[Home] [Help]
PACKAGE BODY: APPS.XLA_00140_AAD_S_000018_PKG
Source
1 PACKAGE BODY XLA_00140_AAD_S_000018_PKG AS
2 --
3 /*======================================================================+
4 | Copyright (c) 1997 Oracle Corporation |
5 | Redwood Shores, CA, USA |
6 | All rights reserved. |
7 +=======================================================================+
8 | Package Name |
9 | XLA_00140_AAD_S_000018_PKG |
10 | |
11 | DESCRIPTION |
12 | Package generated From Product Accounting Definition |
13 | Name : Inflation Standard Accounting |
14 | Code : IAC_STANDARD_ACCOUNTING |
15 | Owner : PRODUCT |
16 | Version : |
17 | AMB Context Code: DEFAULT |
18 | HISTORY |
19 | Generated at 30-03-2009 at 05:03:38 by user ANONYMOUS |
20 +=======================================================================*/
21 --
22 --
23 TYPE t_rec_array_event IS RECORD
24 (array_legal_entity_id XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num
25 ,array_entity_id XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num
26 ,array_entity_code XLA_AE_JOURNAL_ENTRY_PKG.t_array_V30L
27 ,array_transaction_num XLA_AE_JOURNAL_ENTRY_PKG.t_array_V240L
28 ,array_event_id xla_number_array_type --XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num
29 ,array_class_code XLA_AE_JOURNAL_ENTRY_PKG.t_array_V30L
30 ,array_event_type XLA_AE_JOURNAL_ENTRY_PKG.t_array_V30L
31 ,array_event_number XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num
32 ,array_event_date XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date
33 ,array_reference_num_1 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num
34 ,array_reference_num_2 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num
35 ,array_reference_num_3 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num
36 ,array_reference_num_4 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Num
37 ,array_reference_char_1 XLA_AE_JOURNAL_ENTRY_PKG.t_array_V240L
38 ,array_reference_char_2 XLA_AE_JOURNAL_ENTRY_PKG.t_array_V240L
39 ,array_reference_char_3 XLA_AE_JOURNAL_ENTRY_PKG.t_array_V240L
40 ,array_reference_char_4 XLA_AE_JOURNAL_ENTRY_PKG.t_array_V240L
41 ,array_reference_date_1 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date
42 ,array_reference_date_2 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date
43 ,array_reference_date_3 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date
44 ,array_reference_date_4 XLA_AE_JOURNAL_ENTRY_PKG.t_array_Date
45 ,array_event_created_by XLA_AE_JOURNAL_ENTRY_PKG.t_array_V100L
46 );
47 --
48 type t_array_value_num is table of number index by varchar2(30);
49 type t_array_value_char is table of varchar2(240) index by varchar2(30);
50 type t_array_value_date is table of date index by varchar2(30);
51
52 type t_rec_value is record
53 (array_value_num t_array_value_num
54 ,array_value_char t_array_value_char
55 ,array_value_date t_array_value_date);
56
57 type t_array_event is table of t_rec_value index by binary_integer;
58
59 g_array_event t_array_event;
60
61 --=============================================================================
62 -- *********** Diagnostics **********
63 --=============================================================================
64
65 g_diagnostics_mode VARCHAR2(1);
66 g_last_hdr_idx NUMBER; -- 4262811 MPA
67 g_hdr_extract_count PLS_INTEGER;
68
69 --=============================================================================
70 -- *********** Local Trace Routine **********
71 --=============================================================================
72
73 C_LEVEL_STATEMENT CONSTANT NUMBER := FND_LOG.LEVEL_STATEMENT;
74 C_LEVEL_PROCEDURE CONSTANT NUMBER := FND_LOG.LEVEL_PROCEDURE;
75 C_LEVEL_EVENT CONSTANT NUMBER := FND_LOG.LEVEL_EVENT;
76 C_LEVEL_EXCEPTION CONSTANT NUMBER := FND_LOG.LEVEL_EXCEPTION;
77 C_LEVEL_ERROR CONSTANT NUMBER := FND_LOG.LEVEL_ERROR;
78 C_LEVEL_UNEXPECTED CONSTANT NUMBER := FND_LOG.LEVEL_UNEXPECTED;
79
80 C_LEVEL_LOG_DISABLED CONSTANT NUMBER := 99;
81 C_DEFAULT_MODULE CONSTANT VARCHAR2(240) := 'xla.plsql.XLA_00140_AAD_S_000018_PKG';
82
83 C_CHAR CONSTANT VARCHAR2(30) := fnd_global.local_chr(12); -- 4219869 Business flow
84 C_NUM CONSTANT NUMBER := 9.99E125; -- 4219869 Business flow
85
86 g_log_level NUMBER;
87 g_log_enabled BOOLEAN;
88
89 PROCEDURE trace
90 (p_msg IN VARCHAR2
91 ,p_level IN NUMBER
92 ,p_module IN VARCHAR2 ) IS
93 BEGIN
94 ----------------------------------------------------------------------------
95 -- Following is for FND log.
96 ----------------------------------------------------------------------------
97 IF (p_msg IS NULL AND p_level >= g_log_level) THEN
98 fnd_log.message(p_level, p_module);
99 ELSIF p_level >= g_log_level THEN
100 fnd_log.string(p_level, p_module, p_msg);
101 END IF;
102
103 EXCEPTION
104 WHEN xla_exceptions_pkg.application_exception THEN
105 RAISE;
106 WHEN OTHERS THEN
107 xla_exceptions_pkg.raise_message
108 (p_location => 'XLA_00140_AAD_S_000018_PKG.trace');
109 END trace;
110
111 --
112 --+============================================+
113 --| |
114 --| PRIVATE PROCEDURES/FUNCTIONS |
115 --| |
116 --+============================================+
117 --
118
119 --
120 /*======================================================================+
121 | |
122 | Private Function |
123 | ValidateLookupMeaning |
124 | |
125 +======================================================================*/
126 FUNCTION ValidateLookupMeaning(
127 p_meaning IN VARCHAR2
128 , p_lookup_code IN VARCHAR2
129 , p_lookup_type IN VARCHAR2
130 , p_source_code IN VARCHAR2
131 , p_source_type_code IN VARCHAR2
132 , p_source_application_id IN INTEGER
133 )
134 RETURN VARCHAR2
135 IS
136 l_log_module VARCHAR2(240);
137 BEGIN
138 IF g_log_enabled THEN
139 l_log_module := C_DEFAULT_MODULE||'.ValidateLookupMeaning';
140 END IF;
141 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
142 trace
143 (p_msg => 'BEGIN of ValidateLookupMeaning'
144 ,p_level => C_LEVEL_PROCEDURE
145 ,p_module => l_log_module);
146 END IF;
147 --
148 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
149 trace
150 (p_msg => 'p_source_code = '|| p_source_code||
151 ' - p_source_type_code = '|| p_source_type_code||
152 ' - p_source_application_id = '|| p_source_application_id||
153 ' - p_lookup_code = '|| p_lookup_code||
154 ' - p_lookup_type = '|| p_lookup_type||
155 ' - p_meaning = '|| p_meaning
156 ,p_level => C_LEVEL_PROCEDURE
157 ,p_module => l_log_module);
158
159 END IF;
160
161 IF p_lookup_code IS NOT NULL AND p_meaning IS NULL THEN
162 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
163 xla_accounting_err_pkg. build_message
164 (p_appli_s_name => 'XLA'
165 ,p_msg_name => 'XLA_AP_NO_LOOKUP_MEANING'
166 ,p_token_1 => 'SOURCE_NAME'
167 ,p_value_1 => xla_ae_sources_pkg.GetSourceName(
168 p_source_code
169 , p_source_type_code
170 , p_source_application_id
171 )
172 ,p_token_2 => 'LOOKUP_CODE'
173 ,p_value_2 => p_lookup_code
174 ,p_token_3 => 'LOOKUP_TYPE'
175 ,p_value_3 => p_lookup_type
176 ,p_token_4 => 'PRODUCT_NAME'
177 ,p_value_4 => xla_ae_journal_entry_pkg.g_cache_event.application_name
178 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
179 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
180 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
181 );
182
183 IF (C_LEVEL_ERROR >= g_log_level) THEN
184 trace
185 (p_msg => 'ERROR: XLA_AP_NO_LOOKUP_MEANING'
186 ,p_level => C_LEVEL_ERROR
187 ,p_module => l_log_module);
188 END IF;
189 END IF;
190
191 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
192 trace
193 (p_msg => 'END of ValidateLookupMeaning'
194 ,p_level => C_LEVEL_PROCEDURE
195 ,p_module => l_log_module);
196 END IF;
197 RETURN p_meaning;
198 EXCEPTION
199 WHEN xla_exceptions_pkg.application_exception THEN
200 RETURN p_meaning;
201 WHEN OTHERS THEN
202 xla_exceptions_pkg.raise_message
203 (p_location => 'XLA_00140_AAD_S_000018_PKG.ValidateLookupMeaning');
204 --
205 END ValidateLookupMeaning;
206 --
207 --
208
209 FUNCTION GetMeaning (
210 p_flex_value_set_id IN INTEGER
211 , p_flex_value IN VARCHAR2
212 , p_source_code IN VARCHAR2
213 , p_source_type_code IN VARCHAR2
214 , p_source_application_id IN INTEGER
215 )
216 RETURN VARCHAR2
217 IS
218 BEGIN
219 --
220 RETURN NULL ;
221 --
222 EXCEPTION
223 WHEN xla_exceptions_pkg.application_exception THEN
224 RAISE;
225 WHEN OTHERS THEN
226 xla_exceptions_pkg.raise_message
227 (p_location => 'XLA_00140_AAD_S_000018_PKG.GetMeaning');
228 END GetMeaning;
229 --
230
231 ---------------------------------------
232 --
233 -- PRIVATE FUNCTION
234 -- Description_1
235 --
236 ---------------------------------------
237 FUNCTION Description_1 (
238 p_application_id IN NUMBER
239 , p_ae_header_id IN NUMBER DEFAULT NULL
240 --Period Close Date
241 , p_source_1 IN DATE
242 )
243 RETURN VARCHAR2
244 IS
245 l_component_type VARCHAR2(80) ;
246 l_component_code VARCHAR2(30) ;
247 l_component_type_code VARCHAR2(1) ;
248 l_component_appl_id INTEGER ;
249 l_amb_context_code VARCHAR2(30) ;
250 l_ledger_language VARCHAR2(30) ;
251 l_source VARCHAR2(1996) ;
252 l_description VARCHAR2(2000) ;
253 l_log_module VARCHAR2(240) ;
254 BEGIN
255 IF g_log_enabled THEN
256 l_log_module := C_DEFAULT_MODULE||'.Description_1';
257 END IF;
258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
259 trace
260 (p_msg => 'BEGIN of Description_1'
261 ,p_level => C_LEVEL_PROCEDURE
262 ,p_module => l_log_module);
263 END IF;
264
265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
266 l_component_type := 'AMB_DESCRIPTION';
267 l_component_code := 'FA_ADDITION';
268 l_component_type_code := 'S';
269 l_component_appl_id := 140;
270 l_amb_context_code := 'DEFAULT';
271 l_source := NULL;
272 l_description := NULL;
273
274
275
276 IF
277 l_ledger_language = 'US' THEN
278 l_description := SUBSTR(CONCAT(l_description,'Addition'),1,2000);
279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
280 END IF;
281 IF
282 l_ledger_language = 'US' THEN
283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
285 END IF;
286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
288 IF l_source IS NOT NULL THEN
289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
291 END IF;
292 l_description := SUBSTR(l_description,1,1996);
293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
294 trace
295 (p_msg => 'END of Description_1'
296 ,p_level => C_LEVEL_PROCEDURE
297 ,p_module => l_log_module);
298
299 END IF;
300 RETURN l_description;
301
302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
303 trace
304 (p_msg => 'END of Description_1'
305 ,p_level => C_LEVEL_PROCEDURE
306 ,p_module => l_log_module);
307 END IF;
308 RETURN NULL;
309 EXCEPTION
310 WHEN VALUE_ERROR THEN
311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
312 trace
313 (p_msg => 'ERROR: '||sqlerrm
314 ,p_level => C_LEVEL_EXCEPTION
315 ,p_module => l_log_module);
316 END IF;
317 RAISE;
318 WHEN xla_exceptions_pkg.application_exception THEN
319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
320 trace
321 (p_msg => 'ERROR: '||sqlerrm
322 ,p_level => C_LEVEL_EXCEPTION
323 ,p_module => l_log_module);
324 END IF;
325 RAISE;
326 WHEN OTHERS THEN
327 xla_exceptions_pkg.raise_message
328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_1');
329 END Description_1;
330
331 ---------------------------------------
332 --
333 -- PRIVATE FUNCTION
334 -- Description_2
335 --
336 ---------------------------------------
337 FUNCTION Description_2 (
338 p_application_id IN NUMBER
339 , p_ae_header_id IN NUMBER DEFAULT NULL
340 --Period Close Date
341 , p_source_1 IN DATE
342 )
343 RETURN VARCHAR2
344 IS
345 l_component_type VARCHAR2(80) ;
346 l_component_code VARCHAR2(30) ;
347 l_component_type_code VARCHAR2(1) ;
348 l_component_appl_id INTEGER ;
349 l_amb_context_code VARCHAR2(30) ;
350 l_ledger_language VARCHAR2(30) ;
351 l_source VARCHAR2(1996) ;
352 l_description VARCHAR2(2000) ;
353 l_log_module VARCHAR2(240) ;
354 BEGIN
355 IF g_log_enabled THEN
356 l_log_module := C_DEFAULT_MODULE||'.Description_2';
357 END IF;
358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
359 trace
360 (p_msg => 'BEGIN of Description_2'
361 ,p_level => C_LEVEL_PROCEDURE
362 ,p_module => l_log_module);
363 END IF;
364
365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
369 l_component_appl_id := 140;
366 l_component_type := 'AMB_DESCRIPTION';
367 l_component_code := 'FA_ADDITION_BONUS_EXP';
368 l_component_type_code := 'S';
370 l_amb_context_code := 'DEFAULT';
371 l_source := NULL;
372 l_description := NULL;
373
374
375
376 IF
377 l_ledger_language = 'US' THEN
378 l_description := SUBSTR(CONCAT(l_description,'Addition Bonus Depreciation Expense'),1,2000);
379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
380 END IF;
381 IF
382 l_ledger_language = 'US' THEN
383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
385 END IF;
386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
388 IF l_source IS NOT NULL THEN
389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
391 END IF;
392 l_description := SUBSTR(l_description,1,1996);
393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
394 trace
395 (p_msg => 'END of Description_2'
396 ,p_level => C_LEVEL_PROCEDURE
397 ,p_module => l_log_module);
398
399 END IF;
400 RETURN l_description;
401
402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
403 trace
404 (p_msg => 'END of Description_2'
405 ,p_level => C_LEVEL_PROCEDURE
406 ,p_module => l_log_module);
407 END IF;
408 RETURN NULL;
409 EXCEPTION
410 WHEN VALUE_ERROR THEN
411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
412 trace
413 (p_msg => 'ERROR: '||sqlerrm
414 ,p_level => C_LEVEL_EXCEPTION
415 ,p_module => l_log_module);
416 END IF;
417 RAISE;
418 WHEN xla_exceptions_pkg.application_exception THEN
419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
420 trace
421 (p_msg => 'ERROR: '||sqlerrm
422 ,p_level => C_LEVEL_EXCEPTION
423 ,p_module => l_log_module);
424 END IF;
425 RAISE;
426 WHEN OTHERS THEN
427 xla_exceptions_pkg.raise_message
428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_2');
429 END Description_2;
430
431 ---------------------------------------
432 --
433 -- PRIVATE FUNCTION
434 -- Description_3
435 --
436 ---------------------------------------
437 FUNCTION Description_3 (
438 p_application_id IN NUMBER
439 , p_ae_header_id IN NUMBER DEFAULT NULL
440 --Period Close Date
441 , p_source_1 IN DATE
442 )
443 RETURN VARCHAR2
444 IS
445 l_component_type VARCHAR2(80) ;
446 l_component_code VARCHAR2(30) ;
447 l_component_type_code VARCHAR2(1) ;
448 l_component_appl_id INTEGER ;
449 l_amb_context_code VARCHAR2(30) ;
450 l_ledger_language VARCHAR2(30) ;
451 l_source VARCHAR2(1996) ;
452 l_description VARCHAR2(2000) ;
453 l_log_module VARCHAR2(240) ;
454 BEGIN
455 IF g_log_enabled THEN
456 l_log_module := C_DEFAULT_MODULE||'.Description_3';
457 END IF;
458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
459 trace
460 (p_msg => 'BEGIN of Description_3'
461 ,p_level => C_LEVEL_PROCEDURE
462 ,p_module => l_log_module);
463 END IF;
464
465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
466 l_component_type := 'AMB_DESCRIPTION';
467 l_component_code := 'FA_ADDITION_BONUS_RESERVE';
468 l_component_type_code := 'S';
469 l_component_appl_id := 140;
470 l_amb_context_code := 'DEFAULT';
471 l_source := NULL;
472 l_description := NULL;
473
474
475
476 IF
477 l_ledger_language = 'US' THEN
478 l_description := SUBSTR(CONCAT(l_description,'Addition Bonus Depreciation Reserve'),1,2000);
479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
480 END IF;
481 IF
482 l_ledger_language = 'US' THEN
483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
485 END IF;
486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
488 IF l_source IS NOT NULL THEN
489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
491 END IF;
492 l_description := SUBSTR(l_description,1,1996);
493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
494 trace
495 (p_msg => 'END of Description_3'
496 ,p_level => C_LEVEL_PROCEDURE
497 ,p_module => l_log_module);
498
499 END IF;
500 RETURN l_description;
501
502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
503 trace
504 (p_msg => 'END of Description_3'
508 RETURN NULL;
505 ,p_level => C_LEVEL_PROCEDURE
506 ,p_module => l_log_module);
507 END IF;
509 EXCEPTION
510 WHEN VALUE_ERROR THEN
511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
512 trace
513 (p_msg => 'ERROR: '||sqlerrm
514 ,p_level => C_LEVEL_EXCEPTION
515 ,p_module => l_log_module);
516 END IF;
517 RAISE;
518 WHEN xla_exceptions_pkg.application_exception THEN
519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
520 trace
521 (p_msg => 'ERROR: '||sqlerrm
522 ,p_level => C_LEVEL_EXCEPTION
523 ,p_module => l_log_module);
524 END IF;
525 RAISE;
526 WHEN OTHERS THEN
527 xla_exceptions_pkg.raise_message
528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_3');
529 END Description_3;
530
531 ---------------------------------------
532 --
533 -- PRIVATE FUNCTION
534 -- Description_4
535 --
536 ---------------------------------------
537 FUNCTION Description_4 (
538 p_application_id IN NUMBER
539 , p_ae_header_id IN NUMBER DEFAULT NULL
540 --Period Close Date
541 , p_source_1 IN DATE
542 )
543 RETURN VARCHAR2
544 IS
545 l_component_type VARCHAR2(80) ;
546 l_component_code VARCHAR2(30) ;
547 l_component_type_code VARCHAR2(1) ;
548 l_component_appl_id INTEGER ;
549 l_amb_context_code VARCHAR2(30) ;
550 l_ledger_language VARCHAR2(30) ;
551 l_source VARCHAR2(1996) ;
552 l_description VARCHAR2(2000) ;
553 l_log_module VARCHAR2(240) ;
554 BEGIN
555 IF g_log_enabled THEN
556 l_log_module := C_DEFAULT_MODULE||'.Description_4';
557 END IF;
558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
559 trace
560 (p_msg => 'BEGIN of Description_4'
561 ,p_level => C_LEVEL_PROCEDURE
562 ,p_module => l_log_module);
563 END IF;
564
565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
566 l_component_type := 'AMB_DESCRIPTION';
567 l_component_code := 'FA_ADDITION_COST';
568 l_component_type_code := 'S';
569 l_component_appl_id := 140;
570 l_amb_context_code := 'DEFAULT';
571 l_source := NULL;
572 l_description := NULL;
573
574
575
576 IF
577 l_ledger_language = 'US' THEN
578 l_description := SUBSTR(CONCAT(l_description,'Addition Cost'),1,2000);
579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
580 END IF;
581 IF
582 l_ledger_language = 'US' THEN
583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
585 END IF;
586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
588 IF l_source IS NOT NULL THEN
589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
591 END IF;
592 l_description := SUBSTR(l_description,1,1996);
593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
594 trace
595 (p_msg => 'END of Description_4'
596 ,p_level => C_LEVEL_PROCEDURE
597 ,p_module => l_log_module);
598
599 END IF;
600 RETURN l_description;
601
602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
603 trace
604 (p_msg => 'END of Description_4'
605 ,p_level => C_LEVEL_PROCEDURE
606 ,p_module => l_log_module);
607 END IF;
608 RETURN NULL;
609 EXCEPTION
610 WHEN VALUE_ERROR THEN
611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
612 trace
613 (p_msg => 'ERROR: '||sqlerrm
614 ,p_level => C_LEVEL_EXCEPTION
615 ,p_module => l_log_module);
616 END IF;
617 RAISE;
618 WHEN xla_exceptions_pkg.application_exception THEN
619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
620 trace
621 (p_msg => 'ERROR: '||sqlerrm
622 ,p_level => C_LEVEL_EXCEPTION
623 ,p_module => l_log_module);
624 END IF;
625 RAISE;
626 WHEN OTHERS THEN
627 xla_exceptions_pkg.raise_message
628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_4');
629 END Description_4;
630
631 ---------------------------------------
632 --
633 -- PRIVATE FUNCTION
634 -- Description_5
635 --
636 ---------------------------------------
637 FUNCTION Description_5 (
638 p_application_id IN NUMBER
639 , p_ae_header_id IN NUMBER DEFAULT NULL
640 --Period Close Date
641 , p_source_1 IN DATE
642 )
643 RETURN VARCHAR2
644 IS
645 l_component_type VARCHAR2(80) ;
646 l_component_code VARCHAR2(30) ;
647 l_component_type_code VARCHAR2(1) ;
648 l_component_appl_id INTEGER ;
649 l_amb_context_code VARCHAR2(30) ;
653 l_log_module VARCHAR2(240) ;
650 l_ledger_language VARCHAR2(30) ;
651 l_source VARCHAR2(1996) ;
652 l_description VARCHAR2(2000) ;
654 BEGIN
655 IF g_log_enabled THEN
656 l_log_module := C_DEFAULT_MODULE||'.Description_5';
657 END IF;
658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
659 trace
660 (p_msg => 'BEGIN of Description_5'
661 ,p_level => C_LEVEL_PROCEDURE
662 ,p_module => l_log_module);
663 END IF;
664
665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
666 l_component_type := 'AMB_DESCRIPTION';
667 l_component_code := 'FA_ADDITION_COST_CLEARING';
668 l_component_type_code := 'S';
669 l_component_appl_id := 140;
670 l_amb_context_code := 'DEFAULT';
671 l_source := NULL;
672 l_description := NULL;
673
674
675
676 IF
677 l_ledger_language = 'US' THEN
678 l_description := SUBSTR(CONCAT(l_description,'Addition Cost Clearing'),1,2000);
679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
680 END IF;
681 IF
682 l_ledger_language = 'US' THEN
683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
685 END IF;
686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
688 IF l_source IS NOT NULL THEN
689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
691 END IF;
692 l_description := SUBSTR(l_description,1,1996);
693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
694 trace
695 (p_msg => 'END of Description_5'
696 ,p_level => C_LEVEL_PROCEDURE
697 ,p_module => l_log_module);
698
699 END IF;
700 RETURN l_description;
701
702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
703 trace
704 (p_msg => 'END of Description_5'
705 ,p_level => C_LEVEL_PROCEDURE
706 ,p_module => l_log_module);
707 END IF;
708 RETURN NULL;
709 EXCEPTION
710 WHEN VALUE_ERROR THEN
711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
712 trace
713 (p_msg => 'ERROR: '||sqlerrm
714 ,p_level => C_LEVEL_EXCEPTION
715 ,p_module => l_log_module);
716 END IF;
717 RAISE;
718 WHEN xla_exceptions_pkg.application_exception THEN
719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
720 trace
721 (p_msg => 'ERROR: '||sqlerrm
722 ,p_level => C_LEVEL_EXCEPTION
723 ,p_module => l_log_module);
724 END IF;
725 RAISE;
726 WHEN OTHERS THEN
727 xla_exceptions_pkg.raise_message
728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_5');
729 END Description_5;
730
731 ---------------------------------------
732 --
733 -- PRIVATE FUNCTION
734 -- Description_6
735 --
736 ---------------------------------------
737 FUNCTION Description_6 (
738 p_application_id IN NUMBER
739 , p_ae_header_id IN NUMBER DEFAULT NULL
740 --Period Close Date
741 , p_source_1 IN DATE
742 )
743 RETURN VARCHAR2
744 IS
745 l_component_type VARCHAR2(80) ;
746 l_component_code VARCHAR2(30) ;
747 l_component_type_code VARCHAR2(1) ;
748 l_component_appl_id INTEGER ;
749 l_amb_context_code VARCHAR2(30) ;
750 l_ledger_language VARCHAR2(30) ;
751 l_source VARCHAR2(1996) ;
752 l_description VARCHAR2(2000) ;
753 l_log_module VARCHAR2(240) ;
754 BEGIN
755 IF g_log_enabled THEN
756 l_log_module := C_DEFAULT_MODULE||'.Description_6';
757 END IF;
758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
759 trace
760 (p_msg => 'BEGIN of Description_6'
761 ,p_level => C_LEVEL_PROCEDURE
762 ,p_module => l_log_module);
763 END IF;
764
765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
766 l_component_type := 'AMB_DESCRIPTION';
767 l_component_code := 'FA_ADDITION_EXPENSE';
768 l_component_type_code := 'S';
769 l_component_appl_id := 140;
770 l_amb_context_code := 'DEFAULT';
771 l_source := NULL;
772 l_description := NULL;
773
774
775
776 IF
777 l_ledger_language = 'US' THEN
778 l_description := SUBSTR(CONCAT(l_description,'Addition Depreciation Expense'),1,2000);
779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
780 END IF;
781 IF
782 l_ledger_language = 'US' THEN
783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
785 END IF;
786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
788 IF l_source IS NOT NULL THEN
792 l_description := SUBSTR(l_description,1,1996);
789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
791 END IF;
793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
794 trace
795 (p_msg => 'END of Description_6'
796 ,p_level => C_LEVEL_PROCEDURE
797 ,p_module => l_log_module);
798
799 END IF;
800 RETURN l_description;
801
802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
803 trace
804 (p_msg => 'END of Description_6'
805 ,p_level => C_LEVEL_PROCEDURE
806 ,p_module => l_log_module);
807 END IF;
808 RETURN NULL;
809 EXCEPTION
810 WHEN VALUE_ERROR THEN
811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
812 trace
813 (p_msg => 'ERROR: '||sqlerrm
814 ,p_level => C_LEVEL_EXCEPTION
815 ,p_module => l_log_module);
816 END IF;
817 RAISE;
818 WHEN xla_exceptions_pkg.application_exception THEN
819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
820 trace
821 (p_msg => 'ERROR: '||sqlerrm
822 ,p_level => C_LEVEL_EXCEPTION
823 ,p_module => l_log_module);
824 END IF;
825 RAISE;
826 WHEN OTHERS THEN
827 xla_exceptions_pkg.raise_message
828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_6');
829 END Description_6;
830
831 ---------------------------------------
832 --
833 -- PRIVATE FUNCTION
834 -- Description_7
835 --
836 ---------------------------------------
837 FUNCTION Description_7 (
838 p_application_id IN NUMBER
839 , p_ae_header_id IN NUMBER DEFAULT NULL
840 --Period Close Date
841 , p_source_1 IN DATE
842 )
843 RETURN VARCHAR2
844 IS
845 l_component_type VARCHAR2(80) ;
846 l_component_code VARCHAR2(30) ;
847 l_component_type_code VARCHAR2(1) ;
848 l_component_appl_id INTEGER ;
849 l_amb_context_code VARCHAR2(30) ;
850 l_ledger_language VARCHAR2(30) ;
851 l_source VARCHAR2(1996) ;
852 l_description VARCHAR2(2000) ;
853 l_log_module VARCHAR2(240) ;
854 BEGIN
855 IF g_log_enabled THEN
856 l_log_module := C_DEFAULT_MODULE||'.Description_7';
857 END IF;
858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
859 trace
860 (p_msg => 'BEGIN of Description_7'
861 ,p_level => C_LEVEL_PROCEDURE
862 ,p_module => l_log_module);
863 END IF;
864
865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
866 l_component_type := 'AMB_DESCRIPTION';
867 l_component_code := 'FA_ADDITION_RESERVE';
868 l_component_type_code := 'S';
869 l_component_appl_id := 140;
870 l_amb_context_code := 'DEFAULT';
871 l_source := NULL;
872 l_description := NULL;
873
874
875
876 IF
877 l_ledger_language = 'US' THEN
878 l_description := SUBSTR(CONCAT(l_description,'Addition Depreciation Reserve'),1,2000);
879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
880 END IF;
881 IF
882 l_ledger_language = 'US' THEN
883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
885 END IF;
886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
888 IF l_source IS NOT NULL THEN
889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
891 END IF;
892 l_description := SUBSTR(l_description,1,1996);
893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
894 trace
895 (p_msg => 'END of Description_7'
896 ,p_level => C_LEVEL_PROCEDURE
897 ,p_module => l_log_module);
898
899 END IF;
900 RETURN l_description;
901
902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
903 trace
904 (p_msg => 'END of Description_7'
905 ,p_level => C_LEVEL_PROCEDURE
906 ,p_module => l_log_module);
907 END IF;
908 RETURN NULL;
909 EXCEPTION
910 WHEN VALUE_ERROR THEN
911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
912 trace
913 (p_msg => 'ERROR: '||sqlerrm
914 ,p_level => C_LEVEL_EXCEPTION
915 ,p_module => l_log_module);
916 END IF;
917 RAISE;
918 WHEN xla_exceptions_pkg.application_exception THEN
919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
920 trace
921 (p_msg => 'ERROR: '||sqlerrm
922 ,p_level => C_LEVEL_EXCEPTION
923 ,p_module => l_log_module);
924 END IF;
925 RAISE;
926 WHEN OTHERS THEN
927 xla_exceptions_pkg.raise_message
928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_7');
929 END Description_7;
930
931 ---------------------------------------
935 --
932 --
933 -- PRIVATE FUNCTION
934 -- Description_8
936 ---------------------------------------
937 FUNCTION Description_8 (
938 p_application_id IN NUMBER
939 , p_ae_header_id IN NUMBER DEFAULT NULL
940 --Period Close Date
941 , p_source_1 IN DATE
942 )
943 RETURN VARCHAR2
944 IS
945 l_component_type VARCHAR2(80) ;
946 l_component_code VARCHAR2(30) ;
947 l_component_type_code VARCHAR2(1) ;
948 l_component_appl_id INTEGER ;
949 l_amb_context_code VARCHAR2(30) ;
950 l_ledger_language VARCHAR2(30) ;
951 l_source VARCHAR2(1996) ;
952 l_description VARCHAR2(2000) ;
953 l_log_module VARCHAR2(240) ;
954 BEGIN
955 IF g_log_enabled THEN
956 l_log_module := C_DEFAULT_MODULE||'.Description_8';
957 END IF;
958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
959 trace
960 (p_msg => 'BEGIN of Description_8'
961 ,p_level => C_LEVEL_PROCEDURE
962 ,p_module => l_log_module);
963 END IF;
964
965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
966 l_component_type := 'AMB_DESCRIPTION';
967 l_component_code := 'FA_ADJUSTMENT_BONUS_EXP';
968 l_component_type_code := 'S';
969 l_component_appl_id := 140;
970 l_amb_context_code := 'DEFAULT';
971 l_source := NULL;
972 l_description := NULL;
973
974
975
976 IF
977 l_ledger_language = 'US' THEN
978 l_description := SUBSTR(CONCAT(l_description,'Adjustment Bonus Depreciation Expense'),1,2000);
979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
980 END IF;
981 IF
982 l_ledger_language = 'US' THEN
983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
985 END IF;
986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
988 IF l_source IS NOT NULL THEN
989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
991 END IF;
992 l_description := SUBSTR(l_description,1,1996);
993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
994 trace
995 (p_msg => 'END of Description_8'
996 ,p_level => C_LEVEL_PROCEDURE
997 ,p_module => l_log_module);
998
999 END IF;
1000 RETURN l_description;
1001
1002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1003 trace
1004 (p_msg => 'END of Description_8'
1005 ,p_level => C_LEVEL_PROCEDURE
1006 ,p_module => l_log_module);
1007 END IF;
1008 RETURN NULL;
1009 EXCEPTION
1010 WHEN VALUE_ERROR THEN
1011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1012 trace
1013 (p_msg => 'ERROR: '||sqlerrm
1014 ,p_level => C_LEVEL_EXCEPTION
1015 ,p_module => l_log_module);
1016 END IF;
1017 RAISE;
1018 WHEN xla_exceptions_pkg.application_exception THEN
1019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1020 trace
1021 (p_msg => 'ERROR: '||sqlerrm
1022 ,p_level => C_LEVEL_EXCEPTION
1023 ,p_module => l_log_module);
1024 END IF;
1025 RAISE;
1026 WHEN OTHERS THEN
1027 xla_exceptions_pkg.raise_message
1028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_8');
1029 END Description_8;
1030
1031 ---------------------------------------
1032 --
1033 -- PRIVATE FUNCTION
1034 -- Description_9
1035 --
1036 ---------------------------------------
1037 FUNCTION Description_9 (
1038 p_application_id IN NUMBER
1039 , p_ae_header_id IN NUMBER DEFAULT NULL
1040 --Period Close Date
1041 , p_source_1 IN DATE
1042 )
1043 RETURN VARCHAR2
1044 IS
1045 l_component_type VARCHAR2(80) ;
1046 l_component_code VARCHAR2(30) ;
1047 l_component_type_code VARCHAR2(1) ;
1048 l_component_appl_id INTEGER ;
1049 l_amb_context_code VARCHAR2(30) ;
1050 l_ledger_language VARCHAR2(30) ;
1051 l_source VARCHAR2(1996) ;
1052 l_description VARCHAR2(2000) ;
1053 l_log_module VARCHAR2(240) ;
1054 BEGIN
1055 IF g_log_enabled THEN
1056 l_log_module := C_DEFAULT_MODULE||'.Description_9';
1057 END IF;
1058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1059 trace
1060 (p_msg => 'BEGIN of Description_9'
1061 ,p_level => C_LEVEL_PROCEDURE
1062 ,p_module => l_log_module);
1063 END IF;
1064
1065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
1066 l_component_type := 'AMB_DESCRIPTION';
1067 l_component_code := 'FA_ADJUSTMENT_BONUS_RESERVE';
1068 l_component_type_code := 'S';
1069 l_component_appl_id := 140;
1070 l_amb_context_code := 'DEFAULT';
1071 l_source := NULL;
1072 l_description := NULL;
1073
1074
1075
1076 IF
1080 END IF;
1077 l_ledger_language = 'US' THEN
1078 l_description := SUBSTR(CONCAT(l_description,'Adjustment Bonus Depreciation Reserve'),1,2000);
1079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1081 IF
1082 l_ledger_language = 'US' THEN
1083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
1084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1085 END IF;
1086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
1087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
1088 IF l_source IS NOT NULL THEN
1089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
1090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1091 END IF;
1092 l_description := SUBSTR(l_description,1,1996);
1093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1094 trace
1095 (p_msg => 'END of Description_9'
1096 ,p_level => C_LEVEL_PROCEDURE
1097 ,p_module => l_log_module);
1098
1099 END IF;
1100 RETURN l_description;
1101
1102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1103 trace
1104 (p_msg => 'END of Description_9'
1105 ,p_level => C_LEVEL_PROCEDURE
1106 ,p_module => l_log_module);
1107 END IF;
1108 RETURN NULL;
1109 EXCEPTION
1110 WHEN VALUE_ERROR THEN
1111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1112 trace
1113 (p_msg => 'ERROR: '||sqlerrm
1114 ,p_level => C_LEVEL_EXCEPTION
1115 ,p_module => l_log_module);
1116 END IF;
1117 RAISE;
1118 WHEN xla_exceptions_pkg.application_exception THEN
1119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1120 trace
1121 (p_msg => 'ERROR: '||sqlerrm
1122 ,p_level => C_LEVEL_EXCEPTION
1123 ,p_module => l_log_module);
1124 END IF;
1125 RAISE;
1126 WHEN OTHERS THEN
1127 xla_exceptions_pkg.raise_message
1128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_9');
1129 END Description_9;
1130
1131 ---------------------------------------
1132 --
1133 -- PRIVATE FUNCTION
1134 -- Description_10
1135 --
1136 ---------------------------------------
1137 FUNCTION Description_10 (
1138 p_application_id IN NUMBER
1139 , p_ae_header_id IN NUMBER DEFAULT NULL
1140 --Period Close Date
1141 , p_source_1 IN DATE
1142 )
1143 RETURN VARCHAR2
1144 IS
1145 l_component_type VARCHAR2(80) ;
1146 l_component_code VARCHAR2(30) ;
1147 l_component_type_code VARCHAR2(1) ;
1148 l_component_appl_id INTEGER ;
1149 l_amb_context_code VARCHAR2(30) ;
1150 l_ledger_language VARCHAR2(30) ;
1151 l_source VARCHAR2(1996) ;
1152 l_description VARCHAR2(2000) ;
1153 l_log_module VARCHAR2(240) ;
1154 BEGIN
1155 IF g_log_enabled THEN
1156 l_log_module := C_DEFAULT_MODULE||'.Description_10';
1157 END IF;
1158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1159 trace
1160 (p_msg => 'BEGIN of Description_10'
1161 ,p_level => C_LEVEL_PROCEDURE
1162 ,p_module => l_log_module);
1163 END IF;
1164
1165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
1166 l_component_type := 'AMB_DESCRIPTION';
1167 l_component_code := 'FA_ADJUSTMENT_COST';
1168 l_component_type_code := 'S';
1169 l_component_appl_id := 140;
1170 l_amb_context_code := 'DEFAULT';
1171 l_source := NULL;
1172 l_description := NULL;
1173
1174
1175
1176 IF
1177 l_ledger_language = 'US' THEN
1178 l_description := SUBSTR(CONCAT(l_description,'Adjustment Cost'),1,2000);
1179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1180 END IF;
1181 IF
1182 l_ledger_language = 'US' THEN
1183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
1184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1185 END IF;
1186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
1187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
1188 IF l_source IS NOT NULL THEN
1189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
1190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1191 END IF;
1192 l_description := SUBSTR(l_description,1,1996);
1193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1194 trace
1195 (p_msg => 'END of Description_10'
1196 ,p_level => C_LEVEL_PROCEDURE
1197 ,p_module => l_log_module);
1198
1199 END IF;
1200 RETURN l_description;
1201
1202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1203 trace
1204 (p_msg => 'END of Description_10'
1205 ,p_level => C_LEVEL_PROCEDURE
1206 ,p_module => l_log_module);
1207 END IF;
1208 RETURN NULL;
1209 EXCEPTION
1210 WHEN VALUE_ERROR THEN
1211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1212 trace
1213 (p_msg => 'ERROR: '||sqlerrm
1214 ,p_level => C_LEVEL_EXCEPTION
1218 WHEN xla_exceptions_pkg.application_exception THEN
1215 ,p_module => l_log_module);
1216 END IF;
1217 RAISE;
1219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1220 trace
1221 (p_msg => 'ERROR: '||sqlerrm
1222 ,p_level => C_LEVEL_EXCEPTION
1223 ,p_module => l_log_module);
1224 END IF;
1225 RAISE;
1226 WHEN OTHERS THEN
1227 xla_exceptions_pkg.raise_message
1228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_10');
1229 END Description_10;
1230
1231 ---------------------------------------
1232 --
1233 -- PRIVATE FUNCTION
1234 -- Description_11
1235 --
1236 ---------------------------------------
1237 FUNCTION Description_11 (
1238 p_application_id IN NUMBER
1239 , p_ae_header_id IN NUMBER DEFAULT NULL
1240 --Period Close Date
1241 , p_source_1 IN DATE
1242 )
1243 RETURN VARCHAR2
1244 IS
1245 l_component_type VARCHAR2(80) ;
1246 l_component_code VARCHAR2(30) ;
1247 l_component_type_code VARCHAR2(1) ;
1248 l_component_appl_id INTEGER ;
1249 l_amb_context_code VARCHAR2(30) ;
1250 l_ledger_language VARCHAR2(30) ;
1251 l_source VARCHAR2(1996) ;
1252 l_description VARCHAR2(2000) ;
1253 l_log_module VARCHAR2(240) ;
1254 BEGIN
1255 IF g_log_enabled THEN
1256 l_log_module := C_DEFAULT_MODULE||'.Description_11';
1257 END IF;
1258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1259 trace
1260 (p_msg => 'BEGIN of Description_11'
1261 ,p_level => C_LEVEL_PROCEDURE
1262 ,p_module => l_log_module);
1263 END IF;
1264
1265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
1266 l_component_type := 'AMB_DESCRIPTION';
1267 l_component_code := 'FA_ADJUSTMENT_COST_CLEARING';
1268 l_component_type_code := 'S';
1269 l_component_appl_id := 140;
1270 l_amb_context_code := 'DEFAULT';
1271 l_source := NULL;
1272 l_description := NULL;
1273
1274
1275
1276 IF
1277 l_ledger_language = 'US' THEN
1278 l_description := SUBSTR(CONCAT(l_description,'Adjustment Cost Clearing'),1,2000);
1279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1280 END IF;
1281 IF
1282 l_ledger_language = 'US' THEN
1283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
1284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1285 END IF;
1286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
1287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
1288 IF l_source IS NOT NULL THEN
1289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
1290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1291 END IF;
1292 l_description := SUBSTR(l_description,1,1996);
1293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1294 trace
1295 (p_msg => 'END of Description_11'
1296 ,p_level => C_LEVEL_PROCEDURE
1297 ,p_module => l_log_module);
1298
1299 END IF;
1300 RETURN l_description;
1301
1302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1303 trace
1304 (p_msg => 'END of Description_11'
1305 ,p_level => C_LEVEL_PROCEDURE
1306 ,p_module => l_log_module);
1307 END IF;
1308 RETURN NULL;
1309 EXCEPTION
1310 WHEN VALUE_ERROR THEN
1311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1312 trace
1313 (p_msg => 'ERROR: '||sqlerrm
1314 ,p_level => C_LEVEL_EXCEPTION
1315 ,p_module => l_log_module);
1316 END IF;
1317 RAISE;
1318 WHEN xla_exceptions_pkg.application_exception THEN
1319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1320 trace
1321 (p_msg => 'ERROR: '||sqlerrm
1322 ,p_level => C_LEVEL_EXCEPTION
1323 ,p_module => l_log_module);
1324 END IF;
1325 RAISE;
1326 WHEN OTHERS THEN
1327 xla_exceptions_pkg.raise_message
1328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_11');
1329 END Description_11;
1330
1331 ---------------------------------------
1332 --
1333 -- PRIVATE FUNCTION
1334 -- Description_12
1335 --
1336 ---------------------------------------
1337 FUNCTION Description_12 (
1338 p_application_id IN NUMBER
1339 , p_ae_header_id IN NUMBER DEFAULT NULL
1340 --Period Close Date
1341 , p_source_1 IN DATE
1342 )
1343 RETURN VARCHAR2
1344 IS
1345 l_component_type VARCHAR2(80) ;
1346 l_component_code VARCHAR2(30) ;
1347 l_component_type_code VARCHAR2(1) ;
1348 l_component_appl_id INTEGER ;
1349 l_amb_context_code VARCHAR2(30) ;
1350 l_ledger_language VARCHAR2(30) ;
1351 l_source VARCHAR2(1996) ;
1352 l_description VARCHAR2(2000) ;
1353 l_log_module VARCHAR2(240) ;
1354 BEGIN
1355 IF g_log_enabled THEN
1356 l_log_module := C_DEFAULT_MODULE||'.Description_12';
1357 END IF;
1358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1359 trace
1360 (p_msg => 'BEGIN of Description_12'
1364
1361 ,p_level => C_LEVEL_PROCEDURE
1362 ,p_module => l_log_module);
1363 END IF;
1365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
1366 l_component_type := 'AMB_DESCRIPTION';
1367 l_component_code := 'FA_ADJUSTMENT_EXP';
1368 l_component_type_code := 'S';
1369 l_component_appl_id := 140;
1370 l_amb_context_code := 'DEFAULT';
1371 l_source := NULL;
1372 l_description := NULL;
1373
1374
1375
1376 IF
1377 l_ledger_language = 'US' THEN
1378 l_description := SUBSTR(CONCAT(l_description,'Adjustment Depreciation Expense'),1,2000);
1379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1380 END IF;
1381 IF
1382 l_ledger_language = 'US' THEN
1383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
1384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1385 END IF;
1386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
1387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
1388 IF l_source IS NOT NULL THEN
1389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
1390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1391 END IF;
1392 l_description := SUBSTR(l_description,1,1996);
1393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1394 trace
1395 (p_msg => 'END of Description_12'
1396 ,p_level => C_LEVEL_PROCEDURE
1397 ,p_module => l_log_module);
1398
1399 END IF;
1400 RETURN l_description;
1401
1402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1403 trace
1404 (p_msg => 'END of Description_12'
1405 ,p_level => C_LEVEL_PROCEDURE
1406 ,p_module => l_log_module);
1407 END IF;
1408 RETURN NULL;
1409 EXCEPTION
1410 WHEN VALUE_ERROR THEN
1411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1412 trace
1413 (p_msg => 'ERROR: '||sqlerrm
1414 ,p_level => C_LEVEL_EXCEPTION
1415 ,p_module => l_log_module);
1416 END IF;
1417 RAISE;
1418 WHEN xla_exceptions_pkg.application_exception THEN
1419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1420 trace
1421 (p_msg => 'ERROR: '||sqlerrm
1422 ,p_level => C_LEVEL_EXCEPTION
1423 ,p_module => l_log_module);
1424 END IF;
1425 RAISE;
1426 WHEN OTHERS THEN
1427 xla_exceptions_pkg.raise_message
1428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_12');
1429 END Description_12;
1430
1431 ---------------------------------------
1432 --
1433 -- PRIVATE FUNCTION
1434 -- Description_13
1435 --
1436 ---------------------------------------
1437 FUNCTION Description_13 (
1438 p_application_id IN NUMBER
1439 , p_ae_header_id IN NUMBER DEFAULT NULL
1440 --Period Close Date
1441 , p_source_1 IN DATE
1442 )
1443 RETURN VARCHAR2
1444 IS
1445 l_component_type VARCHAR2(80) ;
1446 l_component_code VARCHAR2(30) ;
1447 l_component_type_code VARCHAR2(1) ;
1448 l_component_appl_id INTEGER ;
1449 l_amb_context_code VARCHAR2(30) ;
1450 l_ledger_language VARCHAR2(30) ;
1451 l_source VARCHAR2(1996) ;
1452 l_description VARCHAR2(2000) ;
1453 l_log_module VARCHAR2(240) ;
1454 BEGIN
1455 IF g_log_enabled THEN
1456 l_log_module := C_DEFAULT_MODULE||'.Description_13';
1457 END IF;
1458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1459 trace
1460 (p_msg => 'BEGIN of Description_13'
1461 ,p_level => C_LEVEL_PROCEDURE
1462 ,p_module => l_log_module);
1463 END IF;
1464
1465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
1466 l_component_type := 'AMB_DESCRIPTION';
1467 l_component_code := 'FA_ADJUSTMENT_IC_PAY';
1468 l_component_type_code := 'S';
1469 l_component_appl_id := 140;
1470 l_amb_context_code := 'DEFAULT';
1471 l_source := NULL;
1472 l_description := NULL;
1473
1474
1475
1476 IF
1477 l_ledger_language = 'US' THEN
1478 l_description := SUBSTR(CONCAT(l_description,'Adjustment Intercompany Payable'),1,2000);
1479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1480 END IF;
1481 IF
1482 l_ledger_language = 'US' THEN
1483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
1484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1485 END IF;
1486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
1487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
1488 IF l_source IS NOT NULL THEN
1489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
1490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1491 END IF;
1492 l_description := SUBSTR(l_description,1,1996);
1493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1494 trace
1495 (p_msg => 'END of Description_13'
1496 ,p_level => C_LEVEL_PROCEDURE
1500 RETURN l_description;
1497 ,p_module => l_log_module);
1498
1499 END IF;
1501
1502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1503 trace
1504 (p_msg => 'END of Description_13'
1505 ,p_level => C_LEVEL_PROCEDURE
1506 ,p_module => l_log_module);
1507 END IF;
1508 RETURN NULL;
1509 EXCEPTION
1510 WHEN VALUE_ERROR THEN
1511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1512 trace
1513 (p_msg => 'ERROR: '||sqlerrm
1514 ,p_level => C_LEVEL_EXCEPTION
1515 ,p_module => l_log_module);
1516 END IF;
1517 RAISE;
1518 WHEN xla_exceptions_pkg.application_exception THEN
1519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1520 trace
1521 (p_msg => 'ERROR: '||sqlerrm
1522 ,p_level => C_LEVEL_EXCEPTION
1523 ,p_module => l_log_module);
1524 END IF;
1525 RAISE;
1526 WHEN OTHERS THEN
1527 xla_exceptions_pkg.raise_message
1528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_13');
1529 END Description_13;
1530
1531 ---------------------------------------
1532 --
1533 -- PRIVATE FUNCTION
1534 -- Description_14
1535 --
1536 ---------------------------------------
1537 FUNCTION Description_14 (
1538 p_application_id IN NUMBER
1539 , p_ae_header_id IN NUMBER DEFAULT NULL
1540 --Period Close Date
1541 , p_source_1 IN DATE
1542 )
1543 RETURN VARCHAR2
1544 IS
1545 l_component_type VARCHAR2(80) ;
1546 l_component_code VARCHAR2(30) ;
1547 l_component_type_code VARCHAR2(1) ;
1548 l_component_appl_id INTEGER ;
1549 l_amb_context_code VARCHAR2(30) ;
1550 l_ledger_language VARCHAR2(30) ;
1551 l_source VARCHAR2(1996) ;
1552 l_description VARCHAR2(2000) ;
1553 l_log_module VARCHAR2(240) ;
1554 BEGIN
1555 IF g_log_enabled THEN
1556 l_log_module := C_DEFAULT_MODULE||'.Description_14';
1557 END IF;
1558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1559 trace
1560 (p_msg => 'BEGIN of Description_14'
1561 ,p_level => C_LEVEL_PROCEDURE
1562 ,p_module => l_log_module);
1563 END IF;
1564
1565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
1566 l_component_type := 'AMB_DESCRIPTION';
1567 l_component_code := 'FA_ADJUSTMENT_IC_REC';
1568 l_component_type_code := 'S';
1569 l_component_appl_id := 140;
1570 l_amb_context_code := 'DEFAULT';
1571 l_source := NULL;
1572 l_description := NULL;
1573
1574
1575
1576 IF
1577 l_ledger_language = 'US' THEN
1578 l_description := SUBSTR(CONCAT(l_description,'Adjustment Intercompany Receivable'),1,2000);
1579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1580 END IF;
1581 IF
1582 l_ledger_language = 'US' THEN
1583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
1584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1585 END IF;
1586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
1587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
1588 IF l_source IS NOT NULL THEN
1589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
1590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1591 END IF;
1592 l_description := SUBSTR(l_description,1,1996);
1593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1594 trace
1595 (p_msg => 'END of Description_14'
1596 ,p_level => C_LEVEL_PROCEDURE
1597 ,p_module => l_log_module);
1598
1599 END IF;
1600 RETURN l_description;
1601
1602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1603 trace
1604 (p_msg => 'END of Description_14'
1605 ,p_level => C_LEVEL_PROCEDURE
1606 ,p_module => l_log_module);
1607 END IF;
1608 RETURN NULL;
1609 EXCEPTION
1610 WHEN VALUE_ERROR THEN
1611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1612 trace
1613 (p_msg => 'ERROR: '||sqlerrm
1614 ,p_level => C_LEVEL_EXCEPTION
1615 ,p_module => l_log_module);
1616 END IF;
1617 RAISE;
1618 WHEN xla_exceptions_pkg.application_exception THEN
1619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1620 trace
1621 (p_msg => 'ERROR: '||sqlerrm
1622 ,p_level => C_LEVEL_EXCEPTION
1623 ,p_module => l_log_module);
1624 END IF;
1625 RAISE;
1626 WHEN OTHERS THEN
1627 xla_exceptions_pkg.raise_message
1628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_14');
1629 END Description_14;
1630
1631 ---------------------------------------
1632 --
1633 -- PRIVATE FUNCTION
1634 -- Description_15
1635 --
1636 ---------------------------------------
1637 FUNCTION Description_15 (
1638 p_application_id IN NUMBER
1639 , p_ae_header_id IN NUMBER DEFAULT NULL
1640 --Period Close Date
1641 , p_source_1 IN DATE
1642 )
1643 RETURN VARCHAR2
1644 IS
1645 l_component_type VARCHAR2(80) ;
1649 l_amb_context_code VARCHAR2(30) ;
1646 l_component_code VARCHAR2(30) ;
1647 l_component_type_code VARCHAR2(1) ;
1648 l_component_appl_id INTEGER ;
1650 l_ledger_language VARCHAR2(30) ;
1651 l_source VARCHAR2(1996) ;
1652 l_description VARCHAR2(2000) ;
1653 l_log_module VARCHAR2(240) ;
1654 BEGIN
1655 IF g_log_enabled THEN
1656 l_log_module := C_DEFAULT_MODULE||'.Description_15';
1657 END IF;
1658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1659 trace
1660 (p_msg => 'BEGIN of Description_15'
1661 ,p_level => C_LEVEL_PROCEDURE
1662 ,p_module => l_log_module);
1663 END IF;
1664
1665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
1666 l_component_type := 'AMB_DESCRIPTION';
1667 l_component_code := 'FA_ADJUSTMENT_RESERVE';
1668 l_component_type_code := 'S';
1669 l_component_appl_id := 140;
1670 l_amb_context_code := 'DEFAULT';
1671 l_source := NULL;
1672 l_description := NULL;
1673
1674
1675
1676 IF
1677 l_ledger_language = 'US' THEN
1678 l_description := SUBSTR(CONCAT(l_description,'Adjustment Depreciation Reserve'),1,2000);
1679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1680 END IF;
1681 IF
1682 l_ledger_language = 'US' THEN
1683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
1684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1685 END IF;
1686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
1687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
1688 IF l_source IS NOT NULL THEN
1689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
1690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1691 END IF;
1692 l_description := SUBSTR(l_description,1,1996);
1693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1694 trace
1695 (p_msg => 'END of Description_15'
1696 ,p_level => C_LEVEL_PROCEDURE
1697 ,p_module => l_log_module);
1698
1699 END IF;
1700 RETURN l_description;
1701
1702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1703 trace
1704 (p_msg => 'END of Description_15'
1705 ,p_level => C_LEVEL_PROCEDURE
1706 ,p_module => l_log_module);
1707 END IF;
1708 RETURN NULL;
1709 EXCEPTION
1710 WHEN VALUE_ERROR THEN
1711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1712 trace
1713 (p_msg => 'ERROR: '||sqlerrm
1714 ,p_level => C_LEVEL_EXCEPTION
1715 ,p_module => l_log_module);
1716 END IF;
1717 RAISE;
1718 WHEN xla_exceptions_pkg.application_exception THEN
1719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1720 trace
1721 (p_msg => 'ERROR: '||sqlerrm
1722 ,p_level => C_LEVEL_EXCEPTION
1723 ,p_module => l_log_module);
1724 END IF;
1725 RAISE;
1726 WHEN OTHERS THEN
1727 xla_exceptions_pkg.raise_message
1728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_15');
1729 END Description_15;
1730
1731 ---------------------------------------
1732 --
1733 -- PRIVATE FUNCTION
1734 -- Description_16
1735 --
1736 ---------------------------------------
1737 FUNCTION Description_16 (
1738 p_application_id IN NUMBER
1739 , p_ae_header_id IN NUMBER DEFAULT NULL
1740 --Period Close Date
1741 , p_source_1 IN DATE
1742 )
1743 RETURN VARCHAR2
1744 IS
1745 l_component_type VARCHAR2(80) ;
1746 l_component_code VARCHAR2(30) ;
1747 l_component_type_code VARCHAR2(1) ;
1748 l_component_appl_id INTEGER ;
1749 l_amb_context_code VARCHAR2(30) ;
1750 l_ledger_language VARCHAR2(30) ;
1751 l_source VARCHAR2(1996) ;
1752 l_description VARCHAR2(2000) ;
1753 l_log_module VARCHAR2(240) ;
1754 BEGIN
1755 IF g_log_enabled THEN
1756 l_log_module := C_DEFAULT_MODULE||'.Description_16';
1757 END IF;
1758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1759 trace
1760 (p_msg => 'BEGIN of Description_16'
1761 ,p_level => C_LEVEL_PROCEDURE
1762 ,p_module => l_log_module);
1763 END IF;
1764
1765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
1766 l_component_type := 'AMB_DESCRIPTION';
1767 l_component_code := 'FA_CAPITALIZATION';
1768 l_component_type_code := 'S';
1769 l_component_appl_id := 140;
1770 l_amb_context_code := 'DEFAULT';
1771 l_source := NULL;
1772 l_description := NULL;
1773
1774
1775
1776 IF
1777 l_ledger_language = 'US' THEN
1778 l_description := SUBSTR(CONCAT(l_description,'Assets Capitalization'),1,2000);
1779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1780 END IF;
1781 IF
1782 l_ledger_language = 'US' THEN
1783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
1784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1788 IF l_source IS NOT NULL THEN
1785 END IF;
1786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
1787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
1789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
1790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1791 END IF;
1792 l_description := SUBSTR(l_description,1,1996);
1793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1794 trace
1795 (p_msg => 'END of Description_16'
1796 ,p_level => C_LEVEL_PROCEDURE
1797 ,p_module => l_log_module);
1798
1799 END IF;
1800 RETURN l_description;
1801
1802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1803 trace
1804 (p_msg => 'END of Description_16'
1805 ,p_level => C_LEVEL_PROCEDURE
1806 ,p_module => l_log_module);
1807 END IF;
1808 RETURN NULL;
1809 EXCEPTION
1810 WHEN VALUE_ERROR THEN
1811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1812 trace
1813 (p_msg => 'ERROR: '||sqlerrm
1814 ,p_level => C_LEVEL_EXCEPTION
1815 ,p_module => l_log_module);
1816 END IF;
1817 RAISE;
1818 WHEN xla_exceptions_pkg.application_exception THEN
1819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1820 trace
1821 (p_msg => 'ERROR: '||sqlerrm
1822 ,p_level => C_LEVEL_EXCEPTION
1823 ,p_module => l_log_module);
1824 END IF;
1825 RAISE;
1826 WHEN OTHERS THEN
1827 xla_exceptions_pkg.raise_message
1828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_16');
1829 END Description_16;
1830
1831 ---------------------------------------
1832 --
1833 -- PRIVATE FUNCTION
1834 -- Description_17
1835 --
1836 ---------------------------------------
1837 FUNCTION Description_17 (
1838 p_application_id IN NUMBER
1839 , p_ae_header_id IN NUMBER DEFAULT NULL
1840 --Period Close Date
1841 , p_source_1 IN DATE
1842 )
1843 RETURN VARCHAR2
1844 IS
1845 l_component_type VARCHAR2(80) ;
1846 l_component_code VARCHAR2(30) ;
1847 l_component_type_code VARCHAR2(1) ;
1848 l_component_appl_id INTEGER ;
1849 l_amb_context_code VARCHAR2(30) ;
1850 l_ledger_language VARCHAR2(30) ;
1851 l_source VARCHAR2(1996) ;
1852 l_description VARCHAR2(2000) ;
1853 l_log_module VARCHAR2(240) ;
1854 BEGIN
1855 IF g_log_enabled THEN
1856 l_log_module := C_DEFAULT_MODULE||'.Description_17';
1857 END IF;
1858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1859 trace
1860 (p_msg => 'BEGIN of Description_17'
1861 ,p_level => C_LEVEL_PROCEDURE
1862 ,p_module => l_log_module);
1863 END IF;
1864
1865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
1866 l_component_type := 'AMB_DESCRIPTION';
1867 l_component_code := 'FA_CAP_ASSET_BONUS_EXPENSE';
1868 l_component_type_code := 'S';
1869 l_component_appl_id := 140;
1870 l_amb_context_code := 'DEFAULT';
1871 l_source := NULL;
1872 l_description := NULL;
1873
1874
1875
1876 IF
1877 l_ledger_language = 'US' THEN
1878 l_description := SUBSTR(CONCAT(l_description,'Assets Capitalization Bonus Expense'),1,2000);
1879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1880 END IF;
1881 IF
1882 l_ledger_language = 'US' THEN
1883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
1884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1885 END IF;
1886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
1887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
1888 IF l_source IS NOT NULL THEN
1889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
1890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1891 END IF;
1892 l_description := SUBSTR(l_description,1,1996);
1893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1894 trace
1895 (p_msg => 'END of Description_17'
1896 ,p_level => C_LEVEL_PROCEDURE
1897 ,p_module => l_log_module);
1898
1899 END IF;
1900 RETURN l_description;
1901
1902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1903 trace
1904 (p_msg => 'END of Description_17'
1905 ,p_level => C_LEVEL_PROCEDURE
1906 ,p_module => l_log_module);
1907 END IF;
1908 RETURN NULL;
1909 EXCEPTION
1910 WHEN VALUE_ERROR THEN
1911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1912 trace
1913 (p_msg => 'ERROR: '||sqlerrm
1914 ,p_level => C_LEVEL_EXCEPTION
1915 ,p_module => l_log_module);
1916 END IF;
1917 RAISE;
1918 WHEN xla_exceptions_pkg.application_exception THEN
1919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
1920 trace
1921 (p_msg => 'ERROR: '||sqlerrm
1922 ,p_level => C_LEVEL_EXCEPTION
1923 ,p_module => l_log_module);
1924 END IF;
1925 RAISE;
1926 WHEN OTHERS THEN
1930
1927 xla_exceptions_pkg.raise_message
1928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_17');
1929 END Description_17;
1931 ---------------------------------------
1932 --
1933 -- PRIVATE FUNCTION
1934 -- Description_18
1935 --
1936 ---------------------------------------
1937 FUNCTION Description_18 (
1938 p_application_id IN NUMBER
1939 , p_ae_header_id IN NUMBER DEFAULT NULL
1940 --Period Close Date
1941 , p_source_1 IN DATE
1942 )
1943 RETURN VARCHAR2
1944 IS
1945 l_component_type VARCHAR2(80) ;
1946 l_component_code VARCHAR2(30) ;
1947 l_component_type_code VARCHAR2(1) ;
1948 l_component_appl_id INTEGER ;
1949 l_amb_context_code VARCHAR2(30) ;
1950 l_ledger_language VARCHAR2(30) ;
1951 l_source VARCHAR2(1996) ;
1952 l_description VARCHAR2(2000) ;
1953 l_log_module VARCHAR2(240) ;
1954 BEGIN
1955 IF g_log_enabled THEN
1956 l_log_module := C_DEFAULT_MODULE||'.Description_18';
1957 END IF;
1958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1959 trace
1960 (p_msg => 'BEGIN of Description_18'
1961 ,p_level => C_LEVEL_PROCEDURE
1962 ,p_module => l_log_module);
1963 END IF;
1964
1965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
1966 l_component_type := 'AMB_DESCRIPTION';
1967 l_component_code := 'FA_CAP_ASSET_BONUS_RESERVE';
1968 l_component_type_code := 'S';
1969 l_component_appl_id := 140;
1970 l_amb_context_code := 'DEFAULT';
1971 l_source := NULL;
1972 l_description := NULL;
1973
1974
1975
1976 IF
1977 l_ledger_language = 'US' THEN
1978 l_description := SUBSTR(CONCAT(l_description,'Assets Capitalization Bonus Reserve'),1,2000);
1979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1980 END IF;
1981 IF
1982 l_ledger_language = 'US' THEN
1983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
1984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1985 END IF;
1986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
1987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
1988 IF l_source IS NOT NULL THEN
1989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
1990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
1991 END IF;
1992 l_description := SUBSTR(l_description,1,1996);
1993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1994 trace
1995 (p_msg => 'END of Description_18'
1996 ,p_level => C_LEVEL_PROCEDURE
1997 ,p_module => l_log_module);
1998
1999 END IF;
2000 RETURN l_description;
2001
2002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2003 trace
2004 (p_msg => 'END of Description_18'
2005 ,p_level => C_LEVEL_PROCEDURE
2006 ,p_module => l_log_module);
2007 END IF;
2008 RETURN NULL;
2009 EXCEPTION
2010 WHEN VALUE_ERROR THEN
2011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2012 trace
2013 (p_msg => 'ERROR: '||sqlerrm
2014 ,p_level => C_LEVEL_EXCEPTION
2015 ,p_module => l_log_module);
2016 END IF;
2017 RAISE;
2018 WHEN xla_exceptions_pkg.application_exception THEN
2019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2020 trace
2021 (p_msg => 'ERROR: '||sqlerrm
2022 ,p_level => C_LEVEL_EXCEPTION
2023 ,p_module => l_log_module);
2024 END IF;
2025 RAISE;
2026 WHEN OTHERS THEN
2027 xla_exceptions_pkg.raise_message
2028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_18');
2029 END Description_18;
2030
2031 ---------------------------------------
2032 --
2033 -- PRIVATE FUNCTION
2034 -- Description_19
2035 --
2036 ---------------------------------------
2037 FUNCTION Description_19 (
2038 p_application_id IN NUMBER
2039 , p_ae_header_id IN NUMBER DEFAULT NULL
2040 --Period Close Date
2041 , p_source_1 IN DATE
2042 )
2043 RETURN VARCHAR2
2044 IS
2045 l_component_type VARCHAR2(80) ;
2046 l_component_code VARCHAR2(30) ;
2047 l_component_type_code VARCHAR2(1) ;
2048 l_component_appl_id INTEGER ;
2049 l_amb_context_code VARCHAR2(30) ;
2050 l_ledger_language VARCHAR2(30) ;
2051 l_source VARCHAR2(1996) ;
2052 l_description VARCHAR2(2000) ;
2053 l_log_module VARCHAR2(240) ;
2054 BEGIN
2055 IF g_log_enabled THEN
2056 l_log_module := C_DEFAULT_MODULE||'.Description_19';
2057 END IF;
2058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2059 trace
2060 (p_msg => 'BEGIN of Description_19'
2061 ,p_level => C_LEVEL_PROCEDURE
2062 ,p_module => l_log_module);
2063 END IF;
2064
2065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
2066 l_component_type := 'AMB_DESCRIPTION';
2067 l_component_code := 'FA_CAP_ASSET_CIP_COST';
2068 l_component_type_code := 'S';
2069 l_component_appl_id := 140;
2070 l_amb_context_code := 'DEFAULT';
2074
2071 l_source := NULL;
2072 l_description := NULL;
2073
2075
2076 IF
2077 l_ledger_language = 'US' THEN
2078 l_description := SUBSTR(CONCAT(l_description,'Assets Capitalization CIP Cost'),1,2000);
2079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2080 END IF;
2081 IF
2082 l_ledger_language = 'US' THEN
2083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
2084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2085 END IF;
2086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
2087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
2088 IF l_source IS NOT NULL THEN
2089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
2090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2091 END IF;
2092 l_description := SUBSTR(l_description,1,1996);
2093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2094 trace
2095 (p_msg => 'END of Description_19'
2096 ,p_level => C_LEVEL_PROCEDURE
2097 ,p_module => l_log_module);
2098
2099 END IF;
2100 RETURN l_description;
2101
2102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2103 trace
2104 (p_msg => 'END of Description_19'
2105 ,p_level => C_LEVEL_PROCEDURE
2106 ,p_module => l_log_module);
2107 END IF;
2108 RETURN NULL;
2109 EXCEPTION
2110 WHEN VALUE_ERROR THEN
2111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2112 trace
2113 (p_msg => 'ERROR: '||sqlerrm
2114 ,p_level => C_LEVEL_EXCEPTION
2115 ,p_module => l_log_module);
2116 END IF;
2117 RAISE;
2118 WHEN xla_exceptions_pkg.application_exception THEN
2119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2120 trace
2121 (p_msg => 'ERROR: '||sqlerrm
2122 ,p_level => C_LEVEL_EXCEPTION
2123 ,p_module => l_log_module);
2124 END IF;
2125 RAISE;
2126 WHEN OTHERS THEN
2127 xla_exceptions_pkg.raise_message
2128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_19');
2129 END Description_19;
2130
2131 ---------------------------------------
2132 --
2133 -- PRIVATE FUNCTION
2134 -- Description_20
2135 --
2136 ---------------------------------------
2137 FUNCTION Description_20 (
2138 p_application_id IN NUMBER
2139 , p_ae_header_id IN NUMBER DEFAULT NULL
2140 --Period Close Date
2141 , p_source_1 IN DATE
2142 )
2143 RETURN VARCHAR2
2144 IS
2145 l_component_type VARCHAR2(80) ;
2146 l_component_code VARCHAR2(30) ;
2147 l_component_type_code VARCHAR2(1) ;
2148 l_component_appl_id INTEGER ;
2149 l_amb_context_code VARCHAR2(30) ;
2150 l_ledger_language VARCHAR2(30) ;
2151 l_source VARCHAR2(1996) ;
2152 l_description VARCHAR2(2000) ;
2153 l_log_module VARCHAR2(240) ;
2154 BEGIN
2155 IF g_log_enabled THEN
2156 l_log_module := C_DEFAULT_MODULE||'.Description_20';
2157 END IF;
2158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2159 trace
2160 (p_msg => 'BEGIN of Description_20'
2161 ,p_level => C_LEVEL_PROCEDURE
2162 ,p_module => l_log_module);
2163 END IF;
2164
2165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
2166 l_component_type := 'AMB_DESCRIPTION';
2167 l_component_code := 'FA_CAP_ASSET_COST';
2168 l_component_type_code := 'S';
2169 l_component_appl_id := 140;
2170 l_amb_context_code := 'DEFAULT';
2171 l_source := NULL;
2172 l_description := NULL;
2173
2174
2175
2176 IF
2177 l_ledger_language = 'US' THEN
2178 l_description := SUBSTR(CONCAT(l_description,'Assets Capitalization Cost'),1,2000);
2179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2180 END IF;
2181 IF
2182 l_ledger_language = 'US' THEN
2183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
2184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2185 END IF;
2186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
2187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
2188 IF l_source IS NOT NULL THEN
2189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
2190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2191 END IF;
2192 l_description := SUBSTR(l_description,1,1996);
2193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2194 trace
2195 (p_msg => 'END of Description_20'
2196 ,p_level => C_LEVEL_PROCEDURE
2197 ,p_module => l_log_module);
2198
2199 END IF;
2200 RETURN l_description;
2201
2202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2203 trace
2204 (p_msg => 'END of Description_20'
2205 ,p_level => C_LEVEL_PROCEDURE
2206 ,p_module => l_log_module);
2207 END IF;
2208 RETURN NULL;
2209 EXCEPTION
2210 WHEN VALUE_ERROR THEN
2211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2215 ,p_module => l_log_module);
2212 trace
2213 (p_msg => 'ERROR: '||sqlerrm
2214 ,p_level => C_LEVEL_EXCEPTION
2216 END IF;
2217 RAISE;
2218 WHEN xla_exceptions_pkg.application_exception THEN
2219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2220 trace
2221 (p_msg => 'ERROR: '||sqlerrm
2222 ,p_level => C_LEVEL_EXCEPTION
2223 ,p_module => l_log_module);
2224 END IF;
2225 RAISE;
2226 WHEN OTHERS THEN
2227 xla_exceptions_pkg.raise_message
2228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_20');
2229 END Description_20;
2230
2231 ---------------------------------------
2232 --
2233 -- PRIVATE FUNCTION
2234 -- Description_21
2235 --
2236 ---------------------------------------
2237 FUNCTION Description_21 (
2238 p_application_id IN NUMBER
2239 , p_ae_header_id IN NUMBER DEFAULT NULL
2240 --Period Close Date
2241 , p_source_1 IN DATE
2242 )
2243 RETURN VARCHAR2
2244 IS
2245 l_component_type VARCHAR2(80) ;
2246 l_component_code VARCHAR2(30) ;
2247 l_component_type_code VARCHAR2(1) ;
2248 l_component_appl_id INTEGER ;
2249 l_amb_context_code VARCHAR2(30) ;
2250 l_ledger_language VARCHAR2(30) ;
2251 l_source VARCHAR2(1996) ;
2252 l_description VARCHAR2(2000) ;
2253 l_log_module VARCHAR2(240) ;
2254 BEGIN
2255 IF g_log_enabled THEN
2256 l_log_module := C_DEFAULT_MODULE||'.Description_21';
2257 END IF;
2258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2259 trace
2260 (p_msg => 'BEGIN of Description_21'
2261 ,p_level => C_LEVEL_PROCEDURE
2262 ,p_module => l_log_module);
2263 END IF;
2264
2265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
2266 l_component_type := 'AMB_DESCRIPTION';
2267 l_component_code := 'FA_CAP_ASSET_EXPENSE';
2268 l_component_type_code := 'S';
2269 l_component_appl_id := 140;
2270 l_amb_context_code := 'DEFAULT';
2271 l_source := NULL;
2272 l_description := NULL;
2273
2274
2275
2276 IF
2277 l_ledger_language = 'US' THEN
2278 l_description := SUBSTR(CONCAT(l_description,'Assets Capitalization Expense'),1,2000);
2279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2280 END IF;
2281 IF
2282 l_ledger_language = 'US' THEN
2283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
2284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2285 END IF;
2286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
2287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
2288 IF l_source IS NOT NULL THEN
2289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
2290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2291 END IF;
2292 l_description := SUBSTR(l_description,1,1996);
2293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2294 trace
2295 (p_msg => 'END of Description_21'
2296 ,p_level => C_LEVEL_PROCEDURE
2297 ,p_module => l_log_module);
2298
2299 END IF;
2300 RETURN l_description;
2301
2302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2303 trace
2304 (p_msg => 'END of Description_21'
2305 ,p_level => C_LEVEL_PROCEDURE
2306 ,p_module => l_log_module);
2307 END IF;
2308 RETURN NULL;
2309 EXCEPTION
2310 WHEN VALUE_ERROR THEN
2311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2312 trace
2313 (p_msg => 'ERROR: '||sqlerrm
2314 ,p_level => C_LEVEL_EXCEPTION
2315 ,p_module => l_log_module);
2316 END IF;
2317 RAISE;
2318 WHEN xla_exceptions_pkg.application_exception THEN
2319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2320 trace
2321 (p_msg => 'ERROR: '||sqlerrm
2322 ,p_level => C_LEVEL_EXCEPTION
2323 ,p_module => l_log_module);
2324 END IF;
2325 RAISE;
2326 WHEN OTHERS THEN
2327 xla_exceptions_pkg.raise_message
2328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_21');
2329 END Description_21;
2330
2331 ---------------------------------------
2332 --
2333 -- PRIVATE FUNCTION
2334 -- Description_22
2335 --
2336 ---------------------------------------
2337 FUNCTION Description_22 (
2338 p_application_id IN NUMBER
2339 , p_ae_header_id IN NUMBER DEFAULT NULL
2340 --Period Close Date
2341 , p_source_1 IN DATE
2342 )
2343 RETURN VARCHAR2
2344 IS
2345 l_component_type VARCHAR2(80) ;
2346 l_component_code VARCHAR2(30) ;
2347 l_component_type_code VARCHAR2(1) ;
2348 l_component_appl_id INTEGER ;
2349 l_amb_context_code VARCHAR2(30) ;
2350 l_ledger_language VARCHAR2(30) ;
2351 l_source VARCHAR2(1996) ;
2352 l_description VARCHAR2(2000) ;
2356 l_log_module := C_DEFAULT_MODULE||'.Description_22';
2353 l_log_module VARCHAR2(240) ;
2354 BEGIN
2355 IF g_log_enabled THEN
2357 END IF;
2358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2359 trace
2360 (p_msg => 'BEGIN of Description_22'
2361 ,p_level => C_LEVEL_PROCEDURE
2362 ,p_module => l_log_module);
2363 END IF;
2364
2365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
2366 l_component_type := 'AMB_DESCRIPTION';
2367 l_component_code := 'FA_CAP_ASSET_RESERVE';
2368 l_component_type_code := 'S';
2369 l_component_appl_id := 140;
2370 l_amb_context_code := 'DEFAULT';
2371 l_source := NULL;
2372 l_description := NULL;
2373
2374
2375
2376 IF
2377 l_ledger_language = 'US' THEN
2378 l_description := SUBSTR(CONCAT(l_description,'Assets Capitalization Reserve'),1,2000);
2379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2380 END IF;
2381 IF
2382 l_ledger_language = 'US' THEN
2383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
2384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2385 END IF;
2386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
2387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
2388 IF l_source IS NOT NULL THEN
2389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
2390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2391 END IF;
2392 l_description := SUBSTR(l_description,1,1996);
2393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2394 trace
2395 (p_msg => 'END of Description_22'
2396 ,p_level => C_LEVEL_PROCEDURE
2397 ,p_module => l_log_module);
2398
2399 END IF;
2400 RETURN l_description;
2401
2402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2403 trace
2404 (p_msg => 'END of Description_22'
2405 ,p_level => C_LEVEL_PROCEDURE
2406 ,p_module => l_log_module);
2407 END IF;
2408 RETURN NULL;
2409 EXCEPTION
2410 WHEN VALUE_ERROR THEN
2411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2412 trace
2413 (p_msg => 'ERROR: '||sqlerrm
2414 ,p_level => C_LEVEL_EXCEPTION
2415 ,p_module => l_log_module);
2416 END IF;
2417 RAISE;
2418 WHEN xla_exceptions_pkg.application_exception THEN
2419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2420 trace
2421 (p_msg => 'ERROR: '||sqlerrm
2422 ,p_level => C_LEVEL_EXCEPTION
2423 ,p_module => l_log_module);
2424 END IF;
2425 RAISE;
2426 WHEN OTHERS THEN
2427 xla_exceptions_pkg.raise_message
2428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_22');
2429 END Description_22;
2430
2431 ---------------------------------------
2432 --
2433 -- PRIVATE FUNCTION
2434 -- Description_23
2435 --
2436 ---------------------------------------
2437 FUNCTION Description_23 (
2438 p_application_id IN NUMBER
2439 , p_ae_header_id IN NUMBER DEFAULT NULL
2440 --Period Close Date
2441 , p_source_1 IN DATE
2442 )
2443 RETURN VARCHAR2
2444 IS
2445 l_component_type VARCHAR2(80) ;
2446 l_component_code VARCHAR2(30) ;
2447 l_component_type_code VARCHAR2(1) ;
2448 l_component_appl_id INTEGER ;
2449 l_amb_context_code VARCHAR2(30) ;
2450 l_ledger_language VARCHAR2(30) ;
2451 l_source VARCHAR2(1996) ;
2452 l_description VARCHAR2(2000) ;
2453 l_log_module VARCHAR2(240) ;
2454 BEGIN
2455 IF g_log_enabled THEN
2456 l_log_module := C_DEFAULT_MODULE||'.Description_23';
2457 END IF;
2458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2459 trace
2460 (p_msg => 'BEGIN of Description_23'
2461 ,p_level => C_LEVEL_PROCEDURE
2462 ,p_module => l_log_module);
2463 END IF;
2464
2465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
2466 l_component_type := 'AMB_DESCRIPTION';
2467 l_component_code := 'FA_CIP_ADDITION';
2468 l_component_type_code := 'S';
2469 l_component_appl_id := 140;
2470 l_amb_context_code := 'DEFAULT';
2471 l_source := NULL;
2472 l_description := NULL;
2473
2474
2475
2476 IF
2477 l_ledger_language = 'US' THEN
2478 l_description := SUBSTR(CONCAT(l_description,'CIP Addition'),1,2000);
2479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2480 END IF;
2481 IF
2482 l_ledger_language = 'US' THEN
2483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
2484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2485 END IF;
2486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
2487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
2488 IF l_source IS NOT NULL THEN
2489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
2490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2491 END IF;
2495 (p_msg => 'END of Description_23'
2492 l_description := SUBSTR(l_description,1,1996);
2493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2494 trace
2496 ,p_level => C_LEVEL_PROCEDURE
2497 ,p_module => l_log_module);
2498
2499 END IF;
2500 RETURN l_description;
2501
2502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2503 trace
2504 (p_msg => 'END of Description_23'
2505 ,p_level => C_LEVEL_PROCEDURE
2506 ,p_module => l_log_module);
2507 END IF;
2508 RETURN NULL;
2509 EXCEPTION
2510 WHEN VALUE_ERROR THEN
2511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2512 trace
2513 (p_msg => 'ERROR: '||sqlerrm
2514 ,p_level => C_LEVEL_EXCEPTION
2515 ,p_module => l_log_module);
2516 END IF;
2517 RAISE;
2518 WHEN xla_exceptions_pkg.application_exception THEN
2519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2520 trace
2521 (p_msg => 'ERROR: '||sqlerrm
2522 ,p_level => C_LEVEL_EXCEPTION
2523 ,p_module => l_log_module);
2524 END IF;
2525 RAISE;
2526 WHEN OTHERS THEN
2527 xla_exceptions_pkg.raise_message
2528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_23');
2529 END Description_23;
2530
2531 ---------------------------------------
2532 --
2533 -- PRIVATE FUNCTION
2534 -- Description_24
2535 --
2536 ---------------------------------------
2537 FUNCTION Description_24 (
2538 p_application_id IN NUMBER
2539 , p_ae_header_id IN NUMBER DEFAULT NULL
2540 --Period Close Date
2541 , p_source_1 IN DATE
2542 )
2543 RETURN VARCHAR2
2544 IS
2545 l_component_type VARCHAR2(80) ;
2546 l_component_code VARCHAR2(30) ;
2547 l_component_type_code VARCHAR2(1) ;
2548 l_component_appl_id INTEGER ;
2549 l_amb_context_code VARCHAR2(30) ;
2550 l_ledger_language VARCHAR2(30) ;
2551 l_source VARCHAR2(1996) ;
2552 l_description VARCHAR2(2000) ;
2553 l_log_module VARCHAR2(240) ;
2554 BEGIN
2555 IF g_log_enabled THEN
2556 l_log_module := C_DEFAULT_MODULE||'.Description_24';
2557 END IF;
2558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2559 trace
2560 (p_msg => 'BEGIN of Description_24'
2561 ,p_level => C_LEVEL_PROCEDURE
2562 ,p_module => l_log_module);
2563 END IF;
2564
2565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
2566 l_component_type := 'AMB_DESCRIPTION';
2567 l_component_code := 'FA_CIP_ADDITION_COST';
2568 l_component_type_code := 'S';
2569 l_component_appl_id := 140;
2570 l_amb_context_code := 'DEFAULT';
2571 l_source := NULL;
2572 l_description := NULL;
2573
2574
2575
2576 IF
2577 l_ledger_language = 'US' THEN
2578 l_description := SUBSTR(CONCAT(l_description,'CIP Addition Cost'),1,2000);
2579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2580 END IF;
2581 IF
2582 l_ledger_language = 'US' THEN
2583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
2584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2585 END IF;
2586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
2587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
2588 IF l_source IS NOT NULL THEN
2589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
2590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2591 END IF;
2592 l_description := SUBSTR(l_description,1,1996);
2593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2594 trace
2595 (p_msg => 'END of Description_24'
2596 ,p_level => C_LEVEL_PROCEDURE
2597 ,p_module => l_log_module);
2598
2599 END IF;
2600 RETURN l_description;
2601
2602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2603 trace
2604 (p_msg => 'END of Description_24'
2605 ,p_level => C_LEVEL_PROCEDURE
2606 ,p_module => l_log_module);
2607 END IF;
2608 RETURN NULL;
2609 EXCEPTION
2610 WHEN VALUE_ERROR THEN
2611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2612 trace
2613 (p_msg => 'ERROR: '||sqlerrm
2614 ,p_level => C_LEVEL_EXCEPTION
2615 ,p_module => l_log_module);
2616 END IF;
2617 RAISE;
2618 WHEN xla_exceptions_pkg.application_exception THEN
2619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2620 trace
2621 (p_msg => 'ERROR: '||sqlerrm
2622 ,p_level => C_LEVEL_EXCEPTION
2623 ,p_module => l_log_module);
2624 END IF;
2625 RAISE;
2626 WHEN OTHERS THEN
2627 xla_exceptions_pkg.raise_message
2628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_24');
2629 END Description_24;
2630
2631 ---------------------------------------
2632 --
2633 -- PRIVATE FUNCTION
2634 -- Description_25
2635 --
2636 ---------------------------------------
2640 --Period Close Date
2637 FUNCTION Description_25 (
2638 p_application_id IN NUMBER
2639 , p_ae_header_id IN NUMBER DEFAULT NULL
2641 , p_source_1 IN DATE
2642 )
2643 RETURN VARCHAR2
2644 IS
2645 l_component_type VARCHAR2(80) ;
2646 l_component_code VARCHAR2(30) ;
2647 l_component_type_code VARCHAR2(1) ;
2648 l_component_appl_id INTEGER ;
2649 l_amb_context_code VARCHAR2(30) ;
2650 l_ledger_language VARCHAR2(30) ;
2651 l_source VARCHAR2(1996) ;
2652 l_description VARCHAR2(2000) ;
2653 l_log_module VARCHAR2(240) ;
2654 BEGIN
2655 IF g_log_enabled THEN
2656 l_log_module := C_DEFAULT_MODULE||'.Description_25';
2657 END IF;
2658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2659 trace
2660 (p_msg => 'BEGIN of Description_25'
2661 ,p_level => C_LEVEL_PROCEDURE
2662 ,p_module => l_log_module);
2663 END IF;
2664
2665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
2666 l_component_type := 'AMB_DESCRIPTION';
2667 l_component_code := 'FA_CIP_ADDITION_COST_CLEARING';
2668 l_component_type_code := 'S';
2669 l_component_appl_id := 140;
2670 l_amb_context_code := 'DEFAULT';
2671 l_source := NULL;
2672 l_description := NULL;
2673
2674
2675
2676 IF
2677 l_ledger_language = 'US' THEN
2678 l_description := SUBSTR(CONCAT(l_description,'Addition CIP Cost Clearing'),1,2000);
2679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2680 END IF;
2681 IF
2682 l_ledger_language = 'US' THEN
2683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
2684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2685 END IF;
2686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
2687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
2688 IF l_source IS NOT NULL THEN
2689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
2690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2691 END IF;
2692 l_description := SUBSTR(l_description,1,1996);
2693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2694 trace
2695 (p_msg => 'END of Description_25'
2696 ,p_level => C_LEVEL_PROCEDURE
2697 ,p_module => l_log_module);
2698
2699 END IF;
2700 RETURN l_description;
2701
2702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2703 trace
2704 (p_msg => 'END of Description_25'
2705 ,p_level => C_LEVEL_PROCEDURE
2706 ,p_module => l_log_module);
2707 END IF;
2708 RETURN NULL;
2709 EXCEPTION
2710 WHEN VALUE_ERROR THEN
2711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2712 trace
2713 (p_msg => 'ERROR: '||sqlerrm
2714 ,p_level => C_LEVEL_EXCEPTION
2715 ,p_module => l_log_module);
2716 END IF;
2717 RAISE;
2718 WHEN xla_exceptions_pkg.application_exception THEN
2719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2720 trace
2721 (p_msg => 'ERROR: '||sqlerrm
2722 ,p_level => C_LEVEL_EXCEPTION
2723 ,p_module => l_log_module);
2724 END IF;
2725 RAISE;
2726 WHEN OTHERS THEN
2727 xla_exceptions_pkg.raise_message
2728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_25');
2729 END Description_25;
2730
2731 ---------------------------------------
2732 --
2733 -- PRIVATE FUNCTION
2734 -- Description_26
2735 --
2736 ---------------------------------------
2737 FUNCTION Description_26 (
2738 p_application_id IN NUMBER
2739 , p_ae_header_id IN NUMBER DEFAULT NULL
2740 --Period Close Date
2741 , p_source_1 IN DATE
2742 )
2743 RETURN VARCHAR2
2744 IS
2745 l_component_type VARCHAR2(80) ;
2746 l_component_code VARCHAR2(30) ;
2747 l_component_type_code VARCHAR2(1) ;
2748 l_component_appl_id INTEGER ;
2749 l_amb_context_code VARCHAR2(30) ;
2750 l_ledger_language VARCHAR2(30) ;
2751 l_source VARCHAR2(1996) ;
2752 l_description VARCHAR2(2000) ;
2753 l_log_module VARCHAR2(240) ;
2754 BEGIN
2755 IF g_log_enabled THEN
2756 l_log_module := C_DEFAULT_MODULE||'.Description_26';
2757 END IF;
2758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2759 trace
2760 (p_msg => 'BEGIN of Description_26'
2761 ,p_level => C_LEVEL_PROCEDURE
2762 ,p_module => l_log_module);
2763 END IF;
2764
2765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
2766 l_component_type := 'AMB_DESCRIPTION';
2767 l_component_code := 'FA_CIP_ADJUSTMENT';
2768 l_component_type_code := 'S';
2769 l_component_appl_id := 140;
2770 l_amb_context_code := 'DEFAULT';
2771 l_source := NULL;
2772 l_description := NULL;
2773
2774
2775
2776 IF
2777 l_ledger_language = 'US' THEN
2778 l_description := SUBSTR(CONCAT(l_description,'CIP Adjustment'),1,2000);
2782 l_ledger_language = 'US' THEN
2779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2780 END IF;
2781 IF
2783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
2784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2785 END IF;
2786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
2787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
2788 IF l_source IS NOT NULL THEN
2789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
2790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2791 END IF;
2792 l_description := SUBSTR(l_description,1,1996);
2793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2794 trace
2795 (p_msg => 'END of Description_26'
2796 ,p_level => C_LEVEL_PROCEDURE
2797 ,p_module => l_log_module);
2798
2799 END IF;
2800 RETURN l_description;
2801
2802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2803 trace
2804 (p_msg => 'END of Description_26'
2805 ,p_level => C_LEVEL_PROCEDURE
2806 ,p_module => l_log_module);
2807 END IF;
2808 RETURN NULL;
2809 EXCEPTION
2810 WHEN VALUE_ERROR THEN
2811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2812 trace
2813 (p_msg => 'ERROR: '||sqlerrm
2814 ,p_level => C_LEVEL_EXCEPTION
2815 ,p_module => l_log_module);
2816 END IF;
2817 RAISE;
2818 WHEN xla_exceptions_pkg.application_exception THEN
2819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2820 trace
2821 (p_msg => 'ERROR: '||sqlerrm
2822 ,p_level => C_LEVEL_EXCEPTION
2823 ,p_module => l_log_module);
2824 END IF;
2825 RAISE;
2826 WHEN OTHERS THEN
2827 xla_exceptions_pkg.raise_message
2828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_26');
2829 END Description_26;
2830
2831 ---------------------------------------
2832 --
2833 -- PRIVATE FUNCTION
2834 -- Description_27
2835 --
2836 ---------------------------------------
2837 FUNCTION Description_27 (
2838 p_application_id IN NUMBER
2839 , p_ae_header_id IN NUMBER DEFAULT NULL
2840 --Period Close Date
2841 , p_source_1 IN DATE
2842 )
2843 RETURN VARCHAR2
2844 IS
2845 l_component_type VARCHAR2(80) ;
2846 l_component_code VARCHAR2(30) ;
2847 l_component_type_code VARCHAR2(1) ;
2848 l_component_appl_id INTEGER ;
2849 l_amb_context_code VARCHAR2(30) ;
2850 l_ledger_language VARCHAR2(30) ;
2851 l_source VARCHAR2(1996) ;
2852 l_description VARCHAR2(2000) ;
2853 l_log_module VARCHAR2(240) ;
2854 BEGIN
2855 IF g_log_enabled THEN
2856 l_log_module := C_DEFAULT_MODULE||'.Description_27';
2857 END IF;
2858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2859 trace
2860 (p_msg => 'BEGIN of Description_27'
2861 ,p_level => C_LEVEL_PROCEDURE
2862 ,p_module => l_log_module);
2863 END IF;
2864
2865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
2866 l_component_type := 'AMB_DESCRIPTION';
2867 l_component_code := 'FA_CIP_ADJUSTMENT_COST';
2868 l_component_type_code := 'S';
2869 l_component_appl_id := 140;
2870 l_amb_context_code := 'DEFAULT';
2871 l_source := NULL;
2872 l_description := NULL;
2873
2874
2875
2876 IF
2877 l_ledger_language = 'US' THEN
2878 l_description := SUBSTR(CONCAT(l_description,'CIP Adjustment Cost'),1,2000);
2879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2880 END IF;
2881 IF
2882 l_ledger_language = 'US' THEN
2883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
2884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2885 END IF;
2886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
2887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
2888 IF l_source IS NOT NULL THEN
2889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
2890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2891 END IF;
2892 l_description := SUBSTR(l_description,1,1996);
2893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2894 trace
2895 (p_msg => 'END of Description_27'
2896 ,p_level => C_LEVEL_PROCEDURE
2897 ,p_module => l_log_module);
2898
2899 END IF;
2900 RETURN l_description;
2901
2902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2903 trace
2904 (p_msg => 'END of Description_27'
2905 ,p_level => C_LEVEL_PROCEDURE
2906 ,p_module => l_log_module);
2907 END IF;
2908 RETURN NULL;
2909 EXCEPTION
2910 WHEN VALUE_ERROR THEN
2911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2912 trace
2913 (p_msg => 'ERROR: '||sqlerrm
2914 ,p_level => C_LEVEL_EXCEPTION
2915 ,p_module => l_log_module);
2916 END IF;
2917 RAISE;
2918 WHEN xla_exceptions_pkg.application_exception THEN
2922 ,p_level => C_LEVEL_EXCEPTION
2919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
2920 trace
2921 (p_msg => 'ERROR: '||sqlerrm
2923 ,p_module => l_log_module);
2924 END IF;
2925 RAISE;
2926 WHEN OTHERS THEN
2927 xla_exceptions_pkg.raise_message
2928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_27');
2929 END Description_27;
2930
2931 ---------------------------------------
2932 --
2933 -- PRIVATE FUNCTION
2934 -- Description_28
2935 --
2936 ---------------------------------------
2937 FUNCTION Description_28 (
2938 p_application_id IN NUMBER
2939 , p_ae_header_id IN NUMBER DEFAULT NULL
2940 --Period Close Date
2941 , p_source_1 IN DATE
2942 )
2943 RETURN VARCHAR2
2944 IS
2945 l_component_type VARCHAR2(80) ;
2946 l_component_code VARCHAR2(30) ;
2947 l_component_type_code VARCHAR2(1) ;
2948 l_component_appl_id INTEGER ;
2949 l_amb_context_code VARCHAR2(30) ;
2950 l_ledger_language VARCHAR2(30) ;
2951 l_source VARCHAR2(1996) ;
2952 l_description VARCHAR2(2000) ;
2953 l_log_module VARCHAR2(240) ;
2954 BEGIN
2955 IF g_log_enabled THEN
2956 l_log_module := C_DEFAULT_MODULE||'.Description_28';
2957 END IF;
2958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2959 trace
2960 (p_msg => 'BEGIN of Description_28'
2961 ,p_level => C_LEVEL_PROCEDURE
2962 ,p_module => l_log_module);
2963 END IF;
2964
2965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
2966 l_component_type := 'AMB_DESCRIPTION';
2967 l_component_code := 'FA_CIP_RECLASS';
2968 l_component_type_code := 'S';
2969 l_component_appl_id := 140;
2970 l_amb_context_code := 'DEFAULT';
2971 l_source := NULL;
2972 l_description := NULL;
2973
2974
2975
2976 IF
2977 l_ledger_language = 'US' THEN
2978 l_description := SUBSTR(CONCAT(l_description,'CIP Category Reclass'),1,2000);
2979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2980 END IF;
2981 IF
2982 l_ledger_language = 'US' THEN
2983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
2984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2985 END IF;
2986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
2987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
2988 IF l_source IS NOT NULL THEN
2989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
2990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
2991 END IF;
2992 l_description := SUBSTR(l_description,1,1996);
2993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
2994 trace
2995 (p_msg => 'END of Description_28'
2996 ,p_level => C_LEVEL_PROCEDURE
2997 ,p_module => l_log_module);
2998
2999 END IF;
3000 RETURN l_description;
3001
3002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3003 trace
3004 (p_msg => 'END of Description_28'
3005 ,p_level => C_LEVEL_PROCEDURE
3006 ,p_module => l_log_module);
3007 END IF;
3008 RETURN NULL;
3009 EXCEPTION
3010 WHEN VALUE_ERROR THEN
3011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3012 trace
3013 (p_msg => 'ERROR: '||sqlerrm
3014 ,p_level => C_LEVEL_EXCEPTION
3015 ,p_module => l_log_module);
3016 END IF;
3017 RAISE;
3018 WHEN xla_exceptions_pkg.application_exception THEN
3019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3020 trace
3021 (p_msg => 'ERROR: '||sqlerrm
3022 ,p_level => C_LEVEL_EXCEPTION
3023 ,p_module => l_log_module);
3024 END IF;
3025 RAISE;
3026 WHEN OTHERS THEN
3027 xla_exceptions_pkg.raise_message
3028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_28');
3029 END Description_28;
3030
3031 ---------------------------------------
3032 --
3033 -- PRIVATE FUNCTION
3034 -- Description_29
3035 --
3036 ---------------------------------------
3037 FUNCTION Description_29 (
3038 p_application_id IN NUMBER
3039 , p_ae_header_id IN NUMBER DEFAULT NULL
3040 --Period Close Date
3041 , p_source_1 IN DATE
3042 )
3043 RETURN VARCHAR2
3044 IS
3045 l_component_type VARCHAR2(80) ;
3046 l_component_code VARCHAR2(30) ;
3047 l_component_type_code VARCHAR2(1) ;
3048 l_component_appl_id INTEGER ;
3049 l_amb_context_code VARCHAR2(30) ;
3050 l_ledger_language VARCHAR2(30) ;
3051 l_source VARCHAR2(1996) ;
3052 l_description VARCHAR2(2000) ;
3053 l_log_module VARCHAR2(240) ;
3054 BEGIN
3055 IF g_log_enabled THEN
3056 l_log_module := C_DEFAULT_MODULE||'.Description_29';
3057 END IF;
3058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3059 trace
3060 (p_msg => 'BEGIN of Description_29'
3061 ,p_level => C_LEVEL_PROCEDURE
3062 ,p_module => l_log_module);
3063 END IF;
3064
3068 l_component_type_code := 'S';
3065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
3066 l_component_type := 'AMB_DESCRIPTION';
3067 l_component_code := 'FA_CIP_RECLASS_COST';
3069 l_component_appl_id := 140;
3070 l_amb_context_code := 'DEFAULT';
3071 l_source := NULL;
3072 l_description := NULL;
3073
3074
3075
3076 IF
3077 l_ledger_language = 'US' THEN
3078 l_description := SUBSTR(CONCAT(l_description,'CIP Category Reclass Cost'),1,2000);
3079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3080 END IF;
3081 IF
3082 l_ledger_language = 'US' THEN
3083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
3084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3085 END IF;
3086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
3087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
3088 IF l_source IS NOT NULL THEN
3089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
3090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3091 END IF;
3092 l_description := SUBSTR(l_description,1,1996);
3093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3094 trace
3095 (p_msg => 'END of Description_29'
3096 ,p_level => C_LEVEL_PROCEDURE
3097 ,p_module => l_log_module);
3098
3099 END IF;
3100 RETURN l_description;
3101
3102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3103 trace
3104 (p_msg => 'END of Description_29'
3105 ,p_level => C_LEVEL_PROCEDURE
3106 ,p_module => l_log_module);
3107 END IF;
3108 RETURN NULL;
3109 EXCEPTION
3110 WHEN VALUE_ERROR THEN
3111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3112 trace
3113 (p_msg => 'ERROR: '||sqlerrm
3114 ,p_level => C_LEVEL_EXCEPTION
3115 ,p_module => l_log_module);
3116 END IF;
3117 RAISE;
3118 WHEN xla_exceptions_pkg.application_exception THEN
3119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3120 trace
3121 (p_msg => 'ERROR: '||sqlerrm
3122 ,p_level => C_LEVEL_EXCEPTION
3123 ,p_module => l_log_module);
3124 END IF;
3125 RAISE;
3126 WHEN OTHERS THEN
3127 xla_exceptions_pkg.raise_message
3128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_29');
3129 END Description_29;
3130
3131 ---------------------------------------
3132 --
3133 -- PRIVATE FUNCTION
3134 -- Description_30
3135 --
3136 ---------------------------------------
3137 FUNCTION Description_30 (
3138 p_application_id IN NUMBER
3139 , p_ae_header_id IN NUMBER DEFAULT NULL
3140 --Period Close Date
3141 , p_source_1 IN DATE
3142 )
3143 RETURN VARCHAR2
3144 IS
3145 l_component_type VARCHAR2(80) ;
3146 l_component_code VARCHAR2(30) ;
3147 l_component_type_code VARCHAR2(1) ;
3148 l_component_appl_id INTEGER ;
3149 l_amb_context_code VARCHAR2(30) ;
3150 l_ledger_language VARCHAR2(30) ;
3151 l_source VARCHAR2(1996) ;
3152 l_description VARCHAR2(2000) ;
3153 l_log_module VARCHAR2(240) ;
3154 BEGIN
3155 IF g_log_enabled THEN
3156 l_log_module := C_DEFAULT_MODULE||'.Description_30';
3157 END IF;
3158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3159 trace
3160 (p_msg => 'BEGIN of Description_30'
3161 ,p_level => C_LEVEL_PROCEDURE
3162 ,p_module => l_log_module);
3163 END IF;
3164
3165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
3166 l_component_type := 'AMB_DESCRIPTION';
3167 l_component_code := 'FA_CIP_RECLASS_REVAL_RESERVE';
3168 l_component_type_code := 'S';
3169 l_component_appl_id := 140;
3170 l_amb_context_code := 'DEFAULT';
3171 l_source := NULL;
3172 l_description := NULL;
3173
3174
3175
3176 IF
3177 l_ledger_language = 'US' THEN
3178 l_description := SUBSTR(CONCAT(l_description,'CIP Category Reclass Revaluation Reserve'),1,2000);
3179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3180 END IF;
3181 IF
3182 l_ledger_language = 'US' THEN
3183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
3184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3185 END IF;
3186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
3187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
3188 IF l_source IS NOT NULL THEN
3189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
3190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3191 END IF;
3192 l_description := SUBSTR(l_description,1,1996);
3193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3194 trace
3195 (p_msg => 'END of Description_30'
3196 ,p_level => C_LEVEL_PROCEDURE
3197 ,p_module => l_log_module);
3198
3199 END IF;
3200 RETURN l_description;
3201
3202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3206 ,p_module => l_log_module);
3203 trace
3204 (p_msg => 'END of Description_30'
3205 ,p_level => C_LEVEL_PROCEDURE
3207 END IF;
3208 RETURN NULL;
3209 EXCEPTION
3210 WHEN VALUE_ERROR THEN
3211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3212 trace
3213 (p_msg => 'ERROR: '||sqlerrm
3214 ,p_level => C_LEVEL_EXCEPTION
3215 ,p_module => l_log_module);
3216 END IF;
3217 RAISE;
3218 WHEN xla_exceptions_pkg.application_exception THEN
3219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3220 trace
3221 (p_msg => 'ERROR: '||sqlerrm
3222 ,p_level => C_LEVEL_EXCEPTION
3223 ,p_module => l_log_module);
3224 END IF;
3225 RAISE;
3226 WHEN OTHERS THEN
3227 xla_exceptions_pkg.raise_message
3228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_30');
3229 END Description_30;
3230
3231 ---------------------------------------
3232 --
3233 -- PRIVATE FUNCTION
3234 -- Description_31
3235 --
3236 ---------------------------------------
3237 FUNCTION Description_31 (
3238 p_application_id IN NUMBER
3239 , p_ae_header_id IN NUMBER DEFAULT NULL
3240 --Period Close Date
3241 , p_source_1 IN DATE
3242 )
3243 RETURN VARCHAR2
3244 IS
3245 l_component_type VARCHAR2(80) ;
3246 l_component_code VARCHAR2(30) ;
3247 l_component_type_code VARCHAR2(1) ;
3248 l_component_appl_id INTEGER ;
3249 l_amb_context_code VARCHAR2(30) ;
3250 l_ledger_language VARCHAR2(30) ;
3251 l_source VARCHAR2(1996) ;
3252 l_description VARCHAR2(2000) ;
3253 l_log_module VARCHAR2(240) ;
3254 BEGIN
3255 IF g_log_enabled THEN
3256 l_log_module := C_DEFAULT_MODULE||'.Description_31';
3257 END IF;
3258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3259 trace
3260 (p_msg => 'BEGIN of Description_31'
3261 ,p_level => C_LEVEL_PROCEDURE
3262 ,p_module => l_log_module);
3263 END IF;
3264
3265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
3266 l_component_type := 'AMB_DESCRIPTION';
3267 l_component_code := 'FA_CIP_REINSTATEMENT';
3268 l_component_type_code := 'S';
3269 l_component_appl_id := 140;
3270 l_amb_context_code := 'DEFAULT';
3271 l_source := NULL;
3272 l_description := NULL;
3273
3274
3275
3276 IF
3277 l_ledger_language = 'US' THEN
3278 l_description := SUBSTR(CONCAT(l_description,'CIP Reinstatement'),1,2000);
3279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3280 END IF;
3281 IF
3282 l_ledger_language = 'US' THEN
3283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
3284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3285 END IF;
3286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
3287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
3288 IF l_source IS NOT NULL THEN
3289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
3290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3291 END IF;
3292 l_description := SUBSTR(l_description,1,1996);
3293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3294 trace
3295 (p_msg => 'END of Description_31'
3296 ,p_level => C_LEVEL_PROCEDURE
3297 ,p_module => l_log_module);
3298
3299 END IF;
3300 RETURN l_description;
3301
3302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3303 trace
3304 (p_msg => 'END of Description_31'
3305 ,p_level => C_LEVEL_PROCEDURE
3306 ,p_module => l_log_module);
3307 END IF;
3308 RETURN NULL;
3309 EXCEPTION
3310 WHEN VALUE_ERROR THEN
3311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3312 trace
3313 (p_msg => 'ERROR: '||sqlerrm
3314 ,p_level => C_LEVEL_EXCEPTION
3315 ,p_module => l_log_module);
3316 END IF;
3317 RAISE;
3318 WHEN xla_exceptions_pkg.application_exception THEN
3319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3320 trace
3321 (p_msg => 'ERROR: '||sqlerrm
3322 ,p_level => C_LEVEL_EXCEPTION
3323 ,p_module => l_log_module);
3324 END IF;
3325 RAISE;
3326 WHEN OTHERS THEN
3327 xla_exceptions_pkg.raise_message
3328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_31');
3329 END Description_31;
3330
3331 ---------------------------------------
3332 --
3333 -- PRIVATE FUNCTION
3334 -- Description_32
3335 --
3336 ---------------------------------------
3337 FUNCTION Description_32 (
3338 p_application_id IN NUMBER
3339 , p_ae_header_id IN NUMBER DEFAULT NULL
3340 --Period Close Date
3341 , p_source_1 IN DATE
3342 )
3343 RETURN VARCHAR2
3344 IS
3345 l_component_type VARCHAR2(80) ;
3346 l_component_code VARCHAR2(30) ;
3347 l_component_type_code VARCHAR2(1) ;
3348 l_component_appl_id INTEGER ;
3352 l_description VARCHAR2(2000) ;
3349 l_amb_context_code VARCHAR2(30) ;
3350 l_ledger_language VARCHAR2(30) ;
3351 l_source VARCHAR2(1996) ;
3353 l_log_module VARCHAR2(240) ;
3354 BEGIN
3355 IF g_log_enabled THEN
3356 l_log_module := C_DEFAULT_MODULE||'.Description_32';
3357 END IF;
3358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3359 trace
3360 (p_msg => 'BEGIN of Description_32'
3361 ,p_level => C_LEVEL_PROCEDURE
3362 ,p_module => l_log_module);
3363 END IF;
3364
3365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
3366 l_component_type := 'AMB_DESCRIPTION';
3367 l_component_code := 'FA_CIP_RETIREMENT';
3368 l_component_type_code := 'S';
3369 l_component_appl_id := 140;
3370 l_amb_context_code := 'DEFAULT';
3371 l_source := NULL;
3372 l_description := NULL;
3373
3374
3375
3376 IF
3377 l_ledger_language = 'US' THEN
3378 l_description := SUBSTR(CONCAT(l_description,'CIP Retirement'),1,2000);
3379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3380 END IF;
3381 IF
3382 l_ledger_language = 'US' THEN
3383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
3384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3385 END IF;
3386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
3387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
3388 IF l_source IS NOT NULL THEN
3389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
3390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3391 END IF;
3392 l_description := SUBSTR(l_description,1,1996);
3393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3394 trace
3395 (p_msg => 'END of Description_32'
3396 ,p_level => C_LEVEL_PROCEDURE
3397 ,p_module => l_log_module);
3398
3399 END IF;
3400 RETURN l_description;
3401
3402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3403 trace
3404 (p_msg => 'END of Description_32'
3405 ,p_level => C_LEVEL_PROCEDURE
3406 ,p_module => l_log_module);
3407 END IF;
3408 RETURN NULL;
3409 EXCEPTION
3410 WHEN VALUE_ERROR THEN
3411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3412 trace
3413 (p_msg => 'ERROR: '||sqlerrm
3414 ,p_level => C_LEVEL_EXCEPTION
3415 ,p_module => l_log_module);
3416 END IF;
3417 RAISE;
3418 WHEN xla_exceptions_pkg.application_exception THEN
3419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3420 trace
3421 (p_msg => 'ERROR: '||sqlerrm
3422 ,p_level => C_LEVEL_EXCEPTION
3423 ,p_module => l_log_module);
3424 END IF;
3425 RAISE;
3426 WHEN OTHERS THEN
3427 xla_exceptions_pkg.raise_message
3428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_32');
3429 END Description_32;
3430
3431 ---------------------------------------
3432 --
3433 -- PRIVATE FUNCTION
3434 -- Description_33
3435 --
3436 ---------------------------------------
3437 FUNCTION Description_33 (
3438 p_application_id IN NUMBER
3439 , p_ae_header_id IN NUMBER DEFAULT NULL
3440 --Period Close Date
3441 , p_source_1 IN DATE
3442 )
3443 RETURN VARCHAR2
3444 IS
3445 l_component_type VARCHAR2(80) ;
3446 l_component_code VARCHAR2(30) ;
3447 l_component_type_code VARCHAR2(1) ;
3448 l_component_appl_id INTEGER ;
3449 l_amb_context_code VARCHAR2(30) ;
3450 l_ledger_language VARCHAR2(30) ;
3451 l_source VARCHAR2(1996) ;
3452 l_description VARCHAR2(2000) ;
3453 l_log_module VARCHAR2(240) ;
3454 BEGIN
3455 IF g_log_enabled THEN
3456 l_log_module := C_DEFAULT_MODULE||'.Description_33';
3457 END IF;
3458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3459 trace
3460 (p_msg => 'BEGIN of Description_33'
3461 ,p_level => C_LEVEL_PROCEDURE
3462 ,p_module => l_log_module);
3463 END IF;
3464
3465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
3466 l_component_type := 'AMB_DESCRIPTION';
3467 l_component_code := 'FA_CIP_RETIREMENT_COST';
3468 l_component_type_code := 'S';
3469 l_component_appl_id := 140;
3470 l_amb_context_code := 'DEFAULT';
3471 l_source := NULL;
3472 l_description := NULL;
3473
3474
3475
3476 IF
3477 l_ledger_language = 'US' THEN
3478 l_description := SUBSTR(CONCAT(l_description,'CIP Retirement Cost'),1,2000);
3479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3480 END IF;
3481 IF
3482 l_ledger_language = 'US' THEN
3483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
3484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3485 END IF;
3486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
3490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
3488 IF l_source IS NOT NULL THEN
3489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
3491 END IF;
3492 l_description := SUBSTR(l_description,1,1996);
3493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3494 trace
3495 (p_msg => 'END of Description_33'
3496 ,p_level => C_LEVEL_PROCEDURE
3497 ,p_module => l_log_module);
3498
3499 END IF;
3500 RETURN l_description;
3501
3502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3503 trace
3504 (p_msg => 'END of Description_33'
3505 ,p_level => C_LEVEL_PROCEDURE
3506 ,p_module => l_log_module);
3507 END IF;
3508 RETURN NULL;
3509 EXCEPTION
3510 WHEN VALUE_ERROR THEN
3511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3512 trace
3513 (p_msg => 'ERROR: '||sqlerrm
3514 ,p_level => C_LEVEL_EXCEPTION
3515 ,p_module => l_log_module);
3516 END IF;
3517 RAISE;
3518 WHEN xla_exceptions_pkg.application_exception THEN
3519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3520 trace
3521 (p_msg => 'ERROR: '||sqlerrm
3522 ,p_level => C_LEVEL_EXCEPTION
3523 ,p_module => l_log_module);
3524 END IF;
3525 RAISE;
3526 WHEN OTHERS THEN
3527 xla_exceptions_pkg.raise_message
3528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_33');
3529 END Description_33;
3530
3531 ---------------------------------------
3532 --
3533 -- PRIVATE FUNCTION
3534 -- Description_34
3535 --
3536 ---------------------------------------
3537 FUNCTION Description_34 (
3538 p_application_id IN NUMBER
3539 , p_ae_header_id IN NUMBER DEFAULT NULL
3540 --Period Close Date
3541 , p_source_1 IN DATE
3542 )
3543 RETURN VARCHAR2
3544 IS
3545 l_component_type VARCHAR2(80) ;
3546 l_component_code VARCHAR2(30) ;
3547 l_component_type_code VARCHAR2(1) ;
3548 l_component_appl_id INTEGER ;
3549 l_amb_context_code VARCHAR2(30) ;
3550 l_ledger_language VARCHAR2(30) ;
3551 l_source VARCHAR2(1996) ;
3552 l_description VARCHAR2(2000) ;
3553 l_log_module VARCHAR2(240) ;
3554 BEGIN
3555 IF g_log_enabled THEN
3556 l_log_module := C_DEFAULT_MODULE||'.Description_34';
3557 END IF;
3558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3559 trace
3560 (p_msg => 'BEGIN of Description_34'
3561 ,p_level => C_LEVEL_PROCEDURE
3562 ,p_module => l_log_module);
3563 END IF;
3564
3565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
3566 l_component_type := 'AMB_DESCRIPTION';
3567 l_component_code := 'FA_CIP_RETIREMENT_NBV_RETIRED';
3568 l_component_type_code := 'S';
3569 l_component_appl_id := 140;
3570 l_amb_context_code := 'DEFAULT';
3571 l_source := NULL;
3572 l_description := NULL;
3573
3574
3575
3576 IF
3577 l_ledger_language = 'US' THEN
3578 l_description := SUBSTR(CONCAT(l_description,'CIP Retirement NBV Retired'),1,2000);
3579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3580 END IF;
3581 IF
3582 l_ledger_language = 'US' THEN
3583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
3584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3585 END IF;
3586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
3587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
3588 IF l_source IS NOT NULL THEN
3589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
3590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3591 END IF;
3592 l_description := SUBSTR(l_description,1,1996);
3593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3594 trace
3595 (p_msg => 'END of Description_34'
3596 ,p_level => C_LEVEL_PROCEDURE
3597 ,p_module => l_log_module);
3598
3599 END IF;
3600 RETURN l_description;
3601
3602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3603 trace
3604 (p_msg => 'END of Description_34'
3605 ,p_level => C_LEVEL_PROCEDURE
3606 ,p_module => l_log_module);
3607 END IF;
3608 RETURN NULL;
3609 EXCEPTION
3610 WHEN VALUE_ERROR THEN
3611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3612 trace
3613 (p_msg => 'ERROR: '||sqlerrm
3614 ,p_level => C_LEVEL_EXCEPTION
3615 ,p_module => l_log_module);
3616 END IF;
3617 RAISE;
3618 WHEN xla_exceptions_pkg.application_exception THEN
3619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3620 trace
3621 (p_msg => 'ERROR: '||sqlerrm
3622 ,p_level => C_LEVEL_EXCEPTION
3623 ,p_module => l_log_module);
3624 END IF;
3625 RAISE;
3626 WHEN OTHERS THEN
3627 xla_exceptions_pkg.raise_message
3628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_34');
3629 END Description_34;
3630
3631 ---------------------------------------
3632 --
3636 ---------------------------------------
3633 -- PRIVATE FUNCTION
3634 -- Description_35
3635 --
3637 FUNCTION Description_35 (
3638 p_application_id IN NUMBER
3639 , p_ae_header_id IN NUMBER DEFAULT NULL
3640 --Period Close Date
3641 , p_source_1 IN DATE
3642 )
3643 RETURN VARCHAR2
3644 IS
3645 l_component_type VARCHAR2(80) ;
3646 l_component_code VARCHAR2(30) ;
3647 l_component_type_code VARCHAR2(1) ;
3648 l_component_appl_id INTEGER ;
3649 l_amb_context_code VARCHAR2(30) ;
3650 l_ledger_language VARCHAR2(30) ;
3651 l_source VARCHAR2(1996) ;
3652 l_description VARCHAR2(2000) ;
3653 l_log_module VARCHAR2(240) ;
3654 BEGIN
3655 IF g_log_enabled THEN
3656 l_log_module := C_DEFAULT_MODULE||'.Description_35';
3657 END IF;
3658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3659 trace
3660 (p_msg => 'BEGIN of Description_35'
3661 ,p_level => C_LEVEL_PROCEDURE
3662 ,p_module => l_log_module);
3663 END IF;
3664
3665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
3666 l_component_type := 'AMB_DESCRIPTION';
3667 l_component_code := 'FA_CIP_RETIREMENT_PROC_OF_SALE';
3668 l_component_type_code := 'S';
3669 l_component_appl_id := 140;
3670 l_amb_context_code := 'DEFAULT';
3671 l_source := NULL;
3672 l_description := NULL;
3673
3674
3675
3676 IF
3677 l_ledger_language = 'US' THEN
3678 l_description := SUBSTR(CONCAT(l_description,'CIP Retirement Proceeds of Sale'),1,2000);
3679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3680 END IF;
3681 IF
3682 l_ledger_language = 'US' THEN
3683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
3684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3685 END IF;
3686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
3687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
3688 IF l_source IS NOT NULL THEN
3689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
3690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3691 END IF;
3692 l_description := SUBSTR(l_description,1,1996);
3693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3694 trace
3695 (p_msg => 'END of Description_35'
3696 ,p_level => C_LEVEL_PROCEDURE
3697 ,p_module => l_log_module);
3698
3699 END IF;
3700 RETURN l_description;
3701
3702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3703 trace
3704 (p_msg => 'END of Description_35'
3705 ,p_level => C_LEVEL_PROCEDURE
3706 ,p_module => l_log_module);
3707 END IF;
3708 RETURN NULL;
3709 EXCEPTION
3710 WHEN VALUE_ERROR THEN
3711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3712 trace
3713 (p_msg => 'ERROR: '||sqlerrm
3714 ,p_level => C_LEVEL_EXCEPTION
3715 ,p_module => l_log_module);
3716 END IF;
3717 RAISE;
3718 WHEN xla_exceptions_pkg.application_exception THEN
3719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3720 trace
3721 (p_msg => 'ERROR: '||sqlerrm
3722 ,p_level => C_LEVEL_EXCEPTION
3723 ,p_module => l_log_module);
3724 END IF;
3725 RAISE;
3726 WHEN OTHERS THEN
3727 xla_exceptions_pkg.raise_message
3728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_35');
3729 END Description_35;
3730
3731 ---------------------------------------
3732 --
3733 -- PRIVATE FUNCTION
3734 -- Description_36
3735 --
3736 ---------------------------------------
3737 FUNCTION Description_36 (
3738 p_application_id IN NUMBER
3739 , p_ae_header_id IN NUMBER DEFAULT NULL
3740 --Period Close Date
3741 , p_source_1 IN DATE
3742 )
3743 RETURN VARCHAR2
3744 IS
3745 l_component_type VARCHAR2(80) ;
3746 l_component_code VARCHAR2(30) ;
3747 l_component_type_code VARCHAR2(1) ;
3748 l_component_appl_id INTEGER ;
3749 l_amb_context_code VARCHAR2(30) ;
3750 l_ledger_language VARCHAR2(30) ;
3751 l_source VARCHAR2(1996) ;
3752 l_description VARCHAR2(2000) ;
3753 l_log_module VARCHAR2(240) ;
3754 BEGIN
3755 IF g_log_enabled THEN
3756 l_log_module := C_DEFAULT_MODULE||'.Description_36';
3757 END IF;
3758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3759 trace
3760 (p_msg => 'BEGIN of Description_36'
3761 ,p_level => C_LEVEL_PROCEDURE
3762 ,p_module => l_log_module);
3763 END IF;
3764
3765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
3766 l_component_type := 'AMB_DESCRIPTION';
3767 l_component_code := 'FA_CIP_RET_COST_OF_REMOVAL';
3768 l_component_type_code := 'S';
3769 l_component_appl_id := 140;
3770 l_amb_context_code := 'DEFAULT';
3771 l_source := NULL;
3772 l_description := NULL;
3773
3774
3775
3776 IF
3777 l_ledger_language = 'US' THEN
3781 IF
3778 l_description := SUBSTR(CONCAT(l_description,'CIP Retirement Cost of Removal'),1,2000);
3779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3780 END IF;
3782 l_ledger_language = 'US' THEN
3783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
3784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3785 END IF;
3786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
3787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
3788 IF l_source IS NOT NULL THEN
3789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
3790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3791 END IF;
3792 l_description := SUBSTR(l_description,1,1996);
3793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3794 trace
3795 (p_msg => 'END of Description_36'
3796 ,p_level => C_LEVEL_PROCEDURE
3797 ,p_module => l_log_module);
3798
3799 END IF;
3800 RETURN l_description;
3801
3802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3803 trace
3804 (p_msg => 'END of Description_36'
3805 ,p_level => C_LEVEL_PROCEDURE
3806 ,p_module => l_log_module);
3807 END IF;
3808 RETURN NULL;
3809 EXCEPTION
3810 WHEN VALUE_ERROR THEN
3811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3812 trace
3813 (p_msg => 'ERROR: '||sqlerrm
3814 ,p_level => C_LEVEL_EXCEPTION
3815 ,p_module => l_log_module);
3816 END IF;
3817 RAISE;
3818 WHEN xla_exceptions_pkg.application_exception THEN
3819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3820 trace
3821 (p_msg => 'ERROR: '||sqlerrm
3822 ,p_level => C_LEVEL_EXCEPTION
3823 ,p_module => l_log_module);
3824 END IF;
3825 RAISE;
3826 WHEN OTHERS THEN
3827 xla_exceptions_pkg.raise_message
3828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_36');
3829 END Description_36;
3830
3831 ---------------------------------------
3832 --
3833 -- PRIVATE FUNCTION
3834 -- Description_37
3835 --
3836 ---------------------------------------
3837 FUNCTION Description_37 (
3838 p_application_id IN NUMBER
3839 , p_ae_header_id IN NUMBER DEFAULT NULL
3840 --Period Close Date
3841 , p_source_1 IN DATE
3842 )
3843 RETURN VARCHAR2
3844 IS
3845 l_component_type VARCHAR2(80) ;
3846 l_component_code VARCHAR2(30) ;
3847 l_component_type_code VARCHAR2(1) ;
3848 l_component_appl_id INTEGER ;
3849 l_amb_context_code VARCHAR2(30) ;
3850 l_ledger_language VARCHAR2(30) ;
3851 l_source VARCHAR2(1996) ;
3852 l_description VARCHAR2(2000) ;
3853 l_log_module VARCHAR2(240) ;
3854 BEGIN
3855 IF g_log_enabled THEN
3856 l_log_module := C_DEFAULT_MODULE||'.Description_37';
3857 END IF;
3858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3859 trace
3860 (p_msg => 'BEGIN of Description_37'
3861 ,p_level => C_LEVEL_PROCEDURE
3862 ,p_module => l_log_module);
3863 END IF;
3864
3865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
3866 l_component_type := 'AMB_DESCRIPTION';
3867 l_component_code := 'FA_CIP_RET_COST_OF_REMOVAL_CLR';
3868 l_component_type_code := 'S';
3869 l_component_appl_id := 140;
3870 l_amb_context_code := 'DEFAULT';
3871 l_source := NULL;
3872 l_description := NULL;
3873
3874
3875
3876 IF
3877 l_ledger_language = 'US' THEN
3878 l_description := SUBSTR(CONCAT(l_description,'CIP Retirement Cost of Removal Clearing'),1,2000);
3879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3880 END IF;
3881 IF
3882 l_ledger_language = 'US' THEN
3883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
3884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3885 END IF;
3886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
3887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
3888 IF l_source IS NOT NULL THEN
3889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
3890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3891 END IF;
3892 l_description := SUBSTR(l_description,1,1996);
3893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3894 trace
3895 (p_msg => 'END of Description_37'
3896 ,p_level => C_LEVEL_PROCEDURE
3897 ,p_module => l_log_module);
3898
3899 END IF;
3900 RETURN l_description;
3901
3902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3903 trace
3904 (p_msg => 'END of Description_37'
3905 ,p_level => C_LEVEL_PROCEDURE
3906 ,p_module => l_log_module);
3907 END IF;
3908 RETURN NULL;
3909 EXCEPTION
3910 WHEN VALUE_ERROR THEN
3911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3912 trace
3913 (p_msg => 'ERROR: '||sqlerrm
3914 ,p_level => C_LEVEL_EXCEPTION
3918 WHEN xla_exceptions_pkg.application_exception THEN
3915 ,p_module => l_log_module);
3916 END IF;
3917 RAISE;
3919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
3920 trace
3921 (p_msg => 'ERROR: '||sqlerrm
3922 ,p_level => C_LEVEL_EXCEPTION
3923 ,p_module => l_log_module);
3924 END IF;
3925 RAISE;
3926 WHEN OTHERS THEN
3927 xla_exceptions_pkg.raise_message
3928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_37');
3929 END Description_37;
3930
3931 ---------------------------------------
3932 --
3933 -- PRIVATE FUNCTION
3934 -- Description_38
3935 --
3936 ---------------------------------------
3937 FUNCTION Description_38 (
3938 p_application_id IN NUMBER
3939 , p_ae_header_id IN NUMBER DEFAULT NULL
3940 --Period Close Date
3941 , p_source_1 IN DATE
3942 )
3943 RETURN VARCHAR2
3944 IS
3945 l_component_type VARCHAR2(80) ;
3946 l_component_code VARCHAR2(30) ;
3947 l_component_type_code VARCHAR2(1) ;
3948 l_component_appl_id INTEGER ;
3949 l_amb_context_code VARCHAR2(30) ;
3950 l_ledger_language VARCHAR2(30) ;
3951 l_source VARCHAR2(1996) ;
3952 l_description VARCHAR2(2000) ;
3953 l_log_module VARCHAR2(240) ;
3954 BEGIN
3955 IF g_log_enabled THEN
3956 l_log_module := C_DEFAULT_MODULE||'.Description_38';
3957 END IF;
3958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3959 trace
3960 (p_msg => 'BEGIN of Description_38'
3961 ,p_level => C_LEVEL_PROCEDURE
3962 ,p_module => l_log_module);
3963 END IF;
3964
3965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
3966 l_component_type := 'AMB_DESCRIPTION';
3967 l_component_code := 'FA_CIP_RET_PROC_OF_SALE_CLEAR';
3968 l_component_type_code := 'S';
3969 l_component_appl_id := 140;
3970 l_amb_context_code := 'DEFAULT';
3971 l_source := NULL;
3972 l_description := NULL;
3973
3974
3975
3976 IF
3977 l_ledger_language = 'US' THEN
3978 l_description := SUBSTR(CONCAT(l_description,'CIP Retirement Proceeds of Sale Clearing'),1,2000);
3979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3980 END IF;
3981 IF
3982 l_ledger_language = 'US' THEN
3983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
3984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3985 END IF;
3986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
3987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
3988 IF l_source IS NOT NULL THEN
3989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
3990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
3991 END IF;
3992 l_description := SUBSTR(l_description,1,1996);
3993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
3994 trace
3995 (p_msg => 'END of Description_38'
3996 ,p_level => C_LEVEL_PROCEDURE
3997 ,p_module => l_log_module);
3998
3999 END IF;
4000 RETURN l_description;
4001
4002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4003 trace
4004 (p_msg => 'END of Description_38'
4005 ,p_level => C_LEVEL_PROCEDURE
4006 ,p_module => l_log_module);
4007 END IF;
4008 RETURN NULL;
4009 EXCEPTION
4010 WHEN VALUE_ERROR THEN
4011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4012 trace
4013 (p_msg => 'ERROR: '||sqlerrm
4014 ,p_level => C_LEVEL_EXCEPTION
4015 ,p_module => l_log_module);
4016 END IF;
4017 RAISE;
4018 WHEN xla_exceptions_pkg.application_exception THEN
4019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4020 trace
4021 (p_msg => 'ERROR: '||sqlerrm
4022 ,p_level => C_LEVEL_EXCEPTION
4023 ,p_module => l_log_module);
4024 END IF;
4025 RAISE;
4026 WHEN OTHERS THEN
4027 xla_exceptions_pkg.raise_message
4028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_38');
4029 END Description_38;
4030
4031 ---------------------------------------
4032 --
4033 -- PRIVATE FUNCTION
4034 -- Description_39
4035 --
4036 ---------------------------------------
4037 FUNCTION Description_39 (
4038 p_application_id IN NUMBER
4039 , p_ae_header_id IN NUMBER DEFAULT NULL
4040 --Period Close Date
4041 , p_source_1 IN DATE
4042 )
4043 RETURN VARCHAR2
4044 IS
4045 l_component_type VARCHAR2(80) ;
4046 l_component_code VARCHAR2(30) ;
4047 l_component_type_code VARCHAR2(1) ;
4048 l_component_appl_id INTEGER ;
4049 l_amb_context_code VARCHAR2(30) ;
4050 l_ledger_language VARCHAR2(30) ;
4051 l_source VARCHAR2(1996) ;
4052 l_description VARCHAR2(2000) ;
4053 l_log_module VARCHAR2(240) ;
4054 BEGIN
4055 IF g_log_enabled THEN
4056 l_log_module := C_DEFAULT_MODULE||'.Description_39';
4057 END IF;
4061 ,p_level => C_LEVEL_PROCEDURE
4058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4059 trace
4060 (p_msg => 'BEGIN of Description_39'
4062 ,p_module => l_log_module);
4063 END IF;
4064
4065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
4066 l_component_type := 'AMB_DESCRIPTION';
4067 l_component_code := 'FA_CIP_RET_REVAL_RESERVE';
4068 l_component_type_code := 'S';
4069 l_component_appl_id := 140;
4070 l_amb_context_code := 'DEFAULT';
4071 l_source := NULL;
4072 l_description := NULL;
4073
4074
4075
4076 IF
4077 l_ledger_language = 'US' THEN
4078 l_description := SUBSTR(CONCAT(l_description,'CIP Retirement Revaluation Reserve'),1,2000);
4079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4080 END IF;
4081 IF
4082 l_ledger_language = 'US' THEN
4083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
4084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4085 END IF;
4086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
4087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
4088 IF l_source IS NOT NULL THEN
4089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
4090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4091 END IF;
4092 l_description := SUBSTR(l_description,1,1996);
4093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4094 trace
4095 (p_msg => 'END of Description_39'
4096 ,p_level => C_LEVEL_PROCEDURE
4097 ,p_module => l_log_module);
4098
4099 END IF;
4100 RETURN l_description;
4101
4102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4103 trace
4104 (p_msg => 'END of Description_39'
4105 ,p_level => C_LEVEL_PROCEDURE
4106 ,p_module => l_log_module);
4107 END IF;
4108 RETURN NULL;
4109 EXCEPTION
4110 WHEN VALUE_ERROR THEN
4111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4112 trace
4113 (p_msg => 'ERROR: '||sqlerrm
4114 ,p_level => C_LEVEL_EXCEPTION
4115 ,p_module => l_log_module);
4116 END IF;
4117 RAISE;
4118 WHEN xla_exceptions_pkg.application_exception THEN
4119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4120 trace
4121 (p_msg => 'ERROR: '||sqlerrm
4122 ,p_level => C_LEVEL_EXCEPTION
4123 ,p_module => l_log_module);
4124 END IF;
4125 RAISE;
4126 WHEN OTHERS THEN
4127 xla_exceptions_pkg.raise_message
4128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_39');
4129 END Description_39;
4130
4131 ---------------------------------------
4132 --
4133 -- PRIVATE FUNCTION
4134 -- Description_40
4135 --
4136 ---------------------------------------
4137 FUNCTION Description_40 (
4138 p_application_id IN NUMBER
4139 , p_ae_header_id IN NUMBER DEFAULT NULL
4140 --Period Close Date
4141 , p_source_1 IN DATE
4142 )
4143 RETURN VARCHAR2
4144 IS
4145 l_component_type VARCHAR2(80) ;
4146 l_component_code VARCHAR2(30) ;
4147 l_component_type_code VARCHAR2(1) ;
4148 l_component_appl_id INTEGER ;
4149 l_amb_context_code VARCHAR2(30) ;
4150 l_ledger_language VARCHAR2(30) ;
4151 l_source VARCHAR2(1996) ;
4152 l_description VARCHAR2(2000) ;
4153 l_log_module VARCHAR2(240) ;
4154 BEGIN
4155 IF g_log_enabled THEN
4156 l_log_module := C_DEFAULT_MODULE||'.Description_40';
4157 END IF;
4158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4159 trace
4160 (p_msg => 'BEGIN of Description_40'
4161 ,p_level => C_LEVEL_PROCEDURE
4162 ,p_module => l_log_module);
4163 END IF;
4164
4165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
4166 l_component_type := 'AMB_DESCRIPTION';
4167 l_component_code := 'FA_CIP_RET_REVAL_RES_RETIRED';
4168 l_component_type_code := 'S';
4169 l_component_appl_id := 140;
4170 l_amb_context_code := 'DEFAULT';
4171 l_source := NULL;
4172 l_description := NULL;
4173
4174
4175
4176 IF
4177 l_ledger_language = 'US' THEN
4178 l_description := SUBSTR(CONCAT(l_description,'CIP Retirement Revaluation Reserve Retired'),1,2000);
4179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4180 END IF;
4181 IF
4182 l_ledger_language = 'US' THEN
4183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
4184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4185 END IF;
4186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
4187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
4188 IF l_source IS NOT NULL THEN
4189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
4190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4191 END IF;
4192 l_description := SUBSTR(l_description,1,1996);
4193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4197 ,p_module => l_log_module);
4194 trace
4195 (p_msg => 'END of Description_40'
4196 ,p_level => C_LEVEL_PROCEDURE
4198
4199 END IF;
4200 RETURN l_description;
4201
4202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4203 trace
4204 (p_msg => 'END of Description_40'
4205 ,p_level => C_LEVEL_PROCEDURE
4206 ,p_module => l_log_module);
4207 END IF;
4208 RETURN NULL;
4209 EXCEPTION
4210 WHEN VALUE_ERROR THEN
4211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4212 trace
4213 (p_msg => 'ERROR: '||sqlerrm
4214 ,p_level => C_LEVEL_EXCEPTION
4215 ,p_module => l_log_module);
4216 END IF;
4217 RAISE;
4218 WHEN xla_exceptions_pkg.application_exception THEN
4219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4220 trace
4221 (p_msg => 'ERROR: '||sqlerrm
4222 ,p_level => C_LEVEL_EXCEPTION
4223 ,p_module => l_log_module);
4224 END IF;
4225 RAISE;
4226 WHEN OTHERS THEN
4227 xla_exceptions_pkg.raise_message
4228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_40');
4229 END Description_40;
4230
4231 ---------------------------------------
4232 --
4233 -- PRIVATE FUNCTION
4234 -- Description_41
4235 --
4236 ---------------------------------------
4237 FUNCTION Description_41 (
4238 p_application_id IN NUMBER
4239 , p_ae_header_id IN NUMBER DEFAULT NULL
4240 --Period Close Date
4241 , p_source_1 IN DATE
4242 )
4243 RETURN VARCHAR2
4244 IS
4245 l_component_type VARCHAR2(80) ;
4246 l_component_code VARCHAR2(30) ;
4247 l_component_type_code VARCHAR2(1) ;
4248 l_component_appl_id INTEGER ;
4249 l_amb_context_code VARCHAR2(30) ;
4250 l_ledger_language VARCHAR2(30) ;
4251 l_source VARCHAR2(1996) ;
4252 l_description VARCHAR2(2000) ;
4253 l_log_module VARCHAR2(240) ;
4254 BEGIN
4255 IF g_log_enabled THEN
4256 l_log_module := C_DEFAULT_MODULE||'.Description_41';
4257 END IF;
4258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4259 trace
4260 (p_msg => 'BEGIN of Description_41'
4261 ,p_level => C_LEVEL_PROCEDURE
4262 ,p_module => l_log_module);
4263 END IF;
4264
4265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
4266 l_component_type := 'AMB_DESCRIPTION';
4267 l_component_code := 'FA_CIP_REVALUATION';
4268 l_component_type_code := 'S';
4269 l_component_appl_id := 140;
4270 l_amb_context_code := 'DEFAULT';
4271 l_source := NULL;
4272 l_description := NULL;
4273
4274
4275
4276 IF
4277 l_ledger_language = 'US' THEN
4278 l_description := SUBSTR(CONCAT(l_description,'CIP Revaluation'),1,2000);
4279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4280 END IF;
4281 IF
4282 l_ledger_language = 'US' THEN
4283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
4284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4285 END IF;
4286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
4287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
4288 IF l_source IS NOT NULL THEN
4289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
4290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4291 END IF;
4292 l_description := SUBSTR(l_description,1,1996);
4293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4294 trace
4295 (p_msg => 'END of Description_41'
4296 ,p_level => C_LEVEL_PROCEDURE
4297 ,p_module => l_log_module);
4298
4299 END IF;
4300 RETURN l_description;
4301
4302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4303 trace
4304 (p_msg => 'END of Description_41'
4305 ,p_level => C_LEVEL_PROCEDURE
4306 ,p_module => l_log_module);
4307 END IF;
4308 RETURN NULL;
4309 EXCEPTION
4310 WHEN VALUE_ERROR THEN
4311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4312 trace
4313 (p_msg => 'ERROR: '||sqlerrm
4314 ,p_level => C_LEVEL_EXCEPTION
4315 ,p_module => l_log_module);
4316 END IF;
4317 RAISE;
4318 WHEN xla_exceptions_pkg.application_exception THEN
4319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4320 trace
4321 (p_msg => 'ERROR: '||sqlerrm
4322 ,p_level => C_LEVEL_EXCEPTION
4323 ,p_module => l_log_module);
4324 END IF;
4325 RAISE;
4326 WHEN OTHERS THEN
4327 xla_exceptions_pkg.raise_message
4328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_41');
4329 END Description_41;
4330
4331 ---------------------------------------
4332 --
4333 -- PRIVATE FUNCTION
4334 -- Description_42
4335 --
4336 ---------------------------------------
4337 FUNCTION Description_42 (
4338 p_application_id IN NUMBER
4342 )
4339 , p_ae_header_id IN NUMBER DEFAULT NULL
4340 --Period Close Date
4341 , p_source_1 IN DATE
4343 RETURN VARCHAR2
4344 IS
4345 l_component_type VARCHAR2(80) ;
4346 l_component_code VARCHAR2(30) ;
4347 l_component_type_code VARCHAR2(1) ;
4348 l_component_appl_id INTEGER ;
4349 l_amb_context_code VARCHAR2(30) ;
4350 l_ledger_language VARCHAR2(30) ;
4351 l_source VARCHAR2(1996) ;
4352 l_description VARCHAR2(2000) ;
4353 l_log_module VARCHAR2(240) ;
4354 BEGIN
4355 IF g_log_enabled THEN
4356 l_log_module := C_DEFAULT_MODULE||'.Description_42';
4357 END IF;
4358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4359 trace
4360 (p_msg => 'BEGIN of Description_42'
4361 ,p_level => C_LEVEL_PROCEDURE
4362 ,p_module => l_log_module);
4363 END IF;
4364
4365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
4366 l_component_type := 'AMB_DESCRIPTION';
4367 l_component_code := 'FA_CIP_REVAL_COST';
4368 l_component_type_code := 'S';
4369 l_component_appl_id := 140;
4370 l_amb_context_code := 'DEFAULT';
4371 l_source := NULL;
4372 l_description := NULL;
4373
4374
4375
4376 IF
4377 l_ledger_language = 'US' THEN
4378 l_description := SUBSTR(CONCAT(l_description,'CIP Revaluation Cost'),1,2000);
4379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4380 END IF;
4381 IF
4382 l_ledger_language = 'US' THEN
4383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
4384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4385 END IF;
4386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
4387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
4388 IF l_source IS NOT NULL THEN
4389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
4390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4391 END IF;
4392 l_description := SUBSTR(l_description,1,1996);
4393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4394 trace
4395 (p_msg => 'END of Description_42'
4396 ,p_level => C_LEVEL_PROCEDURE
4397 ,p_module => l_log_module);
4398
4399 END IF;
4400 RETURN l_description;
4401
4402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4403 trace
4404 (p_msg => 'END of Description_42'
4405 ,p_level => C_LEVEL_PROCEDURE
4406 ,p_module => l_log_module);
4407 END IF;
4408 RETURN NULL;
4409 EXCEPTION
4410 WHEN VALUE_ERROR THEN
4411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4412 trace
4413 (p_msg => 'ERROR: '||sqlerrm
4414 ,p_level => C_LEVEL_EXCEPTION
4415 ,p_module => l_log_module);
4416 END IF;
4417 RAISE;
4418 WHEN xla_exceptions_pkg.application_exception THEN
4419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4420 trace
4421 (p_msg => 'ERROR: '||sqlerrm
4422 ,p_level => C_LEVEL_EXCEPTION
4423 ,p_module => l_log_module);
4424 END IF;
4425 RAISE;
4426 WHEN OTHERS THEN
4427 xla_exceptions_pkg.raise_message
4428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_42');
4429 END Description_42;
4430
4431 ---------------------------------------
4432 --
4433 -- PRIVATE FUNCTION
4434 -- Description_43
4435 --
4436 ---------------------------------------
4437 FUNCTION Description_43 (
4438 p_application_id IN NUMBER
4439 , p_ae_header_id IN NUMBER DEFAULT NULL
4440 --Period Close Date
4441 , p_source_1 IN DATE
4442 )
4443 RETURN VARCHAR2
4444 IS
4445 l_component_type VARCHAR2(80) ;
4446 l_component_code VARCHAR2(30) ;
4447 l_component_type_code VARCHAR2(1) ;
4448 l_component_appl_id INTEGER ;
4449 l_amb_context_code VARCHAR2(30) ;
4450 l_ledger_language VARCHAR2(30) ;
4451 l_source VARCHAR2(1996) ;
4452 l_description VARCHAR2(2000) ;
4453 l_log_module VARCHAR2(240) ;
4454 BEGIN
4455 IF g_log_enabled THEN
4456 l_log_module := C_DEFAULT_MODULE||'.Description_43';
4457 END IF;
4458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4459 trace
4460 (p_msg => 'BEGIN of Description_43'
4461 ,p_level => C_LEVEL_PROCEDURE
4462 ,p_module => l_log_module);
4463 END IF;
4464
4465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
4466 l_component_type := 'AMB_DESCRIPTION';
4467 l_component_code := 'FA_CIP_REVAL_RESERVE';
4468 l_component_type_code := 'S';
4469 l_component_appl_id := 140;
4470 l_amb_context_code := 'DEFAULT';
4471 l_source := NULL;
4472 l_description := NULL;
4473
4474
4475
4476 IF
4477 l_ledger_language = 'US' THEN
4478 l_description := SUBSTR(CONCAT(l_description,'CIP Revaluation Reserve'),1,2000);
4479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4480 END IF;
4484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4481 IF
4482 l_ledger_language = 'US' THEN
4483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
4485 END IF;
4486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
4487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
4488 IF l_source IS NOT NULL THEN
4489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
4490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4491 END IF;
4492 l_description := SUBSTR(l_description,1,1996);
4493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4494 trace
4495 (p_msg => 'END of Description_43'
4496 ,p_level => C_LEVEL_PROCEDURE
4497 ,p_module => l_log_module);
4498
4499 END IF;
4500 RETURN l_description;
4501
4502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4503 trace
4504 (p_msg => 'END of Description_43'
4505 ,p_level => C_LEVEL_PROCEDURE
4506 ,p_module => l_log_module);
4507 END IF;
4508 RETURN NULL;
4509 EXCEPTION
4510 WHEN VALUE_ERROR THEN
4511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4512 trace
4513 (p_msg => 'ERROR: '||sqlerrm
4514 ,p_level => C_LEVEL_EXCEPTION
4515 ,p_module => l_log_module);
4516 END IF;
4517 RAISE;
4518 WHEN xla_exceptions_pkg.application_exception THEN
4519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4520 trace
4521 (p_msg => 'ERROR: '||sqlerrm
4522 ,p_level => C_LEVEL_EXCEPTION
4523 ,p_module => l_log_module);
4524 END IF;
4525 RAISE;
4526 WHEN OTHERS THEN
4527 xla_exceptions_pkg.raise_message
4528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_43');
4529 END Description_43;
4530
4531 ---------------------------------------
4532 --
4533 -- PRIVATE FUNCTION
4534 -- Description_44
4535 --
4536 ---------------------------------------
4537 FUNCTION Description_44 (
4538 p_application_id IN NUMBER
4539 , p_ae_header_id IN NUMBER DEFAULT NULL
4540 --Period Close Date
4541 , p_source_1 IN DATE
4542 )
4543 RETURN VARCHAR2
4544 IS
4545 l_component_type VARCHAR2(80) ;
4546 l_component_code VARCHAR2(30) ;
4547 l_component_type_code VARCHAR2(1) ;
4548 l_component_appl_id INTEGER ;
4549 l_amb_context_code VARCHAR2(30) ;
4550 l_ledger_language VARCHAR2(30) ;
4551 l_source VARCHAR2(1996) ;
4552 l_description VARCHAR2(2000) ;
4553 l_log_module VARCHAR2(240) ;
4554 BEGIN
4555 IF g_log_enabled THEN
4556 l_log_module := C_DEFAULT_MODULE||'.Description_44';
4557 END IF;
4558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4559 trace
4560 (p_msg => 'BEGIN of Description_44'
4561 ,p_level => C_LEVEL_PROCEDURE
4562 ,p_module => l_log_module);
4563 END IF;
4564
4565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
4566 l_component_type := 'AMB_DESCRIPTION';
4567 l_component_code := 'FA_CIP_SOURCE_LINE_TRANSFER';
4568 l_component_type_code := 'S';
4569 l_component_appl_id := 140;
4570 l_amb_context_code := 'DEFAULT';
4571 l_source := NULL;
4572 l_description := NULL;
4573
4574
4575
4576 IF
4577 l_ledger_language = 'US' THEN
4578 l_description := SUBSTR(CONCAT(l_description,'CIP Source Line Transfer'),1,2000);
4579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4580 END IF;
4581 IF
4582 l_ledger_language = 'US' THEN
4583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
4584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4585 END IF;
4586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
4587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
4588 IF l_source IS NOT NULL THEN
4589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
4590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4591 END IF;
4592 l_description := SUBSTR(l_description,1,1996);
4593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4594 trace
4595 (p_msg => 'END of Description_44'
4596 ,p_level => C_LEVEL_PROCEDURE
4597 ,p_module => l_log_module);
4598
4599 END IF;
4600 RETURN l_description;
4601
4602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4603 trace
4604 (p_msg => 'END of Description_44'
4605 ,p_level => C_LEVEL_PROCEDURE
4606 ,p_module => l_log_module);
4607 END IF;
4608 RETURN NULL;
4609 EXCEPTION
4610 WHEN VALUE_ERROR THEN
4611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4612 trace
4613 (p_msg => 'ERROR: '||sqlerrm
4614 ,p_level => C_LEVEL_EXCEPTION
4615 ,p_module => l_log_module);
4616 END IF;
4617 RAISE;
4618 WHEN xla_exceptions_pkg.application_exception THEN
4619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4623 ,p_module => l_log_module);
4620 trace
4621 (p_msg => 'ERROR: '||sqlerrm
4622 ,p_level => C_LEVEL_EXCEPTION
4624 END IF;
4625 RAISE;
4626 WHEN OTHERS THEN
4627 xla_exceptions_pkg.raise_message
4628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_44');
4629 END Description_44;
4630
4631 ---------------------------------------
4632 --
4633 -- PRIVATE FUNCTION
4634 -- Description_45
4635 --
4636 ---------------------------------------
4637 FUNCTION Description_45 (
4638 p_application_id IN NUMBER
4639 , p_ae_header_id IN NUMBER DEFAULT NULL
4640 --Period Close Date
4641 , p_source_1 IN DATE
4642 )
4643 RETURN VARCHAR2
4644 IS
4645 l_component_type VARCHAR2(80) ;
4646 l_component_code VARCHAR2(30) ;
4647 l_component_type_code VARCHAR2(1) ;
4648 l_component_appl_id INTEGER ;
4649 l_amb_context_code VARCHAR2(30) ;
4650 l_ledger_language VARCHAR2(30) ;
4651 l_source VARCHAR2(1996) ;
4652 l_description VARCHAR2(2000) ;
4653 l_log_module VARCHAR2(240) ;
4654 BEGIN
4655 IF g_log_enabled THEN
4656 l_log_module := C_DEFAULT_MODULE||'.Description_45';
4657 END IF;
4658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4659 trace
4660 (p_msg => 'BEGIN of Description_45'
4661 ,p_level => C_LEVEL_PROCEDURE
4662 ,p_module => l_log_module);
4663 END IF;
4664
4665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
4666 l_component_type := 'AMB_DESCRIPTION';
4667 l_component_code := 'FA_CIP_TRANSFER_COST';
4668 l_component_type_code := 'S';
4669 l_component_appl_id := 140;
4670 l_amb_context_code := 'DEFAULT';
4671 l_source := NULL;
4672 l_description := NULL;
4673
4674
4675
4676 IF
4677 l_ledger_language = 'US' THEN
4678 l_description := SUBSTR(CONCAT(l_description,'CIP Transfer Cost'),1,2000);
4679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4680 END IF;
4681 IF
4682 l_ledger_language = 'US' THEN
4683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
4684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4685 END IF;
4686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
4687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
4688 IF l_source IS NOT NULL THEN
4689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
4690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4691 END IF;
4692 l_description := SUBSTR(l_description,1,1996);
4693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4694 trace
4695 (p_msg => 'END of Description_45'
4696 ,p_level => C_LEVEL_PROCEDURE
4697 ,p_module => l_log_module);
4698
4699 END IF;
4700 RETURN l_description;
4701
4702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4703 trace
4704 (p_msg => 'END of Description_45'
4705 ,p_level => C_LEVEL_PROCEDURE
4706 ,p_module => l_log_module);
4707 END IF;
4708 RETURN NULL;
4709 EXCEPTION
4710 WHEN VALUE_ERROR THEN
4711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4712 trace
4713 (p_msg => 'ERROR: '||sqlerrm
4714 ,p_level => C_LEVEL_EXCEPTION
4715 ,p_module => l_log_module);
4716 END IF;
4717 RAISE;
4718 WHEN xla_exceptions_pkg.application_exception THEN
4719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4720 trace
4721 (p_msg => 'ERROR: '||sqlerrm
4722 ,p_level => C_LEVEL_EXCEPTION
4723 ,p_module => l_log_module);
4724 END IF;
4725 RAISE;
4726 WHEN OTHERS THEN
4727 xla_exceptions_pkg.raise_message
4728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_45');
4729 END Description_45;
4730
4731 ---------------------------------------
4732 --
4733 -- PRIVATE FUNCTION
4734 -- Description_46
4735 --
4736 ---------------------------------------
4737 FUNCTION Description_46 (
4738 p_application_id IN NUMBER
4739 , p_ae_header_id IN NUMBER DEFAULT NULL
4740 --Period Close Date
4741 , p_source_1 IN DATE
4742 )
4743 RETURN VARCHAR2
4744 IS
4745 l_component_type VARCHAR2(80) ;
4746 l_component_code VARCHAR2(30) ;
4747 l_component_type_code VARCHAR2(1) ;
4748 l_component_appl_id INTEGER ;
4749 l_amb_context_code VARCHAR2(30) ;
4750 l_ledger_language VARCHAR2(30) ;
4751 l_source VARCHAR2(1996) ;
4752 l_description VARCHAR2(2000) ;
4753 l_log_module VARCHAR2(240) ;
4754 BEGIN
4755 IF g_log_enabled THEN
4756 l_log_module := C_DEFAULT_MODULE||'.Description_46';
4757 END IF;
4758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4759 trace
4760 (p_msg => 'BEGIN of Description_46'
4761 ,p_level => C_LEVEL_PROCEDURE
4762 ,p_module => l_log_module);
4763 END IF;
4764
4768 l_component_type_code := 'S';
4765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
4766 l_component_type := 'AMB_DESCRIPTION';
4767 l_component_code := 'FA_CIP_TRANSFER_IC_PAYABLE';
4769 l_component_appl_id := 140;
4770 l_amb_context_code := 'DEFAULT';
4771 l_source := NULL;
4772 l_description := NULL;
4773
4774
4775
4776 IF
4777 l_ledger_language = 'US' THEN
4778 l_description := SUBSTR(CONCAT(l_description,'CIP Transfer Intercompany AP'),1,2000);
4779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4780 END IF;
4781 IF
4782 l_ledger_language = 'US' THEN
4783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
4784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4785 END IF;
4786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
4787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
4788 IF l_source IS NOT NULL THEN
4789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
4790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4791 END IF;
4792 l_description := SUBSTR(l_description,1,1996);
4793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4794 trace
4795 (p_msg => 'END of Description_46'
4796 ,p_level => C_LEVEL_PROCEDURE
4797 ,p_module => l_log_module);
4798
4799 END IF;
4800 RETURN l_description;
4801
4802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4803 trace
4804 (p_msg => 'END of Description_46'
4805 ,p_level => C_LEVEL_PROCEDURE
4806 ,p_module => l_log_module);
4807 END IF;
4808 RETURN NULL;
4809 EXCEPTION
4810 WHEN VALUE_ERROR THEN
4811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4812 trace
4813 (p_msg => 'ERROR: '||sqlerrm
4814 ,p_level => C_LEVEL_EXCEPTION
4815 ,p_module => l_log_module);
4816 END IF;
4817 RAISE;
4818 WHEN xla_exceptions_pkg.application_exception THEN
4819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4820 trace
4821 (p_msg => 'ERROR: '||sqlerrm
4822 ,p_level => C_LEVEL_EXCEPTION
4823 ,p_module => l_log_module);
4824 END IF;
4825 RAISE;
4826 WHEN OTHERS THEN
4827 xla_exceptions_pkg.raise_message
4828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_46');
4829 END Description_46;
4830
4831 ---------------------------------------
4832 --
4833 -- PRIVATE FUNCTION
4834 -- Description_47
4835 --
4836 ---------------------------------------
4837 FUNCTION Description_47 (
4838 p_application_id IN NUMBER
4839 , p_ae_header_id IN NUMBER DEFAULT NULL
4840 --Period Close Date
4841 , p_source_1 IN DATE
4842 )
4843 RETURN VARCHAR2
4844 IS
4845 l_component_type VARCHAR2(80) ;
4846 l_component_code VARCHAR2(30) ;
4847 l_component_type_code VARCHAR2(1) ;
4848 l_component_appl_id INTEGER ;
4849 l_amb_context_code VARCHAR2(30) ;
4850 l_ledger_language VARCHAR2(30) ;
4851 l_source VARCHAR2(1996) ;
4852 l_description VARCHAR2(2000) ;
4853 l_log_module VARCHAR2(240) ;
4854 BEGIN
4855 IF g_log_enabled THEN
4856 l_log_module := C_DEFAULT_MODULE||'.Description_47';
4857 END IF;
4858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4859 trace
4860 (p_msg => 'BEGIN of Description_47'
4861 ,p_level => C_LEVEL_PROCEDURE
4862 ,p_module => l_log_module);
4863 END IF;
4864
4865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
4866 l_component_type := 'AMB_DESCRIPTION';
4867 l_component_code := 'FA_CIP_TRANSFER_IC_RECEIVABLE';
4868 l_component_type_code := 'S';
4869 l_component_appl_id := 140;
4870 l_amb_context_code := 'DEFAULT';
4871 l_source := NULL;
4872 l_description := NULL;
4873
4874
4875
4876 IF
4877 l_ledger_language = 'US' THEN
4878 l_description := SUBSTR(CONCAT(l_description,'CIP Transfer Intercompany AR'),1,2000);
4879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4880 END IF;
4881 IF
4882 l_ledger_language = 'US' THEN
4883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
4884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4885 END IF;
4886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
4887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
4888 IF l_source IS NOT NULL THEN
4889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
4890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4891 END IF;
4892 l_description := SUBSTR(l_description,1,1996);
4893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4894 trace
4895 (p_msg => 'END of Description_47'
4896 ,p_level => C_LEVEL_PROCEDURE
4897 ,p_module => l_log_module);
4898
4899 END IF;
4900 RETURN l_description;
4901
4905 ,p_level => C_LEVEL_PROCEDURE
4902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4903 trace
4904 (p_msg => 'END of Description_47'
4906 ,p_module => l_log_module);
4907 END IF;
4908 RETURN NULL;
4909 EXCEPTION
4910 WHEN VALUE_ERROR THEN
4911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4912 trace
4913 (p_msg => 'ERROR: '||sqlerrm
4914 ,p_level => C_LEVEL_EXCEPTION
4915 ,p_module => l_log_module);
4916 END IF;
4917 RAISE;
4918 WHEN xla_exceptions_pkg.application_exception THEN
4919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
4920 trace
4921 (p_msg => 'ERROR: '||sqlerrm
4922 ,p_level => C_LEVEL_EXCEPTION
4923 ,p_module => l_log_module);
4924 END IF;
4925 RAISE;
4926 WHEN OTHERS THEN
4927 xla_exceptions_pkg.raise_message
4928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_47');
4929 END Description_47;
4930
4931 ---------------------------------------
4932 --
4933 -- PRIVATE FUNCTION
4934 -- Description_48
4935 --
4936 ---------------------------------------
4937 FUNCTION Description_48 (
4938 p_application_id IN NUMBER
4939 , p_ae_header_id IN NUMBER DEFAULT NULL
4940 --Period Close Date
4941 , p_source_1 IN DATE
4942 )
4943 RETURN VARCHAR2
4944 IS
4945 l_component_type VARCHAR2(80) ;
4946 l_component_code VARCHAR2(30) ;
4947 l_component_type_code VARCHAR2(1) ;
4948 l_component_appl_id INTEGER ;
4949 l_amb_context_code VARCHAR2(30) ;
4950 l_ledger_language VARCHAR2(30) ;
4951 l_source VARCHAR2(1996) ;
4952 l_description VARCHAR2(2000) ;
4953 l_log_module VARCHAR2(240) ;
4954 BEGIN
4955 IF g_log_enabled THEN
4956 l_log_module := C_DEFAULT_MODULE||'.Description_48';
4957 END IF;
4958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4959 trace
4960 (p_msg => 'BEGIN of Description_48'
4961 ,p_level => C_LEVEL_PROCEDURE
4962 ,p_module => l_log_module);
4963 END IF;
4964
4965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
4966 l_component_type := 'AMB_DESCRIPTION';
4967 l_component_code := 'FA_CIP_TRANSFER_REVAL_RESERVE';
4968 l_component_type_code := 'S';
4969 l_component_appl_id := 140;
4970 l_amb_context_code := 'DEFAULT';
4971 l_source := NULL;
4972 l_description := NULL;
4973
4974
4975
4976 IF
4977 l_ledger_language = 'US' THEN
4978 l_description := SUBSTR(CONCAT(l_description,'CIP Transfer revaluation Reserve'),1,2000);
4979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4980 END IF;
4981 IF
4982 l_ledger_language = 'US' THEN
4983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
4984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4985 END IF;
4986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
4987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
4988 IF l_source IS NOT NULL THEN
4989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
4990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
4991 END IF;
4992 l_description := SUBSTR(l_description,1,1996);
4993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
4994 trace
4995 (p_msg => 'END of Description_48'
4996 ,p_level => C_LEVEL_PROCEDURE
4997 ,p_module => l_log_module);
4998
4999 END IF;
5000 RETURN l_description;
5001
5002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5003 trace
5004 (p_msg => 'END of Description_48'
5005 ,p_level => C_LEVEL_PROCEDURE
5006 ,p_module => l_log_module);
5007 END IF;
5008 RETURN NULL;
5009 EXCEPTION
5010 WHEN VALUE_ERROR THEN
5011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5012 trace
5013 (p_msg => 'ERROR: '||sqlerrm
5014 ,p_level => C_LEVEL_EXCEPTION
5015 ,p_module => l_log_module);
5016 END IF;
5017 RAISE;
5018 WHEN xla_exceptions_pkg.application_exception THEN
5019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5020 trace
5021 (p_msg => 'ERROR: '||sqlerrm
5022 ,p_level => C_LEVEL_EXCEPTION
5023 ,p_module => l_log_module);
5024 END IF;
5025 RAISE;
5026 WHEN OTHERS THEN
5027 xla_exceptions_pkg.raise_message
5028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_48');
5029 END Description_48;
5030
5031 ---------------------------------------
5032 --
5033 -- PRIVATE FUNCTION
5034 -- Description_49
5035 --
5036 ---------------------------------------
5037 FUNCTION Description_49 (
5038 p_application_id IN NUMBER
5039 , p_ae_header_id IN NUMBER DEFAULT NULL
5040 --Period Close Date
5041 , p_source_1 IN DATE
5042 )
5043 RETURN VARCHAR2
5044 IS
5045 l_component_type VARCHAR2(80) ;
5046 l_component_code VARCHAR2(30) ;
5047 l_component_type_code VARCHAR2(1) ;
5051 l_source VARCHAR2(1996) ;
5048 l_component_appl_id INTEGER ;
5049 l_amb_context_code VARCHAR2(30) ;
5050 l_ledger_language VARCHAR2(30) ;
5052 l_description VARCHAR2(2000) ;
5053 l_log_module VARCHAR2(240) ;
5054 BEGIN
5055 IF g_log_enabled THEN
5056 l_log_module := C_DEFAULT_MODULE||'.Description_49';
5057 END IF;
5058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5059 trace
5060 (p_msg => 'BEGIN of Description_49'
5061 ,p_level => C_LEVEL_PROCEDURE
5062 ,p_module => l_log_module);
5063 END IF;
5064
5065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
5066 l_component_type := 'AMB_DESCRIPTION';
5067 l_component_code := 'FA_CIP_UNITADJ_COST';
5068 l_component_type_code := 'S';
5069 l_component_appl_id := 140;
5070 l_amb_context_code := 'DEFAULT';
5071 l_source := NULL;
5072 l_description := NULL;
5073
5074
5075
5076 IF
5077 l_ledger_language = 'US' THEN
5078 l_description := SUBSTR(CONCAT(l_description,'CIP Unit Adjustment Cost'),1,2000);
5079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5080 END IF;
5081 IF
5082 l_ledger_language = 'US' THEN
5083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
5084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5085 END IF;
5086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
5087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
5088 IF l_source IS NOT NULL THEN
5089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
5090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5091 END IF;
5092 l_description := SUBSTR(l_description,1,1996);
5093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5094 trace
5095 (p_msg => 'END of Description_49'
5096 ,p_level => C_LEVEL_PROCEDURE
5097 ,p_module => l_log_module);
5098
5099 END IF;
5100 RETURN l_description;
5101
5102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5103 trace
5104 (p_msg => 'END of Description_49'
5105 ,p_level => C_LEVEL_PROCEDURE
5106 ,p_module => l_log_module);
5107 END IF;
5108 RETURN NULL;
5109 EXCEPTION
5110 WHEN VALUE_ERROR THEN
5111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5112 trace
5113 (p_msg => 'ERROR: '||sqlerrm
5114 ,p_level => C_LEVEL_EXCEPTION
5115 ,p_module => l_log_module);
5116 END IF;
5117 RAISE;
5118 WHEN xla_exceptions_pkg.application_exception THEN
5119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5120 trace
5121 (p_msg => 'ERROR: '||sqlerrm
5122 ,p_level => C_LEVEL_EXCEPTION
5123 ,p_module => l_log_module);
5124 END IF;
5125 RAISE;
5126 WHEN OTHERS THEN
5127 xla_exceptions_pkg.raise_message
5128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_49');
5129 END Description_49;
5130
5131 ---------------------------------------
5132 --
5133 -- PRIVATE FUNCTION
5134 -- Description_50
5135 --
5136 ---------------------------------------
5137 FUNCTION Description_50 (
5138 p_application_id IN NUMBER
5139 , p_ae_header_id IN NUMBER DEFAULT NULL
5140 --Period Close Date
5141 , p_source_1 IN DATE
5142 )
5143 RETURN VARCHAR2
5144 IS
5145 l_component_type VARCHAR2(80) ;
5146 l_component_code VARCHAR2(30) ;
5147 l_component_type_code VARCHAR2(1) ;
5148 l_component_appl_id INTEGER ;
5149 l_amb_context_code VARCHAR2(30) ;
5150 l_ledger_language VARCHAR2(30) ;
5151 l_source VARCHAR2(1996) ;
5152 l_description VARCHAR2(2000) ;
5153 l_log_module VARCHAR2(240) ;
5154 BEGIN
5155 IF g_log_enabled THEN
5156 l_log_module := C_DEFAULT_MODULE||'.Description_50';
5157 END IF;
5158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5159 trace
5160 (p_msg => 'BEGIN of Description_50'
5161 ,p_level => C_LEVEL_PROCEDURE
5162 ,p_module => l_log_module);
5163 END IF;
5164
5165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
5166 l_component_type := 'AMB_DESCRIPTION';
5167 l_component_code := 'FA_CIP_UNITADJ_IC_PAYABLE';
5168 l_component_type_code := 'S';
5169 l_component_appl_id := 140;
5170 l_amb_context_code := 'DEFAULT';
5171 l_source := NULL;
5172 l_description := NULL;
5173
5174
5175
5176 IF
5177 l_ledger_language = 'US' THEN
5178 l_description := SUBSTR(CONCAT(l_description,'CIP Unit Adjustment Intercompany AP'),1,2000);
5179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5180 END IF;
5181 IF
5182 l_ledger_language = 'US' THEN
5183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
5184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5185 END IF;
5186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
5190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
5188 IF l_source IS NOT NULL THEN
5189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
5191 END IF;
5192 l_description := SUBSTR(l_description,1,1996);
5193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5194 trace
5195 (p_msg => 'END of Description_50'
5196 ,p_level => C_LEVEL_PROCEDURE
5197 ,p_module => l_log_module);
5198
5199 END IF;
5200 RETURN l_description;
5201
5202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5203 trace
5204 (p_msg => 'END of Description_50'
5205 ,p_level => C_LEVEL_PROCEDURE
5206 ,p_module => l_log_module);
5207 END IF;
5208 RETURN NULL;
5209 EXCEPTION
5210 WHEN VALUE_ERROR THEN
5211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5212 trace
5213 (p_msg => 'ERROR: '||sqlerrm
5214 ,p_level => C_LEVEL_EXCEPTION
5215 ,p_module => l_log_module);
5216 END IF;
5217 RAISE;
5218 WHEN xla_exceptions_pkg.application_exception THEN
5219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5220 trace
5221 (p_msg => 'ERROR: '||sqlerrm
5222 ,p_level => C_LEVEL_EXCEPTION
5223 ,p_module => l_log_module);
5224 END IF;
5225 RAISE;
5226 WHEN OTHERS THEN
5227 xla_exceptions_pkg.raise_message
5228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_50');
5229 END Description_50;
5230
5231 ---------------------------------------
5232 --
5233 -- PRIVATE FUNCTION
5234 -- Description_51
5235 --
5236 ---------------------------------------
5237 FUNCTION Description_51 (
5238 p_application_id IN NUMBER
5239 , p_ae_header_id IN NUMBER DEFAULT NULL
5240 --Period Close Date
5241 , p_source_1 IN DATE
5242 )
5243 RETURN VARCHAR2
5244 IS
5245 l_component_type VARCHAR2(80) ;
5246 l_component_code VARCHAR2(30) ;
5247 l_component_type_code VARCHAR2(1) ;
5248 l_component_appl_id INTEGER ;
5249 l_amb_context_code VARCHAR2(30) ;
5250 l_ledger_language VARCHAR2(30) ;
5251 l_source VARCHAR2(1996) ;
5252 l_description VARCHAR2(2000) ;
5253 l_log_module VARCHAR2(240) ;
5254 BEGIN
5255 IF g_log_enabled THEN
5256 l_log_module := C_DEFAULT_MODULE||'.Description_51';
5257 END IF;
5258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5259 trace
5260 (p_msg => 'BEGIN of Description_51'
5261 ,p_level => C_LEVEL_PROCEDURE
5262 ,p_module => l_log_module);
5263 END IF;
5264
5265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
5266 l_component_type := 'AMB_DESCRIPTION';
5267 l_component_code := 'FA_CIP_UNITADJ_IC_RECEIVABLE';
5268 l_component_type_code := 'S';
5269 l_component_appl_id := 140;
5270 l_amb_context_code := 'DEFAULT';
5271 l_source := NULL;
5272 l_description := NULL;
5273
5274
5275
5276 IF
5277 l_ledger_language = 'US' THEN
5278 l_description := SUBSTR(CONCAT(l_description,'CIP Unit Adjustment Intercompany AR'),1,2000);
5279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5280 END IF;
5281 IF
5282 l_ledger_language = 'US' THEN
5283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
5284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5285 END IF;
5286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
5287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
5288 IF l_source IS NOT NULL THEN
5289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
5290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5291 END IF;
5292 l_description := SUBSTR(l_description,1,1996);
5293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5294 trace
5295 (p_msg => 'END of Description_51'
5296 ,p_level => C_LEVEL_PROCEDURE
5297 ,p_module => l_log_module);
5298
5299 END IF;
5300 RETURN l_description;
5301
5302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5303 trace
5304 (p_msg => 'END of Description_51'
5305 ,p_level => C_LEVEL_PROCEDURE
5306 ,p_module => l_log_module);
5307 END IF;
5308 RETURN NULL;
5309 EXCEPTION
5310 WHEN VALUE_ERROR THEN
5311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5312 trace
5313 (p_msg => 'ERROR: '||sqlerrm
5314 ,p_level => C_LEVEL_EXCEPTION
5315 ,p_module => l_log_module);
5316 END IF;
5317 RAISE;
5318 WHEN xla_exceptions_pkg.application_exception THEN
5319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5320 trace
5321 (p_msg => 'ERROR: '||sqlerrm
5322 ,p_level => C_LEVEL_EXCEPTION
5323 ,p_module => l_log_module);
5324 END IF;
5325 RAISE;
5326 WHEN OTHERS THEN
5327 xla_exceptions_pkg.raise_message
5331 ---------------------------------------
5328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_51');
5329 END Description_51;
5330
5332 --
5333 -- PRIVATE FUNCTION
5334 -- Description_52
5335 --
5336 ---------------------------------------
5337 FUNCTION Description_52 (
5338 p_application_id IN NUMBER
5339 , p_ae_header_id IN NUMBER DEFAULT NULL
5340 --Period Close Date
5341 , p_source_1 IN DATE
5342 )
5343 RETURN VARCHAR2
5344 IS
5345 l_component_type VARCHAR2(80) ;
5346 l_component_code VARCHAR2(30) ;
5347 l_component_type_code VARCHAR2(1) ;
5348 l_component_appl_id INTEGER ;
5349 l_amb_context_code VARCHAR2(30) ;
5350 l_ledger_language VARCHAR2(30) ;
5351 l_source VARCHAR2(1996) ;
5352 l_description VARCHAR2(2000) ;
5353 l_log_module VARCHAR2(240) ;
5354 BEGIN
5355 IF g_log_enabled THEN
5356 l_log_module := C_DEFAULT_MODULE||'.Description_52';
5357 END IF;
5358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5359 trace
5360 (p_msg => 'BEGIN of Description_52'
5361 ,p_level => C_LEVEL_PROCEDURE
5362 ,p_module => l_log_module);
5363 END IF;
5364
5365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
5366 l_component_type := 'AMB_DESCRIPTION';
5367 l_component_code := 'FA_CIP_UNITADJ_REVAL_RESERVE';
5368 l_component_type_code := 'S';
5369 l_component_appl_id := 140;
5370 l_amb_context_code := 'DEFAULT';
5371 l_source := NULL;
5372 l_description := NULL;
5373
5374
5375
5376 IF
5377 l_ledger_language = 'US' THEN
5378 l_description := SUBSTR(CONCAT(l_description,'CIP Unit Adjustment revaluation Reserve'),1,2000);
5379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5380 END IF;
5381 IF
5382 l_ledger_language = 'US' THEN
5383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
5384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5385 END IF;
5386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
5387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
5388 IF l_source IS NOT NULL THEN
5389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
5390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5391 END IF;
5392 l_description := SUBSTR(l_description,1,1996);
5393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5394 trace
5395 (p_msg => 'END of Description_52'
5396 ,p_level => C_LEVEL_PROCEDURE
5397 ,p_module => l_log_module);
5398
5399 END IF;
5400 RETURN l_description;
5401
5402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5403 trace
5404 (p_msg => 'END of Description_52'
5405 ,p_level => C_LEVEL_PROCEDURE
5406 ,p_module => l_log_module);
5407 END IF;
5408 RETURN NULL;
5409 EXCEPTION
5410 WHEN VALUE_ERROR THEN
5411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5412 trace
5413 (p_msg => 'ERROR: '||sqlerrm
5414 ,p_level => C_LEVEL_EXCEPTION
5415 ,p_module => l_log_module);
5416 END IF;
5417 RAISE;
5418 WHEN xla_exceptions_pkg.application_exception THEN
5419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5420 trace
5421 (p_msg => 'ERROR: '||sqlerrm
5422 ,p_level => C_LEVEL_EXCEPTION
5423 ,p_module => l_log_module);
5424 END IF;
5425 RAISE;
5426 WHEN OTHERS THEN
5427 xla_exceptions_pkg.raise_message
5428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_52');
5429 END Description_52;
5430
5431 ---------------------------------------
5432 --
5433 -- PRIVATE FUNCTION
5434 -- Description_53
5435 --
5436 ---------------------------------------
5437 FUNCTION Description_53 (
5438 p_application_id IN NUMBER
5439 , p_ae_header_id IN NUMBER DEFAULT NULL
5440 --Period Close Date
5441 , p_source_1 IN DATE
5442 )
5443 RETURN VARCHAR2
5444 IS
5445 l_component_type VARCHAR2(80) ;
5446 l_component_code VARCHAR2(30) ;
5447 l_component_type_code VARCHAR2(1) ;
5448 l_component_appl_id INTEGER ;
5449 l_amb_context_code VARCHAR2(30) ;
5450 l_ledger_language VARCHAR2(30) ;
5451 l_source VARCHAR2(1996) ;
5452 l_description VARCHAR2(2000) ;
5453 l_log_module VARCHAR2(240) ;
5454 BEGIN
5455 IF g_log_enabled THEN
5456 l_log_module := C_DEFAULT_MODULE||'.Description_53';
5457 END IF;
5458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5459 trace
5460 (p_msg => 'BEGIN of Description_53'
5461 ,p_level => C_LEVEL_PROCEDURE
5462 ,p_module => l_log_module);
5463 END IF;
5464
5465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
5466 l_component_type := 'AMB_DESCRIPTION';
5467 l_component_code := 'FA_CIP_UNIT_ADJ';
5468 l_component_type_code := 'S';
5472 l_description := NULL;
5469 l_component_appl_id := 140;
5470 l_amb_context_code := 'DEFAULT';
5471 l_source := NULL;
5473
5474
5475
5476 IF
5477 l_ledger_language = 'US' THEN
5478 l_description := SUBSTR(CONCAT(l_description,'CIP Unit Adjustment'),1,2000);
5479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5480 END IF;
5481 IF
5482 l_ledger_language = 'US' THEN
5483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
5484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5485 END IF;
5486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
5487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
5488 IF l_source IS NOT NULL THEN
5489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
5490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5491 END IF;
5492 l_description := SUBSTR(l_description,1,1996);
5493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5494 trace
5495 (p_msg => 'END of Description_53'
5496 ,p_level => C_LEVEL_PROCEDURE
5497 ,p_module => l_log_module);
5498
5499 END IF;
5500 RETURN l_description;
5501
5502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5503 trace
5504 (p_msg => 'END of Description_53'
5505 ,p_level => C_LEVEL_PROCEDURE
5506 ,p_module => l_log_module);
5507 END IF;
5508 RETURN NULL;
5509 EXCEPTION
5510 WHEN VALUE_ERROR THEN
5511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5512 trace
5513 (p_msg => 'ERROR: '||sqlerrm
5514 ,p_level => C_LEVEL_EXCEPTION
5515 ,p_module => l_log_module);
5516 END IF;
5517 RAISE;
5518 WHEN xla_exceptions_pkg.application_exception THEN
5519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5520 trace
5521 (p_msg => 'ERROR: '||sqlerrm
5522 ,p_level => C_LEVEL_EXCEPTION
5523 ,p_module => l_log_module);
5524 END IF;
5525 RAISE;
5526 WHEN OTHERS THEN
5527 xla_exceptions_pkg.raise_message
5528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_53');
5529 END Description_53;
5530
5531 ---------------------------------------
5532 --
5533 -- PRIVATE FUNCTION
5534 -- Description_54
5535 --
5536 ---------------------------------------
5537 FUNCTION Description_54 (
5538 p_application_id IN NUMBER
5539 , p_ae_header_id IN NUMBER DEFAULT NULL
5540 --Period Close Date
5541 , p_source_1 IN DATE
5542 )
5543 RETURN VARCHAR2
5544 IS
5545 l_component_type VARCHAR2(80) ;
5546 l_component_code VARCHAR2(30) ;
5547 l_component_type_code VARCHAR2(1) ;
5548 l_component_appl_id INTEGER ;
5549 l_amb_context_code VARCHAR2(30) ;
5550 l_ledger_language VARCHAR2(30) ;
5551 l_source VARCHAR2(1996) ;
5552 l_description VARCHAR2(2000) ;
5553 l_log_module VARCHAR2(240) ;
5554 BEGIN
5555 IF g_log_enabled THEN
5556 l_log_module := C_DEFAULT_MODULE||'.Description_54';
5557 END IF;
5558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5559 trace
5560 (p_msg => 'BEGIN of Description_54'
5561 ,p_level => C_LEVEL_PROCEDURE
5562 ,p_module => l_log_module);
5563 END IF;
5564
5565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
5566 l_component_type := 'AMB_DESCRIPTION';
5567 l_component_code := 'FA_DEFERRED_DEPRN';
5568 l_component_type_code := 'S';
5569 l_component_appl_id := 140;
5570 l_amb_context_code := 'DEFAULT';
5571 l_source := NULL;
5572 l_description := NULL;
5573
5574
5575
5576 IF
5577 l_ledger_language = 'US' THEN
5578 l_description := SUBSTR(CONCAT(l_description,'Deferred Depreciation'),1,2000);
5579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5580 END IF;
5581 IF
5582 l_ledger_language = 'US' THEN
5583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
5584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5585 END IF;
5586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
5587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
5588 IF l_source IS NOT NULL THEN
5589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
5590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5591 END IF;
5592 l_description := SUBSTR(l_description,1,1996);
5593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5594 trace
5595 (p_msg => 'END of Description_54'
5596 ,p_level => C_LEVEL_PROCEDURE
5597 ,p_module => l_log_module);
5598
5599 END IF;
5600 RETURN l_description;
5601
5602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5603 trace
5604 (p_msg => 'END of Description_54'
5605 ,p_level => C_LEVEL_PROCEDURE
5606 ,p_module => l_log_module);
5607 END IF;
5608 RETURN NULL;
5609 EXCEPTION
5610 WHEN VALUE_ERROR THEN
5611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5612 trace
5613 (p_msg => 'ERROR: '||sqlerrm
5614 ,p_level => C_LEVEL_EXCEPTION
5618 WHEN xla_exceptions_pkg.application_exception THEN
5615 ,p_module => l_log_module);
5616 END IF;
5617 RAISE;
5619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5620 trace
5621 (p_msg => 'ERROR: '||sqlerrm
5622 ,p_level => C_LEVEL_EXCEPTION
5623 ,p_module => l_log_module);
5624 END IF;
5625 RAISE;
5626 WHEN OTHERS THEN
5627 xla_exceptions_pkg.raise_message
5628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_54');
5629 END Description_54;
5630
5631 ---------------------------------------
5632 --
5633 -- PRIVATE FUNCTION
5634 -- Description_55
5635 --
5636 ---------------------------------------
5637 FUNCTION Description_55 (
5638 p_application_id IN NUMBER
5639 , p_ae_header_id IN NUMBER DEFAULT NULL
5640 --Period Close Date
5641 , p_source_1 IN DATE
5642 )
5643 RETURN VARCHAR2
5644 IS
5645 l_component_type VARCHAR2(80) ;
5646 l_component_code VARCHAR2(30) ;
5647 l_component_type_code VARCHAR2(1) ;
5648 l_component_appl_id INTEGER ;
5649 l_amb_context_code VARCHAR2(30) ;
5650 l_ledger_language VARCHAR2(30) ;
5651 l_source VARCHAR2(1996) ;
5652 l_description VARCHAR2(2000) ;
5653 l_log_module VARCHAR2(240) ;
5654 BEGIN
5655 IF g_log_enabled THEN
5656 l_log_module := C_DEFAULT_MODULE||'.Description_55';
5657 END IF;
5658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5659 trace
5660 (p_msg => 'BEGIN of Description_55'
5661 ,p_level => C_LEVEL_PROCEDURE
5662 ,p_module => l_log_module);
5663 END IF;
5664
5665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
5666 l_component_type := 'AMB_DESCRIPTION';
5667 l_component_code := 'FA_DEFERRED_DEPRN_EXPENSE';
5668 l_component_type_code := 'S';
5669 l_component_appl_id := 140;
5670 l_amb_context_code := 'DEFAULT';
5671 l_source := NULL;
5672 l_description := NULL;
5673
5674
5675
5676 IF
5677 l_ledger_language = 'US' THEN
5678 l_description := SUBSTR(CONCAT(l_description,'Deferred Depreciation Expense'),1,2000);
5679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5680 END IF;
5681 IF
5682 l_ledger_language = 'US' THEN
5683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
5684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5685 END IF;
5686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
5687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
5688 IF l_source IS NOT NULL THEN
5689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
5690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5691 END IF;
5692 l_description := SUBSTR(l_description,1,1996);
5693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5694 trace
5695 (p_msg => 'END of Description_55'
5696 ,p_level => C_LEVEL_PROCEDURE
5697 ,p_module => l_log_module);
5698
5699 END IF;
5700 RETURN l_description;
5701
5702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5703 trace
5704 (p_msg => 'END of Description_55'
5705 ,p_level => C_LEVEL_PROCEDURE
5706 ,p_module => l_log_module);
5707 END IF;
5708 RETURN NULL;
5709 EXCEPTION
5710 WHEN VALUE_ERROR THEN
5711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5712 trace
5713 (p_msg => 'ERROR: '||sqlerrm
5714 ,p_level => C_LEVEL_EXCEPTION
5715 ,p_module => l_log_module);
5716 END IF;
5717 RAISE;
5718 WHEN xla_exceptions_pkg.application_exception THEN
5719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5720 trace
5721 (p_msg => 'ERROR: '||sqlerrm
5722 ,p_level => C_LEVEL_EXCEPTION
5723 ,p_module => l_log_module);
5724 END IF;
5725 RAISE;
5726 WHEN OTHERS THEN
5727 xla_exceptions_pkg.raise_message
5728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_55');
5729 END Description_55;
5730
5731 ---------------------------------------
5732 --
5733 -- PRIVATE FUNCTION
5734 -- Description_56
5735 --
5736 ---------------------------------------
5737 FUNCTION Description_56 (
5738 p_application_id IN NUMBER
5739 , p_ae_header_id IN NUMBER DEFAULT NULL
5740 --Period Close Date
5741 , p_source_1 IN DATE
5742 )
5743 RETURN VARCHAR2
5744 IS
5745 l_component_type VARCHAR2(80) ;
5746 l_component_code VARCHAR2(30) ;
5747 l_component_type_code VARCHAR2(1) ;
5748 l_component_appl_id INTEGER ;
5749 l_amb_context_code VARCHAR2(30) ;
5750 l_ledger_language VARCHAR2(30) ;
5751 l_source VARCHAR2(1996) ;
5752 l_description VARCHAR2(2000) ;
5753 l_log_module VARCHAR2(240) ;
5754 BEGIN
5755 IF g_log_enabled THEN
5756 l_log_module := C_DEFAULT_MODULE||'.Description_56';
5757 END IF;
5758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5759 trace
5760 (p_msg => 'BEGIN of Description_56'
5764
5761 ,p_level => C_LEVEL_PROCEDURE
5762 ,p_module => l_log_module);
5763 END IF;
5765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
5766 l_component_type := 'AMB_DESCRIPTION';
5767 l_component_code := 'FA_DEFERRED_DEPRN_RESERVE';
5768 l_component_type_code := 'S';
5769 l_component_appl_id := 140;
5770 l_amb_context_code := 'DEFAULT';
5771 l_source := NULL;
5772 l_description := NULL;
5773
5774
5775
5776 IF
5777 l_ledger_language = 'US' THEN
5778 l_description := SUBSTR(CONCAT(l_description,'Deferred Depreciation Reserve'),1,2000);
5779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5780 END IF;
5781 IF
5782 l_ledger_language = 'US' THEN
5783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
5784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5785 END IF;
5786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
5787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
5788 IF l_source IS NOT NULL THEN
5789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
5790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5791 END IF;
5792 l_description := SUBSTR(l_description,1,1996);
5793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5794 trace
5795 (p_msg => 'END of Description_56'
5796 ,p_level => C_LEVEL_PROCEDURE
5797 ,p_module => l_log_module);
5798
5799 END IF;
5800 RETURN l_description;
5801
5802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5803 trace
5804 (p_msg => 'END of Description_56'
5805 ,p_level => C_LEVEL_PROCEDURE
5806 ,p_module => l_log_module);
5807 END IF;
5808 RETURN NULL;
5809 EXCEPTION
5810 WHEN VALUE_ERROR THEN
5811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5812 trace
5813 (p_msg => 'ERROR: '||sqlerrm
5814 ,p_level => C_LEVEL_EXCEPTION
5815 ,p_module => l_log_module);
5816 END IF;
5817 RAISE;
5818 WHEN xla_exceptions_pkg.application_exception THEN
5819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5820 trace
5821 (p_msg => 'ERROR: '||sqlerrm
5822 ,p_level => C_LEVEL_EXCEPTION
5823 ,p_module => l_log_module);
5824 END IF;
5825 RAISE;
5826 WHEN OTHERS THEN
5827 xla_exceptions_pkg.raise_message
5828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_56');
5829 END Description_56;
5830
5831 ---------------------------------------
5832 --
5833 -- PRIVATE FUNCTION
5834 -- Description_57
5835 --
5836 ---------------------------------------
5837 FUNCTION Description_57 (
5838 p_application_id IN NUMBER
5839 , p_ae_header_id IN NUMBER DEFAULT NULL
5840 --Period Close Date
5841 , p_source_1 IN DATE
5842 )
5843 RETURN VARCHAR2
5844 IS
5845 l_component_type VARCHAR2(80) ;
5846 l_component_code VARCHAR2(30) ;
5847 l_component_type_code VARCHAR2(1) ;
5848 l_component_appl_id INTEGER ;
5849 l_amb_context_code VARCHAR2(30) ;
5850 l_ledger_language VARCHAR2(30) ;
5851 l_source VARCHAR2(1996) ;
5852 l_description VARCHAR2(2000) ;
5853 l_log_module VARCHAR2(240) ;
5854 BEGIN
5855 IF g_log_enabled THEN
5856 l_log_module := C_DEFAULT_MODULE||'.Description_57';
5857 END IF;
5858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5859 trace
5860 (p_msg => 'BEGIN of Description_57'
5861 ,p_level => C_LEVEL_PROCEDURE
5862 ,p_module => l_log_module);
5863 END IF;
5864
5865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
5866 l_component_type := 'AMB_DESCRIPTION';
5867 l_component_code := 'FA_DEPRECIATION';
5868 l_component_type_code := 'S';
5869 l_component_appl_id := 140;
5870 l_amb_context_code := 'DEFAULT';
5871 l_source := NULL;
5872 l_description := NULL;
5873
5874
5875
5876 IF
5877 l_ledger_language = 'US' THEN
5878 l_description := SUBSTR(CONCAT(l_description,'Depreciation'),1,2000);
5879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5880 END IF;
5881 IF
5882 l_ledger_language = 'US' THEN
5883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
5884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5885 END IF;
5886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
5887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
5888 IF l_source IS NOT NULL THEN
5889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
5890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5891 END IF;
5892 l_description := SUBSTR(l_description,1,1996);
5893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5894 trace
5895 (p_msg => 'END of Description_57'
5896 ,p_level => C_LEVEL_PROCEDURE
5897 ,p_module => l_log_module);
5898
5899 END IF;
5900 RETURN l_description;
5901
5902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5906 ,p_module => l_log_module);
5903 trace
5904 (p_msg => 'END of Description_57'
5905 ,p_level => C_LEVEL_PROCEDURE
5907 END IF;
5908 RETURN NULL;
5909 EXCEPTION
5910 WHEN VALUE_ERROR THEN
5911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5912 trace
5913 (p_msg => 'ERROR: '||sqlerrm
5914 ,p_level => C_LEVEL_EXCEPTION
5915 ,p_module => l_log_module);
5916 END IF;
5917 RAISE;
5918 WHEN xla_exceptions_pkg.application_exception THEN
5919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
5920 trace
5921 (p_msg => 'ERROR: '||sqlerrm
5922 ,p_level => C_LEVEL_EXCEPTION
5923 ,p_module => l_log_module);
5924 END IF;
5925 RAISE;
5926 WHEN OTHERS THEN
5927 xla_exceptions_pkg.raise_message
5928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_57');
5929 END Description_57;
5930
5931 ---------------------------------------
5932 --
5933 -- PRIVATE FUNCTION
5934 -- Description_58
5935 --
5936 ---------------------------------------
5937 FUNCTION Description_58 (
5938 p_application_id IN NUMBER
5939 , p_ae_header_id IN NUMBER DEFAULT NULL
5940 --Period Close Date
5941 , p_source_1 IN DATE
5942 )
5943 RETURN VARCHAR2
5944 IS
5945 l_component_type VARCHAR2(80) ;
5946 l_component_code VARCHAR2(30) ;
5947 l_component_type_code VARCHAR2(1) ;
5948 l_component_appl_id INTEGER ;
5949 l_amb_context_code VARCHAR2(30) ;
5950 l_ledger_language VARCHAR2(30) ;
5951 l_source VARCHAR2(1996) ;
5952 l_description VARCHAR2(2000) ;
5953 l_log_module VARCHAR2(240) ;
5954 BEGIN
5955 IF g_log_enabled THEN
5956 l_log_module := C_DEFAULT_MODULE||'.Description_58';
5957 END IF;
5958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5959 trace
5960 (p_msg => 'BEGIN of Description_58'
5961 ,p_level => C_LEVEL_PROCEDURE
5962 ,p_module => l_log_module);
5963 END IF;
5964
5965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
5966 l_component_type := 'AMB_DESCRIPTION';
5967 l_component_code := 'FA_DEPRECIATION_ADJUSTMENT';
5968 l_component_type_code := 'S';
5969 l_component_appl_id := 140;
5970 l_amb_context_code := 'DEFAULT';
5971 l_source := NULL;
5972 l_description := NULL;
5973
5974
5975
5976 IF
5977 l_ledger_language = 'US' THEN
5978 l_description := SUBSTR(CONCAT(l_description,'Depreciation Adjustment'),1,2000);
5979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5980 END IF;
5981 IF
5982 l_ledger_language = 'US' THEN
5983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
5984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5985 END IF;
5986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
5987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
5988 IF l_source IS NOT NULL THEN
5989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
5990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
5991 END IF;
5992 l_description := SUBSTR(l_description,1,1996);
5993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
5994 trace
5995 (p_msg => 'END of Description_58'
5996 ,p_level => C_LEVEL_PROCEDURE
5997 ,p_module => l_log_module);
5998
5999 END IF;
6000 RETURN l_description;
6001
6002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6003 trace
6004 (p_msg => 'END of Description_58'
6005 ,p_level => C_LEVEL_PROCEDURE
6006 ,p_module => l_log_module);
6007 END IF;
6008 RETURN NULL;
6009 EXCEPTION
6010 WHEN VALUE_ERROR THEN
6011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6012 trace
6013 (p_msg => 'ERROR: '||sqlerrm
6014 ,p_level => C_LEVEL_EXCEPTION
6015 ,p_module => l_log_module);
6016 END IF;
6017 RAISE;
6018 WHEN xla_exceptions_pkg.application_exception THEN
6019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6020 trace
6021 (p_msg => 'ERROR: '||sqlerrm
6022 ,p_level => C_LEVEL_EXCEPTION
6023 ,p_module => l_log_module);
6024 END IF;
6025 RAISE;
6026 WHEN OTHERS THEN
6027 xla_exceptions_pkg.raise_message
6028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_58');
6029 END Description_58;
6030
6031 ---------------------------------------
6032 --
6033 -- PRIVATE FUNCTION
6034 -- Description_59
6035 --
6036 ---------------------------------------
6037 FUNCTION Description_59 (
6038 p_application_id IN NUMBER
6039 , p_ae_header_id IN NUMBER DEFAULT NULL
6040 --Period Close Date
6041 , p_source_1 IN DATE
6042 )
6043 RETURN VARCHAR2
6044 IS
6045 l_component_type VARCHAR2(80) ;
6046 l_component_code VARCHAR2(30) ;
6047 l_component_type_code VARCHAR2(1) ;
6048 l_component_appl_id INTEGER ;
6052 l_description VARCHAR2(2000) ;
6049 l_amb_context_code VARCHAR2(30) ;
6050 l_ledger_language VARCHAR2(30) ;
6051 l_source VARCHAR2(1996) ;
6053 l_log_module VARCHAR2(240) ;
6054 BEGIN
6055 IF g_log_enabled THEN
6056 l_log_module := C_DEFAULT_MODULE||'.Description_59';
6057 END IF;
6058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6059 trace
6060 (p_msg => 'BEGIN of Description_59'
6061 ,p_level => C_LEVEL_PROCEDURE
6062 ,p_module => l_log_module);
6063 END IF;
6064
6065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
6066 l_component_type := 'AMB_DESCRIPTION';
6067 l_component_code := 'FA_DEPRN_RESERVE';
6068 l_component_type_code := 'S';
6069 l_component_appl_id := 140;
6070 l_amb_context_code := 'DEFAULT';
6071 l_source := NULL;
6072 l_description := NULL;
6073
6074
6075
6076 IF
6077 l_ledger_language = 'US' THEN
6078 l_description := SUBSTR(CONCAT(l_description,'Depreciation Reserve'),1,2000);
6079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6080 END IF;
6081 IF
6082 l_ledger_language = 'US' THEN
6083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
6084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6085 END IF;
6086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
6087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
6088 IF l_source IS NOT NULL THEN
6089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
6090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6091 END IF;
6092 l_description := SUBSTR(l_description,1,1996);
6093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6094 trace
6095 (p_msg => 'END of Description_59'
6096 ,p_level => C_LEVEL_PROCEDURE
6097 ,p_module => l_log_module);
6098
6099 END IF;
6100 RETURN l_description;
6101
6102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6103 trace
6104 (p_msg => 'END of Description_59'
6105 ,p_level => C_LEVEL_PROCEDURE
6106 ,p_module => l_log_module);
6107 END IF;
6108 RETURN NULL;
6109 EXCEPTION
6110 WHEN VALUE_ERROR THEN
6111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6112 trace
6113 (p_msg => 'ERROR: '||sqlerrm
6114 ,p_level => C_LEVEL_EXCEPTION
6115 ,p_module => l_log_module);
6116 END IF;
6117 RAISE;
6118 WHEN xla_exceptions_pkg.application_exception THEN
6119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6120 trace
6121 (p_msg => 'ERROR: '||sqlerrm
6122 ,p_level => C_LEVEL_EXCEPTION
6123 ,p_module => l_log_module);
6124 END IF;
6125 RAISE;
6126 WHEN OTHERS THEN
6127 xla_exceptions_pkg.raise_message
6128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_59');
6129 END Description_59;
6130
6131 ---------------------------------------
6132 --
6133 -- PRIVATE FUNCTION
6134 -- Description_60
6135 --
6136 ---------------------------------------
6137 FUNCTION Description_60 (
6138 p_application_id IN NUMBER
6139 , p_ae_header_id IN NUMBER DEFAULT NULL
6140 --Period Close Date
6141 , p_source_1 IN DATE
6142 )
6143 RETURN VARCHAR2
6144 IS
6145 l_component_type VARCHAR2(80) ;
6146 l_component_code VARCHAR2(30) ;
6147 l_component_type_code VARCHAR2(1) ;
6148 l_component_appl_id INTEGER ;
6149 l_amb_context_code VARCHAR2(30) ;
6150 l_ledger_language VARCHAR2(30) ;
6151 l_source VARCHAR2(1996) ;
6152 l_description VARCHAR2(2000) ;
6153 l_log_module VARCHAR2(240) ;
6154 BEGIN
6155 IF g_log_enabled THEN
6156 l_log_module := C_DEFAULT_MODULE||'.Description_60';
6157 END IF;
6158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6159 trace
6160 (p_msg => 'BEGIN of Description_60'
6161 ,p_level => C_LEVEL_PROCEDURE
6162 ,p_module => l_log_module);
6163 END IF;
6164
6165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
6166 l_component_type := 'AMB_DESCRIPTION';
6167 l_component_code := 'FA_DEPRN_REVAL_AMORT';
6168 l_component_type_code := 'S';
6169 l_component_appl_id := 140;
6170 l_amb_context_code := 'DEFAULT';
6171 l_source := NULL;
6172 l_description := NULL;
6173
6174
6175
6176 IF
6177 l_ledger_language = 'US' THEN
6178 l_description := SUBSTR(CONCAT(l_description,'Depreciation Revaluation Amortization'),1,2000);
6179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6180 END IF;
6181 IF
6182 l_ledger_language = 'US' THEN
6183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
6184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6185 END IF;
6186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
6190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
6188 IF l_source IS NOT NULL THEN
6189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
6191 END IF;
6192 l_description := SUBSTR(l_description,1,1996);
6193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6194 trace
6195 (p_msg => 'END of Description_60'
6196 ,p_level => C_LEVEL_PROCEDURE
6197 ,p_module => l_log_module);
6198
6199 END IF;
6200 RETURN l_description;
6201
6202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6203 trace
6204 (p_msg => 'END of Description_60'
6205 ,p_level => C_LEVEL_PROCEDURE
6206 ,p_module => l_log_module);
6207 END IF;
6208 RETURN NULL;
6209 EXCEPTION
6210 WHEN VALUE_ERROR THEN
6211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6212 trace
6213 (p_msg => 'ERROR: '||sqlerrm
6214 ,p_level => C_LEVEL_EXCEPTION
6215 ,p_module => l_log_module);
6216 END IF;
6217 RAISE;
6218 WHEN xla_exceptions_pkg.application_exception THEN
6219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6220 trace
6221 (p_msg => 'ERROR: '||sqlerrm
6222 ,p_level => C_LEVEL_EXCEPTION
6223 ,p_module => l_log_module);
6224 END IF;
6225 RAISE;
6226 WHEN OTHERS THEN
6227 xla_exceptions_pkg.raise_message
6228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_60');
6229 END Description_60;
6230
6231 ---------------------------------------
6232 --
6233 -- PRIVATE FUNCTION
6234 -- Description_61
6235 --
6236 ---------------------------------------
6237 FUNCTION Description_61 (
6238 p_application_id IN NUMBER
6239 , p_ae_header_id IN NUMBER DEFAULT NULL
6240 --Period Close Date
6241 , p_source_1 IN DATE
6242 )
6243 RETURN VARCHAR2
6244 IS
6245 l_component_type VARCHAR2(80) ;
6246 l_component_code VARCHAR2(30) ;
6247 l_component_type_code VARCHAR2(1) ;
6248 l_component_appl_id INTEGER ;
6249 l_amb_context_code VARCHAR2(30) ;
6250 l_ledger_language VARCHAR2(30) ;
6251 l_source VARCHAR2(1996) ;
6252 l_description VARCHAR2(2000) ;
6253 l_log_module VARCHAR2(240) ;
6254 BEGIN
6255 IF g_log_enabled THEN
6256 l_log_module := C_DEFAULT_MODULE||'.Description_61';
6257 END IF;
6258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6259 trace
6260 (p_msg => 'BEGIN of Description_61'
6261 ,p_level => C_LEVEL_PROCEDURE
6262 ,p_module => l_log_module);
6263 END IF;
6264
6265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
6266 l_component_type := 'AMB_DESCRIPTION';
6267 l_component_code := 'FA_DEPRN_REVAL_RESERVE';
6268 l_component_type_code := 'S';
6269 l_component_appl_id := 140;
6270 l_amb_context_code := 'DEFAULT';
6271 l_source := NULL;
6272 l_description := NULL;
6273
6274
6275
6276 IF
6277 l_ledger_language = 'US' THEN
6278 l_description := SUBSTR(CONCAT(l_description,'Depreciation Revaluation Reserve'),1,2000);
6279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6280 END IF;
6281 IF
6282 l_ledger_language = 'US' THEN
6283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
6284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6285 END IF;
6286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
6287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
6288 IF l_source IS NOT NULL THEN
6289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
6290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6291 END IF;
6292 l_description := SUBSTR(l_description,1,1996);
6293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6294 trace
6295 (p_msg => 'END of Description_61'
6296 ,p_level => C_LEVEL_PROCEDURE
6297 ,p_module => l_log_module);
6298
6299 END IF;
6300 RETURN l_description;
6301
6302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6303 trace
6304 (p_msg => 'END of Description_61'
6305 ,p_level => C_LEVEL_PROCEDURE
6306 ,p_module => l_log_module);
6307 END IF;
6308 RETURN NULL;
6309 EXCEPTION
6310 WHEN VALUE_ERROR THEN
6311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6312 trace
6313 (p_msg => 'ERROR: '||sqlerrm
6314 ,p_level => C_LEVEL_EXCEPTION
6315 ,p_module => l_log_module);
6316 END IF;
6317 RAISE;
6318 WHEN xla_exceptions_pkg.application_exception THEN
6319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6320 trace
6321 (p_msg => 'ERROR: '||sqlerrm
6322 ,p_level => C_LEVEL_EXCEPTION
6323 ,p_module => l_log_module);
6324 END IF;
6325 RAISE;
6326 WHEN OTHERS THEN
6327 xla_exceptions_pkg.raise_message
6331 ---------------------------------------
6328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_61');
6329 END Description_61;
6330
6332 --
6333 -- PRIVATE FUNCTION
6334 -- Description_62
6335 --
6336 ---------------------------------------
6337 FUNCTION Description_62 (
6338 p_application_id IN NUMBER
6339 , p_ae_header_id IN NUMBER DEFAULT NULL
6340 --Period Close Date
6341 , p_source_1 IN DATE
6342 )
6343 RETURN VARCHAR2
6344 IS
6345 l_component_type VARCHAR2(80) ;
6346 l_component_code VARCHAR2(30) ;
6347 l_component_type_code VARCHAR2(1) ;
6348 l_component_appl_id INTEGER ;
6349 l_amb_context_code VARCHAR2(30) ;
6350 l_ledger_language VARCHAR2(30) ;
6351 l_source VARCHAR2(1996) ;
6352 l_description VARCHAR2(2000) ;
6353 l_log_module VARCHAR2(240) ;
6354 BEGIN
6355 IF g_log_enabled THEN
6356 l_log_module := C_DEFAULT_MODULE||'.Description_62';
6357 END IF;
6358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6359 trace
6360 (p_msg => 'BEGIN of Description_62'
6361 ,p_level => C_LEVEL_PROCEDURE
6362 ,p_module => l_log_module);
6363 END IF;
6364
6365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
6366 l_component_type := 'AMB_DESCRIPTION';
6367 l_component_code := 'FA_RECLASS';
6368 l_component_type_code := 'S';
6369 l_component_appl_id := 140;
6370 l_amb_context_code := 'DEFAULT';
6371 l_source := NULL;
6372 l_description := NULL;
6373
6374
6375
6376 IF
6377 l_ledger_language = 'US' THEN
6378 l_description := SUBSTR(CONCAT(l_description,'Category Reclass'),1,2000);
6379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6380 END IF;
6381 IF
6382 l_ledger_language = 'US' THEN
6383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
6384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6385 END IF;
6386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
6387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
6388 IF l_source IS NOT NULL THEN
6389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
6390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6391 END IF;
6392 l_description := SUBSTR(l_description,1,1996);
6393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6394 trace
6395 (p_msg => 'END of Description_62'
6396 ,p_level => C_LEVEL_PROCEDURE
6397 ,p_module => l_log_module);
6398
6399 END IF;
6400 RETURN l_description;
6401
6402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6403 trace
6404 (p_msg => 'END of Description_62'
6405 ,p_level => C_LEVEL_PROCEDURE
6406 ,p_module => l_log_module);
6407 END IF;
6408 RETURN NULL;
6409 EXCEPTION
6410 WHEN VALUE_ERROR THEN
6411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6412 trace
6413 (p_msg => 'ERROR: '||sqlerrm
6414 ,p_level => C_LEVEL_EXCEPTION
6415 ,p_module => l_log_module);
6416 END IF;
6417 RAISE;
6418 WHEN xla_exceptions_pkg.application_exception THEN
6419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6420 trace
6421 (p_msg => 'ERROR: '||sqlerrm
6422 ,p_level => C_LEVEL_EXCEPTION
6423 ,p_module => l_log_module);
6424 END IF;
6425 RAISE;
6426 WHEN OTHERS THEN
6427 xla_exceptions_pkg.raise_message
6428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_62');
6429 END Description_62;
6430
6431 ---------------------------------------
6432 --
6433 -- PRIVATE FUNCTION
6434 -- Description_63
6435 --
6436 ---------------------------------------
6437 FUNCTION Description_63 (
6438 p_application_id IN NUMBER
6439 , p_ae_header_id IN NUMBER DEFAULT NULL
6440 --Period Close Date
6441 , p_source_1 IN DATE
6442 )
6443 RETURN VARCHAR2
6444 IS
6445 l_component_type VARCHAR2(80) ;
6446 l_component_code VARCHAR2(30) ;
6447 l_component_type_code VARCHAR2(1) ;
6448 l_component_appl_id INTEGER ;
6449 l_amb_context_code VARCHAR2(30) ;
6450 l_ledger_language VARCHAR2(30) ;
6451 l_source VARCHAR2(1996) ;
6452 l_description VARCHAR2(2000) ;
6453 l_log_module VARCHAR2(240) ;
6454 BEGIN
6455 IF g_log_enabled THEN
6456 l_log_module := C_DEFAULT_MODULE||'.Description_63';
6457 END IF;
6458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6459 trace
6460 (p_msg => 'BEGIN of Description_63'
6461 ,p_level => C_LEVEL_PROCEDURE
6462 ,p_module => l_log_module);
6463 END IF;
6464
6465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
6466 l_component_type := 'AMB_DESCRIPTION';
6467 l_component_code := 'FA_RECLASS_BONUS_EXPENSE';
6468 l_component_type_code := 'S';
6469 l_component_appl_id := 140;
6470 l_amb_context_code := 'DEFAULT';
6471 l_source := NULL;
6475
6472 l_description := NULL;
6473
6474
6476 IF
6477 l_ledger_language = 'US' THEN
6478 l_description := SUBSTR(CONCAT(l_description,'Category Reclass Bonus Expense'),1,2000);
6479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6480 END IF;
6481 IF
6482 l_ledger_language = 'US' THEN
6483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
6484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6485 END IF;
6486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
6487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
6488 IF l_source IS NOT NULL THEN
6489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
6490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6491 END IF;
6492 l_description := SUBSTR(l_description,1,1996);
6493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6494 trace
6495 (p_msg => 'END of Description_63'
6496 ,p_level => C_LEVEL_PROCEDURE
6497 ,p_module => l_log_module);
6498
6499 END IF;
6500 RETURN l_description;
6501
6502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6503 trace
6504 (p_msg => 'END of Description_63'
6505 ,p_level => C_LEVEL_PROCEDURE
6506 ,p_module => l_log_module);
6507 END IF;
6508 RETURN NULL;
6509 EXCEPTION
6510 WHEN VALUE_ERROR THEN
6511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6512 trace
6513 (p_msg => 'ERROR: '||sqlerrm
6514 ,p_level => C_LEVEL_EXCEPTION
6515 ,p_module => l_log_module);
6516 END IF;
6517 RAISE;
6518 WHEN xla_exceptions_pkg.application_exception THEN
6519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6520 trace
6521 (p_msg => 'ERROR: '||sqlerrm
6522 ,p_level => C_LEVEL_EXCEPTION
6523 ,p_module => l_log_module);
6524 END IF;
6525 RAISE;
6526 WHEN OTHERS THEN
6527 xla_exceptions_pkg.raise_message
6528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_63');
6529 END Description_63;
6530
6531 ---------------------------------------
6532 --
6533 -- PRIVATE FUNCTION
6534 -- Description_64
6535 --
6536 ---------------------------------------
6537 FUNCTION Description_64 (
6538 p_application_id IN NUMBER
6539 , p_ae_header_id IN NUMBER DEFAULT NULL
6540 --Period Close Date
6541 , p_source_1 IN DATE
6542 )
6543 RETURN VARCHAR2
6544 IS
6545 l_component_type VARCHAR2(80) ;
6546 l_component_code VARCHAR2(30) ;
6547 l_component_type_code VARCHAR2(1) ;
6548 l_component_appl_id INTEGER ;
6549 l_amb_context_code VARCHAR2(30) ;
6550 l_ledger_language VARCHAR2(30) ;
6551 l_source VARCHAR2(1996) ;
6552 l_description VARCHAR2(2000) ;
6553 l_log_module VARCHAR2(240) ;
6554 BEGIN
6555 IF g_log_enabled THEN
6556 l_log_module := C_DEFAULT_MODULE||'.Description_64';
6557 END IF;
6558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6559 trace
6560 (p_msg => 'BEGIN of Description_64'
6561 ,p_level => C_LEVEL_PROCEDURE
6562 ,p_module => l_log_module);
6563 END IF;
6564
6565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
6566 l_component_type := 'AMB_DESCRIPTION';
6567 l_component_code := 'FA_RECLASS_BONUS_RESERVE';
6568 l_component_type_code := 'S';
6569 l_component_appl_id := 140;
6570 l_amb_context_code := 'DEFAULT';
6571 l_source := NULL;
6572 l_description := NULL;
6573
6574
6575
6576 IF
6577 l_ledger_language = 'US' THEN
6578 l_description := SUBSTR(CONCAT(l_description,'Category Reclass Bonus Reserve'),1,2000);
6579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6580 END IF;
6581 IF
6582 l_ledger_language = 'US' THEN
6583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
6584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6585 END IF;
6586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
6587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
6588 IF l_source IS NOT NULL THEN
6589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
6590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6591 END IF;
6592 l_description := SUBSTR(l_description,1,1996);
6593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6594 trace
6595 (p_msg => 'END of Description_64'
6596 ,p_level => C_LEVEL_PROCEDURE
6597 ,p_module => l_log_module);
6598
6599 END IF;
6600 RETURN l_description;
6601
6602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6603 trace
6604 (p_msg => 'END of Description_64'
6605 ,p_level => C_LEVEL_PROCEDURE
6606 ,p_module => l_log_module);
6607 END IF;
6608 RETURN NULL;
6609 EXCEPTION
6610 WHEN VALUE_ERROR THEN
6611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6612 trace
6616 END IF;
6613 (p_msg => 'ERROR: '||sqlerrm
6614 ,p_level => C_LEVEL_EXCEPTION
6615 ,p_module => l_log_module);
6617 RAISE;
6618 WHEN xla_exceptions_pkg.application_exception THEN
6619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6620 trace
6621 (p_msg => 'ERROR: '||sqlerrm
6622 ,p_level => C_LEVEL_EXCEPTION
6623 ,p_module => l_log_module);
6624 END IF;
6625 RAISE;
6626 WHEN OTHERS THEN
6627 xla_exceptions_pkg.raise_message
6628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_64');
6629 END Description_64;
6630
6631 ---------------------------------------
6632 --
6633 -- PRIVATE FUNCTION
6634 -- Description_65
6635 --
6636 ---------------------------------------
6637 FUNCTION Description_65 (
6638 p_application_id IN NUMBER
6639 , p_ae_header_id IN NUMBER DEFAULT NULL
6640 --Period Close Date
6641 , p_source_1 IN DATE
6642 )
6643 RETURN VARCHAR2
6644 IS
6645 l_component_type VARCHAR2(80) ;
6646 l_component_code VARCHAR2(30) ;
6647 l_component_type_code VARCHAR2(1) ;
6648 l_component_appl_id INTEGER ;
6649 l_amb_context_code VARCHAR2(30) ;
6650 l_ledger_language VARCHAR2(30) ;
6651 l_source VARCHAR2(1996) ;
6652 l_description VARCHAR2(2000) ;
6653 l_log_module VARCHAR2(240) ;
6654 BEGIN
6655 IF g_log_enabled THEN
6656 l_log_module := C_DEFAULT_MODULE||'.Description_65';
6657 END IF;
6658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6659 trace
6660 (p_msg => 'BEGIN of Description_65'
6661 ,p_level => C_LEVEL_PROCEDURE
6662 ,p_module => l_log_module);
6663 END IF;
6664
6665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
6666 l_component_type := 'AMB_DESCRIPTION';
6667 l_component_code := 'FA_RECLASS_COST';
6668 l_component_type_code := 'S';
6669 l_component_appl_id := 140;
6670 l_amb_context_code := 'DEFAULT';
6671 l_source := NULL;
6672 l_description := NULL;
6673
6674
6675
6676 IF
6677 l_ledger_language = 'US' THEN
6678 l_description := SUBSTR(CONCAT(l_description,'Category Reclass Cost'),1,2000);
6679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6680 END IF;
6681 IF
6682 l_ledger_language = 'US' THEN
6683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
6684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6685 END IF;
6686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
6687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
6688 IF l_source IS NOT NULL THEN
6689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
6690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6691 END IF;
6692 l_description := SUBSTR(l_description,1,1996);
6693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6694 trace
6695 (p_msg => 'END of Description_65'
6696 ,p_level => C_LEVEL_PROCEDURE
6697 ,p_module => l_log_module);
6698
6699 END IF;
6700 RETURN l_description;
6701
6702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6703 trace
6704 (p_msg => 'END of Description_65'
6705 ,p_level => C_LEVEL_PROCEDURE
6706 ,p_module => l_log_module);
6707 END IF;
6708 RETURN NULL;
6709 EXCEPTION
6710 WHEN VALUE_ERROR THEN
6711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6712 trace
6713 (p_msg => 'ERROR: '||sqlerrm
6714 ,p_level => C_LEVEL_EXCEPTION
6715 ,p_module => l_log_module);
6716 END IF;
6717 RAISE;
6718 WHEN xla_exceptions_pkg.application_exception THEN
6719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6720 trace
6721 (p_msg => 'ERROR: '||sqlerrm
6722 ,p_level => C_LEVEL_EXCEPTION
6723 ,p_module => l_log_module);
6724 END IF;
6725 RAISE;
6726 WHEN OTHERS THEN
6727 xla_exceptions_pkg.raise_message
6728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_65');
6729 END Description_65;
6730
6731 ---------------------------------------
6732 --
6733 -- PRIVATE FUNCTION
6734 -- Description_66
6735 --
6736 ---------------------------------------
6737 FUNCTION Description_66 (
6738 p_application_id IN NUMBER
6739 , p_ae_header_id IN NUMBER DEFAULT NULL
6740 --Period Close Date
6741 , p_source_1 IN DATE
6742 )
6743 RETURN VARCHAR2
6744 IS
6745 l_component_type VARCHAR2(80) ;
6746 l_component_code VARCHAR2(30) ;
6747 l_component_type_code VARCHAR2(1) ;
6748 l_component_appl_id INTEGER ;
6749 l_amb_context_code VARCHAR2(30) ;
6750 l_ledger_language VARCHAR2(30) ;
6751 l_source VARCHAR2(1996) ;
6752 l_description VARCHAR2(2000) ;
6753 l_log_module VARCHAR2(240) ;
6754 BEGIN
6755 IF g_log_enabled THEN
6756 l_log_module := C_DEFAULT_MODULE||'.Description_66';
6757 END IF;
6758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6762 ,p_module => l_log_module);
6759 trace
6760 (p_msg => 'BEGIN of Description_66'
6761 ,p_level => C_LEVEL_PROCEDURE
6763 END IF;
6764
6765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
6766 l_component_type := 'AMB_DESCRIPTION';
6767 l_component_code := 'FA_RECLASS_DEPRN_EXPENSE';
6768 l_component_type_code := 'S';
6769 l_component_appl_id := 140;
6770 l_amb_context_code := 'DEFAULT';
6771 l_source := NULL;
6772 l_description := NULL;
6773
6774
6775
6776 IF
6777 l_ledger_language = 'US' THEN
6778 l_description := SUBSTR(CONCAT(l_description,'Category Reclass Depreciation Expense'),1,2000);
6779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6780 END IF;
6781 IF
6782 l_ledger_language = 'US' THEN
6783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
6784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6785 END IF;
6786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
6787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
6788 IF l_source IS NOT NULL THEN
6789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
6790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6791 END IF;
6792 l_description := SUBSTR(l_description,1,1996);
6793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6794 trace
6795 (p_msg => 'END of Description_66'
6796 ,p_level => C_LEVEL_PROCEDURE
6797 ,p_module => l_log_module);
6798
6799 END IF;
6800 RETURN l_description;
6801
6802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6803 trace
6804 (p_msg => 'END of Description_66'
6805 ,p_level => C_LEVEL_PROCEDURE
6806 ,p_module => l_log_module);
6807 END IF;
6808 RETURN NULL;
6809 EXCEPTION
6810 WHEN VALUE_ERROR THEN
6811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6812 trace
6813 (p_msg => 'ERROR: '||sqlerrm
6814 ,p_level => C_LEVEL_EXCEPTION
6815 ,p_module => l_log_module);
6816 END IF;
6817 RAISE;
6818 WHEN xla_exceptions_pkg.application_exception THEN
6819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6820 trace
6821 (p_msg => 'ERROR: '||sqlerrm
6822 ,p_level => C_LEVEL_EXCEPTION
6823 ,p_module => l_log_module);
6824 END IF;
6825 RAISE;
6826 WHEN OTHERS THEN
6827 xla_exceptions_pkg.raise_message
6828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_66');
6829 END Description_66;
6830
6831 ---------------------------------------
6832 --
6833 -- PRIVATE FUNCTION
6834 -- Description_67
6835 --
6836 ---------------------------------------
6837 FUNCTION Description_67 (
6838 p_application_id IN NUMBER
6839 , p_ae_header_id IN NUMBER DEFAULT NULL
6840 --Period Close Date
6841 , p_source_1 IN DATE
6842 )
6843 RETURN VARCHAR2
6844 IS
6845 l_component_type VARCHAR2(80) ;
6846 l_component_code VARCHAR2(30) ;
6847 l_component_type_code VARCHAR2(1) ;
6848 l_component_appl_id INTEGER ;
6849 l_amb_context_code VARCHAR2(30) ;
6850 l_ledger_language VARCHAR2(30) ;
6851 l_source VARCHAR2(1996) ;
6852 l_description VARCHAR2(2000) ;
6853 l_log_module VARCHAR2(240) ;
6854 BEGIN
6855 IF g_log_enabled THEN
6856 l_log_module := C_DEFAULT_MODULE||'.Description_67';
6857 END IF;
6858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6859 trace
6860 (p_msg => 'BEGIN of Description_67'
6861 ,p_level => C_LEVEL_PROCEDURE
6862 ,p_module => l_log_module);
6863 END IF;
6864
6865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
6866 l_component_type := 'AMB_DESCRIPTION';
6867 l_component_code := 'FA_RECLASS_RESERVE';
6868 l_component_type_code := 'S';
6869 l_component_appl_id := 140;
6870 l_amb_context_code := 'DEFAULT';
6871 l_source := NULL;
6872 l_description := NULL;
6873
6874
6875
6876 IF
6877 l_ledger_language = 'US' THEN
6878 l_description := SUBSTR(CONCAT(l_description,'Category Reclass Depreciation Reserve'),1,2000);
6879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6880 END IF;
6881 IF
6882 l_ledger_language = 'US' THEN
6883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
6884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6885 END IF;
6886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
6887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
6888 IF l_source IS NOT NULL THEN
6889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
6890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6891 END IF;
6892 l_description := SUBSTR(l_description,1,1996);
6893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6894 trace
6898
6895 (p_msg => 'END of Description_67'
6896 ,p_level => C_LEVEL_PROCEDURE
6897 ,p_module => l_log_module);
6899 END IF;
6900 RETURN l_description;
6901
6902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6903 trace
6904 (p_msg => 'END of Description_67'
6905 ,p_level => C_LEVEL_PROCEDURE
6906 ,p_module => l_log_module);
6907 END IF;
6908 RETURN NULL;
6909 EXCEPTION
6910 WHEN VALUE_ERROR THEN
6911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6912 trace
6913 (p_msg => 'ERROR: '||sqlerrm
6914 ,p_level => C_LEVEL_EXCEPTION
6915 ,p_module => l_log_module);
6916 END IF;
6917 RAISE;
6918 WHEN xla_exceptions_pkg.application_exception THEN
6919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
6920 trace
6921 (p_msg => 'ERROR: '||sqlerrm
6922 ,p_level => C_LEVEL_EXCEPTION
6923 ,p_module => l_log_module);
6924 END IF;
6925 RAISE;
6926 WHEN OTHERS THEN
6927 xla_exceptions_pkg.raise_message
6928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_67');
6929 END Description_67;
6930
6931 ---------------------------------------
6932 --
6933 -- PRIVATE FUNCTION
6934 -- Description_68
6935 --
6936 ---------------------------------------
6937 FUNCTION Description_68 (
6938 p_application_id IN NUMBER
6939 , p_ae_header_id IN NUMBER DEFAULT NULL
6940 --Period Close Date
6941 , p_source_1 IN DATE
6942 )
6943 RETURN VARCHAR2
6944 IS
6945 l_component_type VARCHAR2(80) ;
6946 l_component_code VARCHAR2(30) ;
6947 l_component_type_code VARCHAR2(1) ;
6948 l_component_appl_id INTEGER ;
6949 l_amb_context_code VARCHAR2(30) ;
6950 l_ledger_language VARCHAR2(30) ;
6951 l_source VARCHAR2(1996) ;
6952 l_description VARCHAR2(2000) ;
6953 l_log_module VARCHAR2(240) ;
6954 BEGIN
6955 IF g_log_enabled THEN
6956 l_log_module := C_DEFAULT_MODULE||'.Description_68';
6957 END IF;
6958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6959 trace
6960 (p_msg => 'BEGIN of Description_68'
6961 ,p_level => C_LEVEL_PROCEDURE
6962 ,p_module => l_log_module);
6963 END IF;
6964
6965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
6966 l_component_type := 'AMB_DESCRIPTION';
6967 l_component_code := 'FA_RECLASS_REVAL_RESERVE';
6968 l_component_type_code := 'S';
6969 l_component_appl_id := 140;
6970 l_amb_context_code := 'DEFAULT';
6971 l_source := NULL;
6972 l_description := NULL;
6973
6974
6975
6976 IF
6977 l_ledger_language = 'US' THEN
6978 l_description := SUBSTR(CONCAT(l_description,'Category Reclass Revaluation Reserve'),1,2000);
6979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6980 END IF;
6981 IF
6982 l_ledger_language = 'US' THEN
6983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
6984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6985 END IF;
6986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
6987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
6988 IF l_source IS NOT NULL THEN
6989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
6990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
6991 END IF;
6992 l_description := SUBSTR(l_description,1,1996);
6993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
6994 trace
6995 (p_msg => 'END of Description_68'
6996 ,p_level => C_LEVEL_PROCEDURE
6997 ,p_module => l_log_module);
6998
6999 END IF;
7000 RETURN l_description;
7001
7002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7003 trace
7004 (p_msg => 'END of Description_68'
7005 ,p_level => C_LEVEL_PROCEDURE
7006 ,p_module => l_log_module);
7007 END IF;
7008 RETURN NULL;
7009 EXCEPTION
7010 WHEN VALUE_ERROR THEN
7011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7012 trace
7013 (p_msg => 'ERROR: '||sqlerrm
7014 ,p_level => C_LEVEL_EXCEPTION
7015 ,p_module => l_log_module);
7016 END IF;
7017 RAISE;
7018 WHEN xla_exceptions_pkg.application_exception THEN
7019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7020 trace
7021 (p_msg => 'ERROR: '||sqlerrm
7022 ,p_level => C_LEVEL_EXCEPTION
7023 ,p_module => l_log_module);
7024 END IF;
7025 RAISE;
7026 WHEN OTHERS THEN
7027 xla_exceptions_pkg.raise_message
7028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_68');
7029 END Description_68;
7030
7031 ---------------------------------------
7032 --
7033 -- PRIVATE FUNCTION
7034 -- Description_69
7035 --
7036 ---------------------------------------
7037 FUNCTION Description_69 (
7038 p_application_id IN NUMBER
7039 , p_ae_header_id IN NUMBER DEFAULT NULL
7040 --Period Close Date
7041 , p_source_1 IN DATE
7042 )
7043 RETURN VARCHAR2
7044 IS
7048 l_component_appl_id INTEGER ;
7045 l_component_type VARCHAR2(80) ;
7046 l_component_code VARCHAR2(30) ;
7047 l_component_type_code VARCHAR2(1) ;
7049 l_amb_context_code VARCHAR2(30) ;
7050 l_ledger_language VARCHAR2(30) ;
7051 l_source VARCHAR2(1996) ;
7052 l_description VARCHAR2(2000) ;
7053 l_log_module VARCHAR2(240) ;
7054 BEGIN
7055 IF g_log_enabled THEN
7056 l_log_module := C_DEFAULT_MODULE||'.Description_69';
7057 END IF;
7058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7059 trace
7060 (p_msg => 'BEGIN of Description_69'
7061 ,p_level => C_LEVEL_PROCEDURE
7062 ,p_module => l_log_module);
7063 END IF;
7064
7065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
7066 l_component_type := 'AMB_DESCRIPTION';
7067 l_component_code := 'FA_REINSTATEMENT';
7068 l_component_type_code := 'S';
7069 l_component_appl_id := 140;
7070 l_amb_context_code := 'DEFAULT';
7071 l_source := NULL;
7072 l_description := NULL;
7073
7074
7075
7076 IF
7077 l_ledger_language = 'US' THEN
7078 l_description := SUBSTR(CONCAT(l_description,'Reinstatement'),1,2000);
7079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7080 END IF;
7081 IF
7082 l_ledger_language = 'US' THEN
7083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
7084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7085 END IF;
7086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
7087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
7088 IF l_source IS NOT NULL THEN
7089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
7090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7091 END IF;
7092 l_description := SUBSTR(l_description,1,1996);
7093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7094 trace
7095 (p_msg => 'END of Description_69'
7096 ,p_level => C_LEVEL_PROCEDURE
7097 ,p_module => l_log_module);
7098
7099 END IF;
7100 RETURN l_description;
7101
7102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7103 trace
7104 (p_msg => 'END of Description_69'
7105 ,p_level => C_LEVEL_PROCEDURE
7106 ,p_module => l_log_module);
7107 END IF;
7108 RETURN NULL;
7109 EXCEPTION
7110 WHEN VALUE_ERROR THEN
7111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7112 trace
7113 (p_msg => 'ERROR: '||sqlerrm
7114 ,p_level => C_LEVEL_EXCEPTION
7115 ,p_module => l_log_module);
7116 END IF;
7117 RAISE;
7118 WHEN xla_exceptions_pkg.application_exception THEN
7119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7120 trace
7121 (p_msg => 'ERROR: '||sqlerrm
7122 ,p_level => C_LEVEL_EXCEPTION
7123 ,p_module => l_log_module);
7124 END IF;
7125 RAISE;
7126 WHEN OTHERS THEN
7127 xla_exceptions_pkg.raise_message
7128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_69');
7129 END Description_69;
7130
7131 ---------------------------------------
7132 --
7133 -- PRIVATE FUNCTION
7134 -- Description_70
7135 --
7136 ---------------------------------------
7137 FUNCTION Description_70 (
7138 p_application_id IN NUMBER
7139 , p_ae_header_id IN NUMBER DEFAULT NULL
7140 --Period Close Date
7141 , p_source_1 IN DATE
7142 )
7143 RETURN VARCHAR2
7144 IS
7145 l_component_type VARCHAR2(80) ;
7146 l_component_code VARCHAR2(30) ;
7147 l_component_type_code VARCHAR2(1) ;
7148 l_component_appl_id INTEGER ;
7149 l_amb_context_code VARCHAR2(30) ;
7150 l_ledger_language VARCHAR2(30) ;
7151 l_source VARCHAR2(1996) ;
7152 l_description VARCHAR2(2000) ;
7153 l_log_module VARCHAR2(240) ;
7154 BEGIN
7155 IF g_log_enabled THEN
7156 l_log_module := C_DEFAULT_MODULE||'.Description_70';
7157 END IF;
7158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7159 trace
7160 (p_msg => 'BEGIN of Description_70'
7161 ,p_level => C_LEVEL_PROCEDURE
7162 ,p_module => l_log_module);
7163 END IF;
7164
7165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
7166 l_component_type := 'AMB_DESCRIPTION';
7167 l_component_code := 'FA_RESERVE_TRANSFER';
7168 l_component_type_code := 'S';
7169 l_component_appl_id := 140;
7170 l_amb_context_code := 'DEFAULT';
7171 l_source := NULL;
7172 l_description := NULL;
7173
7174
7175
7176 IF
7177 l_ledger_language = 'US' THEN
7178 l_description := SUBSTR(CONCAT(l_description,'Reserve Transfer'),1,2000);
7179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7180 END IF;
7181 IF
7182 l_ledger_language = 'US' THEN
7183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
7184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7185 END IF;
7189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
7186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
7187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
7188 IF l_source IS NOT NULL THEN
7190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7191 END IF;
7192 l_description := SUBSTR(l_description,1,1996);
7193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7194 trace
7195 (p_msg => 'END of Description_70'
7196 ,p_level => C_LEVEL_PROCEDURE
7197 ,p_module => l_log_module);
7198
7199 END IF;
7200 RETURN l_description;
7201
7202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7203 trace
7204 (p_msg => 'END of Description_70'
7205 ,p_level => C_LEVEL_PROCEDURE
7206 ,p_module => l_log_module);
7207 END IF;
7208 RETURN NULL;
7209 EXCEPTION
7210 WHEN VALUE_ERROR THEN
7211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7212 trace
7213 (p_msg => 'ERROR: '||sqlerrm
7214 ,p_level => C_LEVEL_EXCEPTION
7215 ,p_module => l_log_module);
7216 END IF;
7217 RAISE;
7218 WHEN xla_exceptions_pkg.application_exception THEN
7219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7220 trace
7221 (p_msg => 'ERROR: '||sqlerrm
7222 ,p_level => C_LEVEL_EXCEPTION
7223 ,p_module => l_log_module);
7224 END IF;
7225 RAISE;
7226 WHEN OTHERS THEN
7227 xla_exceptions_pkg.raise_message
7228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_70');
7229 END Description_70;
7230
7231 ---------------------------------------
7232 --
7233 -- PRIVATE FUNCTION
7234 -- Description_71
7235 --
7236 ---------------------------------------
7237 FUNCTION Description_71 (
7238 p_application_id IN NUMBER
7239 , p_ae_header_id IN NUMBER DEFAULT NULL
7240 --Period Close Date
7241 , p_source_1 IN DATE
7242 )
7243 RETURN VARCHAR2
7244 IS
7245 l_component_type VARCHAR2(80) ;
7246 l_component_code VARCHAR2(30) ;
7247 l_component_type_code VARCHAR2(1) ;
7248 l_component_appl_id INTEGER ;
7249 l_amb_context_code VARCHAR2(30) ;
7250 l_ledger_language VARCHAR2(30) ;
7251 l_source VARCHAR2(1996) ;
7252 l_description VARCHAR2(2000) ;
7253 l_log_module VARCHAR2(240) ;
7254 BEGIN
7255 IF g_log_enabled THEN
7256 l_log_module := C_DEFAULT_MODULE||'.Description_71';
7257 END IF;
7258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7259 trace
7260 (p_msg => 'BEGIN of Description_71'
7261 ,p_level => C_LEVEL_PROCEDURE
7262 ,p_module => l_log_module);
7263 END IF;
7264
7265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
7266 l_component_type := 'AMB_DESCRIPTION';
7267 l_component_code := 'FA_RES_IC_PAY';
7268 l_component_type_code := 'S';
7269 l_component_appl_id := 140;
7270 l_amb_context_code := 'DEFAULT';
7271 l_source := NULL;
7272 l_description := NULL;
7273
7274
7275
7276 IF
7277 l_ledger_language = 'US' THEN
7278 l_description := SUBSTR(CONCAT(l_description,'Reserve Transfer Intercompany Payables'),1,2000);
7279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7280 END IF;
7281 IF
7282 l_ledger_language = 'US' THEN
7283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
7284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7285 END IF;
7286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
7287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
7288 IF l_source IS NOT NULL THEN
7289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
7290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7291 END IF;
7292 l_description := SUBSTR(l_description,1,1996);
7293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7294 trace
7295 (p_msg => 'END of Description_71'
7296 ,p_level => C_LEVEL_PROCEDURE
7297 ,p_module => l_log_module);
7298
7299 END IF;
7300 RETURN l_description;
7301
7302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7303 trace
7304 (p_msg => 'END of Description_71'
7305 ,p_level => C_LEVEL_PROCEDURE
7306 ,p_module => l_log_module);
7307 END IF;
7308 RETURN NULL;
7309 EXCEPTION
7310 WHEN VALUE_ERROR THEN
7311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7312 trace
7313 (p_msg => 'ERROR: '||sqlerrm
7314 ,p_level => C_LEVEL_EXCEPTION
7315 ,p_module => l_log_module);
7316 END IF;
7317 RAISE;
7318 WHEN xla_exceptions_pkg.application_exception THEN
7319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7320 trace
7321 (p_msg => 'ERROR: '||sqlerrm
7322 ,p_level => C_LEVEL_EXCEPTION
7323 ,p_module => l_log_module);
7324 END IF;
7325 RAISE;
7326 WHEN OTHERS THEN
7330
7327 xla_exceptions_pkg.raise_message
7328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_71');
7329 END Description_71;
7331 ---------------------------------------
7332 --
7333 -- PRIVATE FUNCTION
7334 -- Description_72
7335 --
7336 ---------------------------------------
7337 FUNCTION Description_72 (
7338 p_application_id IN NUMBER
7339 , p_ae_header_id IN NUMBER DEFAULT NULL
7340 --Period Close Date
7341 , p_source_1 IN DATE
7342 )
7343 RETURN VARCHAR2
7344 IS
7345 l_component_type VARCHAR2(80) ;
7346 l_component_code VARCHAR2(30) ;
7347 l_component_type_code VARCHAR2(1) ;
7348 l_component_appl_id INTEGER ;
7349 l_amb_context_code VARCHAR2(30) ;
7350 l_ledger_language VARCHAR2(30) ;
7351 l_source VARCHAR2(1996) ;
7352 l_description VARCHAR2(2000) ;
7353 l_log_module VARCHAR2(240) ;
7354 BEGIN
7355 IF g_log_enabled THEN
7356 l_log_module := C_DEFAULT_MODULE||'.Description_72';
7357 END IF;
7358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7359 trace
7360 (p_msg => 'BEGIN of Description_72'
7361 ,p_level => C_LEVEL_PROCEDURE
7362 ,p_module => l_log_module);
7363 END IF;
7364
7365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
7366 l_component_type := 'AMB_DESCRIPTION';
7367 l_component_code := 'FA_RES_IC_REC';
7368 l_component_type_code := 'S';
7369 l_component_appl_id := 140;
7370 l_amb_context_code := 'DEFAULT';
7371 l_source := NULL;
7372 l_description := NULL;
7373
7374
7375
7376 IF
7377 l_ledger_language = 'US' THEN
7378 l_description := SUBSTR(CONCAT(l_description,'Reserve Transfer Intercompany Receivable'),1,2000);
7379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7380 END IF;
7381 IF
7382 l_ledger_language = 'US' THEN
7383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
7384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7385 END IF;
7386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
7387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
7388 IF l_source IS NOT NULL THEN
7389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
7390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7391 END IF;
7392 l_description := SUBSTR(l_description,1,1996);
7393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7394 trace
7395 (p_msg => 'END of Description_72'
7396 ,p_level => C_LEVEL_PROCEDURE
7397 ,p_module => l_log_module);
7398
7399 END IF;
7400 RETURN l_description;
7401
7402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7403 trace
7404 (p_msg => 'END of Description_72'
7405 ,p_level => C_LEVEL_PROCEDURE
7406 ,p_module => l_log_module);
7407 END IF;
7408 RETURN NULL;
7409 EXCEPTION
7410 WHEN VALUE_ERROR THEN
7411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7412 trace
7413 (p_msg => 'ERROR: '||sqlerrm
7414 ,p_level => C_LEVEL_EXCEPTION
7415 ,p_module => l_log_module);
7416 END IF;
7417 RAISE;
7418 WHEN xla_exceptions_pkg.application_exception THEN
7419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7420 trace
7421 (p_msg => 'ERROR: '||sqlerrm
7422 ,p_level => C_LEVEL_EXCEPTION
7423 ,p_module => l_log_module);
7424 END IF;
7425 RAISE;
7426 WHEN OTHERS THEN
7427 xla_exceptions_pkg.raise_message
7428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_72');
7429 END Description_72;
7430
7431 ---------------------------------------
7432 --
7433 -- PRIVATE FUNCTION
7434 -- Description_73
7435 --
7436 ---------------------------------------
7437 FUNCTION Description_73 (
7438 p_application_id IN NUMBER
7439 , p_ae_header_id IN NUMBER DEFAULT NULL
7440 --Period Close Date
7441 , p_source_1 IN DATE
7442 )
7443 RETURN VARCHAR2
7444 IS
7445 l_component_type VARCHAR2(80) ;
7446 l_component_code VARCHAR2(30) ;
7447 l_component_type_code VARCHAR2(1) ;
7448 l_component_appl_id INTEGER ;
7449 l_amb_context_code VARCHAR2(30) ;
7450 l_ledger_language VARCHAR2(30) ;
7451 l_source VARCHAR2(1996) ;
7452 l_description VARCHAR2(2000) ;
7453 l_log_module VARCHAR2(240) ;
7454 BEGIN
7455 IF g_log_enabled THEN
7456 l_log_module := C_DEFAULT_MODULE||'.Description_73';
7457 END IF;
7458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7459 trace
7460 (p_msg => 'BEGIN of Description_73'
7461 ,p_level => C_LEVEL_PROCEDURE
7462 ,p_module => l_log_module);
7463 END IF;
7464
7465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
7466 l_component_type := 'AMB_DESCRIPTION';
7470 l_amb_context_code := 'DEFAULT';
7467 l_component_code := 'FA_RES_TRF_RES';
7468 l_component_type_code := 'S';
7469 l_component_appl_id := 140;
7471 l_source := NULL;
7472 l_description := NULL;
7473
7474
7475
7476 IF
7477 l_ledger_language = 'US' THEN
7478 l_description := SUBSTR(CONCAT(l_description,'Reserve Transfer Reserve'),1,2000);
7479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7480 END IF;
7481 IF
7482 l_ledger_language = 'US' THEN
7483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
7484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7485 END IF;
7486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
7487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
7488 IF l_source IS NOT NULL THEN
7489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
7490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7491 END IF;
7492 l_description := SUBSTR(l_description,1,1996);
7493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7494 trace
7495 (p_msg => 'END of Description_73'
7496 ,p_level => C_LEVEL_PROCEDURE
7497 ,p_module => l_log_module);
7498
7499 END IF;
7500 RETURN l_description;
7501
7502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7503 trace
7504 (p_msg => 'END of Description_73'
7505 ,p_level => C_LEVEL_PROCEDURE
7506 ,p_module => l_log_module);
7507 END IF;
7508 RETURN NULL;
7509 EXCEPTION
7510 WHEN VALUE_ERROR THEN
7511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7512 trace
7513 (p_msg => 'ERROR: '||sqlerrm
7514 ,p_level => C_LEVEL_EXCEPTION
7515 ,p_module => l_log_module);
7516 END IF;
7517 RAISE;
7518 WHEN xla_exceptions_pkg.application_exception THEN
7519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7520 trace
7521 (p_msg => 'ERROR: '||sqlerrm
7522 ,p_level => C_LEVEL_EXCEPTION
7523 ,p_module => l_log_module);
7524 END IF;
7525 RAISE;
7526 WHEN OTHERS THEN
7527 xla_exceptions_pkg.raise_message
7528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_73');
7529 END Description_73;
7530
7531 ---------------------------------------
7532 --
7533 -- PRIVATE FUNCTION
7534 -- Description_74
7535 --
7536 ---------------------------------------
7537 FUNCTION Description_74 (
7538 p_application_id IN NUMBER
7539 , p_ae_header_id IN NUMBER DEFAULT NULL
7540 --Period Close Date
7541 , p_source_1 IN DATE
7542 )
7543 RETURN VARCHAR2
7544 IS
7545 l_component_type VARCHAR2(80) ;
7546 l_component_code VARCHAR2(30) ;
7547 l_component_type_code VARCHAR2(1) ;
7548 l_component_appl_id INTEGER ;
7549 l_amb_context_code VARCHAR2(30) ;
7550 l_ledger_language VARCHAR2(30) ;
7551 l_source VARCHAR2(1996) ;
7552 l_description VARCHAR2(2000) ;
7553 l_log_module VARCHAR2(240) ;
7554 BEGIN
7555 IF g_log_enabled THEN
7556 l_log_module := C_DEFAULT_MODULE||'.Description_74';
7557 END IF;
7558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7559 trace
7560 (p_msg => 'BEGIN of Description_74'
7561 ,p_level => C_LEVEL_PROCEDURE
7562 ,p_module => l_log_module);
7563 END IF;
7564
7565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
7566 l_component_type := 'AMB_DESCRIPTION';
7567 l_component_code := 'FA_RETIREMENT';
7568 l_component_type_code := 'S';
7569 l_component_appl_id := 140;
7570 l_amb_context_code := 'DEFAULT';
7571 l_source := NULL;
7572 l_description := NULL;
7573
7574
7575
7576 IF
7577 l_ledger_language = 'US' THEN
7578 l_description := SUBSTR(CONCAT(l_description,'Retirement'),1,2000);
7579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7580 END IF;
7581 IF
7582 l_ledger_language = 'US' THEN
7583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
7584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7585 END IF;
7586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
7587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
7588 IF l_source IS NOT NULL THEN
7589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
7590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7591 END IF;
7592 l_description := SUBSTR(l_description,1,1996);
7593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7594 trace
7595 (p_msg => 'END of Description_74'
7596 ,p_level => C_LEVEL_PROCEDURE
7597 ,p_module => l_log_module);
7598
7599 END IF;
7600 RETURN l_description;
7601
7602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7603 trace
7604 (p_msg => 'END of Description_74'
7605 ,p_level => C_LEVEL_PROCEDURE
7606 ,p_module => l_log_module);
7607 END IF;
7608 RETURN NULL;
7612 trace
7609 EXCEPTION
7610 WHEN VALUE_ERROR THEN
7611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7613 (p_msg => 'ERROR: '||sqlerrm
7614 ,p_level => C_LEVEL_EXCEPTION
7615 ,p_module => l_log_module);
7616 END IF;
7617 RAISE;
7618 WHEN xla_exceptions_pkg.application_exception THEN
7619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7620 trace
7621 (p_msg => 'ERROR: '||sqlerrm
7622 ,p_level => C_LEVEL_EXCEPTION
7623 ,p_module => l_log_module);
7624 END IF;
7625 RAISE;
7626 WHEN OTHERS THEN
7627 xla_exceptions_pkg.raise_message
7628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_74');
7629 END Description_74;
7630
7631 ---------------------------------------
7632 --
7633 -- PRIVATE FUNCTION
7634 -- Description_75
7635 --
7636 ---------------------------------------
7637 FUNCTION Description_75 (
7638 p_application_id IN NUMBER
7639 , p_ae_header_id IN NUMBER DEFAULT NULL
7640 --Period Close Date
7641 , p_source_1 IN DATE
7642 )
7643 RETURN VARCHAR2
7644 IS
7645 l_component_type VARCHAR2(80) ;
7646 l_component_code VARCHAR2(30) ;
7647 l_component_type_code VARCHAR2(1) ;
7648 l_component_appl_id INTEGER ;
7649 l_amb_context_code VARCHAR2(30) ;
7650 l_ledger_language VARCHAR2(30) ;
7651 l_source VARCHAR2(1996) ;
7652 l_description VARCHAR2(2000) ;
7653 l_log_module VARCHAR2(240) ;
7654 BEGIN
7655 IF g_log_enabled THEN
7656 l_log_module := C_DEFAULT_MODULE||'.Description_75';
7657 END IF;
7658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7659 trace
7660 (p_msg => 'BEGIN of Description_75'
7661 ,p_level => C_LEVEL_PROCEDURE
7662 ,p_module => l_log_module);
7663 END IF;
7664
7665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
7666 l_component_type := 'AMB_DESCRIPTION';
7667 l_component_code := 'FA_RETIREMENT_BONUS_EXP';
7668 l_component_type_code := 'S';
7669 l_component_appl_id := 140;
7670 l_amb_context_code := 'DEFAULT';
7671 l_source := NULL;
7672 l_description := NULL;
7673
7674
7675
7676 IF
7677 l_ledger_language = 'US' THEN
7678 l_description := SUBSTR(CONCAT(l_description,'Retirement Bonus Depreciation Expense'),1,2000);
7679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7680 END IF;
7681 IF
7682 l_ledger_language = 'US' THEN
7683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
7684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7685 END IF;
7686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
7687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
7688 IF l_source IS NOT NULL THEN
7689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
7690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7691 END IF;
7692 l_description := SUBSTR(l_description,1,1996);
7693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7694 trace
7695 (p_msg => 'END of Description_75'
7696 ,p_level => C_LEVEL_PROCEDURE
7697 ,p_module => l_log_module);
7698
7699 END IF;
7700 RETURN l_description;
7701
7702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7703 trace
7704 (p_msg => 'END of Description_75'
7705 ,p_level => C_LEVEL_PROCEDURE
7706 ,p_module => l_log_module);
7707 END IF;
7708 RETURN NULL;
7709 EXCEPTION
7710 WHEN VALUE_ERROR THEN
7711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7712 trace
7713 (p_msg => 'ERROR: '||sqlerrm
7714 ,p_level => C_LEVEL_EXCEPTION
7715 ,p_module => l_log_module);
7716 END IF;
7717 RAISE;
7718 WHEN xla_exceptions_pkg.application_exception THEN
7719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7720 trace
7721 (p_msg => 'ERROR: '||sqlerrm
7722 ,p_level => C_LEVEL_EXCEPTION
7723 ,p_module => l_log_module);
7724 END IF;
7725 RAISE;
7726 WHEN OTHERS THEN
7727 xla_exceptions_pkg.raise_message
7728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_75');
7729 END Description_75;
7730
7731 ---------------------------------------
7732 --
7733 -- PRIVATE FUNCTION
7734 -- Description_76
7735 --
7736 ---------------------------------------
7737 FUNCTION Description_76 (
7738 p_application_id IN NUMBER
7739 , p_ae_header_id IN NUMBER DEFAULT NULL
7740 --Period Close Date
7741 , p_source_1 IN DATE
7742 )
7743 RETURN VARCHAR2
7744 IS
7745 l_component_type VARCHAR2(80) ;
7746 l_component_code VARCHAR2(30) ;
7747 l_component_type_code VARCHAR2(1) ;
7748 l_component_appl_id INTEGER ;
7749 l_amb_context_code VARCHAR2(30) ;
7750 l_ledger_language VARCHAR2(30) ;
7751 l_source VARCHAR2(1996) ;
7755 IF g_log_enabled THEN
7752 l_description VARCHAR2(2000) ;
7753 l_log_module VARCHAR2(240) ;
7754 BEGIN
7756 l_log_module := C_DEFAULT_MODULE||'.Description_76';
7757 END IF;
7758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7759 trace
7760 (p_msg => 'BEGIN of Description_76'
7761 ,p_level => C_LEVEL_PROCEDURE
7762 ,p_module => l_log_module);
7763 END IF;
7764
7765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
7766 l_component_type := 'AMB_DESCRIPTION';
7767 l_component_code := 'FA_RETIREMENT_BONUS_RESERVE';
7768 l_component_type_code := 'S';
7769 l_component_appl_id := 140;
7770 l_amb_context_code := 'DEFAULT';
7771 l_source := NULL;
7772 l_description := NULL;
7773
7774
7775
7776 IF
7777 l_ledger_language = 'US' THEN
7778 l_description := SUBSTR(CONCAT(l_description,'Retirement Bonus Depreciation Reserve'),1,2000);
7779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7780 END IF;
7781 IF
7782 l_ledger_language = 'US' THEN
7783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
7784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7785 END IF;
7786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
7787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
7788 IF l_source IS NOT NULL THEN
7789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
7790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7791 END IF;
7792 l_description := SUBSTR(l_description,1,1996);
7793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7794 trace
7795 (p_msg => 'END of Description_76'
7796 ,p_level => C_LEVEL_PROCEDURE
7797 ,p_module => l_log_module);
7798
7799 END IF;
7800 RETURN l_description;
7801
7802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7803 trace
7804 (p_msg => 'END of Description_76'
7805 ,p_level => C_LEVEL_PROCEDURE
7806 ,p_module => l_log_module);
7807 END IF;
7808 RETURN NULL;
7809 EXCEPTION
7810 WHEN VALUE_ERROR THEN
7811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7812 trace
7813 (p_msg => 'ERROR: '||sqlerrm
7814 ,p_level => C_LEVEL_EXCEPTION
7815 ,p_module => l_log_module);
7816 END IF;
7817 RAISE;
7818 WHEN xla_exceptions_pkg.application_exception THEN
7819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7820 trace
7821 (p_msg => 'ERROR: '||sqlerrm
7822 ,p_level => C_LEVEL_EXCEPTION
7823 ,p_module => l_log_module);
7824 END IF;
7825 RAISE;
7826 WHEN OTHERS THEN
7827 xla_exceptions_pkg.raise_message
7828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_76');
7829 END Description_76;
7830
7831 ---------------------------------------
7832 --
7833 -- PRIVATE FUNCTION
7834 -- Description_77
7835 --
7836 ---------------------------------------
7837 FUNCTION Description_77 (
7838 p_application_id IN NUMBER
7839 , p_ae_header_id IN NUMBER DEFAULT NULL
7840 --Period Close Date
7841 , p_source_1 IN DATE
7842 )
7843 RETURN VARCHAR2
7844 IS
7845 l_component_type VARCHAR2(80) ;
7846 l_component_code VARCHAR2(30) ;
7847 l_component_type_code VARCHAR2(1) ;
7848 l_component_appl_id INTEGER ;
7849 l_amb_context_code VARCHAR2(30) ;
7850 l_ledger_language VARCHAR2(30) ;
7851 l_source VARCHAR2(1996) ;
7852 l_description VARCHAR2(2000) ;
7853 l_log_module VARCHAR2(240) ;
7854 BEGIN
7855 IF g_log_enabled THEN
7856 l_log_module := C_DEFAULT_MODULE||'.Description_77';
7857 END IF;
7858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7859 trace
7860 (p_msg => 'BEGIN of Description_77'
7861 ,p_level => C_LEVEL_PROCEDURE
7862 ,p_module => l_log_module);
7863 END IF;
7864
7865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
7866 l_component_type := 'AMB_DESCRIPTION';
7867 l_component_code := 'FA_RETIREMENT_COST';
7868 l_component_type_code := 'S';
7869 l_component_appl_id := 140;
7870 l_amb_context_code := 'DEFAULT';
7871 l_source := NULL;
7872 l_description := NULL;
7873
7874
7875
7876 IF
7877 l_ledger_language = 'US' THEN
7878 l_description := SUBSTR(CONCAT(l_description,'Retirement Cost'),1,2000);
7879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7880 END IF;
7881 IF
7882 l_ledger_language = 'US' THEN
7883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
7884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7885 END IF;
7886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
7887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
7888 IF l_source IS NOT NULL THEN
7889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
7893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7891 END IF;
7892 l_description := SUBSTR(l_description,1,1996);
7894 trace
7895 (p_msg => 'END of Description_77'
7896 ,p_level => C_LEVEL_PROCEDURE
7897 ,p_module => l_log_module);
7898
7899 END IF;
7900 RETURN l_description;
7901
7902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7903 trace
7904 (p_msg => 'END of Description_77'
7905 ,p_level => C_LEVEL_PROCEDURE
7906 ,p_module => l_log_module);
7907 END IF;
7908 RETURN NULL;
7909 EXCEPTION
7910 WHEN VALUE_ERROR THEN
7911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7912 trace
7913 (p_msg => 'ERROR: '||sqlerrm
7914 ,p_level => C_LEVEL_EXCEPTION
7915 ,p_module => l_log_module);
7916 END IF;
7917 RAISE;
7918 WHEN xla_exceptions_pkg.application_exception THEN
7919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
7920 trace
7921 (p_msg => 'ERROR: '||sqlerrm
7922 ,p_level => C_LEVEL_EXCEPTION
7923 ,p_module => l_log_module);
7924 END IF;
7925 RAISE;
7926 WHEN OTHERS THEN
7927 xla_exceptions_pkg.raise_message
7928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_77');
7929 END Description_77;
7930
7931 ---------------------------------------
7932 --
7933 -- PRIVATE FUNCTION
7934 -- Description_78
7935 --
7936 ---------------------------------------
7937 FUNCTION Description_78 (
7938 p_application_id IN NUMBER
7939 , p_ae_header_id IN NUMBER DEFAULT NULL
7940 --Period Close Date
7941 , p_source_1 IN DATE
7942 )
7943 RETURN VARCHAR2
7944 IS
7945 l_component_type VARCHAR2(80) ;
7946 l_component_code VARCHAR2(30) ;
7947 l_component_type_code VARCHAR2(1) ;
7948 l_component_appl_id INTEGER ;
7949 l_amb_context_code VARCHAR2(30) ;
7950 l_ledger_language VARCHAR2(30) ;
7951 l_source VARCHAR2(1996) ;
7952 l_description VARCHAR2(2000) ;
7953 l_log_module VARCHAR2(240) ;
7954 BEGIN
7955 IF g_log_enabled THEN
7956 l_log_module := C_DEFAULT_MODULE||'.Description_78';
7957 END IF;
7958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7959 trace
7960 (p_msg => 'BEGIN of Description_78'
7961 ,p_level => C_LEVEL_PROCEDURE
7962 ,p_module => l_log_module);
7963 END IF;
7964
7965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
7966 l_component_type := 'AMB_DESCRIPTION';
7967 l_component_code := 'FA_RETIREMENT_COST_OF_REMOVAL';
7968 l_component_type_code := 'S';
7969 l_component_appl_id := 140;
7970 l_amb_context_code := 'DEFAULT';
7971 l_source := NULL;
7972 l_description := NULL;
7973
7974
7975
7976 IF
7977 l_ledger_language = 'US' THEN
7978 l_description := SUBSTR(CONCAT(l_description,'Retirement Cost of Removal'),1,2000);
7979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7980 END IF;
7981 IF
7982 l_ledger_language = 'US' THEN
7983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
7984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7985 END IF;
7986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
7987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
7988 IF l_source IS NOT NULL THEN
7989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
7990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
7991 END IF;
7992 l_description := SUBSTR(l_description,1,1996);
7993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
7994 trace
7995 (p_msg => 'END of Description_78'
7996 ,p_level => C_LEVEL_PROCEDURE
7997 ,p_module => l_log_module);
7998
7999 END IF;
8000 RETURN l_description;
8001
8002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8003 trace
8004 (p_msg => 'END of Description_78'
8005 ,p_level => C_LEVEL_PROCEDURE
8006 ,p_module => l_log_module);
8007 END IF;
8008 RETURN NULL;
8009 EXCEPTION
8010 WHEN VALUE_ERROR THEN
8011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8012 trace
8013 (p_msg => 'ERROR: '||sqlerrm
8014 ,p_level => C_LEVEL_EXCEPTION
8015 ,p_module => l_log_module);
8016 END IF;
8017 RAISE;
8018 WHEN xla_exceptions_pkg.application_exception THEN
8019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8020 trace
8021 (p_msg => 'ERROR: '||sqlerrm
8022 ,p_level => C_LEVEL_EXCEPTION
8023 ,p_module => l_log_module);
8024 END IF;
8025 RAISE;
8026 WHEN OTHERS THEN
8027 xla_exceptions_pkg.raise_message
8028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_78');
8029 END Description_78;
8030
8031 ---------------------------------------
8032 --
8033 -- PRIVATE FUNCTION
8037 FUNCTION Description_79 (
8034 -- Description_79
8035 --
8036 ---------------------------------------
8038 p_application_id IN NUMBER
8039 , p_ae_header_id IN NUMBER DEFAULT NULL
8040 --Period Close Date
8041 , p_source_1 IN DATE
8042 )
8043 RETURN VARCHAR2
8044 IS
8045 l_component_type VARCHAR2(80) ;
8046 l_component_code VARCHAR2(30) ;
8047 l_component_type_code VARCHAR2(1) ;
8048 l_component_appl_id INTEGER ;
8049 l_amb_context_code VARCHAR2(30) ;
8050 l_ledger_language VARCHAR2(30) ;
8051 l_source VARCHAR2(1996) ;
8052 l_description VARCHAR2(2000) ;
8053 l_log_module VARCHAR2(240) ;
8054 BEGIN
8055 IF g_log_enabled THEN
8056 l_log_module := C_DEFAULT_MODULE||'.Description_79';
8057 END IF;
8058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8059 trace
8060 (p_msg => 'BEGIN of Description_79'
8061 ,p_level => C_LEVEL_PROCEDURE
8062 ,p_module => l_log_module);
8063 END IF;
8064
8065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
8066 l_component_type := 'AMB_DESCRIPTION';
8067 l_component_code := 'FA_RETIREMENT_EXP';
8068 l_component_type_code := 'S';
8069 l_component_appl_id := 140;
8070 l_amb_context_code := 'DEFAULT';
8071 l_source := NULL;
8072 l_description := NULL;
8073
8074
8075
8076 IF
8077 l_ledger_language = 'US' THEN
8078 l_description := SUBSTR(CONCAT(l_description,'Retirement Depreciation Expense'),1,2000);
8079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8080 END IF;
8081 IF
8082 l_ledger_language = 'US' THEN
8083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
8084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8085 END IF;
8086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
8087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
8088 IF l_source IS NOT NULL THEN
8089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
8090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8091 END IF;
8092 l_description := SUBSTR(l_description,1,1996);
8093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8094 trace
8095 (p_msg => 'END of Description_79'
8096 ,p_level => C_LEVEL_PROCEDURE
8097 ,p_module => l_log_module);
8098
8099 END IF;
8100 RETURN l_description;
8101
8102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8103 trace
8104 (p_msg => 'END of Description_79'
8105 ,p_level => C_LEVEL_PROCEDURE
8106 ,p_module => l_log_module);
8107 END IF;
8108 RETURN NULL;
8109 EXCEPTION
8110 WHEN VALUE_ERROR THEN
8111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8112 trace
8113 (p_msg => 'ERROR: '||sqlerrm
8114 ,p_level => C_LEVEL_EXCEPTION
8115 ,p_module => l_log_module);
8116 END IF;
8117 RAISE;
8118 WHEN xla_exceptions_pkg.application_exception THEN
8119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8120 trace
8121 (p_msg => 'ERROR: '||sqlerrm
8122 ,p_level => C_LEVEL_EXCEPTION
8123 ,p_module => l_log_module);
8124 END IF;
8125 RAISE;
8126 WHEN OTHERS THEN
8127 xla_exceptions_pkg.raise_message
8128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_79');
8129 END Description_79;
8130
8131 ---------------------------------------
8132 --
8133 -- PRIVATE FUNCTION
8134 -- Description_80
8135 --
8136 ---------------------------------------
8137 FUNCTION Description_80 (
8138 p_application_id IN NUMBER
8139 , p_ae_header_id IN NUMBER DEFAULT NULL
8140 --Period Close Date
8141 , p_source_1 IN DATE
8142 )
8143 RETURN VARCHAR2
8144 IS
8145 l_component_type VARCHAR2(80) ;
8146 l_component_code VARCHAR2(30) ;
8147 l_component_type_code VARCHAR2(1) ;
8148 l_component_appl_id INTEGER ;
8149 l_amb_context_code VARCHAR2(30) ;
8150 l_ledger_language VARCHAR2(30) ;
8151 l_source VARCHAR2(1996) ;
8152 l_description VARCHAR2(2000) ;
8153 l_log_module VARCHAR2(240) ;
8154 BEGIN
8155 IF g_log_enabled THEN
8156 l_log_module := C_DEFAULT_MODULE||'.Description_80';
8157 END IF;
8158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8159 trace
8160 (p_msg => 'BEGIN of Description_80'
8161 ,p_level => C_LEVEL_PROCEDURE
8162 ,p_module => l_log_module);
8163 END IF;
8164
8165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
8166 l_component_type := 'AMB_DESCRIPTION';
8167 l_component_code := 'FA_RETIREMENT_NBV_RETIRED';
8168 l_component_type_code := 'S';
8169 l_component_appl_id := 140;
8170 l_amb_context_code := 'DEFAULT';
8171 l_source := NULL;
8172 l_description := NULL;
8173
8174
8175
8176 IF
8177 l_ledger_language = 'US' THEN
8178 l_description := SUBSTR(CONCAT(l_description,'Retirement NBV Retired'),1,2000);
8182 l_ledger_language = 'US' THEN
8179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8180 END IF;
8181 IF
8183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
8184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8185 END IF;
8186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
8187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
8188 IF l_source IS NOT NULL THEN
8189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
8190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8191 END IF;
8192 l_description := SUBSTR(l_description,1,1996);
8193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8194 trace
8195 (p_msg => 'END of Description_80'
8196 ,p_level => C_LEVEL_PROCEDURE
8197 ,p_module => l_log_module);
8198
8199 END IF;
8200 RETURN l_description;
8201
8202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8203 trace
8204 (p_msg => 'END of Description_80'
8205 ,p_level => C_LEVEL_PROCEDURE
8206 ,p_module => l_log_module);
8207 END IF;
8208 RETURN NULL;
8209 EXCEPTION
8210 WHEN VALUE_ERROR THEN
8211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8212 trace
8213 (p_msg => 'ERROR: '||sqlerrm
8214 ,p_level => C_LEVEL_EXCEPTION
8215 ,p_module => l_log_module);
8216 END IF;
8217 RAISE;
8218 WHEN xla_exceptions_pkg.application_exception THEN
8219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8220 trace
8221 (p_msg => 'ERROR: '||sqlerrm
8222 ,p_level => C_LEVEL_EXCEPTION
8223 ,p_module => l_log_module);
8224 END IF;
8225 RAISE;
8226 WHEN OTHERS THEN
8227 xla_exceptions_pkg.raise_message
8228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_80');
8229 END Description_80;
8230
8231 ---------------------------------------
8232 --
8233 -- PRIVATE FUNCTION
8234 -- Description_81
8235 --
8236 ---------------------------------------
8237 FUNCTION Description_81 (
8238 p_application_id IN NUMBER
8239 , p_ae_header_id IN NUMBER DEFAULT NULL
8240 --Period Close Date
8241 , p_source_1 IN DATE
8242 )
8243 RETURN VARCHAR2
8244 IS
8245 l_component_type VARCHAR2(80) ;
8246 l_component_code VARCHAR2(30) ;
8247 l_component_type_code VARCHAR2(1) ;
8248 l_component_appl_id INTEGER ;
8249 l_amb_context_code VARCHAR2(30) ;
8250 l_ledger_language VARCHAR2(30) ;
8251 l_source VARCHAR2(1996) ;
8252 l_description VARCHAR2(2000) ;
8253 l_log_module VARCHAR2(240) ;
8254 BEGIN
8255 IF g_log_enabled THEN
8256 l_log_module := C_DEFAULT_MODULE||'.Description_81';
8257 END IF;
8258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8259 trace
8260 (p_msg => 'BEGIN of Description_81'
8261 ,p_level => C_LEVEL_PROCEDURE
8262 ,p_module => l_log_module);
8263 END IF;
8264
8265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
8266 l_component_type := 'AMB_DESCRIPTION';
8267 l_component_code := 'FA_RETIREMENT_PROC_OF_SALE';
8268 l_component_type_code := 'S';
8269 l_component_appl_id := 140;
8270 l_amb_context_code := 'DEFAULT';
8271 l_source := NULL;
8272 l_description := NULL;
8273
8274
8275
8276 IF
8277 l_ledger_language = 'US' THEN
8278 l_description := SUBSTR(CONCAT(l_description,'Retirement Proceeds of Sale'),1,2000);
8279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8280 END IF;
8281 IF
8282 l_ledger_language = 'US' THEN
8283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
8284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8285 END IF;
8286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
8287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
8288 IF l_source IS NOT NULL THEN
8289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
8290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8291 END IF;
8292 l_description := SUBSTR(l_description,1,1996);
8293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8294 trace
8295 (p_msg => 'END of Description_81'
8296 ,p_level => C_LEVEL_PROCEDURE
8297 ,p_module => l_log_module);
8298
8299 END IF;
8300 RETURN l_description;
8301
8302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8303 trace
8304 (p_msg => 'END of Description_81'
8305 ,p_level => C_LEVEL_PROCEDURE
8306 ,p_module => l_log_module);
8307 END IF;
8308 RETURN NULL;
8309 EXCEPTION
8310 WHEN VALUE_ERROR THEN
8311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8312 trace
8313 (p_msg => 'ERROR: '||sqlerrm
8314 ,p_level => C_LEVEL_EXCEPTION
8315 ,p_module => l_log_module);
8316 END IF;
8317 RAISE;
8321 (p_msg => 'ERROR: '||sqlerrm
8318 WHEN xla_exceptions_pkg.application_exception THEN
8319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8320 trace
8322 ,p_level => C_LEVEL_EXCEPTION
8323 ,p_module => l_log_module);
8324 END IF;
8325 RAISE;
8326 WHEN OTHERS THEN
8327 xla_exceptions_pkg.raise_message
8328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_81');
8329 END Description_81;
8330
8331 ---------------------------------------
8332 --
8333 -- PRIVATE FUNCTION
8334 -- Description_82
8335 --
8336 ---------------------------------------
8337 FUNCTION Description_82 (
8338 p_application_id IN NUMBER
8339 , p_ae_header_id IN NUMBER DEFAULT NULL
8340 --Period Close Date
8341 , p_source_1 IN DATE
8342 )
8343 RETURN VARCHAR2
8344 IS
8345 l_component_type VARCHAR2(80) ;
8346 l_component_code VARCHAR2(30) ;
8347 l_component_type_code VARCHAR2(1) ;
8348 l_component_appl_id INTEGER ;
8349 l_amb_context_code VARCHAR2(30) ;
8350 l_ledger_language VARCHAR2(30) ;
8351 l_source VARCHAR2(1996) ;
8352 l_description VARCHAR2(2000) ;
8353 l_log_module VARCHAR2(240) ;
8354 BEGIN
8355 IF g_log_enabled THEN
8356 l_log_module := C_DEFAULT_MODULE||'.Description_82';
8357 END IF;
8358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8359 trace
8360 (p_msg => 'BEGIN of Description_82'
8361 ,p_level => C_LEVEL_PROCEDURE
8362 ,p_module => l_log_module);
8363 END IF;
8364
8365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
8366 l_component_type := 'AMB_DESCRIPTION';
8367 l_component_code := 'FA_RETIREMENT_RESERVE';
8368 l_component_type_code := 'S';
8369 l_component_appl_id := 140;
8370 l_amb_context_code := 'DEFAULT';
8371 l_source := NULL;
8372 l_description := NULL;
8373
8374
8375
8376 IF
8377 l_ledger_language = 'US' THEN
8378 l_description := SUBSTR(CONCAT(l_description,'Retirement Depreciation Reserve'),1,2000);
8379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8380 END IF;
8381 IF
8382 l_ledger_language = 'US' THEN
8383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
8384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8385 END IF;
8386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
8387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
8388 IF l_source IS NOT NULL THEN
8389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
8390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8391 END IF;
8392 l_description := SUBSTR(l_description,1,1996);
8393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8394 trace
8395 (p_msg => 'END of Description_82'
8396 ,p_level => C_LEVEL_PROCEDURE
8397 ,p_module => l_log_module);
8398
8399 END IF;
8400 RETURN l_description;
8401
8402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8403 trace
8404 (p_msg => 'END of Description_82'
8405 ,p_level => C_LEVEL_PROCEDURE
8406 ,p_module => l_log_module);
8407 END IF;
8408 RETURN NULL;
8409 EXCEPTION
8410 WHEN VALUE_ERROR THEN
8411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8412 trace
8413 (p_msg => 'ERROR: '||sqlerrm
8414 ,p_level => C_LEVEL_EXCEPTION
8415 ,p_module => l_log_module);
8416 END IF;
8417 RAISE;
8418 WHEN xla_exceptions_pkg.application_exception THEN
8419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8420 trace
8421 (p_msg => 'ERROR: '||sqlerrm
8422 ,p_level => C_LEVEL_EXCEPTION
8423 ,p_module => l_log_module);
8424 END IF;
8425 RAISE;
8426 WHEN OTHERS THEN
8427 xla_exceptions_pkg.raise_message
8428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_82');
8429 END Description_82;
8430
8431 ---------------------------------------
8432 --
8433 -- PRIVATE FUNCTION
8434 -- Description_83
8435 --
8436 ---------------------------------------
8437 FUNCTION Description_83 (
8438 p_application_id IN NUMBER
8439 , p_ae_header_id IN NUMBER DEFAULT NULL
8440 --Period Close Date
8441 , p_source_1 IN DATE
8442 )
8443 RETURN VARCHAR2
8444 IS
8445 l_component_type VARCHAR2(80) ;
8446 l_component_code VARCHAR2(30) ;
8447 l_component_type_code VARCHAR2(1) ;
8448 l_component_appl_id INTEGER ;
8449 l_amb_context_code VARCHAR2(30) ;
8450 l_ledger_language VARCHAR2(30) ;
8451 l_source VARCHAR2(1996) ;
8452 l_description VARCHAR2(2000) ;
8453 l_log_module VARCHAR2(240) ;
8454 BEGIN
8455 IF g_log_enabled THEN
8456 l_log_module := C_DEFAULT_MODULE||'.Description_83';
8457 END IF;
8458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8459 trace
8460 (p_msg => 'BEGIN of Description_83'
8461 ,p_level => C_LEVEL_PROCEDURE
8462 ,p_module => l_log_module);
8463 END IF;
8467 l_component_code := 'FA_RETIREMENT_REVAL_RESERVE';
8464
8465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
8466 l_component_type := 'AMB_DESCRIPTION';
8468 l_component_type_code := 'S';
8469 l_component_appl_id := 140;
8470 l_amb_context_code := 'DEFAULT';
8471 l_source := NULL;
8472 l_description := NULL;
8473
8474
8475
8476 IF
8477 l_ledger_language = 'US' THEN
8478 l_description := SUBSTR(CONCAT(l_description,'Retirement Revaluation Reserve'),1,2000);
8479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8480 END IF;
8481 IF
8482 l_ledger_language = 'US' THEN
8483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
8484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8485 END IF;
8486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
8487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
8488 IF l_source IS NOT NULL THEN
8489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
8490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8491 END IF;
8492 l_description := SUBSTR(l_description,1,1996);
8493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8494 trace
8495 (p_msg => 'END of Description_83'
8496 ,p_level => C_LEVEL_PROCEDURE
8497 ,p_module => l_log_module);
8498
8499 END IF;
8500 RETURN l_description;
8501
8502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8503 trace
8504 (p_msg => 'END of Description_83'
8505 ,p_level => C_LEVEL_PROCEDURE
8506 ,p_module => l_log_module);
8507 END IF;
8508 RETURN NULL;
8509 EXCEPTION
8510 WHEN VALUE_ERROR THEN
8511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8512 trace
8513 (p_msg => 'ERROR: '||sqlerrm
8514 ,p_level => C_LEVEL_EXCEPTION
8515 ,p_module => l_log_module);
8516 END IF;
8517 RAISE;
8518 WHEN xla_exceptions_pkg.application_exception THEN
8519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8520 trace
8521 (p_msg => 'ERROR: '||sqlerrm
8522 ,p_level => C_LEVEL_EXCEPTION
8523 ,p_module => l_log_module);
8524 END IF;
8525 RAISE;
8526 WHEN OTHERS THEN
8527 xla_exceptions_pkg.raise_message
8528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_83');
8529 END Description_83;
8530
8531 ---------------------------------------
8532 --
8533 -- PRIVATE FUNCTION
8534 -- Description_84
8535 --
8536 ---------------------------------------
8537 FUNCTION Description_84 (
8538 p_application_id IN NUMBER
8539 , p_ae_header_id IN NUMBER DEFAULT NULL
8540 --Period Close Date
8541 , p_source_1 IN DATE
8542 )
8543 RETURN VARCHAR2
8544 IS
8545 l_component_type VARCHAR2(80) ;
8546 l_component_code VARCHAR2(30) ;
8547 l_component_type_code VARCHAR2(1) ;
8548 l_component_appl_id INTEGER ;
8549 l_amb_context_code VARCHAR2(30) ;
8550 l_ledger_language VARCHAR2(30) ;
8551 l_source VARCHAR2(1996) ;
8552 l_description VARCHAR2(2000) ;
8553 l_log_module VARCHAR2(240) ;
8554 BEGIN
8555 IF g_log_enabled THEN
8556 l_log_module := C_DEFAULT_MODULE||'.Description_84';
8557 END IF;
8558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8559 trace
8560 (p_msg => 'BEGIN of Description_84'
8561 ,p_level => C_LEVEL_PROCEDURE
8562 ,p_module => l_log_module);
8563 END IF;
8564
8565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
8566 l_component_type := 'AMB_DESCRIPTION';
8567 l_component_code := 'FA_RET_ADJ';
8568 l_component_type_code := 'S';
8569 l_component_appl_id := 140;
8570 l_amb_context_code := 'DEFAULT';
8571 l_source := NULL;
8572 l_description := NULL;
8573
8574
8575
8576 IF
8577 l_ledger_language = 'US' THEN
8578 l_description := SUBSTR(CONCAT(l_description,'Retirement Adjustment'),1,2000);
8579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8580 END IF;
8581 IF
8582 l_ledger_language = 'US' THEN
8583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
8584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8585 END IF;
8586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
8587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
8588 IF l_source IS NOT NULL THEN
8589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
8590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8591 END IF;
8592 l_description := SUBSTR(l_description,1,1996);
8593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8594 trace
8595 (p_msg => 'END of Description_84'
8596 ,p_level => C_LEVEL_PROCEDURE
8597 ,p_module => l_log_module);
8598
8599 END IF;
8600 RETURN l_description;
8601
8605 ,p_level => C_LEVEL_PROCEDURE
8602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8603 trace
8604 (p_msg => 'END of Description_84'
8606 ,p_module => l_log_module);
8607 END IF;
8608 RETURN NULL;
8609 EXCEPTION
8610 WHEN VALUE_ERROR THEN
8611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8612 trace
8613 (p_msg => 'ERROR: '||sqlerrm
8614 ,p_level => C_LEVEL_EXCEPTION
8615 ,p_module => l_log_module);
8616 END IF;
8617 RAISE;
8618 WHEN xla_exceptions_pkg.application_exception THEN
8619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8620 trace
8621 (p_msg => 'ERROR: '||sqlerrm
8622 ,p_level => C_LEVEL_EXCEPTION
8623 ,p_module => l_log_module);
8624 END IF;
8625 RAISE;
8626 WHEN OTHERS THEN
8627 xla_exceptions_pkg.raise_message
8628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_84');
8629 END Description_84;
8630
8631 ---------------------------------------
8632 --
8633 -- PRIVATE FUNCTION
8634 -- Description_85
8635 --
8636 ---------------------------------------
8637 FUNCTION Description_85 (
8638 p_application_id IN NUMBER
8639 , p_ae_header_id IN NUMBER DEFAULT NULL
8640 --Period Close Date
8641 , p_source_1 IN DATE
8642 )
8643 RETURN VARCHAR2
8644 IS
8645 l_component_type VARCHAR2(80) ;
8646 l_component_code VARCHAR2(30) ;
8647 l_component_type_code VARCHAR2(1) ;
8648 l_component_appl_id INTEGER ;
8649 l_amb_context_code VARCHAR2(30) ;
8650 l_ledger_language VARCHAR2(30) ;
8651 l_source VARCHAR2(1996) ;
8652 l_description VARCHAR2(2000) ;
8653 l_log_module VARCHAR2(240) ;
8654 BEGIN
8655 IF g_log_enabled THEN
8656 l_log_module := C_DEFAULT_MODULE||'.Description_85';
8657 END IF;
8658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8659 trace
8660 (p_msg => 'BEGIN of Description_85'
8661 ,p_level => C_LEVEL_PROCEDURE
8662 ,p_module => l_log_module);
8663 END IF;
8664
8665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
8666 l_component_type := 'AMB_DESCRIPTION';
8667 l_component_code := 'FA_RET_ADJ_COST_OF_REM_CLR';
8668 l_component_type_code := 'S';
8669 l_component_appl_id := 140;
8670 l_amb_context_code := 'DEFAULT';
8671 l_source := NULL;
8672 l_description := NULL;
8673
8674
8675
8676 IF
8677 l_ledger_language = 'US' THEN
8678 l_description := SUBSTR(CONCAT(l_description,'Retirement Adjustment Cost of Removal Clearing'),1,2000);
8679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8680 END IF;
8681 IF
8682 l_ledger_language = 'US' THEN
8683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
8684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8685 END IF;
8686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
8687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
8688 IF l_source IS NOT NULL THEN
8689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
8690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8691 END IF;
8692 l_description := SUBSTR(l_description,1,1996);
8693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8694 trace
8695 (p_msg => 'END of Description_85'
8696 ,p_level => C_LEVEL_PROCEDURE
8697 ,p_module => l_log_module);
8698
8699 END IF;
8700 RETURN l_description;
8701
8702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8703 trace
8704 (p_msg => 'END of Description_85'
8705 ,p_level => C_LEVEL_PROCEDURE
8706 ,p_module => l_log_module);
8707 END IF;
8708 RETURN NULL;
8709 EXCEPTION
8710 WHEN VALUE_ERROR THEN
8711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8712 trace
8713 (p_msg => 'ERROR: '||sqlerrm
8714 ,p_level => C_LEVEL_EXCEPTION
8715 ,p_module => l_log_module);
8716 END IF;
8717 RAISE;
8718 WHEN xla_exceptions_pkg.application_exception THEN
8719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8720 trace
8721 (p_msg => 'ERROR: '||sqlerrm
8722 ,p_level => C_LEVEL_EXCEPTION
8723 ,p_module => l_log_module);
8724 END IF;
8725 RAISE;
8726 WHEN OTHERS THEN
8727 xla_exceptions_pkg.raise_message
8728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_85');
8729 END Description_85;
8730
8731 ---------------------------------------
8732 --
8733 -- PRIVATE FUNCTION
8734 -- Description_86
8735 --
8736 ---------------------------------------
8737 FUNCTION Description_86 (
8738 p_application_id IN NUMBER
8739 , p_ae_header_id IN NUMBER DEFAULT NULL
8740 --Period Close Date
8741 , p_source_1 IN DATE
8742 )
8743 RETURN VARCHAR2
8744 IS
8745 l_component_type VARCHAR2(80) ;
8746 l_component_code VARCHAR2(30) ;
8747 l_component_type_code VARCHAR2(1) ;
8748 l_component_appl_id INTEGER ;
8752 l_description VARCHAR2(2000) ;
8749 l_amb_context_code VARCHAR2(30) ;
8750 l_ledger_language VARCHAR2(30) ;
8751 l_source VARCHAR2(1996) ;
8753 l_log_module VARCHAR2(240) ;
8754 BEGIN
8755 IF g_log_enabled THEN
8756 l_log_module := C_DEFAULT_MODULE||'.Description_86';
8757 END IF;
8758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8759 trace
8760 (p_msg => 'BEGIN of Description_86'
8761 ,p_level => C_LEVEL_PROCEDURE
8762 ,p_module => l_log_module);
8763 END IF;
8764
8765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
8766 l_component_type := 'AMB_DESCRIPTION';
8767 l_component_code := 'FA_RET_ADJ_RES';
8768 l_component_type_code := 'S';
8769 l_component_appl_id := 140;
8770 l_amb_context_code := 'DEFAULT';
8771 l_source := NULL;
8772 l_description := NULL;
8773
8774
8775
8776 IF
8777 l_ledger_language = 'US' THEN
8778 l_description := SUBSTR(CONCAT(l_description,'Retirement Adjustment Reserve'),1,2000);
8779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8780 END IF;
8781 IF
8782 l_ledger_language = 'US' THEN
8783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
8784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8785 END IF;
8786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
8787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
8788 IF l_source IS NOT NULL THEN
8789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
8790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8791 END IF;
8792 l_description := SUBSTR(l_description,1,1996);
8793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8794 trace
8795 (p_msg => 'END of Description_86'
8796 ,p_level => C_LEVEL_PROCEDURE
8797 ,p_module => l_log_module);
8798
8799 END IF;
8800 RETURN l_description;
8801
8802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8803 trace
8804 (p_msg => 'END of Description_86'
8805 ,p_level => C_LEVEL_PROCEDURE
8806 ,p_module => l_log_module);
8807 END IF;
8808 RETURN NULL;
8809 EXCEPTION
8810 WHEN VALUE_ERROR THEN
8811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8812 trace
8813 (p_msg => 'ERROR: '||sqlerrm
8814 ,p_level => C_LEVEL_EXCEPTION
8815 ,p_module => l_log_module);
8816 END IF;
8817 RAISE;
8818 WHEN xla_exceptions_pkg.application_exception THEN
8819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8820 trace
8821 (p_msg => 'ERROR: '||sqlerrm
8822 ,p_level => C_LEVEL_EXCEPTION
8823 ,p_module => l_log_module);
8824 END IF;
8825 RAISE;
8826 WHEN OTHERS THEN
8827 xla_exceptions_pkg.raise_message
8828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_86');
8829 END Description_86;
8830
8831 ---------------------------------------
8832 --
8833 -- PRIVATE FUNCTION
8834 -- Description_87
8835 --
8836 ---------------------------------------
8837 FUNCTION Description_87 (
8838 p_application_id IN NUMBER
8839 , p_ae_header_id IN NUMBER DEFAULT NULL
8840 --Period Close Date
8841 , p_source_1 IN DATE
8842 )
8843 RETURN VARCHAR2
8844 IS
8845 l_component_type VARCHAR2(80) ;
8846 l_component_code VARCHAR2(30) ;
8847 l_component_type_code VARCHAR2(1) ;
8848 l_component_appl_id INTEGER ;
8849 l_amb_context_code VARCHAR2(30) ;
8850 l_ledger_language VARCHAR2(30) ;
8851 l_source VARCHAR2(1996) ;
8852 l_description VARCHAR2(2000) ;
8853 l_log_module VARCHAR2(240) ;
8854 BEGIN
8855 IF g_log_enabled THEN
8856 l_log_module := C_DEFAULT_MODULE||'.Description_87';
8857 END IF;
8858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8859 trace
8860 (p_msg => 'BEGIN of Description_87'
8861 ,p_level => C_LEVEL_PROCEDURE
8862 ,p_module => l_log_module);
8863 END IF;
8864
8865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
8866 l_component_type := 'AMB_DESCRIPTION';
8867 l_component_code := 'FA_RET_COST_OF_REMOVAL_CLR';
8868 l_component_type_code := 'S';
8869 l_component_appl_id := 140;
8870 l_amb_context_code := 'DEFAULT';
8871 l_source := NULL;
8872 l_description := NULL;
8873
8874
8875
8876 IF
8877 l_ledger_language = 'US' THEN
8878 l_description := SUBSTR(CONCAT(l_description,'Retirement Cost of Removal Clearing'),1,2000);
8879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8880 END IF;
8881 IF
8882 l_ledger_language = 'US' THEN
8883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
8884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8885 END IF;
8886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
8887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
8888 IF l_source IS NOT NULL THEN
8892 l_description := SUBSTR(l_description,1,1996);
8889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
8890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8891 END IF;
8893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8894 trace
8895 (p_msg => 'END of Description_87'
8896 ,p_level => C_LEVEL_PROCEDURE
8897 ,p_module => l_log_module);
8898
8899 END IF;
8900 RETURN l_description;
8901
8902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8903 trace
8904 (p_msg => 'END of Description_87'
8905 ,p_level => C_LEVEL_PROCEDURE
8906 ,p_module => l_log_module);
8907 END IF;
8908 RETURN NULL;
8909 EXCEPTION
8910 WHEN VALUE_ERROR THEN
8911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8912 trace
8913 (p_msg => 'ERROR: '||sqlerrm
8914 ,p_level => C_LEVEL_EXCEPTION
8915 ,p_module => l_log_module);
8916 END IF;
8917 RAISE;
8918 WHEN xla_exceptions_pkg.application_exception THEN
8919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
8920 trace
8921 (p_msg => 'ERROR: '||sqlerrm
8922 ,p_level => C_LEVEL_EXCEPTION
8923 ,p_module => l_log_module);
8924 END IF;
8925 RAISE;
8926 WHEN OTHERS THEN
8927 xla_exceptions_pkg.raise_message
8928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_87');
8929 END Description_87;
8930
8931 ---------------------------------------
8932 --
8933 -- PRIVATE FUNCTION
8934 -- Description_88
8935 --
8936 ---------------------------------------
8937 FUNCTION Description_88 (
8938 p_application_id IN NUMBER
8939 , p_ae_header_id IN NUMBER DEFAULT NULL
8940 --Period Close Date
8941 , p_source_1 IN DATE
8942 )
8943 RETURN VARCHAR2
8944 IS
8945 l_component_type VARCHAR2(80) ;
8946 l_component_code VARCHAR2(30) ;
8947 l_component_type_code VARCHAR2(1) ;
8948 l_component_appl_id INTEGER ;
8949 l_amb_context_code VARCHAR2(30) ;
8950 l_ledger_language VARCHAR2(30) ;
8951 l_source VARCHAR2(1996) ;
8952 l_description VARCHAR2(2000) ;
8953 l_log_module VARCHAR2(240) ;
8954 BEGIN
8955 IF g_log_enabled THEN
8956 l_log_module := C_DEFAULT_MODULE||'.Description_88';
8957 END IF;
8958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8959 trace
8960 (p_msg => 'BEGIN of Description_88'
8961 ,p_level => C_LEVEL_PROCEDURE
8962 ,p_module => l_log_module);
8963 END IF;
8964
8965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
8966 l_component_type := 'AMB_DESCRIPTION';
8967 l_component_code := 'FA_RET_PROC_OF_SALE_CLEAR';
8968 l_component_type_code := 'S';
8969 l_component_appl_id := 140;
8970 l_amb_context_code := 'DEFAULT';
8971 l_source := NULL;
8972 l_description := NULL;
8973
8974
8975
8976 IF
8977 l_ledger_language = 'US' THEN
8978 l_description := SUBSTR(CONCAT(l_description,'Retirement Proceeds of Sale Clearing'),1,2000);
8979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8980 END IF;
8981 IF
8982 l_ledger_language = 'US' THEN
8983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
8984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8985 END IF;
8986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
8987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
8988 IF l_source IS NOT NULL THEN
8989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
8990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
8991 END IF;
8992 l_description := SUBSTR(l_description,1,1996);
8993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
8994 trace
8995 (p_msg => 'END of Description_88'
8996 ,p_level => C_LEVEL_PROCEDURE
8997 ,p_module => l_log_module);
8998
8999 END IF;
9000 RETURN l_description;
9001
9002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9003 trace
9004 (p_msg => 'END of Description_88'
9005 ,p_level => C_LEVEL_PROCEDURE
9006 ,p_module => l_log_module);
9007 END IF;
9008 RETURN NULL;
9009 EXCEPTION
9010 WHEN VALUE_ERROR THEN
9011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9012 trace
9013 (p_msg => 'ERROR: '||sqlerrm
9014 ,p_level => C_LEVEL_EXCEPTION
9015 ,p_module => l_log_module);
9016 END IF;
9017 RAISE;
9018 WHEN xla_exceptions_pkg.application_exception THEN
9019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9020 trace
9021 (p_msg => 'ERROR: '||sqlerrm
9022 ,p_level => C_LEVEL_EXCEPTION
9023 ,p_module => l_log_module);
9024 END IF;
9025 RAISE;
9026 WHEN OTHERS THEN
9027 xla_exceptions_pkg.raise_message
9028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_88');
9029 END Description_88;
9030
9031 ---------------------------------------
9032 --
9036 ---------------------------------------
9033 -- PRIVATE FUNCTION
9034 -- Description_89
9035 --
9037 FUNCTION Description_89 (
9038 p_application_id IN NUMBER
9039 , p_ae_header_id IN NUMBER DEFAULT NULL
9040 --Period Close Date
9041 , p_source_1 IN DATE
9042 )
9043 RETURN VARCHAR2
9044 IS
9045 l_component_type VARCHAR2(80) ;
9046 l_component_code VARCHAR2(30) ;
9047 l_component_type_code VARCHAR2(1) ;
9048 l_component_appl_id INTEGER ;
9049 l_amb_context_code VARCHAR2(30) ;
9050 l_ledger_language VARCHAR2(30) ;
9051 l_source VARCHAR2(1996) ;
9052 l_description VARCHAR2(2000) ;
9053 l_log_module VARCHAR2(240) ;
9054 BEGIN
9055 IF g_log_enabled THEN
9056 l_log_module := C_DEFAULT_MODULE||'.Description_89';
9057 END IF;
9058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9059 trace
9060 (p_msg => 'BEGIN of Description_89'
9061 ,p_level => C_LEVEL_PROCEDURE
9062 ,p_module => l_log_module);
9063 END IF;
9064
9065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
9066 l_component_type := 'AMB_DESCRIPTION';
9067 l_component_code := 'FA_RET_REVAL_RESERVE_RETIRED';
9068 l_component_type_code := 'S';
9069 l_component_appl_id := 140;
9070 l_amb_context_code := 'DEFAULT';
9071 l_source := NULL;
9072 l_description := NULL;
9073
9074
9075
9076 IF
9077 l_ledger_language = 'US' THEN
9078 l_description := SUBSTR(CONCAT(l_description,'Retirement Revaluation Reserve Retired'),1,2000);
9079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9080 END IF;
9081 IF
9082 l_ledger_language = 'US' THEN
9083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
9084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9085 END IF;
9086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
9087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
9088 IF l_source IS NOT NULL THEN
9089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
9090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9091 END IF;
9092 l_description := SUBSTR(l_description,1,1996);
9093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9094 trace
9095 (p_msg => 'END of Description_89'
9096 ,p_level => C_LEVEL_PROCEDURE
9097 ,p_module => l_log_module);
9098
9099 END IF;
9100 RETURN l_description;
9101
9102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9103 trace
9104 (p_msg => 'END of Description_89'
9105 ,p_level => C_LEVEL_PROCEDURE
9106 ,p_module => l_log_module);
9107 END IF;
9108 RETURN NULL;
9109 EXCEPTION
9110 WHEN VALUE_ERROR THEN
9111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9112 trace
9113 (p_msg => 'ERROR: '||sqlerrm
9114 ,p_level => C_LEVEL_EXCEPTION
9115 ,p_module => l_log_module);
9116 END IF;
9117 RAISE;
9118 WHEN xla_exceptions_pkg.application_exception THEN
9119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9120 trace
9121 (p_msg => 'ERROR: '||sqlerrm
9122 ,p_level => C_LEVEL_EXCEPTION
9123 ,p_module => l_log_module);
9124 END IF;
9125 RAISE;
9126 WHEN OTHERS THEN
9127 xla_exceptions_pkg.raise_message
9128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_89');
9129 END Description_89;
9130
9131 ---------------------------------------
9132 --
9133 -- PRIVATE FUNCTION
9134 -- Description_90
9135 --
9136 ---------------------------------------
9137 FUNCTION Description_90 (
9138 p_application_id IN NUMBER
9139 , p_ae_header_id IN NUMBER DEFAULT NULL
9140 --Period Close Date
9141 , p_source_1 IN DATE
9142 )
9143 RETURN VARCHAR2
9144 IS
9145 l_component_type VARCHAR2(80) ;
9146 l_component_code VARCHAR2(30) ;
9147 l_component_type_code VARCHAR2(1) ;
9148 l_component_appl_id INTEGER ;
9149 l_amb_context_code VARCHAR2(30) ;
9150 l_ledger_language VARCHAR2(30) ;
9151 l_source VARCHAR2(1996) ;
9152 l_description VARCHAR2(2000) ;
9153 l_log_module VARCHAR2(240) ;
9154 BEGIN
9155 IF g_log_enabled THEN
9156 l_log_module := C_DEFAULT_MODULE||'.Description_90';
9157 END IF;
9158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9159 trace
9160 (p_msg => 'BEGIN of Description_90'
9161 ,p_level => C_LEVEL_PROCEDURE
9162 ,p_module => l_log_module);
9163 END IF;
9164
9165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
9166 l_component_type := 'AMB_DESCRIPTION';
9167 l_component_code := 'FA_REVALUATION';
9168 l_component_type_code := 'S';
9169 l_component_appl_id := 140;
9170 l_amb_context_code := 'DEFAULT';
9171 l_source := NULL;
9172 l_description := NULL;
9173
9174
9175
9179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9176 IF
9177 l_ledger_language = 'US' THEN
9178 l_description := SUBSTR(CONCAT(l_description,'Revaluation'),1,2000);
9180 END IF;
9181 IF
9182 l_ledger_language = 'US' THEN
9183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
9184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9185 END IF;
9186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
9187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
9188 IF l_source IS NOT NULL THEN
9189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
9190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9191 END IF;
9192 l_description := SUBSTR(l_description,1,1996);
9193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9194 trace
9195 (p_msg => 'END of Description_90'
9196 ,p_level => C_LEVEL_PROCEDURE
9197 ,p_module => l_log_module);
9198
9199 END IF;
9200 RETURN l_description;
9201
9202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9203 trace
9204 (p_msg => 'END of Description_90'
9205 ,p_level => C_LEVEL_PROCEDURE
9206 ,p_module => l_log_module);
9207 END IF;
9208 RETURN NULL;
9209 EXCEPTION
9210 WHEN VALUE_ERROR THEN
9211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9212 trace
9213 (p_msg => 'ERROR: '||sqlerrm
9214 ,p_level => C_LEVEL_EXCEPTION
9215 ,p_module => l_log_module);
9216 END IF;
9217 RAISE;
9218 WHEN xla_exceptions_pkg.application_exception THEN
9219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9220 trace
9221 (p_msg => 'ERROR: '||sqlerrm
9222 ,p_level => C_LEVEL_EXCEPTION
9223 ,p_module => l_log_module);
9224 END IF;
9225 RAISE;
9226 WHEN OTHERS THEN
9227 xla_exceptions_pkg.raise_message
9228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_90');
9229 END Description_90;
9230
9231 ---------------------------------------
9232 --
9233 -- PRIVATE FUNCTION
9234 -- Description_91
9235 --
9236 ---------------------------------------
9237 FUNCTION Description_91 (
9238 p_application_id IN NUMBER
9239 , p_ae_header_id IN NUMBER DEFAULT NULL
9240 --Period Close Date
9241 , p_source_1 IN DATE
9242 )
9243 RETURN VARCHAR2
9244 IS
9245 l_component_type VARCHAR2(80) ;
9246 l_component_code VARCHAR2(30) ;
9247 l_component_type_code VARCHAR2(1) ;
9248 l_component_appl_id INTEGER ;
9249 l_amb_context_code VARCHAR2(30) ;
9250 l_ledger_language VARCHAR2(30) ;
9251 l_source VARCHAR2(1996) ;
9252 l_description VARCHAR2(2000) ;
9253 l_log_module VARCHAR2(240) ;
9254 BEGIN
9255 IF g_log_enabled THEN
9256 l_log_module := C_DEFAULT_MODULE||'.Description_91';
9257 END IF;
9258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9259 trace
9260 (p_msg => 'BEGIN of Description_91'
9261 ,p_level => C_LEVEL_PROCEDURE
9262 ,p_module => l_log_module);
9263 END IF;
9264
9265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
9266 l_component_type := 'AMB_DESCRIPTION';
9267 l_component_code := 'FA_REVAL_BONUS_EXPENSE';
9268 l_component_type_code := 'S';
9269 l_component_appl_id := 140;
9270 l_amb_context_code := 'DEFAULT';
9271 l_source := NULL;
9272 l_description := NULL;
9273
9274
9275
9276 IF
9277 l_ledger_language = 'US' THEN
9278 l_description := SUBSTR(CONCAT(l_description,'Description for Revaluation Bonus Expense'),1,2000);
9279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9280 END IF;
9281 IF
9282 l_ledger_language = 'US' THEN
9283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
9284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9285 END IF;
9286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
9287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
9288 IF l_source IS NOT NULL THEN
9289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
9290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9291 END IF;
9292 l_description := SUBSTR(l_description,1,1996);
9293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9294 trace
9295 (p_msg => 'END of Description_91'
9296 ,p_level => C_LEVEL_PROCEDURE
9297 ,p_module => l_log_module);
9298
9299 END IF;
9300 RETURN l_description;
9301
9302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9303 trace
9304 (p_msg => 'END of Description_91'
9305 ,p_level => C_LEVEL_PROCEDURE
9306 ,p_module => l_log_module);
9307 END IF;
9308 RETURN NULL;
9309 EXCEPTION
9310 WHEN VALUE_ERROR THEN
9311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9312 trace
9313 (p_msg => 'ERROR: '||sqlerrm
9317 RAISE;
9314 ,p_level => C_LEVEL_EXCEPTION
9315 ,p_module => l_log_module);
9316 END IF;
9318 WHEN xla_exceptions_pkg.application_exception THEN
9319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9320 trace
9321 (p_msg => 'ERROR: '||sqlerrm
9322 ,p_level => C_LEVEL_EXCEPTION
9323 ,p_module => l_log_module);
9324 END IF;
9325 RAISE;
9326 WHEN OTHERS THEN
9327 xla_exceptions_pkg.raise_message
9328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_91');
9329 END Description_91;
9330
9331 ---------------------------------------
9332 --
9333 -- PRIVATE FUNCTION
9334 -- Description_92
9335 --
9336 ---------------------------------------
9337 FUNCTION Description_92 (
9338 p_application_id IN NUMBER
9339 , p_ae_header_id IN NUMBER DEFAULT NULL
9340 --Period Close Date
9341 , p_source_1 IN DATE
9342 )
9343 RETURN VARCHAR2
9344 IS
9345 l_component_type VARCHAR2(80) ;
9346 l_component_code VARCHAR2(30) ;
9347 l_component_type_code VARCHAR2(1) ;
9348 l_component_appl_id INTEGER ;
9349 l_amb_context_code VARCHAR2(30) ;
9350 l_ledger_language VARCHAR2(30) ;
9351 l_source VARCHAR2(1996) ;
9352 l_description VARCHAR2(2000) ;
9353 l_log_module VARCHAR2(240) ;
9354 BEGIN
9355 IF g_log_enabled THEN
9356 l_log_module := C_DEFAULT_MODULE||'.Description_92';
9357 END IF;
9358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9359 trace
9360 (p_msg => 'BEGIN of Description_92'
9361 ,p_level => C_LEVEL_PROCEDURE
9362 ,p_module => l_log_module);
9363 END IF;
9364
9365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
9366 l_component_type := 'AMB_DESCRIPTION';
9367 l_component_code := 'FA_REVAL_BONUS_RESERVE';
9368 l_component_type_code := 'S';
9369 l_component_appl_id := 140;
9370 l_amb_context_code := 'DEFAULT';
9371 l_source := NULL;
9372 l_description := NULL;
9373
9374
9375
9376 IF
9377 l_ledger_language = 'US' THEN
9378 l_description := SUBSTR(CONCAT(l_description,'Revaluation Bonus Reserve'),1,2000);
9379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9380 END IF;
9381 IF
9382 l_ledger_language = 'US' THEN
9383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
9384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9385 END IF;
9386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
9387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
9388 IF l_source IS NOT NULL THEN
9389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
9390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9391 END IF;
9392 l_description := SUBSTR(l_description,1,1996);
9393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9394 trace
9395 (p_msg => 'END of Description_92'
9396 ,p_level => C_LEVEL_PROCEDURE
9397 ,p_module => l_log_module);
9398
9399 END IF;
9400 RETURN l_description;
9401
9402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9403 trace
9404 (p_msg => 'END of Description_92'
9405 ,p_level => C_LEVEL_PROCEDURE
9406 ,p_module => l_log_module);
9407 END IF;
9408 RETURN NULL;
9409 EXCEPTION
9410 WHEN VALUE_ERROR THEN
9411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9412 trace
9413 (p_msg => 'ERROR: '||sqlerrm
9414 ,p_level => C_LEVEL_EXCEPTION
9415 ,p_module => l_log_module);
9416 END IF;
9417 RAISE;
9418 WHEN xla_exceptions_pkg.application_exception THEN
9419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9420 trace
9421 (p_msg => 'ERROR: '||sqlerrm
9422 ,p_level => C_LEVEL_EXCEPTION
9423 ,p_module => l_log_module);
9424 END IF;
9425 RAISE;
9426 WHEN OTHERS THEN
9427 xla_exceptions_pkg.raise_message
9428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_92');
9429 END Description_92;
9430
9431 ---------------------------------------
9432 --
9433 -- PRIVATE FUNCTION
9434 -- Description_93
9435 --
9436 ---------------------------------------
9437 FUNCTION Description_93 (
9438 p_application_id IN NUMBER
9439 , p_ae_header_id IN NUMBER DEFAULT NULL
9440 --Period Close Date
9441 , p_source_1 IN DATE
9442 )
9443 RETURN VARCHAR2
9444 IS
9445 l_component_type VARCHAR2(80) ;
9446 l_component_code VARCHAR2(30) ;
9447 l_component_type_code VARCHAR2(1) ;
9448 l_component_appl_id INTEGER ;
9449 l_amb_context_code VARCHAR2(30) ;
9450 l_ledger_language VARCHAR2(30) ;
9451 l_source VARCHAR2(1996) ;
9452 l_description VARCHAR2(2000) ;
9453 l_log_module VARCHAR2(240) ;
9454 BEGIN
9455 IF g_log_enabled THEN
9456 l_log_module := C_DEFAULT_MODULE||'.Description_93';
9460 (p_msg => 'BEGIN of Description_93'
9457 END IF;
9458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9459 trace
9461 ,p_level => C_LEVEL_PROCEDURE
9462 ,p_module => l_log_module);
9463 END IF;
9464
9465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
9466 l_component_type := 'AMB_DESCRIPTION';
9467 l_component_code := 'FA_REVAL_COST';
9468 l_component_type_code := 'S';
9469 l_component_appl_id := 140;
9470 l_amb_context_code := 'DEFAULT';
9471 l_source := NULL;
9472 l_description := NULL;
9473
9474
9475
9476 IF
9477 l_ledger_language = 'US' THEN
9478 l_description := SUBSTR(CONCAT(l_description,'Revaluation Cost'),1,2000);
9479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9480 END IF;
9481 IF
9482 l_ledger_language = 'US' THEN
9483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
9484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9485 END IF;
9486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
9487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
9488 IF l_source IS NOT NULL THEN
9489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
9490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9491 END IF;
9492 l_description := SUBSTR(l_description,1,1996);
9493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9494 trace
9495 (p_msg => 'END of Description_93'
9496 ,p_level => C_LEVEL_PROCEDURE
9497 ,p_module => l_log_module);
9498
9499 END IF;
9500 RETURN l_description;
9501
9502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9503 trace
9504 (p_msg => 'END of Description_93'
9505 ,p_level => C_LEVEL_PROCEDURE
9506 ,p_module => l_log_module);
9507 END IF;
9508 RETURN NULL;
9509 EXCEPTION
9510 WHEN VALUE_ERROR THEN
9511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9512 trace
9513 (p_msg => 'ERROR: '||sqlerrm
9514 ,p_level => C_LEVEL_EXCEPTION
9515 ,p_module => l_log_module);
9516 END IF;
9517 RAISE;
9518 WHEN xla_exceptions_pkg.application_exception THEN
9519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9520 trace
9521 (p_msg => 'ERROR: '||sqlerrm
9522 ,p_level => C_LEVEL_EXCEPTION
9523 ,p_module => l_log_module);
9524 END IF;
9525 RAISE;
9526 WHEN OTHERS THEN
9527 xla_exceptions_pkg.raise_message
9528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_93');
9529 END Description_93;
9530
9531 ---------------------------------------
9532 --
9533 -- PRIVATE FUNCTION
9534 -- Description_94
9535 --
9536 ---------------------------------------
9537 FUNCTION Description_94 (
9538 p_application_id IN NUMBER
9539 , p_ae_header_id IN NUMBER DEFAULT NULL
9540 --Period Close Date
9541 , p_source_1 IN DATE
9542 )
9543 RETURN VARCHAR2
9544 IS
9545 l_component_type VARCHAR2(80) ;
9546 l_component_code VARCHAR2(30) ;
9547 l_component_type_code VARCHAR2(1) ;
9548 l_component_appl_id INTEGER ;
9549 l_amb_context_code VARCHAR2(30) ;
9550 l_ledger_language VARCHAR2(30) ;
9551 l_source VARCHAR2(1996) ;
9552 l_description VARCHAR2(2000) ;
9553 l_log_module VARCHAR2(240) ;
9554 BEGIN
9555 IF g_log_enabled THEN
9556 l_log_module := C_DEFAULT_MODULE||'.Description_94';
9557 END IF;
9558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9559 trace
9560 (p_msg => 'BEGIN of Description_94'
9561 ,p_level => C_LEVEL_PROCEDURE
9562 ,p_module => l_log_module);
9563 END IF;
9564
9565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
9566 l_component_type := 'AMB_DESCRIPTION';
9567 l_component_code := 'FA_REVAL_DEPRN_RESERVE';
9568 l_component_type_code := 'S';
9569 l_component_appl_id := 140;
9570 l_amb_context_code := 'DEFAULT';
9571 l_source := NULL;
9572 l_description := NULL;
9573
9574
9575
9576 IF
9577 l_ledger_language = 'US' THEN
9578 l_description := SUBSTR(CONCAT(l_description,'Revaluation Depreciation Reserve'),1,2000);
9579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9580 END IF;
9581 IF
9582 l_ledger_language = 'US' THEN
9583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
9584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9585 END IF;
9586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
9587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
9588 IF l_source IS NOT NULL THEN
9589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
9590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9591 END IF;
9592 l_description := SUBSTR(l_description,1,1996);
9593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9594 trace
9595 (p_msg => 'END of Description_94'
9596 ,p_level => C_LEVEL_PROCEDURE
9600 RETURN l_description;
9597 ,p_module => l_log_module);
9598
9599 END IF;
9601
9602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9603 trace
9604 (p_msg => 'END of Description_94'
9605 ,p_level => C_LEVEL_PROCEDURE
9606 ,p_module => l_log_module);
9607 END IF;
9608 RETURN NULL;
9609 EXCEPTION
9610 WHEN VALUE_ERROR THEN
9611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9612 trace
9613 (p_msg => 'ERROR: '||sqlerrm
9614 ,p_level => C_LEVEL_EXCEPTION
9615 ,p_module => l_log_module);
9616 END IF;
9617 RAISE;
9618 WHEN xla_exceptions_pkg.application_exception THEN
9619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9620 trace
9621 (p_msg => 'ERROR: '||sqlerrm
9622 ,p_level => C_LEVEL_EXCEPTION
9623 ,p_module => l_log_module);
9624 END IF;
9625 RAISE;
9626 WHEN OTHERS THEN
9627 xla_exceptions_pkg.raise_message
9628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_94');
9629 END Description_94;
9630
9631 ---------------------------------------
9632 --
9633 -- PRIVATE FUNCTION
9634 -- Description_95
9635 --
9636 ---------------------------------------
9637 FUNCTION Description_95 (
9638 p_application_id IN NUMBER
9639 , p_ae_header_id IN NUMBER DEFAULT NULL
9640 --Period Close Date
9641 , p_source_1 IN DATE
9642 )
9643 RETURN VARCHAR2
9644 IS
9645 l_component_type VARCHAR2(80) ;
9646 l_component_code VARCHAR2(30) ;
9647 l_component_type_code VARCHAR2(1) ;
9648 l_component_appl_id INTEGER ;
9649 l_amb_context_code VARCHAR2(30) ;
9650 l_ledger_language VARCHAR2(30) ;
9651 l_source VARCHAR2(1996) ;
9652 l_description VARCHAR2(2000) ;
9653 l_log_module VARCHAR2(240) ;
9654 BEGIN
9655 IF g_log_enabled THEN
9656 l_log_module := C_DEFAULT_MODULE||'.Description_95';
9657 END IF;
9658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9659 trace
9660 (p_msg => 'BEGIN of Description_95'
9661 ,p_level => C_LEVEL_PROCEDURE
9662 ,p_module => l_log_module);
9663 END IF;
9664
9665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
9666 l_component_type := 'AMB_DESCRIPTION';
9667 l_component_code := 'FA_REVAL_EXPENSE';
9668 l_component_type_code := 'S';
9669 l_component_appl_id := 140;
9670 l_amb_context_code := 'DEFAULT';
9671 l_source := NULL;
9672 l_description := NULL;
9673
9674
9675
9676 IF
9677 l_ledger_language = 'US' THEN
9678 l_description := SUBSTR(CONCAT(l_description,'Revaluation Expense'),1,2000);
9679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9680 END IF;
9681 IF
9682 l_ledger_language = 'US' THEN
9683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
9684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9685 END IF;
9686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
9687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
9688 IF l_source IS NOT NULL THEN
9689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
9690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9691 END IF;
9692 l_description := SUBSTR(l_description,1,1996);
9693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9694 trace
9695 (p_msg => 'END of Description_95'
9696 ,p_level => C_LEVEL_PROCEDURE
9697 ,p_module => l_log_module);
9698
9699 END IF;
9700 RETURN l_description;
9701
9702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9703 trace
9704 (p_msg => 'END of Description_95'
9705 ,p_level => C_LEVEL_PROCEDURE
9706 ,p_module => l_log_module);
9707 END IF;
9708 RETURN NULL;
9709 EXCEPTION
9710 WHEN VALUE_ERROR THEN
9711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9712 trace
9713 (p_msg => 'ERROR: '||sqlerrm
9714 ,p_level => C_LEVEL_EXCEPTION
9715 ,p_module => l_log_module);
9716 END IF;
9717 RAISE;
9718 WHEN xla_exceptions_pkg.application_exception THEN
9719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9720 trace
9721 (p_msg => 'ERROR: '||sqlerrm
9722 ,p_level => C_LEVEL_EXCEPTION
9723 ,p_module => l_log_module);
9724 END IF;
9725 RAISE;
9726 WHEN OTHERS THEN
9727 xla_exceptions_pkg.raise_message
9728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_95');
9729 END Description_95;
9730
9731 ---------------------------------------
9732 --
9733 -- PRIVATE FUNCTION
9734 -- Description_96
9735 --
9736 ---------------------------------------
9737 FUNCTION Description_96 (
9738 p_application_id IN NUMBER
9739 , p_ae_header_id IN NUMBER DEFAULT NULL
9740 --Period Close Date
9741 , p_source_1 IN DATE
9745 l_component_type VARCHAR2(80) ;
9742 )
9743 RETURN VARCHAR2
9744 IS
9746 l_component_code VARCHAR2(30) ;
9747 l_component_type_code VARCHAR2(1) ;
9748 l_component_appl_id INTEGER ;
9749 l_amb_context_code VARCHAR2(30) ;
9750 l_ledger_language VARCHAR2(30) ;
9751 l_source VARCHAR2(1996) ;
9752 l_description VARCHAR2(2000) ;
9753 l_log_module VARCHAR2(240) ;
9754 BEGIN
9755 IF g_log_enabled THEN
9756 l_log_module := C_DEFAULT_MODULE||'.Description_96';
9757 END IF;
9758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9759 trace
9760 (p_msg => 'BEGIN of Description_96'
9761 ,p_level => C_LEVEL_PROCEDURE
9762 ,p_module => l_log_module);
9763 END IF;
9764
9765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
9766 l_component_type := 'AMB_DESCRIPTION';
9767 l_component_code := 'FA_REVAL_RESERVE';
9768 l_component_type_code := 'S';
9769 l_component_appl_id := 140;
9770 l_amb_context_code := 'DEFAULT';
9771 l_source := NULL;
9772 l_description := NULL;
9773
9774
9775
9776 IF
9777 l_ledger_language = 'US' THEN
9778 l_description := SUBSTR(CONCAT(l_description,'Revaluation Reserve'),1,2000);
9779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9780 END IF;
9781 IF
9782 l_ledger_language = 'US' THEN
9783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
9784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9785 END IF;
9786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
9787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
9788 IF l_source IS NOT NULL THEN
9789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
9790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9791 END IF;
9792 l_description := SUBSTR(l_description,1,1996);
9793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9794 trace
9795 (p_msg => 'END of Description_96'
9796 ,p_level => C_LEVEL_PROCEDURE
9797 ,p_module => l_log_module);
9798
9799 END IF;
9800 RETURN l_description;
9801
9802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9803 trace
9804 (p_msg => 'END of Description_96'
9805 ,p_level => C_LEVEL_PROCEDURE
9806 ,p_module => l_log_module);
9807 END IF;
9808 RETURN NULL;
9809 EXCEPTION
9810 WHEN VALUE_ERROR THEN
9811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9812 trace
9813 (p_msg => 'ERROR: '||sqlerrm
9814 ,p_level => C_LEVEL_EXCEPTION
9815 ,p_module => l_log_module);
9816 END IF;
9817 RAISE;
9818 WHEN xla_exceptions_pkg.application_exception THEN
9819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9820 trace
9821 (p_msg => 'ERROR: '||sqlerrm
9822 ,p_level => C_LEVEL_EXCEPTION
9823 ,p_module => l_log_module);
9824 END IF;
9825 RAISE;
9826 WHEN OTHERS THEN
9827 xla_exceptions_pkg.raise_message
9828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_96');
9829 END Description_96;
9830
9831 ---------------------------------------
9832 --
9833 -- PRIVATE FUNCTION
9834 -- Description_97
9835 --
9836 ---------------------------------------
9837 FUNCTION Description_97 (
9838 p_application_id IN NUMBER
9839 , p_ae_header_id IN NUMBER DEFAULT NULL
9840 --Period Close Date
9841 , p_source_1 IN DATE
9842 )
9843 RETURN VARCHAR2
9844 IS
9845 l_component_type VARCHAR2(80) ;
9846 l_component_code VARCHAR2(30) ;
9847 l_component_type_code VARCHAR2(1) ;
9848 l_component_appl_id INTEGER ;
9849 l_amb_context_code VARCHAR2(30) ;
9850 l_ledger_language VARCHAR2(30) ;
9851 l_source VARCHAR2(1996) ;
9852 l_description VARCHAR2(2000) ;
9853 l_log_module VARCHAR2(240) ;
9854 BEGIN
9855 IF g_log_enabled THEN
9856 l_log_module := C_DEFAULT_MODULE||'.Description_97';
9857 END IF;
9858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9859 trace
9860 (p_msg => 'BEGIN of Description_97'
9861 ,p_level => C_LEVEL_PROCEDURE
9862 ,p_module => l_log_module);
9863 END IF;
9864
9865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
9866 l_component_type := 'AMB_DESCRIPTION';
9867 l_component_code := 'FA_REV_ASSET_BONUS_EXPENSE';
9868 l_component_type_code := 'S';
9869 l_component_appl_id := 140;
9870 l_amb_context_code := 'DEFAULT';
9871 l_source := NULL;
9872 l_description := NULL;
9873
9874
9875
9876 IF
9877 l_ledger_language = 'US' THEN
9878 l_description := SUBSTR(CONCAT(l_description,'Assets Reverse Capitalization Bonus Expense'),1,2000);
9879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9880 END IF;
9881 IF
9882 l_ledger_language = 'US' THEN
9883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
9884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9885 END IF;
9889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
9886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
9887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
9888 IF l_source IS NOT NULL THEN
9890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9891 END IF;
9892 l_description := SUBSTR(l_description,1,1996);
9893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9894 trace
9895 (p_msg => 'END of Description_97'
9896 ,p_level => C_LEVEL_PROCEDURE
9897 ,p_module => l_log_module);
9898
9899 END IF;
9900 RETURN l_description;
9901
9902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9903 trace
9904 (p_msg => 'END of Description_97'
9905 ,p_level => C_LEVEL_PROCEDURE
9906 ,p_module => l_log_module);
9907 END IF;
9908 RETURN NULL;
9909 EXCEPTION
9910 WHEN VALUE_ERROR THEN
9911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9912 trace
9913 (p_msg => 'ERROR: '||sqlerrm
9914 ,p_level => C_LEVEL_EXCEPTION
9915 ,p_module => l_log_module);
9916 END IF;
9917 RAISE;
9918 WHEN xla_exceptions_pkg.application_exception THEN
9919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
9920 trace
9921 (p_msg => 'ERROR: '||sqlerrm
9922 ,p_level => C_LEVEL_EXCEPTION
9923 ,p_module => l_log_module);
9924 END IF;
9925 RAISE;
9926 WHEN OTHERS THEN
9927 xla_exceptions_pkg.raise_message
9928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_97');
9929 END Description_97;
9930
9931 ---------------------------------------
9932 --
9933 -- PRIVATE FUNCTION
9934 -- Description_98
9935 --
9936 ---------------------------------------
9937 FUNCTION Description_98 (
9938 p_application_id IN NUMBER
9939 , p_ae_header_id IN NUMBER DEFAULT NULL
9940 --Period Close Date
9941 , p_source_1 IN DATE
9942 )
9943 RETURN VARCHAR2
9944 IS
9945 l_component_type VARCHAR2(80) ;
9946 l_component_code VARCHAR2(30) ;
9947 l_component_type_code VARCHAR2(1) ;
9948 l_component_appl_id INTEGER ;
9949 l_amb_context_code VARCHAR2(30) ;
9950 l_ledger_language VARCHAR2(30) ;
9951 l_source VARCHAR2(1996) ;
9952 l_description VARCHAR2(2000) ;
9953 l_log_module VARCHAR2(240) ;
9954 BEGIN
9955 IF g_log_enabled THEN
9956 l_log_module := C_DEFAULT_MODULE||'.Description_98';
9957 END IF;
9958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9959 trace
9960 (p_msg => 'BEGIN of Description_98'
9961 ,p_level => C_LEVEL_PROCEDURE
9962 ,p_module => l_log_module);
9963 END IF;
9964
9965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
9966 l_component_type := 'AMB_DESCRIPTION';
9967 l_component_code := 'FA_REV_ASSET_BONUS_RESERVE';
9968 l_component_type_code := 'S';
9969 l_component_appl_id := 140;
9970 l_amb_context_code := 'DEFAULT';
9971 l_source := NULL;
9972 l_description := NULL;
9973
9974
9975
9976 IF
9977 l_ledger_language = 'US' THEN
9978 l_description := SUBSTR(CONCAT(l_description,'Assets Reverse Capitalization Bonus Reserve'),1,2000);
9979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9980 END IF;
9981 IF
9982 l_ledger_language = 'US' THEN
9983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
9984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9985 END IF;
9986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
9987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
9988 IF l_source IS NOT NULL THEN
9989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
9990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
9991 END IF;
9992 l_description := SUBSTR(l_description,1,1996);
9993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
9994 trace
9995 (p_msg => 'END of Description_98'
9996 ,p_level => C_LEVEL_PROCEDURE
9997 ,p_module => l_log_module);
9998
9999 END IF;
10000 RETURN l_description;
10001
10002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10003 trace
10004 (p_msg => 'END of Description_98'
10005 ,p_level => C_LEVEL_PROCEDURE
10006 ,p_module => l_log_module);
10007 END IF;
10008 RETURN NULL;
10009 EXCEPTION
10010 WHEN VALUE_ERROR THEN
10011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10012 trace
10013 (p_msg => 'ERROR: '||sqlerrm
10014 ,p_level => C_LEVEL_EXCEPTION
10015 ,p_module => l_log_module);
10016 END IF;
10017 RAISE;
10018 WHEN xla_exceptions_pkg.application_exception THEN
10019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10020 trace
10021 (p_msg => 'ERROR: '||sqlerrm
10022 ,p_level => C_LEVEL_EXCEPTION
10023 ,p_module => l_log_module);
10027 xla_exceptions_pkg.raise_message
10024 END IF;
10025 RAISE;
10026 WHEN OTHERS THEN
10028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_98');
10029 END Description_98;
10030
10031 ---------------------------------------
10032 --
10033 -- PRIVATE FUNCTION
10034 -- Description_99
10035 --
10036 ---------------------------------------
10037 FUNCTION Description_99 (
10038 p_application_id IN NUMBER
10039 , p_ae_header_id IN NUMBER DEFAULT NULL
10040 --Period Close Date
10041 , p_source_1 IN DATE
10042 )
10043 RETURN VARCHAR2
10044 IS
10045 l_component_type VARCHAR2(80) ;
10046 l_component_code VARCHAR2(30) ;
10047 l_component_type_code VARCHAR2(1) ;
10048 l_component_appl_id INTEGER ;
10049 l_amb_context_code VARCHAR2(30) ;
10050 l_ledger_language VARCHAR2(30) ;
10051 l_source VARCHAR2(1996) ;
10052 l_description VARCHAR2(2000) ;
10053 l_log_module VARCHAR2(240) ;
10054 BEGIN
10055 IF g_log_enabled THEN
10056 l_log_module := C_DEFAULT_MODULE||'.Description_99';
10057 END IF;
10058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10059 trace
10060 (p_msg => 'BEGIN of Description_99'
10061 ,p_level => C_LEVEL_PROCEDURE
10062 ,p_module => l_log_module);
10063 END IF;
10064
10065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
10066 l_component_type := 'AMB_DESCRIPTION';
10067 l_component_code := 'FA_REV_ASSET_CIP_COST';
10068 l_component_type_code := 'S';
10069 l_component_appl_id := 140;
10070 l_amb_context_code := 'DEFAULT';
10071 l_source := NULL;
10072 l_description := NULL;
10073
10074
10075
10076 IF
10077 l_ledger_language = 'US' THEN
10078 l_description := SUBSTR(CONCAT(l_description,'Assets Reverse Capitalization CIP Cost'),1,2000);
10079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10080 END IF;
10081 IF
10082 l_ledger_language = 'US' THEN
10083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
10084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10085 END IF;
10086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
10087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
10088 IF l_source IS NOT NULL THEN
10089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
10090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10091 END IF;
10092 l_description := SUBSTR(l_description,1,1996);
10093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10094 trace
10095 (p_msg => 'END of Description_99'
10096 ,p_level => C_LEVEL_PROCEDURE
10097 ,p_module => l_log_module);
10098
10099 END IF;
10100 RETURN l_description;
10101
10102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10103 trace
10104 (p_msg => 'END of Description_99'
10105 ,p_level => C_LEVEL_PROCEDURE
10106 ,p_module => l_log_module);
10107 END IF;
10108 RETURN NULL;
10109 EXCEPTION
10110 WHEN VALUE_ERROR THEN
10111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10112 trace
10113 (p_msg => 'ERROR: '||sqlerrm
10114 ,p_level => C_LEVEL_EXCEPTION
10115 ,p_module => l_log_module);
10116 END IF;
10117 RAISE;
10118 WHEN xla_exceptions_pkg.application_exception THEN
10119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10120 trace
10121 (p_msg => 'ERROR: '||sqlerrm
10122 ,p_level => C_LEVEL_EXCEPTION
10123 ,p_module => l_log_module);
10124 END IF;
10125 RAISE;
10126 WHEN OTHERS THEN
10127 xla_exceptions_pkg.raise_message
10128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_99');
10129 END Description_99;
10130
10131 ---------------------------------------
10132 --
10133 -- PRIVATE FUNCTION
10134 -- Description_100
10135 --
10136 ---------------------------------------
10137 FUNCTION Description_100 (
10138 p_application_id IN NUMBER
10139 , p_ae_header_id IN NUMBER DEFAULT NULL
10140 --Period Close Date
10141 , p_source_1 IN DATE
10142 )
10143 RETURN VARCHAR2
10144 IS
10145 l_component_type VARCHAR2(80) ;
10146 l_component_code VARCHAR2(30) ;
10147 l_component_type_code VARCHAR2(1) ;
10148 l_component_appl_id INTEGER ;
10149 l_amb_context_code VARCHAR2(30) ;
10150 l_ledger_language VARCHAR2(30) ;
10151 l_source VARCHAR2(1996) ;
10152 l_description VARCHAR2(2000) ;
10153 l_log_module VARCHAR2(240) ;
10154 BEGIN
10155 IF g_log_enabled THEN
10156 l_log_module := C_DEFAULT_MODULE||'.Description_100';
10157 END IF;
10158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10159 trace
10160 (p_msg => 'BEGIN of Description_100'
10161 ,p_level => C_LEVEL_PROCEDURE
10162 ,p_module => l_log_module);
10163 END IF;
10164
10165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
10169 l_component_appl_id := 140;
10166 l_component_type := 'AMB_DESCRIPTION';
10167 l_component_code := 'FA_REV_ASSET_COST';
10168 l_component_type_code := 'S';
10170 l_amb_context_code := 'DEFAULT';
10171 l_source := NULL;
10172 l_description := NULL;
10173
10174
10175
10176 IF
10177 l_ledger_language = 'US' THEN
10178 l_description := SUBSTR(CONCAT(l_description,'Assets Reverse Capitalization Cost'),1,2000);
10179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10180 END IF;
10181 IF
10182 l_ledger_language = 'US' THEN
10183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
10184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10185 END IF;
10186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
10187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
10188 IF l_source IS NOT NULL THEN
10189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
10190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10191 END IF;
10192 l_description := SUBSTR(l_description,1,1996);
10193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10194 trace
10195 (p_msg => 'END of Description_100'
10196 ,p_level => C_LEVEL_PROCEDURE
10197 ,p_module => l_log_module);
10198
10199 END IF;
10200 RETURN l_description;
10201
10202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10203 trace
10204 (p_msg => 'END of Description_100'
10205 ,p_level => C_LEVEL_PROCEDURE
10206 ,p_module => l_log_module);
10207 END IF;
10208 RETURN NULL;
10209 EXCEPTION
10210 WHEN VALUE_ERROR THEN
10211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10212 trace
10213 (p_msg => 'ERROR: '||sqlerrm
10214 ,p_level => C_LEVEL_EXCEPTION
10215 ,p_module => l_log_module);
10216 END IF;
10217 RAISE;
10218 WHEN xla_exceptions_pkg.application_exception THEN
10219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10220 trace
10221 (p_msg => 'ERROR: '||sqlerrm
10222 ,p_level => C_LEVEL_EXCEPTION
10223 ,p_module => l_log_module);
10224 END IF;
10225 RAISE;
10226 WHEN OTHERS THEN
10227 xla_exceptions_pkg.raise_message
10228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_100');
10229 END Description_100;
10230
10231 ---------------------------------------
10232 --
10233 -- PRIVATE FUNCTION
10234 -- Description_101
10235 --
10236 ---------------------------------------
10237 FUNCTION Description_101 (
10238 p_application_id IN NUMBER
10239 , p_ae_header_id IN NUMBER DEFAULT NULL
10240 --Period Close Date
10241 , p_source_1 IN DATE
10242 )
10243 RETURN VARCHAR2
10244 IS
10245 l_component_type VARCHAR2(80) ;
10246 l_component_code VARCHAR2(30) ;
10247 l_component_type_code VARCHAR2(1) ;
10248 l_component_appl_id INTEGER ;
10249 l_amb_context_code VARCHAR2(30) ;
10250 l_ledger_language VARCHAR2(30) ;
10251 l_source VARCHAR2(1996) ;
10252 l_description VARCHAR2(2000) ;
10253 l_log_module VARCHAR2(240) ;
10254 BEGIN
10255 IF g_log_enabled THEN
10256 l_log_module := C_DEFAULT_MODULE||'.Description_101';
10257 END IF;
10258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10259 trace
10260 (p_msg => 'BEGIN of Description_101'
10261 ,p_level => C_LEVEL_PROCEDURE
10262 ,p_module => l_log_module);
10263 END IF;
10264
10265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
10266 l_component_type := 'AMB_DESCRIPTION';
10267 l_component_code := 'FA_REV_ASSET_EXPENSE';
10268 l_component_type_code := 'S';
10269 l_component_appl_id := 140;
10270 l_amb_context_code := 'DEFAULT';
10271 l_source := NULL;
10272 l_description := NULL;
10273
10274
10275
10276 IF
10277 l_ledger_language = 'US' THEN
10278 l_description := SUBSTR(CONCAT(l_description,'Assets Reverse Capitalization Expense'),1,2000);
10279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10280 END IF;
10281 IF
10282 l_ledger_language = 'US' THEN
10283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
10284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10285 END IF;
10286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
10287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
10288 IF l_source IS NOT NULL THEN
10289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
10290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10291 END IF;
10292 l_description := SUBSTR(l_description,1,1996);
10293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10294 trace
10295 (p_msg => 'END of Description_101'
10296 ,p_level => C_LEVEL_PROCEDURE
10297 ,p_module => l_log_module);
10298
10299 END IF;
10300 RETURN l_description;
10301
10302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10303 trace
10307 END IF;
10304 (p_msg => 'END of Description_101'
10305 ,p_level => C_LEVEL_PROCEDURE
10306 ,p_module => l_log_module);
10308 RETURN NULL;
10309 EXCEPTION
10310 WHEN VALUE_ERROR THEN
10311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10312 trace
10313 (p_msg => 'ERROR: '||sqlerrm
10314 ,p_level => C_LEVEL_EXCEPTION
10315 ,p_module => l_log_module);
10316 END IF;
10317 RAISE;
10318 WHEN xla_exceptions_pkg.application_exception THEN
10319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10320 trace
10321 (p_msg => 'ERROR: '||sqlerrm
10322 ,p_level => C_LEVEL_EXCEPTION
10323 ,p_module => l_log_module);
10324 END IF;
10325 RAISE;
10326 WHEN OTHERS THEN
10327 xla_exceptions_pkg.raise_message
10328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_101');
10329 END Description_101;
10330
10331 ---------------------------------------
10332 --
10333 -- PRIVATE FUNCTION
10334 -- Description_102
10335 --
10336 ---------------------------------------
10337 FUNCTION Description_102 (
10338 p_application_id IN NUMBER
10339 , p_ae_header_id IN NUMBER DEFAULT NULL
10340 --Period Close Date
10341 , p_source_1 IN DATE
10342 )
10343 RETURN VARCHAR2
10344 IS
10345 l_component_type VARCHAR2(80) ;
10346 l_component_code VARCHAR2(30) ;
10347 l_component_type_code VARCHAR2(1) ;
10348 l_component_appl_id INTEGER ;
10349 l_amb_context_code VARCHAR2(30) ;
10350 l_ledger_language VARCHAR2(30) ;
10351 l_source VARCHAR2(1996) ;
10352 l_description VARCHAR2(2000) ;
10353 l_log_module VARCHAR2(240) ;
10354 BEGIN
10355 IF g_log_enabled THEN
10356 l_log_module := C_DEFAULT_MODULE||'.Description_102';
10357 END IF;
10358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10359 trace
10360 (p_msg => 'BEGIN of Description_102'
10361 ,p_level => C_LEVEL_PROCEDURE
10362 ,p_module => l_log_module);
10363 END IF;
10364
10365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
10366 l_component_type := 'AMB_DESCRIPTION';
10367 l_component_code := 'FA_REV_ASSET_RESERVE';
10368 l_component_type_code := 'S';
10369 l_component_appl_id := 140;
10370 l_amb_context_code := 'DEFAULT';
10371 l_source := NULL;
10372 l_description := NULL;
10373
10374
10375
10376 IF
10377 l_ledger_language = 'US' THEN
10378 l_description := SUBSTR(CONCAT(l_description,'Assets Reverse Capitalization Reserve'),1,2000);
10379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10380 END IF;
10381 IF
10382 l_ledger_language = 'US' THEN
10383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
10384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10385 END IF;
10386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
10387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
10388 IF l_source IS NOT NULL THEN
10389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
10390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10391 END IF;
10392 l_description := SUBSTR(l_description,1,1996);
10393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10394 trace
10395 (p_msg => 'END of Description_102'
10396 ,p_level => C_LEVEL_PROCEDURE
10397 ,p_module => l_log_module);
10398
10399 END IF;
10400 RETURN l_description;
10401
10402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10403 trace
10404 (p_msg => 'END of Description_102'
10405 ,p_level => C_LEVEL_PROCEDURE
10406 ,p_module => l_log_module);
10407 END IF;
10408 RETURN NULL;
10409 EXCEPTION
10410 WHEN VALUE_ERROR THEN
10411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10412 trace
10413 (p_msg => 'ERROR: '||sqlerrm
10414 ,p_level => C_LEVEL_EXCEPTION
10415 ,p_module => l_log_module);
10416 END IF;
10417 RAISE;
10418 WHEN xla_exceptions_pkg.application_exception THEN
10419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10420 trace
10421 (p_msg => 'ERROR: '||sqlerrm
10422 ,p_level => C_LEVEL_EXCEPTION
10423 ,p_module => l_log_module);
10424 END IF;
10425 RAISE;
10426 WHEN OTHERS THEN
10427 xla_exceptions_pkg.raise_message
10428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_102');
10429 END Description_102;
10430
10431 ---------------------------------------
10432 --
10433 -- PRIVATE FUNCTION
10434 -- Description_103
10435 --
10436 ---------------------------------------
10437 FUNCTION Description_103 (
10438 p_application_id IN NUMBER
10439 , p_ae_header_id IN NUMBER DEFAULT NULL
10440 --Period Close Date
10441 , p_source_1 IN DATE
10442 )
10443 RETURN VARCHAR2
10444 IS
10445 l_component_type VARCHAR2(80) ;
10449 l_amb_context_code VARCHAR2(30) ;
10446 l_component_code VARCHAR2(30) ;
10447 l_component_type_code VARCHAR2(1) ;
10448 l_component_appl_id INTEGER ;
10450 l_ledger_language VARCHAR2(30) ;
10451 l_source VARCHAR2(1996) ;
10452 l_description VARCHAR2(2000) ;
10453 l_log_module VARCHAR2(240) ;
10454 BEGIN
10455 IF g_log_enabled THEN
10456 l_log_module := C_DEFAULT_MODULE||'.Description_103';
10457 END IF;
10458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10459 trace
10460 (p_msg => 'BEGIN of Description_103'
10461 ,p_level => C_LEVEL_PROCEDURE
10462 ,p_module => l_log_module);
10463 END IF;
10464
10465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
10466 l_component_type := 'AMB_DESCRIPTION';
10467 l_component_code := 'FA_SLT_BONUS_EXP';
10468 l_component_type_code := 'S';
10469 l_component_appl_id := 140;
10470 l_amb_context_code := 'DEFAULT';
10471 l_source := NULL;
10472 l_description := NULL;
10473
10474
10475
10476 IF
10477 l_ledger_language = 'US' THEN
10478 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer Bonus Expense'),1,2000);
10479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10480 END IF;
10481 IF
10482 l_ledger_language = 'US' THEN
10483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
10484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10485 END IF;
10486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
10487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
10488 IF l_source IS NOT NULL THEN
10489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
10490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10491 END IF;
10492 l_description := SUBSTR(l_description,1,1996);
10493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10494 trace
10495 (p_msg => 'END of Description_103'
10496 ,p_level => C_LEVEL_PROCEDURE
10497 ,p_module => l_log_module);
10498
10499 END IF;
10500 RETURN l_description;
10501
10502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10503 trace
10504 (p_msg => 'END of Description_103'
10505 ,p_level => C_LEVEL_PROCEDURE
10506 ,p_module => l_log_module);
10507 END IF;
10508 RETURN NULL;
10509 EXCEPTION
10510 WHEN VALUE_ERROR THEN
10511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10512 trace
10513 (p_msg => 'ERROR: '||sqlerrm
10514 ,p_level => C_LEVEL_EXCEPTION
10515 ,p_module => l_log_module);
10516 END IF;
10517 RAISE;
10518 WHEN xla_exceptions_pkg.application_exception THEN
10519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10520 trace
10521 (p_msg => 'ERROR: '||sqlerrm
10522 ,p_level => C_LEVEL_EXCEPTION
10523 ,p_module => l_log_module);
10524 END IF;
10525 RAISE;
10526 WHEN OTHERS THEN
10527 xla_exceptions_pkg.raise_message
10528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_103');
10529 END Description_103;
10530
10531 ---------------------------------------
10532 --
10533 -- PRIVATE FUNCTION
10534 -- Description_104
10535 --
10536 ---------------------------------------
10537 FUNCTION Description_104 (
10538 p_application_id IN NUMBER
10539 , p_ae_header_id IN NUMBER DEFAULT NULL
10540 --Period Close Date
10541 , p_source_1 IN DATE
10542 )
10543 RETURN VARCHAR2
10544 IS
10545 l_component_type VARCHAR2(80) ;
10546 l_component_code VARCHAR2(30) ;
10547 l_component_type_code VARCHAR2(1) ;
10548 l_component_appl_id INTEGER ;
10549 l_amb_context_code VARCHAR2(30) ;
10550 l_ledger_language VARCHAR2(30) ;
10551 l_source VARCHAR2(1996) ;
10552 l_description VARCHAR2(2000) ;
10553 l_log_module VARCHAR2(240) ;
10554 BEGIN
10555 IF g_log_enabled THEN
10556 l_log_module := C_DEFAULT_MODULE||'.Description_104';
10557 END IF;
10558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10559 trace
10560 (p_msg => 'BEGIN of Description_104'
10561 ,p_level => C_LEVEL_PROCEDURE
10562 ,p_module => l_log_module);
10563 END IF;
10564
10565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
10566 l_component_type := 'AMB_DESCRIPTION';
10567 l_component_code := 'FA_SLT_BONUS_RESERVE';
10568 l_component_type_code := 'S';
10569 l_component_appl_id := 140;
10570 l_amb_context_code := 'DEFAULT';
10571 l_source := NULL;
10572 l_description := NULL;
10573
10574
10575
10576 IF
10577 l_ledger_language = 'US' THEN
10578 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer Bonus Reserve'),1,2000);
10579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10580 END IF;
10581 IF
10582 l_ledger_language = 'US' THEN
10586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
10583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
10584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10585 END IF;
10587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
10588 IF l_source IS NOT NULL THEN
10589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
10590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10591 END IF;
10592 l_description := SUBSTR(l_description,1,1996);
10593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10594 trace
10595 (p_msg => 'END of Description_104'
10596 ,p_level => C_LEVEL_PROCEDURE
10597 ,p_module => l_log_module);
10598
10599 END IF;
10600 RETURN l_description;
10601
10602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10603 trace
10604 (p_msg => 'END of Description_104'
10605 ,p_level => C_LEVEL_PROCEDURE
10606 ,p_module => l_log_module);
10607 END IF;
10608 RETURN NULL;
10609 EXCEPTION
10610 WHEN VALUE_ERROR THEN
10611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10612 trace
10613 (p_msg => 'ERROR: '||sqlerrm
10614 ,p_level => C_LEVEL_EXCEPTION
10615 ,p_module => l_log_module);
10616 END IF;
10617 RAISE;
10618 WHEN xla_exceptions_pkg.application_exception THEN
10619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10620 trace
10621 (p_msg => 'ERROR: '||sqlerrm
10622 ,p_level => C_LEVEL_EXCEPTION
10623 ,p_module => l_log_module);
10624 END IF;
10625 RAISE;
10626 WHEN OTHERS THEN
10627 xla_exceptions_pkg.raise_message
10628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_104');
10629 END Description_104;
10630
10631 ---------------------------------------
10632 --
10633 -- PRIVATE FUNCTION
10634 -- Description_105
10635 --
10636 ---------------------------------------
10637 FUNCTION Description_105 (
10638 p_application_id IN NUMBER
10639 , p_ae_header_id IN NUMBER DEFAULT NULL
10640 --Period Close Date
10641 , p_source_1 IN DATE
10642 )
10643 RETURN VARCHAR2
10644 IS
10645 l_component_type VARCHAR2(80) ;
10646 l_component_code VARCHAR2(30) ;
10647 l_component_type_code VARCHAR2(1) ;
10648 l_component_appl_id INTEGER ;
10649 l_amb_context_code VARCHAR2(30) ;
10650 l_ledger_language VARCHAR2(30) ;
10651 l_source VARCHAR2(1996) ;
10652 l_description VARCHAR2(2000) ;
10653 l_log_module VARCHAR2(240) ;
10654 BEGIN
10655 IF g_log_enabled THEN
10656 l_log_module := C_DEFAULT_MODULE||'.Description_105';
10657 END IF;
10658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10659 trace
10660 (p_msg => 'BEGIN of Description_105'
10661 ,p_level => C_LEVEL_PROCEDURE
10662 ,p_module => l_log_module);
10663 END IF;
10664
10665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
10666 l_component_type := 'AMB_DESCRIPTION';
10667 l_component_code := 'FA_SLT_CIP_COST';
10668 l_component_type_code := 'S';
10669 l_component_appl_id := 140;
10670 l_amb_context_code := 'DEFAULT';
10671 l_source := NULL;
10672 l_description := NULL;
10673
10674
10675
10676 IF
10677 l_ledger_language = 'US' THEN
10678 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer CIP Cost'),1,2000);
10679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10680 END IF;
10681 IF
10682 l_ledger_language = 'US' THEN
10683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
10684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10685 END IF;
10686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
10687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
10688 IF l_source IS NOT NULL THEN
10689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
10690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10691 END IF;
10692 l_description := SUBSTR(l_description,1,1996);
10693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10694 trace
10695 (p_msg => 'END of Description_105'
10696 ,p_level => C_LEVEL_PROCEDURE
10697 ,p_module => l_log_module);
10698
10699 END IF;
10700 RETURN l_description;
10701
10702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10703 trace
10704 (p_msg => 'END of Description_105'
10705 ,p_level => C_LEVEL_PROCEDURE
10706 ,p_module => l_log_module);
10707 END IF;
10708 RETURN NULL;
10709 EXCEPTION
10710 WHEN VALUE_ERROR THEN
10711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10712 trace
10713 (p_msg => 'ERROR: '||sqlerrm
10714 ,p_level => C_LEVEL_EXCEPTION
10715 ,p_module => l_log_module);
10716 END IF;
10717 RAISE;
10718 WHEN xla_exceptions_pkg.application_exception THEN
10722 ,p_level => C_LEVEL_EXCEPTION
10719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10720 trace
10721 (p_msg => 'ERROR: '||sqlerrm
10723 ,p_module => l_log_module);
10724 END IF;
10725 RAISE;
10726 WHEN OTHERS THEN
10727 xla_exceptions_pkg.raise_message
10728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_105');
10729 END Description_105;
10730
10731 ---------------------------------------
10732 --
10733 -- PRIVATE FUNCTION
10734 -- Description_106
10735 --
10736 ---------------------------------------
10737 FUNCTION Description_106 (
10738 p_application_id IN NUMBER
10739 , p_ae_header_id IN NUMBER DEFAULT NULL
10740 --Period Close Date
10741 , p_source_1 IN DATE
10742 )
10743 RETURN VARCHAR2
10744 IS
10745 l_component_type VARCHAR2(80) ;
10746 l_component_code VARCHAR2(30) ;
10747 l_component_type_code VARCHAR2(1) ;
10748 l_component_appl_id INTEGER ;
10749 l_amb_context_code VARCHAR2(30) ;
10750 l_ledger_language VARCHAR2(30) ;
10751 l_source VARCHAR2(1996) ;
10752 l_description VARCHAR2(2000) ;
10753 l_log_module VARCHAR2(240) ;
10754 BEGIN
10755 IF g_log_enabled THEN
10756 l_log_module := C_DEFAULT_MODULE||'.Description_106';
10757 END IF;
10758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10759 trace
10760 (p_msg => 'BEGIN of Description_106'
10761 ,p_level => C_LEVEL_PROCEDURE
10762 ,p_module => l_log_module);
10763 END IF;
10764
10765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
10766 l_component_type := 'AMB_DESCRIPTION';
10767 l_component_code := 'FA_SLT_CIP_COST_CLR';
10768 l_component_type_code := 'S';
10769 l_component_appl_id := 140;
10770 l_amb_context_code := 'DEFAULT';
10771 l_source := NULL;
10772 l_description := NULL;
10773
10774
10775
10776 IF
10777 l_ledger_language = 'US' THEN
10778 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer CIP Cost Clearing'),1,2000);
10779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10780 END IF;
10781 IF
10782 l_ledger_language = 'US' THEN
10783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
10784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10785 END IF;
10786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
10787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
10788 IF l_source IS NOT NULL THEN
10789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
10790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10791 END IF;
10792 l_description := SUBSTR(l_description,1,1996);
10793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10794 trace
10795 (p_msg => 'END of Description_106'
10796 ,p_level => C_LEVEL_PROCEDURE
10797 ,p_module => l_log_module);
10798
10799 END IF;
10800 RETURN l_description;
10801
10802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10803 trace
10804 (p_msg => 'END of Description_106'
10805 ,p_level => C_LEVEL_PROCEDURE
10806 ,p_module => l_log_module);
10807 END IF;
10808 RETURN NULL;
10809 EXCEPTION
10810 WHEN VALUE_ERROR THEN
10811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10812 trace
10813 (p_msg => 'ERROR: '||sqlerrm
10814 ,p_level => C_LEVEL_EXCEPTION
10815 ,p_module => l_log_module);
10816 END IF;
10817 RAISE;
10818 WHEN xla_exceptions_pkg.application_exception THEN
10819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10820 trace
10821 (p_msg => 'ERROR: '||sqlerrm
10822 ,p_level => C_LEVEL_EXCEPTION
10823 ,p_module => l_log_module);
10824 END IF;
10825 RAISE;
10826 WHEN OTHERS THEN
10827 xla_exceptions_pkg.raise_message
10828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_106');
10829 END Description_106;
10830
10831 ---------------------------------------
10832 --
10833 -- PRIVATE FUNCTION
10834 -- Description_107
10835 --
10836 ---------------------------------------
10837 FUNCTION Description_107 (
10838 p_application_id IN NUMBER
10839 , p_ae_header_id IN NUMBER DEFAULT NULL
10840 --Period Close Date
10841 , p_source_1 IN DATE
10842 )
10843 RETURN VARCHAR2
10844 IS
10845 l_component_type VARCHAR2(80) ;
10846 l_component_code VARCHAR2(30) ;
10847 l_component_type_code VARCHAR2(1) ;
10848 l_component_appl_id INTEGER ;
10849 l_amb_context_code VARCHAR2(30) ;
10850 l_ledger_language VARCHAR2(30) ;
10851 l_source VARCHAR2(1996) ;
10852 l_description VARCHAR2(2000) ;
10853 l_log_module VARCHAR2(240) ;
10854 BEGIN
10855 IF g_log_enabled THEN
10856 l_log_module := C_DEFAULT_MODULE||'.Description_107';
10857 END IF;
10858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10862 ,p_module => l_log_module);
10859 trace
10860 (p_msg => 'BEGIN of Description_107'
10861 ,p_level => C_LEVEL_PROCEDURE
10863 END IF;
10864
10865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
10866 l_component_type := 'AMB_DESCRIPTION';
10867 l_component_code := 'FA_SLT_CIP_IC_PAY';
10868 l_component_type_code := 'S';
10869 l_component_appl_id := 140;
10870 l_amb_context_code := 'DEFAULT';
10871 l_source := NULL;
10872 l_description := NULL;
10873
10874
10875
10876 IF
10877 l_ledger_language = 'US' THEN
10878 l_description := SUBSTR(CONCAT(l_description,'CIP Source Line Transfer Intercompany Payable'),1,2000);
10879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10880 END IF;
10881 IF
10882 l_ledger_language = 'US' THEN
10883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
10884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10885 END IF;
10886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
10887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
10888 IF l_source IS NOT NULL THEN
10889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
10890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10891 END IF;
10892 l_description := SUBSTR(l_description,1,1996);
10893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10894 trace
10895 (p_msg => 'END of Description_107'
10896 ,p_level => C_LEVEL_PROCEDURE
10897 ,p_module => l_log_module);
10898
10899 END IF;
10900 RETURN l_description;
10901
10902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10903 trace
10904 (p_msg => 'END of Description_107'
10905 ,p_level => C_LEVEL_PROCEDURE
10906 ,p_module => l_log_module);
10907 END IF;
10908 RETURN NULL;
10909 EXCEPTION
10910 WHEN VALUE_ERROR THEN
10911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10912 trace
10913 (p_msg => 'ERROR: '||sqlerrm
10914 ,p_level => C_LEVEL_EXCEPTION
10915 ,p_module => l_log_module);
10916 END IF;
10917 RAISE;
10918 WHEN xla_exceptions_pkg.application_exception THEN
10919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
10920 trace
10921 (p_msg => 'ERROR: '||sqlerrm
10922 ,p_level => C_LEVEL_EXCEPTION
10923 ,p_module => l_log_module);
10924 END IF;
10925 RAISE;
10926 WHEN OTHERS THEN
10927 xla_exceptions_pkg.raise_message
10928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_107');
10929 END Description_107;
10930
10931 ---------------------------------------
10932 --
10933 -- PRIVATE FUNCTION
10934 -- Description_108
10935 --
10936 ---------------------------------------
10937 FUNCTION Description_108 (
10938 p_application_id IN NUMBER
10939 , p_ae_header_id IN NUMBER DEFAULT NULL
10940 --Period Close Date
10941 , p_source_1 IN DATE
10942 )
10943 RETURN VARCHAR2
10944 IS
10945 l_component_type VARCHAR2(80) ;
10946 l_component_code VARCHAR2(30) ;
10947 l_component_type_code VARCHAR2(1) ;
10948 l_component_appl_id INTEGER ;
10949 l_amb_context_code VARCHAR2(30) ;
10950 l_ledger_language VARCHAR2(30) ;
10951 l_source VARCHAR2(1996) ;
10952 l_description VARCHAR2(2000) ;
10953 l_log_module VARCHAR2(240) ;
10954 BEGIN
10955 IF g_log_enabled THEN
10956 l_log_module := C_DEFAULT_MODULE||'.Description_108';
10957 END IF;
10958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10959 trace
10960 (p_msg => 'BEGIN of Description_108'
10961 ,p_level => C_LEVEL_PROCEDURE
10962 ,p_module => l_log_module);
10963 END IF;
10964
10965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
10966 l_component_type := 'AMB_DESCRIPTION';
10967 l_component_code := 'FA_SLT_CIP_IC_REC';
10968 l_component_type_code := 'S';
10969 l_component_appl_id := 140;
10970 l_amb_context_code := 'DEFAULT';
10971 l_source := NULL;
10972 l_description := NULL;
10973
10974
10975
10976 IF
10977 l_ledger_language = 'US' THEN
10978 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer CIP Intercompany Receivable'),1,2000);
10979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10980 END IF;
10981 IF
10982 l_ledger_language = 'US' THEN
10983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
10984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10985 END IF;
10986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
10987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
10988 IF l_source IS NOT NULL THEN
10989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
10990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
10991 END IF;
10992 l_description := SUBSTR(l_description,1,1996);
10993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
10994 trace
10998
10995 (p_msg => 'END of Description_108'
10996 ,p_level => C_LEVEL_PROCEDURE
10997 ,p_module => l_log_module);
10999 END IF;
11000 RETURN l_description;
11001
11002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11003 trace
11004 (p_msg => 'END of Description_108'
11005 ,p_level => C_LEVEL_PROCEDURE
11006 ,p_module => l_log_module);
11007 END IF;
11008 RETURN NULL;
11009 EXCEPTION
11010 WHEN VALUE_ERROR THEN
11011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11012 trace
11013 (p_msg => 'ERROR: '||sqlerrm
11014 ,p_level => C_LEVEL_EXCEPTION
11015 ,p_module => l_log_module);
11016 END IF;
11017 RAISE;
11018 WHEN xla_exceptions_pkg.application_exception THEN
11019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11020 trace
11021 (p_msg => 'ERROR: '||sqlerrm
11022 ,p_level => C_LEVEL_EXCEPTION
11023 ,p_module => l_log_module);
11024 END IF;
11025 RAISE;
11026 WHEN OTHERS THEN
11027 xla_exceptions_pkg.raise_message
11028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_108');
11029 END Description_108;
11030
11031 ---------------------------------------
11032 --
11033 -- PRIVATE FUNCTION
11034 -- Description_109
11035 --
11036 ---------------------------------------
11037 FUNCTION Description_109 (
11038 p_application_id IN NUMBER
11039 , p_ae_header_id IN NUMBER DEFAULT NULL
11040 --Period Close Date
11041 , p_source_1 IN DATE
11042 )
11043 RETURN VARCHAR2
11044 IS
11045 l_component_type VARCHAR2(80) ;
11046 l_component_code VARCHAR2(30) ;
11047 l_component_type_code VARCHAR2(1) ;
11048 l_component_appl_id INTEGER ;
11049 l_amb_context_code VARCHAR2(30) ;
11050 l_ledger_language VARCHAR2(30) ;
11051 l_source VARCHAR2(1996) ;
11052 l_description VARCHAR2(2000) ;
11053 l_log_module VARCHAR2(240) ;
11054 BEGIN
11055 IF g_log_enabled THEN
11056 l_log_module := C_DEFAULT_MODULE||'.Description_109';
11057 END IF;
11058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11059 trace
11060 (p_msg => 'BEGIN of Description_109'
11061 ,p_level => C_LEVEL_PROCEDURE
11062 ,p_module => l_log_module);
11063 END IF;
11064
11065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
11066 l_component_type := 'AMB_DESCRIPTION';
11067 l_component_code := 'FA_SLT_CIP_REVAL_RESERVE';
11068 l_component_type_code := 'S';
11069 l_component_appl_id := 140;
11070 l_amb_context_code := 'DEFAULT';
11071 l_source := NULL;
11072 l_description := NULL;
11073
11074
11075
11076 IF
11077 l_ledger_language = 'US' THEN
11078 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer CIP Revaluation Reserve'),1,2000);
11079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11080 END IF;
11081 IF
11082 l_ledger_language = 'US' THEN
11083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
11084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11085 END IF;
11086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
11087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
11088 IF l_source IS NOT NULL THEN
11089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
11090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11091 END IF;
11092 l_description := SUBSTR(l_description,1,1996);
11093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11094 trace
11095 (p_msg => 'END of Description_109'
11096 ,p_level => C_LEVEL_PROCEDURE
11097 ,p_module => l_log_module);
11098
11099 END IF;
11100 RETURN l_description;
11101
11102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11103 trace
11104 (p_msg => 'END of Description_109'
11105 ,p_level => C_LEVEL_PROCEDURE
11106 ,p_module => l_log_module);
11107 END IF;
11108 RETURN NULL;
11109 EXCEPTION
11110 WHEN VALUE_ERROR THEN
11111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11112 trace
11113 (p_msg => 'ERROR: '||sqlerrm
11114 ,p_level => C_LEVEL_EXCEPTION
11115 ,p_module => l_log_module);
11116 END IF;
11117 RAISE;
11118 WHEN xla_exceptions_pkg.application_exception THEN
11119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11120 trace
11121 (p_msg => 'ERROR: '||sqlerrm
11122 ,p_level => C_LEVEL_EXCEPTION
11123 ,p_module => l_log_module);
11124 END IF;
11125 RAISE;
11126 WHEN OTHERS THEN
11127 xla_exceptions_pkg.raise_message
11128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_109');
11129 END Description_109;
11130
11131 ---------------------------------------
11132 --
11133 -- PRIVATE FUNCTION
11134 -- Description_110
11135 --
11139 , p_ae_header_id IN NUMBER DEFAULT NULL
11136 ---------------------------------------
11137 FUNCTION Description_110 (
11138 p_application_id IN NUMBER
11140 --Period Close Date
11141 , p_source_1 IN DATE
11142 )
11143 RETURN VARCHAR2
11144 IS
11145 l_component_type VARCHAR2(80) ;
11146 l_component_code VARCHAR2(30) ;
11147 l_component_type_code VARCHAR2(1) ;
11148 l_component_appl_id INTEGER ;
11149 l_amb_context_code VARCHAR2(30) ;
11150 l_ledger_language VARCHAR2(30) ;
11151 l_source VARCHAR2(1996) ;
11152 l_description VARCHAR2(2000) ;
11153 l_log_module VARCHAR2(240) ;
11154 BEGIN
11155 IF g_log_enabled THEN
11156 l_log_module := C_DEFAULT_MODULE||'.Description_110';
11157 END IF;
11158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11159 trace
11160 (p_msg => 'BEGIN of Description_110'
11161 ,p_level => C_LEVEL_PROCEDURE
11162 ,p_module => l_log_module);
11163 END IF;
11164
11165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
11166 l_component_type := 'AMB_DESCRIPTION';
11167 l_component_code := 'FA_SLT_COST';
11168 l_component_type_code := 'S';
11169 l_component_appl_id := 140;
11170 l_amb_context_code := 'DEFAULT';
11171 l_source := NULL;
11172 l_description := NULL;
11173
11174
11175
11176 IF
11177 l_ledger_language = 'US' THEN
11178 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer Cost'),1,2000);
11179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11180 END IF;
11181 IF
11182 l_ledger_language = 'US' THEN
11183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
11184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11185 END IF;
11186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
11187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
11188 IF l_source IS NOT NULL THEN
11189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
11190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11191 END IF;
11192 l_description := SUBSTR(l_description,1,1996);
11193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11194 trace
11195 (p_msg => 'END of Description_110'
11196 ,p_level => C_LEVEL_PROCEDURE
11197 ,p_module => l_log_module);
11198
11199 END IF;
11200 RETURN l_description;
11201
11202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11203 trace
11204 (p_msg => 'END of Description_110'
11205 ,p_level => C_LEVEL_PROCEDURE
11206 ,p_module => l_log_module);
11207 END IF;
11208 RETURN NULL;
11209 EXCEPTION
11210 WHEN VALUE_ERROR THEN
11211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11212 trace
11213 (p_msg => 'ERROR: '||sqlerrm
11214 ,p_level => C_LEVEL_EXCEPTION
11215 ,p_module => l_log_module);
11216 END IF;
11217 RAISE;
11218 WHEN xla_exceptions_pkg.application_exception THEN
11219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11220 trace
11221 (p_msg => 'ERROR: '||sqlerrm
11222 ,p_level => C_LEVEL_EXCEPTION
11223 ,p_module => l_log_module);
11224 END IF;
11225 RAISE;
11226 WHEN OTHERS THEN
11227 xla_exceptions_pkg.raise_message
11228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_110');
11229 END Description_110;
11230
11231 ---------------------------------------
11232 --
11233 -- PRIVATE FUNCTION
11234 -- Description_111
11235 --
11236 ---------------------------------------
11237 FUNCTION Description_111 (
11238 p_application_id IN NUMBER
11239 , p_ae_header_id IN NUMBER DEFAULT NULL
11240 --Period Close Date
11241 , p_source_1 IN DATE
11242 )
11243 RETURN VARCHAR2
11244 IS
11245 l_component_type VARCHAR2(80) ;
11246 l_component_code VARCHAR2(30) ;
11247 l_component_type_code VARCHAR2(1) ;
11248 l_component_appl_id INTEGER ;
11249 l_amb_context_code VARCHAR2(30) ;
11250 l_ledger_language VARCHAR2(30) ;
11251 l_source VARCHAR2(1996) ;
11252 l_description VARCHAR2(2000) ;
11253 l_log_module VARCHAR2(240) ;
11254 BEGIN
11255 IF g_log_enabled THEN
11256 l_log_module := C_DEFAULT_MODULE||'.Description_111';
11257 END IF;
11258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11259 trace
11260 (p_msg => 'BEGIN of Description_111'
11261 ,p_level => C_LEVEL_PROCEDURE
11262 ,p_module => l_log_module);
11263 END IF;
11264
11265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
11266 l_component_type := 'AMB_DESCRIPTION';
11267 l_component_code := 'FA_SLT_COST_CLR';
11268 l_component_type_code := 'S';
11269 l_component_appl_id := 140;
11270 l_amb_context_code := 'DEFAULT';
11271 l_source := NULL;
11272 l_description := NULL;
11273
11274
11275
11276 IF
11277 l_ledger_language = 'US' THEN
11281 IF
11278 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer Cost Clearing'),1,2000);
11279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11280 END IF;
11282 l_ledger_language = 'US' THEN
11283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
11284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11285 END IF;
11286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
11287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
11288 IF l_source IS NOT NULL THEN
11289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
11290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11291 END IF;
11292 l_description := SUBSTR(l_description,1,1996);
11293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11294 trace
11295 (p_msg => 'END of Description_111'
11296 ,p_level => C_LEVEL_PROCEDURE
11297 ,p_module => l_log_module);
11298
11299 END IF;
11300 RETURN l_description;
11301
11302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11303 trace
11304 (p_msg => 'END of Description_111'
11305 ,p_level => C_LEVEL_PROCEDURE
11306 ,p_module => l_log_module);
11307 END IF;
11308 RETURN NULL;
11309 EXCEPTION
11310 WHEN VALUE_ERROR THEN
11311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11312 trace
11313 (p_msg => 'ERROR: '||sqlerrm
11314 ,p_level => C_LEVEL_EXCEPTION
11315 ,p_module => l_log_module);
11316 END IF;
11317 RAISE;
11318 WHEN xla_exceptions_pkg.application_exception THEN
11319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11320 trace
11321 (p_msg => 'ERROR: '||sqlerrm
11322 ,p_level => C_LEVEL_EXCEPTION
11323 ,p_module => l_log_module);
11324 END IF;
11325 RAISE;
11326 WHEN OTHERS THEN
11327 xla_exceptions_pkg.raise_message
11328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_111');
11329 END Description_111;
11330
11331 ---------------------------------------
11332 --
11333 -- PRIVATE FUNCTION
11334 -- Description_112
11335 --
11336 ---------------------------------------
11337 FUNCTION Description_112 (
11338 p_application_id IN NUMBER
11339 , p_ae_header_id IN NUMBER DEFAULT NULL
11340 --Period Close Date
11341 , p_source_1 IN DATE
11342 )
11343 RETURN VARCHAR2
11344 IS
11345 l_component_type VARCHAR2(80) ;
11346 l_component_code VARCHAR2(30) ;
11347 l_component_type_code VARCHAR2(1) ;
11348 l_component_appl_id INTEGER ;
11349 l_amb_context_code VARCHAR2(30) ;
11350 l_ledger_language VARCHAR2(30) ;
11351 l_source VARCHAR2(1996) ;
11352 l_description VARCHAR2(2000) ;
11353 l_log_module VARCHAR2(240) ;
11354 BEGIN
11355 IF g_log_enabled THEN
11356 l_log_module := C_DEFAULT_MODULE||'.Description_112';
11357 END IF;
11358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11359 trace
11360 (p_msg => 'BEGIN of Description_112'
11361 ,p_level => C_LEVEL_PROCEDURE
11362 ,p_module => l_log_module);
11363 END IF;
11364
11365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
11366 l_component_type := 'AMB_DESCRIPTION';
11367 l_component_code := 'FA_SLT_DEPRN_EXP';
11368 l_component_type_code := 'S';
11369 l_component_appl_id := 140;
11370 l_amb_context_code := 'DEFAULT';
11371 l_source := NULL;
11372 l_description := NULL;
11373
11374
11375
11376 IF
11377 l_ledger_language = 'US' THEN
11378 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer Depreciation Expense'),1,2000);
11379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11380 END IF;
11381 IF
11382 l_ledger_language = 'US' THEN
11383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
11384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11385 END IF;
11386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
11387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
11388 IF l_source IS NOT NULL THEN
11389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
11390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11391 END IF;
11392 l_description := SUBSTR(l_description,1,1996);
11393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11394 trace
11395 (p_msg => 'END of Description_112'
11396 ,p_level => C_LEVEL_PROCEDURE
11397 ,p_module => l_log_module);
11398
11399 END IF;
11400 RETURN l_description;
11401
11402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11403 trace
11404 (p_msg => 'END of Description_112'
11405 ,p_level => C_LEVEL_PROCEDURE
11406 ,p_module => l_log_module);
11407 END IF;
11408 RETURN NULL;
11409 EXCEPTION
11410 WHEN VALUE_ERROR THEN
11411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11415 ,p_module => l_log_module);
11412 trace
11413 (p_msg => 'ERROR: '||sqlerrm
11414 ,p_level => C_LEVEL_EXCEPTION
11416 END IF;
11417 RAISE;
11418 WHEN xla_exceptions_pkg.application_exception THEN
11419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11420 trace
11421 (p_msg => 'ERROR: '||sqlerrm
11422 ,p_level => C_LEVEL_EXCEPTION
11423 ,p_module => l_log_module);
11424 END IF;
11425 RAISE;
11426 WHEN OTHERS THEN
11427 xla_exceptions_pkg.raise_message
11428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_112');
11429 END Description_112;
11430
11431 ---------------------------------------
11432 --
11433 -- PRIVATE FUNCTION
11434 -- Description_113
11435 --
11436 ---------------------------------------
11437 FUNCTION Description_113 (
11438 p_application_id IN NUMBER
11439 , p_ae_header_id IN NUMBER DEFAULT NULL
11440 --Period Close Date
11441 , p_source_1 IN DATE
11442 )
11443 RETURN VARCHAR2
11444 IS
11445 l_component_type VARCHAR2(80) ;
11446 l_component_code VARCHAR2(30) ;
11447 l_component_type_code VARCHAR2(1) ;
11448 l_component_appl_id INTEGER ;
11449 l_amb_context_code VARCHAR2(30) ;
11450 l_ledger_language VARCHAR2(30) ;
11451 l_source VARCHAR2(1996) ;
11452 l_description VARCHAR2(2000) ;
11453 l_log_module VARCHAR2(240) ;
11454 BEGIN
11455 IF g_log_enabled THEN
11456 l_log_module := C_DEFAULT_MODULE||'.Description_113';
11457 END IF;
11458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11459 trace
11460 (p_msg => 'BEGIN of Description_113'
11461 ,p_level => C_LEVEL_PROCEDURE
11462 ,p_module => l_log_module);
11463 END IF;
11464
11465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
11466 l_component_type := 'AMB_DESCRIPTION';
11467 l_component_code := 'FA_SLT_DEPRN_RESERVE';
11468 l_component_type_code := 'S';
11469 l_component_appl_id := 140;
11470 l_amb_context_code := 'DEFAULT';
11471 l_source := NULL;
11472 l_description := NULL;
11473
11474
11475
11476 IF
11477 l_ledger_language = 'US' THEN
11478 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer Depreciation Reserve'),1,2000);
11479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11480 END IF;
11481 IF
11482 l_ledger_language = 'US' THEN
11483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
11484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11485 END IF;
11486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
11487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
11488 IF l_source IS NOT NULL THEN
11489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
11490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11491 END IF;
11492 l_description := SUBSTR(l_description,1,1996);
11493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11494 trace
11495 (p_msg => 'END of Description_113'
11496 ,p_level => C_LEVEL_PROCEDURE
11497 ,p_module => l_log_module);
11498
11499 END IF;
11500 RETURN l_description;
11501
11502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11503 trace
11504 (p_msg => 'END of Description_113'
11505 ,p_level => C_LEVEL_PROCEDURE
11506 ,p_module => l_log_module);
11507 END IF;
11508 RETURN NULL;
11509 EXCEPTION
11510 WHEN VALUE_ERROR THEN
11511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11512 trace
11513 (p_msg => 'ERROR: '||sqlerrm
11514 ,p_level => C_LEVEL_EXCEPTION
11515 ,p_module => l_log_module);
11516 END IF;
11517 RAISE;
11518 WHEN xla_exceptions_pkg.application_exception THEN
11519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11520 trace
11521 (p_msg => 'ERROR: '||sqlerrm
11522 ,p_level => C_LEVEL_EXCEPTION
11523 ,p_module => l_log_module);
11524 END IF;
11525 RAISE;
11526 WHEN OTHERS THEN
11527 xla_exceptions_pkg.raise_message
11528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_113');
11529 END Description_113;
11530
11531 ---------------------------------------
11532 --
11533 -- PRIVATE FUNCTION
11534 -- Description_114
11535 --
11536 ---------------------------------------
11537 FUNCTION Description_114 (
11538 p_application_id IN NUMBER
11539 , p_ae_header_id IN NUMBER DEFAULT NULL
11540 --Period Close Date
11541 , p_source_1 IN DATE
11542 )
11543 RETURN VARCHAR2
11544 IS
11545 l_component_type VARCHAR2(80) ;
11546 l_component_code VARCHAR2(30) ;
11547 l_component_type_code VARCHAR2(1) ;
11548 l_component_appl_id INTEGER ;
11549 l_amb_context_code VARCHAR2(30) ;
11550 l_ledger_language VARCHAR2(30) ;
11551 l_source VARCHAR2(1996) ;
11552 l_description VARCHAR2(2000) ;
11553 l_log_module VARCHAR2(240) ;
11554 BEGIN
11555 IF g_log_enabled THEN
11559 trace
11556 l_log_module := C_DEFAULT_MODULE||'.Description_114';
11557 END IF;
11558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11560 (p_msg => 'BEGIN of Description_114'
11561 ,p_level => C_LEVEL_PROCEDURE
11562 ,p_module => l_log_module);
11563 END IF;
11564
11565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
11566 l_component_type := 'AMB_DESCRIPTION';
11567 l_component_code := 'FA_SLT_IC_PAY';
11568 l_component_type_code := 'S';
11569 l_component_appl_id := 140;
11570 l_amb_context_code := 'DEFAULT';
11571 l_source := NULL;
11572 l_description := NULL;
11573
11574
11575
11576 IF
11577 l_ledger_language = 'US' THEN
11578 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer Intercompany Payable'),1,2000);
11579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11580 END IF;
11581 IF
11582 l_ledger_language = 'US' THEN
11583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
11584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11585 END IF;
11586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
11587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
11588 IF l_source IS NOT NULL THEN
11589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
11590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11591 END IF;
11592 l_description := SUBSTR(l_description,1,1996);
11593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11594 trace
11595 (p_msg => 'END of Description_114'
11596 ,p_level => C_LEVEL_PROCEDURE
11597 ,p_module => l_log_module);
11598
11599 END IF;
11600 RETURN l_description;
11601
11602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11603 trace
11604 (p_msg => 'END of Description_114'
11605 ,p_level => C_LEVEL_PROCEDURE
11606 ,p_module => l_log_module);
11607 END IF;
11608 RETURN NULL;
11609 EXCEPTION
11610 WHEN VALUE_ERROR THEN
11611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11612 trace
11613 (p_msg => 'ERROR: '||sqlerrm
11614 ,p_level => C_LEVEL_EXCEPTION
11615 ,p_module => l_log_module);
11616 END IF;
11617 RAISE;
11618 WHEN xla_exceptions_pkg.application_exception THEN
11619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11620 trace
11621 (p_msg => 'ERROR: '||sqlerrm
11622 ,p_level => C_LEVEL_EXCEPTION
11623 ,p_module => l_log_module);
11624 END IF;
11625 RAISE;
11626 WHEN OTHERS THEN
11627 xla_exceptions_pkg.raise_message
11628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_114');
11629 END Description_114;
11630
11631 ---------------------------------------
11632 --
11633 -- PRIVATE FUNCTION
11634 -- Description_115
11635 --
11636 ---------------------------------------
11637 FUNCTION Description_115 (
11638 p_application_id IN NUMBER
11639 , p_ae_header_id IN NUMBER DEFAULT NULL
11640 --Period Close Date
11641 , p_source_1 IN DATE
11642 )
11643 RETURN VARCHAR2
11644 IS
11645 l_component_type VARCHAR2(80) ;
11646 l_component_code VARCHAR2(30) ;
11647 l_component_type_code VARCHAR2(1) ;
11648 l_component_appl_id INTEGER ;
11649 l_amb_context_code VARCHAR2(30) ;
11650 l_ledger_language VARCHAR2(30) ;
11651 l_source VARCHAR2(1996) ;
11652 l_description VARCHAR2(2000) ;
11653 l_log_module VARCHAR2(240) ;
11654 BEGIN
11655 IF g_log_enabled THEN
11656 l_log_module := C_DEFAULT_MODULE||'.Description_115';
11657 END IF;
11658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11659 trace
11660 (p_msg => 'BEGIN of Description_115'
11661 ,p_level => C_LEVEL_PROCEDURE
11662 ,p_module => l_log_module);
11663 END IF;
11664
11665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
11666 l_component_type := 'AMB_DESCRIPTION';
11667 l_component_code := 'FA_SLT_IC_REC';
11668 l_component_type_code := 'S';
11669 l_component_appl_id := 140;
11670 l_amb_context_code := 'DEFAULT';
11671 l_source := NULL;
11672 l_description := NULL;
11673
11674
11675
11676 IF
11677 l_ledger_language = 'US' THEN
11678 l_description := SUBSTR(CONCAT(l_description,'Source LineTransfer Intercompany Receivable'),1,2000);
11679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11680 END IF;
11681 IF
11682 l_ledger_language = 'US' THEN
11683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
11684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11685 END IF;
11686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
11687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
11688 IF l_source IS NOT NULL THEN
11689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
11690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11691 END IF;
11695 (p_msg => 'END of Description_115'
11692 l_description := SUBSTR(l_description,1,1996);
11693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11694 trace
11696 ,p_level => C_LEVEL_PROCEDURE
11697 ,p_module => l_log_module);
11698
11699 END IF;
11700 RETURN l_description;
11701
11702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11703 trace
11704 (p_msg => 'END of Description_115'
11705 ,p_level => C_LEVEL_PROCEDURE
11706 ,p_module => l_log_module);
11707 END IF;
11708 RETURN NULL;
11709 EXCEPTION
11710 WHEN VALUE_ERROR THEN
11711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11712 trace
11713 (p_msg => 'ERROR: '||sqlerrm
11714 ,p_level => C_LEVEL_EXCEPTION
11715 ,p_module => l_log_module);
11716 END IF;
11717 RAISE;
11718 WHEN xla_exceptions_pkg.application_exception THEN
11719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11720 trace
11721 (p_msg => 'ERROR: '||sqlerrm
11722 ,p_level => C_LEVEL_EXCEPTION
11723 ,p_module => l_log_module);
11724 END IF;
11725 RAISE;
11726 WHEN OTHERS THEN
11727 xla_exceptions_pkg.raise_message
11728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_115');
11729 END Description_115;
11730
11731 ---------------------------------------
11732 --
11733 -- PRIVATE FUNCTION
11734 -- Description_116
11735 --
11736 ---------------------------------------
11737 FUNCTION Description_116 (
11738 p_application_id IN NUMBER
11739 , p_ae_header_id IN NUMBER DEFAULT NULL
11740 --Period Close Date
11741 , p_source_1 IN DATE
11742 )
11743 RETURN VARCHAR2
11744 IS
11745 l_component_type VARCHAR2(80) ;
11746 l_component_code VARCHAR2(30) ;
11747 l_component_type_code VARCHAR2(1) ;
11748 l_component_appl_id INTEGER ;
11749 l_amb_context_code VARCHAR2(30) ;
11750 l_ledger_language VARCHAR2(30) ;
11751 l_source VARCHAR2(1996) ;
11752 l_description VARCHAR2(2000) ;
11753 l_log_module VARCHAR2(240) ;
11754 BEGIN
11755 IF g_log_enabled THEN
11756 l_log_module := C_DEFAULT_MODULE||'.Description_116';
11757 END IF;
11758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11759 trace
11760 (p_msg => 'BEGIN of Description_116'
11761 ,p_level => C_LEVEL_PROCEDURE
11762 ,p_module => l_log_module);
11763 END IF;
11764
11765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
11766 l_component_type := 'AMB_DESCRIPTION';
11767 l_component_code := 'FA_SLT_REVAL_RESERVE';
11768 l_component_type_code := 'S';
11769 l_component_appl_id := 140;
11770 l_amb_context_code := 'DEFAULT';
11771 l_source := NULL;
11772 l_description := NULL;
11773
11774
11775
11776 IF
11777 l_ledger_language = 'US' THEN
11778 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer Revaluation Reserve'),1,2000);
11779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11780 END IF;
11781 IF
11782 l_ledger_language = 'US' THEN
11783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
11784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11785 END IF;
11786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
11787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
11788 IF l_source IS NOT NULL THEN
11789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
11790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11791 END IF;
11792 l_description := SUBSTR(l_description,1,1996);
11793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11794 trace
11795 (p_msg => 'END of Description_116'
11796 ,p_level => C_LEVEL_PROCEDURE
11797 ,p_module => l_log_module);
11798
11799 END IF;
11800 RETURN l_description;
11801
11802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11803 trace
11804 (p_msg => 'END of Description_116'
11805 ,p_level => C_LEVEL_PROCEDURE
11806 ,p_module => l_log_module);
11807 END IF;
11808 RETURN NULL;
11809 EXCEPTION
11810 WHEN VALUE_ERROR THEN
11811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11812 trace
11813 (p_msg => 'ERROR: '||sqlerrm
11814 ,p_level => C_LEVEL_EXCEPTION
11815 ,p_module => l_log_module);
11816 END IF;
11817 RAISE;
11818 WHEN xla_exceptions_pkg.application_exception THEN
11819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11820 trace
11821 (p_msg => 'ERROR: '||sqlerrm
11822 ,p_level => C_LEVEL_EXCEPTION
11823 ,p_module => l_log_module);
11824 END IF;
11825 RAISE;
11826 WHEN OTHERS THEN
11827 xla_exceptions_pkg.raise_message
11828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_116');
11829 END Description_116;
11830
11831 ---------------------------------------
11835 --
11832 --
11833 -- PRIVATE FUNCTION
11834 -- Description_117
11836 ---------------------------------------
11837 FUNCTION Description_117 (
11838 p_application_id IN NUMBER
11839 , p_ae_header_id IN NUMBER DEFAULT NULL
11840 --Period Close Date
11841 , p_source_1 IN DATE
11842 )
11843 RETURN VARCHAR2
11844 IS
11845 l_component_type VARCHAR2(80) ;
11846 l_component_code VARCHAR2(30) ;
11847 l_component_type_code VARCHAR2(1) ;
11848 l_component_appl_id INTEGER ;
11849 l_amb_context_code VARCHAR2(30) ;
11850 l_ledger_language VARCHAR2(30) ;
11851 l_source VARCHAR2(1996) ;
11852 l_description VARCHAR2(2000) ;
11853 l_log_module VARCHAR2(240) ;
11854 BEGIN
11855 IF g_log_enabled THEN
11856 l_log_module := C_DEFAULT_MODULE||'.Description_117';
11857 END IF;
11858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11859 trace
11860 (p_msg => 'BEGIN of Description_117'
11861 ,p_level => C_LEVEL_PROCEDURE
11862 ,p_module => l_log_module);
11863 END IF;
11864
11865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
11866 l_component_type := 'AMB_DESCRIPTION';
11867 l_component_code := 'FA_SOURCE_LINE_TRANSFER';
11868 l_component_type_code := 'S';
11869 l_component_appl_id := 140;
11870 l_amb_context_code := 'DEFAULT';
11871 l_source := NULL;
11872 l_description := NULL;
11873
11874
11875
11876 IF
11877 l_ledger_language = 'US' THEN
11878 l_description := SUBSTR(CONCAT(l_description,'Source Line Transfer'),1,2000);
11879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11880 END IF;
11881 IF
11882 l_ledger_language = 'US' THEN
11883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
11884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11885 END IF;
11886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
11887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
11888 IF l_source IS NOT NULL THEN
11889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
11890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11891 END IF;
11892 l_description := SUBSTR(l_description,1,1996);
11893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11894 trace
11895 (p_msg => 'END of Description_117'
11896 ,p_level => C_LEVEL_PROCEDURE
11897 ,p_module => l_log_module);
11898
11899 END IF;
11900 RETURN l_description;
11901
11902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11903 trace
11904 (p_msg => 'END of Description_117'
11905 ,p_level => C_LEVEL_PROCEDURE
11906 ,p_module => l_log_module);
11907 END IF;
11908 RETURN NULL;
11909 EXCEPTION
11910 WHEN VALUE_ERROR THEN
11911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11912 trace
11913 (p_msg => 'ERROR: '||sqlerrm
11914 ,p_level => C_LEVEL_EXCEPTION
11915 ,p_module => l_log_module);
11916 END IF;
11917 RAISE;
11918 WHEN xla_exceptions_pkg.application_exception THEN
11919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
11920 trace
11921 (p_msg => 'ERROR: '||sqlerrm
11922 ,p_level => C_LEVEL_EXCEPTION
11923 ,p_module => l_log_module);
11924 END IF;
11925 RAISE;
11926 WHEN OTHERS THEN
11927 xla_exceptions_pkg.raise_message
11928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_117');
11929 END Description_117;
11930
11931 ---------------------------------------
11932 --
11933 -- PRIVATE FUNCTION
11934 -- Description_118
11935 --
11936 ---------------------------------------
11937 FUNCTION Description_118 (
11938 p_application_id IN NUMBER
11939 , p_ae_header_id IN NUMBER DEFAULT NULL
11940 --Period Close Date
11941 , p_source_1 IN DATE
11942 )
11943 RETURN VARCHAR2
11944 IS
11945 l_component_type VARCHAR2(80) ;
11946 l_component_code VARCHAR2(30) ;
11947 l_component_type_code VARCHAR2(1) ;
11948 l_component_appl_id INTEGER ;
11949 l_amb_context_code VARCHAR2(30) ;
11950 l_ledger_language VARCHAR2(30) ;
11951 l_source VARCHAR2(1996) ;
11952 l_description VARCHAR2(2000) ;
11953 l_log_module VARCHAR2(240) ;
11954 BEGIN
11955 IF g_log_enabled THEN
11956 l_log_module := C_DEFAULT_MODULE||'.Description_118';
11957 END IF;
11958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11959 trace
11960 (p_msg => 'BEGIN of Description_118'
11961 ,p_level => C_LEVEL_PROCEDURE
11962 ,p_module => l_log_module);
11963 END IF;
11964
11965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
11966 l_component_type := 'AMB_DESCRIPTION';
11967 l_component_code := 'FA_TAX_DEPRN_RESERVE';
11968 l_component_type_code := 'S';
11969 l_component_appl_id := 140;
11973
11970 l_amb_context_code := 'DEFAULT';
11971 l_source := NULL;
11972 l_description := NULL;
11974
11975
11976 IF
11977 l_ledger_language = 'US' THEN
11978 l_description := SUBSTR(CONCAT(l_description,'Tax Depreciation Reserve'),1,2000);
11979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11980 END IF;
11981 IF
11982 l_ledger_language = 'US' THEN
11983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
11984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11985 END IF;
11986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
11987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
11988 IF l_source IS NOT NULL THEN
11989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
11990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
11991 END IF;
11992 l_description := SUBSTR(l_description,1,1996);
11993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
11994 trace
11995 (p_msg => 'END of Description_118'
11996 ,p_level => C_LEVEL_PROCEDURE
11997 ,p_module => l_log_module);
11998
11999 END IF;
12000 RETURN l_description;
12001
12002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12003 trace
12004 (p_msg => 'END of Description_118'
12005 ,p_level => C_LEVEL_PROCEDURE
12006 ,p_module => l_log_module);
12007 END IF;
12008 RETURN NULL;
12009 EXCEPTION
12010 WHEN VALUE_ERROR THEN
12011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12012 trace
12013 (p_msg => 'ERROR: '||sqlerrm
12014 ,p_level => C_LEVEL_EXCEPTION
12015 ,p_module => l_log_module);
12016 END IF;
12017 RAISE;
12018 WHEN xla_exceptions_pkg.application_exception THEN
12019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12020 trace
12021 (p_msg => 'ERROR: '||sqlerrm
12022 ,p_level => C_LEVEL_EXCEPTION
12023 ,p_module => l_log_module);
12024 END IF;
12025 RAISE;
12026 WHEN OTHERS THEN
12027 xla_exceptions_pkg.raise_message
12028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_118');
12029 END Description_118;
12030
12031 ---------------------------------------
12032 --
12033 -- PRIVATE FUNCTION
12034 -- Description_119
12035 --
12036 ---------------------------------------
12037 FUNCTION Description_119 (
12038 p_application_id IN NUMBER
12039 , p_ae_header_id IN NUMBER DEFAULT NULL
12040 --Period Close Date
12041 , p_source_1 IN DATE
12042 )
12043 RETURN VARCHAR2
12044 IS
12045 l_component_type VARCHAR2(80) ;
12046 l_component_code VARCHAR2(30) ;
12047 l_component_type_code VARCHAR2(1) ;
12048 l_component_appl_id INTEGER ;
12049 l_amb_context_code VARCHAR2(30) ;
12050 l_ledger_language VARCHAR2(30) ;
12051 l_source VARCHAR2(1996) ;
12052 l_description VARCHAR2(2000) ;
12053 l_log_module VARCHAR2(240) ;
12054 BEGIN
12055 IF g_log_enabled THEN
12056 l_log_module := C_DEFAULT_MODULE||'.Description_119';
12057 END IF;
12058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12059 trace
12060 (p_msg => 'BEGIN of Description_119'
12061 ,p_level => C_LEVEL_PROCEDURE
12062 ,p_module => l_log_module);
12063 END IF;
12064
12065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
12066 l_component_type := 'AMB_DESCRIPTION';
12067 l_component_code := 'FA_TERM_GAIN_LOSS';
12068 l_component_type_code := 'S';
12069 l_component_appl_id := 140;
12070 l_amb_context_code := 'DEFAULT';
12071 l_source := NULL;
12072 l_description := NULL;
12073
12074
12075
12076 IF
12077 l_ledger_language = 'US' THEN
12078 l_description := SUBSTR(CONCAT(l_description,'Terminal Gain and Loss'),1,2000);
12079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12080 END IF;
12081 IF
12082 l_ledger_language = 'US' THEN
12083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
12084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12085 END IF;
12086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
12087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
12088 IF l_source IS NOT NULL THEN
12089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
12090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12091 END IF;
12092 l_description := SUBSTR(l_description,1,1996);
12093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12094 trace
12095 (p_msg => 'END of Description_119'
12096 ,p_level => C_LEVEL_PROCEDURE
12097 ,p_module => l_log_module);
12098
12099 END IF;
12100 RETURN l_description;
12101
12102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12103 trace
12104 (p_msg => 'END of Description_119'
12105 ,p_level => C_LEVEL_PROCEDURE
12106 ,p_module => l_log_module);
12107 END IF;
12111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12108 RETURN NULL;
12109 EXCEPTION
12110 WHEN VALUE_ERROR THEN
12112 trace
12113 (p_msg => 'ERROR: '||sqlerrm
12114 ,p_level => C_LEVEL_EXCEPTION
12115 ,p_module => l_log_module);
12116 END IF;
12117 RAISE;
12118 WHEN xla_exceptions_pkg.application_exception THEN
12119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12120 trace
12121 (p_msg => 'ERROR: '||sqlerrm
12122 ,p_level => C_LEVEL_EXCEPTION
12123 ,p_module => l_log_module);
12124 END IF;
12125 RAISE;
12126 WHEN OTHERS THEN
12127 xla_exceptions_pkg.raise_message
12128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_119');
12129 END Description_119;
12130
12131 ---------------------------------------
12132 --
12133 -- PRIVATE FUNCTION
12134 -- Description_120
12135 --
12136 ---------------------------------------
12137 FUNCTION Description_120 (
12138 p_application_id IN NUMBER
12139 , p_ae_header_id IN NUMBER DEFAULT NULL
12140 --Period Close Date
12141 , p_source_1 IN DATE
12142 )
12143 RETURN VARCHAR2
12144 IS
12145 l_component_type VARCHAR2(80) ;
12146 l_component_code VARCHAR2(30) ;
12147 l_component_type_code VARCHAR2(1) ;
12148 l_component_appl_id INTEGER ;
12149 l_amb_context_code VARCHAR2(30) ;
12150 l_ledger_language VARCHAR2(30) ;
12151 l_source VARCHAR2(1996) ;
12152 l_description VARCHAR2(2000) ;
12153 l_log_module VARCHAR2(240) ;
12154 BEGIN
12155 IF g_log_enabled THEN
12156 l_log_module := C_DEFAULT_MODULE||'.Description_120';
12157 END IF;
12158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12159 trace
12160 (p_msg => 'BEGIN of Description_120'
12161 ,p_level => C_LEVEL_PROCEDURE
12162 ,p_module => l_log_module);
12163 END IF;
12164
12165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
12166 l_component_type := 'AMB_DESCRIPTION';
12167 l_component_code := 'FA_TGL_NBV_RETIRED_GAIN';
12168 l_component_type_code := 'S';
12169 l_component_appl_id := 140;
12170 l_amb_context_code := 'DEFAULT';
12171 l_source := NULL;
12172 l_description := NULL;
12173
12174
12175
12176 IF
12177 l_ledger_language = 'US' THEN
12178 l_description := SUBSTR(CONCAT(l_description,'Net Book Value Retired Gain'),1,2000);
12179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12180 END IF;
12181 IF
12182 l_ledger_language = 'US' THEN
12183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
12184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12185 END IF;
12186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
12187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
12188 IF l_source IS NOT NULL THEN
12189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
12190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12191 END IF;
12192 l_description := SUBSTR(l_description,1,1996);
12193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12194 trace
12195 (p_msg => 'END of Description_120'
12196 ,p_level => C_LEVEL_PROCEDURE
12197 ,p_module => l_log_module);
12198
12199 END IF;
12200 RETURN l_description;
12201
12202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12203 trace
12204 (p_msg => 'END of Description_120'
12205 ,p_level => C_LEVEL_PROCEDURE
12206 ,p_module => l_log_module);
12207 END IF;
12208 RETURN NULL;
12209 EXCEPTION
12210 WHEN VALUE_ERROR THEN
12211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12212 trace
12213 (p_msg => 'ERROR: '||sqlerrm
12214 ,p_level => C_LEVEL_EXCEPTION
12215 ,p_module => l_log_module);
12216 END IF;
12217 RAISE;
12218 WHEN xla_exceptions_pkg.application_exception THEN
12219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12220 trace
12221 (p_msg => 'ERROR: '||sqlerrm
12222 ,p_level => C_LEVEL_EXCEPTION
12223 ,p_module => l_log_module);
12224 END IF;
12225 RAISE;
12226 WHEN OTHERS THEN
12227 xla_exceptions_pkg.raise_message
12228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_120');
12229 END Description_120;
12230
12231 ---------------------------------------
12232 --
12233 -- PRIVATE FUNCTION
12234 -- Description_121
12235 --
12236 ---------------------------------------
12237 FUNCTION Description_121 (
12238 p_application_id IN NUMBER
12239 , p_ae_header_id IN NUMBER DEFAULT NULL
12240 --Period Close Date
12241 , p_source_1 IN DATE
12242 )
12243 RETURN VARCHAR2
12244 IS
12245 l_component_type VARCHAR2(80) ;
12246 l_component_code VARCHAR2(30) ;
12247 l_component_type_code VARCHAR2(1) ;
12248 l_component_appl_id INTEGER ;
12249 l_amb_context_code VARCHAR2(30) ;
12253 l_log_module VARCHAR2(240) ;
12250 l_ledger_language VARCHAR2(30) ;
12251 l_source VARCHAR2(1996) ;
12252 l_description VARCHAR2(2000) ;
12254 BEGIN
12255 IF g_log_enabled THEN
12256 l_log_module := C_DEFAULT_MODULE||'.Description_121';
12257 END IF;
12258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12259 trace
12260 (p_msg => 'BEGIN of Description_121'
12261 ,p_level => C_LEVEL_PROCEDURE
12262 ,p_module => l_log_module);
12263 END IF;
12264
12265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
12266 l_component_type := 'AMB_DESCRIPTION';
12267 l_component_code := 'FA_TGL_NBV_RETIRED_LOSS';
12268 l_component_type_code := 'S';
12269 l_component_appl_id := 140;
12270 l_amb_context_code := 'DEFAULT';
12271 l_source := NULL;
12272 l_description := NULL;
12273
12274
12275
12276 IF
12277 l_ledger_language = 'US' THEN
12278 l_description := SUBSTR(CONCAT(l_description,'Net Book Value Retired Loss'),1,2000);
12279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12280 END IF;
12281 IF
12282 l_ledger_language = 'US' THEN
12283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
12284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12285 END IF;
12286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
12287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
12288 IF l_source IS NOT NULL THEN
12289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
12290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12291 END IF;
12292 l_description := SUBSTR(l_description,1,1996);
12293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12294 trace
12295 (p_msg => 'END of Description_121'
12296 ,p_level => C_LEVEL_PROCEDURE
12297 ,p_module => l_log_module);
12298
12299 END IF;
12300 RETURN l_description;
12301
12302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12303 trace
12304 (p_msg => 'END of Description_121'
12305 ,p_level => C_LEVEL_PROCEDURE
12306 ,p_module => l_log_module);
12307 END IF;
12308 RETURN NULL;
12309 EXCEPTION
12310 WHEN VALUE_ERROR THEN
12311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12312 trace
12313 (p_msg => 'ERROR: '||sqlerrm
12314 ,p_level => C_LEVEL_EXCEPTION
12315 ,p_module => l_log_module);
12316 END IF;
12317 RAISE;
12318 WHEN xla_exceptions_pkg.application_exception THEN
12319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12320 trace
12321 (p_msg => 'ERROR: '||sqlerrm
12322 ,p_level => C_LEVEL_EXCEPTION
12323 ,p_module => l_log_module);
12324 END IF;
12325 RAISE;
12326 WHEN OTHERS THEN
12327 xla_exceptions_pkg.raise_message
12328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_121');
12329 END Description_121;
12330
12331 ---------------------------------------
12332 --
12333 -- PRIVATE FUNCTION
12334 -- Description_122
12335 --
12336 ---------------------------------------
12337 FUNCTION Description_122 (
12338 p_application_id IN NUMBER
12339 , p_ae_header_id IN NUMBER DEFAULT NULL
12340 --Period Close Date
12341 , p_source_1 IN DATE
12342 )
12343 RETURN VARCHAR2
12344 IS
12345 l_component_type VARCHAR2(80) ;
12346 l_component_code VARCHAR2(30) ;
12347 l_component_type_code VARCHAR2(1) ;
12348 l_component_appl_id INTEGER ;
12349 l_amb_context_code VARCHAR2(30) ;
12350 l_ledger_language VARCHAR2(30) ;
12351 l_source VARCHAR2(1996) ;
12352 l_description VARCHAR2(2000) ;
12353 l_log_module VARCHAR2(240) ;
12354 BEGIN
12355 IF g_log_enabled THEN
12356 l_log_module := C_DEFAULT_MODULE||'.Description_122';
12357 END IF;
12358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12359 trace
12360 (p_msg => 'BEGIN of Description_122'
12361 ,p_level => C_LEVEL_PROCEDURE
12362 ,p_module => l_log_module);
12363 END IF;
12364
12365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
12366 l_component_type := 'AMB_DESCRIPTION';
12367 l_component_code := 'FA_TGL_RES';
12368 l_component_type_code := 'S';
12369 l_component_appl_id := 140;
12370 l_amb_context_code := 'DEFAULT';
12371 l_source := NULL;
12372 l_description := NULL;
12373
12374
12375
12376 IF
12377 l_ledger_language = 'US' THEN
12378 l_description := SUBSTR(CONCAT(l_description,'Terminal Gain Loss Reserve'),1,2000);
12379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12380 END IF;
12381 IF
12382 l_ledger_language = 'US' THEN
12383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
12384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12385 END IF;
12386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
12390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
12388 IF l_source IS NOT NULL THEN
12389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
12391 END IF;
12392 l_description := SUBSTR(l_description,1,1996);
12393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12394 trace
12395 (p_msg => 'END of Description_122'
12396 ,p_level => C_LEVEL_PROCEDURE
12397 ,p_module => l_log_module);
12398
12399 END IF;
12400 RETURN l_description;
12401
12402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12403 trace
12404 (p_msg => 'END of Description_122'
12405 ,p_level => C_LEVEL_PROCEDURE
12406 ,p_module => l_log_module);
12407 END IF;
12408 RETURN NULL;
12409 EXCEPTION
12410 WHEN VALUE_ERROR THEN
12411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12412 trace
12413 (p_msg => 'ERROR: '||sqlerrm
12414 ,p_level => C_LEVEL_EXCEPTION
12415 ,p_module => l_log_module);
12416 END IF;
12417 RAISE;
12418 WHEN xla_exceptions_pkg.application_exception THEN
12419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12420 trace
12421 (p_msg => 'ERROR: '||sqlerrm
12422 ,p_level => C_LEVEL_EXCEPTION
12423 ,p_module => l_log_module);
12424 END IF;
12425 RAISE;
12426 WHEN OTHERS THEN
12427 xla_exceptions_pkg.raise_message
12428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_122');
12429 END Description_122;
12430
12431 ---------------------------------------
12432 --
12433 -- PRIVATE FUNCTION
12434 -- Description_123
12435 --
12436 ---------------------------------------
12437 FUNCTION Description_123 (
12438 p_application_id IN NUMBER
12439 , p_ae_header_id IN NUMBER DEFAULT NULL
12440 --Period Close Date
12441 , p_source_1 IN DATE
12442 )
12443 RETURN VARCHAR2
12444 IS
12445 l_component_type VARCHAR2(80) ;
12446 l_component_code VARCHAR2(30) ;
12447 l_component_type_code VARCHAR2(1) ;
12448 l_component_appl_id INTEGER ;
12449 l_amb_context_code VARCHAR2(30) ;
12450 l_ledger_language VARCHAR2(30) ;
12451 l_source VARCHAR2(1996) ;
12452 l_description VARCHAR2(2000) ;
12453 l_log_module VARCHAR2(240) ;
12454 BEGIN
12455 IF g_log_enabled THEN
12456 l_log_module := C_DEFAULT_MODULE||'.Description_123';
12457 END IF;
12458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12459 trace
12460 (p_msg => 'BEGIN of Description_123'
12461 ,p_level => C_LEVEL_PROCEDURE
12462 ,p_module => l_log_module);
12463 END IF;
12464
12465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
12466 l_component_type := 'AMB_DESCRIPTION';
12467 l_component_code := 'FA_TRANSFER';
12468 l_component_type_code := 'S';
12469 l_component_appl_id := 140;
12470 l_amb_context_code := 'DEFAULT';
12471 l_source := NULL;
12472 l_description := NULL;
12473
12474
12475
12476 IF
12477 l_ledger_language = 'US' THEN
12478 l_description := SUBSTR(CONCAT(l_description,'Transfer'),1,2000);
12479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12480 END IF;
12481 IF
12482 l_ledger_language = 'US' THEN
12483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
12484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12485 END IF;
12486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
12487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
12488 IF l_source IS NOT NULL THEN
12489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
12490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12491 END IF;
12492 l_description := SUBSTR(l_description,1,1996);
12493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12494 trace
12495 (p_msg => 'END of Description_123'
12496 ,p_level => C_LEVEL_PROCEDURE
12497 ,p_module => l_log_module);
12498
12499 END IF;
12500 RETURN l_description;
12501
12502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12503 trace
12504 (p_msg => 'END of Description_123'
12505 ,p_level => C_LEVEL_PROCEDURE
12506 ,p_module => l_log_module);
12507 END IF;
12508 RETURN NULL;
12509 EXCEPTION
12510 WHEN VALUE_ERROR THEN
12511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12512 trace
12513 (p_msg => 'ERROR: '||sqlerrm
12514 ,p_level => C_LEVEL_EXCEPTION
12515 ,p_module => l_log_module);
12516 END IF;
12517 RAISE;
12518 WHEN xla_exceptions_pkg.application_exception THEN
12519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12520 trace
12521 (p_msg => 'ERROR: '||sqlerrm
12522 ,p_level => C_LEVEL_EXCEPTION
12523 ,p_module => l_log_module);
12524 END IF;
12525 RAISE;
12526 WHEN OTHERS THEN
12530
12527 xla_exceptions_pkg.raise_message
12528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_123');
12529 END Description_123;
12531 ---------------------------------------
12532 --
12533 -- PRIVATE FUNCTION
12534 -- Description_124
12535 --
12536 ---------------------------------------
12537 FUNCTION Description_124 (
12538 p_application_id IN NUMBER
12539 , p_ae_header_id IN NUMBER DEFAULT NULL
12540 --Period Close Date
12541 , p_source_1 IN DATE
12542 )
12543 RETURN VARCHAR2
12544 IS
12545 l_component_type VARCHAR2(80) ;
12546 l_component_code VARCHAR2(30) ;
12547 l_component_type_code VARCHAR2(1) ;
12548 l_component_appl_id INTEGER ;
12549 l_amb_context_code VARCHAR2(30) ;
12550 l_ledger_language VARCHAR2(30) ;
12551 l_source VARCHAR2(1996) ;
12552 l_description VARCHAR2(2000) ;
12553 l_log_module VARCHAR2(240) ;
12554 BEGIN
12555 IF g_log_enabled THEN
12556 l_log_module := C_DEFAULT_MODULE||'.Description_124';
12557 END IF;
12558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12559 trace
12560 (p_msg => 'BEGIN of Description_124'
12561 ,p_level => C_LEVEL_PROCEDURE
12562 ,p_module => l_log_module);
12563 END IF;
12564
12565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
12566 l_component_type := 'AMB_DESCRIPTION';
12567 l_component_code := 'FA_TRANSFER_BONUS_EXP';
12568 l_component_type_code := 'S';
12569 l_component_appl_id := 140;
12570 l_amb_context_code := 'DEFAULT';
12571 l_source := NULL;
12572 l_description := NULL;
12573
12574
12575
12576 IF
12577 l_ledger_language = 'US' THEN
12578 l_description := SUBSTR(CONCAT(l_description,'Transfer Bonus Depreciation Expense'),1,2000);
12579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12580 END IF;
12581 IF
12582 l_ledger_language = 'US' THEN
12583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
12584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12585 END IF;
12586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
12587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
12588 IF l_source IS NOT NULL THEN
12589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
12590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12591 END IF;
12592 l_description := SUBSTR(l_description,1,1996);
12593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12594 trace
12595 (p_msg => 'END of Description_124'
12596 ,p_level => C_LEVEL_PROCEDURE
12597 ,p_module => l_log_module);
12598
12599 END IF;
12600 RETURN l_description;
12601
12602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12603 trace
12604 (p_msg => 'END of Description_124'
12605 ,p_level => C_LEVEL_PROCEDURE
12606 ,p_module => l_log_module);
12607 END IF;
12608 RETURN NULL;
12609 EXCEPTION
12610 WHEN VALUE_ERROR THEN
12611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12612 trace
12613 (p_msg => 'ERROR: '||sqlerrm
12614 ,p_level => C_LEVEL_EXCEPTION
12615 ,p_module => l_log_module);
12616 END IF;
12617 RAISE;
12618 WHEN xla_exceptions_pkg.application_exception THEN
12619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12620 trace
12621 (p_msg => 'ERROR: '||sqlerrm
12622 ,p_level => C_LEVEL_EXCEPTION
12623 ,p_module => l_log_module);
12624 END IF;
12625 RAISE;
12626 WHEN OTHERS THEN
12627 xla_exceptions_pkg.raise_message
12628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_124');
12629 END Description_124;
12630
12631 ---------------------------------------
12632 --
12633 -- PRIVATE FUNCTION
12634 -- Description_125
12635 --
12636 ---------------------------------------
12637 FUNCTION Description_125 (
12638 p_application_id IN NUMBER
12639 , p_ae_header_id IN NUMBER DEFAULT NULL
12640 --Period Close Date
12641 , p_source_1 IN DATE
12642 )
12643 RETURN VARCHAR2
12644 IS
12645 l_component_type VARCHAR2(80) ;
12646 l_component_code VARCHAR2(30) ;
12647 l_component_type_code VARCHAR2(1) ;
12648 l_component_appl_id INTEGER ;
12649 l_amb_context_code VARCHAR2(30) ;
12650 l_ledger_language VARCHAR2(30) ;
12651 l_source VARCHAR2(1996) ;
12652 l_description VARCHAR2(2000) ;
12653 l_log_module VARCHAR2(240) ;
12654 BEGIN
12655 IF g_log_enabled THEN
12656 l_log_module := C_DEFAULT_MODULE||'.Description_125';
12657 END IF;
12658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12659 trace
12660 (p_msg => 'BEGIN of Description_125'
12661 ,p_level => C_LEVEL_PROCEDURE
12662 ,p_module => l_log_module);
12663 END IF;
12664
12668 l_component_type_code := 'S';
12665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
12666 l_component_type := 'AMB_DESCRIPTION';
12667 l_component_code := 'FA_TRANSFER_BONUS_RESERVE';
12669 l_component_appl_id := 140;
12670 l_amb_context_code := 'DEFAULT';
12671 l_source := NULL;
12672 l_description := NULL;
12673
12674
12675
12676 IF
12677 l_ledger_language = 'US' THEN
12678 l_description := SUBSTR(CONCAT(l_description,'Transfer Bonus Reserve'),1,2000);
12679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12680 END IF;
12681 IF
12682 l_ledger_language = 'US' THEN
12683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
12684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12685 END IF;
12686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
12687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
12688 IF l_source IS NOT NULL THEN
12689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
12690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12691 END IF;
12692 l_description := SUBSTR(l_description,1,1996);
12693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12694 trace
12695 (p_msg => 'END of Description_125'
12696 ,p_level => C_LEVEL_PROCEDURE
12697 ,p_module => l_log_module);
12698
12699 END IF;
12700 RETURN l_description;
12701
12702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12703 trace
12704 (p_msg => 'END of Description_125'
12705 ,p_level => C_LEVEL_PROCEDURE
12706 ,p_module => l_log_module);
12707 END IF;
12708 RETURN NULL;
12709 EXCEPTION
12710 WHEN VALUE_ERROR THEN
12711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12712 trace
12713 (p_msg => 'ERROR: '||sqlerrm
12714 ,p_level => C_LEVEL_EXCEPTION
12715 ,p_module => l_log_module);
12716 END IF;
12717 RAISE;
12718 WHEN xla_exceptions_pkg.application_exception THEN
12719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12720 trace
12721 (p_msg => 'ERROR: '||sqlerrm
12722 ,p_level => C_LEVEL_EXCEPTION
12723 ,p_module => l_log_module);
12724 END IF;
12725 RAISE;
12726 WHEN OTHERS THEN
12727 xla_exceptions_pkg.raise_message
12728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_125');
12729 END Description_125;
12730
12731 ---------------------------------------
12732 --
12733 -- PRIVATE FUNCTION
12734 -- Description_126
12735 --
12736 ---------------------------------------
12737 FUNCTION Description_126 (
12738 p_application_id IN NUMBER
12739 , p_ae_header_id IN NUMBER DEFAULT NULL
12740 --Period Close Date
12741 , p_source_1 IN DATE
12742 )
12743 RETURN VARCHAR2
12744 IS
12745 l_component_type VARCHAR2(80) ;
12746 l_component_code VARCHAR2(30) ;
12747 l_component_type_code VARCHAR2(1) ;
12748 l_component_appl_id INTEGER ;
12749 l_amb_context_code VARCHAR2(30) ;
12750 l_ledger_language VARCHAR2(30) ;
12751 l_source VARCHAR2(1996) ;
12752 l_description VARCHAR2(2000) ;
12753 l_log_module VARCHAR2(240) ;
12754 BEGIN
12755 IF g_log_enabled THEN
12756 l_log_module := C_DEFAULT_MODULE||'.Description_126';
12757 END IF;
12758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12759 trace
12760 (p_msg => 'BEGIN of Description_126'
12761 ,p_level => C_LEVEL_PROCEDURE
12762 ,p_module => l_log_module);
12763 END IF;
12764
12765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
12766 l_component_type := 'AMB_DESCRIPTION';
12767 l_component_code := 'FA_TRANSFER_COST';
12768 l_component_type_code := 'S';
12769 l_component_appl_id := 140;
12770 l_amb_context_code := 'DEFAULT';
12771 l_source := NULL;
12772 l_description := NULL;
12773
12774
12775
12776 IF
12777 l_ledger_language = 'US' THEN
12778 l_description := SUBSTR(CONCAT(l_description,'Transfer Cost'),1,2000);
12779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12780 END IF;
12781 IF
12782 l_ledger_language = 'US' THEN
12783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
12784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12785 END IF;
12786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
12787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
12788 IF l_source IS NOT NULL THEN
12789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
12790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12791 END IF;
12792 l_description := SUBSTR(l_description,1,1996);
12793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12794 trace
12795 (p_msg => 'END of Description_126'
12796 ,p_level => C_LEVEL_PROCEDURE
12797 ,p_module => l_log_module);
12798
12799 END IF;
12800 RETURN l_description;
12801
12802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12803 trace
12807 END IF;
12804 (p_msg => 'END of Description_126'
12805 ,p_level => C_LEVEL_PROCEDURE
12806 ,p_module => l_log_module);
12808 RETURN NULL;
12809 EXCEPTION
12810 WHEN VALUE_ERROR THEN
12811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12812 trace
12813 (p_msg => 'ERROR: '||sqlerrm
12814 ,p_level => C_LEVEL_EXCEPTION
12815 ,p_module => l_log_module);
12816 END IF;
12817 RAISE;
12818 WHEN xla_exceptions_pkg.application_exception THEN
12819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12820 trace
12821 (p_msg => 'ERROR: '||sqlerrm
12822 ,p_level => C_LEVEL_EXCEPTION
12823 ,p_module => l_log_module);
12824 END IF;
12825 RAISE;
12826 WHEN OTHERS THEN
12827 xla_exceptions_pkg.raise_message
12828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_126');
12829 END Description_126;
12830
12831 ---------------------------------------
12832 --
12833 -- PRIVATE FUNCTION
12834 -- Description_127
12835 --
12836 ---------------------------------------
12837 FUNCTION Description_127 (
12838 p_application_id IN NUMBER
12839 , p_ae_header_id IN NUMBER DEFAULT NULL
12840 --Period Close Date
12841 , p_source_1 IN DATE
12842 )
12843 RETURN VARCHAR2
12844 IS
12845 l_component_type VARCHAR2(80) ;
12846 l_component_code VARCHAR2(30) ;
12847 l_component_type_code VARCHAR2(1) ;
12848 l_component_appl_id INTEGER ;
12849 l_amb_context_code VARCHAR2(30) ;
12850 l_ledger_language VARCHAR2(30) ;
12851 l_source VARCHAR2(1996) ;
12852 l_description VARCHAR2(2000) ;
12853 l_log_module VARCHAR2(240) ;
12854 BEGIN
12855 IF g_log_enabled THEN
12856 l_log_module := C_DEFAULT_MODULE||'.Description_127';
12857 END IF;
12858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12859 trace
12860 (p_msg => 'BEGIN of Description_127'
12861 ,p_level => C_LEVEL_PROCEDURE
12862 ,p_module => l_log_module);
12863 END IF;
12864
12865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
12866 l_component_type := 'AMB_DESCRIPTION';
12867 l_component_code := 'FA_TRANSFER_EXP';
12868 l_component_type_code := 'S';
12869 l_component_appl_id := 140;
12870 l_amb_context_code := 'DEFAULT';
12871 l_source := NULL;
12872 l_description := NULL;
12873
12874
12875
12876 IF
12877 l_ledger_language = 'US' THEN
12878 l_description := SUBSTR(CONCAT(l_description,'Transfer Depreciation Expense'),1,2000);
12879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12880 END IF;
12881 IF
12882 l_ledger_language = 'US' THEN
12883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
12884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12885 END IF;
12886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
12887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
12888 IF l_source IS NOT NULL THEN
12889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
12890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12891 END IF;
12892 l_description := SUBSTR(l_description,1,1996);
12893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12894 trace
12895 (p_msg => 'END of Description_127'
12896 ,p_level => C_LEVEL_PROCEDURE
12897 ,p_module => l_log_module);
12898
12899 END IF;
12900 RETURN l_description;
12901
12902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12903 trace
12904 (p_msg => 'END of Description_127'
12905 ,p_level => C_LEVEL_PROCEDURE
12906 ,p_module => l_log_module);
12907 END IF;
12908 RETURN NULL;
12909 EXCEPTION
12910 WHEN VALUE_ERROR THEN
12911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12912 trace
12913 (p_msg => 'ERROR: '||sqlerrm
12914 ,p_level => C_LEVEL_EXCEPTION
12915 ,p_module => l_log_module);
12916 END IF;
12917 RAISE;
12918 WHEN xla_exceptions_pkg.application_exception THEN
12919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
12920 trace
12921 (p_msg => 'ERROR: '||sqlerrm
12922 ,p_level => C_LEVEL_EXCEPTION
12923 ,p_module => l_log_module);
12924 END IF;
12925 RAISE;
12926 WHEN OTHERS THEN
12927 xla_exceptions_pkg.raise_message
12928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_127');
12929 END Description_127;
12930
12931 ---------------------------------------
12932 --
12933 -- PRIVATE FUNCTION
12934 -- Description_128
12935 --
12936 ---------------------------------------
12937 FUNCTION Description_128 (
12938 p_application_id IN NUMBER
12939 , p_ae_header_id IN NUMBER DEFAULT NULL
12940 --Period Close Date
12941 , p_source_1 IN DATE
12942 )
12943 RETURN VARCHAR2
12944 IS
12945 l_component_type VARCHAR2(80) ;
12946 l_component_code VARCHAR2(30) ;
12950 l_ledger_language VARCHAR2(30) ;
12947 l_component_type_code VARCHAR2(1) ;
12948 l_component_appl_id INTEGER ;
12949 l_amb_context_code VARCHAR2(30) ;
12951 l_source VARCHAR2(1996) ;
12952 l_description VARCHAR2(2000) ;
12953 l_log_module VARCHAR2(240) ;
12954 BEGIN
12955 IF g_log_enabled THEN
12956 l_log_module := C_DEFAULT_MODULE||'.Description_128';
12957 END IF;
12958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12959 trace
12960 (p_msg => 'BEGIN of Description_128'
12961 ,p_level => C_LEVEL_PROCEDURE
12962 ,p_module => l_log_module);
12963 END IF;
12964
12965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
12966 l_component_type := 'AMB_DESCRIPTION';
12967 l_component_code := 'FA_TRANSFER_IC_PAYABLE';
12968 l_component_type_code := 'S';
12969 l_component_appl_id := 140;
12970 l_amb_context_code := 'DEFAULT';
12971 l_source := NULL;
12972 l_description := NULL;
12973
12974
12975
12976 IF
12977 l_ledger_language = 'US' THEN
12978 l_description := SUBSTR(CONCAT(l_description,'Transfer Intercompany AP'),1,2000);
12979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12980 END IF;
12981 IF
12982 l_ledger_language = 'US' THEN
12983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
12984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12985 END IF;
12986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
12987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
12988 IF l_source IS NOT NULL THEN
12989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
12990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
12991 END IF;
12992 l_description := SUBSTR(l_description,1,1996);
12993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
12994 trace
12995 (p_msg => 'END of Description_128'
12996 ,p_level => C_LEVEL_PROCEDURE
12997 ,p_module => l_log_module);
12998
12999 END IF;
13000 RETURN l_description;
13001
13002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13003 trace
13004 (p_msg => 'END of Description_128'
13005 ,p_level => C_LEVEL_PROCEDURE
13006 ,p_module => l_log_module);
13007 END IF;
13008 RETURN NULL;
13009 EXCEPTION
13010 WHEN VALUE_ERROR THEN
13011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13012 trace
13013 (p_msg => 'ERROR: '||sqlerrm
13014 ,p_level => C_LEVEL_EXCEPTION
13015 ,p_module => l_log_module);
13016 END IF;
13017 RAISE;
13018 WHEN xla_exceptions_pkg.application_exception THEN
13019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13020 trace
13021 (p_msg => 'ERROR: '||sqlerrm
13022 ,p_level => C_LEVEL_EXCEPTION
13023 ,p_module => l_log_module);
13024 END IF;
13025 RAISE;
13026 WHEN OTHERS THEN
13027 xla_exceptions_pkg.raise_message
13028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_128');
13029 END Description_128;
13030
13031 ---------------------------------------
13032 --
13033 -- PRIVATE FUNCTION
13034 -- Description_129
13035 --
13036 ---------------------------------------
13037 FUNCTION Description_129 (
13038 p_application_id IN NUMBER
13039 , p_ae_header_id IN NUMBER DEFAULT NULL
13040 --Period Close Date
13041 , p_source_1 IN DATE
13042 )
13043 RETURN VARCHAR2
13044 IS
13045 l_component_type VARCHAR2(80) ;
13046 l_component_code VARCHAR2(30) ;
13047 l_component_type_code VARCHAR2(1) ;
13048 l_component_appl_id INTEGER ;
13049 l_amb_context_code VARCHAR2(30) ;
13050 l_ledger_language VARCHAR2(30) ;
13051 l_source VARCHAR2(1996) ;
13052 l_description VARCHAR2(2000) ;
13053 l_log_module VARCHAR2(240) ;
13054 BEGIN
13055 IF g_log_enabled THEN
13056 l_log_module := C_DEFAULT_MODULE||'.Description_129';
13057 END IF;
13058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13059 trace
13060 (p_msg => 'BEGIN of Description_129'
13061 ,p_level => C_LEVEL_PROCEDURE
13062 ,p_module => l_log_module);
13063 END IF;
13064
13065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
13066 l_component_type := 'AMB_DESCRIPTION';
13067 l_component_code := 'FA_TRANSFER_IC_RECEIVABLE';
13068 l_component_type_code := 'S';
13069 l_component_appl_id := 140;
13070 l_amb_context_code := 'DEFAULT';
13071 l_source := NULL;
13072 l_description := NULL;
13073
13074
13075
13076 IF
13077 l_ledger_language = 'US' THEN
13078 l_description := SUBSTR(CONCAT(l_description,'Transfer Intercompany AR'),1,2000);
13079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13080 END IF;
13081 IF
13082 l_ledger_language = 'US' THEN
13083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
13087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
13084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13085 END IF;
13086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
13088 IF l_source IS NOT NULL THEN
13089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
13090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13091 END IF;
13092 l_description := SUBSTR(l_description,1,1996);
13093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13094 trace
13095 (p_msg => 'END of Description_129'
13096 ,p_level => C_LEVEL_PROCEDURE
13097 ,p_module => l_log_module);
13098
13099 END IF;
13100 RETURN l_description;
13101
13102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13103 trace
13104 (p_msg => 'END of Description_129'
13105 ,p_level => C_LEVEL_PROCEDURE
13106 ,p_module => l_log_module);
13107 END IF;
13108 RETURN NULL;
13109 EXCEPTION
13110 WHEN VALUE_ERROR THEN
13111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13112 trace
13113 (p_msg => 'ERROR: '||sqlerrm
13114 ,p_level => C_LEVEL_EXCEPTION
13115 ,p_module => l_log_module);
13116 END IF;
13117 RAISE;
13118 WHEN xla_exceptions_pkg.application_exception THEN
13119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13120 trace
13121 (p_msg => 'ERROR: '||sqlerrm
13122 ,p_level => C_LEVEL_EXCEPTION
13123 ,p_module => l_log_module);
13124 END IF;
13125 RAISE;
13126 WHEN OTHERS THEN
13127 xla_exceptions_pkg.raise_message
13128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_129');
13129 END Description_129;
13130
13131 ---------------------------------------
13132 --
13133 -- PRIVATE FUNCTION
13134 -- Description_130
13135 --
13136 ---------------------------------------
13137 FUNCTION Description_130 (
13138 p_application_id IN NUMBER
13139 , p_ae_header_id IN NUMBER DEFAULT NULL
13140 --Period Close Date
13141 , p_source_1 IN DATE
13142 )
13143 RETURN VARCHAR2
13144 IS
13145 l_component_type VARCHAR2(80) ;
13146 l_component_code VARCHAR2(30) ;
13147 l_component_type_code VARCHAR2(1) ;
13148 l_component_appl_id INTEGER ;
13149 l_amb_context_code VARCHAR2(30) ;
13150 l_ledger_language VARCHAR2(30) ;
13151 l_source VARCHAR2(1996) ;
13152 l_description VARCHAR2(2000) ;
13153 l_log_module VARCHAR2(240) ;
13154 BEGIN
13155 IF g_log_enabled THEN
13156 l_log_module := C_DEFAULT_MODULE||'.Description_130';
13157 END IF;
13158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13159 trace
13160 (p_msg => 'BEGIN of Description_130'
13161 ,p_level => C_LEVEL_PROCEDURE
13162 ,p_module => l_log_module);
13163 END IF;
13164
13165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
13166 l_component_type := 'AMB_DESCRIPTION';
13167 l_component_code := 'FA_TRANSFER_RESERVE';
13168 l_component_type_code := 'S';
13169 l_component_appl_id := 140;
13170 l_amb_context_code := 'DEFAULT';
13171 l_source := NULL;
13172 l_description := NULL;
13173
13174
13175
13176 IF
13177 l_ledger_language = 'US' THEN
13178 l_description := SUBSTR(CONCAT(l_description,'Transfer Reserve'),1,2000);
13179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13180 END IF;
13181 IF
13182 l_ledger_language = 'US' THEN
13183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
13184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13185 END IF;
13186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
13187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
13188 IF l_source IS NOT NULL THEN
13189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
13190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13191 END IF;
13192 l_description := SUBSTR(l_description,1,1996);
13193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13194 trace
13195 (p_msg => 'END of Description_130'
13196 ,p_level => C_LEVEL_PROCEDURE
13197 ,p_module => l_log_module);
13198
13199 END IF;
13200 RETURN l_description;
13201
13202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13203 trace
13204 (p_msg => 'END of Description_130'
13205 ,p_level => C_LEVEL_PROCEDURE
13206 ,p_module => l_log_module);
13207 END IF;
13208 RETURN NULL;
13209 EXCEPTION
13210 WHEN VALUE_ERROR THEN
13211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13212 trace
13213 (p_msg => 'ERROR: '||sqlerrm
13214 ,p_level => C_LEVEL_EXCEPTION
13215 ,p_module => l_log_module);
13216 END IF;
13217 RAISE;
13218 WHEN xla_exceptions_pkg.application_exception THEN
13222 ,p_level => C_LEVEL_EXCEPTION
13219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13220 trace
13221 (p_msg => 'ERROR: '||sqlerrm
13223 ,p_module => l_log_module);
13224 END IF;
13225 RAISE;
13226 WHEN OTHERS THEN
13227 xla_exceptions_pkg.raise_message
13228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_130');
13229 END Description_130;
13230
13231 ---------------------------------------
13232 --
13233 -- PRIVATE FUNCTION
13234 -- Description_131
13235 --
13236 ---------------------------------------
13237 FUNCTION Description_131 (
13238 p_application_id IN NUMBER
13239 , p_ae_header_id IN NUMBER DEFAULT NULL
13240 --Period Close Date
13241 , p_source_1 IN DATE
13242 )
13243 RETURN VARCHAR2
13244 IS
13245 l_component_type VARCHAR2(80) ;
13246 l_component_code VARCHAR2(30) ;
13247 l_component_type_code VARCHAR2(1) ;
13248 l_component_appl_id INTEGER ;
13249 l_amb_context_code VARCHAR2(30) ;
13250 l_ledger_language VARCHAR2(30) ;
13251 l_source VARCHAR2(1996) ;
13252 l_description VARCHAR2(2000) ;
13253 l_log_module VARCHAR2(240) ;
13254 BEGIN
13255 IF g_log_enabled THEN
13256 l_log_module := C_DEFAULT_MODULE||'.Description_131';
13257 END IF;
13258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13259 trace
13260 (p_msg => 'BEGIN of Description_131'
13261 ,p_level => C_LEVEL_PROCEDURE
13262 ,p_module => l_log_module);
13263 END IF;
13264
13265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
13266 l_component_type := 'AMB_DESCRIPTION';
13267 l_component_code := 'FA_TRANSFER_REVAL_RESERVE';
13268 l_component_type_code := 'S';
13269 l_component_appl_id := 140;
13270 l_amb_context_code := 'DEFAULT';
13271 l_source := NULL;
13272 l_description := NULL;
13273
13274
13275
13276 IF
13277 l_ledger_language = 'US' THEN
13278 l_description := SUBSTR(CONCAT(l_description,'Transfer Revaluation Reserve'),1,2000);
13279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13280 END IF;
13281 IF
13282 l_ledger_language = 'US' THEN
13283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
13284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13285 END IF;
13286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
13287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
13288 IF l_source IS NOT NULL THEN
13289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
13290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13291 END IF;
13292 l_description := SUBSTR(l_description,1,1996);
13293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13294 trace
13295 (p_msg => 'END of Description_131'
13296 ,p_level => C_LEVEL_PROCEDURE
13297 ,p_module => l_log_module);
13298
13299 END IF;
13300 RETURN l_description;
13301
13302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13303 trace
13304 (p_msg => 'END of Description_131'
13305 ,p_level => C_LEVEL_PROCEDURE
13306 ,p_module => l_log_module);
13307 END IF;
13308 RETURN NULL;
13309 EXCEPTION
13310 WHEN VALUE_ERROR THEN
13311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13312 trace
13313 (p_msg => 'ERROR: '||sqlerrm
13314 ,p_level => C_LEVEL_EXCEPTION
13315 ,p_module => l_log_module);
13316 END IF;
13317 RAISE;
13318 WHEN xla_exceptions_pkg.application_exception THEN
13319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13320 trace
13321 (p_msg => 'ERROR: '||sqlerrm
13322 ,p_level => C_LEVEL_EXCEPTION
13323 ,p_module => l_log_module);
13324 END IF;
13325 RAISE;
13326 WHEN OTHERS THEN
13327 xla_exceptions_pkg.raise_message
13328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_131');
13329 END Description_131;
13330
13331 ---------------------------------------
13332 --
13333 -- PRIVATE FUNCTION
13334 -- Description_132
13335 --
13336 ---------------------------------------
13337 FUNCTION Description_132 (
13338 p_application_id IN NUMBER
13339 , p_ae_header_id IN NUMBER DEFAULT NULL
13340 --Period Close Date
13341 , p_source_1 IN DATE
13342 )
13343 RETURN VARCHAR2
13344 IS
13345 l_component_type VARCHAR2(80) ;
13346 l_component_code VARCHAR2(30) ;
13347 l_component_type_code VARCHAR2(1) ;
13348 l_component_appl_id INTEGER ;
13349 l_amb_context_code VARCHAR2(30) ;
13350 l_ledger_language VARCHAR2(30) ;
13351 l_source VARCHAR2(1996) ;
13352 l_description VARCHAR2(2000) ;
13353 l_log_module VARCHAR2(240) ;
13354 BEGIN
13355 IF g_log_enabled THEN
13356 l_log_module := C_DEFAULT_MODULE||'.Description_132';
13357 END IF;
13358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13359 trace
13363 END IF;
13360 (p_msg => 'BEGIN of Description_132'
13361 ,p_level => C_LEVEL_PROCEDURE
13362 ,p_module => l_log_module);
13364
13365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
13366 l_component_type := 'AMB_DESCRIPTION';
13367 l_component_code := 'FA_UNITADJ_BONUS_RESERVE';
13368 l_component_type_code := 'S';
13369 l_component_appl_id := 140;
13370 l_amb_context_code := 'DEFAULT';
13371 l_source := NULL;
13372 l_description := NULL;
13373
13374
13375
13376 IF
13377 l_ledger_language = 'US' THEN
13378 l_description := SUBSTR(CONCAT(l_description,'Unit Adjustment Bonus Reserve'),1,2000);
13379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13380 END IF;
13381 IF
13382 l_ledger_language = 'US' THEN
13383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
13384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13385 END IF;
13386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
13387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
13388 IF l_source IS NOT NULL THEN
13389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
13390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13391 END IF;
13392 l_description := SUBSTR(l_description,1,1996);
13393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13394 trace
13395 (p_msg => 'END of Description_132'
13396 ,p_level => C_LEVEL_PROCEDURE
13397 ,p_module => l_log_module);
13398
13399 END IF;
13400 RETURN l_description;
13401
13402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13403 trace
13404 (p_msg => 'END of Description_132'
13405 ,p_level => C_LEVEL_PROCEDURE
13406 ,p_module => l_log_module);
13407 END IF;
13408 RETURN NULL;
13409 EXCEPTION
13410 WHEN VALUE_ERROR THEN
13411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13412 trace
13413 (p_msg => 'ERROR: '||sqlerrm
13414 ,p_level => C_LEVEL_EXCEPTION
13415 ,p_module => l_log_module);
13416 END IF;
13417 RAISE;
13418 WHEN xla_exceptions_pkg.application_exception THEN
13419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13420 trace
13421 (p_msg => 'ERROR: '||sqlerrm
13422 ,p_level => C_LEVEL_EXCEPTION
13423 ,p_module => l_log_module);
13424 END IF;
13425 RAISE;
13426 WHEN OTHERS THEN
13427 xla_exceptions_pkg.raise_message
13428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_132');
13429 END Description_132;
13430
13431 ---------------------------------------
13432 --
13433 -- PRIVATE FUNCTION
13434 -- Description_133
13435 --
13436 ---------------------------------------
13437 FUNCTION Description_133 (
13438 p_application_id IN NUMBER
13439 , p_ae_header_id IN NUMBER DEFAULT NULL
13440 --Period Close Date
13441 , p_source_1 IN DATE
13442 )
13443 RETURN VARCHAR2
13444 IS
13445 l_component_type VARCHAR2(80) ;
13446 l_component_code VARCHAR2(30) ;
13447 l_component_type_code VARCHAR2(1) ;
13448 l_component_appl_id INTEGER ;
13449 l_amb_context_code VARCHAR2(30) ;
13450 l_ledger_language VARCHAR2(30) ;
13451 l_source VARCHAR2(1996) ;
13452 l_description VARCHAR2(2000) ;
13453 l_log_module VARCHAR2(240) ;
13454 BEGIN
13455 IF g_log_enabled THEN
13456 l_log_module := C_DEFAULT_MODULE||'.Description_133';
13457 END IF;
13458 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13459 trace
13460 (p_msg => 'BEGIN of Description_133'
13461 ,p_level => C_LEVEL_PROCEDURE
13462 ,p_module => l_log_module);
13463 END IF;
13464
13465 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
13466 l_component_type := 'AMB_DESCRIPTION';
13467 l_component_code := 'FA_UNITADJ_COST';
13468 l_component_type_code := 'S';
13469 l_component_appl_id := 140;
13470 l_amb_context_code := 'DEFAULT';
13471 l_source := NULL;
13472 l_description := NULL;
13473
13474
13475
13476 IF
13477 l_ledger_language = 'US' THEN
13478 l_description := SUBSTR(CONCAT(l_description,'Unit Adjustment Cost'),1,2000);
13479 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13480 END IF;
13481 IF
13482 l_ledger_language = 'US' THEN
13483 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
13484 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13485 END IF;
13486 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
13487 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
13488 IF l_source IS NOT NULL THEN
13489 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
13490 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13491 END IF;
13492 l_description := SUBSTR(l_description,1,1996);
13496 ,p_level => C_LEVEL_PROCEDURE
13493 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13494 trace
13495 (p_msg => 'END of Description_133'
13497 ,p_module => l_log_module);
13498
13499 END IF;
13500 RETURN l_description;
13501
13502 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13503 trace
13504 (p_msg => 'END of Description_133'
13505 ,p_level => C_LEVEL_PROCEDURE
13506 ,p_module => l_log_module);
13507 END IF;
13508 RETURN NULL;
13509 EXCEPTION
13510 WHEN VALUE_ERROR THEN
13511 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13512 trace
13513 (p_msg => 'ERROR: '||sqlerrm
13514 ,p_level => C_LEVEL_EXCEPTION
13515 ,p_module => l_log_module);
13516 END IF;
13517 RAISE;
13518 WHEN xla_exceptions_pkg.application_exception THEN
13519 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13520 trace
13521 (p_msg => 'ERROR: '||sqlerrm
13522 ,p_level => C_LEVEL_EXCEPTION
13523 ,p_module => l_log_module);
13524 END IF;
13525 RAISE;
13526 WHEN OTHERS THEN
13527 xla_exceptions_pkg.raise_message
13528 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_133');
13529 END Description_133;
13530
13531 ---------------------------------------
13532 --
13533 -- PRIVATE FUNCTION
13534 -- Description_134
13535 --
13536 ---------------------------------------
13537 FUNCTION Description_134 (
13538 p_application_id IN NUMBER
13539 , p_ae_header_id IN NUMBER DEFAULT NULL
13540 --Period Close Date
13541 , p_source_1 IN DATE
13542 )
13543 RETURN VARCHAR2
13544 IS
13545 l_component_type VARCHAR2(80) ;
13546 l_component_code VARCHAR2(30) ;
13547 l_component_type_code VARCHAR2(1) ;
13548 l_component_appl_id INTEGER ;
13549 l_amb_context_code VARCHAR2(30) ;
13550 l_ledger_language VARCHAR2(30) ;
13551 l_source VARCHAR2(1996) ;
13552 l_description VARCHAR2(2000) ;
13553 l_log_module VARCHAR2(240) ;
13554 BEGIN
13555 IF g_log_enabled THEN
13556 l_log_module := C_DEFAULT_MODULE||'.Description_134';
13557 END IF;
13558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13559 trace
13560 (p_msg => 'BEGIN of Description_134'
13561 ,p_level => C_LEVEL_PROCEDURE
13562 ,p_module => l_log_module);
13563 END IF;
13564
13565 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
13566 l_component_type := 'AMB_DESCRIPTION';
13567 l_component_code := 'FA_UNITADJ_EXP';
13568 l_component_type_code := 'S';
13569 l_component_appl_id := 140;
13570 l_amb_context_code := 'DEFAULT';
13571 l_source := NULL;
13572 l_description := NULL;
13573
13574
13575
13576 IF
13577 l_ledger_language = 'US' THEN
13578 l_description := SUBSTR(CONCAT(l_description,'Unit Adjustment Depreciation Expense'),1,2000);
13579 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13580 END IF;
13581 IF
13582 l_ledger_language = 'US' THEN
13583 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
13584 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13585 END IF;
13586 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
13587 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
13588 IF l_source IS NOT NULL THEN
13589 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
13590 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13591 END IF;
13592 l_description := SUBSTR(l_description,1,1996);
13593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13594 trace
13595 (p_msg => 'END of Description_134'
13596 ,p_level => C_LEVEL_PROCEDURE
13597 ,p_module => l_log_module);
13598
13599 END IF;
13600 RETURN l_description;
13601
13602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13603 trace
13604 (p_msg => 'END of Description_134'
13605 ,p_level => C_LEVEL_PROCEDURE
13606 ,p_module => l_log_module);
13607 END IF;
13608 RETURN NULL;
13609 EXCEPTION
13610 WHEN VALUE_ERROR THEN
13611 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13612 trace
13613 (p_msg => 'ERROR: '||sqlerrm
13614 ,p_level => C_LEVEL_EXCEPTION
13615 ,p_module => l_log_module);
13616 END IF;
13617 RAISE;
13618 WHEN xla_exceptions_pkg.application_exception THEN
13619 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13620 trace
13621 (p_msg => 'ERROR: '||sqlerrm
13622 ,p_level => C_LEVEL_EXCEPTION
13623 ,p_module => l_log_module);
13624 END IF;
13625 RAISE;
13626 WHEN OTHERS THEN
13627 xla_exceptions_pkg.raise_message
13628 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_134');
13629 END Description_134;
13630
13631 ---------------------------------------
13632 --
13633 -- PRIVATE FUNCTION
13637 FUNCTION Description_135 (
13634 -- Description_135
13635 --
13636 ---------------------------------------
13638 p_application_id IN NUMBER
13639 , p_ae_header_id IN NUMBER DEFAULT NULL
13640 --Period Close Date
13641 , p_source_1 IN DATE
13642 )
13643 RETURN VARCHAR2
13644 IS
13645 l_component_type VARCHAR2(80) ;
13646 l_component_code VARCHAR2(30) ;
13647 l_component_type_code VARCHAR2(1) ;
13648 l_component_appl_id INTEGER ;
13649 l_amb_context_code VARCHAR2(30) ;
13650 l_ledger_language VARCHAR2(30) ;
13651 l_source VARCHAR2(1996) ;
13652 l_description VARCHAR2(2000) ;
13653 l_log_module VARCHAR2(240) ;
13654 BEGIN
13655 IF g_log_enabled THEN
13656 l_log_module := C_DEFAULT_MODULE||'.Description_135';
13657 END IF;
13658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13659 trace
13660 (p_msg => 'BEGIN of Description_135'
13661 ,p_level => C_LEVEL_PROCEDURE
13662 ,p_module => l_log_module);
13663 END IF;
13664
13665 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
13666 l_component_type := 'AMB_DESCRIPTION';
13667 l_component_code := 'FA_UNITADJ_IC_PAYABLE';
13668 l_component_type_code := 'S';
13669 l_component_appl_id := 140;
13670 l_amb_context_code := 'DEFAULT';
13671 l_source := NULL;
13672 l_description := NULL;
13673
13674
13675
13676 IF
13677 l_ledger_language = 'US' THEN
13678 l_description := SUBSTR(CONCAT(l_description,'Unit Adjustment Intercompany AP'),1,2000);
13679 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13680 END IF;
13681 IF
13682 l_ledger_language = 'US' THEN
13683 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
13684 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13685 END IF;
13686 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
13687 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
13688 IF l_source IS NOT NULL THEN
13689 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
13690 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13691 END IF;
13692 l_description := SUBSTR(l_description,1,1996);
13693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13694 trace
13695 (p_msg => 'END of Description_135'
13696 ,p_level => C_LEVEL_PROCEDURE
13697 ,p_module => l_log_module);
13698
13699 END IF;
13700 RETURN l_description;
13701
13702 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13703 trace
13704 (p_msg => 'END of Description_135'
13705 ,p_level => C_LEVEL_PROCEDURE
13706 ,p_module => l_log_module);
13707 END IF;
13708 RETURN NULL;
13709 EXCEPTION
13710 WHEN VALUE_ERROR THEN
13711 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13712 trace
13713 (p_msg => 'ERROR: '||sqlerrm
13714 ,p_level => C_LEVEL_EXCEPTION
13715 ,p_module => l_log_module);
13716 END IF;
13717 RAISE;
13718 WHEN xla_exceptions_pkg.application_exception THEN
13719 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13720 trace
13721 (p_msg => 'ERROR: '||sqlerrm
13722 ,p_level => C_LEVEL_EXCEPTION
13723 ,p_module => l_log_module);
13724 END IF;
13725 RAISE;
13726 WHEN OTHERS THEN
13727 xla_exceptions_pkg.raise_message
13728 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_135');
13729 END Description_135;
13730
13731 ---------------------------------------
13732 --
13733 -- PRIVATE FUNCTION
13734 -- Description_136
13735 --
13736 ---------------------------------------
13737 FUNCTION Description_136 (
13738 p_application_id IN NUMBER
13739 , p_ae_header_id IN NUMBER DEFAULT NULL
13740 --Period Close Date
13741 , p_source_1 IN DATE
13742 )
13743 RETURN VARCHAR2
13744 IS
13745 l_component_type VARCHAR2(80) ;
13746 l_component_code VARCHAR2(30) ;
13747 l_component_type_code VARCHAR2(1) ;
13748 l_component_appl_id INTEGER ;
13749 l_amb_context_code VARCHAR2(30) ;
13750 l_ledger_language VARCHAR2(30) ;
13751 l_source VARCHAR2(1996) ;
13752 l_description VARCHAR2(2000) ;
13753 l_log_module VARCHAR2(240) ;
13754 BEGIN
13755 IF g_log_enabled THEN
13756 l_log_module := C_DEFAULT_MODULE||'.Description_136';
13757 END IF;
13758 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13759 trace
13760 (p_msg => 'BEGIN of Description_136'
13761 ,p_level => C_LEVEL_PROCEDURE
13762 ,p_module => l_log_module);
13763 END IF;
13764
13765 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
13766 l_component_type := 'AMB_DESCRIPTION';
13767 l_component_code := 'FA_UNITADJ_IC_RECEIVABLE';
13768 l_component_type_code := 'S';
13769 l_component_appl_id := 140;
13770 l_amb_context_code := 'DEFAULT';
13771 l_source := NULL;
13775
13772 l_description := NULL;
13773
13774
13776 IF
13777 l_ledger_language = 'US' THEN
13778 l_description := SUBSTR(CONCAT(l_description,'Unit Adjustment Intercompany AR'),1,2000);
13779 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13780 END IF;
13781 IF
13782 l_ledger_language = 'US' THEN
13783 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
13784 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13785 END IF;
13786 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
13787 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
13788 IF l_source IS NOT NULL THEN
13789 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
13790 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13791 END IF;
13792 l_description := SUBSTR(l_description,1,1996);
13793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13794 trace
13795 (p_msg => 'END of Description_136'
13796 ,p_level => C_LEVEL_PROCEDURE
13797 ,p_module => l_log_module);
13798
13799 END IF;
13800 RETURN l_description;
13801
13802 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13803 trace
13804 (p_msg => 'END of Description_136'
13805 ,p_level => C_LEVEL_PROCEDURE
13806 ,p_module => l_log_module);
13807 END IF;
13808 RETURN NULL;
13809 EXCEPTION
13810 WHEN VALUE_ERROR THEN
13811 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13812 trace
13813 (p_msg => 'ERROR: '||sqlerrm
13814 ,p_level => C_LEVEL_EXCEPTION
13815 ,p_module => l_log_module);
13816 END IF;
13817 RAISE;
13818 WHEN xla_exceptions_pkg.application_exception THEN
13819 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13820 trace
13821 (p_msg => 'ERROR: '||sqlerrm
13822 ,p_level => C_LEVEL_EXCEPTION
13823 ,p_module => l_log_module);
13824 END IF;
13825 RAISE;
13826 WHEN OTHERS THEN
13827 xla_exceptions_pkg.raise_message
13828 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_136');
13829 END Description_136;
13830
13831 ---------------------------------------
13832 --
13833 -- PRIVATE FUNCTION
13834 -- Description_137
13835 --
13836 ---------------------------------------
13837 FUNCTION Description_137 (
13838 p_application_id IN NUMBER
13839 , p_ae_header_id IN NUMBER DEFAULT NULL
13840 --Period Close Date
13841 , p_source_1 IN DATE
13842 )
13843 RETURN VARCHAR2
13844 IS
13845 l_component_type VARCHAR2(80) ;
13846 l_component_code VARCHAR2(30) ;
13847 l_component_type_code VARCHAR2(1) ;
13848 l_component_appl_id INTEGER ;
13849 l_amb_context_code VARCHAR2(30) ;
13850 l_ledger_language VARCHAR2(30) ;
13851 l_source VARCHAR2(1996) ;
13852 l_description VARCHAR2(2000) ;
13853 l_log_module VARCHAR2(240) ;
13854 BEGIN
13855 IF g_log_enabled THEN
13856 l_log_module := C_DEFAULT_MODULE||'.Description_137';
13857 END IF;
13858 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13859 trace
13860 (p_msg => 'BEGIN of Description_137'
13861 ,p_level => C_LEVEL_PROCEDURE
13862 ,p_module => l_log_module);
13863 END IF;
13864
13865 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
13866 l_component_type := 'AMB_DESCRIPTION';
13867 l_component_code := 'FA_UNITADJ_RESERVE';
13868 l_component_type_code := 'S';
13869 l_component_appl_id := 140;
13870 l_amb_context_code := 'DEFAULT';
13871 l_source := NULL;
13872 l_description := NULL;
13873
13874
13875
13876 IF
13877 l_ledger_language = 'US' THEN
13878 l_description := SUBSTR(CONCAT(l_description,'Unit Adjustment Reserve'),1,2000);
13879 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13880 END IF;
13881 IF
13882 l_ledger_language = 'US' THEN
13883 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
13884 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13885 END IF;
13886 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
13887 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
13888 IF l_source IS NOT NULL THEN
13889 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
13890 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13891 END IF;
13892 l_description := SUBSTR(l_description,1,1996);
13893 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13894 trace
13895 (p_msg => 'END of Description_137'
13896 ,p_level => C_LEVEL_PROCEDURE
13897 ,p_module => l_log_module);
13898
13899 END IF;
13900 RETURN l_description;
13901
13902 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13903 trace
13904 (p_msg => 'END of Description_137'
13905 ,p_level => C_LEVEL_PROCEDURE
13906 ,p_module => l_log_module);
13907 END IF;
13908 RETURN NULL;
13909 EXCEPTION
13913 (p_msg => 'ERROR: '||sqlerrm
13910 WHEN VALUE_ERROR THEN
13911 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13912 trace
13914 ,p_level => C_LEVEL_EXCEPTION
13915 ,p_module => l_log_module);
13916 END IF;
13917 RAISE;
13918 WHEN xla_exceptions_pkg.application_exception THEN
13919 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
13920 trace
13921 (p_msg => 'ERROR: '||sqlerrm
13922 ,p_level => C_LEVEL_EXCEPTION
13923 ,p_module => l_log_module);
13924 END IF;
13925 RAISE;
13926 WHEN OTHERS THEN
13927 xla_exceptions_pkg.raise_message
13928 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_137');
13929 END Description_137;
13930
13931 ---------------------------------------
13932 --
13933 -- PRIVATE FUNCTION
13934 -- Description_138
13935 --
13936 ---------------------------------------
13937 FUNCTION Description_138 (
13938 p_application_id IN NUMBER
13939 , p_ae_header_id IN NUMBER DEFAULT NULL
13940 --Period Close Date
13941 , p_source_1 IN DATE
13942 )
13943 RETURN VARCHAR2
13944 IS
13945 l_component_type VARCHAR2(80) ;
13946 l_component_code VARCHAR2(30) ;
13947 l_component_type_code VARCHAR2(1) ;
13948 l_component_appl_id INTEGER ;
13949 l_amb_context_code VARCHAR2(30) ;
13950 l_ledger_language VARCHAR2(30) ;
13951 l_source VARCHAR2(1996) ;
13952 l_description VARCHAR2(2000) ;
13953 l_log_module VARCHAR2(240) ;
13954 BEGIN
13955 IF g_log_enabled THEN
13956 l_log_module := C_DEFAULT_MODULE||'.Description_138';
13957 END IF;
13958 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13959 trace
13960 (p_msg => 'BEGIN of Description_138'
13961 ,p_level => C_LEVEL_PROCEDURE
13962 ,p_module => l_log_module);
13963 END IF;
13964
13965 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
13966 l_component_type := 'AMB_DESCRIPTION';
13967 l_component_code := 'FA_UNITADJ_REVAL_RESERVE';
13968 l_component_type_code := 'S';
13969 l_component_appl_id := 140;
13970 l_amb_context_code := 'DEFAULT';
13971 l_source := NULL;
13972 l_description := NULL;
13973
13974
13975
13976 IF
13977 l_ledger_language = 'US' THEN
13978 l_description := SUBSTR(CONCAT(l_description,'Unit Adjustment Revaluation Reserve'),1,2000);
13979 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13980 END IF;
13981 IF
13982 l_ledger_language = 'US' THEN
13983 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
13984 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13985 END IF;
13986 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
13987 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
13988 IF l_source IS NOT NULL THEN
13989 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
13990 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
13991 END IF;
13992 l_description := SUBSTR(l_description,1,1996);
13993 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
13994 trace
13995 (p_msg => 'END of Description_138'
13996 ,p_level => C_LEVEL_PROCEDURE
13997 ,p_module => l_log_module);
13998
13999 END IF;
14000 RETURN l_description;
14001
14002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14003 trace
14004 (p_msg => 'END of Description_138'
14005 ,p_level => C_LEVEL_PROCEDURE
14006 ,p_module => l_log_module);
14007 END IF;
14008 RETURN NULL;
14009 EXCEPTION
14010 WHEN VALUE_ERROR THEN
14011 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14012 trace
14013 (p_msg => 'ERROR: '||sqlerrm
14014 ,p_level => C_LEVEL_EXCEPTION
14015 ,p_module => l_log_module);
14016 END IF;
14017 RAISE;
14018 WHEN xla_exceptions_pkg.application_exception THEN
14019 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14020 trace
14021 (p_msg => 'ERROR: '||sqlerrm
14022 ,p_level => C_LEVEL_EXCEPTION
14023 ,p_module => l_log_module);
14024 END IF;
14025 RAISE;
14026 WHEN OTHERS THEN
14027 xla_exceptions_pkg.raise_message
14028 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_138');
14029 END Description_138;
14030
14031 ---------------------------------------
14032 --
14033 -- PRIVATE FUNCTION
14034 -- Description_139
14035 --
14036 ---------------------------------------
14037 FUNCTION Description_139 (
14038 p_application_id IN NUMBER
14039 , p_ae_header_id IN NUMBER DEFAULT NULL
14040 --Period Close Date
14041 , p_source_1 IN DATE
14042 )
14043 RETURN VARCHAR2
14044 IS
14045 l_component_type VARCHAR2(80) ;
14046 l_component_code VARCHAR2(30) ;
14047 l_component_type_code VARCHAR2(1) ;
14048 l_component_appl_id INTEGER ;
14049 l_amb_context_code VARCHAR2(30) ;
14050 l_ledger_language VARCHAR2(30) ;
14051 l_source VARCHAR2(1996) ;
14055 IF g_log_enabled THEN
14052 l_description VARCHAR2(2000) ;
14053 l_log_module VARCHAR2(240) ;
14054 BEGIN
14056 l_log_module := C_DEFAULT_MODULE||'.Description_139';
14057 END IF;
14058 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14059 trace
14060 (p_msg => 'BEGIN of Description_139'
14061 ,p_level => C_LEVEL_PROCEDURE
14062 ,p_module => l_log_module);
14063 END IF;
14064
14065 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
14066 l_component_type := 'AMB_DESCRIPTION';
14067 l_component_code := 'FA_UNIT_ADJ';
14068 l_component_type_code := 'S';
14069 l_component_appl_id := 140;
14070 l_amb_context_code := 'DEFAULT';
14071 l_source := NULL;
14072 l_description := NULL;
14073
14074
14075
14076 IF
14077 l_ledger_language = 'US' THEN
14078 l_description := SUBSTR(CONCAT(l_description,'Unit Adjustment'),1,2000);
14079 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14080 END IF;
14081 IF
14082 l_ledger_language = 'US' THEN
14083 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
14084 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14085 END IF;
14086 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
14087 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
14088 IF l_source IS NOT NULL THEN
14089 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
14090 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14091 END IF;
14092 l_description := SUBSTR(l_description,1,1996);
14093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14094 trace
14095 (p_msg => 'END of Description_139'
14096 ,p_level => C_LEVEL_PROCEDURE
14097 ,p_module => l_log_module);
14098
14099 END IF;
14100 RETURN l_description;
14101
14102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14103 trace
14104 (p_msg => 'END of Description_139'
14105 ,p_level => C_LEVEL_PROCEDURE
14106 ,p_module => l_log_module);
14107 END IF;
14108 RETURN NULL;
14109 EXCEPTION
14110 WHEN VALUE_ERROR THEN
14111 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14112 trace
14113 (p_msg => 'ERROR: '||sqlerrm
14114 ,p_level => C_LEVEL_EXCEPTION
14115 ,p_module => l_log_module);
14116 END IF;
14117 RAISE;
14118 WHEN xla_exceptions_pkg.application_exception THEN
14119 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14120 trace
14121 (p_msg => 'ERROR: '||sqlerrm
14122 ,p_level => C_LEVEL_EXCEPTION
14123 ,p_module => l_log_module);
14124 END IF;
14125 RAISE;
14126 WHEN OTHERS THEN
14127 xla_exceptions_pkg.raise_message
14128 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_139');
14129 END Description_139;
14130
14131 ---------------------------------------
14132 --
14133 -- PRIVATE FUNCTION
14134 -- Description_140
14135 --
14136 ---------------------------------------
14137 FUNCTION Description_140 (
14138 p_application_id IN NUMBER
14139 , p_ae_header_id IN NUMBER DEFAULT NULL
14140 --Period Close Date
14141 , p_source_1 IN DATE
14142 )
14143 RETURN VARCHAR2
14144 IS
14145 l_component_type VARCHAR2(80) ;
14146 l_component_code VARCHAR2(30) ;
14147 l_component_type_code VARCHAR2(1) ;
14148 l_component_appl_id INTEGER ;
14149 l_amb_context_code VARCHAR2(30) ;
14150 l_ledger_language VARCHAR2(30) ;
14151 l_source VARCHAR2(1996) ;
14152 l_description VARCHAR2(2000) ;
14153 l_log_module VARCHAR2(240) ;
14154 BEGIN
14155 IF g_log_enabled THEN
14156 l_log_module := C_DEFAULT_MODULE||'.Description_140';
14157 END IF;
14158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14159 trace
14160 (p_msg => 'BEGIN of Description_140'
14161 ,p_level => C_LEVEL_PROCEDURE
14162 ,p_module => l_log_module);
14163 END IF;
14164
14165 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
14166 l_component_type := 'AMB_DESCRIPTION';
14167 l_component_code := 'FA_UNPL_DEP';
14168 l_component_type_code := 'S';
14169 l_component_appl_id := 140;
14170 l_amb_context_code := 'DEFAULT';
14171 l_source := NULL;
14172 l_description := NULL;
14173
14174
14175
14176 IF
14177 l_ledger_language = 'US' THEN
14178 l_description := SUBSTR(CONCAT(l_description,'Unplanned Depreciation'),1,2000);
14179 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14180 END IF;
14181 IF
14182 l_ledger_language = 'US' THEN
14183 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
14184 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14185 END IF;
14186 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
14190 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14187 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
14188 IF l_source IS NOT NULL THEN
14189 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
14191 END IF;
14192 l_description := SUBSTR(l_description,1,1996);
14193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14194 trace
14195 (p_msg => 'END of Description_140'
14196 ,p_level => C_LEVEL_PROCEDURE
14197 ,p_module => l_log_module);
14198
14199 END IF;
14200 RETURN l_description;
14201
14202 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14203 trace
14204 (p_msg => 'END of Description_140'
14205 ,p_level => C_LEVEL_PROCEDURE
14206 ,p_module => l_log_module);
14207 END IF;
14208 RETURN NULL;
14209 EXCEPTION
14210 WHEN VALUE_ERROR THEN
14211 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14212 trace
14213 (p_msg => 'ERROR: '||sqlerrm
14214 ,p_level => C_LEVEL_EXCEPTION
14215 ,p_module => l_log_module);
14216 END IF;
14217 RAISE;
14218 WHEN xla_exceptions_pkg.application_exception THEN
14219 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14220 trace
14221 (p_msg => 'ERROR: '||sqlerrm
14222 ,p_level => C_LEVEL_EXCEPTION
14223 ,p_module => l_log_module);
14224 END IF;
14225 RAISE;
14226 WHEN OTHERS THEN
14227 xla_exceptions_pkg.raise_message
14228 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_140');
14229 END Description_140;
14230
14231 ---------------------------------------
14232 --
14233 -- PRIVATE FUNCTION
14234 -- Description_141
14235 --
14236 ---------------------------------------
14237 FUNCTION Description_141 (
14238 p_application_id IN NUMBER
14239 , p_ae_header_id IN NUMBER DEFAULT NULL
14240 --Period Close Date
14241 , p_source_1 IN DATE
14242 )
14243 RETURN VARCHAR2
14244 IS
14245 l_component_type VARCHAR2(80) ;
14246 l_component_code VARCHAR2(30) ;
14247 l_component_type_code VARCHAR2(1) ;
14248 l_component_appl_id INTEGER ;
14249 l_amb_context_code VARCHAR2(30) ;
14250 l_ledger_language VARCHAR2(30) ;
14251 l_source VARCHAR2(1996) ;
14252 l_description VARCHAR2(2000) ;
14253 l_log_module VARCHAR2(240) ;
14254 BEGIN
14255 IF g_log_enabled THEN
14256 l_log_module := C_DEFAULT_MODULE||'.Description_141';
14257 END IF;
14258 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14259 trace
14260 (p_msg => 'BEGIN of Description_141'
14261 ,p_level => C_LEVEL_PROCEDURE
14262 ,p_module => l_log_module);
14263 END IF;
14264
14265 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
14266 l_component_type := 'AMB_DESCRIPTION';
14267 l_component_code := 'FA_UNPL_EXP';
14268 l_component_type_code := 'S';
14269 l_component_appl_id := 140;
14270 l_amb_context_code := 'DEFAULT';
14271 l_source := NULL;
14272 l_description := NULL;
14273
14274
14275
14276 IF
14277 l_ledger_language = 'US' THEN
14278 l_description := SUBSTR(CONCAT(l_description,'Unplanned Depreciation Expense'),1,2000);
14279 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14280 END IF;
14281 IF
14282 l_ledger_language = 'US' THEN
14283 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
14284 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14285 END IF;
14286 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
14287 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
14288 IF l_source IS NOT NULL THEN
14289 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
14290 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14291 END IF;
14292 l_description := SUBSTR(l_description,1,1996);
14293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14294 trace
14295 (p_msg => 'END of Description_141'
14296 ,p_level => C_LEVEL_PROCEDURE
14297 ,p_module => l_log_module);
14298
14299 END IF;
14300 RETURN l_description;
14301
14302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14303 trace
14304 (p_msg => 'END of Description_141'
14305 ,p_level => C_LEVEL_PROCEDURE
14306 ,p_module => l_log_module);
14307 END IF;
14308 RETURN NULL;
14309 EXCEPTION
14310 WHEN VALUE_ERROR THEN
14311 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14312 trace
14313 (p_msg => 'ERROR: '||sqlerrm
14314 ,p_level => C_LEVEL_EXCEPTION
14315 ,p_module => l_log_module);
14316 END IF;
14317 RAISE;
14318 WHEN xla_exceptions_pkg.application_exception THEN
14319 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14320 trace
14321 (p_msg => 'ERROR: '||sqlerrm
14322 ,p_level => C_LEVEL_EXCEPTION
14323 ,p_module => l_log_module);
14324 END IF;
14325 RAISE;
14326 WHEN OTHERS THEN
14330
14327 xla_exceptions_pkg.raise_message
14328 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_141');
14329 END Description_141;
14331 ---------------------------------------
14332 --
14333 -- PRIVATE FUNCTION
14334 -- Description_142
14335 --
14336 ---------------------------------------
14337 FUNCTION Description_142 (
14338 p_application_id IN NUMBER
14339 , p_ae_header_id IN NUMBER DEFAULT NULL
14340 --Period Close Date
14341 , p_source_1 IN DATE
14342 )
14343 RETURN VARCHAR2
14344 IS
14345 l_component_type VARCHAR2(80) ;
14346 l_component_code VARCHAR2(30) ;
14347 l_component_type_code VARCHAR2(1) ;
14348 l_component_appl_id INTEGER ;
14349 l_amb_context_code VARCHAR2(30) ;
14350 l_ledger_language VARCHAR2(30) ;
14351 l_source VARCHAR2(1996) ;
14352 l_description VARCHAR2(2000) ;
14353 l_log_module VARCHAR2(240) ;
14354 BEGIN
14355 IF g_log_enabled THEN
14356 l_log_module := C_DEFAULT_MODULE||'.Description_142';
14357 END IF;
14358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14359 trace
14360 (p_msg => 'BEGIN of Description_142'
14361 ,p_level => C_LEVEL_PROCEDURE
14362 ,p_module => l_log_module);
14363 END IF;
14364
14365 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
14366 l_component_type := 'AMB_DESCRIPTION';
14367 l_component_code := 'FA_UNPL_RES';
14368 l_component_type_code := 'S';
14369 l_component_appl_id := 140;
14370 l_amb_context_code := 'DEFAULT';
14371 l_source := NULL;
14372 l_description := NULL;
14373
14374
14375
14376 IF
14377 l_ledger_language = 'US' THEN
14378 l_description := SUBSTR(CONCAT(l_description,'Unplanned Depreciation Reserve'),1,2000);
14379 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14380 END IF;
14381 IF
14382 l_ledger_language = 'US' THEN
14383 l_description := SUBSTR(CONCAT(l_description,'-'),1,2000);
14384 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14385 END IF;
14386 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_1,
14387 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
14388 IF l_source IS NOT NULL THEN
14389 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
14390 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14391 END IF;
14392 l_description := SUBSTR(l_description,1,1996);
14393 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14394 trace
14395 (p_msg => 'END of Description_142'
14396 ,p_level => C_LEVEL_PROCEDURE
14397 ,p_module => l_log_module);
14398
14399 END IF;
14400 RETURN l_description;
14401
14402 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14403 trace
14404 (p_msg => 'END of Description_142'
14405 ,p_level => C_LEVEL_PROCEDURE
14406 ,p_module => l_log_module);
14407 END IF;
14408 RETURN NULL;
14409 EXCEPTION
14410 WHEN VALUE_ERROR THEN
14411 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14412 trace
14413 (p_msg => 'ERROR: '||sqlerrm
14414 ,p_level => C_LEVEL_EXCEPTION
14415 ,p_module => l_log_module);
14416 END IF;
14417 RAISE;
14418 WHEN xla_exceptions_pkg.application_exception THEN
14419 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14420 trace
14421 (p_msg => 'ERROR: '||sqlerrm
14422 ,p_level => C_LEVEL_EXCEPTION
14423 ,p_module => l_log_module);
14424 END IF;
14425 RAISE;
14426 WHEN OTHERS THEN
14427 xla_exceptions_pkg.raise_message
14428 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_142');
14429 END Description_142;
14430
14431 ---------------------------------------
14432 --
14433 -- PRIVATE FUNCTION
14434 -- Description_143
14435 --
14436 ---------------------------------------
14437 FUNCTION Description_143 (
14438 p_application_id IN NUMBER
14439 , p_ae_header_id IN NUMBER DEFAULT NULL
14440 --Inflation Adjustment Type Description
14441 , p_source_2 IN VARCHAR2
14442 --Accounting Date
14443 , p_source_3 IN DATE
14444 )
14445 RETURN VARCHAR2
14446 IS
14447 l_component_type VARCHAR2(80) ;
14448 l_component_code VARCHAR2(30) ;
14449 l_component_type_code VARCHAR2(1) ;
14450 l_component_appl_id INTEGER ;
14451 l_amb_context_code VARCHAR2(30) ;
14452 l_ledger_language VARCHAR2(30) ;
14453 l_source VARCHAR2(1996) ;
14454 l_description VARCHAR2(2000) ;
14455 l_log_module VARCHAR2(240) ;
14456 BEGIN
14457 IF g_log_enabled THEN
14458 l_log_module := C_DEFAULT_MODULE||'.Description_143';
14459 END IF;
14460 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14461 trace
14462 (p_msg => 'BEGIN of Description_143'
14463 ,p_level => C_LEVEL_PROCEDURE
14464 ,p_module => l_log_module);
14465 END IF;
14466
14470 l_component_type_code := 'S';
14467 l_ledger_language := xla_ae_journal_entry_pkg.g_cache_ledgers_info.description_language;
14468 l_component_type := 'AMB_DESCRIPTION';
14469 l_component_code := 'IAC_JOURNAL_LINE_DESC';
14471 l_component_appl_id := 140;
14472 l_amb_context_code := 'DEFAULT';
14473 l_source := NULL;
14474 l_description := NULL;
14475
14476
14477
14478 l_source := SUBSTR(p_source_2,1,1996);
14479 IF l_source IS NOT NULL THEN
14480 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
14481 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14482 END IF;
14483 l_source := SUBSTR(xla_ae_sources_pkg.DATE_TO_CHAR(p_source_3,
14484 xla_ae_journal_entry_pkg.g_cache_ledgers_info.nls_desc_language),1,1996);
14485 IF l_source IS NOT NULL THEN
14486 l_description := SUBSTR(CONCAT(l_description,l_source),1,2000);
14487 l_description := SUBSTR(CONCAT(l_description,' '),1,2000);
14488 END IF;
14489 l_description := SUBSTR(l_description,1,1996);
14490 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14491 trace
14492 (p_msg => 'END of Description_143'
14493 ,p_level => C_LEVEL_PROCEDURE
14494 ,p_module => l_log_module);
14495
14496 END IF;
14497 RETURN l_description;
14498
14499 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14500 trace
14501 (p_msg => 'END of Description_143'
14502 ,p_level => C_LEVEL_PROCEDURE
14503 ,p_module => l_log_module);
14504 END IF;
14505 RETURN NULL;
14506 EXCEPTION
14507 WHEN VALUE_ERROR THEN
14508 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14509 trace
14510 (p_msg => 'ERROR: '||sqlerrm
14511 ,p_level => C_LEVEL_EXCEPTION
14512 ,p_module => l_log_module);
14513 END IF;
14514 RAISE;
14515 WHEN xla_exceptions_pkg.application_exception THEN
14516 IF (C_LEVEL_EXCEPTION >= g_log_level) THEN
14517 trace
14518 (p_msg => 'ERROR: '||sqlerrm
14519 ,p_level => C_LEVEL_EXCEPTION
14520 ,p_module => l_log_module);
14521 END IF;
14522 RAISE;
14523 WHEN OTHERS THEN
14524 xla_exceptions_pkg.raise_message
14525 (p_location => 'XLA_00140_AAD_S_000018_PKG.Description_143');
14526 END Description_143;
14527
14528 ---------------------------------------
14529 --
14530 -- PRIVATE FUNCTION
14531 -- AcctDerRule_144
14532 --
14533 ---------------------------------------
14534 FUNCTION AcctDerRule_144 (
14535 p_application_id IN NUMBER
14536 , p_ae_header_id IN NUMBER
14537 , p_side IN VARCHAR2
14538 , p_override_seg_flag IN VARCHAR2
14539 --Bonus Depreciation Expense Account
14540 , p_source_4 IN VARCHAR2
14541 --Generated Code Combination Identifier
14542 , p_source_5 IN NUMBER
14543 , x_transaction_coa_id OUT NOCOPY NUMBER
14544 , x_accounting_coa_id OUT NOCOPY NUMBER
14545 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
14546 , x_flex_value_set_id OUT NOCOPY NUMBER
14547 , x_value_type_code OUT NOCOPY VARCHAR2
14548 , x_value_combination_id OUT NOCOPY NUMBER
14549 , x_value_segment_code OUT NOCOPY VARCHAR2
14550 )
14551 RETURN VARCHAR2
14552 IS
14553 l_component_type VARCHAR2(80) ;
14554 l_component_code VARCHAR2(30) ;
14555 l_component_type_code VARCHAR2(1) ;
14556 l_component_appl_id INTEGER ;
14557 l_amb_context_code VARCHAR2(30) ;
14558 l_log_module VARCHAR2(240) ;
14559 l_output_value VARCHAR2(30) ;
14560 BEGIN
14561 IF g_log_enabled THEN
14562 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_144';
14563 END IF;
14564 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14565
14566 trace
14567 (p_msg => 'BEGIN of AcctDerRule_144'
14568 ,p_level => C_LEVEL_PROCEDURE
14569 ,p_module => l_log_module);
14570
14571 END IF;
14572
14573 l_component_type := 'AMB_ADR';
14574 l_component_code := 'FA_BONUS_DEPRN_EXPENSE_SEGMENT';
14575 l_component_type_code := 'S';
14576 l_component_appl_id := 140;
14577 l_amb_context_code := 'DEFAULT';
14578 x_transaction_coa_id := null;
14579 x_accounting_coa_id := null;
14580 x_flexfield_segment_code := 'GL_ACCOUNT';
14581 x_flex_value_set_id := null ;
14582
14583
14584 IF TO_NUMBER(p_source_5) IS NULL
14585 THEN
14586 --
14587 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14588
14589 trace
14590 (p_msg => 'END of AcctDerRule_144'
14591 ,p_level => C_LEVEL_PROCEDURE
14592 ,p_module => l_log_module);
14593
14594 END IF;
14595 x_value_combination_id := null ;
14596 x_value_segment_code := null ;
14597 x_value_type_code := 'S';
14598 l_output_value := TO_CHAR(p_source_4);
14599 RETURN l_output_value;
14600
14601 ELSE
14602 IF p_override_seg_flag = 'Y' THEN
14603 RETURN '#$NO_OVERRIDE#$';
14604 END IF;
14605 END IF;
14606
14607 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14608
14612 ,p_module => l_log_module);
14609 trace
14610 (p_msg => 'END of AcctDerRule_144(invalid)'
14611 ,p_level => C_LEVEL_PROCEDURE
14613
14614 END IF;
14615
14616 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
14617 x_value_combination_id := null;
14618 x_value_segment_code := null;
14619 x_value_type_code := null;
14620 l_output_value := null;
14621 xla_accounting_err_pkg.build_message
14622 (p_appli_s_name => 'XLA'
14623 ,p_msg_name => 'XLA_AP_INVALID_ADR'
14624 ,p_token_1 => 'COMPONENT_NAME'
14625 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
14626 l_component_type
14627 , l_component_code
14628 , l_component_type_code
14629 , l_component_appl_id
14630 , l_amb_context_code
14631 )
14632 ,p_token_2 => 'OWNER'
14633 ,p_value_2 => xla_lookups_pkg.get_meaning(
14634 'XLA_OWNER_TYPE'
14635 ,l_component_type_code
14636 )
14637 ,p_token_3 => 'PAD_NAME'
14638 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
14639 ,p_token_4 => 'PAD_OWNER'
14640 ,p_value_4 => xla_lookups_pkg.get_meaning(
14641 'XLA_OWNER_TYPE'
14642 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
14643 )
14644 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
14645 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
14646 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
14647 ,p_ae_header_id => NULL
14648 );
14649 RETURN l_output_value;
14650 EXCEPTION
14651 WHEN xla_exceptions_pkg.application_exception THEN
14652 RAISE;
14653 WHEN OTHERS THEN
14654 xla_exceptions_pkg.raise_message
14655 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_144');
14656 END AcctDerRule_144;
14657 --
14658
14659 ---------------------------------------
14660 --
14661 -- PRIVATE FUNCTION
14662 -- AcctDerRule_145
14663 --
14664 ---------------------------------------
14665 FUNCTION AcctDerRule_145 (
14666 p_application_id IN NUMBER
14667 , p_ae_header_id IN NUMBER
14668 , p_side IN VARCHAR2
14669 , p_override_seg_flag IN VARCHAR2
14670 --Generated Code Combination Identifier
14671 , p_source_5 IN NUMBER
14672 --Bonus Reserve Account
14673 , p_source_6 IN VARCHAR2
14674 , x_transaction_coa_id OUT NOCOPY NUMBER
14675 , x_accounting_coa_id OUT NOCOPY NUMBER
14676 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
14677 , x_flex_value_set_id OUT NOCOPY NUMBER
14678 , x_value_type_code OUT NOCOPY VARCHAR2
14679 , x_value_combination_id OUT NOCOPY NUMBER
14680 , x_value_segment_code OUT NOCOPY VARCHAR2
14681 )
14682 RETURN VARCHAR2
14683 IS
14684 l_component_type VARCHAR2(80) ;
14685 l_component_code VARCHAR2(30) ;
14686 l_component_type_code VARCHAR2(1) ;
14687 l_component_appl_id INTEGER ;
14688 l_amb_context_code VARCHAR2(30) ;
14689 l_log_module VARCHAR2(240) ;
14690 l_output_value VARCHAR2(30) ;
14691 BEGIN
14692 IF g_log_enabled THEN
14693 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_145';
14694 END IF;
14695 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14696
14697 trace
14698 (p_msg => 'BEGIN of AcctDerRule_145'
14699 ,p_level => C_LEVEL_PROCEDURE
14700 ,p_module => l_log_module);
14701
14702 END IF;
14703
14704 l_component_type := 'AMB_ADR';
14705 l_component_code := 'FA_BONUS_RES_ACCOUNT_SEGMENT';
14706 l_component_type_code := 'S';
14707 l_component_appl_id := 140;
14708 l_amb_context_code := 'DEFAULT';
14709 x_transaction_coa_id := null;
14710 x_accounting_coa_id := null;
14711 x_flexfield_segment_code := 'GL_ACCOUNT';
14712 x_flex_value_set_id := null ;
14713
14714
14715 IF TO_NUMBER(p_source_5) IS NULL
14716 THEN
14717 --
14718 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14719
14720 trace
14721 (p_msg => 'END of AcctDerRule_145'
14722 ,p_level => C_LEVEL_PROCEDURE
14723 ,p_module => l_log_module);
14724
14725 END IF;
14726 x_value_combination_id := null ;
14727 x_value_segment_code := null ;
14728 x_value_type_code := 'S';
14729 l_output_value := TO_CHAR(p_source_6);
14730 RETURN l_output_value;
14731
14732 ELSE
14733 IF p_override_seg_flag = 'Y' THEN
14734 RETURN '#$NO_OVERRIDE#$';
14735 END IF;
14736 END IF;
14737
14741 (p_msg => 'END of AcctDerRule_145(invalid)'
14738 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14739
14740 trace
14742 ,p_level => C_LEVEL_PROCEDURE
14743 ,p_module => l_log_module);
14744
14745 END IF;
14746
14747 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
14748 x_value_combination_id := null;
14749 x_value_segment_code := null;
14750 x_value_type_code := null;
14751 l_output_value := null;
14752 xla_accounting_err_pkg.build_message
14753 (p_appli_s_name => 'XLA'
14754 ,p_msg_name => 'XLA_AP_INVALID_ADR'
14755 ,p_token_1 => 'COMPONENT_NAME'
14756 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
14757 l_component_type
14758 , l_component_code
14759 , l_component_type_code
14760 , l_component_appl_id
14761 , l_amb_context_code
14762 )
14763 ,p_token_2 => 'OWNER'
14764 ,p_value_2 => xla_lookups_pkg.get_meaning(
14765 'XLA_OWNER_TYPE'
14766 ,l_component_type_code
14767 )
14768 ,p_token_3 => 'PAD_NAME'
14769 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
14770 ,p_token_4 => 'PAD_OWNER'
14771 ,p_value_4 => xla_lookups_pkg.get_meaning(
14772 'XLA_OWNER_TYPE'
14773 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
14774 )
14775 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
14776 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
14777 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
14778 ,p_ae_header_id => NULL
14779 );
14780 RETURN l_output_value;
14781 EXCEPTION
14782 WHEN xla_exceptions_pkg.application_exception THEN
14783 RAISE;
14784 WHEN OTHERS THEN
14785 xla_exceptions_pkg.raise_message
14786 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_145');
14787 END AcctDerRule_145;
14788 --
14789
14790 ---------------------------------------
14791 --
14792 -- PRIVATE FUNCTION
14793 -- AcctDerRule_146
14794 --
14795 ---------------------------------------
14796 FUNCTION AcctDerRule_146 (
14797 p_application_id IN NUMBER
14798 , p_ae_header_id IN NUMBER
14799 , p_side IN VARCHAR2
14800 , p_override_seg_flag IN VARCHAR2
14801 --Generated Code Combination Identifier
14802 , p_source_5 IN NUMBER
14803 --CIP Clearing Account
14804 , p_source_7 IN VARCHAR2
14805 --Payables Code Combination Identifier
14806 , p_source_8 IN NUMBER
14807 , x_transaction_coa_id OUT NOCOPY NUMBER
14808 , x_accounting_coa_id OUT NOCOPY NUMBER
14809 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
14810 , x_flex_value_set_id OUT NOCOPY NUMBER
14811 , x_value_type_code OUT NOCOPY VARCHAR2
14812 , x_value_combination_id OUT NOCOPY NUMBER
14813 , x_value_segment_code OUT NOCOPY VARCHAR2
14814 )
14815 RETURN VARCHAR2
14816 IS
14817 l_component_type VARCHAR2(80) ;
14818 l_component_code VARCHAR2(30) ;
14819 l_component_type_code VARCHAR2(1) ;
14820 l_component_appl_id INTEGER ;
14821 l_amb_context_code VARCHAR2(30) ;
14822 l_log_module VARCHAR2(240) ;
14823 l_output_value VARCHAR2(30) ;
14824 BEGIN
14825 IF g_log_enabled THEN
14826 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_146';
14827 END IF;
14828 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14829
14830 trace
14831 (p_msg => 'BEGIN of AcctDerRule_146'
14832 ,p_level => C_LEVEL_PROCEDURE
14833 ,p_module => l_log_module);
14834
14835 END IF;
14836
14837 l_component_type := 'AMB_ADR';
14838 l_component_code := 'FA_CAT_CIP_CLR_SEGMENT';
14839 l_component_type_code := 'S';
14840 l_component_appl_id := 140;
14841 l_amb_context_code := 'DEFAULT';
14842 x_transaction_coa_id := null;
14843 x_accounting_coa_id := null;
14844 x_flexfield_segment_code := 'GL_ACCOUNT';
14845 x_flex_value_set_id := null ;
14846
14847
14848 IF (TO_NUMBER(p_source_8) IS NULL AND
14849 TO_NUMBER(p_source_5) IS NULL )
14850 THEN
14851 --
14852 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14853
14854 trace
14855 (p_msg => 'END of AcctDerRule_146'
14856 ,p_level => C_LEVEL_PROCEDURE
14857 ,p_module => l_log_module);
14858
14859 END IF;
14860 x_value_combination_id := null ;
14864 RETURN l_output_value;
14861 x_value_segment_code := null ;
14862 x_value_type_code := 'S';
14863 l_output_value := TO_CHAR(p_source_7);
14865
14866 ELSE
14867 IF p_override_seg_flag = 'Y' THEN
14868 RETURN '#$NO_OVERRIDE#$';
14869 END IF;
14870 END IF;
14871
14872 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14873
14874 trace
14875 (p_msg => 'END of AcctDerRule_146(invalid)'
14876 ,p_level => C_LEVEL_PROCEDURE
14877 ,p_module => l_log_module);
14878
14879 END IF;
14880
14881 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
14882 x_value_combination_id := null;
14883 x_value_segment_code := null;
14884 x_value_type_code := null;
14885 l_output_value := null;
14886 xla_accounting_err_pkg.build_message
14887 (p_appli_s_name => 'XLA'
14888 ,p_msg_name => 'XLA_AP_INVALID_ADR'
14889 ,p_token_1 => 'COMPONENT_NAME'
14890 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
14891 l_component_type
14892 , l_component_code
14893 , l_component_type_code
14894 , l_component_appl_id
14895 , l_amb_context_code
14896 )
14897 ,p_token_2 => 'OWNER'
14898 ,p_value_2 => xla_lookups_pkg.get_meaning(
14899 'XLA_OWNER_TYPE'
14900 ,l_component_type_code
14901 )
14902 ,p_token_3 => 'PAD_NAME'
14903 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
14904 ,p_token_4 => 'PAD_OWNER'
14905 ,p_value_4 => xla_lookups_pkg.get_meaning(
14906 'XLA_OWNER_TYPE'
14907 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
14908 )
14909 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
14910 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
14911 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
14912 ,p_ae_header_id => NULL
14913 );
14914 RETURN l_output_value;
14915 EXCEPTION
14916 WHEN xla_exceptions_pkg.application_exception THEN
14917 RAISE;
14918 WHEN OTHERS THEN
14919 xla_exceptions_pkg.raise_message
14920 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_146');
14921 END AcctDerRule_146;
14922 --
14923
14924 ---------------------------------------
14925 --
14926 -- PRIVATE FUNCTION
14927 -- AcctDerRule_147
14928 --
14929 ---------------------------------------
14930 FUNCTION AcctDerRule_147 (
14931 p_application_id IN NUMBER
14932 , p_ae_header_id IN NUMBER
14933 , p_side IN VARCHAR2
14934 , p_override_seg_flag IN VARCHAR2
14935 --Generated Code Combination Identifier
14936 , p_source_5 IN NUMBER
14937 --CIP Cost Account
14938 , p_source_9 IN VARCHAR2
14939 , x_transaction_coa_id OUT NOCOPY NUMBER
14940 , x_accounting_coa_id OUT NOCOPY NUMBER
14941 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
14942 , x_flex_value_set_id OUT NOCOPY NUMBER
14943 , x_value_type_code OUT NOCOPY VARCHAR2
14944 , x_value_combination_id OUT NOCOPY NUMBER
14945 , x_value_segment_code OUT NOCOPY VARCHAR2
14946 )
14947 RETURN VARCHAR2
14948 IS
14949 l_component_type VARCHAR2(80) ;
14950 l_component_code VARCHAR2(30) ;
14951 l_component_type_code VARCHAR2(1) ;
14952 l_component_appl_id INTEGER ;
14953 l_amb_context_code VARCHAR2(30) ;
14954 l_log_module VARCHAR2(240) ;
14955 l_output_value VARCHAR2(30) ;
14956 BEGIN
14957 IF g_log_enabled THEN
14958 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_147';
14959 END IF;
14960 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14961
14962 trace
14963 (p_msg => 'BEGIN of AcctDerRule_147'
14964 ,p_level => C_LEVEL_PROCEDURE
14965 ,p_module => l_log_module);
14966
14967 END IF;
14968
14969 l_component_type := 'AMB_ADR';
14970 l_component_code := 'FA_CAT_CIP_COST_SEGMENT';
14971 l_component_type_code := 'S';
14972 l_component_appl_id := 140;
14973 l_amb_context_code := 'DEFAULT';
14974 x_transaction_coa_id := null;
14975 x_accounting_coa_id := null;
14976 x_flexfield_segment_code := 'GL_ACCOUNT';
14977 x_flex_value_set_id := null ;
14978
14979
14980 IF TO_NUMBER(p_source_5) IS NULL
14981 THEN
14982 --
14983 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
14984
14985 trace
14989
14986 (p_msg => 'END of AcctDerRule_147'
14987 ,p_level => C_LEVEL_PROCEDURE
14988 ,p_module => l_log_module);
14990 END IF;
14991 x_value_combination_id := null ;
14992 x_value_segment_code := null ;
14993 x_value_type_code := 'S';
14994 l_output_value := TO_CHAR(p_source_9);
14995 RETURN l_output_value;
14996
14997 ELSE
14998 IF p_override_seg_flag = 'Y' THEN
14999 RETURN '#$NO_OVERRIDE#$';
15000 END IF;
15001 END IF;
15002
15003 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15004
15005 trace
15006 (p_msg => 'END of AcctDerRule_147(invalid)'
15007 ,p_level => C_LEVEL_PROCEDURE
15008 ,p_module => l_log_module);
15009
15010 END IF;
15011
15012 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
15013 x_value_combination_id := null;
15014 x_value_segment_code := null;
15015 x_value_type_code := null;
15016 l_output_value := null;
15017 xla_accounting_err_pkg.build_message
15018 (p_appli_s_name => 'XLA'
15019 ,p_msg_name => 'XLA_AP_INVALID_ADR'
15020 ,p_token_1 => 'COMPONENT_NAME'
15021 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
15022 l_component_type
15023 , l_component_code
15024 , l_component_type_code
15025 , l_component_appl_id
15026 , l_amb_context_code
15027 )
15028 ,p_token_2 => 'OWNER'
15029 ,p_value_2 => xla_lookups_pkg.get_meaning(
15030 'XLA_OWNER_TYPE'
15031 ,l_component_type_code
15032 )
15033 ,p_token_3 => 'PAD_NAME'
15034 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
15035 ,p_token_4 => 'PAD_OWNER'
15036 ,p_value_4 => xla_lookups_pkg.get_meaning(
15037 'XLA_OWNER_TYPE'
15038 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
15039 )
15040 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
15041 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
15042 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
15043 ,p_ae_header_id => NULL
15044 );
15045 RETURN l_output_value;
15046 EXCEPTION
15047 WHEN xla_exceptions_pkg.application_exception THEN
15048 RAISE;
15049 WHEN OTHERS THEN
15050 xla_exceptions_pkg.raise_message
15051 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_147');
15052 END AcctDerRule_147;
15053 --
15054
15055 ---------------------------------------
15056 --
15057 -- PRIVATE FUNCTION
15058 -- AcctDerRule_148
15059 --
15060 ---------------------------------------
15061 FUNCTION AcctDerRule_148 (
15062 p_application_id IN NUMBER
15063 , p_ae_header_id IN NUMBER
15064 , p_side IN VARCHAR2
15065 , p_override_seg_flag IN VARCHAR2
15066 --Generated Code Combination Identifier
15067 , p_source_5 IN NUMBER
15068 --Payables Code Combination Identifier
15069 , p_source_8 IN NUMBER
15070 --Asset Clearing Account
15071 , p_source_10 IN VARCHAR2
15072 , x_transaction_coa_id OUT NOCOPY NUMBER
15073 , x_accounting_coa_id OUT NOCOPY NUMBER
15074 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
15075 , x_flex_value_set_id OUT NOCOPY NUMBER
15076 , x_value_type_code OUT NOCOPY VARCHAR2
15077 , x_value_combination_id OUT NOCOPY NUMBER
15078 , x_value_segment_code OUT NOCOPY VARCHAR2
15079 )
15080 RETURN VARCHAR2
15081 IS
15082 l_component_type VARCHAR2(80) ;
15083 l_component_code VARCHAR2(30) ;
15084 l_component_type_code VARCHAR2(1) ;
15085 l_component_appl_id INTEGER ;
15086 l_amb_context_code VARCHAR2(30) ;
15087 l_log_module VARCHAR2(240) ;
15088 l_output_value VARCHAR2(30) ;
15089 BEGIN
15090 IF g_log_enabled THEN
15091 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_148';
15092 END IF;
15093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15094
15095 trace
15096 (p_msg => 'BEGIN of AcctDerRule_148'
15097 ,p_level => C_LEVEL_PROCEDURE
15098 ,p_module => l_log_module);
15099
15100 END IF;
15101
15102 l_component_type := 'AMB_ADR';
15103 l_component_code := 'FA_CAT_CLR_ACCOUNT_SEGMENT';
15104 l_component_type_code := 'S';
15105 l_component_appl_id := 140;
15106 l_amb_context_code := 'DEFAULT';
15110 x_flex_value_set_id := null ;
15107 x_transaction_coa_id := null;
15108 x_accounting_coa_id := null;
15109 x_flexfield_segment_code := 'GL_ACCOUNT';
15111
15112
15113 IF TO_NUMBER(p_source_5) IS NULL AND
15114 TO_NUMBER(p_source_8) IS NULL
15115 THEN
15116 --
15117 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15118
15119 trace
15120 (p_msg => 'END of AcctDerRule_148'
15121 ,p_level => C_LEVEL_PROCEDURE
15122 ,p_module => l_log_module);
15123
15124 END IF;
15125 x_value_combination_id := null ;
15126 x_value_segment_code := null ;
15127 x_value_type_code := 'S';
15128 l_output_value := TO_CHAR(p_source_10);
15129 RETURN l_output_value;
15130
15131 ELSE
15132 IF p_override_seg_flag = 'Y' THEN
15133 RETURN '#$NO_OVERRIDE#$';
15134 END IF;
15135 END IF;
15136
15137 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15138
15139 trace
15140 (p_msg => 'END of AcctDerRule_148(invalid)'
15141 ,p_level => C_LEVEL_PROCEDURE
15142 ,p_module => l_log_module);
15143
15144 END IF;
15145
15146 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
15147 x_value_combination_id := null;
15148 x_value_segment_code := null;
15149 x_value_type_code := null;
15150 l_output_value := null;
15151 xla_accounting_err_pkg.build_message
15152 (p_appli_s_name => 'XLA'
15153 ,p_msg_name => 'XLA_AP_INVALID_ADR'
15154 ,p_token_1 => 'COMPONENT_NAME'
15155 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
15156 l_component_type
15157 , l_component_code
15158 , l_component_type_code
15159 , l_component_appl_id
15160 , l_amb_context_code
15161 )
15162 ,p_token_2 => 'OWNER'
15163 ,p_value_2 => xla_lookups_pkg.get_meaning(
15164 'XLA_OWNER_TYPE'
15165 ,l_component_type_code
15166 )
15167 ,p_token_3 => 'PAD_NAME'
15168 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
15169 ,p_token_4 => 'PAD_OWNER'
15170 ,p_value_4 => xla_lookups_pkg.get_meaning(
15171 'XLA_OWNER_TYPE'
15172 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
15173 )
15174 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
15175 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
15176 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
15177 ,p_ae_header_id => NULL
15178 );
15179 RETURN l_output_value;
15180 EXCEPTION
15181 WHEN xla_exceptions_pkg.application_exception THEN
15182 RAISE;
15183 WHEN OTHERS THEN
15184 xla_exceptions_pkg.raise_message
15185 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_148');
15186 END AcctDerRule_148;
15187 --
15188
15189 ---------------------------------------
15190 --
15191 -- PRIVATE FUNCTION
15192 -- AcctDerRule_149
15193 --
15194 ---------------------------------------
15195 FUNCTION AcctDerRule_149 (
15196 p_application_id IN NUMBER
15197 , p_ae_header_id IN NUMBER
15198 , p_side IN VARCHAR2
15199 , p_override_seg_flag IN VARCHAR2
15200 --Generated Code Combination Identifier
15201 , p_source_5 IN NUMBER
15202 --Asset Cost Account
15203 , p_source_11 IN VARCHAR2
15204 , x_transaction_coa_id OUT NOCOPY NUMBER
15205 , x_accounting_coa_id OUT NOCOPY NUMBER
15206 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
15207 , x_flex_value_set_id OUT NOCOPY NUMBER
15208 , x_value_type_code OUT NOCOPY VARCHAR2
15209 , x_value_combination_id OUT NOCOPY NUMBER
15210 , x_value_segment_code OUT NOCOPY VARCHAR2
15211 )
15212 RETURN VARCHAR2
15213 IS
15214 l_component_type VARCHAR2(80) ;
15215 l_component_code VARCHAR2(30) ;
15216 l_component_type_code VARCHAR2(1) ;
15217 l_component_appl_id INTEGER ;
15218 l_amb_context_code VARCHAR2(30) ;
15219 l_log_module VARCHAR2(240) ;
15220 l_output_value VARCHAR2(30) ;
15221 BEGIN
15222 IF g_log_enabled THEN
15223 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_149';
15224 END IF;
15225 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15226
15227 trace
15228 (p_msg => 'BEGIN of AcctDerRule_149'
15229 ,p_level => C_LEVEL_PROCEDURE
15233
15230 ,p_module => l_log_module);
15231
15232 END IF;
15234 l_component_type := 'AMB_ADR';
15235 l_component_code := 'FA_CAT_COST_ACCOUNT_SEGMENT';
15236 l_component_type_code := 'S';
15237 l_component_appl_id := 140;
15238 l_amb_context_code := 'DEFAULT';
15239 x_transaction_coa_id := null;
15240 x_accounting_coa_id := null;
15241 x_flexfield_segment_code := 'GL_ACCOUNT';
15242 x_flex_value_set_id := null ;
15243
15244
15245 IF TO_NUMBER(p_source_5) IS NULL
15246 THEN
15247 --
15248 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15249
15250 trace
15251 (p_msg => 'END of AcctDerRule_149'
15252 ,p_level => C_LEVEL_PROCEDURE
15253 ,p_module => l_log_module);
15254
15255 END IF;
15256 x_value_combination_id := null ;
15257 x_value_segment_code := null ;
15258 x_value_type_code := 'S';
15259 l_output_value := TO_CHAR(p_source_11);
15260 RETURN l_output_value;
15261
15262 ELSE
15263 IF p_override_seg_flag = 'Y' THEN
15264 RETURN '#$NO_OVERRIDE#$';
15265 END IF;
15266 END IF;
15267
15268 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15269
15270 trace
15271 (p_msg => 'END of AcctDerRule_149(invalid)'
15272 ,p_level => C_LEVEL_PROCEDURE
15273 ,p_module => l_log_module);
15274
15275 END IF;
15276
15277 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
15278 x_value_combination_id := null;
15279 x_value_segment_code := null;
15280 x_value_type_code := null;
15281 l_output_value := null;
15282 xla_accounting_err_pkg.build_message
15283 (p_appli_s_name => 'XLA'
15284 ,p_msg_name => 'XLA_AP_INVALID_ADR'
15285 ,p_token_1 => 'COMPONENT_NAME'
15286 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
15287 l_component_type
15288 , l_component_code
15289 , l_component_type_code
15290 , l_component_appl_id
15291 , l_amb_context_code
15292 )
15293 ,p_token_2 => 'OWNER'
15294 ,p_value_2 => xla_lookups_pkg.get_meaning(
15295 'XLA_OWNER_TYPE'
15296 ,l_component_type_code
15297 )
15298 ,p_token_3 => 'PAD_NAME'
15299 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
15300 ,p_token_4 => 'PAD_OWNER'
15301 ,p_value_4 => xla_lookups_pkg.get_meaning(
15302 'XLA_OWNER_TYPE'
15303 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
15304 )
15305 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
15306 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
15307 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
15308 ,p_ae_header_id => NULL
15309 );
15310 RETURN l_output_value;
15311 EXCEPTION
15312 WHEN xla_exceptions_pkg.application_exception THEN
15313 RAISE;
15314 WHEN OTHERS THEN
15315 xla_exceptions_pkg.raise_message
15316 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_149');
15317 END AcctDerRule_149;
15318 --
15319
15320 ---------------------------------------
15321 --
15322 -- PRIVATE FUNCTION
15323 -- AcctDerRule_150
15324 --
15325 ---------------------------------------
15326 FUNCTION AcctDerRule_150 (
15327 p_application_id IN NUMBER
15328 , p_ae_header_id IN NUMBER
15329 , p_side IN VARCHAR2
15330 , p_override_seg_flag IN VARCHAR2
15331 --Generated Code Combination Identifier
15332 , p_source_5 IN NUMBER
15333 --Depreciation Reserve Account
15334 , p_source_12 IN VARCHAR2
15335 , x_transaction_coa_id OUT NOCOPY NUMBER
15336 , x_accounting_coa_id OUT NOCOPY NUMBER
15337 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
15338 , x_flex_value_set_id OUT NOCOPY NUMBER
15339 , x_value_type_code OUT NOCOPY VARCHAR2
15340 , x_value_combination_id OUT NOCOPY NUMBER
15341 , x_value_segment_code OUT NOCOPY VARCHAR2
15342 )
15343 RETURN VARCHAR2
15344 IS
15345 l_component_type VARCHAR2(80) ;
15346 l_component_code VARCHAR2(30) ;
15347 l_component_type_code VARCHAR2(1) ;
15348 l_component_appl_id INTEGER ;
15349 l_amb_context_code VARCHAR2(30) ;
15350 l_log_module VARCHAR2(240) ;
15351 l_output_value VARCHAR2(30) ;
15355 END IF;
15352 BEGIN
15353 IF g_log_enabled THEN
15354 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_150';
15356 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15357
15358 trace
15359 (p_msg => 'BEGIN of AcctDerRule_150'
15360 ,p_level => C_LEVEL_PROCEDURE
15361 ,p_module => l_log_module);
15362
15363 END IF;
15364
15365 l_component_type := 'AMB_ADR';
15366 l_component_code := 'FA_CAT_RES_ACCOUNT_SEGMENT';
15367 l_component_type_code := 'S';
15368 l_component_appl_id := 140;
15369 l_amb_context_code := 'DEFAULT';
15370 x_transaction_coa_id := null;
15371 x_accounting_coa_id := null;
15372 x_flexfield_segment_code := 'GL_ACCOUNT';
15373 x_flex_value_set_id := null ;
15374
15375
15376 IF TO_NUMBER(p_source_5) IS NULL
15377 THEN
15378 --
15379 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15380
15381 trace
15382 (p_msg => 'END of AcctDerRule_150'
15383 ,p_level => C_LEVEL_PROCEDURE
15384 ,p_module => l_log_module);
15385
15386 END IF;
15387 x_value_combination_id := null ;
15388 x_value_segment_code := null ;
15389 x_value_type_code := 'S';
15390 l_output_value := TO_CHAR(p_source_12);
15391 RETURN l_output_value;
15392
15393 ELSE
15394 IF p_override_seg_flag = 'Y' THEN
15395 RETURN '#$NO_OVERRIDE#$';
15396 END IF;
15397 END IF;
15398
15399 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15400
15401 trace
15402 (p_msg => 'END of AcctDerRule_150(invalid)'
15403 ,p_level => C_LEVEL_PROCEDURE
15404 ,p_module => l_log_module);
15405
15406 END IF;
15407
15408 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
15409 x_value_combination_id := null;
15410 x_value_segment_code := null;
15411 x_value_type_code := null;
15412 l_output_value := null;
15413 xla_accounting_err_pkg.build_message
15414 (p_appli_s_name => 'XLA'
15415 ,p_msg_name => 'XLA_AP_INVALID_ADR'
15416 ,p_token_1 => 'COMPONENT_NAME'
15417 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
15418 l_component_type
15419 , l_component_code
15420 , l_component_type_code
15421 , l_component_appl_id
15422 , l_amb_context_code
15423 )
15424 ,p_token_2 => 'OWNER'
15425 ,p_value_2 => xla_lookups_pkg.get_meaning(
15426 'XLA_OWNER_TYPE'
15427 ,l_component_type_code
15428 )
15429 ,p_token_3 => 'PAD_NAME'
15430 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
15431 ,p_token_4 => 'PAD_OWNER'
15432 ,p_value_4 => xla_lookups_pkg.get_meaning(
15433 'XLA_OWNER_TYPE'
15434 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
15435 )
15436 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
15437 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
15438 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
15439 ,p_ae_header_id => NULL
15440 );
15441 RETURN l_output_value;
15442 EXCEPTION
15443 WHEN xla_exceptions_pkg.application_exception THEN
15444 RAISE;
15445 WHEN OTHERS THEN
15446 xla_exceptions_pkg.raise_message
15447 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_150');
15448 END AcctDerRule_150;
15449 --
15450
15451 ---------------------------------------
15452 --
15453 -- PRIVATE FUNCTION
15454 -- AcctDerRule_151
15455 --
15456 ---------------------------------------
15457 FUNCTION AcctDerRule_151 (
15458 p_application_id IN NUMBER
15459 , p_ae_header_id IN NUMBER
15460 , p_side IN VARCHAR2
15461 , p_override_seg_flag IN VARCHAR2
15462 --Generated Code Combination Identifier
15463 , p_source_5 IN NUMBER
15464 --Revaluation Reserve Account
15465 , p_source_13 IN VARCHAR2
15466 , x_transaction_coa_id OUT NOCOPY NUMBER
15467 , x_accounting_coa_id OUT NOCOPY NUMBER
15468 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
15469 , x_flex_value_set_id OUT NOCOPY NUMBER
15470 , x_value_type_code OUT NOCOPY VARCHAR2
15471 , x_value_combination_id OUT NOCOPY NUMBER
15472 , x_value_segment_code OUT NOCOPY VARCHAR2
15473 )
15474 RETURN VARCHAR2
15475 IS
15479 l_component_appl_id INTEGER ;
15476 l_component_type VARCHAR2(80) ;
15477 l_component_code VARCHAR2(30) ;
15478 l_component_type_code VARCHAR2(1) ;
15480 l_amb_context_code VARCHAR2(30) ;
15481 l_log_module VARCHAR2(240) ;
15482 l_output_value VARCHAR2(30) ;
15483 BEGIN
15484 IF g_log_enabled THEN
15485 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_151';
15486 END IF;
15487 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15488
15489 trace
15490 (p_msg => 'BEGIN of AcctDerRule_151'
15491 ,p_level => C_LEVEL_PROCEDURE
15492 ,p_module => l_log_module);
15493
15494 END IF;
15495
15496 l_component_type := 'AMB_ADR';
15497 l_component_code := 'FA_CAT_REVAL_RES_SEGMENT';
15498 l_component_type_code := 'S';
15499 l_component_appl_id := 140;
15500 l_amb_context_code := 'DEFAULT';
15501 x_transaction_coa_id := null;
15502 x_accounting_coa_id := null;
15503 x_flexfield_segment_code := 'GL_ACCOUNT';
15504 x_flex_value_set_id := null ;
15505
15506
15507 IF TO_NUMBER(p_source_5) IS NULL
15508 THEN
15509 --
15510 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15511
15512 trace
15513 (p_msg => 'END of AcctDerRule_151'
15514 ,p_level => C_LEVEL_PROCEDURE
15515 ,p_module => l_log_module);
15516
15517 END IF;
15518 x_value_combination_id := null ;
15519 x_value_segment_code := null ;
15520 x_value_type_code := 'S';
15521 l_output_value := TO_CHAR(p_source_13);
15522 RETURN l_output_value;
15523
15524 ELSE
15525 IF p_override_seg_flag = 'Y' THEN
15526 RETURN '#$NO_OVERRIDE#$';
15527 END IF;
15528 END IF;
15529
15530 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15531
15532 trace
15533 (p_msg => 'END of AcctDerRule_151(invalid)'
15534 ,p_level => C_LEVEL_PROCEDURE
15535 ,p_module => l_log_module);
15536
15537 END IF;
15538
15539 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
15540 x_value_combination_id := null;
15541 x_value_segment_code := null;
15542 x_value_type_code := null;
15543 l_output_value := null;
15544 xla_accounting_err_pkg.build_message
15545 (p_appli_s_name => 'XLA'
15546 ,p_msg_name => 'XLA_AP_INVALID_ADR'
15547 ,p_token_1 => 'COMPONENT_NAME'
15548 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
15549 l_component_type
15550 , l_component_code
15551 , l_component_type_code
15552 , l_component_appl_id
15553 , l_amb_context_code
15554 )
15555 ,p_token_2 => 'OWNER'
15556 ,p_value_2 => xla_lookups_pkg.get_meaning(
15557 'XLA_OWNER_TYPE'
15558 ,l_component_type_code
15559 )
15560 ,p_token_3 => 'PAD_NAME'
15561 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
15562 ,p_token_4 => 'PAD_OWNER'
15563 ,p_value_4 => xla_lookups_pkg.get_meaning(
15564 'XLA_OWNER_TYPE'
15565 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
15566 )
15567 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
15568 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
15569 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
15570 ,p_ae_header_id => NULL
15571 );
15572 RETURN l_output_value;
15573 EXCEPTION
15574 WHEN xla_exceptions_pkg.application_exception THEN
15575 RAISE;
15576 WHEN OTHERS THEN
15577 xla_exceptions_pkg.raise_message
15578 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_151');
15579 END AcctDerRule_151;
15580 --
15581
15582 ---------------------------------------
15583 --
15584 -- PRIVATE FUNCTION
15585 -- AcctDerRule_152
15586 --
15587 ---------------------------------------
15588 FUNCTION AcctDerRule_152 (
15589 p_application_id IN NUMBER
15590 , p_ae_header_id IN NUMBER
15591 , p_side IN VARCHAR2
15592 , p_override_seg_flag IN VARCHAR2
15593 --Generated Code Combination Identifier
15594 , p_source_5 IN NUMBER
15595 --Cost Of Removal Clearing Account
15596 , p_source_14 IN VARCHAR2
15597 , x_transaction_coa_id OUT NOCOPY NUMBER
15598 , x_accounting_coa_id OUT NOCOPY NUMBER
15602 , x_value_combination_id OUT NOCOPY NUMBER
15599 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
15600 , x_flex_value_set_id OUT NOCOPY NUMBER
15601 , x_value_type_code OUT NOCOPY VARCHAR2
15603 , x_value_segment_code OUT NOCOPY VARCHAR2
15604 )
15605 RETURN VARCHAR2
15606 IS
15607 l_component_type VARCHAR2(80) ;
15608 l_component_code VARCHAR2(30) ;
15609 l_component_type_code VARCHAR2(1) ;
15610 l_component_appl_id INTEGER ;
15611 l_amb_context_code VARCHAR2(30) ;
15612 l_log_module VARCHAR2(240) ;
15613 l_output_value VARCHAR2(30) ;
15614 BEGIN
15615 IF g_log_enabled THEN
15616 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_152';
15617 END IF;
15618 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15619
15620 trace
15621 (p_msg => 'BEGIN of AcctDerRule_152'
15622 ,p_level => C_LEVEL_PROCEDURE
15623 ,p_module => l_log_module);
15624
15625 END IF;
15626
15627 l_component_type := 'AMB_ADR';
15628 l_component_code := 'FA_COST_OF_REMOVAL_CLR_SEGMENT';
15629 l_component_type_code := 'S';
15630 l_component_appl_id := 140;
15631 l_amb_context_code := 'DEFAULT';
15632 x_transaction_coa_id := null;
15633 x_accounting_coa_id := null;
15634 x_flexfield_segment_code := 'GL_ACCOUNT';
15635 x_flex_value_set_id := null ;
15636
15637
15638 IF TO_NUMBER(p_source_5) IS NULL
15639 THEN
15640 --
15641 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15642
15643 trace
15644 (p_msg => 'END of AcctDerRule_152'
15645 ,p_level => C_LEVEL_PROCEDURE
15646 ,p_module => l_log_module);
15647
15648 END IF;
15649 x_value_combination_id := null ;
15650 x_value_segment_code := null ;
15651 x_value_type_code := 'S';
15652 l_output_value := TO_CHAR(p_source_14);
15653 RETURN l_output_value;
15654
15655 ELSE
15656 IF p_override_seg_flag = 'Y' THEN
15657 RETURN '#$NO_OVERRIDE#$';
15658 END IF;
15659 END IF;
15660
15661 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15662
15663 trace
15664 (p_msg => 'END of AcctDerRule_152(invalid)'
15665 ,p_level => C_LEVEL_PROCEDURE
15666 ,p_module => l_log_module);
15667
15668 END IF;
15669
15670 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
15671 x_value_combination_id := null;
15672 x_value_segment_code := null;
15673 x_value_type_code := null;
15674 l_output_value := null;
15675 xla_accounting_err_pkg.build_message
15676 (p_appli_s_name => 'XLA'
15677 ,p_msg_name => 'XLA_AP_INVALID_ADR'
15678 ,p_token_1 => 'COMPONENT_NAME'
15679 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
15680 l_component_type
15681 , l_component_code
15682 , l_component_type_code
15683 , l_component_appl_id
15684 , l_amb_context_code
15685 )
15686 ,p_token_2 => 'OWNER'
15687 ,p_value_2 => xla_lookups_pkg.get_meaning(
15688 'XLA_OWNER_TYPE'
15689 ,l_component_type_code
15690 )
15691 ,p_token_3 => 'PAD_NAME'
15692 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
15693 ,p_token_4 => 'PAD_OWNER'
15694 ,p_value_4 => xla_lookups_pkg.get_meaning(
15695 'XLA_OWNER_TYPE'
15696 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
15697 )
15698 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
15699 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
15700 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
15701 ,p_ae_header_id => NULL
15702 );
15703 RETURN l_output_value;
15704 EXCEPTION
15705 WHEN xla_exceptions_pkg.application_exception THEN
15706 RAISE;
15707 WHEN OTHERS THEN
15708 xla_exceptions_pkg.raise_message
15709 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_152');
15710 END AcctDerRule_152;
15711 --
15712
15713 ---------------------------------------
15714 --
15715 -- PRIVATE FUNCTION
15716 -- AcctDerRule_153
15717 --
15718 ---------------------------------------
15719 FUNCTION AcctDerRule_153 (
15720 p_application_id IN NUMBER
15721 , p_ae_header_id IN NUMBER
15722 , p_side IN VARCHAR2
15723 , p_override_seg_flag IN VARCHAR2
15727 , p_source_15 IN VARCHAR2
15724 --Generated Code Combination Identifier
15725 , p_source_5 IN NUMBER
15726 --Cost Of Removal Gain Account
15728 , x_transaction_coa_id OUT NOCOPY NUMBER
15729 , x_accounting_coa_id OUT NOCOPY NUMBER
15730 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
15731 , x_flex_value_set_id OUT NOCOPY NUMBER
15732 , x_value_type_code OUT NOCOPY VARCHAR2
15733 , x_value_combination_id OUT NOCOPY NUMBER
15734 , x_value_segment_code OUT NOCOPY VARCHAR2
15735 )
15736 RETURN VARCHAR2
15737 IS
15738 l_component_type VARCHAR2(80) ;
15739 l_component_code VARCHAR2(30) ;
15740 l_component_type_code VARCHAR2(1) ;
15741 l_component_appl_id INTEGER ;
15742 l_amb_context_code VARCHAR2(30) ;
15743 l_log_module VARCHAR2(240) ;
15744 l_output_value VARCHAR2(30) ;
15745 BEGIN
15746 IF g_log_enabled THEN
15747 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_153';
15748 END IF;
15749 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15750
15751 trace
15752 (p_msg => 'BEGIN of AcctDerRule_153'
15753 ,p_level => C_LEVEL_PROCEDURE
15754 ,p_module => l_log_module);
15755
15756 END IF;
15757
15758 l_component_type := 'AMB_ADR';
15759 l_component_code := 'FA_COST_OF_REM_GAIN_SEGMENT';
15760 l_component_type_code := 'S';
15761 l_component_appl_id := 140;
15762 l_amb_context_code := 'DEFAULT';
15763 x_transaction_coa_id := null;
15764 x_accounting_coa_id := null;
15765 x_flexfield_segment_code := 'GL_ACCOUNT';
15766 x_flex_value_set_id := null ;
15767
15768
15769 IF TO_NUMBER(p_source_5) IS NULL
15770 THEN
15771 --
15772 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15773
15774 trace
15775 (p_msg => 'END of AcctDerRule_153'
15776 ,p_level => C_LEVEL_PROCEDURE
15777 ,p_module => l_log_module);
15778
15779 END IF;
15780 x_value_combination_id := null ;
15781 x_value_segment_code := null ;
15782 x_value_type_code := 'S';
15783 l_output_value := TO_CHAR(p_source_15);
15784 RETURN l_output_value;
15785
15786 ELSE
15787 IF p_override_seg_flag = 'Y' THEN
15788 RETURN '#$NO_OVERRIDE#$';
15789 END IF;
15790 END IF;
15791
15792 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15793
15794 trace
15795 (p_msg => 'END of AcctDerRule_153(invalid)'
15796 ,p_level => C_LEVEL_PROCEDURE
15797 ,p_module => l_log_module);
15798
15799 END IF;
15800
15801 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
15802 x_value_combination_id := null;
15803 x_value_segment_code := null;
15804 x_value_type_code := null;
15805 l_output_value := null;
15806 xla_accounting_err_pkg.build_message
15807 (p_appli_s_name => 'XLA'
15808 ,p_msg_name => 'XLA_AP_INVALID_ADR'
15809 ,p_token_1 => 'COMPONENT_NAME'
15810 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
15811 l_component_type
15812 , l_component_code
15813 , l_component_type_code
15814 , l_component_appl_id
15815 , l_amb_context_code
15816 )
15817 ,p_token_2 => 'OWNER'
15818 ,p_value_2 => xla_lookups_pkg.get_meaning(
15819 'XLA_OWNER_TYPE'
15820 ,l_component_type_code
15821 )
15822 ,p_token_3 => 'PAD_NAME'
15823 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
15824 ,p_token_4 => 'PAD_OWNER'
15825 ,p_value_4 => xla_lookups_pkg.get_meaning(
15826 'XLA_OWNER_TYPE'
15827 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
15828 )
15829 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
15830 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
15831 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
15832 ,p_ae_header_id => NULL
15833 );
15834 RETURN l_output_value;
15835 EXCEPTION
15836 WHEN xla_exceptions_pkg.application_exception THEN
15837 RAISE;
15838 WHEN OTHERS THEN
15839 xla_exceptions_pkg.raise_message
15840 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_153');
15841 END AcctDerRule_153;
15842 --
15843
15844 ---------------------------------------
15845 --
15846 -- PRIVATE FUNCTION
15847 -- AcctDerRule_154
15851 p_application_id IN NUMBER
15848 --
15849 ---------------------------------------
15850 FUNCTION AcctDerRule_154 (
15852 , p_ae_header_id IN NUMBER
15853 , p_side IN VARCHAR2
15854 , p_override_seg_flag IN VARCHAR2
15855 --Generated Code Combination Identifier
15856 , p_source_5 IN NUMBER
15857 --Cost Of Removal Loss Account
15858 , p_source_16 IN VARCHAR2
15859 , x_transaction_coa_id OUT NOCOPY NUMBER
15860 , x_accounting_coa_id OUT NOCOPY NUMBER
15861 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
15862 , x_flex_value_set_id OUT NOCOPY NUMBER
15863 , x_value_type_code OUT NOCOPY VARCHAR2
15864 , x_value_combination_id OUT NOCOPY NUMBER
15865 , x_value_segment_code OUT NOCOPY VARCHAR2
15866 )
15867 RETURN VARCHAR2
15868 IS
15869 l_component_type VARCHAR2(80) ;
15870 l_component_code VARCHAR2(30) ;
15871 l_component_type_code VARCHAR2(1) ;
15872 l_component_appl_id INTEGER ;
15873 l_amb_context_code VARCHAR2(30) ;
15874 l_log_module VARCHAR2(240) ;
15875 l_output_value VARCHAR2(30) ;
15876 BEGIN
15877 IF g_log_enabled THEN
15878 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_154';
15879 END IF;
15880 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15881
15882 trace
15883 (p_msg => 'BEGIN of AcctDerRule_154'
15884 ,p_level => C_LEVEL_PROCEDURE
15885 ,p_module => l_log_module);
15886
15887 END IF;
15888
15889 l_component_type := 'AMB_ADR';
15890 l_component_code := 'FA_COST_OF_REM_LOSS_SEGMENT';
15891 l_component_type_code := 'S';
15892 l_component_appl_id := 140;
15893 l_amb_context_code := 'DEFAULT';
15894 x_transaction_coa_id := null;
15895 x_accounting_coa_id := null;
15896 x_flexfield_segment_code := 'GL_ACCOUNT';
15897 x_flex_value_set_id := null ;
15898
15899
15900 IF TO_NUMBER(p_source_5) IS NULL
15901 THEN
15902 --
15903 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15904
15905 trace
15906 (p_msg => 'END of AcctDerRule_154'
15907 ,p_level => C_LEVEL_PROCEDURE
15908 ,p_module => l_log_module);
15909
15910 END IF;
15911 x_value_combination_id := null ;
15912 x_value_segment_code := null ;
15913 x_value_type_code := 'S';
15914 l_output_value := TO_CHAR(p_source_16);
15915 RETURN l_output_value;
15916
15917 ELSE
15918 IF p_override_seg_flag = 'Y' THEN
15919 RETURN '#$NO_OVERRIDE#$';
15920 END IF;
15921 END IF;
15922
15923 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
15924
15925 trace
15926 (p_msg => 'END of AcctDerRule_154(invalid)'
15927 ,p_level => C_LEVEL_PROCEDURE
15928 ,p_module => l_log_module);
15929
15930 END IF;
15931
15932 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
15933 x_value_combination_id := null;
15934 x_value_segment_code := null;
15935 x_value_type_code := null;
15936 l_output_value := null;
15937 xla_accounting_err_pkg.build_message
15938 (p_appli_s_name => 'XLA'
15939 ,p_msg_name => 'XLA_AP_INVALID_ADR'
15940 ,p_token_1 => 'COMPONENT_NAME'
15941 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
15942 l_component_type
15943 , l_component_code
15944 , l_component_type_code
15945 , l_component_appl_id
15946 , l_amb_context_code
15947 )
15948 ,p_token_2 => 'OWNER'
15949 ,p_value_2 => xla_lookups_pkg.get_meaning(
15950 'XLA_OWNER_TYPE'
15951 ,l_component_type_code
15952 )
15953 ,p_token_3 => 'PAD_NAME'
15954 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
15955 ,p_token_4 => 'PAD_OWNER'
15956 ,p_value_4 => xla_lookups_pkg.get_meaning(
15957 'XLA_OWNER_TYPE'
15958 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
15959 )
15960 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
15961 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
15962 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
15963 ,p_ae_header_id => NULL
15964 );
15965 RETURN l_output_value;
15966 EXCEPTION
15967 WHEN xla_exceptions_pkg.application_exception THEN
15968 RAISE;
15969 WHEN OTHERS THEN
15970 xla_exceptions_pkg.raise_message
15974
15971 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_154');
15972 END AcctDerRule_154;
15973 --
15975 ---------------------------------------
15976 --
15977 -- PRIVATE FUNCTION
15978 -- AcctDerRule_155
15979 --
15980 ---------------------------------------
15981 FUNCTION AcctDerRule_155 (
15982 p_application_id IN NUMBER
15983 , p_ae_header_id IN NUMBER
15984 , p_side IN VARCHAR2
15985 , p_override_seg_flag IN VARCHAR2
15986 --Generated Code Combination Identifier
15987 , p_source_5 IN NUMBER
15988 --Deferred Depreciation Expense Account
15989 , p_source_17 IN VARCHAR2
15990 , x_transaction_coa_id OUT NOCOPY NUMBER
15991 , x_accounting_coa_id OUT NOCOPY NUMBER
15992 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
15993 , x_flex_value_set_id OUT NOCOPY NUMBER
15994 , x_value_type_code OUT NOCOPY VARCHAR2
15995 , x_value_combination_id OUT NOCOPY NUMBER
15996 , x_value_segment_code OUT NOCOPY VARCHAR2
15997 )
15998 RETURN VARCHAR2
15999 IS
16000 l_component_type VARCHAR2(80) ;
16001 l_component_code VARCHAR2(30) ;
16002 l_component_type_code VARCHAR2(1) ;
16003 l_component_appl_id INTEGER ;
16004 l_amb_context_code VARCHAR2(30) ;
16005 l_log_module VARCHAR2(240) ;
16006 l_output_value VARCHAR2(30) ;
16007 BEGIN
16008 IF g_log_enabled THEN
16009 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_155';
16010 END IF;
16011 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16012
16013 trace
16014 (p_msg => 'BEGIN of AcctDerRule_155'
16015 ,p_level => C_LEVEL_PROCEDURE
16016 ,p_module => l_log_module);
16017
16018 END IF;
16019
16020 l_component_type := 'AMB_ADR';
16021 l_component_code := 'FA_DEF_DEPRN_EXPENSE_SEGMENT';
16022 l_component_type_code := 'S';
16023 l_component_appl_id := 140;
16024 l_amb_context_code := 'DEFAULT';
16025 x_transaction_coa_id := null;
16026 x_accounting_coa_id := null;
16027 x_flexfield_segment_code := 'GL_ACCOUNT';
16028 x_flex_value_set_id := null ;
16029
16030
16031 IF TO_NUMBER(p_source_5) IS NULL
16032 THEN
16033 --
16034 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16035
16036 trace
16037 (p_msg => 'END of AcctDerRule_155'
16038 ,p_level => C_LEVEL_PROCEDURE
16039 ,p_module => l_log_module);
16040
16041 END IF;
16042 x_value_combination_id := null ;
16043 x_value_segment_code := null ;
16044 x_value_type_code := 'S';
16045 l_output_value := TO_CHAR(p_source_17);
16046 RETURN l_output_value;
16047
16048 ELSE
16049 IF p_override_seg_flag = 'Y' THEN
16050 RETURN '#$NO_OVERRIDE#$';
16051 END IF;
16052 END IF;
16053
16054 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16055
16056 trace
16057 (p_msg => 'END of AcctDerRule_155(invalid)'
16058 ,p_level => C_LEVEL_PROCEDURE
16059 ,p_module => l_log_module);
16060
16061 END IF;
16062
16063 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
16064 x_value_combination_id := null;
16065 x_value_segment_code := null;
16066 x_value_type_code := null;
16067 l_output_value := null;
16068 xla_accounting_err_pkg.build_message
16069 (p_appli_s_name => 'XLA'
16070 ,p_msg_name => 'XLA_AP_INVALID_ADR'
16071 ,p_token_1 => 'COMPONENT_NAME'
16072 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
16073 l_component_type
16074 , l_component_code
16075 , l_component_type_code
16076 , l_component_appl_id
16077 , l_amb_context_code
16078 )
16079 ,p_token_2 => 'OWNER'
16080 ,p_value_2 => xla_lookups_pkg.get_meaning(
16081 'XLA_OWNER_TYPE'
16082 ,l_component_type_code
16083 )
16084 ,p_token_3 => 'PAD_NAME'
16085 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
16086 ,p_token_4 => 'PAD_OWNER'
16087 ,p_value_4 => xla_lookups_pkg.get_meaning(
16088 'XLA_OWNER_TYPE'
16089 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
16090 )
16091 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
16092 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
16093 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
16094 ,p_ae_header_id => NULL
16098 WHEN xla_exceptions_pkg.application_exception THEN
16095 );
16096 RETURN l_output_value;
16097 EXCEPTION
16099 RAISE;
16100 WHEN OTHERS THEN
16101 xla_exceptions_pkg.raise_message
16102 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_155');
16103 END AcctDerRule_155;
16104 --
16105
16106 ---------------------------------------
16107 --
16108 -- PRIVATE FUNCTION
16109 -- AcctDerRule_156
16110 --
16111 ---------------------------------------
16112 FUNCTION AcctDerRule_156 (
16113 p_application_id IN NUMBER
16114 , p_ae_header_id IN NUMBER
16115 , p_side IN VARCHAR2
16116 , p_override_seg_flag IN VARCHAR2
16117 --Deferred Depreciation Reserve Account
16118 , p_source_18 IN VARCHAR2
16119 --Generated Offset Code Combination Identifier
16120 , p_source_19 IN NUMBER
16121 , x_transaction_coa_id OUT NOCOPY NUMBER
16122 , x_accounting_coa_id OUT NOCOPY NUMBER
16123 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
16124 , x_flex_value_set_id OUT NOCOPY NUMBER
16125 , x_value_type_code OUT NOCOPY VARCHAR2
16126 , x_value_combination_id OUT NOCOPY NUMBER
16127 , x_value_segment_code OUT NOCOPY VARCHAR2
16128 )
16129 RETURN VARCHAR2
16130 IS
16131 l_component_type VARCHAR2(80) ;
16132 l_component_code VARCHAR2(30) ;
16133 l_component_type_code VARCHAR2(1) ;
16134 l_component_appl_id INTEGER ;
16135 l_amb_context_code VARCHAR2(30) ;
16136 l_log_module VARCHAR2(240) ;
16137 l_output_value VARCHAR2(30) ;
16138 BEGIN
16139 IF g_log_enabled THEN
16140 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_156';
16141 END IF;
16142 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16143
16144 trace
16145 (p_msg => 'BEGIN of AcctDerRule_156'
16146 ,p_level => C_LEVEL_PROCEDURE
16147 ,p_module => l_log_module);
16148
16149 END IF;
16150
16151 l_component_type := 'AMB_ADR';
16152 l_component_code := 'FA_DEF_DEPRN_RESERVE_SEGMENT';
16153 l_component_type_code := 'S';
16154 l_component_appl_id := 140;
16155 l_amb_context_code := 'DEFAULT';
16156 x_transaction_coa_id := null;
16157 x_accounting_coa_id := null;
16158 x_flexfield_segment_code := 'GL_ACCOUNT';
16159 x_flex_value_set_id := null ;
16160
16161
16162 IF TO_NUMBER(p_source_19) IS NULL
16163 THEN
16164 --
16165 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16166
16167 trace
16168 (p_msg => 'END of AcctDerRule_156'
16169 ,p_level => C_LEVEL_PROCEDURE
16170 ,p_module => l_log_module);
16171
16172 END IF;
16173 x_value_combination_id := null ;
16174 x_value_segment_code := null ;
16175 x_value_type_code := 'S';
16176 l_output_value := TO_CHAR(p_source_18);
16177 RETURN l_output_value;
16178
16179 ELSE
16180 IF p_override_seg_flag = 'Y' THEN
16181 RETURN '#$NO_OVERRIDE#$';
16182 END IF;
16183 END IF;
16184
16185 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16186
16187 trace
16188 (p_msg => 'END of AcctDerRule_156(invalid)'
16189 ,p_level => C_LEVEL_PROCEDURE
16190 ,p_module => l_log_module);
16191
16192 END IF;
16193
16194 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
16195 x_value_combination_id := null;
16196 x_value_segment_code := null;
16197 x_value_type_code := null;
16198 l_output_value := null;
16199 xla_accounting_err_pkg.build_message
16200 (p_appli_s_name => 'XLA'
16201 ,p_msg_name => 'XLA_AP_INVALID_ADR'
16202 ,p_token_1 => 'COMPONENT_NAME'
16203 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
16204 l_component_type
16205 , l_component_code
16206 , l_component_type_code
16207 , l_component_appl_id
16208 , l_amb_context_code
16209 )
16210 ,p_token_2 => 'OWNER'
16211 ,p_value_2 => xla_lookups_pkg.get_meaning(
16212 'XLA_OWNER_TYPE'
16213 ,l_component_type_code
16214 )
16215 ,p_token_3 => 'PAD_NAME'
16216 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
16217 ,p_token_4 => 'PAD_OWNER'
16218 ,p_value_4 => xla_lookups_pkg.get_meaning(
16219 'XLA_OWNER_TYPE'
16220 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
16221 )
16225 ,p_ae_header_id => NULL
16222 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
16223 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
16224 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
16226 );
16227 RETURN l_output_value;
16228 EXCEPTION
16229 WHEN xla_exceptions_pkg.application_exception THEN
16230 RAISE;
16231 WHEN OTHERS THEN
16232 xla_exceptions_pkg.raise_message
16233 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_156');
16234 END AcctDerRule_156;
16235 --
16236
16237 ---------------------------------------
16238 --
16239 -- PRIVATE FUNCTION
16240 -- AcctDerRule_157
16241 --
16242 ---------------------------------------
16243 FUNCTION AcctDerRule_157 (
16244 p_application_id IN NUMBER
16245 , p_ae_header_id IN NUMBER
16246 , p_side IN VARCHAR2
16247 , p_override_seg_flag IN VARCHAR2
16248 --Generated Code Combination Identifier
16249 , p_source_5 IN NUMBER
16250 --Depreciation Adjustment Account
16251 , p_source_20 IN VARCHAR2
16252 , x_transaction_coa_id OUT NOCOPY NUMBER
16253 , x_accounting_coa_id OUT NOCOPY NUMBER
16254 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
16255 , x_flex_value_set_id OUT NOCOPY NUMBER
16256 , x_value_type_code OUT NOCOPY VARCHAR2
16257 , x_value_combination_id OUT NOCOPY NUMBER
16258 , x_value_segment_code OUT NOCOPY VARCHAR2
16259 )
16260 RETURN VARCHAR2
16261 IS
16262 l_component_type VARCHAR2(80) ;
16263 l_component_code VARCHAR2(30) ;
16264 l_component_type_code VARCHAR2(1) ;
16265 l_component_appl_id INTEGER ;
16266 l_amb_context_code VARCHAR2(30) ;
16267 l_log_module VARCHAR2(240) ;
16268 l_output_value VARCHAR2(30) ;
16269 BEGIN
16270 IF g_log_enabled THEN
16271 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_157';
16272 END IF;
16273 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16274
16275 trace
16276 (p_msg => 'BEGIN of AcctDerRule_157'
16277 ,p_level => C_LEVEL_PROCEDURE
16278 ,p_module => l_log_module);
16279
16280 END IF;
16281
16282 l_component_type := 'AMB_ADR';
16283 l_component_code := 'FA_DEPRN_ADJUSTMENT_SEGMENT';
16284 l_component_type_code := 'S';
16285 l_component_appl_id := 140;
16286 l_amb_context_code := 'DEFAULT';
16287 x_transaction_coa_id := null;
16288 x_accounting_coa_id := null;
16289 x_flexfield_segment_code := 'GL_ACCOUNT';
16290 x_flex_value_set_id := null ;
16291
16292
16293 IF TO_NUMBER(p_source_5) IS NULL
16294 THEN
16295 --
16296 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16297
16298 trace
16299 (p_msg => 'END of AcctDerRule_157'
16300 ,p_level => C_LEVEL_PROCEDURE
16301 ,p_module => l_log_module);
16302
16303 END IF;
16304 x_value_combination_id := null ;
16305 x_value_segment_code := null ;
16306 x_value_type_code := 'S';
16307 l_output_value := TO_CHAR(p_source_20);
16308 RETURN l_output_value;
16309
16310 ELSE
16311 IF p_override_seg_flag = 'Y' THEN
16312 RETURN '#$NO_OVERRIDE#$';
16313 END IF;
16314 END IF;
16315
16316 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16317
16318 trace
16319 (p_msg => 'END of AcctDerRule_157(invalid)'
16320 ,p_level => C_LEVEL_PROCEDURE
16321 ,p_module => l_log_module);
16322
16323 END IF;
16324
16325 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
16326 x_value_combination_id := null;
16327 x_value_segment_code := null;
16328 x_value_type_code := null;
16329 l_output_value := null;
16330 xla_accounting_err_pkg.build_message
16331 (p_appli_s_name => 'XLA'
16332 ,p_msg_name => 'XLA_AP_INVALID_ADR'
16333 ,p_token_1 => 'COMPONENT_NAME'
16334 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
16335 l_component_type
16336 , l_component_code
16337 , l_component_type_code
16338 , l_component_appl_id
16339 , l_amb_context_code
16340 )
16341 ,p_token_2 => 'OWNER'
16342 ,p_value_2 => xla_lookups_pkg.get_meaning(
16343 'XLA_OWNER_TYPE'
16344 ,l_component_type_code
16345 )
16346 ,p_token_3 => 'PAD_NAME'
16347 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
16351 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
16348 ,p_token_4 => 'PAD_OWNER'
16349 ,p_value_4 => xla_lookups_pkg.get_meaning(
16350 'XLA_OWNER_TYPE'
16352 )
16353 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
16354 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
16355 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
16356 ,p_ae_header_id => NULL
16357 );
16358 RETURN l_output_value;
16359 EXCEPTION
16360 WHEN xla_exceptions_pkg.application_exception THEN
16361 RAISE;
16362 WHEN OTHERS THEN
16363 xla_exceptions_pkg.raise_message
16364 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_157');
16365 END AcctDerRule_157;
16366 --
16367
16368 ---------------------------------------
16369 --
16370 -- PRIVATE FUNCTION
16371 -- AcctDerRule_158
16372 --
16373 ---------------------------------------
16374 FUNCTION AcctDerRule_158 (
16375 p_application_id IN NUMBER
16376 , p_ae_header_id IN NUMBER
16377 , p_side IN VARCHAR2
16378 , p_override_seg_flag IN VARCHAR2
16379 --Generated Code Combination Identifier
16380 , p_source_5 IN NUMBER
16381 --Intercompany Payables Account
16382 , p_source_21 IN VARCHAR2
16383 , x_transaction_coa_id OUT NOCOPY NUMBER
16384 , x_accounting_coa_id OUT NOCOPY NUMBER
16385 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
16386 , x_flex_value_set_id OUT NOCOPY NUMBER
16387 , x_value_type_code OUT NOCOPY VARCHAR2
16388 , x_value_combination_id OUT NOCOPY NUMBER
16389 , x_value_segment_code OUT NOCOPY VARCHAR2
16390 )
16391 RETURN VARCHAR2
16392 IS
16393 l_component_type VARCHAR2(80) ;
16394 l_component_code VARCHAR2(30) ;
16395 l_component_type_code VARCHAR2(1) ;
16396 l_component_appl_id INTEGER ;
16397 l_amb_context_code VARCHAR2(30) ;
16398 l_log_module VARCHAR2(240) ;
16399 l_output_value VARCHAR2(30) ;
16400 BEGIN
16401 IF g_log_enabled THEN
16402 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_158';
16403 END IF;
16404 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16405
16406 trace
16407 (p_msg => 'BEGIN of AcctDerRule_158'
16408 ,p_level => C_LEVEL_PROCEDURE
16409 ,p_module => l_log_module);
16410
16411 END IF;
16412
16413 l_component_type := 'AMB_ADR';
16414 l_component_code := 'FA_IC_PAYABLE_ACCOUNT';
16415 l_component_type_code := 'S';
16416 l_component_appl_id := 140;
16417 l_amb_context_code := 'DEFAULT';
16418 x_transaction_coa_id := null;
16419 x_accounting_coa_id := null;
16420 x_flexfield_segment_code := 'GL_ACCOUNT';
16421 x_flex_value_set_id := null ;
16422
16423
16424 IF TO_NUMBER(p_source_5) IS NULL
16425 THEN
16426 --
16427 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16428
16429 trace
16430 (p_msg => 'END of AcctDerRule_158'
16431 ,p_level => C_LEVEL_PROCEDURE
16432 ,p_module => l_log_module);
16433
16434 END IF;
16435 x_value_combination_id := null ;
16436 x_value_segment_code := null ;
16437 x_value_type_code := 'S';
16438 l_output_value := TO_CHAR(p_source_21);
16439 RETURN l_output_value;
16440
16441 ELSE
16442 IF p_override_seg_flag = 'Y' THEN
16443 RETURN '#$NO_OVERRIDE#$';
16444 END IF;
16445 END IF;
16446
16447 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16448
16449 trace
16450 (p_msg => 'END of AcctDerRule_158(invalid)'
16451 ,p_level => C_LEVEL_PROCEDURE
16452 ,p_module => l_log_module);
16453
16454 END IF;
16455
16456 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
16457 x_value_combination_id := null;
16458 x_value_segment_code := null;
16459 x_value_type_code := null;
16460 l_output_value := null;
16461 xla_accounting_err_pkg.build_message
16462 (p_appli_s_name => 'XLA'
16463 ,p_msg_name => 'XLA_AP_INVALID_ADR'
16464 ,p_token_1 => 'COMPONENT_NAME'
16465 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
16466 l_component_type
16467 , l_component_code
16468 , l_component_type_code
16469 , l_component_appl_id
16470 , l_amb_context_code
16471 )
16472 ,p_token_2 => 'OWNER'
16473 ,p_value_2 => xla_lookups_pkg.get_meaning(
16477 ,p_token_3 => 'PAD_NAME'
16474 'XLA_OWNER_TYPE'
16475 ,l_component_type_code
16476 )
16478 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
16479 ,p_token_4 => 'PAD_OWNER'
16480 ,p_value_4 => xla_lookups_pkg.get_meaning(
16481 'XLA_OWNER_TYPE'
16482 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
16483 )
16484 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
16485 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
16486 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
16487 ,p_ae_header_id => NULL
16488 );
16489 RETURN l_output_value;
16490 EXCEPTION
16491 WHEN xla_exceptions_pkg.application_exception THEN
16492 RAISE;
16493 WHEN OTHERS THEN
16494 xla_exceptions_pkg.raise_message
16495 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_158');
16496 END AcctDerRule_158;
16497 --
16498
16499 ---------------------------------------
16500 --
16501 -- PRIVATE FUNCTION
16502 -- AcctDerRule_159
16503 --
16504 ---------------------------------------
16505 FUNCTION AcctDerRule_159 (
16506 p_application_id IN NUMBER
16507 , p_ae_header_id IN NUMBER
16508 , p_side IN VARCHAR2
16509 , p_override_seg_flag IN VARCHAR2
16510 --Generated Code Combination Identifier
16511 , p_source_5 IN NUMBER
16512 --Intercompany Receivables Account
16513 , p_source_22 IN VARCHAR2
16514 , x_transaction_coa_id OUT NOCOPY NUMBER
16515 , x_accounting_coa_id OUT NOCOPY NUMBER
16516 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
16517 , x_flex_value_set_id OUT NOCOPY NUMBER
16518 , x_value_type_code OUT NOCOPY VARCHAR2
16519 , x_value_combination_id OUT NOCOPY NUMBER
16520 , x_value_segment_code OUT NOCOPY VARCHAR2
16521 )
16522 RETURN VARCHAR2
16523 IS
16524 l_component_type VARCHAR2(80) ;
16525 l_component_code VARCHAR2(30) ;
16526 l_component_type_code VARCHAR2(1) ;
16527 l_component_appl_id INTEGER ;
16528 l_amb_context_code VARCHAR2(30) ;
16529 l_log_module VARCHAR2(240) ;
16530 l_output_value VARCHAR2(30) ;
16531 BEGIN
16532 IF g_log_enabled THEN
16533 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_159';
16534 END IF;
16535 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16536
16537 trace
16538 (p_msg => 'BEGIN of AcctDerRule_159'
16539 ,p_level => C_LEVEL_PROCEDURE
16540 ,p_module => l_log_module);
16541
16542 END IF;
16543
16544 l_component_type := 'AMB_ADR';
16545 l_component_code := 'FA_IC_RECEIVABLE_ACCOUNT';
16546 l_component_type_code := 'S';
16547 l_component_appl_id := 140;
16548 l_amb_context_code := 'DEFAULT';
16549 x_transaction_coa_id := null;
16550 x_accounting_coa_id := null;
16551 x_flexfield_segment_code := 'GL_ACCOUNT';
16552 x_flex_value_set_id := null ;
16553
16554
16555 IF TO_NUMBER(p_source_5) IS NULL
16556 THEN
16557 --
16558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16559
16560 trace
16561 (p_msg => 'END of AcctDerRule_159'
16562 ,p_level => C_LEVEL_PROCEDURE
16563 ,p_module => l_log_module);
16564
16565 END IF;
16566 x_value_combination_id := null ;
16567 x_value_segment_code := null ;
16568 x_value_type_code := 'S';
16569 l_output_value := TO_CHAR(p_source_22);
16570 RETURN l_output_value;
16571
16572 ELSE
16573 IF p_override_seg_flag = 'Y' THEN
16574 RETURN '#$NO_OVERRIDE#$';
16575 END IF;
16576 END IF;
16577
16578 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16579
16580 trace
16581 (p_msg => 'END of AcctDerRule_159(invalid)'
16582 ,p_level => C_LEVEL_PROCEDURE
16583 ,p_module => l_log_module);
16584
16585 END IF;
16586
16587 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
16588 x_value_combination_id := null;
16589 x_value_segment_code := null;
16590 x_value_type_code := null;
16591 l_output_value := null;
16592 xla_accounting_err_pkg.build_message
16593 (p_appli_s_name => 'XLA'
16594 ,p_msg_name => 'XLA_AP_INVALID_ADR'
16595 ,p_token_1 => 'COMPONENT_NAME'
16596 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
16597 l_component_type
16598 , l_component_code
16599 , l_component_type_code
16603 ,p_token_2 => 'OWNER'
16600 , l_component_appl_id
16601 , l_amb_context_code
16602 )
16604 ,p_value_2 => xla_lookups_pkg.get_meaning(
16605 'XLA_OWNER_TYPE'
16606 ,l_component_type_code
16607 )
16608 ,p_token_3 => 'PAD_NAME'
16609 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
16610 ,p_token_4 => 'PAD_OWNER'
16611 ,p_value_4 => xla_lookups_pkg.get_meaning(
16612 'XLA_OWNER_TYPE'
16613 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
16614 )
16615 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
16616 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
16617 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
16618 ,p_ae_header_id => NULL
16619 );
16620 RETURN l_output_value;
16621 EXCEPTION
16622 WHEN xla_exceptions_pkg.application_exception THEN
16623 RAISE;
16624 WHEN OTHERS THEN
16625 xla_exceptions_pkg.raise_message
16626 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_159');
16627 END AcctDerRule_159;
16628 --
16629
16630 ---------------------------------------
16631 --
16632 -- PRIVATE FUNCTION
16633 -- AcctDerRule_160
16634 --
16635 ---------------------------------------
16636 FUNCTION AcctDerRule_160 (
16637 p_application_id IN NUMBER
16638 , p_ae_header_id IN NUMBER
16639 , p_side IN VARCHAR2
16640 , p_override_seg_flag IN VARCHAR2
16641 --Generated Code Combination Identifier
16642 , p_source_5 IN NUMBER
16643 --Net Book Value Retired Gain Account
16644 , p_source_23 IN VARCHAR2
16645 , x_transaction_coa_id OUT NOCOPY NUMBER
16646 , x_accounting_coa_id OUT NOCOPY NUMBER
16647 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
16648 , x_flex_value_set_id OUT NOCOPY NUMBER
16649 , x_value_type_code OUT NOCOPY VARCHAR2
16650 , x_value_combination_id OUT NOCOPY NUMBER
16651 , x_value_segment_code OUT NOCOPY VARCHAR2
16652 )
16653 RETURN VARCHAR2
16654 IS
16655 l_component_type VARCHAR2(80) ;
16656 l_component_code VARCHAR2(30) ;
16657 l_component_type_code VARCHAR2(1) ;
16658 l_component_appl_id INTEGER ;
16659 l_amb_context_code VARCHAR2(30) ;
16660 l_log_module VARCHAR2(240) ;
16661 l_output_value VARCHAR2(30) ;
16662 BEGIN
16663 IF g_log_enabled THEN
16664 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_160';
16665 END IF;
16666 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16667
16668 trace
16669 (p_msg => 'BEGIN of AcctDerRule_160'
16670 ,p_level => C_LEVEL_PROCEDURE
16671 ,p_module => l_log_module);
16672
16673 END IF;
16674
16675 l_component_type := 'AMB_ADR';
16676 l_component_code := 'FA_NBV_RETIRED_GAIN_SEGMENT';
16677 l_component_type_code := 'S';
16678 l_component_appl_id := 140;
16679 l_amb_context_code := 'DEFAULT';
16680 x_transaction_coa_id := null;
16681 x_accounting_coa_id := null;
16682 x_flexfield_segment_code := 'GL_ACCOUNT';
16683 x_flex_value_set_id := null ;
16684
16685
16686 IF TO_NUMBER(p_source_5) IS NULL
16687 THEN
16688 --
16689 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16690
16691 trace
16692 (p_msg => 'END of AcctDerRule_160'
16693 ,p_level => C_LEVEL_PROCEDURE
16694 ,p_module => l_log_module);
16695
16696 END IF;
16697 x_value_combination_id := null ;
16698 x_value_segment_code := null ;
16699 x_value_type_code := 'S';
16700 l_output_value := TO_CHAR(p_source_23);
16701 RETURN l_output_value;
16702
16703 ELSE
16704 IF p_override_seg_flag = 'Y' THEN
16705 RETURN '#$NO_OVERRIDE#$';
16706 END IF;
16707 END IF;
16708
16709 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16710
16711 trace
16712 (p_msg => 'END of AcctDerRule_160(invalid)'
16713 ,p_level => C_LEVEL_PROCEDURE
16714 ,p_module => l_log_module);
16715
16716 END IF;
16717
16718 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
16719 x_value_combination_id := null;
16720 x_value_segment_code := null;
16721 x_value_type_code := null;
16722 l_output_value := null;
16723 xla_accounting_err_pkg.build_message
16724 (p_appli_s_name => 'XLA'
16725 ,p_msg_name => 'XLA_AP_INVALID_ADR'
16729 , l_component_code
16726 ,p_token_1 => 'COMPONENT_NAME'
16727 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
16728 l_component_type
16730 , l_component_type_code
16731 , l_component_appl_id
16732 , l_amb_context_code
16733 )
16734 ,p_token_2 => 'OWNER'
16735 ,p_value_2 => xla_lookups_pkg.get_meaning(
16736 'XLA_OWNER_TYPE'
16737 ,l_component_type_code
16738 )
16739 ,p_token_3 => 'PAD_NAME'
16740 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
16741 ,p_token_4 => 'PAD_OWNER'
16742 ,p_value_4 => xla_lookups_pkg.get_meaning(
16743 'XLA_OWNER_TYPE'
16744 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
16745 )
16746 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
16747 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
16748 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
16749 ,p_ae_header_id => NULL
16750 );
16751 RETURN l_output_value;
16752 EXCEPTION
16753 WHEN xla_exceptions_pkg.application_exception THEN
16754 RAISE;
16755 WHEN OTHERS THEN
16756 xla_exceptions_pkg.raise_message
16757 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_160');
16758 END AcctDerRule_160;
16759 --
16760
16761 ---------------------------------------
16762 --
16763 -- PRIVATE FUNCTION
16764 -- AcctDerRule_161
16765 --
16766 ---------------------------------------
16767 FUNCTION AcctDerRule_161 (
16768 p_application_id IN NUMBER
16769 , p_ae_header_id IN NUMBER
16770 , p_side IN VARCHAR2
16771 , p_override_seg_flag IN VARCHAR2
16772 --Generated Code Combination Identifier
16773 , p_source_5 IN NUMBER
16774 --Net Book Value Retired Loss Account
16775 , p_source_24 IN VARCHAR2
16776 , x_transaction_coa_id OUT NOCOPY NUMBER
16777 , x_accounting_coa_id OUT NOCOPY NUMBER
16778 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
16779 , x_flex_value_set_id OUT NOCOPY NUMBER
16780 , x_value_type_code OUT NOCOPY VARCHAR2
16781 , x_value_combination_id OUT NOCOPY NUMBER
16782 , x_value_segment_code OUT NOCOPY VARCHAR2
16783 )
16784 RETURN VARCHAR2
16785 IS
16786 l_component_type VARCHAR2(80) ;
16787 l_component_code VARCHAR2(30) ;
16788 l_component_type_code VARCHAR2(1) ;
16789 l_component_appl_id INTEGER ;
16790 l_amb_context_code VARCHAR2(30) ;
16791 l_log_module VARCHAR2(240) ;
16792 l_output_value VARCHAR2(30) ;
16793 BEGIN
16794 IF g_log_enabled THEN
16795 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_161';
16796 END IF;
16797 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16798
16799 trace
16800 (p_msg => 'BEGIN of AcctDerRule_161'
16801 ,p_level => C_LEVEL_PROCEDURE
16802 ,p_module => l_log_module);
16803
16804 END IF;
16805
16806 l_component_type := 'AMB_ADR';
16807 l_component_code := 'FA_NBV_RETIRED_LOSS_SEGMENT';
16808 l_component_type_code := 'S';
16809 l_component_appl_id := 140;
16810 l_amb_context_code := 'DEFAULT';
16811 x_transaction_coa_id := null;
16812 x_accounting_coa_id := null;
16813 x_flexfield_segment_code := 'GL_ACCOUNT';
16814 x_flex_value_set_id := null ;
16815
16816
16817 IF TO_NUMBER(p_source_5) IS NULL
16818 THEN
16819 --
16820 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16821
16822 trace
16823 (p_msg => 'END of AcctDerRule_161'
16824 ,p_level => C_LEVEL_PROCEDURE
16825 ,p_module => l_log_module);
16826
16827 END IF;
16828 x_value_combination_id := null ;
16829 x_value_segment_code := null ;
16830 x_value_type_code := 'S';
16831 l_output_value := TO_CHAR(p_source_24);
16832 RETURN l_output_value;
16833
16834 ELSE
16835 IF p_override_seg_flag = 'Y' THEN
16836 RETURN '#$NO_OVERRIDE#$';
16837 END IF;
16838 END IF;
16839
16840 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16841
16842 trace
16843 (p_msg => 'END of AcctDerRule_161(invalid)'
16844 ,p_level => C_LEVEL_PROCEDURE
16845 ,p_module => l_log_module);
16846
16847 END IF;
16848
16849 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
16853 l_output_value := null;
16850 x_value_combination_id := null;
16851 x_value_segment_code := null;
16852 x_value_type_code := null;
16854 xla_accounting_err_pkg.build_message
16855 (p_appli_s_name => 'XLA'
16856 ,p_msg_name => 'XLA_AP_INVALID_ADR'
16857 ,p_token_1 => 'COMPONENT_NAME'
16858 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
16859 l_component_type
16860 , l_component_code
16861 , l_component_type_code
16862 , l_component_appl_id
16863 , l_amb_context_code
16864 )
16865 ,p_token_2 => 'OWNER'
16866 ,p_value_2 => xla_lookups_pkg.get_meaning(
16867 'XLA_OWNER_TYPE'
16868 ,l_component_type_code
16869 )
16870 ,p_token_3 => 'PAD_NAME'
16871 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
16872 ,p_token_4 => 'PAD_OWNER'
16873 ,p_value_4 => xla_lookups_pkg.get_meaning(
16874 'XLA_OWNER_TYPE'
16875 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
16876 )
16877 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
16878 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
16879 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
16880 ,p_ae_header_id => NULL
16881 );
16882 RETURN l_output_value;
16883 EXCEPTION
16884 WHEN xla_exceptions_pkg.application_exception THEN
16885 RAISE;
16886 WHEN OTHERS THEN
16887 xla_exceptions_pkg.raise_message
16888 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_161');
16889 END AcctDerRule_161;
16890 --
16891
16892 ---------------------------------------
16893 --
16894 -- PRIVATE FUNCTION
16895 -- AcctDerRule_162
16896 --
16897 ---------------------------------------
16898 FUNCTION AcctDerRule_162 (
16899 p_application_id IN NUMBER
16900 , p_ae_header_id IN NUMBER
16901 , p_side IN VARCHAR2
16902 , p_override_seg_flag IN VARCHAR2
16903 --Generated Code Combination Identifier
16904 , p_source_5 IN NUMBER
16905 --Proceeds Of Sale Clearing Account
16906 , p_source_25 IN VARCHAR2
16907 , x_transaction_coa_id OUT NOCOPY NUMBER
16908 , x_accounting_coa_id OUT NOCOPY NUMBER
16909 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
16910 , x_flex_value_set_id OUT NOCOPY NUMBER
16911 , x_value_type_code OUT NOCOPY VARCHAR2
16912 , x_value_combination_id OUT NOCOPY NUMBER
16913 , x_value_segment_code OUT NOCOPY VARCHAR2
16914 )
16915 RETURN VARCHAR2
16916 IS
16917 l_component_type VARCHAR2(80) ;
16918 l_component_code VARCHAR2(30) ;
16919 l_component_type_code VARCHAR2(1) ;
16920 l_component_appl_id INTEGER ;
16921 l_amb_context_code VARCHAR2(30) ;
16922 l_log_module VARCHAR2(240) ;
16923 l_output_value VARCHAR2(30) ;
16924 BEGIN
16925 IF g_log_enabled THEN
16926 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_162';
16927 END IF;
16928 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16929
16930 trace
16931 (p_msg => 'BEGIN of AcctDerRule_162'
16932 ,p_level => C_LEVEL_PROCEDURE
16933 ,p_module => l_log_module);
16934
16935 END IF;
16936
16937 l_component_type := 'AMB_ADR';
16938 l_component_code := 'FA_PROC_OF_SALE_CLR_SEGMENT';
16939 l_component_type_code := 'S';
16940 l_component_appl_id := 140;
16941 l_amb_context_code := 'DEFAULT';
16942 x_transaction_coa_id := null;
16943 x_accounting_coa_id := null;
16944 x_flexfield_segment_code := 'GL_ACCOUNT';
16945 x_flex_value_set_id := null ;
16946
16947
16948 IF TO_NUMBER(p_source_5) IS NULL
16949 THEN
16950 --
16951 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16952
16953 trace
16954 (p_msg => 'END of AcctDerRule_162'
16955 ,p_level => C_LEVEL_PROCEDURE
16956 ,p_module => l_log_module);
16957
16958 END IF;
16959 x_value_combination_id := null ;
16960 x_value_segment_code := null ;
16961 x_value_type_code := 'S';
16962 l_output_value := TO_CHAR(p_source_25);
16963 RETURN l_output_value;
16964
16965 ELSE
16966 IF p_override_seg_flag = 'Y' THEN
16967 RETURN '#$NO_OVERRIDE#$';
16968 END IF;
16969 END IF;
16970
16971 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
16975 ,p_level => C_LEVEL_PROCEDURE
16972
16973 trace
16974 (p_msg => 'END of AcctDerRule_162(invalid)'
16976 ,p_module => l_log_module);
16977
16978 END IF;
16979
16980 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
16981 x_value_combination_id := null;
16982 x_value_segment_code := null;
16983 x_value_type_code := null;
16984 l_output_value := null;
16985 xla_accounting_err_pkg.build_message
16986 (p_appli_s_name => 'XLA'
16987 ,p_msg_name => 'XLA_AP_INVALID_ADR'
16988 ,p_token_1 => 'COMPONENT_NAME'
16989 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
16990 l_component_type
16991 , l_component_code
16992 , l_component_type_code
16993 , l_component_appl_id
16994 , l_amb_context_code
16995 )
16996 ,p_token_2 => 'OWNER'
16997 ,p_value_2 => xla_lookups_pkg.get_meaning(
16998 'XLA_OWNER_TYPE'
16999 ,l_component_type_code
17000 )
17001 ,p_token_3 => 'PAD_NAME'
17002 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
17003 ,p_token_4 => 'PAD_OWNER'
17004 ,p_value_4 => xla_lookups_pkg.get_meaning(
17005 'XLA_OWNER_TYPE'
17006 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
17007 )
17008 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
17009 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
17010 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
17011 ,p_ae_header_id => NULL
17012 );
17013 RETURN l_output_value;
17014 EXCEPTION
17015 WHEN xla_exceptions_pkg.application_exception THEN
17016 RAISE;
17017 WHEN OTHERS THEN
17018 xla_exceptions_pkg.raise_message
17019 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_162');
17020 END AcctDerRule_162;
17021 --
17022
17023 ---------------------------------------
17024 --
17025 -- PRIVATE FUNCTION
17026 -- AcctDerRule_163
17027 --
17028 ---------------------------------------
17029 FUNCTION AcctDerRule_163 (
17030 p_application_id IN NUMBER
17031 , p_ae_header_id IN NUMBER
17032 , p_side IN VARCHAR2
17033 , p_override_seg_flag IN VARCHAR2
17034 --Generated Code Combination Identifier
17035 , p_source_5 IN NUMBER
17036 --Proceeds Of Sale Gain Account
17037 , p_source_26 IN VARCHAR2
17038 , x_transaction_coa_id OUT NOCOPY NUMBER
17039 , x_accounting_coa_id OUT NOCOPY NUMBER
17040 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
17041 , x_flex_value_set_id OUT NOCOPY NUMBER
17042 , x_value_type_code OUT NOCOPY VARCHAR2
17043 , x_value_combination_id OUT NOCOPY NUMBER
17044 , x_value_segment_code OUT NOCOPY VARCHAR2
17045 )
17046 RETURN VARCHAR2
17047 IS
17048 l_component_type VARCHAR2(80) ;
17049 l_component_code VARCHAR2(30) ;
17050 l_component_type_code VARCHAR2(1) ;
17051 l_component_appl_id INTEGER ;
17052 l_amb_context_code VARCHAR2(30) ;
17053 l_log_module VARCHAR2(240) ;
17054 l_output_value VARCHAR2(30) ;
17055 BEGIN
17056 IF g_log_enabled THEN
17057 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_163';
17058 END IF;
17059 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17060
17061 trace
17062 (p_msg => 'BEGIN of AcctDerRule_163'
17063 ,p_level => C_LEVEL_PROCEDURE
17064 ,p_module => l_log_module);
17065
17066 END IF;
17067
17068 l_component_type := 'AMB_ADR';
17069 l_component_code := 'FA_PROC_OF_SALE_GAIN_SEGMENT';
17070 l_component_type_code := 'S';
17071 l_component_appl_id := 140;
17072 l_amb_context_code := 'DEFAULT';
17073 x_transaction_coa_id := null;
17074 x_accounting_coa_id := null;
17075 x_flexfield_segment_code := 'GL_ACCOUNT';
17076 x_flex_value_set_id := null ;
17077
17078
17079 IF TO_NUMBER(p_source_5) IS NULL
17080 THEN
17081 --
17082 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17083
17084 trace
17085 (p_msg => 'END of AcctDerRule_163'
17086 ,p_level => C_LEVEL_PROCEDURE
17087 ,p_module => l_log_module);
17088
17089 END IF;
17090 x_value_combination_id := null ;
17091 x_value_segment_code := null ;
17092 x_value_type_code := 'S';
17096 ELSE
17093 l_output_value := TO_CHAR(p_source_26);
17094 RETURN l_output_value;
17095
17097 IF p_override_seg_flag = 'Y' THEN
17098 RETURN '#$NO_OVERRIDE#$';
17099 END IF;
17100 END IF;
17101
17102 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17103
17104 trace
17105 (p_msg => 'END of AcctDerRule_163(invalid)'
17106 ,p_level => C_LEVEL_PROCEDURE
17107 ,p_module => l_log_module);
17108
17109 END IF;
17110
17111 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
17112 x_value_combination_id := null;
17113 x_value_segment_code := null;
17114 x_value_type_code := null;
17115 l_output_value := null;
17116 xla_accounting_err_pkg.build_message
17117 (p_appli_s_name => 'XLA'
17118 ,p_msg_name => 'XLA_AP_INVALID_ADR'
17119 ,p_token_1 => 'COMPONENT_NAME'
17120 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
17121 l_component_type
17122 , l_component_code
17123 , l_component_type_code
17124 , l_component_appl_id
17125 , l_amb_context_code
17126 )
17127 ,p_token_2 => 'OWNER'
17128 ,p_value_2 => xla_lookups_pkg.get_meaning(
17129 'XLA_OWNER_TYPE'
17130 ,l_component_type_code
17131 )
17132 ,p_token_3 => 'PAD_NAME'
17133 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
17134 ,p_token_4 => 'PAD_OWNER'
17135 ,p_value_4 => xla_lookups_pkg.get_meaning(
17136 'XLA_OWNER_TYPE'
17137 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
17138 )
17139 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
17140 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
17141 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
17142 ,p_ae_header_id => NULL
17143 );
17144 RETURN l_output_value;
17145 EXCEPTION
17146 WHEN xla_exceptions_pkg.application_exception THEN
17147 RAISE;
17148 WHEN OTHERS THEN
17149 xla_exceptions_pkg.raise_message
17150 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_163');
17151 END AcctDerRule_163;
17152 --
17153
17154 ---------------------------------------
17155 --
17156 -- PRIVATE FUNCTION
17157 -- AcctDerRule_164
17158 --
17159 ---------------------------------------
17160 FUNCTION AcctDerRule_164 (
17161 p_application_id IN NUMBER
17162 , p_ae_header_id IN NUMBER
17163 , p_side IN VARCHAR2
17164 , p_override_seg_flag IN VARCHAR2
17165 --Generated Code Combination Identifier
17166 , p_source_5 IN NUMBER
17167 --Proceeds Of Sale Loss Account
17168 , p_source_27 IN VARCHAR2
17169 , x_transaction_coa_id OUT NOCOPY NUMBER
17170 , x_accounting_coa_id OUT NOCOPY NUMBER
17171 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
17172 , x_flex_value_set_id OUT NOCOPY NUMBER
17173 , x_value_type_code OUT NOCOPY VARCHAR2
17174 , x_value_combination_id OUT NOCOPY NUMBER
17175 , x_value_segment_code OUT NOCOPY VARCHAR2
17176 )
17177 RETURN VARCHAR2
17178 IS
17179 l_component_type VARCHAR2(80) ;
17180 l_component_code VARCHAR2(30) ;
17181 l_component_type_code VARCHAR2(1) ;
17182 l_component_appl_id INTEGER ;
17183 l_amb_context_code VARCHAR2(30) ;
17184 l_log_module VARCHAR2(240) ;
17185 l_output_value VARCHAR2(30) ;
17186 BEGIN
17187 IF g_log_enabled THEN
17188 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_164';
17189 END IF;
17190 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17191
17192 trace
17193 (p_msg => 'BEGIN of AcctDerRule_164'
17194 ,p_level => C_LEVEL_PROCEDURE
17195 ,p_module => l_log_module);
17196
17197 END IF;
17198
17199 l_component_type := 'AMB_ADR';
17200 l_component_code := 'FA_PROC_OF_SALE_LOSS_SEGMENT';
17201 l_component_type_code := 'S';
17202 l_component_appl_id := 140;
17203 l_amb_context_code := 'DEFAULT';
17204 x_transaction_coa_id := null;
17205 x_accounting_coa_id := null;
17206 x_flexfield_segment_code := 'GL_ACCOUNT';
17207 x_flex_value_set_id := null ;
17208
17209
17210 IF TO_NUMBER(p_source_5) IS NULL
17211 THEN
17212 --
17213 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17214
17215 trace
17216 (p_msg => 'END of AcctDerRule_164'
17220 END IF;
17217 ,p_level => C_LEVEL_PROCEDURE
17218 ,p_module => l_log_module);
17219
17221 x_value_combination_id := null ;
17222 x_value_segment_code := null ;
17223 x_value_type_code := 'S';
17224 l_output_value := TO_CHAR(p_source_27);
17225 RETURN l_output_value;
17226
17227 ELSE
17228 IF p_override_seg_flag = 'Y' THEN
17229 RETURN '#$NO_OVERRIDE#$';
17230 END IF;
17231 END IF;
17232
17233 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17234
17235 trace
17236 (p_msg => 'END of AcctDerRule_164(invalid)'
17237 ,p_level => C_LEVEL_PROCEDURE
17238 ,p_module => l_log_module);
17239
17240 END IF;
17241
17242 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
17243 x_value_combination_id := null;
17244 x_value_segment_code := null;
17245 x_value_type_code := null;
17246 l_output_value := null;
17247 xla_accounting_err_pkg.build_message
17248 (p_appli_s_name => 'XLA'
17249 ,p_msg_name => 'XLA_AP_INVALID_ADR'
17250 ,p_token_1 => 'COMPONENT_NAME'
17251 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
17252 l_component_type
17253 , l_component_code
17254 , l_component_type_code
17255 , l_component_appl_id
17256 , l_amb_context_code
17257 )
17258 ,p_token_2 => 'OWNER'
17259 ,p_value_2 => xla_lookups_pkg.get_meaning(
17260 'XLA_OWNER_TYPE'
17261 ,l_component_type_code
17262 )
17263 ,p_token_3 => 'PAD_NAME'
17264 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
17265 ,p_token_4 => 'PAD_OWNER'
17266 ,p_value_4 => xla_lookups_pkg.get_meaning(
17267 'XLA_OWNER_TYPE'
17268 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
17269 )
17270 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
17271 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
17272 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
17273 ,p_ae_header_id => NULL
17274 );
17275 RETURN l_output_value;
17276 EXCEPTION
17277 WHEN xla_exceptions_pkg.application_exception THEN
17278 RAISE;
17279 WHEN OTHERS THEN
17280 xla_exceptions_pkg.raise_message
17281 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_164');
17282 END AcctDerRule_164;
17283 --
17284
17285 ---------------------------------------
17286 --
17287 -- PRIVATE FUNCTION
17288 -- AcctDerRule_165
17289 --
17290 ---------------------------------------
17291 FUNCTION AcctDerRule_165 (
17292 p_application_id IN NUMBER
17293 , p_ae_header_id IN NUMBER
17294 , p_side IN VARCHAR2
17295 , p_override_seg_flag IN VARCHAR2
17296 --Generated Code Combination Identifier
17297 , p_source_5 IN NUMBER
17298 --Revaluation Amortization Account
17299 , p_source_28 IN VARCHAR2
17300 , x_transaction_coa_id OUT NOCOPY NUMBER
17301 , x_accounting_coa_id OUT NOCOPY NUMBER
17302 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
17303 , x_flex_value_set_id OUT NOCOPY NUMBER
17304 , x_value_type_code OUT NOCOPY VARCHAR2
17305 , x_value_combination_id OUT NOCOPY NUMBER
17306 , x_value_segment_code OUT NOCOPY VARCHAR2
17307 )
17308 RETURN VARCHAR2
17309 IS
17310 l_component_type VARCHAR2(80) ;
17311 l_component_code VARCHAR2(30) ;
17312 l_component_type_code VARCHAR2(1) ;
17313 l_component_appl_id INTEGER ;
17314 l_amb_context_code VARCHAR2(30) ;
17315 l_log_module VARCHAR2(240) ;
17316 l_output_value VARCHAR2(30) ;
17317 BEGIN
17318 IF g_log_enabled THEN
17319 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_165';
17320 END IF;
17321 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17322
17323 trace
17324 (p_msg => 'BEGIN of AcctDerRule_165'
17325 ,p_level => C_LEVEL_PROCEDURE
17326 ,p_module => l_log_module);
17327
17328 END IF;
17329
17330 l_component_type := 'AMB_ADR';
17331 l_component_code := 'FA_REVAL_AMORT_SEGMENT';
17332 l_component_type_code := 'S';
17333 l_component_appl_id := 140;
17334 l_amb_context_code := 'DEFAULT';
17335 x_transaction_coa_id := null;
17336 x_accounting_coa_id := null;
17340
17337 x_flexfield_segment_code := 'GL_ACCOUNT';
17338 x_flex_value_set_id := null ;
17339
17341 IF TO_NUMBER(p_source_5) IS NULL
17342 THEN
17343 --
17344 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17345
17346 trace
17347 (p_msg => 'END of AcctDerRule_165'
17348 ,p_level => C_LEVEL_PROCEDURE
17349 ,p_module => l_log_module);
17350
17351 END IF;
17352 x_value_combination_id := null ;
17353 x_value_segment_code := null ;
17354 x_value_type_code := 'S';
17355 l_output_value := TO_CHAR(p_source_28);
17356 RETURN l_output_value;
17357
17358 ELSE
17359 IF p_override_seg_flag = 'Y' THEN
17360 RETURN '#$NO_OVERRIDE#$';
17361 END IF;
17362 END IF;
17363
17364 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17365
17366 trace
17367 (p_msg => 'END of AcctDerRule_165(invalid)'
17368 ,p_level => C_LEVEL_PROCEDURE
17369 ,p_module => l_log_module);
17370
17371 END IF;
17372
17373 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
17374 x_value_combination_id := null;
17375 x_value_segment_code := null;
17376 x_value_type_code := null;
17377 l_output_value := null;
17378 xla_accounting_err_pkg.build_message
17379 (p_appli_s_name => 'XLA'
17380 ,p_msg_name => 'XLA_AP_INVALID_ADR'
17381 ,p_token_1 => 'COMPONENT_NAME'
17382 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
17383 l_component_type
17384 , l_component_code
17385 , l_component_type_code
17386 , l_component_appl_id
17387 , l_amb_context_code
17388 )
17389 ,p_token_2 => 'OWNER'
17390 ,p_value_2 => xla_lookups_pkg.get_meaning(
17391 'XLA_OWNER_TYPE'
17392 ,l_component_type_code
17393 )
17394 ,p_token_3 => 'PAD_NAME'
17395 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
17396 ,p_token_4 => 'PAD_OWNER'
17397 ,p_value_4 => xla_lookups_pkg.get_meaning(
17398 'XLA_OWNER_TYPE'
17399 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
17400 )
17401 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
17402 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
17403 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
17404 ,p_ae_header_id => NULL
17405 );
17406 RETURN l_output_value;
17407 EXCEPTION
17408 WHEN xla_exceptions_pkg.application_exception THEN
17409 RAISE;
17410 WHEN OTHERS THEN
17411 xla_exceptions_pkg.raise_message
17412 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_165');
17413 END AcctDerRule_165;
17414 --
17415
17416 ---------------------------------------
17417 --
17418 -- PRIVATE FUNCTION
17419 -- AcctDerRule_166
17420 --
17421 ---------------------------------------
17422 FUNCTION AcctDerRule_166 (
17423 p_application_id IN NUMBER
17424 , p_ae_header_id IN NUMBER
17425 , p_side IN VARCHAR2
17426 , p_override_seg_flag IN VARCHAR2
17427 --Generated Code Combination Identifier
17428 , p_source_5 IN NUMBER
17429 --Revaluation Reserve Retired Gain Account
17430 , p_source_29 IN VARCHAR2
17431 , x_transaction_coa_id OUT NOCOPY NUMBER
17432 , x_accounting_coa_id OUT NOCOPY NUMBER
17433 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
17434 , x_flex_value_set_id OUT NOCOPY NUMBER
17435 , x_value_type_code OUT NOCOPY VARCHAR2
17436 , x_value_combination_id OUT NOCOPY NUMBER
17437 , x_value_segment_code OUT NOCOPY VARCHAR2
17438 )
17439 RETURN VARCHAR2
17440 IS
17441 l_component_type VARCHAR2(80) ;
17442 l_component_code VARCHAR2(30) ;
17443 l_component_type_code VARCHAR2(1) ;
17444 l_component_appl_id INTEGER ;
17445 l_amb_context_code VARCHAR2(30) ;
17446 l_log_module VARCHAR2(240) ;
17447 l_output_value VARCHAR2(30) ;
17448 BEGIN
17449 IF g_log_enabled THEN
17450 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_166';
17451 END IF;
17452 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17453
17454 trace
17455 (p_msg => 'BEGIN of AcctDerRule_166'
17456 ,p_level => C_LEVEL_PROCEDURE
17457 ,p_module => l_log_module);
17458
17459 END IF;
17460
17461 l_component_type := 'AMB_ADR';
17465 l_amb_context_code := 'DEFAULT';
17462 l_component_code := 'FA_REVAL_RES_RET_GAIN_SEGMENT';
17463 l_component_type_code := 'S';
17464 l_component_appl_id := 140;
17466 x_transaction_coa_id := null;
17467 x_accounting_coa_id := null;
17468 x_flexfield_segment_code := 'GL_ACCOUNT';
17469 x_flex_value_set_id := null ;
17470
17471
17472 IF TO_NUMBER(p_source_5) IS NULL
17473 THEN
17474 --
17475 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17476
17477 trace
17478 (p_msg => 'END of AcctDerRule_166'
17479 ,p_level => C_LEVEL_PROCEDURE
17480 ,p_module => l_log_module);
17481
17482 END IF;
17483 x_value_combination_id := null ;
17484 x_value_segment_code := null ;
17485 x_value_type_code := 'S';
17486 l_output_value := TO_CHAR(p_source_29);
17487 RETURN l_output_value;
17488
17489 ELSE
17490 IF p_override_seg_flag = 'Y' THEN
17491 RETURN '#$NO_OVERRIDE#$';
17492 END IF;
17493 END IF;
17494
17495 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17496
17497 trace
17498 (p_msg => 'END of AcctDerRule_166(invalid)'
17499 ,p_level => C_LEVEL_PROCEDURE
17500 ,p_module => l_log_module);
17501
17502 END IF;
17503
17504 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
17505 x_value_combination_id := null;
17506 x_value_segment_code := null;
17507 x_value_type_code := null;
17508 l_output_value := null;
17509 xla_accounting_err_pkg.build_message
17510 (p_appli_s_name => 'XLA'
17511 ,p_msg_name => 'XLA_AP_INVALID_ADR'
17512 ,p_token_1 => 'COMPONENT_NAME'
17513 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
17514 l_component_type
17515 , l_component_code
17516 , l_component_type_code
17517 , l_component_appl_id
17518 , l_amb_context_code
17519 )
17520 ,p_token_2 => 'OWNER'
17521 ,p_value_2 => xla_lookups_pkg.get_meaning(
17522 'XLA_OWNER_TYPE'
17523 ,l_component_type_code
17524 )
17525 ,p_token_3 => 'PAD_NAME'
17526 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
17527 ,p_token_4 => 'PAD_OWNER'
17528 ,p_value_4 => xla_lookups_pkg.get_meaning(
17529 'XLA_OWNER_TYPE'
17530 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
17531 )
17532 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
17533 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
17534 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
17535 ,p_ae_header_id => NULL
17536 );
17537 RETURN l_output_value;
17538 EXCEPTION
17539 WHEN xla_exceptions_pkg.application_exception THEN
17540 RAISE;
17541 WHEN OTHERS THEN
17542 xla_exceptions_pkg.raise_message
17543 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_166');
17544 END AcctDerRule_166;
17545 --
17546
17547 ---------------------------------------
17548 --
17549 -- PRIVATE FUNCTION
17550 -- AcctDerRule_167
17551 --
17552 ---------------------------------------
17553 FUNCTION AcctDerRule_167 (
17554 p_application_id IN NUMBER
17555 , p_ae_header_id IN NUMBER
17556 , p_side IN VARCHAR2
17557 , p_override_seg_flag IN VARCHAR2
17558 --Generated Code Combination Identifier
17559 , p_source_5 IN NUMBER
17560 --Revaluation Reserve Retired Loss Account
17561 , p_source_30 IN VARCHAR2
17562 , x_transaction_coa_id OUT NOCOPY NUMBER
17563 , x_accounting_coa_id OUT NOCOPY NUMBER
17564 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
17565 , x_flex_value_set_id OUT NOCOPY NUMBER
17566 , x_value_type_code OUT NOCOPY VARCHAR2
17567 , x_value_combination_id OUT NOCOPY NUMBER
17568 , x_value_segment_code OUT NOCOPY VARCHAR2
17569 )
17570 RETURN VARCHAR2
17571 IS
17572 l_component_type VARCHAR2(80) ;
17573 l_component_code VARCHAR2(30) ;
17574 l_component_type_code VARCHAR2(1) ;
17575 l_component_appl_id INTEGER ;
17576 l_amb_context_code VARCHAR2(30) ;
17577 l_log_module VARCHAR2(240) ;
17578 l_output_value VARCHAR2(30) ;
17579 BEGIN
17580 IF g_log_enabled THEN
17581 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_167';
17582 END IF;
17586 (p_msg => 'BEGIN of AcctDerRule_167'
17583 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17584
17585 trace
17587 ,p_level => C_LEVEL_PROCEDURE
17588 ,p_module => l_log_module);
17589
17590 END IF;
17591
17592 l_component_type := 'AMB_ADR';
17593 l_component_code := 'FA_REVAL_RES_RET_LOSS_SEGMENT';
17594 l_component_type_code := 'S';
17595 l_component_appl_id := 140;
17596 l_amb_context_code := 'DEFAULT';
17597 x_transaction_coa_id := null;
17598 x_accounting_coa_id := null;
17599 x_flexfield_segment_code := 'GL_ACCOUNT';
17600 x_flex_value_set_id := null ;
17601
17602
17603 IF TO_NUMBER(p_source_5) IS NULL
17604 THEN
17605 --
17606 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17607
17608 trace
17609 (p_msg => 'END of AcctDerRule_167'
17610 ,p_level => C_LEVEL_PROCEDURE
17611 ,p_module => l_log_module);
17612
17613 END IF;
17614 x_value_combination_id := null ;
17615 x_value_segment_code := null ;
17616 x_value_type_code := 'S';
17617 l_output_value := TO_CHAR(p_source_30);
17618 RETURN l_output_value;
17619
17620 ELSE
17621 IF p_override_seg_flag = 'Y' THEN
17622 RETURN '#$NO_OVERRIDE#$';
17623 END IF;
17624 END IF;
17625
17626 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17627
17628 trace
17629 (p_msg => 'END of AcctDerRule_167(invalid)'
17630 ,p_level => C_LEVEL_PROCEDURE
17631 ,p_module => l_log_module);
17632
17633 END IF;
17634
17635 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
17636 x_value_combination_id := null;
17637 x_value_segment_code := null;
17638 x_value_type_code := null;
17639 l_output_value := null;
17640 xla_accounting_err_pkg.build_message
17641 (p_appli_s_name => 'XLA'
17642 ,p_msg_name => 'XLA_AP_INVALID_ADR'
17643 ,p_token_1 => 'COMPONENT_NAME'
17644 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
17645 l_component_type
17646 , l_component_code
17647 , l_component_type_code
17648 , l_component_appl_id
17649 , l_amb_context_code
17650 )
17651 ,p_token_2 => 'OWNER'
17652 ,p_value_2 => xla_lookups_pkg.get_meaning(
17653 'XLA_OWNER_TYPE'
17654 ,l_component_type_code
17655 )
17656 ,p_token_3 => 'PAD_NAME'
17657 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
17658 ,p_token_4 => 'PAD_OWNER'
17659 ,p_value_4 => xla_lookups_pkg.get_meaning(
17660 'XLA_OWNER_TYPE'
17661 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
17662 )
17663 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
17664 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
17665 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
17666 ,p_ae_header_id => NULL
17667 );
17668 RETURN l_output_value;
17669 EXCEPTION
17670 WHEN xla_exceptions_pkg.application_exception THEN
17671 RAISE;
17672 WHEN OTHERS THEN
17673 xla_exceptions_pkg.raise_message
17674 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_167');
17675 END AcctDerRule_167;
17676 --
17677
17678 ---------------------------------------
17679 --
17680 -- PRIVATE FUNCTION
17681 -- AcctDerRule_168
17682 --
17683 ---------------------------------------
17684 FUNCTION AcctDerRule_168 (
17685 p_application_id IN NUMBER
17686 , p_ae_header_id IN NUMBER
17687 , p_side IN VARCHAR2
17688 , p_override_seg_flag IN VARCHAR2
17689 --Depreciation Reserve Account
17690 , p_source_12 IN VARCHAR2
17691 --Generated Offset Code Combination Identifier
17692 , p_source_19 IN NUMBER
17693 , x_transaction_coa_id OUT NOCOPY NUMBER
17694 , x_accounting_coa_id OUT NOCOPY NUMBER
17695 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
17696 , x_flex_value_set_id OUT NOCOPY NUMBER
17697 , x_value_type_code OUT NOCOPY VARCHAR2
17698 , x_value_combination_id OUT NOCOPY NUMBER
17699 , x_value_segment_code OUT NOCOPY VARCHAR2
17700 )
17701 RETURN VARCHAR2
17702 IS
17703 l_component_type VARCHAR2(80) ;
17704 l_component_code VARCHAR2(30) ;
17705 l_component_type_code VARCHAR2(1) ;
17709 l_output_value VARCHAR2(30) ;
17706 l_component_appl_id INTEGER ;
17707 l_amb_context_code VARCHAR2(30) ;
17708 l_log_module VARCHAR2(240) ;
17710 BEGIN
17711 IF g_log_enabled THEN
17712 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_168';
17713 END IF;
17714 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17715
17716 trace
17717 (p_msg => 'BEGIN of AcctDerRule_168'
17718 ,p_level => C_LEVEL_PROCEDURE
17719 ,p_module => l_log_module);
17720
17721 END IF;
17722
17723 l_component_type := 'AMB_ADR';
17724 l_component_code := 'FA_UPL_CAT_RES_ACCOUNT_SEGMENT';
17725 l_component_type_code := 'S';
17726 l_component_appl_id := 140;
17727 l_amb_context_code := 'DEFAULT';
17728 x_transaction_coa_id := null;
17729 x_accounting_coa_id := null;
17730 x_flexfield_segment_code := 'GL_ACCOUNT';
17731 x_flex_value_set_id := null ;
17732
17733
17734 IF TO_NUMBER(p_source_19) IS NULL
17735 THEN
17736 --
17737 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17738
17739 trace
17740 (p_msg => 'END of AcctDerRule_168'
17741 ,p_level => C_LEVEL_PROCEDURE
17742 ,p_module => l_log_module);
17743
17744 END IF;
17745 x_value_combination_id := null ;
17746 x_value_segment_code := null ;
17747 x_value_type_code := 'S';
17748 l_output_value := TO_CHAR(p_source_12);
17749 RETURN l_output_value;
17750
17751 ELSE
17752 IF p_override_seg_flag = 'Y' THEN
17753 RETURN '#$NO_OVERRIDE#$';
17754 END IF;
17755 END IF;
17756
17757 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17758
17759 trace
17760 (p_msg => 'END of AcctDerRule_168(invalid)'
17761 ,p_level => C_LEVEL_PROCEDURE
17762 ,p_module => l_log_module);
17763
17764 END IF;
17765
17766 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
17767 x_value_combination_id := null;
17768 x_value_segment_code := null;
17769 x_value_type_code := null;
17770 l_output_value := null;
17771 xla_accounting_err_pkg.build_message
17772 (p_appli_s_name => 'XLA'
17773 ,p_msg_name => 'XLA_AP_INVALID_ADR'
17774 ,p_token_1 => 'COMPONENT_NAME'
17775 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
17776 l_component_type
17777 , l_component_code
17778 , l_component_type_code
17779 , l_component_appl_id
17780 , l_amb_context_code
17781 )
17782 ,p_token_2 => 'OWNER'
17783 ,p_value_2 => xla_lookups_pkg.get_meaning(
17784 'XLA_OWNER_TYPE'
17785 ,l_component_type_code
17786 )
17787 ,p_token_3 => 'PAD_NAME'
17788 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
17789 ,p_token_4 => 'PAD_OWNER'
17790 ,p_value_4 => xla_lookups_pkg.get_meaning(
17791 'XLA_OWNER_TYPE'
17792 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
17793 )
17794 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
17795 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
17796 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
17797 ,p_ae_header_id => NULL
17798 );
17799 RETURN l_output_value;
17800 EXCEPTION
17801 WHEN xla_exceptions_pkg.application_exception THEN
17802 RAISE;
17803 WHEN OTHERS THEN
17804 xla_exceptions_pkg.raise_message
17805 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_168');
17806 END AcctDerRule_168;
17807 --
17808
17809 ---------------------------------------
17810 --
17811 -- PRIVATE FUNCTION
17812 -- AcctDerRule_169
17813 --
17814 ---------------------------------------
17815 FUNCTION AcctDerRule_169 (
17816 p_application_id IN NUMBER
17817 , p_ae_header_id IN NUMBER
17818 , p_side IN VARCHAR2
17819 , p_override_seg_flag IN VARCHAR2
17820 --Generated Code Combination Identifier
17821 , p_source_5 IN NUMBER
17822 --Expense Account Code Combination Identifier
17823 , p_source_31 IN NUMBER
17824 , x_transaction_coa_id OUT NOCOPY NUMBER
17825 , x_accounting_coa_id OUT NOCOPY NUMBER
17826 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
17827 , x_flex_value_set_id OUT NOCOPY NUMBER
17828 , x_value_type_code OUT NOCOPY VARCHAR2
17829 , x_value_combination_id OUT NOCOPY NUMBER
17830 , x_value_segment_code OUT NOCOPY VARCHAR2
17831 )
17832 RETURN VARCHAR2
17833 IS
17834 l_component_type VARCHAR2(80) ;
17838 l_amb_context_code VARCHAR2(30) ;
17835 l_component_code VARCHAR2(30) ;
17836 l_component_type_code VARCHAR2(1) ;
17837 l_component_appl_id INTEGER ;
17839 l_log_module VARCHAR2(240) ;
17840 l_output_value VARCHAR2(30) ;
17841 BEGIN
17842 IF g_log_enabled THEN
17843 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_169';
17844 END IF;
17845 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17846
17847 trace
17848 (p_msg => 'BEGIN of AcctDerRule_169'
17849 ,p_level => C_LEVEL_PROCEDURE
17850 ,p_module => l_log_module);
17851
17852 END IF;
17853
17854 l_component_type := 'AMB_ADR';
17855 l_component_code := 'FA_EXPENSE_ACCT';
17856 l_component_type_code := 'S';
17857 l_component_appl_id := 140;
17858 l_amb_context_code := 'DEFAULT';
17859 x_transaction_coa_id := null;
17860 x_accounting_coa_id := null;
17861 x_flexfield_segment_code := 'GL_BALANCING';
17862 x_flex_value_set_id := null ;
17863
17864
17865 IF TO_NUMBER(p_source_5) IS NULL
17866 THEN
17867 --
17868 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17869
17870 trace
17871 (p_msg => 'END of AcctDerRule_169'
17872 ,p_level => C_LEVEL_PROCEDURE
17873 ,p_module => l_log_module);
17874
17875 END IF;
17876 x_value_combination_id := TO_NUMBER(p_source_31) ;
17877 x_value_segment_code := 'GL_BALANCING' ;
17878 x_value_type_code := 'S';
17879 l_output_value := null;
17880 RETURN l_output_value;
17881
17882 ELSE
17883 IF p_override_seg_flag = 'Y' THEN
17884 RETURN '#$NO_OVERRIDE#$';
17885 END IF;
17886 END IF;
17887
17888 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17889
17890 trace
17891 (p_msg => 'END of AcctDerRule_169(invalid)'
17892 ,p_level => C_LEVEL_PROCEDURE
17893 ,p_module => l_log_module);
17894
17895 END IF;
17896
17897 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
17898 x_value_combination_id := null;
17899 x_value_segment_code := null;
17900 x_value_type_code := null;
17901 l_output_value := null;
17902 xla_accounting_err_pkg.build_message
17903 (p_appli_s_name => 'XLA'
17904 ,p_msg_name => 'XLA_AP_INVALID_ADR'
17905 ,p_token_1 => 'COMPONENT_NAME'
17906 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
17907 l_component_type
17908 , l_component_code
17909 , l_component_type_code
17910 , l_component_appl_id
17911 , l_amb_context_code
17912 )
17913 ,p_token_2 => 'OWNER'
17914 ,p_value_2 => xla_lookups_pkg.get_meaning(
17915 'XLA_OWNER_TYPE'
17916 ,l_component_type_code
17917 )
17918 ,p_token_3 => 'PAD_NAME'
17919 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
17920 ,p_token_4 => 'PAD_OWNER'
17921 ,p_value_4 => xla_lookups_pkg.get_meaning(
17922 'XLA_OWNER_TYPE'
17923 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
17924 )
17925 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
17926 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
17927 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
17928 ,p_ae_header_id => NULL
17929 );
17930 RETURN l_output_value;
17931 EXCEPTION
17932 WHEN xla_exceptions_pkg.application_exception THEN
17933 RAISE;
17934 WHEN OTHERS THEN
17935 xla_exceptions_pkg.raise_message
17936 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_169');
17937 END AcctDerRule_169;
17938 --
17939
17940 ---------------------------------------
17941 --
17942 -- PRIVATE FUNCTION
17943 -- AcctDerRule_170
17944 --
17945 ---------------------------------------
17946 FUNCTION AcctDerRule_170 (
17947 p_application_id IN NUMBER
17948 , p_ae_header_id IN NUMBER
17949 , p_side IN VARCHAR2
17950 , p_override_seg_flag IN VARCHAR2
17951 --Generated Code Combination Identifier
17952 , p_source_5 IN NUMBER
17953 --Payables Code Combination Identifier
17954 , p_source_8 IN NUMBER
17955 --Expense Account Code Combination Identifier
17956 , p_source_31 IN NUMBER
17957 , x_transaction_coa_id OUT NOCOPY NUMBER
17958 , x_accounting_coa_id OUT NOCOPY NUMBER
17959 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
17963 , x_value_segment_code OUT NOCOPY VARCHAR2
17960 , x_flex_value_set_id OUT NOCOPY NUMBER
17961 , x_value_type_code OUT NOCOPY VARCHAR2
17962 , x_value_combination_id OUT NOCOPY NUMBER
17964 )
17965 RETURN VARCHAR2
17966 IS
17967 l_component_type VARCHAR2(80) ;
17968 l_component_code VARCHAR2(30) ;
17969 l_component_type_code VARCHAR2(1) ;
17970 l_component_appl_id INTEGER ;
17971 l_amb_context_code VARCHAR2(30) ;
17972 l_log_module VARCHAR2(240) ;
17973 l_output_value VARCHAR2(30) ;
17974 BEGIN
17975 IF g_log_enabled THEN
17976 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_170';
17977 END IF;
17978 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
17979
17980 trace
17981 (p_msg => 'BEGIN of AcctDerRule_170'
17982 ,p_level => C_LEVEL_PROCEDURE
17983 ,p_module => l_log_module);
17984
17985 END IF;
17986
17987 l_component_type := 'AMB_ADR';
17988 l_component_code := 'FA_EXPENSE_ACCT_PAY';
17989 l_component_type_code := 'S';
17990 l_component_appl_id := 140;
17991 l_amb_context_code := 'DEFAULT';
17992 x_transaction_coa_id := null;
17993 x_accounting_coa_id := null;
17994 x_flexfield_segment_code := 'GL_BALANCING';
17995 x_flex_value_set_id := null ;
17996
17997
17998 IF TO_NUMBER(p_source_5) IS NULL AND
17999 TO_NUMBER(p_source_8) IS NULL
18000 THEN
18001 --
18002 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18003
18004 trace
18005 (p_msg => 'END of AcctDerRule_170'
18006 ,p_level => C_LEVEL_PROCEDURE
18007 ,p_module => l_log_module);
18008
18009 END IF;
18010 x_value_combination_id := TO_NUMBER(p_source_31) ;
18011 x_value_segment_code := 'GL_BALANCING' ;
18012 x_value_type_code := 'S';
18013 l_output_value := null;
18014 RETURN l_output_value;
18015
18016 ELSE
18017 IF p_override_seg_flag = 'Y' THEN
18018 RETURN '#$NO_OVERRIDE#$';
18019 END IF;
18020 END IF;
18021
18022 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18023
18024 trace
18025 (p_msg => 'END of AcctDerRule_170(invalid)'
18026 ,p_level => C_LEVEL_PROCEDURE
18027 ,p_module => l_log_module);
18028
18029 END IF;
18030
18031 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
18032 x_value_combination_id := null;
18033 x_value_segment_code := null;
18034 x_value_type_code := null;
18035 l_output_value := null;
18036 xla_accounting_err_pkg.build_message
18037 (p_appli_s_name => 'XLA'
18038 ,p_msg_name => 'XLA_AP_INVALID_ADR'
18039 ,p_token_1 => 'COMPONENT_NAME'
18040 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
18041 l_component_type
18042 , l_component_code
18043 , l_component_type_code
18044 , l_component_appl_id
18045 , l_amb_context_code
18046 )
18047 ,p_token_2 => 'OWNER'
18048 ,p_value_2 => xla_lookups_pkg.get_meaning(
18049 'XLA_OWNER_TYPE'
18050 ,l_component_type_code
18051 )
18052 ,p_token_3 => 'PAD_NAME'
18053 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
18054 ,p_token_4 => 'PAD_OWNER'
18055 ,p_value_4 => xla_lookups_pkg.get_meaning(
18056 'XLA_OWNER_TYPE'
18057 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
18058 )
18059 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
18060 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
18061 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
18062 ,p_ae_header_id => NULL
18063 );
18064 RETURN l_output_value;
18065 EXCEPTION
18066 WHEN xla_exceptions_pkg.application_exception THEN
18067 RAISE;
18068 WHEN OTHERS THEN
18069 xla_exceptions_pkg.raise_message
18070 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_170');
18071 END AcctDerRule_170;
18072 --
18073
18074 ---------------------------------------
18075 --
18076 -- PRIVATE FUNCTION
18077 -- AcctDerRule_171
18078 --
18079 ---------------------------------------
18080 FUNCTION AcctDerRule_171 (
18081 p_application_id IN NUMBER
18082 , p_ae_header_id IN NUMBER
18083 , p_side IN VARCHAR2
18084 , p_override_seg_flag IN VARCHAR2
18085 --Generated Offset Code Combination Identifier
18086 , p_source_19 IN NUMBER
18090 , x_accounting_coa_id OUT NOCOPY NUMBER
18087 --Expense Account Code Combination Identifier
18088 , p_source_31 IN NUMBER
18089 , x_transaction_coa_id OUT NOCOPY NUMBER
18091 , x_flexfield_segment_code OUT NOCOPY VARCHAR2
18092 , x_flex_value_set_id OUT NOCOPY NUMBER
18093 , x_value_type_code OUT NOCOPY VARCHAR2
18094 , x_value_combination_id OUT NOCOPY NUMBER
18095 , x_value_segment_code OUT NOCOPY VARCHAR2
18096 )
18097 RETURN VARCHAR2
18098 IS
18099 l_component_type VARCHAR2(80) ;
18100 l_component_code VARCHAR2(30) ;
18101 l_component_type_code VARCHAR2(1) ;
18102 l_component_appl_id INTEGER ;
18103 l_amb_context_code VARCHAR2(30) ;
18104 l_log_module VARCHAR2(240) ;
18105 l_output_value VARCHAR2(30) ;
18106 BEGIN
18107 IF g_log_enabled THEN
18108 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_171';
18109 END IF;
18110 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18111
18112 trace
18113 (p_msg => 'BEGIN of AcctDerRule_171'
18114 ,p_level => C_LEVEL_PROCEDURE
18115 ,p_module => l_log_module);
18116
18117 END IF;
18118
18119 l_component_type := 'AMB_ADR';
18120 l_component_code := 'FA_UPL_EXP_ACCOUNT';
18121 l_component_type_code := 'S';
18122 l_component_appl_id := 140;
18123 l_amb_context_code := 'DEFAULT';
18124 x_transaction_coa_id := null;
18125 x_accounting_coa_id := null;
18126 x_flexfield_segment_code := 'GL_BALANCING';
18127 x_flex_value_set_id := null ;
18128
18129
18130 IF TO_NUMBER(p_source_19) IS NULL
18131 THEN
18132 --
18133 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18134
18135 trace
18136 (p_msg => 'END of AcctDerRule_171'
18137 ,p_level => C_LEVEL_PROCEDURE
18138 ,p_module => l_log_module);
18139
18140 END IF;
18141 x_value_combination_id := TO_NUMBER(p_source_31) ;
18142 x_value_segment_code := 'GL_BALANCING' ;
18143 x_value_type_code := 'S';
18144 l_output_value := null;
18145 RETURN l_output_value;
18146
18147 ELSE
18148 IF p_override_seg_flag = 'Y' THEN
18149 RETURN '#$NO_OVERRIDE#$';
18150 END IF;
18151 END IF;
18152
18153 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18154
18155 trace
18156 (p_msg => 'END of AcctDerRule_171(invalid)'
18157 ,p_level => C_LEVEL_PROCEDURE
18158 ,p_module => l_log_module);
18159
18160 END IF;
18161
18162 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
18163 x_value_combination_id := null;
18164 x_value_segment_code := null;
18165 x_value_type_code := null;
18166 l_output_value := null;
18167 xla_accounting_err_pkg.build_message
18168 (p_appli_s_name => 'XLA'
18169 ,p_msg_name => 'XLA_AP_INVALID_ADR'
18170 ,p_token_1 => 'COMPONENT_NAME'
18171 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
18172 l_component_type
18173 , l_component_code
18174 , l_component_type_code
18175 , l_component_appl_id
18176 , l_amb_context_code
18177 )
18178 ,p_token_2 => 'OWNER'
18179 ,p_value_2 => xla_lookups_pkg.get_meaning(
18180 'XLA_OWNER_TYPE'
18181 ,l_component_type_code
18182 )
18183 ,p_token_3 => 'PAD_NAME'
18184 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
18185 ,p_token_4 => 'PAD_OWNER'
18186 ,p_value_4 => xla_lookups_pkg.get_meaning(
18187 'XLA_OWNER_TYPE'
18188 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
18189 )
18190 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
18191 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
18192 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
18193 ,p_ae_header_id => NULL
18194 );
18195 RETURN l_output_value;
18196 EXCEPTION
18197 WHEN xla_exceptions_pkg.application_exception THEN
18198 RAISE;
18199 WHEN OTHERS THEN
18200 xla_exceptions_pkg.raise_message
18201 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_171');
18202 END AcctDerRule_171;
18203 --
18204
18205 ---------------------------------------
18206 --
18207 -- PRIVATE FUNCTION
18208 -- AcctDerRule_172
18209 --
18210 ---------------------------------------
18214 , p_side IN VARCHAR2
18211 FUNCTION AcctDerRule_172 (
18212 p_application_id IN NUMBER
18213 , p_ae_header_id IN NUMBER
18215 --Generated Code Combination Identifier
18216 , p_source_5 IN NUMBER
18217 --Payables Code Combination Identifier
18218 , p_source_8 IN NUMBER
18219 --Default Code Combination Identifier
18220 , p_source_32 IN NUMBER
18221 , x_transaction_coa_id OUT NOCOPY NUMBER
18222 , x_accounting_coa_id OUT NOCOPY NUMBER
18223 , x_value_type_code OUT NOCOPY VARCHAR2
18224 )
18225 RETURN NUMBER
18226 IS
18227 l_component_type VARCHAR2(80) ;
18228 l_component_code VARCHAR2(30) ;
18229 l_component_type_code VARCHAR2(1) ;
18230 l_component_appl_id INTEGER ;
18231 l_amb_context_code VARCHAR2(30) ;
18232 l_log_module VARCHAR2(240) ;
18233 l_output_value NUMBER ;
18234 BEGIN
18235 IF g_log_enabled THEN
18236 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_172';
18237 END IF;
18238 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18239 trace
18240 (p_msg => 'BEGIN of AcctDerRule_172'
18241 ,p_level => C_LEVEL_PROCEDURE
18242 ,p_module => l_log_module);
18243 END IF;
18244 --
18245 l_component_type := 'AMB_ADR';
18246 l_component_code := 'FA_CAT_CIP_COST_CLEARING';
18247 l_component_type_code := 'S';
18248 l_component_appl_id := 140;
18249 l_amb_context_code := 'DEFAULT';
18250 x_transaction_coa_id := null;
18251 x_accounting_coa_id := null;
18252 --
18253
18254 IF TO_NUMBER(p_source_8) IS NOT NULL
18255 THEN
18256 --
18257 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18258 trace
18259 (p_msg => 'END of AcctDerRule_172'
18260 ,p_level => C_LEVEL_PROCEDURE
18261 ,p_module => l_log_module);
18262 END IF;
18263 x_value_type_code := 'S';
18264 l_output_value := TO_NUMBER(TO_NUMBER(p_source_8));
18265 RETURN l_output_value;
18266
18267 ELSIF TO_NUMBER(p_source_5) IS NOT NULL AND
18268 TO_NUMBER(p_source_8) IS NULL
18269 THEN
18270 --
18271 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18272 trace
18273 (p_msg => 'END of AcctDerRule_172'
18274 ,p_level => C_LEVEL_PROCEDURE
18275 ,p_module => l_log_module);
18276 END IF;
18277 x_value_type_code := 'S';
18278 l_output_value := TO_NUMBER(TO_NUMBER(p_source_5));
18279 RETURN l_output_value;
18280
18281 ELSIF TO_NUMBER(p_source_5) IS NULL AND
18282 TO_NUMBER(p_source_8) IS NULL
18283 THEN
18284 --
18285 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18286 trace
18287 (p_msg => 'END of AcctDerRule_172'
18288 ,p_level => C_LEVEL_PROCEDURE
18289 ,p_module => l_log_module);
18290 END IF;
18291 x_value_type_code := 'S';
18292 l_output_value := TO_NUMBER(TO_NUMBER(p_source_32));
18293 RETURN l_output_value;
18294
18295 END IF;
18296 --
18297 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18298 trace
18299 (p_msg => 'END of AcctDerRule_172(invalid)'
18300 ,p_level => C_LEVEL_PROCEDURE
18301 ,p_module => l_log_module);
18302 END IF;
18303 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
18304 x_value_type_code := null;
18305 l_output_value := null;
18306 xla_accounting_err_pkg.build_message
18307 (p_appli_s_name => 'XLA'
18308 ,p_msg_name => 'XLA_AP_INVALID_ADR'
18309 ,p_token_1 => 'COMPONENT_NAME'
18310 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
18311 l_component_type
18312 , l_component_code
18313 , l_component_type_code
18314 , l_component_appl_id
18315 , l_amb_context_code
18316 )
18317 ,p_token_2 => 'OWNER'
18318 ,p_value_2 => xla_lookups_pkg.get_meaning(
18319 'XLA_OWNER_TYPE'
18320 ,l_component_type_code
18321 )
18322 ,p_token_3 => 'PAD_NAME'
18323 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
18324 ,p_token_4 => 'PAD_OWNER'
18325 ,p_value_4 => xla_lookups_pkg.get_meaning(
18326 'XLA_OWNER_TYPE'
18327 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
18328 )
18329 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
18330 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
18334 RETURN l_output_value;
18331 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
18332 ,p_ae_header_id => NULL
18333 );
18335 EXCEPTION
18336 WHEN xla_exceptions_pkg.application_exception THEN
18337 RAISE;
18338 WHEN OTHERS THEN
18339 xla_exceptions_pkg.raise_message
18340 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_172');
18341 END AcctDerRule_172;
18342 --
18343
18344 ---------------------------------------
18345 --
18346 -- PRIVATE FUNCTION
18347 -- AcctDerRule_173
18348 --
18349 ---------------------------------------
18350 FUNCTION AcctDerRule_173 (
18351 p_application_id IN NUMBER
18352 , p_ae_header_id IN NUMBER
18353 , p_side IN VARCHAR2
18354 --Generated Code Combination Identifier
18355 , p_source_5 IN NUMBER
18356 --Payables Code Combination Identifier
18357 , p_source_8 IN NUMBER
18358 --Default Code Combination Identifier
18359 , p_source_32 IN NUMBER
18360 , x_transaction_coa_id OUT NOCOPY NUMBER
18361 , x_accounting_coa_id OUT NOCOPY NUMBER
18362 , x_value_type_code OUT NOCOPY VARCHAR2
18363 )
18364 RETURN NUMBER
18365 IS
18366 l_component_type VARCHAR2(80) ;
18367 l_component_code VARCHAR2(30) ;
18368 l_component_type_code VARCHAR2(1) ;
18369 l_component_appl_id INTEGER ;
18370 l_amb_context_code VARCHAR2(30) ;
18371 l_log_module VARCHAR2(240) ;
18372 l_output_value NUMBER ;
18373 BEGIN
18374 IF g_log_enabled THEN
18375 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_173';
18376 END IF;
18377 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18378 trace
18379 (p_msg => 'BEGIN of AcctDerRule_173'
18380 ,p_level => C_LEVEL_PROCEDURE
18381 ,p_module => l_log_module);
18382 END IF;
18383 --
18384 l_component_type := 'AMB_ADR';
18385 l_component_code := 'FA_CAT_COST_CLEARING';
18386 l_component_type_code := 'S';
18387 l_component_appl_id := 140;
18388 l_amb_context_code := 'DEFAULT';
18389 x_transaction_coa_id := null;
18390 x_accounting_coa_id := null;
18391 --
18392
18393 IF TO_NUMBER(p_source_8) IS NOT NULL
18394 THEN
18395 --
18396 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18397 trace
18398 (p_msg => 'END of AcctDerRule_173'
18399 ,p_level => C_LEVEL_PROCEDURE
18400 ,p_module => l_log_module);
18401 END IF;
18402 x_value_type_code := 'S';
18403 l_output_value := TO_NUMBER(TO_NUMBER(p_source_8));
18404 RETURN l_output_value;
18405
18406 ELSIF TO_NUMBER(p_source_5) IS NOT NULL AND
18407 TO_NUMBER(p_source_8) IS NULL
18408 THEN
18409 --
18410 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18411 trace
18412 (p_msg => 'END of AcctDerRule_173'
18413 ,p_level => C_LEVEL_PROCEDURE
18414 ,p_module => l_log_module);
18415 END IF;
18416 x_value_type_code := 'S';
18417 l_output_value := TO_NUMBER(TO_NUMBER(p_source_5));
18418 RETURN l_output_value;
18419
18420 ELSIF TO_NUMBER(p_source_8) IS NULL AND
18421 TO_NUMBER(p_source_5) IS NULL
18422 THEN
18423 --
18424 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18425 trace
18426 (p_msg => 'END of AcctDerRule_173'
18427 ,p_level => C_LEVEL_PROCEDURE
18428 ,p_module => l_log_module);
18429 END IF;
18430 x_value_type_code := 'S';
18431 l_output_value := TO_NUMBER(TO_NUMBER(p_source_32));
18432 RETURN l_output_value;
18433
18434 END IF;
18435 --
18436 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18437 trace
18438 (p_msg => 'END of AcctDerRule_173(invalid)'
18439 ,p_level => C_LEVEL_PROCEDURE
18440 ,p_module => l_log_module);
18441 END IF;
18442 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
18443 x_value_type_code := null;
18444 l_output_value := null;
18445 xla_accounting_err_pkg.build_message
18446 (p_appli_s_name => 'XLA'
18447 ,p_msg_name => 'XLA_AP_INVALID_ADR'
18448 ,p_token_1 => 'COMPONENT_NAME'
18449 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
18450 l_component_type
18451 , l_component_code
18452 , l_component_type_code
18453 , l_component_appl_id
18454 , l_amb_context_code
18455 )
18456 ,p_token_2 => 'OWNER'
18457 ,p_value_2 => xla_lookups_pkg.get_meaning(
18458 'XLA_OWNER_TYPE'
18459 ,l_component_type_code
18460 )
18464 ,p_value_4 => xla_lookups_pkg.get_meaning(
18461 ,p_token_3 => 'PAD_NAME'
18462 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
18463 ,p_token_4 => 'PAD_OWNER'
18465 'XLA_OWNER_TYPE'
18466 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
18467 )
18468 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
18469 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
18470 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
18471 ,p_ae_header_id => NULL
18472 );
18473 RETURN l_output_value;
18474 EXCEPTION
18475 WHEN xla_exceptions_pkg.application_exception THEN
18476 RAISE;
18477 WHEN OTHERS THEN
18478 xla_exceptions_pkg.raise_message
18479 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_173');
18480 END AcctDerRule_173;
18481 --
18482
18483 ---------------------------------------
18484 --
18485 -- PRIVATE FUNCTION
18486 -- AcctDerRule_174
18487 --
18488 ---------------------------------------
18489 FUNCTION AcctDerRule_174 (
18490 p_application_id IN NUMBER
18491 , p_ae_header_id IN NUMBER
18492 , p_side IN VARCHAR2
18493 --Generated Code Combination Identifier
18494 , p_source_5 IN NUMBER
18495 --Default Code Combination Identifier
18496 , p_source_32 IN NUMBER
18497 , x_transaction_coa_id OUT NOCOPY NUMBER
18498 , x_accounting_coa_id OUT NOCOPY NUMBER
18499 , x_value_type_code OUT NOCOPY VARCHAR2
18500 )
18501 RETURN NUMBER
18502 IS
18503 l_component_type VARCHAR2(80) ;
18504 l_component_code VARCHAR2(30) ;
18505 l_component_type_code VARCHAR2(1) ;
18506 l_component_appl_id INTEGER ;
18507 l_amb_context_code VARCHAR2(30) ;
18508 l_log_module VARCHAR2(240) ;
18509 l_output_value NUMBER ;
18510 BEGIN
18511 IF g_log_enabled THEN
18512 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_174';
18513 END IF;
18514 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18515 trace
18516 (p_msg => 'BEGIN of AcctDerRule_174'
18517 ,p_level => C_LEVEL_PROCEDURE
18518 ,p_module => l_log_module);
18519 END IF;
18520 --
18521 l_component_type := 'AMB_ADR';
18522 l_component_code := 'FA_DEFAULT_ACCOUNT';
18523 l_component_type_code := 'S';
18524 l_component_appl_id := 140;
18525 l_amb_context_code := 'DEFAULT';
18526 x_transaction_coa_id := null;
18527 x_accounting_coa_id := null;
18528 --
18529
18530 IF TO_NUMBER(p_source_5) IS NOT NULL
18531 THEN
18532 --
18533 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18534 trace
18535 (p_msg => 'END of AcctDerRule_174'
18536 ,p_level => C_LEVEL_PROCEDURE
18537 ,p_module => l_log_module);
18538 END IF;
18539 x_value_type_code := 'S';
18540 l_output_value := TO_NUMBER(TO_NUMBER(p_source_5));
18541 RETURN l_output_value;
18542
18543 ELSIF TO_NUMBER(p_source_5) IS NULL
18544 THEN
18545 --
18546 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18547 trace
18548 (p_msg => 'END of AcctDerRule_174'
18549 ,p_level => C_LEVEL_PROCEDURE
18550 ,p_module => l_log_module);
18551 END IF;
18552 x_value_type_code := 'S';
18553 l_output_value := TO_NUMBER(TO_NUMBER(p_source_32));
18554 RETURN l_output_value;
18555
18556 END IF;
18557 --
18558 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18559 trace
18560 (p_msg => 'END of AcctDerRule_174(invalid)'
18561 ,p_level => C_LEVEL_PROCEDURE
18562 ,p_module => l_log_module);
18563 END IF;
18564 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
18565 x_value_type_code := null;
18566 l_output_value := null;
18567 xla_accounting_err_pkg.build_message
18568 (p_appli_s_name => 'XLA'
18569 ,p_msg_name => 'XLA_AP_INVALID_ADR'
18570 ,p_token_1 => 'COMPONENT_NAME'
18571 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
18572 l_component_type
18573 , l_component_code
18574 , l_component_type_code
18575 , l_component_appl_id
18576 , l_amb_context_code
18577 )
18578 ,p_token_2 => 'OWNER'
18579 ,p_value_2 => xla_lookups_pkg.get_meaning(
18580 'XLA_OWNER_TYPE'
18581 ,l_component_type_code
18585 ,p_token_4 => 'PAD_OWNER'
18582 )
18583 ,p_token_3 => 'PAD_NAME'
18584 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
18586 ,p_value_4 => xla_lookups_pkg.get_meaning(
18587 'XLA_OWNER_TYPE'
18588 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
18589 )
18590 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
18591 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
18592 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
18593 ,p_ae_header_id => NULL
18594 );
18595 RETURN l_output_value;
18596 EXCEPTION
18597 WHEN xla_exceptions_pkg.application_exception THEN
18598 RAISE;
18599 WHEN OTHERS THEN
18600 xla_exceptions_pkg.raise_message
18601 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_174');
18602 END AcctDerRule_174;
18603 --
18604
18605 ---------------------------------------
18606 --
18607 -- PRIVATE FUNCTION
18608 -- AcctDerRule_175
18609 --
18610 ---------------------------------------
18611 FUNCTION AcctDerRule_175 (
18612 p_application_id IN NUMBER
18613 , p_ae_header_id IN NUMBER
18614 , p_side IN VARCHAR2
18615 --Generated Code Combination Identifier
18616 , p_source_5 IN NUMBER
18617 --Generated Offset Code Combination Identifier
18618 , p_source_19 IN NUMBER
18619 --Default Code Combination Identifier
18620 , p_source_32 IN NUMBER
18621 , x_transaction_coa_id OUT NOCOPY NUMBER
18622 , x_accounting_coa_id OUT NOCOPY NUMBER
18623 , x_value_type_code OUT NOCOPY VARCHAR2
18624 )
18625 RETURN NUMBER
18626 IS
18627 l_component_type VARCHAR2(80) ;
18628 l_component_code VARCHAR2(30) ;
18629 l_component_type_code VARCHAR2(1) ;
18630 l_component_appl_id INTEGER ;
18631 l_amb_context_code VARCHAR2(30) ;
18632 l_log_module VARCHAR2(240) ;
18633 l_output_value NUMBER ;
18634 BEGIN
18635 IF g_log_enabled THEN
18636 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_175';
18637 END IF;
18638 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18639 trace
18640 (p_msg => 'BEGIN of AcctDerRule_175'
18641 ,p_level => C_LEVEL_PROCEDURE
18642 ,p_module => l_log_module);
18643 END IF;
18644 --
18645 l_component_type := 'AMB_ADR';
18646 l_component_code := 'FA_DEFAULT_OFFSET_ACCOUNT';
18647 l_component_type_code := 'S';
18648 l_component_appl_id := 140;
18649 l_amb_context_code := 'DEFAULT';
18650 x_transaction_coa_id := null;
18651 x_accounting_coa_id := null;
18652 --
18653
18654 IF TO_NUMBER(p_source_19) IS NOT NULL
18655 THEN
18656 --
18657 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18658 trace
18659 (p_msg => 'END of AcctDerRule_175'
18660 ,p_level => C_LEVEL_PROCEDURE
18661 ,p_module => l_log_module);
18662 END IF;
18663 x_value_type_code := 'S';
18664 l_output_value := TO_NUMBER(TO_NUMBER(p_source_19));
18665 RETURN l_output_value;
18666
18667 ELSIF (TO_NUMBER(p_source_5) IS NOT NULL AND
18668 TO_NUMBER(p_source_19) IS NULL )
18669 THEN
18670 --
18671 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18672 trace
18673 (p_msg => 'END of AcctDerRule_175'
18674 ,p_level => C_LEVEL_PROCEDURE
18675 ,p_module => l_log_module);
18676 END IF;
18677 x_value_type_code := 'S';
18678 l_output_value := TO_NUMBER(TO_NUMBER(p_source_5));
18679 RETURN l_output_value;
18680
18681 ELSIF TO_NUMBER(p_source_5) IS NULL
18682 THEN
18683 --
18684 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18685 trace
18686 (p_msg => 'END of AcctDerRule_175'
18687 ,p_level => C_LEVEL_PROCEDURE
18688 ,p_module => l_log_module);
18689 END IF;
18690 x_value_type_code := 'S';
18691 l_output_value := TO_NUMBER(TO_NUMBER(p_source_32));
18692 RETURN l_output_value;
18693
18694 END IF;
18695 --
18696 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18697 trace
18698 (p_msg => 'END of AcctDerRule_175(invalid)'
18699 ,p_level => C_LEVEL_PROCEDURE
18700 ,p_module => l_log_module);
18701 END IF;
18702 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
18703 x_value_type_code := null;
18704 l_output_value := null;
18705 xla_accounting_err_pkg.build_message
18706 (p_appli_s_name => 'XLA'
18707 ,p_msg_name => 'XLA_AP_INVALID_ADR'
18708 ,p_token_1 => 'COMPONENT_NAME'
18709 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
18710 l_component_type
18714 , l_amb_context_code
18711 , l_component_code
18712 , l_component_type_code
18713 , l_component_appl_id
18715 )
18716 ,p_token_2 => 'OWNER'
18717 ,p_value_2 => xla_lookups_pkg.get_meaning(
18718 'XLA_OWNER_TYPE'
18719 ,l_component_type_code
18720 )
18721 ,p_token_3 => 'PAD_NAME'
18722 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
18723 ,p_token_4 => 'PAD_OWNER'
18724 ,p_value_4 => xla_lookups_pkg.get_meaning(
18725 'XLA_OWNER_TYPE'
18726 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
18727 )
18728 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
18729 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
18730 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
18731 ,p_ae_header_id => NULL
18732 );
18733 RETURN l_output_value;
18734 EXCEPTION
18735 WHEN xla_exceptions_pkg.application_exception THEN
18736 RAISE;
18737 WHEN OTHERS THEN
18738 xla_exceptions_pkg.raise_message
18739 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_175');
18740 END AcctDerRule_175;
18741 --
18742
18743 ---------------------------------------
18744 --
18745 -- PRIVATE FUNCTION
18746 -- AcctDerRule_176
18747 --
18748 ---------------------------------------
18749 FUNCTION AcctDerRule_176 (
18750 p_application_id IN NUMBER
18751 , p_ae_header_id IN NUMBER
18752 , p_side IN VARCHAR2
18753 --Generated Code Combination Identifier
18754 , p_source_5 IN NUMBER
18755 --Expense Account Code Combination Identifier
18756 , p_source_31 IN NUMBER
18757 , x_transaction_coa_id OUT NOCOPY NUMBER
18758 , x_accounting_coa_id OUT NOCOPY NUMBER
18759 , x_value_type_code OUT NOCOPY VARCHAR2
18760 )
18761 RETURN NUMBER
18762 IS
18763 l_component_type VARCHAR2(80) ;
18764 l_component_code VARCHAR2(30) ;
18765 l_component_type_code VARCHAR2(1) ;
18766 l_component_appl_id INTEGER ;
18767 l_amb_context_code VARCHAR2(30) ;
18768 l_log_module VARCHAR2(240) ;
18769 l_output_value NUMBER ;
18770 BEGIN
18771 IF g_log_enabled THEN
18772 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_176';
18773 END IF;
18774 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18775 trace
18776 (p_msg => 'BEGIN of AcctDerRule_176'
18777 ,p_level => C_LEVEL_PROCEDURE
18778 ,p_module => l_log_module);
18779 END IF;
18780 --
18781 l_component_type := 'AMB_ADR';
18782 l_component_code := 'FA_EXPENSE_ACCOUNT';
18783 l_component_type_code := 'S';
18784 l_component_appl_id := 140;
18785 l_amb_context_code := 'DEFAULT';
18786 x_transaction_coa_id := null;
18787 x_accounting_coa_id := null;
18788 --
18789
18790 IF TO_NUMBER(p_source_5) IS NOT NULL
18791 THEN
18792 --
18793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18794 trace
18795 (p_msg => 'END of AcctDerRule_176'
18796 ,p_level => C_LEVEL_PROCEDURE
18797 ,p_module => l_log_module);
18798 END IF;
18799 x_value_type_code := 'S';
18800 l_output_value := TO_NUMBER(TO_NUMBER(p_source_5));
18801 RETURN l_output_value;
18802
18803 ELSIF TO_NUMBER(p_source_5) IS NULL
18804 THEN
18805 --
18806 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18807 trace
18808 (p_msg => 'END of AcctDerRule_176'
18809 ,p_level => C_LEVEL_PROCEDURE
18810 ,p_module => l_log_module);
18811 END IF;
18812 x_value_type_code := 'S';
18813 l_output_value := TO_NUMBER(TO_NUMBER(p_source_31));
18814 RETURN l_output_value;
18815
18816 END IF;
18817 --
18818 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18819 trace
18820 (p_msg => 'END of AcctDerRule_176(invalid)'
18821 ,p_level => C_LEVEL_PROCEDURE
18822 ,p_module => l_log_module);
18823 END IF;
18824 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
18825 x_value_type_code := null;
18826 l_output_value := null;
18827 xla_accounting_err_pkg.build_message
18828 (p_appli_s_name => 'XLA'
18829 ,p_msg_name => 'XLA_AP_INVALID_ADR'
18830 ,p_token_1 => 'COMPONENT_NAME'
18831 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
18832 l_component_type
18836 , l_amb_context_code
18833 , l_component_code
18834 , l_component_type_code
18835 , l_component_appl_id
18837 )
18838 ,p_token_2 => 'OWNER'
18839 ,p_value_2 => xla_lookups_pkg.get_meaning(
18840 'XLA_OWNER_TYPE'
18841 ,l_component_type_code
18842 )
18843 ,p_token_3 => 'PAD_NAME'
18844 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
18845 ,p_token_4 => 'PAD_OWNER'
18846 ,p_value_4 => xla_lookups_pkg.get_meaning(
18847 'XLA_OWNER_TYPE'
18848 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
18849 )
18850 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
18851 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
18852 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
18853 ,p_ae_header_id => NULL
18854 );
18855 RETURN l_output_value;
18856 EXCEPTION
18857 WHEN xla_exceptions_pkg.application_exception THEN
18858 RAISE;
18859 WHEN OTHERS THEN
18860 xla_exceptions_pkg.raise_message
18861 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_176');
18862 END AcctDerRule_176;
18863 --
18864
18865 ---------------------------------------
18866 --
18867 -- PRIVATE FUNCTION
18868 -- AcctDerRule_177
18869 --
18870 ---------------------------------------
18871 FUNCTION AcctDerRule_177 (
18872 p_application_id IN NUMBER
18873 , p_ae_header_id IN NUMBER
18874 , p_side IN VARCHAR2
18875 --Expense Account Code Combination Identifier
18876 , p_source_31 IN NUMBER
18877 --Bonus Generated Code Combination Identifier
18878 , p_source_33 IN NUMBER
18879 , x_transaction_coa_id OUT NOCOPY NUMBER
18880 , x_accounting_coa_id OUT NOCOPY NUMBER
18881 , x_value_type_code OUT NOCOPY VARCHAR2
18882 )
18883 RETURN NUMBER
18884 IS
18885 l_component_type VARCHAR2(80) ;
18886 l_component_code VARCHAR2(30) ;
18887 l_component_type_code VARCHAR2(1) ;
18888 l_component_appl_id INTEGER ;
18889 l_amb_context_code VARCHAR2(30) ;
18890 l_log_module VARCHAR2(240) ;
18891 l_output_value NUMBER ;
18892 BEGIN
18893 IF g_log_enabled THEN
18894 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_177';
18895 END IF;
18896 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18897 trace
18898 (p_msg => 'BEGIN of AcctDerRule_177'
18899 ,p_level => C_LEVEL_PROCEDURE
18900 ,p_module => l_log_module);
18901 END IF;
18902 --
18903 l_component_type := 'AMB_ADR';
18904 l_component_code := 'FA_PER_BONUS_DEPRN_EXPENSE';
18905 l_component_type_code := 'S';
18906 l_component_appl_id := 140;
18907 l_amb_context_code := 'DEFAULT';
18908 x_transaction_coa_id := null;
18909 x_accounting_coa_id := null;
18910 --
18911
18912 IF TO_NUMBER(p_source_33) IS NOT NULL
18913 THEN
18914 --
18915 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18916 trace
18917 (p_msg => 'END of AcctDerRule_177'
18918 ,p_level => C_LEVEL_PROCEDURE
18919 ,p_module => l_log_module);
18920 END IF;
18921 x_value_type_code := 'S';
18922 l_output_value := TO_NUMBER(TO_NUMBER(p_source_33));
18923 RETURN l_output_value;
18924
18925 ELSIF TO_NUMBER(p_source_33) IS NULL
18926 THEN
18927 --
18928 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18929 trace
18930 (p_msg => 'END of AcctDerRule_177'
18931 ,p_level => C_LEVEL_PROCEDURE
18932 ,p_module => l_log_module);
18933 END IF;
18934 x_value_type_code := 'S';
18935 l_output_value := TO_NUMBER(TO_NUMBER(p_source_31));
18936 RETURN l_output_value;
18937
18938 END IF;
18939 --
18940 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
18941 trace
18942 (p_msg => 'END of AcctDerRule_177(invalid)'
18943 ,p_level => C_LEVEL_PROCEDURE
18944 ,p_module => l_log_module);
18945 END IF;
18946 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
18947 x_value_type_code := null;
18948 l_output_value := null;
18949 xla_accounting_err_pkg.build_message
18950 (p_appli_s_name => 'XLA'
18951 ,p_msg_name => 'XLA_AP_INVALID_ADR'
18952 ,p_token_1 => 'COMPONENT_NAME'
18953 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
18957 , l_component_appl_id
18954 l_component_type
18955 , l_component_code
18956 , l_component_type_code
18958 , l_amb_context_code
18959 )
18960 ,p_token_2 => 'OWNER'
18961 ,p_value_2 => xla_lookups_pkg.get_meaning(
18962 'XLA_OWNER_TYPE'
18963 ,l_component_type_code
18964 )
18965 ,p_token_3 => 'PAD_NAME'
18966 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
18967 ,p_token_4 => 'PAD_OWNER'
18968 ,p_value_4 => xla_lookups_pkg.get_meaning(
18969 'XLA_OWNER_TYPE'
18970 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
18971 )
18972 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
18973 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
18974 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
18975 ,p_ae_header_id => NULL
18976 );
18977 RETURN l_output_value;
18978 EXCEPTION
18979 WHEN xla_exceptions_pkg.application_exception THEN
18980 RAISE;
18981 WHEN OTHERS THEN
18982 xla_exceptions_pkg.raise_message
18983 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_177');
18984 END AcctDerRule_177;
18985 --
18986
18987 ---------------------------------------
18988 --
18989 -- PRIVATE FUNCTION
18990 -- AcctDerRule_178
18991 --
18992 ---------------------------------------
18993 FUNCTION AcctDerRule_178 (
18994 p_application_id IN NUMBER
18995 , p_ae_header_id IN NUMBER
18996 , p_side IN VARCHAR2
18997 --Default Code Combination Identifier
18998 , p_source_32 IN NUMBER
18999 --Bonus Generated Offset Code Combination Identifier
19000 , p_source_34 IN NUMBER
19001 , x_transaction_coa_id OUT NOCOPY NUMBER
19002 , x_accounting_coa_id OUT NOCOPY NUMBER
19003 , x_value_type_code OUT NOCOPY VARCHAR2
19004 )
19005 RETURN NUMBER
19006 IS
19007 l_component_type VARCHAR2(80) ;
19008 l_component_code VARCHAR2(30) ;
19009 l_component_type_code VARCHAR2(1) ;
19010 l_component_appl_id INTEGER ;
19011 l_amb_context_code VARCHAR2(30) ;
19012 l_log_module VARCHAR2(240) ;
19013 l_output_value NUMBER ;
19014 BEGIN
19015 IF g_log_enabled THEN
19016 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_178';
19017 END IF;
19018 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19019 trace
19020 (p_msg => 'BEGIN of AcctDerRule_178'
19021 ,p_level => C_LEVEL_PROCEDURE
19022 ,p_module => l_log_module);
19023 END IF;
19024 --
19025 l_component_type := 'AMB_ADR';
19026 l_component_code := 'FA_PER_BONUS_DEPRN_RESERVE';
19027 l_component_type_code := 'S';
19028 l_component_appl_id := 140;
19029 l_amb_context_code := 'DEFAULT';
19030 x_transaction_coa_id := null;
19031 x_accounting_coa_id := null;
19032 --
19033
19034 IF TO_NUMBER(p_source_34) IS NOT NULL
19035 THEN
19036 --
19037 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19038 trace
19039 (p_msg => 'END of AcctDerRule_178'
19040 ,p_level => C_LEVEL_PROCEDURE
19041 ,p_module => l_log_module);
19042 END IF;
19043 x_value_type_code := 'S';
19044 l_output_value := TO_NUMBER(TO_NUMBER(p_source_34));
19045 RETURN l_output_value;
19046
19047 ELSIF TO_NUMBER(p_source_34) IS NULL
19048 THEN
19049 --
19050 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19051 trace
19052 (p_msg => 'END of AcctDerRule_178'
19053 ,p_level => C_LEVEL_PROCEDURE
19054 ,p_module => l_log_module);
19055 END IF;
19056 x_value_type_code := 'S';
19057 l_output_value := TO_NUMBER(TO_NUMBER(p_source_32));
19058 RETURN l_output_value;
19059
19060 END IF;
19061 --
19062 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19063 trace
19064 (p_msg => 'END of AcctDerRule_178(invalid)'
19065 ,p_level => C_LEVEL_PROCEDURE
19066 ,p_module => l_log_module);
19067 END IF;
19068 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
19069 x_value_type_code := null;
19070 l_output_value := null;
19071 xla_accounting_err_pkg.build_message
19072 (p_appli_s_name => 'XLA'
19073 ,p_msg_name => 'XLA_AP_INVALID_ADR'
19074 ,p_token_1 => 'COMPONENT_NAME'
19075 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
19079 , l_component_appl_id
19076 l_component_type
19077 , l_component_code
19078 , l_component_type_code
19080 , l_amb_context_code
19081 )
19082 ,p_token_2 => 'OWNER'
19083 ,p_value_2 => xla_lookups_pkg.get_meaning(
19084 'XLA_OWNER_TYPE'
19085 ,l_component_type_code
19086 )
19087 ,p_token_3 => 'PAD_NAME'
19088 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
19089 ,p_token_4 => 'PAD_OWNER'
19090 ,p_value_4 => xla_lookups_pkg.get_meaning(
19091 'XLA_OWNER_TYPE'
19092 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
19093 )
19094 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
19095 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
19096 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
19097 ,p_ae_header_id => NULL
19098 );
19099 RETURN l_output_value;
19100 EXCEPTION
19101 WHEN xla_exceptions_pkg.application_exception THEN
19102 RAISE;
19103 WHEN OTHERS THEN
19104 xla_exceptions_pkg.raise_message
19105 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_178');
19106 END AcctDerRule_178;
19107 --
19108
19109 ---------------------------------------
19110 --
19111 -- PRIVATE FUNCTION
19112 -- AcctDerRule_179
19113 --
19114 ---------------------------------------
19115 FUNCTION AcctDerRule_179 (
19116 p_application_id IN NUMBER
19117 , p_ae_header_id IN NUMBER
19118 , p_side IN VARCHAR2
19119 --Default Code Combination Identifier
19120 , p_source_32 IN NUMBER
19121 --Revaluation Generated Code Combination Identifier
19122 , p_source_35 IN NUMBER
19123 , x_transaction_coa_id OUT NOCOPY NUMBER
19124 , x_accounting_coa_id OUT NOCOPY NUMBER
19125 , x_value_type_code OUT NOCOPY VARCHAR2
19126 )
19127 RETURN NUMBER
19128 IS
19129 l_component_type VARCHAR2(80) ;
19130 l_component_code VARCHAR2(30) ;
19131 l_component_type_code VARCHAR2(1) ;
19132 l_component_appl_id INTEGER ;
19133 l_amb_context_code VARCHAR2(30) ;
19134 l_log_module VARCHAR2(240) ;
19135 l_output_value NUMBER ;
19136 BEGIN
19137 IF g_log_enabled THEN
19138 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_179';
19139 END IF;
19140 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19141 trace
19142 (p_msg => 'BEGIN of AcctDerRule_179'
19143 ,p_level => C_LEVEL_PROCEDURE
19144 ,p_module => l_log_module);
19145 END IF;
19146 --
19147 l_component_type := 'AMB_ADR';
19148 l_component_code := 'FA_PER_REVAL_AMORTIZATION';
19149 l_component_type_code := 'S';
19150 l_component_appl_id := 140;
19151 l_amb_context_code := 'DEFAULT';
19152 x_transaction_coa_id := null;
19153 x_accounting_coa_id := null;
19154 --
19155
19156 IF TO_NUMBER(p_source_35) IS NOT NULL
19157 THEN
19158 --
19159 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19160 trace
19161 (p_msg => 'END of AcctDerRule_179'
19162 ,p_level => C_LEVEL_PROCEDURE
19163 ,p_module => l_log_module);
19164 END IF;
19165 x_value_type_code := 'S';
19166 l_output_value := TO_NUMBER(TO_NUMBER(p_source_35));
19167 RETURN l_output_value;
19168
19169 ELSIF TO_NUMBER(p_source_35) IS NULL
19170 THEN
19171 --
19172 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19173 trace
19174 (p_msg => 'END of AcctDerRule_179'
19175 ,p_level => C_LEVEL_PROCEDURE
19176 ,p_module => l_log_module);
19177 END IF;
19178 x_value_type_code := 'S';
19179 l_output_value := TO_NUMBER(TO_NUMBER(p_source_32));
19180 RETURN l_output_value;
19181
19182 END IF;
19183 --
19184 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19185 trace
19186 (p_msg => 'END of AcctDerRule_179(invalid)'
19187 ,p_level => C_LEVEL_PROCEDURE
19188 ,p_module => l_log_module);
19189 END IF;
19190 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
19191 x_value_type_code := null;
19192 l_output_value := null;
19193 xla_accounting_err_pkg.build_message
19194 (p_appli_s_name => 'XLA'
19195 ,p_msg_name => 'XLA_AP_INVALID_ADR'
19196 ,p_token_1 => 'COMPONENT_NAME'
19200 , l_component_type_code
19197 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
19198 l_component_type
19199 , l_component_code
19201 , l_component_appl_id
19202 , l_amb_context_code
19203 )
19204 ,p_token_2 => 'OWNER'
19205 ,p_value_2 => xla_lookups_pkg.get_meaning(
19206 'XLA_OWNER_TYPE'
19207 ,l_component_type_code
19208 )
19209 ,p_token_3 => 'PAD_NAME'
19210 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
19211 ,p_token_4 => 'PAD_OWNER'
19212 ,p_value_4 => xla_lookups_pkg.get_meaning(
19213 'XLA_OWNER_TYPE'
19214 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
19215 )
19216 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
19217 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
19218 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
19219 ,p_ae_header_id => NULL
19220 );
19221 RETURN l_output_value;
19222 EXCEPTION
19223 WHEN xla_exceptions_pkg.application_exception THEN
19224 RAISE;
19225 WHEN OTHERS THEN
19226 xla_exceptions_pkg.raise_message
19227 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_179');
19228 END AcctDerRule_179;
19229 --
19230
19231 ---------------------------------------
19232 --
19233 -- PRIVATE FUNCTION
19234 -- AcctDerRule_180
19235 --
19236 ---------------------------------------
19237 FUNCTION AcctDerRule_180 (
19238 p_application_id IN NUMBER
19239 , p_ae_header_id IN NUMBER
19240 , p_side IN VARCHAR2
19241 --Default Code Combination Identifier
19242 , p_source_32 IN NUMBER
19243 --Revaluation Generated Offset Code Combination Identifier
19244 , p_source_36 IN NUMBER
19245 , x_transaction_coa_id OUT NOCOPY NUMBER
19246 , x_accounting_coa_id OUT NOCOPY NUMBER
19247 , x_value_type_code OUT NOCOPY VARCHAR2
19248 )
19249 RETURN NUMBER
19250 IS
19251 l_component_type VARCHAR2(80) ;
19252 l_component_code VARCHAR2(30) ;
19253 l_component_type_code VARCHAR2(1) ;
19254 l_component_appl_id INTEGER ;
19255 l_amb_context_code VARCHAR2(30) ;
19256 l_log_module VARCHAR2(240) ;
19257 l_output_value NUMBER ;
19258 BEGIN
19259 IF g_log_enabled THEN
19260 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_180';
19261 END IF;
19262 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19263 trace
19264 (p_msg => 'BEGIN of AcctDerRule_180'
19265 ,p_level => C_LEVEL_PROCEDURE
19266 ,p_module => l_log_module);
19267 END IF;
19268 --
19269 l_component_type := 'AMB_ADR';
19270 l_component_code := 'FA_PER_REVAL_RESERVE';
19271 l_component_type_code := 'S';
19272 l_component_appl_id := 140;
19273 l_amb_context_code := 'DEFAULT';
19274 x_transaction_coa_id := null;
19275 x_accounting_coa_id := null;
19276 --
19277
19278 IF TO_NUMBER(p_source_36) IS NOT NULL
19279 THEN
19280 --
19281 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19282 trace
19283 (p_msg => 'END of AcctDerRule_180'
19284 ,p_level => C_LEVEL_PROCEDURE
19285 ,p_module => l_log_module);
19286 END IF;
19287 x_value_type_code := 'S';
19288 l_output_value := TO_NUMBER(TO_NUMBER(p_source_36));
19289 RETURN l_output_value;
19290
19291 ELSIF TO_NUMBER(p_source_36) IS NULL
19292 THEN
19293 --
19294 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19295 trace
19296 (p_msg => 'END of AcctDerRule_180'
19297 ,p_level => C_LEVEL_PROCEDURE
19298 ,p_module => l_log_module);
19299 END IF;
19300 x_value_type_code := 'S';
19301 l_output_value := TO_NUMBER(TO_NUMBER(p_source_32));
19302 RETURN l_output_value;
19303
19304 END IF;
19305 --
19306 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19307 trace
19308 (p_msg => 'END of AcctDerRule_180(invalid)'
19309 ,p_level => C_LEVEL_PROCEDURE
19310 ,p_module => l_log_module);
19311 END IF;
19312 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
19313 x_value_type_code := null;
19314 l_output_value := null;
19315 xla_accounting_err_pkg.build_message
19316 (p_appli_s_name => 'XLA'
19317 ,p_msg_name => 'XLA_AP_INVALID_ADR'
19318 ,p_token_1 => 'COMPONENT_NAME'
19319 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
19323 , l_component_appl_id
19320 l_component_type
19321 , l_component_code
19322 , l_component_type_code
19324 , l_amb_context_code
19325 )
19326 ,p_token_2 => 'OWNER'
19327 ,p_value_2 => xla_lookups_pkg.get_meaning(
19328 'XLA_OWNER_TYPE'
19329 ,l_component_type_code
19330 )
19331 ,p_token_3 => 'PAD_NAME'
19332 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
19333 ,p_token_4 => 'PAD_OWNER'
19334 ,p_value_4 => xla_lookups_pkg.get_meaning(
19335 'XLA_OWNER_TYPE'
19336 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
19337 )
19338 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
19339 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
19340 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
19341 ,p_ae_header_id => NULL
19342 );
19343 RETURN l_output_value;
19344 EXCEPTION
19345 WHEN xla_exceptions_pkg.application_exception THEN
19346 RAISE;
19347 WHEN OTHERS THEN
19348 xla_exceptions_pkg.raise_message
19349 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_180');
19350 END AcctDerRule_180;
19351 --
19352
19353 ---------------------------------------
19354 --
19355 -- PRIVATE FUNCTION
19356 -- AcctDerRule_181
19357 --
19358 ---------------------------------------
19359 FUNCTION AcctDerRule_181 (
19360 p_application_id IN NUMBER
19361 , p_ae_header_id IN NUMBER
19362 , p_side IN VARCHAR2
19363 --Generated Offset Code Combination Identifier
19364 , p_source_19 IN NUMBER
19365 --Default Code Combination Identifier
19366 , p_source_32 IN NUMBER
19367 , x_transaction_coa_id OUT NOCOPY NUMBER
19368 , x_accounting_coa_id OUT NOCOPY NUMBER
19369 , x_value_type_code OUT NOCOPY VARCHAR2
19370 )
19371 RETURN NUMBER
19372 IS
19373 l_component_type VARCHAR2(80) ;
19374 l_component_code VARCHAR2(30) ;
19375 l_component_type_code VARCHAR2(1) ;
19376 l_component_appl_id INTEGER ;
19377 l_amb_context_code VARCHAR2(30) ;
19378 l_log_module VARCHAR2(240) ;
19379 l_output_value NUMBER ;
19380 BEGIN
19381 IF g_log_enabled THEN
19382 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_181';
19383 END IF;
19384 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19385 trace
19386 (p_msg => 'BEGIN of AcctDerRule_181'
19387 ,p_level => C_LEVEL_PROCEDURE
19388 ,p_module => l_log_module);
19389 END IF;
19390 --
19391 l_component_type := 'AMB_ADR';
19392 l_component_code := 'FA_UPL_RESERVE';
19393 l_component_type_code := 'S';
19394 l_component_appl_id := 140;
19395 l_amb_context_code := 'DEFAULT';
19396 x_transaction_coa_id := null;
19397 x_accounting_coa_id := null;
19398 --
19399
19400 IF TO_NUMBER(p_source_19) IS NOT NULL
19401 THEN
19402 --
19403 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19404 trace
19405 (p_msg => 'END of AcctDerRule_181'
19406 ,p_level => C_LEVEL_PROCEDURE
19407 ,p_module => l_log_module);
19408 END IF;
19409 x_value_type_code := 'S';
19410 l_output_value := TO_NUMBER(TO_NUMBER(p_source_19));
19411 RETURN l_output_value;
19412
19413 ELSIF TO_NUMBER(p_source_19) IS NULL
19414 THEN
19415 --
19416 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19417 trace
19418 (p_msg => 'END of AcctDerRule_181'
19419 ,p_level => C_LEVEL_PROCEDURE
19420 ,p_module => l_log_module);
19421 END IF;
19422 x_value_type_code := 'S';
19423 l_output_value := TO_NUMBER(TO_NUMBER(p_source_32));
19424 RETURN l_output_value;
19425
19426 END IF;
19427 --
19428 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19429 trace
19430 (p_msg => 'END of AcctDerRule_181(invalid)'
19431 ,p_level => C_LEVEL_PROCEDURE
19432 ,p_module => l_log_module);
19433 END IF;
19434 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
19435 x_value_type_code := null;
19436 l_output_value := null;
19437 xla_accounting_err_pkg.build_message
19438 (p_appli_s_name => 'XLA'
19439 ,p_msg_name => 'XLA_AP_INVALID_ADR'
19440 ,p_token_1 => 'COMPONENT_NAME'
19441 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
19445 , l_component_appl_id
19442 l_component_type
19443 , l_component_code
19444 , l_component_type_code
19446 , l_amb_context_code
19447 )
19448 ,p_token_2 => 'OWNER'
19449 ,p_value_2 => xla_lookups_pkg.get_meaning(
19450 'XLA_OWNER_TYPE'
19451 ,l_component_type_code
19452 )
19453 ,p_token_3 => 'PAD_NAME'
19454 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
19455 ,p_token_4 => 'PAD_OWNER'
19456 ,p_value_4 => xla_lookups_pkg.get_meaning(
19457 'XLA_OWNER_TYPE'
19458 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
19459 )
19460 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
19461 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
19462 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
19463 ,p_ae_header_id => NULL
19464 );
19465 RETURN l_output_value;
19466 EXCEPTION
19467 WHEN xla_exceptions_pkg.application_exception THEN
19468 RAISE;
19469 WHEN OTHERS THEN
19470 xla_exceptions_pkg.raise_message
19471 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_181');
19472 END AcctDerRule_181;
19473 --
19474
19475 ---------------------------------------
19476 --
19477 -- PRIVATE FUNCTION
19478 -- AcctDerRule_182
19479 --
19480 ---------------------------------------
19481 FUNCTION AcctDerRule_182 (
19482 p_application_id IN NUMBER
19483 , p_ae_header_id IN NUMBER
19484 , p_side IN VARCHAR2
19485 --Inflation Asset Ccid
19486 , p_source_37 IN NUMBER
19487 , x_transaction_coa_id OUT NOCOPY NUMBER
19488 , x_accounting_coa_id OUT NOCOPY NUMBER
19489 , x_value_type_code OUT NOCOPY VARCHAR2
19490 )
19491 RETURN NUMBER
19492 IS
19493 l_component_type VARCHAR2(80) ;
19494 l_component_code VARCHAR2(30) ;
19495 l_component_type_code VARCHAR2(1) ;
19496 l_component_appl_id INTEGER ;
19497 l_amb_context_code VARCHAR2(30) ;
19498 l_log_module VARCHAR2(240) ;
19499 l_output_value NUMBER ;
19500 BEGIN
19501 IF g_log_enabled THEN
19502 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_182';
19503 END IF;
19504 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19505 trace
19506 (p_msg => 'BEGIN of AcctDerRule_182'
19507 ,p_level => C_LEVEL_PROCEDURE
19508 ,p_module => l_log_module);
19509 END IF;
19510 --
19511 l_component_type := 'AMB_ADR';
19512 l_component_code := 'IAC_ASSET_COST_AC';
19513 l_component_type_code := 'S';
19514 l_component_appl_id := 140;
19515 l_amb_context_code := 'DEFAULT';
19516 x_transaction_coa_id := null;
19517 x_accounting_coa_id := null;
19518 --
19519
19520 --
19521 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19522 trace
19523 (p_msg => 'END of AcctDerRule_182'
19524 ,p_level => C_LEVEL_PROCEDURE
19525 ,p_module => l_log_module);
19526 END IF;
19527 x_value_type_code := 'S';
19528 l_output_value := TO_NUMBER(TO_NUMBER(p_source_37));
19529 RETURN l_output_value;
19530
19531 --
19532 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19533 trace
19534 (p_msg => 'END of AcctDerRule_182(invalid)'
19535 ,p_level => C_LEVEL_PROCEDURE
19536 ,p_module => l_log_module);
19537 END IF;
19538 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
19539 x_value_type_code := null;
19540 l_output_value := null;
19541 xla_accounting_err_pkg.build_message
19542 (p_appli_s_name => 'XLA'
19543 ,p_msg_name => 'XLA_AP_INVALID_ADR'
19544 ,p_token_1 => 'COMPONENT_NAME'
19545 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
19546 l_component_type
19547 , l_component_code
19548 , l_component_type_code
19549 , l_component_appl_id
19550 , l_amb_context_code
19551 )
19552 ,p_token_2 => 'OWNER'
19553 ,p_value_2 => xla_lookups_pkg.get_meaning(
19557 ,p_token_3 => 'PAD_NAME'
19554 'XLA_OWNER_TYPE'
19555 ,l_component_type_code
19556 )
19558 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
19559 ,p_token_4 => 'PAD_OWNER'
19560 ,p_value_4 => xla_lookups_pkg.get_meaning(
19561 'XLA_OWNER_TYPE'
19562 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
19563 )
19564 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
19565 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
19566 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
19567 ,p_ae_header_id => NULL
19568 );
19569 RETURN l_output_value;
19570 EXCEPTION
19571 WHEN xla_exceptions_pkg.application_exception THEN
19572 RAISE;
19573 WHEN OTHERS THEN
19574 xla_exceptions_pkg.raise_message
19575 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_182');
19576 END AcctDerRule_182;
19577 --
19578
19579 ---------------------------------------
19580 --
19581 -- PRIVATE FUNCTION
19582 -- AcctDerRule_183
19583 --
19584 ---------------------------------------
19585 FUNCTION AcctDerRule_183 (
19586 p_application_id IN NUMBER
19587 , p_ae_header_id IN NUMBER
19588 , p_side IN VARCHAR2
19589 --Inflation Backlog Depreciation Reserve Ccid
19590 , p_source_38 IN NUMBER
19591 , x_transaction_coa_id OUT NOCOPY NUMBER
19592 , x_accounting_coa_id OUT NOCOPY NUMBER
19593 , x_value_type_code OUT NOCOPY VARCHAR2
19594 )
19595 RETURN NUMBER
19596 IS
19597 l_component_type VARCHAR2(80) ;
19598 l_component_code VARCHAR2(30) ;
19599 l_component_type_code VARCHAR2(1) ;
19600 l_component_appl_id INTEGER ;
19601 l_amb_context_code VARCHAR2(30) ;
19602 l_log_module VARCHAR2(240) ;
19603 l_output_value NUMBER ;
19604 BEGIN
19605 IF g_log_enabled THEN
19606 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_183';
19607 END IF;
19608 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19609 trace
19610 (p_msg => 'BEGIN of AcctDerRule_183'
19611 ,p_level => C_LEVEL_PROCEDURE
19612 ,p_module => l_log_module);
19613 END IF;
19614 --
19615 l_component_type := 'AMB_ADR';
19616 l_component_code := 'IAC_BACKLOG_RESERVE_AC';
19617 l_component_type_code := 'S';
19618 l_component_appl_id := 140;
19619 l_amb_context_code := 'DEFAULT';
19620 x_transaction_coa_id := null;
19621 x_accounting_coa_id := null;
19622 --
19623
19624 --
19625 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19626 trace
19627 (p_msg => 'END of AcctDerRule_183'
19628 ,p_level => C_LEVEL_PROCEDURE
19629 ,p_module => l_log_module);
19630 END IF;
19631 x_value_type_code := 'S';
19632 l_output_value := TO_NUMBER(TO_NUMBER(p_source_38));
19633 RETURN l_output_value;
19634
19635 --
19636 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19637 trace
19638 (p_msg => 'END of AcctDerRule_183(invalid)'
19639 ,p_level => C_LEVEL_PROCEDURE
19640 ,p_module => l_log_module);
19641 END IF;
19642 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
19643 x_value_type_code := null;
19644 l_output_value := null;
19645 xla_accounting_err_pkg.build_message
19646 (p_appli_s_name => 'XLA'
19647 ,p_msg_name => 'XLA_AP_INVALID_ADR'
19648 ,p_token_1 => 'COMPONENT_NAME'
19649 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
19650 l_component_type
19651 , l_component_code
19652 , l_component_type_code
19653 , l_component_appl_id
19654 , l_amb_context_code
19655 )
19656 ,p_token_2 => 'OWNER'
19657 ,p_value_2 => xla_lookups_pkg.get_meaning(
19658 'XLA_OWNER_TYPE'
19659 ,l_component_type_code
19660 )
19661 ,p_token_3 => 'PAD_NAME'
19662 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
19663 ,p_token_4 => 'PAD_OWNER'
19664 ,p_value_4 => xla_lookups_pkg.get_meaning(
19665 'XLA_OWNER_TYPE'
19669 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
19666 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
19667 )
19668 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
19670 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
19671 ,p_ae_header_id => NULL
19672 );
19673 RETURN l_output_value;
19674 EXCEPTION
19675 WHEN xla_exceptions_pkg.application_exception THEN
19676 RAISE;
19677 WHEN OTHERS THEN
19678 xla_exceptions_pkg.raise_message
19679 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_183');
19680 END AcctDerRule_183;
19681 --
19682
19683 ---------------------------------------
19684 --
19685 -- PRIVATE FUNCTION
19686 -- AcctDerRule_184
19687 --
19688 ---------------------------------------
19689 FUNCTION AcctDerRule_184 (
19690 p_application_id IN NUMBER
19691 , p_ae_header_id IN NUMBER
19692 , p_side IN VARCHAR2
19693 --Inflation Depreciation Expense Ccid
19694 , p_source_39 IN NUMBER
19695 , x_transaction_coa_id OUT NOCOPY NUMBER
19696 , x_accounting_coa_id OUT NOCOPY NUMBER
19697 , x_value_type_code OUT NOCOPY VARCHAR2
19698 )
19699 RETURN NUMBER
19700 IS
19701 l_component_type VARCHAR2(80) ;
19702 l_component_code VARCHAR2(30) ;
19703 l_component_type_code VARCHAR2(1) ;
19704 l_component_appl_id INTEGER ;
19705 l_amb_context_code VARCHAR2(30) ;
19706 l_log_module VARCHAR2(240) ;
19707 l_output_value NUMBER ;
19708 BEGIN
19709 IF g_log_enabled THEN
19710 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_184';
19711 END IF;
19712 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19713 trace
19714 (p_msg => 'BEGIN of AcctDerRule_184'
19715 ,p_level => C_LEVEL_PROCEDURE
19716 ,p_module => l_log_module);
19717 END IF;
19718 --
19719 l_component_type := 'AMB_ADR';
19720 l_component_code := 'IAC_DEPRECIATION_EXPENSE_AC';
19721 l_component_type_code := 'S';
19722 l_component_appl_id := 140;
19723 l_amb_context_code := 'DEFAULT';
19724 x_transaction_coa_id := null;
19725 x_accounting_coa_id := null;
19726 --
19727
19728 --
19729 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19730 trace
19731 (p_msg => 'END of AcctDerRule_184'
19732 ,p_level => C_LEVEL_PROCEDURE
19733 ,p_module => l_log_module);
19734 END IF;
19735 x_value_type_code := 'S';
19736 l_output_value := TO_NUMBER(TO_NUMBER(p_source_39));
19737 RETURN l_output_value;
19738
19739 --
19740 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19741 trace
19742 (p_msg => 'END of AcctDerRule_184(invalid)'
19743 ,p_level => C_LEVEL_PROCEDURE
19744 ,p_module => l_log_module);
19745 END IF;
19746 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
19747 x_value_type_code := null;
19748 l_output_value := null;
19749 xla_accounting_err_pkg.build_message
19750 (p_appli_s_name => 'XLA'
19751 ,p_msg_name => 'XLA_AP_INVALID_ADR'
19752 ,p_token_1 => 'COMPONENT_NAME'
19753 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
19754 l_component_type
19755 , l_component_code
19756 , l_component_type_code
19757 , l_component_appl_id
19758 , l_amb_context_code
19759 )
19760 ,p_token_2 => 'OWNER'
19761 ,p_value_2 => xla_lookups_pkg.get_meaning(
19762 'XLA_OWNER_TYPE'
19763 ,l_component_type_code
19764 )
19765 ,p_token_3 => 'PAD_NAME'
19766 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
19767 ,p_token_4 => 'PAD_OWNER'
19768 ,p_value_4 => xla_lookups_pkg.get_meaning(
19769 'XLA_OWNER_TYPE'
19770 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
19771 )
19772 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
19773 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
19774 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
19775 ,p_ae_header_id => NULL
19776 );
19777 RETURN l_output_value;
19778 EXCEPTION
19782 xla_exceptions_pkg.raise_message
19779 WHEN xla_exceptions_pkg.application_exception THEN
19780 RAISE;
19781 WHEN OTHERS THEN
19783 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_184');
19784 END AcctDerRule_184;
19785 --
19786
19787 ---------------------------------------
19788 --
19789 -- PRIVATE FUNCTION
19790 -- AcctDerRule_185
19791 --
19792 ---------------------------------------
19793 FUNCTION AcctDerRule_185 (
19794 p_application_id IN NUMBER
19795 , p_ae_header_id IN NUMBER
19796 , p_side IN VARCHAR2
19797 --Inflation Depreciation Reserve Ccid
19798 , p_source_40 IN NUMBER
19799 , x_transaction_coa_id OUT NOCOPY NUMBER
19800 , x_accounting_coa_id OUT NOCOPY NUMBER
19801 , x_value_type_code OUT NOCOPY VARCHAR2
19802 )
19803 RETURN NUMBER
19804 IS
19805 l_component_type VARCHAR2(80) ;
19806 l_component_code VARCHAR2(30) ;
19807 l_component_type_code VARCHAR2(1) ;
19808 l_component_appl_id INTEGER ;
19809 l_amb_context_code VARCHAR2(30) ;
19810 l_log_module VARCHAR2(240) ;
19811 l_output_value NUMBER ;
19812 BEGIN
19813 IF g_log_enabled THEN
19814 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_185';
19815 END IF;
19816 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19817 trace
19818 (p_msg => 'BEGIN of AcctDerRule_185'
19819 ,p_level => C_LEVEL_PROCEDURE
19820 ,p_module => l_log_module);
19821 END IF;
19822 --
19823 l_component_type := 'AMB_ADR';
19824 l_component_code := 'IAC_DEPRECIATION_RESERVE_AC';
19825 l_component_type_code := 'S';
19826 l_component_appl_id := 140;
19827 l_amb_context_code := 'DEFAULT';
19828 x_transaction_coa_id := null;
19829 x_accounting_coa_id := null;
19830 --
19831
19832 --
19833 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19834 trace
19835 (p_msg => 'END of AcctDerRule_185'
19836 ,p_level => C_LEVEL_PROCEDURE
19837 ,p_module => l_log_module);
19838 END IF;
19839 x_value_type_code := 'S';
19840 l_output_value := TO_NUMBER(TO_NUMBER(p_source_40));
19841 RETURN l_output_value;
19842
19843 --
19844 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19845 trace
19846 (p_msg => 'END of AcctDerRule_185(invalid)'
19847 ,p_level => C_LEVEL_PROCEDURE
19848 ,p_module => l_log_module);
19849 END IF;
19850 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
19851 x_value_type_code := null;
19852 l_output_value := null;
19853 xla_accounting_err_pkg.build_message
19854 (p_appli_s_name => 'XLA'
19855 ,p_msg_name => 'XLA_AP_INVALID_ADR'
19856 ,p_token_1 => 'COMPONENT_NAME'
19857 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
19858 l_component_type
19859 , l_component_code
19860 , l_component_type_code
19861 , l_component_appl_id
19862 , l_amb_context_code
19863 )
19864 ,p_token_2 => 'OWNER'
19865 ,p_value_2 => xla_lookups_pkg.get_meaning(
19866 'XLA_OWNER_TYPE'
19867 ,l_component_type_code
19868 )
19869 ,p_token_3 => 'PAD_NAME'
19870 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
19871 ,p_token_4 => 'PAD_OWNER'
19872 ,p_value_4 => xla_lookups_pkg.get_meaning(
19873 'XLA_OWNER_TYPE'
19874 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
19875 )
19876 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
19877 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
19878 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
19879 ,p_ae_header_id => NULL
19880 );
19881 RETURN l_output_value;
19882 EXCEPTION
19883 WHEN xla_exceptions_pkg.application_exception THEN
19884 RAISE;
19885 WHEN OTHERS THEN
19886 xla_exceptions_pkg.raise_message
19887 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_185');
19888 END AcctDerRule_185;
19889 --
19890
19891 ---------------------------------------
19892 --
19893 -- PRIVATE FUNCTION
19894 -- AcctDerRule_186
19895 --
19896 ---------------------------------------
19897 FUNCTION AcctDerRule_186 (
19898 p_application_id IN NUMBER
19899 , p_ae_header_id IN NUMBER
19903 , x_transaction_coa_id OUT NOCOPY NUMBER
19900 , p_side IN VARCHAR2
19901 --Inflation General Fund Ccid
19902 , p_source_41 IN NUMBER
19904 , x_accounting_coa_id OUT NOCOPY NUMBER
19905 , x_value_type_code OUT NOCOPY VARCHAR2
19906 )
19907 RETURN NUMBER
19908 IS
19909 l_component_type VARCHAR2(80) ;
19910 l_component_code VARCHAR2(30) ;
19911 l_component_type_code VARCHAR2(1) ;
19912 l_component_appl_id INTEGER ;
19913 l_amb_context_code VARCHAR2(30) ;
19914 l_log_module VARCHAR2(240) ;
19915 l_output_value NUMBER ;
19916 BEGIN
19917 IF g_log_enabled THEN
19918 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_186';
19919 END IF;
19920 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19921 trace
19922 (p_msg => 'BEGIN of AcctDerRule_186'
19923 ,p_level => C_LEVEL_PROCEDURE
19924 ,p_module => l_log_module);
19925 END IF;
19926 --
19927 l_component_type := 'AMB_ADR';
19928 l_component_code := 'IAC_GENERAL_FUND_AC';
19929 l_component_type_code := 'S';
19930 l_component_appl_id := 140;
19931 l_amb_context_code := 'DEFAULT';
19932 x_transaction_coa_id := null;
19933 x_accounting_coa_id := null;
19934 --
19935
19936 --
19937 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19938 trace
19939 (p_msg => 'END of AcctDerRule_186'
19940 ,p_level => C_LEVEL_PROCEDURE
19941 ,p_module => l_log_module);
19942 END IF;
19943 x_value_type_code := 'S';
19944 l_output_value := TO_NUMBER(TO_NUMBER(p_source_41));
19945 RETURN l_output_value;
19946
19947 --
19948 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
19949 trace
19950 (p_msg => 'END of AcctDerRule_186(invalid)'
19951 ,p_level => C_LEVEL_PROCEDURE
19952 ,p_module => l_log_module);
19953 END IF;
19954 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
19955 x_value_type_code := null;
19956 l_output_value := null;
19957 xla_accounting_err_pkg.build_message
19958 (p_appli_s_name => 'XLA'
19959 ,p_msg_name => 'XLA_AP_INVALID_ADR'
19960 ,p_token_1 => 'COMPONENT_NAME'
19961 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
19962 l_component_type
19963 , l_component_code
19964 , l_component_type_code
19965 , l_component_appl_id
19966 , l_amb_context_code
19967 )
19968 ,p_token_2 => 'OWNER'
19969 ,p_value_2 => xla_lookups_pkg.get_meaning(
19970 'XLA_OWNER_TYPE'
19971 ,l_component_type_code
19972 )
19973 ,p_token_3 => 'PAD_NAME'
19974 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
19975 ,p_token_4 => 'PAD_OWNER'
19976 ,p_value_4 => xla_lookups_pkg.get_meaning(
19977 'XLA_OWNER_TYPE'
19978 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
19979 )
19980 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
19981 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
19982 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
19983 ,p_ae_header_id => NULL
19984 );
19985 RETURN l_output_value;
19986 EXCEPTION
19987 WHEN xla_exceptions_pkg.application_exception THEN
19988 RAISE;
19989 WHEN OTHERS THEN
19990 xla_exceptions_pkg.raise_message
19991 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_186');
19992 END AcctDerRule_186;
19993 --
19994
19995 ---------------------------------------
19996 --
19997 -- PRIVATE FUNCTION
19998 -- AcctDerRule_187
19999 --
20000 ---------------------------------------
20001 FUNCTION AcctDerRule_187 (
20002 p_application_id IN NUMBER
20003 , p_ae_header_id IN NUMBER
20004 , p_side IN VARCHAR2
20005 --Inflation AP Intercompany Ccid
20006 , p_source_42 IN NUMBER
20007 , x_transaction_coa_id OUT NOCOPY NUMBER
20008 , x_accounting_coa_id OUT NOCOPY NUMBER
20009 , x_value_type_code OUT NOCOPY VARCHAR2
20010 )
20011 RETURN NUMBER
20012 IS
20013 l_component_type VARCHAR2(80) ;
20014 l_component_code VARCHAR2(30) ;
20015 l_component_type_code VARCHAR2(1) ;
20016 l_component_appl_id INTEGER ;
20017 l_amb_context_code VARCHAR2(30) ;
20018 l_log_module VARCHAR2(240) ;
20022 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_187';
20019 l_output_value NUMBER ;
20020 BEGIN
20021 IF g_log_enabled THEN
20023 END IF;
20024 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20025 trace
20026 (p_msg => 'BEGIN of AcctDerRule_187'
20027 ,p_level => C_LEVEL_PROCEDURE
20028 ,p_module => l_log_module);
20029 END IF;
20030 --
20031 l_component_type := 'AMB_ADR';
20032 l_component_code := 'IAC_INTERCOMPANY_AP_AC';
20033 l_component_type_code := 'S';
20034 l_component_appl_id := 140;
20035 l_amb_context_code := 'DEFAULT';
20036 x_transaction_coa_id := null;
20037 x_accounting_coa_id := null;
20038 --
20039
20040 --
20041 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20042 trace
20043 (p_msg => 'END of AcctDerRule_187'
20044 ,p_level => C_LEVEL_PROCEDURE
20045 ,p_module => l_log_module);
20046 END IF;
20047 x_value_type_code := 'S';
20048 l_output_value := TO_NUMBER(TO_NUMBER(p_source_42));
20049 RETURN l_output_value;
20050
20051 --
20052 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20053 trace
20054 (p_msg => 'END of AcctDerRule_187(invalid)'
20055 ,p_level => C_LEVEL_PROCEDURE
20056 ,p_module => l_log_module);
20057 END IF;
20058 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
20059 x_value_type_code := null;
20060 l_output_value := null;
20061 xla_accounting_err_pkg.build_message
20062 (p_appli_s_name => 'XLA'
20063 ,p_msg_name => 'XLA_AP_INVALID_ADR'
20064 ,p_token_1 => 'COMPONENT_NAME'
20065 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
20066 l_component_type
20067 , l_component_code
20068 , l_component_type_code
20069 , l_component_appl_id
20070 , l_amb_context_code
20071 )
20072 ,p_token_2 => 'OWNER'
20073 ,p_value_2 => xla_lookups_pkg.get_meaning(
20074 'XLA_OWNER_TYPE'
20075 ,l_component_type_code
20076 )
20077 ,p_token_3 => 'PAD_NAME'
20078 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
20079 ,p_token_4 => 'PAD_OWNER'
20080 ,p_value_4 => xla_lookups_pkg.get_meaning(
20081 'XLA_OWNER_TYPE'
20082 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
20083 )
20084 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
20085 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
20086 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
20087 ,p_ae_header_id => NULL
20088 );
20089 RETURN l_output_value;
20090 EXCEPTION
20091 WHEN xla_exceptions_pkg.application_exception THEN
20092 RAISE;
20093 WHEN OTHERS THEN
20094 xla_exceptions_pkg.raise_message
20095 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_187');
20096 END AcctDerRule_187;
20097 --
20098
20099 ---------------------------------------
20100 --
20101 -- PRIVATE FUNCTION
20102 -- AcctDerRule_188
20103 --
20104 ---------------------------------------
20105 FUNCTION AcctDerRule_188 (
20106 p_application_id IN NUMBER
20107 , p_ae_header_id IN NUMBER
20108 , p_side IN VARCHAR2
20109 --Inflation AR Intercompany Ccid
20110 , p_source_43 IN NUMBER
20111 , x_transaction_coa_id OUT NOCOPY NUMBER
20112 , x_accounting_coa_id OUT NOCOPY NUMBER
20113 , x_value_type_code OUT NOCOPY VARCHAR2
20114 )
20115 RETURN NUMBER
20116 IS
20117 l_component_type VARCHAR2(80) ;
20118 l_component_code VARCHAR2(30) ;
20119 l_component_type_code VARCHAR2(1) ;
20120 l_component_appl_id INTEGER ;
20121 l_amb_context_code VARCHAR2(30) ;
20122 l_log_module VARCHAR2(240) ;
20123 l_output_value NUMBER ;
20124 BEGIN
20125 IF g_log_enabled THEN
20126 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_188';
20127 END IF;
20128 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20129 trace
20130 (p_msg => 'BEGIN of AcctDerRule_188'
20131 ,p_level => C_LEVEL_PROCEDURE
20132 ,p_module => l_log_module);
20133 END IF;
20134 --
20135 l_component_type := 'AMB_ADR';
20136 l_component_code := 'IAC_INTERCOMPANY_AR';
20137 l_component_type_code := 'S';
20138 l_component_appl_id := 140;
20142 --
20139 l_amb_context_code := 'DEFAULT';
20140 x_transaction_coa_id := null;
20141 x_accounting_coa_id := null;
20143
20144 --
20145 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20146 trace
20147 (p_msg => 'END of AcctDerRule_188'
20148 ,p_level => C_LEVEL_PROCEDURE
20149 ,p_module => l_log_module);
20150 END IF;
20151 x_value_type_code := 'S';
20152 l_output_value := TO_NUMBER(TO_NUMBER(p_source_43));
20153 RETURN l_output_value;
20154
20155 --
20156 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20157 trace
20158 (p_msg => 'END of AcctDerRule_188(invalid)'
20159 ,p_level => C_LEVEL_PROCEDURE
20160 ,p_module => l_log_module);
20161 END IF;
20162 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
20163 x_value_type_code := null;
20164 l_output_value := null;
20165 xla_accounting_err_pkg.build_message
20166 (p_appli_s_name => 'XLA'
20167 ,p_msg_name => 'XLA_AP_INVALID_ADR'
20168 ,p_token_1 => 'COMPONENT_NAME'
20169 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
20170 l_component_type
20171 , l_component_code
20172 , l_component_type_code
20173 , l_component_appl_id
20174 , l_amb_context_code
20175 )
20176 ,p_token_2 => 'OWNER'
20177 ,p_value_2 => xla_lookups_pkg.get_meaning(
20178 'XLA_OWNER_TYPE'
20179 ,l_component_type_code
20180 )
20181 ,p_token_3 => 'PAD_NAME'
20182 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
20183 ,p_token_4 => 'PAD_OWNER'
20184 ,p_value_4 => xla_lookups_pkg.get_meaning(
20185 'XLA_OWNER_TYPE'
20186 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
20187 )
20188 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
20189 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
20190 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
20191 ,p_ae_header_id => NULL
20192 );
20193 RETURN l_output_value;
20194 EXCEPTION
20195 WHEN xla_exceptions_pkg.application_exception THEN
20196 RAISE;
20197 WHEN OTHERS THEN
20198 xla_exceptions_pkg.raise_message
20199 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_188');
20200 END AcctDerRule_188;
20201 --
20202
20203 ---------------------------------------
20204 --
20205 -- PRIVATE FUNCTION
20206 -- AcctDerRule_189
20207 --
20208 ---------------------------------------
20209 FUNCTION AcctDerRule_189 (
20210 p_application_id IN NUMBER
20211 , p_ae_header_id IN NUMBER
20212 , p_side IN VARCHAR2
20213 --Inflation Net Book Value Retired Gain Ccid
20214 , p_source_44 IN NUMBER
20215 , x_transaction_coa_id OUT NOCOPY NUMBER
20216 , x_accounting_coa_id OUT NOCOPY NUMBER
20217 , x_value_type_code OUT NOCOPY VARCHAR2
20218 )
20219 RETURN NUMBER
20220 IS
20221 l_component_type VARCHAR2(80) ;
20222 l_component_code VARCHAR2(30) ;
20223 l_component_type_code VARCHAR2(1) ;
20224 l_component_appl_id INTEGER ;
20225 l_amb_context_code VARCHAR2(30) ;
20226 l_log_module VARCHAR2(240) ;
20227 l_output_value NUMBER ;
20228 BEGIN
20229 IF g_log_enabled THEN
20230 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_189';
20231 END IF;
20232 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20233 trace
20234 (p_msg => 'BEGIN of AcctDerRule_189'
20235 ,p_level => C_LEVEL_PROCEDURE
20236 ,p_module => l_log_module);
20237 END IF;
20238 --
20239 l_component_type := 'AMB_ADR';
20240 l_component_code := 'IAC_NBV_RETIRED_GAIN_AC';
20241 l_component_type_code := 'S';
20242 l_component_appl_id := 140;
20243 l_amb_context_code := 'DEFAULT';
20244 x_transaction_coa_id := null;
20245 x_accounting_coa_id := null;
20246 --
20247
20248 --
20249 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20250 trace
20251 (p_msg => 'END of AcctDerRule_189'
20252 ,p_level => C_LEVEL_PROCEDURE
20253 ,p_module => l_log_module);
20254 END IF;
20255 x_value_type_code := 'S';
20256 l_output_value := TO_NUMBER(TO_NUMBER(p_source_44));
20257 RETURN l_output_value;
20258
20259 --
20260 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20261 trace
20265 END IF;
20262 (p_msg => 'END of AcctDerRule_189(invalid)'
20263 ,p_level => C_LEVEL_PROCEDURE
20264 ,p_module => l_log_module);
20266 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
20267 x_value_type_code := null;
20268 l_output_value := null;
20269 xla_accounting_err_pkg.build_message
20270 (p_appli_s_name => 'XLA'
20271 ,p_msg_name => 'XLA_AP_INVALID_ADR'
20272 ,p_token_1 => 'COMPONENT_NAME'
20273 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
20274 l_component_type
20275 , l_component_code
20276 , l_component_type_code
20277 , l_component_appl_id
20278 , l_amb_context_code
20279 )
20280 ,p_token_2 => 'OWNER'
20281 ,p_value_2 => xla_lookups_pkg.get_meaning(
20282 'XLA_OWNER_TYPE'
20283 ,l_component_type_code
20284 )
20285 ,p_token_3 => 'PAD_NAME'
20286 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
20287 ,p_token_4 => 'PAD_OWNER'
20288 ,p_value_4 => xla_lookups_pkg.get_meaning(
20289 'XLA_OWNER_TYPE'
20290 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
20291 )
20292 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
20293 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
20294 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
20295 ,p_ae_header_id => NULL
20296 );
20297 RETURN l_output_value;
20298 EXCEPTION
20299 WHEN xla_exceptions_pkg.application_exception THEN
20300 RAISE;
20301 WHEN OTHERS THEN
20302 xla_exceptions_pkg.raise_message
20303 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_189');
20304 END AcctDerRule_189;
20305 --
20306
20307 ---------------------------------------
20308 --
20309 -- PRIVATE FUNCTION
20310 -- AcctDerRule_190
20311 --
20312 ---------------------------------------
20313 FUNCTION AcctDerRule_190 (
20314 p_application_id IN NUMBER
20315 , p_ae_header_id IN NUMBER
20316 , p_side IN VARCHAR2
20317 --Inflation Operating Expense Ccid
20318 , p_source_45 IN NUMBER
20319 , x_transaction_coa_id OUT NOCOPY NUMBER
20320 , x_accounting_coa_id OUT NOCOPY NUMBER
20321 , x_value_type_code OUT NOCOPY VARCHAR2
20322 )
20323 RETURN NUMBER
20324 IS
20325 l_component_type VARCHAR2(80) ;
20326 l_component_code VARCHAR2(30) ;
20327 l_component_type_code VARCHAR2(1) ;
20328 l_component_appl_id INTEGER ;
20329 l_amb_context_code VARCHAR2(30) ;
20330 l_log_module VARCHAR2(240) ;
20331 l_output_value NUMBER ;
20332 BEGIN
20333 IF g_log_enabled THEN
20334 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_190';
20335 END IF;
20336 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20337 trace
20338 (p_msg => 'BEGIN of AcctDerRule_190'
20339 ,p_level => C_LEVEL_PROCEDURE
20340 ,p_module => l_log_module);
20341 END IF;
20342 --
20343 l_component_type := 'AMB_ADR';
20344 l_component_code := 'IAC_OPERATING_EXPENSE_AC';
20345 l_component_type_code := 'S';
20346 l_component_appl_id := 140;
20347 l_amb_context_code := 'DEFAULT';
20348 x_transaction_coa_id := null;
20349 x_accounting_coa_id := null;
20350 --
20351
20352 --
20353 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20354 trace
20355 (p_msg => 'END of AcctDerRule_190'
20356 ,p_level => C_LEVEL_PROCEDURE
20357 ,p_module => l_log_module);
20358 END IF;
20359 x_value_type_code := 'S';
20360 l_output_value := TO_NUMBER(TO_NUMBER(p_source_45));
20361 RETURN l_output_value;
20362
20363 --
20364 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20365 trace
20366 (p_msg => 'END of AcctDerRule_190(invalid)'
20367 ,p_level => C_LEVEL_PROCEDURE
20368 ,p_module => l_log_module);
20369 END IF;
20370 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
20371 x_value_type_code := null;
20372 l_output_value := null;
20373 xla_accounting_err_pkg.build_message
20374 (p_appli_s_name => 'XLA'
20375 ,p_msg_name => 'XLA_AP_INVALID_ADR'
20376 ,p_token_1 => 'COMPONENT_NAME'
20380 , l_component_type_code
20377 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
20378 l_component_type
20379 , l_component_code
20381 , l_component_appl_id
20382 , l_amb_context_code
20383 )
20384 ,p_token_2 => 'OWNER'
20385 ,p_value_2 => xla_lookups_pkg.get_meaning(
20386 'XLA_OWNER_TYPE'
20387 ,l_component_type_code
20388 )
20389 ,p_token_3 => 'PAD_NAME'
20390 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
20391 ,p_token_4 => 'PAD_OWNER'
20392 ,p_value_4 => xla_lookups_pkg.get_meaning(
20393 'XLA_OWNER_TYPE'
20394 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
20395 )
20396 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
20397 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
20398 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
20399 ,p_ae_header_id => NULL
20400 );
20401 RETURN l_output_value;
20402 EXCEPTION
20403 WHEN xla_exceptions_pkg.application_exception THEN
20404 RAISE;
20405 WHEN OTHERS THEN
20406 xla_exceptions_pkg.raise_message
20407 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_190');
20408 END AcctDerRule_190;
20409 --
20410
20411 ---------------------------------------
20412 --
20413 -- PRIVATE FUNCTION
20414 -- AcctDerRule_191
20415 --
20416 ---------------------------------------
20417 FUNCTION AcctDerRule_191 (
20418 p_application_id IN NUMBER
20419 , p_ae_header_id IN NUMBER
20420 , p_side IN VARCHAR2
20421 --Inflation Revaluation Reserve Ccid
20422 , p_source_46 IN NUMBER
20423 , x_transaction_coa_id OUT NOCOPY NUMBER
20424 , x_accounting_coa_id OUT NOCOPY NUMBER
20425 , x_value_type_code OUT NOCOPY VARCHAR2
20426 )
20427 RETURN NUMBER
20428 IS
20429 l_component_type VARCHAR2(80) ;
20430 l_component_code VARCHAR2(30) ;
20431 l_component_type_code VARCHAR2(1) ;
20432 l_component_appl_id INTEGER ;
20433 l_amb_context_code VARCHAR2(30) ;
20434 l_log_module VARCHAR2(240) ;
20435 l_output_value NUMBER ;
20436 BEGIN
20437 IF g_log_enabled THEN
20438 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_191';
20439 END IF;
20440 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20441 trace
20442 (p_msg => 'BEGIN of AcctDerRule_191'
20443 ,p_level => C_LEVEL_PROCEDURE
20444 ,p_module => l_log_module);
20445 END IF;
20446 --
20447 l_component_type := 'AMB_ADR';
20448 l_component_code := 'IAC_REVALUATION_RESERVE_AC';
20449 l_component_type_code := 'S';
20450 l_component_appl_id := 140;
20451 l_amb_context_code := 'DEFAULT';
20452 x_transaction_coa_id := null;
20453 x_accounting_coa_id := null;
20454 --
20455
20456 --
20457 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20458 trace
20459 (p_msg => 'END of AcctDerRule_191'
20460 ,p_level => C_LEVEL_PROCEDURE
20461 ,p_module => l_log_module);
20462 END IF;
20463 x_value_type_code := 'S';
20464 l_output_value := TO_NUMBER(TO_NUMBER(p_source_46));
20465 RETURN l_output_value;
20466
20467 --
20468 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20469 trace
20470 (p_msg => 'END of AcctDerRule_191(invalid)'
20471 ,p_level => C_LEVEL_PROCEDURE
20472 ,p_module => l_log_module);
20473 END IF;
20474 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
20475 x_value_type_code := null;
20476 l_output_value := null;
20477 xla_accounting_err_pkg.build_message
20478 (p_appli_s_name => 'XLA'
20479 ,p_msg_name => 'XLA_AP_INVALID_ADR'
20480 ,p_token_1 => 'COMPONENT_NAME'
20481 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
20482 l_component_type
20483 , l_component_code
20484 , l_component_type_code
20485 , l_component_appl_id
20486 , l_amb_context_code
20487 )
20488 ,p_token_2 => 'OWNER'
20489 ,p_value_2 => xla_lookups_pkg.get_meaning(
20493 ,p_token_3 => 'PAD_NAME'
20490 'XLA_OWNER_TYPE'
20491 ,l_component_type_code
20492 )
20494 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
20495 ,p_token_4 => 'PAD_OWNER'
20496 ,p_value_4 => xla_lookups_pkg.get_meaning(
20497 'XLA_OWNER_TYPE'
20498 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
20499 )
20500 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
20501 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
20502 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
20503 ,p_ae_header_id => NULL
20504 );
20505 RETURN l_output_value;
20506 EXCEPTION
20507 WHEN xla_exceptions_pkg.application_exception THEN
20508 RAISE;
20509 WHEN OTHERS THEN
20510 xla_exceptions_pkg.raise_message
20511 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_191');
20512 END AcctDerRule_191;
20513 --
20514
20515 ---------------------------------------
20516 --
20517 -- PRIVATE FUNCTION
20518 -- AcctDerRule_192
20519 --
20520 ---------------------------------------
20521 FUNCTION AcctDerRule_192 (
20522 p_application_id IN NUMBER
20523 , p_ae_header_id IN NUMBER
20524 , p_side IN VARCHAR2
20525 --Inflation Revaluation Reserver Retired Ccid
20526 , p_source_47 IN NUMBER
20527 , x_transaction_coa_id OUT NOCOPY NUMBER
20528 , x_accounting_coa_id OUT NOCOPY NUMBER
20529 , x_value_type_code OUT NOCOPY VARCHAR2
20530 )
20531 RETURN NUMBER
20532 IS
20533 l_component_type VARCHAR2(80) ;
20534 l_component_code VARCHAR2(30) ;
20535 l_component_type_code VARCHAR2(1) ;
20536 l_component_appl_id INTEGER ;
20537 l_amb_context_code VARCHAR2(30) ;
20538 l_log_module VARCHAR2(240) ;
20539 l_output_value NUMBER ;
20540 BEGIN
20541 IF g_log_enabled THEN
20542 l_log_module := C_DEFAULT_MODULE||'.AcctDerRule_192';
20543 END IF;
20544 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20545 trace
20546 (p_msg => 'BEGIN of AcctDerRule_192'
20547 ,p_level => C_LEVEL_PROCEDURE
20548 ,p_module => l_log_module);
20549 END IF;
20550 --
20551 l_component_type := 'AMB_ADR';
20552 l_component_code := 'IAC_REVAL_RESERVE_RETIRE_AC';
20553 l_component_type_code := 'S';
20554 l_component_appl_id := 140;
20555 l_amb_context_code := 'DEFAULT';
20556 x_transaction_coa_id := null;
20557 x_accounting_coa_id := null;
20558 --
20559
20560 --
20561 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20562 trace
20563 (p_msg => 'END of AcctDerRule_192'
20564 ,p_level => C_LEVEL_PROCEDURE
20565 ,p_module => l_log_module);
20566 END IF;
20567 x_value_type_code := 'S';
20568 l_output_value := TO_NUMBER(TO_NUMBER(p_source_47));
20569 RETURN l_output_value;
20570
20571 --
20572 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20573 trace
20574 (p_msg => 'END of AcctDerRule_192(invalid)'
20575 ,p_level => C_LEVEL_PROCEDURE
20576 ,p_module => l_log_module);
20577 END IF;
20578 xla_ae_journal_entry_pkg.g_global_status := xla_ae_journal_entry_pkg.C_INVALID;
20579 x_value_type_code := null;
20580 l_output_value := null;
20581 xla_accounting_err_pkg.build_message
20582 (p_appli_s_name => 'XLA'
20583 ,p_msg_name => 'XLA_AP_INVALID_ADR'
20584 ,p_token_1 => 'COMPONENT_NAME'
20585 ,p_value_1 => xla_ae_sources_pkg.GetComponentName (
20586 l_component_type
20587 , l_component_code
20588 , l_component_type_code
20589 , l_component_appl_id
20590 , l_amb_context_code
20591 )
20592 ,p_token_2 => 'OWNER'
20593 ,p_value_2 => xla_lookups_pkg.get_meaning(
20594 'XLA_OWNER_TYPE'
20595 ,l_component_type_code
20596 )
20597 ,p_token_3 => 'PAD_NAME'
20598 ,p_value_3 => xla_ae_journal_entry_pkg.g_cache_pad.pad_session_name
20599 ,p_token_4 => 'PAD_OWNER'
20600 ,p_value_4 => xla_lookups_pkg.get_meaning(
20601 'XLA_OWNER_TYPE'
20605 ,p_event_id => xla_ae_journal_entry_pkg.g_cache_event.event_id
20602 ,xla_ae_journal_entry_pkg.g_cache_pad.product_rule_type_code
20603 )
20604 ,p_entity_id => xla_ae_journal_entry_pkg.g_cache_event.entity_id
20606 ,p_ledger_id => xla_ae_journal_entry_pkg.g_cache_event.target_ledger_id
20607 ,p_ae_header_id => NULL
20608 );
20609 RETURN l_output_value;
20610 EXCEPTION
20611 WHEN xla_exceptions_pkg.application_exception THEN
20612 RAISE;
20613 WHEN OTHERS THEN
20614 xla_exceptions_pkg.raise_message
20615 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctDerRule_192');
20616 END AcctDerRule_192;
20617 --
20618
20619 ---------------------------------------
20620 --
20621 -- PRIVATE FUNCTION
20622 -- AcctLineType_193
20623 --
20624 ---------------------------------------
20625 PROCEDURE AcctLineType_193 (
20626 p_application_id IN NUMBER
20627 ,p_event_id IN NUMBER
20628 ,p_calculate_acctd_flag IN VARCHAR2
20629 ,p_calculate_g_l_flag IN VARCHAR2
20630 ,p_actual_flag IN OUT VARCHAR2
20631 ,p_balance_type_code OUT VARCHAR2
20632 ,p_gain_or_loss_ref OUT VARCHAR2
20633
20634 --Period Close Date
20635 , p_source_1 IN DATE
20636 --Bonus Depreciation Expense Account
20637 , p_source_4 IN VARCHAR2
20638 --Generated Code Combination Identifier
20639 , p_source_5 IN NUMBER
20640 --Expense Account Code Combination Identifier
20641 , p_source_31 IN NUMBER
20642 --Adjustment Type
20643 , p_source_48 IN VARCHAR2
20644 --Transaction Header Identifier
20645 , p_source_49 IN NUMBER
20646 --Adjustment Line Identifier
20647 , p_source_50 IN NUMBER
20648 --Distribution Type Code
20649 , p_source_51 IN VARCHAR2
20650 --Entered Amount
20651 , p_source_52 IN NUMBER
20652 --Currency Code
20653 , p_source_53 IN VARCHAR2
20654 )
20655 IS
20656
20657 l_component_type VARCHAR2(80);
20658 l_component_code VARCHAR2(30);
20659 l_component_type_code VARCHAR2(1);
20660 l_component_appl_id INTEGER;
20661 l_amb_context_code VARCHAR2(30);
20662 l_entity_code VARCHAR2(30);
20663 l_event_class_code VARCHAR2(30);
20664 l_ae_header_id NUMBER;
20665 l_event_type_code VARCHAR2(30);
20666 l_line_definition_code VARCHAR2(30);
20667 l_line_definition_owner_code VARCHAR2(1);
20668 --
20669 -- adr variables
20670 l_segment VARCHAR2(30);
20671 l_ccid NUMBER;
20672 l_adr_transaction_coa_id NUMBER;
20673 l_adr_accounting_coa_id NUMBER;
20674 l_adr_flexfield_segment_code VARCHAR2(30);
20675 l_adr_flex_value_set_id NUMBER;
20676 l_adr_value_type_code VARCHAR2(30);
20677 l_adr_value_combination_id NUMBER;
20678 l_adr_value_segment_code VARCHAR2(30);
20679
20680 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
20681 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
20682 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
20683 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
20684
20685 -- 4262811 Variables ------------------------------------------------------------------------------------------
20686 l_entered_amt_idx NUMBER;
20687 l_accted_amt_idx NUMBER;
20688 l_acc_rev_flag VARCHAR2(1);
20689 l_accrual_line_num NUMBER;
20690 l_tmp_amt NUMBER;
20691 l_acc_rev_natural_side_code VARCHAR2(1);
20692
20693 l_num_entries NUMBER;
20694 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
20695 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
20696 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
20697 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
20698 l_recog_line_1 NUMBER;
20699 l_recog_line_2 NUMBER;
20700
20701 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
20702 l_bflow_applied_to_amt NUMBER; -- 5132302
20703 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
20704
20705 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
20706
20707 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
20708 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
20709
20710 ---------------------------------------------------------------------------------------------------------------
20711
20712
20713 --
20714 -- bulk performance
20715 --
20716 l_balance_type_code VARCHAR2(1);
20717 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
20718 l_log_module VARCHAR2(240);
20719
20720 --
20721 -- Upgrade strategy
20722 --
20723 l_actual_upg_option VARCHAR2(1);
20724 l_enc_upg_option VARCHAR2(1);
20725
20726 --
20730 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_193';
20727 BEGIN
20728 --
20729 IF g_log_enabled THEN
20731 END IF;
20732 --
20733 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
20734
20735 trace
20736 (p_msg => 'BEGIN of AcctLineType_193'
20737 ,p_level => C_LEVEL_PROCEDURE
20738 ,p_module => l_log_module);
20739
20740 END IF;
20741 --
20742 l_component_type := 'AMB_JLT';
20743 l_component_code := 'FA_ADD_BONUS_EXP';
20744 l_component_type_code := 'S';
20745 l_component_appl_id := 140;
20746 l_amb_context_code := 'DEFAULT';
20747 l_entity_code := 'TRANSACTIONS';
20748 l_event_class_code := 'ADDITIONS';
20749 l_event_type_code := 'ADDITIONS_ALL';
20750 l_line_definition_owner_code := 'S';
20751 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADDITI1';
20752 --
20753 l_balance_type_code := 'A';
20754 l_segment := NULL;
20755 l_ccid := NULL;
20756 l_adr_transaction_coa_id := NULL;
20757 l_adr_accounting_coa_id := NULL;
20758 l_adr_flexfield_segment_code := NULL;
20759 l_adr_flex_value_set_id := NULL;
20760 l_adr_value_type_code := NULL;
20761 l_adr_value_combination_id := NULL;
20762 l_adr_value_segment_code := NULL;
20763
20764 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
20765 l_bflow_class_code := ''; -- 4219869 Business Flow
20766 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
20767 l_budgetary_control_flag := 'N';
20768
20769 l_bflow_applied_to_amt_idx := NULL; -- 5132302
20770 l_bflow_applied_to_amt := NULL; -- 5132302
20771 l_entered_amt_idx := NULL; -- 4262811
20772 l_accted_amt_idx := NULL; -- 4262811
20773 l_acc_rev_flag := NULL; -- 4262811
20774 l_accrual_line_num := NULL; -- 4262811
20775 l_tmp_amt := NULL; -- 4262811
20776 --
20777
20778 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
20779 l_balance_type_code <> 'B' THEN
20780 IF NVL(p_source_48,'
20781 ') = 'BONUS EXPENSE'
20782 THEN
20783
20784 --
20785 XLA_AE_LINES_PKG.SetNewLine;
20786
20787 p_balance_type_code := l_balance_type_code;
20788 -- set the flag so later we will know whether the gain loss line needs to be created
20789
20790 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
20791 p_actual_flag :='A';
20792 END IF;
20793
20794 --
20795 -- bulk performance
20796 --
20797 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
20798 p_header_num => 0); -- 4262811
20799 --
20800 -- set accounting line options
20801 --
20802 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
20803 p_natural_side_code => 'D'
20804 , p_gain_or_loss_flag => 'N'
20805 , p_gl_transfer_mode_code => 'S'
20806 , p_acct_entry_type_code => 'A'
20807 , p_switch_side_flag => 'Y'
20808 , p_merge_duplicate_code => 'N'
20809 );
20810 --
20811 l_acc_rev_natural_side_code := 'C'; -- 4262811
20812 --
20813 --
20814 -- set accounting line type info
20815 --
20816 xla_ae_lines_pkg.SetAcctLineType
20817 (p_component_type => l_component_type
20818 ,p_event_type_code => l_event_type_code
20819 ,p_line_definition_owner_code => l_line_definition_owner_code
20820 ,p_line_definition_code => l_line_definition_code
20821 ,p_accounting_line_code => l_component_code
20822 ,p_accounting_line_type_code => l_component_type_code
20823 ,p_accounting_line_appl_id => l_component_appl_id
20824 ,p_amb_context_code => l_amb_context_code
20825 ,p_entity_code => l_entity_code
20826 ,p_event_class_code => l_event_class_code);
20827 --
20828 -- set accounting class
20829 --
20830 xla_ae_lines_pkg.SetAcctClass(
20831 p_accounting_class_code => 'EXPENSE'
20832 , p_ae_header_id => l_ae_header_id
20833 );
20834
20835 --
20836 -- set rounding class
20837 --
20838 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
20839 'EXPENSE';
20840
20841 --
20842 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
20843 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
20844 --
20845 -- bulk performance
20846 --
20847 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
20848
20849 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
20850 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
20851
20852 -- 4955764
20853 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
20854 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
20855
20856 -- 4458381 Public Sector Enh
20857
20858 --
20859 -- set accounting attributes for the line type
20860 --
20861 l_entered_amt_idx := 4;
20865 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
20862 l_accted_amt_idx := 6;
20863 l_bflow_applied_to_amt_idx := NULL; -- 5132302
20864 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
20866 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
20867 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
20868 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
20869 l_rec_acct_attrs.array_char_value(3) := p_source_51;
20870 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
20871 l_rec_acct_attrs.array_num_value(4) := p_source_52;
20872 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
20873 l_rec_acct_attrs.array_char_value(5) := p_source_53;
20874 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
20875 l_rec_acct_attrs.array_num_value(6) := p_source_52;
20876
20877 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
20878 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
20879
20880 ---------------------------------------------------------------------------------------------------------------
20881 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
20882 ---------------------------------------------------------------------------------------------------------------
20883 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
20884
20885 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
20886 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
20887
20888 IF xla_accounting_cache_pkg.GetValueChar
20889 (p_source_code => 'LEDGER_CATEGORY_CODE'
20890 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
20891 AND l_bflow_method_code = 'PRIOR_ENTRY'
20892 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
20893 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
20894 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
20895 )
20896 THEN
20897 xla_ae_lines_pkg.BflowUpgEntry
20898 (p_business_method_code => l_bflow_method_code
20899 ,p_business_class_code => l_bflow_class_code
20900 ,p_balance_type => l_balance_type_code);
20901 ELSE
20902 NULL;
20903 -- No business flow processing for business flow method of NONE.
20904 END IF;
20905
20906 --
20907 -- call analytical criteria
20908 --
20909
20910 --
20911 -- call description
20912 --
20913
20914 xla_ae_lines_pkg.SetLineDescription(
20915 p_ae_header_id => l_ae_header_id
20916 ,p_description => Description_2 (
20917 p_application_id => p_application_id
20918 , p_ae_header_id => l_ae_header_id
20919 , p_source_1 => p_source_1
20920 )
20921 );
20922
20923
20924 --
20925 -- call ADRs
20926 -- Bug 4922099
20927 --
20928 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
20929 (NVL(l_actual_upg_option, 'N') = 'O') OR
20930 (NVL(l_enc_upg_option, 'N') = 'O')
20931 )
20932 THEN
20933 NULL;
20934 --
20935 --
20936
20937 l_ccid := AcctDerRule_176(
20938 p_application_id => p_application_id
20939 , p_ae_header_id => l_ae_header_id
20940 , p_source_5 => p_source_5
20941 , p_source_31 => p_source_31
20942 , x_transaction_coa_id => l_adr_transaction_coa_id
20943 , x_accounting_coa_id => l_adr_accounting_coa_id
20944 , x_value_type_code => l_adr_value_type_code
20945 , p_side => 'NA'
20946 );
20947
20948 xla_ae_lines_pkg.set_ccid(
20949 p_code_combination_id => l_ccid
20950 , p_value_type_code => l_adr_value_type_code
20951 , p_transaction_coa_id => l_adr_transaction_coa_id
20952 , p_accounting_coa_id => l_adr_accounting_coa_id
20953 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
20954 , p_adr_type_code => 'S'
20955 , p_component_type => l_component_type
20956 , p_component_code => l_component_code
20957 , p_component_type_code => l_component_type_code
20958 , p_component_appl_id => l_component_appl_id
20959 , p_amb_context_code => l_amb_context_code
20960 , p_side => 'NA'
20961 );
20962
20963
20964 l_segment := AcctDerRule_144(
20965 p_application_id => p_application_id
20966 , p_ae_header_id => l_ae_header_id
20967 , p_source_4 => p_source_4
20968 , p_source_5 => p_source_5
20969 , x_transaction_coa_id => l_adr_transaction_coa_id
20970 , x_accounting_coa_id => l_adr_accounting_coa_id
20971 , x_flexfield_segment_code => l_adr_flexfield_segment_code
20972 , x_flex_value_set_id => l_adr_flex_value_set_id
20973 , x_value_type_code => l_adr_value_type_code
20974 , x_value_combination_id => l_adr_value_combination_id
20975 , x_value_segment_code => l_adr_value_segment_code
20976 , p_side => 'NA'
20977 , p_override_seg_flag => 'Y'
20981
20978 );
20979
20980 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
20982 xla_ae_lines_pkg.set_segment(
20983 p_to_segment_code => 'GL_ACCOUNT'
20984 , p_segment_value => l_segment
20985 , p_from_segment_code => l_adr_value_segment_code
20986 , p_from_combination_id => l_adr_value_combination_id
20987 , p_value_type_code => l_adr_value_type_code
20988 , p_transaction_coa_id => l_adr_transaction_coa_id
20989 , p_accounting_coa_id => l_adr_accounting_coa_id
20990 , p_flexfield_segment_code => l_adr_flexfield_segment_code
20991 , p_flex_value_set_id => l_adr_flex_value_set_id
20992 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
20993 , p_adr_type_code => 'S'
20994 , p_component_type => l_component_type
20995 , p_component_code => l_component_code
20996 , p_component_type_code => l_component_type_code
20997 , p_component_appl_id => l_component_appl_id
20998 , p_amb_context_code => l_amb_context_code
20999 , p_entity_code => 'TRANSACTIONS'
21000 , p_event_class_code => 'ADDITIONS'
21001 , p_side => 'NA'
21002 );
21003
21004 END IF;
21005
21006 --
21007 --
21008 END IF;
21009 --
21010 -- Bug 4922099
21011 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
21012 (NVL(l_enc_upg_option, 'N') = 'O')
21013 ) AND
21014 (l_bflow_method_code = 'PRIOR_ENTRY')
21015 )
21016 THEN
21017 IF
21018 --
21019 1 = 2
21020 --
21021 THEN
21022 xla_accounting_err_pkg.build_message
21023 (p_appli_s_name => 'XLA'
21024 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
21025 ,p_token_1 => 'LINE_NUMBER'
21026 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
21027 ,p_token_2 => 'LINE_TYPE_NAME'
21028 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
21029 l_component_type
21030 ,l_component_code
21031 ,l_component_type_code
21032 ,l_component_appl_id
21033 ,l_amb_context_code
21034 ,l_entity_code
21035 ,l_event_class_code
21036 )
21037 ,p_token_3 => 'OWNER'
21038 ,p_value_3 => xla_lookups_pkg.get_meaning(
21039 p_lookup_type => 'XLA_OWNER_TYPE'
21040 ,p_lookup_code => l_component_type_code
21041 )
21042 ,p_token_4 => 'PRODUCT_NAME'
21043 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
21044 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
21045 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
21046 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
21047 ,p_ae_header_id => NULL
21048 );
21049
21050 IF (C_LEVEL_ERROR>= g_log_level) THEN
21051 trace
21052 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
21053 ,p_level => C_LEVEL_ERROR
21054 ,p_module => l_log_module);
21055 END IF;
21056 END IF;
21057 END IF;
21058 --
21059 --
21060 ------------------------------------------------------------------------------------------------
21061 -- 4219869 Business Flow
21062 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
21063 -- Prior Entry. Currently, the following code is always generated.
21064 ------------------------------------------------------------------------------------------------
21065 XLA_AE_LINES_PKG.ValidateCurrentLine;
21066
21067 ------------------------------------------------------------------------------------
21068 -- 4219869 Business Flow
21069 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
21070 ------------------------------------------------------------------------------------
21071 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
21072
21073 ----------------------------------------------------------------------------------
21074 -- 4219869 Business Flow
21075 -- Update journal entry status -- Need to generate this within IF <condition>
21079 ,p_balance_type_code => l_balance_type_code
21076 ----------------------------------------------------------------------------------
21077 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
21078 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
21080 );
21081
21082 -------------------------------------------------------------------------------------------
21083 -- 4262811 - Generate the Accrual Reversal lines
21084 -------------------------------------------------------------------------------------------
21085 BEGIN
21086 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
21087 (g_array_event(p_event_id).array_value_num('header_index'));
21088 IF l_acc_rev_flag IS NULL THEN
21089 l_acc_rev_flag := 'N';
21090 END IF;
21091 EXCEPTION
21092 WHEN OTHERS THEN
21093 l_acc_rev_flag := 'N';
21094 END;
21095 --
21096 IF (l_acc_rev_flag = 'Y') THEN
21097
21098 -- 4645092 ------------------------------------------------------------------------------
21099 -- To allow MPA report to determine if it should generate report process
21100 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
21101 ------------------------------------------------------------------------------------------
21102
21103 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
21104 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
21105 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
21106 -- call ADRs
21107 -- Bug 4922099
21108 --
21109 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
21110 (NVL(l_actual_upg_option, 'N') = 'O') OR
21111 (NVL(l_enc_upg_option, 'N') = 'O')
21112 )
21113 THEN
21114 NULL;
21115 --
21116 --
21117
21118 l_ccid := AcctDerRule_176(
21119 p_application_id => p_application_id
21120 , p_ae_header_id => l_ae_header_id
21121 , p_source_5 => p_source_5
21122 , p_source_31 => p_source_31
21123 , x_transaction_coa_id => l_adr_transaction_coa_id
21124 , x_accounting_coa_id => l_adr_accounting_coa_id
21125 , x_value_type_code => l_adr_value_type_code
21126 , p_side => 'NA'
21127 );
21128
21129 xla_ae_lines_pkg.set_ccid(
21130 p_code_combination_id => l_ccid
21131 , p_value_type_code => l_adr_value_type_code
21132 , p_transaction_coa_id => l_adr_transaction_coa_id
21133 , p_accounting_coa_id => l_adr_accounting_coa_id
21134 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
21135 , p_adr_type_code => 'S'
21136 , p_component_type => l_component_type
21137 , p_component_code => l_component_code
21138 , p_component_type_code => l_component_type_code
21139 , p_component_appl_id => l_component_appl_id
21140 , p_amb_context_code => l_amb_context_code
21141 , p_side => 'NA'
21142 );
21143
21144
21145 l_segment := AcctDerRule_144(
21146 p_application_id => p_application_id
21147 , p_ae_header_id => l_ae_header_id
21148 , p_source_4 => p_source_4
21149 , p_source_5 => p_source_5
21150 , x_transaction_coa_id => l_adr_transaction_coa_id
21151 , x_accounting_coa_id => l_adr_accounting_coa_id
21152 , x_flexfield_segment_code => l_adr_flexfield_segment_code
21153 , x_flex_value_set_id => l_adr_flex_value_set_id
21154 , x_value_type_code => l_adr_value_type_code
21155 , x_value_combination_id => l_adr_value_combination_id
21156 , x_value_segment_code => l_adr_value_segment_code
21157 , p_side => 'NA'
21158 , p_override_seg_flag => 'Y'
21159 );
21160
21161 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
21162
21163 xla_ae_lines_pkg.set_segment(
21164 p_to_segment_code => 'GL_ACCOUNT'
21165 , p_segment_value => l_segment
21166 , p_from_segment_code => l_adr_value_segment_code
21167 , p_from_combination_id => l_adr_value_combination_id
21168 , p_value_type_code => l_adr_value_type_code
21169 , p_transaction_coa_id => l_adr_transaction_coa_id
21170 , p_accounting_coa_id => l_adr_accounting_coa_id
21171 , p_flexfield_segment_code => l_adr_flexfield_segment_code
21172 , p_flex_value_set_id => l_adr_flex_value_set_id
21173 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
21174 , p_adr_type_code => 'S'
21175 , p_component_type => l_component_type
21176 , p_component_code => l_component_code
21177 , p_component_type_code => l_component_type_code
21178 , p_component_appl_id => l_component_appl_id
21179 , p_amb_context_code => l_amb_context_code
21180 , p_entity_code => 'TRANSACTIONS'
21181 , p_event_class_code => 'ADDITIONS'
21182 , p_side => 'NA'
21183 );
21184
21185 END IF;
21186
21187 --
21188 --
21189 END IF;
21190
21191 --
21195 p_header_num => 1);
21192 -- Update the line information that should be overwritten
21193 --
21194 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
21196 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
21197
21198 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
21199
21200 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
21201 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
21202 END IF;
21203
21204 --
21205 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
21206 --
21207 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
21208 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
21209 ELSE
21210 ---------------------------------------------------------------------------------------------------
21211 -- 4262811a Switch Sign
21212 ---------------------------------------------------------------------------------------------------
21213 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
21214 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
21215 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
21216 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
21217 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
21218 -- 5132302
21219 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
21220 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
21221
21222 END IF;
21223
21224 -- 4955764
21225 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
21226 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
21227
21228
21229 XLA_AE_LINES_PKG.ValidateCurrentLine;
21230 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
21231
21232 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
21233 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
21234 ,p_balance_type_code => l_balance_type_code);
21235
21236 END IF;
21237
21238 -----------------------------------------------------------------------------------------
21239 -- 4262811 Multiperiod Accounting
21240 -----------------------------------------------------------------------------------------
21241 -- No MPA option is assigned.
21242
21243
21244 END IF;
21245 END IF;
21246 --
21247
21248 --
21249 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
21250 trace
21251 (p_msg => 'END of AcctLineType_193'
21252 ,p_level => C_LEVEL_PROCEDURE
21253 ,p_module => l_log_module);
21254 END IF;
21255 --
21256 EXCEPTION
21257 WHEN xla_exceptions_pkg.application_exception THEN
21258 RAISE;
21259 WHEN OTHERS THEN
21260 xla_exceptions_pkg.raise_message
21261 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_193');
21262 END AcctLineType_193;
21263 --
21264
21265 ---------------------------------------
21266 --
21267 -- PRIVATE FUNCTION
21268 -- AcctLineType_194
21269 --
21270 ---------------------------------------
21271 PROCEDURE AcctLineType_194 (
21272 p_application_id IN NUMBER
21273 ,p_event_id IN NUMBER
21274 ,p_calculate_acctd_flag IN VARCHAR2
21275 ,p_calculate_g_l_flag IN VARCHAR2
21276 ,p_actual_flag IN OUT VARCHAR2
21277 ,p_balance_type_code OUT VARCHAR2
21278 ,p_gain_or_loss_ref OUT VARCHAR2
21279
21280 --Period Close Date
21281 , p_source_1 IN DATE
21282 --Generated Code Combination Identifier
21283 , p_source_5 IN NUMBER
21284 --Bonus Reserve Account
21285 , p_source_6 IN VARCHAR2
21286 --Generated Offset Code Combination Identifier
21287 , p_source_19 IN NUMBER
21288 --Expense Account Code Combination Identifier
21289 , p_source_31 IN NUMBER
21290 --Default Code Combination Identifier
21291 , p_source_32 IN NUMBER
21292 --Adjustment Type
21293 , p_source_48 IN VARCHAR2
21294 --Transaction Header Identifier
21295 , p_source_49 IN NUMBER
21296 --Adjustment Line Identifier
21297 , p_source_50 IN NUMBER
21298 --Distribution Type Code
21299 , p_source_51 IN VARCHAR2
21300 --Entered Amount
21301 , p_source_52 IN NUMBER
21302 --Currency Code
21303 , p_source_53 IN VARCHAR2
21304 )
21305 IS
21306
21307 l_component_type VARCHAR2(80);
21308 l_component_code VARCHAR2(30);
21309 l_component_type_code VARCHAR2(1);
21310 l_component_appl_id INTEGER;
21311 l_amb_context_code VARCHAR2(30);
21312 l_entity_code VARCHAR2(30);
21316 l_line_definition_code VARCHAR2(30);
21313 l_event_class_code VARCHAR2(30);
21314 l_ae_header_id NUMBER;
21315 l_event_type_code VARCHAR2(30);
21317 l_line_definition_owner_code VARCHAR2(1);
21318 --
21319 -- adr variables
21320 l_segment VARCHAR2(30);
21321 l_ccid NUMBER;
21322 l_adr_transaction_coa_id NUMBER;
21323 l_adr_accounting_coa_id NUMBER;
21324 l_adr_flexfield_segment_code VARCHAR2(30);
21325 l_adr_flex_value_set_id NUMBER;
21326 l_adr_value_type_code VARCHAR2(30);
21327 l_adr_value_combination_id NUMBER;
21328 l_adr_value_segment_code VARCHAR2(30);
21329
21330 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
21331 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
21332 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
21333 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
21334
21335 -- 4262811 Variables ------------------------------------------------------------------------------------------
21336 l_entered_amt_idx NUMBER;
21337 l_accted_amt_idx NUMBER;
21338 l_acc_rev_flag VARCHAR2(1);
21339 l_accrual_line_num NUMBER;
21340 l_tmp_amt NUMBER;
21341 l_acc_rev_natural_side_code VARCHAR2(1);
21342
21343 l_num_entries NUMBER;
21344 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
21345 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
21346 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
21347 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
21348 l_recog_line_1 NUMBER;
21349 l_recog_line_2 NUMBER;
21350
21351 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
21352 l_bflow_applied_to_amt NUMBER; -- 5132302
21353 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
21354
21355 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
21356
21357 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
21358 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
21359
21360 ---------------------------------------------------------------------------------------------------------------
21361
21362
21363 --
21364 -- bulk performance
21365 --
21366 l_balance_type_code VARCHAR2(1);
21367 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
21368 l_log_module VARCHAR2(240);
21369
21370 --
21371 -- Upgrade strategy
21372 --
21373 l_actual_upg_option VARCHAR2(1);
21374 l_enc_upg_option VARCHAR2(1);
21375
21376 --
21377 BEGIN
21378 --
21379 IF g_log_enabled THEN
21380 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_194';
21381 END IF;
21382 --
21383 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
21384
21385 trace
21386 (p_msg => 'BEGIN of AcctLineType_194'
21387 ,p_level => C_LEVEL_PROCEDURE
21388 ,p_module => l_log_module);
21389
21390 END IF;
21391 --
21392 l_component_type := 'AMB_JLT';
21393 l_component_code := 'FA_ADD_BONUS_RESERVE';
21394 l_component_type_code := 'S';
21395 l_component_appl_id := 140;
21396 l_amb_context_code := 'DEFAULT';
21397 l_entity_code := 'TRANSACTIONS';
21398 l_event_class_code := 'ADDITIONS';
21399 l_event_type_code := 'ADDITIONS_ALL';
21400 l_line_definition_owner_code := 'S';
21401 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADDITI1';
21402 --
21403 l_balance_type_code := 'A';
21404 l_segment := NULL;
21405 l_ccid := NULL;
21406 l_adr_transaction_coa_id := NULL;
21407 l_adr_accounting_coa_id := NULL;
21408 l_adr_flexfield_segment_code := NULL;
21409 l_adr_flex_value_set_id := NULL;
21410 l_adr_value_type_code := NULL;
21411 l_adr_value_combination_id := NULL;
21412 l_adr_value_segment_code := NULL;
21413
21414 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
21415 l_bflow_class_code := ''; -- 4219869 Business Flow
21416 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
21417 l_budgetary_control_flag := 'N';
21418
21419 l_bflow_applied_to_amt_idx := NULL; -- 5132302
21420 l_bflow_applied_to_amt := NULL; -- 5132302
21421 l_entered_amt_idx := NULL; -- 4262811
21422 l_accted_amt_idx := NULL; -- 4262811
21423 l_acc_rev_flag := NULL; -- 4262811
21424 l_accrual_line_num := NULL; -- 4262811
21425 l_tmp_amt := NULL; -- 4262811
21426 --
21427
21428 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
21429 l_balance_type_code <> 'B' THEN
21430 IF NVL(p_source_48,'
21431 ') = 'BONUS EXPENSE'
21432 THEN
21433
21434 --
21435 XLA_AE_LINES_PKG.SetNewLine;
21436
21437 p_balance_type_code := l_balance_type_code;
21441 p_actual_flag :='A';
21438 -- set the flag so later we will know whether the gain loss line needs to be created
21439
21440 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
21442 END IF;
21443
21444 --
21445 -- bulk performance
21446 --
21447 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
21448 p_header_num => 0); -- 4262811
21449 --
21450 -- set accounting line options
21451 --
21452 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
21453 p_natural_side_code => 'C'
21454 , p_gain_or_loss_flag => 'N'
21455 , p_gl_transfer_mode_code => 'S'
21456 , p_acct_entry_type_code => 'A'
21457 , p_switch_side_flag => 'Y'
21458 , p_merge_duplicate_code => 'N'
21459 );
21460 --
21461 l_acc_rev_natural_side_code := 'D'; -- 4262811
21462 --
21463 --
21464 -- set accounting line type info
21465 --
21466 xla_ae_lines_pkg.SetAcctLineType
21467 (p_component_type => l_component_type
21468 ,p_event_type_code => l_event_type_code
21469 ,p_line_definition_owner_code => l_line_definition_owner_code
21470 ,p_line_definition_code => l_line_definition_code
21471 ,p_accounting_line_code => l_component_code
21472 ,p_accounting_line_type_code => l_component_type_code
21473 ,p_accounting_line_appl_id => l_component_appl_id
21474 ,p_amb_context_code => l_amb_context_code
21475 ,p_entity_code => l_entity_code
21476 ,p_event_class_code => l_event_class_code);
21477 --
21478 -- set accounting class
21479 --
21480 xla_ae_lines_pkg.SetAcctClass(
21481 p_accounting_class_code => 'ASSET'
21482 , p_ae_header_id => l_ae_header_id
21483 );
21484
21485 --
21486 -- set rounding class
21487 --
21488 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
21489 'ASSET';
21490
21491 --
21492 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
21493 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
21494 --
21495 -- bulk performance
21496 --
21497 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
21498
21499 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
21500 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
21501
21502 -- 4955764
21503 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
21504 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
21505
21506 -- 4458381 Public Sector Enh
21507
21508 --
21509 -- set accounting attributes for the line type
21510 --
21511 l_entered_amt_idx := 4;
21512 l_accted_amt_idx := 6;
21513 l_bflow_applied_to_amt_idx := NULL; -- 5132302
21514 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
21515 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
21516 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
21517 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
21518 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
21519 l_rec_acct_attrs.array_char_value(3) := p_source_51;
21520 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
21521 l_rec_acct_attrs.array_num_value(4) := p_source_52;
21522 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
21523 l_rec_acct_attrs.array_char_value(5) := p_source_53;
21524 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
21525 l_rec_acct_attrs.array_num_value(6) := p_source_52;
21526
21527 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
21528 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
21529
21530 ---------------------------------------------------------------------------------------------------------------
21531 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
21532 ---------------------------------------------------------------------------------------------------------------
21533 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
21534
21535 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
21536 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
21537
21538 IF xla_accounting_cache_pkg.GetValueChar
21539 (p_source_code => 'LEDGER_CATEGORY_CODE'
21540 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
21541 AND l_bflow_method_code = 'PRIOR_ENTRY'
21542 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
21543 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
21544 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
21545 )
21546 THEN
21547 xla_ae_lines_pkg.BflowUpgEntry
21548 (p_business_method_code => l_bflow_method_code
21552 NULL;
21549 ,p_business_class_code => l_bflow_class_code
21550 ,p_balance_type => l_balance_type_code);
21551 ELSE
21553 -- No business flow processing for business flow method of NONE.
21554 END IF;
21555
21556 --
21557 -- call analytical criteria
21558 --
21559
21560 --
21561 -- call description
21562 --
21563
21564 xla_ae_lines_pkg.SetLineDescription(
21565 p_ae_header_id => l_ae_header_id
21566 ,p_description => Description_3 (
21567 p_application_id => p_application_id
21568 , p_ae_header_id => l_ae_header_id
21569 , p_source_1 => p_source_1
21570 )
21571 );
21572
21573
21574 --
21575 -- call ADRs
21576 -- Bug 4922099
21577 --
21578 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
21579 (NVL(l_actual_upg_option, 'N') = 'O') OR
21580 (NVL(l_enc_upg_option, 'N') = 'O')
21581 )
21582 THEN
21583 NULL;
21584 --
21585 --
21586
21587 l_ccid := AcctDerRule_175(
21588 p_application_id => p_application_id
21589 , p_ae_header_id => l_ae_header_id
21590 , p_source_5 => p_source_5
21591 , p_source_19 => p_source_19
21592 , p_source_32 => p_source_32
21593 , x_transaction_coa_id => l_adr_transaction_coa_id
21594 , x_accounting_coa_id => l_adr_accounting_coa_id
21595 , x_value_type_code => l_adr_value_type_code
21596 , p_side => 'NA'
21597 );
21598
21599 xla_ae_lines_pkg.set_ccid(
21600 p_code_combination_id => l_ccid
21601 , p_value_type_code => l_adr_value_type_code
21602 , p_transaction_coa_id => l_adr_transaction_coa_id
21603 , p_accounting_coa_id => l_adr_accounting_coa_id
21604 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
21605 , p_adr_type_code => 'S'
21606 , p_component_type => l_component_type
21607 , p_component_code => l_component_code
21608 , p_component_type_code => l_component_type_code
21609 , p_component_appl_id => l_component_appl_id
21610 , p_amb_context_code => l_amb_context_code
21611 , p_side => 'NA'
21612 );
21613
21614
21615 l_segment := AcctDerRule_145(
21616 p_application_id => p_application_id
21617 , p_ae_header_id => l_ae_header_id
21618 , p_source_5 => p_source_5
21619 , p_source_6 => p_source_6
21620 , x_transaction_coa_id => l_adr_transaction_coa_id
21621 , x_accounting_coa_id => l_adr_accounting_coa_id
21622 , x_flexfield_segment_code => l_adr_flexfield_segment_code
21623 , x_flex_value_set_id => l_adr_flex_value_set_id
21624 , x_value_type_code => l_adr_value_type_code
21625 , x_value_combination_id => l_adr_value_combination_id
21626 , x_value_segment_code => l_adr_value_segment_code
21627 , p_side => 'NA'
21628 , p_override_seg_flag => 'Y'
21629 );
21630
21631 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
21632
21633 xla_ae_lines_pkg.set_segment(
21634 p_to_segment_code => 'GL_ACCOUNT'
21635 , p_segment_value => l_segment
21636 , p_from_segment_code => l_adr_value_segment_code
21637 , p_from_combination_id => l_adr_value_combination_id
21638 , p_value_type_code => l_adr_value_type_code
21639 , p_transaction_coa_id => l_adr_transaction_coa_id
21640 , p_accounting_coa_id => l_adr_accounting_coa_id
21641 , p_flexfield_segment_code => l_adr_flexfield_segment_code
21642 , p_flex_value_set_id => l_adr_flex_value_set_id
21643 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
21644 , p_adr_type_code => 'S'
21645 , p_component_type => l_component_type
21646 , p_component_code => l_component_code
21647 , p_component_type_code => l_component_type_code
21648 , p_component_appl_id => l_component_appl_id
21649 , p_amb_context_code => l_amb_context_code
21650 , p_entity_code => 'TRANSACTIONS'
21651 , p_event_class_code => 'ADDITIONS'
21652 , p_side => 'NA'
21653 );
21654
21655 END IF;
21656
21657 l_segment := AcctDerRule_169(
21658 p_application_id => p_application_id
21659 , p_ae_header_id => l_ae_header_id
21660 , p_source_5 => p_source_5
21661 , p_source_31 => p_source_31
21662 , x_transaction_coa_id => l_adr_transaction_coa_id
21663 , x_accounting_coa_id => l_adr_accounting_coa_id
21664 , x_flexfield_segment_code => l_adr_flexfield_segment_code
21665 , x_flex_value_set_id => l_adr_flex_value_set_id
21666 , x_value_type_code => l_adr_value_type_code
21667 , x_value_combination_id => l_adr_value_combination_id
21668 , x_value_segment_code => l_adr_value_segment_code
21669 , p_side => 'NA'
21670 , p_override_seg_flag => 'Y'
21674
21671 );
21672
21673 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
21675 xla_ae_lines_pkg.set_segment(
21676 p_to_segment_code => 'GL_BALANCING'
21677 , p_segment_value => l_segment
21678 , p_from_segment_code => l_adr_value_segment_code
21679 , p_from_combination_id => l_adr_value_combination_id
21680 , p_value_type_code => l_adr_value_type_code
21681 , p_transaction_coa_id => l_adr_transaction_coa_id
21682 , p_accounting_coa_id => l_adr_accounting_coa_id
21683 , p_flexfield_segment_code => l_adr_flexfield_segment_code
21684 , p_flex_value_set_id => l_adr_flex_value_set_id
21685 , p_adr_code => 'FA_EXPENSE_ACCT'
21686 , p_adr_type_code => 'S'
21687 , p_component_type => l_component_type
21688 , p_component_code => l_component_code
21689 , p_component_type_code => l_component_type_code
21690 , p_component_appl_id => l_component_appl_id
21691 , p_amb_context_code => l_amb_context_code
21692 , p_entity_code => 'TRANSACTIONS'
21693 , p_event_class_code => 'ADDITIONS'
21694 , p_side => 'NA'
21695 );
21696
21697 END IF;
21698
21699 --
21700 --
21701 END IF;
21702 --
21703 -- Bug 4922099
21704 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
21705 (NVL(l_enc_upg_option, 'N') = 'O')
21706 ) AND
21707 (l_bflow_method_code = 'PRIOR_ENTRY')
21708 )
21709 THEN
21710 IF
21711 --
21712 1 = 2
21713 --
21714 THEN
21715 xla_accounting_err_pkg.build_message
21716 (p_appli_s_name => 'XLA'
21717 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
21718 ,p_token_1 => 'LINE_NUMBER'
21719 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
21720 ,p_token_2 => 'LINE_TYPE_NAME'
21721 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
21722 l_component_type
21723 ,l_component_code
21724 ,l_component_type_code
21725 ,l_component_appl_id
21726 ,l_amb_context_code
21727 ,l_entity_code
21728 ,l_event_class_code
21729 )
21730 ,p_token_3 => 'OWNER'
21731 ,p_value_3 => xla_lookups_pkg.get_meaning(
21732 p_lookup_type => 'XLA_OWNER_TYPE'
21733 ,p_lookup_code => l_component_type_code
21734 )
21735 ,p_token_4 => 'PRODUCT_NAME'
21736 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
21737 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
21738 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
21739 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
21740 ,p_ae_header_id => NULL
21741 );
21742
21743 IF (C_LEVEL_ERROR>= g_log_level) THEN
21744 trace
21745 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
21746 ,p_level => C_LEVEL_ERROR
21747 ,p_module => l_log_module);
21748 END IF;
21749 END IF;
21750 END IF;
21751 --
21752 --
21753 ------------------------------------------------------------------------------------------------
21754 -- 4219869 Business Flow
21755 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
21756 -- Prior Entry. Currently, the following code is always generated.
21757 ------------------------------------------------------------------------------------------------
21758 XLA_AE_LINES_PKG.ValidateCurrentLine;
21759
21760 ------------------------------------------------------------------------------------
21761 -- 4219869 Business Flow
21762 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
21763 ------------------------------------------------------------------------------------
21764 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
21765
21766 ----------------------------------------------------------------------------------
21767 -- 4219869 Business Flow
21771 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
21768 -- Update journal entry status -- Need to generate this within IF <condition>
21769 ----------------------------------------------------------------------------------
21770 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
21772 ,p_balance_type_code => l_balance_type_code
21773 );
21774
21775 -------------------------------------------------------------------------------------------
21776 -- 4262811 - Generate the Accrual Reversal lines
21777 -------------------------------------------------------------------------------------------
21778 BEGIN
21779 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
21780 (g_array_event(p_event_id).array_value_num('header_index'));
21781 IF l_acc_rev_flag IS NULL THEN
21782 l_acc_rev_flag := 'N';
21783 END IF;
21784 EXCEPTION
21785 WHEN OTHERS THEN
21786 l_acc_rev_flag := 'N';
21787 END;
21788 --
21789 IF (l_acc_rev_flag = 'Y') THEN
21790
21791 -- 4645092 ------------------------------------------------------------------------------
21792 -- To allow MPA report to determine if it should generate report process
21793 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
21794 ------------------------------------------------------------------------------------------
21795
21796 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
21797 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
21798 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
21799 -- call ADRs
21800 -- Bug 4922099
21801 --
21802 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
21803 (NVL(l_actual_upg_option, 'N') = 'O') OR
21804 (NVL(l_enc_upg_option, 'N') = 'O')
21805 )
21806 THEN
21807 NULL;
21808 --
21809 --
21810
21811 l_ccid := AcctDerRule_175(
21812 p_application_id => p_application_id
21813 , p_ae_header_id => l_ae_header_id
21814 , p_source_5 => p_source_5
21815 , p_source_19 => p_source_19
21816 , p_source_32 => p_source_32
21817 , x_transaction_coa_id => l_adr_transaction_coa_id
21818 , x_accounting_coa_id => l_adr_accounting_coa_id
21819 , x_value_type_code => l_adr_value_type_code
21820 , p_side => 'NA'
21821 );
21822
21823 xla_ae_lines_pkg.set_ccid(
21824 p_code_combination_id => l_ccid
21825 , p_value_type_code => l_adr_value_type_code
21826 , p_transaction_coa_id => l_adr_transaction_coa_id
21827 , p_accounting_coa_id => l_adr_accounting_coa_id
21828 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
21829 , p_adr_type_code => 'S'
21830 , p_component_type => l_component_type
21831 , p_component_code => l_component_code
21832 , p_component_type_code => l_component_type_code
21833 , p_component_appl_id => l_component_appl_id
21834 , p_amb_context_code => l_amb_context_code
21835 , p_side => 'NA'
21836 );
21837
21838
21839 l_segment := AcctDerRule_145(
21840 p_application_id => p_application_id
21841 , p_ae_header_id => l_ae_header_id
21842 , p_source_5 => p_source_5
21843 , p_source_6 => p_source_6
21844 , x_transaction_coa_id => l_adr_transaction_coa_id
21845 , x_accounting_coa_id => l_adr_accounting_coa_id
21846 , x_flexfield_segment_code => l_adr_flexfield_segment_code
21847 , x_flex_value_set_id => l_adr_flex_value_set_id
21848 , x_value_type_code => l_adr_value_type_code
21849 , x_value_combination_id => l_adr_value_combination_id
21850 , x_value_segment_code => l_adr_value_segment_code
21851 , p_side => 'NA'
21852 , p_override_seg_flag => 'Y'
21853 );
21854
21855 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
21856
21857 xla_ae_lines_pkg.set_segment(
21858 p_to_segment_code => 'GL_ACCOUNT'
21859 , p_segment_value => l_segment
21860 , p_from_segment_code => l_adr_value_segment_code
21861 , p_from_combination_id => l_adr_value_combination_id
21862 , p_value_type_code => l_adr_value_type_code
21863 , p_transaction_coa_id => l_adr_transaction_coa_id
21864 , p_accounting_coa_id => l_adr_accounting_coa_id
21865 , p_flexfield_segment_code => l_adr_flexfield_segment_code
21866 , p_flex_value_set_id => l_adr_flex_value_set_id
21867 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
21868 , p_adr_type_code => 'S'
21869 , p_component_type => l_component_type
21870 , p_component_code => l_component_code
21871 , p_component_type_code => l_component_type_code
21872 , p_component_appl_id => l_component_appl_id
21873 , p_amb_context_code => l_amb_context_code
21874 , p_entity_code => 'TRANSACTIONS'
21875 , p_event_class_code => 'ADDITIONS'
21879 END IF;
21876 , p_side => 'NA'
21877 );
21878
21880
21881 l_segment := AcctDerRule_169(
21882 p_application_id => p_application_id
21883 , p_ae_header_id => l_ae_header_id
21884 , p_source_5 => p_source_5
21885 , p_source_31 => p_source_31
21886 , x_transaction_coa_id => l_adr_transaction_coa_id
21887 , x_accounting_coa_id => l_adr_accounting_coa_id
21888 , x_flexfield_segment_code => l_adr_flexfield_segment_code
21889 , x_flex_value_set_id => l_adr_flex_value_set_id
21890 , x_value_type_code => l_adr_value_type_code
21891 , x_value_combination_id => l_adr_value_combination_id
21892 , x_value_segment_code => l_adr_value_segment_code
21893 , p_side => 'NA'
21894 , p_override_seg_flag => 'Y'
21895 );
21896
21897 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
21898
21899 xla_ae_lines_pkg.set_segment(
21900 p_to_segment_code => 'GL_BALANCING'
21901 , p_segment_value => l_segment
21902 , p_from_segment_code => l_adr_value_segment_code
21903 , p_from_combination_id => l_adr_value_combination_id
21904 , p_value_type_code => l_adr_value_type_code
21905 , p_transaction_coa_id => l_adr_transaction_coa_id
21906 , p_accounting_coa_id => l_adr_accounting_coa_id
21907 , p_flexfield_segment_code => l_adr_flexfield_segment_code
21908 , p_flex_value_set_id => l_adr_flex_value_set_id
21909 , p_adr_code => 'FA_EXPENSE_ACCT'
21910 , p_adr_type_code => 'S'
21911 , p_component_type => l_component_type
21912 , p_component_code => l_component_code
21913 , p_component_type_code => l_component_type_code
21914 , p_component_appl_id => l_component_appl_id
21915 , p_amb_context_code => l_amb_context_code
21916 , p_entity_code => 'TRANSACTIONS'
21917 , p_event_class_code => 'ADDITIONS'
21918 , p_side => 'NA'
21919 );
21920
21921 END IF;
21922
21923 --
21924 --
21925 END IF;
21926
21927 --
21928 -- Update the line information that should be overwritten
21929 --
21930 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
21931 p_header_num => 1);
21932 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
21933
21934 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
21935
21936 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
21937 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
21938 END IF;
21939
21940 --
21941 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
21942 --
21943 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
21944 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
21945 ELSE
21946 ---------------------------------------------------------------------------------------------------
21947 -- 4262811a Switch Sign
21948 ---------------------------------------------------------------------------------------------------
21949 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
21950 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
21951 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
21952 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
21953 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
21954 -- 5132302
21955 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
21956 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
21957
21958 END IF;
21959
21960 -- 4955764
21961 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
21962 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
21963
21964
21965 XLA_AE_LINES_PKG.ValidateCurrentLine;
21966 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
21967
21968 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
21969 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
21970 ,p_balance_type_code => l_balance_type_code);
21971
21972 END IF;
21973
21974 -----------------------------------------------------------------------------------------
21975 -- 4262811 Multiperiod Accounting
21976 -----------------------------------------------------------------------------------------
21977 -- No MPA option is assigned.
21978
21979
21980 END IF;
21981 END IF;
21982 --
21983
21984 --
21985 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
21986 trace
21987 (p_msg => 'END of AcctLineType_194'
21988 ,p_level => C_LEVEL_PROCEDURE
21992 EXCEPTION
21989 ,p_module => l_log_module);
21990 END IF;
21991 --
21993 WHEN xla_exceptions_pkg.application_exception THEN
21994 RAISE;
21995 WHEN OTHERS THEN
21996 xla_exceptions_pkg.raise_message
21997 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_194');
21998 END AcctLineType_194;
21999 --
22000
22001 ---------------------------------------
22002 --
22003 -- PRIVATE FUNCTION
22004 -- AcctLineType_195
22005 --
22006 ---------------------------------------
22007 PROCEDURE AcctLineType_195 (
22008 p_application_id IN NUMBER
22009 ,p_event_id IN NUMBER
22010 ,p_calculate_acctd_flag IN VARCHAR2
22011 ,p_calculate_g_l_flag IN VARCHAR2
22012 ,p_actual_flag IN OUT VARCHAR2
22013 ,p_balance_type_code OUT VARCHAR2
22014 ,p_gain_or_loss_ref OUT VARCHAR2
22015
22016 --Period Close Date
22017 , p_source_1 IN DATE
22018 --Generated Code Combination Identifier
22019 , p_source_5 IN NUMBER
22020 --Asset Cost Account
22021 , p_source_11 IN VARCHAR2
22022 --Expense Account Code Combination Identifier
22023 , p_source_31 IN NUMBER
22024 --Default Code Combination Identifier
22025 , p_source_32 IN NUMBER
22026 --Adjustment Type
22027 , p_source_48 IN VARCHAR2
22028 --Transaction Header Identifier
22029 , p_source_49 IN NUMBER
22030 --Adjustment Line Identifier
22031 , p_source_50 IN NUMBER
22032 --Distribution Type Code
22033 , p_source_51 IN VARCHAR2
22034 --Entered Amount
22035 , p_source_52 IN NUMBER
22036 --Currency Code
22037 , p_source_53 IN VARCHAR2
22038 )
22039 IS
22040
22041 l_component_type VARCHAR2(80);
22042 l_component_code VARCHAR2(30);
22043 l_component_type_code VARCHAR2(1);
22044 l_component_appl_id INTEGER;
22045 l_amb_context_code VARCHAR2(30);
22046 l_entity_code VARCHAR2(30);
22047 l_event_class_code VARCHAR2(30);
22048 l_ae_header_id NUMBER;
22049 l_event_type_code VARCHAR2(30);
22050 l_line_definition_code VARCHAR2(30);
22051 l_line_definition_owner_code VARCHAR2(1);
22052 --
22053 -- adr variables
22054 l_segment VARCHAR2(30);
22055 l_ccid NUMBER;
22056 l_adr_transaction_coa_id NUMBER;
22057 l_adr_accounting_coa_id NUMBER;
22058 l_adr_flexfield_segment_code VARCHAR2(30);
22059 l_adr_flex_value_set_id NUMBER;
22060 l_adr_value_type_code VARCHAR2(30);
22061 l_adr_value_combination_id NUMBER;
22062 l_adr_value_segment_code VARCHAR2(30);
22063
22064 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
22065 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
22066 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
22067 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
22068
22069 -- 4262811 Variables ------------------------------------------------------------------------------------------
22070 l_entered_amt_idx NUMBER;
22071 l_accted_amt_idx NUMBER;
22072 l_acc_rev_flag VARCHAR2(1);
22073 l_accrual_line_num NUMBER;
22074 l_tmp_amt NUMBER;
22075 l_acc_rev_natural_side_code VARCHAR2(1);
22076
22077 l_num_entries NUMBER;
22078 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
22079 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
22080 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
22081 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
22082 l_recog_line_1 NUMBER;
22083 l_recog_line_2 NUMBER;
22084
22085 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
22086 l_bflow_applied_to_amt NUMBER; -- 5132302
22087 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
22088
22089 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
22090
22091 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
22092 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
22093
22094 ---------------------------------------------------------------------------------------------------------------
22095
22096
22097 --
22098 -- bulk performance
22099 --
22100 l_balance_type_code VARCHAR2(1);
22101 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
22102 l_log_module VARCHAR2(240);
22103
22104 --
22105 -- Upgrade strategy
22106 --
22107 l_actual_upg_option VARCHAR2(1);
22108 l_enc_upg_option VARCHAR2(1);
22109
22110 --
22111 BEGIN
22112 --
22113 IF g_log_enabled THEN
22114 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_195';
22115 END IF;
22116 --
22117 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
22118
22119 trace
22120 (p_msg => 'BEGIN of AcctLineType_195'
22121 ,p_level => C_LEVEL_PROCEDURE
22122 ,p_module => l_log_module);
22123
22124 END IF;
22125 --
22129 l_component_appl_id := 140;
22126 l_component_type := 'AMB_JLT';
22127 l_component_code := 'FA_ADD_COST';
22128 l_component_type_code := 'S';
22130 l_amb_context_code := 'DEFAULT';
22131 l_entity_code := 'TRANSACTIONS';
22132 l_event_class_code := 'ADDITIONS';
22133 l_event_type_code := 'ADDITIONS_ALL';
22134 l_line_definition_owner_code := 'S';
22135 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADDITI1';
22136 --
22137 l_balance_type_code := 'A';
22138 l_segment := NULL;
22139 l_ccid := NULL;
22140 l_adr_transaction_coa_id := NULL;
22141 l_adr_accounting_coa_id := NULL;
22142 l_adr_flexfield_segment_code := NULL;
22143 l_adr_flex_value_set_id := NULL;
22144 l_adr_value_type_code := NULL;
22145 l_adr_value_combination_id := NULL;
22146 l_adr_value_segment_code := NULL;
22147
22148 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
22149 l_bflow_class_code := ''; -- 4219869 Business Flow
22150 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
22151 l_budgetary_control_flag := 'N';
22152
22153 l_bflow_applied_to_amt_idx := NULL; -- 5132302
22154 l_bflow_applied_to_amt := NULL; -- 5132302
22155 l_entered_amt_idx := NULL; -- 4262811
22156 l_accted_amt_idx := NULL; -- 4262811
22157 l_acc_rev_flag := NULL; -- 4262811
22158 l_accrual_line_num := NULL; -- 4262811
22159 l_tmp_amt := NULL; -- 4262811
22160 --
22161
22162 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
22163 l_balance_type_code <> 'B' THEN
22164 IF NVL(p_source_48,'
22165 ') = 'COST'
22166 THEN
22167
22168 --
22169 XLA_AE_LINES_PKG.SetNewLine;
22170
22171 p_balance_type_code := l_balance_type_code;
22172 -- set the flag so later we will know whether the gain loss line needs to be created
22173
22174 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
22175 p_actual_flag :='A';
22176 END IF;
22177
22178 --
22179 -- bulk performance
22180 --
22181 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
22182 p_header_num => 0); -- 4262811
22183 --
22184 -- set accounting line options
22185 --
22186 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
22187 p_natural_side_code => 'D'
22188 , p_gain_or_loss_flag => 'N'
22189 , p_gl_transfer_mode_code => 'S'
22190 , p_acct_entry_type_code => 'A'
22191 , p_switch_side_flag => 'Y'
22192 , p_merge_duplicate_code => 'N'
22193 );
22194 --
22195 l_acc_rev_natural_side_code := 'C'; -- 4262811
22196 --
22197 --
22198 -- set accounting line type info
22199 --
22200 xla_ae_lines_pkg.SetAcctLineType
22201 (p_component_type => l_component_type
22202 ,p_event_type_code => l_event_type_code
22203 ,p_line_definition_owner_code => l_line_definition_owner_code
22204 ,p_line_definition_code => l_line_definition_code
22205 ,p_accounting_line_code => l_component_code
22206 ,p_accounting_line_type_code => l_component_type_code
22207 ,p_accounting_line_appl_id => l_component_appl_id
22208 ,p_amb_context_code => l_amb_context_code
22209 ,p_entity_code => l_entity_code
22210 ,p_event_class_code => l_event_class_code);
22211 --
22212 -- set accounting class
22213 --
22214 xla_ae_lines_pkg.SetAcctClass(
22215 p_accounting_class_code => 'ASSET'
22216 , p_ae_header_id => l_ae_header_id
22217 );
22218
22219 --
22220 -- set rounding class
22221 --
22222 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
22223 'ASSET';
22224
22225 --
22226 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
22227 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
22228 --
22229 -- bulk performance
22230 --
22231 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
22232
22233 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
22234 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
22235
22236 -- 4955764
22237 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
22238 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
22239
22240 -- 4458381 Public Sector Enh
22241
22242 --
22243 -- set accounting attributes for the line type
22244 --
22245 l_entered_amt_idx := 4;
22246 l_accted_amt_idx := 6;
22247 l_bflow_applied_to_amt_idx := NULL; -- 5132302
22248 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
22249 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
22253 l_rec_acct_attrs.array_char_value(3) := p_source_51;
22250 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
22251 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
22252 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
22254 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
22255 l_rec_acct_attrs.array_num_value(4) := p_source_52;
22256 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
22257 l_rec_acct_attrs.array_char_value(5) := p_source_53;
22258 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
22259 l_rec_acct_attrs.array_num_value(6) := p_source_52;
22260
22261 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
22262 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
22263
22264 ---------------------------------------------------------------------------------------------------------------
22265 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
22266 ---------------------------------------------------------------------------------------------------------------
22267 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
22268
22269 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
22270 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
22271
22272 IF xla_accounting_cache_pkg.GetValueChar
22273 (p_source_code => 'LEDGER_CATEGORY_CODE'
22274 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
22275 AND l_bflow_method_code = 'PRIOR_ENTRY'
22276 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
22277 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
22278 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
22279 )
22280 THEN
22281 xla_ae_lines_pkg.BflowUpgEntry
22282 (p_business_method_code => l_bflow_method_code
22283 ,p_business_class_code => l_bflow_class_code
22284 ,p_balance_type => l_balance_type_code);
22285 ELSE
22286 NULL;
22287 -- No business flow processing for business flow method of NONE.
22288 END IF;
22289
22290 --
22291 -- call analytical criteria
22292 --
22293
22294 --
22295 -- call description
22296 --
22297
22298 xla_ae_lines_pkg.SetLineDescription(
22299 p_ae_header_id => l_ae_header_id
22300 ,p_description => Description_4 (
22301 p_application_id => p_application_id
22302 , p_ae_header_id => l_ae_header_id
22303 , p_source_1 => p_source_1
22304 )
22305 );
22306
22307
22308 --
22309 -- call ADRs
22310 -- Bug 4922099
22311 --
22312 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
22313 (NVL(l_actual_upg_option, 'N') = 'O') OR
22314 (NVL(l_enc_upg_option, 'N') = 'O')
22315 )
22316 THEN
22317 NULL;
22318 --
22319 --
22320
22321 l_ccid := AcctDerRule_174(
22322 p_application_id => p_application_id
22323 , p_ae_header_id => l_ae_header_id
22324 , p_source_5 => p_source_5
22325 , p_source_32 => p_source_32
22326 , x_transaction_coa_id => l_adr_transaction_coa_id
22327 , x_accounting_coa_id => l_adr_accounting_coa_id
22328 , x_value_type_code => l_adr_value_type_code
22329 , p_side => 'NA'
22330 );
22331
22332 xla_ae_lines_pkg.set_ccid(
22333 p_code_combination_id => l_ccid
22334 , p_value_type_code => l_adr_value_type_code
22335 , p_transaction_coa_id => l_adr_transaction_coa_id
22336 , p_accounting_coa_id => l_adr_accounting_coa_id
22337 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
22338 , p_adr_type_code => 'S'
22339 , p_component_type => l_component_type
22340 , p_component_code => l_component_code
22341 , p_component_type_code => l_component_type_code
22342 , p_component_appl_id => l_component_appl_id
22343 , p_amb_context_code => l_amb_context_code
22344 , p_side => 'NA'
22345 );
22346
22347
22348 l_segment := AcctDerRule_149(
22349 p_application_id => p_application_id
22350 , p_ae_header_id => l_ae_header_id
22351 , p_source_5 => p_source_5
22352 , p_source_11 => p_source_11
22353 , x_transaction_coa_id => l_adr_transaction_coa_id
22354 , x_accounting_coa_id => l_adr_accounting_coa_id
22355 , x_flexfield_segment_code => l_adr_flexfield_segment_code
22356 , x_flex_value_set_id => l_adr_flex_value_set_id
22357 , x_value_type_code => l_adr_value_type_code
22358 , x_value_combination_id => l_adr_value_combination_id
22359 , x_value_segment_code => l_adr_value_segment_code
22360 , p_side => 'NA'
22361 , p_override_seg_flag => 'Y'
22362 );
22363
22367 p_to_segment_code => 'GL_ACCOUNT'
22364 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
22365
22366 xla_ae_lines_pkg.set_segment(
22368 , p_segment_value => l_segment
22369 , p_from_segment_code => l_adr_value_segment_code
22370 , p_from_combination_id => l_adr_value_combination_id
22371 , p_value_type_code => l_adr_value_type_code
22372 , p_transaction_coa_id => l_adr_transaction_coa_id
22373 , p_accounting_coa_id => l_adr_accounting_coa_id
22374 , p_flexfield_segment_code => l_adr_flexfield_segment_code
22375 , p_flex_value_set_id => l_adr_flex_value_set_id
22376 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
22377 , p_adr_type_code => 'S'
22378 , p_component_type => l_component_type
22379 , p_component_code => l_component_code
22380 , p_component_type_code => l_component_type_code
22381 , p_component_appl_id => l_component_appl_id
22382 , p_amb_context_code => l_amb_context_code
22383 , p_entity_code => 'TRANSACTIONS'
22384 , p_event_class_code => 'ADDITIONS'
22385 , p_side => 'NA'
22386 );
22387
22388 END IF;
22389
22390 l_segment := AcctDerRule_169(
22391 p_application_id => p_application_id
22392 , p_ae_header_id => l_ae_header_id
22393 , p_source_5 => p_source_5
22394 , p_source_31 => p_source_31
22395 , x_transaction_coa_id => l_adr_transaction_coa_id
22396 , x_accounting_coa_id => l_adr_accounting_coa_id
22397 , x_flexfield_segment_code => l_adr_flexfield_segment_code
22398 , x_flex_value_set_id => l_adr_flex_value_set_id
22399 , x_value_type_code => l_adr_value_type_code
22400 , x_value_combination_id => l_adr_value_combination_id
22401 , x_value_segment_code => l_adr_value_segment_code
22402 , p_side => 'NA'
22403 , p_override_seg_flag => 'Y'
22404 );
22405
22406 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
22407
22408 xla_ae_lines_pkg.set_segment(
22409 p_to_segment_code => 'GL_BALANCING'
22410 , p_segment_value => l_segment
22411 , p_from_segment_code => l_adr_value_segment_code
22412 , p_from_combination_id => l_adr_value_combination_id
22413 , p_value_type_code => l_adr_value_type_code
22414 , p_transaction_coa_id => l_adr_transaction_coa_id
22415 , p_accounting_coa_id => l_adr_accounting_coa_id
22416 , p_flexfield_segment_code => l_adr_flexfield_segment_code
22417 , p_flex_value_set_id => l_adr_flex_value_set_id
22418 , p_adr_code => 'FA_EXPENSE_ACCT'
22419 , p_adr_type_code => 'S'
22420 , p_component_type => l_component_type
22421 , p_component_code => l_component_code
22422 , p_component_type_code => l_component_type_code
22423 , p_component_appl_id => l_component_appl_id
22424 , p_amb_context_code => l_amb_context_code
22425 , p_entity_code => 'TRANSACTIONS'
22426 , p_event_class_code => 'ADDITIONS'
22427 , p_side => 'NA'
22428 );
22429
22430 END IF;
22431
22432 --
22433 --
22434 END IF;
22435 --
22436 -- Bug 4922099
22437 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
22438 (NVL(l_enc_upg_option, 'N') = 'O')
22439 ) AND
22440 (l_bflow_method_code = 'PRIOR_ENTRY')
22441 )
22442 THEN
22443 IF
22444 --
22445 1 = 2
22446 --
22447 THEN
22448 xla_accounting_err_pkg.build_message
22449 (p_appli_s_name => 'XLA'
22450 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
22451 ,p_token_1 => 'LINE_NUMBER'
22452 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
22453 ,p_token_2 => 'LINE_TYPE_NAME'
22454 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
22455 l_component_type
22456 ,l_component_code
22457 ,l_component_type_code
22458 ,l_component_appl_id
22459 ,l_amb_context_code
22460 ,l_entity_code
22461 ,l_event_class_code
22462 )
22463 ,p_token_3 => 'OWNER'
22464 ,p_value_3 => xla_lookups_pkg.get_meaning(
22465 p_lookup_type => 'XLA_OWNER_TYPE'
22469 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
22466 ,p_lookup_code => l_component_type_code
22467 )
22468 ,p_token_4 => 'PRODUCT_NAME'
22470 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
22471 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
22472 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
22473 ,p_ae_header_id => NULL
22474 );
22475
22476 IF (C_LEVEL_ERROR>= g_log_level) THEN
22477 trace
22478 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
22479 ,p_level => C_LEVEL_ERROR
22480 ,p_module => l_log_module);
22481 END IF;
22482 END IF;
22483 END IF;
22484 --
22485 --
22486 ------------------------------------------------------------------------------------------------
22487 -- 4219869 Business Flow
22488 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
22489 -- Prior Entry. Currently, the following code is always generated.
22490 ------------------------------------------------------------------------------------------------
22491 XLA_AE_LINES_PKG.ValidateCurrentLine;
22492
22493 ------------------------------------------------------------------------------------
22494 -- 4219869 Business Flow
22495 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
22496 ------------------------------------------------------------------------------------
22497 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
22498
22499 ----------------------------------------------------------------------------------
22500 -- 4219869 Business Flow
22501 -- Update journal entry status -- Need to generate this within IF <condition>
22502 ----------------------------------------------------------------------------------
22503 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
22504 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
22505 ,p_balance_type_code => l_balance_type_code
22506 );
22507
22508 -------------------------------------------------------------------------------------------
22509 -- 4262811 - Generate the Accrual Reversal lines
22510 -------------------------------------------------------------------------------------------
22511 BEGIN
22512 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
22513 (g_array_event(p_event_id).array_value_num('header_index'));
22514 IF l_acc_rev_flag IS NULL THEN
22515 l_acc_rev_flag := 'N';
22516 END IF;
22517 EXCEPTION
22518 WHEN OTHERS THEN
22519 l_acc_rev_flag := 'N';
22520 END;
22521 --
22522 IF (l_acc_rev_flag = 'Y') THEN
22523
22524 -- 4645092 ------------------------------------------------------------------------------
22525 -- To allow MPA report to determine if it should generate report process
22526 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
22527 ------------------------------------------------------------------------------------------
22528
22529 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
22530 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
22531 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
22532 -- call ADRs
22533 -- Bug 4922099
22534 --
22535 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
22536 (NVL(l_actual_upg_option, 'N') = 'O') OR
22537 (NVL(l_enc_upg_option, 'N') = 'O')
22538 )
22539 THEN
22540 NULL;
22541 --
22542 --
22543
22544 l_ccid := AcctDerRule_174(
22545 p_application_id => p_application_id
22546 , p_ae_header_id => l_ae_header_id
22547 , p_source_5 => p_source_5
22548 , p_source_32 => p_source_32
22549 , x_transaction_coa_id => l_adr_transaction_coa_id
22550 , x_accounting_coa_id => l_adr_accounting_coa_id
22551 , x_value_type_code => l_adr_value_type_code
22552 , p_side => 'NA'
22553 );
22554
22555 xla_ae_lines_pkg.set_ccid(
22556 p_code_combination_id => l_ccid
22557 , p_value_type_code => l_adr_value_type_code
22558 , p_transaction_coa_id => l_adr_transaction_coa_id
22559 , p_accounting_coa_id => l_adr_accounting_coa_id
22560 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
22561 , p_adr_type_code => 'S'
22562 , p_component_type => l_component_type
22563 , p_component_code => l_component_code
22564 , p_component_type_code => l_component_type_code
22565 , p_component_appl_id => l_component_appl_id
22566 , p_amb_context_code => l_amb_context_code
22567 , p_side => 'NA'
22568 );
22569
22570
22571 l_segment := AcctDerRule_149(
22575 , p_source_11 => p_source_11
22572 p_application_id => p_application_id
22573 , p_ae_header_id => l_ae_header_id
22574 , p_source_5 => p_source_5
22576 , x_transaction_coa_id => l_adr_transaction_coa_id
22577 , x_accounting_coa_id => l_adr_accounting_coa_id
22578 , x_flexfield_segment_code => l_adr_flexfield_segment_code
22579 , x_flex_value_set_id => l_adr_flex_value_set_id
22580 , x_value_type_code => l_adr_value_type_code
22581 , x_value_combination_id => l_adr_value_combination_id
22582 , x_value_segment_code => l_adr_value_segment_code
22583 , p_side => 'NA'
22584 , p_override_seg_flag => 'Y'
22585 );
22586
22587 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
22588
22589 xla_ae_lines_pkg.set_segment(
22590 p_to_segment_code => 'GL_ACCOUNT'
22591 , p_segment_value => l_segment
22592 , p_from_segment_code => l_adr_value_segment_code
22593 , p_from_combination_id => l_adr_value_combination_id
22594 , p_value_type_code => l_adr_value_type_code
22595 , p_transaction_coa_id => l_adr_transaction_coa_id
22596 , p_accounting_coa_id => l_adr_accounting_coa_id
22597 , p_flexfield_segment_code => l_adr_flexfield_segment_code
22598 , p_flex_value_set_id => l_adr_flex_value_set_id
22599 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
22600 , p_adr_type_code => 'S'
22601 , p_component_type => l_component_type
22602 , p_component_code => l_component_code
22603 , p_component_type_code => l_component_type_code
22604 , p_component_appl_id => l_component_appl_id
22605 , p_amb_context_code => l_amb_context_code
22606 , p_entity_code => 'TRANSACTIONS'
22607 , p_event_class_code => 'ADDITIONS'
22608 , p_side => 'NA'
22609 );
22610
22611 END IF;
22612
22613 l_segment := AcctDerRule_169(
22614 p_application_id => p_application_id
22615 , p_ae_header_id => l_ae_header_id
22616 , p_source_5 => p_source_5
22617 , p_source_31 => p_source_31
22618 , x_transaction_coa_id => l_adr_transaction_coa_id
22619 , x_accounting_coa_id => l_adr_accounting_coa_id
22620 , x_flexfield_segment_code => l_adr_flexfield_segment_code
22621 , x_flex_value_set_id => l_adr_flex_value_set_id
22622 , x_value_type_code => l_adr_value_type_code
22623 , x_value_combination_id => l_adr_value_combination_id
22624 , x_value_segment_code => l_adr_value_segment_code
22625 , p_side => 'NA'
22626 , p_override_seg_flag => 'Y'
22627 );
22628
22629 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
22630
22631 xla_ae_lines_pkg.set_segment(
22632 p_to_segment_code => 'GL_BALANCING'
22633 , p_segment_value => l_segment
22634 , p_from_segment_code => l_adr_value_segment_code
22635 , p_from_combination_id => l_adr_value_combination_id
22636 , p_value_type_code => l_adr_value_type_code
22637 , p_transaction_coa_id => l_adr_transaction_coa_id
22638 , p_accounting_coa_id => l_adr_accounting_coa_id
22639 , p_flexfield_segment_code => l_adr_flexfield_segment_code
22640 , p_flex_value_set_id => l_adr_flex_value_set_id
22641 , p_adr_code => 'FA_EXPENSE_ACCT'
22642 , p_adr_type_code => 'S'
22643 , p_component_type => l_component_type
22644 , p_component_code => l_component_code
22645 , p_component_type_code => l_component_type_code
22646 , p_component_appl_id => l_component_appl_id
22647 , p_amb_context_code => l_amb_context_code
22648 , p_entity_code => 'TRANSACTIONS'
22649 , p_event_class_code => 'ADDITIONS'
22650 , p_side => 'NA'
22651 );
22652
22653 END IF;
22654
22655 --
22656 --
22657 END IF;
22658
22659 --
22660 -- Update the line information that should be overwritten
22661 --
22662 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
22663 p_header_num => 1);
22664 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
22665
22666 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
22667
22668 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
22669 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
22670 END IF;
22671
22672 --
22673 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
22674 --
22675 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
22676 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
22677 ELSE
22678 ---------------------------------------------------------------------------------------------------
22682 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
22679 -- 4262811a Switch Sign
22680 ---------------------------------------------------------------------------------------------------
22681 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
22683 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
22684 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
22685 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
22686 -- 5132302
22687 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
22688 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
22689
22690 END IF;
22691
22692 -- 4955764
22693 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
22694 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
22695
22696
22697 XLA_AE_LINES_PKG.ValidateCurrentLine;
22698 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
22699
22700 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
22701 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
22702 ,p_balance_type_code => l_balance_type_code);
22703
22704 END IF;
22705
22706 -----------------------------------------------------------------------------------------
22707 -- 4262811 Multiperiod Accounting
22708 -----------------------------------------------------------------------------------------
22709 -- No MPA option is assigned.
22710
22711
22712 END IF;
22713 END IF;
22714 --
22715
22716 --
22717 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
22718 trace
22719 (p_msg => 'END of AcctLineType_195'
22720 ,p_level => C_LEVEL_PROCEDURE
22721 ,p_module => l_log_module);
22722 END IF;
22723 --
22724 EXCEPTION
22725 WHEN xla_exceptions_pkg.application_exception THEN
22726 RAISE;
22727 WHEN OTHERS THEN
22728 xla_exceptions_pkg.raise_message
22729 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_195');
22730 END AcctLineType_195;
22731 --
22732
22733 ---------------------------------------
22734 --
22735 -- PRIVATE FUNCTION
22736 -- AcctLineType_196
22737 --
22738 ---------------------------------------
22739 PROCEDURE AcctLineType_196 (
22740 p_application_id IN NUMBER
22741 ,p_event_id IN NUMBER
22742 ,p_calculate_acctd_flag IN VARCHAR2
22743 ,p_calculate_g_l_flag IN VARCHAR2
22744 ,p_actual_flag IN OUT VARCHAR2
22745 ,p_balance_type_code OUT VARCHAR2
22746 ,p_gain_or_loss_ref OUT VARCHAR2
22747
22748 --Period Close Date
22749 , p_source_1 IN DATE
22750 --Generated Code Combination Identifier
22751 , p_source_5 IN NUMBER
22752 --Payables Code Combination Identifier
22753 , p_source_8 IN NUMBER
22754 --Asset Clearing Account
22755 , p_source_10 IN VARCHAR2
22756 --Expense Account Code Combination Identifier
22757 , p_source_31 IN NUMBER
22758 --Default Code Combination Identifier
22759 , p_source_32 IN NUMBER
22760 --Adjustment Type
22761 , p_source_48 IN VARCHAR2
22762 --Transaction Header Identifier
22763 , p_source_49 IN NUMBER
22764 --Adjustment Line Identifier
22765 , p_source_50 IN NUMBER
22766 --Distribution Type Code
22767 , p_source_51 IN VARCHAR2
22768 --Entered Amount
22769 , p_source_52 IN NUMBER
22770 --Currency Code
22771 , p_source_53 IN VARCHAR2
22772 )
22773 IS
22774
22775 l_component_type VARCHAR2(80);
22776 l_component_code VARCHAR2(30);
22777 l_component_type_code VARCHAR2(1);
22778 l_component_appl_id INTEGER;
22779 l_amb_context_code VARCHAR2(30);
22780 l_entity_code VARCHAR2(30);
22781 l_event_class_code VARCHAR2(30);
22782 l_ae_header_id NUMBER;
22783 l_event_type_code VARCHAR2(30);
22784 l_line_definition_code VARCHAR2(30);
22785 l_line_definition_owner_code VARCHAR2(1);
22786 --
22787 -- adr variables
22788 l_segment VARCHAR2(30);
22789 l_ccid NUMBER;
22790 l_adr_transaction_coa_id NUMBER;
22791 l_adr_accounting_coa_id NUMBER;
22792 l_adr_flexfield_segment_code VARCHAR2(30);
22793 l_adr_flex_value_set_id NUMBER;
22794 l_adr_value_type_code VARCHAR2(30);
22795 l_adr_value_combination_id NUMBER;
22796 l_adr_value_segment_code VARCHAR2(30);
22797
22798 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
22799 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
22800 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
22801 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
22802
22803 -- 4262811 Variables ------------------------------------------------------------------------------------------
22804 l_entered_amt_idx NUMBER;
22808 l_tmp_amt NUMBER;
22805 l_accted_amt_idx NUMBER;
22806 l_acc_rev_flag VARCHAR2(1);
22807 l_accrual_line_num NUMBER;
22809 l_acc_rev_natural_side_code VARCHAR2(1);
22810
22811 l_num_entries NUMBER;
22812 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
22813 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
22814 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
22815 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
22816 l_recog_line_1 NUMBER;
22817 l_recog_line_2 NUMBER;
22818
22819 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
22820 l_bflow_applied_to_amt NUMBER; -- 5132302
22821 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
22822
22823 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
22824
22825 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
22826 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
22827
22828 ---------------------------------------------------------------------------------------------------------------
22829
22830
22831 --
22832 -- bulk performance
22833 --
22834 l_balance_type_code VARCHAR2(1);
22835 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
22836 l_log_module VARCHAR2(240);
22837
22838 --
22839 -- Upgrade strategy
22840 --
22841 l_actual_upg_option VARCHAR2(1);
22842 l_enc_upg_option VARCHAR2(1);
22843
22844 --
22845 BEGIN
22846 --
22847 IF g_log_enabled THEN
22848 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_196';
22849 END IF;
22850 --
22851 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
22852
22853 trace
22854 (p_msg => 'BEGIN of AcctLineType_196'
22855 ,p_level => C_LEVEL_PROCEDURE
22856 ,p_module => l_log_module);
22857
22858 END IF;
22859 --
22860 l_component_type := 'AMB_JLT';
22861 l_component_code := 'FA_ADD_COST_CLEARING';
22862 l_component_type_code := 'S';
22863 l_component_appl_id := 140;
22864 l_amb_context_code := 'DEFAULT';
22865 l_entity_code := 'TRANSACTIONS';
22866 l_event_class_code := 'ADDITIONS';
22867 l_event_type_code := 'ADDITIONS_ALL';
22868 l_line_definition_owner_code := 'S';
22869 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADDITI1';
22870 --
22871 l_balance_type_code := 'A';
22872 l_segment := NULL;
22873 l_ccid := NULL;
22874 l_adr_transaction_coa_id := NULL;
22875 l_adr_accounting_coa_id := NULL;
22876 l_adr_flexfield_segment_code := NULL;
22877 l_adr_flex_value_set_id := NULL;
22878 l_adr_value_type_code := NULL;
22879 l_adr_value_combination_id := NULL;
22880 l_adr_value_segment_code := NULL;
22881
22882 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
22883 l_bflow_class_code := ''; -- 4219869 Business Flow
22884 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
22885 l_budgetary_control_flag := 'N';
22886
22887 l_bflow_applied_to_amt_idx := NULL; -- 5132302
22888 l_bflow_applied_to_amt := NULL; -- 5132302
22889 l_entered_amt_idx := NULL; -- 4262811
22890 l_accted_amt_idx := NULL; -- 4262811
22891 l_acc_rev_flag := NULL; -- 4262811
22892 l_accrual_line_num := NULL; -- 4262811
22893 l_tmp_amt := NULL; -- 4262811
22894 --
22895
22896 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
22897 l_balance_type_code <> 'B' THEN
22898 IF NVL(p_source_48,'
22899 ') = 'COST CLEARING'
22900 THEN
22901
22902 --
22903 XLA_AE_LINES_PKG.SetNewLine;
22904
22905 p_balance_type_code := l_balance_type_code;
22906 -- set the flag so later we will know whether the gain loss line needs to be created
22907
22908 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
22909 p_actual_flag :='A';
22910 END IF;
22911
22912 --
22913 -- bulk performance
22914 --
22915 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
22916 p_header_num => 0); -- 4262811
22917 --
22918 -- set accounting line options
22919 --
22920 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
22921 p_natural_side_code => 'C'
22922 , p_gain_or_loss_flag => 'N'
22923 , p_gl_transfer_mode_code => 'S'
22924 , p_acct_entry_type_code => 'A'
22925 , p_switch_side_flag => 'Y'
22926 , p_merge_duplicate_code => 'N'
22927 );
22928 --
22929 l_acc_rev_natural_side_code := 'D'; -- 4262811
22930 --
22931 --
22932 -- set accounting line type info
22933 --
22934 xla_ae_lines_pkg.SetAcctLineType
22935 (p_component_type => l_component_type
22936 ,p_event_type_code => l_event_type_code
22940 ,p_accounting_line_type_code => l_component_type_code
22937 ,p_line_definition_owner_code => l_line_definition_owner_code
22938 ,p_line_definition_code => l_line_definition_code
22939 ,p_accounting_line_code => l_component_code
22941 ,p_accounting_line_appl_id => l_component_appl_id
22942 ,p_amb_context_code => l_amb_context_code
22943 ,p_entity_code => l_entity_code
22944 ,p_event_class_code => l_event_class_code);
22945 --
22946 -- set accounting class
22947 --
22948 xla_ae_lines_pkg.SetAcctClass(
22949 p_accounting_class_code => 'ASSET'
22950 , p_ae_header_id => l_ae_header_id
22951 );
22952
22953 --
22954 -- set rounding class
22955 --
22956 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
22957 'ASSET';
22958
22959 --
22960 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
22961 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
22962 --
22963 -- bulk performance
22964 --
22965 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
22966
22967 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
22968 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
22969
22970 -- 4955764
22971 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
22972 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
22973
22974 -- 4458381 Public Sector Enh
22975
22976 --
22977 -- set accounting attributes for the line type
22978 --
22979 l_entered_amt_idx := 4;
22980 l_accted_amt_idx := 6;
22981 l_bflow_applied_to_amt_idx := NULL; -- 5132302
22982 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
22983 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
22984 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
22985 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
22986 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
22987 l_rec_acct_attrs.array_char_value(3) := p_source_51;
22988 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
22989 l_rec_acct_attrs.array_num_value(4) := p_source_52;
22990 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
22991 l_rec_acct_attrs.array_char_value(5) := p_source_53;
22992 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
22993 l_rec_acct_attrs.array_num_value(6) := p_source_52;
22994
22995 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
22996 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
22997
22998 ---------------------------------------------------------------------------------------------------------------
22999 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
23000 ---------------------------------------------------------------------------------------------------------------
23001 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
23002
23003 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
23004 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
23005
23006 IF xla_accounting_cache_pkg.GetValueChar
23007 (p_source_code => 'LEDGER_CATEGORY_CODE'
23008 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
23009 AND l_bflow_method_code = 'PRIOR_ENTRY'
23010 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
23011 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
23012 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
23013 )
23014 THEN
23015 xla_ae_lines_pkg.BflowUpgEntry
23016 (p_business_method_code => l_bflow_method_code
23017 ,p_business_class_code => l_bflow_class_code
23018 ,p_balance_type => l_balance_type_code);
23019 ELSE
23020 NULL;
23021 -- No business flow processing for business flow method of NONE.
23022 END IF;
23023
23024 --
23025 -- call analytical criteria
23026 --
23027
23028 --
23029 -- call description
23030 --
23031
23032 xla_ae_lines_pkg.SetLineDescription(
23033 p_ae_header_id => l_ae_header_id
23034 ,p_description => Description_5 (
23035 p_application_id => p_application_id
23036 , p_ae_header_id => l_ae_header_id
23037 , p_source_1 => p_source_1
23038 )
23039 );
23040
23041
23042 --
23043 -- call ADRs
23044 -- Bug 4922099
23045 --
23046 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
23047 (NVL(l_actual_upg_option, 'N') = 'O') OR
23048 (NVL(l_enc_upg_option, 'N') = 'O')
23049 )
23050 THEN
23051 NULL;
23052 --
23053 --
23054
23055 l_ccid := AcctDerRule_173(
23056 p_application_id => p_application_id
23060 , p_source_32 => p_source_32
23057 , p_ae_header_id => l_ae_header_id
23058 , p_source_5 => p_source_5
23059 , p_source_8 => p_source_8
23061 , x_transaction_coa_id => l_adr_transaction_coa_id
23062 , x_accounting_coa_id => l_adr_accounting_coa_id
23063 , x_value_type_code => l_adr_value_type_code
23064 , p_side => 'NA'
23065 );
23066
23067 xla_ae_lines_pkg.set_ccid(
23068 p_code_combination_id => l_ccid
23069 , p_value_type_code => l_adr_value_type_code
23070 , p_transaction_coa_id => l_adr_transaction_coa_id
23071 , p_accounting_coa_id => l_adr_accounting_coa_id
23072 , p_adr_code => 'FA_CAT_COST_CLEARING'
23073 , p_adr_type_code => 'S'
23074 , p_component_type => l_component_type
23075 , p_component_code => l_component_code
23076 , p_component_type_code => l_component_type_code
23077 , p_component_appl_id => l_component_appl_id
23078 , p_amb_context_code => l_amb_context_code
23079 , p_side => 'NA'
23080 );
23081
23082
23083 l_segment := AcctDerRule_148(
23084 p_application_id => p_application_id
23085 , p_ae_header_id => l_ae_header_id
23086 , p_source_5 => p_source_5
23087 , p_source_8 => p_source_8
23088 , p_source_10 => p_source_10
23089 , x_transaction_coa_id => l_adr_transaction_coa_id
23090 , x_accounting_coa_id => l_adr_accounting_coa_id
23091 , x_flexfield_segment_code => l_adr_flexfield_segment_code
23092 , x_flex_value_set_id => l_adr_flex_value_set_id
23093 , x_value_type_code => l_adr_value_type_code
23094 , x_value_combination_id => l_adr_value_combination_id
23095 , x_value_segment_code => l_adr_value_segment_code
23096 , p_side => 'NA'
23097 , p_override_seg_flag => 'Y'
23098 );
23099
23100 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
23101
23102 xla_ae_lines_pkg.set_segment(
23103 p_to_segment_code => 'GL_ACCOUNT'
23104 , p_segment_value => l_segment
23105 , p_from_segment_code => l_adr_value_segment_code
23106 , p_from_combination_id => l_adr_value_combination_id
23107 , p_value_type_code => l_adr_value_type_code
23108 , p_transaction_coa_id => l_adr_transaction_coa_id
23109 , p_accounting_coa_id => l_adr_accounting_coa_id
23110 , p_flexfield_segment_code => l_adr_flexfield_segment_code
23111 , p_flex_value_set_id => l_adr_flex_value_set_id
23112 , p_adr_code => 'FA_CAT_CLR_ACCOUNT_SEGMENT'
23113 , p_adr_type_code => 'S'
23114 , p_component_type => l_component_type
23115 , p_component_code => l_component_code
23116 , p_component_type_code => l_component_type_code
23117 , p_component_appl_id => l_component_appl_id
23118 , p_amb_context_code => l_amb_context_code
23119 , p_entity_code => 'TRANSACTIONS'
23120 , p_event_class_code => 'ADDITIONS'
23121 , p_side => 'NA'
23122 );
23123
23124 END IF;
23125
23126 l_segment := AcctDerRule_170(
23127 p_application_id => p_application_id
23128 , p_ae_header_id => l_ae_header_id
23129 , p_source_5 => p_source_5
23130 , p_source_8 => p_source_8
23131 , p_source_31 => p_source_31
23132 , x_transaction_coa_id => l_adr_transaction_coa_id
23133 , x_accounting_coa_id => l_adr_accounting_coa_id
23134 , x_flexfield_segment_code => l_adr_flexfield_segment_code
23135 , x_flex_value_set_id => l_adr_flex_value_set_id
23136 , x_value_type_code => l_adr_value_type_code
23137 , x_value_combination_id => l_adr_value_combination_id
23138 , x_value_segment_code => l_adr_value_segment_code
23139 , p_side => 'NA'
23140 , p_override_seg_flag => 'Y'
23141 );
23142
23143 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
23144
23145 xla_ae_lines_pkg.set_segment(
23146 p_to_segment_code => 'GL_BALANCING'
23147 , p_segment_value => l_segment
23148 , p_from_segment_code => l_adr_value_segment_code
23149 , p_from_combination_id => l_adr_value_combination_id
23150 , p_value_type_code => l_adr_value_type_code
23151 , p_transaction_coa_id => l_adr_transaction_coa_id
23152 , p_accounting_coa_id => l_adr_accounting_coa_id
23153 , p_flexfield_segment_code => l_adr_flexfield_segment_code
23154 , p_flex_value_set_id => l_adr_flex_value_set_id
23155 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
23156 , p_adr_type_code => 'S'
23157 , p_component_type => l_component_type
23158 , p_component_code => l_component_code
23159 , p_component_type_code => l_component_type_code
23160 , p_component_appl_id => l_component_appl_id
23161 , p_amb_context_code => l_amb_context_code
23162 , p_entity_code => 'TRANSACTIONS'
23166
23163 , p_event_class_code => 'ADDITIONS'
23164 , p_side => 'NA'
23165 );
23167 END IF;
23168
23169 --
23170 --
23171 END IF;
23172 --
23173 -- Bug 4922099
23174 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
23175 (NVL(l_enc_upg_option, 'N') = 'O')
23176 ) AND
23177 (l_bflow_method_code = 'PRIOR_ENTRY')
23178 )
23179 THEN
23180 IF
23181 --
23182 1 = 2
23183 --
23184 THEN
23185 xla_accounting_err_pkg.build_message
23186 (p_appli_s_name => 'XLA'
23187 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
23188 ,p_token_1 => 'LINE_NUMBER'
23189 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
23190 ,p_token_2 => 'LINE_TYPE_NAME'
23191 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
23192 l_component_type
23193 ,l_component_code
23194 ,l_component_type_code
23195 ,l_component_appl_id
23196 ,l_amb_context_code
23197 ,l_entity_code
23198 ,l_event_class_code
23199 )
23200 ,p_token_3 => 'OWNER'
23201 ,p_value_3 => xla_lookups_pkg.get_meaning(
23202 p_lookup_type => 'XLA_OWNER_TYPE'
23203 ,p_lookup_code => l_component_type_code
23204 )
23205 ,p_token_4 => 'PRODUCT_NAME'
23206 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
23207 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
23208 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
23209 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
23210 ,p_ae_header_id => NULL
23211 );
23212
23213 IF (C_LEVEL_ERROR>= g_log_level) THEN
23214 trace
23215 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
23216 ,p_level => C_LEVEL_ERROR
23217 ,p_module => l_log_module);
23218 END IF;
23219 END IF;
23220 END IF;
23221 --
23222 --
23223 ------------------------------------------------------------------------------------------------
23224 -- 4219869 Business Flow
23225 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
23226 -- Prior Entry. Currently, the following code is always generated.
23227 ------------------------------------------------------------------------------------------------
23228 XLA_AE_LINES_PKG.ValidateCurrentLine;
23229
23230 ------------------------------------------------------------------------------------
23231 -- 4219869 Business Flow
23232 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
23233 ------------------------------------------------------------------------------------
23234 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
23235
23236 ----------------------------------------------------------------------------------
23237 -- 4219869 Business Flow
23238 -- Update journal entry status -- Need to generate this within IF <condition>
23239 ----------------------------------------------------------------------------------
23240 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
23241 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
23242 ,p_balance_type_code => l_balance_type_code
23243 );
23244
23245 -------------------------------------------------------------------------------------------
23246 -- 4262811 - Generate the Accrual Reversal lines
23247 -------------------------------------------------------------------------------------------
23248 BEGIN
23249 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
23250 (g_array_event(p_event_id).array_value_num('header_index'));
23251 IF l_acc_rev_flag IS NULL THEN
23252 l_acc_rev_flag := 'N';
23253 END IF;
23254 EXCEPTION
23255 WHEN OTHERS THEN
23256 l_acc_rev_flag := 'N';
23257 END;
23258 --
23259 IF (l_acc_rev_flag = 'Y') THEN
23260
23264 ------------------------------------------------------------------------------------------
23261 -- 4645092 ------------------------------------------------------------------------------
23262 -- To allow MPA report to determine if it should generate report process
23263 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
23265
23266 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
23267 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
23268 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
23269 -- call ADRs
23270 -- Bug 4922099
23271 --
23272 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
23273 (NVL(l_actual_upg_option, 'N') = 'O') OR
23274 (NVL(l_enc_upg_option, 'N') = 'O')
23275 )
23276 THEN
23277 NULL;
23278 --
23279 --
23280
23281 l_ccid := AcctDerRule_173(
23282 p_application_id => p_application_id
23283 , p_ae_header_id => l_ae_header_id
23284 , p_source_5 => p_source_5
23285 , p_source_8 => p_source_8
23286 , p_source_32 => p_source_32
23287 , x_transaction_coa_id => l_adr_transaction_coa_id
23288 , x_accounting_coa_id => l_adr_accounting_coa_id
23289 , x_value_type_code => l_adr_value_type_code
23290 , p_side => 'NA'
23291 );
23292
23293 xla_ae_lines_pkg.set_ccid(
23294 p_code_combination_id => l_ccid
23295 , p_value_type_code => l_adr_value_type_code
23296 , p_transaction_coa_id => l_adr_transaction_coa_id
23297 , p_accounting_coa_id => l_adr_accounting_coa_id
23298 , p_adr_code => 'FA_CAT_COST_CLEARING'
23299 , p_adr_type_code => 'S'
23300 , p_component_type => l_component_type
23301 , p_component_code => l_component_code
23302 , p_component_type_code => l_component_type_code
23303 , p_component_appl_id => l_component_appl_id
23304 , p_amb_context_code => l_amb_context_code
23305 , p_side => 'NA'
23306 );
23307
23308
23309 l_segment := AcctDerRule_148(
23310 p_application_id => p_application_id
23311 , p_ae_header_id => l_ae_header_id
23312 , p_source_5 => p_source_5
23313 , p_source_8 => p_source_8
23314 , p_source_10 => p_source_10
23315 , x_transaction_coa_id => l_adr_transaction_coa_id
23316 , x_accounting_coa_id => l_adr_accounting_coa_id
23317 , x_flexfield_segment_code => l_adr_flexfield_segment_code
23318 , x_flex_value_set_id => l_adr_flex_value_set_id
23319 , x_value_type_code => l_adr_value_type_code
23320 , x_value_combination_id => l_adr_value_combination_id
23321 , x_value_segment_code => l_adr_value_segment_code
23322 , p_side => 'NA'
23323 , p_override_seg_flag => 'Y'
23324 );
23325
23326 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
23327
23328 xla_ae_lines_pkg.set_segment(
23329 p_to_segment_code => 'GL_ACCOUNT'
23330 , p_segment_value => l_segment
23331 , p_from_segment_code => l_adr_value_segment_code
23332 , p_from_combination_id => l_adr_value_combination_id
23333 , p_value_type_code => l_adr_value_type_code
23334 , p_transaction_coa_id => l_adr_transaction_coa_id
23335 , p_accounting_coa_id => l_adr_accounting_coa_id
23336 , p_flexfield_segment_code => l_adr_flexfield_segment_code
23337 , p_flex_value_set_id => l_adr_flex_value_set_id
23338 , p_adr_code => 'FA_CAT_CLR_ACCOUNT_SEGMENT'
23339 , p_adr_type_code => 'S'
23340 , p_component_type => l_component_type
23341 , p_component_code => l_component_code
23342 , p_component_type_code => l_component_type_code
23343 , p_component_appl_id => l_component_appl_id
23344 , p_amb_context_code => l_amb_context_code
23345 , p_entity_code => 'TRANSACTIONS'
23346 , p_event_class_code => 'ADDITIONS'
23347 , p_side => 'NA'
23348 );
23349
23350 END IF;
23351
23352 l_segment := AcctDerRule_170(
23353 p_application_id => p_application_id
23354 , p_ae_header_id => l_ae_header_id
23355 , p_source_5 => p_source_5
23356 , p_source_8 => p_source_8
23357 , p_source_31 => p_source_31
23358 , x_transaction_coa_id => l_adr_transaction_coa_id
23359 , x_accounting_coa_id => l_adr_accounting_coa_id
23360 , x_flexfield_segment_code => l_adr_flexfield_segment_code
23361 , x_flex_value_set_id => l_adr_flex_value_set_id
23362 , x_value_type_code => l_adr_value_type_code
23363 , x_value_combination_id => l_adr_value_combination_id
23364 , x_value_segment_code => l_adr_value_segment_code
23365 , p_side => 'NA'
23366 , p_override_seg_flag => 'Y'
23367 );
23368
23369 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
23370
23371 xla_ae_lines_pkg.set_segment(
23375 , p_from_combination_id => l_adr_value_combination_id
23372 p_to_segment_code => 'GL_BALANCING'
23373 , p_segment_value => l_segment
23374 , p_from_segment_code => l_adr_value_segment_code
23376 , p_value_type_code => l_adr_value_type_code
23377 , p_transaction_coa_id => l_adr_transaction_coa_id
23378 , p_accounting_coa_id => l_adr_accounting_coa_id
23379 , p_flexfield_segment_code => l_adr_flexfield_segment_code
23380 , p_flex_value_set_id => l_adr_flex_value_set_id
23381 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
23382 , p_adr_type_code => 'S'
23383 , p_component_type => l_component_type
23384 , p_component_code => l_component_code
23385 , p_component_type_code => l_component_type_code
23386 , p_component_appl_id => l_component_appl_id
23387 , p_amb_context_code => l_amb_context_code
23388 , p_entity_code => 'TRANSACTIONS'
23389 , p_event_class_code => 'ADDITIONS'
23390 , p_side => 'NA'
23391 );
23392
23393 END IF;
23394
23395 --
23396 --
23397 END IF;
23398
23399 --
23400 -- Update the line information that should be overwritten
23401 --
23402 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
23403 p_header_num => 1);
23404 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
23405
23406 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
23407
23408 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
23409 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
23410 END IF;
23411
23412 --
23413 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
23414 --
23415 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
23416 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
23417 ELSE
23418 ---------------------------------------------------------------------------------------------------
23419 -- 4262811a Switch Sign
23420 ---------------------------------------------------------------------------------------------------
23421 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
23422 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
23423 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
23424 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
23425 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
23426 -- 5132302
23427 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
23428 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
23429
23430 END IF;
23431
23432 -- 4955764
23433 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
23434 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
23435
23436
23437 XLA_AE_LINES_PKG.ValidateCurrentLine;
23438 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
23439
23440 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
23441 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
23442 ,p_balance_type_code => l_balance_type_code);
23443
23444 END IF;
23445
23446 -----------------------------------------------------------------------------------------
23447 -- 4262811 Multiperiod Accounting
23448 -----------------------------------------------------------------------------------------
23449 -- No MPA option is assigned.
23450
23451
23452 END IF;
23453 END IF;
23454 --
23455
23456 --
23457 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
23458 trace
23459 (p_msg => 'END of AcctLineType_196'
23460 ,p_level => C_LEVEL_PROCEDURE
23461 ,p_module => l_log_module);
23462 END IF;
23463 --
23464 EXCEPTION
23465 WHEN xla_exceptions_pkg.application_exception THEN
23466 RAISE;
23467 WHEN OTHERS THEN
23468 xla_exceptions_pkg.raise_message
23469 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_196');
23470 END AcctLineType_196;
23471 --
23472
23473 ---------------------------------------
23474 --
23475 -- PRIVATE FUNCTION
23476 -- AcctLineType_197
23477 --
23478 ---------------------------------------
23479 PROCEDURE AcctLineType_197 (
23480 p_application_id IN NUMBER
23481 ,p_event_id IN NUMBER
23482 ,p_calculate_acctd_flag IN VARCHAR2
23483 ,p_calculate_g_l_flag IN VARCHAR2
23484 ,p_actual_flag IN OUT VARCHAR2
23485 ,p_balance_type_code OUT VARCHAR2
23486 ,p_gain_or_loss_ref OUT VARCHAR2
23487
23491 , p_source_5 IN NUMBER
23488 --Period Close Date
23489 , p_source_1 IN DATE
23490 --Generated Code Combination Identifier
23492 --Expense Account Code Combination Identifier
23493 , p_source_31 IN NUMBER
23494 --Adjustment Type
23495 , p_source_48 IN VARCHAR2
23496 --Transaction Header Identifier
23497 , p_source_49 IN NUMBER
23498 --Adjustment Line Identifier
23499 , p_source_50 IN NUMBER
23500 --Distribution Type Code
23501 , p_source_51 IN VARCHAR2
23502 --Entered Amount
23503 , p_source_52 IN NUMBER
23504 --Currency Code
23505 , p_source_53 IN VARCHAR2
23506 )
23507 IS
23508
23509 l_component_type VARCHAR2(80);
23510 l_component_code VARCHAR2(30);
23511 l_component_type_code VARCHAR2(1);
23512 l_component_appl_id INTEGER;
23513 l_amb_context_code VARCHAR2(30);
23514 l_entity_code VARCHAR2(30);
23515 l_event_class_code VARCHAR2(30);
23516 l_ae_header_id NUMBER;
23517 l_event_type_code VARCHAR2(30);
23518 l_line_definition_code VARCHAR2(30);
23519 l_line_definition_owner_code VARCHAR2(1);
23520 --
23521 -- adr variables
23522 l_segment VARCHAR2(30);
23523 l_ccid NUMBER;
23524 l_adr_transaction_coa_id NUMBER;
23525 l_adr_accounting_coa_id NUMBER;
23526 l_adr_flexfield_segment_code VARCHAR2(30);
23527 l_adr_flex_value_set_id NUMBER;
23528 l_adr_value_type_code VARCHAR2(30);
23529 l_adr_value_combination_id NUMBER;
23530 l_adr_value_segment_code VARCHAR2(30);
23531
23532 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
23533 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
23534 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
23535 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
23536
23537 -- 4262811 Variables ------------------------------------------------------------------------------------------
23538 l_entered_amt_idx NUMBER;
23539 l_accted_amt_idx NUMBER;
23540 l_acc_rev_flag VARCHAR2(1);
23541 l_accrual_line_num NUMBER;
23542 l_tmp_amt NUMBER;
23543 l_acc_rev_natural_side_code VARCHAR2(1);
23544
23545 l_num_entries NUMBER;
23546 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
23547 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
23548 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
23549 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
23550 l_recog_line_1 NUMBER;
23551 l_recog_line_2 NUMBER;
23552
23553 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
23554 l_bflow_applied_to_amt NUMBER; -- 5132302
23555 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
23556
23557 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
23558
23559 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
23560 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
23561
23562 ---------------------------------------------------------------------------------------------------------------
23563
23564
23565 --
23566 -- bulk performance
23567 --
23568 l_balance_type_code VARCHAR2(1);
23569 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
23570 l_log_module VARCHAR2(240);
23571
23572 --
23573 -- Upgrade strategy
23574 --
23575 l_actual_upg_option VARCHAR2(1);
23576 l_enc_upg_option VARCHAR2(1);
23577
23578 --
23579 BEGIN
23580 --
23581 IF g_log_enabled THEN
23582 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_197';
23583 END IF;
23584 --
23585 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
23586
23587 trace
23588 (p_msg => 'BEGIN of AcctLineType_197'
23589 ,p_level => C_LEVEL_PROCEDURE
23590 ,p_module => l_log_module);
23591
23592 END IF;
23593 --
23594 l_component_type := 'AMB_JLT';
23595 l_component_code := 'FA_ADD_EXP';
23596 l_component_type_code := 'S';
23597 l_component_appl_id := 140;
23598 l_amb_context_code := 'DEFAULT';
23599 l_entity_code := 'TRANSACTIONS';
23600 l_event_class_code := 'ADDITIONS';
23601 l_event_type_code := 'ADDITIONS_ALL';
23602 l_line_definition_owner_code := 'S';
23603 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADDITI1';
23604 --
23605 l_balance_type_code := 'A';
23606 l_segment := NULL;
23607 l_ccid := NULL;
23608 l_adr_transaction_coa_id := NULL;
23609 l_adr_accounting_coa_id := NULL;
23610 l_adr_flexfield_segment_code := NULL;
23611 l_adr_flex_value_set_id := NULL;
23612 l_adr_value_type_code := NULL;
23613 l_adr_value_combination_id := NULL;
23614 l_adr_value_segment_code := NULL;
23615
23616 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
23617 l_bflow_class_code := ''; -- 4219869 Business Flow
23621 l_bflow_applied_to_amt_idx := NULL; -- 5132302
23618 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
23619 l_budgetary_control_flag := 'N';
23620
23622 l_bflow_applied_to_amt := NULL; -- 5132302
23623 l_entered_amt_idx := NULL; -- 4262811
23624 l_accted_amt_idx := NULL; -- 4262811
23625 l_acc_rev_flag := NULL; -- 4262811
23626 l_accrual_line_num := NULL; -- 4262811
23627 l_tmp_amt := NULL; -- 4262811
23628 --
23629
23630 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
23631 l_balance_type_code <> 'B' THEN
23632 IF NVL(p_source_48,'
23633 ') = 'EXPENSE'
23634 THEN
23635
23636 --
23637 XLA_AE_LINES_PKG.SetNewLine;
23638
23639 p_balance_type_code := l_balance_type_code;
23640 -- set the flag so later we will know whether the gain loss line needs to be created
23641
23642 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
23643 p_actual_flag :='A';
23644 END IF;
23645
23646 --
23647 -- bulk performance
23648 --
23649 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
23650 p_header_num => 0); -- 4262811
23651 --
23652 -- set accounting line options
23653 --
23654 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
23655 p_natural_side_code => 'D'
23656 , p_gain_or_loss_flag => 'N'
23657 , p_gl_transfer_mode_code => 'S'
23658 , p_acct_entry_type_code => 'A'
23659 , p_switch_side_flag => 'Y'
23660 , p_merge_duplicate_code => 'N'
23661 );
23662 --
23663 l_acc_rev_natural_side_code := 'C'; -- 4262811
23664 --
23665 --
23666 -- set accounting line type info
23667 --
23668 xla_ae_lines_pkg.SetAcctLineType
23669 (p_component_type => l_component_type
23670 ,p_event_type_code => l_event_type_code
23671 ,p_line_definition_owner_code => l_line_definition_owner_code
23672 ,p_line_definition_code => l_line_definition_code
23673 ,p_accounting_line_code => l_component_code
23674 ,p_accounting_line_type_code => l_component_type_code
23675 ,p_accounting_line_appl_id => l_component_appl_id
23676 ,p_amb_context_code => l_amb_context_code
23677 ,p_entity_code => l_entity_code
23678 ,p_event_class_code => l_event_class_code);
23679 --
23680 -- set accounting class
23681 --
23682 xla_ae_lines_pkg.SetAcctClass(
23683 p_accounting_class_code => 'EXPENSE'
23684 , p_ae_header_id => l_ae_header_id
23685 );
23686
23687 --
23688 -- set rounding class
23689 --
23690 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
23691 'EXPENSE';
23692
23693 --
23694 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
23695 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
23696 --
23697 -- bulk performance
23698 --
23699 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
23700
23701 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
23702 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
23703
23704 -- 4955764
23705 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
23706 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
23707
23708 -- 4458381 Public Sector Enh
23709
23710 --
23711 -- set accounting attributes for the line type
23712 --
23713 l_entered_amt_idx := 4;
23714 l_accted_amt_idx := 6;
23715 l_bflow_applied_to_amt_idx := NULL; -- 5132302
23716 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
23717 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
23718 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
23719 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
23720 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
23721 l_rec_acct_attrs.array_char_value(3) := p_source_51;
23722 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
23723 l_rec_acct_attrs.array_num_value(4) := p_source_52;
23724 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
23725 l_rec_acct_attrs.array_char_value(5) := p_source_53;
23726 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
23727 l_rec_acct_attrs.array_num_value(6) := p_source_52;
23728
23729 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
23730 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
23731
23732 ---------------------------------------------------------------------------------------------------------------
23733 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
23737 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
23734 ---------------------------------------------------------------------------------------------------------------
23735 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
23736
23738 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
23739
23740 IF xla_accounting_cache_pkg.GetValueChar
23741 (p_source_code => 'LEDGER_CATEGORY_CODE'
23742 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
23743 AND l_bflow_method_code = 'PRIOR_ENTRY'
23744 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
23745 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
23746 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
23747 )
23748 THEN
23749 xla_ae_lines_pkg.BflowUpgEntry
23750 (p_business_method_code => l_bflow_method_code
23751 ,p_business_class_code => l_bflow_class_code
23752 ,p_balance_type => l_balance_type_code);
23753 ELSE
23754 NULL;
23755 -- No business flow processing for business flow method of NONE.
23756 END IF;
23757
23758 --
23759 -- call analytical criteria
23760 --
23761
23762 --
23763 -- call description
23764 --
23765
23766 xla_ae_lines_pkg.SetLineDescription(
23767 p_ae_header_id => l_ae_header_id
23768 ,p_description => Description_6 (
23769 p_application_id => p_application_id
23770 , p_ae_header_id => l_ae_header_id
23771 , p_source_1 => p_source_1
23772 )
23773 );
23774
23775
23776 --
23777 -- call ADRs
23778 -- Bug 4922099
23779 --
23780 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
23781 (NVL(l_actual_upg_option, 'N') = 'O') OR
23782 (NVL(l_enc_upg_option, 'N') = 'O')
23783 )
23784 THEN
23785 NULL;
23786 --
23787 --
23788
23789 l_ccid := AcctDerRule_176(
23790 p_application_id => p_application_id
23791 , p_ae_header_id => l_ae_header_id
23792 , p_source_5 => p_source_5
23793 , p_source_31 => p_source_31
23794 , x_transaction_coa_id => l_adr_transaction_coa_id
23795 , x_accounting_coa_id => l_adr_accounting_coa_id
23796 , x_value_type_code => l_adr_value_type_code
23797 , p_side => 'NA'
23798 );
23799
23800 xla_ae_lines_pkg.set_ccid(
23801 p_code_combination_id => l_ccid
23802 , p_value_type_code => l_adr_value_type_code
23803 , p_transaction_coa_id => l_adr_transaction_coa_id
23804 , p_accounting_coa_id => l_adr_accounting_coa_id
23805 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
23806 , p_adr_type_code => 'S'
23807 , p_component_type => l_component_type
23808 , p_component_code => l_component_code
23809 , p_component_type_code => l_component_type_code
23810 , p_component_appl_id => l_component_appl_id
23811 , p_amb_context_code => l_amb_context_code
23812 , p_side => 'NA'
23813 );
23814
23815
23816 --
23817 --
23818 END IF;
23819 --
23820 -- Bug 4922099
23821 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
23822 (NVL(l_enc_upg_option, 'N') = 'O')
23823 ) AND
23824 (l_bflow_method_code = 'PRIOR_ENTRY')
23825 )
23826 THEN
23827 IF
23828 --
23829 1 = 2
23830 --
23831 THEN
23832 xla_accounting_err_pkg.build_message
23833 (p_appli_s_name => 'XLA'
23834 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
23835 ,p_token_1 => 'LINE_NUMBER'
23836 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
23837 ,p_token_2 => 'LINE_TYPE_NAME'
23838 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
23839 l_component_type
23840 ,l_component_code
23841 ,l_component_type_code
23842 ,l_component_appl_id
23843 ,l_amb_context_code
23844 ,l_entity_code
23845 ,l_event_class_code
23846 )
23847 ,p_token_3 => 'OWNER'
23848 ,p_value_3 => xla_lookups_pkg.get_meaning(
23849 p_lookup_type => 'XLA_OWNER_TYPE'
23853 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
23850 ,p_lookup_code => l_component_type_code
23851 )
23852 ,p_token_4 => 'PRODUCT_NAME'
23854 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
23855 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
23856 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
23857 ,p_ae_header_id => NULL
23858 );
23859
23860 IF (C_LEVEL_ERROR>= g_log_level) THEN
23861 trace
23862 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
23863 ,p_level => C_LEVEL_ERROR
23864 ,p_module => l_log_module);
23865 END IF;
23866 END IF;
23867 END IF;
23868 --
23869 --
23870 ------------------------------------------------------------------------------------------------
23871 -- 4219869 Business Flow
23872 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
23873 -- Prior Entry. Currently, the following code is always generated.
23874 ------------------------------------------------------------------------------------------------
23875 XLA_AE_LINES_PKG.ValidateCurrentLine;
23876
23877 ------------------------------------------------------------------------------------
23878 -- 4219869 Business Flow
23879 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
23880 ------------------------------------------------------------------------------------
23881 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
23882
23883 ----------------------------------------------------------------------------------
23884 -- 4219869 Business Flow
23885 -- Update journal entry status -- Need to generate this within IF <condition>
23886 ----------------------------------------------------------------------------------
23887 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
23888 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
23889 ,p_balance_type_code => l_balance_type_code
23890 );
23891
23892 -------------------------------------------------------------------------------------------
23893 -- 4262811 - Generate the Accrual Reversal lines
23894 -------------------------------------------------------------------------------------------
23895 BEGIN
23896 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
23897 (g_array_event(p_event_id).array_value_num('header_index'));
23898 IF l_acc_rev_flag IS NULL THEN
23899 l_acc_rev_flag := 'N';
23900 END IF;
23901 EXCEPTION
23902 WHEN OTHERS THEN
23903 l_acc_rev_flag := 'N';
23904 END;
23905 --
23906 IF (l_acc_rev_flag = 'Y') THEN
23907
23908 -- 4645092 ------------------------------------------------------------------------------
23909 -- To allow MPA report to determine if it should generate report process
23910 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
23911 ------------------------------------------------------------------------------------------
23912
23913 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
23914 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
23915 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
23916 -- call ADRs
23917 -- Bug 4922099
23918 --
23919 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
23920 (NVL(l_actual_upg_option, 'N') = 'O') OR
23921 (NVL(l_enc_upg_option, 'N') = 'O')
23922 )
23923 THEN
23924 NULL;
23925 --
23926 --
23927
23928 l_ccid := AcctDerRule_176(
23929 p_application_id => p_application_id
23930 , p_ae_header_id => l_ae_header_id
23931 , p_source_5 => p_source_5
23932 , p_source_31 => p_source_31
23933 , x_transaction_coa_id => l_adr_transaction_coa_id
23934 , x_accounting_coa_id => l_adr_accounting_coa_id
23935 , x_value_type_code => l_adr_value_type_code
23936 , p_side => 'NA'
23937 );
23938
23939 xla_ae_lines_pkg.set_ccid(
23940 p_code_combination_id => l_ccid
23941 , p_value_type_code => l_adr_value_type_code
23942 , p_transaction_coa_id => l_adr_transaction_coa_id
23943 , p_accounting_coa_id => l_adr_accounting_coa_id
23944 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
23945 , p_adr_type_code => 'S'
23946 , p_component_type => l_component_type
23947 , p_component_code => l_component_code
23948 , p_component_type_code => l_component_type_code
23949 , p_component_appl_id => l_component_appl_id
23950 , p_amb_context_code => l_amb_context_code
23951 , p_side => 'NA'
23952 );
23953
23957 END IF;
23954
23955 --
23956 --
23958
23959 --
23960 -- Update the line information that should be overwritten
23961 --
23962 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
23963 p_header_num => 1);
23964 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
23965
23966 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
23967
23968 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
23969 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
23970 END IF;
23971
23972 --
23973 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
23974 --
23975 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
23976 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
23977 ELSE
23978 ---------------------------------------------------------------------------------------------------
23979 -- 4262811a Switch Sign
23980 ---------------------------------------------------------------------------------------------------
23981 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
23982 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
23983 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
23984 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
23985 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
23986 -- 5132302
23987 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
23988 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
23989
23990 END IF;
23991
23992 -- 4955764
23993 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
23994 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
23995
23996
23997 XLA_AE_LINES_PKG.ValidateCurrentLine;
23998 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
23999
24000 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
24001 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
24002 ,p_balance_type_code => l_balance_type_code);
24003
24004 END IF;
24005
24006 -----------------------------------------------------------------------------------------
24007 -- 4262811 Multiperiod Accounting
24008 -----------------------------------------------------------------------------------------
24009 -- No MPA option is assigned.
24010
24011
24012 END IF;
24013 END IF;
24014 --
24015
24016 --
24017 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
24018 trace
24019 (p_msg => 'END of AcctLineType_197'
24020 ,p_level => C_LEVEL_PROCEDURE
24021 ,p_module => l_log_module);
24022 END IF;
24023 --
24024 EXCEPTION
24025 WHEN xla_exceptions_pkg.application_exception THEN
24026 RAISE;
24027 WHEN OTHERS THEN
24028 xla_exceptions_pkg.raise_message
24029 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_197');
24030 END AcctLineType_197;
24031 --
24032
24033 ---------------------------------------
24034 --
24035 -- PRIVATE FUNCTION
24036 -- AcctLineType_198
24037 --
24038 ---------------------------------------
24039 PROCEDURE AcctLineType_198 (
24040 p_application_id IN NUMBER
24041 ,p_event_id IN NUMBER
24042 ,p_calculate_acctd_flag IN VARCHAR2
24043 ,p_calculate_g_l_flag IN VARCHAR2
24044 ,p_actual_flag IN OUT VARCHAR2
24045 ,p_balance_type_code OUT VARCHAR2
24046 ,p_gain_or_loss_ref OUT VARCHAR2
24047
24048 --Period Close Date
24049 , p_source_1 IN DATE
24050 --Generated Code Combination Identifier
24051 , p_source_5 IN NUMBER
24052 --Expense Account Code Combination Identifier
24053 , p_source_31 IN NUMBER
24054 --Adjustment Type
24055 , p_source_48 IN VARCHAR2
24056 --Transaction Header Identifier
24057 , p_source_49 IN NUMBER
24058 --Adjustment Line Identifier
24059 , p_source_50 IN NUMBER
24060 --Distribution Type Code
24061 , p_source_51 IN VARCHAR2
24062 --Entered Amount
24063 , p_source_52 IN NUMBER
24064 --Currency Code
24065 , p_source_53 IN VARCHAR2
24066 )
24067 IS
24068
24069 l_component_type VARCHAR2(80);
24070 l_component_code VARCHAR2(30);
24071 l_component_type_code VARCHAR2(1);
24072 l_component_appl_id INTEGER;
24073 l_amb_context_code VARCHAR2(30);
24074 l_entity_code VARCHAR2(30);
24075 l_event_class_code VARCHAR2(30);
24076 l_ae_header_id NUMBER;
24077 l_event_type_code VARCHAR2(30);
24078 l_line_definition_code VARCHAR2(30);
24079 l_line_definition_owner_code VARCHAR2(1);
24080 --
24081 -- adr variables
24082 l_segment VARCHAR2(30);
24086 l_adr_flexfield_segment_code VARCHAR2(30);
24083 l_ccid NUMBER;
24084 l_adr_transaction_coa_id NUMBER;
24085 l_adr_accounting_coa_id NUMBER;
24087 l_adr_flex_value_set_id NUMBER;
24088 l_adr_value_type_code VARCHAR2(30);
24089 l_adr_value_combination_id NUMBER;
24090 l_adr_value_segment_code VARCHAR2(30);
24091
24092 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
24093 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
24094 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
24095 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
24096
24097 -- 4262811 Variables ------------------------------------------------------------------------------------------
24098 l_entered_amt_idx NUMBER;
24099 l_accted_amt_idx NUMBER;
24100 l_acc_rev_flag VARCHAR2(1);
24101 l_accrual_line_num NUMBER;
24102 l_tmp_amt NUMBER;
24103 l_acc_rev_natural_side_code VARCHAR2(1);
24104
24105 l_num_entries NUMBER;
24106 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
24107 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
24108 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
24109 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
24110 l_recog_line_1 NUMBER;
24111 l_recog_line_2 NUMBER;
24112
24113 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
24114 l_bflow_applied_to_amt NUMBER; -- 5132302
24115 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
24116
24117 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
24118
24119 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
24120 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
24121
24122 ---------------------------------------------------------------------------------------------------------------
24123
24124
24125 --
24126 -- bulk performance
24127 --
24128 l_balance_type_code VARCHAR2(1);
24129 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
24130 l_log_module VARCHAR2(240);
24131
24132 --
24133 -- Upgrade strategy
24134 --
24135 l_actual_upg_option VARCHAR2(1);
24136 l_enc_upg_option VARCHAR2(1);
24137
24138 --
24139 BEGIN
24140 --
24141 IF g_log_enabled THEN
24142 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_198';
24143 END IF;
24144 --
24145 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
24146
24147 trace
24148 (p_msg => 'BEGIN of AcctLineType_198'
24149 ,p_level => C_LEVEL_PROCEDURE
24150 ,p_module => l_log_module);
24151
24152 END IF;
24153 --
24154 l_component_type := 'AMB_JLT';
24155 l_component_code := 'FA_ADD_EXP_BAL';
24156 l_component_type_code := 'S';
24157 l_component_appl_id := 140;
24158 l_amb_context_code := 'DEFAULT';
24159 l_entity_code := 'TRANSACTIONS';
24160 l_event_class_code := 'ADDITIONS';
24161 l_event_type_code := 'ADDITIONS_ALL';
24162 l_line_definition_owner_code := 'S';
24163 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADDITI1';
24164 --
24165 l_balance_type_code := 'A';
24166 l_segment := NULL;
24167 l_ccid := NULL;
24168 l_adr_transaction_coa_id := NULL;
24169 l_adr_accounting_coa_id := NULL;
24170 l_adr_flexfield_segment_code := NULL;
24171 l_adr_flex_value_set_id := NULL;
24172 l_adr_value_type_code := NULL;
24173 l_adr_value_combination_id := NULL;
24174 l_adr_value_segment_code := NULL;
24175
24176 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
24177 l_bflow_class_code := ''; -- 4219869 Business Flow
24178 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
24179 l_budgetary_control_flag := 'N';
24180
24181 l_bflow_applied_to_amt_idx := NULL; -- 5132302
24182 l_bflow_applied_to_amt := NULL; -- 5132302
24183 l_entered_amt_idx := NULL; -- 4262811
24184 l_accted_amt_idx := NULL; -- 4262811
24185 l_acc_rev_flag := NULL; -- 4262811
24186 l_accrual_line_num := NULL; -- 4262811
24187 l_tmp_amt := NULL; -- 4262811
24188 --
24189
24190 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
24191 l_balance_type_code <> 'B' THEN
24192 IF NVL(p_source_48,'
24193 ') = 'BONUS EXPENSE'
24194 THEN
24195
24196 --
24197 XLA_AE_LINES_PKG.SetNewLine;
24198
24199 p_balance_type_code := l_balance_type_code;
24200 -- set the flag so later we will know whether the gain loss line needs to be created
24201
24202 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
24203 p_actual_flag :='A';
24204 END IF;
24205
24206 --
24207 -- bulk performance
24208 --
24209 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
24213 --
24210 p_header_num => 0); -- 4262811
24211 --
24212 -- set accounting line options
24214 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
24215 p_natural_side_code => 'C'
24216 , p_gain_or_loss_flag => 'N'
24217 , p_gl_transfer_mode_code => 'S'
24218 , p_acct_entry_type_code => 'A'
24219 , p_switch_side_flag => 'Y'
24220 , p_merge_duplicate_code => 'N'
24221 );
24222 --
24223 l_acc_rev_natural_side_code := 'D'; -- 4262811
24224 --
24225 --
24226 -- set accounting line type info
24227 --
24228 xla_ae_lines_pkg.SetAcctLineType
24229 (p_component_type => l_component_type
24230 ,p_event_type_code => l_event_type_code
24231 ,p_line_definition_owner_code => l_line_definition_owner_code
24232 ,p_line_definition_code => l_line_definition_code
24233 ,p_accounting_line_code => l_component_code
24234 ,p_accounting_line_type_code => l_component_type_code
24235 ,p_accounting_line_appl_id => l_component_appl_id
24236 ,p_amb_context_code => l_amb_context_code
24237 ,p_entity_code => l_entity_code
24238 ,p_event_class_code => l_event_class_code);
24239 --
24240 -- set accounting class
24241 --
24242 xla_ae_lines_pkg.SetAcctClass(
24243 p_accounting_class_code => 'EXPENSE'
24244 , p_ae_header_id => l_ae_header_id
24245 );
24246
24247 --
24248 -- set rounding class
24249 --
24250 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
24251 'EXPENSE';
24252
24253 --
24254 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
24255 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
24256 --
24257 -- bulk performance
24258 --
24259 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
24260
24261 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
24262 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
24263
24264 -- 4955764
24265 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
24266 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
24267
24268 -- 4458381 Public Sector Enh
24269
24270 --
24271 -- set accounting attributes for the line type
24272 --
24273 l_entered_amt_idx := 4;
24274 l_accted_amt_idx := 6;
24275 l_bflow_applied_to_amt_idx := NULL; -- 5132302
24276 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
24277 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
24278 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
24279 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
24280 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
24281 l_rec_acct_attrs.array_char_value(3) := p_source_51;
24282 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
24283 l_rec_acct_attrs.array_num_value(4) := p_source_52;
24284 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
24285 l_rec_acct_attrs.array_char_value(5) := p_source_53;
24286 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
24287 l_rec_acct_attrs.array_num_value(6) := p_source_52;
24288
24289 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
24290 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
24291
24292 ---------------------------------------------------------------------------------------------------------------
24293 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
24294 ---------------------------------------------------------------------------------------------------------------
24295 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
24296
24297 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
24298 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
24299
24300 IF xla_accounting_cache_pkg.GetValueChar
24301 (p_source_code => 'LEDGER_CATEGORY_CODE'
24302 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
24303 AND l_bflow_method_code = 'PRIOR_ENTRY'
24304 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
24305 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
24306 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
24307 )
24308 THEN
24309 xla_ae_lines_pkg.BflowUpgEntry
24310 (p_business_method_code => l_bflow_method_code
24311 ,p_business_class_code => l_bflow_class_code
24312 ,p_balance_type => l_balance_type_code);
24313 ELSE
24314 NULL;
24315 -- No business flow processing for business flow method of NONE.
24316 END IF;
24317
24318 --
24319 -- call analytical criteria
24323 -- call description
24320 --
24321
24322 --
24324 --
24325
24326 xla_ae_lines_pkg.SetLineDescription(
24327 p_ae_header_id => l_ae_header_id
24328 ,p_description => Description_6 (
24329 p_application_id => p_application_id
24330 , p_ae_header_id => l_ae_header_id
24331 , p_source_1 => p_source_1
24332 )
24333 );
24334
24335
24336 --
24337 -- call ADRs
24338 -- Bug 4922099
24339 --
24340 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
24341 (NVL(l_actual_upg_option, 'N') = 'O') OR
24342 (NVL(l_enc_upg_option, 'N') = 'O')
24343 )
24344 THEN
24345 NULL;
24346 --
24347 --
24348
24349 l_ccid := AcctDerRule_176(
24350 p_application_id => p_application_id
24351 , p_ae_header_id => l_ae_header_id
24352 , p_source_5 => p_source_5
24353 , p_source_31 => p_source_31
24354 , x_transaction_coa_id => l_adr_transaction_coa_id
24355 , x_accounting_coa_id => l_adr_accounting_coa_id
24356 , x_value_type_code => l_adr_value_type_code
24357 , p_side => 'NA'
24358 );
24359
24360 xla_ae_lines_pkg.set_ccid(
24361 p_code_combination_id => l_ccid
24362 , p_value_type_code => l_adr_value_type_code
24363 , p_transaction_coa_id => l_adr_transaction_coa_id
24364 , p_accounting_coa_id => l_adr_accounting_coa_id
24365 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
24366 , p_adr_type_code => 'S'
24367 , p_component_type => l_component_type
24368 , p_component_code => l_component_code
24369 , p_component_type_code => l_component_type_code
24370 , p_component_appl_id => l_component_appl_id
24371 , p_amb_context_code => l_amb_context_code
24372 , p_side => 'NA'
24373 );
24374
24375
24376 --
24377 --
24378 END IF;
24379 --
24380 -- Bug 4922099
24381 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
24382 (NVL(l_enc_upg_option, 'N') = 'O')
24383 ) AND
24384 (l_bflow_method_code = 'PRIOR_ENTRY')
24385 )
24386 THEN
24387 IF
24388 --
24389 1 = 2
24390 --
24391 THEN
24392 xla_accounting_err_pkg.build_message
24393 (p_appli_s_name => 'XLA'
24394 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
24395 ,p_token_1 => 'LINE_NUMBER'
24396 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
24397 ,p_token_2 => 'LINE_TYPE_NAME'
24398 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
24399 l_component_type
24400 ,l_component_code
24401 ,l_component_type_code
24402 ,l_component_appl_id
24403 ,l_amb_context_code
24404 ,l_entity_code
24405 ,l_event_class_code
24406 )
24407 ,p_token_3 => 'OWNER'
24408 ,p_value_3 => xla_lookups_pkg.get_meaning(
24409 p_lookup_type => 'XLA_OWNER_TYPE'
24410 ,p_lookup_code => l_component_type_code
24411 )
24412 ,p_token_4 => 'PRODUCT_NAME'
24413 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
24414 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
24415 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
24416 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
24417 ,p_ae_header_id => NULL
24418 );
24419
24420 IF (C_LEVEL_ERROR>= g_log_level) THEN
24421 trace
24422 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
24423 ,p_level => C_LEVEL_ERROR
24424 ,p_module => l_log_module);
24425 END IF;
24426 END IF;
24427 END IF;
24428 --
24429 --
24430 ------------------------------------------------------------------------------------------------
24434 ------------------------------------------------------------------------------------------------
24431 -- 4219869 Business Flow
24432 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
24433 -- Prior Entry. Currently, the following code is always generated.
24435 XLA_AE_LINES_PKG.ValidateCurrentLine;
24436
24437 ------------------------------------------------------------------------------------
24438 -- 4219869 Business Flow
24439 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
24440 ------------------------------------------------------------------------------------
24441 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
24442
24443 ----------------------------------------------------------------------------------
24444 -- 4219869 Business Flow
24445 -- Update journal entry status -- Need to generate this within IF <condition>
24446 ----------------------------------------------------------------------------------
24447 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
24448 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
24449 ,p_balance_type_code => l_balance_type_code
24450 );
24451
24452 -------------------------------------------------------------------------------------------
24453 -- 4262811 - Generate the Accrual Reversal lines
24454 -------------------------------------------------------------------------------------------
24455 BEGIN
24456 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
24457 (g_array_event(p_event_id).array_value_num('header_index'));
24458 IF l_acc_rev_flag IS NULL THEN
24459 l_acc_rev_flag := 'N';
24460 END IF;
24461 EXCEPTION
24462 WHEN OTHERS THEN
24463 l_acc_rev_flag := 'N';
24464 END;
24465 --
24466 IF (l_acc_rev_flag = 'Y') THEN
24467
24468 -- 4645092 ------------------------------------------------------------------------------
24469 -- To allow MPA report to determine if it should generate report process
24470 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
24471 ------------------------------------------------------------------------------------------
24472
24473 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
24474 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
24475 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
24476 -- call ADRs
24477 -- Bug 4922099
24478 --
24479 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
24480 (NVL(l_actual_upg_option, 'N') = 'O') OR
24481 (NVL(l_enc_upg_option, 'N') = 'O')
24482 )
24483 THEN
24484 NULL;
24485 --
24486 --
24487
24488 l_ccid := AcctDerRule_176(
24489 p_application_id => p_application_id
24490 , p_ae_header_id => l_ae_header_id
24491 , p_source_5 => p_source_5
24492 , p_source_31 => p_source_31
24493 , x_transaction_coa_id => l_adr_transaction_coa_id
24494 , x_accounting_coa_id => l_adr_accounting_coa_id
24495 , x_value_type_code => l_adr_value_type_code
24496 , p_side => 'NA'
24497 );
24498
24499 xla_ae_lines_pkg.set_ccid(
24500 p_code_combination_id => l_ccid
24501 , p_value_type_code => l_adr_value_type_code
24502 , p_transaction_coa_id => l_adr_transaction_coa_id
24503 , p_accounting_coa_id => l_adr_accounting_coa_id
24504 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
24505 , p_adr_type_code => 'S'
24506 , p_component_type => l_component_type
24507 , p_component_code => l_component_code
24508 , p_component_type_code => l_component_type_code
24509 , p_component_appl_id => l_component_appl_id
24510 , p_amb_context_code => l_amb_context_code
24511 , p_side => 'NA'
24512 );
24513
24514
24515 --
24516 --
24517 END IF;
24518
24519 --
24520 -- Update the line information that should be overwritten
24521 --
24522 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
24523 p_header_num => 1);
24524 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
24525
24526 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
24527
24528 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
24529 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
24530 END IF;
24531
24532 --
24533 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
24534 --
24535 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
24536 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
24537 ELSE
24538 ---------------------------------------------------------------------------------------------------
24539 -- 4262811a Switch Sign
24540 ---------------------------------------------------------------------------------------------------
24544 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
24541 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
24542 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
24543 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
24545 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
24546 -- 5132302
24547 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
24548 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
24549
24550 END IF;
24551
24552 -- 4955764
24553 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
24554 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
24555
24556
24557 XLA_AE_LINES_PKG.ValidateCurrentLine;
24558 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
24559
24560 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
24561 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
24562 ,p_balance_type_code => l_balance_type_code);
24563
24564 END IF;
24565
24566 -----------------------------------------------------------------------------------------
24567 -- 4262811 Multiperiod Accounting
24568 -----------------------------------------------------------------------------------------
24569 -- No MPA option is assigned.
24570
24571
24572 END IF;
24573 END IF;
24574 --
24575
24576 --
24577 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
24578 trace
24579 (p_msg => 'END of AcctLineType_198'
24580 ,p_level => C_LEVEL_PROCEDURE
24581 ,p_module => l_log_module);
24582 END IF;
24583 --
24584 EXCEPTION
24585 WHEN xla_exceptions_pkg.application_exception THEN
24586 RAISE;
24587 WHEN OTHERS THEN
24588 xla_exceptions_pkg.raise_message
24589 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_198');
24590 END AcctLineType_198;
24591 --
24592
24593 ---------------------------------------
24594 --
24595 -- PRIVATE FUNCTION
24596 -- AcctLineType_199
24597 --
24598 ---------------------------------------
24599 PROCEDURE AcctLineType_199 (
24600 p_application_id IN NUMBER
24601 ,p_event_id IN NUMBER
24602 ,p_calculate_acctd_flag IN VARCHAR2
24603 ,p_calculate_g_l_flag IN VARCHAR2
24604 ,p_actual_flag IN OUT VARCHAR2
24605 ,p_balance_type_code OUT VARCHAR2
24606 ,p_gain_or_loss_ref OUT VARCHAR2
24607
24608 --Period Close Date
24609 , p_source_1 IN DATE
24610 --Generated Code Combination Identifier
24611 , p_source_5 IN NUMBER
24612 --Depreciation Reserve Account
24613 , p_source_12 IN VARCHAR2
24614 --Generated Offset Code Combination Identifier
24615 , p_source_19 IN NUMBER
24616 --Expense Account Code Combination Identifier
24617 , p_source_31 IN NUMBER
24618 --Default Code Combination Identifier
24619 , p_source_32 IN NUMBER
24620 --Adjustment Type
24621 , p_source_48 IN VARCHAR2
24622 --Transaction Header Identifier
24623 , p_source_49 IN NUMBER
24624 --Adjustment Line Identifier
24625 , p_source_50 IN NUMBER
24626 --Distribution Type Code
24627 , p_source_51 IN VARCHAR2
24628 --Entered Amount
24629 , p_source_52 IN NUMBER
24630 --Currency Code
24631 , p_source_53 IN VARCHAR2
24632 )
24633 IS
24634
24635 l_component_type VARCHAR2(80);
24636 l_component_code VARCHAR2(30);
24637 l_component_type_code VARCHAR2(1);
24638 l_component_appl_id INTEGER;
24639 l_amb_context_code VARCHAR2(30);
24640 l_entity_code VARCHAR2(30);
24641 l_event_class_code VARCHAR2(30);
24642 l_ae_header_id NUMBER;
24643 l_event_type_code VARCHAR2(30);
24644 l_line_definition_code VARCHAR2(30);
24645 l_line_definition_owner_code VARCHAR2(1);
24646 --
24647 -- adr variables
24648 l_segment VARCHAR2(30);
24649 l_ccid NUMBER;
24650 l_adr_transaction_coa_id NUMBER;
24651 l_adr_accounting_coa_id NUMBER;
24652 l_adr_flexfield_segment_code VARCHAR2(30);
24653 l_adr_flex_value_set_id NUMBER;
24654 l_adr_value_type_code VARCHAR2(30);
24655 l_adr_value_combination_id NUMBER;
24656 l_adr_value_segment_code VARCHAR2(30);
24657
24658 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
24659 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
24660 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
24661 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
24662
24663 -- 4262811 Variables ------------------------------------------------------------------------------------------
24664 l_entered_amt_idx NUMBER;
24665 l_accted_amt_idx NUMBER;
24666 l_acc_rev_flag VARCHAR2(1);
24667 l_accrual_line_num NUMBER;
24668 l_tmp_amt NUMBER;
24672 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
24669 l_acc_rev_natural_side_code VARCHAR2(1);
24670
24671 l_num_entries NUMBER;
24673 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
24674 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
24675 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
24676 l_recog_line_1 NUMBER;
24677 l_recog_line_2 NUMBER;
24678
24679 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
24680 l_bflow_applied_to_amt NUMBER; -- 5132302
24681 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
24682
24683 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
24684
24685 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
24686 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
24687
24688 ---------------------------------------------------------------------------------------------------------------
24689
24690
24691 --
24692 -- bulk performance
24693 --
24694 l_balance_type_code VARCHAR2(1);
24695 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
24696 l_log_module VARCHAR2(240);
24697
24698 --
24699 -- Upgrade strategy
24700 --
24701 l_actual_upg_option VARCHAR2(1);
24702 l_enc_upg_option VARCHAR2(1);
24703
24704 --
24705 BEGIN
24706 --
24707 IF g_log_enabled THEN
24708 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_199';
24709 END IF;
24710 --
24711 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
24712
24713 trace
24714 (p_msg => 'BEGIN of AcctLineType_199'
24715 ,p_level => C_LEVEL_PROCEDURE
24716 ,p_module => l_log_module);
24717
24718 END IF;
24719 --
24720 l_component_type := 'AMB_JLT';
24721 l_component_code := 'FA_ADD_RESERVE';
24722 l_component_type_code := 'S';
24723 l_component_appl_id := 140;
24724 l_amb_context_code := 'DEFAULT';
24725 l_entity_code := 'TRANSACTIONS';
24726 l_event_class_code := 'ADDITIONS';
24727 l_event_type_code := 'ADDITIONS_ALL';
24728 l_line_definition_owner_code := 'S';
24729 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADDITI1';
24730 --
24731 l_balance_type_code := 'A';
24732 l_segment := NULL;
24733 l_ccid := NULL;
24734 l_adr_transaction_coa_id := NULL;
24735 l_adr_accounting_coa_id := NULL;
24736 l_adr_flexfield_segment_code := NULL;
24737 l_adr_flex_value_set_id := NULL;
24738 l_adr_value_type_code := NULL;
24739 l_adr_value_combination_id := NULL;
24740 l_adr_value_segment_code := NULL;
24741
24742 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
24743 l_bflow_class_code := ''; -- 4219869 Business Flow
24744 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
24745 l_budgetary_control_flag := 'N';
24746
24747 l_bflow_applied_to_amt_idx := NULL; -- 5132302
24748 l_bflow_applied_to_amt := NULL; -- 5132302
24749 l_entered_amt_idx := NULL; -- 4262811
24750 l_accted_amt_idx := NULL; -- 4262811
24751 l_acc_rev_flag := NULL; -- 4262811
24752 l_accrual_line_num := NULL; -- 4262811
24753 l_tmp_amt := NULL; -- 4262811
24754 --
24755
24756 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
24757 l_balance_type_code <> 'B' THEN
24758 IF NVL(p_source_48,'
24759 ') = 'EXPENSE'
24760 THEN
24761
24762 --
24763 XLA_AE_LINES_PKG.SetNewLine;
24764
24765 p_balance_type_code := l_balance_type_code;
24766 -- set the flag so later we will know whether the gain loss line needs to be created
24767
24768 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
24769 p_actual_flag :='A';
24770 END IF;
24771
24772 --
24773 -- bulk performance
24774 --
24775 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
24776 p_header_num => 0); -- 4262811
24777 --
24778 -- set accounting line options
24779 --
24780 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
24781 p_natural_side_code => 'C'
24782 , p_gain_or_loss_flag => 'N'
24783 , p_gl_transfer_mode_code => 'S'
24784 , p_acct_entry_type_code => 'A'
24785 , p_switch_side_flag => 'Y'
24786 , p_merge_duplicate_code => 'N'
24787 );
24788 --
24789 l_acc_rev_natural_side_code := 'D'; -- 4262811
24790 --
24791 --
24792 -- set accounting line type info
24793 --
24794 xla_ae_lines_pkg.SetAcctLineType
24795 (p_component_type => l_component_type
24796 ,p_event_type_code => l_event_type_code
24797 ,p_line_definition_owner_code => l_line_definition_owner_code
24801 ,p_accounting_line_appl_id => l_component_appl_id
24798 ,p_line_definition_code => l_line_definition_code
24799 ,p_accounting_line_code => l_component_code
24800 ,p_accounting_line_type_code => l_component_type_code
24802 ,p_amb_context_code => l_amb_context_code
24803 ,p_entity_code => l_entity_code
24804 ,p_event_class_code => l_event_class_code);
24805 --
24806 -- set accounting class
24807 --
24808 xla_ae_lines_pkg.SetAcctClass(
24809 p_accounting_class_code => 'ASSET'
24810 , p_ae_header_id => l_ae_header_id
24811 );
24812
24813 --
24814 -- set rounding class
24815 --
24816 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
24817 'ASSET';
24818
24819 --
24820 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
24821 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
24822 --
24823 -- bulk performance
24824 --
24825 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
24826
24827 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
24828 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
24829
24830 -- 4955764
24831 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
24832 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
24833
24834 -- 4458381 Public Sector Enh
24835
24836 --
24837 -- set accounting attributes for the line type
24838 --
24839 l_entered_amt_idx := 4;
24840 l_accted_amt_idx := 6;
24841 l_bflow_applied_to_amt_idx := NULL; -- 5132302
24842 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
24843 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
24844 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
24845 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
24846 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
24847 l_rec_acct_attrs.array_char_value(3) := p_source_51;
24848 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
24849 l_rec_acct_attrs.array_num_value(4) := p_source_52;
24850 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
24851 l_rec_acct_attrs.array_char_value(5) := p_source_53;
24852 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
24853 l_rec_acct_attrs.array_num_value(6) := p_source_52;
24854
24855 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
24856 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
24857
24858 ---------------------------------------------------------------------------------------------------------------
24859 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
24860 ---------------------------------------------------------------------------------------------------------------
24861 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
24862
24863 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
24864 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
24865
24866 IF xla_accounting_cache_pkg.GetValueChar
24867 (p_source_code => 'LEDGER_CATEGORY_CODE'
24868 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
24869 AND l_bflow_method_code = 'PRIOR_ENTRY'
24870 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
24871 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
24872 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
24873 )
24874 THEN
24875 xla_ae_lines_pkg.BflowUpgEntry
24876 (p_business_method_code => l_bflow_method_code
24877 ,p_business_class_code => l_bflow_class_code
24878 ,p_balance_type => l_balance_type_code);
24879 ELSE
24880 NULL;
24881 -- No business flow processing for business flow method of NONE.
24882 END IF;
24883
24884 --
24885 -- call analytical criteria
24886 --
24887
24888 --
24889 -- call description
24890 --
24891
24892 xla_ae_lines_pkg.SetLineDescription(
24893 p_ae_header_id => l_ae_header_id
24894 ,p_description => Description_7 (
24895 p_application_id => p_application_id
24896 , p_ae_header_id => l_ae_header_id
24897 , p_source_1 => p_source_1
24898 )
24899 );
24900
24901
24902 --
24903 -- call ADRs
24904 -- Bug 4922099
24905 --
24906 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
24907 (NVL(l_actual_upg_option, 'N') = 'O') OR
24908 (NVL(l_enc_upg_option, 'N') = 'O')
24909 )
24910 THEN
24911 NULL;
24912 --
24913 --
24914
24915 l_ccid := AcctDerRule_175(
24916 p_application_id => p_application_id
24917 , p_ae_header_id => l_ae_header_id
24918 , p_source_5 => p_source_5
24919 , p_source_19 => p_source_19
24923 , x_value_type_code => l_adr_value_type_code
24920 , p_source_32 => p_source_32
24921 , x_transaction_coa_id => l_adr_transaction_coa_id
24922 , x_accounting_coa_id => l_adr_accounting_coa_id
24924 , p_side => 'NA'
24925 );
24926
24927 xla_ae_lines_pkg.set_ccid(
24928 p_code_combination_id => l_ccid
24929 , p_value_type_code => l_adr_value_type_code
24930 , p_transaction_coa_id => l_adr_transaction_coa_id
24931 , p_accounting_coa_id => l_adr_accounting_coa_id
24932 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
24933 , p_adr_type_code => 'S'
24934 , p_component_type => l_component_type
24935 , p_component_code => l_component_code
24936 , p_component_type_code => l_component_type_code
24937 , p_component_appl_id => l_component_appl_id
24938 , p_amb_context_code => l_amb_context_code
24939 , p_side => 'NA'
24940 );
24941
24942
24943 l_segment := AcctDerRule_150(
24944 p_application_id => p_application_id
24945 , p_ae_header_id => l_ae_header_id
24946 , p_source_5 => p_source_5
24947 , p_source_12 => p_source_12
24948 , x_transaction_coa_id => l_adr_transaction_coa_id
24949 , x_accounting_coa_id => l_adr_accounting_coa_id
24950 , x_flexfield_segment_code => l_adr_flexfield_segment_code
24951 , x_flex_value_set_id => l_adr_flex_value_set_id
24952 , x_value_type_code => l_adr_value_type_code
24953 , x_value_combination_id => l_adr_value_combination_id
24954 , x_value_segment_code => l_adr_value_segment_code
24955 , p_side => 'NA'
24956 , p_override_seg_flag => 'Y'
24957 );
24958
24959 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
24960
24961 xla_ae_lines_pkg.set_segment(
24962 p_to_segment_code => 'GL_ACCOUNT'
24963 , p_segment_value => l_segment
24964 , p_from_segment_code => l_adr_value_segment_code
24965 , p_from_combination_id => l_adr_value_combination_id
24966 , p_value_type_code => l_adr_value_type_code
24967 , p_transaction_coa_id => l_adr_transaction_coa_id
24968 , p_accounting_coa_id => l_adr_accounting_coa_id
24969 , p_flexfield_segment_code => l_adr_flexfield_segment_code
24970 , p_flex_value_set_id => l_adr_flex_value_set_id
24971 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
24972 , p_adr_type_code => 'S'
24973 , p_component_type => l_component_type
24974 , p_component_code => l_component_code
24975 , p_component_type_code => l_component_type_code
24976 , p_component_appl_id => l_component_appl_id
24977 , p_amb_context_code => l_amb_context_code
24978 , p_entity_code => 'TRANSACTIONS'
24979 , p_event_class_code => 'ADDITIONS'
24980 , p_side => 'NA'
24981 );
24982
24983 END IF;
24984
24985 l_segment := AcctDerRule_169(
24986 p_application_id => p_application_id
24987 , p_ae_header_id => l_ae_header_id
24988 , p_source_5 => p_source_5
24989 , p_source_31 => p_source_31
24990 , x_transaction_coa_id => l_adr_transaction_coa_id
24991 , x_accounting_coa_id => l_adr_accounting_coa_id
24992 , x_flexfield_segment_code => l_adr_flexfield_segment_code
24993 , x_flex_value_set_id => l_adr_flex_value_set_id
24994 , x_value_type_code => l_adr_value_type_code
24995 , x_value_combination_id => l_adr_value_combination_id
24996 , x_value_segment_code => l_adr_value_segment_code
24997 , p_side => 'NA'
24998 , p_override_seg_flag => 'Y'
24999 );
25000
25001 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
25002
25003 xla_ae_lines_pkg.set_segment(
25004 p_to_segment_code => 'GL_BALANCING'
25005 , p_segment_value => l_segment
25006 , p_from_segment_code => l_adr_value_segment_code
25007 , p_from_combination_id => l_adr_value_combination_id
25008 , p_value_type_code => l_adr_value_type_code
25009 , p_transaction_coa_id => l_adr_transaction_coa_id
25010 , p_accounting_coa_id => l_adr_accounting_coa_id
25011 , p_flexfield_segment_code => l_adr_flexfield_segment_code
25012 , p_flex_value_set_id => l_adr_flex_value_set_id
25013 , p_adr_code => 'FA_EXPENSE_ACCT'
25014 , p_adr_type_code => 'S'
25015 , p_component_type => l_component_type
25016 , p_component_code => l_component_code
25017 , p_component_type_code => l_component_type_code
25018 , p_component_appl_id => l_component_appl_id
25019 , p_amb_context_code => l_amb_context_code
25020 , p_entity_code => 'TRANSACTIONS'
25021 , p_event_class_code => 'ADDITIONS'
25022 , p_side => 'NA'
25023 );
25024
25025 END IF;
25026
25030 --
25027 --
25028 --
25029 END IF;
25031 -- Bug 4922099
25032 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
25033 (NVL(l_enc_upg_option, 'N') = 'O')
25034 ) AND
25035 (l_bflow_method_code = 'PRIOR_ENTRY')
25036 )
25037 THEN
25038 IF
25039 --
25040 1 = 2
25041 --
25042 THEN
25043 xla_accounting_err_pkg.build_message
25044 (p_appli_s_name => 'XLA'
25045 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
25046 ,p_token_1 => 'LINE_NUMBER'
25047 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
25048 ,p_token_2 => 'LINE_TYPE_NAME'
25049 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
25050 l_component_type
25051 ,l_component_code
25052 ,l_component_type_code
25053 ,l_component_appl_id
25054 ,l_amb_context_code
25055 ,l_entity_code
25056 ,l_event_class_code
25057 )
25058 ,p_token_3 => 'OWNER'
25059 ,p_value_3 => xla_lookups_pkg.get_meaning(
25060 p_lookup_type => 'XLA_OWNER_TYPE'
25061 ,p_lookup_code => l_component_type_code
25062 )
25063 ,p_token_4 => 'PRODUCT_NAME'
25064 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
25065 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
25066 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
25067 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
25068 ,p_ae_header_id => NULL
25069 );
25070
25071 IF (C_LEVEL_ERROR>= g_log_level) THEN
25072 trace
25073 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
25074 ,p_level => C_LEVEL_ERROR
25075 ,p_module => l_log_module);
25076 END IF;
25077 END IF;
25078 END IF;
25079 --
25080 --
25081 ------------------------------------------------------------------------------------------------
25082 -- 4219869 Business Flow
25083 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
25084 -- Prior Entry. Currently, the following code is always generated.
25085 ------------------------------------------------------------------------------------------------
25086 XLA_AE_LINES_PKG.ValidateCurrentLine;
25087
25088 ------------------------------------------------------------------------------------
25089 -- 4219869 Business Flow
25090 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
25091 ------------------------------------------------------------------------------------
25092 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
25093
25094 ----------------------------------------------------------------------------------
25095 -- 4219869 Business Flow
25096 -- Update journal entry status -- Need to generate this within IF <condition>
25097 ----------------------------------------------------------------------------------
25098 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
25099 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
25100 ,p_balance_type_code => l_balance_type_code
25101 );
25102
25103 -------------------------------------------------------------------------------------------
25104 -- 4262811 - Generate the Accrual Reversal lines
25105 -------------------------------------------------------------------------------------------
25106 BEGIN
25107 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
25108 (g_array_event(p_event_id).array_value_num('header_index'));
25109 IF l_acc_rev_flag IS NULL THEN
25110 l_acc_rev_flag := 'N';
25111 END IF;
25112 EXCEPTION
25113 WHEN OTHERS THEN
25114 l_acc_rev_flag := 'N';
25115 END;
25116 --
25117 IF (l_acc_rev_flag = 'Y') THEN
25118
25119 -- 4645092 ------------------------------------------------------------------------------
25120 -- To allow MPA report to determine if it should generate report process
25121 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
25125 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
25122 ------------------------------------------------------------------------------------------
25123
25124 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
25126 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
25127 -- call ADRs
25128 -- Bug 4922099
25129 --
25130 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
25131 (NVL(l_actual_upg_option, 'N') = 'O') OR
25132 (NVL(l_enc_upg_option, 'N') = 'O')
25133 )
25134 THEN
25135 NULL;
25136 --
25137 --
25138
25139 l_ccid := AcctDerRule_175(
25140 p_application_id => p_application_id
25141 , p_ae_header_id => l_ae_header_id
25142 , p_source_5 => p_source_5
25143 , p_source_19 => p_source_19
25144 , p_source_32 => p_source_32
25145 , x_transaction_coa_id => l_adr_transaction_coa_id
25146 , x_accounting_coa_id => l_adr_accounting_coa_id
25147 , x_value_type_code => l_adr_value_type_code
25148 , p_side => 'NA'
25149 );
25150
25151 xla_ae_lines_pkg.set_ccid(
25152 p_code_combination_id => l_ccid
25153 , p_value_type_code => l_adr_value_type_code
25154 , p_transaction_coa_id => l_adr_transaction_coa_id
25155 , p_accounting_coa_id => l_adr_accounting_coa_id
25156 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
25157 , p_adr_type_code => 'S'
25158 , p_component_type => l_component_type
25159 , p_component_code => l_component_code
25160 , p_component_type_code => l_component_type_code
25161 , p_component_appl_id => l_component_appl_id
25162 , p_amb_context_code => l_amb_context_code
25163 , p_side => 'NA'
25164 );
25165
25166
25167 l_segment := AcctDerRule_150(
25168 p_application_id => p_application_id
25169 , p_ae_header_id => l_ae_header_id
25170 , p_source_5 => p_source_5
25171 , p_source_12 => p_source_12
25172 , x_transaction_coa_id => l_adr_transaction_coa_id
25173 , x_accounting_coa_id => l_adr_accounting_coa_id
25174 , x_flexfield_segment_code => l_adr_flexfield_segment_code
25175 , x_flex_value_set_id => l_adr_flex_value_set_id
25176 , x_value_type_code => l_adr_value_type_code
25177 , x_value_combination_id => l_adr_value_combination_id
25178 , x_value_segment_code => l_adr_value_segment_code
25179 , p_side => 'NA'
25180 , p_override_seg_flag => 'Y'
25181 );
25182
25183 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
25184
25185 xla_ae_lines_pkg.set_segment(
25186 p_to_segment_code => 'GL_ACCOUNT'
25187 , p_segment_value => l_segment
25188 , p_from_segment_code => l_adr_value_segment_code
25189 , p_from_combination_id => l_adr_value_combination_id
25190 , p_value_type_code => l_adr_value_type_code
25191 , p_transaction_coa_id => l_adr_transaction_coa_id
25192 , p_accounting_coa_id => l_adr_accounting_coa_id
25193 , p_flexfield_segment_code => l_adr_flexfield_segment_code
25194 , p_flex_value_set_id => l_adr_flex_value_set_id
25195 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
25196 , p_adr_type_code => 'S'
25197 , p_component_type => l_component_type
25198 , p_component_code => l_component_code
25199 , p_component_type_code => l_component_type_code
25200 , p_component_appl_id => l_component_appl_id
25201 , p_amb_context_code => l_amb_context_code
25202 , p_entity_code => 'TRANSACTIONS'
25203 , p_event_class_code => 'ADDITIONS'
25204 , p_side => 'NA'
25205 );
25206
25207 END IF;
25208
25209 l_segment := AcctDerRule_169(
25210 p_application_id => p_application_id
25211 , p_ae_header_id => l_ae_header_id
25212 , p_source_5 => p_source_5
25213 , p_source_31 => p_source_31
25214 , x_transaction_coa_id => l_adr_transaction_coa_id
25215 , x_accounting_coa_id => l_adr_accounting_coa_id
25216 , x_flexfield_segment_code => l_adr_flexfield_segment_code
25217 , x_flex_value_set_id => l_adr_flex_value_set_id
25218 , x_value_type_code => l_adr_value_type_code
25219 , x_value_combination_id => l_adr_value_combination_id
25220 , x_value_segment_code => l_adr_value_segment_code
25221 , p_side => 'NA'
25222 , p_override_seg_flag => 'Y'
25223 );
25224
25225 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
25226
25227 xla_ae_lines_pkg.set_segment(
25228 p_to_segment_code => 'GL_BALANCING'
25229 , p_segment_value => l_segment
25230 , p_from_segment_code => l_adr_value_segment_code
25231 , p_from_combination_id => l_adr_value_combination_id
25232 , p_value_type_code => l_adr_value_type_code
25233 , p_transaction_coa_id => l_adr_transaction_coa_id
25237 , p_adr_code => 'FA_EXPENSE_ACCT'
25234 , p_accounting_coa_id => l_adr_accounting_coa_id
25235 , p_flexfield_segment_code => l_adr_flexfield_segment_code
25236 , p_flex_value_set_id => l_adr_flex_value_set_id
25238 , p_adr_type_code => 'S'
25239 , p_component_type => l_component_type
25240 , p_component_code => l_component_code
25241 , p_component_type_code => l_component_type_code
25242 , p_component_appl_id => l_component_appl_id
25243 , p_amb_context_code => l_amb_context_code
25244 , p_entity_code => 'TRANSACTIONS'
25245 , p_event_class_code => 'ADDITIONS'
25246 , p_side => 'NA'
25247 );
25248
25249 END IF;
25250
25251 --
25252 --
25253 END IF;
25254
25255 --
25256 -- Update the line information that should be overwritten
25257 --
25258 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
25259 p_header_num => 1);
25260 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
25261
25262 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
25263
25264 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
25265 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
25266 END IF;
25267
25268 --
25269 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
25270 --
25271 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
25272 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
25273 ELSE
25274 ---------------------------------------------------------------------------------------------------
25275 -- 4262811a Switch Sign
25276 ---------------------------------------------------------------------------------------------------
25277 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
25278 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
25279 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
25280 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
25281 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
25282 -- 5132302
25283 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
25284 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
25285
25286 END IF;
25287
25288 -- 4955764
25289 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
25290 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
25291
25292
25293 XLA_AE_LINES_PKG.ValidateCurrentLine;
25294 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
25295
25296 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
25297 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
25298 ,p_balance_type_code => l_balance_type_code);
25299
25300 END IF;
25301
25302 -----------------------------------------------------------------------------------------
25303 -- 4262811 Multiperiod Accounting
25304 -----------------------------------------------------------------------------------------
25305 -- No MPA option is assigned.
25306
25307
25308 END IF;
25309 END IF;
25310 --
25311
25312 --
25313 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
25314 trace
25315 (p_msg => 'END of AcctLineType_199'
25316 ,p_level => C_LEVEL_PROCEDURE
25317 ,p_module => l_log_module);
25318 END IF;
25319 --
25320 EXCEPTION
25321 WHEN xla_exceptions_pkg.application_exception THEN
25322 RAISE;
25323 WHEN OTHERS THEN
25324 xla_exceptions_pkg.raise_message
25325 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_199');
25326 END AcctLineType_199;
25327 --
25328
25329 ---------------------------------------
25330 --
25331 -- PRIVATE FUNCTION
25332 -- AcctLineType_200
25333 --
25334 ---------------------------------------
25335 PROCEDURE AcctLineType_200 (
25336 p_application_id IN NUMBER
25337 ,p_event_id IN NUMBER
25338 ,p_calculate_acctd_flag IN VARCHAR2
25339 ,p_calculate_g_l_flag IN VARCHAR2
25340 ,p_actual_flag IN OUT VARCHAR2
25341 ,p_balance_type_code OUT VARCHAR2
25342 ,p_gain_or_loss_ref OUT VARCHAR2
25343
25344 --Period Close Date
25345 , p_source_1 IN DATE
25346 --Generated Code Combination Identifier
25347 , p_source_5 IN NUMBER
25348 --Depreciation Reserve Account
25349 , p_source_12 IN VARCHAR2
25350 --Generated Offset Code Combination Identifier
25351 , p_source_19 IN NUMBER
25352 --Expense Account Code Combination Identifier
25356 --Adjustment Type
25353 , p_source_31 IN NUMBER
25354 --Default Code Combination Identifier
25355 , p_source_32 IN NUMBER
25357 , p_source_48 IN VARCHAR2
25358 --Transaction Header Identifier
25359 , p_source_49 IN NUMBER
25360 --Adjustment Line Identifier
25361 , p_source_50 IN NUMBER
25362 --Distribution Type Code
25363 , p_source_51 IN VARCHAR2
25364 --Entered Amount
25365 , p_source_52 IN NUMBER
25366 --Currency Code
25367 , p_source_53 IN VARCHAR2
25368 )
25369 IS
25370
25371 l_component_type VARCHAR2(80);
25372 l_component_code VARCHAR2(30);
25373 l_component_type_code VARCHAR2(1);
25374 l_component_appl_id INTEGER;
25375 l_amb_context_code VARCHAR2(30);
25376 l_entity_code VARCHAR2(30);
25377 l_event_class_code VARCHAR2(30);
25378 l_ae_header_id NUMBER;
25379 l_event_type_code VARCHAR2(30);
25380 l_line_definition_code VARCHAR2(30);
25381 l_line_definition_owner_code VARCHAR2(1);
25382 --
25383 -- adr variables
25384 l_segment VARCHAR2(30);
25385 l_ccid NUMBER;
25386 l_adr_transaction_coa_id NUMBER;
25387 l_adr_accounting_coa_id NUMBER;
25388 l_adr_flexfield_segment_code VARCHAR2(30);
25389 l_adr_flex_value_set_id NUMBER;
25390 l_adr_value_type_code VARCHAR2(30);
25391 l_adr_value_combination_id NUMBER;
25392 l_adr_value_segment_code VARCHAR2(30);
25393
25394 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
25395 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
25396 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
25397 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
25398
25399 -- 4262811 Variables ------------------------------------------------------------------------------------------
25400 l_entered_amt_idx NUMBER;
25401 l_accted_amt_idx NUMBER;
25402 l_acc_rev_flag VARCHAR2(1);
25403 l_accrual_line_num NUMBER;
25404 l_tmp_amt NUMBER;
25405 l_acc_rev_natural_side_code VARCHAR2(1);
25406
25407 l_num_entries NUMBER;
25408 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
25409 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
25410 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
25411 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
25412 l_recog_line_1 NUMBER;
25413 l_recog_line_2 NUMBER;
25414
25415 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
25416 l_bflow_applied_to_amt NUMBER; -- 5132302
25417 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
25418
25419 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
25420
25421 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
25422 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
25423
25424 ---------------------------------------------------------------------------------------------------------------
25425
25426
25427 --
25428 -- bulk performance
25429 --
25430 l_balance_type_code VARCHAR2(1);
25431 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
25432 l_log_module VARCHAR2(240);
25433
25434 --
25435 -- Upgrade strategy
25436 --
25437 l_actual_upg_option VARCHAR2(1);
25438 l_enc_upg_option VARCHAR2(1);
25439
25440 --
25441 BEGIN
25442 --
25443 IF g_log_enabled THEN
25444 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_200';
25445 END IF;
25446 --
25447 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
25448
25449 trace
25450 (p_msg => 'BEGIN of AcctLineType_200'
25451 ,p_level => C_LEVEL_PROCEDURE
25452 ,p_module => l_log_module);
25453
25454 END IF;
25455 --
25456 l_component_type := 'AMB_JLT';
25457 l_component_code := 'FA_ADD_RESERVE_BAL';
25458 l_component_type_code := 'S';
25459 l_component_appl_id := 140;
25460 l_amb_context_code := 'DEFAULT';
25461 l_entity_code := 'TRANSACTIONS';
25462 l_event_class_code := 'ADDITIONS';
25463 l_event_type_code := 'ADDITIONS_ALL';
25464 l_line_definition_owner_code := 'S';
25465 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADDITI1';
25466 --
25467 l_balance_type_code := 'A';
25468 l_segment := NULL;
25469 l_ccid := NULL;
25470 l_adr_transaction_coa_id := NULL;
25471 l_adr_accounting_coa_id := NULL;
25472 l_adr_flexfield_segment_code := NULL;
25473 l_adr_flex_value_set_id := NULL;
25474 l_adr_value_type_code := NULL;
25475 l_adr_value_combination_id := NULL;
25476 l_adr_value_segment_code := NULL;
25477
25478 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
25479 l_bflow_class_code := ''; -- 4219869 Business Flow
25480 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
25484 l_bflow_applied_to_amt := NULL; -- 5132302
25481 l_budgetary_control_flag := 'N';
25482
25483 l_bflow_applied_to_amt_idx := NULL; -- 5132302
25485 l_entered_amt_idx := NULL; -- 4262811
25486 l_accted_amt_idx := NULL; -- 4262811
25487 l_acc_rev_flag := NULL; -- 4262811
25488 l_accrual_line_num := NULL; -- 4262811
25489 l_tmp_amt := NULL; -- 4262811
25490 --
25491
25492 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
25493 l_balance_type_code <> 'B' THEN
25494 IF NVL(p_source_48,'
25495 ') = 'BONUS EXPENSE'
25496 THEN
25497
25498 --
25499 XLA_AE_LINES_PKG.SetNewLine;
25500
25501 p_balance_type_code := l_balance_type_code;
25502 -- set the flag so later we will know whether the gain loss line needs to be created
25503
25504 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
25505 p_actual_flag :='A';
25506 END IF;
25507
25508 --
25509 -- bulk performance
25510 --
25511 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
25512 p_header_num => 0); -- 4262811
25513 --
25514 -- set accounting line options
25515 --
25516 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
25517 p_natural_side_code => 'D'
25518 , p_gain_or_loss_flag => 'N'
25519 , p_gl_transfer_mode_code => 'S'
25520 , p_acct_entry_type_code => 'A'
25521 , p_switch_side_flag => 'Y'
25522 , p_merge_duplicate_code => 'N'
25523 );
25524 --
25525 l_acc_rev_natural_side_code := 'C'; -- 4262811
25526 --
25527 --
25528 -- set accounting line type info
25529 --
25530 xla_ae_lines_pkg.SetAcctLineType
25531 (p_component_type => l_component_type
25532 ,p_event_type_code => l_event_type_code
25533 ,p_line_definition_owner_code => l_line_definition_owner_code
25534 ,p_line_definition_code => l_line_definition_code
25535 ,p_accounting_line_code => l_component_code
25536 ,p_accounting_line_type_code => l_component_type_code
25537 ,p_accounting_line_appl_id => l_component_appl_id
25538 ,p_amb_context_code => l_amb_context_code
25539 ,p_entity_code => l_entity_code
25540 ,p_event_class_code => l_event_class_code);
25541 --
25542 -- set accounting class
25543 --
25544 xla_ae_lines_pkg.SetAcctClass(
25545 p_accounting_class_code => 'ASSET'
25546 , p_ae_header_id => l_ae_header_id
25547 );
25548
25549 --
25550 -- set rounding class
25551 --
25552 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
25553 'ASSET';
25554
25555 --
25556 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
25557 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
25558 --
25559 -- bulk performance
25560 --
25561 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
25562
25563 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
25564 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
25565
25566 -- 4955764
25567 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
25568 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
25569
25570 -- 4458381 Public Sector Enh
25571
25572 --
25573 -- set accounting attributes for the line type
25574 --
25575 l_entered_amt_idx := 4;
25576 l_accted_amt_idx := 6;
25577 l_bflow_applied_to_amt_idx := NULL; -- 5132302
25578 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
25579 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
25580 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
25581 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
25582 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
25583 l_rec_acct_attrs.array_char_value(3) := p_source_51;
25584 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
25585 l_rec_acct_attrs.array_num_value(4) := p_source_52;
25586 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
25587 l_rec_acct_attrs.array_char_value(5) := p_source_53;
25588 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
25589 l_rec_acct_attrs.array_num_value(6) := p_source_52;
25590
25591 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
25592 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
25593
25594 ---------------------------------------------------------------------------------------------------------------
25595 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
25596 ---------------------------------------------------------------------------------------------------------------
25600 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
25597 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
25598
25599 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
25601
25602 IF xla_accounting_cache_pkg.GetValueChar
25603 (p_source_code => 'LEDGER_CATEGORY_CODE'
25604 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
25605 AND l_bflow_method_code = 'PRIOR_ENTRY'
25606 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
25607 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
25608 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
25609 )
25610 THEN
25611 xla_ae_lines_pkg.BflowUpgEntry
25612 (p_business_method_code => l_bflow_method_code
25613 ,p_business_class_code => l_bflow_class_code
25614 ,p_balance_type => l_balance_type_code);
25615 ELSE
25616 NULL;
25617 -- No business flow processing for business flow method of NONE.
25618 END IF;
25619
25620 --
25621 -- call analytical criteria
25622 --
25623
25624 --
25625 -- call description
25626 --
25627
25628 xla_ae_lines_pkg.SetLineDescription(
25629 p_ae_header_id => l_ae_header_id
25630 ,p_description => Description_7 (
25631 p_application_id => p_application_id
25632 , p_ae_header_id => l_ae_header_id
25633 , p_source_1 => p_source_1
25634 )
25635 );
25636
25637
25638 --
25639 -- call ADRs
25640 -- Bug 4922099
25641 --
25642 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
25643 (NVL(l_actual_upg_option, 'N') = 'O') OR
25644 (NVL(l_enc_upg_option, 'N') = 'O')
25645 )
25646 THEN
25647 NULL;
25648 --
25649 --
25650
25651 l_ccid := AcctDerRule_175(
25652 p_application_id => p_application_id
25653 , p_ae_header_id => l_ae_header_id
25654 , p_source_5 => p_source_5
25655 , p_source_19 => p_source_19
25656 , p_source_32 => p_source_32
25657 , x_transaction_coa_id => l_adr_transaction_coa_id
25658 , x_accounting_coa_id => l_adr_accounting_coa_id
25659 , x_value_type_code => l_adr_value_type_code
25660 , p_side => 'NA'
25661 );
25662
25663 xla_ae_lines_pkg.set_ccid(
25664 p_code_combination_id => l_ccid
25665 , p_value_type_code => l_adr_value_type_code
25666 , p_transaction_coa_id => l_adr_transaction_coa_id
25667 , p_accounting_coa_id => l_adr_accounting_coa_id
25668 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
25669 , p_adr_type_code => 'S'
25670 , p_component_type => l_component_type
25671 , p_component_code => l_component_code
25672 , p_component_type_code => l_component_type_code
25673 , p_component_appl_id => l_component_appl_id
25674 , p_amb_context_code => l_amb_context_code
25675 , p_side => 'NA'
25676 );
25677
25678
25679 l_segment := AcctDerRule_150(
25680 p_application_id => p_application_id
25681 , p_ae_header_id => l_ae_header_id
25682 , p_source_5 => p_source_5
25683 , p_source_12 => p_source_12
25684 , x_transaction_coa_id => l_adr_transaction_coa_id
25685 , x_accounting_coa_id => l_adr_accounting_coa_id
25686 , x_flexfield_segment_code => l_adr_flexfield_segment_code
25687 , x_flex_value_set_id => l_adr_flex_value_set_id
25688 , x_value_type_code => l_adr_value_type_code
25689 , x_value_combination_id => l_adr_value_combination_id
25690 , x_value_segment_code => l_adr_value_segment_code
25691 , p_side => 'NA'
25692 , p_override_seg_flag => 'Y'
25693 );
25694
25695 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
25696
25697 xla_ae_lines_pkg.set_segment(
25698 p_to_segment_code => 'GL_ACCOUNT'
25699 , p_segment_value => l_segment
25700 , p_from_segment_code => l_adr_value_segment_code
25701 , p_from_combination_id => l_adr_value_combination_id
25702 , p_value_type_code => l_adr_value_type_code
25703 , p_transaction_coa_id => l_adr_transaction_coa_id
25704 , p_accounting_coa_id => l_adr_accounting_coa_id
25705 , p_flexfield_segment_code => l_adr_flexfield_segment_code
25706 , p_flex_value_set_id => l_adr_flex_value_set_id
25707 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
25708 , p_adr_type_code => 'S'
25709 , p_component_type => l_component_type
25710 , p_component_code => l_component_code
25711 , p_component_type_code => l_component_type_code
25712 , p_component_appl_id => l_component_appl_id
25713 , p_amb_context_code => l_amb_context_code
25714 , p_entity_code => 'TRANSACTIONS'
25715 , p_event_class_code => 'ADDITIONS'
25719 END IF;
25716 , p_side => 'NA'
25717 );
25718
25720
25721 l_segment := AcctDerRule_169(
25722 p_application_id => p_application_id
25723 , p_ae_header_id => l_ae_header_id
25724 , p_source_5 => p_source_5
25725 , p_source_31 => p_source_31
25726 , x_transaction_coa_id => l_adr_transaction_coa_id
25727 , x_accounting_coa_id => l_adr_accounting_coa_id
25728 , x_flexfield_segment_code => l_adr_flexfield_segment_code
25729 , x_flex_value_set_id => l_adr_flex_value_set_id
25730 , x_value_type_code => l_adr_value_type_code
25731 , x_value_combination_id => l_adr_value_combination_id
25732 , x_value_segment_code => l_adr_value_segment_code
25733 , p_side => 'NA'
25734 , p_override_seg_flag => 'Y'
25735 );
25736
25737 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
25738
25739 xla_ae_lines_pkg.set_segment(
25740 p_to_segment_code => 'GL_BALANCING'
25741 , p_segment_value => l_segment
25742 , p_from_segment_code => l_adr_value_segment_code
25743 , p_from_combination_id => l_adr_value_combination_id
25744 , p_value_type_code => l_adr_value_type_code
25745 , p_transaction_coa_id => l_adr_transaction_coa_id
25746 , p_accounting_coa_id => l_adr_accounting_coa_id
25747 , p_flexfield_segment_code => l_adr_flexfield_segment_code
25748 , p_flex_value_set_id => l_adr_flex_value_set_id
25749 , p_adr_code => 'FA_EXPENSE_ACCT'
25750 , p_adr_type_code => 'S'
25751 , p_component_type => l_component_type
25752 , p_component_code => l_component_code
25753 , p_component_type_code => l_component_type_code
25754 , p_component_appl_id => l_component_appl_id
25755 , p_amb_context_code => l_amb_context_code
25756 , p_entity_code => 'TRANSACTIONS'
25757 , p_event_class_code => 'ADDITIONS'
25758 , p_side => 'NA'
25759 );
25760
25761 END IF;
25762
25763 --
25764 --
25765 END IF;
25766 --
25767 -- Bug 4922099
25768 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
25769 (NVL(l_enc_upg_option, 'N') = 'O')
25770 ) AND
25771 (l_bflow_method_code = 'PRIOR_ENTRY')
25772 )
25773 THEN
25774 IF
25775 --
25776 1 = 2
25777 --
25778 THEN
25779 xla_accounting_err_pkg.build_message
25780 (p_appli_s_name => 'XLA'
25781 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
25782 ,p_token_1 => 'LINE_NUMBER'
25783 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
25784 ,p_token_2 => 'LINE_TYPE_NAME'
25785 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
25786 l_component_type
25787 ,l_component_code
25788 ,l_component_type_code
25789 ,l_component_appl_id
25790 ,l_amb_context_code
25791 ,l_entity_code
25792 ,l_event_class_code
25793 )
25794 ,p_token_3 => 'OWNER'
25795 ,p_value_3 => xla_lookups_pkg.get_meaning(
25796 p_lookup_type => 'XLA_OWNER_TYPE'
25797 ,p_lookup_code => l_component_type_code
25798 )
25799 ,p_token_4 => 'PRODUCT_NAME'
25800 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
25801 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
25802 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
25803 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
25804 ,p_ae_header_id => NULL
25805 );
25806
25807 IF (C_LEVEL_ERROR>= g_log_level) THEN
25808 trace
25809 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
25810 ,p_level => C_LEVEL_ERROR
25811 ,p_module => l_log_module);
25812 END IF;
25813 END IF;
25814 END IF;
25815 --
25816 --
25820 -- Prior Entry. Currently, the following code is always generated.
25817 ------------------------------------------------------------------------------------------------
25818 -- 4219869 Business Flow
25819 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
25821 ------------------------------------------------------------------------------------------------
25822 XLA_AE_LINES_PKG.ValidateCurrentLine;
25823
25824 ------------------------------------------------------------------------------------
25825 -- 4219869 Business Flow
25826 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
25827 ------------------------------------------------------------------------------------
25828 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
25829
25830 ----------------------------------------------------------------------------------
25831 -- 4219869 Business Flow
25832 -- Update journal entry status -- Need to generate this within IF <condition>
25833 ----------------------------------------------------------------------------------
25834 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
25835 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
25836 ,p_balance_type_code => l_balance_type_code
25837 );
25838
25839 -------------------------------------------------------------------------------------------
25840 -- 4262811 - Generate the Accrual Reversal lines
25841 -------------------------------------------------------------------------------------------
25842 BEGIN
25843 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
25844 (g_array_event(p_event_id).array_value_num('header_index'));
25845 IF l_acc_rev_flag IS NULL THEN
25846 l_acc_rev_flag := 'N';
25847 END IF;
25848 EXCEPTION
25849 WHEN OTHERS THEN
25850 l_acc_rev_flag := 'N';
25851 END;
25852 --
25853 IF (l_acc_rev_flag = 'Y') THEN
25854
25855 -- 4645092 ------------------------------------------------------------------------------
25856 -- To allow MPA report to determine if it should generate report process
25857 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
25858 ------------------------------------------------------------------------------------------
25859
25860 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
25861 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
25862 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
25863 -- call ADRs
25864 -- Bug 4922099
25865 --
25866 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
25867 (NVL(l_actual_upg_option, 'N') = 'O') OR
25868 (NVL(l_enc_upg_option, 'N') = 'O')
25869 )
25870 THEN
25871 NULL;
25872 --
25873 --
25874
25875 l_ccid := AcctDerRule_175(
25876 p_application_id => p_application_id
25877 , p_ae_header_id => l_ae_header_id
25878 , p_source_5 => p_source_5
25879 , p_source_19 => p_source_19
25880 , p_source_32 => p_source_32
25881 , x_transaction_coa_id => l_adr_transaction_coa_id
25882 , x_accounting_coa_id => l_adr_accounting_coa_id
25883 , x_value_type_code => l_adr_value_type_code
25884 , p_side => 'NA'
25885 );
25886
25887 xla_ae_lines_pkg.set_ccid(
25888 p_code_combination_id => l_ccid
25889 , p_value_type_code => l_adr_value_type_code
25890 , p_transaction_coa_id => l_adr_transaction_coa_id
25891 , p_accounting_coa_id => l_adr_accounting_coa_id
25892 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
25893 , p_adr_type_code => 'S'
25894 , p_component_type => l_component_type
25895 , p_component_code => l_component_code
25896 , p_component_type_code => l_component_type_code
25897 , p_component_appl_id => l_component_appl_id
25898 , p_amb_context_code => l_amb_context_code
25899 , p_side => 'NA'
25900 );
25901
25902
25903 l_segment := AcctDerRule_150(
25904 p_application_id => p_application_id
25905 , p_ae_header_id => l_ae_header_id
25906 , p_source_5 => p_source_5
25907 , p_source_12 => p_source_12
25908 , x_transaction_coa_id => l_adr_transaction_coa_id
25909 , x_accounting_coa_id => l_adr_accounting_coa_id
25910 , x_flexfield_segment_code => l_adr_flexfield_segment_code
25911 , x_flex_value_set_id => l_adr_flex_value_set_id
25912 , x_value_type_code => l_adr_value_type_code
25913 , x_value_combination_id => l_adr_value_combination_id
25914 , x_value_segment_code => l_adr_value_segment_code
25915 , p_side => 'NA'
25916 , p_override_seg_flag => 'Y'
25917 );
25918
25919 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
25920
25921 xla_ae_lines_pkg.set_segment(
25922 p_to_segment_code => 'GL_ACCOUNT'
25923 , p_segment_value => l_segment
25924 , p_from_segment_code => l_adr_value_segment_code
25928 , p_accounting_coa_id => l_adr_accounting_coa_id
25925 , p_from_combination_id => l_adr_value_combination_id
25926 , p_value_type_code => l_adr_value_type_code
25927 , p_transaction_coa_id => l_adr_transaction_coa_id
25929 , p_flexfield_segment_code => l_adr_flexfield_segment_code
25930 , p_flex_value_set_id => l_adr_flex_value_set_id
25931 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
25932 , p_adr_type_code => 'S'
25933 , p_component_type => l_component_type
25934 , p_component_code => l_component_code
25935 , p_component_type_code => l_component_type_code
25936 , p_component_appl_id => l_component_appl_id
25937 , p_amb_context_code => l_amb_context_code
25938 , p_entity_code => 'TRANSACTIONS'
25939 , p_event_class_code => 'ADDITIONS'
25940 , p_side => 'NA'
25941 );
25942
25943 END IF;
25944
25945 l_segment := AcctDerRule_169(
25946 p_application_id => p_application_id
25947 , p_ae_header_id => l_ae_header_id
25948 , p_source_5 => p_source_5
25949 , p_source_31 => p_source_31
25950 , x_transaction_coa_id => l_adr_transaction_coa_id
25951 , x_accounting_coa_id => l_adr_accounting_coa_id
25952 , x_flexfield_segment_code => l_adr_flexfield_segment_code
25953 , x_flex_value_set_id => l_adr_flex_value_set_id
25954 , x_value_type_code => l_adr_value_type_code
25955 , x_value_combination_id => l_adr_value_combination_id
25956 , x_value_segment_code => l_adr_value_segment_code
25957 , p_side => 'NA'
25958 , p_override_seg_flag => 'Y'
25959 );
25960
25961 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
25962
25963 xla_ae_lines_pkg.set_segment(
25964 p_to_segment_code => 'GL_BALANCING'
25965 , p_segment_value => l_segment
25966 , p_from_segment_code => l_adr_value_segment_code
25967 , p_from_combination_id => l_adr_value_combination_id
25968 , p_value_type_code => l_adr_value_type_code
25969 , p_transaction_coa_id => l_adr_transaction_coa_id
25970 , p_accounting_coa_id => l_adr_accounting_coa_id
25971 , p_flexfield_segment_code => l_adr_flexfield_segment_code
25972 , p_flex_value_set_id => l_adr_flex_value_set_id
25973 , p_adr_code => 'FA_EXPENSE_ACCT'
25974 , p_adr_type_code => 'S'
25975 , p_component_type => l_component_type
25976 , p_component_code => l_component_code
25977 , p_component_type_code => l_component_type_code
25978 , p_component_appl_id => l_component_appl_id
25979 , p_amb_context_code => l_amb_context_code
25980 , p_entity_code => 'TRANSACTIONS'
25981 , p_event_class_code => 'ADDITIONS'
25982 , p_side => 'NA'
25983 );
25984
25985 END IF;
25986
25987 --
25988 --
25989 END IF;
25990
25991 --
25992 -- Update the line information that should be overwritten
25993 --
25994 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
25995 p_header_num => 1);
25996 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
25997
25998 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
25999
26000 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
26001 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
26002 END IF;
26003
26004 --
26005 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
26006 --
26007 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
26008 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
26009 ELSE
26010 ---------------------------------------------------------------------------------------------------
26011 -- 4262811a Switch Sign
26012 ---------------------------------------------------------------------------------------------------
26013 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
26014 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
26015 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
26016 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
26017 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
26018 -- 5132302
26019 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
26020 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
26021
26022 END IF;
26023
26024 -- 4955764
26025 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
26026 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
26030 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
26027
26028
26029 XLA_AE_LINES_PKG.ValidateCurrentLine;
26031
26032 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
26033 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
26034 ,p_balance_type_code => l_balance_type_code);
26035
26036 END IF;
26037
26038 -----------------------------------------------------------------------------------------
26039 -- 4262811 Multiperiod Accounting
26040 -----------------------------------------------------------------------------------------
26041 -- No MPA option is assigned.
26042
26043
26044 END IF;
26045 END IF;
26046 --
26047
26048 --
26049 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
26050 trace
26051 (p_msg => 'END of AcctLineType_200'
26052 ,p_level => C_LEVEL_PROCEDURE
26053 ,p_module => l_log_module);
26054 END IF;
26055 --
26056 EXCEPTION
26057 WHEN xla_exceptions_pkg.application_exception THEN
26058 RAISE;
26059 WHEN OTHERS THEN
26060 xla_exceptions_pkg.raise_message
26061 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_200');
26062 END AcctLineType_200;
26063 --
26064
26065 ---------------------------------------
26066 --
26067 -- PRIVATE FUNCTION
26068 -- AcctLineType_201
26069 --
26070 ---------------------------------------
26071 PROCEDURE AcctLineType_201 (
26072 p_application_id IN NUMBER
26073 ,p_event_id IN NUMBER
26074 ,p_calculate_acctd_flag IN VARCHAR2
26075 ,p_calculate_g_l_flag IN VARCHAR2
26076 ,p_actual_flag IN OUT VARCHAR2
26077 ,p_balance_type_code OUT VARCHAR2
26078 ,p_gain_or_loss_ref OUT VARCHAR2
26079
26080 --Period Close Date
26081 , p_source_1 IN DATE
26082 --Bonus Depreciation Expense Account
26083 , p_source_4 IN VARCHAR2
26084 --Generated Code Combination Identifier
26085 , p_source_5 IN NUMBER
26086 --Expense Account Code Combination Identifier
26087 , p_source_31 IN NUMBER
26088 --Adjustment Type
26089 , p_source_48 IN VARCHAR2
26090 --Transaction Header Identifier
26091 , p_source_49 IN NUMBER
26092 --Adjustment Line Identifier
26093 , p_source_50 IN NUMBER
26094 --Distribution Type Code
26095 , p_source_51 IN VARCHAR2
26096 --Entered Amount
26097 , p_source_52 IN NUMBER
26098 --Currency Code
26099 , p_source_53 IN VARCHAR2
26100 )
26101 IS
26102
26103 l_component_type VARCHAR2(80);
26104 l_component_code VARCHAR2(30);
26105 l_component_type_code VARCHAR2(1);
26106 l_component_appl_id INTEGER;
26107 l_amb_context_code VARCHAR2(30);
26108 l_entity_code VARCHAR2(30);
26109 l_event_class_code VARCHAR2(30);
26110 l_ae_header_id NUMBER;
26111 l_event_type_code VARCHAR2(30);
26112 l_line_definition_code VARCHAR2(30);
26113 l_line_definition_owner_code VARCHAR2(1);
26114 --
26115 -- adr variables
26116 l_segment VARCHAR2(30);
26117 l_ccid NUMBER;
26118 l_adr_transaction_coa_id NUMBER;
26119 l_adr_accounting_coa_id NUMBER;
26120 l_adr_flexfield_segment_code VARCHAR2(30);
26121 l_adr_flex_value_set_id NUMBER;
26122 l_adr_value_type_code VARCHAR2(30);
26123 l_adr_value_combination_id NUMBER;
26124 l_adr_value_segment_code VARCHAR2(30);
26125
26126 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
26127 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
26128 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
26129 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
26130
26131 -- 4262811 Variables ------------------------------------------------------------------------------------------
26132 l_entered_amt_idx NUMBER;
26133 l_accted_amt_idx NUMBER;
26134 l_acc_rev_flag VARCHAR2(1);
26135 l_accrual_line_num NUMBER;
26136 l_tmp_amt NUMBER;
26137 l_acc_rev_natural_side_code VARCHAR2(1);
26138
26139 l_num_entries NUMBER;
26140 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
26141 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
26142 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
26143 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
26144 l_recog_line_1 NUMBER;
26145 l_recog_line_2 NUMBER;
26146
26147 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
26148 l_bflow_applied_to_amt NUMBER; -- 5132302
26149 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
26150
26151 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
26152
26153 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
26154 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
26155
26159 --
26156 ---------------------------------------------------------------------------------------------------------------
26157
26158
26160 -- bulk performance
26161 --
26162 l_balance_type_code VARCHAR2(1);
26163 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
26164 l_log_module VARCHAR2(240);
26165
26166 --
26167 -- Upgrade strategy
26168 --
26169 l_actual_upg_option VARCHAR2(1);
26170 l_enc_upg_option VARCHAR2(1);
26171
26172 --
26173 BEGIN
26174 --
26175 IF g_log_enabled THEN
26176 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_201';
26177 END IF;
26178 --
26179 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
26180
26181 trace
26182 (p_msg => 'BEGIN of AcctLineType_201'
26183 ,p_level => C_LEVEL_PROCEDURE
26184 ,p_module => l_log_module);
26185
26186 END IF;
26187 --
26188 l_component_type := 'AMB_JLT';
26189 l_component_code := 'FA_ADJ_BONUS_EXP';
26190 l_component_type_code := 'S';
26191 l_component_appl_id := 140;
26192 l_amb_context_code := 'DEFAULT';
26193 l_entity_code := 'TRANSACTIONS';
26194 l_event_class_code := 'ADJUSTMENTS';
26195 l_event_type_code := 'ADJUSTMENTS_ALL';
26196 l_line_definition_owner_code := 'S';
26197 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADJUST2';
26198 --
26199 l_balance_type_code := 'A';
26200 l_segment := NULL;
26201 l_ccid := NULL;
26202 l_adr_transaction_coa_id := NULL;
26203 l_adr_accounting_coa_id := NULL;
26204 l_adr_flexfield_segment_code := NULL;
26205 l_adr_flex_value_set_id := NULL;
26206 l_adr_value_type_code := NULL;
26207 l_adr_value_combination_id := NULL;
26208 l_adr_value_segment_code := NULL;
26209
26210 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
26211 l_bflow_class_code := ''; -- 4219869 Business Flow
26212 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
26213 l_budgetary_control_flag := 'N';
26214
26215 l_bflow_applied_to_amt_idx := NULL; -- 5132302
26216 l_bflow_applied_to_amt := NULL; -- 5132302
26217 l_entered_amt_idx := NULL; -- 4262811
26218 l_accted_amt_idx := NULL; -- 4262811
26219 l_acc_rev_flag := NULL; -- 4262811
26220 l_accrual_line_num := NULL; -- 4262811
26221 l_tmp_amt := NULL; -- 4262811
26222 --
26223
26224 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
26225 l_balance_type_code <> 'B' THEN
26226 IF NVL(p_source_48,'
26227 ') = 'BONUS EXPENSE'
26228 THEN
26229
26230 --
26231 XLA_AE_LINES_PKG.SetNewLine;
26232
26233 p_balance_type_code := l_balance_type_code;
26234 -- set the flag so later we will know whether the gain loss line needs to be created
26235
26236 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
26237 p_actual_flag :='A';
26238 END IF;
26239
26240 --
26241 -- bulk performance
26242 --
26243 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
26244 p_header_num => 0); -- 4262811
26245 --
26246 -- set accounting line options
26247 --
26248 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
26249 p_natural_side_code => 'D'
26250 , p_gain_or_loss_flag => 'N'
26251 , p_gl_transfer_mode_code => 'S'
26252 , p_acct_entry_type_code => 'A'
26253 , p_switch_side_flag => 'Y'
26254 , p_merge_duplicate_code => 'N'
26255 );
26256 --
26257 l_acc_rev_natural_side_code := 'C'; -- 4262811
26258 --
26259 --
26260 -- set accounting line type info
26261 --
26262 xla_ae_lines_pkg.SetAcctLineType
26263 (p_component_type => l_component_type
26264 ,p_event_type_code => l_event_type_code
26265 ,p_line_definition_owner_code => l_line_definition_owner_code
26266 ,p_line_definition_code => l_line_definition_code
26267 ,p_accounting_line_code => l_component_code
26268 ,p_accounting_line_type_code => l_component_type_code
26269 ,p_accounting_line_appl_id => l_component_appl_id
26270 ,p_amb_context_code => l_amb_context_code
26271 ,p_entity_code => l_entity_code
26272 ,p_event_class_code => l_event_class_code);
26273 --
26274 -- set accounting class
26275 --
26276 xla_ae_lines_pkg.SetAcctClass(
26277 p_accounting_class_code => 'EXPENSE'
26278 , p_ae_header_id => l_ae_header_id
26279 );
26280
26281 --
26282 -- set rounding class
26283 --
26284 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
26285 'EXPENSE';
26286
26287 --
26288 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
26289 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
26290 --
26291 -- bulk performance
26292 --
26296 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
26293 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
26294
26295 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
26297
26298 -- 4955764
26299 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
26300 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
26301
26302 -- 4458381 Public Sector Enh
26303
26304 --
26305 -- set accounting attributes for the line type
26306 --
26307 l_entered_amt_idx := 4;
26308 l_accted_amt_idx := 6;
26309 l_bflow_applied_to_amt_idx := NULL; -- 5132302
26310 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
26311 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
26312 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
26313 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
26314 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
26315 l_rec_acct_attrs.array_char_value(3) := p_source_51;
26316 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
26317 l_rec_acct_attrs.array_num_value(4) := p_source_52;
26318 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
26319 l_rec_acct_attrs.array_char_value(5) := p_source_53;
26320 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
26321 l_rec_acct_attrs.array_num_value(6) := p_source_52;
26322
26323 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
26324 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
26325
26326 ---------------------------------------------------------------------------------------------------------------
26327 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
26328 ---------------------------------------------------------------------------------------------------------------
26329 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
26330
26331 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
26332 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
26333
26334 IF xla_accounting_cache_pkg.GetValueChar
26335 (p_source_code => 'LEDGER_CATEGORY_CODE'
26336 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
26337 AND l_bflow_method_code = 'PRIOR_ENTRY'
26338 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
26339 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
26340 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
26341 )
26342 THEN
26343 xla_ae_lines_pkg.BflowUpgEntry
26344 (p_business_method_code => l_bflow_method_code
26345 ,p_business_class_code => l_bflow_class_code
26346 ,p_balance_type => l_balance_type_code);
26347 ELSE
26348 NULL;
26349 -- No business flow processing for business flow method of NONE.
26350 END IF;
26351
26352 --
26353 -- call analytical criteria
26354 --
26355
26356 --
26357 -- call description
26358 --
26359
26360 xla_ae_lines_pkg.SetLineDescription(
26361 p_ae_header_id => l_ae_header_id
26362 ,p_description => Description_8 (
26363 p_application_id => p_application_id
26364 , p_ae_header_id => l_ae_header_id
26365 , p_source_1 => p_source_1
26366 )
26367 );
26368
26369
26370 --
26371 -- call ADRs
26372 -- Bug 4922099
26373 --
26374 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
26375 (NVL(l_actual_upg_option, 'N') = 'O') OR
26376 (NVL(l_enc_upg_option, 'N') = 'O')
26377 )
26378 THEN
26379 NULL;
26380 --
26381 --
26382
26383 l_ccid := AcctDerRule_176(
26384 p_application_id => p_application_id
26385 , p_ae_header_id => l_ae_header_id
26386 , p_source_5 => p_source_5
26387 , p_source_31 => p_source_31
26388 , x_transaction_coa_id => l_adr_transaction_coa_id
26389 , x_accounting_coa_id => l_adr_accounting_coa_id
26390 , x_value_type_code => l_adr_value_type_code
26391 , p_side => 'NA'
26392 );
26393
26394 xla_ae_lines_pkg.set_ccid(
26395 p_code_combination_id => l_ccid
26396 , p_value_type_code => l_adr_value_type_code
26397 , p_transaction_coa_id => l_adr_transaction_coa_id
26398 , p_accounting_coa_id => l_adr_accounting_coa_id
26399 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
26400 , p_adr_type_code => 'S'
26401 , p_component_type => l_component_type
26402 , p_component_code => l_component_code
26403 , p_component_type_code => l_component_type_code
26404 , p_component_appl_id => l_component_appl_id
26405 , p_amb_context_code => l_amb_context_code
26406 , p_side => 'NA'
26407 );
26408
26409
26410 l_segment := AcctDerRule_144(
26411 p_application_id => p_application_id
26415 , x_transaction_coa_id => l_adr_transaction_coa_id
26412 , p_ae_header_id => l_ae_header_id
26413 , p_source_4 => p_source_4
26414 , p_source_5 => p_source_5
26416 , x_accounting_coa_id => l_adr_accounting_coa_id
26417 , x_flexfield_segment_code => l_adr_flexfield_segment_code
26418 , x_flex_value_set_id => l_adr_flex_value_set_id
26419 , x_value_type_code => l_adr_value_type_code
26420 , x_value_combination_id => l_adr_value_combination_id
26421 , x_value_segment_code => l_adr_value_segment_code
26422 , p_side => 'NA'
26423 , p_override_seg_flag => 'Y'
26424 );
26425
26426 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
26427
26428 xla_ae_lines_pkg.set_segment(
26429 p_to_segment_code => 'GL_ACCOUNT'
26430 , p_segment_value => l_segment
26431 , p_from_segment_code => l_adr_value_segment_code
26432 , p_from_combination_id => l_adr_value_combination_id
26433 , p_value_type_code => l_adr_value_type_code
26434 , p_transaction_coa_id => l_adr_transaction_coa_id
26435 , p_accounting_coa_id => l_adr_accounting_coa_id
26436 , p_flexfield_segment_code => l_adr_flexfield_segment_code
26437 , p_flex_value_set_id => l_adr_flex_value_set_id
26438 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
26439 , p_adr_type_code => 'S'
26440 , p_component_type => l_component_type
26441 , p_component_code => l_component_code
26442 , p_component_type_code => l_component_type_code
26443 , p_component_appl_id => l_component_appl_id
26444 , p_amb_context_code => l_amb_context_code
26445 , p_entity_code => 'TRANSACTIONS'
26446 , p_event_class_code => 'ADJUSTMENTS'
26447 , p_side => 'NA'
26448 );
26449
26450 END IF;
26451
26452 --
26453 --
26454 END IF;
26455 --
26456 -- Bug 4922099
26457 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
26458 (NVL(l_enc_upg_option, 'N') = 'O')
26459 ) AND
26460 (l_bflow_method_code = 'PRIOR_ENTRY')
26461 )
26462 THEN
26463 IF
26464 --
26465 1 = 2
26466 --
26467 THEN
26468 xla_accounting_err_pkg.build_message
26469 (p_appli_s_name => 'XLA'
26470 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
26471 ,p_token_1 => 'LINE_NUMBER'
26472 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
26473 ,p_token_2 => 'LINE_TYPE_NAME'
26474 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
26475 l_component_type
26476 ,l_component_code
26477 ,l_component_type_code
26478 ,l_component_appl_id
26479 ,l_amb_context_code
26480 ,l_entity_code
26481 ,l_event_class_code
26482 )
26483 ,p_token_3 => 'OWNER'
26484 ,p_value_3 => xla_lookups_pkg.get_meaning(
26485 p_lookup_type => 'XLA_OWNER_TYPE'
26486 ,p_lookup_code => l_component_type_code
26487 )
26488 ,p_token_4 => 'PRODUCT_NAME'
26489 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
26490 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
26491 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
26492 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
26493 ,p_ae_header_id => NULL
26494 );
26495
26496 IF (C_LEVEL_ERROR>= g_log_level) THEN
26497 trace
26498 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
26499 ,p_level => C_LEVEL_ERROR
26500 ,p_module => l_log_module);
26501 END IF;
26502 END IF;
26503 END IF;
26504 --
26505 --
26506 ------------------------------------------------------------------------------------------------
26507 -- 4219869 Business Flow
26511 XLA_AE_LINES_PKG.ValidateCurrentLine;
26508 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
26509 -- Prior Entry. Currently, the following code is always generated.
26510 ------------------------------------------------------------------------------------------------
26512
26513 ------------------------------------------------------------------------------------
26514 -- 4219869 Business Flow
26515 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
26516 ------------------------------------------------------------------------------------
26517 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
26518
26519 ----------------------------------------------------------------------------------
26520 -- 4219869 Business Flow
26521 -- Update journal entry status -- Need to generate this within IF <condition>
26522 ----------------------------------------------------------------------------------
26523 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
26524 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
26525 ,p_balance_type_code => l_balance_type_code
26526 );
26527
26528 -------------------------------------------------------------------------------------------
26529 -- 4262811 - Generate the Accrual Reversal lines
26530 -------------------------------------------------------------------------------------------
26531 BEGIN
26532 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
26533 (g_array_event(p_event_id).array_value_num('header_index'));
26534 IF l_acc_rev_flag IS NULL THEN
26535 l_acc_rev_flag := 'N';
26536 END IF;
26537 EXCEPTION
26538 WHEN OTHERS THEN
26539 l_acc_rev_flag := 'N';
26540 END;
26541 --
26542 IF (l_acc_rev_flag = 'Y') THEN
26543
26544 -- 4645092 ------------------------------------------------------------------------------
26545 -- To allow MPA report to determine if it should generate report process
26546 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
26547 ------------------------------------------------------------------------------------------
26548
26549 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
26550 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
26551 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
26552 -- call ADRs
26553 -- Bug 4922099
26554 --
26555 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
26556 (NVL(l_actual_upg_option, 'N') = 'O') OR
26557 (NVL(l_enc_upg_option, 'N') = 'O')
26558 )
26559 THEN
26560 NULL;
26561 --
26562 --
26563
26564 l_ccid := AcctDerRule_176(
26565 p_application_id => p_application_id
26566 , p_ae_header_id => l_ae_header_id
26567 , p_source_5 => p_source_5
26568 , p_source_31 => p_source_31
26569 , x_transaction_coa_id => l_adr_transaction_coa_id
26570 , x_accounting_coa_id => l_adr_accounting_coa_id
26571 , x_value_type_code => l_adr_value_type_code
26572 , p_side => 'NA'
26573 );
26574
26575 xla_ae_lines_pkg.set_ccid(
26576 p_code_combination_id => l_ccid
26577 , p_value_type_code => l_adr_value_type_code
26578 , p_transaction_coa_id => l_adr_transaction_coa_id
26579 , p_accounting_coa_id => l_adr_accounting_coa_id
26580 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
26581 , p_adr_type_code => 'S'
26582 , p_component_type => l_component_type
26583 , p_component_code => l_component_code
26584 , p_component_type_code => l_component_type_code
26585 , p_component_appl_id => l_component_appl_id
26586 , p_amb_context_code => l_amb_context_code
26587 , p_side => 'NA'
26588 );
26589
26590
26591 l_segment := AcctDerRule_144(
26592 p_application_id => p_application_id
26593 , p_ae_header_id => l_ae_header_id
26594 , p_source_4 => p_source_4
26595 , p_source_5 => p_source_5
26596 , x_transaction_coa_id => l_adr_transaction_coa_id
26597 , x_accounting_coa_id => l_adr_accounting_coa_id
26598 , x_flexfield_segment_code => l_adr_flexfield_segment_code
26599 , x_flex_value_set_id => l_adr_flex_value_set_id
26600 , x_value_type_code => l_adr_value_type_code
26601 , x_value_combination_id => l_adr_value_combination_id
26602 , x_value_segment_code => l_adr_value_segment_code
26603 , p_side => 'NA'
26604 , p_override_seg_flag => 'Y'
26605 );
26606
26607 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
26608
26609 xla_ae_lines_pkg.set_segment(
26610 p_to_segment_code => 'GL_ACCOUNT'
26611 , p_segment_value => l_segment
26612 , p_from_segment_code => l_adr_value_segment_code
26613 , p_from_combination_id => l_adr_value_combination_id
26614 , p_value_type_code => l_adr_value_type_code
26615 , p_transaction_coa_id => l_adr_transaction_coa_id
26616 , p_accounting_coa_id => l_adr_accounting_coa_id
26620 , p_adr_type_code => 'S'
26617 , p_flexfield_segment_code => l_adr_flexfield_segment_code
26618 , p_flex_value_set_id => l_adr_flex_value_set_id
26619 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
26621 , p_component_type => l_component_type
26622 , p_component_code => l_component_code
26623 , p_component_type_code => l_component_type_code
26624 , p_component_appl_id => l_component_appl_id
26625 , p_amb_context_code => l_amb_context_code
26626 , p_entity_code => 'TRANSACTIONS'
26627 , p_event_class_code => 'ADJUSTMENTS'
26628 , p_side => 'NA'
26629 );
26630
26631 END IF;
26632
26633 --
26634 --
26635 END IF;
26636
26637 --
26638 -- Update the line information that should be overwritten
26639 --
26640 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
26641 p_header_num => 1);
26642 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
26643
26644 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
26645
26646 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
26647 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
26648 END IF;
26649
26650 --
26651 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
26652 --
26653 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
26654 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
26655 ELSE
26656 ---------------------------------------------------------------------------------------------------
26657 -- 4262811a Switch Sign
26658 ---------------------------------------------------------------------------------------------------
26659 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
26660 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
26661 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
26662 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
26663 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
26664 -- 5132302
26665 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
26666 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
26667
26668 END IF;
26669
26670 -- 4955764
26671 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
26672 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
26673
26674
26675 XLA_AE_LINES_PKG.ValidateCurrentLine;
26676 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
26677
26678 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
26679 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
26680 ,p_balance_type_code => l_balance_type_code);
26681
26682 END IF;
26683
26684 -----------------------------------------------------------------------------------------
26685 -- 4262811 Multiperiod Accounting
26686 -----------------------------------------------------------------------------------------
26687 -- No MPA option is assigned.
26688
26689
26690 END IF;
26691 END IF;
26692 --
26693
26694 --
26695 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
26696 trace
26697 (p_msg => 'END of AcctLineType_201'
26698 ,p_level => C_LEVEL_PROCEDURE
26699 ,p_module => l_log_module);
26700 END IF;
26701 --
26702 EXCEPTION
26703 WHEN xla_exceptions_pkg.application_exception THEN
26704 RAISE;
26705 WHEN OTHERS THEN
26706 xla_exceptions_pkg.raise_message
26707 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_201');
26708 END AcctLineType_201;
26709 --
26710
26711 ---------------------------------------
26712 --
26713 -- PRIVATE FUNCTION
26714 -- AcctLineType_202
26715 --
26716 ---------------------------------------
26717 PROCEDURE AcctLineType_202 (
26718 p_application_id IN NUMBER
26719 ,p_event_id IN NUMBER
26720 ,p_calculate_acctd_flag IN VARCHAR2
26721 ,p_calculate_g_l_flag IN VARCHAR2
26722 ,p_actual_flag IN OUT VARCHAR2
26723 ,p_balance_type_code OUT VARCHAR2
26724 ,p_gain_or_loss_ref OUT VARCHAR2
26725
26726 --Period Close Date
26727 , p_source_1 IN DATE
26728 --Generated Code Combination Identifier
26729 , p_source_5 IN NUMBER
26730 --Bonus Reserve Account
26731 , p_source_6 IN VARCHAR2
26732 --Generated Offset Code Combination Identifier
26733 , p_source_19 IN NUMBER
26734 --Expense Account Code Combination Identifier
26738 --Adjustment Type
26735 , p_source_31 IN NUMBER
26736 --Default Code Combination Identifier
26737 , p_source_32 IN NUMBER
26739 , p_source_48 IN VARCHAR2
26740 --Transaction Header Identifier
26741 , p_source_49 IN NUMBER
26742 --Adjustment Line Identifier
26743 , p_source_50 IN NUMBER
26744 --Distribution Type Code
26745 , p_source_51 IN VARCHAR2
26746 --Entered Amount
26747 , p_source_52 IN NUMBER
26748 --Currency Code
26749 , p_source_53 IN VARCHAR2
26750 )
26751 IS
26752
26753 l_component_type VARCHAR2(80);
26754 l_component_code VARCHAR2(30);
26755 l_component_type_code VARCHAR2(1);
26756 l_component_appl_id INTEGER;
26757 l_amb_context_code VARCHAR2(30);
26758 l_entity_code VARCHAR2(30);
26759 l_event_class_code VARCHAR2(30);
26760 l_ae_header_id NUMBER;
26761 l_event_type_code VARCHAR2(30);
26762 l_line_definition_code VARCHAR2(30);
26763 l_line_definition_owner_code VARCHAR2(1);
26764 --
26765 -- adr variables
26766 l_segment VARCHAR2(30);
26767 l_ccid NUMBER;
26768 l_adr_transaction_coa_id NUMBER;
26769 l_adr_accounting_coa_id NUMBER;
26770 l_adr_flexfield_segment_code VARCHAR2(30);
26771 l_adr_flex_value_set_id NUMBER;
26772 l_adr_value_type_code VARCHAR2(30);
26773 l_adr_value_combination_id NUMBER;
26774 l_adr_value_segment_code VARCHAR2(30);
26775
26776 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
26777 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
26778 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
26779 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
26780
26781 -- 4262811 Variables ------------------------------------------------------------------------------------------
26782 l_entered_amt_idx NUMBER;
26783 l_accted_amt_idx NUMBER;
26784 l_acc_rev_flag VARCHAR2(1);
26785 l_accrual_line_num NUMBER;
26786 l_tmp_amt NUMBER;
26787 l_acc_rev_natural_side_code VARCHAR2(1);
26788
26789 l_num_entries NUMBER;
26790 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
26791 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
26792 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
26793 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
26794 l_recog_line_1 NUMBER;
26795 l_recog_line_2 NUMBER;
26796
26797 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
26798 l_bflow_applied_to_amt NUMBER; -- 5132302
26799 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
26800
26801 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
26802
26803 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
26804 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
26805
26806 ---------------------------------------------------------------------------------------------------------------
26807
26808
26809 --
26810 -- bulk performance
26811 --
26812 l_balance_type_code VARCHAR2(1);
26813 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
26814 l_log_module VARCHAR2(240);
26815
26816 --
26817 -- Upgrade strategy
26818 --
26819 l_actual_upg_option VARCHAR2(1);
26820 l_enc_upg_option VARCHAR2(1);
26821
26822 --
26823 BEGIN
26824 --
26825 IF g_log_enabled THEN
26826 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_202';
26827 END IF;
26828 --
26829 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
26830
26831 trace
26832 (p_msg => 'BEGIN of AcctLineType_202'
26833 ,p_level => C_LEVEL_PROCEDURE
26834 ,p_module => l_log_module);
26835
26836 END IF;
26837 --
26838 l_component_type := 'AMB_JLT';
26839 l_component_code := 'FA_ADJ_BONUS_RESERVE';
26840 l_component_type_code := 'S';
26841 l_component_appl_id := 140;
26842 l_amb_context_code := 'DEFAULT';
26843 l_entity_code := 'TRANSACTIONS';
26844 l_event_class_code := 'ADJUSTMENTS';
26845 l_event_type_code := 'ADJUSTMENTS_ALL';
26846 l_line_definition_owner_code := 'S';
26847 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADJUST2';
26848 --
26849 l_balance_type_code := 'A';
26850 l_segment := NULL;
26851 l_ccid := NULL;
26852 l_adr_transaction_coa_id := NULL;
26853 l_adr_accounting_coa_id := NULL;
26854 l_adr_flexfield_segment_code := NULL;
26855 l_adr_flex_value_set_id := NULL;
26856 l_adr_value_type_code := NULL;
26857 l_adr_value_combination_id := NULL;
26858 l_adr_value_segment_code := NULL;
26859
26860 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
26861 l_bflow_class_code := ''; -- 4219869 Business Flow
26862 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
26863 l_budgetary_control_flag := 'N';
26864
26868 l_accted_amt_idx := NULL; -- 4262811
26865 l_bflow_applied_to_amt_idx := NULL; -- 5132302
26866 l_bflow_applied_to_amt := NULL; -- 5132302
26867 l_entered_amt_idx := NULL; -- 4262811
26869 l_acc_rev_flag := NULL; -- 4262811
26870 l_accrual_line_num := NULL; -- 4262811
26871 l_tmp_amt := NULL; -- 4262811
26872 --
26873
26874 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
26875 l_balance_type_code <> 'B' THEN
26876 IF (NVL(p_source_48,'
26877 ') = 'BONUS EXPENSE' OR
26878 NVL(p_source_48,'
26879 ') = 'BONUS RESERVE')
26880 THEN
26881
26882 --
26883 XLA_AE_LINES_PKG.SetNewLine;
26884
26885 p_balance_type_code := l_balance_type_code;
26886 -- set the flag so later we will know whether the gain loss line needs to be created
26887
26888 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
26889 p_actual_flag :='A';
26890 END IF;
26891
26892 --
26893 -- bulk performance
26894 --
26895 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
26896 p_header_num => 0); -- 4262811
26897 --
26898 -- set accounting line options
26899 --
26900 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
26901 p_natural_side_code => 'C'
26902 , p_gain_or_loss_flag => 'N'
26903 , p_gl_transfer_mode_code => 'S'
26904 , p_acct_entry_type_code => 'A'
26905 , p_switch_side_flag => 'Y'
26906 , p_merge_duplicate_code => 'N'
26907 );
26908 --
26909 l_acc_rev_natural_side_code := 'D'; -- 4262811
26910 --
26911 --
26912 -- set accounting line type info
26913 --
26914 xla_ae_lines_pkg.SetAcctLineType
26915 (p_component_type => l_component_type
26916 ,p_event_type_code => l_event_type_code
26917 ,p_line_definition_owner_code => l_line_definition_owner_code
26918 ,p_line_definition_code => l_line_definition_code
26919 ,p_accounting_line_code => l_component_code
26920 ,p_accounting_line_type_code => l_component_type_code
26921 ,p_accounting_line_appl_id => l_component_appl_id
26922 ,p_amb_context_code => l_amb_context_code
26923 ,p_entity_code => l_entity_code
26924 ,p_event_class_code => l_event_class_code);
26925 --
26926 -- set accounting class
26927 --
26928 xla_ae_lines_pkg.SetAcctClass(
26929 p_accounting_class_code => 'ASSET'
26930 , p_ae_header_id => l_ae_header_id
26931 );
26932
26933 --
26934 -- set rounding class
26935 --
26936 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
26937 'ASSET';
26938
26939 --
26940 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
26941 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
26942 --
26943 -- bulk performance
26944 --
26945 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
26946
26947 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
26948 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
26949
26950 -- 4955764
26951 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
26952 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
26953
26954 -- 4458381 Public Sector Enh
26955
26956 --
26957 -- set accounting attributes for the line type
26958 --
26959 l_entered_amt_idx := 4;
26960 l_accted_amt_idx := 6;
26961 l_bflow_applied_to_amt_idx := NULL; -- 5132302
26962 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
26963 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
26964 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
26965 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
26966 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
26967 l_rec_acct_attrs.array_char_value(3) := p_source_51;
26968 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
26969 l_rec_acct_attrs.array_num_value(4) := p_source_52;
26970 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
26971 l_rec_acct_attrs.array_char_value(5) := p_source_53;
26972 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
26973 l_rec_acct_attrs.array_num_value(6) := p_source_52;
26974
26975 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
26976 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
26977
26978 ---------------------------------------------------------------------------------------------------------------
26979 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
26983 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
26980 ---------------------------------------------------------------------------------------------------------------
26981 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
26982
26984 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
26985
26986 IF xla_accounting_cache_pkg.GetValueChar
26987 (p_source_code => 'LEDGER_CATEGORY_CODE'
26988 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
26989 AND l_bflow_method_code = 'PRIOR_ENTRY'
26990 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
26991 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
26992 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
26993 )
26994 THEN
26995 xla_ae_lines_pkg.BflowUpgEntry
26996 (p_business_method_code => l_bflow_method_code
26997 ,p_business_class_code => l_bflow_class_code
26998 ,p_balance_type => l_balance_type_code);
26999 ELSE
27000 NULL;
27001 -- No business flow processing for business flow method of NONE.
27002 END IF;
27003
27004 --
27005 -- call analytical criteria
27006 --
27007
27008 --
27009 -- call description
27010 --
27011
27012 xla_ae_lines_pkg.SetLineDescription(
27013 p_ae_header_id => l_ae_header_id
27014 ,p_description => Description_9 (
27015 p_application_id => p_application_id
27016 , p_ae_header_id => l_ae_header_id
27017 , p_source_1 => p_source_1
27018 )
27019 );
27020
27021
27022 --
27023 -- call ADRs
27024 -- Bug 4922099
27025 --
27026 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
27027 (NVL(l_actual_upg_option, 'N') = 'O') OR
27028 (NVL(l_enc_upg_option, 'N') = 'O')
27029 )
27030 THEN
27031 NULL;
27032 --
27033 --
27034
27035 l_ccid := AcctDerRule_175(
27036 p_application_id => p_application_id
27037 , p_ae_header_id => l_ae_header_id
27038 , p_source_5 => p_source_5
27039 , p_source_19 => p_source_19
27040 , p_source_32 => p_source_32
27041 , x_transaction_coa_id => l_adr_transaction_coa_id
27042 , x_accounting_coa_id => l_adr_accounting_coa_id
27043 , x_value_type_code => l_adr_value_type_code
27044 , p_side => 'NA'
27045 );
27046
27047 xla_ae_lines_pkg.set_ccid(
27048 p_code_combination_id => l_ccid
27049 , p_value_type_code => l_adr_value_type_code
27050 , p_transaction_coa_id => l_adr_transaction_coa_id
27051 , p_accounting_coa_id => l_adr_accounting_coa_id
27052 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
27053 , p_adr_type_code => 'S'
27054 , p_component_type => l_component_type
27055 , p_component_code => l_component_code
27056 , p_component_type_code => l_component_type_code
27057 , p_component_appl_id => l_component_appl_id
27058 , p_amb_context_code => l_amb_context_code
27059 , p_side => 'NA'
27060 );
27061
27062
27063 l_segment := AcctDerRule_145(
27064 p_application_id => p_application_id
27065 , p_ae_header_id => l_ae_header_id
27066 , p_source_5 => p_source_5
27067 , p_source_6 => p_source_6
27068 , x_transaction_coa_id => l_adr_transaction_coa_id
27069 , x_accounting_coa_id => l_adr_accounting_coa_id
27070 , x_flexfield_segment_code => l_adr_flexfield_segment_code
27071 , x_flex_value_set_id => l_adr_flex_value_set_id
27072 , x_value_type_code => l_adr_value_type_code
27073 , x_value_combination_id => l_adr_value_combination_id
27074 , x_value_segment_code => l_adr_value_segment_code
27075 , p_side => 'NA'
27076 , p_override_seg_flag => 'Y'
27077 );
27078
27079 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
27080
27081 xla_ae_lines_pkg.set_segment(
27082 p_to_segment_code => 'GL_ACCOUNT'
27083 , p_segment_value => l_segment
27084 , p_from_segment_code => l_adr_value_segment_code
27085 , p_from_combination_id => l_adr_value_combination_id
27086 , p_value_type_code => l_adr_value_type_code
27087 , p_transaction_coa_id => l_adr_transaction_coa_id
27088 , p_accounting_coa_id => l_adr_accounting_coa_id
27089 , p_flexfield_segment_code => l_adr_flexfield_segment_code
27090 , p_flex_value_set_id => l_adr_flex_value_set_id
27091 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
27092 , p_adr_type_code => 'S'
27093 , p_component_type => l_component_type
27094 , p_component_code => l_component_code
27095 , p_component_type_code => l_component_type_code
27096 , p_component_appl_id => l_component_appl_id
27097 , p_amb_context_code => l_amb_context_code
27098 , p_entity_code => 'TRANSACTIONS'
27102
27099 , p_event_class_code => 'ADJUSTMENTS'
27100 , p_side => 'NA'
27101 );
27103 END IF;
27104
27105 l_segment := AcctDerRule_169(
27106 p_application_id => p_application_id
27107 , p_ae_header_id => l_ae_header_id
27108 , p_source_5 => p_source_5
27109 , p_source_31 => p_source_31
27110 , x_transaction_coa_id => l_adr_transaction_coa_id
27111 , x_accounting_coa_id => l_adr_accounting_coa_id
27112 , x_flexfield_segment_code => l_adr_flexfield_segment_code
27113 , x_flex_value_set_id => l_adr_flex_value_set_id
27114 , x_value_type_code => l_adr_value_type_code
27115 , x_value_combination_id => l_adr_value_combination_id
27116 , x_value_segment_code => l_adr_value_segment_code
27117 , p_side => 'NA'
27118 , p_override_seg_flag => 'Y'
27119 );
27120
27121 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
27122
27123 xla_ae_lines_pkg.set_segment(
27124 p_to_segment_code => 'GL_BALANCING'
27125 , p_segment_value => l_segment
27126 , p_from_segment_code => l_adr_value_segment_code
27127 , p_from_combination_id => l_adr_value_combination_id
27128 , p_value_type_code => l_adr_value_type_code
27129 , p_transaction_coa_id => l_adr_transaction_coa_id
27130 , p_accounting_coa_id => l_adr_accounting_coa_id
27131 , p_flexfield_segment_code => l_adr_flexfield_segment_code
27132 , p_flex_value_set_id => l_adr_flex_value_set_id
27133 , p_adr_code => 'FA_EXPENSE_ACCT'
27134 , p_adr_type_code => 'S'
27135 , p_component_type => l_component_type
27136 , p_component_code => l_component_code
27137 , p_component_type_code => l_component_type_code
27138 , p_component_appl_id => l_component_appl_id
27139 , p_amb_context_code => l_amb_context_code
27140 , p_entity_code => 'TRANSACTIONS'
27141 , p_event_class_code => 'ADJUSTMENTS'
27142 , p_side => 'NA'
27143 );
27144
27145 END IF;
27146
27147 --
27148 --
27149 END IF;
27150 --
27151 -- Bug 4922099
27152 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
27153 (NVL(l_enc_upg_option, 'N') = 'O')
27154 ) AND
27155 (l_bflow_method_code = 'PRIOR_ENTRY')
27156 )
27157 THEN
27158 IF
27159 --
27160 1 = 2
27161 --
27162 THEN
27163 xla_accounting_err_pkg.build_message
27164 (p_appli_s_name => 'XLA'
27165 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
27166 ,p_token_1 => 'LINE_NUMBER'
27167 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
27168 ,p_token_2 => 'LINE_TYPE_NAME'
27169 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
27170 l_component_type
27171 ,l_component_code
27172 ,l_component_type_code
27173 ,l_component_appl_id
27174 ,l_amb_context_code
27175 ,l_entity_code
27176 ,l_event_class_code
27177 )
27178 ,p_token_3 => 'OWNER'
27179 ,p_value_3 => xla_lookups_pkg.get_meaning(
27180 p_lookup_type => 'XLA_OWNER_TYPE'
27181 ,p_lookup_code => l_component_type_code
27182 )
27183 ,p_token_4 => 'PRODUCT_NAME'
27184 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
27185 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
27186 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
27187 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
27188 ,p_ae_header_id => NULL
27189 );
27190
27191 IF (C_LEVEL_ERROR>= g_log_level) THEN
27192 trace
27193 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
27194 ,p_level => C_LEVEL_ERROR
27195 ,p_module => l_log_module);
27199 --
27196 END IF;
27197 END IF;
27198 END IF;
27200 --
27201 ------------------------------------------------------------------------------------------------
27202 -- 4219869 Business Flow
27203 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
27204 -- Prior Entry. Currently, the following code is always generated.
27205 ------------------------------------------------------------------------------------------------
27206 XLA_AE_LINES_PKG.ValidateCurrentLine;
27207
27208 ------------------------------------------------------------------------------------
27209 -- 4219869 Business Flow
27210 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
27211 ------------------------------------------------------------------------------------
27212 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
27213
27214 ----------------------------------------------------------------------------------
27215 -- 4219869 Business Flow
27216 -- Update journal entry status -- Need to generate this within IF <condition>
27217 ----------------------------------------------------------------------------------
27218 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
27219 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
27220 ,p_balance_type_code => l_balance_type_code
27221 );
27222
27223 -------------------------------------------------------------------------------------------
27224 -- 4262811 - Generate the Accrual Reversal lines
27225 -------------------------------------------------------------------------------------------
27226 BEGIN
27227 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
27228 (g_array_event(p_event_id).array_value_num('header_index'));
27229 IF l_acc_rev_flag IS NULL THEN
27230 l_acc_rev_flag := 'N';
27231 END IF;
27232 EXCEPTION
27233 WHEN OTHERS THEN
27234 l_acc_rev_flag := 'N';
27235 END;
27236 --
27237 IF (l_acc_rev_flag = 'Y') THEN
27238
27239 -- 4645092 ------------------------------------------------------------------------------
27240 -- To allow MPA report to determine if it should generate report process
27241 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
27242 ------------------------------------------------------------------------------------------
27243
27244 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
27245 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
27246 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
27247 -- call ADRs
27248 -- Bug 4922099
27249 --
27250 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
27251 (NVL(l_actual_upg_option, 'N') = 'O') OR
27252 (NVL(l_enc_upg_option, 'N') = 'O')
27253 )
27254 THEN
27255 NULL;
27256 --
27257 --
27258
27259 l_ccid := AcctDerRule_175(
27260 p_application_id => p_application_id
27261 , p_ae_header_id => l_ae_header_id
27262 , p_source_5 => p_source_5
27263 , p_source_19 => p_source_19
27264 , p_source_32 => p_source_32
27265 , x_transaction_coa_id => l_adr_transaction_coa_id
27266 , x_accounting_coa_id => l_adr_accounting_coa_id
27267 , x_value_type_code => l_adr_value_type_code
27268 , p_side => 'NA'
27269 );
27270
27271 xla_ae_lines_pkg.set_ccid(
27272 p_code_combination_id => l_ccid
27273 , p_value_type_code => l_adr_value_type_code
27274 , p_transaction_coa_id => l_adr_transaction_coa_id
27275 , p_accounting_coa_id => l_adr_accounting_coa_id
27276 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
27277 , p_adr_type_code => 'S'
27278 , p_component_type => l_component_type
27279 , p_component_code => l_component_code
27280 , p_component_type_code => l_component_type_code
27281 , p_component_appl_id => l_component_appl_id
27282 , p_amb_context_code => l_amb_context_code
27283 , p_side => 'NA'
27284 );
27285
27286
27287 l_segment := AcctDerRule_145(
27288 p_application_id => p_application_id
27289 , p_ae_header_id => l_ae_header_id
27290 , p_source_5 => p_source_5
27291 , p_source_6 => p_source_6
27292 , x_transaction_coa_id => l_adr_transaction_coa_id
27293 , x_accounting_coa_id => l_adr_accounting_coa_id
27294 , x_flexfield_segment_code => l_adr_flexfield_segment_code
27295 , x_flex_value_set_id => l_adr_flex_value_set_id
27296 , x_value_type_code => l_adr_value_type_code
27297 , x_value_combination_id => l_adr_value_combination_id
27298 , x_value_segment_code => l_adr_value_segment_code
27299 , p_side => 'NA'
27300 , p_override_seg_flag => 'Y'
27301 );
27302
27303 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
27304
27305 xla_ae_lines_pkg.set_segment(
27306 p_to_segment_code => 'GL_ACCOUNT'
27307 , p_segment_value => l_segment
27308 , p_from_segment_code => l_adr_value_segment_code
27309 , p_from_combination_id => l_adr_value_combination_id
27313 , p_flexfield_segment_code => l_adr_flexfield_segment_code
27310 , p_value_type_code => l_adr_value_type_code
27311 , p_transaction_coa_id => l_adr_transaction_coa_id
27312 , p_accounting_coa_id => l_adr_accounting_coa_id
27314 , p_flex_value_set_id => l_adr_flex_value_set_id
27315 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
27316 , p_adr_type_code => 'S'
27317 , p_component_type => l_component_type
27318 , p_component_code => l_component_code
27319 , p_component_type_code => l_component_type_code
27320 , p_component_appl_id => l_component_appl_id
27321 , p_amb_context_code => l_amb_context_code
27322 , p_entity_code => 'TRANSACTIONS'
27323 , p_event_class_code => 'ADJUSTMENTS'
27324 , p_side => 'NA'
27325 );
27326
27327 END IF;
27328
27329 l_segment := AcctDerRule_169(
27330 p_application_id => p_application_id
27331 , p_ae_header_id => l_ae_header_id
27332 , p_source_5 => p_source_5
27333 , p_source_31 => p_source_31
27334 , x_transaction_coa_id => l_adr_transaction_coa_id
27335 , x_accounting_coa_id => l_adr_accounting_coa_id
27336 , x_flexfield_segment_code => l_adr_flexfield_segment_code
27337 , x_flex_value_set_id => l_adr_flex_value_set_id
27338 , x_value_type_code => l_adr_value_type_code
27339 , x_value_combination_id => l_adr_value_combination_id
27340 , x_value_segment_code => l_adr_value_segment_code
27341 , p_side => 'NA'
27342 , p_override_seg_flag => 'Y'
27343 );
27344
27345 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
27346
27347 xla_ae_lines_pkg.set_segment(
27348 p_to_segment_code => 'GL_BALANCING'
27349 , p_segment_value => l_segment
27350 , p_from_segment_code => l_adr_value_segment_code
27351 , p_from_combination_id => l_adr_value_combination_id
27352 , p_value_type_code => l_adr_value_type_code
27353 , p_transaction_coa_id => l_adr_transaction_coa_id
27354 , p_accounting_coa_id => l_adr_accounting_coa_id
27355 , p_flexfield_segment_code => l_adr_flexfield_segment_code
27356 , p_flex_value_set_id => l_adr_flex_value_set_id
27357 , p_adr_code => 'FA_EXPENSE_ACCT'
27358 , p_adr_type_code => 'S'
27359 , p_component_type => l_component_type
27360 , p_component_code => l_component_code
27361 , p_component_type_code => l_component_type_code
27362 , p_component_appl_id => l_component_appl_id
27363 , p_amb_context_code => l_amb_context_code
27364 , p_entity_code => 'TRANSACTIONS'
27365 , p_event_class_code => 'ADJUSTMENTS'
27366 , p_side => 'NA'
27367 );
27368
27369 END IF;
27370
27371 --
27372 --
27373 END IF;
27374
27375 --
27376 -- Update the line information that should be overwritten
27377 --
27378 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
27379 p_header_num => 1);
27380 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
27381
27382 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
27383
27384 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
27385 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
27386 END IF;
27387
27388 --
27389 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
27390 --
27391 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
27392 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
27393 ELSE
27394 ---------------------------------------------------------------------------------------------------
27395 -- 4262811a Switch Sign
27396 ---------------------------------------------------------------------------------------------------
27397 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
27398 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
27399 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
27400 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
27401 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
27402 -- 5132302
27403 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
27404 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
27405
27406 END IF;
27407
27408 -- 4955764
27409 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
27410 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
27414 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
27411
27412
27413 XLA_AE_LINES_PKG.ValidateCurrentLine;
27415
27416 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
27417 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
27418 ,p_balance_type_code => l_balance_type_code);
27419
27420 END IF;
27421
27422 -----------------------------------------------------------------------------------------
27423 -- 4262811 Multiperiod Accounting
27424 -----------------------------------------------------------------------------------------
27425 -- No MPA option is assigned.
27426
27427
27428 END IF;
27429 END IF;
27430 --
27431
27432 --
27433 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
27434 trace
27435 (p_msg => 'END of AcctLineType_202'
27436 ,p_level => C_LEVEL_PROCEDURE
27437 ,p_module => l_log_module);
27438 END IF;
27439 --
27440 EXCEPTION
27441 WHEN xla_exceptions_pkg.application_exception THEN
27442 RAISE;
27443 WHEN OTHERS THEN
27444 xla_exceptions_pkg.raise_message
27445 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_202');
27446 END AcctLineType_202;
27447 --
27448
27449 ---------------------------------------
27450 --
27451 -- PRIVATE FUNCTION
27452 -- AcctLineType_203
27453 --
27454 ---------------------------------------
27455 PROCEDURE AcctLineType_203 (
27456 p_application_id IN NUMBER
27457 ,p_event_id IN NUMBER
27458 ,p_calculate_acctd_flag IN VARCHAR2
27459 ,p_calculate_g_l_flag IN VARCHAR2
27460 ,p_actual_flag IN OUT VARCHAR2
27461 ,p_balance_type_code OUT VARCHAR2
27462 ,p_gain_or_loss_ref OUT VARCHAR2
27463
27464 --Period Close Date
27465 , p_source_1 IN DATE
27466 --Generated Code Combination Identifier
27467 , p_source_5 IN NUMBER
27468 --Asset Cost Account
27469 , p_source_11 IN VARCHAR2
27470 --Expense Account Code Combination Identifier
27471 , p_source_31 IN NUMBER
27472 --Default Code Combination Identifier
27473 , p_source_32 IN NUMBER
27474 --Adjustment Type
27475 , p_source_48 IN VARCHAR2
27476 --Transaction Header Identifier
27477 , p_source_49 IN NUMBER
27478 --Adjustment Line Identifier
27479 , p_source_50 IN NUMBER
27480 --Distribution Type Code
27481 , p_source_51 IN VARCHAR2
27482 --Entered Amount
27483 , p_source_52 IN NUMBER
27484 --Currency Code
27485 , p_source_53 IN VARCHAR2
27486 )
27487 IS
27488
27489 l_component_type VARCHAR2(80);
27490 l_component_code VARCHAR2(30);
27491 l_component_type_code VARCHAR2(1);
27492 l_component_appl_id INTEGER;
27493 l_amb_context_code VARCHAR2(30);
27494 l_entity_code VARCHAR2(30);
27495 l_event_class_code VARCHAR2(30);
27496 l_ae_header_id NUMBER;
27497 l_event_type_code VARCHAR2(30);
27498 l_line_definition_code VARCHAR2(30);
27499 l_line_definition_owner_code VARCHAR2(1);
27500 --
27501 -- adr variables
27502 l_segment VARCHAR2(30);
27503 l_ccid NUMBER;
27504 l_adr_transaction_coa_id NUMBER;
27505 l_adr_accounting_coa_id NUMBER;
27506 l_adr_flexfield_segment_code VARCHAR2(30);
27507 l_adr_flex_value_set_id NUMBER;
27508 l_adr_value_type_code VARCHAR2(30);
27509 l_adr_value_combination_id NUMBER;
27510 l_adr_value_segment_code VARCHAR2(30);
27511
27512 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
27513 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
27514 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
27515 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
27516
27517 -- 4262811 Variables ------------------------------------------------------------------------------------------
27518 l_entered_amt_idx NUMBER;
27519 l_accted_amt_idx NUMBER;
27520 l_acc_rev_flag VARCHAR2(1);
27521 l_accrual_line_num NUMBER;
27522 l_tmp_amt NUMBER;
27523 l_acc_rev_natural_side_code VARCHAR2(1);
27524
27525 l_num_entries NUMBER;
27526 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
27527 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
27528 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
27529 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
27530 l_recog_line_1 NUMBER;
27531 l_recog_line_2 NUMBER;
27532
27533 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
27534 l_bflow_applied_to_amt NUMBER; -- 5132302
27535 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
27536
27537 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
27538
27539 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
27540 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
27541
27545 --
27542 ---------------------------------------------------------------------------------------------------------------
27543
27544
27546 -- bulk performance
27547 --
27548 l_balance_type_code VARCHAR2(1);
27549 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
27550 l_log_module VARCHAR2(240);
27551
27552 --
27553 -- Upgrade strategy
27554 --
27555 l_actual_upg_option VARCHAR2(1);
27556 l_enc_upg_option VARCHAR2(1);
27557
27558 --
27559 BEGIN
27560 --
27561 IF g_log_enabled THEN
27562 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_203';
27563 END IF;
27564 --
27565 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
27566
27567 trace
27568 (p_msg => 'BEGIN of AcctLineType_203'
27569 ,p_level => C_LEVEL_PROCEDURE
27570 ,p_module => l_log_module);
27571
27572 END IF;
27573 --
27574 l_component_type := 'AMB_JLT';
27575 l_component_code := 'FA_ADJ_COST';
27576 l_component_type_code := 'S';
27577 l_component_appl_id := 140;
27578 l_amb_context_code := 'DEFAULT';
27579 l_entity_code := 'TRANSACTIONS';
27580 l_event_class_code := 'ADJUSTMENTS';
27581 l_event_type_code := 'ADJUSTMENTS_ALL';
27582 l_line_definition_owner_code := 'S';
27583 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADJUST2';
27584 --
27585 l_balance_type_code := 'A';
27586 l_segment := NULL;
27587 l_ccid := NULL;
27588 l_adr_transaction_coa_id := NULL;
27589 l_adr_accounting_coa_id := NULL;
27590 l_adr_flexfield_segment_code := NULL;
27591 l_adr_flex_value_set_id := NULL;
27592 l_adr_value_type_code := NULL;
27593 l_adr_value_combination_id := NULL;
27594 l_adr_value_segment_code := NULL;
27595
27596 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
27597 l_bflow_class_code := ''; -- 4219869 Business Flow
27598 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
27599 l_budgetary_control_flag := 'N';
27600
27601 l_bflow_applied_to_amt_idx := NULL; -- 5132302
27602 l_bflow_applied_to_amt := NULL; -- 5132302
27603 l_entered_amt_idx := NULL; -- 4262811
27604 l_accted_amt_idx := NULL; -- 4262811
27605 l_acc_rev_flag := NULL; -- 4262811
27606 l_accrual_line_num := NULL; -- 4262811
27607 l_tmp_amt := NULL; -- 4262811
27608 --
27609
27610 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
27611 l_balance_type_code <> 'B' THEN
27612 IF NVL(p_source_48,'
27613 ') = 'COST'
27614 THEN
27615
27616 --
27617 XLA_AE_LINES_PKG.SetNewLine;
27618
27619 p_balance_type_code := l_balance_type_code;
27620 -- set the flag so later we will know whether the gain loss line needs to be created
27621
27622 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
27623 p_actual_flag :='A';
27624 END IF;
27625
27626 --
27627 -- bulk performance
27628 --
27629 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
27630 p_header_num => 0); -- 4262811
27631 --
27632 -- set accounting line options
27633 --
27634 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
27635 p_natural_side_code => 'D'
27636 , p_gain_or_loss_flag => 'N'
27637 , p_gl_transfer_mode_code => 'S'
27638 , p_acct_entry_type_code => 'A'
27639 , p_switch_side_flag => 'Y'
27640 , p_merge_duplicate_code => 'N'
27641 );
27642 --
27643 l_acc_rev_natural_side_code := 'C'; -- 4262811
27644 --
27645 --
27646 -- set accounting line type info
27647 --
27648 xla_ae_lines_pkg.SetAcctLineType
27649 (p_component_type => l_component_type
27650 ,p_event_type_code => l_event_type_code
27651 ,p_line_definition_owner_code => l_line_definition_owner_code
27652 ,p_line_definition_code => l_line_definition_code
27653 ,p_accounting_line_code => l_component_code
27654 ,p_accounting_line_type_code => l_component_type_code
27655 ,p_accounting_line_appl_id => l_component_appl_id
27656 ,p_amb_context_code => l_amb_context_code
27657 ,p_entity_code => l_entity_code
27658 ,p_event_class_code => l_event_class_code);
27659 --
27660 -- set accounting class
27661 --
27662 xla_ae_lines_pkg.SetAcctClass(
27663 p_accounting_class_code => 'ASSET'
27664 , p_ae_header_id => l_ae_header_id
27665 );
27666
27667 --
27668 -- set rounding class
27669 --
27670 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
27671 'ASSET';
27672
27673 --
27674 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
27678 --
27675 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
27676 --
27677 -- bulk performance
27679 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
27680
27681 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
27682 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
27683
27684 -- 4955764
27685 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
27686 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
27687
27688 -- 4458381 Public Sector Enh
27689
27690 --
27691 -- set accounting attributes for the line type
27692 --
27693 l_entered_amt_idx := 4;
27694 l_accted_amt_idx := 6;
27695 l_bflow_applied_to_amt_idx := NULL; -- 5132302
27696 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
27697 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
27698 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
27699 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
27700 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
27701 l_rec_acct_attrs.array_char_value(3) := p_source_51;
27702 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
27703 l_rec_acct_attrs.array_num_value(4) := p_source_52;
27704 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
27705 l_rec_acct_attrs.array_char_value(5) := p_source_53;
27706 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
27707 l_rec_acct_attrs.array_num_value(6) := p_source_52;
27708
27709 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
27710 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
27711
27712 ---------------------------------------------------------------------------------------------------------------
27713 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
27714 ---------------------------------------------------------------------------------------------------------------
27715 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
27716
27717 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
27718 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
27719
27720 IF xla_accounting_cache_pkg.GetValueChar
27721 (p_source_code => 'LEDGER_CATEGORY_CODE'
27722 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
27723 AND l_bflow_method_code = 'PRIOR_ENTRY'
27724 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
27725 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
27726 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
27727 )
27728 THEN
27729 xla_ae_lines_pkg.BflowUpgEntry
27730 (p_business_method_code => l_bflow_method_code
27731 ,p_business_class_code => l_bflow_class_code
27732 ,p_balance_type => l_balance_type_code);
27733 ELSE
27734 NULL;
27735 -- No business flow processing for business flow method of NONE.
27736 END IF;
27737
27738 --
27739 -- call analytical criteria
27740 --
27741
27742 --
27743 -- call description
27744 --
27745
27746 xla_ae_lines_pkg.SetLineDescription(
27747 p_ae_header_id => l_ae_header_id
27748 ,p_description => Description_10 (
27749 p_application_id => p_application_id
27750 , p_ae_header_id => l_ae_header_id
27751 , p_source_1 => p_source_1
27752 )
27753 );
27754
27755
27756 --
27757 -- call ADRs
27758 -- Bug 4922099
27759 --
27760 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
27761 (NVL(l_actual_upg_option, 'N') = 'O') OR
27762 (NVL(l_enc_upg_option, 'N') = 'O')
27763 )
27764 THEN
27765 NULL;
27766 --
27767 --
27768
27769 l_ccid := AcctDerRule_174(
27770 p_application_id => p_application_id
27771 , p_ae_header_id => l_ae_header_id
27772 , p_source_5 => p_source_5
27773 , p_source_32 => p_source_32
27774 , x_transaction_coa_id => l_adr_transaction_coa_id
27775 , x_accounting_coa_id => l_adr_accounting_coa_id
27776 , x_value_type_code => l_adr_value_type_code
27777 , p_side => 'NA'
27778 );
27779
27780 xla_ae_lines_pkg.set_ccid(
27781 p_code_combination_id => l_ccid
27782 , p_value_type_code => l_adr_value_type_code
27783 , p_transaction_coa_id => l_adr_transaction_coa_id
27784 , p_accounting_coa_id => l_adr_accounting_coa_id
27785 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
27786 , p_adr_type_code => 'S'
27787 , p_component_type => l_component_type
27788 , p_component_code => l_component_code
27789 , p_component_type_code => l_component_type_code
27790 , p_component_appl_id => l_component_appl_id
27794
27791 , p_amb_context_code => l_amb_context_code
27792 , p_side => 'NA'
27793 );
27795
27796 l_segment := AcctDerRule_149(
27797 p_application_id => p_application_id
27798 , p_ae_header_id => l_ae_header_id
27799 , p_source_5 => p_source_5
27800 , p_source_11 => p_source_11
27801 , x_transaction_coa_id => l_adr_transaction_coa_id
27802 , x_accounting_coa_id => l_adr_accounting_coa_id
27803 , x_flexfield_segment_code => l_adr_flexfield_segment_code
27804 , x_flex_value_set_id => l_adr_flex_value_set_id
27805 , x_value_type_code => l_adr_value_type_code
27806 , x_value_combination_id => l_adr_value_combination_id
27807 , x_value_segment_code => l_adr_value_segment_code
27808 , p_side => 'NA'
27809 , p_override_seg_flag => 'Y'
27810 );
27811
27812 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
27813
27814 xla_ae_lines_pkg.set_segment(
27815 p_to_segment_code => 'GL_ACCOUNT'
27816 , p_segment_value => l_segment
27817 , p_from_segment_code => l_adr_value_segment_code
27818 , p_from_combination_id => l_adr_value_combination_id
27819 , p_value_type_code => l_adr_value_type_code
27820 , p_transaction_coa_id => l_adr_transaction_coa_id
27821 , p_accounting_coa_id => l_adr_accounting_coa_id
27822 , p_flexfield_segment_code => l_adr_flexfield_segment_code
27823 , p_flex_value_set_id => l_adr_flex_value_set_id
27824 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
27825 , p_adr_type_code => 'S'
27826 , p_component_type => l_component_type
27827 , p_component_code => l_component_code
27828 , p_component_type_code => l_component_type_code
27829 , p_component_appl_id => l_component_appl_id
27830 , p_amb_context_code => l_amb_context_code
27831 , p_entity_code => 'TRANSACTIONS'
27832 , p_event_class_code => 'ADJUSTMENTS'
27833 , p_side => 'NA'
27834 );
27835
27836 END IF;
27837
27838 l_segment := AcctDerRule_169(
27839 p_application_id => p_application_id
27840 , p_ae_header_id => l_ae_header_id
27841 , p_source_5 => p_source_5
27842 , p_source_31 => p_source_31
27843 , x_transaction_coa_id => l_adr_transaction_coa_id
27844 , x_accounting_coa_id => l_adr_accounting_coa_id
27845 , x_flexfield_segment_code => l_adr_flexfield_segment_code
27846 , x_flex_value_set_id => l_adr_flex_value_set_id
27847 , x_value_type_code => l_adr_value_type_code
27848 , x_value_combination_id => l_adr_value_combination_id
27849 , x_value_segment_code => l_adr_value_segment_code
27850 , p_side => 'NA'
27851 , p_override_seg_flag => 'Y'
27852 );
27853
27854 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
27855
27856 xla_ae_lines_pkg.set_segment(
27857 p_to_segment_code => 'GL_BALANCING'
27858 , p_segment_value => l_segment
27859 , p_from_segment_code => l_adr_value_segment_code
27860 , p_from_combination_id => l_adr_value_combination_id
27861 , p_value_type_code => l_adr_value_type_code
27862 , p_transaction_coa_id => l_adr_transaction_coa_id
27863 , p_accounting_coa_id => l_adr_accounting_coa_id
27864 , p_flexfield_segment_code => l_adr_flexfield_segment_code
27865 , p_flex_value_set_id => l_adr_flex_value_set_id
27866 , p_adr_code => 'FA_EXPENSE_ACCT'
27867 , p_adr_type_code => 'S'
27868 , p_component_type => l_component_type
27869 , p_component_code => l_component_code
27870 , p_component_type_code => l_component_type_code
27871 , p_component_appl_id => l_component_appl_id
27872 , p_amb_context_code => l_amb_context_code
27873 , p_entity_code => 'TRANSACTIONS'
27874 , p_event_class_code => 'ADJUSTMENTS'
27875 , p_side => 'NA'
27876 );
27877
27878 END IF;
27879
27880 --
27881 --
27882 END IF;
27883 --
27884 -- Bug 4922099
27885 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
27886 (NVL(l_enc_upg_option, 'N') = 'O')
27887 ) AND
27888 (l_bflow_method_code = 'PRIOR_ENTRY')
27889 )
27890 THEN
27891 IF
27892 --
27893 1 = 2
27894 --
27895 THEN
27896 xla_accounting_err_pkg.build_message
27897 (p_appli_s_name => 'XLA'
27898 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
27899 ,p_token_1 => 'LINE_NUMBER'
27900 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
27901 ,p_token_2 => 'LINE_TYPE_NAME'
27905 ,l_component_type_code
27902 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
27903 l_component_type
27904 ,l_component_code
27906 ,l_component_appl_id
27907 ,l_amb_context_code
27908 ,l_entity_code
27909 ,l_event_class_code
27910 )
27911 ,p_token_3 => 'OWNER'
27912 ,p_value_3 => xla_lookups_pkg.get_meaning(
27913 p_lookup_type => 'XLA_OWNER_TYPE'
27914 ,p_lookup_code => l_component_type_code
27915 )
27916 ,p_token_4 => 'PRODUCT_NAME'
27917 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
27918 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
27919 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
27920 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
27921 ,p_ae_header_id => NULL
27922 );
27923
27924 IF (C_LEVEL_ERROR>= g_log_level) THEN
27925 trace
27926 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
27927 ,p_level => C_LEVEL_ERROR
27928 ,p_module => l_log_module);
27929 END IF;
27930 END IF;
27931 END IF;
27932 --
27933 --
27934 ------------------------------------------------------------------------------------------------
27935 -- 4219869 Business Flow
27936 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
27937 -- Prior Entry. Currently, the following code is always generated.
27938 ------------------------------------------------------------------------------------------------
27939 XLA_AE_LINES_PKG.ValidateCurrentLine;
27940
27941 ------------------------------------------------------------------------------------
27942 -- 4219869 Business Flow
27943 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
27944 ------------------------------------------------------------------------------------
27945 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
27946
27947 ----------------------------------------------------------------------------------
27948 -- 4219869 Business Flow
27949 -- Update journal entry status -- Need to generate this within IF <condition>
27950 ----------------------------------------------------------------------------------
27951 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
27952 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
27953 ,p_balance_type_code => l_balance_type_code
27954 );
27955
27956 -------------------------------------------------------------------------------------------
27957 -- 4262811 - Generate the Accrual Reversal lines
27958 -------------------------------------------------------------------------------------------
27959 BEGIN
27960 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
27961 (g_array_event(p_event_id).array_value_num('header_index'));
27962 IF l_acc_rev_flag IS NULL THEN
27963 l_acc_rev_flag := 'N';
27964 END IF;
27965 EXCEPTION
27966 WHEN OTHERS THEN
27967 l_acc_rev_flag := 'N';
27968 END;
27969 --
27970 IF (l_acc_rev_flag = 'Y') THEN
27971
27972 -- 4645092 ------------------------------------------------------------------------------
27973 -- To allow MPA report to determine if it should generate report process
27974 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
27975 ------------------------------------------------------------------------------------------
27976
27977 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
27978 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
27979 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
27980 -- call ADRs
27981 -- Bug 4922099
27982 --
27983 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
27984 (NVL(l_actual_upg_option, 'N') = 'O') OR
27985 (NVL(l_enc_upg_option, 'N') = 'O')
27986 )
27987 THEN
27988 NULL;
27989 --
27990 --
27991
27992 l_ccid := AcctDerRule_174(
27993 p_application_id => p_application_id
27994 , p_ae_header_id => l_ae_header_id
27995 , p_source_5 => p_source_5
27996 , p_source_32 => p_source_32
28000 , p_side => 'NA'
27997 , x_transaction_coa_id => l_adr_transaction_coa_id
27998 , x_accounting_coa_id => l_adr_accounting_coa_id
27999 , x_value_type_code => l_adr_value_type_code
28001 );
28002
28003 xla_ae_lines_pkg.set_ccid(
28004 p_code_combination_id => l_ccid
28005 , p_value_type_code => l_adr_value_type_code
28006 , p_transaction_coa_id => l_adr_transaction_coa_id
28007 , p_accounting_coa_id => l_adr_accounting_coa_id
28008 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
28009 , p_adr_type_code => 'S'
28010 , p_component_type => l_component_type
28011 , p_component_code => l_component_code
28012 , p_component_type_code => l_component_type_code
28013 , p_component_appl_id => l_component_appl_id
28014 , p_amb_context_code => l_amb_context_code
28015 , p_side => 'NA'
28016 );
28017
28018
28019 l_segment := AcctDerRule_149(
28020 p_application_id => p_application_id
28021 , p_ae_header_id => l_ae_header_id
28022 , p_source_5 => p_source_5
28023 , p_source_11 => p_source_11
28024 , x_transaction_coa_id => l_adr_transaction_coa_id
28025 , x_accounting_coa_id => l_adr_accounting_coa_id
28026 , x_flexfield_segment_code => l_adr_flexfield_segment_code
28027 , x_flex_value_set_id => l_adr_flex_value_set_id
28028 , x_value_type_code => l_adr_value_type_code
28029 , x_value_combination_id => l_adr_value_combination_id
28030 , x_value_segment_code => l_adr_value_segment_code
28031 , p_side => 'NA'
28032 , p_override_seg_flag => 'Y'
28033 );
28034
28035 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
28036
28037 xla_ae_lines_pkg.set_segment(
28038 p_to_segment_code => 'GL_ACCOUNT'
28039 , p_segment_value => l_segment
28040 , p_from_segment_code => l_adr_value_segment_code
28041 , p_from_combination_id => l_adr_value_combination_id
28042 , p_value_type_code => l_adr_value_type_code
28043 , p_transaction_coa_id => l_adr_transaction_coa_id
28044 , p_accounting_coa_id => l_adr_accounting_coa_id
28045 , p_flexfield_segment_code => l_adr_flexfield_segment_code
28046 , p_flex_value_set_id => l_adr_flex_value_set_id
28047 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
28048 , p_adr_type_code => 'S'
28049 , p_component_type => l_component_type
28050 , p_component_code => l_component_code
28051 , p_component_type_code => l_component_type_code
28052 , p_component_appl_id => l_component_appl_id
28053 , p_amb_context_code => l_amb_context_code
28054 , p_entity_code => 'TRANSACTIONS'
28055 , p_event_class_code => 'ADJUSTMENTS'
28056 , p_side => 'NA'
28057 );
28058
28059 END IF;
28060
28061 l_segment := AcctDerRule_169(
28062 p_application_id => p_application_id
28063 , p_ae_header_id => l_ae_header_id
28064 , p_source_5 => p_source_5
28065 , p_source_31 => p_source_31
28066 , x_transaction_coa_id => l_adr_transaction_coa_id
28067 , x_accounting_coa_id => l_adr_accounting_coa_id
28068 , x_flexfield_segment_code => l_adr_flexfield_segment_code
28069 , x_flex_value_set_id => l_adr_flex_value_set_id
28070 , x_value_type_code => l_adr_value_type_code
28071 , x_value_combination_id => l_adr_value_combination_id
28072 , x_value_segment_code => l_adr_value_segment_code
28073 , p_side => 'NA'
28074 , p_override_seg_flag => 'Y'
28075 );
28076
28077 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
28078
28079 xla_ae_lines_pkg.set_segment(
28080 p_to_segment_code => 'GL_BALANCING'
28081 , p_segment_value => l_segment
28082 , p_from_segment_code => l_adr_value_segment_code
28083 , p_from_combination_id => l_adr_value_combination_id
28084 , p_value_type_code => l_adr_value_type_code
28085 , p_transaction_coa_id => l_adr_transaction_coa_id
28086 , p_accounting_coa_id => l_adr_accounting_coa_id
28087 , p_flexfield_segment_code => l_adr_flexfield_segment_code
28088 , p_flex_value_set_id => l_adr_flex_value_set_id
28089 , p_adr_code => 'FA_EXPENSE_ACCT'
28090 , p_adr_type_code => 'S'
28091 , p_component_type => l_component_type
28092 , p_component_code => l_component_code
28093 , p_component_type_code => l_component_type_code
28094 , p_component_appl_id => l_component_appl_id
28095 , p_amb_context_code => l_amb_context_code
28096 , p_entity_code => 'TRANSACTIONS'
28097 , p_event_class_code => 'ADJUSTMENTS'
28098 , p_side => 'NA'
28099 );
28100
28101 END IF;
28102
28103 --
28104 --
28105 END IF;
28109 --
28106
28107 --
28108 -- Update the line information that should be overwritten
28110 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
28111 p_header_num => 1);
28112 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
28113
28114 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
28115
28116 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
28117 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
28118 END IF;
28119
28120 --
28121 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
28122 --
28123 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
28124 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
28125 ELSE
28126 ---------------------------------------------------------------------------------------------------
28127 -- 4262811a Switch Sign
28128 ---------------------------------------------------------------------------------------------------
28129 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
28130 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
28131 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
28132 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
28133 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
28134 -- 5132302
28135 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
28136 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
28137
28138 END IF;
28139
28140 -- 4955764
28141 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
28142 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
28143
28144
28145 XLA_AE_LINES_PKG.ValidateCurrentLine;
28146 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
28147
28148 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
28149 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
28150 ,p_balance_type_code => l_balance_type_code);
28151
28152 END IF;
28153
28154 -----------------------------------------------------------------------------------------
28155 -- 4262811 Multiperiod Accounting
28156 -----------------------------------------------------------------------------------------
28157 -- No MPA option is assigned.
28158
28159
28160 END IF;
28161 END IF;
28162 --
28163
28164 --
28165 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
28166 trace
28167 (p_msg => 'END of AcctLineType_203'
28168 ,p_level => C_LEVEL_PROCEDURE
28169 ,p_module => l_log_module);
28170 END IF;
28171 --
28172 EXCEPTION
28173 WHEN xla_exceptions_pkg.application_exception THEN
28174 RAISE;
28175 WHEN OTHERS THEN
28176 xla_exceptions_pkg.raise_message
28177 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_203');
28178 END AcctLineType_203;
28179 --
28180
28181 ---------------------------------------
28182 --
28183 -- PRIVATE FUNCTION
28184 -- AcctLineType_204
28185 --
28186 ---------------------------------------
28187 PROCEDURE AcctLineType_204 (
28188 p_application_id IN NUMBER
28189 ,p_event_id IN NUMBER
28190 ,p_calculate_acctd_flag IN VARCHAR2
28191 ,p_calculate_g_l_flag IN VARCHAR2
28192 ,p_actual_flag IN OUT VARCHAR2
28193 ,p_balance_type_code OUT VARCHAR2
28194 ,p_gain_or_loss_ref OUT VARCHAR2
28195
28196 --Period Close Date
28197 , p_source_1 IN DATE
28198 --Generated Code Combination Identifier
28199 , p_source_5 IN NUMBER
28200 --Payables Code Combination Identifier
28201 , p_source_8 IN NUMBER
28202 --Asset Clearing Account
28203 , p_source_10 IN VARCHAR2
28204 --Expense Account Code Combination Identifier
28205 , p_source_31 IN NUMBER
28206 --Default Code Combination Identifier
28207 , p_source_32 IN NUMBER
28208 --Adjustment Type
28209 , p_source_48 IN VARCHAR2
28210 --Transaction Header Identifier
28211 , p_source_49 IN NUMBER
28212 --Adjustment Line Identifier
28213 , p_source_50 IN NUMBER
28214 --Distribution Type Code
28215 , p_source_51 IN VARCHAR2
28216 --Entered Amount
28217 , p_source_52 IN NUMBER
28218 --Currency Code
28219 , p_source_53 IN VARCHAR2
28220 )
28221 IS
28222
28223 l_component_type VARCHAR2(80);
28224 l_component_code VARCHAR2(30);
28225 l_component_type_code VARCHAR2(1);
28226 l_component_appl_id INTEGER;
28227 l_amb_context_code VARCHAR2(30);
28228 l_entity_code VARCHAR2(30);
28229 l_event_class_code VARCHAR2(30);
28230 l_ae_header_id NUMBER;
28234 --
28231 l_event_type_code VARCHAR2(30);
28232 l_line_definition_code VARCHAR2(30);
28233 l_line_definition_owner_code VARCHAR2(1);
28235 -- adr variables
28236 l_segment VARCHAR2(30);
28237 l_ccid NUMBER;
28238 l_adr_transaction_coa_id NUMBER;
28239 l_adr_accounting_coa_id NUMBER;
28240 l_adr_flexfield_segment_code VARCHAR2(30);
28241 l_adr_flex_value_set_id NUMBER;
28242 l_adr_value_type_code VARCHAR2(30);
28243 l_adr_value_combination_id NUMBER;
28244 l_adr_value_segment_code VARCHAR2(30);
28245
28246 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
28247 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
28248 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
28249 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
28250
28251 -- 4262811 Variables ------------------------------------------------------------------------------------------
28252 l_entered_amt_idx NUMBER;
28253 l_accted_amt_idx NUMBER;
28254 l_acc_rev_flag VARCHAR2(1);
28255 l_accrual_line_num NUMBER;
28256 l_tmp_amt NUMBER;
28257 l_acc_rev_natural_side_code VARCHAR2(1);
28258
28259 l_num_entries NUMBER;
28260 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
28261 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
28262 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
28263 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
28264 l_recog_line_1 NUMBER;
28265 l_recog_line_2 NUMBER;
28266
28267 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
28268 l_bflow_applied_to_amt NUMBER; -- 5132302
28269 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
28270
28271 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
28272
28273 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
28274 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
28275
28276 ---------------------------------------------------------------------------------------------------------------
28277
28278
28279 --
28280 -- bulk performance
28281 --
28282 l_balance_type_code VARCHAR2(1);
28283 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
28284 l_log_module VARCHAR2(240);
28285
28286 --
28287 -- Upgrade strategy
28288 --
28289 l_actual_upg_option VARCHAR2(1);
28290 l_enc_upg_option VARCHAR2(1);
28291
28292 --
28293 BEGIN
28294 --
28295 IF g_log_enabled THEN
28296 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_204';
28297 END IF;
28298 --
28299 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
28300
28301 trace
28302 (p_msg => 'BEGIN of AcctLineType_204'
28303 ,p_level => C_LEVEL_PROCEDURE
28304 ,p_module => l_log_module);
28305
28306 END IF;
28307 --
28308 l_component_type := 'AMB_JLT';
28309 l_component_code := 'FA_ADJ_COST_CLEARING';
28310 l_component_type_code := 'S';
28311 l_component_appl_id := 140;
28312 l_amb_context_code := 'DEFAULT';
28313 l_entity_code := 'TRANSACTIONS';
28314 l_event_class_code := 'ADJUSTMENTS';
28315 l_event_type_code := 'ADJUSTMENTS_ALL';
28316 l_line_definition_owner_code := 'S';
28317 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADJUST2';
28318 --
28319 l_balance_type_code := 'A';
28320 l_segment := NULL;
28321 l_ccid := NULL;
28322 l_adr_transaction_coa_id := NULL;
28323 l_adr_accounting_coa_id := NULL;
28324 l_adr_flexfield_segment_code := NULL;
28325 l_adr_flex_value_set_id := NULL;
28326 l_adr_value_type_code := NULL;
28327 l_adr_value_combination_id := NULL;
28328 l_adr_value_segment_code := NULL;
28329
28330 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
28331 l_bflow_class_code := ''; -- 4219869 Business Flow
28332 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
28333 l_budgetary_control_flag := 'N';
28334
28335 l_bflow_applied_to_amt_idx := NULL; -- 5132302
28336 l_bflow_applied_to_amt := NULL; -- 5132302
28337 l_entered_amt_idx := NULL; -- 4262811
28338 l_accted_amt_idx := NULL; -- 4262811
28339 l_acc_rev_flag := NULL; -- 4262811
28340 l_accrual_line_num := NULL; -- 4262811
28341 l_tmp_amt := NULL; -- 4262811
28342 --
28343
28344 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
28345 l_balance_type_code <> 'B' THEN
28346 IF NVL(p_source_48,'
28347 ') = 'COST CLEARING'
28348 THEN
28349
28350 --
28351 XLA_AE_LINES_PKG.SetNewLine;
28352
28353 p_balance_type_code := l_balance_type_code;
28354 -- set the flag so later we will know whether the gain loss line needs to be created
28355
28359
28356 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
28357 p_actual_flag :='A';
28358 END IF;
28360 --
28361 -- bulk performance
28362 --
28363 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
28364 p_header_num => 0); -- 4262811
28365 --
28366 -- set accounting line options
28367 --
28368 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
28369 p_natural_side_code => 'C'
28370 , p_gain_or_loss_flag => 'N'
28371 , p_gl_transfer_mode_code => 'S'
28372 , p_acct_entry_type_code => 'A'
28373 , p_switch_side_flag => 'Y'
28374 , p_merge_duplicate_code => 'N'
28375 );
28376 --
28377 l_acc_rev_natural_side_code := 'D'; -- 4262811
28378 --
28379 --
28380 -- set accounting line type info
28381 --
28382 xla_ae_lines_pkg.SetAcctLineType
28383 (p_component_type => l_component_type
28384 ,p_event_type_code => l_event_type_code
28385 ,p_line_definition_owner_code => l_line_definition_owner_code
28386 ,p_line_definition_code => l_line_definition_code
28387 ,p_accounting_line_code => l_component_code
28388 ,p_accounting_line_type_code => l_component_type_code
28389 ,p_accounting_line_appl_id => l_component_appl_id
28390 ,p_amb_context_code => l_amb_context_code
28391 ,p_entity_code => l_entity_code
28392 ,p_event_class_code => l_event_class_code);
28393 --
28394 -- set accounting class
28395 --
28396 xla_ae_lines_pkg.SetAcctClass(
28397 p_accounting_class_code => 'ASSET'
28398 , p_ae_header_id => l_ae_header_id
28399 );
28400
28401 --
28402 -- set rounding class
28403 --
28404 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
28405 'ASSET';
28406
28407 --
28408 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
28409 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
28410 --
28411 -- bulk performance
28412 --
28413 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
28414
28415 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
28416 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
28417
28418 -- 4955764
28419 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
28420 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
28421
28422 -- 4458381 Public Sector Enh
28423
28424 --
28425 -- set accounting attributes for the line type
28426 --
28427 l_entered_amt_idx := 4;
28428 l_accted_amt_idx := 6;
28429 l_bflow_applied_to_amt_idx := NULL; -- 5132302
28430 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
28431 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
28432 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
28433 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
28434 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
28435 l_rec_acct_attrs.array_char_value(3) := p_source_51;
28436 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
28437 l_rec_acct_attrs.array_num_value(4) := p_source_52;
28438 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
28439 l_rec_acct_attrs.array_char_value(5) := p_source_53;
28440 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
28441 l_rec_acct_attrs.array_num_value(6) := p_source_52;
28442
28443 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
28444 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
28445
28446 ---------------------------------------------------------------------------------------------------------------
28447 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
28448 ---------------------------------------------------------------------------------------------------------------
28449 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
28450
28451 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
28452 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
28453
28454 IF xla_accounting_cache_pkg.GetValueChar
28455 (p_source_code => 'LEDGER_CATEGORY_CODE'
28456 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
28457 AND l_bflow_method_code = 'PRIOR_ENTRY'
28458 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
28459 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
28460 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
28461 )
28462 THEN
28463 xla_ae_lines_pkg.BflowUpgEntry
28464 (p_business_method_code => l_bflow_method_code
28468 NULL;
28465 ,p_business_class_code => l_bflow_class_code
28466 ,p_balance_type => l_balance_type_code);
28467 ELSE
28469 -- No business flow processing for business flow method of NONE.
28470 END IF;
28471
28472 --
28473 -- call analytical criteria
28474 --
28475
28476 --
28477 -- call description
28478 --
28479
28480 xla_ae_lines_pkg.SetLineDescription(
28481 p_ae_header_id => l_ae_header_id
28482 ,p_description => Description_11 (
28483 p_application_id => p_application_id
28484 , p_ae_header_id => l_ae_header_id
28485 , p_source_1 => p_source_1
28486 )
28487 );
28488
28489
28490 --
28491 -- call ADRs
28492 -- Bug 4922099
28493 --
28494 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
28495 (NVL(l_actual_upg_option, 'N') = 'O') OR
28496 (NVL(l_enc_upg_option, 'N') = 'O')
28497 )
28498 THEN
28499 NULL;
28500 --
28501 --
28502
28503 l_ccid := AcctDerRule_173(
28504 p_application_id => p_application_id
28505 , p_ae_header_id => l_ae_header_id
28506 , p_source_5 => p_source_5
28507 , p_source_8 => p_source_8
28508 , p_source_32 => p_source_32
28509 , x_transaction_coa_id => l_adr_transaction_coa_id
28510 , x_accounting_coa_id => l_adr_accounting_coa_id
28511 , x_value_type_code => l_adr_value_type_code
28512 , p_side => 'NA'
28513 );
28514
28515 xla_ae_lines_pkg.set_ccid(
28516 p_code_combination_id => l_ccid
28517 , p_value_type_code => l_adr_value_type_code
28518 , p_transaction_coa_id => l_adr_transaction_coa_id
28519 , p_accounting_coa_id => l_adr_accounting_coa_id
28520 , p_adr_code => 'FA_CAT_COST_CLEARING'
28521 , p_adr_type_code => 'S'
28522 , p_component_type => l_component_type
28523 , p_component_code => l_component_code
28524 , p_component_type_code => l_component_type_code
28525 , p_component_appl_id => l_component_appl_id
28526 , p_amb_context_code => l_amb_context_code
28527 , p_side => 'NA'
28528 );
28529
28530
28531 l_segment := AcctDerRule_148(
28532 p_application_id => p_application_id
28533 , p_ae_header_id => l_ae_header_id
28534 , p_source_5 => p_source_5
28535 , p_source_8 => p_source_8
28536 , p_source_10 => p_source_10
28537 , x_transaction_coa_id => l_adr_transaction_coa_id
28538 , x_accounting_coa_id => l_adr_accounting_coa_id
28539 , x_flexfield_segment_code => l_adr_flexfield_segment_code
28540 , x_flex_value_set_id => l_adr_flex_value_set_id
28541 , x_value_type_code => l_adr_value_type_code
28542 , x_value_combination_id => l_adr_value_combination_id
28543 , x_value_segment_code => l_adr_value_segment_code
28544 , p_side => 'NA'
28545 , p_override_seg_flag => 'Y'
28546 );
28547
28548 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
28549
28550 xla_ae_lines_pkg.set_segment(
28551 p_to_segment_code => 'GL_ACCOUNT'
28552 , p_segment_value => l_segment
28553 , p_from_segment_code => l_adr_value_segment_code
28554 , p_from_combination_id => l_adr_value_combination_id
28555 , p_value_type_code => l_adr_value_type_code
28556 , p_transaction_coa_id => l_adr_transaction_coa_id
28557 , p_accounting_coa_id => l_adr_accounting_coa_id
28558 , p_flexfield_segment_code => l_adr_flexfield_segment_code
28559 , p_flex_value_set_id => l_adr_flex_value_set_id
28560 , p_adr_code => 'FA_CAT_CLR_ACCOUNT_SEGMENT'
28561 , p_adr_type_code => 'S'
28562 , p_component_type => l_component_type
28563 , p_component_code => l_component_code
28564 , p_component_type_code => l_component_type_code
28565 , p_component_appl_id => l_component_appl_id
28566 , p_amb_context_code => l_amb_context_code
28567 , p_entity_code => 'TRANSACTIONS'
28568 , p_event_class_code => 'ADJUSTMENTS'
28569 , p_side => 'NA'
28570 );
28571
28572 END IF;
28573
28574 l_segment := AcctDerRule_170(
28575 p_application_id => p_application_id
28576 , p_ae_header_id => l_ae_header_id
28577 , p_source_5 => p_source_5
28578 , p_source_8 => p_source_8
28579 , p_source_31 => p_source_31
28580 , x_transaction_coa_id => l_adr_transaction_coa_id
28581 , x_accounting_coa_id => l_adr_accounting_coa_id
28582 , x_flexfield_segment_code => l_adr_flexfield_segment_code
28583 , x_flex_value_set_id => l_adr_flex_value_set_id
28584 , x_value_type_code => l_adr_value_type_code
28585 , x_value_combination_id => l_adr_value_combination_id
28586 , x_value_segment_code => l_adr_value_segment_code
28587 , p_side => 'NA'
28588 , p_override_seg_flag => 'Y'
28589 );
28590
28591 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
28592
28593 xla_ae_lines_pkg.set_segment(
28597 , p_from_combination_id => l_adr_value_combination_id
28594 p_to_segment_code => 'GL_BALANCING'
28595 , p_segment_value => l_segment
28596 , p_from_segment_code => l_adr_value_segment_code
28598 , p_value_type_code => l_adr_value_type_code
28599 , p_transaction_coa_id => l_adr_transaction_coa_id
28600 , p_accounting_coa_id => l_adr_accounting_coa_id
28601 , p_flexfield_segment_code => l_adr_flexfield_segment_code
28602 , p_flex_value_set_id => l_adr_flex_value_set_id
28603 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
28604 , p_adr_type_code => 'S'
28605 , p_component_type => l_component_type
28606 , p_component_code => l_component_code
28607 , p_component_type_code => l_component_type_code
28608 , p_component_appl_id => l_component_appl_id
28609 , p_amb_context_code => l_amb_context_code
28610 , p_entity_code => 'TRANSACTIONS'
28611 , p_event_class_code => 'ADJUSTMENTS'
28612 , p_side => 'NA'
28613 );
28614
28615 END IF;
28616
28617 --
28618 --
28619 END IF;
28620 --
28621 -- Bug 4922099
28622 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
28623 (NVL(l_enc_upg_option, 'N') = 'O')
28624 ) AND
28625 (l_bflow_method_code = 'PRIOR_ENTRY')
28626 )
28627 THEN
28628 IF
28629 --
28630 1 = 2
28631 --
28632 THEN
28633 xla_accounting_err_pkg.build_message
28634 (p_appli_s_name => 'XLA'
28635 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
28636 ,p_token_1 => 'LINE_NUMBER'
28637 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
28638 ,p_token_2 => 'LINE_TYPE_NAME'
28639 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
28640 l_component_type
28641 ,l_component_code
28642 ,l_component_type_code
28643 ,l_component_appl_id
28644 ,l_amb_context_code
28645 ,l_entity_code
28646 ,l_event_class_code
28647 )
28648 ,p_token_3 => 'OWNER'
28649 ,p_value_3 => xla_lookups_pkg.get_meaning(
28650 p_lookup_type => 'XLA_OWNER_TYPE'
28651 ,p_lookup_code => l_component_type_code
28652 )
28653 ,p_token_4 => 'PRODUCT_NAME'
28654 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
28655 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
28656 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
28657 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
28658 ,p_ae_header_id => NULL
28659 );
28660
28661 IF (C_LEVEL_ERROR>= g_log_level) THEN
28662 trace
28663 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
28664 ,p_level => C_LEVEL_ERROR
28665 ,p_module => l_log_module);
28666 END IF;
28667 END IF;
28668 END IF;
28669 --
28670 --
28671 ------------------------------------------------------------------------------------------------
28672 -- 4219869 Business Flow
28673 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
28674 -- Prior Entry. Currently, the following code is always generated.
28675 ------------------------------------------------------------------------------------------------
28676 XLA_AE_LINES_PKG.ValidateCurrentLine;
28677
28678 ------------------------------------------------------------------------------------
28679 -- 4219869 Business Flow
28680 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
28681 ------------------------------------------------------------------------------------
28682 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
28683
28684 ----------------------------------------------------------------------------------
28685 -- 4219869 Business Flow
28686 -- Update journal entry status -- Need to generate this within IF <condition>
28687 ----------------------------------------------------------------------------------
28691 );
28688 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
28689 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
28690 ,p_balance_type_code => l_balance_type_code
28692
28693 -------------------------------------------------------------------------------------------
28694 -- 4262811 - Generate the Accrual Reversal lines
28695 -------------------------------------------------------------------------------------------
28696 BEGIN
28697 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
28698 (g_array_event(p_event_id).array_value_num('header_index'));
28699 IF l_acc_rev_flag IS NULL THEN
28700 l_acc_rev_flag := 'N';
28701 END IF;
28702 EXCEPTION
28703 WHEN OTHERS THEN
28704 l_acc_rev_flag := 'N';
28705 END;
28706 --
28707 IF (l_acc_rev_flag = 'Y') THEN
28708
28709 -- 4645092 ------------------------------------------------------------------------------
28710 -- To allow MPA report to determine if it should generate report process
28711 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
28712 ------------------------------------------------------------------------------------------
28713
28714 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
28715 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
28716 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
28717 -- call ADRs
28718 -- Bug 4922099
28719 --
28720 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
28721 (NVL(l_actual_upg_option, 'N') = 'O') OR
28722 (NVL(l_enc_upg_option, 'N') = 'O')
28723 )
28724 THEN
28725 NULL;
28726 --
28727 --
28728
28729 l_ccid := AcctDerRule_173(
28730 p_application_id => p_application_id
28731 , p_ae_header_id => l_ae_header_id
28732 , p_source_5 => p_source_5
28733 , p_source_8 => p_source_8
28734 , p_source_32 => p_source_32
28735 , x_transaction_coa_id => l_adr_transaction_coa_id
28736 , x_accounting_coa_id => l_adr_accounting_coa_id
28737 , x_value_type_code => l_adr_value_type_code
28738 , p_side => 'NA'
28739 );
28740
28741 xla_ae_lines_pkg.set_ccid(
28742 p_code_combination_id => l_ccid
28743 , p_value_type_code => l_adr_value_type_code
28744 , p_transaction_coa_id => l_adr_transaction_coa_id
28745 , p_accounting_coa_id => l_adr_accounting_coa_id
28746 , p_adr_code => 'FA_CAT_COST_CLEARING'
28747 , p_adr_type_code => 'S'
28748 , p_component_type => l_component_type
28749 , p_component_code => l_component_code
28750 , p_component_type_code => l_component_type_code
28751 , p_component_appl_id => l_component_appl_id
28752 , p_amb_context_code => l_amb_context_code
28753 , p_side => 'NA'
28754 );
28755
28756
28757 l_segment := AcctDerRule_148(
28758 p_application_id => p_application_id
28759 , p_ae_header_id => l_ae_header_id
28760 , p_source_5 => p_source_5
28761 , p_source_8 => p_source_8
28762 , p_source_10 => p_source_10
28763 , x_transaction_coa_id => l_adr_transaction_coa_id
28764 , x_accounting_coa_id => l_adr_accounting_coa_id
28765 , x_flexfield_segment_code => l_adr_flexfield_segment_code
28766 , x_flex_value_set_id => l_adr_flex_value_set_id
28767 , x_value_type_code => l_adr_value_type_code
28768 , x_value_combination_id => l_adr_value_combination_id
28769 , x_value_segment_code => l_adr_value_segment_code
28770 , p_side => 'NA'
28771 , p_override_seg_flag => 'Y'
28772 );
28773
28774 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
28775
28776 xla_ae_lines_pkg.set_segment(
28777 p_to_segment_code => 'GL_ACCOUNT'
28778 , p_segment_value => l_segment
28779 , p_from_segment_code => l_adr_value_segment_code
28780 , p_from_combination_id => l_adr_value_combination_id
28781 , p_value_type_code => l_adr_value_type_code
28782 , p_transaction_coa_id => l_adr_transaction_coa_id
28783 , p_accounting_coa_id => l_adr_accounting_coa_id
28784 , p_flexfield_segment_code => l_adr_flexfield_segment_code
28785 , p_flex_value_set_id => l_adr_flex_value_set_id
28786 , p_adr_code => 'FA_CAT_CLR_ACCOUNT_SEGMENT'
28787 , p_adr_type_code => 'S'
28788 , p_component_type => l_component_type
28789 , p_component_code => l_component_code
28790 , p_component_type_code => l_component_type_code
28791 , p_component_appl_id => l_component_appl_id
28792 , p_amb_context_code => l_amb_context_code
28793 , p_entity_code => 'TRANSACTIONS'
28794 , p_event_class_code => 'ADJUSTMENTS'
28795 , p_side => 'NA'
28796 );
28797
28798 END IF;
28799
28800 l_segment := AcctDerRule_170(
28801 p_application_id => p_application_id
28805 , p_source_31 => p_source_31
28802 , p_ae_header_id => l_ae_header_id
28803 , p_source_5 => p_source_5
28804 , p_source_8 => p_source_8
28806 , x_transaction_coa_id => l_adr_transaction_coa_id
28807 , x_accounting_coa_id => l_adr_accounting_coa_id
28808 , x_flexfield_segment_code => l_adr_flexfield_segment_code
28809 , x_flex_value_set_id => l_adr_flex_value_set_id
28810 , x_value_type_code => l_adr_value_type_code
28811 , x_value_combination_id => l_adr_value_combination_id
28812 , x_value_segment_code => l_adr_value_segment_code
28813 , p_side => 'NA'
28814 , p_override_seg_flag => 'Y'
28815 );
28816
28817 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
28818
28819 xla_ae_lines_pkg.set_segment(
28820 p_to_segment_code => 'GL_BALANCING'
28821 , p_segment_value => l_segment
28822 , p_from_segment_code => l_adr_value_segment_code
28823 , p_from_combination_id => l_adr_value_combination_id
28824 , p_value_type_code => l_adr_value_type_code
28825 , p_transaction_coa_id => l_adr_transaction_coa_id
28826 , p_accounting_coa_id => l_adr_accounting_coa_id
28827 , p_flexfield_segment_code => l_adr_flexfield_segment_code
28828 , p_flex_value_set_id => l_adr_flex_value_set_id
28829 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
28830 , p_adr_type_code => 'S'
28831 , p_component_type => l_component_type
28832 , p_component_code => l_component_code
28833 , p_component_type_code => l_component_type_code
28834 , p_component_appl_id => l_component_appl_id
28835 , p_amb_context_code => l_amb_context_code
28836 , p_entity_code => 'TRANSACTIONS'
28837 , p_event_class_code => 'ADJUSTMENTS'
28838 , p_side => 'NA'
28839 );
28840
28841 END IF;
28842
28843 --
28844 --
28845 END IF;
28846
28847 --
28848 -- Update the line information that should be overwritten
28849 --
28850 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
28851 p_header_num => 1);
28852 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
28853
28854 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
28855
28856 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
28857 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
28858 END IF;
28859
28860 --
28861 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
28862 --
28863 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
28864 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
28865 ELSE
28866 ---------------------------------------------------------------------------------------------------
28867 -- 4262811a Switch Sign
28868 ---------------------------------------------------------------------------------------------------
28869 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
28870 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
28871 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
28872 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
28873 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
28874 -- 5132302
28875 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
28876 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
28877
28878 END IF;
28879
28880 -- 4955764
28881 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
28882 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
28883
28884
28885 XLA_AE_LINES_PKG.ValidateCurrentLine;
28886 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
28887
28888 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
28889 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
28890 ,p_balance_type_code => l_balance_type_code);
28891
28892 END IF;
28893
28894 -----------------------------------------------------------------------------------------
28895 -- 4262811 Multiperiod Accounting
28896 -----------------------------------------------------------------------------------------
28897 -- No MPA option is assigned.
28898
28899
28900 END IF;
28901 END IF;
28902 --
28903
28904 --
28905 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
28906 trace
28907 (p_msg => 'END of AcctLineType_204'
28908 ,p_level => C_LEVEL_PROCEDURE
28909 ,p_module => l_log_module);
28913 WHEN xla_exceptions_pkg.application_exception THEN
28910 END IF;
28911 --
28912 EXCEPTION
28914 RAISE;
28915 WHEN OTHERS THEN
28916 xla_exceptions_pkg.raise_message
28917 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_204');
28918 END AcctLineType_204;
28919 --
28920
28921 ---------------------------------------
28922 --
28923 -- PRIVATE FUNCTION
28924 -- AcctLineType_205
28925 --
28926 ---------------------------------------
28927 PROCEDURE AcctLineType_205 (
28928 p_application_id IN NUMBER
28929 ,p_event_id IN NUMBER
28930 ,p_calculate_acctd_flag IN VARCHAR2
28931 ,p_calculate_g_l_flag IN VARCHAR2
28932 ,p_actual_flag IN OUT VARCHAR2
28933 ,p_balance_type_code OUT VARCHAR2
28934 ,p_gain_or_loss_ref OUT VARCHAR2
28935
28936 --Period Close Date
28937 , p_source_1 IN DATE
28938 --Generated Code Combination Identifier
28939 , p_source_5 IN NUMBER
28940 --Expense Account Code Combination Identifier
28941 , p_source_31 IN NUMBER
28942 --Adjustment Type
28943 , p_source_48 IN VARCHAR2
28944 --Transaction Header Identifier
28945 , p_source_49 IN NUMBER
28946 --Adjustment Line Identifier
28947 , p_source_50 IN NUMBER
28948 --Distribution Type Code
28949 , p_source_51 IN VARCHAR2
28950 --Entered Amount
28951 , p_source_52 IN NUMBER
28952 --Currency Code
28953 , p_source_53 IN VARCHAR2
28954 )
28955 IS
28956
28957 l_component_type VARCHAR2(80);
28958 l_component_code VARCHAR2(30);
28959 l_component_type_code VARCHAR2(1);
28960 l_component_appl_id INTEGER;
28961 l_amb_context_code VARCHAR2(30);
28962 l_entity_code VARCHAR2(30);
28963 l_event_class_code VARCHAR2(30);
28964 l_ae_header_id NUMBER;
28965 l_event_type_code VARCHAR2(30);
28966 l_line_definition_code VARCHAR2(30);
28967 l_line_definition_owner_code VARCHAR2(1);
28968 --
28969 -- adr variables
28970 l_segment VARCHAR2(30);
28971 l_ccid NUMBER;
28972 l_adr_transaction_coa_id NUMBER;
28973 l_adr_accounting_coa_id NUMBER;
28974 l_adr_flexfield_segment_code VARCHAR2(30);
28975 l_adr_flex_value_set_id NUMBER;
28976 l_adr_value_type_code VARCHAR2(30);
28977 l_adr_value_combination_id NUMBER;
28978 l_adr_value_segment_code VARCHAR2(30);
28979
28980 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
28981 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
28982 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
28983 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
28984
28985 -- 4262811 Variables ------------------------------------------------------------------------------------------
28986 l_entered_amt_idx NUMBER;
28987 l_accted_amt_idx NUMBER;
28988 l_acc_rev_flag VARCHAR2(1);
28989 l_accrual_line_num NUMBER;
28990 l_tmp_amt NUMBER;
28991 l_acc_rev_natural_side_code VARCHAR2(1);
28992
28993 l_num_entries NUMBER;
28994 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
28995 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
28996 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
28997 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
28998 l_recog_line_1 NUMBER;
28999 l_recog_line_2 NUMBER;
29000
29001 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
29002 l_bflow_applied_to_amt NUMBER; -- 5132302
29003 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
29004
29005 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
29006
29007 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
29008 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
29009
29010 ---------------------------------------------------------------------------------------------------------------
29011
29012
29013 --
29014 -- bulk performance
29015 --
29016 l_balance_type_code VARCHAR2(1);
29017 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
29018 l_log_module VARCHAR2(240);
29019
29020 --
29021 -- Upgrade strategy
29022 --
29023 l_actual_upg_option VARCHAR2(1);
29024 l_enc_upg_option VARCHAR2(1);
29025
29026 --
29027 BEGIN
29028 --
29029 IF g_log_enabled THEN
29030 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_205';
29031 END IF;
29032 --
29033 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
29034
29035 trace
29036 (p_msg => 'BEGIN of AcctLineType_205'
29037 ,p_level => C_LEVEL_PROCEDURE
29038 ,p_module => l_log_module);
29039
29040 END IF;
29041 --
29042 l_component_type := 'AMB_JLT';
29043 l_component_code := 'FA_ADJ_EXP';
29044 l_component_type_code := 'S';
29048 l_event_class_code := 'ADJUSTMENTS';
29045 l_component_appl_id := 140;
29046 l_amb_context_code := 'DEFAULT';
29047 l_entity_code := 'TRANSACTIONS';
29049 l_event_type_code := 'ADJUSTMENTS_ALL';
29050 l_line_definition_owner_code := 'S';
29051 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADJUST2';
29052 --
29053 l_balance_type_code := 'A';
29054 l_segment := NULL;
29055 l_ccid := NULL;
29056 l_adr_transaction_coa_id := NULL;
29057 l_adr_accounting_coa_id := NULL;
29058 l_adr_flexfield_segment_code := NULL;
29059 l_adr_flex_value_set_id := NULL;
29060 l_adr_value_type_code := NULL;
29061 l_adr_value_combination_id := NULL;
29062 l_adr_value_segment_code := NULL;
29063
29064 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
29065 l_bflow_class_code := ''; -- 4219869 Business Flow
29066 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
29067 l_budgetary_control_flag := 'N';
29068
29069 l_bflow_applied_to_amt_idx := NULL; -- 5132302
29070 l_bflow_applied_to_amt := NULL; -- 5132302
29071 l_entered_amt_idx := NULL; -- 4262811
29072 l_accted_amt_idx := NULL; -- 4262811
29073 l_acc_rev_flag := NULL; -- 4262811
29074 l_accrual_line_num := NULL; -- 4262811
29075 l_tmp_amt := NULL; -- 4262811
29076 --
29077
29078 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
29079 l_balance_type_code <> 'B' THEN
29080 IF NVL(p_source_48,'
29081 ') = 'EXPENSE'
29082 THEN
29083
29084 --
29085 XLA_AE_LINES_PKG.SetNewLine;
29086
29087 p_balance_type_code := l_balance_type_code;
29088 -- set the flag so later we will know whether the gain loss line needs to be created
29089
29090 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
29091 p_actual_flag :='A';
29092 END IF;
29093
29094 --
29095 -- bulk performance
29096 --
29097 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
29098 p_header_num => 0); -- 4262811
29099 --
29100 -- set accounting line options
29101 --
29102 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
29103 p_natural_side_code => 'D'
29104 , p_gain_or_loss_flag => 'N'
29105 , p_gl_transfer_mode_code => 'S'
29106 , p_acct_entry_type_code => 'A'
29107 , p_switch_side_flag => 'Y'
29108 , p_merge_duplicate_code => 'N'
29109 );
29110 --
29111 l_acc_rev_natural_side_code := 'C'; -- 4262811
29112 --
29113 --
29114 -- set accounting line type info
29115 --
29116 xla_ae_lines_pkg.SetAcctLineType
29117 (p_component_type => l_component_type
29118 ,p_event_type_code => l_event_type_code
29119 ,p_line_definition_owner_code => l_line_definition_owner_code
29120 ,p_line_definition_code => l_line_definition_code
29121 ,p_accounting_line_code => l_component_code
29122 ,p_accounting_line_type_code => l_component_type_code
29123 ,p_accounting_line_appl_id => l_component_appl_id
29124 ,p_amb_context_code => l_amb_context_code
29125 ,p_entity_code => l_entity_code
29126 ,p_event_class_code => l_event_class_code);
29127 --
29128 -- set accounting class
29129 --
29130 xla_ae_lines_pkg.SetAcctClass(
29131 p_accounting_class_code => 'EXPENSE'
29132 , p_ae_header_id => l_ae_header_id
29133 );
29134
29135 --
29136 -- set rounding class
29137 --
29138 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
29139 'EXPENSE';
29140
29141 --
29142 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
29143 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
29144 --
29145 -- bulk performance
29146 --
29147 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
29148
29149 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
29150 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
29151
29152 -- 4955764
29153 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
29154 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
29155
29156 -- 4458381 Public Sector Enh
29157
29158 --
29159 -- set accounting attributes for the line type
29160 --
29161 l_entered_amt_idx := 4;
29162 l_accted_amt_idx := 6;
29163 l_bflow_applied_to_amt_idx := NULL; -- 5132302
29164 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
29165 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
29166 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
29167 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
29171 l_rec_acct_attrs.array_num_value(4) := p_source_52;
29168 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
29169 l_rec_acct_attrs.array_char_value(3) := p_source_51;
29170 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
29172 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
29173 l_rec_acct_attrs.array_char_value(5) := p_source_53;
29174 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
29175 l_rec_acct_attrs.array_num_value(6) := p_source_52;
29176
29177 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
29178 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
29179
29180 ---------------------------------------------------------------------------------------------------------------
29181 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
29182 ---------------------------------------------------------------------------------------------------------------
29183 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
29184
29185 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
29186 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
29187
29188 IF xla_accounting_cache_pkg.GetValueChar
29189 (p_source_code => 'LEDGER_CATEGORY_CODE'
29190 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
29191 AND l_bflow_method_code = 'PRIOR_ENTRY'
29192 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
29193 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
29194 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
29195 )
29196 THEN
29197 xla_ae_lines_pkg.BflowUpgEntry
29198 (p_business_method_code => l_bflow_method_code
29199 ,p_business_class_code => l_bflow_class_code
29200 ,p_balance_type => l_balance_type_code);
29201 ELSE
29202 NULL;
29203 -- No business flow processing for business flow method of NONE.
29204 END IF;
29205
29206 --
29207 -- call analytical criteria
29208 --
29209
29210 --
29211 -- call description
29212 --
29213
29214 xla_ae_lines_pkg.SetLineDescription(
29215 p_ae_header_id => l_ae_header_id
29216 ,p_description => Description_12 (
29217 p_application_id => p_application_id
29218 , p_ae_header_id => l_ae_header_id
29219 , p_source_1 => p_source_1
29220 )
29221 );
29222
29223
29224 --
29225 -- call ADRs
29226 -- Bug 4922099
29227 --
29228 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
29229 (NVL(l_actual_upg_option, 'N') = 'O') OR
29230 (NVL(l_enc_upg_option, 'N') = 'O')
29231 )
29232 THEN
29233 NULL;
29234 --
29235 --
29236
29237 l_ccid := AcctDerRule_176(
29238 p_application_id => p_application_id
29239 , p_ae_header_id => l_ae_header_id
29240 , p_source_5 => p_source_5
29241 , p_source_31 => p_source_31
29242 , x_transaction_coa_id => l_adr_transaction_coa_id
29243 , x_accounting_coa_id => l_adr_accounting_coa_id
29244 , x_value_type_code => l_adr_value_type_code
29245 , p_side => 'NA'
29246 );
29247
29248 xla_ae_lines_pkg.set_ccid(
29249 p_code_combination_id => l_ccid
29250 , p_value_type_code => l_adr_value_type_code
29251 , p_transaction_coa_id => l_adr_transaction_coa_id
29252 , p_accounting_coa_id => l_adr_accounting_coa_id
29253 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
29254 , p_adr_type_code => 'S'
29255 , p_component_type => l_component_type
29256 , p_component_code => l_component_code
29257 , p_component_type_code => l_component_type_code
29258 , p_component_appl_id => l_component_appl_id
29259 , p_amb_context_code => l_amb_context_code
29260 , p_side => 'NA'
29261 );
29262
29263
29264 --
29265 --
29266 END IF;
29267 --
29268 -- Bug 4922099
29269 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
29270 (NVL(l_enc_upg_option, 'N') = 'O')
29271 ) AND
29272 (l_bflow_method_code = 'PRIOR_ENTRY')
29273 )
29274 THEN
29275 IF
29276 --
29277 1 = 2
29278 --
29279 THEN
29280 xla_accounting_err_pkg.build_message
29281 (p_appli_s_name => 'XLA'
29282 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
29283 ,p_token_1 => 'LINE_NUMBER'
29284 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
29285 ,p_token_2 => 'LINE_TYPE_NAME'
29286 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
29287 l_component_type
29291 ,l_amb_context_code
29288 ,l_component_code
29289 ,l_component_type_code
29290 ,l_component_appl_id
29292 ,l_entity_code
29293 ,l_event_class_code
29294 )
29295 ,p_token_3 => 'OWNER'
29296 ,p_value_3 => xla_lookups_pkg.get_meaning(
29297 p_lookup_type => 'XLA_OWNER_TYPE'
29298 ,p_lookup_code => l_component_type_code
29299 )
29300 ,p_token_4 => 'PRODUCT_NAME'
29301 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
29302 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
29303 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
29304 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
29305 ,p_ae_header_id => NULL
29306 );
29307
29308 IF (C_LEVEL_ERROR>= g_log_level) THEN
29309 trace
29310 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
29311 ,p_level => C_LEVEL_ERROR
29312 ,p_module => l_log_module);
29313 END IF;
29314 END IF;
29315 END IF;
29316 --
29317 --
29318 ------------------------------------------------------------------------------------------------
29319 -- 4219869 Business Flow
29320 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
29321 -- Prior Entry. Currently, the following code is always generated.
29322 ------------------------------------------------------------------------------------------------
29323 XLA_AE_LINES_PKG.ValidateCurrentLine;
29324
29325 ------------------------------------------------------------------------------------
29326 -- 4219869 Business Flow
29327 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
29328 ------------------------------------------------------------------------------------
29329 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
29330
29331 ----------------------------------------------------------------------------------
29332 -- 4219869 Business Flow
29333 -- Update journal entry status -- Need to generate this within IF <condition>
29334 ----------------------------------------------------------------------------------
29335 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
29336 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
29337 ,p_balance_type_code => l_balance_type_code
29338 );
29339
29340 -------------------------------------------------------------------------------------------
29341 -- 4262811 - Generate the Accrual Reversal lines
29342 -------------------------------------------------------------------------------------------
29343 BEGIN
29344 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
29345 (g_array_event(p_event_id).array_value_num('header_index'));
29346 IF l_acc_rev_flag IS NULL THEN
29347 l_acc_rev_flag := 'N';
29348 END IF;
29349 EXCEPTION
29350 WHEN OTHERS THEN
29351 l_acc_rev_flag := 'N';
29352 END;
29353 --
29354 IF (l_acc_rev_flag = 'Y') THEN
29355
29356 -- 4645092 ------------------------------------------------------------------------------
29357 -- To allow MPA report to determine if it should generate report process
29358 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
29359 ------------------------------------------------------------------------------------------
29360
29361 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
29362 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
29363 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
29364 -- call ADRs
29365 -- Bug 4922099
29366 --
29367 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
29368 (NVL(l_actual_upg_option, 'N') = 'O') OR
29369 (NVL(l_enc_upg_option, 'N') = 'O')
29370 )
29371 THEN
29372 NULL;
29373 --
29374 --
29375
29376 l_ccid := AcctDerRule_176(
29377 p_application_id => p_application_id
29378 , p_ae_header_id => l_ae_header_id
29379 , p_source_5 => p_source_5
29380 , p_source_31 => p_source_31
29381 , x_transaction_coa_id => l_adr_transaction_coa_id
29382 , x_accounting_coa_id => l_adr_accounting_coa_id
29383 , x_value_type_code => l_adr_value_type_code
29384 , p_side => 'NA'
29385 );
29386
29390 , p_transaction_coa_id => l_adr_transaction_coa_id
29387 xla_ae_lines_pkg.set_ccid(
29388 p_code_combination_id => l_ccid
29389 , p_value_type_code => l_adr_value_type_code
29391 , p_accounting_coa_id => l_adr_accounting_coa_id
29392 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
29393 , p_adr_type_code => 'S'
29394 , p_component_type => l_component_type
29395 , p_component_code => l_component_code
29396 , p_component_type_code => l_component_type_code
29397 , p_component_appl_id => l_component_appl_id
29398 , p_amb_context_code => l_amb_context_code
29399 , p_side => 'NA'
29400 );
29401
29402
29403 --
29404 --
29405 END IF;
29406
29407 --
29408 -- Update the line information that should be overwritten
29409 --
29410 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
29411 p_header_num => 1);
29412 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
29413
29414 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
29415
29416 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
29417 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
29418 END IF;
29419
29420 --
29421 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
29422 --
29423 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
29424 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
29425 ELSE
29426 ---------------------------------------------------------------------------------------------------
29427 -- 4262811a Switch Sign
29428 ---------------------------------------------------------------------------------------------------
29429 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
29430 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
29431 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
29432 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
29433 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
29434 -- 5132302
29435 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
29436 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
29437
29438 END IF;
29439
29440 -- 4955764
29441 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
29442 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
29443
29444
29445 XLA_AE_LINES_PKG.ValidateCurrentLine;
29446 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
29447
29448 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
29449 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
29450 ,p_balance_type_code => l_balance_type_code);
29451
29452 END IF;
29453
29454 -----------------------------------------------------------------------------------------
29455 -- 4262811 Multiperiod Accounting
29456 -----------------------------------------------------------------------------------------
29457 -- No MPA option is assigned.
29458
29459
29460 END IF;
29461 END IF;
29462 --
29463
29464 --
29465 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
29466 trace
29467 (p_msg => 'END of AcctLineType_205'
29468 ,p_level => C_LEVEL_PROCEDURE
29469 ,p_module => l_log_module);
29470 END IF;
29471 --
29472 EXCEPTION
29473 WHEN xla_exceptions_pkg.application_exception THEN
29474 RAISE;
29475 WHEN OTHERS THEN
29476 xla_exceptions_pkg.raise_message
29477 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_205');
29478 END AcctLineType_205;
29479 --
29480
29481 ---------------------------------------
29482 --
29483 -- PRIVATE FUNCTION
29484 -- AcctLineType_206
29485 --
29486 ---------------------------------------
29487 PROCEDURE AcctLineType_206 (
29488 p_application_id IN NUMBER
29489 ,p_event_id IN NUMBER
29490 ,p_calculate_acctd_flag IN VARCHAR2
29491 ,p_calculate_g_l_flag IN VARCHAR2
29492 ,p_actual_flag IN OUT VARCHAR2
29493 ,p_balance_type_code OUT VARCHAR2
29494 ,p_gain_or_loss_ref OUT VARCHAR2
29495
29496 --Period Close Date
29497 , p_source_1 IN DATE
29498 --Generated Code Combination Identifier
29499 , p_source_5 IN NUMBER
29500 --Expense Account Code Combination Identifier
29501 , p_source_31 IN NUMBER
29502 --Adjustment Type
29503 , p_source_48 IN VARCHAR2
29504 --Transaction Header Identifier
29505 , p_source_49 IN NUMBER
29509 , p_source_51 IN VARCHAR2
29506 --Adjustment Line Identifier
29507 , p_source_50 IN NUMBER
29508 --Distribution Type Code
29510 --Entered Amount
29511 , p_source_52 IN NUMBER
29512 --Currency Code
29513 , p_source_53 IN VARCHAR2
29514 )
29515 IS
29516
29517 l_component_type VARCHAR2(80);
29518 l_component_code VARCHAR2(30);
29519 l_component_type_code VARCHAR2(1);
29520 l_component_appl_id INTEGER;
29521 l_amb_context_code VARCHAR2(30);
29522 l_entity_code VARCHAR2(30);
29523 l_event_class_code VARCHAR2(30);
29524 l_ae_header_id NUMBER;
29525 l_event_type_code VARCHAR2(30);
29526 l_line_definition_code VARCHAR2(30);
29527 l_line_definition_owner_code VARCHAR2(1);
29528 --
29529 -- adr variables
29530 l_segment VARCHAR2(30);
29531 l_ccid NUMBER;
29532 l_adr_transaction_coa_id NUMBER;
29533 l_adr_accounting_coa_id NUMBER;
29534 l_adr_flexfield_segment_code VARCHAR2(30);
29535 l_adr_flex_value_set_id NUMBER;
29536 l_adr_value_type_code VARCHAR2(30);
29537 l_adr_value_combination_id NUMBER;
29538 l_adr_value_segment_code VARCHAR2(30);
29539
29540 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
29541 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
29542 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
29543 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
29544
29545 -- 4262811 Variables ------------------------------------------------------------------------------------------
29546 l_entered_amt_idx NUMBER;
29547 l_accted_amt_idx NUMBER;
29548 l_acc_rev_flag VARCHAR2(1);
29549 l_accrual_line_num NUMBER;
29550 l_tmp_amt NUMBER;
29551 l_acc_rev_natural_side_code VARCHAR2(1);
29552
29553 l_num_entries NUMBER;
29554 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
29555 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
29556 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
29557 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
29558 l_recog_line_1 NUMBER;
29559 l_recog_line_2 NUMBER;
29560
29561 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
29562 l_bflow_applied_to_amt NUMBER; -- 5132302
29563 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
29564
29565 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
29566
29567 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
29568 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
29569
29570 ---------------------------------------------------------------------------------------------------------------
29571
29572
29573 --
29574 -- bulk performance
29575 --
29576 l_balance_type_code VARCHAR2(1);
29577 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
29578 l_log_module VARCHAR2(240);
29579
29580 --
29581 -- Upgrade strategy
29582 --
29583 l_actual_upg_option VARCHAR2(1);
29584 l_enc_upg_option VARCHAR2(1);
29585
29586 --
29587 BEGIN
29588 --
29589 IF g_log_enabled THEN
29590 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_206';
29591 END IF;
29592 --
29593 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
29594
29595 trace
29596 (p_msg => 'BEGIN of AcctLineType_206'
29597 ,p_level => C_LEVEL_PROCEDURE
29598 ,p_module => l_log_module);
29599
29600 END IF;
29601 --
29602 l_component_type := 'AMB_JLT';
29603 l_component_code := 'FA_ADJ_EXP_BAL';
29604 l_component_type_code := 'S';
29605 l_component_appl_id := 140;
29606 l_amb_context_code := 'DEFAULT';
29607 l_entity_code := 'TRANSACTIONS';
29608 l_event_class_code := 'ADJUSTMENTS';
29609 l_event_type_code := 'ADJUSTMENTS_ALL';
29610 l_line_definition_owner_code := 'S';
29611 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADJUST2';
29612 --
29613 l_balance_type_code := 'A';
29614 l_segment := NULL;
29615 l_ccid := NULL;
29616 l_adr_transaction_coa_id := NULL;
29617 l_adr_accounting_coa_id := NULL;
29618 l_adr_flexfield_segment_code := NULL;
29619 l_adr_flex_value_set_id := NULL;
29620 l_adr_value_type_code := NULL;
29621 l_adr_value_combination_id := NULL;
29622 l_adr_value_segment_code := NULL;
29623
29624 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
29625 l_bflow_class_code := ''; -- 4219869 Business Flow
29626 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
29627 l_budgetary_control_flag := 'N';
29628
29629 l_bflow_applied_to_amt_idx := NULL; -- 5132302
29630 l_bflow_applied_to_amt := NULL; -- 5132302
29631 l_entered_amt_idx := NULL; -- 4262811
29632 l_accted_amt_idx := NULL; -- 4262811
29633 l_acc_rev_flag := NULL; -- 4262811
29634 l_accrual_line_num := NULL; -- 4262811
29638 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
29635 l_tmp_amt := NULL; -- 4262811
29636 --
29637
29639 l_balance_type_code <> 'B' THEN
29640 IF NVL(p_source_48,'
29641 ') = 'BONUS EXPENSE'
29642 THEN
29643
29644 --
29645 XLA_AE_LINES_PKG.SetNewLine;
29646
29647 p_balance_type_code := l_balance_type_code;
29648 -- set the flag so later we will know whether the gain loss line needs to be created
29649
29650 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
29651 p_actual_flag :='A';
29652 END IF;
29653
29654 --
29655 -- bulk performance
29656 --
29657 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
29658 p_header_num => 0); -- 4262811
29659 --
29660 -- set accounting line options
29661 --
29662 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
29663 p_natural_side_code => 'C'
29664 , p_gain_or_loss_flag => 'N'
29665 , p_gl_transfer_mode_code => 'S'
29666 , p_acct_entry_type_code => 'A'
29667 , p_switch_side_flag => 'Y'
29668 , p_merge_duplicate_code => 'N'
29669 );
29670 --
29671 l_acc_rev_natural_side_code := 'D'; -- 4262811
29672 --
29673 --
29674 -- set accounting line type info
29675 --
29676 xla_ae_lines_pkg.SetAcctLineType
29677 (p_component_type => l_component_type
29678 ,p_event_type_code => l_event_type_code
29679 ,p_line_definition_owner_code => l_line_definition_owner_code
29680 ,p_line_definition_code => l_line_definition_code
29681 ,p_accounting_line_code => l_component_code
29682 ,p_accounting_line_type_code => l_component_type_code
29683 ,p_accounting_line_appl_id => l_component_appl_id
29684 ,p_amb_context_code => l_amb_context_code
29685 ,p_entity_code => l_entity_code
29686 ,p_event_class_code => l_event_class_code);
29687 --
29688 -- set accounting class
29689 --
29690 xla_ae_lines_pkg.SetAcctClass(
29691 p_accounting_class_code => 'EXPENSE'
29692 , p_ae_header_id => l_ae_header_id
29693 );
29694
29695 --
29696 -- set rounding class
29697 --
29698 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
29699 'EXPENSE';
29700
29701 --
29702 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
29703 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
29704 --
29705 -- bulk performance
29706 --
29707 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
29708
29709 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
29710 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
29711
29712 -- 4955764
29713 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
29714 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
29715
29716 -- 4458381 Public Sector Enh
29717
29718 --
29719 -- set accounting attributes for the line type
29720 --
29721 l_entered_amt_idx := 4;
29722 l_accted_amt_idx := 6;
29723 l_bflow_applied_to_amt_idx := NULL; -- 5132302
29724 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
29725 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
29726 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
29727 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
29728 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
29729 l_rec_acct_attrs.array_char_value(3) := p_source_51;
29730 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
29731 l_rec_acct_attrs.array_num_value(4) := p_source_52;
29732 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
29733 l_rec_acct_attrs.array_char_value(5) := p_source_53;
29734 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
29735 l_rec_acct_attrs.array_num_value(6) := p_source_52;
29736
29737 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
29738 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
29739
29740 ---------------------------------------------------------------------------------------------------------------
29741 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
29742 ---------------------------------------------------------------------------------------------------------------
29743 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
29744
29745 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
29746 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
29747
29751 AND l_bflow_method_code = 'PRIOR_ENTRY'
29748 IF xla_accounting_cache_pkg.GetValueChar
29749 (p_source_code => 'LEDGER_CATEGORY_CODE'
29750 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
29752 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
29753 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
29754 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
29755 )
29756 THEN
29757 xla_ae_lines_pkg.BflowUpgEntry
29758 (p_business_method_code => l_bflow_method_code
29759 ,p_business_class_code => l_bflow_class_code
29760 ,p_balance_type => l_balance_type_code);
29761 ELSE
29762 NULL;
29763 -- No business flow processing for business flow method of NONE.
29764 END IF;
29765
29766 --
29767 -- call analytical criteria
29768 --
29769
29770 --
29771 -- call description
29772 --
29773
29774 xla_ae_lines_pkg.SetLineDescription(
29775 p_ae_header_id => l_ae_header_id
29776 ,p_description => Description_12 (
29777 p_application_id => p_application_id
29778 , p_ae_header_id => l_ae_header_id
29779 , p_source_1 => p_source_1
29780 )
29781 );
29782
29783
29784 --
29785 -- call ADRs
29786 -- Bug 4922099
29787 --
29788 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
29789 (NVL(l_actual_upg_option, 'N') = 'O') OR
29790 (NVL(l_enc_upg_option, 'N') = 'O')
29791 )
29792 THEN
29793 NULL;
29794 --
29795 --
29796
29797 l_ccid := AcctDerRule_176(
29798 p_application_id => p_application_id
29799 , p_ae_header_id => l_ae_header_id
29800 , p_source_5 => p_source_5
29801 , p_source_31 => p_source_31
29802 , x_transaction_coa_id => l_adr_transaction_coa_id
29803 , x_accounting_coa_id => l_adr_accounting_coa_id
29804 , x_value_type_code => l_adr_value_type_code
29805 , p_side => 'NA'
29806 );
29807
29808 xla_ae_lines_pkg.set_ccid(
29809 p_code_combination_id => l_ccid
29810 , p_value_type_code => l_adr_value_type_code
29811 , p_transaction_coa_id => l_adr_transaction_coa_id
29812 , p_accounting_coa_id => l_adr_accounting_coa_id
29813 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
29814 , p_adr_type_code => 'S'
29815 , p_component_type => l_component_type
29816 , p_component_code => l_component_code
29817 , p_component_type_code => l_component_type_code
29818 , p_component_appl_id => l_component_appl_id
29819 , p_amb_context_code => l_amb_context_code
29820 , p_side => 'NA'
29821 );
29822
29823
29824 --
29825 --
29826 END IF;
29827 --
29828 -- Bug 4922099
29829 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
29830 (NVL(l_enc_upg_option, 'N') = 'O')
29831 ) AND
29832 (l_bflow_method_code = 'PRIOR_ENTRY')
29833 )
29834 THEN
29835 IF
29836 --
29837 1 = 2
29838 --
29839 THEN
29840 xla_accounting_err_pkg.build_message
29841 (p_appli_s_name => 'XLA'
29842 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
29843 ,p_token_1 => 'LINE_NUMBER'
29844 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
29845 ,p_token_2 => 'LINE_TYPE_NAME'
29846 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
29847 l_component_type
29848 ,l_component_code
29849 ,l_component_type_code
29850 ,l_component_appl_id
29851 ,l_amb_context_code
29852 ,l_entity_code
29853 ,l_event_class_code
29854 )
29855 ,p_token_3 => 'OWNER'
29856 ,p_value_3 => xla_lookups_pkg.get_meaning(
29857 p_lookup_type => 'XLA_OWNER_TYPE'
29858 ,p_lookup_code => l_component_type_code
29859 )
29860 ,p_token_4 => 'PRODUCT_NAME'
29861 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
29862 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
29863 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
29867
29864 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
29865 ,p_ae_header_id => NULL
29866 );
29868 IF (C_LEVEL_ERROR>= g_log_level) THEN
29869 trace
29870 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
29871 ,p_level => C_LEVEL_ERROR
29872 ,p_module => l_log_module);
29873 END IF;
29874 END IF;
29875 END IF;
29876 --
29877 --
29878 ------------------------------------------------------------------------------------------------
29879 -- 4219869 Business Flow
29880 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
29881 -- Prior Entry. Currently, the following code is always generated.
29882 ------------------------------------------------------------------------------------------------
29883 XLA_AE_LINES_PKG.ValidateCurrentLine;
29884
29885 ------------------------------------------------------------------------------------
29886 -- 4219869 Business Flow
29887 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
29888 ------------------------------------------------------------------------------------
29889 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
29890
29891 ----------------------------------------------------------------------------------
29892 -- 4219869 Business Flow
29893 -- Update journal entry status -- Need to generate this within IF <condition>
29894 ----------------------------------------------------------------------------------
29895 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
29896 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
29897 ,p_balance_type_code => l_balance_type_code
29898 );
29899
29900 -------------------------------------------------------------------------------------------
29901 -- 4262811 - Generate the Accrual Reversal lines
29902 -------------------------------------------------------------------------------------------
29903 BEGIN
29904 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
29905 (g_array_event(p_event_id).array_value_num('header_index'));
29906 IF l_acc_rev_flag IS NULL THEN
29907 l_acc_rev_flag := 'N';
29908 END IF;
29909 EXCEPTION
29910 WHEN OTHERS THEN
29911 l_acc_rev_flag := 'N';
29912 END;
29913 --
29914 IF (l_acc_rev_flag = 'Y') THEN
29915
29916 -- 4645092 ------------------------------------------------------------------------------
29917 -- To allow MPA report to determine if it should generate report process
29918 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
29919 ------------------------------------------------------------------------------------------
29920
29921 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
29922 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
29923 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
29924 -- call ADRs
29925 -- Bug 4922099
29926 --
29927 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
29928 (NVL(l_actual_upg_option, 'N') = 'O') OR
29929 (NVL(l_enc_upg_option, 'N') = 'O')
29930 )
29931 THEN
29932 NULL;
29933 --
29934 --
29935
29936 l_ccid := AcctDerRule_176(
29937 p_application_id => p_application_id
29938 , p_ae_header_id => l_ae_header_id
29939 , p_source_5 => p_source_5
29940 , p_source_31 => p_source_31
29941 , x_transaction_coa_id => l_adr_transaction_coa_id
29942 , x_accounting_coa_id => l_adr_accounting_coa_id
29943 , x_value_type_code => l_adr_value_type_code
29944 , p_side => 'NA'
29945 );
29946
29947 xla_ae_lines_pkg.set_ccid(
29948 p_code_combination_id => l_ccid
29949 , p_value_type_code => l_adr_value_type_code
29950 , p_transaction_coa_id => l_adr_transaction_coa_id
29951 , p_accounting_coa_id => l_adr_accounting_coa_id
29952 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
29953 , p_adr_type_code => 'S'
29954 , p_component_type => l_component_type
29955 , p_component_code => l_component_code
29956 , p_component_type_code => l_component_type_code
29957 , p_component_appl_id => l_component_appl_id
29958 , p_amb_context_code => l_amb_context_code
29959 , p_side => 'NA'
29960 );
29961
29962
29963 --
29964 --
29965 END IF;
29966
29967 --
29968 -- Update the line information that should be overwritten
29969 --
29970 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
29971 p_header_num => 1);
29972 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
29973
29974 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
29975
29976 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
29980 --
29977 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
29978 END IF;
29979
29981 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
29982 --
29983 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
29984 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
29985 ELSE
29986 ---------------------------------------------------------------------------------------------------
29987 -- 4262811a Switch Sign
29988 ---------------------------------------------------------------------------------------------------
29989 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
29990 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
29991 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
29992 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
29993 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
29994 -- 5132302
29995 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
29996 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
29997
29998 END IF;
29999
30000 -- 4955764
30001 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
30002 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
30003
30004
30005 XLA_AE_LINES_PKG.ValidateCurrentLine;
30006 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
30007
30008 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
30009 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
30010 ,p_balance_type_code => l_balance_type_code);
30011
30012 END IF;
30013
30014 -----------------------------------------------------------------------------------------
30015 -- 4262811 Multiperiod Accounting
30016 -----------------------------------------------------------------------------------------
30017 -- No MPA option is assigned.
30018
30019
30020 END IF;
30021 END IF;
30022 --
30023
30024 --
30025 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
30026 trace
30027 (p_msg => 'END of AcctLineType_206'
30028 ,p_level => C_LEVEL_PROCEDURE
30029 ,p_module => l_log_module);
30030 END IF;
30031 --
30032 EXCEPTION
30033 WHEN xla_exceptions_pkg.application_exception THEN
30034 RAISE;
30035 WHEN OTHERS THEN
30036 xla_exceptions_pkg.raise_message
30037 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_206');
30038 END AcctLineType_206;
30039 --
30040
30041 ---------------------------------------
30042 --
30043 -- PRIVATE FUNCTION
30044 -- AcctLineType_207
30045 --
30046 ---------------------------------------
30047 PROCEDURE AcctLineType_207 (
30048 p_application_id IN NUMBER
30049 ,p_event_id IN NUMBER
30050 ,p_calculate_acctd_flag IN VARCHAR2
30051 ,p_calculate_g_l_flag IN VARCHAR2
30052 ,p_actual_flag IN OUT VARCHAR2
30053 ,p_balance_type_code OUT VARCHAR2
30054 ,p_gain_or_loss_ref OUT VARCHAR2
30055
30056 --Period Close Date
30057 , p_source_1 IN DATE
30058 --Generated Code Combination Identifier
30059 , p_source_5 IN NUMBER
30060 --Intercompany Payables Account
30061 , p_source_21 IN VARCHAR2
30062 --Expense Account Code Combination Identifier
30063 , p_source_31 IN NUMBER
30064 --Default Code Combination Identifier
30065 , p_source_32 IN NUMBER
30066 --Adjustment Type
30067 , p_source_48 IN VARCHAR2
30068 --Transaction Header Identifier
30069 , p_source_49 IN NUMBER
30070 --Adjustment Line Identifier
30071 , p_source_50 IN NUMBER
30072 --Distribution Type Code
30073 , p_source_51 IN VARCHAR2
30074 --Entered Amount
30075 , p_source_52 IN NUMBER
30076 --Currency Code
30077 , p_source_53 IN VARCHAR2
30078 )
30079 IS
30080
30081 l_component_type VARCHAR2(80);
30082 l_component_code VARCHAR2(30);
30083 l_component_type_code VARCHAR2(1);
30084 l_component_appl_id INTEGER;
30085 l_amb_context_code VARCHAR2(30);
30086 l_entity_code VARCHAR2(30);
30087 l_event_class_code VARCHAR2(30);
30088 l_ae_header_id NUMBER;
30089 l_event_type_code VARCHAR2(30);
30090 l_line_definition_code VARCHAR2(30);
30091 l_line_definition_owner_code VARCHAR2(1);
30092 --
30093 -- adr variables
30094 l_segment VARCHAR2(30);
30095 l_ccid NUMBER;
30096 l_adr_transaction_coa_id NUMBER;
30097 l_adr_accounting_coa_id NUMBER;
30098 l_adr_flexfield_segment_code VARCHAR2(30);
30099 l_adr_flex_value_set_id NUMBER;
30100 l_adr_value_type_code VARCHAR2(30);
30104 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
30101 l_adr_value_combination_id NUMBER;
30102 l_adr_value_segment_code VARCHAR2(30);
30103
30105 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
30106 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
30107 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
30108
30109 -- 4262811 Variables ------------------------------------------------------------------------------------------
30110 l_entered_amt_idx NUMBER;
30111 l_accted_amt_idx NUMBER;
30112 l_acc_rev_flag VARCHAR2(1);
30113 l_accrual_line_num NUMBER;
30114 l_tmp_amt NUMBER;
30115 l_acc_rev_natural_side_code VARCHAR2(1);
30116
30117 l_num_entries NUMBER;
30118 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
30119 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
30120 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
30121 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
30122 l_recog_line_1 NUMBER;
30123 l_recog_line_2 NUMBER;
30124
30125 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
30126 l_bflow_applied_to_amt NUMBER; -- 5132302
30127 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
30128
30129 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
30130
30131 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
30132 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
30133
30134 ---------------------------------------------------------------------------------------------------------------
30135
30136
30137 --
30138 -- bulk performance
30139 --
30140 l_balance_type_code VARCHAR2(1);
30141 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
30142 l_log_module VARCHAR2(240);
30143
30144 --
30145 -- Upgrade strategy
30146 --
30147 l_actual_upg_option VARCHAR2(1);
30148 l_enc_upg_option VARCHAR2(1);
30149
30150 --
30151 BEGIN
30152 --
30153 IF g_log_enabled THEN
30154 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_207';
30155 END IF;
30156 --
30157 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
30158
30159 trace
30160 (p_msg => 'BEGIN of AcctLineType_207'
30161 ,p_level => C_LEVEL_PROCEDURE
30162 ,p_module => l_log_module);
30163
30164 END IF;
30165 --
30166 l_component_type := 'AMB_JLT';
30167 l_component_code := 'FA_ADJ_IC_PAY';
30168 l_component_type_code := 'S';
30169 l_component_appl_id := 140;
30170 l_amb_context_code := 'DEFAULT';
30171 l_entity_code := 'TRANSACTIONS';
30172 l_event_class_code := 'ADJUSTMENTS';
30173 l_event_type_code := 'ADJUSTMENTS_ALL';
30174 l_line_definition_owner_code := 'S';
30175 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADJUST2';
30176 --
30177 l_balance_type_code := 'A';
30178 l_segment := NULL;
30179 l_ccid := NULL;
30180 l_adr_transaction_coa_id := NULL;
30181 l_adr_accounting_coa_id := NULL;
30182 l_adr_flexfield_segment_code := NULL;
30183 l_adr_flex_value_set_id := NULL;
30184 l_adr_value_type_code := NULL;
30185 l_adr_value_combination_id := NULL;
30186 l_adr_value_segment_code := NULL;
30187
30188 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
30189 l_bflow_class_code := ''; -- 4219869 Business Flow
30190 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
30191 l_budgetary_control_flag := 'N';
30192
30193 l_bflow_applied_to_amt_idx := NULL; -- 5132302
30194 l_bflow_applied_to_amt := NULL; -- 5132302
30195 l_entered_amt_idx := NULL; -- 4262811
30196 l_accted_amt_idx := NULL; -- 4262811
30197 l_acc_rev_flag := NULL; -- 4262811
30198 l_accrual_line_num := NULL; -- 4262811
30199 l_tmp_amt := NULL; -- 4262811
30200 --
30201
30202 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
30203 l_balance_type_code <> 'B' THEN
30204 IF NVL(p_source_48,'
30205 ') = 'INTERCO AP'
30206 THEN
30207
30208 --
30209 XLA_AE_LINES_PKG.SetNewLine;
30210
30211 p_balance_type_code := l_balance_type_code;
30212 -- set the flag so later we will know whether the gain loss line needs to be created
30213
30214 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
30215 p_actual_flag :='A';
30216 END IF;
30217
30218 --
30219 -- bulk performance
30220 --
30221 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
30222 p_header_num => 0); -- 4262811
30223 --
30224 -- set accounting line options
30225 --
30226 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
30227 p_natural_side_code => 'C'
30228 , p_gain_or_loss_flag => 'N'
30232 , p_merge_duplicate_code => 'N'
30229 , p_gl_transfer_mode_code => 'S'
30230 , p_acct_entry_type_code => 'A'
30231 , p_switch_side_flag => 'Y'
30233 );
30234 --
30235 l_acc_rev_natural_side_code := 'D'; -- 4262811
30236 --
30237 --
30238 -- set accounting line type info
30239 --
30240 xla_ae_lines_pkg.SetAcctLineType
30241 (p_component_type => l_component_type
30242 ,p_event_type_code => l_event_type_code
30243 ,p_line_definition_owner_code => l_line_definition_owner_code
30244 ,p_line_definition_code => l_line_definition_code
30245 ,p_accounting_line_code => l_component_code
30246 ,p_accounting_line_type_code => l_component_type_code
30247 ,p_accounting_line_appl_id => l_component_appl_id
30248 ,p_amb_context_code => l_amb_context_code
30249 ,p_entity_code => l_entity_code
30250 ,p_event_class_code => l_event_class_code);
30251 --
30252 -- set accounting class
30253 --
30254 xla_ae_lines_pkg.SetAcctClass(
30255 p_accounting_class_code => 'LIABILITY'
30256 , p_ae_header_id => l_ae_header_id
30257 );
30258
30259 --
30260 -- set rounding class
30261 --
30262 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
30263 'LIABILITY';
30264
30265 --
30266 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
30267 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
30268 --
30269 -- bulk performance
30270 --
30271 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
30272
30273 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
30274 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
30275
30276 -- 4955764
30277 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
30278 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
30279
30280 -- 4458381 Public Sector Enh
30281
30282 --
30283 -- set accounting attributes for the line type
30284 --
30285 l_entered_amt_idx := 4;
30286 l_accted_amt_idx := 6;
30287 l_bflow_applied_to_amt_idx := NULL; -- 5132302
30288 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
30289 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
30290 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
30291 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
30292 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
30293 l_rec_acct_attrs.array_char_value(3) := p_source_51;
30294 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
30295 l_rec_acct_attrs.array_num_value(4) := p_source_52;
30296 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
30297 l_rec_acct_attrs.array_char_value(5) := p_source_53;
30298 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
30299 l_rec_acct_attrs.array_num_value(6) := p_source_52;
30300
30301 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
30302 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
30303
30304 ---------------------------------------------------------------------------------------------------------------
30305 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
30306 ---------------------------------------------------------------------------------------------------------------
30307 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
30308
30309 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
30310 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
30311
30312 IF xla_accounting_cache_pkg.GetValueChar
30313 (p_source_code => 'LEDGER_CATEGORY_CODE'
30314 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
30315 AND l_bflow_method_code = 'PRIOR_ENTRY'
30316 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
30317 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
30318 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
30319 )
30320 THEN
30321 xla_ae_lines_pkg.BflowUpgEntry
30322 (p_business_method_code => l_bflow_method_code
30323 ,p_business_class_code => l_bflow_class_code
30324 ,p_balance_type => l_balance_type_code);
30325 ELSE
30326 NULL;
30327 -- No business flow processing for business flow method of NONE.
30328 END IF;
30329
30330 --
30331 -- call analytical criteria
30332 --
30333
30334 --
30335 -- call description
30336 --
30337
30338 xla_ae_lines_pkg.SetLineDescription(
30339 p_ae_header_id => l_ae_header_id
30340 ,p_description => Description_13 (
30344 )
30341 p_application_id => p_application_id
30342 , p_ae_header_id => l_ae_header_id
30343 , p_source_1 => p_source_1
30345 );
30346
30347
30348 --
30349 -- call ADRs
30350 -- Bug 4922099
30351 --
30352 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
30353 (NVL(l_actual_upg_option, 'N') = 'O') OR
30354 (NVL(l_enc_upg_option, 'N') = 'O')
30355 )
30356 THEN
30357 NULL;
30358 --
30359 --
30360
30361 l_ccid := AcctDerRule_174(
30362 p_application_id => p_application_id
30363 , p_ae_header_id => l_ae_header_id
30364 , p_source_5 => p_source_5
30365 , p_source_32 => p_source_32
30366 , x_transaction_coa_id => l_adr_transaction_coa_id
30367 , x_accounting_coa_id => l_adr_accounting_coa_id
30368 , x_value_type_code => l_adr_value_type_code
30369 , p_side => 'NA'
30370 );
30371
30372 xla_ae_lines_pkg.set_ccid(
30373 p_code_combination_id => l_ccid
30374 , p_value_type_code => l_adr_value_type_code
30375 , p_transaction_coa_id => l_adr_transaction_coa_id
30376 , p_accounting_coa_id => l_adr_accounting_coa_id
30377 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
30378 , p_adr_type_code => 'S'
30379 , p_component_type => l_component_type
30380 , p_component_code => l_component_code
30381 , p_component_type_code => l_component_type_code
30382 , p_component_appl_id => l_component_appl_id
30383 , p_amb_context_code => l_amb_context_code
30384 , p_side => 'NA'
30385 );
30386
30387
30388 l_segment := AcctDerRule_169(
30389 p_application_id => p_application_id
30390 , p_ae_header_id => l_ae_header_id
30391 , p_source_5 => p_source_5
30392 , p_source_31 => p_source_31
30393 , x_transaction_coa_id => l_adr_transaction_coa_id
30394 , x_accounting_coa_id => l_adr_accounting_coa_id
30395 , x_flexfield_segment_code => l_adr_flexfield_segment_code
30396 , x_flex_value_set_id => l_adr_flex_value_set_id
30397 , x_value_type_code => l_adr_value_type_code
30398 , x_value_combination_id => l_adr_value_combination_id
30399 , x_value_segment_code => l_adr_value_segment_code
30400 , p_side => 'NA'
30401 , p_override_seg_flag => 'Y'
30402 );
30403
30404 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
30405
30406 xla_ae_lines_pkg.set_segment(
30407 p_to_segment_code => 'GL_BALANCING'
30408 , p_segment_value => l_segment
30409 , p_from_segment_code => l_adr_value_segment_code
30410 , p_from_combination_id => l_adr_value_combination_id
30411 , p_value_type_code => l_adr_value_type_code
30412 , p_transaction_coa_id => l_adr_transaction_coa_id
30413 , p_accounting_coa_id => l_adr_accounting_coa_id
30414 , p_flexfield_segment_code => l_adr_flexfield_segment_code
30415 , p_flex_value_set_id => l_adr_flex_value_set_id
30416 , p_adr_code => 'FA_EXPENSE_ACCT'
30417 , p_adr_type_code => 'S'
30418 , p_component_type => l_component_type
30419 , p_component_code => l_component_code
30420 , p_component_type_code => l_component_type_code
30421 , p_component_appl_id => l_component_appl_id
30422 , p_amb_context_code => l_amb_context_code
30423 , p_entity_code => 'TRANSACTIONS'
30424 , p_event_class_code => 'ADJUSTMENTS'
30425 , p_side => 'NA'
30426 );
30427
30428 END IF;
30429
30430 l_segment := AcctDerRule_158(
30431 p_application_id => p_application_id
30432 , p_ae_header_id => l_ae_header_id
30433 , p_source_5 => p_source_5
30434 , p_source_21 => p_source_21
30435 , x_transaction_coa_id => l_adr_transaction_coa_id
30436 , x_accounting_coa_id => l_adr_accounting_coa_id
30437 , x_flexfield_segment_code => l_adr_flexfield_segment_code
30438 , x_flex_value_set_id => l_adr_flex_value_set_id
30439 , x_value_type_code => l_adr_value_type_code
30440 , x_value_combination_id => l_adr_value_combination_id
30441 , x_value_segment_code => l_adr_value_segment_code
30442 , p_side => 'NA'
30443 , p_override_seg_flag => 'Y'
30444 );
30445
30446 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
30447
30448 xla_ae_lines_pkg.set_segment(
30449 p_to_segment_code => 'GL_ACCOUNT'
30450 , p_segment_value => l_segment
30451 , p_from_segment_code => l_adr_value_segment_code
30452 , p_from_combination_id => l_adr_value_combination_id
30453 , p_value_type_code => l_adr_value_type_code
30454 , p_transaction_coa_id => l_adr_transaction_coa_id
30455 , p_accounting_coa_id => l_adr_accounting_coa_id
30456 , p_flexfield_segment_code => l_adr_flexfield_segment_code
30460 , p_component_type => l_component_type
30457 , p_flex_value_set_id => l_adr_flex_value_set_id
30458 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
30459 , p_adr_type_code => 'S'
30461 , p_component_code => l_component_code
30462 , p_component_type_code => l_component_type_code
30463 , p_component_appl_id => l_component_appl_id
30464 , p_amb_context_code => l_amb_context_code
30465 , p_entity_code => 'TRANSACTIONS'
30466 , p_event_class_code => 'ADJUSTMENTS'
30467 , p_side => 'NA'
30468 );
30469
30470 END IF;
30471
30472 --
30473 --
30474 END IF;
30475 --
30476 -- Bug 4922099
30477 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
30478 (NVL(l_enc_upg_option, 'N') = 'O')
30479 ) AND
30480 (l_bflow_method_code = 'PRIOR_ENTRY')
30481 )
30482 THEN
30483 IF
30484 --
30485 1 = 2
30486 --
30487 THEN
30488 xla_accounting_err_pkg.build_message
30489 (p_appli_s_name => 'XLA'
30490 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
30491 ,p_token_1 => 'LINE_NUMBER'
30492 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
30493 ,p_token_2 => 'LINE_TYPE_NAME'
30494 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
30495 l_component_type
30496 ,l_component_code
30497 ,l_component_type_code
30498 ,l_component_appl_id
30499 ,l_amb_context_code
30500 ,l_entity_code
30501 ,l_event_class_code
30502 )
30503 ,p_token_3 => 'OWNER'
30504 ,p_value_3 => xla_lookups_pkg.get_meaning(
30505 p_lookup_type => 'XLA_OWNER_TYPE'
30506 ,p_lookup_code => l_component_type_code
30507 )
30508 ,p_token_4 => 'PRODUCT_NAME'
30509 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
30510 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
30511 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
30512 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
30513 ,p_ae_header_id => NULL
30514 );
30515
30516 IF (C_LEVEL_ERROR>= g_log_level) THEN
30517 trace
30518 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
30519 ,p_level => C_LEVEL_ERROR
30520 ,p_module => l_log_module);
30521 END IF;
30522 END IF;
30523 END IF;
30524 --
30525 --
30526 ------------------------------------------------------------------------------------------------
30527 -- 4219869 Business Flow
30528 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
30529 -- Prior Entry. Currently, the following code is always generated.
30530 ------------------------------------------------------------------------------------------------
30531 XLA_AE_LINES_PKG.ValidateCurrentLine;
30532
30533 ------------------------------------------------------------------------------------
30534 -- 4219869 Business Flow
30535 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
30536 ------------------------------------------------------------------------------------
30537 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
30538
30539 ----------------------------------------------------------------------------------
30540 -- 4219869 Business Flow
30541 -- Update journal entry status -- Need to generate this within IF <condition>
30542 ----------------------------------------------------------------------------------
30543 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
30544 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
30545 ,p_balance_type_code => l_balance_type_code
30546 );
30547
30548 -------------------------------------------------------------------------------------------
30549 -- 4262811 - Generate the Accrual Reversal lines
30550 -------------------------------------------------------------------------------------------
30551 BEGIN
30555 l_acc_rev_flag := 'N';
30552 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
30553 (g_array_event(p_event_id).array_value_num('header_index'));
30554 IF l_acc_rev_flag IS NULL THEN
30556 END IF;
30557 EXCEPTION
30558 WHEN OTHERS THEN
30559 l_acc_rev_flag := 'N';
30560 END;
30561 --
30562 IF (l_acc_rev_flag = 'Y') THEN
30563
30564 -- 4645092 ------------------------------------------------------------------------------
30565 -- To allow MPA report to determine if it should generate report process
30566 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
30567 ------------------------------------------------------------------------------------------
30568
30569 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
30570 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
30571 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
30572 -- call ADRs
30573 -- Bug 4922099
30574 --
30575 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
30576 (NVL(l_actual_upg_option, 'N') = 'O') OR
30577 (NVL(l_enc_upg_option, 'N') = 'O')
30578 )
30579 THEN
30580 NULL;
30581 --
30582 --
30583
30584 l_ccid := AcctDerRule_174(
30585 p_application_id => p_application_id
30586 , p_ae_header_id => l_ae_header_id
30587 , p_source_5 => p_source_5
30588 , p_source_32 => p_source_32
30589 , x_transaction_coa_id => l_adr_transaction_coa_id
30590 , x_accounting_coa_id => l_adr_accounting_coa_id
30591 , x_value_type_code => l_adr_value_type_code
30592 , p_side => 'NA'
30593 );
30594
30595 xla_ae_lines_pkg.set_ccid(
30596 p_code_combination_id => l_ccid
30597 , p_value_type_code => l_adr_value_type_code
30598 , p_transaction_coa_id => l_adr_transaction_coa_id
30599 , p_accounting_coa_id => l_adr_accounting_coa_id
30600 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
30601 , p_adr_type_code => 'S'
30602 , p_component_type => l_component_type
30603 , p_component_code => l_component_code
30604 , p_component_type_code => l_component_type_code
30605 , p_component_appl_id => l_component_appl_id
30606 , p_amb_context_code => l_amb_context_code
30607 , p_side => 'NA'
30608 );
30609
30610
30611 l_segment := AcctDerRule_169(
30612 p_application_id => p_application_id
30613 , p_ae_header_id => l_ae_header_id
30614 , p_source_5 => p_source_5
30615 , p_source_31 => p_source_31
30616 , x_transaction_coa_id => l_adr_transaction_coa_id
30617 , x_accounting_coa_id => l_adr_accounting_coa_id
30618 , x_flexfield_segment_code => l_adr_flexfield_segment_code
30619 , x_flex_value_set_id => l_adr_flex_value_set_id
30620 , x_value_type_code => l_adr_value_type_code
30621 , x_value_combination_id => l_adr_value_combination_id
30622 , x_value_segment_code => l_adr_value_segment_code
30623 , p_side => 'NA'
30624 , p_override_seg_flag => 'Y'
30625 );
30626
30627 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
30628
30629 xla_ae_lines_pkg.set_segment(
30630 p_to_segment_code => 'GL_BALANCING'
30631 , p_segment_value => l_segment
30632 , p_from_segment_code => l_adr_value_segment_code
30633 , p_from_combination_id => l_adr_value_combination_id
30634 , p_value_type_code => l_adr_value_type_code
30635 , p_transaction_coa_id => l_adr_transaction_coa_id
30636 , p_accounting_coa_id => l_adr_accounting_coa_id
30637 , p_flexfield_segment_code => l_adr_flexfield_segment_code
30638 , p_flex_value_set_id => l_adr_flex_value_set_id
30639 , p_adr_code => 'FA_EXPENSE_ACCT'
30640 , p_adr_type_code => 'S'
30641 , p_component_type => l_component_type
30642 , p_component_code => l_component_code
30643 , p_component_type_code => l_component_type_code
30644 , p_component_appl_id => l_component_appl_id
30645 , p_amb_context_code => l_amb_context_code
30646 , p_entity_code => 'TRANSACTIONS'
30647 , p_event_class_code => 'ADJUSTMENTS'
30648 , p_side => 'NA'
30649 );
30650
30651 END IF;
30652
30653 l_segment := AcctDerRule_158(
30654 p_application_id => p_application_id
30655 , p_ae_header_id => l_ae_header_id
30656 , p_source_5 => p_source_5
30657 , p_source_21 => p_source_21
30658 , x_transaction_coa_id => l_adr_transaction_coa_id
30659 , x_accounting_coa_id => l_adr_accounting_coa_id
30660 , x_flexfield_segment_code => l_adr_flexfield_segment_code
30661 , x_flex_value_set_id => l_adr_flex_value_set_id
30662 , x_value_type_code => l_adr_value_type_code
30663 , x_value_combination_id => l_adr_value_combination_id
30667 );
30664 , x_value_segment_code => l_adr_value_segment_code
30665 , p_side => 'NA'
30666 , p_override_seg_flag => 'Y'
30668
30669 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
30670
30671 xla_ae_lines_pkg.set_segment(
30672 p_to_segment_code => 'GL_ACCOUNT'
30673 , p_segment_value => l_segment
30674 , p_from_segment_code => l_adr_value_segment_code
30675 , p_from_combination_id => l_adr_value_combination_id
30676 , p_value_type_code => l_adr_value_type_code
30677 , p_transaction_coa_id => l_adr_transaction_coa_id
30678 , p_accounting_coa_id => l_adr_accounting_coa_id
30679 , p_flexfield_segment_code => l_adr_flexfield_segment_code
30680 , p_flex_value_set_id => l_adr_flex_value_set_id
30681 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
30682 , p_adr_type_code => 'S'
30683 , p_component_type => l_component_type
30684 , p_component_code => l_component_code
30685 , p_component_type_code => l_component_type_code
30686 , p_component_appl_id => l_component_appl_id
30687 , p_amb_context_code => l_amb_context_code
30688 , p_entity_code => 'TRANSACTIONS'
30689 , p_event_class_code => 'ADJUSTMENTS'
30690 , p_side => 'NA'
30691 );
30692
30693 END IF;
30694
30695 --
30696 --
30697 END IF;
30698
30699 --
30700 -- Update the line information that should be overwritten
30701 --
30702 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
30703 p_header_num => 1);
30704 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
30705
30706 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
30707
30708 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
30709 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
30710 END IF;
30711
30712 --
30713 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
30714 --
30715 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
30716 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
30717 ELSE
30718 ---------------------------------------------------------------------------------------------------
30719 -- 4262811a Switch Sign
30720 ---------------------------------------------------------------------------------------------------
30721 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
30722 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
30723 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
30724 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
30725 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
30726 -- 5132302
30727 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
30728 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
30729
30730 END IF;
30731
30732 -- 4955764
30733 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
30734 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
30735
30736
30737 XLA_AE_LINES_PKG.ValidateCurrentLine;
30738 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
30739
30740 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
30741 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
30742 ,p_balance_type_code => l_balance_type_code);
30743
30744 END IF;
30745
30746 -----------------------------------------------------------------------------------------
30747 -- 4262811 Multiperiod Accounting
30748 -----------------------------------------------------------------------------------------
30749 -- No MPA option is assigned.
30750
30751
30752 END IF;
30753 END IF;
30754 --
30755
30756 --
30757 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
30758 trace
30759 (p_msg => 'END of AcctLineType_207'
30760 ,p_level => C_LEVEL_PROCEDURE
30761 ,p_module => l_log_module);
30762 END IF;
30763 --
30764 EXCEPTION
30765 WHEN xla_exceptions_pkg.application_exception THEN
30766 RAISE;
30767 WHEN OTHERS THEN
30768 xla_exceptions_pkg.raise_message
30769 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_207');
30770 END AcctLineType_207;
30771 --
30772
30773 ---------------------------------------
30774 --
30775 -- PRIVATE FUNCTION
30776 -- AcctLineType_208
30777 --
30778 ---------------------------------------
30779 PROCEDURE AcctLineType_208 (
30780 p_application_id IN NUMBER
30784 ,p_actual_flag IN OUT VARCHAR2
30781 ,p_event_id IN NUMBER
30782 ,p_calculate_acctd_flag IN VARCHAR2
30783 ,p_calculate_g_l_flag IN VARCHAR2
30785 ,p_balance_type_code OUT VARCHAR2
30786 ,p_gain_or_loss_ref OUT VARCHAR2
30787
30788 --Period Close Date
30789 , p_source_1 IN DATE
30790 --Generated Code Combination Identifier
30791 , p_source_5 IN NUMBER
30792 --Intercompany Receivables Account
30793 , p_source_22 IN VARCHAR2
30794 --Expense Account Code Combination Identifier
30795 , p_source_31 IN NUMBER
30796 --Default Code Combination Identifier
30797 , p_source_32 IN NUMBER
30798 --Adjustment Type
30799 , p_source_48 IN VARCHAR2
30800 --Transaction Header Identifier
30801 , p_source_49 IN NUMBER
30802 --Adjustment Line Identifier
30803 , p_source_50 IN NUMBER
30804 --Distribution Type Code
30805 , p_source_51 IN VARCHAR2
30806 --Entered Amount
30807 , p_source_52 IN NUMBER
30808 --Currency Code
30809 , p_source_53 IN VARCHAR2
30810 )
30811 IS
30812
30813 l_component_type VARCHAR2(80);
30814 l_component_code VARCHAR2(30);
30815 l_component_type_code VARCHAR2(1);
30816 l_component_appl_id INTEGER;
30817 l_amb_context_code VARCHAR2(30);
30818 l_entity_code VARCHAR2(30);
30819 l_event_class_code VARCHAR2(30);
30820 l_ae_header_id NUMBER;
30821 l_event_type_code VARCHAR2(30);
30822 l_line_definition_code VARCHAR2(30);
30823 l_line_definition_owner_code VARCHAR2(1);
30824 --
30825 -- adr variables
30826 l_segment VARCHAR2(30);
30827 l_ccid NUMBER;
30828 l_adr_transaction_coa_id NUMBER;
30829 l_adr_accounting_coa_id NUMBER;
30830 l_adr_flexfield_segment_code VARCHAR2(30);
30831 l_adr_flex_value_set_id NUMBER;
30832 l_adr_value_type_code VARCHAR2(30);
30833 l_adr_value_combination_id NUMBER;
30834 l_adr_value_segment_code VARCHAR2(30);
30835
30836 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
30837 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
30838 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
30839 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
30840
30841 -- 4262811 Variables ------------------------------------------------------------------------------------------
30842 l_entered_amt_idx NUMBER;
30843 l_accted_amt_idx NUMBER;
30844 l_acc_rev_flag VARCHAR2(1);
30845 l_accrual_line_num NUMBER;
30846 l_tmp_amt NUMBER;
30847 l_acc_rev_natural_side_code VARCHAR2(1);
30848
30849 l_num_entries NUMBER;
30850 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
30851 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
30852 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
30853 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
30854 l_recog_line_1 NUMBER;
30855 l_recog_line_2 NUMBER;
30856
30857 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
30858 l_bflow_applied_to_amt NUMBER; -- 5132302
30859 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
30860
30861 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
30862
30863 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
30864 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
30865
30866 ---------------------------------------------------------------------------------------------------------------
30867
30868
30869 --
30870 -- bulk performance
30871 --
30872 l_balance_type_code VARCHAR2(1);
30873 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
30874 l_log_module VARCHAR2(240);
30875
30876 --
30877 -- Upgrade strategy
30878 --
30879 l_actual_upg_option VARCHAR2(1);
30880 l_enc_upg_option VARCHAR2(1);
30881
30882 --
30883 BEGIN
30884 --
30885 IF g_log_enabled THEN
30886 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_208';
30887 END IF;
30888 --
30889 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
30890
30891 trace
30892 (p_msg => 'BEGIN of AcctLineType_208'
30893 ,p_level => C_LEVEL_PROCEDURE
30894 ,p_module => l_log_module);
30895
30896 END IF;
30897 --
30898 l_component_type := 'AMB_JLT';
30899 l_component_code := 'FA_ADJ_IC_REC';
30900 l_component_type_code := 'S';
30901 l_component_appl_id := 140;
30902 l_amb_context_code := 'DEFAULT';
30903 l_entity_code := 'TRANSACTIONS';
30904 l_event_class_code := 'ADJUSTMENTS';
30905 l_event_type_code := 'ADJUSTMENTS_ALL';
30906 l_line_definition_owner_code := 'S';
30907 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADJUST2';
30908 --
30909 l_balance_type_code := 'A';
30913 l_adr_accounting_coa_id := NULL;
30910 l_segment := NULL;
30911 l_ccid := NULL;
30912 l_adr_transaction_coa_id := NULL;
30914 l_adr_flexfield_segment_code := NULL;
30915 l_adr_flex_value_set_id := NULL;
30916 l_adr_value_type_code := NULL;
30917 l_adr_value_combination_id := NULL;
30918 l_adr_value_segment_code := NULL;
30919
30920 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
30921 l_bflow_class_code := ''; -- 4219869 Business Flow
30922 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
30923 l_budgetary_control_flag := 'N';
30924
30925 l_bflow_applied_to_amt_idx := NULL; -- 5132302
30926 l_bflow_applied_to_amt := NULL; -- 5132302
30927 l_entered_amt_idx := NULL; -- 4262811
30928 l_accted_amt_idx := NULL; -- 4262811
30929 l_acc_rev_flag := NULL; -- 4262811
30930 l_accrual_line_num := NULL; -- 4262811
30931 l_tmp_amt := NULL; -- 4262811
30932 --
30933
30934 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
30935 l_balance_type_code <> 'B' THEN
30936 IF NVL(p_source_48,'
30937 ') = 'INTERCO AR'
30938 THEN
30939
30940 --
30941 XLA_AE_LINES_PKG.SetNewLine;
30942
30943 p_balance_type_code := l_balance_type_code;
30944 -- set the flag so later we will know whether the gain loss line needs to be created
30945
30946 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
30947 p_actual_flag :='A';
30948 END IF;
30949
30950 --
30951 -- bulk performance
30952 --
30953 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
30954 p_header_num => 0); -- 4262811
30955 --
30956 -- set accounting line options
30957 --
30958 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
30959 p_natural_side_code => 'D'
30960 , p_gain_or_loss_flag => 'N'
30961 , p_gl_transfer_mode_code => 'S'
30962 , p_acct_entry_type_code => 'A'
30963 , p_switch_side_flag => 'Y'
30964 , p_merge_duplicate_code => 'N'
30965 );
30966 --
30967 l_acc_rev_natural_side_code := 'C'; -- 4262811
30968 --
30969 --
30970 -- set accounting line type info
30971 --
30972 xla_ae_lines_pkg.SetAcctLineType
30973 (p_component_type => l_component_type
30974 ,p_event_type_code => l_event_type_code
30975 ,p_line_definition_owner_code => l_line_definition_owner_code
30976 ,p_line_definition_code => l_line_definition_code
30977 ,p_accounting_line_code => l_component_code
30978 ,p_accounting_line_type_code => l_component_type_code
30979 ,p_accounting_line_appl_id => l_component_appl_id
30980 ,p_amb_context_code => l_amb_context_code
30981 ,p_entity_code => l_entity_code
30982 ,p_event_class_code => l_event_class_code);
30983 --
30984 -- set accounting class
30985 --
30986 xla_ae_lines_pkg.SetAcctClass(
30987 p_accounting_class_code => 'ASSET'
30988 , p_ae_header_id => l_ae_header_id
30989 );
30990
30991 --
30992 -- set rounding class
30993 --
30994 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
30995 'ASSET';
30996
30997 --
30998 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
30999 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
31000 --
31001 -- bulk performance
31002 --
31003 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
31004
31005 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
31006 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
31007
31008 -- 4955764
31009 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
31010 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
31011
31012 -- 4458381 Public Sector Enh
31013
31014 --
31015 -- set accounting attributes for the line type
31016 --
31017 l_entered_amt_idx := 4;
31018 l_accted_amt_idx := 6;
31019 l_bflow_applied_to_amt_idx := NULL; -- 5132302
31020 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
31021 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
31022 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
31023 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
31024 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
31025 l_rec_acct_attrs.array_char_value(3) := p_source_51;
31026 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
31027 l_rec_acct_attrs.array_num_value(4) := p_source_52;
31028 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
31029 l_rec_acct_attrs.array_char_value(5) := p_source_53;
31030 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
31031 l_rec_acct_attrs.array_num_value(6) := p_source_52;
31032
31036 ---------------------------------------------------------------------------------------------------------------
31033 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
31034 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
31035
31037 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
31038 ---------------------------------------------------------------------------------------------------------------
31039 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
31040
31041 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
31042 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
31043
31044 IF xla_accounting_cache_pkg.GetValueChar
31045 (p_source_code => 'LEDGER_CATEGORY_CODE'
31046 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
31047 AND l_bflow_method_code = 'PRIOR_ENTRY'
31048 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
31049 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
31050 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
31051 )
31052 THEN
31053 xla_ae_lines_pkg.BflowUpgEntry
31054 (p_business_method_code => l_bflow_method_code
31055 ,p_business_class_code => l_bflow_class_code
31056 ,p_balance_type => l_balance_type_code);
31057 ELSE
31058 NULL;
31059 -- No business flow processing for business flow method of NONE.
31060 END IF;
31061
31062 --
31063 -- call analytical criteria
31064 --
31065
31066 --
31067 -- call description
31068 --
31069
31070 xla_ae_lines_pkg.SetLineDescription(
31071 p_ae_header_id => l_ae_header_id
31072 ,p_description => Description_14 (
31073 p_application_id => p_application_id
31074 , p_ae_header_id => l_ae_header_id
31075 , p_source_1 => p_source_1
31076 )
31077 );
31078
31079
31080 --
31081 -- call ADRs
31082 -- Bug 4922099
31083 --
31084 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
31085 (NVL(l_actual_upg_option, 'N') = 'O') OR
31086 (NVL(l_enc_upg_option, 'N') = 'O')
31087 )
31088 THEN
31089 NULL;
31090 --
31091 --
31092
31093 l_ccid := AcctDerRule_174(
31094 p_application_id => p_application_id
31095 , p_ae_header_id => l_ae_header_id
31096 , p_source_5 => p_source_5
31097 , p_source_32 => p_source_32
31098 , x_transaction_coa_id => l_adr_transaction_coa_id
31099 , x_accounting_coa_id => l_adr_accounting_coa_id
31100 , x_value_type_code => l_adr_value_type_code
31101 , p_side => 'NA'
31102 );
31103
31104 xla_ae_lines_pkg.set_ccid(
31105 p_code_combination_id => l_ccid
31106 , p_value_type_code => l_adr_value_type_code
31107 , p_transaction_coa_id => l_adr_transaction_coa_id
31108 , p_accounting_coa_id => l_adr_accounting_coa_id
31109 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
31110 , p_adr_type_code => 'S'
31111 , p_component_type => l_component_type
31112 , p_component_code => l_component_code
31113 , p_component_type_code => l_component_type_code
31114 , p_component_appl_id => l_component_appl_id
31115 , p_amb_context_code => l_amb_context_code
31116 , p_side => 'NA'
31117 );
31118
31119
31120 l_segment := AcctDerRule_169(
31121 p_application_id => p_application_id
31122 , p_ae_header_id => l_ae_header_id
31123 , p_source_5 => p_source_5
31124 , p_source_31 => p_source_31
31125 , x_transaction_coa_id => l_adr_transaction_coa_id
31126 , x_accounting_coa_id => l_adr_accounting_coa_id
31127 , x_flexfield_segment_code => l_adr_flexfield_segment_code
31128 , x_flex_value_set_id => l_adr_flex_value_set_id
31129 , x_value_type_code => l_adr_value_type_code
31130 , x_value_combination_id => l_adr_value_combination_id
31131 , x_value_segment_code => l_adr_value_segment_code
31132 , p_side => 'NA'
31133 , p_override_seg_flag => 'Y'
31134 );
31135
31136 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
31137
31138 xla_ae_lines_pkg.set_segment(
31139 p_to_segment_code => 'GL_BALANCING'
31140 , p_segment_value => l_segment
31141 , p_from_segment_code => l_adr_value_segment_code
31142 , p_from_combination_id => l_adr_value_combination_id
31143 , p_value_type_code => l_adr_value_type_code
31144 , p_transaction_coa_id => l_adr_transaction_coa_id
31145 , p_accounting_coa_id => l_adr_accounting_coa_id
31146 , p_flexfield_segment_code => l_adr_flexfield_segment_code
31147 , p_flex_value_set_id => l_adr_flex_value_set_id
31148 , p_adr_code => 'FA_EXPENSE_ACCT'
31149 , p_adr_type_code => 'S'
31153 , p_component_appl_id => l_component_appl_id
31150 , p_component_type => l_component_type
31151 , p_component_code => l_component_code
31152 , p_component_type_code => l_component_type_code
31154 , p_amb_context_code => l_amb_context_code
31155 , p_entity_code => 'TRANSACTIONS'
31156 , p_event_class_code => 'ADJUSTMENTS'
31157 , p_side => 'NA'
31158 );
31159
31160 END IF;
31161
31162 l_segment := AcctDerRule_159(
31163 p_application_id => p_application_id
31164 , p_ae_header_id => l_ae_header_id
31165 , p_source_5 => p_source_5
31166 , p_source_22 => p_source_22
31167 , x_transaction_coa_id => l_adr_transaction_coa_id
31168 , x_accounting_coa_id => l_adr_accounting_coa_id
31169 , x_flexfield_segment_code => l_adr_flexfield_segment_code
31170 , x_flex_value_set_id => l_adr_flex_value_set_id
31171 , x_value_type_code => l_adr_value_type_code
31172 , x_value_combination_id => l_adr_value_combination_id
31173 , x_value_segment_code => l_adr_value_segment_code
31174 , p_side => 'NA'
31175 , p_override_seg_flag => 'Y'
31176 );
31177
31178 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
31179
31180 xla_ae_lines_pkg.set_segment(
31181 p_to_segment_code => 'GL_ACCOUNT'
31182 , p_segment_value => l_segment
31183 , p_from_segment_code => l_adr_value_segment_code
31184 , p_from_combination_id => l_adr_value_combination_id
31185 , p_value_type_code => l_adr_value_type_code
31186 , p_transaction_coa_id => l_adr_transaction_coa_id
31187 , p_accounting_coa_id => l_adr_accounting_coa_id
31188 , p_flexfield_segment_code => l_adr_flexfield_segment_code
31189 , p_flex_value_set_id => l_adr_flex_value_set_id
31190 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
31191 , p_adr_type_code => 'S'
31192 , p_component_type => l_component_type
31193 , p_component_code => l_component_code
31194 , p_component_type_code => l_component_type_code
31195 , p_component_appl_id => l_component_appl_id
31196 , p_amb_context_code => l_amb_context_code
31197 , p_entity_code => 'TRANSACTIONS'
31198 , p_event_class_code => 'ADJUSTMENTS'
31199 , p_side => 'NA'
31200 );
31201
31202 END IF;
31203
31204 --
31205 --
31206 END IF;
31207 --
31208 -- Bug 4922099
31209 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
31210 (NVL(l_enc_upg_option, 'N') = 'O')
31211 ) AND
31212 (l_bflow_method_code = 'PRIOR_ENTRY')
31213 )
31214 THEN
31215 IF
31216 --
31217 1 = 2
31218 --
31219 THEN
31220 xla_accounting_err_pkg.build_message
31221 (p_appli_s_name => 'XLA'
31222 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
31223 ,p_token_1 => 'LINE_NUMBER'
31224 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
31225 ,p_token_2 => 'LINE_TYPE_NAME'
31226 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
31227 l_component_type
31228 ,l_component_code
31229 ,l_component_type_code
31230 ,l_component_appl_id
31231 ,l_amb_context_code
31232 ,l_entity_code
31233 ,l_event_class_code
31234 )
31235 ,p_token_3 => 'OWNER'
31236 ,p_value_3 => xla_lookups_pkg.get_meaning(
31237 p_lookup_type => 'XLA_OWNER_TYPE'
31238 ,p_lookup_code => l_component_type_code
31239 )
31240 ,p_token_4 => 'PRODUCT_NAME'
31241 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
31242 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
31243 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
31244 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
31248 IF (C_LEVEL_ERROR>= g_log_level) THEN
31245 ,p_ae_header_id => NULL
31246 );
31247
31249 trace
31250 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
31251 ,p_level => C_LEVEL_ERROR
31252 ,p_module => l_log_module);
31253 END IF;
31254 END IF;
31255 END IF;
31256 --
31257 --
31258 ------------------------------------------------------------------------------------------------
31259 -- 4219869 Business Flow
31260 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
31261 -- Prior Entry. Currently, the following code is always generated.
31262 ------------------------------------------------------------------------------------------------
31263 XLA_AE_LINES_PKG.ValidateCurrentLine;
31264
31265 ------------------------------------------------------------------------------------
31266 -- 4219869 Business Flow
31267 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
31268 ------------------------------------------------------------------------------------
31269 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
31270
31271 ----------------------------------------------------------------------------------
31272 -- 4219869 Business Flow
31273 -- Update journal entry status -- Need to generate this within IF <condition>
31274 ----------------------------------------------------------------------------------
31275 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
31276 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
31277 ,p_balance_type_code => l_balance_type_code
31278 );
31279
31280 -------------------------------------------------------------------------------------------
31281 -- 4262811 - Generate the Accrual Reversal lines
31282 -------------------------------------------------------------------------------------------
31283 BEGIN
31284 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
31285 (g_array_event(p_event_id).array_value_num('header_index'));
31286 IF l_acc_rev_flag IS NULL THEN
31287 l_acc_rev_flag := 'N';
31288 END IF;
31289 EXCEPTION
31290 WHEN OTHERS THEN
31291 l_acc_rev_flag := 'N';
31292 END;
31293 --
31294 IF (l_acc_rev_flag = 'Y') THEN
31295
31296 -- 4645092 ------------------------------------------------------------------------------
31297 -- To allow MPA report to determine if it should generate report process
31298 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
31299 ------------------------------------------------------------------------------------------
31300
31301 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
31302 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
31303 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
31304 -- call ADRs
31305 -- Bug 4922099
31306 --
31307 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
31308 (NVL(l_actual_upg_option, 'N') = 'O') OR
31309 (NVL(l_enc_upg_option, 'N') = 'O')
31310 )
31311 THEN
31312 NULL;
31313 --
31314 --
31315
31316 l_ccid := AcctDerRule_174(
31317 p_application_id => p_application_id
31318 , p_ae_header_id => l_ae_header_id
31319 , p_source_5 => p_source_5
31320 , p_source_32 => p_source_32
31321 , x_transaction_coa_id => l_adr_transaction_coa_id
31322 , x_accounting_coa_id => l_adr_accounting_coa_id
31323 , x_value_type_code => l_adr_value_type_code
31324 , p_side => 'NA'
31325 );
31326
31327 xla_ae_lines_pkg.set_ccid(
31328 p_code_combination_id => l_ccid
31329 , p_value_type_code => l_adr_value_type_code
31330 , p_transaction_coa_id => l_adr_transaction_coa_id
31331 , p_accounting_coa_id => l_adr_accounting_coa_id
31332 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
31333 , p_adr_type_code => 'S'
31334 , p_component_type => l_component_type
31335 , p_component_code => l_component_code
31336 , p_component_type_code => l_component_type_code
31337 , p_component_appl_id => l_component_appl_id
31338 , p_amb_context_code => l_amb_context_code
31339 , p_side => 'NA'
31340 );
31341
31342
31343 l_segment := AcctDerRule_169(
31344 p_application_id => p_application_id
31345 , p_ae_header_id => l_ae_header_id
31346 , p_source_5 => p_source_5
31347 , p_source_31 => p_source_31
31348 , x_transaction_coa_id => l_adr_transaction_coa_id
31349 , x_accounting_coa_id => l_adr_accounting_coa_id
31350 , x_flexfield_segment_code => l_adr_flexfield_segment_code
31351 , x_flex_value_set_id => l_adr_flex_value_set_id
31352 , x_value_type_code => l_adr_value_type_code
31353 , x_value_combination_id => l_adr_value_combination_id
31354 , x_value_segment_code => l_adr_value_segment_code
31358
31355 , p_side => 'NA'
31356 , p_override_seg_flag => 'Y'
31357 );
31359 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
31360
31361 xla_ae_lines_pkg.set_segment(
31362 p_to_segment_code => 'GL_BALANCING'
31363 , p_segment_value => l_segment
31364 , p_from_segment_code => l_adr_value_segment_code
31365 , p_from_combination_id => l_adr_value_combination_id
31366 , p_value_type_code => l_adr_value_type_code
31367 , p_transaction_coa_id => l_adr_transaction_coa_id
31368 , p_accounting_coa_id => l_adr_accounting_coa_id
31369 , p_flexfield_segment_code => l_adr_flexfield_segment_code
31370 , p_flex_value_set_id => l_adr_flex_value_set_id
31371 , p_adr_code => 'FA_EXPENSE_ACCT'
31372 , p_adr_type_code => 'S'
31373 , p_component_type => l_component_type
31374 , p_component_code => l_component_code
31375 , p_component_type_code => l_component_type_code
31376 , p_component_appl_id => l_component_appl_id
31377 , p_amb_context_code => l_amb_context_code
31378 , p_entity_code => 'TRANSACTIONS'
31379 , p_event_class_code => 'ADJUSTMENTS'
31380 , p_side => 'NA'
31381 );
31382
31383 END IF;
31384
31385 l_segment := AcctDerRule_159(
31386 p_application_id => p_application_id
31387 , p_ae_header_id => l_ae_header_id
31388 , p_source_5 => p_source_5
31389 , p_source_22 => p_source_22
31390 , x_transaction_coa_id => l_adr_transaction_coa_id
31391 , x_accounting_coa_id => l_adr_accounting_coa_id
31392 , x_flexfield_segment_code => l_adr_flexfield_segment_code
31393 , x_flex_value_set_id => l_adr_flex_value_set_id
31394 , x_value_type_code => l_adr_value_type_code
31395 , x_value_combination_id => l_adr_value_combination_id
31396 , x_value_segment_code => l_adr_value_segment_code
31397 , p_side => 'NA'
31398 , p_override_seg_flag => 'Y'
31399 );
31400
31401 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
31402
31403 xla_ae_lines_pkg.set_segment(
31404 p_to_segment_code => 'GL_ACCOUNT'
31405 , p_segment_value => l_segment
31406 , p_from_segment_code => l_adr_value_segment_code
31407 , p_from_combination_id => l_adr_value_combination_id
31408 , p_value_type_code => l_adr_value_type_code
31409 , p_transaction_coa_id => l_adr_transaction_coa_id
31410 , p_accounting_coa_id => l_adr_accounting_coa_id
31411 , p_flexfield_segment_code => l_adr_flexfield_segment_code
31412 , p_flex_value_set_id => l_adr_flex_value_set_id
31413 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
31414 , p_adr_type_code => 'S'
31415 , p_component_type => l_component_type
31416 , p_component_code => l_component_code
31417 , p_component_type_code => l_component_type_code
31418 , p_component_appl_id => l_component_appl_id
31419 , p_amb_context_code => l_amb_context_code
31420 , p_entity_code => 'TRANSACTIONS'
31421 , p_event_class_code => 'ADJUSTMENTS'
31422 , p_side => 'NA'
31423 );
31424
31425 END IF;
31426
31427 --
31428 --
31429 END IF;
31430
31431 --
31432 -- Update the line information that should be overwritten
31433 --
31434 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
31435 p_header_num => 1);
31436 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
31437
31438 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
31439
31440 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
31441 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
31442 END IF;
31443
31444 --
31445 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
31446 --
31447 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
31448 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
31449 ELSE
31450 ---------------------------------------------------------------------------------------------------
31451 -- 4262811a Switch Sign
31452 ---------------------------------------------------------------------------------------------------
31453 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
31454 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
31455 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
31456 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
31457 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
31458 -- 5132302
31462 END IF;
31459 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
31460 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
31461
31463
31464 -- 4955764
31465 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
31466 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
31467
31468
31469 XLA_AE_LINES_PKG.ValidateCurrentLine;
31470 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
31471
31472 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
31473 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
31474 ,p_balance_type_code => l_balance_type_code);
31475
31476 END IF;
31477
31478 -----------------------------------------------------------------------------------------
31479 -- 4262811 Multiperiod Accounting
31480 -----------------------------------------------------------------------------------------
31481 -- No MPA option is assigned.
31482
31483
31484 END IF;
31485 END IF;
31486 --
31487
31488 --
31489 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
31490 trace
31491 (p_msg => 'END of AcctLineType_208'
31492 ,p_level => C_LEVEL_PROCEDURE
31493 ,p_module => l_log_module);
31494 END IF;
31495 --
31496 EXCEPTION
31497 WHEN xla_exceptions_pkg.application_exception THEN
31498 RAISE;
31499 WHEN OTHERS THEN
31500 xla_exceptions_pkg.raise_message
31501 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_208');
31502 END AcctLineType_208;
31503 --
31504
31505 ---------------------------------------
31506 --
31507 -- PRIVATE FUNCTION
31508 -- AcctLineType_209
31509 --
31510 ---------------------------------------
31511 PROCEDURE AcctLineType_209 (
31512 p_application_id IN NUMBER
31513 ,p_event_id IN NUMBER
31514 ,p_calculate_acctd_flag IN VARCHAR2
31515 ,p_calculate_g_l_flag IN VARCHAR2
31516 ,p_actual_flag IN OUT VARCHAR2
31517 ,p_balance_type_code OUT VARCHAR2
31518 ,p_gain_or_loss_ref OUT VARCHAR2
31519
31520 --Period Close Date
31521 , p_source_1 IN DATE
31522 --Generated Code Combination Identifier
31523 , p_source_5 IN NUMBER
31524 --Depreciation Reserve Account
31525 , p_source_12 IN VARCHAR2
31526 --Generated Offset Code Combination Identifier
31527 , p_source_19 IN NUMBER
31528 --Expense Account Code Combination Identifier
31529 , p_source_31 IN NUMBER
31530 --Default Code Combination Identifier
31531 , p_source_32 IN NUMBER
31532 --Adjustment Type
31533 , p_source_48 IN VARCHAR2
31534 --Transaction Header Identifier
31535 , p_source_49 IN NUMBER
31536 --Adjustment Line Identifier
31537 , p_source_50 IN NUMBER
31538 --Distribution Type Code
31539 , p_source_51 IN VARCHAR2
31540 --Entered Amount
31541 , p_source_52 IN NUMBER
31542 --Currency Code
31543 , p_source_53 IN VARCHAR2
31544 )
31545 IS
31546
31547 l_component_type VARCHAR2(80);
31548 l_component_code VARCHAR2(30);
31549 l_component_type_code VARCHAR2(1);
31550 l_component_appl_id INTEGER;
31551 l_amb_context_code VARCHAR2(30);
31552 l_entity_code VARCHAR2(30);
31553 l_event_class_code VARCHAR2(30);
31554 l_ae_header_id NUMBER;
31555 l_event_type_code VARCHAR2(30);
31556 l_line_definition_code VARCHAR2(30);
31557 l_line_definition_owner_code VARCHAR2(1);
31558 --
31559 -- adr variables
31560 l_segment VARCHAR2(30);
31561 l_ccid NUMBER;
31562 l_adr_transaction_coa_id NUMBER;
31563 l_adr_accounting_coa_id NUMBER;
31564 l_adr_flexfield_segment_code VARCHAR2(30);
31565 l_adr_flex_value_set_id NUMBER;
31566 l_adr_value_type_code VARCHAR2(30);
31567 l_adr_value_combination_id NUMBER;
31568 l_adr_value_segment_code VARCHAR2(30);
31569
31570 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
31571 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
31572 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
31573 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
31574
31575 -- 4262811 Variables ------------------------------------------------------------------------------------------
31576 l_entered_amt_idx NUMBER;
31577 l_accted_amt_idx NUMBER;
31578 l_acc_rev_flag VARCHAR2(1);
31579 l_accrual_line_num NUMBER;
31580 l_tmp_amt NUMBER;
31581 l_acc_rev_natural_side_code VARCHAR2(1);
31582
31583 l_num_entries NUMBER;
31584 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
31585 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
31586 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
31587 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
31588 l_recog_line_1 NUMBER;
31592 l_bflow_applied_to_amt NUMBER; -- 5132302
31589 l_recog_line_2 NUMBER;
31590
31591 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
31593 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
31594
31595 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
31596
31597 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
31598 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
31599
31600 ---------------------------------------------------------------------------------------------------------------
31601
31602
31603 --
31604 -- bulk performance
31605 --
31606 l_balance_type_code VARCHAR2(1);
31607 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
31608 l_log_module VARCHAR2(240);
31609
31610 --
31611 -- Upgrade strategy
31612 --
31613 l_actual_upg_option VARCHAR2(1);
31614 l_enc_upg_option VARCHAR2(1);
31615
31616 --
31617 BEGIN
31618 --
31619 IF g_log_enabled THEN
31620 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_209';
31621 END IF;
31622 --
31623 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
31624
31625 trace
31626 (p_msg => 'BEGIN of AcctLineType_209'
31627 ,p_level => C_LEVEL_PROCEDURE
31628 ,p_module => l_log_module);
31629
31630 END IF;
31631 --
31632 l_component_type := 'AMB_JLT';
31633 l_component_code := 'FA_ADJ_RESERVE';
31634 l_component_type_code := 'S';
31635 l_component_appl_id := 140;
31636 l_amb_context_code := 'DEFAULT';
31637 l_entity_code := 'TRANSACTIONS';
31638 l_event_class_code := 'ADJUSTMENTS';
31639 l_event_type_code := 'ADJUSTMENTS_ALL';
31640 l_line_definition_owner_code := 'S';
31641 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADJUST2';
31642 --
31643 l_balance_type_code := 'A';
31644 l_segment := NULL;
31645 l_ccid := NULL;
31646 l_adr_transaction_coa_id := NULL;
31647 l_adr_accounting_coa_id := NULL;
31648 l_adr_flexfield_segment_code := NULL;
31649 l_adr_flex_value_set_id := NULL;
31650 l_adr_value_type_code := NULL;
31651 l_adr_value_combination_id := NULL;
31652 l_adr_value_segment_code := NULL;
31653
31654 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
31655 l_bflow_class_code := ''; -- 4219869 Business Flow
31656 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
31657 l_budgetary_control_flag := 'N';
31658
31659 l_bflow_applied_to_amt_idx := NULL; -- 5132302
31660 l_bflow_applied_to_amt := NULL; -- 5132302
31661 l_entered_amt_idx := NULL; -- 4262811
31662 l_accted_amt_idx := NULL; -- 4262811
31663 l_acc_rev_flag := NULL; -- 4262811
31664 l_accrual_line_num := NULL; -- 4262811
31665 l_tmp_amt := NULL; -- 4262811
31666 --
31667
31668 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
31669 l_balance_type_code <> 'B' THEN
31670 IF (NVL(p_source_48,'
31671 ') = 'EXPENSE' OR
31672 NVL(p_source_48,'
31673 ') = 'RESERVE')
31674 THEN
31675
31676 --
31677 XLA_AE_LINES_PKG.SetNewLine;
31678
31679 p_balance_type_code := l_balance_type_code;
31680 -- set the flag so later we will know whether the gain loss line needs to be created
31681
31682 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
31683 p_actual_flag :='A';
31684 END IF;
31685
31686 --
31687 -- bulk performance
31688 --
31689 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
31690 p_header_num => 0); -- 4262811
31691 --
31692 -- set accounting line options
31693 --
31694 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
31695 p_natural_side_code => 'C'
31696 , p_gain_or_loss_flag => 'N'
31697 , p_gl_transfer_mode_code => 'S'
31698 , p_acct_entry_type_code => 'A'
31699 , p_switch_side_flag => 'Y'
31700 , p_merge_duplicate_code => 'N'
31701 );
31702 --
31703 l_acc_rev_natural_side_code := 'D'; -- 4262811
31704 --
31705 --
31706 -- set accounting line type info
31707 --
31708 xla_ae_lines_pkg.SetAcctLineType
31709 (p_component_type => l_component_type
31710 ,p_event_type_code => l_event_type_code
31711 ,p_line_definition_owner_code => l_line_definition_owner_code
31712 ,p_line_definition_code => l_line_definition_code
31713 ,p_accounting_line_code => l_component_code
31714 ,p_accounting_line_type_code => l_component_type_code
31715 ,p_accounting_line_appl_id => l_component_appl_id
31716 ,p_amb_context_code => l_amb_context_code
31717 ,p_entity_code => l_entity_code
31718 ,p_event_class_code => l_event_class_code);
31719 --
31720 -- set accounting class
31721 --
31722 xla_ae_lines_pkg.SetAcctClass(
31726
31723 p_accounting_class_code => 'ASSET'
31724 , p_ae_header_id => l_ae_header_id
31725 );
31727 --
31728 -- set rounding class
31729 --
31730 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
31731 'ASSET';
31732
31733 --
31734 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
31735 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
31736 --
31737 -- bulk performance
31738 --
31739 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
31740
31741 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
31742 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
31743
31744 -- 4955764
31745 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
31746 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
31747
31748 -- 4458381 Public Sector Enh
31749
31750 --
31751 -- set accounting attributes for the line type
31752 --
31753 l_entered_amt_idx := 4;
31754 l_accted_amt_idx := 6;
31755 l_bflow_applied_to_amt_idx := NULL; -- 5132302
31756 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
31757 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
31758 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
31759 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
31760 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
31761 l_rec_acct_attrs.array_char_value(3) := p_source_51;
31762 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
31763 l_rec_acct_attrs.array_num_value(4) := p_source_52;
31764 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
31765 l_rec_acct_attrs.array_char_value(5) := p_source_53;
31766 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
31767 l_rec_acct_attrs.array_num_value(6) := p_source_52;
31768
31769 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
31770 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
31771
31772 ---------------------------------------------------------------------------------------------------------------
31773 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
31774 ---------------------------------------------------------------------------------------------------------------
31775 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
31776
31777 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
31778 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
31779
31780 IF xla_accounting_cache_pkg.GetValueChar
31781 (p_source_code => 'LEDGER_CATEGORY_CODE'
31782 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
31783 AND l_bflow_method_code = 'PRIOR_ENTRY'
31784 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
31785 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
31786 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
31787 )
31788 THEN
31789 xla_ae_lines_pkg.BflowUpgEntry
31790 (p_business_method_code => l_bflow_method_code
31791 ,p_business_class_code => l_bflow_class_code
31792 ,p_balance_type => l_balance_type_code);
31793 ELSE
31794 NULL;
31795 -- No business flow processing for business flow method of NONE.
31796 END IF;
31797
31798 --
31799 -- call analytical criteria
31800 --
31801
31802 --
31803 -- call description
31804 --
31805
31806 xla_ae_lines_pkg.SetLineDescription(
31807 p_ae_header_id => l_ae_header_id
31808 ,p_description => Description_15 (
31809 p_application_id => p_application_id
31810 , p_ae_header_id => l_ae_header_id
31811 , p_source_1 => p_source_1
31812 )
31813 );
31814
31815
31816 --
31817 -- call ADRs
31818 -- Bug 4922099
31819 --
31820 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
31821 (NVL(l_actual_upg_option, 'N') = 'O') OR
31822 (NVL(l_enc_upg_option, 'N') = 'O')
31823 )
31824 THEN
31825 NULL;
31826 --
31827 --
31828
31829 l_ccid := AcctDerRule_175(
31830 p_application_id => p_application_id
31831 , p_ae_header_id => l_ae_header_id
31832 , p_source_5 => p_source_5
31833 , p_source_19 => p_source_19
31834 , p_source_32 => p_source_32
31835 , x_transaction_coa_id => l_adr_transaction_coa_id
31836 , x_accounting_coa_id => l_adr_accounting_coa_id
31837 , x_value_type_code => l_adr_value_type_code
31838 , p_side => 'NA'
31839 );
31840
31841 xla_ae_lines_pkg.set_ccid(
31845 , p_accounting_coa_id => l_adr_accounting_coa_id
31842 p_code_combination_id => l_ccid
31843 , p_value_type_code => l_adr_value_type_code
31844 , p_transaction_coa_id => l_adr_transaction_coa_id
31846 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
31847 , p_adr_type_code => 'S'
31848 , p_component_type => l_component_type
31849 , p_component_code => l_component_code
31850 , p_component_type_code => l_component_type_code
31851 , p_component_appl_id => l_component_appl_id
31852 , p_amb_context_code => l_amb_context_code
31853 , p_side => 'NA'
31854 );
31855
31856
31857 l_segment := AcctDerRule_150(
31858 p_application_id => p_application_id
31859 , p_ae_header_id => l_ae_header_id
31860 , p_source_5 => p_source_5
31861 , p_source_12 => p_source_12
31862 , x_transaction_coa_id => l_adr_transaction_coa_id
31863 , x_accounting_coa_id => l_adr_accounting_coa_id
31864 , x_flexfield_segment_code => l_adr_flexfield_segment_code
31865 , x_flex_value_set_id => l_adr_flex_value_set_id
31866 , x_value_type_code => l_adr_value_type_code
31867 , x_value_combination_id => l_adr_value_combination_id
31868 , x_value_segment_code => l_adr_value_segment_code
31869 , p_side => 'NA'
31870 , p_override_seg_flag => 'Y'
31871 );
31872
31873 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
31874
31875 xla_ae_lines_pkg.set_segment(
31876 p_to_segment_code => 'GL_ACCOUNT'
31877 , p_segment_value => l_segment
31878 , p_from_segment_code => l_adr_value_segment_code
31879 , p_from_combination_id => l_adr_value_combination_id
31880 , p_value_type_code => l_adr_value_type_code
31881 , p_transaction_coa_id => l_adr_transaction_coa_id
31882 , p_accounting_coa_id => l_adr_accounting_coa_id
31883 , p_flexfield_segment_code => l_adr_flexfield_segment_code
31884 , p_flex_value_set_id => l_adr_flex_value_set_id
31885 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
31886 , p_adr_type_code => 'S'
31887 , p_component_type => l_component_type
31888 , p_component_code => l_component_code
31889 , p_component_type_code => l_component_type_code
31890 , p_component_appl_id => l_component_appl_id
31891 , p_amb_context_code => l_amb_context_code
31892 , p_entity_code => 'TRANSACTIONS'
31893 , p_event_class_code => 'ADJUSTMENTS'
31894 , p_side => 'NA'
31895 );
31896
31897 END IF;
31898
31899 l_segment := AcctDerRule_169(
31900 p_application_id => p_application_id
31901 , p_ae_header_id => l_ae_header_id
31902 , p_source_5 => p_source_5
31903 , p_source_31 => p_source_31
31904 , x_transaction_coa_id => l_adr_transaction_coa_id
31905 , x_accounting_coa_id => l_adr_accounting_coa_id
31906 , x_flexfield_segment_code => l_adr_flexfield_segment_code
31907 , x_flex_value_set_id => l_adr_flex_value_set_id
31908 , x_value_type_code => l_adr_value_type_code
31909 , x_value_combination_id => l_adr_value_combination_id
31910 , x_value_segment_code => l_adr_value_segment_code
31911 , p_side => 'NA'
31912 , p_override_seg_flag => 'Y'
31913 );
31914
31915 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
31916
31917 xla_ae_lines_pkg.set_segment(
31918 p_to_segment_code => 'GL_BALANCING'
31919 , p_segment_value => l_segment
31920 , p_from_segment_code => l_adr_value_segment_code
31921 , p_from_combination_id => l_adr_value_combination_id
31922 , p_value_type_code => l_adr_value_type_code
31923 , p_transaction_coa_id => l_adr_transaction_coa_id
31924 , p_accounting_coa_id => l_adr_accounting_coa_id
31925 , p_flexfield_segment_code => l_adr_flexfield_segment_code
31926 , p_flex_value_set_id => l_adr_flex_value_set_id
31927 , p_adr_code => 'FA_EXPENSE_ACCT'
31928 , p_adr_type_code => 'S'
31929 , p_component_type => l_component_type
31930 , p_component_code => l_component_code
31931 , p_component_type_code => l_component_type_code
31932 , p_component_appl_id => l_component_appl_id
31933 , p_amb_context_code => l_amb_context_code
31934 , p_entity_code => 'TRANSACTIONS'
31935 , p_event_class_code => 'ADJUSTMENTS'
31936 , p_side => 'NA'
31937 );
31938
31939 END IF;
31940
31941 --
31942 --
31943 END IF;
31944 --
31945 -- Bug 4922099
31946 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
31947 (NVL(l_enc_upg_option, 'N') = 'O')
31948 ) AND
31949 (l_bflow_method_code = 'PRIOR_ENTRY')
31950 )
31951 THEN
31952 IF
31953 --
31954 1 = 2
31955 --
31956 THEN
31960 ,p_token_1 => 'LINE_NUMBER'
31957 xla_accounting_err_pkg.build_message
31958 (p_appli_s_name => 'XLA'
31959 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
31961 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
31962 ,p_token_2 => 'LINE_TYPE_NAME'
31963 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
31964 l_component_type
31965 ,l_component_code
31966 ,l_component_type_code
31967 ,l_component_appl_id
31968 ,l_amb_context_code
31969 ,l_entity_code
31970 ,l_event_class_code
31971 )
31972 ,p_token_3 => 'OWNER'
31973 ,p_value_3 => xla_lookups_pkg.get_meaning(
31974 p_lookup_type => 'XLA_OWNER_TYPE'
31975 ,p_lookup_code => l_component_type_code
31976 )
31977 ,p_token_4 => 'PRODUCT_NAME'
31978 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
31979 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
31980 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
31981 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
31982 ,p_ae_header_id => NULL
31983 );
31984
31985 IF (C_LEVEL_ERROR>= g_log_level) THEN
31986 trace
31987 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
31988 ,p_level => C_LEVEL_ERROR
31989 ,p_module => l_log_module);
31990 END IF;
31991 END IF;
31992 END IF;
31993 --
31994 --
31995 ------------------------------------------------------------------------------------------------
31996 -- 4219869 Business Flow
31997 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
31998 -- Prior Entry. Currently, the following code is always generated.
31999 ------------------------------------------------------------------------------------------------
32000 XLA_AE_LINES_PKG.ValidateCurrentLine;
32001
32002 ------------------------------------------------------------------------------------
32003 -- 4219869 Business Flow
32004 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
32005 ------------------------------------------------------------------------------------
32006 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
32007
32008 ----------------------------------------------------------------------------------
32009 -- 4219869 Business Flow
32010 -- Update journal entry status -- Need to generate this within IF <condition>
32011 ----------------------------------------------------------------------------------
32012 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
32013 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
32014 ,p_balance_type_code => l_balance_type_code
32015 );
32016
32017 -------------------------------------------------------------------------------------------
32018 -- 4262811 - Generate the Accrual Reversal lines
32019 -------------------------------------------------------------------------------------------
32020 BEGIN
32021 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
32022 (g_array_event(p_event_id).array_value_num('header_index'));
32023 IF l_acc_rev_flag IS NULL THEN
32024 l_acc_rev_flag := 'N';
32025 END IF;
32026 EXCEPTION
32027 WHEN OTHERS THEN
32028 l_acc_rev_flag := 'N';
32029 END;
32030 --
32031 IF (l_acc_rev_flag = 'Y') THEN
32032
32033 -- 4645092 ------------------------------------------------------------------------------
32034 -- To allow MPA report to determine if it should generate report process
32035 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
32036 ------------------------------------------------------------------------------------------
32037
32038 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
32039 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
32040 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
32041 -- call ADRs
32042 -- Bug 4922099
32043 --
32044 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
32045 (NVL(l_actual_upg_option, 'N') = 'O') OR
32049 NULL;
32046 (NVL(l_enc_upg_option, 'N') = 'O')
32047 )
32048 THEN
32050 --
32051 --
32052
32053 l_ccid := AcctDerRule_175(
32054 p_application_id => p_application_id
32055 , p_ae_header_id => l_ae_header_id
32056 , p_source_5 => p_source_5
32057 , p_source_19 => p_source_19
32058 , p_source_32 => p_source_32
32059 , x_transaction_coa_id => l_adr_transaction_coa_id
32060 , x_accounting_coa_id => l_adr_accounting_coa_id
32061 , x_value_type_code => l_adr_value_type_code
32062 , p_side => 'NA'
32063 );
32064
32065 xla_ae_lines_pkg.set_ccid(
32066 p_code_combination_id => l_ccid
32067 , p_value_type_code => l_adr_value_type_code
32068 , p_transaction_coa_id => l_adr_transaction_coa_id
32069 , p_accounting_coa_id => l_adr_accounting_coa_id
32070 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
32071 , p_adr_type_code => 'S'
32072 , p_component_type => l_component_type
32073 , p_component_code => l_component_code
32074 , p_component_type_code => l_component_type_code
32075 , p_component_appl_id => l_component_appl_id
32076 , p_amb_context_code => l_amb_context_code
32077 , p_side => 'NA'
32078 );
32079
32080
32081 l_segment := AcctDerRule_150(
32082 p_application_id => p_application_id
32083 , p_ae_header_id => l_ae_header_id
32084 , p_source_5 => p_source_5
32085 , p_source_12 => p_source_12
32086 , x_transaction_coa_id => l_adr_transaction_coa_id
32087 , x_accounting_coa_id => l_adr_accounting_coa_id
32088 , x_flexfield_segment_code => l_adr_flexfield_segment_code
32089 , x_flex_value_set_id => l_adr_flex_value_set_id
32090 , x_value_type_code => l_adr_value_type_code
32091 , x_value_combination_id => l_adr_value_combination_id
32092 , x_value_segment_code => l_adr_value_segment_code
32093 , p_side => 'NA'
32094 , p_override_seg_flag => 'Y'
32095 );
32096
32097 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
32098
32099 xla_ae_lines_pkg.set_segment(
32100 p_to_segment_code => 'GL_ACCOUNT'
32101 , p_segment_value => l_segment
32102 , p_from_segment_code => l_adr_value_segment_code
32103 , p_from_combination_id => l_adr_value_combination_id
32104 , p_value_type_code => l_adr_value_type_code
32105 , p_transaction_coa_id => l_adr_transaction_coa_id
32106 , p_accounting_coa_id => l_adr_accounting_coa_id
32107 , p_flexfield_segment_code => l_adr_flexfield_segment_code
32108 , p_flex_value_set_id => l_adr_flex_value_set_id
32109 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
32110 , p_adr_type_code => 'S'
32111 , p_component_type => l_component_type
32112 , p_component_code => l_component_code
32113 , p_component_type_code => l_component_type_code
32114 , p_component_appl_id => l_component_appl_id
32115 , p_amb_context_code => l_amb_context_code
32116 , p_entity_code => 'TRANSACTIONS'
32117 , p_event_class_code => 'ADJUSTMENTS'
32118 , p_side => 'NA'
32119 );
32120
32121 END IF;
32122
32123 l_segment := AcctDerRule_169(
32124 p_application_id => p_application_id
32125 , p_ae_header_id => l_ae_header_id
32126 , p_source_5 => p_source_5
32127 , p_source_31 => p_source_31
32128 , x_transaction_coa_id => l_adr_transaction_coa_id
32129 , x_accounting_coa_id => l_adr_accounting_coa_id
32130 , x_flexfield_segment_code => l_adr_flexfield_segment_code
32131 , x_flex_value_set_id => l_adr_flex_value_set_id
32132 , x_value_type_code => l_adr_value_type_code
32133 , x_value_combination_id => l_adr_value_combination_id
32134 , x_value_segment_code => l_adr_value_segment_code
32135 , p_side => 'NA'
32136 , p_override_seg_flag => 'Y'
32137 );
32138
32139 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
32140
32141 xla_ae_lines_pkg.set_segment(
32142 p_to_segment_code => 'GL_BALANCING'
32143 , p_segment_value => l_segment
32144 , p_from_segment_code => l_adr_value_segment_code
32145 , p_from_combination_id => l_adr_value_combination_id
32146 , p_value_type_code => l_adr_value_type_code
32147 , p_transaction_coa_id => l_adr_transaction_coa_id
32148 , p_accounting_coa_id => l_adr_accounting_coa_id
32149 , p_flexfield_segment_code => l_adr_flexfield_segment_code
32150 , p_flex_value_set_id => l_adr_flex_value_set_id
32151 , p_adr_code => 'FA_EXPENSE_ACCT'
32152 , p_adr_type_code => 'S'
32153 , p_component_type => l_component_type
32154 , p_component_code => l_component_code
32158 , p_entity_code => 'TRANSACTIONS'
32155 , p_component_type_code => l_component_type_code
32156 , p_component_appl_id => l_component_appl_id
32157 , p_amb_context_code => l_amb_context_code
32159 , p_event_class_code => 'ADJUSTMENTS'
32160 , p_side => 'NA'
32161 );
32162
32163 END IF;
32164
32165 --
32166 --
32167 END IF;
32168
32169 --
32170 -- Update the line information that should be overwritten
32171 --
32172 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
32173 p_header_num => 1);
32174 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
32175
32176 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
32177
32178 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
32179 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
32180 END IF;
32181
32182 --
32183 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
32184 --
32185 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
32186 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
32187 ELSE
32188 ---------------------------------------------------------------------------------------------------
32189 -- 4262811a Switch Sign
32190 ---------------------------------------------------------------------------------------------------
32191 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
32192 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
32193 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
32194 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
32195 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
32196 -- 5132302
32197 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
32198 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
32199
32200 END IF;
32201
32202 -- 4955764
32203 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
32204 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
32205
32206
32207 XLA_AE_LINES_PKG.ValidateCurrentLine;
32208 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
32209
32210 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
32211 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
32212 ,p_balance_type_code => l_balance_type_code);
32213
32214 END IF;
32215
32216 -----------------------------------------------------------------------------------------
32217 -- 4262811 Multiperiod Accounting
32218 -----------------------------------------------------------------------------------------
32219 -- No MPA option is assigned.
32220
32221
32222 END IF;
32223 END IF;
32224 --
32225
32226 --
32227 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
32228 trace
32229 (p_msg => 'END of AcctLineType_209'
32230 ,p_level => C_LEVEL_PROCEDURE
32231 ,p_module => l_log_module);
32232 END IF;
32233 --
32234 EXCEPTION
32235 WHEN xla_exceptions_pkg.application_exception THEN
32236 RAISE;
32237 WHEN OTHERS THEN
32238 xla_exceptions_pkg.raise_message
32239 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_209');
32240 END AcctLineType_209;
32241 --
32242
32243 ---------------------------------------
32244 --
32245 -- PRIVATE FUNCTION
32246 -- AcctLineType_210
32247 --
32248 ---------------------------------------
32249 PROCEDURE AcctLineType_210 (
32250 p_application_id IN NUMBER
32251 ,p_event_id IN NUMBER
32252 ,p_calculate_acctd_flag IN VARCHAR2
32253 ,p_calculate_g_l_flag IN VARCHAR2
32254 ,p_actual_flag IN OUT VARCHAR2
32255 ,p_balance_type_code OUT VARCHAR2
32256 ,p_gain_or_loss_ref OUT VARCHAR2
32257
32258 --Period Close Date
32259 , p_source_1 IN DATE
32260 --Generated Code Combination Identifier
32261 , p_source_5 IN NUMBER
32262 --Depreciation Reserve Account
32263 , p_source_12 IN VARCHAR2
32264 --Generated Offset Code Combination Identifier
32265 , p_source_19 IN NUMBER
32266 --Expense Account Code Combination Identifier
32267 , p_source_31 IN NUMBER
32268 --Default Code Combination Identifier
32269 , p_source_32 IN NUMBER
32270 --Adjustment Type
32271 , p_source_48 IN VARCHAR2
32272 --Transaction Header Identifier
32273 , p_source_49 IN NUMBER
32274 --Adjustment Line Identifier
32278 --Entered Amount
32275 , p_source_50 IN NUMBER
32276 --Distribution Type Code
32277 , p_source_51 IN VARCHAR2
32279 , p_source_52 IN NUMBER
32280 --Currency Code
32281 , p_source_53 IN VARCHAR2
32282 )
32283 IS
32284
32285 l_component_type VARCHAR2(80);
32286 l_component_code VARCHAR2(30);
32287 l_component_type_code VARCHAR2(1);
32288 l_component_appl_id INTEGER;
32289 l_amb_context_code VARCHAR2(30);
32290 l_entity_code VARCHAR2(30);
32291 l_event_class_code VARCHAR2(30);
32292 l_ae_header_id NUMBER;
32293 l_event_type_code VARCHAR2(30);
32294 l_line_definition_code VARCHAR2(30);
32295 l_line_definition_owner_code VARCHAR2(1);
32296 --
32297 -- adr variables
32298 l_segment VARCHAR2(30);
32299 l_ccid NUMBER;
32300 l_adr_transaction_coa_id NUMBER;
32301 l_adr_accounting_coa_id NUMBER;
32302 l_adr_flexfield_segment_code VARCHAR2(30);
32303 l_adr_flex_value_set_id NUMBER;
32304 l_adr_value_type_code VARCHAR2(30);
32305 l_adr_value_combination_id NUMBER;
32306 l_adr_value_segment_code VARCHAR2(30);
32307
32308 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
32309 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
32310 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
32311 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
32312
32313 -- 4262811 Variables ------------------------------------------------------------------------------------------
32314 l_entered_amt_idx NUMBER;
32315 l_accted_amt_idx NUMBER;
32316 l_acc_rev_flag VARCHAR2(1);
32317 l_accrual_line_num NUMBER;
32318 l_tmp_amt NUMBER;
32319 l_acc_rev_natural_side_code VARCHAR2(1);
32320
32321 l_num_entries NUMBER;
32322 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
32323 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
32324 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
32325 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
32326 l_recog_line_1 NUMBER;
32327 l_recog_line_2 NUMBER;
32328
32329 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
32330 l_bflow_applied_to_amt NUMBER; -- 5132302
32331 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
32332
32333 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
32334
32335 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
32336 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
32337
32338 ---------------------------------------------------------------------------------------------------------------
32339
32340
32341 --
32342 -- bulk performance
32343 --
32344 l_balance_type_code VARCHAR2(1);
32345 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
32346 l_log_module VARCHAR2(240);
32347
32348 --
32349 -- Upgrade strategy
32350 --
32351 l_actual_upg_option VARCHAR2(1);
32352 l_enc_upg_option VARCHAR2(1);
32353
32354 --
32355 BEGIN
32356 --
32357 IF g_log_enabled THEN
32358 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_210';
32359 END IF;
32360 --
32361 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
32362
32363 trace
32364 (p_msg => 'BEGIN of AcctLineType_210'
32365 ,p_level => C_LEVEL_PROCEDURE
32366 ,p_module => l_log_module);
32367
32368 END IF;
32369 --
32370 l_component_type := 'AMB_JLT';
32371 l_component_code := 'FA_ADJ_RESERVE_BAL';
32372 l_component_type_code := 'S';
32373 l_component_appl_id := 140;
32374 l_amb_context_code := 'DEFAULT';
32375 l_entity_code := 'TRANSACTIONS';
32376 l_event_class_code := 'ADJUSTMENTS';
32377 l_event_type_code := 'ADJUSTMENTS_ALL';
32378 l_line_definition_owner_code := 'S';
32379 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_ADJUST2';
32380 --
32381 l_balance_type_code := 'A';
32382 l_segment := NULL;
32383 l_ccid := NULL;
32384 l_adr_transaction_coa_id := NULL;
32385 l_adr_accounting_coa_id := NULL;
32386 l_adr_flexfield_segment_code := NULL;
32387 l_adr_flex_value_set_id := NULL;
32388 l_adr_value_type_code := NULL;
32389 l_adr_value_combination_id := NULL;
32390 l_adr_value_segment_code := NULL;
32391
32392 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
32393 l_bflow_class_code := ''; -- 4219869 Business Flow
32394 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
32395 l_budgetary_control_flag := 'N';
32396
32397 l_bflow_applied_to_amt_idx := NULL; -- 5132302
32398 l_bflow_applied_to_amt := NULL; -- 5132302
32399 l_entered_amt_idx := NULL; -- 4262811
32400 l_accted_amt_idx := NULL; -- 4262811
32401 l_acc_rev_flag := NULL; -- 4262811
32405
32402 l_accrual_line_num := NULL; -- 4262811
32403 l_tmp_amt := NULL; -- 4262811
32404 --
32406 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
32407 l_balance_type_code <> 'B' THEN
32408 IF NVL(p_source_48,'
32409 ') = 'BONUS EXPENSE'
32410 THEN
32411
32412 --
32413 XLA_AE_LINES_PKG.SetNewLine;
32414
32415 p_balance_type_code := l_balance_type_code;
32416 -- set the flag so later we will know whether the gain loss line needs to be created
32417
32418 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
32419 p_actual_flag :='A';
32420 END IF;
32421
32422 --
32423 -- bulk performance
32424 --
32425 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
32426 p_header_num => 0); -- 4262811
32427 --
32428 -- set accounting line options
32429 --
32430 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
32431 p_natural_side_code => 'D'
32432 , p_gain_or_loss_flag => 'N'
32433 , p_gl_transfer_mode_code => 'S'
32434 , p_acct_entry_type_code => 'A'
32435 , p_switch_side_flag => 'Y'
32436 , p_merge_duplicate_code => 'N'
32437 );
32438 --
32439 l_acc_rev_natural_side_code := 'C'; -- 4262811
32440 --
32441 --
32442 -- set accounting line type info
32443 --
32444 xla_ae_lines_pkg.SetAcctLineType
32445 (p_component_type => l_component_type
32446 ,p_event_type_code => l_event_type_code
32447 ,p_line_definition_owner_code => l_line_definition_owner_code
32448 ,p_line_definition_code => l_line_definition_code
32449 ,p_accounting_line_code => l_component_code
32450 ,p_accounting_line_type_code => l_component_type_code
32451 ,p_accounting_line_appl_id => l_component_appl_id
32452 ,p_amb_context_code => l_amb_context_code
32453 ,p_entity_code => l_entity_code
32454 ,p_event_class_code => l_event_class_code);
32455 --
32456 -- set accounting class
32457 --
32458 xla_ae_lines_pkg.SetAcctClass(
32459 p_accounting_class_code => 'ASSET'
32460 , p_ae_header_id => l_ae_header_id
32461 );
32462
32463 --
32464 -- set rounding class
32465 --
32466 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
32467 'ASSET';
32468
32469 --
32470 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
32471 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
32472 --
32473 -- bulk performance
32474 --
32475 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
32476
32477 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
32478 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
32479
32480 -- 4955764
32481 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
32482 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
32483
32484 -- 4458381 Public Sector Enh
32485
32486 --
32487 -- set accounting attributes for the line type
32488 --
32489 l_entered_amt_idx := 4;
32490 l_accted_amt_idx := 6;
32491 l_bflow_applied_to_amt_idx := NULL; -- 5132302
32492 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
32493 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
32494 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
32495 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
32496 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
32497 l_rec_acct_attrs.array_char_value(3) := p_source_51;
32498 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
32499 l_rec_acct_attrs.array_num_value(4) := p_source_52;
32500 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
32501 l_rec_acct_attrs.array_char_value(5) := p_source_53;
32502 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
32503 l_rec_acct_attrs.array_num_value(6) := p_source_52;
32504
32505 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
32506 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
32507
32508 ---------------------------------------------------------------------------------------------------------------
32509 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
32510 ---------------------------------------------------------------------------------------------------------------
32511 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
32512
32513 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
32514 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
32515
32519 AND l_bflow_method_code = 'PRIOR_ENTRY'
32516 IF xla_accounting_cache_pkg.GetValueChar
32517 (p_source_code => 'LEDGER_CATEGORY_CODE'
32518 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
32520 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
32521 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
32522 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
32523 )
32524 THEN
32525 xla_ae_lines_pkg.BflowUpgEntry
32526 (p_business_method_code => l_bflow_method_code
32527 ,p_business_class_code => l_bflow_class_code
32528 ,p_balance_type => l_balance_type_code);
32529 ELSE
32530 NULL;
32531 -- No business flow processing for business flow method of NONE.
32532 END IF;
32533
32534 --
32535 -- call analytical criteria
32536 --
32537
32538 --
32539 -- call description
32540 --
32541
32542 xla_ae_lines_pkg.SetLineDescription(
32543 p_ae_header_id => l_ae_header_id
32544 ,p_description => Description_15 (
32545 p_application_id => p_application_id
32546 , p_ae_header_id => l_ae_header_id
32547 , p_source_1 => p_source_1
32548 )
32549 );
32550
32551
32552 --
32553 -- call ADRs
32554 -- Bug 4922099
32555 --
32556 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
32557 (NVL(l_actual_upg_option, 'N') = 'O') OR
32558 (NVL(l_enc_upg_option, 'N') = 'O')
32559 )
32560 THEN
32561 NULL;
32562 --
32563 --
32564
32565 l_ccid := AcctDerRule_175(
32566 p_application_id => p_application_id
32567 , p_ae_header_id => l_ae_header_id
32568 , p_source_5 => p_source_5
32569 , p_source_19 => p_source_19
32570 , p_source_32 => p_source_32
32571 , x_transaction_coa_id => l_adr_transaction_coa_id
32572 , x_accounting_coa_id => l_adr_accounting_coa_id
32573 , x_value_type_code => l_adr_value_type_code
32574 , p_side => 'NA'
32575 );
32576
32577 xla_ae_lines_pkg.set_ccid(
32578 p_code_combination_id => l_ccid
32579 , p_value_type_code => l_adr_value_type_code
32580 , p_transaction_coa_id => l_adr_transaction_coa_id
32581 , p_accounting_coa_id => l_adr_accounting_coa_id
32582 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
32583 , p_adr_type_code => 'S'
32584 , p_component_type => l_component_type
32585 , p_component_code => l_component_code
32586 , p_component_type_code => l_component_type_code
32587 , p_component_appl_id => l_component_appl_id
32588 , p_amb_context_code => l_amb_context_code
32589 , p_side => 'NA'
32590 );
32591
32592
32593 l_segment := AcctDerRule_150(
32594 p_application_id => p_application_id
32595 , p_ae_header_id => l_ae_header_id
32596 , p_source_5 => p_source_5
32597 , p_source_12 => p_source_12
32598 , x_transaction_coa_id => l_adr_transaction_coa_id
32599 , x_accounting_coa_id => l_adr_accounting_coa_id
32600 , x_flexfield_segment_code => l_adr_flexfield_segment_code
32601 , x_flex_value_set_id => l_adr_flex_value_set_id
32602 , x_value_type_code => l_adr_value_type_code
32603 , x_value_combination_id => l_adr_value_combination_id
32604 , x_value_segment_code => l_adr_value_segment_code
32605 , p_side => 'NA'
32606 , p_override_seg_flag => 'Y'
32607 );
32608
32609 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
32610
32611 xla_ae_lines_pkg.set_segment(
32612 p_to_segment_code => 'GL_ACCOUNT'
32613 , p_segment_value => l_segment
32614 , p_from_segment_code => l_adr_value_segment_code
32615 , p_from_combination_id => l_adr_value_combination_id
32616 , p_value_type_code => l_adr_value_type_code
32617 , p_transaction_coa_id => l_adr_transaction_coa_id
32618 , p_accounting_coa_id => l_adr_accounting_coa_id
32619 , p_flexfield_segment_code => l_adr_flexfield_segment_code
32620 , p_flex_value_set_id => l_adr_flex_value_set_id
32621 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
32622 , p_adr_type_code => 'S'
32623 , p_component_type => l_component_type
32624 , p_component_code => l_component_code
32625 , p_component_type_code => l_component_type_code
32626 , p_component_appl_id => l_component_appl_id
32627 , p_amb_context_code => l_amb_context_code
32628 , p_entity_code => 'TRANSACTIONS'
32629 , p_event_class_code => 'ADJUSTMENTS'
32630 , p_side => 'NA'
32631 );
32632
32633 END IF;
32634
32635 l_segment := AcctDerRule_169(
32636 p_application_id => p_application_id
32637 , p_ae_header_id => l_ae_header_id
32638 , p_source_5 => p_source_5
32639 , p_source_31 => p_source_31
32643 , x_flex_value_set_id => l_adr_flex_value_set_id
32640 , x_transaction_coa_id => l_adr_transaction_coa_id
32641 , x_accounting_coa_id => l_adr_accounting_coa_id
32642 , x_flexfield_segment_code => l_adr_flexfield_segment_code
32644 , x_value_type_code => l_adr_value_type_code
32645 , x_value_combination_id => l_adr_value_combination_id
32646 , x_value_segment_code => l_adr_value_segment_code
32647 , p_side => 'NA'
32648 , p_override_seg_flag => 'Y'
32649 );
32650
32651 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
32652
32653 xla_ae_lines_pkg.set_segment(
32654 p_to_segment_code => 'GL_BALANCING'
32655 , p_segment_value => l_segment
32656 , p_from_segment_code => l_adr_value_segment_code
32657 , p_from_combination_id => l_adr_value_combination_id
32658 , p_value_type_code => l_adr_value_type_code
32659 , p_transaction_coa_id => l_adr_transaction_coa_id
32660 , p_accounting_coa_id => l_adr_accounting_coa_id
32661 , p_flexfield_segment_code => l_adr_flexfield_segment_code
32662 , p_flex_value_set_id => l_adr_flex_value_set_id
32663 , p_adr_code => 'FA_EXPENSE_ACCT'
32664 , p_adr_type_code => 'S'
32665 , p_component_type => l_component_type
32666 , p_component_code => l_component_code
32667 , p_component_type_code => l_component_type_code
32668 , p_component_appl_id => l_component_appl_id
32669 , p_amb_context_code => l_amb_context_code
32670 , p_entity_code => 'TRANSACTIONS'
32671 , p_event_class_code => 'ADJUSTMENTS'
32672 , p_side => 'NA'
32673 );
32674
32675 END IF;
32676
32677 --
32678 --
32679 END IF;
32680 --
32681 -- Bug 4922099
32682 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
32683 (NVL(l_enc_upg_option, 'N') = 'O')
32684 ) AND
32685 (l_bflow_method_code = 'PRIOR_ENTRY')
32686 )
32687 THEN
32688 IF
32689 --
32690 1 = 2
32691 --
32692 THEN
32693 xla_accounting_err_pkg.build_message
32694 (p_appli_s_name => 'XLA'
32695 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
32696 ,p_token_1 => 'LINE_NUMBER'
32697 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
32698 ,p_token_2 => 'LINE_TYPE_NAME'
32699 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
32700 l_component_type
32701 ,l_component_code
32702 ,l_component_type_code
32703 ,l_component_appl_id
32704 ,l_amb_context_code
32705 ,l_entity_code
32706 ,l_event_class_code
32707 )
32708 ,p_token_3 => 'OWNER'
32709 ,p_value_3 => xla_lookups_pkg.get_meaning(
32710 p_lookup_type => 'XLA_OWNER_TYPE'
32711 ,p_lookup_code => l_component_type_code
32712 )
32713 ,p_token_4 => 'PRODUCT_NAME'
32714 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
32715 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
32716 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
32717 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
32718 ,p_ae_header_id => NULL
32719 );
32720
32721 IF (C_LEVEL_ERROR>= g_log_level) THEN
32722 trace
32723 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
32724 ,p_level => C_LEVEL_ERROR
32725 ,p_module => l_log_module);
32726 END IF;
32727 END IF;
32728 END IF;
32729 --
32730 --
32731 ------------------------------------------------------------------------------------------------
32732 -- 4219869 Business Flow
32733 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
32734 -- Prior Entry. Currently, the following code is always generated.
32738 ------------------------------------------------------------------------------------
32735 ------------------------------------------------------------------------------------------------
32736 XLA_AE_LINES_PKG.ValidateCurrentLine;
32737
32739 -- 4219869 Business Flow
32740 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
32741 ------------------------------------------------------------------------------------
32742 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
32743
32744 ----------------------------------------------------------------------------------
32745 -- 4219869 Business Flow
32746 -- Update journal entry status -- Need to generate this within IF <condition>
32747 ----------------------------------------------------------------------------------
32748 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
32749 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
32750 ,p_balance_type_code => l_balance_type_code
32751 );
32752
32753 -------------------------------------------------------------------------------------------
32754 -- 4262811 - Generate the Accrual Reversal lines
32755 -------------------------------------------------------------------------------------------
32756 BEGIN
32757 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
32758 (g_array_event(p_event_id).array_value_num('header_index'));
32759 IF l_acc_rev_flag IS NULL THEN
32760 l_acc_rev_flag := 'N';
32761 END IF;
32762 EXCEPTION
32763 WHEN OTHERS THEN
32764 l_acc_rev_flag := 'N';
32765 END;
32766 --
32767 IF (l_acc_rev_flag = 'Y') THEN
32768
32769 -- 4645092 ------------------------------------------------------------------------------
32770 -- To allow MPA report to determine if it should generate report process
32771 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
32772 ------------------------------------------------------------------------------------------
32773
32774 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
32775 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
32776 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
32777 -- call ADRs
32778 -- Bug 4922099
32779 --
32780 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
32781 (NVL(l_actual_upg_option, 'N') = 'O') OR
32782 (NVL(l_enc_upg_option, 'N') = 'O')
32783 )
32784 THEN
32785 NULL;
32786 --
32787 --
32788
32789 l_ccid := AcctDerRule_175(
32790 p_application_id => p_application_id
32791 , p_ae_header_id => l_ae_header_id
32792 , p_source_5 => p_source_5
32793 , p_source_19 => p_source_19
32794 , p_source_32 => p_source_32
32795 , x_transaction_coa_id => l_adr_transaction_coa_id
32796 , x_accounting_coa_id => l_adr_accounting_coa_id
32797 , x_value_type_code => l_adr_value_type_code
32798 , p_side => 'NA'
32799 );
32800
32801 xla_ae_lines_pkg.set_ccid(
32802 p_code_combination_id => l_ccid
32803 , p_value_type_code => l_adr_value_type_code
32804 , p_transaction_coa_id => l_adr_transaction_coa_id
32805 , p_accounting_coa_id => l_adr_accounting_coa_id
32806 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
32807 , p_adr_type_code => 'S'
32808 , p_component_type => l_component_type
32809 , p_component_code => l_component_code
32810 , p_component_type_code => l_component_type_code
32811 , p_component_appl_id => l_component_appl_id
32812 , p_amb_context_code => l_amb_context_code
32813 , p_side => 'NA'
32814 );
32815
32816
32817 l_segment := AcctDerRule_150(
32818 p_application_id => p_application_id
32819 , p_ae_header_id => l_ae_header_id
32820 , p_source_5 => p_source_5
32821 , p_source_12 => p_source_12
32822 , x_transaction_coa_id => l_adr_transaction_coa_id
32823 , x_accounting_coa_id => l_adr_accounting_coa_id
32824 , x_flexfield_segment_code => l_adr_flexfield_segment_code
32825 , x_flex_value_set_id => l_adr_flex_value_set_id
32826 , x_value_type_code => l_adr_value_type_code
32827 , x_value_combination_id => l_adr_value_combination_id
32828 , x_value_segment_code => l_adr_value_segment_code
32829 , p_side => 'NA'
32830 , p_override_seg_flag => 'Y'
32831 );
32832
32833 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
32834
32835 xla_ae_lines_pkg.set_segment(
32836 p_to_segment_code => 'GL_ACCOUNT'
32837 , p_segment_value => l_segment
32838 , p_from_segment_code => l_adr_value_segment_code
32839 , p_from_combination_id => l_adr_value_combination_id
32840 , p_value_type_code => l_adr_value_type_code
32841 , p_transaction_coa_id => l_adr_transaction_coa_id
32842 , p_accounting_coa_id => l_adr_accounting_coa_id
32843 , p_flexfield_segment_code => l_adr_flexfield_segment_code
32844 , p_flex_value_set_id => l_adr_flex_value_set_id
32848 , p_component_code => l_component_code
32845 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
32846 , p_adr_type_code => 'S'
32847 , p_component_type => l_component_type
32849 , p_component_type_code => l_component_type_code
32850 , p_component_appl_id => l_component_appl_id
32851 , p_amb_context_code => l_amb_context_code
32852 , p_entity_code => 'TRANSACTIONS'
32853 , p_event_class_code => 'ADJUSTMENTS'
32854 , p_side => 'NA'
32855 );
32856
32857 END IF;
32858
32859 l_segment := AcctDerRule_169(
32860 p_application_id => p_application_id
32861 , p_ae_header_id => l_ae_header_id
32862 , p_source_5 => p_source_5
32863 , p_source_31 => p_source_31
32864 , x_transaction_coa_id => l_adr_transaction_coa_id
32865 , x_accounting_coa_id => l_adr_accounting_coa_id
32866 , x_flexfield_segment_code => l_adr_flexfield_segment_code
32867 , x_flex_value_set_id => l_adr_flex_value_set_id
32868 , x_value_type_code => l_adr_value_type_code
32869 , x_value_combination_id => l_adr_value_combination_id
32870 , x_value_segment_code => l_adr_value_segment_code
32871 , p_side => 'NA'
32872 , p_override_seg_flag => 'Y'
32873 );
32874
32875 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
32876
32877 xla_ae_lines_pkg.set_segment(
32878 p_to_segment_code => 'GL_BALANCING'
32879 , p_segment_value => l_segment
32880 , p_from_segment_code => l_adr_value_segment_code
32881 , p_from_combination_id => l_adr_value_combination_id
32882 , p_value_type_code => l_adr_value_type_code
32883 , p_transaction_coa_id => l_adr_transaction_coa_id
32884 , p_accounting_coa_id => l_adr_accounting_coa_id
32885 , p_flexfield_segment_code => l_adr_flexfield_segment_code
32886 , p_flex_value_set_id => l_adr_flex_value_set_id
32887 , p_adr_code => 'FA_EXPENSE_ACCT'
32888 , p_adr_type_code => 'S'
32889 , p_component_type => l_component_type
32890 , p_component_code => l_component_code
32891 , p_component_type_code => l_component_type_code
32892 , p_component_appl_id => l_component_appl_id
32893 , p_amb_context_code => l_amb_context_code
32894 , p_entity_code => 'TRANSACTIONS'
32895 , p_event_class_code => 'ADJUSTMENTS'
32896 , p_side => 'NA'
32897 );
32898
32899 END IF;
32900
32901 --
32902 --
32903 END IF;
32904
32905 --
32906 -- Update the line information that should be overwritten
32907 --
32908 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
32909 p_header_num => 1);
32910 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
32911
32912 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
32913
32914 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
32915 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
32916 END IF;
32917
32918 --
32919 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
32920 --
32921 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
32922 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
32923 ELSE
32924 ---------------------------------------------------------------------------------------------------
32925 -- 4262811a Switch Sign
32926 ---------------------------------------------------------------------------------------------------
32927 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
32928 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
32929 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
32930 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
32931 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
32932 -- 5132302
32933 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
32934 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
32935
32936 END IF;
32937
32938 -- 4955764
32939 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
32940 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
32941
32942
32943 XLA_AE_LINES_PKG.ValidateCurrentLine;
32944 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
32945
32946 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
32947 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
32948 ,p_balance_type_code => l_balance_type_code);
32952 -----------------------------------------------------------------------------------------
32949
32950 END IF;
32951
32953 -- 4262811 Multiperiod Accounting
32954 -----------------------------------------------------------------------------------------
32955 -- No MPA option is assigned.
32956
32957
32958 END IF;
32959 END IF;
32960 --
32961
32962 --
32963 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
32964 trace
32965 (p_msg => 'END of AcctLineType_210'
32966 ,p_level => C_LEVEL_PROCEDURE
32967 ,p_module => l_log_module);
32968 END IF;
32969 --
32970 EXCEPTION
32971 WHEN xla_exceptions_pkg.application_exception THEN
32972 RAISE;
32973 WHEN OTHERS THEN
32974 xla_exceptions_pkg.raise_message
32975 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_210');
32976 END AcctLineType_210;
32977 --
32978
32979 ---------------------------------------
32980 --
32981 -- PRIVATE FUNCTION
32982 -- AcctLineType_211
32983 --
32984 ---------------------------------------
32985 PROCEDURE AcctLineType_211 (
32986 p_application_id IN NUMBER
32987 ,p_event_id IN NUMBER
32988 ,p_calculate_acctd_flag IN VARCHAR2
32989 ,p_calculate_g_l_flag IN VARCHAR2
32990 ,p_actual_flag IN OUT VARCHAR2
32991 ,p_balance_type_code OUT VARCHAR2
32992 ,p_gain_or_loss_ref OUT VARCHAR2
32993
32994 --Period Close Date
32995 , p_source_1 IN DATE
32996 --Generated Code Combination Identifier
32997 , p_source_5 IN NUMBER
32998 --CIP Cost Account
32999 , p_source_9 IN VARCHAR2
33000 --Expense Account Code Combination Identifier
33001 , p_source_31 IN NUMBER
33002 --Default Code Combination Identifier
33003 , p_source_32 IN NUMBER
33004 --Adjustment Type
33005 , p_source_48 IN VARCHAR2
33006 --Transaction Header Identifier
33007 , p_source_49 IN NUMBER
33008 --Adjustment Line Identifier
33009 , p_source_50 IN NUMBER
33010 --Distribution Type Code
33011 , p_source_51 IN VARCHAR2
33012 --Entered Amount
33013 , p_source_52 IN NUMBER
33014 --Currency Code
33015 , p_source_53 IN VARCHAR2
33016 )
33017 IS
33018
33019 l_component_type VARCHAR2(80);
33020 l_component_code VARCHAR2(30);
33021 l_component_type_code VARCHAR2(1);
33022 l_component_appl_id INTEGER;
33023 l_amb_context_code VARCHAR2(30);
33024 l_entity_code VARCHAR2(30);
33025 l_event_class_code VARCHAR2(30);
33026 l_ae_header_id NUMBER;
33027 l_event_type_code VARCHAR2(30);
33028 l_line_definition_code VARCHAR2(30);
33029 l_line_definition_owner_code VARCHAR2(1);
33030 --
33031 -- adr variables
33032 l_segment VARCHAR2(30);
33033 l_ccid NUMBER;
33034 l_adr_transaction_coa_id NUMBER;
33035 l_adr_accounting_coa_id NUMBER;
33036 l_adr_flexfield_segment_code VARCHAR2(30);
33037 l_adr_flex_value_set_id NUMBER;
33038 l_adr_value_type_code VARCHAR2(30);
33039 l_adr_value_combination_id NUMBER;
33040 l_adr_value_segment_code VARCHAR2(30);
33041
33042 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
33043 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
33044 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
33045 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
33046
33047 -- 4262811 Variables ------------------------------------------------------------------------------------------
33048 l_entered_amt_idx NUMBER;
33049 l_accted_amt_idx NUMBER;
33050 l_acc_rev_flag VARCHAR2(1);
33051 l_accrual_line_num NUMBER;
33052 l_tmp_amt NUMBER;
33053 l_acc_rev_natural_side_code VARCHAR2(1);
33054
33055 l_num_entries NUMBER;
33056 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
33057 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
33058 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
33059 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
33060 l_recog_line_1 NUMBER;
33061 l_recog_line_2 NUMBER;
33062
33063 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
33064 l_bflow_applied_to_amt NUMBER; -- 5132302
33065 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
33066
33067 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
33068
33069 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
33070 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
33071
33072 ---------------------------------------------------------------------------------------------------------------
33073
33074
33075 --
33076 -- bulk performance
33077 --
33078 l_balance_type_code VARCHAR2(1);
33079 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
33080 l_log_module VARCHAR2(240);
33081
33082 --
33086 l_enc_upg_option VARCHAR2(1);
33083 -- Upgrade strategy
33084 --
33085 l_actual_upg_option VARCHAR2(1);
33087
33088 --
33089 BEGIN
33090 --
33091 IF g_log_enabled THEN
33092 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_211';
33093 END IF;
33094 --
33095 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
33096
33097 trace
33098 (p_msg => 'BEGIN of AcctLineType_211'
33099 ,p_level => C_LEVEL_PROCEDURE
33100 ,p_module => l_log_module);
33101
33102 END IF;
33103 --
33104 l_component_type := 'AMB_JLT';
33105 l_component_code := 'FA_CAP_ASSET_CIP_COST';
33106 l_component_type_code := 'S';
33107 l_component_appl_id := 140;
33108 l_amb_context_code := 'DEFAULT';
33109 l_entity_code := 'TRANSACTIONS';
33110 l_event_class_code := 'CAPITALIZATION';
33111 l_event_type_code := 'CAPITALIZATION';
33112 l_line_definition_owner_code := 'S';
33113 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CAPITA3';
33114 --
33115 l_balance_type_code := 'A';
33116 l_segment := NULL;
33117 l_ccid := NULL;
33118 l_adr_transaction_coa_id := NULL;
33119 l_adr_accounting_coa_id := NULL;
33120 l_adr_flexfield_segment_code := NULL;
33121 l_adr_flex_value_set_id := NULL;
33122 l_adr_value_type_code := NULL;
33123 l_adr_value_combination_id := NULL;
33124 l_adr_value_segment_code := NULL;
33125
33126 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
33127 l_bflow_class_code := ''; -- 4219869 Business Flow
33128 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
33129 l_budgetary_control_flag := 'N';
33130
33131 l_bflow_applied_to_amt_idx := NULL; -- 5132302
33132 l_bflow_applied_to_amt := NULL; -- 5132302
33133 l_entered_amt_idx := NULL; -- 4262811
33134 l_accted_amt_idx := NULL; -- 4262811
33135 l_acc_rev_flag := NULL; -- 4262811
33136 l_accrual_line_num := NULL; -- 4262811
33137 l_tmp_amt := NULL; -- 4262811
33138 --
33139
33140 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
33141 l_balance_type_code <> 'B' THEN
33142 IF NVL(p_source_48,'
33143 ') = 'CIP COST'
33144 THEN
33145
33146 --
33147 XLA_AE_LINES_PKG.SetNewLine;
33148
33149 p_balance_type_code := l_balance_type_code;
33150 -- set the flag so later we will know whether the gain loss line needs to be created
33151
33152 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
33153 p_actual_flag :='A';
33154 END IF;
33155
33156 --
33157 -- bulk performance
33158 --
33159 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
33160 p_header_num => 0); -- 4262811
33161 --
33162 -- set accounting line options
33163 --
33164 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
33165 p_natural_side_code => 'C'
33166 , p_gain_or_loss_flag => 'N'
33167 , p_gl_transfer_mode_code => 'S'
33168 , p_acct_entry_type_code => 'A'
33169 , p_switch_side_flag => 'Y'
33170 , p_merge_duplicate_code => 'N'
33171 );
33172 --
33173 l_acc_rev_natural_side_code := 'D'; -- 4262811
33174 --
33175 --
33176 -- set accounting line type info
33177 --
33178 xla_ae_lines_pkg.SetAcctLineType
33179 (p_component_type => l_component_type
33180 ,p_event_type_code => l_event_type_code
33181 ,p_line_definition_owner_code => l_line_definition_owner_code
33182 ,p_line_definition_code => l_line_definition_code
33183 ,p_accounting_line_code => l_component_code
33184 ,p_accounting_line_type_code => l_component_type_code
33185 ,p_accounting_line_appl_id => l_component_appl_id
33186 ,p_amb_context_code => l_amb_context_code
33187 ,p_entity_code => l_entity_code
33188 ,p_event_class_code => l_event_class_code);
33189 --
33190 -- set accounting class
33191 --
33192 xla_ae_lines_pkg.SetAcctClass(
33193 p_accounting_class_code => 'ASSET'
33194 , p_ae_header_id => l_ae_header_id
33195 );
33196
33197 --
33198 -- set rounding class
33199 --
33200 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
33201 'ASSET';
33202
33203 --
33204 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
33205 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
33206 --
33207 -- bulk performance
33208 --
33209 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
33210
33211 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
33212 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
33213
33214 -- 4955764
33218 -- 4458381 Public Sector Enh
33215 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
33216 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
33217
33219
33220 --
33221 -- set accounting attributes for the line type
33222 --
33223 l_entered_amt_idx := 4;
33224 l_accted_amt_idx := 6;
33225 l_bflow_applied_to_amt_idx := NULL; -- 5132302
33226 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
33227 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
33228 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
33229 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
33230 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
33231 l_rec_acct_attrs.array_char_value(3) := p_source_51;
33232 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
33233 l_rec_acct_attrs.array_num_value(4) := p_source_52;
33234 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
33235 l_rec_acct_attrs.array_char_value(5) := p_source_53;
33236 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
33237 l_rec_acct_attrs.array_num_value(6) := p_source_52;
33238
33239 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
33240 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
33241
33242 ---------------------------------------------------------------------------------------------------------------
33243 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
33244 ---------------------------------------------------------------------------------------------------------------
33245 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
33246
33247 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
33248 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
33249
33250 IF xla_accounting_cache_pkg.GetValueChar
33251 (p_source_code => 'LEDGER_CATEGORY_CODE'
33252 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
33253 AND l_bflow_method_code = 'PRIOR_ENTRY'
33254 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
33255 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
33256 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
33257 )
33258 THEN
33259 xla_ae_lines_pkg.BflowUpgEntry
33260 (p_business_method_code => l_bflow_method_code
33261 ,p_business_class_code => l_bflow_class_code
33262 ,p_balance_type => l_balance_type_code);
33263 ELSE
33264 NULL;
33265 -- No business flow processing for business flow method of NONE.
33266 END IF;
33267
33268 --
33269 -- call analytical criteria
33270 --
33271
33272 --
33273 -- call description
33274 --
33275
33276 xla_ae_lines_pkg.SetLineDescription(
33277 p_ae_header_id => l_ae_header_id
33278 ,p_description => Description_19 (
33279 p_application_id => p_application_id
33280 , p_ae_header_id => l_ae_header_id
33281 , p_source_1 => p_source_1
33282 )
33283 );
33284
33285
33286 --
33287 -- call ADRs
33288 -- Bug 4922099
33289 --
33290 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
33291 (NVL(l_actual_upg_option, 'N') = 'O') OR
33292 (NVL(l_enc_upg_option, 'N') = 'O')
33293 )
33294 THEN
33295 NULL;
33296 --
33297 --
33298
33299 l_ccid := AcctDerRule_174(
33300 p_application_id => p_application_id
33301 , p_ae_header_id => l_ae_header_id
33302 , p_source_5 => p_source_5
33303 , p_source_32 => p_source_32
33304 , x_transaction_coa_id => l_adr_transaction_coa_id
33305 , x_accounting_coa_id => l_adr_accounting_coa_id
33306 , x_value_type_code => l_adr_value_type_code
33307 , p_side => 'NA'
33308 );
33309
33310 xla_ae_lines_pkg.set_ccid(
33311 p_code_combination_id => l_ccid
33312 , p_value_type_code => l_adr_value_type_code
33313 , p_transaction_coa_id => l_adr_transaction_coa_id
33314 , p_accounting_coa_id => l_adr_accounting_coa_id
33315 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
33316 , p_adr_type_code => 'S'
33317 , p_component_type => l_component_type
33318 , p_component_code => l_component_code
33319 , p_component_type_code => l_component_type_code
33320 , p_component_appl_id => l_component_appl_id
33321 , p_amb_context_code => l_amb_context_code
33322 , p_side => 'NA'
33323 );
33324
33325
33326 l_segment := AcctDerRule_147(
33327 p_application_id => p_application_id
33328 , p_ae_header_id => l_ae_header_id
33329 , p_source_5 => p_source_5
33330 , p_source_9 => p_source_9
33331 , x_transaction_coa_id => l_adr_transaction_coa_id
33335 , x_value_type_code => l_adr_value_type_code
33332 , x_accounting_coa_id => l_adr_accounting_coa_id
33333 , x_flexfield_segment_code => l_adr_flexfield_segment_code
33334 , x_flex_value_set_id => l_adr_flex_value_set_id
33336 , x_value_combination_id => l_adr_value_combination_id
33337 , x_value_segment_code => l_adr_value_segment_code
33338 , p_side => 'NA'
33339 , p_override_seg_flag => 'Y'
33340 );
33341
33342 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
33343
33344 xla_ae_lines_pkg.set_segment(
33345 p_to_segment_code => 'GL_ACCOUNT'
33346 , p_segment_value => l_segment
33347 , p_from_segment_code => l_adr_value_segment_code
33348 , p_from_combination_id => l_adr_value_combination_id
33349 , p_value_type_code => l_adr_value_type_code
33350 , p_transaction_coa_id => l_adr_transaction_coa_id
33351 , p_accounting_coa_id => l_adr_accounting_coa_id
33352 , p_flexfield_segment_code => l_adr_flexfield_segment_code
33353 , p_flex_value_set_id => l_adr_flex_value_set_id
33354 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
33355 , p_adr_type_code => 'S'
33356 , p_component_type => l_component_type
33357 , p_component_code => l_component_code
33358 , p_component_type_code => l_component_type_code
33359 , p_component_appl_id => l_component_appl_id
33360 , p_amb_context_code => l_amb_context_code
33361 , p_entity_code => 'TRANSACTIONS'
33362 , p_event_class_code => 'CAPITALIZATION'
33363 , p_side => 'NA'
33364 );
33365
33366 END IF;
33367
33368 l_segment := AcctDerRule_169(
33369 p_application_id => p_application_id
33370 , p_ae_header_id => l_ae_header_id
33371 , p_source_5 => p_source_5
33372 , p_source_31 => p_source_31
33373 , x_transaction_coa_id => l_adr_transaction_coa_id
33374 , x_accounting_coa_id => l_adr_accounting_coa_id
33375 , x_flexfield_segment_code => l_adr_flexfield_segment_code
33376 , x_flex_value_set_id => l_adr_flex_value_set_id
33377 , x_value_type_code => l_adr_value_type_code
33378 , x_value_combination_id => l_adr_value_combination_id
33379 , x_value_segment_code => l_adr_value_segment_code
33380 , p_side => 'NA'
33381 , p_override_seg_flag => 'Y'
33382 );
33383
33384 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
33385
33386 xla_ae_lines_pkg.set_segment(
33387 p_to_segment_code => 'GL_BALANCING'
33388 , p_segment_value => l_segment
33389 , p_from_segment_code => l_adr_value_segment_code
33390 , p_from_combination_id => l_adr_value_combination_id
33391 , p_value_type_code => l_adr_value_type_code
33392 , p_transaction_coa_id => l_adr_transaction_coa_id
33393 , p_accounting_coa_id => l_adr_accounting_coa_id
33394 , p_flexfield_segment_code => l_adr_flexfield_segment_code
33395 , p_flex_value_set_id => l_adr_flex_value_set_id
33396 , p_adr_code => 'FA_EXPENSE_ACCT'
33397 , p_adr_type_code => 'S'
33398 , p_component_type => l_component_type
33399 , p_component_code => l_component_code
33400 , p_component_type_code => l_component_type_code
33401 , p_component_appl_id => l_component_appl_id
33402 , p_amb_context_code => l_amb_context_code
33403 , p_entity_code => 'TRANSACTIONS'
33404 , p_event_class_code => 'CAPITALIZATION'
33405 , p_side => 'NA'
33406 );
33407
33408 END IF;
33409
33410 --
33411 --
33412 END IF;
33413 --
33414 -- Bug 4922099
33415 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
33416 (NVL(l_enc_upg_option, 'N') = 'O')
33417 ) AND
33418 (l_bflow_method_code = 'PRIOR_ENTRY')
33419 )
33420 THEN
33421 IF
33422 --
33423 1 = 2
33424 --
33425 THEN
33426 xla_accounting_err_pkg.build_message
33427 (p_appli_s_name => 'XLA'
33428 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
33429 ,p_token_1 => 'LINE_NUMBER'
33430 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
33431 ,p_token_2 => 'LINE_TYPE_NAME'
33432 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
33433 l_component_type
33434 ,l_component_code
33435 ,l_component_type_code
33436 ,l_component_appl_id
33440 )
33437 ,l_amb_context_code
33438 ,l_entity_code
33439 ,l_event_class_code
33441 ,p_token_3 => 'OWNER'
33442 ,p_value_3 => xla_lookups_pkg.get_meaning(
33443 p_lookup_type => 'XLA_OWNER_TYPE'
33444 ,p_lookup_code => l_component_type_code
33445 )
33446 ,p_token_4 => 'PRODUCT_NAME'
33447 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
33448 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
33449 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
33450 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
33451 ,p_ae_header_id => NULL
33452 );
33453
33454 IF (C_LEVEL_ERROR>= g_log_level) THEN
33455 trace
33456 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
33457 ,p_level => C_LEVEL_ERROR
33458 ,p_module => l_log_module);
33459 END IF;
33460 END IF;
33461 END IF;
33462 --
33463 --
33464 ------------------------------------------------------------------------------------------------
33465 -- 4219869 Business Flow
33466 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
33467 -- Prior Entry. Currently, the following code is always generated.
33468 ------------------------------------------------------------------------------------------------
33469 XLA_AE_LINES_PKG.ValidateCurrentLine;
33470
33471 ------------------------------------------------------------------------------------
33472 -- 4219869 Business Flow
33473 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
33474 ------------------------------------------------------------------------------------
33475 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
33476
33477 ----------------------------------------------------------------------------------
33478 -- 4219869 Business Flow
33479 -- Update journal entry status -- Need to generate this within IF <condition>
33480 ----------------------------------------------------------------------------------
33481 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
33482 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
33483 ,p_balance_type_code => l_balance_type_code
33484 );
33485
33486 -------------------------------------------------------------------------------------------
33487 -- 4262811 - Generate the Accrual Reversal lines
33488 -------------------------------------------------------------------------------------------
33489 BEGIN
33490 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
33491 (g_array_event(p_event_id).array_value_num('header_index'));
33492 IF l_acc_rev_flag IS NULL THEN
33493 l_acc_rev_flag := 'N';
33494 END IF;
33495 EXCEPTION
33496 WHEN OTHERS THEN
33497 l_acc_rev_flag := 'N';
33498 END;
33499 --
33500 IF (l_acc_rev_flag = 'Y') THEN
33501
33502 -- 4645092 ------------------------------------------------------------------------------
33503 -- To allow MPA report to determine if it should generate report process
33504 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
33505 ------------------------------------------------------------------------------------------
33506
33507 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
33508 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
33509 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
33510 -- call ADRs
33511 -- Bug 4922099
33512 --
33513 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
33514 (NVL(l_actual_upg_option, 'N') = 'O') OR
33515 (NVL(l_enc_upg_option, 'N') = 'O')
33516 )
33517 THEN
33518 NULL;
33519 --
33520 --
33521
33522 l_ccid := AcctDerRule_174(
33523 p_application_id => p_application_id
33524 , p_ae_header_id => l_ae_header_id
33525 , p_source_5 => p_source_5
33526 , p_source_32 => p_source_32
33527 , x_transaction_coa_id => l_adr_transaction_coa_id
33528 , x_accounting_coa_id => l_adr_accounting_coa_id
33529 , x_value_type_code => l_adr_value_type_code
33530 , p_side => 'NA'
33531 );
33532
33533 xla_ae_lines_pkg.set_ccid(
33534 p_code_combination_id => l_ccid
33535 , p_value_type_code => l_adr_value_type_code
33539 , p_adr_type_code => 'S'
33536 , p_transaction_coa_id => l_adr_transaction_coa_id
33537 , p_accounting_coa_id => l_adr_accounting_coa_id
33538 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
33540 , p_component_type => l_component_type
33541 , p_component_code => l_component_code
33542 , p_component_type_code => l_component_type_code
33543 , p_component_appl_id => l_component_appl_id
33544 , p_amb_context_code => l_amb_context_code
33545 , p_side => 'NA'
33546 );
33547
33548
33549 l_segment := AcctDerRule_147(
33550 p_application_id => p_application_id
33551 , p_ae_header_id => l_ae_header_id
33552 , p_source_5 => p_source_5
33553 , p_source_9 => p_source_9
33554 , x_transaction_coa_id => l_adr_transaction_coa_id
33555 , x_accounting_coa_id => l_adr_accounting_coa_id
33556 , x_flexfield_segment_code => l_adr_flexfield_segment_code
33557 , x_flex_value_set_id => l_adr_flex_value_set_id
33558 , x_value_type_code => l_adr_value_type_code
33559 , x_value_combination_id => l_adr_value_combination_id
33560 , x_value_segment_code => l_adr_value_segment_code
33561 , p_side => 'NA'
33562 , p_override_seg_flag => 'Y'
33563 );
33564
33565 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
33566
33567 xla_ae_lines_pkg.set_segment(
33568 p_to_segment_code => 'GL_ACCOUNT'
33569 , p_segment_value => l_segment
33570 , p_from_segment_code => l_adr_value_segment_code
33571 , p_from_combination_id => l_adr_value_combination_id
33572 , p_value_type_code => l_adr_value_type_code
33573 , p_transaction_coa_id => l_adr_transaction_coa_id
33574 , p_accounting_coa_id => l_adr_accounting_coa_id
33575 , p_flexfield_segment_code => l_adr_flexfield_segment_code
33576 , p_flex_value_set_id => l_adr_flex_value_set_id
33577 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
33578 , p_adr_type_code => 'S'
33579 , p_component_type => l_component_type
33580 , p_component_code => l_component_code
33581 , p_component_type_code => l_component_type_code
33582 , p_component_appl_id => l_component_appl_id
33583 , p_amb_context_code => l_amb_context_code
33584 , p_entity_code => 'TRANSACTIONS'
33585 , p_event_class_code => 'CAPITALIZATION'
33586 , p_side => 'NA'
33587 );
33588
33589 END IF;
33590
33591 l_segment := AcctDerRule_169(
33592 p_application_id => p_application_id
33593 , p_ae_header_id => l_ae_header_id
33594 , p_source_5 => p_source_5
33595 , p_source_31 => p_source_31
33596 , x_transaction_coa_id => l_adr_transaction_coa_id
33597 , x_accounting_coa_id => l_adr_accounting_coa_id
33598 , x_flexfield_segment_code => l_adr_flexfield_segment_code
33599 , x_flex_value_set_id => l_adr_flex_value_set_id
33600 , x_value_type_code => l_adr_value_type_code
33601 , x_value_combination_id => l_adr_value_combination_id
33602 , x_value_segment_code => l_adr_value_segment_code
33603 , p_side => 'NA'
33604 , p_override_seg_flag => 'Y'
33605 );
33606
33607 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
33608
33609 xla_ae_lines_pkg.set_segment(
33610 p_to_segment_code => 'GL_BALANCING'
33611 , p_segment_value => l_segment
33612 , p_from_segment_code => l_adr_value_segment_code
33613 , p_from_combination_id => l_adr_value_combination_id
33614 , p_value_type_code => l_adr_value_type_code
33615 , p_transaction_coa_id => l_adr_transaction_coa_id
33616 , p_accounting_coa_id => l_adr_accounting_coa_id
33617 , p_flexfield_segment_code => l_adr_flexfield_segment_code
33618 , p_flex_value_set_id => l_adr_flex_value_set_id
33619 , p_adr_code => 'FA_EXPENSE_ACCT'
33620 , p_adr_type_code => 'S'
33621 , p_component_type => l_component_type
33622 , p_component_code => l_component_code
33623 , p_component_type_code => l_component_type_code
33624 , p_component_appl_id => l_component_appl_id
33625 , p_amb_context_code => l_amb_context_code
33626 , p_entity_code => 'TRANSACTIONS'
33627 , p_event_class_code => 'CAPITALIZATION'
33628 , p_side => 'NA'
33629 );
33630
33631 END IF;
33632
33633 --
33634 --
33635 END IF;
33636
33637 --
33638 -- Update the line information that should be overwritten
33639 --
33640 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
33641 p_header_num => 1);
33642 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
33643
33647 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
33644 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
33645
33646 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
33648 END IF;
33649
33650 --
33651 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
33652 --
33653 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
33654 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
33655 ELSE
33656 ---------------------------------------------------------------------------------------------------
33657 -- 4262811a Switch Sign
33658 ---------------------------------------------------------------------------------------------------
33659 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
33660 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
33661 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
33662 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
33663 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
33664 -- 5132302
33665 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
33666 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
33667
33668 END IF;
33669
33670 -- 4955764
33671 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
33672 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
33673
33674
33675 XLA_AE_LINES_PKG.ValidateCurrentLine;
33676 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
33677
33678 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
33679 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
33680 ,p_balance_type_code => l_balance_type_code);
33681
33682 END IF;
33683
33684 -----------------------------------------------------------------------------------------
33685 -- 4262811 Multiperiod Accounting
33686 -----------------------------------------------------------------------------------------
33687 -- No MPA option is assigned.
33688
33689
33690 END IF;
33691 END IF;
33692 --
33693
33694 --
33695 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
33696 trace
33697 (p_msg => 'END of AcctLineType_211'
33698 ,p_level => C_LEVEL_PROCEDURE
33699 ,p_module => l_log_module);
33700 END IF;
33701 --
33702 EXCEPTION
33703 WHEN xla_exceptions_pkg.application_exception THEN
33704 RAISE;
33705 WHEN OTHERS THEN
33706 xla_exceptions_pkg.raise_message
33707 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_211');
33708 END AcctLineType_211;
33709 --
33710
33711 ---------------------------------------
33712 --
33713 -- PRIVATE FUNCTION
33714 -- AcctLineType_212
33715 --
33716 ---------------------------------------
33717 PROCEDURE AcctLineType_212 (
33718 p_application_id IN NUMBER
33719 ,p_event_id IN NUMBER
33720 ,p_calculate_acctd_flag IN VARCHAR2
33721 ,p_calculate_g_l_flag IN VARCHAR2
33722 ,p_actual_flag IN OUT VARCHAR2
33723 ,p_balance_type_code OUT VARCHAR2
33724 ,p_gain_or_loss_ref OUT VARCHAR2
33725
33726 --Period Close Date
33727 , p_source_1 IN DATE
33728 --Generated Code Combination Identifier
33729 , p_source_5 IN NUMBER
33730 --Asset Cost Account
33731 , p_source_11 IN VARCHAR2
33732 --Expense Account Code Combination Identifier
33733 , p_source_31 IN NUMBER
33734 --Default Code Combination Identifier
33735 , p_source_32 IN NUMBER
33736 --Adjustment Type
33737 , p_source_48 IN VARCHAR2
33738 --Transaction Header Identifier
33739 , p_source_49 IN NUMBER
33740 --Adjustment Line Identifier
33741 , p_source_50 IN NUMBER
33742 --Distribution Type Code
33743 , p_source_51 IN VARCHAR2
33744 --Entered Amount
33745 , p_source_52 IN NUMBER
33746 --Currency Code
33747 , p_source_53 IN VARCHAR2
33748 )
33749 IS
33750
33751 l_component_type VARCHAR2(80);
33752 l_component_code VARCHAR2(30);
33753 l_component_type_code VARCHAR2(1);
33754 l_component_appl_id INTEGER;
33755 l_amb_context_code VARCHAR2(30);
33756 l_entity_code VARCHAR2(30);
33757 l_event_class_code VARCHAR2(30);
33758 l_ae_header_id NUMBER;
33759 l_event_type_code VARCHAR2(30);
33760 l_line_definition_code VARCHAR2(30);
33761 l_line_definition_owner_code VARCHAR2(1);
33762 --
33763 -- adr variables
33764 l_segment VARCHAR2(30);
33765 l_ccid NUMBER;
33766 l_adr_transaction_coa_id NUMBER;
33770 l_adr_value_type_code VARCHAR2(30);
33767 l_adr_accounting_coa_id NUMBER;
33768 l_adr_flexfield_segment_code VARCHAR2(30);
33769 l_adr_flex_value_set_id NUMBER;
33771 l_adr_value_combination_id NUMBER;
33772 l_adr_value_segment_code VARCHAR2(30);
33773
33774 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
33775 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
33776 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
33777 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
33778
33779 -- 4262811 Variables ------------------------------------------------------------------------------------------
33780 l_entered_amt_idx NUMBER;
33781 l_accted_amt_idx NUMBER;
33782 l_acc_rev_flag VARCHAR2(1);
33783 l_accrual_line_num NUMBER;
33784 l_tmp_amt NUMBER;
33785 l_acc_rev_natural_side_code VARCHAR2(1);
33786
33787 l_num_entries NUMBER;
33788 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
33789 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
33790 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
33791 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
33792 l_recog_line_1 NUMBER;
33793 l_recog_line_2 NUMBER;
33794
33795 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
33796 l_bflow_applied_to_amt NUMBER; -- 5132302
33797 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
33798
33799 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
33800
33801 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
33802 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
33803
33804 ---------------------------------------------------------------------------------------------------------------
33805
33806
33807 --
33808 -- bulk performance
33809 --
33810 l_balance_type_code VARCHAR2(1);
33811 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
33812 l_log_module VARCHAR2(240);
33813
33814 --
33815 -- Upgrade strategy
33816 --
33817 l_actual_upg_option VARCHAR2(1);
33818 l_enc_upg_option VARCHAR2(1);
33819
33820 --
33821 BEGIN
33822 --
33823 IF g_log_enabled THEN
33824 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_212';
33825 END IF;
33826 --
33827 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
33828
33829 trace
33830 (p_msg => 'BEGIN of AcctLineType_212'
33831 ,p_level => C_LEVEL_PROCEDURE
33832 ,p_module => l_log_module);
33833
33834 END IF;
33835 --
33836 l_component_type := 'AMB_JLT';
33837 l_component_code := 'FA_CAP_ASSET_COST';
33838 l_component_type_code := 'S';
33839 l_component_appl_id := 140;
33840 l_amb_context_code := 'DEFAULT';
33841 l_entity_code := 'TRANSACTIONS';
33842 l_event_class_code := 'CAPITALIZATION';
33843 l_event_type_code := 'CAPITALIZATION';
33844 l_line_definition_owner_code := 'S';
33845 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CAPITA3';
33846 --
33847 l_balance_type_code := 'A';
33848 l_segment := NULL;
33849 l_ccid := NULL;
33850 l_adr_transaction_coa_id := NULL;
33851 l_adr_accounting_coa_id := NULL;
33852 l_adr_flexfield_segment_code := NULL;
33853 l_adr_flex_value_set_id := NULL;
33854 l_adr_value_type_code := NULL;
33855 l_adr_value_combination_id := NULL;
33856 l_adr_value_segment_code := NULL;
33857
33858 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
33859 l_bflow_class_code := ''; -- 4219869 Business Flow
33860 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
33861 l_budgetary_control_flag := 'N';
33862
33863 l_bflow_applied_to_amt_idx := NULL; -- 5132302
33864 l_bflow_applied_to_amt := NULL; -- 5132302
33865 l_entered_amt_idx := NULL; -- 4262811
33866 l_accted_amt_idx := NULL; -- 4262811
33867 l_acc_rev_flag := NULL; -- 4262811
33868 l_accrual_line_num := NULL; -- 4262811
33869 l_tmp_amt := NULL; -- 4262811
33870 --
33871
33872 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
33873 l_balance_type_code <> 'B' THEN
33874 IF NVL(p_source_48,'
33875 ') = 'COST'
33876 THEN
33877
33878 --
33879 XLA_AE_LINES_PKG.SetNewLine;
33880
33881 p_balance_type_code := l_balance_type_code;
33882 -- set the flag so later we will know whether the gain loss line needs to be created
33883
33884 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
33885 p_actual_flag :='A';
33886 END IF;
33887
33888 --
33889 -- bulk performance
33890 --
33891 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
33892 p_header_num => 0); -- 4262811
33893 --
33894 -- set accounting line options
33895 --
33899 , p_gl_transfer_mode_code => 'S'
33896 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
33897 p_natural_side_code => 'D'
33898 , p_gain_or_loss_flag => 'N'
33900 , p_acct_entry_type_code => 'A'
33901 , p_switch_side_flag => 'Y'
33902 , p_merge_duplicate_code => 'N'
33903 );
33904 --
33905 l_acc_rev_natural_side_code := 'C'; -- 4262811
33906 --
33907 --
33908 -- set accounting line type info
33909 --
33910 xla_ae_lines_pkg.SetAcctLineType
33911 (p_component_type => l_component_type
33912 ,p_event_type_code => l_event_type_code
33913 ,p_line_definition_owner_code => l_line_definition_owner_code
33914 ,p_line_definition_code => l_line_definition_code
33915 ,p_accounting_line_code => l_component_code
33916 ,p_accounting_line_type_code => l_component_type_code
33917 ,p_accounting_line_appl_id => l_component_appl_id
33918 ,p_amb_context_code => l_amb_context_code
33919 ,p_entity_code => l_entity_code
33920 ,p_event_class_code => l_event_class_code);
33921 --
33922 -- set accounting class
33923 --
33924 xla_ae_lines_pkg.SetAcctClass(
33925 p_accounting_class_code => 'ASSET'
33926 , p_ae_header_id => l_ae_header_id
33927 );
33928
33929 --
33930 -- set rounding class
33931 --
33932 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
33933 'ASSET';
33934
33935 --
33936 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
33937 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
33938 --
33939 -- bulk performance
33940 --
33941 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
33942
33943 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
33944 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
33945
33946 -- 4955764
33947 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
33948 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
33949
33950 -- 4458381 Public Sector Enh
33951
33952 --
33953 -- set accounting attributes for the line type
33954 --
33955 l_entered_amt_idx := 4;
33956 l_accted_amt_idx := 6;
33957 l_bflow_applied_to_amt_idx := NULL; -- 5132302
33958 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
33959 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
33960 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
33961 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
33962 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
33963 l_rec_acct_attrs.array_char_value(3) := p_source_51;
33964 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
33965 l_rec_acct_attrs.array_num_value(4) := p_source_52;
33966 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
33967 l_rec_acct_attrs.array_char_value(5) := p_source_53;
33968 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
33969 l_rec_acct_attrs.array_num_value(6) := p_source_52;
33970
33971 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
33972 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
33973
33974 ---------------------------------------------------------------------------------------------------------------
33975 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
33976 ---------------------------------------------------------------------------------------------------------------
33977 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
33978
33979 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
33980 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
33981
33982 IF xla_accounting_cache_pkg.GetValueChar
33983 (p_source_code => 'LEDGER_CATEGORY_CODE'
33984 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
33985 AND l_bflow_method_code = 'PRIOR_ENTRY'
33986 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
33987 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
33988 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
33989 )
33990 THEN
33991 xla_ae_lines_pkg.BflowUpgEntry
33992 (p_business_method_code => l_bflow_method_code
33993 ,p_business_class_code => l_bflow_class_code
33994 ,p_balance_type => l_balance_type_code);
33995 ELSE
33996 NULL;
33997 -- No business flow processing for business flow method of NONE.
33998 END IF;
33999
34000 --
34001 -- call analytical criteria
34002 --
34003
34004 --
34005 -- call description
34006 --
34007
34011 p_application_id => p_application_id
34008 xla_ae_lines_pkg.SetLineDescription(
34009 p_ae_header_id => l_ae_header_id
34010 ,p_description => Description_20 (
34012 , p_ae_header_id => l_ae_header_id
34013 , p_source_1 => p_source_1
34014 )
34015 );
34016
34017
34018 --
34019 -- call ADRs
34020 -- Bug 4922099
34021 --
34022 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
34023 (NVL(l_actual_upg_option, 'N') = 'O') OR
34024 (NVL(l_enc_upg_option, 'N') = 'O')
34025 )
34026 THEN
34027 NULL;
34028 --
34029 --
34030
34031 l_ccid := AcctDerRule_174(
34032 p_application_id => p_application_id
34033 , p_ae_header_id => l_ae_header_id
34034 , p_source_5 => p_source_5
34035 , p_source_32 => p_source_32
34036 , x_transaction_coa_id => l_adr_transaction_coa_id
34037 , x_accounting_coa_id => l_adr_accounting_coa_id
34038 , x_value_type_code => l_adr_value_type_code
34039 , p_side => 'NA'
34040 );
34041
34042 xla_ae_lines_pkg.set_ccid(
34043 p_code_combination_id => l_ccid
34044 , p_value_type_code => l_adr_value_type_code
34045 , p_transaction_coa_id => l_adr_transaction_coa_id
34046 , p_accounting_coa_id => l_adr_accounting_coa_id
34047 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
34048 , p_adr_type_code => 'S'
34049 , p_component_type => l_component_type
34050 , p_component_code => l_component_code
34051 , p_component_type_code => l_component_type_code
34052 , p_component_appl_id => l_component_appl_id
34053 , p_amb_context_code => l_amb_context_code
34054 , p_side => 'NA'
34055 );
34056
34057
34058 l_segment := AcctDerRule_149(
34059 p_application_id => p_application_id
34060 , p_ae_header_id => l_ae_header_id
34061 , p_source_5 => p_source_5
34062 , p_source_11 => p_source_11
34063 , x_transaction_coa_id => l_adr_transaction_coa_id
34064 , x_accounting_coa_id => l_adr_accounting_coa_id
34065 , x_flexfield_segment_code => l_adr_flexfield_segment_code
34066 , x_flex_value_set_id => l_adr_flex_value_set_id
34067 , x_value_type_code => l_adr_value_type_code
34068 , x_value_combination_id => l_adr_value_combination_id
34069 , x_value_segment_code => l_adr_value_segment_code
34070 , p_side => 'NA'
34071 , p_override_seg_flag => 'Y'
34072 );
34073
34074 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
34075
34076 xla_ae_lines_pkg.set_segment(
34077 p_to_segment_code => 'GL_ACCOUNT'
34078 , p_segment_value => l_segment
34079 , p_from_segment_code => l_adr_value_segment_code
34080 , p_from_combination_id => l_adr_value_combination_id
34081 , p_value_type_code => l_adr_value_type_code
34082 , p_transaction_coa_id => l_adr_transaction_coa_id
34083 , p_accounting_coa_id => l_adr_accounting_coa_id
34084 , p_flexfield_segment_code => l_adr_flexfield_segment_code
34085 , p_flex_value_set_id => l_adr_flex_value_set_id
34086 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
34087 , p_adr_type_code => 'S'
34088 , p_component_type => l_component_type
34089 , p_component_code => l_component_code
34090 , p_component_type_code => l_component_type_code
34091 , p_component_appl_id => l_component_appl_id
34092 , p_amb_context_code => l_amb_context_code
34093 , p_entity_code => 'TRANSACTIONS'
34094 , p_event_class_code => 'CAPITALIZATION'
34095 , p_side => 'NA'
34096 );
34097
34098 END IF;
34099
34100 l_segment := AcctDerRule_169(
34101 p_application_id => p_application_id
34102 , p_ae_header_id => l_ae_header_id
34103 , p_source_5 => p_source_5
34104 , p_source_31 => p_source_31
34105 , x_transaction_coa_id => l_adr_transaction_coa_id
34106 , x_accounting_coa_id => l_adr_accounting_coa_id
34107 , x_flexfield_segment_code => l_adr_flexfield_segment_code
34108 , x_flex_value_set_id => l_adr_flex_value_set_id
34109 , x_value_type_code => l_adr_value_type_code
34110 , x_value_combination_id => l_adr_value_combination_id
34111 , x_value_segment_code => l_adr_value_segment_code
34112 , p_side => 'NA'
34113 , p_override_seg_flag => 'Y'
34114 );
34115
34116 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
34117
34118 xla_ae_lines_pkg.set_segment(
34119 p_to_segment_code => 'GL_BALANCING'
34120 , p_segment_value => l_segment
34121 , p_from_segment_code => l_adr_value_segment_code
34122 , p_from_combination_id => l_adr_value_combination_id
34123 , p_value_type_code => l_adr_value_type_code
34124 , p_transaction_coa_id => l_adr_transaction_coa_id
34128 , p_adr_code => 'FA_EXPENSE_ACCT'
34125 , p_accounting_coa_id => l_adr_accounting_coa_id
34126 , p_flexfield_segment_code => l_adr_flexfield_segment_code
34127 , p_flex_value_set_id => l_adr_flex_value_set_id
34129 , p_adr_type_code => 'S'
34130 , p_component_type => l_component_type
34131 , p_component_code => l_component_code
34132 , p_component_type_code => l_component_type_code
34133 , p_component_appl_id => l_component_appl_id
34134 , p_amb_context_code => l_amb_context_code
34135 , p_entity_code => 'TRANSACTIONS'
34136 , p_event_class_code => 'CAPITALIZATION'
34137 , p_side => 'NA'
34138 );
34139
34140 END IF;
34141
34142 --
34143 --
34144 END IF;
34145 --
34146 -- Bug 4922099
34147 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
34148 (NVL(l_enc_upg_option, 'N') = 'O')
34149 ) AND
34150 (l_bflow_method_code = 'PRIOR_ENTRY')
34151 )
34152 THEN
34153 IF
34154 --
34155 1 = 2
34156 --
34157 THEN
34158 xla_accounting_err_pkg.build_message
34159 (p_appli_s_name => 'XLA'
34160 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
34161 ,p_token_1 => 'LINE_NUMBER'
34162 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
34163 ,p_token_2 => 'LINE_TYPE_NAME'
34164 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
34165 l_component_type
34166 ,l_component_code
34167 ,l_component_type_code
34168 ,l_component_appl_id
34169 ,l_amb_context_code
34170 ,l_entity_code
34171 ,l_event_class_code
34172 )
34173 ,p_token_3 => 'OWNER'
34174 ,p_value_3 => xla_lookups_pkg.get_meaning(
34175 p_lookup_type => 'XLA_OWNER_TYPE'
34176 ,p_lookup_code => l_component_type_code
34177 )
34178 ,p_token_4 => 'PRODUCT_NAME'
34179 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
34180 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
34181 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
34182 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
34183 ,p_ae_header_id => NULL
34184 );
34185
34186 IF (C_LEVEL_ERROR>= g_log_level) THEN
34187 trace
34188 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
34189 ,p_level => C_LEVEL_ERROR
34190 ,p_module => l_log_module);
34191 END IF;
34192 END IF;
34193 END IF;
34194 --
34195 --
34196 ------------------------------------------------------------------------------------------------
34197 -- 4219869 Business Flow
34198 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
34199 -- Prior Entry. Currently, the following code is always generated.
34200 ------------------------------------------------------------------------------------------------
34201 XLA_AE_LINES_PKG.ValidateCurrentLine;
34202
34203 ------------------------------------------------------------------------------------
34204 -- 4219869 Business Flow
34205 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
34206 ------------------------------------------------------------------------------------
34207 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
34208
34209 ----------------------------------------------------------------------------------
34210 -- 4219869 Business Flow
34211 -- Update journal entry status -- Need to generate this within IF <condition>
34212 ----------------------------------------------------------------------------------
34213 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
34214 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
34215 ,p_balance_type_code => l_balance_type_code
34216 );
34217
34218 -------------------------------------------------------------------------------------------
34222 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
34219 -- 4262811 - Generate the Accrual Reversal lines
34220 -------------------------------------------------------------------------------------------
34221 BEGIN
34223 (g_array_event(p_event_id).array_value_num('header_index'));
34224 IF l_acc_rev_flag IS NULL THEN
34225 l_acc_rev_flag := 'N';
34226 END IF;
34227 EXCEPTION
34228 WHEN OTHERS THEN
34229 l_acc_rev_flag := 'N';
34230 END;
34231 --
34232 IF (l_acc_rev_flag = 'Y') THEN
34233
34234 -- 4645092 ------------------------------------------------------------------------------
34235 -- To allow MPA report to determine if it should generate report process
34236 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
34237 ------------------------------------------------------------------------------------------
34238
34239 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
34240 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
34241 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
34242 -- call ADRs
34243 -- Bug 4922099
34244 --
34245 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
34246 (NVL(l_actual_upg_option, 'N') = 'O') OR
34247 (NVL(l_enc_upg_option, 'N') = 'O')
34248 )
34249 THEN
34250 NULL;
34251 --
34252 --
34253
34254 l_ccid := AcctDerRule_174(
34255 p_application_id => p_application_id
34256 , p_ae_header_id => l_ae_header_id
34257 , p_source_5 => p_source_5
34258 , p_source_32 => p_source_32
34259 , x_transaction_coa_id => l_adr_transaction_coa_id
34260 , x_accounting_coa_id => l_adr_accounting_coa_id
34261 , x_value_type_code => l_adr_value_type_code
34262 , p_side => 'NA'
34263 );
34264
34265 xla_ae_lines_pkg.set_ccid(
34266 p_code_combination_id => l_ccid
34267 , p_value_type_code => l_adr_value_type_code
34268 , p_transaction_coa_id => l_adr_transaction_coa_id
34269 , p_accounting_coa_id => l_adr_accounting_coa_id
34270 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
34271 , p_adr_type_code => 'S'
34272 , p_component_type => l_component_type
34273 , p_component_code => l_component_code
34274 , p_component_type_code => l_component_type_code
34275 , p_component_appl_id => l_component_appl_id
34276 , p_amb_context_code => l_amb_context_code
34277 , p_side => 'NA'
34278 );
34279
34280
34281 l_segment := AcctDerRule_149(
34282 p_application_id => p_application_id
34283 , p_ae_header_id => l_ae_header_id
34284 , p_source_5 => p_source_5
34285 , p_source_11 => p_source_11
34286 , x_transaction_coa_id => l_adr_transaction_coa_id
34287 , x_accounting_coa_id => l_adr_accounting_coa_id
34288 , x_flexfield_segment_code => l_adr_flexfield_segment_code
34289 , x_flex_value_set_id => l_adr_flex_value_set_id
34290 , x_value_type_code => l_adr_value_type_code
34291 , x_value_combination_id => l_adr_value_combination_id
34292 , x_value_segment_code => l_adr_value_segment_code
34293 , p_side => 'NA'
34294 , p_override_seg_flag => 'Y'
34295 );
34296
34297 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
34298
34299 xla_ae_lines_pkg.set_segment(
34300 p_to_segment_code => 'GL_ACCOUNT'
34301 , p_segment_value => l_segment
34302 , p_from_segment_code => l_adr_value_segment_code
34303 , p_from_combination_id => l_adr_value_combination_id
34304 , p_value_type_code => l_adr_value_type_code
34305 , p_transaction_coa_id => l_adr_transaction_coa_id
34306 , p_accounting_coa_id => l_adr_accounting_coa_id
34307 , p_flexfield_segment_code => l_adr_flexfield_segment_code
34308 , p_flex_value_set_id => l_adr_flex_value_set_id
34309 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
34310 , p_adr_type_code => 'S'
34311 , p_component_type => l_component_type
34312 , p_component_code => l_component_code
34313 , p_component_type_code => l_component_type_code
34314 , p_component_appl_id => l_component_appl_id
34315 , p_amb_context_code => l_amb_context_code
34316 , p_entity_code => 'TRANSACTIONS'
34317 , p_event_class_code => 'CAPITALIZATION'
34318 , p_side => 'NA'
34319 );
34320
34321 END IF;
34322
34323 l_segment := AcctDerRule_169(
34324 p_application_id => p_application_id
34325 , p_ae_header_id => l_ae_header_id
34326 , p_source_5 => p_source_5
34327 , p_source_31 => p_source_31
34328 , x_transaction_coa_id => l_adr_transaction_coa_id
34329 , x_accounting_coa_id => l_adr_accounting_coa_id
34330 , x_flexfield_segment_code => l_adr_flexfield_segment_code
34331 , x_flex_value_set_id => l_adr_flex_value_set_id
34332 , x_value_type_code => l_adr_value_type_code
34333 , x_value_combination_id => l_adr_value_combination_id
34337 );
34334 , x_value_segment_code => l_adr_value_segment_code
34335 , p_side => 'NA'
34336 , p_override_seg_flag => 'Y'
34338
34339 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
34340
34341 xla_ae_lines_pkg.set_segment(
34342 p_to_segment_code => 'GL_BALANCING'
34343 , p_segment_value => l_segment
34344 , p_from_segment_code => l_adr_value_segment_code
34345 , p_from_combination_id => l_adr_value_combination_id
34346 , p_value_type_code => l_adr_value_type_code
34347 , p_transaction_coa_id => l_adr_transaction_coa_id
34348 , p_accounting_coa_id => l_adr_accounting_coa_id
34349 , p_flexfield_segment_code => l_adr_flexfield_segment_code
34350 , p_flex_value_set_id => l_adr_flex_value_set_id
34351 , p_adr_code => 'FA_EXPENSE_ACCT'
34352 , p_adr_type_code => 'S'
34353 , p_component_type => l_component_type
34354 , p_component_code => l_component_code
34355 , p_component_type_code => l_component_type_code
34356 , p_component_appl_id => l_component_appl_id
34357 , p_amb_context_code => l_amb_context_code
34358 , p_entity_code => 'TRANSACTIONS'
34359 , p_event_class_code => 'CAPITALIZATION'
34360 , p_side => 'NA'
34361 );
34362
34363 END IF;
34364
34365 --
34366 --
34367 END IF;
34368
34369 --
34370 -- Update the line information that should be overwritten
34371 --
34372 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
34373 p_header_num => 1);
34374 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
34375
34376 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
34377
34378 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
34379 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
34380 END IF;
34381
34382 --
34383 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
34384 --
34385 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
34386 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
34387 ELSE
34388 ---------------------------------------------------------------------------------------------------
34389 -- 4262811a Switch Sign
34390 ---------------------------------------------------------------------------------------------------
34391 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
34392 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
34393 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
34394 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
34395 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
34396 -- 5132302
34397 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
34398 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
34399
34400 END IF;
34401
34402 -- 4955764
34403 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
34404 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
34405
34406
34407 XLA_AE_LINES_PKG.ValidateCurrentLine;
34408 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
34409
34410 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
34411 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
34412 ,p_balance_type_code => l_balance_type_code);
34413
34414 END IF;
34415
34416 -----------------------------------------------------------------------------------------
34417 -- 4262811 Multiperiod Accounting
34418 -----------------------------------------------------------------------------------------
34419 -- No MPA option is assigned.
34420
34421
34422 END IF;
34423 END IF;
34424 --
34425
34426 --
34427 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
34428 trace
34429 (p_msg => 'END of AcctLineType_212'
34430 ,p_level => C_LEVEL_PROCEDURE
34431 ,p_module => l_log_module);
34432 END IF;
34433 --
34434 EXCEPTION
34435 WHEN xla_exceptions_pkg.application_exception THEN
34436 RAISE;
34437 WHEN OTHERS THEN
34438 xla_exceptions_pkg.raise_message
34439 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_212');
34440 END AcctLineType_212;
34441 --
34442
34443 ---------------------------------------
34444 --
34445 -- PRIVATE FUNCTION
34446 -- AcctLineType_213
34447 --
34448 ---------------------------------------
34449 PROCEDURE AcctLineType_213 (
34450 p_application_id IN NUMBER
34451 ,p_event_id IN NUMBER
34455 ,p_balance_type_code OUT VARCHAR2
34452 ,p_calculate_acctd_flag IN VARCHAR2
34453 ,p_calculate_g_l_flag IN VARCHAR2
34454 ,p_actual_flag IN OUT VARCHAR2
34456 ,p_gain_or_loss_ref OUT VARCHAR2
34457
34458 --Period Close Date
34459 , p_source_1 IN DATE
34460 --Generated Code Combination Identifier
34461 , p_source_5 IN NUMBER
34462 --Expense Account Code Combination Identifier
34463 , p_source_31 IN NUMBER
34464 --Adjustment Type
34465 , p_source_48 IN VARCHAR2
34466 --Transaction Header Identifier
34467 , p_source_49 IN NUMBER
34468 --Adjustment Line Identifier
34469 , p_source_50 IN NUMBER
34470 --Distribution Type Code
34471 , p_source_51 IN VARCHAR2
34472 --Entered Amount
34473 , p_source_52 IN NUMBER
34474 --Currency Code
34475 , p_source_53 IN VARCHAR2
34476 )
34477 IS
34478
34479 l_component_type VARCHAR2(80);
34480 l_component_code VARCHAR2(30);
34481 l_component_type_code VARCHAR2(1);
34482 l_component_appl_id INTEGER;
34483 l_amb_context_code VARCHAR2(30);
34484 l_entity_code VARCHAR2(30);
34485 l_event_class_code VARCHAR2(30);
34486 l_ae_header_id NUMBER;
34487 l_event_type_code VARCHAR2(30);
34488 l_line_definition_code VARCHAR2(30);
34489 l_line_definition_owner_code VARCHAR2(1);
34490 --
34491 -- adr variables
34492 l_segment VARCHAR2(30);
34493 l_ccid NUMBER;
34494 l_adr_transaction_coa_id NUMBER;
34495 l_adr_accounting_coa_id NUMBER;
34496 l_adr_flexfield_segment_code VARCHAR2(30);
34497 l_adr_flex_value_set_id NUMBER;
34498 l_adr_value_type_code VARCHAR2(30);
34499 l_adr_value_combination_id NUMBER;
34500 l_adr_value_segment_code VARCHAR2(30);
34501
34502 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
34503 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
34504 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
34505 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
34506
34507 -- 4262811 Variables ------------------------------------------------------------------------------------------
34508 l_entered_amt_idx NUMBER;
34509 l_accted_amt_idx NUMBER;
34510 l_acc_rev_flag VARCHAR2(1);
34511 l_accrual_line_num NUMBER;
34512 l_tmp_amt NUMBER;
34513 l_acc_rev_natural_side_code VARCHAR2(1);
34514
34515 l_num_entries NUMBER;
34516 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
34517 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
34518 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
34519 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
34520 l_recog_line_1 NUMBER;
34521 l_recog_line_2 NUMBER;
34522
34523 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
34524 l_bflow_applied_to_amt NUMBER; -- 5132302
34525 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
34526
34527 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
34528
34529 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
34530 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
34531
34532 ---------------------------------------------------------------------------------------------------------------
34533
34534
34535 --
34536 -- bulk performance
34537 --
34538 l_balance_type_code VARCHAR2(1);
34539 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
34540 l_log_module VARCHAR2(240);
34541
34542 --
34543 -- Upgrade strategy
34544 --
34545 l_actual_upg_option VARCHAR2(1);
34546 l_enc_upg_option VARCHAR2(1);
34547
34548 --
34549 BEGIN
34550 --
34551 IF g_log_enabled THEN
34552 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_213';
34553 END IF;
34554 --
34555 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
34556
34557 trace
34558 (p_msg => 'BEGIN of AcctLineType_213'
34559 ,p_level => C_LEVEL_PROCEDURE
34560 ,p_module => l_log_module);
34561
34562 END IF;
34563 --
34564 l_component_type := 'AMB_JLT';
34565 l_component_code := 'FA_CAP_ASSET_EXP';
34566 l_component_type_code := 'S';
34567 l_component_appl_id := 140;
34568 l_amb_context_code := 'DEFAULT';
34569 l_entity_code := 'TRANSACTIONS';
34570 l_event_class_code := 'CAPITALIZATION';
34571 l_event_type_code := 'CAPITALIZATION';
34572 l_line_definition_owner_code := 'S';
34573 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CAPITA3';
34574 --
34575 l_balance_type_code := 'A';
34576 l_segment := NULL;
34577 l_ccid := NULL;
34578 l_adr_transaction_coa_id := NULL;
34579 l_adr_accounting_coa_id := NULL;
34580 l_adr_flexfield_segment_code := NULL;
34581 l_adr_flex_value_set_id := NULL;
34582 l_adr_value_type_code := NULL;
34583 l_adr_value_combination_id := NULL;
34587 l_bflow_class_code := ''; -- 4219869 Business Flow
34584 l_adr_value_segment_code := NULL;
34585
34586 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
34588 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
34589 l_budgetary_control_flag := 'N';
34590
34591 l_bflow_applied_to_amt_idx := NULL; -- 5132302
34592 l_bflow_applied_to_amt := NULL; -- 5132302
34593 l_entered_amt_idx := NULL; -- 4262811
34594 l_accted_amt_idx := NULL; -- 4262811
34595 l_acc_rev_flag := NULL; -- 4262811
34596 l_accrual_line_num := NULL; -- 4262811
34597 l_tmp_amt := NULL; -- 4262811
34598 --
34599
34600 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
34601 l_balance_type_code <> 'B' THEN
34602 IF NVL(p_source_48,'
34603 ') = 'EXPENSE'
34604 THEN
34605
34606 --
34607 XLA_AE_LINES_PKG.SetNewLine;
34608
34609 p_balance_type_code := l_balance_type_code;
34610 -- set the flag so later we will know whether the gain loss line needs to be created
34611
34612 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
34613 p_actual_flag :='A';
34614 END IF;
34615
34616 --
34617 -- bulk performance
34618 --
34619 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
34620 p_header_num => 0); -- 4262811
34621 --
34622 -- set accounting line options
34623 --
34624 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
34625 p_natural_side_code => 'D'
34626 , p_gain_or_loss_flag => 'N'
34627 , p_gl_transfer_mode_code => 'S'
34628 , p_acct_entry_type_code => 'A'
34629 , p_switch_side_flag => 'Y'
34630 , p_merge_duplicate_code => 'N'
34631 );
34632 --
34633 l_acc_rev_natural_side_code := 'C'; -- 4262811
34634 --
34635 --
34636 -- set accounting line type info
34637 --
34638 xla_ae_lines_pkg.SetAcctLineType
34639 (p_component_type => l_component_type
34640 ,p_event_type_code => l_event_type_code
34641 ,p_line_definition_owner_code => l_line_definition_owner_code
34642 ,p_line_definition_code => l_line_definition_code
34643 ,p_accounting_line_code => l_component_code
34644 ,p_accounting_line_type_code => l_component_type_code
34645 ,p_accounting_line_appl_id => l_component_appl_id
34646 ,p_amb_context_code => l_amb_context_code
34647 ,p_entity_code => l_entity_code
34648 ,p_event_class_code => l_event_class_code);
34649 --
34650 -- set accounting class
34651 --
34652 xla_ae_lines_pkg.SetAcctClass(
34653 p_accounting_class_code => 'EXPENSE'
34654 , p_ae_header_id => l_ae_header_id
34655 );
34656
34657 --
34658 -- set rounding class
34659 --
34660 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
34661 'EXPENSE';
34662
34663 --
34664 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
34665 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
34666 --
34667 -- bulk performance
34668 --
34669 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
34670
34671 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
34672 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
34673
34674 -- 4955764
34675 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
34676 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
34677
34678 -- 4458381 Public Sector Enh
34679
34680 --
34681 -- set accounting attributes for the line type
34682 --
34683 l_entered_amt_idx := 4;
34684 l_accted_amt_idx := 6;
34685 l_bflow_applied_to_amt_idx := NULL; -- 5132302
34686 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
34687 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
34688 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
34689 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
34690 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
34691 l_rec_acct_attrs.array_char_value(3) := p_source_51;
34692 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
34693 l_rec_acct_attrs.array_num_value(4) := p_source_52;
34694 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
34695 l_rec_acct_attrs.array_char_value(5) := p_source_53;
34696 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
34697 l_rec_acct_attrs.array_num_value(6) := p_source_52;
34698
34699 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
34700 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
34701
34705 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
34702 ---------------------------------------------------------------------------------------------------------------
34703 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
34704 ---------------------------------------------------------------------------------------------------------------
34706
34707 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
34708 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
34709
34710 IF xla_accounting_cache_pkg.GetValueChar
34711 (p_source_code => 'LEDGER_CATEGORY_CODE'
34712 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
34713 AND l_bflow_method_code = 'PRIOR_ENTRY'
34714 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
34715 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
34716 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
34717 )
34718 THEN
34719 xla_ae_lines_pkg.BflowUpgEntry
34720 (p_business_method_code => l_bflow_method_code
34721 ,p_business_class_code => l_bflow_class_code
34722 ,p_balance_type => l_balance_type_code);
34723 ELSE
34724 NULL;
34725 -- No business flow processing for business flow method of NONE.
34726 END IF;
34727
34728 --
34729 -- call analytical criteria
34730 --
34731
34732 --
34733 -- call description
34734 --
34735
34736 xla_ae_lines_pkg.SetLineDescription(
34737 p_ae_header_id => l_ae_header_id
34738 ,p_description => Description_21 (
34739 p_application_id => p_application_id
34740 , p_ae_header_id => l_ae_header_id
34741 , p_source_1 => p_source_1
34742 )
34743 );
34744
34745
34746 --
34747 -- call ADRs
34748 -- Bug 4922099
34749 --
34750 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
34751 (NVL(l_actual_upg_option, 'N') = 'O') OR
34752 (NVL(l_enc_upg_option, 'N') = 'O')
34753 )
34754 THEN
34755 NULL;
34756 --
34757 --
34758
34759 l_ccid := AcctDerRule_176(
34760 p_application_id => p_application_id
34761 , p_ae_header_id => l_ae_header_id
34762 , p_source_5 => p_source_5
34763 , p_source_31 => p_source_31
34764 , x_transaction_coa_id => l_adr_transaction_coa_id
34765 , x_accounting_coa_id => l_adr_accounting_coa_id
34766 , x_value_type_code => l_adr_value_type_code
34767 , p_side => 'NA'
34768 );
34769
34770 xla_ae_lines_pkg.set_ccid(
34771 p_code_combination_id => l_ccid
34772 , p_value_type_code => l_adr_value_type_code
34773 , p_transaction_coa_id => l_adr_transaction_coa_id
34774 , p_accounting_coa_id => l_adr_accounting_coa_id
34775 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
34776 , p_adr_type_code => 'S'
34777 , p_component_type => l_component_type
34778 , p_component_code => l_component_code
34779 , p_component_type_code => l_component_type_code
34780 , p_component_appl_id => l_component_appl_id
34781 , p_amb_context_code => l_amb_context_code
34782 , p_side => 'NA'
34783 );
34784
34785
34786 --
34787 --
34788 END IF;
34789 --
34790 -- Bug 4922099
34791 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
34792 (NVL(l_enc_upg_option, 'N') = 'O')
34793 ) AND
34794 (l_bflow_method_code = 'PRIOR_ENTRY')
34795 )
34796 THEN
34797 IF
34798 --
34799 1 = 2
34800 --
34801 THEN
34802 xla_accounting_err_pkg.build_message
34803 (p_appli_s_name => 'XLA'
34804 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
34805 ,p_token_1 => 'LINE_NUMBER'
34806 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
34807 ,p_token_2 => 'LINE_TYPE_NAME'
34808 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
34809 l_component_type
34810 ,l_component_code
34811 ,l_component_type_code
34812 ,l_component_appl_id
34813 ,l_amb_context_code
34814 ,l_entity_code
34815 ,l_event_class_code
34816 )
34820 ,p_lookup_code => l_component_type_code
34817 ,p_token_3 => 'OWNER'
34818 ,p_value_3 => xla_lookups_pkg.get_meaning(
34819 p_lookup_type => 'XLA_OWNER_TYPE'
34821 )
34822 ,p_token_4 => 'PRODUCT_NAME'
34823 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
34824 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
34825 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
34826 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
34827 ,p_ae_header_id => NULL
34828 );
34829
34830 IF (C_LEVEL_ERROR>= g_log_level) THEN
34831 trace
34832 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
34833 ,p_level => C_LEVEL_ERROR
34834 ,p_module => l_log_module);
34835 END IF;
34836 END IF;
34837 END IF;
34838 --
34839 --
34840 ------------------------------------------------------------------------------------------------
34841 -- 4219869 Business Flow
34842 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
34843 -- Prior Entry. Currently, the following code is always generated.
34844 ------------------------------------------------------------------------------------------------
34845 XLA_AE_LINES_PKG.ValidateCurrentLine;
34846
34847 ------------------------------------------------------------------------------------
34848 -- 4219869 Business Flow
34849 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
34850 ------------------------------------------------------------------------------------
34851 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
34852
34853 ----------------------------------------------------------------------------------
34854 -- 4219869 Business Flow
34855 -- Update journal entry status -- Need to generate this within IF <condition>
34856 ----------------------------------------------------------------------------------
34857 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
34858 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
34859 ,p_balance_type_code => l_balance_type_code
34860 );
34861
34862 -------------------------------------------------------------------------------------------
34863 -- 4262811 - Generate the Accrual Reversal lines
34864 -------------------------------------------------------------------------------------------
34865 BEGIN
34866 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
34867 (g_array_event(p_event_id).array_value_num('header_index'));
34868 IF l_acc_rev_flag IS NULL THEN
34869 l_acc_rev_flag := 'N';
34870 END IF;
34871 EXCEPTION
34872 WHEN OTHERS THEN
34873 l_acc_rev_flag := 'N';
34874 END;
34875 --
34876 IF (l_acc_rev_flag = 'Y') THEN
34877
34878 -- 4645092 ------------------------------------------------------------------------------
34879 -- To allow MPA report to determine if it should generate report process
34880 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
34881 ------------------------------------------------------------------------------------------
34882
34883 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
34884 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
34885 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
34886 -- call ADRs
34887 -- Bug 4922099
34888 --
34889 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
34890 (NVL(l_actual_upg_option, 'N') = 'O') OR
34891 (NVL(l_enc_upg_option, 'N') = 'O')
34892 )
34893 THEN
34894 NULL;
34895 --
34896 --
34897
34898 l_ccid := AcctDerRule_176(
34899 p_application_id => p_application_id
34900 , p_ae_header_id => l_ae_header_id
34901 , p_source_5 => p_source_5
34902 , p_source_31 => p_source_31
34903 , x_transaction_coa_id => l_adr_transaction_coa_id
34904 , x_accounting_coa_id => l_adr_accounting_coa_id
34905 , x_value_type_code => l_adr_value_type_code
34906 , p_side => 'NA'
34907 );
34908
34909 xla_ae_lines_pkg.set_ccid(
34910 p_code_combination_id => l_ccid
34911 , p_value_type_code => l_adr_value_type_code
34912 , p_transaction_coa_id => l_adr_transaction_coa_id
34913 , p_accounting_coa_id => l_adr_accounting_coa_id
34914 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
34915 , p_adr_type_code => 'S'
34916 , p_component_type => l_component_type
34917 , p_component_code => l_component_code
34921 , p_side => 'NA'
34918 , p_component_type_code => l_component_type_code
34919 , p_component_appl_id => l_component_appl_id
34920 , p_amb_context_code => l_amb_context_code
34922 );
34923
34924
34925 --
34926 --
34927 END IF;
34928
34929 --
34930 -- Update the line information that should be overwritten
34931 --
34932 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
34933 p_header_num => 1);
34934 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
34935
34936 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
34937
34938 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
34939 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
34940 END IF;
34941
34942 --
34943 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
34944 --
34945 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
34946 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
34947 ELSE
34948 ---------------------------------------------------------------------------------------------------
34949 -- 4262811a Switch Sign
34950 ---------------------------------------------------------------------------------------------------
34951 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
34952 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
34953 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
34954 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
34955 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
34956 -- 5132302
34957 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
34958 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
34959
34960 END IF;
34961
34962 -- 4955764
34963 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
34964 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
34965
34966
34967 XLA_AE_LINES_PKG.ValidateCurrentLine;
34968 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
34969
34970 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
34971 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
34972 ,p_balance_type_code => l_balance_type_code);
34973
34974 END IF;
34975
34976 -----------------------------------------------------------------------------------------
34977 -- 4262811 Multiperiod Accounting
34978 -----------------------------------------------------------------------------------------
34979 -- No MPA option is assigned.
34980
34981
34982 END IF;
34983 END IF;
34984 --
34985
34986 --
34987 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
34988 trace
34989 (p_msg => 'END of AcctLineType_213'
34990 ,p_level => C_LEVEL_PROCEDURE
34991 ,p_module => l_log_module);
34992 END IF;
34993 --
34994 EXCEPTION
34995 WHEN xla_exceptions_pkg.application_exception THEN
34996 RAISE;
34997 WHEN OTHERS THEN
34998 xla_exceptions_pkg.raise_message
34999 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_213');
35000 END AcctLineType_213;
35001 --
35002
35003 ---------------------------------------
35004 --
35005 -- PRIVATE FUNCTION
35006 -- AcctLineType_214
35007 --
35008 ---------------------------------------
35009 PROCEDURE AcctLineType_214 (
35010 p_application_id IN NUMBER
35011 ,p_event_id IN NUMBER
35012 ,p_calculate_acctd_flag IN VARCHAR2
35013 ,p_calculate_g_l_flag IN VARCHAR2
35014 ,p_actual_flag IN OUT VARCHAR2
35015 ,p_balance_type_code OUT VARCHAR2
35016 ,p_gain_or_loss_ref OUT VARCHAR2
35017
35018 --Period Close Date
35019 , p_source_1 IN DATE
35020 --Bonus Depreciation Expense Account
35021 , p_source_4 IN VARCHAR2
35022 --Generated Code Combination Identifier
35023 , p_source_5 IN NUMBER
35024 --Expense Account Code Combination Identifier
35025 , p_source_31 IN NUMBER
35026 --Adjustment Type
35027 , p_source_48 IN VARCHAR2
35028 --Transaction Header Identifier
35029 , p_source_49 IN NUMBER
35030 --Adjustment Line Identifier
35031 , p_source_50 IN NUMBER
35032 --Distribution Type Code
35033 , p_source_51 IN VARCHAR2
35034 --Entered Amount
35035 , p_source_52 IN NUMBER
35036 --Currency Code
35037 , p_source_53 IN VARCHAR2
35038 )
35039 IS
35040
35041 l_component_type VARCHAR2(80);
35042 l_component_code VARCHAR2(30);
35046 l_entity_code VARCHAR2(30);
35043 l_component_type_code VARCHAR2(1);
35044 l_component_appl_id INTEGER;
35045 l_amb_context_code VARCHAR2(30);
35047 l_event_class_code VARCHAR2(30);
35048 l_ae_header_id NUMBER;
35049 l_event_type_code VARCHAR2(30);
35050 l_line_definition_code VARCHAR2(30);
35051 l_line_definition_owner_code VARCHAR2(1);
35052 --
35053 -- adr variables
35054 l_segment VARCHAR2(30);
35055 l_ccid NUMBER;
35056 l_adr_transaction_coa_id NUMBER;
35057 l_adr_accounting_coa_id NUMBER;
35058 l_adr_flexfield_segment_code VARCHAR2(30);
35059 l_adr_flex_value_set_id NUMBER;
35060 l_adr_value_type_code VARCHAR2(30);
35061 l_adr_value_combination_id NUMBER;
35062 l_adr_value_segment_code VARCHAR2(30);
35063
35064 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
35065 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
35066 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
35067 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
35068
35069 -- 4262811 Variables ------------------------------------------------------------------------------------------
35070 l_entered_amt_idx NUMBER;
35071 l_accted_amt_idx NUMBER;
35072 l_acc_rev_flag VARCHAR2(1);
35073 l_accrual_line_num NUMBER;
35074 l_tmp_amt NUMBER;
35075 l_acc_rev_natural_side_code VARCHAR2(1);
35076
35077 l_num_entries NUMBER;
35078 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
35079 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
35080 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
35081 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
35082 l_recog_line_1 NUMBER;
35083 l_recog_line_2 NUMBER;
35084
35085 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
35086 l_bflow_applied_to_amt NUMBER; -- 5132302
35087 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
35088
35089 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
35090
35091 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
35092 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
35093
35094 ---------------------------------------------------------------------------------------------------------------
35095
35096
35097 --
35098 -- bulk performance
35099 --
35100 l_balance_type_code VARCHAR2(1);
35101 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
35102 l_log_module VARCHAR2(240);
35103
35104 --
35105 -- Upgrade strategy
35106 --
35107 l_actual_upg_option VARCHAR2(1);
35108 l_enc_upg_option VARCHAR2(1);
35109
35110 --
35111 BEGIN
35112 --
35113 IF g_log_enabled THEN
35114 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_214';
35115 END IF;
35116 --
35117 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
35118
35119 trace
35120 (p_msg => 'BEGIN of AcctLineType_214'
35121 ,p_level => C_LEVEL_PROCEDURE
35122 ,p_module => l_log_module);
35123
35124 END IF;
35125 --
35126 l_component_type := 'AMB_JLT';
35127 l_component_code := 'FA_CAP_BONUS_EXP';
35128 l_component_type_code := 'S';
35129 l_component_appl_id := 140;
35130 l_amb_context_code := 'DEFAULT';
35131 l_entity_code := 'TRANSACTIONS';
35132 l_event_class_code := 'CAPITALIZATION';
35133 l_event_type_code := 'CAPITALIZATION';
35134 l_line_definition_owner_code := 'S';
35135 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CAPITA3';
35136 --
35137 l_balance_type_code := 'A';
35138 l_segment := NULL;
35139 l_ccid := NULL;
35140 l_adr_transaction_coa_id := NULL;
35141 l_adr_accounting_coa_id := NULL;
35142 l_adr_flexfield_segment_code := NULL;
35143 l_adr_flex_value_set_id := NULL;
35144 l_adr_value_type_code := NULL;
35145 l_adr_value_combination_id := NULL;
35146 l_adr_value_segment_code := NULL;
35147
35148 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
35149 l_bflow_class_code := ''; -- 4219869 Business Flow
35150 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
35151 l_budgetary_control_flag := 'N';
35152
35153 l_bflow_applied_to_amt_idx := NULL; -- 5132302
35154 l_bflow_applied_to_amt := NULL; -- 5132302
35155 l_entered_amt_idx := NULL; -- 4262811
35156 l_accted_amt_idx := NULL; -- 4262811
35157 l_acc_rev_flag := NULL; -- 4262811
35158 l_accrual_line_num := NULL; -- 4262811
35159 l_tmp_amt := NULL; -- 4262811
35160 --
35161
35162 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
35163 l_balance_type_code <> 'B' THEN
35164 IF NVL(p_source_48,'
35165 ') = 'BONUS EXPENSE'
35166 THEN
35167
35168 --
35172 -- set the flag so later we will know whether the gain loss line needs to be created
35169 XLA_AE_LINES_PKG.SetNewLine;
35170
35171 p_balance_type_code := l_balance_type_code;
35173
35174 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
35175 p_actual_flag :='A';
35176 END IF;
35177
35178 --
35179 -- bulk performance
35180 --
35181 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
35182 p_header_num => 0); -- 4262811
35183 --
35184 -- set accounting line options
35185 --
35186 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
35187 p_natural_side_code => 'D'
35188 , p_gain_or_loss_flag => 'N'
35189 , p_gl_transfer_mode_code => 'S'
35190 , p_acct_entry_type_code => 'A'
35191 , p_switch_side_flag => 'Y'
35192 , p_merge_duplicate_code => 'N'
35193 );
35194 --
35195 l_acc_rev_natural_side_code := 'C'; -- 4262811
35196 --
35197 --
35198 -- set accounting line type info
35199 --
35200 xla_ae_lines_pkg.SetAcctLineType
35201 (p_component_type => l_component_type
35202 ,p_event_type_code => l_event_type_code
35203 ,p_line_definition_owner_code => l_line_definition_owner_code
35204 ,p_line_definition_code => l_line_definition_code
35205 ,p_accounting_line_code => l_component_code
35206 ,p_accounting_line_type_code => l_component_type_code
35207 ,p_accounting_line_appl_id => l_component_appl_id
35208 ,p_amb_context_code => l_amb_context_code
35209 ,p_entity_code => l_entity_code
35210 ,p_event_class_code => l_event_class_code);
35211 --
35212 -- set accounting class
35213 --
35214 xla_ae_lines_pkg.SetAcctClass(
35215 p_accounting_class_code => 'EXPENSE'
35216 , p_ae_header_id => l_ae_header_id
35217 );
35218
35219 --
35220 -- set rounding class
35221 --
35222 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
35223 'EXPENSE';
35224
35225 --
35226 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
35227 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
35228 --
35229 -- bulk performance
35230 --
35231 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
35232
35233 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
35234 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
35235
35236 -- 4955764
35237 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
35238 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
35239
35240 -- 4458381 Public Sector Enh
35241
35242 --
35243 -- set accounting attributes for the line type
35244 --
35245 l_entered_amt_idx := 4;
35246 l_accted_amt_idx := 6;
35247 l_bflow_applied_to_amt_idx := NULL; -- 5132302
35248 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
35249 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
35250 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
35251 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
35252 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
35253 l_rec_acct_attrs.array_char_value(3) := p_source_51;
35254 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
35255 l_rec_acct_attrs.array_num_value(4) := p_source_52;
35256 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
35257 l_rec_acct_attrs.array_char_value(5) := p_source_53;
35258 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
35259 l_rec_acct_attrs.array_num_value(6) := p_source_52;
35260
35261 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
35262 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
35263
35264 ---------------------------------------------------------------------------------------------------------------
35265 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
35266 ---------------------------------------------------------------------------------------------------------------
35267 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
35268
35269 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
35270 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
35271
35272 IF xla_accounting_cache_pkg.GetValueChar
35273 (p_source_code => 'LEDGER_CATEGORY_CODE'
35274 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
35275 AND l_bflow_method_code = 'PRIOR_ENTRY'
35276 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
35277 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
35278 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
35282 (p_business_method_code => l_bflow_method_code
35279 )
35280 THEN
35281 xla_ae_lines_pkg.BflowUpgEntry
35283 ,p_business_class_code => l_bflow_class_code
35284 ,p_balance_type => l_balance_type_code);
35285 ELSE
35286 NULL;
35287 -- No business flow processing for business flow method of NONE.
35288 END IF;
35289
35290 --
35291 -- call analytical criteria
35292 --
35293
35294 --
35295 -- call description
35296 --
35297
35298 xla_ae_lines_pkg.SetLineDescription(
35299 p_ae_header_id => l_ae_header_id
35300 ,p_description => Description_17 (
35301 p_application_id => p_application_id
35302 , p_ae_header_id => l_ae_header_id
35303 , p_source_1 => p_source_1
35304 )
35305 );
35306
35307
35308 --
35309 -- call ADRs
35310 -- Bug 4922099
35311 --
35312 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
35313 (NVL(l_actual_upg_option, 'N') = 'O') OR
35314 (NVL(l_enc_upg_option, 'N') = 'O')
35315 )
35316 THEN
35317 NULL;
35318 --
35319 --
35320
35321 l_ccid := AcctDerRule_176(
35322 p_application_id => p_application_id
35323 , p_ae_header_id => l_ae_header_id
35324 , p_source_5 => p_source_5
35325 , p_source_31 => p_source_31
35326 , x_transaction_coa_id => l_adr_transaction_coa_id
35327 , x_accounting_coa_id => l_adr_accounting_coa_id
35328 , x_value_type_code => l_adr_value_type_code
35329 , p_side => 'NA'
35330 );
35331
35332 xla_ae_lines_pkg.set_ccid(
35333 p_code_combination_id => l_ccid
35334 , p_value_type_code => l_adr_value_type_code
35335 , p_transaction_coa_id => l_adr_transaction_coa_id
35336 , p_accounting_coa_id => l_adr_accounting_coa_id
35337 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
35338 , p_adr_type_code => 'S'
35339 , p_component_type => l_component_type
35340 , p_component_code => l_component_code
35341 , p_component_type_code => l_component_type_code
35342 , p_component_appl_id => l_component_appl_id
35343 , p_amb_context_code => l_amb_context_code
35344 , p_side => 'NA'
35345 );
35346
35347
35348 l_segment := AcctDerRule_144(
35349 p_application_id => p_application_id
35350 , p_ae_header_id => l_ae_header_id
35351 , p_source_4 => p_source_4
35352 , p_source_5 => p_source_5
35353 , x_transaction_coa_id => l_adr_transaction_coa_id
35354 , x_accounting_coa_id => l_adr_accounting_coa_id
35355 , x_flexfield_segment_code => l_adr_flexfield_segment_code
35356 , x_flex_value_set_id => l_adr_flex_value_set_id
35357 , x_value_type_code => l_adr_value_type_code
35358 , x_value_combination_id => l_adr_value_combination_id
35359 , x_value_segment_code => l_adr_value_segment_code
35360 , p_side => 'NA'
35361 , p_override_seg_flag => 'Y'
35362 );
35363
35364 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
35365
35366 xla_ae_lines_pkg.set_segment(
35367 p_to_segment_code => 'GL_ACCOUNT'
35368 , p_segment_value => l_segment
35369 , p_from_segment_code => l_adr_value_segment_code
35370 , p_from_combination_id => l_adr_value_combination_id
35371 , p_value_type_code => l_adr_value_type_code
35372 , p_transaction_coa_id => l_adr_transaction_coa_id
35373 , p_accounting_coa_id => l_adr_accounting_coa_id
35374 , p_flexfield_segment_code => l_adr_flexfield_segment_code
35375 , p_flex_value_set_id => l_adr_flex_value_set_id
35376 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
35377 , p_adr_type_code => 'S'
35378 , p_component_type => l_component_type
35379 , p_component_code => l_component_code
35380 , p_component_type_code => l_component_type_code
35381 , p_component_appl_id => l_component_appl_id
35382 , p_amb_context_code => l_amb_context_code
35383 , p_entity_code => 'TRANSACTIONS'
35384 , p_event_class_code => 'CAPITALIZATION'
35385 , p_side => 'NA'
35386 );
35387
35388 END IF;
35389
35390 --
35391 --
35392 END IF;
35393 --
35394 -- Bug 4922099
35395 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
35396 (NVL(l_enc_upg_option, 'N') = 'O')
35397 ) AND
35398 (l_bflow_method_code = 'PRIOR_ENTRY')
35399 )
35400 THEN
35401 IF
35402 --
35403 1 = 2
35404 --
35405 THEN
35406 xla_accounting_err_pkg.build_message
35407 (p_appli_s_name => 'XLA'
35408 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
35409 ,p_token_1 => 'LINE_NUMBER'
35413 l_component_type
35410 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
35411 ,p_token_2 => 'LINE_TYPE_NAME'
35412 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
35414 ,l_component_code
35415 ,l_component_type_code
35416 ,l_component_appl_id
35417 ,l_amb_context_code
35418 ,l_entity_code
35419 ,l_event_class_code
35420 )
35421 ,p_token_3 => 'OWNER'
35422 ,p_value_3 => xla_lookups_pkg.get_meaning(
35423 p_lookup_type => 'XLA_OWNER_TYPE'
35424 ,p_lookup_code => l_component_type_code
35425 )
35426 ,p_token_4 => 'PRODUCT_NAME'
35427 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
35428 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
35429 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
35430 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
35431 ,p_ae_header_id => NULL
35432 );
35433
35434 IF (C_LEVEL_ERROR>= g_log_level) THEN
35435 trace
35436 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
35437 ,p_level => C_LEVEL_ERROR
35438 ,p_module => l_log_module);
35439 END IF;
35440 END IF;
35441 END IF;
35442 --
35443 --
35444 ------------------------------------------------------------------------------------------------
35445 -- 4219869 Business Flow
35446 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
35447 -- Prior Entry. Currently, the following code is always generated.
35448 ------------------------------------------------------------------------------------------------
35449 XLA_AE_LINES_PKG.ValidateCurrentLine;
35450
35451 ------------------------------------------------------------------------------------
35452 -- 4219869 Business Flow
35453 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
35454 ------------------------------------------------------------------------------------
35455 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
35456
35457 ----------------------------------------------------------------------------------
35458 -- 4219869 Business Flow
35459 -- Update journal entry status -- Need to generate this within IF <condition>
35460 ----------------------------------------------------------------------------------
35461 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
35462 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
35463 ,p_balance_type_code => l_balance_type_code
35464 );
35465
35466 -------------------------------------------------------------------------------------------
35467 -- 4262811 - Generate the Accrual Reversal lines
35468 -------------------------------------------------------------------------------------------
35469 BEGIN
35470 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
35471 (g_array_event(p_event_id).array_value_num('header_index'));
35472 IF l_acc_rev_flag IS NULL THEN
35473 l_acc_rev_flag := 'N';
35474 END IF;
35475 EXCEPTION
35476 WHEN OTHERS THEN
35477 l_acc_rev_flag := 'N';
35478 END;
35479 --
35480 IF (l_acc_rev_flag = 'Y') THEN
35481
35482 -- 4645092 ------------------------------------------------------------------------------
35483 -- To allow MPA report to determine if it should generate report process
35484 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
35485 ------------------------------------------------------------------------------------------
35486
35487 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
35488 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
35489 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
35490 -- call ADRs
35491 -- Bug 4922099
35492 --
35493 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
35494 (NVL(l_actual_upg_option, 'N') = 'O') OR
35495 (NVL(l_enc_upg_option, 'N') = 'O')
35496 )
35497 THEN
35498 NULL;
35499 --
35500 --
35501
35502 l_ccid := AcctDerRule_176(
35506 , p_source_31 => p_source_31
35503 p_application_id => p_application_id
35504 , p_ae_header_id => l_ae_header_id
35505 , p_source_5 => p_source_5
35507 , x_transaction_coa_id => l_adr_transaction_coa_id
35508 , x_accounting_coa_id => l_adr_accounting_coa_id
35509 , x_value_type_code => l_adr_value_type_code
35510 , p_side => 'NA'
35511 );
35512
35513 xla_ae_lines_pkg.set_ccid(
35514 p_code_combination_id => l_ccid
35515 , p_value_type_code => l_adr_value_type_code
35516 , p_transaction_coa_id => l_adr_transaction_coa_id
35517 , p_accounting_coa_id => l_adr_accounting_coa_id
35518 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
35519 , p_adr_type_code => 'S'
35520 , p_component_type => l_component_type
35521 , p_component_code => l_component_code
35522 , p_component_type_code => l_component_type_code
35523 , p_component_appl_id => l_component_appl_id
35524 , p_amb_context_code => l_amb_context_code
35525 , p_side => 'NA'
35526 );
35527
35528
35529 l_segment := AcctDerRule_144(
35530 p_application_id => p_application_id
35531 , p_ae_header_id => l_ae_header_id
35532 , p_source_4 => p_source_4
35533 , p_source_5 => p_source_5
35534 , x_transaction_coa_id => l_adr_transaction_coa_id
35535 , x_accounting_coa_id => l_adr_accounting_coa_id
35536 , x_flexfield_segment_code => l_adr_flexfield_segment_code
35537 , x_flex_value_set_id => l_adr_flex_value_set_id
35538 , x_value_type_code => l_adr_value_type_code
35539 , x_value_combination_id => l_adr_value_combination_id
35540 , x_value_segment_code => l_adr_value_segment_code
35541 , p_side => 'NA'
35542 , p_override_seg_flag => 'Y'
35543 );
35544
35545 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
35546
35547 xla_ae_lines_pkg.set_segment(
35548 p_to_segment_code => 'GL_ACCOUNT'
35549 , p_segment_value => l_segment
35550 , p_from_segment_code => l_adr_value_segment_code
35551 , p_from_combination_id => l_adr_value_combination_id
35552 , p_value_type_code => l_adr_value_type_code
35553 , p_transaction_coa_id => l_adr_transaction_coa_id
35554 , p_accounting_coa_id => l_adr_accounting_coa_id
35555 , p_flexfield_segment_code => l_adr_flexfield_segment_code
35556 , p_flex_value_set_id => l_adr_flex_value_set_id
35557 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
35558 , p_adr_type_code => 'S'
35559 , p_component_type => l_component_type
35560 , p_component_code => l_component_code
35561 , p_component_type_code => l_component_type_code
35562 , p_component_appl_id => l_component_appl_id
35563 , p_amb_context_code => l_amb_context_code
35564 , p_entity_code => 'TRANSACTIONS'
35565 , p_event_class_code => 'CAPITALIZATION'
35566 , p_side => 'NA'
35567 );
35568
35569 END IF;
35570
35571 --
35572 --
35573 END IF;
35574
35575 --
35576 -- Update the line information that should be overwritten
35577 --
35578 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
35579 p_header_num => 1);
35580 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
35581
35582 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
35583
35584 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
35585 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
35586 END IF;
35587
35588 --
35589 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
35590 --
35591 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
35592 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
35593 ELSE
35594 ---------------------------------------------------------------------------------------------------
35595 -- 4262811a Switch Sign
35596 ---------------------------------------------------------------------------------------------------
35597 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
35598 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
35599 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
35600 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
35601 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
35602 -- 5132302
35603 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
35604 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
35605
35606 END IF;
35607
35608 -- 4955764
35612
35609 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
35610 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
35611
35613 XLA_AE_LINES_PKG.ValidateCurrentLine;
35614 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
35615
35616 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
35617 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
35618 ,p_balance_type_code => l_balance_type_code);
35619
35620 END IF;
35621
35622 -----------------------------------------------------------------------------------------
35623 -- 4262811 Multiperiod Accounting
35624 -----------------------------------------------------------------------------------------
35625 -- No MPA option is assigned.
35626
35627
35628 END IF;
35629 END IF;
35630 --
35631
35632 --
35633 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
35634 trace
35635 (p_msg => 'END of AcctLineType_214'
35636 ,p_level => C_LEVEL_PROCEDURE
35637 ,p_module => l_log_module);
35638 END IF;
35639 --
35640 EXCEPTION
35641 WHEN xla_exceptions_pkg.application_exception THEN
35642 RAISE;
35643 WHEN OTHERS THEN
35644 xla_exceptions_pkg.raise_message
35645 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_214');
35646 END AcctLineType_214;
35647 --
35648
35649 ---------------------------------------
35650 --
35651 -- PRIVATE FUNCTION
35652 -- AcctLineType_215
35653 --
35654 ---------------------------------------
35655 PROCEDURE AcctLineType_215 (
35656 p_application_id IN NUMBER
35657 ,p_event_id IN NUMBER
35658 ,p_calculate_acctd_flag IN VARCHAR2
35659 ,p_calculate_g_l_flag IN VARCHAR2
35660 ,p_actual_flag IN OUT VARCHAR2
35661 ,p_balance_type_code OUT VARCHAR2
35662 ,p_gain_or_loss_ref OUT VARCHAR2
35663
35664 --Period Close Date
35665 , p_source_1 IN DATE
35666 --Generated Code Combination Identifier
35667 , p_source_5 IN NUMBER
35668 --Bonus Reserve Account
35669 , p_source_6 IN VARCHAR2
35670 --Generated Offset Code Combination Identifier
35671 , p_source_19 IN NUMBER
35672 --Expense Account Code Combination Identifier
35673 , p_source_31 IN NUMBER
35674 --Default Code Combination Identifier
35675 , p_source_32 IN NUMBER
35676 --Adjustment Type
35677 , p_source_48 IN VARCHAR2
35678 --Transaction Header Identifier
35679 , p_source_49 IN NUMBER
35680 --Adjustment Line Identifier
35681 , p_source_50 IN NUMBER
35682 --Distribution Type Code
35683 , p_source_51 IN VARCHAR2
35684 --Entered Amount
35685 , p_source_52 IN NUMBER
35686 --Currency Code
35687 , p_source_53 IN VARCHAR2
35688 )
35689 IS
35690
35691 l_component_type VARCHAR2(80);
35692 l_component_code VARCHAR2(30);
35693 l_component_type_code VARCHAR2(1);
35694 l_component_appl_id INTEGER;
35695 l_amb_context_code VARCHAR2(30);
35696 l_entity_code VARCHAR2(30);
35697 l_event_class_code VARCHAR2(30);
35698 l_ae_header_id NUMBER;
35699 l_event_type_code VARCHAR2(30);
35700 l_line_definition_code VARCHAR2(30);
35701 l_line_definition_owner_code VARCHAR2(1);
35702 --
35703 -- adr variables
35704 l_segment VARCHAR2(30);
35705 l_ccid NUMBER;
35706 l_adr_transaction_coa_id NUMBER;
35707 l_adr_accounting_coa_id NUMBER;
35708 l_adr_flexfield_segment_code VARCHAR2(30);
35709 l_adr_flex_value_set_id NUMBER;
35710 l_adr_value_type_code VARCHAR2(30);
35711 l_adr_value_combination_id NUMBER;
35712 l_adr_value_segment_code VARCHAR2(30);
35713
35714 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
35715 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
35716 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
35717 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
35718
35719 -- 4262811 Variables ------------------------------------------------------------------------------------------
35720 l_entered_amt_idx NUMBER;
35721 l_accted_amt_idx NUMBER;
35722 l_acc_rev_flag VARCHAR2(1);
35723 l_accrual_line_num NUMBER;
35724 l_tmp_amt NUMBER;
35725 l_acc_rev_natural_side_code VARCHAR2(1);
35726
35727 l_num_entries NUMBER;
35728 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
35729 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
35730 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
35731 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
35732 l_recog_line_1 NUMBER;
35733 l_recog_line_2 NUMBER;
35734
35735 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
35736 l_bflow_applied_to_amt NUMBER; -- 5132302
35737 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
35738
35742 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
35739 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
35740
35741 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
35743
35744 ---------------------------------------------------------------------------------------------------------------
35745
35746
35747 --
35748 -- bulk performance
35749 --
35750 l_balance_type_code VARCHAR2(1);
35751 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
35752 l_log_module VARCHAR2(240);
35753
35754 --
35755 -- Upgrade strategy
35756 --
35757 l_actual_upg_option VARCHAR2(1);
35758 l_enc_upg_option VARCHAR2(1);
35759
35760 --
35761 BEGIN
35762 --
35763 IF g_log_enabled THEN
35764 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_215';
35765 END IF;
35766 --
35767 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
35768
35769 trace
35770 (p_msg => 'BEGIN of AcctLineType_215'
35771 ,p_level => C_LEVEL_PROCEDURE
35772 ,p_module => l_log_module);
35773
35774 END IF;
35775 --
35776 l_component_type := 'AMB_JLT';
35777 l_component_code := 'FA_CAP_BONUS_RESERVE';
35778 l_component_type_code := 'S';
35779 l_component_appl_id := 140;
35780 l_amb_context_code := 'DEFAULT';
35781 l_entity_code := 'TRANSACTIONS';
35782 l_event_class_code := 'CAPITALIZATION';
35783 l_event_type_code := 'CAPITALIZATION';
35784 l_line_definition_owner_code := 'S';
35785 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CAPITA3';
35786 --
35787 l_balance_type_code := 'A';
35788 l_segment := NULL;
35789 l_ccid := NULL;
35790 l_adr_transaction_coa_id := NULL;
35791 l_adr_accounting_coa_id := NULL;
35792 l_adr_flexfield_segment_code := NULL;
35793 l_adr_flex_value_set_id := NULL;
35794 l_adr_value_type_code := NULL;
35795 l_adr_value_combination_id := NULL;
35796 l_adr_value_segment_code := NULL;
35797
35798 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
35799 l_bflow_class_code := ''; -- 4219869 Business Flow
35800 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
35801 l_budgetary_control_flag := 'N';
35802
35803 l_bflow_applied_to_amt_idx := NULL; -- 5132302
35804 l_bflow_applied_to_amt := NULL; -- 5132302
35805 l_entered_amt_idx := NULL; -- 4262811
35806 l_accted_amt_idx := NULL; -- 4262811
35807 l_acc_rev_flag := NULL; -- 4262811
35808 l_accrual_line_num := NULL; -- 4262811
35809 l_tmp_amt := NULL; -- 4262811
35810 --
35811
35812 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
35813 l_balance_type_code <> 'B' THEN
35814 IF NVL(p_source_48,'
35815 ') = 'BONUS EXPENSE'
35816 THEN
35817
35818 --
35819 XLA_AE_LINES_PKG.SetNewLine;
35820
35821 p_balance_type_code := l_balance_type_code;
35822 -- set the flag so later we will know whether the gain loss line needs to be created
35823
35824 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
35825 p_actual_flag :='A';
35826 END IF;
35827
35828 --
35829 -- bulk performance
35830 --
35831 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
35832 p_header_num => 0); -- 4262811
35833 --
35834 -- set accounting line options
35835 --
35836 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
35837 p_natural_side_code => 'C'
35838 , p_gain_or_loss_flag => 'N'
35839 , p_gl_transfer_mode_code => 'S'
35840 , p_acct_entry_type_code => 'A'
35841 , p_switch_side_flag => 'Y'
35842 , p_merge_duplicate_code => 'N'
35843 );
35844 --
35845 l_acc_rev_natural_side_code := 'D'; -- 4262811
35846 --
35847 --
35848 -- set accounting line type info
35849 --
35850 xla_ae_lines_pkg.SetAcctLineType
35851 (p_component_type => l_component_type
35852 ,p_event_type_code => l_event_type_code
35853 ,p_line_definition_owner_code => l_line_definition_owner_code
35854 ,p_line_definition_code => l_line_definition_code
35855 ,p_accounting_line_code => l_component_code
35856 ,p_accounting_line_type_code => l_component_type_code
35857 ,p_accounting_line_appl_id => l_component_appl_id
35858 ,p_amb_context_code => l_amb_context_code
35859 ,p_entity_code => l_entity_code
35860 ,p_event_class_code => l_event_class_code);
35861 --
35862 -- set accounting class
35863 --
35864 xla_ae_lines_pkg.SetAcctClass(
35865 p_accounting_class_code => 'ASSET'
35866 , p_ae_header_id => l_ae_header_id
35867 );
35868
35869 --
35870 -- set rounding class
35871 --
35875 --
35872 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
35873 'ASSET';
35874
35876 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
35877 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
35878 --
35879 -- bulk performance
35880 --
35881 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
35882
35883 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
35884 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
35885
35886 -- 4955764
35887 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
35888 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
35889
35890 -- 4458381 Public Sector Enh
35891
35892 --
35893 -- set accounting attributes for the line type
35894 --
35895 l_entered_amt_idx := 4;
35896 l_accted_amt_idx := 6;
35897 l_bflow_applied_to_amt_idx := NULL; -- 5132302
35898 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
35899 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
35900 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
35901 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
35902 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
35903 l_rec_acct_attrs.array_char_value(3) := p_source_51;
35904 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
35905 l_rec_acct_attrs.array_num_value(4) := p_source_52;
35906 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
35907 l_rec_acct_attrs.array_char_value(5) := p_source_53;
35908 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
35909 l_rec_acct_attrs.array_num_value(6) := p_source_52;
35910
35911 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
35912 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
35913
35914 ---------------------------------------------------------------------------------------------------------------
35915 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
35916 ---------------------------------------------------------------------------------------------------------------
35917 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
35918
35919 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
35920 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
35921
35922 IF xla_accounting_cache_pkg.GetValueChar
35923 (p_source_code => 'LEDGER_CATEGORY_CODE'
35924 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
35925 AND l_bflow_method_code = 'PRIOR_ENTRY'
35926 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
35927 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
35928 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
35929 )
35930 THEN
35931 xla_ae_lines_pkg.BflowUpgEntry
35932 (p_business_method_code => l_bflow_method_code
35933 ,p_business_class_code => l_bflow_class_code
35934 ,p_balance_type => l_balance_type_code);
35935 ELSE
35936 NULL;
35937 -- No business flow processing for business flow method of NONE.
35938 END IF;
35939
35940 --
35941 -- call analytical criteria
35942 --
35943
35944 --
35945 -- call description
35946 --
35947
35948 xla_ae_lines_pkg.SetLineDescription(
35949 p_ae_header_id => l_ae_header_id
35950 ,p_description => Description_18 (
35951 p_application_id => p_application_id
35952 , p_ae_header_id => l_ae_header_id
35953 , p_source_1 => p_source_1
35954 )
35955 );
35956
35957
35958 --
35959 -- call ADRs
35960 -- Bug 4922099
35961 --
35962 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
35963 (NVL(l_actual_upg_option, 'N') = 'O') OR
35964 (NVL(l_enc_upg_option, 'N') = 'O')
35965 )
35966 THEN
35967 NULL;
35968 --
35969 --
35970
35971 l_ccid := AcctDerRule_175(
35972 p_application_id => p_application_id
35973 , p_ae_header_id => l_ae_header_id
35974 , p_source_5 => p_source_5
35975 , p_source_19 => p_source_19
35976 , p_source_32 => p_source_32
35977 , x_transaction_coa_id => l_adr_transaction_coa_id
35978 , x_accounting_coa_id => l_adr_accounting_coa_id
35979 , x_value_type_code => l_adr_value_type_code
35980 , p_side => 'NA'
35981 );
35982
35983 xla_ae_lines_pkg.set_ccid(
35984 p_code_combination_id => l_ccid
35985 , p_value_type_code => l_adr_value_type_code
35986 , p_transaction_coa_id => l_adr_transaction_coa_id
35990 , p_component_type => l_component_type
35987 , p_accounting_coa_id => l_adr_accounting_coa_id
35988 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
35989 , p_adr_type_code => 'S'
35991 , p_component_code => l_component_code
35992 , p_component_type_code => l_component_type_code
35993 , p_component_appl_id => l_component_appl_id
35994 , p_amb_context_code => l_amb_context_code
35995 , p_side => 'NA'
35996 );
35997
35998
35999 l_segment := AcctDerRule_145(
36000 p_application_id => p_application_id
36001 , p_ae_header_id => l_ae_header_id
36002 , p_source_5 => p_source_5
36003 , p_source_6 => p_source_6
36004 , x_transaction_coa_id => l_adr_transaction_coa_id
36005 , x_accounting_coa_id => l_adr_accounting_coa_id
36006 , x_flexfield_segment_code => l_adr_flexfield_segment_code
36007 , x_flex_value_set_id => l_adr_flex_value_set_id
36008 , x_value_type_code => l_adr_value_type_code
36009 , x_value_combination_id => l_adr_value_combination_id
36010 , x_value_segment_code => l_adr_value_segment_code
36011 , p_side => 'NA'
36012 , p_override_seg_flag => 'Y'
36013 );
36014
36015 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
36016
36017 xla_ae_lines_pkg.set_segment(
36018 p_to_segment_code => 'GL_ACCOUNT'
36019 , p_segment_value => l_segment
36020 , p_from_segment_code => l_adr_value_segment_code
36021 , p_from_combination_id => l_adr_value_combination_id
36022 , p_value_type_code => l_adr_value_type_code
36023 , p_transaction_coa_id => l_adr_transaction_coa_id
36024 , p_accounting_coa_id => l_adr_accounting_coa_id
36025 , p_flexfield_segment_code => l_adr_flexfield_segment_code
36026 , p_flex_value_set_id => l_adr_flex_value_set_id
36027 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
36028 , p_adr_type_code => 'S'
36029 , p_component_type => l_component_type
36030 , p_component_code => l_component_code
36031 , p_component_type_code => l_component_type_code
36032 , p_component_appl_id => l_component_appl_id
36033 , p_amb_context_code => l_amb_context_code
36034 , p_entity_code => 'TRANSACTIONS'
36035 , p_event_class_code => 'CAPITALIZATION'
36036 , p_side => 'NA'
36037 );
36038
36039 END IF;
36040
36041 l_segment := AcctDerRule_169(
36042 p_application_id => p_application_id
36043 , p_ae_header_id => l_ae_header_id
36044 , p_source_5 => p_source_5
36045 , p_source_31 => p_source_31
36046 , x_transaction_coa_id => l_adr_transaction_coa_id
36047 , x_accounting_coa_id => l_adr_accounting_coa_id
36048 , x_flexfield_segment_code => l_adr_flexfield_segment_code
36049 , x_flex_value_set_id => l_adr_flex_value_set_id
36050 , x_value_type_code => l_adr_value_type_code
36051 , x_value_combination_id => l_adr_value_combination_id
36052 , x_value_segment_code => l_adr_value_segment_code
36053 , p_side => 'NA'
36054 , p_override_seg_flag => 'Y'
36055 );
36056
36057 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
36058
36059 xla_ae_lines_pkg.set_segment(
36060 p_to_segment_code => 'GL_BALANCING'
36061 , p_segment_value => l_segment
36062 , p_from_segment_code => l_adr_value_segment_code
36063 , p_from_combination_id => l_adr_value_combination_id
36064 , p_value_type_code => l_adr_value_type_code
36065 , p_transaction_coa_id => l_adr_transaction_coa_id
36066 , p_accounting_coa_id => l_adr_accounting_coa_id
36067 , p_flexfield_segment_code => l_adr_flexfield_segment_code
36068 , p_flex_value_set_id => l_adr_flex_value_set_id
36069 , p_adr_code => 'FA_EXPENSE_ACCT'
36070 , p_adr_type_code => 'S'
36071 , p_component_type => l_component_type
36072 , p_component_code => l_component_code
36073 , p_component_type_code => l_component_type_code
36074 , p_component_appl_id => l_component_appl_id
36075 , p_amb_context_code => l_amb_context_code
36076 , p_entity_code => 'TRANSACTIONS'
36077 , p_event_class_code => 'CAPITALIZATION'
36078 , p_side => 'NA'
36079 );
36080
36081 END IF;
36082
36083 --
36084 --
36085 END IF;
36086 --
36087 -- Bug 4922099
36088 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
36089 (NVL(l_enc_upg_option, 'N') = 'O')
36090 ) AND
36091 (l_bflow_method_code = 'PRIOR_ENTRY')
36092 )
36093 THEN
36094 IF
36095 --
36096 1 = 2
36097 --
36098 THEN
36099 xla_accounting_err_pkg.build_message
36100 (p_appli_s_name => 'XLA'
36104 ,p_token_2 => 'LINE_TYPE_NAME'
36101 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
36102 ,p_token_1 => 'LINE_NUMBER'
36103 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
36105 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
36106 l_component_type
36107 ,l_component_code
36108 ,l_component_type_code
36109 ,l_component_appl_id
36110 ,l_amb_context_code
36111 ,l_entity_code
36112 ,l_event_class_code
36113 )
36114 ,p_token_3 => 'OWNER'
36115 ,p_value_3 => xla_lookups_pkg.get_meaning(
36116 p_lookup_type => 'XLA_OWNER_TYPE'
36117 ,p_lookup_code => l_component_type_code
36118 )
36119 ,p_token_4 => 'PRODUCT_NAME'
36120 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
36121 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
36122 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
36123 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
36124 ,p_ae_header_id => NULL
36125 );
36126
36127 IF (C_LEVEL_ERROR>= g_log_level) THEN
36128 trace
36129 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
36130 ,p_level => C_LEVEL_ERROR
36131 ,p_module => l_log_module);
36132 END IF;
36133 END IF;
36134 END IF;
36135 --
36136 --
36137 ------------------------------------------------------------------------------------------------
36138 -- 4219869 Business Flow
36139 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
36140 -- Prior Entry. Currently, the following code is always generated.
36141 ------------------------------------------------------------------------------------------------
36142 XLA_AE_LINES_PKG.ValidateCurrentLine;
36143
36144 ------------------------------------------------------------------------------------
36145 -- 4219869 Business Flow
36146 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
36147 ------------------------------------------------------------------------------------
36148 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
36149
36150 ----------------------------------------------------------------------------------
36151 -- 4219869 Business Flow
36152 -- Update journal entry status -- Need to generate this within IF <condition>
36153 ----------------------------------------------------------------------------------
36154 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
36155 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
36156 ,p_balance_type_code => l_balance_type_code
36157 );
36158
36159 -------------------------------------------------------------------------------------------
36160 -- 4262811 - Generate the Accrual Reversal lines
36161 -------------------------------------------------------------------------------------------
36162 BEGIN
36163 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
36164 (g_array_event(p_event_id).array_value_num('header_index'));
36165 IF l_acc_rev_flag IS NULL THEN
36166 l_acc_rev_flag := 'N';
36167 END IF;
36168 EXCEPTION
36169 WHEN OTHERS THEN
36170 l_acc_rev_flag := 'N';
36171 END;
36172 --
36173 IF (l_acc_rev_flag = 'Y') THEN
36174
36175 -- 4645092 ------------------------------------------------------------------------------
36176 -- To allow MPA report to determine if it should generate report process
36177 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
36178 ------------------------------------------------------------------------------------------
36179
36180 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
36181 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
36182 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
36183 -- call ADRs
36184 -- Bug 4922099
36185 --
36186 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
36187 (NVL(l_actual_upg_option, 'N') = 'O') OR
36191 NULL;
36188 (NVL(l_enc_upg_option, 'N') = 'O')
36189 )
36190 THEN
36192 --
36193 --
36194
36195 l_ccid := AcctDerRule_175(
36196 p_application_id => p_application_id
36197 , p_ae_header_id => l_ae_header_id
36198 , p_source_5 => p_source_5
36199 , p_source_19 => p_source_19
36200 , p_source_32 => p_source_32
36201 , x_transaction_coa_id => l_adr_transaction_coa_id
36202 , x_accounting_coa_id => l_adr_accounting_coa_id
36203 , x_value_type_code => l_adr_value_type_code
36204 , p_side => 'NA'
36205 );
36206
36207 xla_ae_lines_pkg.set_ccid(
36208 p_code_combination_id => l_ccid
36209 , p_value_type_code => l_adr_value_type_code
36210 , p_transaction_coa_id => l_adr_transaction_coa_id
36211 , p_accounting_coa_id => l_adr_accounting_coa_id
36212 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
36213 , p_adr_type_code => 'S'
36214 , p_component_type => l_component_type
36215 , p_component_code => l_component_code
36216 , p_component_type_code => l_component_type_code
36217 , p_component_appl_id => l_component_appl_id
36218 , p_amb_context_code => l_amb_context_code
36219 , p_side => 'NA'
36220 );
36221
36222
36223 l_segment := AcctDerRule_145(
36224 p_application_id => p_application_id
36225 , p_ae_header_id => l_ae_header_id
36226 , p_source_5 => p_source_5
36227 , p_source_6 => p_source_6
36228 , x_transaction_coa_id => l_adr_transaction_coa_id
36229 , x_accounting_coa_id => l_adr_accounting_coa_id
36230 , x_flexfield_segment_code => l_adr_flexfield_segment_code
36231 , x_flex_value_set_id => l_adr_flex_value_set_id
36232 , x_value_type_code => l_adr_value_type_code
36233 , x_value_combination_id => l_adr_value_combination_id
36234 , x_value_segment_code => l_adr_value_segment_code
36235 , p_side => 'NA'
36236 , p_override_seg_flag => 'Y'
36237 );
36238
36239 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
36240
36241 xla_ae_lines_pkg.set_segment(
36242 p_to_segment_code => 'GL_ACCOUNT'
36243 , p_segment_value => l_segment
36244 , p_from_segment_code => l_adr_value_segment_code
36245 , p_from_combination_id => l_adr_value_combination_id
36246 , p_value_type_code => l_adr_value_type_code
36247 , p_transaction_coa_id => l_adr_transaction_coa_id
36248 , p_accounting_coa_id => l_adr_accounting_coa_id
36249 , p_flexfield_segment_code => l_adr_flexfield_segment_code
36250 , p_flex_value_set_id => l_adr_flex_value_set_id
36251 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
36252 , p_adr_type_code => 'S'
36253 , p_component_type => l_component_type
36254 , p_component_code => l_component_code
36255 , p_component_type_code => l_component_type_code
36256 , p_component_appl_id => l_component_appl_id
36257 , p_amb_context_code => l_amb_context_code
36258 , p_entity_code => 'TRANSACTIONS'
36259 , p_event_class_code => 'CAPITALIZATION'
36260 , p_side => 'NA'
36261 );
36262
36263 END IF;
36264
36265 l_segment := AcctDerRule_169(
36266 p_application_id => p_application_id
36267 , p_ae_header_id => l_ae_header_id
36268 , p_source_5 => p_source_5
36269 , p_source_31 => p_source_31
36270 , x_transaction_coa_id => l_adr_transaction_coa_id
36271 , x_accounting_coa_id => l_adr_accounting_coa_id
36272 , x_flexfield_segment_code => l_adr_flexfield_segment_code
36273 , x_flex_value_set_id => l_adr_flex_value_set_id
36274 , x_value_type_code => l_adr_value_type_code
36275 , x_value_combination_id => l_adr_value_combination_id
36276 , x_value_segment_code => l_adr_value_segment_code
36277 , p_side => 'NA'
36278 , p_override_seg_flag => 'Y'
36279 );
36280
36281 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
36282
36283 xla_ae_lines_pkg.set_segment(
36284 p_to_segment_code => 'GL_BALANCING'
36285 , p_segment_value => l_segment
36286 , p_from_segment_code => l_adr_value_segment_code
36287 , p_from_combination_id => l_adr_value_combination_id
36288 , p_value_type_code => l_adr_value_type_code
36289 , p_transaction_coa_id => l_adr_transaction_coa_id
36290 , p_accounting_coa_id => l_adr_accounting_coa_id
36291 , p_flexfield_segment_code => l_adr_flexfield_segment_code
36292 , p_flex_value_set_id => l_adr_flex_value_set_id
36293 , p_adr_code => 'FA_EXPENSE_ACCT'
36294 , p_adr_type_code => 'S'
36295 , p_component_type => l_component_type
36296 , p_component_code => l_component_code
36300 , p_entity_code => 'TRANSACTIONS'
36297 , p_component_type_code => l_component_type_code
36298 , p_component_appl_id => l_component_appl_id
36299 , p_amb_context_code => l_amb_context_code
36301 , p_event_class_code => 'CAPITALIZATION'
36302 , p_side => 'NA'
36303 );
36304
36305 END IF;
36306
36307 --
36308 --
36309 END IF;
36310
36311 --
36312 -- Update the line information that should be overwritten
36313 --
36314 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
36315 p_header_num => 1);
36316 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
36317
36318 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
36319
36320 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
36321 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
36322 END IF;
36323
36324 --
36325 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
36326 --
36327 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
36328 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
36329 ELSE
36330 ---------------------------------------------------------------------------------------------------
36331 -- 4262811a Switch Sign
36332 ---------------------------------------------------------------------------------------------------
36333 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
36334 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
36335 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
36336 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
36337 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
36338 -- 5132302
36339 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
36340 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
36341
36342 END IF;
36343
36344 -- 4955764
36345 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
36346 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
36347
36348
36349 XLA_AE_LINES_PKG.ValidateCurrentLine;
36350 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
36351
36352 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
36353 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
36354 ,p_balance_type_code => l_balance_type_code);
36355
36356 END IF;
36357
36358 -----------------------------------------------------------------------------------------
36359 -- 4262811 Multiperiod Accounting
36360 -----------------------------------------------------------------------------------------
36361 -- No MPA option is assigned.
36362
36363
36364 END IF;
36365 END IF;
36366 --
36367
36368 --
36369 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
36370 trace
36371 (p_msg => 'END of AcctLineType_215'
36372 ,p_level => C_LEVEL_PROCEDURE
36373 ,p_module => l_log_module);
36374 END IF;
36375 --
36376 EXCEPTION
36377 WHEN xla_exceptions_pkg.application_exception THEN
36378 RAISE;
36379 WHEN OTHERS THEN
36380 xla_exceptions_pkg.raise_message
36381 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_215');
36382 END AcctLineType_215;
36383 --
36384
36385 ---------------------------------------
36386 --
36387 -- PRIVATE FUNCTION
36388 -- AcctLineType_216
36389 --
36390 ---------------------------------------
36391 PROCEDURE AcctLineType_216 (
36392 p_application_id IN NUMBER
36393 ,p_event_id IN NUMBER
36394 ,p_calculate_acctd_flag IN VARCHAR2
36395 ,p_calculate_g_l_flag IN VARCHAR2
36396 ,p_actual_flag IN OUT VARCHAR2
36397 ,p_balance_type_code OUT VARCHAR2
36398 ,p_gain_or_loss_ref OUT VARCHAR2
36399
36400 --Period Close Date
36401 , p_source_1 IN DATE
36402 --Generated Code Combination Identifier
36403 , p_source_5 IN NUMBER
36404 --Expense Account Code Combination Identifier
36405 , p_source_31 IN NUMBER
36406 --Adjustment Type
36407 , p_source_48 IN VARCHAR2
36408 --Transaction Header Identifier
36409 , p_source_49 IN NUMBER
36410 --Adjustment Line Identifier
36411 , p_source_50 IN NUMBER
36412 --Distribution Type Code
36413 , p_source_51 IN VARCHAR2
36414 --Entered Amount
36415 , p_source_52 IN NUMBER
36416 --Currency Code
36417 , p_source_53 IN VARCHAR2
36418 )
36419 IS
36420
36421 l_component_type VARCHAR2(80);
36425 l_amb_context_code VARCHAR2(30);
36422 l_component_code VARCHAR2(30);
36423 l_component_type_code VARCHAR2(1);
36424 l_component_appl_id INTEGER;
36426 l_entity_code VARCHAR2(30);
36427 l_event_class_code VARCHAR2(30);
36428 l_ae_header_id NUMBER;
36429 l_event_type_code VARCHAR2(30);
36430 l_line_definition_code VARCHAR2(30);
36431 l_line_definition_owner_code VARCHAR2(1);
36432 --
36433 -- adr variables
36434 l_segment VARCHAR2(30);
36435 l_ccid NUMBER;
36436 l_adr_transaction_coa_id NUMBER;
36437 l_adr_accounting_coa_id NUMBER;
36438 l_adr_flexfield_segment_code VARCHAR2(30);
36439 l_adr_flex_value_set_id NUMBER;
36440 l_adr_value_type_code VARCHAR2(30);
36441 l_adr_value_combination_id NUMBER;
36442 l_adr_value_segment_code VARCHAR2(30);
36443
36444 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
36445 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
36446 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
36447 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
36448
36449 -- 4262811 Variables ------------------------------------------------------------------------------------------
36450 l_entered_amt_idx NUMBER;
36451 l_accted_amt_idx NUMBER;
36452 l_acc_rev_flag VARCHAR2(1);
36453 l_accrual_line_num NUMBER;
36454 l_tmp_amt NUMBER;
36455 l_acc_rev_natural_side_code VARCHAR2(1);
36456
36457 l_num_entries NUMBER;
36458 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
36459 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
36460 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
36461 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
36462 l_recog_line_1 NUMBER;
36463 l_recog_line_2 NUMBER;
36464
36465 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
36466 l_bflow_applied_to_amt NUMBER; -- 5132302
36467 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
36468
36469 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
36470
36471 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
36472 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
36473
36474 ---------------------------------------------------------------------------------------------------------------
36475
36476
36477 --
36478 -- bulk performance
36479 --
36480 l_balance_type_code VARCHAR2(1);
36481 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
36482 l_log_module VARCHAR2(240);
36483
36484 --
36485 -- Upgrade strategy
36486 --
36487 l_actual_upg_option VARCHAR2(1);
36488 l_enc_upg_option VARCHAR2(1);
36489
36490 --
36491 BEGIN
36492 --
36493 IF g_log_enabled THEN
36494 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_216';
36495 END IF;
36496 --
36497 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
36498
36499 trace
36500 (p_msg => 'BEGIN of AcctLineType_216'
36501 ,p_level => C_LEVEL_PROCEDURE
36502 ,p_module => l_log_module);
36503
36504 END IF;
36505 --
36506 l_component_type := 'AMB_JLT';
36507 l_component_code := 'FA_CAP_EXP_BAL';
36508 l_component_type_code := 'S';
36509 l_component_appl_id := 140;
36510 l_amb_context_code := 'DEFAULT';
36511 l_entity_code := 'TRANSACTIONS';
36512 l_event_class_code := 'CAPITALIZATION';
36513 l_event_type_code := 'CAPITALIZATION';
36514 l_line_definition_owner_code := 'S';
36515 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CAPITA3';
36516 --
36517 l_balance_type_code := 'A';
36518 l_segment := NULL;
36519 l_ccid := NULL;
36520 l_adr_transaction_coa_id := NULL;
36521 l_adr_accounting_coa_id := NULL;
36522 l_adr_flexfield_segment_code := NULL;
36523 l_adr_flex_value_set_id := NULL;
36524 l_adr_value_type_code := NULL;
36525 l_adr_value_combination_id := NULL;
36526 l_adr_value_segment_code := NULL;
36527
36528 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
36529 l_bflow_class_code := ''; -- 4219869 Business Flow
36530 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
36531 l_budgetary_control_flag := 'N';
36532
36533 l_bflow_applied_to_amt_idx := NULL; -- 5132302
36534 l_bflow_applied_to_amt := NULL; -- 5132302
36535 l_entered_amt_idx := NULL; -- 4262811
36536 l_accted_amt_idx := NULL; -- 4262811
36537 l_acc_rev_flag := NULL; -- 4262811
36538 l_accrual_line_num := NULL; -- 4262811
36539 l_tmp_amt := NULL; -- 4262811
36540 --
36541
36542 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
36543 l_balance_type_code <> 'B' THEN
36544 IF NVL(p_source_48,'
36545 ') = 'BONUS EXPENSE'
36546 THEN
36550
36547
36548 --
36549 XLA_AE_LINES_PKG.SetNewLine;
36551 p_balance_type_code := l_balance_type_code;
36552 -- set the flag so later we will know whether the gain loss line needs to be created
36553
36554 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
36555 p_actual_flag :='A';
36556 END IF;
36557
36558 --
36559 -- bulk performance
36560 --
36561 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
36562 p_header_num => 0); -- 4262811
36563 --
36564 -- set accounting line options
36565 --
36566 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
36567 p_natural_side_code => 'C'
36568 , p_gain_or_loss_flag => 'N'
36569 , p_gl_transfer_mode_code => 'S'
36570 , p_acct_entry_type_code => 'A'
36571 , p_switch_side_flag => 'Y'
36572 , p_merge_duplicate_code => 'N'
36573 );
36574 --
36575 l_acc_rev_natural_side_code := 'D'; -- 4262811
36576 --
36577 --
36578 -- set accounting line type info
36579 --
36580 xla_ae_lines_pkg.SetAcctLineType
36581 (p_component_type => l_component_type
36582 ,p_event_type_code => l_event_type_code
36583 ,p_line_definition_owner_code => l_line_definition_owner_code
36584 ,p_line_definition_code => l_line_definition_code
36585 ,p_accounting_line_code => l_component_code
36586 ,p_accounting_line_type_code => l_component_type_code
36587 ,p_accounting_line_appl_id => l_component_appl_id
36588 ,p_amb_context_code => l_amb_context_code
36589 ,p_entity_code => l_entity_code
36590 ,p_event_class_code => l_event_class_code);
36591 --
36592 -- set accounting class
36593 --
36594 xla_ae_lines_pkg.SetAcctClass(
36595 p_accounting_class_code => 'EXPENSE'
36596 , p_ae_header_id => l_ae_header_id
36597 );
36598
36599 --
36600 -- set rounding class
36601 --
36602 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
36603 'EXPENSE';
36604
36605 --
36606 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
36607 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
36608 --
36609 -- bulk performance
36610 --
36611 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
36612
36613 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
36614 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
36615
36616 -- 4955764
36617 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
36618 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
36619
36620 -- 4458381 Public Sector Enh
36621
36622 --
36623 -- set accounting attributes for the line type
36624 --
36625 l_entered_amt_idx := 4;
36626 l_accted_amt_idx := 6;
36627 l_bflow_applied_to_amt_idx := NULL; -- 5132302
36628 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
36629 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
36630 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
36631 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
36632 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
36633 l_rec_acct_attrs.array_char_value(3) := p_source_51;
36634 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
36635 l_rec_acct_attrs.array_num_value(4) := p_source_52;
36636 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
36637 l_rec_acct_attrs.array_char_value(5) := p_source_53;
36638 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
36639 l_rec_acct_attrs.array_num_value(6) := p_source_52;
36640
36641 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
36642 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
36643
36644 ---------------------------------------------------------------------------------------------------------------
36645 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
36646 ---------------------------------------------------------------------------------------------------------------
36647 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
36648
36649 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
36650 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
36651
36652 IF xla_accounting_cache_pkg.GetValueChar
36653 (p_source_code => 'LEDGER_CATEGORY_CODE'
36654 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
36655 AND l_bflow_method_code = 'PRIOR_ENTRY'
36656 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
36657 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
36661 xla_ae_lines_pkg.BflowUpgEntry
36658 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
36659 )
36660 THEN
36662 (p_business_method_code => l_bflow_method_code
36663 ,p_business_class_code => l_bflow_class_code
36664 ,p_balance_type => l_balance_type_code);
36665 ELSE
36666 NULL;
36667 -- No business flow processing for business flow method of NONE.
36668 END IF;
36669
36670 --
36671 -- call analytical criteria
36672 --
36673
36674 --
36675 -- call description
36676 --
36677
36678 xla_ae_lines_pkg.SetLineDescription(
36679 p_ae_header_id => l_ae_header_id
36680 ,p_description => Description_21 (
36681 p_application_id => p_application_id
36682 , p_ae_header_id => l_ae_header_id
36683 , p_source_1 => p_source_1
36684 )
36685 );
36686
36687
36688 --
36689 -- call ADRs
36690 -- Bug 4922099
36691 --
36692 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
36693 (NVL(l_actual_upg_option, 'N') = 'O') OR
36694 (NVL(l_enc_upg_option, 'N') = 'O')
36695 )
36696 THEN
36697 NULL;
36698 --
36699 --
36700
36701 l_ccid := AcctDerRule_176(
36702 p_application_id => p_application_id
36703 , p_ae_header_id => l_ae_header_id
36704 , p_source_5 => p_source_5
36705 , p_source_31 => p_source_31
36706 , x_transaction_coa_id => l_adr_transaction_coa_id
36707 , x_accounting_coa_id => l_adr_accounting_coa_id
36708 , x_value_type_code => l_adr_value_type_code
36709 , p_side => 'NA'
36710 );
36711
36712 xla_ae_lines_pkg.set_ccid(
36713 p_code_combination_id => l_ccid
36714 , p_value_type_code => l_adr_value_type_code
36715 , p_transaction_coa_id => l_adr_transaction_coa_id
36716 , p_accounting_coa_id => l_adr_accounting_coa_id
36717 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
36718 , p_adr_type_code => 'S'
36719 , p_component_type => l_component_type
36720 , p_component_code => l_component_code
36721 , p_component_type_code => l_component_type_code
36722 , p_component_appl_id => l_component_appl_id
36723 , p_amb_context_code => l_amb_context_code
36724 , p_side => 'NA'
36725 );
36726
36727
36728 --
36729 --
36730 END IF;
36731 --
36732 -- Bug 4922099
36733 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
36734 (NVL(l_enc_upg_option, 'N') = 'O')
36735 ) AND
36736 (l_bflow_method_code = 'PRIOR_ENTRY')
36737 )
36738 THEN
36739 IF
36740 --
36741 1 = 2
36742 --
36743 THEN
36744 xla_accounting_err_pkg.build_message
36745 (p_appli_s_name => 'XLA'
36746 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
36747 ,p_token_1 => 'LINE_NUMBER'
36748 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
36749 ,p_token_2 => 'LINE_TYPE_NAME'
36750 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
36751 l_component_type
36752 ,l_component_code
36753 ,l_component_type_code
36754 ,l_component_appl_id
36755 ,l_amb_context_code
36756 ,l_entity_code
36757 ,l_event_class_code
36758 )
36759 ,p_token_3 => 'OWNER'
36760 ,p_value_3 => xla_lookups_pkg.get_meaning(
36761 p_lookup_type => 'XLA_OWNER_TYPE'
36762 ,p_lookup_code => l_component_type_code
36763 )
36764 ,p_token_4 => 'PRODUCT_NAME'
36765 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
36766 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
36767 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
36768 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
36769 ,p_ae_header_id => NULL
36770 );
36771
36772 IF (C_LEVEL_ERROR>= g_log_level) THEN
36773 trace
36777 END IF;
36774 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
36775 ,p_level => C_LEVEL_ERROR
36776 ,p_module => l_log_module);
36778 END IF;
36779 END IF;
36780 --
36781 --
36782 ------------------------------------------------------------------------------------------------
36783 -- 4219869 Business Flow
36784 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
36785 -- Prior Entry. Currently, the following code is always generated.
36786 ------------------------------------------------------------------------------------------------
36787 XLA_AE_LINES_PKG.ValidateCurrentLine;
36788
36789 ------------------------------------------------------------------------------------
36790 -- 4219869 Business Flow
36791 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
36792 ------------------------------------------------------------------------------------
36793 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
36794
36795 ----------------------------------------------------------------------------------
36796 -- 4219869 Business Flow
36797 -- Update journal entry status -- Need to generate this within IF <condition>
36798 ----------------------------------------------------------------------------------
36799 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
36800 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
36801 ,p_balance_type_code => l_balance_type_code
36802 );
36803
36804 -------------------------------------------------------------------------------------------
36805 -- 4262811 - Generate the Accrual Reversal lines
36806 -------------------------------------------------------------------------------------------
36807 BEGIN
36808 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
36809 (g_array_event(p_event_id).array_value_num('header_index'));
36810 IF l_acc_rev_flag IS NULL THEN
36811 l_acc_rev_flag := 'N';
36812 END IF;
36813 EXCEPTION
36814 WHEN OTHERS THEN
36815 l_acc_rev_flag := 'N';
36816 END;
36817 --
36818 IF (l_acc_rev_flag = 'Y') THEN
36819
36820 -- 4645092 ------------------------------------------------------------------------------
36821 -- To allow MPA report to determine if it should generate report process
36822 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
36823 ------------------------------------------------------------------------------------------
36824
36825 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
36826 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
36827 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
36828 -- call ADRs
36829 -- Bug 4922099
36830 --
36831 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
36832 (NVL(l_actual_upg_option, 'N') = 'O') OR
36833 (NVL(l_enc_upg_option, 'N') = 'O')
36834 )
36835 THEN
36836 NULL;
36837 --
36838 --
36839
36840 l_ccid := AcctDerRule_176(
36841 p_application_id => p_application_id
36842 , p_ae_header_id => l_ae_header_id
36843 , p_source_5 => p_source_5
36844 , p_source_31 => p_source_31
36845 , x_transaction_coa_id => l_adr_transaction_coa_id
36846 , x_accounting_coa_id => l_adr_accounting_coa_id
36847 , x_value_type_code => l_adr_value_type_code
36848 , p_side => 'NA'
36849 );
36850
36851 xla_ae_lines_pkg.set_ccid(
36852 p_code_combination_id => l_ccid
36853 , p_value_type_code => l_adr_value_type_code
36854 , p_transaction_coa_id => l_adr_transaction_coa_id
36855 , p_accounting_coa_id => l_adr_accounting_coa_id
36856 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
36857 , p_adr_type_code => 'S'
36858 , p_component_type => l_component_type
36859 , p_component_code => l_component_code
36860 , p_component_type_code => l_component_type_code
36861 , p_component_appl_id => l_component_appl_id
36862 , p_amb_context_code => l_amb_context_code
36863 , p_side => 'NA'
36864 );
36865
36866
36867 --
36868 --
36869 END IF;
36870
36871 --
36872 -- Update the line information that should be overwritten
36873 --
36874 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
36875 p_header_num => 1);
36876 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
36877
36878 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
36879
36880 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
36881 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
36882 END IF;
36883
36884 --
36885 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
36886 --
36890 ---------------------------------------------------------------------------------------------------
36887 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
36888 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
36889 ELSE
36891 -- 4262811a Switch Sign
36892 ---------------------------------------------------------------------------------------------------
36893 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
36894 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
36895 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
36896 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
36897 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
36898 -- 5132302
36899 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
36900 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
36901
36902 END IF;
36903
36904 -- 4955764
36905 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
36906 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
36907
36908
36909 XLA_AE_LINES_PKG.ValidateCurrentLine;
36910 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
36911
36912 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
36913 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
36914 ,p_balance_type_code => l_balance_type_code);
36915
36916 END IF;
36917
36918 -----------------------------------------------------------------------------------------
36919 -- 4262811 Multiperiod Accounting
36920 -----------------------------------------------------------------------------------------
36921 -- No MPA option is assigned.
36922
36923
36924 END IF;
36925 END IF;
36926 --
36927
36928 --
36929 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
36930 trace
36931 (p_msg => 'END of AcctLineType_216'
36932 ,p_level => C_LEVEL_PROCEDURE
36933 ,p_module => l_log_module);
36934 END IF;
36935 --
36936 EXCEPTION
36937 WHEN xla_exceptions_pkg.application_exception THEN
36938 RAISE;
36939 WHEN OTHERS THEN
36940 xla_exceptions_pkg.raise_message
36941 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_216');
36942 END AcctLineType_216;
36943 --
36944
36945 ---------------------------------------
36946 --
36947 -- PRIVATE FUNCTION
36948 -- AcctLineType_217
36949 --
36950 ---------------------------------------
36951 PROCEDURE AcctLineType_217 (
36952 p_application_id IN NUMBER
36953 ,p_event_id IN NUMBER
36954 ,p_calculate_acctd_flag IN VARCHAR2
36955 ,p_calculate_g_l_flag IN VARCHAR2
36956 ,p_actual_flag IN OUT VARCHAR2
36957 ,p_balance_type_code OUT VARCHAR2
36958 ,p_gain_or_loss_ref OUT VARCHAR2
36959
36960 --Period Close Date
36961 , p_source_1 IN DATE
36962 --Generated Code Combination Identifier
36963 , p_source_5 IN NUMBER
36964 --Depreciation Reserve Account
36965 , p_source_12 IN VARCHAR2
36966 --Generated Offset Code Combination Identifier
36967 , p_source_19 IN NUMBER
36968 --Expense Account Code Combination Identifier
36969 , p_source_31 IN NUMBER
36970 --Default Code Combination Identifier
36971 , p_source_32 IN NUMBER
36972 --Adjustment Type
36973 , p_source_48 IN VARCHAR2
36974 --Transaction Header Identifier
36975 , p_source_49 IN NUMBER
36976 --Adjustment Line Identifier
36977 , p_source_50 IN NUMBER
36978 --Distribution Type Code
36979 , p_source_51 IN VARCHAR2
36980 --Entered Amount
36981 , p_source_52 IN NUMBER
36982 --Currency Code
36983 , p_source_53 IN VARCHAR2
36984 )
36985 IS
36986
36987 l_component_type VARCHAR2(80);
36988 l_component_code VARCHAR2(30);
36989 l_component_type_code VARCHAR2(1);
36990 l_component_appl_id INTEGER;
36991 l_amb_context_code VARCHAR2(30);
36992 l_entity_code VARCHAR2(30);
36993 l_event_class_code VARCHAR2(30);
36994 l_ae_header_id NUMBER;
36995 l_event_type_code VARCHAR2(30);
36996 l_line_definition_code VARCHAR2(30);
36997 l_line_definition_owner_code VARCHAR2(1);
36998 --
36999 -- adr variables
37000 l_segment VARCHAR2(30);
37001 l_ccid NUMBER;
37002 l_adr_transaction_coa_id NUMBER;
37003 l_adr_accounting_coa_id NUMBER;
37004 l_adr_flexfield_segment_code VARCHAR2(30);
37005 l_adr_flex_value_set_id NUMBER;
37006 l_adr_value_type_code VARCHAR2(30);
37007 l_adr_value_combination_id NUMBER;
37008 l_adr_value_segment_code VARCHAR2(30);
37009
37010 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
37011 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
37012 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
37016 l_entered_amt_idx NUMBER;
37013 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
37014
37015 -- 4262811 Variables ------------------------------------------------------------------------------------------
37017 l_accted_amt_idx NUMBER;
37018 l_acc_rev_flag VARCHAR2(1);
37019 l_accrual_line_num NUMBER;
37020 l_tmp_amt NUMBER;
37021 l_acc_rev_natural_side_code VARCHAR2(1);
37022
37023 l_num_entries NUMBER;
37024 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
37025 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
37026 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
37027 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
37028 l_recog_line_1 NUMBER;
37029 l_recog_line_2 NUMBER;
37030
37031 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
37032 l_bflow_applied_to_amt NUMBER; -- 5132302
37033 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
37034
37035 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
37036
37037 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
37038 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
37039
37040 ---------------------------------------------------------------------------------------------------------------
37041
37042
37043 --
37044 -- bulk performance
37045 --
37046 l_balance_type_code VARCHAR2(1);
37047 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
37048 l_log_module VARCHAR2(240);
37049
37050 --
37051 -- Upgrade strategy
37052 --
37053 l_actual_upg_option VARCHAR2(1);
37054 l_enc_upg_option VARCHAR2(1);
37055
37056 --
37057 BEGIN
37058 --
37059 IF g_log_enabled THEN
37060 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_217';
37061 END IF;
37062 --
37063 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
37064
37065 trace
37066 (p_msg => 'BEGIN of AcctLineType_217'
37067 ,p_level => C_LEVEL_PROCEDURE
37068 ,p_module => l_log_module);
37069
37070 END IF;
37071 --
37072 l_component_type := 'AMB_JLT';
37073 l_component_code := 'FA_CAP_RESERVE';
37074 l_component_type_code := 'S';
37075 l_component_appl_id := 140;
37076 l_amb_context_code := 'DEFAULT';
37077 l_entity_code := 'TRANSACTIONS';
37078 l_event_class_code := 'CAPITALIZATION';
37079 l_event_type_code := 'CAPITALIZATION';
37080 l_line_definition_owner_code := 'S';
37081 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CAPITA3';
37082 --
37083 l_balance_type_code := 'A';
37084 l_segment := NULL;
37085 l_ccid := NULL;
37086 l_adr_transaction_coa_id := NULL;
37087 l_adr_accounting_coa_id := NULL;
37088 l_adr_flexfield_segment_code := NULL;
37089 l_adr_flex_value_set_id := NULL;
37090 l_adr_value_type_code := NULL;
37091 l_adr_value_combination_id := NULL;
37092 l_adr_value_segment_code := NULL;
37093
37094 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
37095 l_bflow_class_code := ''; -- 4219869 Business Flow
37096 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
37097 l_budgetary_control_flag := 'N';
37098
37099 l_bflow_applied_to_amt_idx := NULL; -- 5132302
37100 l_bflow_applied_to_amt := NULL; -- 5132302
37101 l_entered_amt_idx := NULL; -- 4262811
37102 l_accted_amt_idx := NULL; -- 4262811
37103 l_acc_rev_flag := NULL; -- 4262811
37104 l_accrual_line_num := NULL; -- 4262811
37105 l_tmp_amt := NULL; -- 4262811
37106 --
37107
37108 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
37109 l_balance_type_code <> 'B' THEN
37110 IF NVL(p_source_48,'
37111 ') = 'EXPENSE'
37112 THEN
37113
37114 --
37115 XLA_AE_LINES_PKG.SetNewLine;
37116
37117 p_balance_type_code := l_balance_type_code;
37118 -- set the flag so later we will know whether the gain loss line needs to be created
37119
37120 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
37121 p_actual_flag :='A';
37122 END IF;
37123
37124 --
37125 -- bulk performance
37126 --
37127 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
37128 p_header_num => 0); -- 4262811
37129 --
37130 -- set accounting line options
37131 --
37132 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
37133 p_natural_side_code => 'C'
37134 , p_gain_or_loss_flag => 'N'
37135 , p_gl_transfer_mode_code => 'S'
37136 , p_acct_entry_type_code => 'A'
37137 , p_switch_side_flag => 'Y'
37138 , p_merge_duplicate_code => 'N'
37139 );
37140 --
37141 l_acc_rev_natural_side_code := 'D'; -- 4262811
37142 --
37143 --
37147 (p_component_type => l_component_type
37144 -- set accounting line type info
37145 --
37146 xla_ae_lines_pkg.SetAcctLineType
37148 ,p_event_type_code => l_event_type_code
37149 ,p_line_definition_owner_code => l_line_definition_owner_code
37150 ,p_line_definition_code => l_line_definition_code
37151 ,p_accounting_line_code => l_component_code
37152 ,p_accounting_line_type_code => l_component_type_code
37153 ,p_accounting_line_appl_id => l_component_appl_id
37154 ,p_amb_context_code => l_amb_context_code
37155 ,p_entity_code => l_entity_code
37156 ,p_event_class_code => l_event_class_code);
37157 --
37158 -- set accounting class
37159 --
37160 xla_ae_lines_pkg.SetAcctClass(
37161 p_accounting_class_code => 'ASSET'
37162 , p_ae_header_id => l_ae_header_id
37163 );
37164
37165 --
37166 -- set rounding class
37167 --
37168 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
37169 'ASSET';
37170
37171 --
37172 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
37173 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
37174 --
37175 -- bulk performance
37176 --
37177 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
37178
37179 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
37180 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
37181
37182 -- 4955764
37183 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
37184 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
37185
37186 -- 4458381 Public Sector Enh
37187
37188 --
37189 -- set accounting attributes for the line type
37190 --
37191 l_entered_amt_idx := 4;
37192 l_accted_amt_idx := 6;
37193 l_bflow_applied_to_amt_idx := NULL; -- 5132302
37194 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
37195 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
37196 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
37197 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
37198 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
37199 l_rec_acct_attrs.array_char_value(3) := p_source_51;
37200 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
37201 l_rec_acct_attrs.array_num_value(4) := p_source_52;
37202 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
37203 l_rec_acct_attrs.array_char_value(5) := p_source_53;
37204 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
37205 l_rec_acct_attrs.array_num_value(6) := p_source_52;
37206
37207 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
37208 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
37209
37210 ---------------------------------------------------------------------------------------------------------------
37211 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
37212 ---------------------------------------------------------------------------------------------------------------
37213 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
37214
37215 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
37216 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
37217
37218 IF xla_accounting_cache_pkg.GetValueChar
37219 (p_source_code => 'LEDGER_CATEGORY_CODE'
37220 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
37221 AND l_bflow_method_code = 'PRIOR_ENTRY'
37222 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
37223 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
37224 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
37225 )
37226 THEN
37227 xla_ae_lines_pkg.BflowUpgEntry
37228 (p_business_method_code => l_bflow_method_code
37229 ,p_business_class_code => l_bflow_class_code
37230 ,p_balance_type => l_balance_type_code);
37231 ELSE
37232 NULL;
37233 -- No business flow processing for business flow method of NONE.
37234 END IF;
37235
37236 --
37237 -- call analytical criteria
37238 --
37239
37240 --
37241 -- call description
37242 --
37243
37244 xla_ae_lines_pkg.SetLineDescription(
37245 p_ae_header_id => l_ae_header_id
37246 ,p_description => Description_22 (
37247 p_application_id => p_application_id
37248 , p_ae_header_id => l_ae_header_id
37249 , p_source_1 => p_source_1
37250 )
37251 );
37252
37253
37254 --
37255 -- call ADRs
37256 -- Bug 4922099
37257 --
37258 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
37259 (NVL(l_actual_upg_option, 'N') = 'O') OR
37260 (NVL(l_enc_upg_option, 'N') = 'O')
37261 )
37262 THEN
37263 NULL;
37267 l_ccid := AcctDerRule_175(
37264 --
37265 --
37266
37268 p_application_id => p_application_id
37269 , p_ae_header_id => l_ae_header_id
37270 , p_source_5 => p_source_5
37271 , p_source_19 => p_source_19
37272 , p_source_32 => p_source_32
37273 , x_transaction_coa_id => l_adr_transaction_coa_id
37274 , x_accounting_coa_id => l_adr_accounting_coa_id
37275 , x_value_type_code => l_adr_value_type_code
37276 , p_side => 'NA'
37277 );
37278
37279 xla_ae_lines_pkg.set_ccid(
37280 p_code_combination_id => l_ccid
37281 , p_value_type_code => l_adr_value_type_code
37282 , p_transaction_coa_id => l_adr_transaction_coa_id
37283 , p_accounting_coa_id => l_adr_accounting_coa_id
37284 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
37285 , p_adr_type_code => 'S'
37286 , p_component_type => l_component_type
37287 , p_component_code => l_component_code
37288 , p_component_type_code => l_component_type_code
37289 , p_component_appl_id => l_component_appl_id
37290 , p_amb_context_code => l_amb_context_code
37291 , p_side => 'NA'
37292 );
37293
37294
37295 l_segment := AcctDerRule_150(
37296 p_application_id => p_application_id
37297 , p_ae_header_id => l_ae_header_id
37298 , p_source_5 => p_source_5
37299 , p_source_12 => p_source_12
37300 , x_transaction_coa_id => l_adr_transaction_coa_id
37301 , x_accounting_coa_id => l_adr_accounting_coa_id
37302 , x_flexfield_segment_code => l_adr_flexfield_segment_code
37303 , x_flex_value_set_id => l_adr_flex_value_set_id
37304 , x_value_type_code => l_adr_value_type_code
37305 , x_value_combination_id => l_adr_value_combination_id
37306 , x_value_segment_code => l_adr_value_segment_code
37307 , p_side => 'NA'
37308 , p_override_seg_flag => 'Y'
37309 );
37310
37311 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
37312
37313 xla_ae_lines_pkg.set_segment(
37314 p_to_segment_code => 'GL_ACCOUNT'
37315 , p_segment_value => l_segment
37316 , p_from_segment_code => l_adr_value_segment_code
37317 , p_from_combination_id => l_adr_value_combination_id
37318 , p_value_type_code => l_adr_value_type_code
37319 , p_transaction_coa_id => l_adr_transaction_coa_id
37320 , p_accounting_coa_id => l_adr_accounting_coa_id
37321 , p_flexfield_segment_code => l_adr_flexfield_segment_code
37322 , p_flex_value_set_id => l_adr_flex_value_set_id
37323 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
37324 , p_adr_type_code => 'S'
37325 , p_component_type => l_component_type
37326 , p_component_code => l_component_code
37327 , p_component_type_code => l_component_type_code
37328 , p_component_appl_id => l_component_appl_id
37329 , p_amb_context_code => l_amb_context_code
37330 , p_entity_code => 'TRANSACTIONS'
37331 , p_event_class_code => 'CAPITALIZATION'
37332 , p_side => 'NA'
37333 );
37334
37335 END IF;
37336
37337 l_segment := AcctDerRule_169(
37338 p_application_id => p_application_id
37339 , p_ae_header_id => l_ae_header_id
37340 , p_source_5 => p_source_5
37341 , p_source_31 => p_source_31
37342 , x_transaction_coa_id => l_adr_transaction_coa_id
37343 , x_accounting_coa_id => l_adr_accounting_coa_id
37344 , x_flexfield_segment_code => l_adr_flexfield_segment_code
37345 , x_flex_value_set_id => l_adr_flex_value_set_id
37346 , x_value_type_code => l_adr_value_type_code
37347 , x_value_combination_id => l_adr_value_combination_id
37348 , x_value_segment_code => l_adr_value_segment_code
37349 , p_side => 'NA'
37350 , p_override_seg_flag => 'Y'
37351 );
37352
37353 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
37354
37355 xla_ae_lines_pkg.set_segment(
37356 p_to_segment_code => 'GL_BALANCING'
37357 , p_segment_value => l_segment
37358 , p_from_segment_code => l_adr_value_segment_code
37359 , p_from_combination_id => l_adr_value_combination_id
37360 , p_value_type_code => l_adr_value_type_code
37361 , p_transaction_coa_id => l_adr_transaction_coa_id
37362 , p_accounting_coa_id => l_adr_accounting_coa_id
37363 , p_flexfield_segment_code => l_adr_flexfield_segment_code
37364 , p_flex_value_set_id => l_adr_flex_value_set_id
37365 , p_adr_code => 'FA_EXPENSE_ACCT'
37366 , p_adr_type_code => 'S'
37367 , p_component_type => l_component_type
37368 , p_component_code => l_component_code
37369 , p_component_type_code => l_component_type_code
37370 , p_component_appl_id => l_component_appl_id
37374 , p_side => 'NA'
37371 , p_amb_context_code => l_amb_context_code
37372 , p_entity_code => 'TRANSACTIONS'
37373 , p_event_class_code => 'CAPITALIZATION'
37375 );
37376
37377 END IF;
37378
37379 --
37380 --
37381 END IF;
37382 --
37383 -- Bug 4922099
37384 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
37385 (NVL(l_enc_upg_option, 'N') = 'O')
37386 ) AND
37387 (l_bflow_method_code = 'PRIOR_ENTRY')
37388 )
37389 THEN
37390 IF
37391 --
37392 1 = 2
37393 --
37394 THEN
37395 xla_accounting_err_pkg.build_message
37396 (p_appli_s_name => 'XLA'
37397 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
37398 ,p_token_1 => 'LINE_NUMBER'
37399 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
37400 ,p_token_2 => 'LINE_TYPE_NAME'
37401 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
37402 l_component_type
37403 ,l_component_code
37404 ,l_component_type_code
37405 ,l_component_appl_id
37406 ,l_amb_context_code
37407 ,l_entity_code
37408 ,l_event_class_code
37409 )
37410 ,p_token_3 => 'OWNER'
37411 ,p_value_3 => xla_lookups_pkg.get_meaning(
37412 p_lookup_type => 'XLA_OWNER_TYPE'
37413 ,p_lookup_code => l_component_type_code
37414 )
37415 ,p_token_4 => 'PRODUCT_NAME'
37416 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
37417 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
37418 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
37419 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
37420 ,p_ae_header_id => NULL
37421 );
37422
37423 IF (C_LEVEL_ERROR>= g_log_level) THEN
37424 trace
37425 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
37426 ,p_level => C_LEVEL_ERROR
37427 ,p_module => l_log_module);
37428 END IF;
37429 END IF;
37430 END IF;
37431 --
37432 --
37433 ------------------------------------------------------------------------------------------------
37434 -- 4219869 Business Flow
37435 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
37436 -- Prior Entry. Currently, the following code is always generated.
37437 ------------------------------------------------------------------------------------------------
37438 XLA_AE_LINES_PKG.ValidateCurrentLine;
37439
37440 ------------------------------------------------------------------------------------
37441 -- 4219869 Business Flow
37442 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
37443 ------------------------------------------------------------------------------------
37444 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
37445
37446 ----------------------------------------------------------------------------------
37447 -- 4219869 Business Flow
37448 -- Update journal entry status -- Need to generate this within IF <condition>
37449 ----------------------------------------------------------------------------------
37450 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
37451 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
37452 ,p_balance_type_code => l_balance_type_code
37453 );
37454
37455 -------------------------------------------------------------------------------------------
37456 -- 4262811 - Generate the Accrual Reversal lines
37457 -------------------------------------------------------------------------------------------
37458 BEGIN
37459 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
37460 (g_array_event(p_event_id).array_value_num('header_index'));
37461 IF l_acc_rev_flag IS NULL THEN
37462 l_acc_rev_flag := 'N';
37463 END IF;
37464 EXCEPTION
37465 WHEN OTHERS THEN
37466 l_acc_rev_flag := 'N';
37470
37467 END;
37468 --
37469 IF (l_acc_rev_flag = 'Y') THEN
37471 -- 4645092 ------------------------------------------------------------------------------
37472 -- To allow MPA report to determine if it should generate report process
37473 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
37474 ------------------------------------------------------------------------------------------
37475
37476 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
37477 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
37478 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
37479 -- call ADRs
37480 -- Bug 4922099
37481 --
37482 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
37483 (NVL(l_actual_upg_option, 'N') = 'O') OR
37484 (NVL(l_enc_upg_option, 'N') = 'O')
37485 )
37486 THEN
37487 NULL;
37488 --
37489 --
37490
37491 l_ccid := AcctDerRule_175(
37492 p_application_id => p_application_id
37493 , p_ae_header_id => l_ae_header_id
37494 , p_source_5 => p_source_5
37495 , p_source_19 => p_source_19
37496 , p_source_32 => p_source_32
37497 , x_transaction_coa_id => l_adr_transaction_coa_id
37498 , x_accounting_coa_id => l_adr_accounting_coa_id
37499 , x_value_type_code => l_adr_value_type_code
37500 , p_side => 'NA'
37501 );
37502
37503 xla_ae_lines_pkg.set_ccid(
37504 p_code_combination_id => l_ccid
37505 , p_value_type_code => l_adr_value_type_code
37506 , p_transaction_coa_id => l_adr_transaction_coa_id
37507 , p_accounting_coa_id => l_adr_accounting_coa_id
37508 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
37509 , p_adr_type_code => 'S'
37510 , p_component_type => l_component_type
37511 , p_component_code => l_component_code
37512 , p_component_type_code => l_component_type_code
37513 , p_component_appl_id => l_component_appl_id
37514 , p_amb_context_code => l_amb_context_code
37515 , p_side => 'NA'
37516 );
37517
37518
37519 l_segment := AcctDerRule_150(
37520 p_application_id => p_application_id
37521 , p_ae_header_id => l_ae_header_id
37522 , p_source_5 => p_source_5
37523 , p_source_12 => p_source_12
37524 , x_transaction_coa_id => l_adr_transaction_coa_id
37525 , x_accounting_coa_id => l_adr_accounting_coa_id
37526 , x_flexfield_segment_code => l_adr_flexfield_segment_code
37527 , x_flex_value_set_id => l_adr_flex_value_set_id
37528 , x_value_type_code => l_adr_value_type_code
37529 , x_value_combination_id => l_adr_value_combination_id
37530 , x_value_segment_code => l_adr_value_segment_code
37531 , p_side => 'NA'
37532 , p_override_seg_flag => 'Y'
37533 );
37534
37535 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
37536
37537 xla_ae_lines_pkg.set_segment(
37538 p_to_segment_code => 'GL_ACCOUNT'
37539 , p_segment_value => l_segment
37540 , p_from_segment_code => l_adr_value_segment_code
37541 , p_from_combination_id => l_adr_value_combination_id
37542 , p_value_type_code => l_adr_value_type_code
37543 , p_transaction_coa_id => l_adr_transaction_coa_id
37544 , p_accounting_coa_id => l_adr_accounting_coa_id
37545 , p_flexfield_segment_code => l_adr_flexfield_segment_code
37546 , p_flex_value_set_id => l_adr_flex_value_set_id
37547 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
37548 , p_adr_type_code => 'S'
37549 , p_component_type => l_component_type
37550 , p_component_code => l_component_code
37551 , p_component_type_code => l_component_type_code
37552 , p_component_appl_id => l_component_appl_id
37553 , p_amb_context_code => l_amb_context_code
37554 , p_entity_code => 'TRANSACTIONS'
37555 , p_event_class_code => 'CAPITALIZATION'
37556 , p_side => 'NA'
37557 );
37558
37559 END IF;
37560
37561 l_segment := AcctDerRule_169(
37562 p_application_id => p_application_id
37563 , p_ae_header_id => l_ae_header_id
37564 , p_source_5 => p_source_5
37565 , p_source_31 => p_source_31
37566 , x_transaction_coa_id => l_adr_transaction_coa_id
37567 , x_accounting_coa_id => l_adr_accounting_coa_id
37568 , x_flexfield_segment_code => l_adr_flexfield_segment_code
37569 , x_flex_value_set_id => l_adr_flex_value_set_id
37570 , x_value_type_code => l_adr_value_type_code
37571 , x_value_combination_id => l_adr_value_combination_id
37572 , x_value_segment_code => l_adr_value_segment_code
37573 , p_side => 'NA'
37574 , p_override_seg_flag => 'Y'
37575 );
37576
37577 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
37578
37579 xla_ae_lines_pkg.set_segment(
37583 , p_from_combination_id => l_adr_value_combination_id
37580 p_to_segment_code => 'GL_BALANCING'
37581 , p_segment_value => l_segment
37582 , p_from_segment_code => l_adr_value_segment_code
37584 , p_value_type_code => l_adr_value_type_code
37585 , p_transaction_coa_id => l_adr_transaction_coa_id
37586 , p_accounting_coa_id => l_adr_accounting_coa_id
37587 , p_flexfield_segment_code => l_adr_flexfield_segment_code
37588 , p_flex_value_set_id => l_adr_flex_value_set_id
37589 , p_adr_code => 'FA_EXPENSE_ACCT'
37590 , p_adr_type_code => 'S'
37591 , p_component_type => l_component_type
37592 , p_component_code => l_component_code
37593 , p_component_type_code => l_component_type_code
37594 , p_component_appl_id => l_component_appl_id
37595 , p_amb_context_code => l_amb_context_code
37596 , p_entity_code => 'TRANSACTIONS'
37597 , p_event_class_code => 'CAPITALIZATION'
37598 , p_side => 'NA'
37599 );
37600
37601 END IF;
37602
37603 --
37604 --
37605 END IF;
37606
37607 --
37608 -- Update the line information that should be overwritten
37609 --
37610 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
37611 p_header_num => 1);
37612 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
37613
37614 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
37615
37616 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
37617 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
37618 END IF;
37619
37620 --
37621 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
37622 --
37623 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
37624 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
37625 ELSE
37626 ---------------------------------------------------------------------------------------------------
37627 -- 4262811a Switch Sign
37628 ---------------------------------------------------------------------------------------------------
37629 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
37630 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
37631 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
37632 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
37633 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
37634 -- 5132302
37635 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
37636 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
37637
37638 END IF;
37639
37640 -- 4955764
37641 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
37642 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
37643
37644
37645 XLA_AE_LINES_PKG.ValidateCurrentLine;
37646 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
37647
37648 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
37649 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
37650 ,p_balance_type_code => l_balance_type_code);
37651
37652 END IF;
37653
37654 -----------------------------------------------------------------------------------------
37655 -- 4262811 Multiperiod Accounting
37656 -----------------------------------------------------------------------------------------
37657 -- No MPA option is assigned.
37658
37659
37660 END IF;
37661 END IF;
37662 --
37663
37664 --
37665 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
37666 trace
37667 (p_msg => 'END of AcctLineType_217'
37668 ,p_level => C_LEVEL_PROCEDURE
37669 ,p_module => l_log_module);
37670 END IF;
37671 --
37672 EXCEPTION
37673 WHEN xla_exceptions_pkg.application_exception THEN
37674 RAISE;
37675 WHEN OTHERS THEN
37676 xla_exceptions_pkg.raise_message
37677 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_217');
37678 END AcctLineType_217;
37679 --
37680
37681 ---------------------------------------
37682 --
37683 -- PRIVATE FUNCTION
37684 -- AcctLineType_218
37685 --
37686 ---------------------------------------
37687 PROCEDURE AcctLineType_218 (
37688 p_application_id IN NUMBER
37689 ,p_event_id IN NUMBER
37690 ,p_calculate_acctd_flag IN VARCHAR2
37691 ,p_calculate_g_l_flag IN VARCHAR2
37692 ,p_actual_flag IN OUT VARCHAR2
37693 ,p_balance_type_code OUT VARCHAR2
37697 , p_source_1 IN DATE
37694 ,p_gain_or_loss_ref OUT VARCHAR2
37695
37696 --Period Close Date
37698 --Generated Code Combination Identifier
37699 , p_source_5 IN NUMBER
37700 --Depreciation Reserve Account
37701 , p_source_12 IN VARCHAR2
37702 --Generated Offset Code Combination Identifier
37703 , p_source_19 IN NUMBER
37704 --Expense Account Code Combination Identifier
37705 , p_source_31 IN NUMBER
37706 --Default Code Combination Identifier
37707 , p_source_32 IN NUMBER
37708 --Adjustment Type
37709 , p_source_48 IN VARCHAR2
37710 --Transaction Header Identifier
37711 , p_source_49 IN NUMBER
37712 --Adjustment Line Identifier
37713 , p_source_50 IN NUMBER
37714 --Distribution Type Code
37715 , p_source_51 IN VARCHAR2
37716 --Entered Amount
37717 , p_source_52 IN NUMBER
37718 --Currency Code
37719 , p_source_53 IN VARCHAR2
37720 )
37721 IS
37722
37723 l_component_type VARCHAR2(80);
37724 l_component_code VARCHAR2(30);
37725 l_component_type_code VARCHAR2(1);
37726 l_component_appl_id INTEGER;
37727 l_amb_context_code VARCHAR2(30);
37728 l_entity_code VARCHAR2(30);
37729 l_event_class_code VARCHAR2(30);
37730 l_ae_header_id NUMBER;
37731 l_event_type_code VARCHAR2(30);
37732 l_line_definition_code VARCHAR2(30);
37733 l_line_definition_owner_code VARCHAR2(1);
37734 --
37735 -- adr variables
37736 l_segment VARCHAR2(30);
37737 l_ccid NUMBER;
37738 l_adr_transaction_coa_id NUMBER;
37739 l_adr_accounting_coa_id NUMBER;
37740 l_adr_flexfield_segment_code VARCHAR2(30);
37741 l_adr_flex_value_set_id NUMBER;
37742 l_adr_value_type_code VARCHAR2(30);
37743 l_adr_value_combination_id NUMBER;
37744 l_adr_value_segment_code VARCHAR2(30);
37745
37746 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
37747 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
37748 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
37749 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
37750
37751 -- 4262811 Variables ------------------------------------------------------------------------------------------
37752 l_entered_amt_idx NUMBER;
37753 l_accted_amt_idx NUMBER;
37754 l_acc_rev_flag VARCHAR2(1);
37755 l_accrual_line_num NUMBER;
37756 l_tmp_amt NUMBER;
37757 l_acc_rev_natural_side_code VARCHAR2(1);
37758
37759 l_num_entries NUMBER;
37760 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
37761 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
37762 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
37763 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
37764 l_recog_line_1 NUMBER;
37765 l_recog_line_2 NUMBER;
37766
37767 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
37768 l_bflow_applied_to_amt NUMBER; -- 5132302
37769 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
37770
37771 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
37772
37773 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
37774 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
37775
37776 ---------------------------------------------------------------------------------------------------------------
37777
37778
37779 --
37780 -- bulk performance
37781 --
37782 l_balance_type_code VARCHAR2(1);
37783 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
37784 l_log_module VARCHAR2(240);
37785
37786 --
37787 -- Upgrade strategy
37788 --
37789 l_actual_upg_option VARCHAR2(1);
37790 l_enc_upg_option VARCHAR2(1);
37791
37792 --
37793 BEGIN
37794 --
37795 IF g_log_enabled THEN
37796 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_218';
37797 END IF;
37798 --
37799 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
37800
37801 trace
37802 (p_msg => 'BEGIN of AcctLineType_218'
37803 ,p_level => C_LEVEL_PROCEDURE
37804 ,p_module => l_log_module);
37805
37806 END IF;
37807 --
37808 l_component_type := 'AMB_JLT';
37809 l_component_code := 'FA_CAP_RESERVE_BAL';
37810 l_component_type_code := 'S';
37811 l_component_appl_id := 140;
37812 l_amb_context_code := 'DEFAULT';
37813 l_entity_code := 'TRANSACTIONS';
37814 l_event_class_code := 'CAPITALIZATION';
37815 l_event_type_code := 'CAPITALIZATION';
37816 l_line_definition_owner_code := 'S';
37817 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CAPITA3';
37818 --
37819 l_balance_type_code := 'A';
37820 l_segment := NULL;
37821 l_ccid := NULL;
37822 l_adr_transaction_coa_id := NULL;
37826 l_adr_value_type_code := NULL;
37823 l_adr_accounting_coa_id := NULL;
37824 l_adr_flexfield_segment_code := NULL;
37825 l_adr_flex_value_set_id := NULL;
37827 l_adr_value_combination_id := NULL;
37828 l_adr_value_segment_code := NULL;
37829
37830 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
37831 l_bflow_class_code := ''; -- 4219869 Business Flow
37832 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
37833 l_budgetary_control_flag := 'N';
37834
37835 l_bflow_applied_to_amt_idx := NULL; -- 5132302
37836 l_bflow_applied_to_amt := NULL; -- 5132302
37837 l_entered_amt_idx := NULL; -- 4262811
37838 l_accted_amt_idx := NULL; -- 4262811
37839 l_acc_rev_flag := NULL; -- 4262811
37840 l_accrual_line_num := NULL; -- 4262811
37841 l_tmp_amt := NULL; -- 4262811
37842 --
37843
37844 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
37845 l_balance_type_code <> 'B' THEN
37846 IF NVL(p_source_48,'
37847 ') = 'BONUS EXPENSE'
37848 THEN
37849
37850 --
37851 XLA_AE_LINES_PKG.SetNewLine;
37852
37853 p_balance_type_code := l_balance_type_code;
37854 -- set the flag so later we will know whether the gain loss line needs to be created
37855
37856 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
37857 p_actual_flag :='A';
37858 END IF;
37859
37860 --
37861 -- bulk performance
37862 --
37863 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
37864 p_header_num => 0); -- 4262811
37865 --
37866 -- set accounting line options
37867 --
37868 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
37869 p_natural_side_code => 'D'
37870 , p_gain_or_loss_flag => 'N'
37871 , p_gl_transfer_mode_code => 'S'
37872 , p_acct_entry_type_code => 'A'
37873 , p_switch_side_flag => 'Y'
37874 , p_merge_duplicate_code => 'N'
37875 );
37876 --
37877 l_acc_rev_natural_side_code := 'C'; -- 4262811
37878 --
37879 --
37880 -- set accounting line type info
37881 --
37882 xla_ae_lines_pkg.SetAcctLineType
37883 (p_component_type => l_component_type
37884 ,p_event_type_code => l_event_type_code
37885 ,p_line_definition_owner_code => l_line_definition_owner_code
37886 ,p_line_definition_code => l_line_definition_code
37887 ,p_accounting_line_code => l_component_code
37888 ,p_accounting_line_type_code => l_component_type_code
37889 ,p_accounting_line_appl_id => l_component_appl_id
37890 ,p_amb_context_code => l_amb_context_code
37891 ,p_entity_code => l_entity_code
37892 ,p_event_class_code => l_event_class_code);
37893 --
37894 -- set accounting class
37895 --
37896 xla_ae_lines_pkg.SetAcctClass(
37897 p_accounting_class_code => 'ASSET'
37898 , p_ae_header_id => l_ae_header_id
37899 );
37900
37901 --
37902 -- set rounding class
37903 --
37904 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
37905 'ASSET';
37906
37907 --
37908 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
37909 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
37910 --
37911 -- bulk performance
37912 --
37913 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
37914
37915 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
37916 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
37917
37918 -- 4955764
37919 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
37920 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
37921
37922 -- 4458381 Public Sector Enh
37923
37924 --
37925 -- set accounting attributes for the line type
37926 --
37927 l_entered_amt_idx := 4;
37928 l_accted_amt_idx := 6;
37929 l_bflow_applied_to_amt_idx := NULL; -- 5132302
37930 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
37931 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
37932 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
37933 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
37934 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
37935 l_rec_acct_attrs.array_char_value(3) := p_source_51;
37936 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
37937 l_rec_acct_attrs.array_num_value(4) := p_source_52;
37938 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
37939 l_rec_acct_attrs.array_char_value(5) := p_source_53;
37940 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
37941 l_rec_acct_attrs.array_num_value(6) := p_source_52;
37942
37946 ---------------------------------------------------------------------------------------------------------------
37943 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
37944 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
37945
37947 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
37948 ---------------------------------------------------------------------------------------------------------------
37949 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
37950
37951 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
37952 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
37953
37954 IF xla_accounting_cache_pkg.GetValueChar
37955 (p_source_code => 'LEDGER_CATEGORY_CODE'
37956 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
37957 AND l_bflow_method_code = 'PRIOR_ENTRY'
37958 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
37959 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
37960 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
37961 )
37962 THEN
37963 xla_ae_lines_pkg.BflowUpgEntry
37964 (p_business_method_code => l_bflow_method_code
37965 ,p_business_class_code => l_bflow_class_code
37966 ,p_balance_type => l_balance_type_code);
37967 ELSE
37968 NULL;
37969 -- No business flow processing for business flow method of NONE.
37970 END IF;
37971
37972 --
37973 -- call analytical criteria
37974 --
37975
37976 --
37977 -- call description
37978 --
37979
37980 xla_ae_lines_pkg.SetLineDescription(
37981 p_ae_header_id => l_ae_header_id
37982 ,p_description => Description_22 (
37983 p_application_id => p_application_id
37984 , p_ae_header_id => l_ae_header_id
37985 , p_source_1 => p_source_1
37986 )
37987 );
37988
37989
37990 --
37991 -- call ADRs
37992 -- Bug 4922099
37993 --
37994 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
37995 (NVL(l_actual_upg_option, 'N') = 'O') OR
37996 (NVL(l_enc_upg_option, 'N') = 'O')
37997 )
37998 THEN
37999 NULL;
38000 --
38001 --
38002
38003 l_ccid := AcctDerRule_175(
38004 p_application_id => p_application_id
38005 , p_ae_header_id => l_ae_header_id
38006 , p_source_5 => p_source_5
38007 , p_source_19 => p_source_19
38008 , p_source_32 => p_source_32
38009 , x_transaction_coa_id => l_adr_transaction_coa_id
38010 , x_accounting_coa_id => l_adr_accounting_coa_id
38011 , x_value_type_code => l_adr_value_type_code
38012 , p_side => 'NA'
38013 );
38014
38015 xla_ae_lines_pkg.set_ccid(
38016 p_code_combination_id => l_ccid
38017 , p_value_type_code => l_adr_value_type_code
38018 , p_transaction_coa_id => l_adr_transaction_coa_id
38019 , p_accounting_coa_id => l_adr_accounting_coa_id
38020 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
38021 , p_adr_type_code => 'S'
38022 , p_component_type => l_component_type
38023 , p_component_code => l_component_code
38024 , p_component_type_code => l_component_type_code
38025 , p_component_appl_id => l_component_appl_id
38026 , p_amb_context_code => l_amb_context_code
38027 , p_side => 'NA'
38028 );
38029
38030
38031 l_segment := AcctDerRule_150(
38032 p_application_id => p_application_id
38033 , p_ae_header_id => l_ae_header_id
38034 , p_source_5 => p_source_5
38035 , p_source_12 => p_source_12
38036 , x_transaction_coa_id => l_adr_transaction_coa_id
38037 , x_accounting_coa_id => l_adr_accounting_coa_id
38038 , x_flexfield_segment_code => l_adr_flexfield_segment_code
38039 , x_flex_value_set_id => l_adr_flex_value_set_id
38040 , x_value_type_code => l_adr_value_type_code
38041 , x_value_combination_id => l_adr_value_combination_id
38042 , x_value_segment_code => l_adr_value_segment_code
38043 , p_side => 'NA'
38044 , p_override_seg_flag => 'Y'
38045 );
38046
38047 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
38048
38049 xla_ae_lines_pkg.set_segment(
38050 p_to_segment_code => 'GL_ACCOUNT'
38051 , p_segment_value => l_segment
38052 , p_from_segment_code => l_adr_value_segment_code
38053 , p_from_combination_id => l_adr_value_combination_id
38054 , p_value_type_code => l_adr_value_type_code
38055 , p_transaction_coa_id => l_adr_transaction_coa_id
38056 , p_accounting_coa_id => l_adr_accounting_coa_id
38057 , p_flexfield_segment_code => l_adr_flexfield_segment_code
38058 , p_flex_value_set_id => l_adr_flex_value_set_id
38059 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
38063 , p_component_type_code => l_component_type_code
38060 , p_adr_type_code => 'S'
38061 , p_component_type => l_component_type
38062 , p_component_code => l_component_code
38064 , p_component_appl_id => l_component_appl_id
38065 , p_amb_context_code => l_amb_context_code
38066 , p_entity_code => 'TRANSACTIONS'
38067 , p_event_class_code => 'CAPITALIZATION'
38068 , p_side => 'NA'
38069 );
38070
38071 END IF;
38072
38073 l_segment := AcctDerRule_169(
38074 p_application_id => p_application_id
38075 , p_ae_header_id => l_ae_header_id
38076 , p_source_5 => p_source_5
38077 , p_source_31 => p_source_31
38078 , x_transaction_coa_id => l_adr_transaction_coa_id
38079 , x_accounting_coa_id => l_adr_accounting_coa_id
38080 , x_flexfield_segment_code => l_adr_flexfield_segment_code
38081 , x_flex_value_set_id => l_adr_flex_value_set_id
38082 , x_value_type_code => l_adr_value_type_code
38083 , x_value_combination_id => l_adr_value_combination_id
38084 , x_value_segment_code => l_adr_value_segment_code
38085 , p_side => 'NA'
38086 , p_override_seg_flag => 'Y'
38087 );
38088
38089 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
38090
38091 xla_ae_lines_pkg.set_segment(
38092 p_to_segment_code => 'GL_BALANCING'
38093 , p_segment_value => l_segment
38094 , p_from_segment_code => l_adr_value_segment_code
38095 , p_from_combination_id => l_adr_value_combination_id
38096 , p_value_type_code => l_adr_value_type_code
38097 , p_transaction_coa_id => l_adr_transaction_coa_id
38098 , p_accounting_coa_id => l_adr_accounting_coa_id
38099 , p_flexfield_segment_code => l_adr_flexfield_segment_code
38100 , p_flex_value_set_id => l_adr_flex_value_set_id
38101 , p_adr_code => 'FA_EXPENSE_ACCT'
38102 , p_adr_type_code => 'S'
38103 , p_component_type => l_component_type
38104 , p_component_code => l_component_code
38105 , p_component_type_code => l_component_type_code
38106 , p_component_appl_id => l_component_appl_id
38107 , p_amb_context_code => l_amb_context_code
38108 , p_entity_code => 'TRANSACTIONS'
38109 , p_event_class_code => 'CAPITALIZATION'
38110 , p_side => 'NA'
38111 );
38112
38113 END IF;
38114
38115 --
38116 --
38117 END IF;
38118 --
38119 -- Bug 4922099
38120 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
38121 (NVL(l_enc_upg_option, 'N') = 'O')
38122 ) AND
38123 (l_bflow_method_code = 'PRIOR_ENTRY')
38124 )
38125 THEN
38126 IF
38127 --
38128 1 = 2
38129 --
38130 THEN
38131 xla_accounting_err_pkg.build_message
38132 (p_appli_s_name => 'XLA'
38133 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
38134 ,p_token_1 => 'LINE_NUMBER'
38135 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
38136 ,p_token_2 => 'LINE_TYPE_NAME'
38137 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
38138 l_component_type
38139 ,l_component_code
38140 ,l_component_type_code
38141 ,l_component_appl_id
38142 ,l_amb_context_code
38143 ,l_entity_code
38144 ,l_event_class_code
38145 )
38146 ,p_token_3 => 'OWNER'
38147 ,p_value_3 => xla_lookups_pkg.get_meaning(
38148 p_lookup_type => 'XLA_OWNER_TYPE'
38149 ,p_lookup_code => l_component_type_code
38150 )
38151 ,p_token_4 => 'PRODUCT_NAME'
38152 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
38153 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
38154 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
38155 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
38159 IF (C_LEVEL_ERROR>= g_log_level) THEN
38156 ,p_ae_header_id => NULL
38157 );
38158
38160 trace
38161 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
38162 ,p_level => C_LEVEL_ERROR
38163 ,p_module => l_log_module);
38164 END IF;
38165 END IF;
38166 END IF;
38167 --
38168 --
38169 ------------------------------------------------------------------------------------------------
38170 -- 4219869 Business Flow
38171 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
38172 -- Prior Entry. Currently, the following code is always generated.
38173 ------------------------------------------------------------------------------------------------
38174 XLA_AE_LINES_PKG.ValidateCurrentLine;
38175
38176 ------------------------------------------------------------------------------------
38177 -- 4219869 Business Flow
38178 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
38179 ------------------------------------------------------------------------------------
38180 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
38181
38182 ----------------------------------------------------------------------------------
38183 -- 4219869 Business Flow
38184 -- Update journal entry status -- Need to generate this within IF <condition>
38185 ----------------------------------------------------------------------------------
38186 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
38187 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
38188 ,p_balance_type_code => l_balance_type_code
38189 );
38190
38191 -------------------------------------------------------------------------------------------
38192 -- 4262811 - Generate the Accrual Reversal lines
38193 -------------------------------------------------------------------------------------------
38194 BEGIN
38195 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
38196 (g_array_event(p_event_id).array_value_num('header_index'));
38197 IF l_acc_rev_flag IS NULL THEN
38198 l_acc_rev_flag := 'N';
38199 END IF;
38200 EXCEPTION
38201 WHEN OTHERS THEN
38202 l_acc_rev_flag := 'N';
38203 END;
38204 --
38205 IF (l_acc_rev_flag = 'Y') THEN
38206
38207 -- 4645092 ------------------------------------------------------------------------------
38208 -- To allow MPA report to determine if it should generate report process
38209 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
38210 ------------------------------------------------------------------------------------------
38211
38212 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
38213 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
38214 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
38215 -- call ADRs
38216 -- Bug 4922099
38217 --
38218 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
38219 (NVL(l_actual_upg_option, 'N') = 'O') OR
38220 (NVL(l_enc_upg_option, 'N') = 'O')
38221 )
38222 THEN
38223 NULL;
38224 --
38225 --
38226
38227 l_ccid := AcctDerRule_175(
38228 p_application_id => p_application_id
38229 , p_ae_header_id => l_ae_header_id
38230 , p_source_5 => p_source_5
38231 , p_source_19 => p_source_19
38232 , p_source_32 => p_source_32
38233 , x_transaction_coa_id => l_adr_transaction_coa_id
38234 , x_accounting_coa_id => l_adr_accounting_coa_id
38235 , x_value_type_code => l_adr_value_type_code
38236 , p_side => 'NA'
38237 );
38238
38239 xla_ae_lines_pkg.set_ccid(
38240 p_code_combination_id => l_ccid
38241 , p_value_type_code => l_adr_value_type_code
38242 , p_transaction_coa_id => l_adr_transaction_coa_id
38243 , p_accounting_coa_id => l_adr_accounting_coa_id
38244 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
38245 , p_adr_type_code => 'S'
38246 , p_component_type => l_component_type
38247 , p_component_code => l_component_code
38248 , p_component_type_code => l_component_type_code
38249 , p_component_appl_id => l_component_appl_id
38250 , p_amb_context_code => l_amb_context_code
38251 , p_side => 'NA'
38252 );
38253
38254
38255 l_segment := AcctDerRule_150(
38256 p_application_id => p_application_id
38257 , p_ae_header_id => l_ae_header_id
38258 , p_source_5 => p_source_5
38259 , p_source_12 => p_source_12
38260 , x_transaction_coa_id => l_adr_transaction_coa_id
38261 , x_accounting_coa_id => l_adr_accounting_coa_id
38262 , x_flexfield_segment_code => l_adr_flexfield_segment_code
38263 , x_flex_value_set_id => l_adr_flex_value_set_id
38264 , x_value_type_code => l_adr_value_type_code
38265 , x_value_combination_id => l_adr_value_combination_id
38266 , x_value_segment_code => l_adr_value_segment_code
38267 , p_side => 'NA'
38271 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
38268 , p_override_seg_flag => 'Y'
38269 );
38270
38272
38273 xla_ae_lines_pkg.set_segment(
38274 p_to_segment_code => 'GL_ACCOUNT'
38275 , p_segment_value => l_segment
38276 , p_from_segment_code => l_adr_value_segment_code
38277 , p_from_combination_id => l_adr_value_combination_id
38278 , p_value_type_code => l_adr_value_type_code
38279 , p_transaction_coa_id => l_adr_transaction_coa_id
38280 , p_accounting_coa_id => l_adr_accounting_coa_id
38281 , p_flexfield_segment_code => l_adr_flexfield_segment_code
38282 , p_flex_value_set_id => l_adr_flex_value_set_id
38283 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
38284 , p_adr_type_code => 'S'
38285 , p_component_type => l_component_type
38286 , p_component_code => l_component_code
38287 , p_component_type_code => l_component_type_code
38288 , p_component_appl_id => l_component_appl_id
38289 , p_amb_context_code => l_amb_context_code
38290 , p_entity_code => 'TRANSACTIONS'
38291 , p_event_class_code => 'CAPITALIZATION'
38292 , p_side => 'NA'
38293 );
38294
38295 END IF;
38296
38297 l_segment := AcctDerRule_169(
38298 p_application_id => p_application_id
38299 , p_ae_header_id => l_ae_header_id
38300 , p_source_5 => p_source_5
38301 , p_source_31 => p_source_31
38302 , x_transaction_coa_id => l_adr_transaction_coa_id
38303 , x_accounting_coa_id => l_adr_accounting_coa_id
38304 , x_flexfield_segment_code => l_adr_flexfield_segment_code
38305 , x_flex_value_set_id => l_adr_flex_value_set_id
38306 , x_value_type_code => l_adr_value_type_code
38307 , x_value_combination_id => l_adr_value_combination_id
38308 , x_value_segment_code => l_adr_value_segment_code
38309 , p_side => 'NA'
38310 , p_override_seg_flag => 'Y'
38311 );
38312
38313 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
38314
38315 xla_ae_lines_pkg.set_segment(
38316 p_to_segment_code => 'GL_BALANCING'
38317 , p_segment_value => l_segment
38318 , p_from_segment_code => l_adr_value_segment_code
38319 , p_from_combination_id => l_adr_value_combination_id
38320 , p_value_type_code => l_adr_value_type_code
38321 , p_transaction_coa_id => l_adr_transaction_coa_id
38322 , p_accounting_coa_id => l_adr_accounting_coa_id
38323 , p_flexfield_segment_code => l_adr_flexfield_segment_code
38324 , p_flex_value_set_id => l_adr_flex_value_set_id
38325 , p_adr_code => 'FA_EXPENSE_ACCT'
38326 , p_adr_type_code => 'S'
38327 , p_component_type => l_component_type
38328 , p_component_code => l_component_code
38329 , p_component_type_code => l_component_type_code
38330 , p_component_appl_id => l_component_appl_id
38331 , p_amb_context_code => l_amb_context_code
38332 , p_entity_code => 'TRANSACTIONS'
38333 , p_event_class_code => 'CAPITALIZATION'
38334 , p_side => 'NA'
38335 );
38336
38337 END IF;
38338
38339 --
38340 --
38341 END IF;
38342
38343 --
38344 -- Update the line information that should be overwritten
38345 --
38346 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
38347 p_header_num => 1);
38348 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
38349
38350 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
38351
38352 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
38353 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
38354 END IF;
38355
38356 --
38357 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
38358 --
38359 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
38360 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
38361 ELSE
38362 ---------------------------------------------------------------------------------------------------
38363 -- 4262811a Switch Sign
38364 ---------------------------------------------------------------------------------------------------
38365 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
38366 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
38367 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
38368 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
38372 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
38369 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
38370 -- 5132302
38371 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
38373
38374 END IF;
38375
38376 -- 4955764
38377 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
38378 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
38379
38380
38381 XLA_AE_LINES_PKG.ValidateCurrentLine;
38382 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
38383
38384 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
38385 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
38386 ,p_balance_type_code => l_balance_type_code);
38387
38388 END IF;
38389
38390 -----------------------------------------------------------------------------------------
38391 -- 4262811 Multiperiod Accounting
38392 -----------------------------------------------------------------------------------------
38393 -- No MPA option is assigned.
38394
38395
38396 END IF;
38397 END IF;
38398 --
38399
38400 --
38401 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
38402 trace
38403 (p_msg => 'END of AcctLineType_218'
38404 ,p_level => C_LEVEL_PROCEDURE
38405 ,p_module => l_log_module);
38406 END IF;
38407 --
38408 EXCEPTION
38409 WHEN xla_exceptions_pkg.application_exception THEN
38410 RAISE;
38411 WHEN OTHERS THEN
38412 xla_exceptions_pkg.raise_message
38413 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_218');
38414 END AcctLineType_218;
38415 --
38416
38417 ---------------------------------------
38418 --
38419 -- PRIVATE FUNCTION
38420 -- AcctLineType_219
38421 --
38422 ---------------------------------------
38423 PROCEDURE AcctLineType_219 (
38424 p_application_id IN NUMBER
38425 ,p_event_id IN NUMBER
38426 ,p_calculate_acctd_flag IN VARCHAR2
38427 ,p_calculate_g_l_flag IN VARCHAR2
38428 ,p_actual_flag IN OUT VARCHAR2
38429 ,p_balance_type_code OUT VARCHAR2
38430 ,p_gain_or_loss_ref OUT VARCHAR2
38431
38432 --Period Close Date
38433 , p_source_1 IN DATE
38434 --Generated Code Combination Identifier
38435 , p_source_5 IN NUMBER
38436 --CIP Cost Account
38437 , p_source_9 IN VARCHAR2
38438 --Expense Account Code Combination Identifier
38439 , p_source_31 IN NUMBER
38440 --Default Code Combination Identifier
38441 , p_source_32 IN NUMBER
38442 --Adjustment Type
38443 , p_source_48 IN VARCHAR2
38444 --Transaction Header Identifier
38445 , p_source_49 IN NUMBER
38446 --Adjustment Line Identifier
38447 , p_source_50 IN NUMBER
38448 --Distribution Type Code
38449 , p_source_51 IN VARCHAR2
38450 --Entered Amount
38451 , p_source_52 IN NUMBER
38452 --Currency Code
38453 , p_source_53 IN VARCHAR2
38454 )
38455 IS
38456
38457 l_component_type VARCHAR2(80);
38458 l_component_code VARCHAR2(30);
38459 l_component_type_code VARCHAR2(1);
38460 l_component_appl_id INTEGER;
38461 l_amb_context_code VARCHAR2(30);
38462 l_entity_code VARCHAR2(30);
38463 l_event_class_code VARCHAR2(30);
38464 l_ae_header_id NUMBER;
38465 l_event_type_code VARCHAR2(30);
38466 l_line_definition_code VARCHAR2(30);
38467 l_line_definition_owner_code VARCHAR2(1);
38468 --
38469 -- adr variables
38470 l_segment VARCHAR2(30);
38471 l_ccid NUMBER;
38472 l_adr_transaction_coa_id NUMBER;
38473 l_adr_accounting_coa_id NUMBER;
38474 l_adr_flexfield_segment_code VARCHAR2(30);
38475 l_adr_flex_value_set_id NUMBER;
38476 l_adr_value_type_code VARCHAR2(30);
38477 l_adr_value_combination_id NUMBER;
38478 l_adr_value_segment_code VARCHAR2(30);
38479
38480 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
38481 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
38482 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
38483 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
38484
38485 -- 4262811 Variables ------------------------------------------------------------------------------------------
38486 l_entered_amt_idx NUMBER;
38487 l_accted_amt_idx NUMBER;
38488 l_acc_rev_flag VARCHAR2(1);
38489 l_accrual_line_num NUMBER;
38490 l_tmp_amt NUMBER;
38491 l_acc_rev_natural_side_code VARCHAR2(1);
38492
38493 l_num_entries NUMBER;
38494 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
38495 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
38496 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
38497 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
38498 l_recog_line_1 NUMBER;
38499 l_recog_line_2 NUMBER;
38500
38501 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
38505 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
38502 l_bflow_applied_to_amt NUMBER; -- 5132302
38503 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
38504
38506
38507 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
38508 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
38509
38510 ---------------------------------------------------------------------------------------------------------------
38511
38512
38513 --
38514 -- bulk performance
38515 --
38516 l_balance_type_code VARCHAR2(1);
38517 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
38518 l_log_module VARCHAR2(240);
38519
38520 --
38521 -- Upgrade strategy
38522 --
38523 l_actual_upg_option VARCHAR2(1);
38524 l_enc_upg_option VARCHAR2(1);
38525
38526 --
38527 BEGIN
38528 --
38529 IF g_log_enabled THEN
38530 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_219';
38531 END IF;
38532 --
38533 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
38534
38535 trace
38536 (p_msg => 'BEGIN of AcctLineType_219'
38537 ,p_level => C_LEVEL_PROCEDURE
38538 ,p_module => l_log_module);
38539
38540 END IF;
38541 --
38542 l_component_type := 'AMB_JLT';
38543 l_component_code := 'FA_CIP_ADD_COST';
38544 l_component_type_code := 'S';
38545 l_component_appl_id := 140;
38546 l_amb_context_code := 'DEFAULT';
38547 l_entity_code := 'TRANSACTIONS';
38548 l_event_class_code := 'CIP_ADDITIONS';
38549 l_event_type_code := 'CIP_ADDITIONS_ALL';
38550 l_line_definition_owner_code := 'S';
38551 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_AD5';
38552 --
38553 l_balance_type_code := 'A';
38554 l_segment := NULL;
38555 l_ccid := NULL;
38556 l_adr_transaction_coa_id := NULL;
38557 l_adr_accounting_coa_id := NULL;
38558 l_adr_flexfield_segment_code := NULL;
38559 l_adr_flex_value_set_id := NULL;
38560 l_adr_value_type_code := NULL;
38561 l_adr_value_combination_id := NULL;
38562 l_adr_value_segment_code := NULL;
38563
38564 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
38565 l_bflow_class_code := ''; -- 4219869 Business Flow
38566 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
38567 l_budgetary_control_flag := 'N';
38568
38569 l_bflow_applied_to_amt_idx := NULL; -- 5132302
38570 l_bflow_applied_to_amt := NULL; -- 5132302
38571 l_entered_amt_idx := NULL; -- 4262811
38572 l_accted_amt_idx := NULL; -- 4262811
38573 l_acc_rev_flag := NULL; -- 4262811
38574 l_accrual_line_num := NULL; -- 4262811
38575 l_tmp_amt := NULL; -- 4262811
38576 --
38577
38578 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
38579 l_balance_type_code <> 'B' THEN
38580 IF NVL(p_source_48,'
38581 ') = 'CIP COST'
38582 THEN
38583
38584 --
38585 XLA_AE_LINES_PKG.SetNewLine;
38586
38587 p_balance_type_code := l_balance_type_code;
38588 -- set the flag so later we will know whether the gain loss line needs to be created
38589
38590 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
38591 p_actual_flag :='A';
38592 END IF;
38593
38594 --
38595 -- bulk performance
38596 --
38597 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
38598 p_header_num => 0); -- 4262811
38599 --
38600 -- set accounting line options
38601 --
38602 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
38603 p_natural_side_code => 'D'
38604 , p_gain_or_loss_flag => 'N'
38605 , p_gl_transfer_mode_code => 'S'
38606 , p_acct_entry_type_code => 'A'
38607 , p_switch_side_flag => 'Y'
38608 , p_merge_duplicate_code => 'N'
38609 );
38610 --
38611 l_acc_rev_natural_side_code := 'C'; -- 4262811
38612 --
38613 --
38614 -- set accounting line type info
38615 --
38616 xla_ae_lines_pkg.SetAcctLineType
38617 (p_component_type => l_component_type
38618 ,p_event_type_code => l_event_type_code
38619 ,p_line_definition_owner_code => l_line_definition_owner_code
38620 ,p_line_definition_code => l_line_definition_code
38621 ,p_accounting_line_code => l_component_code
38622 ,p_accounting_line_type_code => l_component_type_code
38623 ,p_accounting_line_appl_id => l_component_appl_id
38624 ,p_amb_context_code => l_amb_context_code
38625 ,p_entity_code => l_entity_code
38626 ,p_event_class_code => l_event_class_code);
38627 --
38628 -- set accounting class
38629 --
38630 xla_ae_lines_pkg.SetAcctClass(
38631 p_accounting_class_code => 'ASSET'
38632 , p_ae_header_id => l_ae_header_id
38633 );
38634
38635 --
38639 'ASSET';
38636 -- set rounding class
38637 --
38638 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
38640
38641 --
38642 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
38643 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
38644 --
38645 -- bulk performance
38646 --
38647 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
38648
38649 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
38650 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
38651
38652 -- 4955764
38653 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
38654 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
38655
38656 -- 4458381 Public Sector Enh
38657
38658 --
38659 -- set accounting attributes for the line type
38660 --
38661 l_entered_amt_idx := 4;
38662 l_accted_amt_idx := 6;
38663 l_bflow_applied_to_amt_idx := NULL; -- 5132302
38664 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
38665 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
38666 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
38667 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
38668 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
38669 l_rec_acct_attrs.array_char_value(3) := p_source_51;
38670 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
38671 l_rec_acct_attrs.array_num_value(4) := p_source_52;
38672 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
38673 l_rec_acct_attrs.array_char_value(5) := p_source_53;
38674 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
38675 l_rec_acct_attrs.array_num_value(6) := p_source_52;
38676
38677 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
38678 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
38679
38680 ---------------------------------------------------------------------------------------------------------------
38681 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
38682 ---------------------------------------------------------------------------------------------------------------
38683 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
38684
38685 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
38686 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
38687
38688 IF xla_accounting_cache_pkg.GetValueChar
38689 (p_source_code => 'LEDGER_CATEGORY_CODE'
38690 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
38691 AND l_bflow_method_code = 'PRIOR_ENTRY'
38692 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
38693 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
38694 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
38695 )
38696 THEN
38697 xla_ae_lines_pkg.BflowUpgEntry
38698 (p_business_method_code => l_bflow_method_code
38699 ,p_business_class_code => l_bflow_class_code
38700 ,p_balance_type => l_balance_type_code);
38701 ELSE
38702 NULL;
38703 -- No business flow processing for business flow method of NONE.
38704 END IF;
38705
38706 --
38707 -- call analytical criteria
38708 --
38709
38710 --
38711 -- call description
38712 --
38713
38714 xla_ae_lines_pkg.SetLineDescription(
38715 p_ae_header_id => l_ae_header_id
38716 ,p_description => Description_24 (
38717 p_application_id => p_application_id
38718 , p_ae_header_id => l_ae_header_id
38719 , p_source_1 => p_source_1
38720 )
38721 );
38722
38723
38724 --
38725 -- call ADRs
38726 -- Bug 4922099
38727 --
38728 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
38729 (NVL(l_actual_upg_option, 'N') = 'O') OR
38730 (NVL(l_enc_upg_option, 'N') = 'O')
38731 )
38732 THEN
38733 NULL;
38734 --
38735 --
38736
38737 l_ccid := AcctDerRule_174(
38738 p_application_id => p_application_id
38739 , p_ae_header_id => l_ae_header_id
38740 , p_source_5 => p_source_5
38741 , p_source_32 => p_source_32
38742 , x_transaction_coa_id => l_adr_transaction_coa_id
38743 , x_accounting_coa_id => l_adr_accounting_coa_id
38744 , x_value_type_code => l_adr_value_type_code
38745 , p_side => 'NA'
38746 );
38747
38748 xla_ae_lines_pkg.set_ccid(
38749 p_code_combination_id => l_ccid
38750 , p_value_type_code => l_adr_value_type_code
38751 , p_transaction_coa_id => l_adr_transaction_coa_id
38752 , p_accounting_coa_id => l_adr_accounting_coa_id
38753 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
38754 , p_adr_type_code => 'S'
38758 , p_component_appl_id => l_component_appl_id
38755 , p_component_type => l_component_type
38756 , p_component_code => l_component_code
38757 , p_component_type_code => l_component_type_code
38759 , p_amb_context_code => l_amb_context_code
38760 , p_side => 'NA'
38761 );
38762
38763
38764 l_segment := AcctDerRule_147(
38765 p_application_id => p_application_id
38766 , p_ae_header_id => l_ae_header_id
38767 , p_source_5 => p_source_5
38768 , p_source_9 => p_source_9
38769 , x_transaction_coa_id => l_adr_transaction_coa_id
38770 , x_accounting_coa_id => l_adr_accounting_coa_id
38771 , x_flexfield_segment_code => l_adr_flexfield_segment_code
38772 , x_flex_value_set_id => l_adr_flex_value_set_id
38773 , x_value_type_code => l_adr_value_type_code
38774 , x_value_combination_id => l_adr_value_combination_id
38775 , x_value_segment_code => l_adr_value_segment_code
38776 , p_side => 'NA'
38777 , p_override_seg_flag => 'Y'
38778 );
38779
38780 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
38781
38782 xla_ae_lines_pkg.set_segment(
38783 p_to_segment_code => 'GL_ACCOUNT'
38784 , p_segment_value => l_segment
38785 , p_from_segment_code => l_adr_value_segment_code
38786 , p_from_combination_id => l_adr_value_combination_id
38787 , p_value_type_code => l_adr_value_type_code
38788 , p_transaction_coa_id => l_adr_transaction_coa_id
38789 , p_accounting_coa_id => l_adr_accounting_coa_id
38790 , p_flexfield_segment_code => l_adr_flexfield_segment_code
38791 , p_flex_value_set_id => l_adr_flex_value_set_id
38792 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
38793 , p_adr_type_code => 'S'
38794 , p_component_type => l_component_type
38795 , p_component_code => l_component_code
38796 , p_component_type_code => l_component_type_code
38797 , p_component_appl_id => l_component_appl_id
38798 , p_amb_context_code => l_amb_context_code
38799 , p_entity_code => 'TRANSACTIONS'
38800 , p_event_class_code => 'CIP_ADDITIONS'
38801 , p_side => 'NA'
38802 );
38803
38804 END IF;
38805
38806 l_segment := AcctDerRule_169(
38807 p_application_id => p_application_id
38808 , p_ae_header_id => l_ae_header_id
38809 , p_source_5 => p_source_5
38810 , p_source_31 => p_source_31
38811 , x_transaction_coa_id => l_adr_transaction_coa_id
38812 , x_accounting_coa_id => l_adr_accounting_coa_id
38813 , x_flexfield_segment_code => l_adr_flexfield_segment_code
38814 , x_flex_value_set_id => l_adr_flex_value_set_id
38815 , x_value_type_code => l_adr_value_type_code
38816 , x_value_combination_id => l_adr_value_combination_id
38817 , x_value_segment_code => l_adr_value_segment_code
38818 , p_side => 'NA'
38819 , p_override_seg_flag => 'Y'
38820 );
38821
38822 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
38823
38824 xla_ae_lines_pkg.set_segment(
38825 p_to_segment_code => 'GL_BALANCING'
38826 , p_segment_value => l_segment
38827 , p_from_segment_code => l_adr_value_segment_code
38828 , p_from_combination_id => l_adr_value_combination_id
38829 , p_value_type_code => l_adr_value_type_code
38830 , p_transaction_coa_id => l_adr_transaction_coa_id
38831 , p_accounting_coa_id => l_adr_accounting_coa_id
38832 , p_flexfield_segment_code => l_adr_flexfield_segment_code
38833 , p_flex_value_set_id => l_adr_flex_value_set_id
38834 , p_adr_code => 'FA_EXPENSE_ACCT'
38835 , p_adr_type_code => 'S'
38836 , p_component_type => l_component_type
38837 , p_component_code => l_component_code
38838 , p_component_type_code => l_component_type_code
38839 , p_component_appl_id => l_component_appl_id
38840 , p_amb_context_code => l_amb_context_code
38841 , p_entity_code => 'TRANSACTIONS'
38842 , p_event_class_code => 'CIP_ADDITIONS'
38843 , p_side => 'NA'
38844 );
38845
38846 END IF;
38847
38848 --
38849 --
38850 END IF;
38851 --
38852 -- Bug 4922099
38853 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
38854 (NVL(l_enc_upg_option, 'N') = 'O')
38855 ) AND
38856 (l_bflow_method_code = 'PRIOR_ENTRY')
38857 )
38858 THEN
38859 IF
38860 --
38861 1 = 2
38862 --
38863 THEN
38864 xla_accounting_err_pkg.build_message
38865 (p_appli_s_name => 'XLA'
38866 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
38867 ,p_token_1 => 'LINE_NUMBER'
38871 l_component_type
38868 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
38869 ,p_token_2 => 'LINE_TYPE_NAME'
38870 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
38872 ,l_component_code
38873 ,l_component_type_code
38874 ,l_component_appl_id
38875 ,l_amb_context_code
38876 ,l_entity_code
38877 ,l_event_class_code
38878 )
38879 ,p_token_3 => 'OWNER'
38880 ,p_value_3 => xla_lookups_pkg.get_meaning(
38881 p_lookup_type => 'XLA_OWNER_TYPE'
38882 ,p_lookup_code => l_component_type_code
38883 )
38884 ,p_token_4 => 'PRODUCT_NAME'
38885 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
38886 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
38887 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
38888 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
38889 ,p_ae_header_id => NULL
38890 );
38891
38892 IF (C_LEVEL_ERROR>= g_log_level) THEN
38893 trace
38894 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
38895 ,p_level => C_LEVEL_ERROR
38896 ,p_module => l_log_module);
38897 END IF;
38898 END IF;
38899 END IF;
38900 --
38901 --
38902 ------------------------------------------------------------------------------------------------
38903 -- 4219869 Business Flow
38904 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
38905 -- Prior Entry. Currently, the following code is always generated.
38906 ------------------------------------------------------------------------------------------------
38907 XLA_AE_LINES_PKG.ValidateCurrentLine;
38908
38909 ------------------------------------------------------------------------------------
38910 -- 4219869 Business Flow
38911 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
38912 ------------------------------------------------------------------------------------
38913 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
38914
38915 ----------------------------------------------------------------------------------
38916 -- 4219869 Business Flow
38917 -- Update journal entry status -- Need to generate this within IF <condition>
38918 ----------------------------------------------------------------------------------
38919 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
38920 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
38921 ,p_balance_type_code => l_balance_type_code
38922 );
38923
38924 -------------------------------------------------------------------------------------------
38925 -- 4262811 - Generate the Accrual Reversal lines
38926 -------------------------------------------------------------------------------------------
38927 BEGIN
38928 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
38929 (g_array_event(p_event_id).array_value_num('header_index'));
38930 IF l_acc_rev_flag IS NULL THEN
38931 l_acc_rev_flag := 'N';
38932 END IF;
38933 EXCEPTION
38934 WHEN OTHERS THEN
38935 l_acc_rev_flag := 'N';
38936 END;
38937 --
38938 IF (l_acc_rev_flag = 'Y') THEN
38939
38940 -- 4645092 ------------------------------------------------------------------------------
38941 -- To allow MPA report to determine if it should generate report process
38942 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
38943 ------------------------------------------------------------------------------------------
38944
38945 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
38946 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
38947 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
38948 -- call ADRs
38949 -- Bug 4922099
38950 --
38951 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
38952 (NVL(l_actual_upg_option, 'N') = 'O') OR
38953 (NVL(l_enc_upg_option, 'N') = 'O')
38954 )
38955 THEN
38956 NULL;
38957 --
38958 --
38959
38960 l_ccid := AcctDerRule_174(
38964 , p_source_32 => p_source_32
38961 p_application_id => p_application_id
38962 , p_ae_header_id => l_ae_header_id
38963 , p_source_5 => p_source_5
38965 , x_transaction_coa_id => l_adr_transaction_coa_id
38966 , x_accounting_coa_id => l_adr_accounting_coa_id
38967 , x_value_type_code => l_adr_value_type_code
38968 , p_side => 'NA'
38969 );
38970
38971 xla_ae_lines_pkg.set_ccid(
38972 p_code_combination_id => l_ccid
38973 , p_value_type_code => l_adr_value_type_code
38974 , p_transaction_coa_id => l_adr_transaction_coa_id
38975 , p_accounting_coa_id => l_adr_accounting_coa_id
38976 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
38977 , p_adr_type_code => 'S'
38978 , p_component_type => l_component_type
38979 , p_component_code => l_component_code
38980 , p_component_type_code => l_component_type_code
38981 , p_component_appl_id => l_component_appl_id
38982 , p_amb_context_code => l_amb_context_code
38983 , p_side => 'NA'
38984 );
38985
38986
38987 l_segment := AcctDerRule_147(
38988 p_application_id => p_application_id
38989 , p_ae_header_id => l_ae_header_id
38990 , p_source_5 => p_source_5
38991 , p_source_9 => p_source_9
38992 , x_transaction_coa_id => l_adr_transaction_coa_id
38993 , x_accounting_coa_id => l_adr_accounting_coa_id
38994 , x_flexfield_segment_code => l_adr_flexfield_segment_code
38995 , x_flex_value_set_id => l_adr_flex_value_set_id
38996 , x_value_type_code => l_adr_value_type_code
38997 , x_value_combination_id => l_adr_value_combination_id
38998 , x_value_segment_code => l_adr_value_segment_code
38999 , p_side => 'NA'
39000 , p_override_seg_flag => 'Y'
39001 );
39002
39003 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
39004
39005 xla_ae_lines_pkg.set_segment(
39006 p_to_segment_code => 'GL_ACCOUNT'
39007 , p_segment_value => l_segment
39008 , p_from_segment_code => l_adr_value_segment_code
39009 , p_from_combination_id => l_adr_value_combination_id
39010 , p_value_type_code => l_adr_value_type_code
39011 , p_transaction_coa_id => l_adr_transaction_coa_id
39012 , p_accounting_coa_id => l_adr_accounting_coa_id
39013 , p_flexfield_segment_code => l_adr_flexfield_segment_code
39014 , p_flex_value_set_id => l_adr_flex_value_set_id
39015 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
39016 , p_adr_type_code => 'S'
39017 , p_component_type => l_component_type
39018 , p_component_code => l_component_code
39019 , p_component_type_code => l_component_type_code
39020 , p_component_appl_id => l_component_appl_id
39021 , p_amb_context_code => l_amb_context_code
39022 , p_entity_code => 'TRANSACTIONS'
39023 , p_event_class_code => 'CIP_ADDITIONS'
39024 , p_side => 'NA'
39025 );
39026
39027 END IF;
39028
39029 l_segment := AcctDerRule_169(
39030 p_application_id => p_application_id
39031 , p_ae_header_id => l_ae_header_id
39032 , p_source_5 => p_source_5
39033 , p_source_31 => p_source_31
39034 , x_transaction_coa_id => l_adr_transaction_coa_id
39035 , x_accounting_coa_id => l_adr_accounting_coa_id
39036 , x_flexfield_segment_code => l_adr_flexfield_segment_code
39037 , x_flex_value_set_id => l_adr_flex_value_set_id
39038 , x_value_type_code => l_adr_value_type_code
39039 , x_value_combination_id => l_adr_value_combination_id
39040 , x_value_segment_code => l_adr_value_segment_code
39041 , p_side => 'NA'
39042 , p_override_seg_flag => 'Y'
39043 );
39044
39045 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
39046
39047 xla_ae_lines_pkg.set_segment(
39048 p_to_segment_code => 'GL_BALANCING'
39049 , p_segment_value => l_segment
39050 , p_from_segment_code => l_adr_value_segment_code
39051 , p_from_combination_id => l_adr_value_combination_id
39052 , p_value_type_code => l_adr_value_type_code
39053 , p_transaction_coa_id => l_adr_transaction_coa_id
39054 , p_accounting_coa_id => l_adr_accounting_coa_id
39055 , p_flexfield_segment_code => l_adr_flexfield_segment_code
39056 , p_flex_value_set_id => l_adr_flex_value_set_id
39057 , p_adr_code => 'FA_EXPENSE_ACCT'
39058 , p_adr_type_code => 'S'
39059 , p_component_type => l_component_type
39060 , p_component_code => l_component_code
39061 , p_component_type_code => l_component_type_code
39062 , p_component_appl_id => l_component_appl_id
39063 , p_amb_context_code => l_amb_context_code
39064 , p_entity_code => 'TRANSACTIONS'
39065 , p_event_class_code => 'CIP_ADDITIONS'
39066 , p_side => 'NA'
39067 );
39068
39069 END IF;
39070
39071 --
39072 --
39076 -- Update the line information that should be overwritten
39073 END IF;
39074
39075 --
39077 --
39078 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
39079 p_header_num => 1);
39080 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
39081
39082 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
39083
39084 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
39085 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
39086 END IF;
39087
39088 --
39089 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
39090 --
39091 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
39092 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
39093 ELSE
39094 ---------------------------------------------------------------------------------------------------
39095 -- 4262811a Switch Sign
39096 ---------------------------------------------------------------------------------------------------
39097 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
39098 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
39099 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
39100 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
39101 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
39102 -- 5132302
39103 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
39104 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
39105
39106 END IF;
39107
39108 -- 4955764
39109 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
39110 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
39111
39112
39113 XLA_AE_LINES_PKG.ValidateCurrentLine;
39114 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
39115
39116 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
39117 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
39118 ,p_balance_type_code => l_balance_type_code);
39119
39120 END IF;
39121
39122 -----------------------------------------------------------------------------------------
39123 -- 4262811 Multiperiod Accounting
39124 -----------------------------------------------------------------------------------------
39125 -- No MPA option is assigned.
39126
39127
39128 END IF;
39129 END IF;
39130 --
39131
39132 --
39133 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
39134 trace
39135 (p_msg => 'END of AcctLineType_219'
39136 ,p_level => C_LEVEL_PROCEDURE
39137 ,p_module => l_log_module);
39138 END IF;
39139 --
39140 EXCEPTION
39141 WHEN xla_exceptions_pkg.application_exception THEN
39142 RAISE;
39143 WHEN OTHERS THEN
39144 xla_exceptions_pkg.raise_message
39145 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_219');
39146 END AcctLineType_219;
39147 --
39148
39149 ---------------------------------------
39150 --
39151 -- PRIVATE FUNCTION
39152 -- AcctLineType_220
39153 --
39154 ---------------------------------------
39155 PROCEDURE AcctLineType_220 (
39156 p_application_id IN NUMBER
39157 ,p_event_id IN NUMBER
39158 ,p_calculate_acctd_flag IN VARCHAR2
39159 ,p_calculate_g_l_flag IN VARCHAR2
39160 ,p_actual_flag IN OUT VARCHAR2
39161 ,p_balance_type_code OUT VARCHAR2
39162 ,p_gain_or_loss_ref OUT VARCHAR2
39163
39164 --Period Close Date
39165 , p_source_1 IN DATE
39166 --Generated Code Combination Identifier
39167 , p_source_5 IN NUMBER
39168 --CIP Clearing Account
39169 , p_source_7 IN VARCHAR2
39170 --Payables Code Combination Identifier
39171 , p_source_8 IN NUMBER
39172 --Expense Account Code Combination Identifier
39173 , p_source_31 IN NUMBER
39174 --Default Code Combination Identifier
39175 , p_source_32 IN NUMBER
39176 --Adjustment Type
39177 , p_source_48 IN VARCHAR2
39178 --Transaction Header Identifier
39179 , p_source_49 IN NUMBER
39180 --Adjustment Line Identifier
39181 , p_source_50 IN NUMBER
39182 --Distribution Type Code
39183 , p_source_51 IN VARCHAR2
39184 --Entered Amount
39185 , p_source_52 IN NUMBER
39186 --Currency Code
39187 , p_source_53 IN VARCHAR2
39188 )
39189 IS
39190
39191 l_component_type VARCHAR2(80);
39192 l_component_code VARCHAR2(30);
39193 l_component_type_code VARCHAR2(1);
39194 l_component_appl_id INTEGER;
39195 l_amb_context_code VARCHAR2(30);
39196 l_entity_code VARCHAR2(30);
39197 l_event_class_code VARCHAR2(30);
39201 l_line_definition_owner_code VARCHAR2(1);
39198 l_ae_header_id NUMBER;
39199 l_event_type_code VARCHAR2(30);
39200 l_line_definition_code VARCHAR2(30);
39202 --
39203 -- adr variables
39204 l_segment VARCHAR2(30);
39205 l_ccid NUMBER;
39206 l_adr_transaction_coa_id NUMBER;
39207 l_adr_accounting_coa_id NUMBER;
39208 l_adr_flexfield_segment_code VARCHAR2(30);
39209 l_adr_flex_value_set_id NUMBER;
39210 l_adr_value_type_code VARCHAR2(30);
39211 l_adr_value_combination_id NUMBER;
39212 l_adr_value_segment_code VARCHAR2(30);
39213
39214 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
39215 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
39216 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
39217 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
39218
39219 -- 4262811 Variables ------------------------------------------------------------------------------------------
39220 l_entered_amt_idx NUMBER;
39221 l_accted_amt_idx NUMBER;
39222 l_acc_rev_flag VARCHAR2(1);
39223 l_accrual_line_num NUMBER;
39224 l_tmp_amt NUMBER;
39225 l_acc_rev_natural_side_code VARCHAR2(1);
39226
39227 l_num_entries NUMBER;
39228 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
39229 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
39230 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
39231 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
39232 l_recog_line_1 NUMBER;
39233 l_recog_line_2 NUMBER;
39234
39235 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
39236 l_bflow_applied_to_amt NUMBER; -- 5132302
39237 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
39238
39239 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
39240
39241 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
39242 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
39243
39244 ---------------------------------------------------------------------------------------------------------------
39245
39246
39247 --
39248 -- bulk performance
39249 --
39250 l_balance_type_code VARCHAR2(1);
39251 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
39252 l_log_module VARCHAR2(240);
39253
39254 --
39255 -- Upgrade strategy
39256 --
39257 l_actual_upg_option VARCHAR2(1);
39258 l_enc_upg_option VARCHAR2(1);
39259
39260 --
39261 BEGIN
39262 --
39263 IF g_log_enabled THEN
39264 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_220';
39265 END IF;
39266 --
39267 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
39268
39269 trace
39270 (p_msg => 'BEGIN of AcctLineType_220'
39271 ,p_level => C_LEVEL_PROCEDURE
39272 ,p_module => l_log_module);
39273
39274 END IF;
39275 --
39276 l_component_type := 'AMB_JLT';
39277 l_component_code := 'FA_CIP_ADD_COST_CLEARING';
39278 l_component_type_code := 'S';
39279 l_component_appl_id := 140;
39280 l_amb_context_code := 'DEFAULT';
39281 l_entity_code := 'TRANSACTIONS';
39282 l_event_class_code := 'CIP_ADDITIONS';
39283 l_event_type_code := 'CIP_ADDITIONS_ALL';
39284 l_line_definition_owner_code := 'S';
39285 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_AD5';
39286 --
39287 l_balance_type_code := 'A';
39288 l_segment := NULL;
39289 l_ccid := NULL;
39290 l_adr_transaction_coa_id := NULL;
39291 l_adr_accounting_coa_id := NULL;
39292 l_adr_flexfield_segment_code := NULL;
39293 l_adr_flex_value_set_id := NULL;
39294 l_adr_value_type_code := NULL;
39295 l_adr_value_combination_id := NULL;
39296 l_adr_value_segment_code := NULL;
39297
39298 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
39299 l_bflow_class_code := ''; -- 4219869 Business Flow
39300 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
39301 l_budgetary_control_flag := 'N';
39302
39303 l_bflow_applied_to_amt_idx := NULL; -- 5132302
39304 l_bflow_applied_to_amt := NULL; -- 5132302
39305 l_entered_amt_idx := NULL; -- 4262811
39306 l_accted_amt_idx := NULL; -- 4262811
39307 l_acc_rev_flag := NULL; -- 4262811
39308 l_accrual_line_num := NULL; -- 4262811
39309 l_tmp_amt := NULL; -- 4262811
39310 --
39311
39312 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
39313 l_balance_type_code <> 'B' THEN
39314 IF NVL(p_source_48,'
39315 ') = 'COST CLEARING'
39316 THEN
39317
39318 --
39319 XLA_AE_LINES_PKG.SetNewLine;
39320
39321 p_balance_type_code := l_balance_type_code;
39322 -- set the flag so later we will know whether the gain loss line needs to be created
39323
39327
39324 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
39325 p_actual_flag :='A';
39326 END IF;
39328 --
39329 -- bulk performance
39330 --
39331 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
39332 p_header_num => 0); -- 4262811
39333 --
39334 -- set accounting line options
39335 --
39336 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
39337 p_natural_side_code => 'C'
39338 , p_gain_or_loss_flag => 'N'
39339 , p_gl_transfer_mode_code => 'S'
39340 , p_acct_entry_type_code => 'A'
39341 , p_switch_side_flag => 'Y'
39342 , p_merge_duplicate_code => 'N'
39343 );
39344 --
39345 l_acc_rev_natural_side_code := 'D'; -- 4262811
39346 --
39347 --
39348 -- set accounting line type info
39349 --
39350 xla_ae_lines_pkg.SetAcctLineType
39351 (p_component_type => l_component_type
39352 ,p_event_type_code => l_event_type_code
39353 ,p_line_definition_owner_code => l_line_definition_owner_code
39354 ,p_line_definition_code => l_line_definition_code
39355 ,p_accounting_line_code => l_component_code
39356 ,p_accounting_line_type_code => l_component_type_code
39357 ,p_accounting_line_appl_id => l_component_appl_id
39358 ,p_amb_context_code => l_amb_context_code
39359 ,p_entity_code => l_entity_code
39360 ,p_event_class_code => l_event_class_code);
39361 --
39362 -- set accounting class
39363 --
39364 xla_ae_lines_pkg.SetAcctClass(
39365 p_accounting_class_code => 'ASSET'
39366 , p_ae_header_id => l_ae_header_id
39367 );
39368
39369 --
39370 -- set rounding class
39371 --
39372 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
39373 'ASSET';
39374
39375 --
39376 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
39377 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
39378 --
39379 -- bulk performance
39380 --
39381 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
39382
39383 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
39384 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
39385
39386 -- 4955764
39387 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
39388 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
39389
39390 -- 4458381 Public Sector Enh
39391
39392 --
39393 -- set accounting attributes for the line type
39394 --
39395 l_entered_amt_idx := 4;
39396 l_accted_amt_idx := 6;
39397 l_bflow_applied_to_amt_idx := NULL; -- 5132302
39398 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
39399 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
39400 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
39401 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
39402 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
39403 l_rec_acct_attrs.array_char_value(3) := p_source_51;
39404 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
39405 l_rec_acct_attrs.array_num_value(4) := p_source_52;
39406 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
39407 l_rec_acct_attrs.array_char_value(5) := p_source_53;
39408 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
39409 l_rec_acct_attrs.array_num_value(6) := p_source_52;
39410
39411 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
39412 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
39413
39414 ---------------------------------------------------------------------------------------------------------------
39415 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
39416 ---------------------------------------------------------------------------------------------------------------
39417 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
39418
39419 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
39420 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
39421
39422 IF xla_accounting_cache_pkg.GetValueChar
39423 (p_source_code => 'LEDGER_CATEGORY_CODE'
39424 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
39425 AND l_bflow_method_code = 'PRIOR_ENTRY'
39426 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
39427 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
39428 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
39429 )
39430 THEN
39431 xla_ae_lines_pkg.BflowUpgEntry
39432 (p_business_method_code => l_bflow_method_code
39436 NULL;
39433 ,p_business_class_code => l_bflow_class_code
39434 ,p_balance_type => l_balance_type_code);
39435 ELSE
39437 -- No business flow processing for business flow method of NONE.
39438 END IF;
39439
39440 --
39441 -- call analytical criteria
39442 --
39443
39444 --
39445 -- call description
39446 --
39447
39448 xla_ae_lines_pkg.SetLineDescription(
39449 p_ae_header_id => l_ae_header_id
39450 ,p_description => Description_25 (
39451 p_application_id => p_application_id
39452 , p_ae_header_id => l_ae_header_id
39453 , p_source_1 => p_source_1
39454 )
39455 );
39456
39457
39458 --
39459 -- call ADRs
39460 -- Bug 4922099
39461 --
39462 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
39463 (NVL(l_actual_upg_option, 'N') = 'O') OR
39464 (NVL(l_enc_upg_option, 'N') = 'O')
39465 )
39466 THEN
39467 NULL;
39468 --
39469 --
39470
39471 l_ccid := AcctDerRule_172(
39472 p_application_id => p_application_id
39473 , p_ae_header_id => l_ae_header_id
39474 , p_source_5 => p_source_5
39475 , p_source_8 => p_source_8
39476 , p_source_32 => p_source_32
39477 , x_transaction_coa_id => l_adr_transaction_coa_id
39478 , x_accounting_coa_id => l_adr_accounting_coa_id
39479 , x_value_type_code => l_adr_value_type_code
39480 , p_side => 'NA'
39481 );
39482
39483 xla_ae_lines_pkg.set_ccid(
39484 p_code_combination_id => l_ccid
39485 , p_value_type_code => l_adr_value_type_code
39486 , p_transaction_coa_id => l_adr_transaction_coa_id
39487 , p_accounting_coa_id => l_adr_accounting_coa_id
39488 , p_adr_code => 'FA_CAT_CIP_COST_CLEARING'
39489 , p_adr_type_code => 'S'
39490 , p_component_type => l_component_type
39491 , p_component_code => l_component_code
39492 , p_component_type_code => l_component_type_code
39493 , p_component_appl_id => l_component_appl_id
39494 , p_amb_context_code => l_amb_context_code
39495 , p_side => 'NA'
39496 );
39497
39498
39499 l_segment := AcctDerRule_146(
39500 p_application_id => p_application_id
39501 , p_ae_header_id => l_ae_header_id
39502 , p_source_5 => p_source_5
39503 , p_source_7 => p_source_7
39504 , p_source_8 => p_source_8
39505 , x_transaction_coa_id => l_adr_transaction_coa_id
39506 , x_accounting_coa_id => l_adr_accounting_coa_id
39507 , x_flexfield_segment_code => l_adr_flexfield_segment_code
39508 , x_flex_value_set_id => l_adr_flex_value_set_id
39509 , x_value_type_code => l_adr_value_type_code
39510 , x_value_combination_id => l_adr_value_combination_id
39511 , x_value_segment_code => l_adr_value_segment_code
39512 , p_side => 'NA'
39513 , p_override_seg_flag => 'Y'
39514 );
39515
39516 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
39517
39518 xla_ae_lines_pkg.set_segment(
39519 p_to_segment_code => 'GL_ACCOUNT'
39520 , p_segment_value => l_segment
39521 , p_from_segment_code => l_adr_value_segment_code
39522 , p_from_combination_id => l_adr_value_combination_id
39523 , p_value_type_code => l_adr_value_type_code
39524 , p_transaction_coa_id => l_adr_transaction_coa_id
39525 , p_accounting_coa_id => l_adr_accounting_coa_id
39526 , p_flexfield_segment_code => l_adr_flexfield_segment_code
39527 , p_flex_value_set_id => l_adr_flex_value_set_id
39528 , p_adr_code => 'FA_CAT_CIP_CLR_SEGMENT'
39529 , p_adr_type_code => 'S'
39530 , p_component_type => l_component_type
39531 , p_component_code => l_component_code
39532 , p_component_type_code => l_component_type_code
39533 , p_component_appl_id => l_component_appl_id
39534 , p_amb_context_code => l_amb_context_code
39535 , p_entity_code => 'TRANSACTIONS'
39536 , p_event_class_code => 'CIP_ADDITIONS'
39537 , p_side => 'NA'
39538 );
39539
39540 END IF;
39541
39542 l_segment := AcctDerRule_170(
39543 p_application_id => p_application_id
39544 , p_ae_header_id => l_ae_header_id
39545 , p_source_5 => p_source_5
39546 , p_source_8 => p_source_8
39547 , p_source_31 => p_source_31
39548 , x_transaction_coa_id => l_adr_transaction_coa_id
39549 , x_accounting_coa_id => l_adr_accounting_coa_id
39550 , x_flexfield_segment_code => l_adr_flexfield_segment_code
39551 , x_flex_value_set_id => l_adr_flex_value_set_id
39552 , x_value_type_code => l_adr_value_type_code
39553 , x_value_combination_id => l_adr_value_combination_id
39554 , x_value_segment_code => l_adr_value_segment_code
39555 , p_side => 'NA'
39556 , p_override_seg_flag => 'Y'
39557 );
39558
39559 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
39563 , p_segment_value => l_segment
39560
39561 xla_ae_lines_pkg.set_segment(
39562 p_to_segment_code => 'GL_BALANCING'
39564 , p_from_segment_code => l_adr_value_segment_code
39565 , p_from_combination_id => l_adr_value_combination_id
39566 , p_value_type_code => l_adr_value_type_code
39567 , p_transaction_coa_id => l_adr_transaction_coa_id
39568 , p_accounting_coa_id => l_adr_accounting_coa_id
39569 , p_flexfield_segment_code => l_adr_flexfield_segment_code
39570 , p_flex_value_set_id => l_adr_flex_value_set_id
39571 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
39572 , p_adr_type_code => 'S'
39573 , p_component_type => l_component_type
39574 , p_component_code => l_component_code
39575 , p_component_type_code => l_component_type_code
39576 , p_component_appl_id => l_component_appl_id
39577 , p_amb_context_code => l_amb_context_code
39578 , p_entity_code => 'TRANSACTIONS'
39579 , p_event_class_code => 'CIP_ADDITIONS'
39580 , p_side => 'NA'
39581 );
39582
39583 END IF;
39584
39585 --
39586 --
39587 END IF;
39588 --
39589 -- Bug 4922099
39590 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
39591 (NVL(l_enc_upg_option, 'N') = 'O')
39592 ) AND
39593 (l_bflow_method_code = 'PRIOR_ENTRY')
39594 )
39595 THEN
39596 IF
39597 --
39598 1 = 2
39599 --
39600 THEN
39601 xla_accounting_err_pkg.build_message
39602 (p_appli_s_name => 'XLA'
39603 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
39604 ,p_token_1 => 'LINE_NUMBER'
39605 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
39606 ,p_token_2 => 'LINE_TYPE_NAME'
39607 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
39608 l_component_type
39609 ,l_component_code
39610 ,l_component_type_code
39611 ,l_component_appl_id
39612 ,l_amb_context_code
39613 ,l_entity_code
39614 ,l_event_class_code
39615 )
39616 ,p_token_3 => 'OWNER'
39617 ,p_value_3 => xla_lookups_pkg.get_meaning(
39618 p_lookup_type => 'XLA_OWNER_TYPE'
39619 ,p_lookup_code => l_component_type_code
39620 )
39621 ,p_token_4 => 'PRODUCT_NAME'
39622 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
39623 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
39624 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
39625 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
39626 ,p_ae_header_id => NULL
39627 );
39628
39629 IF (C_LEVEL_ERROR>= g_log_level) THEN
39630 trace
39631 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
39632 ,p_level => C_LEVEL_ERROR
39633 ,p_module => l_log_module);
39634 END IF;
39635 END IF;
39636 END IF;
39637 --
39638 --
39639 ------------------------------------------------------------------------------------------------
39640 -- 4219869 Business Flow
39641 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
39642 -- Prior Entry. Currently, the following code is always generated.
39643 ------------------------------------------------------------------------------------------------
39644 XLA_AE_LINES_PKG.ValidateCurrentLine;
39645
39646 ------------------------------------------------------------------------------------
39647 -- 4219869 Business Flow
39648 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
39649 ------------------------------------------------------------------------------------
39650 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
39651
39652 ----------------------------------------------------------------------------------
39653 -- 4219869 Business Flow
39654 -- Update journal entry status -- Need to generate this within IF <condition>
39655 ----------------------------------------------------------------------------------
39659 );
39656 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
39657 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
39658 ,p_balance_type_code => l_balance_type_code
39660
39661 -------------------------------------------------------------------------------------------
39662 -- 4262811 - Generate the Accrual Reversal lines
39663 -------------------------------------------------------------------------------------------
39664 BEGIN
39665 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
39666 (g_array_event(p_event_id).array_value_num('header_index'));
39667 IF l_acc_rev_flag IS NULL THEN
39668 l_acc_rev_flag := 'N';
39669 END IF;
39670 EXCEPTION
39671 WHEN OTHERS THEN
39672 l_acc_rev_flag := 'N';
39673 END;
39674 --
39675 IF (l_acc_rev_flag = 'Y') THEN
39676
39677 -- 4645092 ------------------------------------------------------------------------------
39678 -- To allow MPA report to determine if it should generate report process
39679 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
39680 ------------------------------------------------------------------------------------------
39681
39682 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
39683 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
39684 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
39685 -- call ADRs
39686 -- Bug 4922099
39687 --
39688 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
39689 (NVL(l_actual_upg_option, 'N') = 'O') OR
39690 (NVL(l_enc_upg_option, 'N') = 'O')
39691 )
39692 THEN
39693 NULL;
39694 --
39695 --
39696
39697 l_ccid := AcctDerRule_172(
39698 p_application_id => p_application_id
39699 , p_ae_header_id => l_ae_header_id
39700 , p_source_5 => p_source_5
39701 , p_source_8 => p_source_8
39702 , p_source_32 => p_source_32
39703 , x_transaction_coa_id => l_adr_transaction_coa_id
39704 , x_accounting_coa_id => l_adr_accounting_coa_id
39705 , x_value_type_code => l_adr_value_type_code
39706 , p_side => 'NA'
39707 );
39708
39709 xla_ae_lines_pkg.set_ccid(
39710 p_code_combination_id => l_ccid
39711 , p_value_type_code => l_adr_value_type_code
39712 , p_transaction_coa_id => l_adr_transaction_coa_id
39713 , p_accounting_coa_id => l_adr_accounting_coa_id
39714 , p_adr_code => 'FA_CAT_CIP_COST_CLEARING'
39715 , p_adr_type_code => 'S'
39716 , p_component_type => l_component_type
39717 , p_component_code => l_component_code
39718 , p_component_type_code => l_component_type_code
39719 , p_component_appl_id => l_component_appl_id
39720 , p_amb_context_code => l_amb_context_code
39721 , p_side => 'NA'
39722 );
39723
39724
39725 l_segment := AcctDerRule_146(
39726 p_application_id => p_application_id
39727 , p_ae_header_id => l_ae_header_id
39728 , p_source_5 => p_source_5
39729 , p_source_7 => p_source_7
39730 , p_source_8 => p_source_8
39731 , x_transaction_coa_id => l_adr_transaction_coa_id
39732 , x_accounting_coa_id => l_adr_accounting_coa_id
39733 , x_flexfield_segment_code => l_adr_flexfield_segment_code
39734 , x_flex_value_set_id => l_adr_flex_value_set_id
39735 , x_value_type_code => l_adr_value_type_code
39736 , x_value_combination_id => l_adr_value_combination_id
39737 , x_value_segment_code => l_adr_value_segment_code
39738 , p_side => 'NA'
39739 , p_override_seg_flag => 'Y'
39740 );
39741
39742 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
39743
39744 xla_ae_lines_pkg.set_segment(
39745 p_to_segment_code => 'GL_ACCOUNT'
39746 , p_segment_value => l_segment
39747 , p_from_segment_code => l_adr_value_segment_code
39748 , p_from_combination_id => l_adr_value_combination_id
39749 , p_value_type_code => l_adr_value_type_code
39750 , p_transaction_coa_id => l_adr_transaction_coa_id
39751 , p_accounting_coa_id => l_adr_accounting_coa_id
39752 , p_flexfield_segment_code => l_adr_flexfield_segment_code
39753 , p_flex_value_set_id => l_adr_flex_value_set_id
39754 , p_adr_code => 'FA_CAT_CIP_CLR_SEGMENT'
39755 , p_adr_type_code => 'S'
39756 , p_component_type => l_component_type
39757 , p_component_code => l_component_code
39758 , p_component_type_code => l_component_type_code
39759 , p_component_appl_id => l_component_appl_id
39760 , p_amb_context_code => l_amb_context_code
39761 , p_entity_code => 'TRANSACTIONS'
39762 , p_event_class_code => 'CIP_ADDITIONS'
39763 , p_side => 'NA'
39764 );
39765
39766 END IF;
39767
39768 l_segment := AcctDerRule_170(
39769 p_application_id => p_application_id
39773 , p_source_31 => p_source_31
39770 , p_ae_header_id => l_ae_header_id
39771 , p_source_5 => p_source_5
39772 , p_source_8 => p_source_8
39774 , x_transaction_coa_id => l_adr_transaction_coa_id
39775 , x_accounting_coa_id => l_adr_accounting_coa_id
39776 , x_flexfield_segment_code => l_adr_flexfield_segment_code
39777 , x_flex_value_set_id => l_adr_flex_value_set_id
39778 , x_value_type_code => l_adr_value_type_code
39779 , x_value_combination_id => l_adr_value_combination_id
39780 , x_value_segment_code => l_adr_value_segment_code
39781 , p_side => 'NA'
39782 , p_override_seg_flag => 'Y'
39783 );
39784
39785 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
39786
39787 xla_ae_lines_pkg.set_segment(
39788 p_to_segment_code => 'GL_BALANCING'
39789 , p_segment_value => l_segment
39790 , p_from_segment_code => l_adr_value_segment_code
39791 , p_from_combination_id => l_adr_value_combination_id
39792 , p_value_type_code => l_adr_value_type_code
39793 , p_transaction_coa_id => l_adr_transaction_coa_id
39794 , p_accounting_coa_id => l_adr_accounting_coa_id
39795 , p_flexfield_segment_code => l_adr_flexfield_segment_code
39796 , p_flex_value_set_id => l_adr_flex_value_set_id
39797 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
39798 , p_adr_type_code => 'S'
39799 , p_component_type => l_component_type
39800 , p_component_code => l_component_code
39801 , p_component_type_code => l_component_type_code
39802 , p_component_appl_id => l_component_appl_id
39803 , p_amb_context_code => l_amb_context_code
39804 , p_entity_code => 'TRANSACTIONS'
39805 , p_event_class_code => 'CIP_ADDITIONS'
39806 , p_side => 'NA'
39807 );
39808
39809 END IF;
39810
39811 --
39812 --
39813 END IF;
39814
39815 --
39816 -- Update the line information that should be overwritten
39817 --
39818 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
39819 p_header_num => 1);
39820 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
39821
39822 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
39823
39824 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
39825 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
39826 END IF;
39827
39828 --
39829 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
39830 --
39831 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
39832 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
39833 ELSE
39834 ---------------------------------------------------------------------------------------------------
39835 -- 4262811a Switch Sign
39836 ---------------------------------------------------------------------------------------------------
39837 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
39838 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
39839 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
39840 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
39841 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
39842 -- 5132302
39843 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
39844 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
39845
39846 END IF;
39847
39848 -- 4955764
39849 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
39850 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
39851
39852
39853 XLA_AE_LINES_PKG.ValidateCurrentLine;
39854 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
39855
39856 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
39857 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
39858 ,p_balance_type_code => l_balance_type_code);
39859
39860 END IF;
39861
39862 -----------------------------------------------------------------------------------------
39863 -- 4262811 Multiperiod Accounting
39864 -----------------------------------------------------------------------------------------
39865 -- No MPA option is assigned.
39866
39867
39868 END IF;
39869 END IF;
39870 --
39871
39872 --
39873 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
39874 trace
39875 (p_msg => 'END of AcctLineType_220'
39876 ,p_level => C_LEVEL_PROCEDURE
39877 ,p_module => l_log_module);
39878 END IF;
39882 RAISE;
39879 --
39880 EXCEPTION
39881 WHEN xla_exceptions_pkg.application_exception THEN
39883 WHEN OTHERS THEN
39884 xla_exceptions_pkg.raise_message
39885 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_220');
39886 END AcctLineType_220;
39887 --
39888
39889 ---------------------------------------
39890 --
39891 -- PRIVATE FUNCTION
39892 -- AcctLineType_221
39893 --
39894 ---------------------------------------
39895 PROCEDURE AcctLineType_221 (
39896 p_application_id IN NUMBER
39897 ,p_event_id IN NUMBER
39898 ,p_calculate_acctd_flag IN VARCHAR2
39899 ,p_calculate_g_l_flag IN VARCHAR2
39900 ,p_actual_flag IN OUT VARCHAR2
39901 ,p_balance_type_code OUT VARCHAR2
39902 ,p_gain_or_loss_ref OUT VARCHAR2
39903
39904 --Period Close Date
39905 , p_source_1 IN DATE
39906 --Generated Code Combination Identifier
39907 , p_source_5 IN NUMBER
39908 --CIP Cost Account
39909 , p_source_9 IN VARCHAR2
39910 --Expense Account Code Combination Identifier
39911 , p_source_31 IN NUMBER
39912 --Default Code Combination Identifier
39913 , p_source_32 IN NUMBER
39914 --Adjustment Type
39915 , p_source_48 IN VARCHAR2
39916 --Transaction Header Identifier
39917 , p_source_49 IN NUMBER
39918 --Adjustment Line Identifier
39919 , p_source_50 IN NUMBER
39920 --Distribution Type Code
39921 , p_source_51 IN VARCHAR2
39922 --Entered Amount
39923 , p_source_52 IN NUMBER
39924 --Currency Code
39925 , p_source_53 IN VARCHAR2
39926 )
39927 IS
39928
39929 l_component_type VARCHAR2(80);
39930 l_component_code VARCHAR2(30);
39931 l_component_type_code VARCHAR2(1);
39932 l_component_appl_id INTEGER;
39933 l_amb_context_code VARCHAR2(30);
39934 l_entity_code VARCHAR2(30);
39935 l_event_class_code VARCHAR2(30);
39936 l_ae_header_id NUMBER;
39937 l_event_type_code VARCHAR2(30);
39938 l_line_definition_code VARCHAR2(30);
39939 l_line_definition_owner_code VARCHAR2(1);
39940 --
39941 -- adr variables
39942 l_segment VARCHAR2(30);
39943 l_ccid NUMBER;
39944 l_adr_transaction_coa_id NUMBER;
39945 l_adr_accounting_coa_id NUMBER;
39946 l_adr_flexfield_segment_code VARCHAR2(30);
39947 l_adr_flex_value_set_id NUMBER;
39948 l_adr_value_type_code VARCHAR2(30);
39949 l_adr_value_combination_id NUMBER;
39950 l_adr_value_segment_code VARCHAR2(30);
39951
39952 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
39953 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
39954 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
39955 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
39956
39957 -- 4262811 Variables ------------------------------------------------------------------------------------------
39958 l_entered_amt_idx NUMBER;
39959 l_accted_amt_idx NUMBER;
39960 l_acc_rev_flag VARCHAR2(1);
39961 l_accrual_line_num NUMBER;
39962 l_tmp_amt NUMBER;
39963 l_acc_rev_natural_side_code VARCHAR2(1);
39964
39965 l_num_entries NUMBER;
39966 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
39967 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
39968 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
39969 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
39970 l_recog_line_1 NUMBER;
39971 l_recog_line_2 NUMBER;
39972
39973 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
39974 l_bflow_applied_to_amt NUMBER; -- 5132302
39975 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
39976
39977 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
39978
39979 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
39980 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
39981
39982 ---------------------------------------------------------------------------------------------------------------
39983
39984
39985 --
39986 -- bulk performance
39987 --
39988 l_balance_type_code VARCHAR2(1);
39989 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
39990 l_log_module VARCHAR2(240);
39991
39992 --
39993 -- Upgrade strategy
39994 --
39995 l_actual_upg_option VARCHAR2(1);
39996 l_enc_upg_option VARCHAR2(1);
39997
39998 --
39999 BEGIN
40000 --
40001 IF g_log_enabled THEN
40002 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_221';
40003 END IF;
40004 --
40005 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
40006
40007 trace
40008 (p_msg => 'BEGIN of AcctLineType_221'
40009 ,p_level => C_LEVEL_PROCEDURE
40010 ,p_module => l_log_module);
40011
40012 END IF;
40013 --
40014 l_component_type := 'AMB_JLT';
40015 l_component_code := 'FA_CIP_ADJ_COST';
40016 l_component_type_code := 'S';
40020 l_event_class_code := 'CIP_ADJUSTMENTS';
40017 l_component_appl_id := 140;
40018 l_amb_context_code := 'DEFAULT';
40019 l_entity_code := 'TRANSACTIONS';
40021 l_event_type_code := 'CIP_ADJUSTMENTS_ALL';
40022 l_line_definition_owner_code := 'S';
40023 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_AD6';
40024 --
40025 l_balance_type_code := 'A';
40026 l_segment := NULL;
40027 l_ccid := NULL;
40028 l_adr_transaction_coa_id := NULL;
40029 l_adr_accounting_coa_id := NULL;
40030 l_adr_flexfield_segment_code := NULL;
40031 l_adr_flex_value_set_id := NULL;
40032 l_adr_value_type_code := NULL;
40033 l_adr_value_combination_id := NULL;
40034 l_adr_value_segment_code := NULL;
40035
40036 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
40037 l_bflow_class_code := ''; -- 4219869 Business Flow
40038 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
40039 l_budgetary_control_flag := 'N';
40040
40041 l_bflow_applied_to_amt_idx := NULL; -- 5132302
40042 l_bflow_applied_to_amt := NULL; -- 5132302
40043 l_entered_amt_idx := NULL; -- 4262811
40044 l_accted_amt_idx := NULL; -- 4262811
40045 l_acc_rev_flag := NULL; -- 4262811
40046 l_accrual_line_num := NULL; -- 4262811
40047 l_tmp_amt := NULL; -- 4262811
40048 --
40049
40050 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
40051 l_balance_type_code <> 'B' THEN
40052 IF NVL(p_source_48,'
40053 ') = 'CIP COST'
40054 THEN
40055
40056 --
40057 XLA_AE_LINES_PKG.SetNewLine;
40058
40059 p_balance_type_code := l_balance_type_code;
40060 -- set the flag so later we will know whether the gain loss line needs to be created
40061
40062 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
40063 p_actual_flag :='A';
40064 END IF;
40065
40066 --
40067 -- bulk performance
40068 --
40069 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
40070 p_header_num => 0); -- 4262811
40071 --
40072 -- set accounting line options
40073 --
40074 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
40075 p_natural_side_code => 'D'
40076 , p_gain_or_loss_flag => 'N'
40077 , p_gl_transfer_mode_code => 'S'
40078 , p_acct_entry_type_code => 'A'
40079 , p_switch_side_flag => 'Y'
40080 , p_merge_duplicate_code => 'N'
40081 );
40082 --
40083 l_acc_rev_natural_side_code := 'C'; -- 4262811
40084 --
40085 --
40086 -- set accounting line type info
40087 --
40088 xla_ae_lines_pkg.SetAcctLineType
40089 (p_component_type => l_component_type
40090 ,p_event_type_code => l_event_type_code
40091 ,p_line_definition_owner_code => l_line_definition_owner_code
40092 ,p_line_definition_code => l_line_definition_code
40093 ,p_accounting_line_code => l_component_code
40094 ,p_accounting_line_type_code => l_component_type_code
40095 ,p_accounting_line_appl_id => l_component_appl_id
40096 ,p_amb_context_code => l_amb_context_code
40097 ,p_entity_code => l_entity_code
40098 ,p_event_class_code => l_event_class_code);
40099 --
40100 -- set accounting class
40101 --
40102 xla_ae_lines_pkg.SetAcctClass(
40103 p_accounting_class_code => 'ASSET'
40104 , p_ae_header_id => l_ae_header_id
40105 );
40106
40107 --
40108 -- set rounding class
40109 --
40110 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
40111 'ASSET';
40112
40113 --
40114 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
40115 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
40116 --
40117 -- bulk performance
40118 --
40119 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
40120
40121 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
40122 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
40123
40124 -- 4955764
40125 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
40126 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
40127
40128 -- 4458381 Public Sector Enh
40129
40130 --
40131 -- set accounting attributes for the line type
40132 --
40133 l_entered_amt_idx := 4;
40134 l_accted_amt_idx := 6;
40135 l_bflow_applied_to_amt_idx := NULL; -- 5132302
40136 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
40137 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
40138 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
40139 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
40140 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
40144 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
40141 l_rec_acct_attrs.array_char_value(3) := p_source_51;
40142 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
40143 l_rec_acct_attrs.array_num_value(4) := p_source_52;
40145 l_rec_acct_attrs.array_char_value(5) := p_source_53;
40146 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
40147 l_rec_acct_attrs.array_num_value(6) := p_source_52;
40148
40149 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
40150 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
40151
40152 ---------------------------------------------------------------------------------------------------------------
40153 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
40154 ---------------------------------------------------------------------------------------------------------------
40155 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
40156
40157 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
40158 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
40159
40160 IF xla_accounting_cache_pkg.GetValueChar
40161 (p_source_code => 'LEDGER_CATEGORY_CODE'
40162 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
40163 AND l_bflow_method_code = 'PRIOR_ENTRY'
40164 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
40165 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
40166 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
40167 )
40168 THEN
40169 xla_ae_lines_pkg.BflowUpgEntry
40170 (p_business_method_code => l_bflow_method_code
40171 ,p_business_class_code => l_bflow_class_code
40172 ,p_balance_type => l_balance_type_code);
40173 ELSE
40174 NULL;
40175 -- No business flow processing for business flow method of NONE.
40176 END IF;
40177
40178 --
40179 -- call analytical criteria
40180 --
40181
40182 --
40183 -- call description
40184 --
40185
40186 xla_ae_lines_pkg.SetLineDescription(
40187 p_ae_header_id => l_ae_header_id
40188 ,p_description => Description_27 (
40189 p_application_id => p_application_id
40190 , p_ae_header_id => l_ae_header_id
40191 , p_source_1 => p_source_1
40192 )
40193 );
40194
40195
40196 --
40197 -- call ADRs
40198 -- Bug 4922099
40199 --
40200 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
40201 (NVL(l_actual_upg_option, 'N') = 'O') OR
40202 (NVL(l_enc_upg_option, 'N') = 'O')
40203 )
40204 THEN
40205 NULL;
40206 --
40207 --
40208
40209 l_ccid := AcctDerRule_174(
40210 p_application_id => p_application_id
40211 , p_ae_header_id => l_ae_header_id
40212 , p_source_5 => p_source_5
40213 , p_source_32 => p_source_32
40214 , x_transaction_coa_id => l_adr_transaction_coa_id
40215 , x_accounting_coa_id => l_adr_accounting_coa_id
40216 , x_value_type_code => l_adr_value_type_code
40217 , p_side => 'NA'
40218 );
40219
40220 xla_ae_lines_pkg.set_ccid(
40221 p_code_combination_id => l_ccid
40222 , p_value_type_code => l_adr_value_type_code
40223 , p_transaction_coa_id => l_adr_transaction_coa_id
40224 , p_accounting_coa_id => l_adr_accounting_coa_id
40225 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
40226 , p_adr_type_code => 'S'
40227 , p_component_type => l_component_type
40228 , p_component_code => l_component_code
40229 , p_component_type_code => l_component_type_code
40230 , p_component_appl_id => l_component_appl_id
40231 , p_amb_context_code => l_amb_context_code
40232 , p_side => 'NA'
40233 );
40234
40235
40236 l_segment := AcctDerRule_147(
40237 p_application_id => p_application_id
40238 , p_ae_header_id => l_ae_header_id
40239 , p_source_5 => p_source_5
40240 , p_source_9 => p_source_9
40241 , x_transaction_coa_id => l_adr_transaction_coa_id
40242 , x_accounting_coa_id => l_adr_accounting_coa_id
40243 , x_flexfield_segment_code => l_adr_flexfield_segment_code
40244 , x_flex_value_set_id => l_adr_flex_value_set_id
40245 , x_value_type_code => l_adr_value_type_code
40246 , x_value_combination_id => l_adr_value_combination_id
40247 , x_value_segment_code => l_adr_value_segment_code
40248 , p_side => 'NA'
40249 , p_override_seg_flag => 'Y'
40250 );
40251
40252 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
40253
40254 xla_ae_lines_pkg.set_segment(
40255 p_to_segment_code => 'GL_ACCOUNT'
40256 , p_segment_value => l_segment
40257 , p_from_segment_code => l_adr_value_segment_code
40258 , p_from_combination_id => l_adr_value_combination_id
40262 , p_flexfield_segment_code => l_adr_flexfield_segment_code
40259 , p_value_type_code => l_adr_value_type_code
40260 , p_transaction_coa_id => l_adr_transaction_coa_id
40261 , p_accounting_coa_id => l_adr_accounting_coa_id
40263 , p_flex_value_set_id => l_adr_flex_value_set_id
40264 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
40265 , p_adr_type_code => 'S'
40266 , p_component_type => l_component_type
40267 , p_component_code => l_component_code
40268 , p_component_type_code => l_component_type_code
40269 , p_component_appl_id => l_component_appl_id
40270 , p_amb_context_code => l_amb_context_code
40271 , p_entity_code => 'TRANSACTIONS'
40272 , p_event_class_code => 'CIP_ADJUSTMENTS'
40273 , p_side => 'NA'
40274 );
40275
40276 END IF;
40277
40278 l_segment := AcctDerRule_169(
40279 p_application_id => p_application_id
40280 , p_ae_header_id => l_ae_header_id
40281 , p_source_5 => p_source_5
40282 , p_source_31 => p_source_31
40283 , x_transaction_coa_id => l_adr_transaction_coa_id
40284 , x_accounting_coa_id => l_adr_accounting_coa_id
40285 , x_flexfield_segment_code => l_adr_flexfield_segment_code
40286 , x_flex_value_set_id => l_adr_flex_value_set_id
40287 , x_value_type_code => l_adr_value_type_code
40288 , x_value_combination_id => l_adr_value_combination_id
40289 , x_value_segment_code => l_adr_value_segment_code
40290 , p_side => 'NA'
40291 , p_override_seg_flag => 'Y'
40292 );
40293
40294 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
40295
40296 xla_ae_lines_pkg.set_segment(
40297 p_to_segment_code => 'GL_BALANCING'
40298 , p_segment_value => l_segment
40299 , p_from_segment_code => l_adr_value_segment_code
40300 , p_from_combination_id => l_adr_value_combination_id
40301 , p_value_type_code => l_adr_value_type_code
40302 , p_transaction_coa_id => l_adr_transaction_coa_id
40303 , p_accounting_coa_id => l_adr_accounting_coa_id
40304 , p_flexfield_segment_code => l_adr_flexfield_segment_code
40305 , p_flex_value_set_id => l_adr_flex_value_set_id
40306 , p_adr_code => 'FA_EXPENSE_ACCT'
40307 , p_adr_type_code => 'S'
40308 , p_component_type => l_component_type
40309 , p_component_code => l_component_code
40310 , p_component_type_code => l_component_type_code
40311 , p_component_appl_id => l_component_appl_id
40312 , p_amb_context_code => l_amb_context_code
40313 , p_entity_code => 'TRANSACTIONS'
40314 , p_event_class_code => 'CIP_ADJUSTMENTS'
40315 , p_side => 'NA'
40316 );
40317
40318 END IF;
40319
40320 --
40321 --
40322 END IF;
40323 --
40324 -- Bug 4922099
40325 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
40326 (NVL(l_enc_upg_option, 'N') = 'O')
40327 ) AND
40328 (l_bflow_method_code = 'PRIOR_ENTRY')
40329 )
40330 THEN
40331 IF
40332 --
40333 1 = 2
40334 --
40335 THEN
40336 xla_accounting_err_pkg.build_message
40337 (p_appli_s_name => 'XLA'
40338 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
40339 ,p_token_1 => 'LINE_NUMBER'
40340 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
40341 ,p_token_2 => 'LINE_TYPE_NAME'
40342 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
40343 l_component_type
40344 ,l_component_code
40345 ,l_component_type_code
40346 ,l_component_appl_id
40347 ,l_amb_context_code
40348 ,l_entity_code
40349 ,l_event_class_code
40350 )
40351 ,p_token_3 => 'OWNER'
40352 ,p_value_3 => xla_lookups_pkg.get_meaning(
40353 p_lookup_type => 'XLA_OWNER_TYPE'
40354 ,p_lookup_code => l_component_type_code
40355 )
40356 ,p_token_4 => 'PRODUCT_NAME'
40360 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
40357 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
40358 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
40359 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
40361 ,p_ae_header_id => NULL
40362 );
40363
40364 IF (C_LEVEL_ERROR>= g_log_level) THEN
40365 trace
40366 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
40367 ,p_level => C_LEVEL_ERROR
40368 ,p_module => l_log_module);
40369 END IF;
40370 END IF;
40371 END IF;
40372 --
40373 --
40374 ------------------------------------------------------------------------------------------------
40375 -- 4219869 Business Flow
40376 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
40377 -- Prior Entry. Currently, the following code is always generated.
40378 ------------------------------------------------------------------------------------------------
40379 XLA_AE_LINES_PKG.ValidateCurrentLine;
40380
40381 ------------------------------------------------------------------------------------
40382 -- 4219869 Business Flow
40383 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
40384 ------------------------------------------------------------------------------------
40385 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
40386
40387 ----------------------------------------------------------------------------------
40388 -- 4219869 Business Flow
40389 -- Update journal entry status -- Need to generate this within IF <condition>
40390 ----------------------------------------------------------------------------------
40391 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
40392 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
40393 ,p_balance_type_code => l_balance_type_code
40394 );
40395
40396 -------------------------------------------------------------------------------------------
40397 -- 4262811 - Generate the Accrual Reversal lines
40398 -------------------------------------------------------------------------------------------
40399 BEGIN
40400 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
40401 (g_array_event(p_event_id).array_value_num('header_index'));
40402 IF l_acc_rev_flag IS NULL THEN
40403 l_acc_rev_flag := 'N';
40404 END IF;
40405 EXCEPTION
40406 WHEN OTHERS THEN
40407 l_acc_rev_flag := 'N';
40408 END;
40409 --
40410 IF (l_acc_rev_flag = 'Y') THEN
40411
40412 -- 4645092 ------------------------------------------------------------------------------
40413 -- To allow MPA report to determine if it should generate report process
40414 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
40415 ------------------------------------------------------------------------------------------
40416
40417 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
40418 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
40419 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
40420 -- call ADRs
40421 -- Bug 4922099
40422 --
40423 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
40424 (NVL(l_actual_upg_option, 'N') = 'O') OR
40425 (NVL(l_enc_upg_option, 'N') = 'O')
40426 )
40427 THEN
40428 NULL;
40429 --
40430 --
40431
40432 l_ccid := AcctDerRule_174(
40433 p_application_id => p_application_id
40434 , p_ae_header_id => l_ae_header_id
40435 , p_source_5 => p_source_5
40436 , p_source_32 => p_source_32
40437 , x_transaction_coa_id => l_adr_transaction_coa_id
40438 , x_accounting_coa_id => l_adr_accounting_coa_id
40439 , x_value_type_code => l_adr_value_type_code
40440 , p_side => 'NA'
40441 );
40442
40443 xla_ae_lines_pkg.set_ccid(
40444 p_code_combination_id => l_ccid
40445 , p_value_type_code => l_adr_value_type_code
40446 , p_transaction_coa_id => l_adr_transaction_coa_id
40447 , p_accounting_coa_id => l_adr_accounting_coa_id
40448 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
40449 , p_adr_type_code => 'S'
40450 , p_component_type => l_component_type
40451 , p_component_code => l_component_code
40452 , p_component_type_code => l_component_type_code
40453 , p_component_appl_id => l_component_appl_id
40454 , p_amb_context_code => l_amb_context_code
40455 , p_side => 'NA'
40456 );
40457
40458
40459 l_segment := AcctDerRule_147(
40460 p_application_id => p_application_id
40461 , p_ae_header_id => l_ae_header_id
40462 , p_source_5 => p_source_5
40463 , p_source_9 => p_source_9
40464 , x_transaction_coa_id => l_adr_transaction_coa_id
40465 , x_accounting_coa_id => l_adr_accounting_coa_id
40469 , x_value_combination_id => l_adr_value_combination_id
40466 , x_flexfield_segment_code => l_adr_flexfield_segment_code
40467 , x_flex_value_set_id => l_adr_flex_value_set_id
40468 , x_value_type_code => l_adr_value_type_code
40470 , x_value_segment_code => l_adr_value_segment_code
40471 , p_side => 'NA'
40472 , p_override_seg_flag => 'Y'
40473 );
40474
40475 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
40476
40477 xla_ae_lines_pkg.set_segment(
40478 p_to_segment_code => 'GL_ACCOUNT'
40479 , p_segment_value => l_segment
40480 , p_from_segment_code => l_adr_value_segment_code
40481 , p_from_combination_id => l_adr_value_combination_id
40482 , p_value_type_code => l_adr_value_type_code
40483 , p_transaction_coa_id => l_adr_transaction_coa_id
40484 , p_accounting_coa_id => l_adr_accounting_coa_id
40485 , p_flexfield_segment_code => l_adr_flexfield_segment_code
40486 , p_flex_value_set_id => l_adr_flex_value_set_id
40487 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
40488 , p_adr_type_code => 'S'
40489 , p_component_type => l_component_type
40490 , p_component_code => l_component_code
40491 , p_component_type_code => l_component_type_code
40492 , p_component_appl_id => l_component_appl_id
40493 , p_amb_context_code => l_amb_context_code
40494 , p_entity_code => 'TRANSACTIONS'
40495 , p_event_class_code => 'CIP_ADJUSTMENTS'
40496 , p_side => 'NA'
40497 );
40498
40499 END IF;
40500
40501 l_segment := AcctDerRule_169(
40502 p_application_id => p_application_id
40503 , p_ae_header_id => l_ae_header_id
40504 , p_source_5 => p_source_5
40505 , p_source_31 => p_source_31
40506 , x_transaction_coa_id => l_adr_transaction_coa_id
40507 , x_accounting_coa_id => l_adr_accounting_coa_id
40508 , x_flexfield_segment_code => l_adr_flexfield_segment_code
40509 , x_flex_value_set_id => l_adr_flex_value_set_id
40510 , x_value_type_code => l_adr_value_type_code
40511 , x_value_combination_id => l_adr_value_combination_id
40512 , x_value_segment_code => l_adr_value_segment_code
40513 , p_side => 'NA'
40514 , p_override_seg_flag => 'Y'
40515 );
40516
40517 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
40518
40519 xla_ae_lines_pkg.set_segment(
40520 p_to_segment_code => 'GL_BALANCING'
40521 , p_segment_value => l_segment
40522 , p_from_segment_code => l_adr_value_segment_code
40523 , p_from_combination_id => l_adr_value_combination_id
40524 , p_value_type_code => l_adr_value_type_code
40525 , p_transaction_coa_id => l_adr_transaction_coa_id
40526 , p_accounting_coa_id => l_adr_accounting_coa_id
40527 , p_flexfield_segment_code => l_adr_flexfield_segment_code
40528 , p_flex_value_set_id => l_adr_flex_value_set_id
40529 , p_adr_code => 'FA_EXPENSE_ACCT'
40530 , p_adr_type_code => 'S'
40531 , p_component_type => l_component_type
40532 , p_component_code => l_component_code
40533 , p_component_type_code => l_component_type_code
40534 , p_component_appl_id => l_component_appl_id
40535 , p_amb_context_code => l_amb_context_code
40536 , p_entity_code => 'TRANSACTIONS'
40537 , p_event_class_code => 'CIP_ADJUSTMENTS'
40538 , p_side => 'NA'
40539 );
40540
40541 END IF;
40542
40543 --
40544 --
40545 END IF;
40546
40547 --
40548 -- Update the line information that should be overwritten
40549 --
40550 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
40551 p_header_num => 1);
40552 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
40553
40554 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
40555
40556 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
40557 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
40558 END IF;
40559
40560 --
40561 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
40562 --
40563 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
40564 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
40565 ELSE
40566 ---------------------------------------------------------------------------------------------------
40567 -- 4262811a Switch Sign
40568 ---------------------------------------------------------------------------------------------------
40569 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
40570 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
40574 -- 5132302
40571 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
40572 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
40573 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
40575 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
40576 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
40577
40578 END IF;
40579
40580 -- 4955764
40581 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
40582 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
40583
40584
40585 XLA_AE_LINES_PKG.ValidateCurrentLine;
40586 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
40587
40588 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
40589 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
40590 ,p_balance_type_code => l_balance_type_code);
40591
40592 END IF;
40593
40594 -----------------------------------------------------------------------------------------
40595 -- 4262811 Multiperiod Accounting
40596 -----------------------------------------------------------------------------------------
40597 -- No MPA option is assigned.
40598
40599
40600 END IF;
40601 END IF;
40602 --
40603
40604 --
40605 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
40606 trace
40607 (p_msg => 'END of AcctLineType_221'
40608 ,p_level => C_LEVEL_PROCEDURE
40609 ,p_module => l_log_module);
40610 END IF;
40611 --
40612 EXCEPTION
40613 WHEN xla_exceptions_pkg.application_exception THEN
40614 RAISE;
40615 WHEN OTHERS THEN
40616 xla_exceptions_pkg.raise_message
40617 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_221');
40618 END AcctLineType_221;
40619 --
40620
40621 ---------------------------------------
40622 --
40623 -- PRIVATE FUNCTION
40624 -- AcctLineType_222
40625 --
40626 ---------------------------------------
40627 PROCEDURE AcctLineType_222 (
40628 p_application_id IN NUMBER
40629 ,p_event_id IN NUMBER
40630 ,p_calculate_acctd_flag IN VARCHAR2
40631 ,p_calculate_g_l_flag IN VARCHAR2
40632 ,p_actual_flag IN OUT VARCHAR2
40633 ,p_balance_type_code OUT VARCHAR2
40634 ,p_gain_or_loss_ref OUT VARCHAR2
40635
40636 --Period Close Date
40637 , p_source_1 IN DATE
40638 --Generated Code Combination Identifier
40639 , p_source_5 IN NUMBER
40640 --CIP Clearing Account
40641 , p_source_7 IN VARCHAR2
40642 --Payables Code Combination Identifier
40643 , p_source_8 IN NUMBER
40644 --Expense Account Code Combination Identifier
40645 , p_source_31 IN NUMBER
40646 --Default Code Combination Identifier
40647 , p_source_32 IN NUMBER
40648 --Adjustment Type
40649 , p_source_48 IN VARCHAR2
40650 --Transaction Header Identifier
40651 , p_source_49 IN NUMBER
40652 --Adjustment Line Identifier
40653 , p_source_50 IN NUMBER
40654 --Distribution Type Code
40655 , p_source_51 IN VARCHAR2
40656 --Entered Amount
40657 , p_source_52 IN NUMBER
40658 --Currency Code
40659 , p_source_53 IN VARCHAR2
40660 )
40661 IS
40662
40663 l_component_type VARCHAR2(80);
40664 l_component_code VARCHAR2(30);
40665 l_component_type_code VARCHAR2(1);
40666 l_component_appl_id INTEGER;
40667 l_amb_context_code VARCHAR2(30);
40668 l_entity_code VARCHAR2(30);
40669 l_event_class_code VARCHAR2(30);
40670 l_ae_header_id NUMBER;
40671 l_event_type_code VARCHAR2(30);
40672 l_line_definition_code VARCHAR2(30);
40673 l_line_definition_owner_code VARCHAR2(1);
40674 --
40675 -- adr variables
40676 l_segment VARCHAR2(30);
40677 l_ccid NUMBER;
40678 l_adr_transaction_coa_id NUMBER;
40679 l_adr_accounting_coa_id NUMBER;
40680 l_adr_flexfield_segment_code VARCHAR2(30);
40681 l_adr_flex_value_set_id NUMBER;
40682 l_adr_value_type_code VARCHAR2(30);
40683 l_adr_value_combination_id NUMBER;
40684 l_adr_value_segment_code VARCHAR2(30);
40685
40686 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
40687 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
40688 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
40689 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
40690
40691 -- 4262811 Variables ------------------------------------------------------------------------------------------
40692 l_entered_amt_idx NUMBER;
40693 l_accted_amt_idx NUMBER;
40694 l_acc_rev_flag VARCHAR2(1);
40695 l_accrual_line_num NUMBER;
40696 l_tmp_amt NUMBER;
40697 l_acc_rev_natural_side_code VARCHAR2(1);
40698
40699 l_num_entries NUMBER;
40700 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
40701 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
40705 l_recog_line_2 NUMBER;
40702 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
40703 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
40704 l_recog_line_1 NUMBER;
40706
40707 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
40708 l_bflow_applied_to_amt NUMBER; -- 5132302
40709 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
40710
40711 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
40712
40713 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
40714 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
40715
40716 ---------------------------------------------------------------------------------------------------------------
40717
40718
40719 --
40720 -- bulk performance
40721 --
40722 l_balance_type_code VARCHAR2(1);
40723 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
40724 l_log_module VARCHAR2(240);
40725
40726 --
40727 -- Upgrade strategy
40728 --
40729 l_actual_upg_option VARCHAR2(1);
40730 l_enc_upg_option VARCHAR2(1);
40731
40732 --
40733 BEGIN
40734 --
40735 IF g_log_enabled THEN
40736 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_222';
40737 END IF;
40738 --
40739 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
40740
40741 trace
40742 (p_msg => 'BEGIN of AcctLineType_222'
40743 ,p_level => C_LEVEL_PROCEDURE
40744 ,p_module => l_log_module);
40745
40746 END IF;
40747 --
40748 l_component_type := 'AMB_JLT';
40749 l_component_code := 'FA_CIP_ADJ_COST_CLEARING';
40750 l_component_type_code := 'S';
40751 l_component_appl_id := 140;
40752 l_amb_context_code := 'DEFAULT';
40753 l_entity_code := 'TRANSACTIONS';
40754 l_event_class_code := 'CIP_ADJUSTMENTS';
40755 l_event_type_code := 'CIP_ADJUSTMENTS_ALL';
40756 l_line_definition_owner_code := 'S';
40757 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_AD6';
40758 --
40759 l_balance_type_code := 'A';
40760 l_segment := NULL;
40761 l_ccid := NULL;
40762 l_adr_transaction_coa_id := NULL;
40763 l_adr_accounting_coa_id := NULL;
40764 l_adr_flexfield_segment_code := NULL;
40765 l_adr_flex_value_set_id := NULL;
40766 l_adr_value_type_code := NULL;
40767 l_adr_value_combination_id := NULL;
40768 l_adr_value_segment_code := NULL;
40769
40770 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
40771 l_bflow_class_code := ''; -- 4219869 Business Flow
40772 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
40773 l_budgetary_control_flag := 'N';
40774
40775 l_bflow_applied_to_amt_idx := NULL; -- 5132302
40776 l_bflow_applied_to_amt := NULL; -- 5132302
40777 l_entered_amt_idx := NULL; -- 4262811
40778 l_accted_amt_idx := NULL; -- 4262811
40779 l_acc_rev_flag := NULL; -- 4262811
40780 l_accrual_line_num := NULL; -- 4262811
40781 l_tmp_amt := NULL; -- 4262811
40782 --
40783
40784 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
40785 l_balance_type_code <> 'B' THEN
40786 IF NVL(p_source_48,'
40787 ') = 'COST CLEARING'
40788 THEN
40789
40790 --
40791 XLA_AE_LINES_PKG.SetNewLine;
40792
40793 p_balance_type_code := l_balance_type_code;
40794 -- set the flag so later we will know whether the gain loss line needs to be created
40795
40796 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
40797 p_actual_flag :='A';
40798 END IF;
40799
40800 --
40801 -- bulk performance
40802 --
40803 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
40804 p_header_num => 0); -- 4262811
40805 --
40806 -- set accounting line options
40807 --
40808 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
40809 p_natural_side_code => 'C'
40810 , p_gain_or_loss_flag => 'N'
40811 , p_gl_transfer_mode_code => 'S'
40812 , p_acct_entry_type_code => 'A'
40813 , p_switch_side_flag => 'Y'
40814 , p_merge_duplicate_code => 'N'
40815 );
40816 --
40817 l_acc_rev_natural_side_code := 'D'; -- 4262811
40818 --
40819 --
40820 -- set accounting line type info
40821 --
40822 xla_ae_lines_pkg.SetAcctLineType
40823 (p_component_type => l_component_type
40824 ,p_event_type_code => l_event_type_code
40825 ,p_line_definition_owner_code => l_line_definition_owner_code
40826 ,p_line_definition_code => l_line_definition_code
40827 ,p_accounting_line_code => l_component_code
40828 ,p_accounting_line_type_code => l_component_type_code
40829 ,p_accounting_line_appl_id => l_component_appl_id
40830 ,p_amb_context_code => l_amb_context_code
40834 -- set accounting class
40831 ,p_entity_code => l_entity_code
40832 ,p_event_class_code => l_event_class_code);
40833 --
40835 --
40836 xla_ae_lines_pkg.SetAcctClass(
40837 p_accounting_class_code => 'ASSET'
40838 , p_ae_header_id => l_ae_header_id
40839 );
40840
40841 --
40842 -- set rounding class
40843 --
40844 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
40845 'ASSET';
40846
40847 --
40848 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
40849 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
40850 --
40851 -- bulk performance
40852 --
40853 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
40854
40855 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
40856 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
40857
40858 -- 4955764
40859 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
40860 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
40861
40862 -- 4458381 Public Sector Enh
40863
40864 --
40865 -- set accounting attributes for the line type
40866 --
40867 l_entered_amt_idx := 4;
40868 l_accted_amt_idx := 6;
40869 l_bflow_applied_to_amt_idx := NULL; -- 5132302
40870 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
40871 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
40872 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
40873 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
40874 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
40875 l_rec_acct_attrs.array_char_value(3) := p_source_51;
40876 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
40877 l_rec_acct_attrs.array_num_value(4) := p_source_52;
40878 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
40879 l_rec_acct_attrs.array_char_value(5) := p_source_53;
40880 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
40881 l_rec_acct_attrs.array_num_value(6) := p_source_52;
40882
40883 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
40884 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
40885
40886 ---------------------------------------------------------------------------------------------------------------
40887 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
40888 ---------------------------------------------------------------------------------------------------------------
40889 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
40890
40891 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
40892 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
40893
40894 IF xla_accounting_cache_pkg.GetValueChar
40895 (p_source_code => 'LEDGER_CATEGORY_CODE'
40896 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
40897 AND l_bflow_method_code = 'PRIOR_ENTRY'
40898 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
40899 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
40900 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
40901 )
40902 THEN
40903 xla_ae_lines_pkg.BflowUpgEntry
40904 (p_business_method_code => l_bflow_method_code
40905 ,p_business_class_code => l_bflow_class_code
40906 ,p_balance_type => l_balance_type_code);
40907 ELSE
40908 NULL;
40909 -- No business flow processing for business flow method of NONE.
40910 END IF;
40911
40912 --
40913 -- call analytical criteria
40914 --
40915
40916 --
40917 -- call description
40918 --
40919
40920 xla_ae_lines_pkg.SetLineDescription(
40921 p_ae_header_id => l_ae_header_id
40922 ,p_description => Description_27 (
40923 p_application_id => p_application_id
40924 , p_ae_header_id => l_ae_header_id
40925 , p_source_1 => p_source_1
40926 )
40927 );
40928
40929
40930 --
40931 -- call ADRs
40932 -- Bug 4922099
40933 --
40934 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
40935 (NVL(l_actual_upg_option, 'N') = 'O') OR
40936 (NVL(l_enc_upg_option, 'N') = 'O')
40937 )
40938 THEN
40939 NULL;
40940 --
40941 --
40942
40943 l_ccid := AcctDerRule_172(
40944 p_application_id => p_application_id
40945 , p_ae_header_id => l_ae_header_id
40946 , p_source_5 => p_source_5
40947 , p_source_8 => p_source_8
40948 , p_source_32 => p_source_32
40949 , x_transaction_coa_id => l_adr_transaction_coa_id
40950 , x_accounting_coa_id => l_adr_accounting_coa_id
40951 , x_value_type_code => l_adr_value_type_code
40955 xla_ae_lines_pkg.set_ccid(
40952 , p_side => 'NA'
40953 );
40954
40956 p_code_combination_id => l_ccid
40957 , p_value_type_code => l_adr_value_type_code
40958 , p_transaction_coa_id => l_adr_transaction_coa_id
40959 , p_accounting_coa_id => l_adr_accounting_coa_id
40960 , p_adr_code => 'FA_CAT_CIP_COST_CLEARING'
40961 , p_adr_type_code => 'S'
40962 , p_component_type => l_component_type
40963 , p_component_code => l_component_code
40964 , p_component_type_code => l_component_type_code
40965 , p_component_appl_id => l_component_appl_id
40966 , p_amb_context_code => l_amb_context_code
40967 , p_side => 'NA'
40968 );
40969
40970
40971 l_segment := AcctDerRule_146(
40972 p_application_id => p_application_id
40973 , p_ae_header_id => l_ae_header_id
40974 , p_source_5 => p_source_5
40975 , p_source_7 => p_source_7
40976 , p_source_8 => p_source_8
40977 , x_transaction_coa_id => l_adr_transaction_coa_id
40978 , x_accounting_coa_id => l_adr_accounting_coa_id
40979 , x_flexfield_segment_code => l_adr_flexfield_segment_code
40980 , x_flex_value_set_id => l_adr_flex_value_set_id
40981 , x_value_type_code => l_adr_value_type_code
40982 , x_value_combination_id => l_adr_value_combination_id
40983 , x_value_segment_code => l_adr_value_segment_code
40984 , p_side => 'NA'
40985 , p_override_seg_flag => 'Y'
40986 );
40987
40988 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
40989
40990 xla_ae_lines_pkg.set_segment(
40991 p_to_segment_code => 'GL_ACCOUNT'
40992 , p_segment_value => l_segment
40993 , p_from_segment_code => l_adr_value_segment_code
40994 , p_from_combination_id => l_adr_value_combination_id
40995 , p_value_type_code => l_adr_value_type_code
40996 , p_transaction_coa_id => l_adr_transaction_coa_id
40997 , p_accounting_coa_id => l_adr_accounting_coa_id
40998 , p_flexfield_segment_code => l_adr_flexfield_segment_code
40999 , p_flex_value_set_id => l_adr_flex_value_set_id
41000 , p_adr_code => 'FA_CAT_CIP_CLR_SEGMENT'
41001 , p_adr_type_code => 'S'
41002 , p_component_type => l_component_type
41003 , p_component_code => l_component_code
41004 , p_component_type_code => l_component_type_code
41005 , p_component_appl_id => l_component_appl_id
41006 , p_amb_context_code => l_amb_context_code
41007 , p_entity_code => 'TRANSACTIONS'
41008 , p_event_class_code => 'CIP_ADJUSTMENTS'
41009 , p_side => 'NA'
41010 );
41011
41012 END IF;
41013
41014 l_segment := AcctDerRule_170(
41015 p_application_id => p_application_id
41016 , p_ae_header_id => l_ae_header_id
41017 , p_source_5 => p_source_5
41018 , p_source_8 => p_source_8
41019 , p_source_31 => p_source_31
41020 , x_transaction_coa_id => l_adr_transaction_coa_id
41021 , x_accounting_coa_id => l_adr_accounting_coa_id
41022 , x_flexfield_segment_code => l_adr_flexfield_segment_code
41023 , x_flex_value_set_id => l_adr_flex_value_set_id
41024 , x_value_type_code => l_adr_value_type_code
41025 , x_value_combination_id => l_adr_value_combination_id
41026 , x_value_segment_code => l_adr_value_segment_code
41027 , p_side => 'NA'
41028 , p_override_seg_flag => 'Y'
41029 );
41030
41031 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
41032
41033 xla_ae_lines_pkg.set_segment(
41034 p_to_segment_code => 'GL_BALANCING'
41035 , p_segment_value => l_segment
41036 , p_from_segment_code => l_adr_value_segment_code
41037 , p_from_combination_id => l_adr_value_combination_id
41038 , p_value_type_code => l_adr_value_type_code
41039 , p_transaction_coa_id => l_adr_transaction_coa_id
41040 , p_accounting_coa_id => l_adr_accounting_coa_id
41041 , p_flexfield_segment_code => l_adr_flexfield_segment_code
41042 , p_flex_value_set_id => l_adr_flex_value_set_id
41043 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
41044 , p_adr_type_code => 'S'
41045 , p_component_type => l_component_type
41046 , p_component_code => l_component_code
41047 , p_component_type_code => l_component_type_code
41048 , p_component_appl_id => l_component_appl_id
41049 , p_amb_context_code => l_amb_context_code
41050 , p_entity_code => 'TRANSACTIONS'
41051 , p_event_class_code => 'CIP_ADJUSTMENTS'
41052 , p_side => 'NA'
41053 );
41054
41055 END IF;
41056
41057 --
41058 --
41059 END IF;
41060 --
41061 -- Bug 4922099
41062 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
41063 (NVL(l_enc_upg_option, 'N') = 'O')
41064 ) AND
41065 (l_bflow_method_code = 'PRIOR_ENTRY')
41066 )
41070 1 = 2
41067 THEN
41068 IF
41069 --
41071 --
41072 THEN
41073 xla_accounting_err_pkg.build_message
41074 (p_appli_s_name => 'XLA'
41075 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
41076 ,p_token_1 => 'LINE_NUMBER'
41077 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
41078 ,p_token_2 => 'LINE_TYPE_NAME'
41079 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
41080 l_component_type
41081 ,l_component_code
41082 ,l_component_type_code
41083 ,l_component_appl_id
41084 ,l_amb_context_code
41085 ,l_entity_code
41086 ,l_event_class_code
41087 )
41088 ,p_token_3 => 'OWNER'
41089 ,p_value_3 => xla_lookups_pkg.get_meaning(
41090 p_lookup_type => 'XLA_OWNER_TYPE'
41091 ,p_lookup_code => l_component_type_code
41092 )
41093 ,p_token_4 => 'PRODUCT_NAME'
41094 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
41095 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
41096 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
41097 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
41098 ,p_ae_header_id => NULL
41099 );
41100
41101 IF (C_LEVEL_ERROR>= g_log_level) THEN
41102 trace
41103 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
41104 ,p_level => C_LEVEL_ERROR
41105 ,p_module => l_log_module);
41106 END IF;
41107 END IF;
41108 END IF;
41109 --
41110 --
41111 ------------------------------------------------------------------------------------------------
41112 -- 4219869 Business Flow
41113 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
41114 -- Prior Entry. Currently, the following code is always generated.
41115 ------------------------------------------------------------------------------------------------
41116 XLA_AE_LINES_PKG.ValidateCurrentLine;
41117
41118 ------------------------------------------------------------------------------------
41119 -- 4219869 Business Flow
41120 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
41121 ------------------------------------------------------------------------------------
41122 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
41123
41124 ----------------------------------------------------------------------------------
41125 -- 4219869 Business Flow
41126 -- Update journal entry status -- Need to generate this within IF <condition>
41127 ----------------------------------------------------------------------------------
41128 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
41129 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
41130 ,p_balance_type_code => l_balance_type_code
41131 );
41132
41133 -------------------------------------------------------------------------------------------
41134 -- 4262811 - Generate the Accrual Reversal lines
41135 -------------------------------------------------------------------------------------------
41136 BEGIN
41137 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
41138 (g_array_event(p_event_id).array_value_num('header_index'));
41139 IF l_acc_rev_flag IS NULL THEN
41140 l_acc_rev_flag := 'N';
41141 END IF;
41142 EXCEPTION
41143 WHEN OTHERS THEN
41144 l_acc_rev_flag := 'N';
41145 END;
41146 --
41147 IF (l_acc_rev_flag = 'Y') THEN
41148
41149 -- 4645092 ------------------------------------------------------------------------------
41150 -- To allow MPA report to determine if it should generate report process
41151 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
41152 ------------------------------------------------------------------------------------------
41153
41154 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
41155 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
41156 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
41157 -- call ADRs
41158 -- Bug 4922099
41159 --
41163 )
41160 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
41161 (NVL(l_actual_upg_option, 'N') = 'O') OR
41162 (NVL(l_enc_upg_option, 'N') = 'O')
41164 THEN
41165 NULL;
41166 --
41167 --
41168
41169 l_ccid := AcctDerRule_172(
41170 p_application_id => p_application_id
41171 , p_ae_header_id => l_ae_header_id
41172 , p_source_5 => p_source_5
41173 , p_source_8 => p_source_8
41174 , p_source_32 => p_source_32
41175 , x_transaction_coa_id => l_adr_transaction_coa_id
41176 , x_accounting_coa_id => l_adr_accounting_coa_id
41177 , x_value_type_code => l_adr_value_type_code
41178 , p_side => 'NA'
41179 );
41180
41181 xla_ae_lines_pkg.set_ccid(
41182 p_code_combination_id => l_ccid
41183 , p_value_type_code => l_adr_value_type_code
41184 , p_transaction_coa_id => l_adr_transaction_coa_id
41185 , p_accounting_coa_id => l_adr_accounting_coa_id
41186 , p_adr_code => 'FA_CAT_CIP_COST_CLEARING'
41187 , p_adr_type_code => 'S'
41188 , p_component_type => l_component_type
41189 , p_component_code => l_component_code
41190 , p_component_type_code => l_component_type_code
41191 , p_component_appl_id => l_component_appl_id
41192 , p_amb_context_code => l_amb_context_code
41193 , p_side => 'NA'
41194 );
41195
41196
41197 l_segment := AcctDerRule_146(
41198 p_application_id => p_application_id
41199 , p_ae_header_id => l_ae_header_id
41200 , p_source_5 => p_source_5
41201 , p_source_7 => p_source_7
41202 , p_source_8 => p_source_8
41203 , x_transaction_coa_id => l_adr_transaction_coa_id
41204 , x_accounting_coa_id => l_adr_accounting_coa_id
41205 , x_flexfield_segment_code => l_adr_flexfield_segment_code
41206 , x_flex_value_set_id => l_adr_flex_value_set_id
41207 , x_value_type_code => l_adr_value_type_code
41208 , x_value_combination_id => l_adr_value_combination_id
41209 , x_value_segment_code => l_adr_value_segment_code
41210 , p_side => 'NA'
41211 , p_override_seg_flag => 'Y'
41212 );
41213
41214 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
41215
41216 xla_ae_lines_pkg.set_segment(
41217 p_to_segment_code => 'GL_ACCOUNT'
41218 , p_segment_value => l_segment
41219 , p_from_segment_code => l_adr_value_segment_code
41220 , p_from_combination_id => l_adr_value_combination_id
41221 , p_value_type_code => l_adr_value_type_code
41222 , p_transaction_coa_id => l_adr_transaction_coa_id
41223 , p_accounting_coa_id => l_adr_accounting_coa_id
41224 , p_flexfield_segment_code => l_adr_flexfield_segment_code
41225 , p_flex_value_set_id => l_adr_flex_value_set_id
41226 , p_adr_code => 'FA_CAT_CIP_CLR_SEGMENT'
41227 , p_adr_type_code => 'S'
41228 , p_component_type => l_component_type
41229 , p_component_code => l_component_code
41230 , p_component_type_code => l_component_type_code
41231 , p_component_appl_id => l_component_appl_id
41232 , p_amb_context_code => l_amb_context_code
41233 , p_entity_code => 'TRANSACTIONS'
41234 , p_event_class_code => 'CIP_ADJUSTMENTS'
41235 , p_side => 'NA'
41236 );
41237
41238 END IF;
41239
41240 l_segment := AcctDerRule_170(
41241 p_application_id => p_application_id
41242 , p_ae_header_id => l_ae_header_id
41243 , p_source_5 => p_source_5
41244 , p_source_8 => p_source_8
41245 , p_source_31 => p_source_31
41246 , x_transaction_coa_id => l_adr_transaction_coa_id
41247 , x_accounting_coa_id => l_adr_accounting_coa_id
41248 , x_flexfield_segment_code => l_adr_flexfield_segment_code
41249 , x_flex_value_set_id => l_adr_flex_value_set_id
41250 , x_value_type_code => l_adr_value_type_code
41251 , x_value_combination_id => l_adr_value_combination_id
41252 , x_value_segment_code => l_adr_value_segment_code
41253 , p_side => 'NA'
41254 , p_override_seg_flag => 'Y'
41255 );
41256
41257 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
41258
41259 xla_ae_lines_pkg.set_segment(
41260 p_to_segment_code => 'GL_BALANCING'
41261 , p_segment_value => l_segment
41262 , p_from_segment_code => l_adr_value_segment_code
41263 , p_from_combination_id => l_adr_value_combination_id
41264 , p_value_type_code => l_adr_value_type_code
41265 , p_transaction_coa_id => l_adr_transaction_coa_id
41266 , p_accounting_coa_id => l_adr_accounting_coa_id
41267 , p_flexfield_segment_code => l_adr_flexfield_segment_code
41268 , p_flex_value_set_id => l_adr_flex_value_set_id
41269 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
41270 , p_adr_type_code => 'S'
41274 , p_component_appl_id => l_component_appl_id
41271 , p_component_type => l_component_type
41272 , p_component_code => l_component_code
41273 , p_component_type_code => l_component_type_code
41275 , p_amb_context_code => l_amb_context_code
41276 , p_entity_code => 'TRANSACTIONS'
41277 , p_event_class_code => 'CIP_ADJUSTMENTS'
41278 , p_side => 'NA'
41279 );
41280
41281 END IF;
41282
41283 --
41284 --
41285 END IF;
41286
41287 --
41288 -- Update the line information that should be overwritten
41289 --
41290 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
41291 p_header_num => 1);
41292 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
41293
41294 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
41295
41296 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
41297 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
41298 END IF;
41299
41300 --
41301 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
41302 --
41303 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
41304 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
41305 ELSE
41306 ---------------------------------------------------------------------------------------------------
41307 -- 4262811a Switch Sign
41308 ---------------------------------------------------------------------------------------------------
41309 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
41310 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
41311 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
41312 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
41313 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
41314 -- 5132302
41315 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
41316 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
41317
41318 END IF;
41319
41320 -- 4955764
41321 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
41322 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
41323
41324
41325 XLA_AE_LINES_PKG.ValidateCurrentLine;
41326 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
41327
41328 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
41329 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
41330 ,p_balance_type_code => l_balance_type_code);
41331
41332 END IF;
41333
41334 -----------------------------------------------------------------------------------------
41335 -- 4262811 Multiperiod Accounting
41336 -----------------------------------------------------------------------------------------
41337 -- No MPA option is assigned.
41338
41339
41340 END IF;
41341 END IF;
41342 --
41343
41344 --
41345 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
41346 trace
41347 (p_msg => 'END of AcctLineType_222'
41348 ,p_level => C_LEVEL_PROCEDURE
41349 ,p_module => l_log_module);
41350 END IF;
41351 --
41352 EXCEPTION
41353 WHEN xla_exceptions_pkg.application_exception THEN
41354 RAISE;
41355 WHEN OTHERS THEN
41356 xla_exceptions_pkg.raise_message
41357 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_222');
41358 END AcctLineType_222;
41359 --
41360
41361 ---------------------------------------
41362 --
41363 -- PRIVATE FUNCTION
41364 -- AcctLineType_223
41365 --
41366 ---------------------------------------
41367 PROCEDURE AcctLineType_223 (
41368 p_application_id IN NUMBER
41369 ,p_event_id IN NUMBER
41370 ,p_calculate_acctd_flag IN VARCHAR2
41371 ,p_calculate_g_l_flag IN VARCHAR2
41372 ,p_actual_flag IN OUT VARCHAR2
41373 ,p_balance_type_code OUT VARCHAR2
41374 ,p_gain_or_loss_ref OUT VARCHAR2
41375
41376 --Period Close Date
41377 , p_source_1 IN DATE
41378 --Generated Code Combination Identifier
41379 , p_source_5 IN NUMBER
41380 --Cost Of Removal Clearing Account
41381 , p_source_14 IN VARCHAR2
41382 --Expense Account Code Combination Identifier
41383 , p_source_31 IN NUMBER
41384 --Default Code Combination Identifier
41385 , p_source_32 IN NUMBER
41386 --Adjustment Type
41387 , p_source_48 IN VARCHAR2
41388 --Transaction Header Identifier
41389 , p_source_49 IN NUMBER
41390 --Adjustment Line Identifier
41391 , p_source_50 IN NUMBER
41392 --Distribution Type Code
41396 --Currency Code
41393 , p_source_51 IN VARCHAR2
41394 --Entered Amount
41395 , p_source_52 IN NUMBER
41397 , p_source_53 IN VARCHAR2
41398 )
41399 IS
41400
41401 l_component_type VARCHAR2(80);
41402 l_component_code VARCHAR2(30);
41403 l_component_type_code VARCHAR2(1);
41404 l_component_appl_id INTEGER;
41405 l_amb_context_code VARCHAR2(30);
41406 l_entity_code VARCHAR2(30);
41407 l_event_class_code VARCHAR2(30);
41408 l_ae_header_id NUMBER;
41409 l_event_type_code VARCHAR2(30);
41410 l_line_definition_code VARCHAR2(30);
41411 l_line_definition_owner_code VARCHAR2(1);
41412 --
41413 -- adr variables
41414 l_segment VARCHAR2(30);
41415 l_ccid NUMBER;
41416 l_adr_transaction_coa_id NUMBER;
41417 l_adr_accounting_coa_id NUMBER;
41418 l_adr_flexfield_segment_code VARCHAR2(30);
41419 l_adr_flex_value_set_id NUMBER;
41420 l_adr_value_type_code VARCHAR2(30);
41421 l_adr_value_combination_id NUMBER;
41422 l_adr_value_segment_code VARCHAR2(30);
41423
41424 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
41425 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
41426 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
41427 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
41428
41429 -- 4262811 Variables ------------------------------------------------------------------------------------------
41430 l_entered_amt_idx NUMBER;
41431 l_accted_amt_idx NUMBER;
41432 l_acc_rev_flag VARCHAR2(1);
41433 l_accrual_line_num NUMBER;
41434 l_tmp_amt NUMBER;
41435 l_acc_rev_natural_side_code VARCHAR2(1);
41436
41437 l_num_entries NUMBER;
41438 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
41439 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
41440 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
41441 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
41442 l_recog_line_1 NUMBER;
41443 l_recog_line_2 NUMBER;
41444
41445 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
41446 l_bflow_applied_to_amt NUMBER; -- 5132302
41447 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
41448
41449 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
41450
41451 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
41452 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
41453
41454 ---------------------------------------------------------------------------------------------------------------
41455
41456
41457 --
41458 -- bulk performance
41459 --
41460 l_balance_type_code VARCHAR2(1);
41461 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
41462 l_log_module VARCHAR2(240);
41463
41464 --
41465 -- Upgrade strategy
41466 --
41467 l_actual_upg_option VARCHAR2(1);
41468 l_enc_upg_option VARCHAR2(1);
41469
41470 --
41471 BEGIN
41472 --
41473 IF g_log_enabled THEN
41474 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_223';
41475 END IF;
41476 --
41477 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
41478
41479 trace
41480 (p_msg => 'BEGIN of AcctLineType_223'
41481 ,p_level => C_LEVEL_PROCEDURE
41482 ,p_module => l_log_module);
41483
41484 END IF;
41485 --
41486 l_component_type := 'AMB_JLT';
41487 l_component_code := 'FA_CIP_COST_OF_REMOVAL_CLR';
41488 l_component_type_code := 'S';
41489 l_component_appl_id := 140;
41490 l_amb_context_code := 'DEFAULT';
41491 l_entity_code := 'TRANSACTIONS';
41492 l_event_class_code := 'CIP_RETIREMENTS';
41493 l_event_type_code := 'CIP_REINSTATEMENTS';
41494 l_line_definition_owner_code := 'S';
41495 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
41496 --
41497 l_balance_type_code := 'A';
41498 l_segment := NULL;
41499 l_ccid := NULL;
41500 l_adr_transaction_coa_id := NULL;
41501 l_adr_accounting_coa_id := NULL;
41502 l_adr_flexfield_segment_code := NULL;
41503 l_adr_flex_value_set_id := NULL;
41504 l_adr_value_type_code := NULL;
41505 l_adr_value_combination_id := NULL;
41506 l_adr_value_segment_code := NULL;
41507
41508 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
41509 l_bflow_class_code := ''; -- 4219869 Business Flow
41510 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
41511 l_budgetary_control_flag := 'N';
41512
41513 l_bflow_applied_to_amt_idx := NULL; -- 5132302
41514 l_bflow_applied_to_amt := NULL; -- 5132302
41515 l_entered_amt_idx := NULL; -- 4262811
41516 l_accted_amt_idx := NULL; -- 4262811
41517 l_acc_rev_flag := NULL; -- 4262811
41518 l_accrual_line_num := NULL; -- 4262811
41519 l_tmp_amt := NULL; -- 4262811
41520 --
41521
41525 ') = 'REMOVALCOST CLR'
41522 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
41523 l_balance_type_code <> 'B' THEN
41524 IF NVL(p_source_48,'
41526 THEN
41527
41528 --
41529 XLA_AE_LINES_PKG.SetNewLine;
41530
41531 p_balance_type_code := l_balance_type_code;
41532 -- set the flag so later we will know whether the gain loss line needs to be created
41533
41534 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
41535 p_actual_flag :='A';
41536 END IF;
41537
41538 --
41539 -- bulk performance
41540 --
41541 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
41542 p_header_num => 0); -- 4262811
41543 --
41544 -- set accounting line options
41545 --
41546 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
41547 p_natural_side_code => 'C'
41548 , p_gain_or_loss_flag => 'N'
41549 , p_gl_transfer_mode_code => 'S'
41550 , p_acct_entry_type_code => 'A'
41551 , p_switch_side_flag => 'Y'
41552 , p_merge_duplicate_code => 'N'
41553 );
41554 --
41555 l_acc_rev_natural_side_code := 'D'; -- 4262811
41556 --
41557 --
41558 -- set accounting line type info
41559 --
41560 xla_ae_lines_pkg.SetAcctLineType
41561 (p_component_type => l_component_type
41562 ,p_event_type_code => l_event_type_code
41563 ,p_line_definition_owner_code => l_line_definition_owner_code
41564 ,p_line_definition_code => l_line_definition_code
41565 ,p_accounting_line_code => l_component_code
41566 ,p_accounting_line_type_code => l_component_type_code
41567 ,p_accounting_line_appl_id => l_component_appl_id
41568 ,p_amb_context_code => l_amb_context_code
41569 ,p_entity_code => l_entity_code
41570 ,p_event_class_code => l_event_class_code);
41571 --
41572 -- set accounting class
41573 --
41574 xla_ae_lines_pkg.SetAcctClass(
41575 p_accounting_class_code => 'ASSET'
41576 , p_ae_header_id => l_ae_header_id
41577 );
41578
41579 --
41580 -- set rounding class
41581 --
41582 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
41583 'ASSET';
41584
41585 --
41586 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
41587 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
41588 --
41589 -- bulk performance
41590 --
41591 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
41592
41593 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
41594 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
41595
41596 -- 4955764
41597 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
41598 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
41599
41600 -- 4458381 Public Sector Enh
41601
41602 --
41603 -- set accounting attributes for the line type
41604 --
41605 l_entered_amt_idx := 4;
41606 l_accted_amt_idx := 6;
41607 l_bflow_applied_to_amt_idx := NULL; -- 5132302
41608 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
41609 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
41610 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
41611 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
41612 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
41613 l_rec_acct_attrs.array_char_value(3) := p_source_51;
41614 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
41615 l_rec_acct_attrs.array_num_value(4) := p_source_52;
41616 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
41617 l_rec_acct_attrs.array_char_value(5) := p_source_53;
41618 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
41619 l_rec_acct_attrs.array_num_value(6) := p_source_52;
41620
41621 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
41622 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
41623
41624 ---------------------------------------------------------------------------------------------------------------
41625 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
41626 ---------------------------------------------------------------------------------------------------------------
41627 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
41628
41629 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
41630 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
41631
41632 IF xla_accounting_cache_pkg.GetValueChar
41633 (p_source_code => 'LEDGER_CATEGORY_CODE'
41634 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
41638 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
41635 AND l_bflow_method_code = 'PRIOR_ENTRY'
41636 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
41637 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
41639 )
41640 THEN
41641 xla_ae_lines_pkg.BflowUpgEntry
41642 (p_business_method_code => l_bflow_method_code
41643 ,p_business_class_code => l_bflow_class_code
41644 ,p_balance_type => l_balance_type_code);
41645 ELSE
41646 NULL;
41647 -- No business flow processing for business flow method of NONE.
41648 END IF;
41649
41650 --
41651 -- call analytical criteria
41652 --
41653
41654 --
41655 -- call description
41656 --
41657
41658 xla_ae_lines_pkg.SetLineDescription(
41659 p_ae_header_id => l_ae_header_id
41660 ,p_description => Description_37 (
41661 p_application_id => p_application_id
41662 , p_ae_header_id => l_ae_header_id
41663 , p_source_1 => p_source_1
41664 )
41665 );
41666
41667
41668 --
41669 -- call ADRs
41670 -- Bug 4922099
41671 --
41672 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
41673 (NVL(l_actual_upg_option, 'N') = 'O') OR
41674 (NVL(l_enc_upg_option, 'N') = 'O')
41675 )
41676 THEN
41677 NULL;
41678 --
41679 --
41680
41681 l_ccid := AcctDerRule_174(
41682 p_application_id => p_application_id
41683 , p_ae_header_id => l_ae_header_id
41684 , p_source_5 => p_source_5
41685 , p_source_32 => p_source_32
41686 , x_transaction_coa_id => l_adr_transaction_coa_id
41687 , x_accounting_coa_id => l_adr_accounting_coa_id
41688 , x_value_type_code => l_adr_value_type_code
41689 , p_side => 'NA'
41690 );
41691
41692 xla_ae_lines_pkg.set_ccid(
41693 p_code_combination_id => l_ccid
41694 , p_value_type_code => l_adr_value_type_code
41695 , p_transaction_coa_id => l_adr_transaction_coa_id
41696 , p_accounting_coa_id => l_adr_accounting_coa_id
41697 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
41698 , p_adr_type_code => 'S'
41699 , p_component_type => l_component_type
41700 , p_component_code => l_component_code
41701 , p_component_type_code => l_component_type_code
41702 , p_component_appl_id => l_component_appl_id
41703 , p_amb_context_code => l_amb_context_code
41704 , p_side => 'NA'
41705 );
41706
41707
41708 l_segment := AcctDerRule_152(
41709 p_application_id => p_application_id
41710 , p_ae_header_id => l_ae_header_id
41711 , p_source_5 => p_source_5
41712 , p_source_14 => p_source_14
41713 , x_transaction_coa_id => l_adr_transaction_coa_id
41714 , x_accounting_coa_id => l_adr_accounting_coa_id
41715 , x_flexfield_segment_code => l_adr_flexfield_segment_code
41716 , x_flex_value_set_id => l_adr_flex_value_set_id
41717 , x_value_type_code => l_adr_value_type_code
41718 , x_value_combination_id => l_adr_value_combination_id
41719 , x_value_segment_code => l_adr_value_segment_code
41720 , p_side => 'NA'
41721 , p_override_seg_flag => 'Y'
41722 );
41723
41724 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
41725
41726 xla_ae_lines_pkg.set_segment(
41727 p_to_segment_code => 'GL_ACCOUNT'
41728 , p_segment_value => l_segment
41729 , p_from_segment_code => l_adr_value_segment_code
41730 , p_from_combination_id => l_adr_value_combination_id
41731 , p_value_type_code => l_adr_value_type_code
41732 , p_transaction_coa_id => l_adr_transaction_coa_id
41733 , p_accounting_coa_id => l_adr_accounting_coa_id
41734 , p_flexfield_segment_code => l_adr_flexfield_segment_code
41735 , p_flex_value_set_id => l_adr_flex_value_set_id
41736 , p_adr_code => 'FA_COST_OF_REMOVAL_CLR_SEGMENT'
41737 , p_adr_type_code => 'S'
41738 , p_component_type => l_component_type
41739 , p_component_code => l_component_code
41740 , p_component_type_code => l_component_type_code
41741 , p_component_appl_id => l_component_appl_id
41742 , p_amb_context_code => l_amb_context_code
41743 , p_entity_code => 'TRANSACTIONS'
41744 , p_event_class_code => 'CIP_RETIREMENTS'
41745 , p_side => 'NA'
41746 );
41747
41748 END IF;
41749
41750 l_segment := AcctDerRule_169(
41751 p_application_id => p_application_id
41752 , p_ae_header_id => l_ae_header_id
41753 , p_source_5 => p_source_5
41754 , p_source_31 => p_source_31
41755 , x_transaction_coa_id => l_adr_transaction_coa_id
41756 , x_accounting_coa_id => l_adr_accounting_coa_id
41757 , x_flexfield_segment_code => l_adr_flexfield_segment_code
41758 , x_flex_value_set_id => l_adr_flex_value_set_id
41762 , p_side => 'NA'
41759 , x_value_type_code => l_adr_value_type_code
41760 , x_value_combination_id => l_adr_value_combination_id
41761 , x_value_segment_code => l_adr_value_segment_code
41763 , p_override_seg_flag => 'Y'
41764 );
41765
41766 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
41767
41768 xla_ae_lines_pkg.set_segment(
41769 p_to_segment_code => 'GL_BALANCING'
41770 , p_segment_value => l_segment
41771 , p_from_segment_code => l_adr_value_segment_code
41772 , p_from_combination_id => l_adr_value_combination_id
41773 , p_value_type_code => l_adr_value_type_code
41774 , p_transaction_coa_id => l_adr_transaction_coa_id
41775 , p_accounting_coa_id => l_adr_accounting_coa_id
41776 , p_flexfield_segment_code => l_adr_flexfield_segment_code
41777 , p_flex_value_set_id => l_adr_flex_value_set_id
41778 , p_adr_code => 'FA_EXPENSE_ACCT'
41779 , p_adr_type_code => 'S'
41780 , p_component_type => l_component_type
41781 , p_component_code => l_component_code
41782 , p_component_type_code => l_component_type_code
41783 , p_component_appl_id => l_component_appl_id
41784 , p_amb_context_code => l_amb_context_code
41785 , p_entity_code => 'TRANSACTIONS'
41786 , p_event_class_code => 'CIP_RETIREMENTS'
41787 , p_side => 'NA'
41788 );
41789
41790 END IF;
41791
41792 --
41793 --
41794 END IF;
41795 --
41796 -- Bug 4922099
41797 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
41798 (NVL(l_enc_upg_option, 'N') = 'O')
41799 ) AND
41800 (l_bflow_method_code = 'PRIOR_ENTRY')
41801 )
41802 THEN
41803 IF
41804 --
41805 1 = 2
41806 --
41807 THEN
41808 xla_accounting_err_pkg.build_message
41809 (p_appli_s_name => 'XLA'
41810 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
41811 ,p_token_1 => 'LINE_NUMBER'
41812 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
41813 ,p_token_2 => 'LINE_TYPE_NAME'
41814 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
41815 l_component_type
41816 ,l_component_code
41817 ,l_component_type_code
41818 ,l_component_appl_id
41819 ,l_amb_context_code
41820 ,l_entity_code
41821 ,l_event_class_code
41822 )
41823 ,p_token_3 => 'OWNER'
41824 ,p_value_3 => xla_lookups_pkg.get_meaning(
41825 p_lookup_type => 'XLA_OWNER_TYPE'
41826 ,p_lookup_code => l_component_type_code
41827 )
41828 ,p_token_4 => 'PRODUCT_NAME'
41829 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
41830 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
41831 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
41832 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
41833 ,p_ae_header_id => NULL
41834 );
41835
41836 IF (C_LEVEL_ERROR>= g_log_level) THEN
41837 trace
41838 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
41839 ,p_level => C_LEVEL_ERROR
41840 ,p_module => l_log_module);
41841 END IF;
41842 END IF;
41843 END IF;
41844 --
41845 --
41846 ------------------------------------------------------------------------------------------------
41847 -- 4219869 Business Flow
41848 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
41849 -- Prior Entry. Currently, the following code is always generated.
41850 ------------------------------------------------------------------------------------------------
41851 XLA_AE_LINES_PKG.ValidateCurrentLine;
41852
41853 ------------------------------------------------------------------------------------
41854 -- 4219869 Business Flow
41855 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
41859 ----------------------------------------------------------------------------------
41856 ------------------------------------------------------------------------------------
41857 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
41858
41860 -- 4219869 Business Flow
41861 -- Update journal entry status -- Need to generate this within IF <condition>
41862 ----------------------------------------------------------------------------------
41863 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
41864 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
41865 ,p_balance_type_code => l_balance_type_code
41866 );
41867
41868 -------------------------------------------------------------------------------------------
41869 -- 4262811 - Generate the Accrual Reversal lines
41870 -------------------------------------------------------------------------------------------
41871 BEGIN
41872 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
41873 (g_array_event(p_event_id).array_value_num('header_index'));
41874 IF l_acc_rev_flag IS NULL THEN
41875 l_acc_rev_flag := 'N';
41876 END IF;
41877 EXCEPTION
41878 WHEN OTHERS THEN
41879 l_acc_rev_flag := 'N';
41880 END;
41881 --
41882 IF (l_acc_rev_flag = 'Y') THEN
41883
41884 -- 4645092 ------------------------------------------------------------------------------
41885 -- To allow MPA report to determine if it should generate report process
41886 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
41887 ------------------------------------------------------------------------------------------
41888
41889 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
41890 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
41891 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
41892 -- call ADRs
41893 -- Bug 4922099
41894 --
41895 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
41896 (NVL(l_actual_upg_option, 'N') = 'O') OR
41897 (NVL(l_enc_upg_option, 'N') = 'O')
41898 )
41899 THEN
41900 NULL;
41901 --
41902 --
41903
41904 l_ccid := AcctDerRule_174(
41905 p_application_id => p_application_id
41906 , p_ae_header_id => l_ae_header_id
41907 , p_source_5 => p_source_5
41908 , p_source_32 => p_source_32
41909 , x_transaction_coa_id => l_adr_transaction_coa_id
41910 , x_accounting_coa_id => l_adr_accounting_coa_id
41911 , x_value_type_code => l_adr_value_type_code
41912 , p_side => 'NA'
41913 );
41914
41915 xla_ae_lines_pkg.set_ccid(
41916 p_code_combination_id => l_ccid
41917 , p_value_type_code => l_adr_value_type_code
41918 , p_transaction_coa_id => l_adr_transaction_coa_id
41919 , p_accounting_coa_id => l_adr_accounting_coa_id
41920 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
41921 , p_adr_type_code => 'S'
41922 , p_component_type => l_component_type
41923 , p_component_code => l_component_code
41924 , p_component_type_code => l_component_type_code
41925 , p_component_appl_id => l_component_appl_id
41926 , p_amb_context_code => l_amb_context_code
41927 , p_side => 'NA'
41928 );
41929
41930
41931 l_segment := AcctDerRule_152(
41932 p_application_id => p_application_id
41933 , p_ae_header_id => l_ae_header_id
41934 , p_source_5 => p_source_5
41935 , p_source_14 => p_source_14
41936 , x_transaction_coa_id => l_adr_transaction_coa_id
41937 , x_accounting_coa_id => l_adr_accounting_coa_id
41938 , x_flexfield_segment_code => l_adr_flexfield_segment_code
41939 , x_flex_value_set_id => l_adr_flex_value_set_id
41940 , x_value_type_code => l_adr_value_type_code
41941 , x_value_combination_id => l_adr_value_combination_id
41942 , x_value_segment_code => l_adr_value_segment_code
41943 , p_side => 'NA'
41944 , p_override_seg_flag => 'Y'
41945 );
41946
41947 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
41948
41949 xla_ae_lines_pkg.set_segment(
41950 p_to_segment_code => 'GL_ACCOUNT'
41951 , p_segment_value => l_segment
41952 , p_from_segment_code => l_adr_value_segment_code
41953 , p_from_combination_id => l_adr_value_combination_id
41954 , p_value_type_code => l_adr_value_type_code
41955 , p_transaction_coa_id => l_adr_transaction_coa_id
41956 , p_accounting_coa_id => l_adr_accounting_coa_id
41957 , p_flexfield_segment_code => l_adr_flexfield_segment_code
41958 , p_flex_value_set_id => l_adr_flex_value_set_id
41959 , p_adr_code => 'FA_COST_OF_REMOVAL_CLR_SEGMENT'
41960 , p_adr_type_code => 'S'
41961 , p_component_type => l_component_type
41962 , p_component_code => l_component_code
41963 , p_component_type_code => l_component_type_code
41964 , p_component_appl_id => l_component_appl_id
41965 , p_amb_context_code => l_amb_context_code
41966 , p_entity_code => 'TRANSACTIONS'
41967 , p_event_class_code => 'CIP_RETIREMENTS'
41971 END IF;
41968 , p_side => 'NA'
41969 );
41970
41972
41973 l_segment := AcctDerRule_169(
41974 p_application_id => p_application_id
41975 , p_ae_header_id => l_ae_header_id
41976 , p_source_5 => p_source_5
41977 , p_source_31 => p_source_31
41978 , x_transaction_coa_id => l_adr_transaction_coa_id
41979 , x_accounting_coa_id => l_adr_accounting_coa_id
41980 , x_flexfield_segment_code => l_adr_flexfield_segment_code
41981 , x_flex_value_set_id => l_adr_flex_value_set_id
41982 , x_value_type_code => l_adr_value_type_code
41983 , x_value_combination_id => l_adr_value_combination_id
41984 , x_value_segment_code => l_adr_value_segment_code
41985 , p_side => 'NA'
41986 , p_override_seg_flag => 'Y'
41987 );
41988
41989 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
41990
41991 xla_ae_lines_pkg.set_segment(
41992 p_to_segment_code => 'GL_BALANCING'
41993 , p_segment_value => l_segment
41994 , p_from_segment_code => l_adr_value_segment_code
41995 , p_from_combination_id => l_adr_value_combination_id
41996 , p_value_type_code => l_adr_value_type_code
41997 , p_transaction_coa_id => l_adr_transaction_coa_id
41998 , p_accounting_coa_id => l_adr_accounting_coa_id
41999 , p_flexfield_segment_code => l_adr_flexfield_segment_code
42000 , p_flex_value_set_id => l_adr_flex_value_set_id
42001 , p_adr_code => 'FA_EXPENSE_ACCT'
42002 , p_adr_type_code => 'S'
42003 , p_component_type => l_component_type
42004 , p_component_code => l_component_code
42005 , p_component_type_code => l_component_type_code
42006 , p_component_appl_id => l_component_appl_id
42007 , p_amb_context_code => l_amb_context_code
42008 , p_entity_code => 'TRANSACTIONS'
42009 , p_event_class_code => 'CIP_RETIREMENTS'
42010 , p_side => 'NA'
42011 );
42012
42013 END IF;
42014
42015 --
42016 --
42017 END IF;
42018
42019 --
42020 -- Update the line information that should be overwritten
42021 --
42022 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
42023 p_header_num => 1);
42024 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
42025
42026 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
42027
42028 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
42029 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
42030 END IF;
42031
42032 --
42033 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
42034 --
42035 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
42036 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
42037 ELSE
42038 ---------------------------------------------------------------------------------------------------
42039 -- 4262811a Switch Sign
42040 ---------------------------------------------------------------------------------------------------
42041 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
42042 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
42043 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
42044 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
42045 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
42046 -- 5132302
42047 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
42048 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
42049
42050 END IF;
42051
42052 -- 4955764
42053 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
42054 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
42055
42056
42057 XLA_AE_LINES_PKG.ValidateCurrentLine;
42058 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
42059
42060 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
42061 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
42062 ,p_balance_type_code => l_balance_type_code);
42063
42064 END IF;
42065
42066 -----------------------------------------------------------------------------------------
42067 -- 4262811 Multiperiod Accounting
42068 -----------------------------------------------------------------------------------------
42069 -- No MPA option is assigned.
42070
42071
42072 END IF;
42073 END IF;
42074 --
42075
42076 --
42077 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
42078 trace
42082 END IF;
42079 (p_msg => 'END of AcctLineType_223'
42080 ,p_level => C_LEVEL_PROCEDURE
42081 ,p_module => l_log_module);
42083 --
42084 EXCEPTION
42085 WHEN xla_exceptions_pkg.application_exception THEN
42086 RAISE;
42087 WHEN OTHERS THEN
42088 xla_exceptions_pkg.raise_message
42089 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_223');
42090 END AcctLineType_223;
42091 --
42092
42093 ---------------------------------------
42094 --
42095 -- PRIVATE FUNCTION
42096 -- AcctLineType_224
42097 --
42098 ---------------------------------------
42099 PROCEDURE AcctLineType_224 (
42100 p_application_id IN NUMBER
42101 ,p_event_id IN NUMBER
42102 ,p_calculate_acctd_flag IN VARCHAR2
42103 ,p_calculate_g_l_flag IN VARCHAR2
42104 ,p_actual_flag IN OUT VARCHAR2
42105 ,p_balance_type_code OUT VARCHAR2
42106 ,p_gain_or_loss_ref OUT VARCHAR2
42107
42108 --Period Close Date
42109 , p_source_1 IN DATE
42110 --Generated Code Combination Identifier
42111 , p_source_5 IN NUMBER
42112 --Cost Of Removal Clearing Account
42113 , p_source_14 IN VARCHAR2
42114 --Expense Account Code Combination Identifier
42115 , p_source_31 IN NUMBER
42116 --Default Code Combination Identifier
42117 , p_source_32 IN NUMBER
42118 --Adjustment Type
42119 , p_source_48 IN VARCHAR2
42120 --Transaction Header Identifier
42121 , p_source_49 IN NUMBER
42122 --Adjustment Line Identifier
42123 , p_source_50 IN NUMBER
42124 --Distribution Type Code
42125 , p_source_51 IN VARCHAR2
42126 --Entered Amount
42127 , p_source_52 IN NUMBER
42128 --Currency Code
42129 , p_source_53 IN VARCHAR2
42130 )
42131 IS
42132
42133 l_component_type VARCHAR2(80);
42134 l_component_code VARCHAR2(30);
42135 l_component_type_code VARCHAR2(1);
42136 l_component_appl_id INTEGER;
42137 l_amb_context_code VARCHAR2(30);
42138 l_entity_code VARCHAR2(30);
42139 l_event_class_code VARCHAR2(30);
42140 l_ae_header_id NUMBER;
42141 l_event_type_code VARCHAR2(30);
42142 l_line_definition_code VARCHAR2(30);
42143 l_line_definition_owner_code VARCHAR2(1);
42144 --
42145 -- adr variables
42146 l_segment VARCHAR2(30);
42147 l_ccid NUMBER;
42148 l_adr_transaction_coa_id NUMBER;
42149 l_adr_accounting_coa_id NUMBER;
42150 l_adr_flexfield_segment_code VARCHAR2(30);
42151 l_adr_flex_value_set_id NUMBER;
42152 l_adr_value_type_code VARCHAR2(30);
42153 l_adr_value_combination_id NUMBER;
42154 l_adr_value_segment_code VARCHAR2(30);
42155
42156 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
42157 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
42158 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
42159 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
42160
42161 -- 4262811 Variables ------------------------------------------------------------------------------------------
42162 l_entered_amt_idx NUMBER;
42163 l_accted_amt_idx NUMBER;
42164 l_acc_rev_flag VARCHAR2(1);
42165 l_accrual_line_num NUMBER;
42166 l_tmp_amt NUMBER;
42167 l_acc_rev_natural_side_code VARCHAR2(1);
42168
42169 l_num_entries NUMBER;
42170 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
42171 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
42172 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
42173 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
42174 l_recog_line_1 NUMBER;
42175 l_recog_line_2 NUMBER;
42176
42177 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
42178 l_bflow_applied_to_amt NUMBER; -- 5132302
42179 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
42180
42181 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
42182
42183 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
42184 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
42185
42186 ---------------------------------------------------------------------------------------------------------------
42187
42188
42189 --
42190 -- bulk performance
42191 --
42192 l_balance_type_code VARCHAR2(1);
42193 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
42194 l_log_module VARCHAR2(240);
42195
42196 --
42197 -- Upgrade strategy
42198 --
42199 l_actual_upg_option VARCHAR2(1);
42200 l_enc_upg_option VARCHAR2(1);
42201
42202 --
42203 BEGIN
42204 --
42205 IF g_log_enabled THEN
42206 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_224';
42207 END IF;
42208 --
42209 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
42210
42211 trace
42212 (p_msg => 'BEGIN of AcctLineType_224'
42216 END IF;
42213 ,p_level => C_LEVEL_PROCEDURE
42214 ,p_module => l_log_module);
42215
42217 --
42218 l_component_type := 'AMB_JLT';
42219 l_component_code := 'FA_CIP_COST_OF_REMOVAL_CLR';
42220 l_component_type_code := 'S';
42221 l_component_appl_id := 140;
42222 l_amb_context_code := 'DEFAULT';
42223 l_entity_code := 'TRANSACTIONS';
42224 l_event_class_code := 'CIP_RETIREMENTS';
42225 l_event_type_code := 'CIP_RETIREMENTS';
42226 l_line_definition_owner_code := 'S';
42227 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
42228 --
42229 l_balance_type_code := 'A';
42230 l_segment := NULL;
42231 l_ccid := NULL;
42232 l_adr_transaction_coa_id := NULL;
42233 l_adr_accounting_coa_id := NULL;
42234 l_adr_flexfield_segment_code := NULL;
42235 l_adr_flex_value_set_id := NULL;
42236 l_adr_value_type_code := NULL;
42237 l_adr_value_combination_id := NULL;
42238 l_adr_value_segment_code := NULL;
42239
42240 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
42241 l_bflow_class_code := ''; -- 4219869 Business Flow
42242 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
42243 l_budgetary_control_flag := 'N';
42244
42245 l_bflow_applied_to_amt_idx := NULL; -- 5132302
42246 l_bflow_applied_to_amt := NULL; -- 5132302
42247 l_entered_amt_idx := NULL; -- 4262811
42248 l_accted_amt_idx := NULL; -- 4262811
42249 l_acc_rev_flag := NULL; -- 4262811
42250 l_accrual_line_num := NULL; -- 4262811
42251 l_tmp_amt := NULL; -- 4262811
42252 --
42253
42254 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
42255 l_balance_type_code <> 'B' THEN
42256 IF NVL(p_source_48,'
42257 ') = 'REMOVALCOST CLR'
42258 THEN
42259
42260 --
42261 XLA_AE_LINES_PKG.SetNewLine;
42262
42263 p_balance_type_code := l_balance_type_code;
42264 -- set the flag so later we will know whether the gain loss line needs to be created
42265
42266 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
42267 p_actual_flag :='A';
42268 END IF;
42269
42270 --
42271 -- bulk performance
42272 --
42273 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
42274 p_header_num => 0); -- 4262811
42275 --
42276 -- set accounting line options
42277 --
42278 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
42279 p_natural_side_code => 'C'
42280 , p_gain_or_loss_flag => 'N'
42281 , p_gl_transfer_mode_code => 'S'
42282 , p_acct_entry_type_code => 'A'
42283 , p_switch_side_flag => 'Y'
42284 , p_merge_duplicate_code => 'N'
42285 );
42286 --
42287 l_acc_rev_natural_side_code := 'D'; -- 4262811
42288 --
42289 --
42290 -- set accounting line type info
42291 --
42292 xla_ae_lines_pkg.SetAcctLineType
42293 (p_component_type => l_component_type
42294 ,p_event_type_code => l_event_type_code
42295 ,p_line_definition_owner_code => l_line_definition_owner_code
42296 ,p_line_definition_code => l_line_definition_code
42297 ,p_accounting_line_code => l_component_code
42298 ,p_accounting_line_type_code => l_component_type_code
42299 ,p_accounting_line_appl_id => l_component_appl_id
42300 ,p_amb_context_code => l_amb_context_code
42301 ,p_entity_code => l_entity_code
42302 ,p_event_class_code => l_event_class_code);
42303 --
42304 -- set accounting class
42305 --
42306 xla_ae_lines_pkg.SetAcctClass(
42307 p_accounting_class_code => 'ASSET'
42308 , p_ae_header_id => l_ae_header_id
42309 );
42310
42311 --
42312 -- set rounding class
42313 --
42314 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
42315 'ASSET';
42316
42317 --
42318 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
42319 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
42320 --
42321 -- bulk performance
42322 --
42323 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
42324
42325 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
42326 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
42327
42328 -- 4955764
42329 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
42330 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
42331
42332 -- 4458381 Public Sector Enh
42333
42334 --
42335 -- set accounting attributes for the line type
42336 --
42337 l_entered_amt_idx := 4;
42338 l_accted_amt_idx := 6;
42339 l_bflow_applied_to_amt_idx := NULL; -- 5132302
42343 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
42340 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
42341 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
42342 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
42344 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
42345 l_rec_acct_attrs.array_char_value(3) := p_source_51;
42346 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
42347 l_rec_acct_attrs.array_num_value(4) := p_source_52;
42348 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
42349 l_rec_acct_attrs.array_char_value(5) := p_source_53;
42350 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
42351 l_rec_acct_attrs.array_num_value(6) := p_source_52;
42352
42353 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
42354 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
42355
42356 ---------------------------------------------------------------------------------------------------------------
42357 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
42358 ---------------------------------------------------------------------------------------------------------------
42359 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
42360
42361 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
42362 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
42363
42364 IF xla_accounting_cache_pkg.GetValueChar
42365 (p_source_code => 'LEDGER_CATEGORY_CODE'
42366 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
42367 AND l_bflow_method_code = 'PRIOR_ENTRY'
42368 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
42369 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
42370 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
42371 )
42372 THEN
42373 xla_ae_lines_pkg.BflowUpgEntry
42374 (p_business_method_code => l_bflow_method_code
42375 ,p_business_class_code => l_bflow_class_code
42376 ,p_balance_type => l_balance_type_code);
42377 ELSE
42378 NULL;
42379 -- No business flow processing for business flow method of NONE.
42380 END IF;
42381
42382 --
42383 -- call analytical criteria
42384 --
42385
42386 --
42387 -- call description
42388 --
42389
42390 xla_ae_lines_pkg.SetLineDescription(
42391 p_ae_header_id => l_ae_header_id
42392 ,p_description => Description_37 (
42393 p_application_id => p_application_id
42394 , p_ae_header_id => l_ae_header_id
42395 , p_source_1 => p_source_1
42396 )
42397 );
42398
42399
42400 --
42401 -- call ADRs
42402 -- Bug 4922099
42403 --
42404 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
42405 (NVL(l_actual_upg_option, 'N') = 'O') OR
42406 (NVL(l_enc_upg_option, 'N') = 'O')
42407 )
42408 THEN
42409 NULL;
42410 --
42411 --
42412
42413 l_ccid := AcctDerRule_174(
42414 p_application_id => p_application_id
42415 , p_ae_header_id => l_ae_header_id
42416 , p_source_5 => p_source_5
42417 , p_source_32 => p_source_32
42418 , x_transaction_coa_id => l_adr_transaction_coa_id
42419 , x_accounting_coa_id => l_adr_accounting_coa_id
42420 , x_value_type_code => l_adr_value_type_code
42421 , p_side => 'NA'
42422 );
42423
42424 xla_ae_lines_pkg.set_ccid(
42425 p_code_combination_id => l_ccid
42426 , p_value_type_code => l_adr_value_type_code
42427 , p_transaction_coa_id => l_adr_transaction_coa_id
42428 , p_accounting_coa_id => l_adr_accounting_coa_id
42429 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
42430 , p_adr_type_code => 'S'
42431 , p_component_type => l_component_type
42432 , p_component_code => l_component_code
42433 , p_component_type_code => l_component_type_code
42434 , p_component_appl_id => l_component_appl_id
42435 , p_amb_context_code => l_amb_context_code
42436 , p_side => 'NA'
42437 );
42438
42439
42440 l_segment := AcctDerRule_152(
42441 p_application_id => p_application_id
42442 , p_ae_header_id => l_ae_header_id
42443 , p_source_5 => p_source_5
42444 , p_source_14 => p_source_14
42445 , x_transaction_coa_id => l_adr_transaction_coa_id
42446 , x_accounting_coa_id => l_adr_accounting_coa_id
42447 , x_flexfield_segment_code => l_adr_flexfield_segment_code
42448 , x_flex_value_set_id => l_adr_flex_value_set_id
42449 , x_value_type_code => l_adr_value_type_code
42450 , x_value_combination_id => l_adr_value_combination_id
42451 , x_value_segment_code => l_adr_value_segment_code
42452 , p_side => 'NA'
42453 , p_override_seg_flag => 'Y'
42454 );
42455
42456 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
42457
42458 xla_ae_lines_pkg.set_segment(
42462 , p_from_combination_id => l_adr_value_combination_id
42459 p_to_segment_code => 'GL_ACCOUNT'
42460 , p_segment_value => l_segment
42461 , p_from_segment_code => l_adr_value_segment_code
42463 , p_value_type_code => l_adr_value_type_code
42464 , p_transaction_coa_id => l_adr_transaction_coa_id
42465 , p_accounting_coa_id => l_adr_accounting_coa_id
42466 , p_flexfield_segment_code => l_adr_flexfield_segment_code
42467 , p_flex_value_set_id => l_adr_flex_value_set_id
42468 , p_adr_code => 'FA_COST_OF_REMOVAL_CLR_SEGMENT'
42469 , p_adr_type_code => 'S'
42470 , p_component_type => l_component_type
42471 , p_component_code => l_component_code
42472 , p_component_type_code => l_component_type_code
42473 , p_component_appl_id => l_component_appl_id
42474 , p_amb_context_code => l_amb_context_code
42475 , p_entity_code => 'TRANSACTIONS'
42476 , p_event_class_code => 'CIP_RETIREMENTS'
42477 , p_side => 'NA'
42478 );
42479
42480 END IF;
42481
42482 l_segment := AcctDerRule_169(
42483 p_application_id => p_application_id
42484 , p_ae_header_id => l_ae_header_id
42485 , p_source_5 => p_source_5
42486 , p_source_31 => p_source_31
42487 , x_transaction_coa_id => l_adr_transaction_coa_id
42488 , x_accounting_coa_id => l_adr_accounting_coa_id
42489 , x_flexfield_segment_code => l_adr_flexfield_segment_code
42490 , x_flex_value_set_id => l_adr_flex_value_set_id
42491 , x_value_type_code => l_adr_value_type_code
42492 , x_value_combination_id => l_adr_value_combination_id
42493 , x_value_segment_code => l_adr_value_segment_code
42494 , p_side => 'NA'
42495 , p_override_seg_flag => 'Y'
42496 );
42497
42498 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
42499
42500 xla_ae_lines_pkg.set_segment(
42501 p_to_segment_code => 'GL_BALANCING'
42502 , p_segment_value => l_segment
42503 , p_from_segment_code => l_adr_value_segment_code
42504 , p_from_combination_id => l_adr_value_combination_id
42505 , p_value_type_code => l_adr_value_type_code
42506 , p_transaction_coa_id => l_adr_transaction_coa_id
42507 , p_accounting_coa_id => l_adr_accounting_coa_id
42508 , p_flexfield_segment_code => l_adr_flexfield_segment_code
42509 , p_flex_value_set_id => l_adr_flex_value_set_id
42510 , p_adr_code => 'FA_EXPENSE_ACCT'
42511 , p_adr_type_code => 'S'
42512 , p_component_type => l_component_type
42513 , p_component_code => l_component_code
42514 , p_component_type_code => l_component_type_code
42515 , p_component_appl_id => l_component_appl_id
42516 , p_amb_context_code => l_amb_context_code
42517 , p_entity_code => 'TRANSACTIONS'
42518 , p_event_class_code => 'CIP_RETIREMENTS'
42519 , p_side => 'NA'
42520 );
42521
42522 END IF;
42523
42524 --
42525 --
42526 END IF;
42527 --
42528 -- Bug 4922099
42529 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
42530 (NVL(l_enc_upg_option, 'N') = 'O')
42531 ) AND
42532 (l_bflow_method_code = 'PRIOR_ENTRY')
42533 )
42534 THEN
42535 IF
42536 --
42537 1 = 2
42538 --
42539 THEN
42540 xla_accounting_err_pkg.build_message
42541 (p_appli_s_name => 'XLA'
42542 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
42543 ,p_token_1 => 'LINE_NUMBER'
42544 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
42545 ,p_token_2 => 'LINE_TYPE_NAME'
42546 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
42547 l_component_type
42548 ,l_component_code
42549 ,l_component_type_code
42550 ,l_component_appl_id
42551 ,l_amb_context_code
42552 ,l_entity_code
42553 ,l_event_class_code
42554 )
42555 ,p_token_3 => 'OWNER'
42556 ,p_value_3 => xla_lookups_pkg.get_meaning(
42557 p_lookup_type => 'XLA_OWNER_TYPE'
42558 ,p_lookup_code => l_component_type_code
42562 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
42559 )
42560 ,p_token_4 => 'PRODUCT_NAME'
42561 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
42563 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
42564 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
42565 ,p_ae_header_id => NULL
42566 );
42567
42568 IF (C_LEVEL_ERROR>= g_log_level) THEN
42569 trace
42570 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
42571 ,p_level => C_LEVEL_ERROR
42572 ,p_module => l_log_module);
42573 END IF;
42574 END IF;
42575 END IF;
42576 --
42577 --
42578 ------------------------------------------------------------------------------------------------
42579 -- 4219869 Business Flow
42580 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
42581 -- Prior Entry. Currently, the following code is always generated.
42582 ------------------------------------------------------------------------------------------------
42583 XLA_AE_LINES_PKG.ValidateCurrentLine;
42584
42585 ------------------------------------------------------------------------------------
42586 -- 4219869 Business Flow
42587 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
42588 ------------------------------------------------------------------------------------
42589 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
42590
42591 ----------------------------------------------------------------------------------
42592 -- 4219869 Business Flow
42593 -- Update journal entry status -- Need to generate this within IF <condition>
42594 ----------------------------------------------------------------------------------
42595 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
42596 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
42597 ,p_balance_type_code => l_balance_type_code
42598 );
42599
42600 -------------------------------------------------------------------------------------------
42601 -- 4262811 - Generate the Accrual Reversal lines
42602 -------------------------------------------------------------------------------------------
42603 BEGIN
42604 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
42605 (g_array_event(p_event_id).array_value_num('header_index'));
42606 IF l_acc_rev_flag IS NULL THEN
42607 l_acc_rev_flag := 'N';
42608 END IF;
42609 EXCEPTION
42610 WHEN OTHERS THEN
42611 l_acc_rev_flag := 'N';
42612 END;
42613 --
42614 IF (l_acc_rev_flag = 'Y') THEN
42615
42616 -- 4645092 ------------------------------------------------------------------------------
42617 -- To allow MPA report to determine if it should generate report process
42618 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
42619 ------------------------------------------------------------------------------------------
42620
42621 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
42622 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
42623 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
42624 -- call ADRs
42625 -- Bug 4922099
42626 --
42627 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
42628 (NVL(l_actual_upg_option, 'N') = 'O') OR
42629 (NVL(l_enc_upg_option, 'N') = 'O')
42630 )
42631 THEN
42632 NULL;
42633 --
42634 --
42635
42636 l_ccid := AcctDerRule_174(
42637 p_application_id => p_application_id
42638 , p_ae_header_id => l_ae_header_id
42639 , p_source_5 => p_source_5
42640 , p_source_32 => p_source_32
42641 , x_transaction_coa_id => l_adr_transaction_coa_id
42642 , x_accounting_coa_id => l_adr_accounting_coa_id
42643 , x_value_type_code => l_adr_value_type_code
42644 , p_side => 'NA'
42645 );
42646
42647 xla_ae_lines_pkg.set_ccid(
42648 p_code_combination_id => l_ccid
42649 , p_value_type_code => l_adr_value_type_code
42650 , p_transaction_coa_id => l_adr_transaction_coa_id
42651 , p_accounting_coa_id => l_adr_accounting_coa_id
42652 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
42653 , p_adr_type_code => 'S'
42654 , p_component_type => l_component_type
42655 , p_component_code => l_component_code
42656 , p_component_type_code => l_component_type_code
42657 , p_component_appl_id => l_component_appl_id
42658 , p_amb_context_code => l_amb_context_code
42659 , p_side => 'NA'
42660 );
42661
42662
42663 l_segment := AcctDerRule_152(
42664 p_application_id => p_application_id
42665 , p_ae_header_id => l_ae_header_id
42669 , x_accounting_coa_id => l_adr_accounting_coa_id
42666 , p_source_5 => p_source_5
42667 , p_source_14 => p_source_14
42668 , x_transaction_coa_id => l_adr_transaction_coa_id
42670 , x_flexfield_segment_code => l_adr_flexfield_segment_code
42671 , x_flex_value_set_id => l_adr_flex_value_set_id
42672 , x_value_type_code => l_adr_value_type_code
42673 , x_value_combination_id => l_adr_value_combination_id
42674 , x_value_segment_code => l_adr_value_segment_code
42675 , p_side => 'NA'
42676 , p_override_seg_flag => 'Y'
42677 );
42678
42679 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
42680
42681 xla_ae_lines_pkg.set_segment(
42682 p_to_segment_code => 'GL_ACCOUNT'
42683 , p_segment_value => l_segment
42684 , p_from_segment_code => l_adr_value_segment_code
42685 , p_from_combination_id => l_adr_value_combination_id
42686 , p_value_type_code => l_adr_value_type_code
42687 , p_transaction_coa_id => l_adr_transaction_coa_id
42688 , p_accounting_coa_id => l_adr_accounting_coa_id
42689 , p_flexfield_segment_code => l_adr_flexfield_segment_code
42690 , p_flex_value_set_id => l_adr_flex_value_set_id
42691 , p_adr_code => 'FA_COST_OF_REMOVAL_CLR_SEGMENT'
42692 , p_adr_type_code => 'S'
42693 , p_component_type => l_component_type
42694 , p_component_code => l_component_code
42695 , p_component_type_code => l_component_type_code
42696 , p_component_appl_id => l_component_appl_id
42697 , p_amb_context_code => l_amb_context_code
42698 , p_entity_code => 'TRANSACTIONS'
42699 , p_event_class_code => 'CIP_RETIREMENTS'
42700 , p_side => 'NA'
42701 );
42702
42703 END IF;
42704
42705 l_segment := AcctDerRule_169(
42706 p_application_id => p_application_id
42707 , p_ae_header_id => l_ae_header_id
42708 , p_source_5 => p_source_5
42709 , p_source_31 => p_source_31
42710 , x_transaction_coa_id => l_adr_transaction_coa_id
42711 , x_accounting_coa_id => l_adr_accounting_coa_id
42712 , x_flexfield_segment_code => l_adr_flexfield_segment_code
42713 , x_flex_value_set_id => l_adr_flex_value_set_id
42714 , x_value_type_code => l_adr_value_type_code
42715 , x_value_combination_id => l_adr_value_combination_id
42716 , x_value_segment_code => l_adr_value_segment_code
42717 , p_side => 'NA'
42718 , p_override_seg_flag => 'Y'
42719 );
42720
42721 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
42722
42723 xla_ae_lines_pkg.set_segment(
42724 p_to_segment_code => 'GL_BALANCING'
42725 , p_segment_value => l_segment
42726 , p_from_segment_code => l_adr_value_segment_code
42727 , p_from_combination_id => l_adr_value_combination_id
42728 , p_value_type_code => l_adr_value_type_code
42729 , p_transaction_coa_id => l_adr_transaction_coa_id
42730 , p_accounting_coa_id => l_adr_accounting_coa_id
42731 , p_flexfield_segment_code => l_adr_flexfield_segment_code
42732 , p_flex_value_set_id => l_adr_flex_value_set_id
42733 , p_adr_code => 'FA_EXPENSE_ACCT'
42734 , p_adr_type_code => 'S'
42735 , p_component_type => l_component_type
42736 , p_component_code => l_component_code
42737 , p_component_type_code => l_component_type_code
42738 , p_component_appl_id => l_component_appl_id
42739 , p_amb_context_code => l_amb_context_code
42740 , p_entity_code => 'TRANSACTIONS'
42741 , p_event_class_code => 'CIP_RETIREMENTS'
42742 , p_side => 'NA'
42743 );
42744
42745 END IF;
42746
42747 --
42748 --
42749 END IF;
42750
42751 --
42752 -- Update the line information that should be overwritten
42753 --
42754 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
42755 p_header_num => 1);
42756 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
42757
42758 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
42759
42760 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
42761 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
42762 END IF;
42763
42764 --
42765 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
42766 --
42767 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
42768 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
42769 ELSE
42770 ---------------------------------------------------------------------------------------------------
42771 -- 4262811a Switch Sign
42775 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
42772 ---------------------------------------------------------------------------------------------------
42773 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
42774 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
42776 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
42777 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
42778 -- 5132302
42779 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
42780 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
42781
42782 END IF;
42783
42784 -- 4955764
42785 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
42786 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
42787
42788
42789 XLA_AE_LINES_PKG.ValidateCurrentLine;
42790 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
42791
42792 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
42793 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
42794 ,p_balance_type_code => l_balance_type_code);
42795
42796 END IF;
42797
42798 -----------------------------------------------------------------------------------------
42799 -- 4262811 Multiperiod Accounting
42800 -----------------------------------------------------------------------------------------
42801 -- No MPA option is assigned.
42802
42803
42804 END IF;
42805 END IF;
42806 --
42807
42808 --
42809 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
42810 trace
42811 (p_msg => 'END of AcctLineType_224'
42812 ,p_level => C_LEVEL_PROCEDURE
42813 ,p_module => l_log_module);
42814 END IF;
42815 --
42816 EXCEPTION
42817 WHEN xla_exceptions_pkg.application_exception THEN
42818 RAISE;
42819 WHEN OTHERS THEN
42820 xla_exceptions_pkg.raise_message
42821 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_224');
42822 END AcctLineType_224;
42823 --
42824
42825 ---------------------------------------
42826 --
42827 -- PRIVATE FUNCTION
42828 -- AcctLineType_225
42829 --
42830 ---------------------------------------
42831 PROCEDURE AcctLineType_225 (
42832 p_application_id IN NUMBER
42833 ,p_event_id IN NUMBER
42834 ,p_calculate_acctd_flag IN VARCHAR2
42835 ,p_calculate_g_l_flag IN VARCHAR2
42836 ,p_actual_flag IN OUT VARCHAR2
42837 ,p_balance_type_code OUT VARCHAR2
42838 ,p_gain_or_loss_ref OUT VARCHAR2
42839
42840 --Period Close Date
42841 , p_source_1 IN DATE
42842 --Generated Code Combination Identifier
42843 , p_source_5 IN NUMBER
42844 --Cost Of Removal Gain Account
42845 , p_source_15 IN VARCHAR2
42846 --Expense Account Code Combination Identifier
42847 , p_source_31 IN NUMBER
42848 --Default Code Combination Identifier
42849 , p_source_32 IN NUMBER
42850 --Adjustment Type
42851 , p_source_48 IN VARCHAR2
42852 --Transaction Header Identifier
42853 , p_source_49 IN NUMBER
42854 --Adjustment Line Identifier
42855 , p_source_50 IN NUMBER
42856 --Distribution Type Code
42857 , p_source_51 IN VARCHAR2
42858 --Entered Amount
42859 , p_source_52 IN NUMBER
42860 --Currency Code
42861 , p_source_53 IN VARCHAR2
42862 --Gain Loss Amount
42863 , p_source_54 IN NUMBER
42864 )
42865 IS
42866
42867 l_component_type VARCHAR2(80);
42868 l_component_code VARCHAR2(30);
42869 l_component_type_code VARCHAR2(1);
42870 l_component_appl_id INTEGER;
42871 l_amb_context_code VARCHAR2(30);
42872 l_entity_code VARCHAR2(30);
42873 l_event_class_code VARCHAR2(30);
42874 l_ae_header_id NUMBER;
42875 l_event_type_code VARCHAR2(30);
42876 l_line_definition_code VARCHAR2(30);
42877 l_line_definition_owner_code VARCHAR2(1);
42878 --
42879 -- adr variables
42880 l_segment VARCHAR2(30);
42881 l_ccid NUMBER;
42882 l_adr_transaction_coa_id NUMBER;
42883 l_adr_accounting_coa_id NUMBER;
42884 l_adr_flexfield_segment_code VARCHAR2(30);
42885 l_adr_flex_value_set_id NUMBER;
42886 l_adr_value_type_code VARCHAR2(30);
42887 l_adr_value_combination_id NUMBER;
42888 l_adr_value_segment_code VARCHAR2(30);
42889
42890 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
42891 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
42892 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
42893 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
42894
42895 -- 4262811 Variables ------------------------------------------------------------------------------------------
42896 l_entered_amt_idx NUMBER;
42897 l_accted_amt_idx NUMBER;
42898 l_acc_rev_flag VARCHAR2(1);
42899 l_accrual_line_num NUMBER;
42900 l_tmp_amt NUMBER;
42904 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
42901 l_acc_rev_natural_side_code VARCHAR2(1);
42902
42903 l_num_entries NUMBER;
42905 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
42906 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
42907 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
42908 l_recog_line_1 NUMBER;
42909 l_recog_line_2 NUMBER;
42910
42911 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
42912 l_bflow_applied_to_amt NUMBER; -- 5132302
42913 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
42914
42915 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
42916
42917 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
42918 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
42919
42920 ---------------------------------------------------------------------------------------------------------------
42921
42922
42923 --
42924 -- bulk performance
42925 --
42926 l_balance_type_code VARCHAR2(1);
42927 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
42928 l_log_module VARCHAR2(240);
42929
42930 --
42931 -- Upgrade strategy
42932 --
42933 l_actual_upg_option VARCHAR2(1);
42934 l_enc_upg_option VARCHAR2(1);
42935
42936 --
42937 BEGIN
42938 --
42939 IF g_log_enabled THEN
42940 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_225';
42941 END IF;
42942 --
42943 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
42944
42945 trace
42946 (p_msg => 'BEGIN of AcctLineType_225'
42947 ,p_level => C_LEVEL_PROCEDURE
42948 ,p_module => l_log_module);
42949
42950 END IF;
42951 --
42952 l_component_type := 'AMB_JLT';
42953 l_component_code := 'FA_CIP_COST_OF_REMOVAL_GAIN';
42954 l_component_type_code := 'S';
42955 l_component_appl_id := 140;
42956 l_amb_context_code := 'DEFAULT';
42957 l_entity_code := 'TRANSACTIONS';
42958 l_event_class_code := 'CIP_RETIREMENTS';
42959 l_event_type_code := 'CIP_RETIREMENTS';
42960 l_line_definition_owner_code := 'S';
42961 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
42962 --
42963 l_balance_type_code := 'A';
42964 l_segment := NULL;
42965 l_ccid := NULL;
42966 l_adr_transaction_coa_id := NULL;
42967 l_adr_accounting_coa_id := NULL;
42968 l_adr_flexfield_segment_code := NULL;
42969 l_adr_flex_value_set_id := NULL;
42970 l_adr_value_type_code := NULL;
42971 l_adr_value_combination_id := NULL;
42972 l_adr_value_segment_code := NULL;
42973
42974 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
42975 l_bflow_class_code := ''; -- 4219869 Business Flow
42976 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
42977 l_budgetary_control_flag := 'N';
42978
42979 l_bflow_applied_to_amt_idx := NULL; -- 5132302
42980 l_bflow_applied_to_amt := NULL; -- 5132302
42981 l_entered_amt_idx := NULL; -- 4262811
42982 l_accted_amt_idx := NULL; -- 4262811
42983 l_acc_rev_flag := NULL; -- 4262811
42984 l_accrual_line_num := NULL; -- 4262811
42985 l_tmp_amt := NULL; -- 4262811
42986 --
42987
42988 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
42989 l_balance_type_code <> 'B' THEN
42990 IF NVL(p_source_48,'
42991 ') = 'REMOVALCOST' AND
42992 p_source_54 >= 0
42993 THEN
42994
42995 --
42996 XLA_AE_LINES_PKG.SetNewLine;
42997
42998 p_balance_type_code := l_balance_type_code;
42999 -- set the flag so later we will know whether the gain loss line needs to be created
43000
43001 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
43002 p_actual_flag :='A';
43003 END IF;
43004
43005 --
43006 -- bulk performance
43007 --
43008 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
43009 p_header_num => 0); -- 4262811
43010 --
43011 -- set accounting line options
43012 --
43013 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
43014 p_natural_side_code => 'D'
43015 , p_gain_or_loss_flag => 'N'
43016 , p_gl_transfer_mode_code => 'S'
43017 , p_acct_entry_type_code => 'A'
43018 , p_switch_side_flag => 'Y'
43019 , p_merge_duplicate_code => 'N'
43020 );
43021 --
43022 l_acc_rev_natural_side_code := 'C'; -- 4262811
43023 --
43024 --
43025 -- set accounting line type info
43026 --
43027 xla_ae_lines_pkg.SetAcctLineType
43028 (p_component_type => l_component_type
43029 ,p_event_type_code => l_event_type_code
43030 ,p_line_definition_owner_code => l_line_definition_owner_code
43031 ,p_line_definition_code => l_line_definition_code
43035 ,p_amb_context_code => l_amb_context_code
43032 ,p_accounting_line_code => l_component_code
43033 ,p_accounting_line_type_code => l_component_type_code
43034 ,p_accounting_line_appl_id => l_component_appl_id
43036 ,p_entity_code => l_entity_code
43037 ,p_event_class_code => l_event_class_code);
43038 --
43039 -- set accounting class
43040 --
43041 xla_ae_lines_pkg.SetAcctClass(
43042 p_accounting_class_code => 'ASSET'
43043 , p_ae_header_id => l_ae_header_id
43044 );
43045
43046 --
43047 -- set rounding class
43048 --
43049 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
43050 'ASSET';
43051
43052 --
43053 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
43054 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
43055 --
43056 -- bulk performance
43057 --
43058 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
43059
43060 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
43061 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
43062
43063 -- 4955764
43064 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
43065 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
43066
43067 -- 4458381 Public Sector Enh
43068
43069 --
43070 -- set accounting attributes for the line type
43071 --
43072 l_entered_amt_idx := 4;
43073 l_accted_amt_idx := 6;
43074 l_bflow_applied_to_amt_idx := NULL; -- 5132302
43075 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
43076 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
43077 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
43078 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
43079 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
43080 l_rec_acct_attrs.array_char_value(3) := p_source_51;
43081 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
43082 l_rec_acct_attrs.array_num_value(4) := p_source_52;
43083 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
43084 l_rec_acct_attrs.array_char_value(5) := p_source_53;
43085 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
43086 l_rec_acct_attrs.array_num_value(6) := p_source_52;
43087
43088 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
43089 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
43090
43091 ---------------------------------------------------------------------------------------------------------------
43092 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
43093 ---------------------------------------------------------------------------------------------------------------
43094 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
43095
43096 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
43097 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
43098
43099 IF xla_accounting_cache_pkg.GetValueChar
43100 (p_source_code => 'LEDGER_CATEGORY_CODE'
43101 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
43102 AND l_bflow_method_code = 'PRIOR_ENTRY'
43103 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
43104 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
43105 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
43106 )
43107 THEN
43108 xla_ae_lines_pkg.BflowUpgEntry
43109 (p_business_method_code => l_bflow_method_code
43110 ,p_business_class_code => l_bflow_class_code
43111 ,p_balance_type => l_balance_type_code);
43112 ELSE
43113 NULL;
43114 -- No business flow processing for business flow method of NONE.
43115 END IF;
43116
43117 --
43118 -- call analytical criteria
43119 --
43120
43121 --
43122 -- call description
43123 --
43124
43125 xla_ae_lines_pkg.SetLineDescription(
43126 p_ae_header_id => l_ae_header_id
43127 ,p_description => Description_36 (
43128 p_application_id => p_application_id
43129 , p_ae_header_id => l_ae_header_id
43130 , p_source_1 => p_source_1
43131 )
43132 );
43133
43134
43135 --
43136 -- call ADRs
43137 -- Bug 4922099
43138 --
43139 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
43140 (NVL(l_actual_upg_option, 'N') = 'O') OR
43141 (NVL(l_enc_upg_option, 'N') = 'O')
43142 )
43143 THEN
43144 NULL;
43145 --
43146 --
43147
43148 l_ccid := AcctDerRule_174(
43149 p_application_id => p_application_id
43150 , p_ae_header_id => l_ae_header_id
43151 , p_source_5 => p_source_5
43152 , p_source_32 => p_source_32
43156 , p_side => 'NA'
43153 , x_transaction_coa_id => l_adr_transaction_coa_id
43154 , x_accounting_coa_id => l_adr_accounting_coa_id
43155 , x_value_type_code => l_adr_value_type_code
43157 );
43158
43159 xla_ae_lines_pkg.set_ccid(
43160 p_code_combination_id => l_ccid
43161 , p_value_type_code => l_adr_value_type_code
43162 , p_transaction_coa_id => l_adr_transaction_coa_id
43163 , p_accounting_coa_id => l_adr_accounting_coa_id
43164 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
43165 , p_adr_type_code => 'S'
43166 , p_component_type => l_component_type
43167 , p_component_code => l_component_code
43168 , p_component_type_code => l_component_type_code
43169 , p_component_appl_id => l_component_appl_id
43170 , p_amb_context_code => l_amb_context_code
43171 , p_side => 'NA'
43172 );
43173
43174
43175 l_segment := AcctDerRule_153(
43176 p_application_id => p_application_id
43177 , p_ae_header_id => l_ae_header_id
43178 , p_source_5 => p_source_5
43179 , p_source_15 => p_source_15
43180 , x_transaction_coa_id => l_adr_transaction_coa_id
43181 , x_accounting_coa_id => l_adr_accounting_coa_id
43182 , x_flexfield_segment_code => l_adr_flexfield_segment_code
43183 , x_flex_value_set_id => l_adr_flex_value_set_id
43184 , x_value_type_code => l_adr_value_type_code
43185 , x_value_combination_id => l_adr_value_combination_id
43186 , x_value_segment_code => l_adr_value_segment_code
43187 , p_side => 'NA'
43188 , p_override_seg_flag => 'Y'
43189 );
43190
43191 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
43192
43193 xla_ae_lines_pkg.set_segment(
43194 p_to_segment_code => 'GL_ACCOUNT'
43195 , p_segment_value => l_segment
43196 , p_from_segment_code => l_adr_value_segment_code
43197 , p_from_combination_id => l_adr_value_combination_id
43198 , p_value_type_code => l_adr_value_type_code
43199 , p_transaction_coa_id => l_adr_transaction_coa_id
43200 , p_accounting_coa_id => l_adr_accounting_coa_id
43201 , p_flexfield_segment_code => l_adr_flexfield_segment_code
43202 , p_flex_value_set_id => l_adr_flex_value_set_id
43203 , p_adr_code => 'FA_COST_OF_REM_GAIN_SEGMENT'
43204 , p_adr_type_code => 'S'
43205 , p_component_type => l_component_type
43206 , p_component_code => l_component_code
43207 , p_component_type_code => l_component_type_code
43208 , p_component_appl_id => l_component_appl_id
43209 , p_amb_context_code => l_amb_context_code
43210 , p_entity_code => 'TRANSACTIONS'
43211 , p_event_class_code => 'CIP_RETIREMENTS'
43212 , p_side => 'NA'
43213 );
43214
43215 END IF;
43216
43217 l_segment := AcctDerRule_169(
43218 p_application_id => p_application_id
43219 , p_ae_header_id => l_ae_header_id
43220 , p_source_5 => p_source_5
43221 , p_source_31 => p_source_31
43222 , x_transaction_coa_id => l_adr_transaction_coa_id
43223 , x_accounting_coa_id => l_adr_accounting_coa_id
43224 , x_flexfield_segment_code => l_adr_flexfield_segment_code
43225 , x_flex_value_set_id => l_adr_flex_value_set_id
43226 , x_value_type_code => l_adr_value_type_code
43227 , x_value_combination_id => l_adr_value_combination_id
43228 , x_value_segment_code => l_adr_value_segment_code
43229 , p_side => 'NA'
43230 , p_override_seg_flag => 'Y'
43231 );
43232
43233 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
43234
43235 xla_ae_lines_pkg.set_segment(
43236 p_to_segment_code => 'GL_BALANCING'
43237 , p_segment_value => l_segment
43238 , p_from_segment_code => l_adr_value_segment_code
43239 , p_from_combination_id => l_adr_value_combination_id
43240 , p_value_type_code => l_adr_value_type_code
43241 , p_transaction_coa_id => l_adr_transaction_coa_id
43242 , p_accounting_coa_id => l_adr_accounting_coa_id
43243 , p_flexfield_segment_code => l_adr_flexfield_segment_code
43244 , p_flex_value_set_id => l_adr_flex_value_set_id
43245 , p_adr_code => 'FA_EXPENSE_ACCT'
43246 , p_adr_type_code => 'S'
43247 , p_component_type => l_component_type
43248 , p_component_code => l_component_code
43249 , p_component_type_code => l_component_type_code
43250 , p_component_appl_id => l_component_appl_id
43251 , p_amb_context_code => l_amb_context_code
43252 , p_entity_code => 'TRANSACTIONS'
43253 , p_event_class_code => 'CIP_RETIREMENTS'
43254 , p_side => 'NA'
43255 );
43256
43257 END IF;
43258
43259 --
43260 --
43261 END IF;
43265 (NVL(l_enc_upg_option, 'N') = 'O')
43262 --
43263 -- Bug 4922099
43264 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
43266 ) AND
43267 (l_bflow_method_code = 'PRIOR_ENTRY')
43268 )
43269 THEN
43270 IF
43271 --
43272 1 = 2
43273 --
43274 THEN
43275 xla_accounting_err_pkg.build_message
43276 (p_appli_s_name => 'XLA'
43277 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
43278 ,p_token_1 => 'LINE_NUMBER'
43279 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
43280 ,p_token_2 => 'LINE_TYPE_NAME'
43281 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
43282 l_component_type
43283 ,l_component_code
43284 ,l_component_type_code
43285 ,l_component_appl_id
43286 ,l_amb_context_code
43287 ,l_entity_code
43288 ,l_event_class_code
43289 )
43290 ,p_token_3 => 'OWNER'
43291 ,p_value_3 => xla_lookups_pkg.get_meaning(
43292 p_lookup_type => 'XLA_OWNER_TYPE'
43293 ,p_lookup_code => l_component_type_code
43294 )
43295 ,p_token_4 => 'PRODUCT_NAME'
43296 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
43297 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
43298 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
43299 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
43300 ,p_ae_header_id => NULL
43301 );
43302
43303 IF (C_LEVEL_ERROR>= g_log_level) THEN
43304 trace
43305 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
43306 ,p_level => C_LEVEL_ERROR
43307 ,p_module => l_log_module);
43308 END IF;
43309 END IF;
43310 END IF;
43311 --
43312 --
43313 ------------------------------------------------------------------------------------------------
43314 -- 4219869 Business Flow
43315 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
43316 -- Prior Entry. Currently, the following code is always generated.
43317 ------------------------------------------------------------------------------------------------
43318 XLA_AE_LINES_PKG.ValidateCurrentLine;
43319
43320 ------------------------------------------------------------------------------------
43321 -- 4219869 Business Flow
43322 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
43323 ------------------------------------------------------------------------------------
43324 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
43325
43326 ----------------------------------------------------------------------------------
43327 -- 4219869 Business Flow
43328 -- Update journal entry status -- Need to generate this within IF <condition>
43329 ----------------------------------------------------------------------------------
43330 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
43331 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
43332 ,p_balance_type_code => l_balance_type_code
43333 );
43334
43335 -------------------------------------------------------------------------------------------
43336 -- 4262811 - Generate the Accrual Reversal lines
43337 -------------------------------------------------------------------------------------------
43338 BEGIN
43339 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
43340 (g_array_event(p_event_id).array_value_num('header_index'));
43341 IF l_acc_rev_flag IS NULL THEN
43342 l_acc_rev_flag := 'N';
43343 END IF;
43344 EXCEPTION
43345 WHEN OTHERS THEN
43346 l_acc_rev_flag := 'N';
43347 END;
43348 --
43349 IF (l_acc_rev_flag = 'Y') THEN
43350
43351 -- 4645092 ------------------------------------------------------------------------------
43352 -- To allow MPA report to determine if it should generate report process
43353 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
43354 ------------------------------------------------------------------------------------------
43355
43356 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
43360 -- Bug 4922099
43357 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
43358 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
43359 -- call ADRs
43361 --
43362 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
43363 (NVL(l_actual_upg_option, 'N') = 'O') OR
43364 (NVL(l_enc_upg_option, 'N') = 'O')
43365 )
43366 THEN
43367 NULL;
43368 --
43369 --
43370
43371 l_ccid := AcctDerRule_174(
43372 p_application_id => p_application_id
43373 , p_ae_header_id => l_ae_header_id
43374 , p_source_5 => p_source_5
43375 , p_source_32 => p_source_32
43376 , x_transaction_coa_id => l_adr_transaction_coa_id
43377 , x_accounting_coa_id => l_adr_accounting_coa_id
43378 , x_value_type_code => l_adr_value_type_code
43379 , p_side => 'NA'
43380 );
43381
43382 xla_ae_lines_pkg.set_ccid(
43383 p_code_combination_id => l_ccid
43384 , p_value_type_code => l_adr_value_type_code
43385 , p_transaction_coa_id => l_adr_transaction_coa_id
43386 , p_accounting_coa_id => l_adr_accounting_coa_id
43387 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
43388 , p_adr_type_code => 'S'
43389 , p_component_type => l_component_type
43390 , p_component_code => l_component_code
43391 , p_component_type_code => l_component_type_code
43392 , p_component_appl_id => l_component_appl_id
43393 , p_amb_context_code => l_amb_context_code
43394 , p_side => 'NA'
43395 );
43396
43397
43398 l_segment := AcctDerRule_153(
43399 p_application_id => p_application_id
43400 , p_ae_header_id => l_ae_header_id
43401 , p_source_5 => p_source_5
43402 , p_source_15 => p_source_15
43403 , x_transaction_coa_id => l_adr_transaction_coa_id
43404 , x_accounting_coa_id => l_adr_accounting_coa_id
43405 , x_flexfield_segment_code => l_adr_flexfield_segment_code
43406 , x_flex_value_set_id => l_adr_flex_value_set_id
43407 , x_value_type_code => l_adr_value_type_code
43408 , x_value_combination_id => l_adr_value_combination_id
43409 , x_value_segment_code => l_adr_value_segment_code
43410 , p_side => 'NA'
43411 , p_override_seg_flag => 'Y'
43412 );
43413
43414 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
43415
43416 xla_ae_lines_pkg.set_segment(
43417 p_to_segment_code => 'GL_ACCOUNT'
43418 , p_segment_value => l_segment
43419 , p_from_segment_code => l_adr_value_segment_code
43420 , p_from_combination_id => l_adr_value_combination_id
43421 , p_value_type_code => l_adr_value_type_code
43422 , p_transaction_coa_id => l_adr_transaction_coa_id
43423 , p_accounting_coa_id => l_adr_accounting_coa_id
43424 , p_flexfield_segment_code => l_adr_flexfield_segment_code
43425 , p_flex_value_set_id => l_adr_flex_value_set_id
43426 , p_adr_code => 'FA_COST_OF_REM_GAIN_SEGMENT'
43427 , p_adr_type_code => 'S'
43428 , p_component_type => l_component_type
43429 , p_component_code => l_component_code
43430 , p_component_type_code => l_component_type_code
43431 , p_component_appl_id => l_component_appl_id
43432 , p_amb_context_code => l_amb_context_code
43433 , p_entity_code => 'TRANSACTIONS'
43434 , p_event_class_code => 'CIP_RETIREMENTS'
43435 , p_side => 'NA'
43436 );
43437
43438 END IF;
43439
43440 l_segment := AcctDerRule_169(
43441 p_application_id => p_application_id
43442 , p_ae_header_id => l_ae_header_id
43443 , p_source_5 => p_source_5
43444 , p_source_31 => p_source_31
43445 , x_transaction_coa_id => l_adr_transaction_coa_id
43446 , x_accounting_coa_id => l_adr_accounting_coa_id
43447 , x_flexfield_segment_code => l_adr_flexfield_segment_code
43448 , x_flex_value_set_id => l_adr_flex_value_set_id
43449 , x_value_type_code => l_adr_value_type_code
43450 , x_value_combination_id => l_adr_value_combination_id
43451 , x_value_segment_code => l_adr_value_segment_code
43452 , p_side => 'NA'
43453 , p_override_seg_flag => 'Y'
43454 );
43455
43456 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
43457
43458 xla_ae_lines_pkg.set_segment(
43459 p_to_segment_code => 'GL_BALANCING'
43460 , p_segment_value => l_segment
43461 , p_from_segment_code => l_adr_value_segment_code
43462 , p_from_combination_id => l_adr_value_combination_id
43463 , p_value_type_code => l_adr_value_type_code
43464 , p_transaction_coa_id => l_adr_transaction_coa_id
43465 , p_accounting_coa_id => l_adr_accounting_coa_id
43466 , p_flexfield_segment_code => l_adr_flexfield_segment_code
43467 , p_flex_value_set_id => l_adr_flex_value_set_id
43468 , p_adr_code => 'FA_EXPENSE_ACCT'
43472 , p_component_type_code => l_component_type_code
43469 , p_adr_type_code => 'S'
43470 , p_component_type => l_component_type
43471 , p_component_code => l_component_code
43473 , p_component_appl_id => l_component_appl_id
43474 , p_amb_context_code => l_amb_context_code
43475 , p_entity_code => 'TRANSACTIONS'
43476 , p_event_class_code => 'CIP_RETIREMENTS'
43477 , p_side => 'NA'
43478 );
43479
43480 END IF;
43481
43482 --
43483 --
43484 END IF;
43485
43486 --
43487 -- Update the line information that should be overwritten
43488 --
43489 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
43490 p_header_num => 1);
43491 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
43492
43493 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
43494
43495 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
43496 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
43497 END IF;
43498
43499 --
43500 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
43501 --
43502 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
43503 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
43504 ELSE
43505 ---------------------------------------------------------------------------------------------------
43506 -- 4262811a Switch Sign
43507 ---------------------------------------------------------------------------------------------------
43508 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
43509 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
43510 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
43511 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
43512 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
43513 -- 5132302
43514 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
43515 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
43516
43517 END IF;
43518
43519 -- 4955764
43520 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
43521 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
43522
43523
43524 XLA_AE_LINES_PKG.ValidateCurrentLine;
43525 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
43526
43527 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
43528 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
43529 ,p_balance_type_code => l_balance_type_code);
43530
43531 END IF;
43532
43533 -----------------------------------------------------------------------------------------
43534 -- 4262811 Multiperiod Accounting
43535 -----------------------------------------------------------------------------------------
43536 -- No MPA option is assigned.
43537
43538
43539 END IF;
43540 END IF;
43541 --
43542
43543 --
43544 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
43545 trace
43546 (p_msg => 'END of AcctLineType_225'
43547 ,p_level => C_LEVEL_PROCEDURE
43548 ,p_module => l_log_module);
43549 END IF;
43550 --
43551 EXCEPTION
43552 WHEN xla_exceptions_pkg.application_exception THEN
43553 RAISE;
43554 WHEN OTHERS THEN
43555 xla_exceptions_pkg.raise_message
43556 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_225');
43557 END AcctLineType_225;
43558 --
43559
43560 ---------------------------------------
43561 --
43562 -- PRIVATE FUNCTION
43563 -- AcctLineType_226
43564 --
43565 ---------------------------------------
43566 PROCEDURE AcctLineType_226 (
43567 p_application_id IN NUMBER
43568 ,p_event_id IN NUMBER
43569 ,p_calculate_acctd_flag IN VARCHAR2
43570 ,p_calculate_g_l_flag IN VARCHAR2
43571 ,p_actual_flag IN OUT VARCHAR2
43572 ,p_balance_type_code OUT VARCHAR2
43573 ,p_gain_or_loss_ref OUT VARCHAR2
43574
43575 --Period Close Date
43576 , p_source_1 IN DATE
43577 --Generated Code Combination Identifier
43578 , p_source_5 IN NUMBER
43579 --Cost Of Removal Gain Account
43580 , p_source_15 IN VARCHAR2
43581 --Expense Account Code Combination Identifier
43582 , p_source_31 IN NUMBER
43583 --Default Code Combination Identifier
43584 , p_source_32 IN NUMBER
43585 --Adjustment Type
43586 , p_source_48 IN VARCHAR2
43587 --Transaction Header Identifier
43588 , p_source_49 IN NUMBER
43589 --Adjustment Line Identifier
43590 , p_source_50 IN NUMBER
43591 --Distribution Type Code
43595 --Currency Code
43592 , p_source_51 IN VARCHAR2
43593 --Entered Amount
43594 , p_source_52 IN NUMBER
43596 , p_source_53 IN VARCHAR2
43597 --Gain Loss Amount
43598 , p_source_54 IN NUMBER
43599 )
43600 IS
43601
43602 l_component_type VARCHAR2(80);
43603 l_component_code VARCHAR2(30);
43604 l_component_type_code VARCHAR2(1);
43605 l_component_appl_id INTEGER;
43606 l_amb_context_code VARCHAR2(30);
43607 l_entity_code VARCHAR2(30);
43608 l_event_class_code VARCHAR2(30);
43609 l_ae_header_id NUMBER;
43610 l_event_type_code VARCHAR2(30);
43611 l_line_definition_code VARCHAR2(30);
43612 l_line_definition_owner_code VARCHAR2(1);
43613 --
43614 -- adr variables
43615 l_segment VARCHAR2(30);
43616 l_ccid NUMBER;
43617 l_adr_transaction_coa_id NUMBER;
43618 l_adr_accounting_coa_id NUMBER;
43619 l_adr_flexfield_segment_code VARCHAR2(30);
43620 l_adr_flex_value_set_id NUMBER;
43621 l_adr_value_type_code VARCHAR2(30);
43622 l_adr_value_combination_id NUMBER;
43623 l_adr_value_segment_code VARCHAR2(30);
43624
43625 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
43626 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
43627 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
43628 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
43629
43630 -- 4262811 Variables ------------------------------------------------------------------------------------------
43631 l_entered_amt_idx NUMBER;
43632 l_accted_amt_idx NUMBER;
43633 l_acc_rev_flag VARCHAR2(1);
43634 l_accrual_line_num NUMBER;
43635 l_tmp_amt NUMBER;
43636 l_acc_rev_natural_side_code VARCHAR2(1);
43637
43638 l_num_entries NUMBER;
43639 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
43640 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
43641 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
43642 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
43643 l_recog_line_1 NUMBER;
43644 l_recog_line_2 NUMBER;
43645
43646 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
43647 l_bflow_applied_to_amt NUMBER; -- 5132302
43648 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
43649
43650 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
43651
43652 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
43653 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
43654
43655 ---------------------------------------------------------------------------------------------------------------
43656
43657
43658 --
43659 -- bulk performance
43660 --
43661 l_balance_type_code VARCHAR2(1);
43662 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
43663 l_log_module VARCHAR2(240);
43664
43665 --
43666 -- Upgrade strategy
43667 --
43668 l_actual_upg_option VARCHAR2(1);
43669 l_enc_upg_option VARCHAR2(1);
43670
43671 --
43672 BEGIN
43673 --
43674 IF g_log_enabled THEN
43675 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_226';
43676 END IF;
43677 --
43678 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
43679
43680 trace
43681 (p_msg => 'BEGIN of AcctLineType_226'
43682 ,p_level => C_LEVEL_PROCEDURE
43683 ,p_module => l_log_module);
43684
43685 END IF;
43686 --
43687 l_component_type := 'AMB_JLT';
43688 l_component_code := 'FA_CIP_COST_OF_REMOVAL_GAIN';
43689 l_component_type_code := 'S';
43690 l_component_appl_id := 140;
43691 l_amb_context_code := 'DEFAULT';
43692 l_entity_code := 'TRANSACTIONS';
43693 l_event_class_code := 'CIP_RETIREMENTS';
43694 l_event_type_code := 'CIP_REINSTATEMENTS';
43695 l_line_definition_owner_code := 'S';
43696 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
43697 --
43698 l_balance_type_code := 'A';
43699 l_segment := NULL;
43700 l_ccid := NULL;
43701 l_adr_transaction_coa_id := NULL;
43702 l_adr_accounting_coa_id := NULL;
43703 l_adr_flexfield_segment_code := NULL;
43704 l_adr_flex_value_set_id := NULL;
43705 l_adr_value_type_code := NULL;
43706 l_adr_value_combination_id := NULL;
43707 l_adr_value_segment_code := NULL;
43708
43709 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
43710 l_bflow_class_code := ''; -- 4219869 Business Flow
43711 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
43712 l_budgetary_control_flag := 'N';
43713
43714 l_bflow_applied_to_amt_idx := NULL; -- 5132302
43715 l_bflow_applied_to_amt := NULL; -- 5132302
43716 l_entered_amt_idx := NULL; -- 4262811
43717 l_accted_amt_idx := NULL; -- 4262811
43721 --
43718 l_acc_rev_flag := NULL; -- 4262811
43719 l_accrual_line_num := NULL; -- 4262811
43720 l_tmp_amt := NULL; -- 4262811
43722
43723 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
43724 l_balance_type_code <> 'B' THEN
43725 IF NVL(p_source_48,'
43726 ') = 'REMOVALCOST' AND
43727 p_source_54 >= 0
43728 THEN
43729
43730 --
43731 XLA_AE_LINES_PKG.SetNewLine;
43732
43733 p_balance_type_code := l_balance_type_code;
43734 -- set the flag so later we will know whether the gain loss line needs to be created
43735
43736 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
43737 p_actual_flag :='A';
43738 END IF;
43739
43740 --
43741 -- bulk performance
43742 --
43743 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
43744 p_header_num => 0); -- 4262811
43745 --
43746 -- set accounting line options
43747 --
43748 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
43749 p_natural_side_code => 'D'
43750 , p_gain_or_loss_flag => 'N'
43751 , p_gl_transfer_mode_code => 'S'
43752 , p_acct_entry_type_code => 'A'
43753 , p_switch_side_flag => 'Y'
43754 , p_merge_duplicate_code => 'N'
43755 );
43756 --
43757 l_acc_rev_natural_side_code := 'C'; -- 4262811
43758 --
43759 --
43760 -- set accounting line type info
43761 --
43762 xla_ae_lines_pkg.SetAcctLineType
43763 (p_component_type => l_component_type
43764 ,p_event_type_code => l_event_type_code
43765 ,p_line_definition_owner_code => l_line_definition_owner_code
43766 ,p_line_definition_code => l_line_definition_code
43767 ,p_accounting_line_code => l_component_code
43768 ,p_accounting_line_type_code => l_component_type_code
43769 ,p_accounting_line_appl_id => l_component_appl_id
43770 ,p_amb_context_code => l_amb_context_code
43771 ,p_entity_code => l_entity_code
43772 ,p_event_class_code => l_event_class_code);
43773 --
43774 -- set accounting class
43775 --
43776 xla_ae_lines_pkg.SetAcctClass(
43777 p_accounting_class_code => 'ASSET'
43778 , p_ae_header_id => l_ae_header_id
43779 );
43780
43781 --
43782 -- set rounding class
43783 --
43784 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
43785 'ASSET';
43786
43787 --
43788 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
43789 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
43790 --
43791 -- bulk performance
43792 --
43793 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
43794
43795 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
43796 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
43797
43798 -- 4955764
43799 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
43800 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
43801
43802 -- 4458381 Public Sector Enh
43803
43804 --
43805 -- set accounting attributes for the line type
43806 --
43807 l_entered_amt_idx := 4;
43808 l_accted_amt_idx := 6;
43809 l_bflow_applied_to_amt_idx := NULL; -- 5132302
43810 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
43811 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
43812 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
43813 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
43814 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
43815 l_rec_acct_attrs.array_char_value(3) := p_source_51;
43816 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
43817 l_rec_acct_attrs.array_num_value(4) := p_source_52;
43818 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
43819 l_rec_acct_attrs.array_char_value(5) := p_source_53;
43820 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
43821 l_rec_acct_attrs.array_num_value(6) := p_source_52;
43822
43823 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
43824 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
43825
43826 ---------------------------------------------------------------------------------------------------------------
43827 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
43828 ---------------------------------------------------------------------------------------------------------------
43829 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
43830
43831 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
43832 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
43833
43834 IF xla_accounting_cache_pkg.GetValueChar
43838 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
43835 (p_source_code => 'LEDGER_CATEGORY_CODE'
43836 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
43837 AND l_bflow_method_code = 'PRIOR_ENTRY'
43839 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
43840 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
43841 )
43842 THEN
43843 xla_ae_lines_pkg.BflowUpgEntry
43844 (p_business_method_code => l_bflow_method_code
43845 ,p_business_class_code => l_bflow_class_code
43846 ,p_balance_type => l_balance_type_code);
43847 ELSE
43848 NULL;
43849 -- No business flow processing for business flow method of NONE.
43850 END IF;
43851
43852 --
43853 -- call analytical criteria
43854 --
43855
43856 --
43857 -- call description
43858 --
43859
43860 xla_ae_lines_pkg.SetLineDescription(
43861 p_ae_header_id => l_ae_header_id
43862 ,p_description => Description_36 (
43863 p_application_id => p_application_id
43864 , p_ae_header_id => l_ae_header_id
43865 , p_source_1 => p_source_1
43866 )
43867 );
43868
43869
43870 --
43871 -- call ADRs
43872 -- Bug 4922099
43873 --
43874 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
43875 (NVL(l_actual_upg_option, 'N') = 'O') OR
43876 (NVL(l_enc_upg_option, 'N') = 'O')
43877 )
43878 THEN
43879 NULL;
43880 --
43881 --
43882
43883 l_ccid := AcctDerRule_174(
43884 p_application_id => p_application_id
43885 , p_ae_header_id => l_ae_header_id
43886 , p_source_5 => p_source_5
43887 , p_source_32 => p_source_32
43888 , x_transaction_coa_id => l_adr_transaction_coa_id
43889 , x_accounting_coa_id => l_adr_accounting_coa_id
43890 , x_value_type_code => l_adr_value_type_code
43891 , p_side => 'NA'
43892 );
43893
43894 xla_ae_lines_pkg.set_ccid(
43895 p_code_combination_id => l_ccid
43896 , p_value_type_code => l_adr_value_type_code
43897 , p_transaction_coa_id => l_adr_transaction_coa_id
43898 , p_accounting_coa_id => l_adr_accounting_coa_id
43899 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
43900 , p_adr_type_code => 'S'
43901 , p_component_type => l_component_type
43902 , p_component_code => l_component_code
43903 , p_component_type_code => l_component_type_code
43904 , p_component_appl_id => l_component_appl_id
43905 , p_amb_context_code => l_amb_context_code
43906 , p_side => 'NA'
43907 );
43908
43909
43910 l_segment := AcctDerRule_153(
43911 p_application_id => p_application_id
43912 , p_ae_header_id => l_ae_header_id
43913 , p_source_5 => p_source_5
43914 , p_source_15 => p_source_15
43915 , x_transaction_coa_id => l_adr_transaction_coa_id
43916 , x_accounting_coa_id => l_adr_accounting_coa_id
43917 , x_flexfield_segment_code => l_adr_flexfield_segment_code
43918 , x_flex_value_set_id => l_adr_flex_value_set_id
43919 , x_value_type_code => l_adr_value_type_code
43920 , x_value_combination_id => l_adr_value_combination_id
43921 , x_value_segment_code => l_adr_value_segment_code
43922 , p_side => 'NA'
43923 , p_override_seg_flag => 'Y'
43924 );
43925
43926 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
43927
43928 xla_ae_lines_pkg.set_segment(
43929 p_to_segment_code => 'GL_ACCOUNT'
43930 , p_segment_value => l_segment
43931 , p_from_segment_code => l_adr_value_segment_code
43932 , p_from_combination_id => l_adr_value_combination_id
43933 , p_value_type_code => l_adr_value_type_code
43934 , p_transaction_coa_id => l_adr_transaction_coa_id
43935 , p_accounting_coa_id => l_adr_accounting_coa_id
43936 , p_flexfield_segment_code => l_adr_flexfield_segment_code
43937 , p_flex_value_set_id => l_adr_flex_value_set_id
43938 , p_adr_code => 'FA_COST_OF_REM_GAIN_SEGMENT'
43939 , p_adr_type_code => 'S'
43940 , p_component_type => l_component_type
43941 , p_component_code => l_component_code
43942 , p_component_type_code => l_component_type_code
43943 , p_component_appl_id => l_component_appl_id
43944 , p_amb_context_code => l_amb_context_code
43945 , p_entity_code => 'TRANSACTIONS'
43946 , p_event_class_code => 'CIP_RETIREMENTS'
43947 , p_side => 'NA'
43948 );
43949
43950 END IF;
43951
43952 l_segment := AcctDerRule_169(
43953 p_application_id => p_application_id
43954 , p_ae_header_id => l_ae_header_id
43955 , p_source_5 => p_source_5
43956 , p_source_31 => p_source_31
43957 , x_transaction_coa_id => l_adr_transaction_coa_id
43958 , x_accounting_coa_id => l_adr_accounting_coa_id
43962 , x_value_combination_id => l_adr_value_combination_id
43959 , x_flexfield_segment_code => l_adr_flexfield_segment_code
43960 , x_flex_value_set_id => l_adr_flex_value_set_id
43961 , x_value_type_code => l_adr_value_type_code
43963 , x_value_segment_code => l_adr_value_segment_code
43964 , p_side => 'NA'
43965 , p_override_seg_flag => 'Y'
43966 );
43967
43968 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
43969
43970 xla_ae_lines_pkg.set_segment(
43971 p_to_segment_code => 'GL_BALANCING'
43972 , p_segment_value => l_segment
43973 , p_from_segment_code => l_adr_value_segment_code
43974 , p_from_combination_id => l_adr_value_combination_id
43975 , p_value_type_code => l_adr_value_type_code
43976 , p_transaction_coa_id => l_adr_transaction_coa_id
43977 , p_accounting_coa_id => l_adr_accounting_coa_id
43978 , p_flexfield_segment_code => l_adr_flexfield_segment_code
43979 , p_flex_value_set_id => l_adr_flex_value_set_id
43980 , p_adr_code => 'FA_EXPENSE_ACCT'
43981 , p_adr_type_code => 'S'
43982 , p_component_type => l_component_type
43983 , p_component_code => l_component_code
43984 , p_component_type_code => l_component_type_code
43985 , p_component_appl_id => l_component_appl_id
43986 , p_amb_context_code => l_amb_context_code
43987 , p_entity_code => 'TRANSACTIONS'
43988 , p_event_class_code => 'CIP_RETIREMENTS'
43989 , p_side => 'NA'
43990 );
43991
43992 END IF;
43993
43994 --
43995 --
43996 END IF;
43997 --
43998 -- Bug 4922099
43999 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
44000 (NVL(l_enc_upg_option, 'N') = 'O')
44001 ) AND
44002 (l_bflow_method_code = 'PRIOR_ENTRY')
44003 )
44004 THEN
44005 IF
44006 --
44007 1 = 2
44008 --
44009 THEN
44010 xla_accounting_err_pkg.build_message
44011 (p_appli_s_name => 'XLA'
44012 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
44013 ,p_token_1 => 'LINE_NUMBER'
44014 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
44015 ,p_token_2 => 'LINE_TYPE_NAME'
44016 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
44017 l_component_type
44018 ,l_component_code
44019 ,l_component_type_code
44020 ,l_component_appl_id
44021 ,l_amb_context_code
44022 ,l_entity_code
44023 ,l_event_class_code
44024 )
44025 ,p_token_3 => 'OWNER'
44026 ,p_value_3 => xla_lookups_pkg.get_meaning(
44027 p_lookup_type => 'XLA_OWNER_TYPE'
44028 ,p_lookup_code => l_component_type_code
44029 )
44030 ,p_token_4 => 'PRODUCT_NAME'
44031 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
44032 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
44033 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
44034 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
44035 ,p_ae_header_id => NULL
44036 );
44037
44038 IF (C_LEVEL_ERROR>= g_log_level) THEN
44039 trace
44040 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
44041 ,p_level => C_LEVEL_ERROR
44042 ,p_module => l_log_module);
44043 END IF;
44044 END IF;
44045 END IF;
44046 --
44047 --
44048 ------------------------------------------------------------------------------------------------
44049 -- 4219869 Business Flow
44050 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
44051 -- Prior Entry. Currently, the following code is always generated.
44052 ------------------------------------------------------------------------------------------------
44053 XLA_AE_LINES_PKG.ValidateCurrentLine;
44054
44055 ------------------------------------------------------------------------------------
44059 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
44056 -- 4219869 Business Flow
44057 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
44058 ------------------------------------------------------------------------------------
44060
44061 ----------------------------------------------------------------------------------
44062 -- 4219869 Business Flow
44063 -- Update journal entry status -- Need to generate this within IF <condition>
44064 ----------------------------------------------------------------------------------
44065 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
44066 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
44067 ,p_balance_type_code => l_balance_type_code
44068 );
44069
44070 -------------------------------------------------------------------------------------------
44071 -- 4262811 - Generate the Accrual Reversal lines
44072 -------------------------------------------------------------------------------------------
44073 BEGIN
44074 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
44075 (g_array_event(p_event_id).array_value_num('header_index'));
44076 IF l_acc_rev_flag IS NULL THEN
44077 l_acc_rev_flag := 'N';
44078 END IF;
44079 EXCEPTION
44080 WHEN OTHERS THEN
44081 l_acc_rev_flag := 'N';
44082 END;
44083 --
44084 IF (l_acc_rev_flag = 'Y') THEN
44085
44086 -- 4645092 ------------------------------------------------------------------------------
44087 -- To allow MPA report to determine if it should generate report process
44088 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
44089 ------------------------------------------------------------------------------------------
44090
44091 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
44092 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
44093 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
44094 -- call ADRs
44095 -- Bug 4922099
44096 --
44097 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
44098 (NVL(l_actual_upg_option, 'N') = 'O') OR
44099 (NVL(l_enc_upg_option, 'N') = 'O')
44100 )
44101 THEN
44102 NULL;
44103 --
44104 --
44105
44106 l_ccid := AcctDerRule_174(
44107 p_application_id => p_application_id
44108 , p_ae_header_id => l_ae_header_id
44109 , p_source_5 => p_source_5
44110 , p_source_32 => p_source_32
44111 , x_transaction_coa_id => l_adr_transaction_coa_id
44112 , x_accounting_coa_id => l_adr_accounting_coa_id
44113 , x_value_type_code => l_adr_value_type_code
44114 , p_side => 'NA'
44115 );
44116
44117 xla_ae_lines_pkg.set_ccid(
44118 p_code_combination_id => l_ccid
44119 , p_value_type_code => l_adr_value_type_code
44120 , p_transaction_coa_id => l_adr_transaction_coa_id
44121 , p_accounting_coa_id => l_adr_accounting_coa_id
44122 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
44123 , p_adr_type_code => 'S'
44124 , p_component_type => l_component_type
44125 , p_component_code => l_component_code
44126 , p_component_type_code => l_component_type_code
44127 , p_component_appl_id => l_component_appl_id
44128 , p_amb_context_code => l_amb_context_code
44129 , p_side => 'NA'
44130 );
44131
44132
44133 l_segment := AcctDerRule_153(
44134 p_application_id => p_application_id
44135 , p_ae_header_id => l_ae_header_id
44136 , p_source_5 => p_source_5
44137 , p_source_15 => p_source_15
44138 , x_transaction_coa_id => l_adr_transaction_coa_id
44139 , x_accounting_coa_id => l_adr_accounting_coa_id
44140 , x_flexfield_segment_code => l_adr_flexfield_segment_code
44141 , x_flex_value_set_id => l_adr_flex_value_set_id
44142 , x_value_type_code => l_adr_value_type_code
44143 , x_value_combination_id => l_adr_value_combination_id
44144 , x_value_segment_code => l_adr_value_segment_code
44145 , p_side => 'NA'
44146 , p_override_seg_flag => 'Y'
44147 );
44148
44149 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
44150
44151 xla_ae_lines_pkg.set_segment(
44152 p_to_segment_code => 'GL_ACCOUNT'
44153 , p_segment_value => l_segment
44154 , p_from_segment_code => l_adr_value_segment_code
44155 , p_from_combination_id => l_adr_value_combination_id
44156 , p_value_type_code => l_adr_value_type_code
44157 , p_transaction_coa_id => l_adr_transaction_coa_id
44158 , p_accounting_coa_id => l_adr_accounting_coa_id
44159 , p_flexfield_segment_code => l_adr_flexfield_segment_code
44160 , p_flex_value_set_id => l_adr_flex_value_set_id
44161 , p_adr_code => 'FA_COST_OF_REM_GAIN_SEGMENT'
44162 , p_adr_type_code => 'S'
44163 , p_component_type => l_component_type
44164 , p_component_code => l_component_code
44168 , p_entity_code => 'TRANSACTIONS'
44165 , p_component_type_code => l_component_type_code
44166 , p_component_appl_id => l_component_appl_id
44167 , p_amb_context_code => l_amb_context_code
44169 , p_event_class_code => 'CIP_RETIREMENTS'
44170 , p_side => 'NA'
44171 );
44172
44173 END IF;
44174
44175 l_segment := AcctDerRule_169(
44176 p_application_id => p_application_id
44177 , p_ae_header_id => l_ae_header_id
44178 , p_source_5 => p_source_5
44179 , p_source_31 => p_source_31
44180 , x_transaction_coa_id => l_adr_transaction_coa_id
44181 , x_accounting_coa_id => l_adr_accounting_coa_id
44182 , x_flexfield_segment_code => l_adr_flexfield_segment_code
44183 , x_flex_value_set_id => l_adr_flex_value_set_id
44184 , x_value_type_code => l_adr_value_type_code
44185 , x_value_combination_id => l_adr_value_combination_id
44186 , x_value_segment_code => l_adr_value_segment_code
44187 , p_side => 'NA'
44188 , p_override_seg_flag => 'Y'
44189 );
44190
44191 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
44192
44193 xla_ae_lines_pkg.set_segment(
44194 p_to_segment_code => 'GL_BALANCING'
44195 , p_segment_value => l_segment
44196 , p_from_segment_code => l_adr_value_segment_code
44197 , p_from_combination_id => l_adr_value_combination_id
44198 , p_value_type_code => l_adr_value_type_code
44199 , p_transaction_coa_id => l_adr_transaction_coa_id
44200 , p_accounting_coa_id => l_adr_accounting_coa_id
44201 , p_flexfield_segment_code => l_adr_flexfield_segment_code
44202 , p_flex_value_set_id => l_adr_flex_value_set_id
44203 , p_adr_code => 'FA_EXPENSE_ACCT'
44204 , p_adr_type_code => 'S'
44205 , p_component_type => l_component_type
44206 , p_component_code => l_component_code
44207 , p_component_type_code => l_component_type_code
44208 , p_component_appl_id => l_component_appl_id
44209 , p_amb_context_code => l_amb_context_code
44210 , p_entity_code => 'TRANSACTIONS'
44211 , p_event_class_code => 'CIP_RETIREMENTS'
44212 , p_side => 'NA'
44213 );
44214
44215 END IF;
44216
44217 --
44218 --
44219 END IF;
44220
44221 --
44222 -- Update the line information that should be overwritten
44223 --
44224 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
44225 p_header_num => 1);
44226 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
44227
44228 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
44229
44230 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
44231 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
44232 END IF;
44233
44234 --
44235 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
44236 --
44237 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
44238 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
44239 ELSE
44240 ---------------------------------------------------------------------------------------------------
44241 -- 4262811a Switch Sign
44242 ---------------------------------------------------------------------------------------------------
44243 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
44244 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
44245 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
44246 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
44247 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
44248 -- 5132302
44249 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
44250 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
44251
44252 END IF;
44253
44254 -- 4955764
44255 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
44256 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
44257
44258
44259 XLA_AE_LINES_PKG.ValidateCurrentLine;
44260 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
44261
44262 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
44263 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
44264 ,p_balance_type_code => l_balance_type_code);
44265
44266 END IF;
44267
44268 -----------------------------------------------------------------------------------------
44269 -- 4262811 Multiperiod Accounting
44273
44270 -----------------------------------------------------------------------------------------
44271 -- No MPA option is assigned.
44272
44274 END IF;
44275 END IF;
44276 --
44277
44278 --
44279 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
44280 trace
44281 (p_msg => 'END of AcctLineType_226'
44282 ,p_level => C_LEVEL_PROCEDURE
44283 ,p_module => l_log_module);
44284 END IF;
44285 --
44286 EXCEPTION
44287 WHEN xla_exceptions_pkg.application_exception THEN
44288 RAISE;
44289 WHEN OTHERS THEN
44290 xla_exceptions_pkg.raise_message
44291 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_226');
44292 END AcctLineType_226;
44293 --
44294
44295 ---------------------------------------
44296 --
44297 -- PRIVATE FUNCTION
44298 -- AcctLineType_227
44299 --
44300 ---------------------------------------
44301 PROCEDURE AcctLineType_227 (
44302 p_application_id IN NUMBER
44303 ,p_event_id IN NUMBER
44304 ,p_calculate_acctd_flag IN VARCHAR2
44305 ,p_calculate_g_l_flag IN VARCHAR2
44306 ,p_actual_flag IN OUT VARCHAR2
44307 ,p_balance_type_code OUT VARCHAR2
44308 ,p_gain_or_loss_ref OUT VARCHAR2
44309
44310 --Period Close Date
44311 , p_source_1 IN DATE
44312 --Generated Code Combination Identifier
44313 , p_source_5 IN NUMBER
44314 --Cost Of Removal Loss Account
44315 , p_source_16 IN VARCHAR2
44316 --Expense Account Code Combination Identifier
44317 , p_source_31 IN NUMBER
44318 --Default Code Combination Identifier
44319 , p_source_32 IN NUMBER
44320 --Adjustment Type
44321 , p_source_48 IN VARCHAR2
44322 --Transaction Header Identifier
44323 , p_source_49 IN NUMBER
44324 --Adjustment Line Identifier
44325 , p_source_50 IN NUMBER
44326 --Distribution Type Code
44327 , p_source_51 IN VARCHAR2
44328 --Entered Amount
44329 , p_source_52 IN NUMBER
44330 --Currency Code
44331 , p_source_53 IN VARCHAR2
44332 --Gain Loss Amount
44333 , p_source_54 IN NUMBER
44334 )
44335 IS
44336
44337 l_component_type VARCHAR2(80);
44338 l_component_code VARCHAR2(30);
44339 l_component_type_code VARCHAR2(1);
44340 l_component_appl_id INTEGER;
44341 l_amb_context_code VARCHAR2(30);
44342 l_entity_code VARCHAR2(30);
44343 l_event_class_code VARCHAR2(30);
44344 l_ae_header_id NUMBER;
44345 l_event_type_code VARCHAR2(30);
44346 l_line_definition_code VARCHAR2(30);
44347 l_line_definition_owner_code VARCHAR2(1);
44348 --
44349 -- adr variables
44350 l_segment VARCHAR2(30);
44351 l_ccid NUMBER;
44352 l_adr_transaction_coa_id NUMBER;
44353 l_adr_accounting_coa_id NUMBER;
44354 l_adr_flexfield_segment_code VARCHAR2(30);
44355 l_adr_flex_value_set_id NUMBER;
44356 l_adr_value_type_code VARCHAR2(30);
44357 l_adr_value_combination_id NUMBER;
44358 l_adr_value_segment_code VARCHAR2(30);
44359
44360 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
44361 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
44362 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
44363 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
44364
44365 -- 4262811 Variables ------------------------------------------------------------------------------------------
44366 l_entered_amt_idx NUMBER;
44367 l_accted_amt_idx NUMBER;
44368 l_acc_rev_flag VARCHAR2(1);
44369 l_accrual_line_num NUMBER;
44370 l_tmp_amt NUMBER;
44371 l_acc_rev_natural_side_code VARCHAR2(1);
44372
44373 l_num_entries NUMBER;
44374 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
44375 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
44376 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
44377 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
44378 l_recog_line_1 NUMBER;
44379 l_recog_line_2 NUMBER;
44380
44381 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
44382 l_bflow_applied_to_amt NUMBER; -- 5132302
44383 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
44384
44385 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
44386
44387 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
44388 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
44389
44390 ---------------------------------------------------------------------------------------------------------------
44391
44392
44393 --
44394 -- bulk performance
44395 --
44396 l_balance_type_code VARCHAR2(1);
44397 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
44398 l_log_module VARCHAR2(240);
44399
44400 --
44401 -- Upgrade strategy
44402 --
44403 l_actual_upg_option VARCHAR2(1);
44404 l_enc_upg_option VARCHAR2(1);
44405
44406 --
44407 BEGIN
44411 END IF;
44408 --
44409 IF g_log_enabled THEN
44410 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_227';
44412 --
44413 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
44414
44415 trace
44416 (p_msg => 'BEGIN of AcctLineType_227'
44417 ,p_level => C_LEVEL_PROCEDURE
44418 ,p_module => l_log_module);
44419
44420 END IF;
44421 --
44422 l_component_type := 'AMB_JLT';
44423 l_component_code := 'FA_CIP_COST_OF_REMOVAL_LOSS';
44424 l_component_type_code := 'S';
44425 l_component_appl_id := 140;
44426 l_amb_context_code := 'DEFAULT';
44427 l_entity_code := 'TRANSACTIONS';
44428 l_event_class_code := 'CIP_RETIREMENTS';
44429 l_event_type_code := 'CIP_RETIREMENTS';
44430 l_line_definition_owner_code := 'S';
44431 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
44432 --
44433 l_balance_type_code := 'A';
44434 l_segment := NULL;
44435 l_ccid := NULL;
44436 l_adr_transaction_coa_id := NULL;
44437 l_adr_accounting_coa_id := NULL;
44438 l_adr_flexfield_segment_code := NULL;
44439 l_adr_flex_value_set_id := NULL;
44440 l_adr_value_type_code := NULL;
44441 l_adr_value_combination_id := NULL;
44442 l_adr_value_segment_code := NULL;
44443
44444 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
44445 l_bflow_class_code := ''; -- 4219869 Business Flow
44446 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
44447 l_budgetary_control_flag := 'N';
44448
44449 l_bflow_applied_to_amt_idx := NULL; -- 5132302
44450 l_bflow_applied_to_amt := NULL; -- 5132302
44451 l_entered_amt_idx := NULL; -- 4262811
44452 l_accted_amt_idx := NULL; -- 4262811
44453 l_acc_rev_flag := NULL; -- 4262811
44454 l_accrual_line_num := NULL; -- 4262811
44455 l_tmp_amt := NULL; -- 4262811
44456 --
44457
44458 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
44459 l_balance_type_code <> 'B' THEN
44460 IF NVL(p_source_48,'
44461 ') = 'REMOVALCOST' AND
44462 p_source_54 < 0
44463 THEN
44464
44465 --
44466 XLA_AE_LINES_PKG.SetNewLine;
44467
44468 p_balance_type_code := l_balance_type_code;
44469 -- set the flag so later we will know whether the gain loss line needs to be created
44470
44471 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
44472 p_actual_flag :='A';
44473 END IF;
44474
44475 --
44476 -- bulk performance
44477 --
44478 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
44479 p_header_num => 0); -- 4262811
44480 --
44481 -- set accounting line options
44482 --
44483 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
44484 p_natural_side_code => 'D'
44485 , p_gain_or_loss_flag => 'N'
44486 , p_gl_transfer_mode_code => 'S'
44487 , p_acct_entry_type_code => 'A'
44488 , p_switch_side_flag => 'Y'
44489 , p_merge_duplicate_code => 'N'
44490 );
44491 --
44492 l_acc_rev_natural_side_code := 'C'; -- 4262811
44493 --
44494 --
44495 -- set accounting line type info
44496 --
44497 xla_ae_lines_pkg.SetAcctLineType
44498 (p_component_type => l_component_type
44499 ,p_event_type_code => l_event_type_code
44500 ,p_line_definition_owner_code => l_line_definition_owner_code
44501 ,p_line_definition_code => l_line_definition_code
44502 ,p_accounting_line_code => l_component_code
44503 ,p_accounting_line_type_code => l_component_type_code
44504 ,p_accounting_line_appl_id => l_component_appl_id
44505 ,p_amb_context_code => l_amb_context_code
44506 ,p_entity_code => l_entity_code
44507 ,p_event_class_code => l_event_class_code);
44508 --
44509 -- set accounting class
44510 --
44511 xla_ae_lines_pkg.SetAcctClass(
44512 p_accounting_class_code => 'ASSET'
44513 , p_ae_header_id => l_ae_header_id
44514 );
44515
44516 --
44517 -- set rounding class
44518 --
44519 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
44520 'ASSET';
44521
44522 --
44523 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
44524 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
44525 --
44526 -- bulk performance
44527 --
44528 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
44529
44530 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
44531 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
44532
44533 -- 4955764
44534 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
44535 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
44536
44540 -- set accounting attributes for the line type
44537 -- 4458381 Public Sector Enh
44538
44539 --
44541 --
44542 l_entered_amt_idx := 4;
44543 l_accted_amt_idx := 6;
44544 l_bflow_applied_to_amt_idx := NULL; -- 5132302
44545 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
44546 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
44547 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
44548 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
44549 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
44550 l_rec_acct_attrs.array_char_value(3) := p_source_51;
44551 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
44552 l_rec_acct_attrs.array_num_value(4) := p_source_52;
44553 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
44554 l_rec_acct_attrs.array_char_value(5) := p_source_53;
44555 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
44556 l_rec_acct_attrs.array_num_value(6) := p_source_52;
44557
44558 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
44559 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
44560
44561 ---------------------------------------------------------------------------------------------------------------
44562 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
44563 ---------------------------------------------------------------------------------------------------------------
44564 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
44565
44566 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
44567 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
44568
44569 IF xla_accounting_cache_pkg.GetValueChar
44570 (p_source_code => 'LEDGER_CATEGORY_CODE'
44571 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
44572 AND l_bflow_method_code = 'PRIOR_ENTRY'
44573 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
44574 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
44575 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
44576 )
44577 THEN
44578 xla_ae_lines_pkg.BflowUpgEntry
44579 (p_business_method_code => l_bflow_method_code
44580 ,p_business_class_code => l_bflow_class_code
44581 ,p_balance_type => l_balance_type_code);
44582 ELSE
44583 NULL;
44584 -- No business flow processing for business flow method of NONE.
44585 END IF;
44586
44587 --
44588 -- call analytical criteria
44589 --
44590
44591 --
44592 -- call description
44593 --
44594
44595 xla_ae_lines_pkg.SetLineDescription(
44596 p_ae_header_id => l_ae_header_id
44597 ,p_description => Description_36 (
44598 p_application_id => p_application_id
44599 , p_ae_header_id => l_ae_header_id
44600 , p_source_1 => p_source_1
44601 )
44602 );
44603
44604
44605 --
44606 -- call ADRs
44607 -- Bug 4922099
44608 --
44609 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
44610 (NVL(l_actual_upg_option, 'N') = 'O') OR
44611 (NVL(l_enc_upg_option, 'N') = 'O')
44612 )
44613 THEN
44614 NULL;
44615 --
44616 --
44617
44618 l_ccid := AcctDerRule_174(
44619 p_application_id => p_application_id
44620 , p_ae_header_id => l_ae_header_id
44621 , p_source_5 => p_source_5
44622 , p_source_32 => p_source_32
44623 , x_transaction_coa_id => l_adr_transaction_coa_id
44624 , x_accounting_coa_id => l_adr_accounting_coa_id
44625 , x_value_type_code => l_adr_value_type_code
44626 , p_side => 'NA'
44627 );
44628
44629 xla_ae_lines_pkg.set_ccid(
44630 p_code_combination_id => l_ccid
44631 , p_value_type_code => l_adr_value_type_code
44632 , p_transaction_coa_id => l_adr_transaction_coa_id
44633 , p_accounting_coa_id => l_adr_accounting_coa_id
44634 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
44635 , p_adr_type_code => 'S'
44636 , p_component_type => l_component_type
44637 , p_component_code => l_component_code
44638 , p_component_type_code => l_component_type_code
44639 , p_component_appl_id => l_component_appl_id
44640 , p_amb_context_code => l_amb_context_code
44641 , p_side => 'NA'
44642 );
44643
44644
44645 l_segment := AcctDerRule_154(
44646 p_application_id => p_application_id
44647 , p_ae_header_id => l_ae_header_id
44648 , p_source_5 => p_source_5
44649 , p_source_16 => p_source_16
44650 , x_transaction_coa_id => l_adr_transaction_coa_id
44651 , x_accounting_coa_id => l_adr_accounting_coa_id
44652 , x_flexfield_segment_code => l_adr_flexfield_segment_code
44653 , x_flex_value_set_id => l_adr_flex_value_set_id
44654 , x_value_type_code => l_adr_value_type_code
44658 , p_override_seg_flag => 'Y'
44655 , x_value_combination_id => l_adr_value_combination_id
44656 , x_value_segment_code => l_adr_value_segment_code
44657 , p_side => 'NA'
44659 );
44660
44661 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
44662
44663 xla_ae_lines_pkg.set_segment(
44664 p_to_segment_code => 'GL_ACCOUNT'
44665 , p_segment_value => l_segment
44666 , p_from_segment_code => l_adr_value_segment_code
44667 , p_from_combination_id => l_adr_value_combination_id
44668 , p_value_type_code => l_adr_value_type_code
44669 , p_transaction_coa_id => l_adr_transaction_coa_id
44670 , p_accounting_coa_id => l_adr_accounting_coa_id
44671 , p_flexfield_segment_code => l_adr_flexfield_segment_code
44672 , p_flex_value_set_id => l_adr_flex_value_set_id
44673 , p_adr_code => 'FA_COST_OF_REM_LOSS_SEGMENT'
44674 , p_adr_type_code => 'S'
44675 , p_component_type => l_component_type
44676 , p_component_code => l_component_code
44677 , p_component_type_code => l_component_type_code
44678 , p_component_appl_id => l_component_appl_id
44679 , p_amb_context_code => l_amb_context_code
44680 , p_entity_code => 'TRANSACTIONS'
44681 , p_event_class_code => 'CIP_RETIREMENTS'
44682 , p_side => 'NA'
44683 );
44684
44685 END IF;
44686
44687 l_segment := AcctDerRule_169(
44688 p_application_id => p_application_id
44689 , p_ae_header_id => l_ae_header_id
44690 , p_source_5 => p_source_5
44691 , p_source_31 => p_source_31
44692 , x_transaction_coa_id => l_adr_transaction_coa_id
44693 , x_accounting_coa_id => l_adr_accounting_coa_id
44694 , x_flexfield_segment_code => l_adr_flexfield_segment_code
44695 , x_flex_value_set_id => l_adr_flex_value_set_id
44696 , x_value_type_code => l_adr_value_type_code
44697 , x_value_combination_id => l_adr_value_combination_id
44698 , x_value_segment_code => l_adr_value_segment_code
44699 , p_side => 'NA'
44700 , p_override_seg_flag => 'Y'
44701 );
44702
44703 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
44704
44705 xla_ae_lines_pkg.set_segment(
44706 p_to_segment_code => 'GL_BALANCING'
44707 , p_segment_value => l_segment
44708 , p_from_segment_code => l_adr_value_segment_code
44709 , p_from_combination_id => l_adr_value_combination_id
44710 , p_value_type_code => l_adr_value_type_code
44711 , p_transaction_coa_id => l_adr_transaction_coa_id
44712 , p_accounting_coa_id => l_adr_accounting_coa_id
44713 , p_flexfield_segment_code => l_adr_flexfield_segment_code
44714 , p_flex_value_set_id => l_adr_flex_value_set_id
44715 , p_adr_code => 'FA_EXPENSE_ACCT'
44716 , p_adr_type_code => 'S'
44717 , p_component_type => l_component_type
44718 , p_component_code => l_component_code
44719 , p_component_type_code => l_component_type_code
44720 , p_component_appl_id => l_component_appl_id
44721 , p_amb_context_code => l_amb_context_code
44722 , p_entity_code => 'TRANSACTIONS'
44723 , p_event_class_code => 'CIP_RETIREMENTS'
44724 , p_side => 'NA'
44725 );
44726
44727 END IF;
44728
44729 --
44730 --
44731 END IF;
44732 --
44733 -- Bug 4922099
44734 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
44735 (NVL(l_enc_upg_option, 'N') = 'O')
44736 ) AND
44737 (l_bflow_method_code = 'PRIOR_ENTRY')
44738 )
44739 THEN
44740 IF
44741 --
44742 1 = 2
44743 --
44744 THEN
44745 xla_accounting_err_pkg.build_message
44746 (p_appli_s_name => 'XLA'
44747 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
44748 ,p_token_1 => 'LINE_NUMBER'
44749 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
44750 ,p_token_2 => 'LINE_TYPE_NAME'
44751 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
44752 l_component_type
44753 ,l_component_code
44754 ,l_component_type_code
44755 ,l_component_appl_id
44756 ,l_amb_context_code
44757 ,l_entity_code
44758 ,l_event_class_code
44759 )
44763 ,p_lookup_code => l_component_type_code
44760 ,p_token_3 => 'OWNER'
44761 ,p_value_3 => xla_lookups_pkg.get_meaning(
44762 p_lookup_type => 'XLA_OWNER_TYPE'
44764 )
44765 ,p_token_4 => 'PRODUCT_NAME'
44766 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
44767 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
44768 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
44769 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
44770 ,p_ae_header_id => NULL
44771 );
44772
44773 IF (C_LEVEL_ERROR>= g_log_level) THEN
44774 trace
44775 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
44776 ,p_level => C_LEVEL_ERROR
44777 ,p_module => l_log_module);
44778 END IF;
44779 END IF;
44780 END IF;
44781 --
44782 --
44783 ------------------------------------------------------------------------------------------------
44784 -- 4219869 Business Flow
44785 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
44786 -- Prior Entry. Currently, the following code is always generated.
44787 ------------------------------------------------------------------------------------------------
44788 XLA_AE_LINES_PKG.ValidateCurrentLine;
44789
44790 ------------------------------------------------------------------------------------
44791 -- 4219869 Business Flow
44792 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
44793 ------------------------------------------------------------------------------------
44794 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
44795
44796 ----------------------------------------------------------------------------------
44797 -- 4219869 Business Flow
44798 -- Update journal entry status -- Need to generate this within IF <condition>
44799 ----------------------------------------------------------------------------------
44800 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
44801 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
44802 ,p_balance_type_code => l_balance_type_code
44803 );
44804
44805 -------------------------------------------------------------------------------------------
44806 -- 4262811 - Generate the Accrual Reversal lines
44807 -------------------------------------------------------------------------------------------
44808 BEGIN
44809 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
44810 (g_array_event(p_event_id).array_value_num('header_index'));
44811 IF l_acc_rev_flag IS NULL THEN
44812 l_acc_rev_flag := 'N';
44813 END IF;
44814 EXCEPTION
44815 WHEN OTHERS THEN
44816 l_acc_rev_flag := 'N';
44817 END;
44818 --
44819 IF (l_acc_rev_flag = 'Y') THEN
44820
44821 -- 4645092 ------------------------------------------------------------------------------
44822 -- To allow MPA report to determine if it should generate report process
44823 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
44824 ------------------------------------------------------------------------------------------
44825
44826 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
44827 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
44828 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
44829 -- call ADRs
44830 -- Bug 4922099
44831 --
44832 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
44833 (NVL(l_actual_upg_option, 'N') = 'O') OR
44834 (NVL(l_enc_upg_option, 'N') = 'O')
44835 )
44836 THEN
44837 NULL;
44838 --
44839 --
44840
44841 l_ccid := AcctDerRule_174(
44842 p_application_id => p_application_id
44843 , p_ae_header_id => l_ae_header_id
44844 , p_source_5 => p_source_5
44845 , p_source_32 => p_source_32
44846 , x_transaction_coa_id => l_adr_transaction_coa_id
44847 , x_accounting_coa_id => l_adr_accounting_coa_id
44848 , x_value_type_code => l_adr_value_type_code
44849 , p_side => 'NA'
44850 );
44851
44852 xla_ae_lines_pkg.set_ccid(
44853 p_code_combination_id => l_ccid
44854 , p_value_type_code => l_adr_value_type_code
44855 , p_transaction_coa_id => l_adr_transaction_coa_id
44856 , p_accounting_coa_id => l_adr_accounting_coa_id
44857 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
44858 , p_adr_type_code => 'S'
44859 , p_component_type => l_component_type
44860 , p_component_code => l_component_code
44861 , p_component_type_code => l_component_type_code
44862 , p_component_appl_id => l_component_appl_id
44866
44863 , p_amb_context_code => l_amb_context_code
44864 , p_side => 'NA'
44865 );
44867
44868 l_segment := AcctDerRule_154(
44869 p_application_id => p_application_id
44870 , p_ae_header_id => l_ae_header_id
44871 , p_source_5 => p_source_5
44872 , p_source_16 => p_source_16
44873 , x_transaction_coa_id => l_adr_transaction_coa_id
44874 , x_accounting_coa_id => l_adr_accounting_coa_id
44875 , x_flexfield_segment_code => l_adr_flexfield_segment_code
44876 , x_flex_value_set_id => l_adr_flex_value_set_id
44877 , x_value_type_code => l_adr_value_type_code
44878 , x_value_combination_id => l_adr_value_combination_id
44879 , x_value_segment_code => l_adr_value_segment_code
44880 , p_side => 'NA'
44881 , p_override_seg_flag => 'Y'
44882 );
44883
44884 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
44885
44886 xla_ae_lines_pkg.set_segment(
44887 p_to_segment_code => 'GL_ACCOUNT'
44888 , p_segment_value => l_segment
44889 , p_from_segment_code => l_adr_value_segment_code
44890 , p_from_combination_id => l_adr_value_combination_id
44891 , p_value_type_code => l_adr_value_type_code
44892 , p_transaction_coa_id => l_adr_transaction_coa_id
44893 , p_accounting_coa_id => l_adr_accounting_coa_id
44894 , p_flexfield_segment_code => l_adr_flexfield_segment_code
44895 , p_flex_value_set_id => l_adr_flex_value_set_id
44896 , p_adr_code => 'FA_COST_OF_REM_LOSS_SEGMENT'
44897 , p_adr_type_code => 'S'
44898 , p_component_type => l_component_type
44899 , p_component_code => l_component_code
44900 , p_component_type_code => l_component_type_code
44901 , p_component_appl_id => l_component_appl_id
44902 , p_amb_context_code => l_amb_context_code
44903 , p_entity_code => 'TRANSACTIONS'
44904 , p_event_class_code => 'CIP_RETIREMENTS'
44905 , p_side => 'NA'
44906 );
44907
44908 END IF;
44909
44910 l_segment := AcctDerRule_169(
44911 p_application_id => p_application_id
44912 , p_ae_header_id => l_ae_header_id
44913 , p_source_5 => p_source_5
44914 , p_source_31 => p_source_31
44915 , x_transaction_coa_id => l_adr_transaction_coa_id
44916 , x_accounting_coa_id => l_adr_accounting_coa_id
44917 , x_flexfield_segment_code => l_adr_flexfield_segment_code
44918 , x_flex_value_set_id => l_adr_flex_value_set_id
44919 , x_value_type_code => l_adr_value_type_code
44920 , x_value_combination_id => l_adr_value_combination_id
44921 , x_value_segment_code => l_adr_value_segment_code
44922 , p_side => 'NA'
44923 , p_override_seg_flag => 'Y'
44924 );
44925
44926 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
44927
44928 xla_ae_lines_pkg.set_segment(
44929 p_to_segment_code => 'GL_BALANCING'
44930 , p_segment_value => l_segment
44931 , p_from_segment_code => l_adr_value_segment_code
44932 , p_from_combination_id => l_adr_value_combination_id
44933 , p_value_type_code => l_adr_value_type_code
44934 , p_transaction_coa_id => l_adr_transaction_coa_id
44935 , p_accounting_coa_id => l_adr_accounting_coa_id
44936 , p_flexfield_segment_code => l_adr_flexfield_segment_code
44937 , p_flex_value_set_id => l_adr_flex_value_set_id
44938 , p_adr_code => 'FA_EXPENSE_ACCT'
44939 , p_adr_type_code => 'S'
44940 , p_component_type => l_component_type
44941 , p_component_code => l_component_code
44942 , p_component_type_code => l_component_type_code
44943 , p_component_appl_id => l_component_appl_id
44944 , p_amb_context_code => l_amb_context_code
44945 , p_entity_code => 'TRANSACTIONS'
44946 , p_event_class_code => 'CIP_RETIREMENTS'
44947 , p_side => 'NA'
44948 );
44949
44950 END IF;
44951
44952 --
44953 --
44954 END IF;
44955
44956 --
44957 -- Update the line information that should be overwritten
44958 --
44959 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
44960 p_header_num => 1);
44961 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
44962
44963 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
44964
44965 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
44966 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
44967 END IF;
44968
44969 --
44970 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
44971 --
44972 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
44976 -- 4262811a Switch Sign
44973 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
44974 ELSE
44975 ---------------------------------------------------------------------------------------------------
44977 ---------------------------------------------------------------------------------------------------
44978 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
44979 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
44980 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
44981 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
44982 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
44983 -- 5132302
44984 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
44985 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
44986
44987 END IF;
44988
44989 -- 4955764
44990 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
44991 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
44992
44993
44994 XLA_AE_LINES_PKG.ValidateCurrentLine;
44995 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
44996
44997 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
44998 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
44999 ,p_balance_type_code => l_balance_type_code);
45000
45001 END IF;
45002
45003 -----------------------------------------------------------------------------------------
45004 -- 4262811 Multiperiod Accounting
45005 -----------------------------------------------------------------------------------------
45006 -- No MPA option is assigned.
45007
45008
45009 END IF;
45010 END IF;
45011 --
45012
45013 --
45014 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
45015 trace
45016 (p_msg => 'END of AcctLineType_227'
45017 ,p_level => C_LEVEL_PROCEDURE
45018 ,p_module => l_log_module);
45019 END IF;
45020 --
45021 EXCEPTION
45022 WHEN xla_exceptions_pkg.application_exception THEN
45023 RAISE;
45024 WHEN OTHERS THEN
45025 xla_exceptions_pkg.raise_message
45026 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_227');
45027 END AcctLineType_227;
45028 --
45029
45030 ---------------------------------------
45031 --
45032 -- PRIVATE FUNCTION
45033 -- AcctLineType_228
45034 --
45035 ---------------------------------------
45036 PROCEDURE AcctLineType_228 (
45037 p_application_id IN NUMBER
45038 ,p_event_id IN NUMBER
45039 ,p_calculate_acctd_flag IN VARCHAR2
45040 ,p_calculate_g_l_flag IN VARCHAR2
45041 ,p_actual_flag IN OUT VARCHAR2
45042 ,p_balance_type_code OUT VARCHAR2
45043 ,p_gain_or_loss_ref OUT VARCHAR2
45044
45045 --Period Close Date
45046 , p_source_1 IN DATE
45047 --Generated Code Combination Identifier
45048 , p_source_5 IN NUMBER
45049 --Cost Of Removal Loss Account
45050 , p_source_16 IN VARCHAR2
45051 --Expense Account Code Combination Identifier
45052 , p_source_31 IN NUMBER
45053 --Default Code Combination Identifier
45054 , p_source_32 IN NUMBER
45055 --Adjustment Type
45056 , p_source_48 IN VARCHAR2
45057 --Transaction Header Identifier
45058 , p_source_49 IN NUMBER
45059 --Adjustment Line Identifier
45060 , p_source_50 IN NUMBER
45061 --Distribution Type Code
45062 , p_source_51 IN VARCHAR2
45063 --Entered Amount
45064 , p_source_52 IN NUMBER
45065 --Currency Code
45066 , p_source_53 IN VARCHAR2
45067 --Gain Loss Amount
45068 , p_source_54 IN NUMBER
45069 )
45070 IS
45071
45072 l_component_type VARCHAR2(80);
45073 l_component_code VARCHAR2(30);
45074 l_component_type_code VARCHAR2(1);
45075 l_component_appl_id INTEGER;
45076 l_amb_context_code VARCHAR2(30);
45077 l_entity_code VARCHAR2(30);
45078 l_event_class_code VARCHAR2(30);
45079 l_ae_header_id NUMBER;
45080 l_event_type_code VARCHAR2(30);
45081 l_line_definition_code VARCHAR2(30);
45082 l_line_definition_owner_code VARCHAR2(1);
45083 --
45084 -- adr variables
45085 l_segment VARCHAR2(30);
45086 l_ccid NUMBER;
45087 l_adr_transaction_coa_id NUMBER;
45088 l_adr_accounting_coa_id NUMBER;
45089 l_adr_flexfield_segment_code VARCHAR2(30);
45090 l_adr_flex_value_set_id NUMBER;
45091 l_adr_value_type_code VARCHAR2(30);
45092 l_adr_value_combination_id NUMBER;
45093 l_adr_value_segment_code VARCHAR2(30);
45094
45095 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
45096 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
45097 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
45101 l_entered_amt_idx NUMBER;
45098 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
45099
45100 -- 4262811 Variables ------------------------------------------------------------------------------------------
45102 l_accted_amt_idx NUMBER;
45103 l_acc_rev_flag VARCHAR2(1);
45104 l_accrual_line_num NUMBER;
45105 l_tmp_amt NUMBER;
45106 l_acc_rev_natural_side_code VARCHAR2(1);
45107
45108 l_num_entries NUMBER;
45109 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
45110 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
45111 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
45112 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
45113 l_recog_line_1 NUMBER;
45114 l_recog_line_2 NUMBER;
45115
45116 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
45117 l_bflow_applied_to_amt NUMBER; -- 5132302
45118 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
45119
45120 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
45121
45122 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
45123 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
45124
45125 ---------------------------------------------------------------------------------------------------------------
45126
45127
45128 --
45129 -- bulk performance
45130 --
45131 l_balance_type_code VARCHAR2(1);
45132 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
45133 l_log_module VARCHAR2(240);
45134
45135 --
45136 -- Upgrade strategy
45137 --
45138 l_actual_upg_option VARCHAR2(1);
45139 l_enc_upg_option VARCHAR2(1);
45140
45141 --
45142 BEGIN
45143 --
45144 IF g_log_enabled THEN
45145 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_228';
45146 END IF;
45147 --
45148 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
45149
45150 trace
45151 (p_msg => 'BEGIN of AcctLineType_228'
45152 ,p_level => C_LEVEL_PROCEDURE
45153 ,p_module => l_log_module);
45154
45155 END IF;
45156 --
45157 l_component_type := 'AMB_JLT';
45158 l_component_code := 'FA_CIP_COST_OF_REMOVAL_LOSS';
45159 l_component_type_code := 'S';
45160 l_component_appl_id := 140;
45161 l_amb_context_code := 'DEFAULT';
45162 l_entity_code := 'TRANSACTIONS';
45163 l_event_class_code := 'CIP_RETIREMENTS';
45164 l_event_type_code := 'CIP_REINSTATEMENTS';
45165 l_line_definition_owner_code := 'S';
45166 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
45167 --
45168 l_balance_type_code := 'A';
45169 l_segment := NULL;
45170 l_ccid := NULL;
45171 l_adr_transaction_coa_id := NULL;
45172 l_adr_accounting_coa_id := NULL;
45173 l_adr_flexfield_segment_code := NULL;
45174 l_adr_flex_value_set_id := NULL;
45175 l_adr_value_type_code := NULL;
45176 l_adr_value_combination_id := NULL;
45177 l_adr_value_segment_code := NULL;
45178
45179 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
45180 l_bflow_class_code := ''; -- 4219869 Business Flow
45181 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
45182 l_budgetary_control_flag := 'N';
45183
45184 l_bflow_applied_to_amt_idx := NULL; -- 5132302
45185 l_bflow_applied_to_amt := NULL; -- 5132302
45186 l_entered_amt_idx := NULL; -- 4262811
45187 l_accted_amt_idx := NULL; -- 4262811
45188 l_acc_rev_flag := NULL; -- 4262811
45189 l_accrual_line_num := NULL; -- 4262811
45190 l_tmp_amt := NULL; -- 4262811
45191 --
45192
45193 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
45194 l_balance_type_code <> 'B' THEN
45195 IF NVL(p_source_48,'
45196 ') = 'REMOVALCOST' AND
45197 p_source_54 < 0
45198 THEN
45199
45200 --
45201 XLA_AE_LINES_PKG.SetNewLine;
45202
45203 p_balance_type_code := l_balance_type_code;
45204 -- set the flag so later we will know whether the gain loss line needs to be created
45205
45206 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
45207 p_actual_flag :='A';
45208 END IF;
45209
45210 --
45211 -- bulk performance
45212 --
45213 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
45214 p_header_num => 0); -- 4262811
45215 --
45216 -- set accounting line options
45217 --
45218 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
45219 p_natural_side_code => 'D'
45220 , p_gain_or_loss_flag => 'N'
45221 , p_gl_transfer_mode_code => 'S'
45222 , p_acct_entry_type_code => 'A'
45223 , p_switch_side_flag => 'Y'
45224 , p_merge_duplicate_code => 'N'
45225 );
45226 --
45227 l_acc_rev_natural_side_code := 'C'; -- 4262811
45231 --
45228 --
45229 --
45230 -- set accounting line type info
45232 xla_ae_lines_pkg.SetAcctLineType
45233 (p_component_type => l_component_type
45234 ,p_event_type_code => l_event_type_code
45235 ,p_line_definition_owner_code => l_line_definition_owner_code
45236 ,p_line_definition_code => l_line_definition_code
45237 ,p_accounting_line_code => l_component_code
45238 ,p_accounting_line_type_code => l_component_type_code
45239 ,p_accounting_line_appl_id => l_component_appl_id
45240 ,p_amb_context_code => l_amb_context_code
45241 ,p_entity_code => l_entity_code
45242 ,p_event_class_code => l_event_class_code);
45243 --
45244 -- set accounting class
45245 --
45246 xla_ae_lines_pkg.SetAcctClass(
45247 p_accounting_class_code => 'ASSET'
45248 , p_ae_header_id => l_ae_header_id
45249 );
45250
45251 --
45252 -- set rounding class
45253 --
45254 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
45255 'ASSET';
45256
45257 --
45258 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
45259 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
45260 --
45261 -- bulk performance
45262 --
45263 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
45264
45265 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
45266 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
45267
45268 -- 4955764
45269 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
45270 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
45271
45272 -- 4458381 Public Sector Enh
45273
45274 --
45275 -- set accounting attributes for the line type
45276 --
45277 l_entered_amt_idx := 4;
45278 l_accted_amt_idx := 6;
45279 l_bflow_applied_to_amt_idx := NULL; -- 5132302
45280 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
45281 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
45282 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
45283 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
45284 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
45285 l_rec_acct_attrs.array_char_value(3) := p_source_51;
45286 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
45287 l_rec_acct_attrs.array_num_value(4) := p_source_52;
45288 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
45289 l_rec_acct_attrs.array_char_value(5) := p_source_53;
45290 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
45291 l_rec_acct_attrs.array_num_value(6) := p_source_52;
45292
45293 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
45294 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
45295
45296 ---------------------------------------------------------------------------------------------------------------
45297 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
45298 ---------------------------------------------------------------------------------------------------------------
45299 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
45300
45301 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
45302 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
45303
45304 IF xla_accounting_cache_pkg.GetValueChar
45305 (p_source_code => 'LEDGER_CATEGORY_CODE'
45306 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
45307 AND l_bflow_method_code = 'PRIOR_ENTRY'
45308 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
45309 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
45310 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
45311 )
45312 THEN
45313 xla_ae_lines_pkg.BflowUpgEntry
45314 (p_business_method_code => l_bflow_method_code
45315 ,p_business_class_code => l_bflow_class_code
45316 ,p_balance_type => l_balance_type_code);
45317 ELSE
45318 NULL;
45319 -- No business flow processing for business flow method of NONE.
45320 END IF;
45321
45322 --
45323 -- call analytical criteria
45324 --
45325
45326 --
45327 -- call description
45328 --
45329
45330 xla_ae_lines_pkg.SetLineDescription(
45331 p_ae_header_id => l_ae_header_id
45332 ,p_description => Description_36 (
45333 p_application_id => p_application_id
45334 , p_ae_header_id => l_ae_header_id
45335 , p_source_1 => p_source_1
45336 )
45337 );
45338
45339
45340 --
45341 -- call ADRs
45342 -- Bug 4922099
45343 --
45344 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
45345 (NVL(l_actual_upg_option, 'N') = 'O') OR
45346 (NVL(l_enc_upg_option, 'N') = 'O')
45347 )
45348 THEN
45352
45349 NULL;
45350 --
45351 --
45353 l_ccid := AcctDerRule_174(
45354 p_application_id => p_application_id
45355 , p_ae_header_id => l_ae_header_id
45356 , p_source_5 => p_source_5
45357 , p_source_32 => p_source_32
45358 , x_transaction_coa_id => l_adr_transaction_coa_id
45359 , x_accounting_coa_id => l_adr_accounting_coa_id
45360 , x_value_type_code => l_adr_value_type_code
45361 , p_side => 'NA'
45362 );
45363
45364 xla_ae_lines_pkg.set_ccid(
45365 p_code_combination_id => l_ccid
45366 , p_value_type_code => l_adr_value_type_code
45367 , p_transaction_coa_id => l_adr_transaction_coa_id
45368 , p_accounting_coa_id => l_adr_accounting_coa_id
45369 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
45370 , p_adr_type_code => 'S'
45371 , p_component_type => l_component_type
45372 , p_component_code => l_component_code
45373 , p_component_type_code => l_component_type_code
45374 , p_component_appl_id => l_component_appl_id
45375 , p_amb_context_code => l_amb_context_code
45376 , p_side => 'NA'
45377 );
45378
45379
45380 l_segment := AcctDerRule_154(
45381 p_application_id => p_application_id
45382 , p_ae_header_id => l_ae_header_id
45383 , p_source_5 => p_source_5
45384 , p_source_16 => p_source_16
45385 , x_transaction_coa_id => l_adr_transaction_coa_id
45386 , x_accounting_coa_id => l_adr_accounting_coa_id
45387 , x_flexfield_segment_code => l_adr_flexfield_segment_code
45388 , x_flex_value_set_id => l_adr_flex_value_set_id
45389 , x_value_type_code => l_adr_value_type_code
45390 , x_value_combination_id => l_adr_value_combination_id
45391 , x_value_segment_code => l_adr_value_segment_code
45392 , p_side => 'NA'
45393 , p_override_seg_flag => 'Y'
45394 );
45395
45396 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
45397
45398 xla_ae_lines_pkg.set_segment(
45399 p_to_segment_code => 'GL_ACCOUNT'
45400 , p_segment_value => l_segment
45401 , p_from_segment_code => l_adr_value_segment_code
45402 , p_from_combination_id => l_adr_value_combination_id
45403 , p_value_type_code => l_adr_value_type_code
45404 , p_transaction_coa_id => l_adr_transaction_coa_id
45405 , p_accounting_coa_id => l_adr_accounting_coa_id
45406 , p_flexfield_segment_code => l_adr_flexfield_segment_code
45407 , p_flex_value_set_id => l_adr_flex_value_set_id
45408 , p_adr_code => 'FA_COST_OF_REM_LOSS_SEGMENT'
45409 , p_adr_type_code => 'S'
45410 , p_component_type => l_component_type
45411 , p_component_code => l_component_code
45412 , p_component_type_code => l_component_type_code
45413 , p_component_appl_id => l_component_appl_id
45414 , p_amb_context_code => l_amb_context_code
45415 , p_entity_code => 'TRANSACTIONS'
45416 , p_event_class_code => 'CIP_RETIREMENTS'
45417 , p_side => 'NA'
45418 );
45419
45420 END IF;
45421
45422 l_segment := AcctDerRule_169(
45423 p_application_id => p_application_id
45424 , p_ae_header_id => l_ae_header_id
45425 , p_source_5 => p_source_5
45426 , p_source_31 => p_source_31
45427 , x_transaction_coa_id => l_adr_transaction_coa_id
45428 , x_accounting_coa_id => l_adr_accounting_coa_id
45429 , x_flexfield_segment_code => l_adr_flexfield_segment_code
45430 , x_flex_value_set_id => l_adr_flex_value_set_id
45431 , x_value_type_code => l_adr_value_type_code
45432 , x_value_combination_id => l_adr_value_combination_id
45433 , x_value_segment_code => l_adr_value_segment_code
45434 , p_side => 'NA'
45435 , p_override_seg_flag => 'Y'
45436 );
45437
45438 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
45439
45440 xla_ae_lines_pkg.set_segment(
45441 p_to_segment_code => 'GL_BALANCING'
45442 , p_segment_value => l_segment
45443 , p_from_segment_code => l_adr_value_segment_code
45444 , p_from_combination_id => l_adr_value_combination_id
45445 , p_value_type_code => l_adr_value_type_code
45446 , p_transaction_coa_id => l_adr_transaction_coa_id
45447 , p_accounting_coa_id => l_adr_accounting_coa_id
45448 , p_flexfield_segment_code => l_adr_flexfield_segment_code
45449 , p_flex_value_set_id => l_adr_flex_value_set_id
45450 , p_adr_code => 'FA_EXPENSE_ACCT'
45451 , p_adr_type_code => 'S'
45452 , p_component_type => l_component_type
45453 , p_component_code => l_component_code
45454 , p_component_type_code => l_component_type_code
45455 , p_component_appl_id => l_component_appl_id
45456 , p_amb_context_code => l_amb_context_code
45457 , p_entity_code => 'TRANSACTIONS'
45461
45458 , p_event_class_code => 'CIP_RETIREMENTS'
45459 , p_side => 'NA'
45460 );
45462 END IF;
45463
45464 --
45465 --
45466 END IF;
45467 --
45468 -- Bug 4922099
45469 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
45470 (NVL(l_enc_upg_option, 'N') = 'O')
45471 ) AND
45472 (l_bflow_method_code = 'PRIOR_ENTRY')
45473 )
45474 THEN
45475 IF
45476 --
45477 1 = 2
45478 --
45479 THEN
45480 xla_accounting_err_pkg.build_message
45481 (p_appli_s_name => 'XLA'
45482 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
45483 ,p_token_1 => 'LINE_NUMBER'
45484 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
45485 ,p_token_2 => 'LINE_TYPE_NAME'
45486 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
45487 l_component_type
45488 ,l_component_code
45489 ,l_component_type_code
45490 ,l_component_appl_id
45491 ,l_amb_context_code
45492 ,l_entity_code
45493 ,l_event_class_code
45494 )
45495 ,p_token_3 => 'OWNER'
45496 ,p_value_3 => xla_lookups_pkg.get_meaning(
45497 p_lookup_type => 'XLA_OWNER_TYPE'
45498 ,p_lookup_code => l_component_type_code
45499 )
45500 ,p_token_4 => 'PRODUCT_NAME'
45501 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
45502 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
45503 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
45504 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
45505 ,p_ae_header_id => NULL
45506 );
45507
45508 IF (C_LEVEL_ERROR>= g_log_level) THEN
45509 trace
45510 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
45511 ,p_level => C_LEVEL_ERROR
45512 ,p_module => l_log_module);
45513 END IF;
45514 END IF;
45515 END IF;
45516 --
45517 --
45518 ------------------------------------------------------------------------------------------------
45519 -- 4219869 Business Flow
45520 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
45521 -- Prior Entry. Currently, the following code is always generated.
45522 ------------------------------------------------------------------------------------------------
45523 XLA_AE_LINES_PKG.ValidateCurrentLine;
45524
45525 ------------------------------------------------------------------------------------
45526 -- 4219869 Business Flow
45527 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
45528 ------------------------------------------------------------------------------------
45529 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
45530
45531 ----------------------------------------------------------------------------------
45532 -- 4219869 Business Flow
45533 -- Update journal entry status -- Need to generate this within IF <condition>
45534 ----------------------------------------------------------------------------------
45535 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
45536 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
45537 ,p_balance_type_code => l_balance_type_code
45538 );
45539
45540 -------------------------------------------------------------------------------------------
45541 -- 4262811 - Generate the Accrual Reversal lines
45542 -------------------------------------------------------------------------------------------
45543 BEGIN
45544 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
45545 (g_array_event(p_event_id).array_value_num('header_index'));
45546 IF l_acc_rev_flag IS NULL THEN
45547 l_acc_rev_flag := 'N';
45548 END IF;
45549 EXCEPTION
45550 WHEN OTHERS THEN
45551 l_acc_rev_flag := 'N';
45552 END;
45553 --
45554 IF (l_acc_rev_flag = 'Y') THEN
45555
45556 -- 4645092 ------------------------------------------------------------------------------
45560
45557 -- To allow MPA report to determine if it should generate report process
45558 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
45559 ------------------------------------------------------------------------------------------
45561 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
45562 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
45563 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
45564 -- call ADRs
45565 -- Bug 4922099
45566 --
45567 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
45568 (NVL(l_actual_upg_option, 'N') = 'O') OR
45569 (NVL(l_enc_upg_option, 'N') = 'O')
45570 )
45571 THEN
45572 NULL;
45573 --
45574 --
45575
45576 l_ccid := AcctDerRule_174(
45577 p_application_id => p_application_id
45578 , p_ae_header_id => l_ae_header_id
45579 , p_source_5 => p_source_5
45580 , p_source_32 => p_source_32
45581 , x_transaction_coa_id => l_adr_transaction_coa_id
45582 , x_accounting_coa_id => l_adr_accounting_coa_id
45583 , x_value_type_code => l_adr_value_type_code
45584 , p_side => 'NA'
45585 );
45586
45587 xla_ae_lines_pkg.set_ccid(
45588 p_code_combination_id => l_ccid
45589 , p_value_type_code => l_adr_value_type_code
45590 , p_transaction_coa_id => l_adr_transaction_coa_id
45591 , p_accounting_coa_id => l_adr_accounting_coa_id
45592 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
45593 , p_adr_type_code => 'S'
45594 , p_component_type => l_component_type
45595 , p_component_code => l_component_code
45596 , p_component_type_code => l_component_type_code
45597 , p_component_appl_id => l_component_appl_id
45598 , p_amb_context_code => l_amb_context_code
45599 , p_side => 'NA'
45600 );
45601
45602
45603 l_segment := AcctDerRule_154(
45604 p_application_id => p_application_id
45605 , p_ae_header_id => l_ae_header_id
45606 , p_source_5 => p_source_5
45607 , p_source_16 => p_source_16
45608 , x_transaction_coa_id => l_adr_transaction_coa_id
45609 , x_accounting_coa_id => l_adr_accounting_coa_id
45610 , x_flexfield_segment_code => l_adr_flexfield_segment_code
45611 , x_flex_value_set_id => l_adr_flex_value_set_id
45612 , x_value_type_code => l_adr_value_type_code
45613 , x_value_combination_id => l_adr_value_combination_id
45614 , x_value_segment_code => l_adr_value_segment_code
45615 , p_side => 'NA'
45616 , p_override_seg_flag => 'Y'
45617 );
45618
45619 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
45620
45621 xla_ae_lines_pkg.set_segment(
45622 p_to_segment_code => 'GL_ACCOUNT'
45623 , p_segment_value => l_segment
45624 , p_from_segment_code => l_adr_value_segment_code
45625 , p_from_combination_id => l_adr_value_combination_id
45626 , p_value_type_code => l_adr_value_type_code
45627 , p_transaction_coa_id => l_adr_transaction_coa_id
45628 , p_accounting_coa_id => l_adr_accounting_coa_id
45629 , p_flexfield_segment_code => l_adr_flexfield_segment_code
45630 , p_flex_value_set_id => l_adr_flex_value_set_id
45631 , p_adr_code => 'FA_COST_OF_REM_LOSS_SEGMENT'
45632 , p_adr_type_code => 'S'
45633 , p_component_type => l_component_type
45634 , p_component_code => l_component_code
45635 , p_component_type_code => l_component_type_code
45636 , p_component_appl_id => l_component_appl_id
45637 , p_amb_context_code => l_amb_context_code
45638 , p_entity_code => 'TRANSACTIONS'
45639 , p_event_class_code => 'CIP_RETIREMENTS'
45640 , p_side => 'NA'
45641 );
45642
45643 END IF;
45644
45645 l_segment := AcctDerRule_169(
45646 p_application_id => p_application_id
45647 , p_ae_header_id => l_ae_header_id
45648 , p_source_5 => p_source_5
45649 , p_source_31 => p_source_31
45650 , x_transaction_coa_id => l_adr_transaction_coa_id
45651 , x_accounting_coa_id => l_adr_accounting_coa_id
45652 , x_flexfield_segment_code => l_adr_flexfield_segment_code
45653 , x_flex_value_set_id => l_adr_flex_value_set_id
45654 , x_value_type_code => l_adr_value_type_code
45655 , x_value_combination_id => l_adr_value_combination_id
45656 , x_value_segment_code => l_adr_value_segment_code
45657 , p_side => 'NA'
45658 , p_override_seg_flag => 'Y'
45659 );
45660
45661 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
45662
45663 xla_ae_lines_pkg.set_segment(
45664 p_to_segment_code => 'GL_BALANCING'
45665 , p_segment_value => l_segment
45666 , p_from_segment_code => l_adr_value_segment_code
45667 , p_from_combination_id => l_adr_value_combination_id
45671 , p_flexfield_segment_code => l_adr_flexfield_segment_code
45668 , p_value_type_code => l_adr_value_type_code
45669 , p_transaction_coa_id => l_adr_transaction_coa_id
45670 , p_accounting_coa_id => l_adr_accounting_coa_id
45672 , p_flex_value_set_id => l_adr_flex_value_set_id
45673 , p_adr_code => 'FA_EXPENSE_ACCT'
45674 , p_adr_type_code => 'S'
45675 , p_component_type => l_component_type
45676 , p_component_code => l_component_code
45677 , p_component_type_code => l_component_type_code
45678 , p_component_appl_id => l_component_appl_id
45679 , p_amb_context_code => l_amb_context_code
45680 , p_entity_code => 'TRANSACTIONS'
45681 , p_event_class_code => 'CIP_RETIREMENTS'
45682 , p_side => 'NA'
45683 );
45684
45685 END IF;
45686
45687 --
45688 --
45689 END IF;
45690
45691 --
45692 -- Update the line information that should be overwritten
45693 --
45694 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
45695 p_header_num => 1);
45696 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
45697
45698 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
45699
45700 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
45701 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
45702 END IF;
45703
45704 --
45705 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
45706 --
45707 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
45708 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
45709 ELSE
45710 ---------------------------------------------------------------------------------------------------
45711 -- 4262811a Switch Sign
45712 ---------------------------------------------------------------------------------------------------
45713 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
45714 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
45715 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
45716 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
45717 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
45718 -- 5132302
45719 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
45720 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
45721
45722 END IF;
45723
45724 -- 4955764
45725 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
45726 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
45727
45728
45729 XLA_AE_LINES_PKG.ValidateCurrentLine;
45730 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
45731
45732 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
45733 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
45734 ,p_balance_type_code => l_balance_type_code);
45735
45736 END IF;
45737
45738 -----------------------------------------------------------------------------------------
45739 -- 4262811 Multiperiod Accounting
45740 -----------------------------------------------------------------------------------------
45741 -- No MPA option is assigned.
45742
45743
45744 END IF;
45745 END IF;
45746 --
45747
45748 --
45749 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
45750 trace
45751 (p_msg => 'END of AcctLineType_228'
45752 ,p_level => C_LEVEL_PROCEDURE
45753 ,p_module => l_log_module);
45754 END IF;
45755 --
45756 EXCEPTION
45757 WHEN xla_exceptions_pkg.application_exception THEN
45758 RAISE;
45759 WHEN OTHERS THEN
45760 xla_exceptions_pkg.raise_message
45761 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_228');
45762 END AcctLineType_228;
45763 --
45764
45765 ---------------------------------------
45766 --
45767 -- PRIVATE FUNCTION
45768 -- AcctLineType_229
45769 --
45770 ---------------------------------------
45771 PROCEDURE AcctLineType_229 (
45772 p_application_id IN NUMBER
45773 ,p_event_id IN NUMBER
45774 ,p_calculate_acctd_flag IN VARCHAR2
45775 ,p_calculate_g_l_flag IN VARCHAR2
45776 ,p_actual_flag IN OUT VARCHAR2
45777 ,p_balance_type_code OUT VARCHAR2
45778 ,p_gain_or_loss_ref OUT VARCHAR2
45779
45780 --Period Close Date
45781 , p_source_1 IN DATE
45782 --Generated Code Combination Identifier
45783 , p_source_5 IN NUMBER
45784 --Net Book Value Retired Gain Account
45785 , p_source_23 IN VARCHAR2
45786 --Expense Account Code Combination Identifier
45787 , p_source_31 IN NUMBER
45788 --Default Code Combination Identifier
45792 --Transaction Header Identifier
45789 , p_source_32 IN NUMBER
45790 --Adjustment Type
45791 , p_source_48 IN VARCHAR2
45793 , p_source_49 IN NUMBER
45794 --Adjustment Line Identifier
45795 , p_source_50 IN NUMBER
45796 --Distribution Type Code
45797 , p_source_51 IN VARCHAR2
45798 --Entered Amount
45799 , p_source_52 IN NUMBER
45800 --Currency Code
45801 , p_source_53 IN VARCHAR2
45802 --Gain Loss Amount
45803 , p_source_54 IN NUMBER
45804 )
45805 IS
45806
45807 l_component_type VARCHAR2(80);
45808 l_component_code VARCHAR2(30);
45809 l_component_type_code VARCHAR2(1);
45810 l_component_appl_id INTEGER;
45811 l_amb_context_code VARCHAR2(30);
45812 l_entity_code VARCHAR2(30);
45813 l_event_class_code VARCHAR2(30);
45814 l_ae_header_id NUMBER;
45815 l_event_type_code VARCHAR2(30);
45816 l_line_definition_code VARCHAR2(30);
45817 l_line_definition_owner_code VARCHAR2(1);
45818 --
45819 -- adr variables
45820 l_segment VARCHAR2(30);
45821 l_ccid NUMBER;
45822 l_adr_transaction_coa_id NUMBER;
45823 l_adr_accounting_coa_id NUMBER;
45824 l_adr_flexfield_segment_code VARCHAR2(30);
45825 l_adr_flex_value_set_id NUMBER;
45826 l_adr_value_type_code VARCHAR2(30);
45827 l_adr_value_combination_id NUMBER;
45828 l_adr_value_segment_code VARCHAR2(30);
45829
45830 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
45831 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
45832 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
45833 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
45834
45835 -- 4262811 Variables ------------------------------------------------------------------------------------------
45836 l_entered_amt_idx NUMBER;
45837 l_accted_amt_idx NUMBER;
45838 l_acc_rev_flag VARCHAR2(1);
45839 l_accrual_line_num NUMBER;
45840 l_tmp_amt NUMBER;
45841 l_acc_rev_natural_side_code VARCHAR2(1);
45842
45843 l_num_entries NUMBER;
45844 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
45845 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
45846 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
45847 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
45848 l_recog_line_1 NUMBER;
45849 l_recog_line_2 NUMBER;
45850
45851 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
45852 l_bflow_applied_to_amt NUMBER; -- 5132302
45853 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
45854
45855 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
45856
45857 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
45858 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
45859
45860 ---------------------------------------------------------------------------------------------------------------
45861
45862
45863 --
45864 -- bulk performance
45865 --
45866 l_balance_type_code VARCHAR2(1);
45867 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
45868 l_log_module VARCHAR2(240);
45869
45870 --
45871 -- Upgrade strategy
45872 --
45873 l_actual_upg_option VARCHAR2(1);
45874 l_enc_upg_option VARCHAR2(1);
45875
45876 --
45877 BEGIN
45878 --
45879 IF g_log_enabled THEN
45880 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_229';
45881 END IF;
45882 --
45883 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
45884
45885 trace
45886 (p_msg => 'BEGIN of AcctLineType_229'
45887 ,p_level => C_LEVEL_PROCEDURE
45888 ,p_module => l_log_module);
45889
45890 END IF;
45891 --
45892 l_component_type := 'AMB_JLT';
45893 l_component_code := 'FA_CIP_NBV_RETIRED_GAIN';
45894 l_component_type_code := 'S';
45895 l_component_appl_id := 140;
45896 l_amb_context_code := 'DEFAULT';
45897 l_entity_code := 'TRANSACTIONS';
45898 l_event_class_code := 'CIP_RETIREMENTS';
45899 l_event_type_code := 'CIP_RETIREMENTS';
45900 l_line_definition_owner_code := 'S';
45901 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
45902 --
45903 l_balance_type_code := 'A';
45904 l_segment := NULL;
45905 l_ccid := NULL;
45906 l_adr_transaction_coa_id := NULL;
45907 l_adr_accounting_coa_id := NULL;
45908 l_adr_flexfield_segment_code := NULL;
45909 l_adr_flex_value_set_id := NULL;
45910 l_adr_value_type_code := NULL;
45911 l_adr_value_combination_id := NULL;
45912 l_adr_value_segment_code := NULL;
45913
45914 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
45915 l_bflow_class_code := ''; -- 4219869 Business Flow
45916 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
45917 l_budgetary_control_flag := 'N';
45918
45922 l_accted_amt_idx := NULL; -- 4262811
45919 l_bflow_applied_to_amt_idx := NULL; -- 5132302
45920 l_bflow_applied_to_amt := NULL; -- 5132302
45921 l_entered_amt_idx := NULL; -- 4262811
45923 l_acc_rev_flag := NULL; -- 4262811
45924 l_accrual_line_num := NULL; -- 4262811
45925 l_tmp_amt := NULL; -- 4262811
45926 --
45927
45928 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
45929 l_balance_type_code <> 'B' THEN
45930 IF NVL(p_source_48,'
45931 ') = 'NBV RETIRED' AND
45932 p_source_54 >= 0
45933 THEN
45934
45935 --
45936 XLA_AE_LINES_PKG.SetNewLine;
45937
45938 p_balance_type_code := l_balance_type_code;
45939 -- set the flag so later we will know whether the gain loss line needs to be created
45940
45941 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
45942 p_actual_flag :='A';
45943 END IF;
45944
45945 --
45946 -- bulk performance
45947 --
45948 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
45949 p_header_num => 0); -- 4262811
45950 --
45951 -- set accounting line options
45952 --
45953 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
45954 p_natural_side_code => 'D'
45955 , p_gain_or_loss_flag => 'N'
45956 , p_gl_transfer_mode_code => 'S'
45957 , p_acct_entry_type_code => 'A'
45958 , p_switch_side_flag => 'Y'
45959 , p_merge_duplicate_code => 'N'
45960 );
45961 --
45962 l_acc_rev_natural_side_code := 'C'; -- 4262811
45963 --
45964 --
45965 -- set accounting line type info
45966 --
45967 xla_ae_lines_pkg.SetAcctLineType
45968 (p_component_type => l_component_type
45969 ,p_event_type_code => l_event_type_code
45970 ,p_line_definition_owner_code => l_line_definition_owner_code
45971 ,p_line_definition_code => l_line_definition_code
45972 ,p_accounting_line_code => l_component_code
45973 ,p_accounting_line_type_code => l_component_type_code
45974 ,p_accounting_line_appl_id => l_component_appl_id
45975 ,p_amb_context_code => l_amb_context_code
45976 ,p_entity_code => l_entity_code
45977 ,p_event_class_code => l_event_class_code);
45978 --
45979 -- set accounting class
45980 --
45981 xla_ae_lines_pkg.SetAcctClass(
45982 p_accounting_class_code => 'ASSET'
45983 , p_ae_header_id => l_ae_header_id
45984 );
45985
45986 --
45987 -- set rounding class
45988 --
45989 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
45990 'ASSET';
45991
45992 --
45993 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
45994 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
45995 --
45996 -- bulk performance
45997 --
45998 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
45999
46000 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
46001 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
46002
46003 -- 4955764
46004 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
46005 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
46006
46007 -- 4458381 Public Sector Enh
46008
46009 --
46010 -- set accounting attributes for the line type
46011 --
46012 l_entered_amt_idx := 4;
46013 l_accted_amt_idx := 6;
46014 l_bflow_applied_to_amt_idx := NULL; -- 5132302
46015 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
46016 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
46017 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
46018 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
46019 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
46020 l_rec_acct_attrs.array_char_value(3) := p_source_51;
46021 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
46022 l_rec_acct_attrs.array_num_value(4) := p_source_52;
46023 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
46024 l_rec_acct_attrs.array_char_value(5) := p_source_53;
46025 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
46026 l_rec_acct_attrs.array_num_value(6) := p_source_52;
46027
46028 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
46029 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
46030
46031 ---------------------------------------------------------------------------------------------------------------
46032 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
46033 ---------------------------------------------------------------------------------------------------------------
46037 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
46034 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
46035
46036 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
46038
46039 IF xla_accounting_cache_pkg.GetValueChar
46040 (p_source_code => 'LEDGER_CATEGORY_CODE'
46041 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
46042 AND l_bflow_method_code = 'PRIOR_ENTRY'
46043 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
46044 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
46045 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
46046 )
46047 THEN
46048 xla_ae_lines_pkg.BflowUpgEntry
46049 (p_business_method_code => l_bflow_method_code
46050 ,p_business_class_code => l_bflow_class_code
46051 ,p_balance_type => l_balance_type_code);
46052 ELSE
46053 NULL;
46054 -- No business flow processing for business flow method of NONE.
46055 END IF;
46056
46057 --
46058 -- call analytical criteria
46059 --
46060
46061 --
46062 -- call description
46063 --
46064
46065 xla_ae_lines_pkg.SetLineDescription(
46066 p_ae_header_id => l_ae_header_id
46067 ,p_description => Description_34 (
46068 p_application_id => p_application_id
46069 , p_ae_header_id => l_ae_header_id
46070 , p_source_1 => p_source_1
46071 )
46072 );
46073
46074
46075 --
46076 -- call ADRs
46077 -- Bug 4922099
46078 --
46079 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
46080 (NVL(l_actual_upg_option, 'N') = 'O') OR
46081 (NVL(l_enc_upg_option, 'N') = 'O')
46082 )
46083 THEN
46084 NULL;
46085 --
46086 --
46087
46088 l_ccid := AcctDerRule_174(
46089 p_application_id => p_application_id
46090 , p_ae_header_id => l_ae_header_id
46091 , p_source_5 => p_source_5
46092 , p_source_32 => p_source_32
46093 , x_transaction_coa_id => l_adr_transaction_coa_id
46094 , x_accounting_coa_id => l_adr_accounting_coa_id
46095 , x_value_type_code => l_adr_value_type_code
46096 , p_side => 'NA'
46097 );
46098
46099 xla_ae_lines_pkg.set_ccid(
46100 p_code_combination_id => l_ccid
46101 , p_value_type_code => l_adr_value_type_code
46102 , p_transaction_coa_id => l_adr_transaction_coa_id
46103 , p_accounting_coa_id => l_adr_accounting_coa_id
46104 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
46105 , p_adr_type_code => 'S'
46106 , p_component_type => l_component_type
46107 , p_component_code => l_component_code
46108 , p_component_type_code => l_component_type_code
46109 , p_component_appl_id => l_component_appl_id
46110 , p_amb_context_code => l_amb_context_code
46111 , p_side => 'NA'
46112 );
46113
46114
46115 l_segment := AcctDerRule_169(
46116 p_application_id => p_application_id
46117 , p_ae_header_id => l_ae_header_id
46118 , p_source_5 => p_source_5
46119 , p_source_31 => p_source_31
46120 , x_transaction_coa_id => l_adr_transaction_coa_id
46121 , x_accounting_coa_id => l_adr_accounting_coa_id
46122 , x_flexfield_segment_code => l_adr_flexfield_segment_code
46123 , x_flex_value_set_id => l_adr_flex_value_set_id
46124 , x_value_type_code => l_adr_value_type_code
46125 , x_value_combination_id => l_adr_value_combination_id
46126 , x_value_segment_code => l_adr_value_segment_code
46127 , p_side => 'NA'
46128 , p_override_seg_flag => 'Y'
46129 );
46130
46131 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
46132
46133 xla_ae_lines_pkg.set_segment(
46134 p_to_segment_code => 'GL_BALANCING'
46135 , p_segment_value => l_segment
46136 , p_from_segment_code => l_adr_value_segment_code
46137 , p_from_combination_id => l_adr_value_combination_id
46138 , p_value_type_code => l_adr_value_type_code
46139 , p_transaction_coa_id => l_adr_transaction_coa_id
46140 , p_accounting_coa_id => l_adr_accounting_coa_id
46141 , p_flexfield_segment_code => l_adr_flexfield_segment_code
46142 , p_flex_value_set_id => l_adr_flex_value_set_id
46143 , p_adr_code => 'FA_EXPENSE_ACCT'
46144 , p_adr_type_code => 'S'
46145 , p_component_type => l_component_type
46146 , p_component_code => l_component_code
46147 , p_component_type_code => l_component_type_code
46148 , p_component_appl_id => l_component_appl_id
46149 , p_amb_context_code => l_amb_context_code
46150 , p_entity_code => 'TRANSACTIONS'
46151 , p_event_class_code => 'CIP_RETIREMENTS'
46152 , p_side => 'NA'
46153 );
46154
46158 p_application_id => p_application_id
46155 END IF;
46156
46157 l_segment := AcctDerRule_160(
46159 , p_ae_header_id => l_ae_header_id
46160 , p_source_5 => p_source_5
46161 , p_source_23 => p_source_23
46162 , x_transaction_coa_id => l_adr_transaction_coa_id
46163 , x_accounting_coa_id => l_adr_accounting_coa_id
46164 , x_flexfield_segment_code => l_adr_flexfield_segment_code
46165 , x_flex_value_set_id => l_adr_flex_value_set_id
46166 , x_value_type_code => l_adr_value_type_code
46167 , x_value_combination_id => l_adr_value_combination_id
46168 , x_value_segment_code => l_adr_value_segment_code
46169 , p_side => 'NA'
46170 , p_override_seg_flag => 'Y'
46171 );
46172
46173 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
46174
46175 xla_ae_lines_pkg.set_segment(
46176 p_to_segment_code => 'GL_ACCOUNT'
46177 , p_segment_value => l_segment
46178 , p_from_segment_code => l_adr_value_segment_code
46179 , p_from_combination_id => l_adr_value_combination_id
46180 , p_value_type_code => l_adr_value_type_code
46181 , p_transaction_coa_id => l_adr_transaction_coa_id
46182 , p_accounting_coa_id => l_adr_accounting_coa_id
46183 , p_flexfield_segment_code => l_adr_flexfield_segment_code
46184 , p_flex_value_set_id => l_adr_flex_value_set_id
46185 , p_adr_code => 'FA_NBV_RETIRED_GAIN_SEGMENT'
46186 , p_adr_type_code => 'S'
46187 , p_component_type => l_component_type
46188 , p_component_code => l_component_code
46189 , p_component_type_code => l_component_type_code
46190 , p_component_appl_id => l_component_appl_id
46191 , p_amb_context_code => l_amb_context_code
46192 , p_entity_code => 'TRANSACTIONS'
46193 , p_event_class_code => 'CIP_RETIREMENTS'
46194 , p_side => 'NA'
46195 );
46196
46197 END IF;
46198
46199 --
46200 --
46201 END IF;
46202 --
46203 -- Bug 4922099
46204 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
46205 (NVL(l_enc_upg_option, 'N') = 'O')
46206 ) AND
46207 (l_bflow_method_code = 'PRIOR_ENTRY')
46208 )
46209 THEN
46210 IF
46211 --
46212 1 = 2
46213 --
46214 THEN
46215 xla_accounting_err_pkg.build_message
46216 (p_appli_s_name => 'XLA'
46217 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
46218 ,p_token_1 => 'LINE_NUMBER'
46219 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
46220 ,p_token_2 => 'LINE_TYPE_NAME'
46221 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
46222 l_component_type
46223 ,l_component_code
46224 ,l_component_type_code
46225 ,l_component_appl_id
46226 ,l_amb_context_code
46227 ,l_entity_code
46228 ,l_event_class_code
46229 )
46230 ,p_token_3 => 'OWNER'
46231 ,p_value_3 => xla_lookups_pkg.get_meaning(
46232 p_lookup_type => 'XLA_OWNER_TYPE'
46233 ,p_lookup_code => l_component_type_code
46234 )
46235 ,p_token_4 => 'PRODUCT_NAME'
46236 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
46237 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
46238 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
46239 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
46240 ,p_ae_header_id => NULL
46241 );
46242
46243 IF (C_LEVEL_ERROR>= g_log_level) THEN
46244 trace
46245 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
46246 ,p_level => C_LEVEL_ERROR
46247 ,p_module => l_log_module);
46248 END IF;
46249 END IF;
46250 END IF;
46251 --
46252 --
46253 ------------------------------------------------------------------------------------------------
46254 -- 4219869 Business Flow
46255 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
46259
46256 -- Prior Entry. Currently, the following code is always generated.
46257 ------------------------------------------------------------------------------------------------
46258 XLA_AE_LINES_PKG.ValidateCurrentLine;
46260 ------------------------------------------------------------------------------------
46261 -- 4219869 Business Flow
46262 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
46263 ------------------------------------------------------------------------------------
46264 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
46265
46266 ----------------------------------------------------------------------------------
46267 -- 4219869 Business Flow
46268 -- Update journal entry status -- Need to generate this within IF <condition>
46269 ----------------------------------------------------------------------------------
46270 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
46271 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
46272 ,p_balance_type_code => l_balance_type_code
46273 );
46274
46275 -------------------------------------------------------------------------------------------
46276 -- 4262811 - Generate the Accrual Reversal lines
46277 -------------------------------------------------------------------------------------------
46278 BEGIN
46279 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
46280 (g_array_event(p_event_id).array_value_num('header_index'));
46281 IF l_acc_rev_flag IS NULL THEN
46282 l_acc_rev_flag := 'N';
46283 END IF;
46284 EXCEPTION
46285 WHEN OTHERS THEN
46286 l_acc_rev_flag := 'N';
46287 END;
46288 --
46289 IF (l_acc_rev_flag = 'Y') THEN
46290
46291 -- 4645092 ------------------------------------------------------------------------------
46292 -- To allow MPA report to determine if it should generate report process
46293 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
46294 ------------------------------------------------------------------------------------------
46295
46296 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
46297 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
46298 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
46299 -- call ADRs
46300 -- Bug 4922099
46301 --
46302 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
46303 (NVL(l_actual_upg_option, 'N') = 'O') OR
46304 (NVL(l_enc_upg_option, 'N') = 'O')
46305 )
46306 THEN
46307 NULL;
46308 --
46309 --
46310
46311 l_ccid := AcctDerRule_174(
46312 p_application_id => p_application_id
46313 , p_ae_header_id => l_ae_header_id
46314 , p_source_5 => p_source_5
46315 , p_source_32 => p_source_32
46316 , x_transaction_coa_id => l_adr_transaction_coa_id
46317 , x_accounting_coa_id => l_adr_accounting_coa_id
46318 , x_value_type_code => l_adr_value_type_code
46319 , p_side => 'NA'
46320 );
46321
46322 xla_ae_lines_pkg.set_ccid(
46323 p_code_combination_id => l_ccid
46324 , p_value_type_code => l_adr_value_type_code
46325 , p_transaction_coa_id => l_adr_transaction_coa_id
46326 , p_accounting_coa_id => l_adr_accounting_coa_id
46327 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
46328 , p_adr_type_code => 'S'
46329 , p_component_type => l_component_type
46330 , p_component_code => l_component_code
46331 , p_component_type_code => l_component_type_code
46332 , p_component_appl_id => l_component_appl_id
46333 , p_amb_context_code => l_amb_context_code
46334 , p_side => 'NA'
46335 );
46336
46337
46338 l_segment := AcctDerRule_169(
46339 p_application_id => p_application_id
46340 , p_ae_header_id => l_ae_header_id
46341 , p_source_5 => p_source_5
46342 , p_source_31 => p_source_31
46343 , x_transaction_coa_id => l_adr_transaction_coa_id
46344 , x_accounting_coa_id => l_adr_accounting_coa_id
46345 , x_flexfield_segment_code => l_adr_flexfield_segment_code
46346 , x_flex_value_set_id => l_adr_flex_value_set_id
46347 , x_value_type_code => l_adr_value_type_code
46348 , x_value_combination_id => l_adr_value_combination_id
46349 , x_value_segment_code => l_adr_value_segment_code
46350 , p_side => 'NA'
46351 , p_override_seg_flag => 'Y'
46352 );
46353
46354 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
46355
46356 xla_ae_lines_pkg.set_segment(
46357 p_to_segment_code => 'GL_BALANCING'
46358 , p_segment_value => l_segment
46359 , p_from_segment_code => l_adr_value_segment_code
46360 , p_from_combination_id => l_adr_value_combination_id
46361 , p_value_type_code => l_adr_value_type_code
46362 , p_transaction_coa_id => l_adr_transaction_coa_id
46363 , p_accounting_coa_id => l_adr_accounting_coa_id
46364 , p_flexfield_segment_code => l_adr_flexfield_segment_code
46365 , p_flex_value_set_id => l_adr_flex_value_set_id
46369 , p_component_code => l_component_code
46366 , p_adr_code => 'FA_EXPENSE_ACCT'
46367 , p_adr_type_code => 'S'
46368 , p_component_type => l_component_type
46370 , p_component_type_code => l_component_type_code
46371 , p_component_appl_id => l_component_appl_id
46372 , p_amb_context_code => l_amb_context_code
46373 , p_entity_code => 'TRANSACTIONS'
46374 , p_event_class_code => 'CIP_RETIREMENTS'
46375 , p_side => 'NA'
46376 );
46377
46378 END IF;
46379
46380 l_segment := AcctDerRule_160(
46381 p_application_id => p_application_id
46382 , p_ae_header_id => l_ae_header_id
46383 , p_source_5 => p_source_5
46384 , p_source_23 => p_source_23
46385 , x_transaction_coa_id => l_adr_transaction_coa_id
46386 , x_accounting_coa_id => l_adr_accounting_coa_id
46387 , x_flexfield_segment_code => l_adr_flexfield_segment_code
46388 , x_flex_value_set_id => l_adr_flex_value_set_id
46389 , x_value_type_code => l_adr_value_type_code
46390 , x_value_combination_id => l_adr_value_combination_id
46391 , x_value_segment_code => l_adr_value_segment_code
46392 , p_side => 'NA'
46393 , p_override_seg_flag => 'Y'
46394 );
46395
46396 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
46397
46398 xla_ae_lines_pkg.set_segment(
46399 p_to_segment_code => 'GL_ACCOUNT'
46400 , p_segment_value => l_segment
46401 , p_from_segment_code => l_adr_value_segment_code
46402 , p_from_combination_id => l_adr_value_combination_id
46403 , p_value_type_code => l_adr_value_type_code
46404 , p_transaction_coa_id => l_adr_transaction_coa_id
46405 , p_accounting_coa_id => l_adr_accounting_coa_id
46406 , p_flexfield_segment_code => l_adr_flexfield_segment_code
46407 , p_flex_value_set_id => l_adr_flex_value_set_id
46408 , p_adr_code => 'FA_NBV_RETIRED_GAIN_SEGMENT'
46409 , p_adr_type_code => 'S'
46410 , p_component_type => l_component_type
46411 , p_component_code => l_component_code
46412 , p_component_type_code => l_component_type_code
46413 , p_component_appl_id => l_component_appl_id
46414 , p_amb_context_code => l_amb_context_code
46415 , p_entity_code => 'TRANSACTIONS'
46416 , p_event_class_code => 'CIP_RETIREMENTS'
46417 , p_side => 'NA'
46418 );
46419
46420 END IF;
46421
46422 --
46423 --
46424 END IF;
46425
46426 --
46427 -- Update the line information that should be overwritten
46428 --
46429 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
46430 p_header_num => 1);
46431 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
46432
46433 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
46434
46435 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
46436 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
46437 END IF;
46438
46439 --
46440 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
46441 --
46442 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
46443 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
46444 ELSE
46445 ---------------------------------------------------------------------------------------------------
46446 -- 4262811a Switch Sign
46447 ---------------------------------------------------------------------------------------------------
46448 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
46449 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
46450 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
46451 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
46452 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
46453 -- 5132302
46454 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
46455 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
46456
46457 END IF;
46458
46459 -- 4955764
46460 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
46461 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
46462
46463
46464 XLA_AE_LINES_PKG.ValidateCurrentLine;
46465 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
46466
46467 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
46468 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
46472
46469 ,p_balance_type_code => l_balance_type_code);
46470
46471 END IF;
46473 -----------------------------------------------------------------------------------------
46474 -- 4262811 Multiperiod Accounting
46475 -----------------------------------------------------------------------------------------
46476 -- No MPA option is assigned.
46477
46478
46479 END IF;
46480 END IF;
46481 --
46482
46483 --
46484 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
46485 trace
46486 (p_msg => 'END of AcctLineType_229'
46487 ,p_level => C_LEVEL_PROCEDURE
46488 ,p_module => l_log_module);
46489 END IF;
46490 --
46491 EXCEPTION
46492 WHEN xla_exceptions_pkg.application_exception THEN
46493 RAISE;
46494 WHEN OTHERS THEN
46495 xla_exceptions_pkg.raise_message
46496 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_229');
46497 END AcctLineType_229;
46498 --
46499
46500 ---------------------------------------
46501 --
46502 -- PRIVATE FUNCTION
46503 -- AcctLineType_230
46504 --
46505 ---------------------------------------
46506 PROCEDURE AcctLineType_230 (
46507 p_application_id IN NUMBER
46508 ,p_event_id IN NUMBER
46509 ,p_calculate_acctd_flag IN VARCHAR2
46510 ,p_calculate_g_l_flag IN VARCHAR2
46511 ,p_actual_flag IN OUT VARCHAR2
46512 ,p_balance_type_code OUT VARCHAR2
46513 ,p_gain_or_loss_ref OUT VARCHAR2
46514
46515 --Period Close Date
46516 , p_source_1 IN DATE
46517 --Generated Code Combination Identifier
46518 , p_source_5 IN NUMBER
46519 --Net Book Value Retired Gain Account
46520 , p_source_23 IN VARCHAR2
46521 --Expense Account Code Combination Identifier
46522 , p_source_31 IN NUMBER
46523 --Default Code Combination Identifier
46524 , p_source_32 IN NUMBER
46525 --Adjustment Type
46526 , p_source_48 IN VARCHAR2
46527 --Transaction Header Identifier
46528 , p_source_49 IN NUMBER
46529 --Adjustment Line Identifier
46530 , p_source_50 IN NUMBER
46531 --Distribution Type Code
46532 , p_source_51 IN VARCHAR2
46533 --Entered Amount
46534 , p_source_52 IN NUMBER
46535 --Currency Code
46536 , p_source_53 IN VARCHAR2
46537 --Gain Loss Amount
46538 , p_source_54 IN NUMBER
46539 )
46540 IS
46541
46542 l_component_type VARCHAR2(80);
46543 l_component_code VARCHAR2(30);
46544 l_component_type_code VARCHAR2(1);
46545 l_component_appl_id INTEGER;
46546 l_amb_context_code VARCHAR2(30);
46547 l_entity_code VARCHAR2(30);
46548 l_event_class_code VARCHAR2(30);
46549 l_ae_header_id NUMBER;
46550 l_event_type_code VARCHAR2(30);
46551 l_line_definition_code VARCHAR2(30);
46552 l_line_definition_owner_code VARCHAR2(1);
46553 --
46554 -- adr variables
46555 l_segment VARCHAR2(30);
46556 l_ccid NUMBER;
46557 l_adr_transaction_coa_id NUMBER;
46558 l_adr_accounting_coa_id NUMBER;
46559 l_adr_flexfield_segment_code VARCHAR2(30);
46560 l_adr_flex_value_set_id NUMBER;
46561 l_adr_value_type_code VARCHAR2(30);
46562 l_adr_value_combination_id NUMBER;
46563 l_adr_value_segment_code VARCHAR2(30);
46564
46565 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
46566 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
46567 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
46568 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
46569
46570 -- 4262811 Variables ------------------------------------------------------------------------------------------
46571 l_entered_amt_idx NUMBER;
46572 l_accted_amt_idx NUMBER;
46573 l_acc_rev_flag VARCHAR2(1);
46574 l_accrual_line_num NUMBER;
46575 l_tmp_amt NUMBER;
46576 l_acc_rev_natural_side_code VARCHAR2(1);
46577
46578 l_num_entries NUMBER;
46579 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
46580 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
46581 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
46582 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
46583 l_recog_line_1 NUMBER;
46584 l_recog_line_2 NUMBER;
46585
46586 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
46587 l_bflow_applied_to_amt NUMBER; -- 5132302
46588 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
46589
46590 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
46591
46592 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
46593 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
46594
46595 ---------------------------------------------------------------------------------------------------------------
46596
46597
46598 --
46599 -- bulk performance
46600 --
46601 l_balance_type_code VARCHAR2(1);
46605 --
46602 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
46603 l_log_module VARCHAR2(240);
46604
46606 -- Upgrade strategy
46607 --
46608 l_actual_upg_option VARCHAR2(1);
46609 l_enc_upg_option VARCHAR2(1);
46610
46611 --
46612 BEGIN
46613 --
46614 IF g_log_enabled THEN
46615 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_230';
46616 END IF;
46617 --
46618 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
46619
46620 trace
46621 (p_msg => 'BEGIN of AcctLineType_230'
46622 ,p_level => C_LEVEL_PROCEDURE
46623 ,p_module => l_log_module);
46624
46625 END IF;
46626 --
46627 l_component_type := 'AMB_JLT';
46628 l_component_code := 'FA_CIP_NBV_RETIRED_GAIN';
46629 l_component_type_code := 'S';
46630 l_component_appl_id := 140;
46631 l_amb_context_code := 'DEFAULT';
46632 l_entity_code := 'TRANSACTIONS';
46633 l_event_class_code := 'CIP_RETIREMENTS';
46634 l_event_type_code := 'CIP_REINSTATEMENTS';
46635 l_line_definition_owner_code := 'S';
46636 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
46637 --
46638 l_balance_type_code := 'A';
46639 l_segment := NULL;
46640 l_ccid := NULL;
46641 l_adr_transaction_coa_id := NULL;
46642 l_adr_accounting_coa_id := NULL;
46643 l_adr_flexfield_segment_code := NULL;
46644 l_adr_flex_value_set_id := NULL;
46645 l_adr_value_type_code := NULL;
46646 l_adr_value_combination_id := NULL;
46647 l_adr_value_segment_code := NULL;
46648
46649 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
46650 l_bflow_class_code := ''; -- 4219869 Business Flow
46651 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
46652 l_budgetary_control_flag := 'N';
46653
46654 l_bflow_applied_to_amt_idx := NULL; -- 5132302
46655 l_bflow_applied_to_amt := NULL; -- 5132302
46656 l_entered_amt_idx := NULL; -- 4262811
46657 l_accted_amt_idx := NULL; -- 4262811
46658 l_acc_rev_flag := NULL; -- 4262811
46659 l_accrual_line_num := NULL; -- 4262811
46660 l_tmp_amt := NULL; -- 4262811
46661 --
46662
46663 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
46664 l_balance_type_code <> 'B' THEN
46665 IF NVL(p_source_48,'
46666 ') = 'NBV RETIRED' AND
46667 p_source_54 >= 0
46668 THEN
46669
46670 --
46671 XLA_AE_LINES_PKG.SetNewLine;
46672
46673 p_balance_type_code := l_balance_type_code;
46674 -- set the flag so later we will know whether the gain loss line needs to be created
46675
46676 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
46677 p_actual_flag :='A';
46678 END IF;
46679
46680 --
46681 -- bulk performance
46682 --
46683 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
46684 p_header_num => 0); -- 4262811
46685 --
46686 -- set accounting line options
46687 --
46688 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
46689 p_natural_side_code => 'D'
46690 , p_gain_or_loss_flag => 'N'
46691 , p_gl_transfer_mode_code => 'S'
46692 , p_acct_entry_type_code => 'A'
46693 , p_switch_side_flag => 'Y'
46694 , p_merge_duplicate_code => 'N'
46695 );
46696 --
46697 l_acc_rev_natural_side_code := 'C'; -- 4262811
46698 --
46699 --
46700 -- set accounting line type info
46701 --
46702 xla_ae_lines_pkg.SetAcctLineType
46703 (p_component_type => l_component_type
46704 ,p_event_type_code => l_event_type_code
46705 ,p_line_definition_owner_code => l_line_definition_owner_code
46706 ,p_line_definition_code => l_line_definition_code
46707 ,p_accounting_line_code => l_component_code
46708 ,p_accounting_line_type_code => l_component_type_code
46709 ,p_accounting_line_appl_id => l_component_appl_id
46710 ,p_amb_context_code => l_amb_context_code
46711 ,p_entity_code => l_entity_code
46712 ,p_event_class_code => l_event_class_code);
46713 --
46714 -- set accounting class
46715 --
46716 xla_ae_lines_pkg.SetAcctClass(
46717 p_accounting_class_code => 'ASSET'
46718 , p_ae_header_id => l_ae_header_id
46719 );
46720
46721 --
46722 -- set rounding class
46723 --
46724 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
46725 'ASSET';
46726
46727 --
46728 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
46729 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
46730 --
46731 -- bulk performance
46732 --
46733 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
46734
46735 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
46736 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
46737
46741
46738 -- 4955764
46739 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
46740 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
46742 -- 4458381 Public Sector Enh
46743
46744 --
46745 -- set accounting attributes for the line type
46746 --
46747 l_entered_amt_idx := 4;
46748 l_accted_amt_idx := 6;
46749 l_bflow_applied_to_amt_idx := NULL; -- 5132302
46750 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
46751 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
46752 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
46753 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
46754 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
46755 l_rec_acct_attrs.array_char_value(3) := p_source_51;
46756 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
46757 l_rec_acct_attrs.array_num_value(4) := p_source_52;
46758 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
46759 l_rec_acct_attrs.array_char_value(5) := p_source_53;
46760 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
46761 l_rec_acct_attrs.array_num_value(6) := p_source_52;
46762
46763 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
46764 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
46765
46766 ---------------------------------------------------------------------------------------------------------------
46767 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
46768 ---------------------------------------------------------------------------------------------------------------
46769 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
46770
46771 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
46772 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
46773
46774 IF xla_accounting_cache_pkg.GetValueChar
46775 (p_source_code => 'LEDGER_CATEGORY_CODE'
46776 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
46777 AND l_bflow_method_code = 'PRIOR_ENTRY'
46778 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
46779 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
46780 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
46781 )
46782 THEN
46783 xla_ae_lines_pkg.BflowUpgEntry
46784 (p_business_method_code => l_bflow_method_code
46785 ,p_business_class_code => l_bflow_class_code
46786 ,p_balance_type => l_balance_type_code);
46787 ELSE
46788 NULL;
46789 -- No business flow processing for business flow method of NONE.
46790 END IF;
46791
46792 --
46793 -- call analytical criteria
46794 --
46795
46796 --
46797 -- call description
46798 --
46799
46800 xla_ae_lines_pkg.SetLineDescription(
46801 p_ae_header_id => l_ae_header_id
46802 ,p_description => Description_34 (
46803 p_application_id => p_application_id
46804 , p_ae_header_id => l_ae_header_id
46805 , p_source_1 => p_source_1
46806 )
46807 );
46808
46809
46810 --
46811 -- call ADRs
46812 -- Bug 4922099
46813 --
46814 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
46815 (NVL(l_actual_upg_option, 'N') = 'O') OR
46816 (NVL(l_enc_upg_option, 'N') = 'O')
46817 )
46818 THEN
46819 NULL;
46820 --
46821 --
46822
46823 l_ccid := AcctDerRule_174(
46824 p_application_id => p_application_id
46825 , p_ae_header_id => l_ae_header_id
46826 , p_source_5 => p_source_5
46827 , p_source_32 => p_source_32
46828 , x_transaction_coa_id => l_adr_transaction_coa_id
46829 , x_accounting_coa_id => l_adr_accounting_coa_id
46830 , x_value_type_code => l_adr_value_type_code
46831 , p_side => 'NA'
46832 );
46833
46834 xla_ae_lines_pkg.set_ccid(
46835 p_code_combination_id => l_ccid
46836 , p_value_type_code => l_adr_value_type_code
46837 , p_transaction_coa_id => l_adr_transaction_coa_id
46838 , p_accounting_coa_id => l_adr_accounting_coa_id
46839 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
46840 , p_adr_type_code => 'S'
46841 , p_component_type => l_component_type
46842 , p_component_code => l_component_code
46843 , p_component_type_code => l_component_type_code
46844 , p_component_appl_id => l_component_appl_id
46845 , p_amb_context_code => l_amb_context_code
46846 , p_side => 'NA'
46847 );
46848
46849
46850 l_segment := AcctDerRule_169(
46851 p_application_id => p_application_id
46852 , p_ae_header_id => l_ae_header_id
46853 , p_source_5 => p_source_5
46854 , p_source_31 => p_source_31
46855 , x_transaction_coa_id => l_adr_transaction_coa_id
46856 , x_accounting_coa_id => l_adr_accounting_coa_id
46860 , x_value_combination_id => l_adr_value_combination_id
46857 , x_flexfield_segment_code => l_adr_flexfield_segment_code
46858 , x_flex_value_set_id => l_adr_flex_value_set_id
46859 , x_value_type_code => l_adr_value_type_code
46861 , x_value_segment_code => l_adr_value_segment_code
46862 , p_side => 'NA'
46863 , p_override_seg_flag => 'Y'
46864 );
46865
46866 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
46867
46868 xla_ae_lines_pkg.set_segment(
46869 p_to_segment_code => 'GL_BALANCING'
46870 , p_segment_value => l_segment
46871 , p_from_segment_code => l_adr_value_segment_code
46872 , p_from_combination_id => l_adr_value_combination_id
46873 , p_value_type_code => l_adr_value_type_code
46874 , p_transaction_coa_id => l_adr_transaction_coa_id
46875 , p_accounting_coa_id => l_adr_accounting_coa_id
46876 , p_flexfield_segment_code => l_adr_flexfield_segment_code
46877 , p_flex_value_set_id => l_adr_flex_value_set_id
46878 , p_adr_code => 'FA_EXPENSE_ACCT'
46879 , p_adr_type_code => 'S'
46880 , p_component_type => l_component_type
46881 , p_component_code => l_component_code
46882 , p_component_type_code => l_component_type_code
46883 , p_component_appl_id => l_component_appl_id
46884 , p_amb_context_code => l_amb_context_code
46885 , p_entity_code => 'TRANSACTIONS'
46886 , p_event_class_code => 'CIP_RETIREMENTS'
46887 , p_side => 'NA'
46888 );
46889
46890 END IF;
46891
46892 l_segment := AcctDerRule_160(
46893 p_application_id => p_application_id
46894 , p_ae_header_id => l_ae_header_id
46895 , p_source_5 => p_source_5
46896 , p_source_23 => p_source_23
46897 , x_transaction_coa_id => l_adr_transaction_coa_id
46898 , x_accounting_coa_id => l_adr_accounting_coa_id
46899 , x_flexfield_segment_code => l_adr_flexfield_segment_code
46900 , x_flex_value_set_id => l_adr_flex_value_set_id
46901 , x_value_type_code => l_adr_value_type_code
46902 , x_value_combination_id => l_adr_value_combination_id
46903 , x_value_segment_code => l_adr_value_segment_code
46904 , p_side => 'NA'
46905 , p_override_seg_flag => 'Y'
46906 );
46907
46908 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
46909
46910 xla_ae_lines_pkg.set_segment(
46911 p_to_segment_code => 'GL_ACCOUNT'
46912 , p_segment_value => l_segment
46913 , p_from_segment_code => l_adr_value_segment_code
46914 , p_from_combination_id => l_adr_value_combination_id
46915 , p_value_type_code => l_adr_value_type_code
46916 , p_transaction_coa_id => l_adr_transaction_coa_id
46917 , p_accounting_coa_id => l_adr_accounting_coa_id
46918 , p_flexfield_segment_code => l_adr_flexfield_segment_code
46919 , p_flex_value_set_id => l_adr_flex_value_set_id
46920 , p_adr_code => 'FA_NBV_RETIRED_GAIN_SEGMENT'
46921 , p_adr_type_code => 'S'
46922 , p_component_type => l_component_type
46923 , p_component_code => l_component_code
46924 , p_component_type_code => l_component_type_code
46925 , p_component_appl_id => l_component_appl_id
46926 , p_amb_context_code => l_amb_context_code
46927 , p_entity_code => 'TRANSACTIONS'
46928 , p_event_class_code => 'CIP_RETIREMENTS'
46929 , p_side => 'NA'
46930 );
46931
46932 END IF;
46933
46934 --
46935 --
46936 END IF;
46937 --
46938 -- Bug 4922099
46939 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
46940 (NVL(l_enc_upg_option, 'N') = 'O')
46941 ) AND
46942 (l_bflow_method_code = 'PRIOR_ENTRY')
46943 )
46944 THEN
46945 IF
46946 --
46947 1 = 2
46948 --
46949 THEN
46950 xla_accounting_err_pkg.build_message
46951 (p_appli_s_name => 'XLA'
46952 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
46953 ,p_token_1 => 'LINE_NUMBER'
46954 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
46955 ,p_token_2 => 'LINE_TYPE_NAME'
46956 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
46957 l_component_type
46958 ,l_component_code
46959 ,l_component_type_code
46960 ,l_component_appl_id
46961 ,l_amb_context_code
46965 ,p_token_3 => 'OWNER'
46962 ,l_entity_code
46963 ,l_event_class_code
46964 )
46966 ,p_value_3 => xla_lookups_pkg.get_meaning(
46967 p_lookup_type => 'XLA_OWNER_TYPE'
46968 ,p_lookup_code => l_component_type_code
46969 )
46970 ,p_token_4 => 'PRODUCT_NAME'
46971 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
46972 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
46973 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
46974 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
46975 ,p_ae_header_id => NULL
46976 );
46977
46978 IF (C_LEVEL_ERROR>= g_log_level) THEN
46979 trace
46980 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
46981 ,p_level => C_LEVEL_ERROR
46982 ,p_module => l_log_module);
46983 END IF;
46984 END IF;
46985 END IF;
46986 --
46987 --
46988 ------------------------------------------------------------------------------------------------
46989 -- 4219869 Business Flow
46990 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
46991 -- Prior Entry. Currently, the following code is always generated.
46992 ------------------------------------------------------------------------------------------------
46993 XLA_AE_LINES_PKG.ValidateCurrentLine;
46994
46995 ------------------------------------------------------------------------------------
46996 -- 4219869 Business Flow
46997 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
46998 ------------------------------------------------------------------------------------
46999 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
47000
47001 ----------------------------------------------------------------------------------
47002 -- 4219869 Business Flow
47003 -- Update journal entry status -- Need to generate this within IF <condition>
47004 ----------------------------------------------------------------------------------
47005 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
47006 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
47007 ,p_balance_type_code => l_balance_type_code
47008 );
47009
47010 -------------------------------------------------------------------------------------------
47011 -- 4262811 - Generate the Accrual Reversal lines
47012 -------------------------------------------------------------------------------------------
47013 BEGIN
47014 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
47015 (g_array_event(p_event_id).array_value_num('header_index'));
47016 IF l_acc_rev_flag IS NULL THEN
47017 l_acc_rev_flag := 'N';
47018 END IF;
47019 EXCEPTION
47020 WHEN OTHERS THEN
47021 l_acc_rev_flag := 'N';
47022 END;
47023 --
47024 IF (l_acc_rev_flag = 'Y') THEN
47025
47026 -- 4645092 ------------------------------------------------------------------------------
47027 -- To allow MPA report to determine if it should generate report process
47028 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
47029 ------------------------------------------------------------------------------------------
47030
47031 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
47032 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
47033 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
47034 -- call ADRs
47035 -- Bug 4922099
47036 --
47037 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
47038 (NVL(l_actual_upg_option, 'N') = 'O') OR
47039 (NVL(l_enc_upg_option, 'N') = 'O')
47040 )
47041 THEN
47042 NULL;
47043 --
47044 --
47045
47046 l_ccid := AcctDerRule_174(
47047 p_application_id => p_application_id
47048 , p_ae_header_id => l_ae_header_id
47049 , p_source_5 => p_source_5
47050 , p_source_32 => p_source_32
47051 , x_transaction_coa_id => l_adr_transaction_coa_id
47052 , x_accounting_coa_id => l_adr_accounting_coa_id
47053 , x_value_type_code => l_adr_value_type_code
47054 , p_side => 'NA'
47055 );
47056
47057 xla_ae_lines_pkg.set_ccid(
47058 p_code_combination_id => l_ccid
47059 , p_value_type_code => l_adr_value_type_code
47060 , p_transaction_coa_id => l_adr_transaction_coa_id
47061 , p_accounting_coa_id => l_adr_accounting_coa_id
47065 , p_component_code => l_component_code
47062 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
47063 , p_adr_type_code => 'S'
47064 , p_component_type => l_component_type
47066 , p_component_type_code => l_component_type_code
47067 , p_component_appl_id => l_component_appl_id
47068 , p_amb_context_code => l_amb_context_code
47069 , p_side => 'NA'
47070 );
47071
47072
47073 l_segment := AcctDerRule_169(
47074 p_application_id => p_application_id
47075 , p_ae_header_id => l_ae_header_id
47076 , p_source_5 => p_source_5
47077 , p_source_31 => p_source_31
47078 , x_transaction_coa_id => l_adr_transaction_coa_id
47079 , x_accounting_coa_id => l_adr_accounting_coa_id
47080 , x_flexfield_segment_code => l_adr_flexfield_segment_code
47081 , x_flex_value_set_id => l_adr_flex_value_set_id
47082 , x_value_type_code => l_adr_value_type_code
47083 , x_value_combination_id => l_adr_value_combination_id
47084 , x_value_segment_code => l_adr_value_segment_code
47085 , p_side => 'NA'
47086 , p_override_seg_flag => 'Y'
47087 );
47088
47089 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
47090
47091 xla_ae_lines_pkg.set_segment(
47092 p_to_segment_code => 'GL_BALANCING'
47093 , p_segment_value => l_segment
47094 , p_from_segment_code => l_adr_value_segment_code
47095 , p_from_combination_id => l_adr_value_combination_id
47096 , p_value_type_code => l_adr_value_type_code
47097 , p_transaction_coa_id => l_adr_transaction_coa_id
47098 , p_accounting_coa_id => l_adr_accounting_coa_id
47099 , p_flexfield_segment_code => l_adr_flexfield_segment_code
47100 , p_flex_value_set_id => l_adr_flex_value_set_id
47101 , p_adr_code => 'FA_EXPENSE_ACCT'
47102 , p_adr_type_code => 'S'
47103 , p_component_type => l_component_type
47104 , p_component_code => l_component_code
47105 , p_component_type_code => l_component_type_code
47106 , p_component_appl_id => l_component_appl_id
47107 , p_amb_context_code => l_amb_context_code
47108 , p_entity_code => 'TRANSACTIONS'
47109 , p_event_class_code => 'CIP_RETIREMENTS'
47110 , p_side => 'NA'
47111 );
47112
47113 END IF;
47114
47115 l_segment := AcctDerRule_160(
47116 p_application_id => p_application_id
47117 , p_ae_header_id => l_ae_header_id
47118 , p_source_5 => p_source_5
47119 , p_source_23 => p_source_23
47120 , x_transaction_coa_id => l_adr_transaction_coa_id
47121 , x_accounting_coa_id => l_adr_accounting_coa_id
47122 , x_flexfield_segment_code => l_adr_flexfield_segment_code
47123 , x_flex_value_set_id => l_adr_flex_value_set_id
47124 , x_value_type_code => l_adr_value_type_code
47125 , x_value_combination_id => l_adr_value_combination_id
47126 , x_value_segment_code => l_adr_value_segment_code
47127 , p_side => 'NA'
47128 , p_override_seg_flag => 'Y'
47129 );
47130
47131 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
47132
47133 xla_ae_lines_pkg.set_segment(
47134 p_to_segment_code => 'GL_ACCOUNT'
47135 , p_segment_value => l_segment
47136 , p_from_segment_code => l_adr_value_segment_code
47137 , p_from_combination_id => l_adr_value_combination_id
47138 , p_value_type_code => l_adr_value_type_code
47139 , p_transaction_coa_id => l_adr_transaction_coa_id
47140 , p_accounting_coa_id => l_adr_accounting_coa_id
47141 , p_flexfield_segment_code => l_adr_flexfield_segment_code
47142 , p_flex_value_set_id => l_adr_flex_value_set_id
47143 , p_adr_code => 'FA_NBV_RETIRED_GAIN_SEGMENT'
47144 , p_adr_type_code => 'S'
47145 , p_component_type => l_component_type
47146 , p_component_code => l_component_code
47147 , p_component_type_code => l_component_type_code
47148 , p_component_appl_id => l_component_appl_id
47149 , p_amb_context_code => l_amb_context_code
47150 , p_entity_code => 'TRANSACTIONS'
47151 , p_event_class_code => 'CIP_RETIREMENTS'
47152 , p_side => 'NA'
47153 );
47154
47155 END IF;
47156
47157 --
47158 --
47159 END IF;
47160
47161 --
47162 -- Update the line information that should be overwritten
47163 --
47164 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
47165 p_header_num => 1);
47166 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
47167
47168 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
47169
47170 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
47171 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
47172 END IF;
47173
47174 --
47178 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
47175 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
47176 --
47177 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
47179 ELSE
47180 ---------------------------------------------------------------------------------------------------
47181 -- 4262811a Switch Sign
47182 ---------------------------------------------------------------------------------------------------
47183 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
47184 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
47185 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
47186 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
47187 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
47188 -- 5132302
47189 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
47190 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
47191
47192 END IF;
47193
47194 -- 4955764
47195 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
47196 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
47197
47198
47199 XLA_AE_LINES_PKG.ValidateCurrentLine;
47200 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
47201
47202 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
47203 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
47204 ,p_balance_type_code => l_balance_type_code);
47205
47206 END IF;
47207
47208 -----------------------------------------------------------------------------------------
47209 -- 4262811 Multiperiod Accounting
47210 -----------------------------------------------------------------------------------------
47211 -- No MPA option is assigned.
47212
47213
47214 END IF;
47215 END IF;
47216 --
47217
47218 --
47219 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
47220 trace
47221 (p_msg => 'END of AcctLineType_230'
47222 ,p_level => C_LEVEL_PROCEDURE
47223 ,p_module => l_log_module);
47224 END IF;
47225 --
47226 EXCEPTION
47227 WHEN xla_exceptions_pkg.application_exception THEN
47228 RAISE;
47229 WHEN OTHERS THEN
47230 xla_exceptions_pkg.raise_message
47231 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_230');
47232 END AcctLineType_230;
47233 --
47234
47235 ---------------------------------------
47236 --
47237 -- PRIVATE FUNCTION
47238 -- AcctLineType_231
47239 --
47240 ---------------------------------------
47241 PROCEDURE AcctLineType_231 (
47242 p_application_id IN NUMBER
47243 ,p_event_id IN NUMBER
47244 ,p_calculate_acctd_flag IN VARCHAR2
47245 ,p_calculate_g_l_flag IN VARCHAR2
47246 ,p_actual_flag IN OUT VARCHAR2
47247 ,p_balance_type_code OUT VARCHAR2
47248 ,p_gain_or_loss_ref OUT VARCHAR2
47249
47250 --Period Close Date
47251 , p_source_1 IN DATE
47252 --Generated Code Combination Identifier
47253 , p_source_5 IN NUMBER
47254 --Net Book Value Retired Loss Account
47255 , p_source_24 IN VARCHAR2
47256 --Expense Account Code Combination Identifier
47257 , p_source_31 IN NUMBER
47258 --Default Code Combination Identifier
47259 , p_source_32 IN NUMBER
47260 --Adjustment Type
47261 , p_source_48 IN VARCHAR2
47262 --Transaction Header Identifier
47263 , p_source_49 IN NUMBER
47264 --Adjustment Line Identifier
47265 , p_source_50 IN NUMBER
47266 --Distribution Type Code
47267 , p_source_51 IN VARCHAR2
47268 --Entered Amount
47269 , p_source_52 IN NUMBER
47270 --Currency Code
47271 , p_source_53 IN VARCHAR2
47272 --Gain Loss Amount
47273 , p_source_54 IN NUMBER
47274 )
47275 IS
47276
47277 l_component_type VARCHAR2(80);
47278 l_component_code VARCHAR2(30);
47279 l_component_type_code VARCHAR2(1);
47280 l_component_appl_id INTEGER;
47281 l_amb_context_code VARCHAR2(30);
47282 l_entity_code VARCHAR2(30);
47283 l_event_class_code VARCHAR2(30);
47284 l_ae_header_id NUMBER;
47285 l_event_type_code VARCHAR2(30);
47286 l_line_definition_code VARCHAR2(30);
47287 l_line_definition_owner_code VARCHAR2(1);
47288 --
47289 -- adr variables
47290 l_segment VARCHAR2(30);
47291 l_ccid NUMBER;
47292 l_adr_transaction_coa_id NUMBER;
47293 l_adr_accounting_coa_id NUMBER;
47294 l_adr_flexfield_segment_code VARCHAR2(30);
47295 l_adr_flex_value_set_id NUMBER;
47296 l_adr_value_type_code VARCHAR2(30);
47297 l_adr_value_combination_id NUMBER;
47298 l_adr_value_segment_code VARCHAR2(30);
47299
47300 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
47304
47301 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
47302 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
47303 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
47305 -- 4262811 Variables ------------------------------------------------------------------------------------------
47306 l_entered_amt_idx NUMBER;
47307 l_accted_amt_idx NUMBER;
47308 l_acc_rev_flag VARCHAR2(1);
47309 l_accrual_line_num NUMBER;
47310 l_tmp_amt NUMBER;
47311 l_acc_rev_natural_side_code VARCHAR2(1);
47312
47313 l_num_entries NUMBER;
47314 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
47315 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
47316 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
47317 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
47318 l_recog_line_1 NUMBER;
47319 l_recog_line_2 NUMBER;
47320
47321 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
47322 l_bflow_applied_to_amt NUMBER; -- 5132302
47323 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
47324
47325 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
47326
47327 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
47328 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
47329
47330 ---------------------------------------------------------------------------------------------------------------
47331
47332
47333 --
47334 -- bulk performance
47335 --
47336 l_balance_type_code VARCHAR2(1);
47337 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
47338 l_log_module VARCHAR2(240);
47339
47340 --
47341 -- Upgrade strategy
47342 --
47343 l_actual_upg_option VARCHAR2(1);
47344 l_enc_upg_option VARCHAR2(1);
47345
47346 --
47347 BEGIN
47348 --
47349 IF g_log_enabled THEN
47350 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_231';
47351 END IF;
47352 --
47353 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
47354
47355 trace
47356 (p_msg => 'BEGIN of AcctLineType_231'
47357 ,p_level => C_LEVEL_PROCEDURE
47358 ,p_module => l_log_module);
47359
47360 END IF;
47361 --
47362 l_component_type := 'AMB_JLT';
47363 l_component_code := 'FA_CIP_NBV_RETIRED_LOSS';
47364 l_component_type_code := 'S';
47365 l_component_appl_id := 140;
47366 l_amb_context_code := 'DEFAULT';
47367 l_entity_code := 'TRANSACTIONS';
47368 l_event_class_code := 'CIP_RETIREMENTS';
47369 l_event_type_code := 'CIP_REINSTATEMENTS';
47370 l_line_definition_owner_code := 'S';
47371 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
47372 --
47373 l_balance_type_code := 'A';
47374 l_segment := NULL;
47375 l_ccid := NULL;
47376 l_adr_transaction_coa_id := NULL;
47377 l_adr_accounting_coa_id := NULL;
47378 l_adr_flexfield_segment_code := NULL;
47379 l_adr_flex_value_set_id := NULL;
47380 l_adr_value_type_code := NULL;
47381 l_adr_value_combination_id := NULL;
47382 l_adr_value_segment_code := NULL;
47383
47384 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
47385 l_bflow_class_code := ''; -- 4219869 Business Flow
47386 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
47387 l_budgetary_control_flag := 'N';
47388
47389 l_bflow_applied_to_amt_idx := NULL; -- 5132302
47390 l_bflow_applied_to_amt := NULL; -- 5132302
47391 l_entered_amt_idx := NULL; -- 4262811
47392 l_accted_amt_idx := NULL; -- 4262811
47393 l_acc_rev_flag := NULL; -- 4262811
47394 l_accrual_line_num := NULL; -- 4262811
47395 l_tmp_amt := NULL; -- 4262811
47396 --
47397
47398 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
47399 l_balance_type_code <> 'B' THEN
47400 IF NVL(p_source_48,'
47401 ') = 'NBV RETIRED' AND
47402 p_source_54 < 0
47403 THEN
47404
47405 --
47406 XLA_AE_LINES_PKG.SetNewLine;
47407
47408 p_balance_type_code := l_balance_type_code;
47409 -- set the flag so later we will know whether the gain loss line needs to be created
47410
47411 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
47412 p_actual_flag :='A';
47413 END IF;
47414
47415 --
47416 -- bulk performance
47417 --
47418 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
47419 p_header_num => 0); -- 4262811
47420 --
47421 -- set accounting line options
47422 --
47423 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
47424 p_natural_side_code => 'D'
47425 , p_gain_or_loss_flag => 'N'
47426 , p_gl_transfer_mode_code => 'S'
47427 , p_acct_entry_type_code => 'A'
47431 --
47428 , p_switch_side_flag => 'Y'
47429 , p_merge_duplicate_code => 'N'
47430 );
47432 l_acc_rev_natural_side_code := 'C'; -- 4262811
47433 --
47434 --
47435 -- set accounting line type info
47436 --
47437 xla_ae_lines_pkg.SetAcctLineType
47438 (p_component_type => l_component_type
47439 ,p_event_type_code => l_event_type_code
47440 ,p_line_definition_owner_code => l_line_definition_owner_code
47441 ,p_line_definition_code => l_line_definition_code
47442 ,p_accounting_line_code => l_component_code
47443 ,p_accounting_line_type_code => l_component_type_code
47444 ,p_accounting_line_appl_id => l_component_appl_id
47445 ,p_amb_context_code => l_amb_context_code
47446 ,p_entity_code => l_entity_code
47447 ,p_event_class_code => l_event_class_code);
47448 --
47449 -- set accounting class
47450 --
47451 xla_ae_lines_pkg.SetAcctClass(
47452 p_accounting_class_code => 'ASSET'
47453 , p_ae_header_id => l_ae_header_id
47454 );
47455
47456 --
47457 -- set rounding class
47458 --
47459 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
47460 'ASSET';
47461
47462 --
47463 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
47464 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
47465 --
47466 -- bulk performance
47467 --
47468 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
47469
47470 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
47471 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
47472
47473 -- 4955764
47474 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
47475 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
47476
47477 -- 4458381 Public Sector Enh
47478
47479 --
47480 -- set accounting attributes for the line type
47481 --
47482 l_entered_amt_idx := 4;
47483 l_accted_amt_idx := 6;
47484 l_bflow_applied_to_amt_idx := NULL; -- 5132302
47485 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
47486 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
47487 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
47488 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
47489 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
47490 l_rec_acct_attrs.array_char_value(3) := p_source_51;
47491 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
47492 l_rec_acct_attrs.array_num_value(4) := p_source_52;
47493 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
47494 l_rec_acct_attrs.array_char_value(5) := p_source_53;
47495 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
47496 l_rec_acct_attrs.array_num_value(6) := p_source_52;
47497
47498 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
47499 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
47500
47501 ---------------------------------------------------------------------------------------------------------------
47502 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
47503 ---------------------------------------------------------------------------------------------------------------
47504 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
47505
47506 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
47507 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
47508
47509 IF xla_accounting_cache_pkg.GetValueChar
47510 (p_source_code => 'LEDGER_CATEGORY_CODE'
47511 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
47512 AND l_bflow_method_code = 'PRIOR_ENTRY'
47513 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
47514 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
47515 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
47516 )
47517 THEN
47518 xla_ae_lines_pkg.BflowUpgEntry
47519 (p_business_method_code => l_bflow_method_code
47520 ,p_business_class_code => l_bflow_class_code
47521 ,p_balance_type => l_balance_type_code);
47522 ELSE
47523 NULL;
47524 -- No business flow processing for business flow method of NONE.
47525 END IF;
47526
47527 --
47528 -- call analytical criteria
47529 --
47530
47531 --
47532 -- call description
47533 --
47534
47535 xla_ae_lines_pkg.SetLineDescription(
47536 p_ae_header_id => l_ae_header_id
47537 ,p_description => Description_34 (
47538 p_application_id => p_application_id
47539 , p_ae_header_id => l_ae_header_id
47540 , p_source_1 => p_source_1
47541 )
47542 );
47546 -- call ADRs
47543
47544
47545 --
47547 -- Bug 4922099
47548 --
47549 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
47550 (NVL(l_actual_upg_option, 'N') = 'O') OR
47551 (NVL(l_enc_upg_option, 'N') = 'O')
47552 )
47553 THEN
47554 NULL;
47555 --
47556 --
47557
47558 l_ccid := AcctDerRule_174(
47559 p_application_id => p_application_id
47560 , p_ae_header_id => l_ae_header_id
47561 , p_source_5 => p_source_5
47562 , p_source_32 => p_source_32
47563 , x_transaction_coa_id => l_adr_transaction_coa_id
47564 , x_accounting_coa_id => l_adr_accounting_coa_id
47565 , x_value_type_code => l_adr_value_type_code
47566 , p_side => 'NA'
47567 );
47568
47569 xla_ae_lines_pkg.set_ccid(
47570 p_code_combination_id => l_ccid
47571 , p_value_type_code => l_adr_value_type_code
47572 , p_transaction_coa_id => l_adr_transaction_coa_id
47573 , p_accounting_coa_id => l_adr_accounting_coa_id
47574 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
47575 , p_adr_type_code => 'S'
47576 , p_component_type => l_component_type
47577 , p_component_code => l_component_code
47578 , p_component_type_code => l_component_type_code
47579 , p_component_appl_id => l_component_appl_id
47580 , p_amb_context_code => l_amb_context_code
47581 , p_side => 'NA'
47582 );
47583
47584
47585 l_segment := AcctDerRule_169(
47586 p_application_id => p_application_id
47587 , p_ae_header_id => l_ae_header_id
47588 , p_source_5 => p_source_5
47589 , p_source_31 => p_source_31
47590 , x_transaction_coa_id => l_adr_transaction_coa_id
47591 , x_accounting_coa_id => l_adr_accounting_coa_id
47592 , x_flexfield_segment_code => l_adr_flexfield_segment_code
47593 , x_flex_value_set_id => l_adr_flex_value_set_id
47594 , x_value_type_code => l_adr_value_type_code
47595 , x_value_combination_id => l_adr_value_combination_id
47596 , x_value_segment_code => l_adr_value_segment_code
47597 , p_side => 'NA'
47598 , p_override_seg_flag => 'Y'
47599 );
47600
47601 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
47602
47603 xla_ae_lines_pkg.set_segment(
47604 p_to_segment_code => 'GL_BALANCING'
47605 , p_segment_value => l_segment
47606 , p_from_segment_code => l_adr_value_segment_code
47607 , p_from_combination_id => l_adr_value_combination_id
47608 , p_value_type_code => l_adr_value_type_code
47609 , p_transaction_coa_id => l_adr_transaction_coa_id
47610 , p_accounting_coa_id => l_adr_accounting_coa_id
47611 , p_flexfield_segment_code => l_adr_flexfield_segment_code
47612 , p_flex_value_set_id => l_adr_flex_value_set_id
47613 , p_adr_code => 'FA_EXPENSE_ACCT'
47614 , p_adr_type_code => 'S'
47615 , p_component_type => l_component_type
47616 , p_component_code => l_component_code
47617 , p_component_type_code => l_component_type_code
47618 , p_component_appl_id => l_component_appl_id
47619 , p_amb_context_code => l_amb_context_code
47620 , p_entity_code => 'TRANSACTIONS'
47621 , p_event_class_code => 'CIP_RETIREMENTS'
47622 , p_side => 'NA'
47623 );
47624
47625 END IF;
47626
47627 l_segment := AcctDerRule_161(
47628 p_application_id => p_application_id
47629 , p_ae_header_id => l_ae_header_id
47630 , p_source_5 => p_source_5
47631 , p_source_24 => p_source_24
47632 , x_transaction_coa_id => l_adr_transaction_coa_id
47633 , x_accounting_coa_id => l_adr_accounting_coa_id
47634 , x_flexfield_segment_code => l_adr_flexfield_segment_code
47635 , x_flex_value_set_id => l_adr_flex_value_set_id
47636 , x_value_type_code => l_adr_value_type_code
47637 , x_value_combination_id => l_adr_value_combination_id
47638 , x_value_segment_code => l_adr_value_segment_code
47639 , p_side => 'NA'
47640 , p_override_seg_flag => 'Y'
47641 );
47642
47643 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
47644
47645 xla_ae_lines_pkg.set_segment(
47646 p_to_segment_code => 'GL_ACCOUNT'
47647 , p_segment_value => l_segment
47648 , p_from_segment_code => l_adr_value_segment_code
47649 , p_from_combination_id => l_adr_value_combination_id
47650 , p_value_type_code => l_adr_value_type_code
47651 , p_transaction_coa_id => l_adr_transaction_coa_id
47652 , p_accounting_coa_id => l_adr_accounting_coa_id
47653 , p_flexfield_segment_code => l_adr_flexfield_segment_code
47654 , p_flex_value_set_id => l_adr_flex_value_set_id
47655 , p_adr_code => 'FA_NBV_RETIRED_LOSS_SEGMENT'
47656 , p_adr_type_code => 'S'
47657 , p_component_type => l_component_type
47658 , p_component_code => l_component_code
47662 , p_entity_code => 'TRANSACTIONS'
47659 , p_component_type_code => l_component_type_code
47660 , p_component_appl_id => l_component_appl_id
47661 , p_amb_context_code => l_amb_context_code
47663 , p_event_class_code => 'CIP_RETIREMENTS'
47664 , p_side => 'NA'
47665 );
47666
47667 END IF;
47668
47669 --
47670 --
47671 END IF;
47672 --
47673 -- Bug 4922099
47674 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
47675 (NVL(l_enc_upg_option, 'N') = 'O')
47676 ) AND
47677 (l_bflow_method_code = 'PRIOR_ENTRY')
47678 )
47679 THEN
47680 IF
47681 --
47682 1 = 2
47683 --
47684 THEN
47685 xla_accounting_err_pkg.build_message
47686 (p_appli_s_name => 'XLA'
47687 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
47688 ,p_token_1 => 'LINE_NUMBER'
47689 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
47690 ,p_token_2 => 'LINE_TYPE_NAME'
47691 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
47692 l_component_type
47693 ,l_component_code
47694 ,l_component_type_code
47695 ,l_component_appl_id
47696 ,l_amb_context_code
47697 ,l_entity_code
47698 ,l_event_class_code
47699 )
47700 ,p_token_3 => 'OWNER'
47701 ,p_value_3 => xla_lookups_pkg.get_meaning(
47702 p_lookup_type => 'XLA_OWNER_TYPE'
47703 ,p_lookup_code => l_component_type_code
47704 )
47705 ,p_token_4 => 'PRODUCT_NAME'
47706 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
47707 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
47708 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
47709 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
47710 ,p_ae_header_id => NULL
47711 );
47712
47713 IF (C_LEVEL_ERROR>= g_log_level) THEN
47714 trace
47715 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
47716 ,p_level => C_LEVEL_ERROR
47717 ,p_module => l_log_module);
47718 END IF;
47719 END IF;
47720 END IF;
47721 --
47722 --
47723 ------------------------------------------------------------------------------------------------
47724 -- 4219869 Business Flow
47725 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
47726 -- Prior Entry. Currently, the following code is always generated.
47727 ------------------------------------------------------------------------------------------------
47728 XLA_AE_LINES_PKG.ValidateCurrentLine;
47729
47730 ------------------------------------------------------------------------------------
47731 -- 4219869 Business Flow
47732 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
47733 ------------------------------------------------------------------------------------
47734 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
47735
47736 ----------------------------------------------------------------------------------
47737 -- 4219869 Business Flow
47738 -- Update journal entry status -- Need to generate this within IF <condition>
47739 ----------------------------------------------------------------------------------
47740 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
47741 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
47742 ,p_balance_type_code => l_balance_type_code
47743 );
47744
47745 -------------------------------------------------------------------------------------------
47746 -- 4262811 - Generate the Accrual Reversal lines
47747 -------------------------------------------------------------------------------------------
47748 BEGIN
47749 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
47750 (g_array_event(p_event_id).array_value_num('header_index'));
47751 IF l_acc_rev_flag IS NULL THEN
47752 l_acc_rev_flag := 'N';
47753 END IF;
47754 EXCEPTION
47755 WHEN OTHERS THEN
47756 l_acc_rev_flag := 'N';
47760
47757 END;
47758 --
47759 IF (l_acc_rev_flag = 'Y') THEN
47761 -- 4645092 ------------------------------------------------------------------------------
47762 -- To allow MPA report to determine if it should generate report process
47763 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
47764 ------------------------------------------------------------------------------------------
47765
47766 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
47767 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
47768 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
47769 -- call ADRs
47770 -- Bug 4922099
47771 --
47772 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
47773 (NVL(l_actual_upg_option, 'N') = 'O') OR
47774 (NVL(l_enc_upg_option, 'N') = 'O')
47775 )
47776 THEN
47777 NULL;
47778 --
47779 --
47780
47781 l_ccid := AcctDerRule_174(
47782 p_application_id => p_application_id
47783 , p_ae_header_id => l_ae_header_id
47784 , p_source_5 => p_source_5
47785 , p_source_32 => p_source_32
47786 , x_transaction_coa_id => l_adr_transaction_coa_id
47787 , x_accounting_coa_id => l_adr_accounting_coa_id
47788 , x_value_type_code => l_adr_value_type_code
47789 , p_side => 'NA'
47790 );
47791
47792 xla_ae_lines_pkg.set_ccid(
47793 p_code_combination_id => l_ccid
47794 , p_value_type_code => l_adr_value_type_code
47795 , p_transaction_coa_id => l_adr_transaction_coa_id
47796 , p_accounting_coa_id => l_adr_accounting_coa_id
47797 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
47798 , p_adr_type_code => 'S'
47799 , p_component_type => l_component_type
47800 , p_component_code => l_component_code
47801 , p_component_type_code => l_component_type_code
47802 , p_component_appl_id => l_component_appl_id
47803 , p_amb_context_code => l_amb_context_code
47804 , p_side => 'NA'
47805 );
47806
47807
47808 l_segment := AcctDerRule_169(
47809 p_application_id => p_application_id
47810 , p_ae_header_id => l_ae_header_id
47811 , p_source_5 => p_source_5
47812 , p_source_31 => p_source_31
47813 , x_transaction_coa_id => l_adr_transaction_coa_id
47814 , x_accounting_coa_id => l_adr_accounting_coa_id
47815 , x_flexfield_segment_code => l_adr_flexfield_segment_code
47816 , x_flex_value_set_id => l_adr_flex_value_set_id
47817 , x_value_type_code => l_adr_value_type_code
47818 , x_value_combination_id => l_adr_value_combination_id
47819 , x_value_segment_code => l_adr_value_segment_code
47820 , p_side => 'NA'
47821 , p_override_seg_flag => 'Y'
47822 );
47823
47824 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
47825
47826 xla_ae_lines_pkg.set_segment(
47827 p_to_segment_code => 'GL_BALANCING'
47828 , p_segment_value => l_segment
47829 , p_from_segment_code => l_adr_value_segment_code
47830 , p_from_combination_id => l_adr_value_combination_id
47831 , p_value_type_code => l_adr_value_type_code
47832 , p_transaction_coa_id => l_adr_transaction_coa_id
47833 , p_accounting_coa_id => l_adr_accounting_coa_id
47834 , p_flexfield_segment_code => l_adr_flexfield_segment_code
47835 , p_flex_value_set_id => l_adr_flex_value_set_id
47836 , p_adr_code => 'FA_EXPENSE_ACCT'
47837 , p_adr_type_code => 'S'
47838 , p_component_type => l_component_type
47839 , p_component_code => l_component_code
47840 , p_component_type_code => l_component_type_code
47841 , p_component_appl_id => l_component_appl_id
47842 , p_amb_context_code => l_amb_context_code
47843 , p_entity_code => 'TRANSACTIONS'
47844 , p_event_class_code => 'CIP_RETIREMENTS'
47845 , p_side => 'NA'
47846 );
47847
47848 END IF;
47849
47850 l_segment := AcctDerRule_161(
47851 p_application_id => p_application_id
47852 , p_ae_header_id => l_ae_header_id
47853 , p_source_5 => p_source_5
47854 , p_source_24 => p_source_24
47855 , x_transaction_coa_id => l_adr_transaction_coa_id
47856 , x_accounting_coa_id => l_adr_accounting_coa_id
47857 , x_flexfield_segment_code => l_adr_flexfield_segment_code
47858 , x_flex_value_set_id => l_adr_flex_value_set_id
47859 , x_value_type_code => l_adr_value_type_code
47860 , x_value_combination_id => l_adr_value_combination_id
47861 , x_value_segment_code => l_adr_value_segment_code
47862 , p_side => 'NA'
47863 , p_override_seg_flag => 'Y'
47864 );
47865
47866 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
47867
47868 xla_ae_lines_pkg.set_segment(
47869 p_to_segment_code => 'GL_ACCOUNT'
47870 , p_segment_value => l_segment
47874 , p_transaction_coa_id => l_adr_transaction_coa_id
47871 , p_from_segment_code => l_adr_value_segment_code
47872 , p_from_combination_id => l_adr_value_combination_id
47873 , p_value_type_code => l_adr_value_type_code
47875 , p_accounting_coa_id => l_adr_accounting_coa_id
47876 , p_flexfield_segment_code => l_adr_flexfield_segment_code
47877 , p_flex_value_set_id => l_adr_flex_value_set_id
47878 , p_adr_code => 'FA_NBV_RETIRED_LOSS_SEGMENT'
47879 , p_adr_type_code => 'S'
47880 , p_component_type => l_component_type
47881 , p_component_code => l_component_code
47882 , p_component_type_code => l_component_type_code
47883 , p_component_appl_id => l_component_appl_id
47884 , p_amb_context_code => l_amb_context_code
47885 , p_entity_code => 'TRANSACTIONS'
47886 , p_event_class_code => 'CIP_RETIREMENTS'
47887 , p_side => 'NA'
47888 );
47889
47890 END IF;
47891
47892 --
47893 --
47894 END IF;
47895
47896 --
47897 -- Update the line information that should be overwritten
47898 --
47899 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
47900 p_header_num => 1);
47901 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
47902
47903 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
47904
47905 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
47906 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
47907 END IF;
47908
47909 --
47910 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
47911 --
47912 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
47913 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
47914 ELSE
47915 ---------------------------------------------------------------------------------------------------
47916 -- 4262811a Switch Sign
47917 ---------------------------------------------------------------------------------------------------
47918 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
47919 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
47920 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
47921 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
47922 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
47923 -- 5132302
47924 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
47925 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
47926
47927 END IF;
47928
47929 -- 4955764
47930 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
47931 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
47932
47933
47934 XLA_AE_LINES_PKG.ValidateCurrentLine;
47935 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
47936
47937 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
47938 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
47939 ,p_balance_type_code => l_balance_type_code);
47940
47941 END IF;
47942
47943 -----------------------------------------------------------------------------------------
47944 -- 4262811 Multiperiod Accounting
47945 -----------------------------------------------------------------------------------------
47946 -- No MPA option is assigned.
47947
47948
47949 END IF;
47950 END IF;
47951 --
47952
47953 --
47954 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
47955 trace
47956 (p_msg => 'END of AcctLineType_231'
47957 ,p_level => C_LEVEL_PROCEDURE
47958 ,p_module => l_log_module);
47959 END IF;
47960 --
47961 EXCEPTION
47962 WHEN xla_exceptions_pkg.application_exception THEN
47963 RAISE;
47964 WHEN OTHERS THEN
47965 xla_exceptions_pkg.raise_message
47966 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_231');
47967 END AcctLineType_231;
47968 --
47969
47970 ---------------------------------------
47971 --
47972 -- PRIVATE FUNCTION
47973 -- AcctLineType_232
47974 --
47975 ---------------------------------------
47976 PROCEDURE AcctLineType_232 (
47977 p_application_id IN NUMBER
47978 ,p_event_id IN NUMBER
47979 ,p_calculate_acctd_flag IN VARCHAR2
47980 ,p_calculate_g_l_flag IN VARCHAR2
47981 ,p_actual_flag IN OUT VARCHAR2
47982 ,p_balance_type_code OUT VARCHAR2
47983 ,p_gain_or_loss_ref OUT VARCHAR2
47984
47985 --Period Close Date
47986 , p_source_1 IN DATE
47990 , p_source_24 IN VARCHAR2
47987 --Generated Code Combination Identifier
47988 , p_source_5 IN NUMBER
47989 --Net Book Value Retired Loss Account
47991 --Expense Account Code Combination Identifier
47992 , p_source_31 IN NUMBER
47993 --Default Code Combination Identifier
47994 , p_source_32 IN NUMBER
47995 --Adjustment Type
47996 , p_source_48 IN VARCHAR2
47997 --Transaction Header Identifier
47998 , p_source_49 IN NUMBER
47999 --Adjustment Line Identifier
48000 , p_source_50 IN NUMBER
48001 --Distribution Type Code
48002 , p_source_51 IN VARCHAR2
48003 --Entered Amount
48004 , p_source_52 IN NUMBER
48005 --Currency Code
48006 , p_source_53 IN VARCHAR2
48007 --Gain Loss Amount
48008 , p_source_54 IN NUMBER
48009 )
48010 IS
48011
48012 l_component_type VARCHAR2(80);
48013 l_component_code VARCHAR2(30);
48014 l_component_type_code VARCHAR2(1);
48015 l_component_appl_id INTEGER;
48016 l_amb_context_code VARCHAR2(30);
48017 l_entity_code VARCHAR2(30);
48018 l_event_class_code VARCHAR2(30);
48019 l_ae_header_id NUMBER;
48020 l_event_type_code VARCHAR2(30);
48021 l_line_definition_code VARCHAR2(30);
48022 l_line_definition_owner_code VARCHAR2(1);
48023 --
48024 -- adr variables
48025 l_segment VARCHAR2(30);
48026 l_ccid NUMBER;
48027 l_adr_transaction_coa_id NUMBER;
48028 l_adr_accounting_coa_id NUMBER;
48029 l_adr_flexfield_segment_code VARCHAR2(30);
48030 l_adr_flex_value_set_id NUMBER;
48031 l_adr_value_type_code VARCHAR2(30);
48032 l_adr_value_combination_id NUMBER;
48033 l_adr_value_segment_code VARCHAR2(30);
48034
48035 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
48036 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
48037 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
48038 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
48039
48040 -- 4262811 Variables ------------------------------------------------------------------------------------------
48041 l_entered_amt_idx NUMBER;
48042 l_accted_amt_idx NUMBER;
48043 l_acc_rev_flag VARCHAR2(1);
48044 l_accrual_line_num NUMBER;
48045 l_tmp_amt NUMBER;
48046 l_acc_rev_natural_side_code VARCHAR2(1);
48047
48048 l_num_entries NUMBER;
48049 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
48050 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
48051 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
48052 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
48053 l_recog_line_1 NUMBER;
48054 l_recog_line_2 NUMBER;
48055
48056 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
48057 l_bflow_applied_to_amt NUMBER; -- 5132302
48058 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
48059
48060 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
48061
48062 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
48063 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
48064
48065 ---------------------------------------------------------------------------------------------------------------
48066
48067
48068 --
48069 -- bulk performance
48070 --
48071 l_balance_type_code VARCHAR2(1);
48072 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
48073 l_log_module VARCHAR2(240);
48074
48075 --
48076 -- Upgrade strategy
48077 --
48078 l_actual_upg_option VARCHAR2(1);
48079 l_enc_upg_option VARCHAR2(1);
48080
48081 --
48082 BEGIN
48083 --
48084 IF g_log_enabled THEN
48085 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_232';
48086 END IF;
48087 --
48088 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
48089
48090 trace
48091 (p_msg => 'BEGIN of AcctLineType_232'
48092 ,p_level => C_LEVEL_PROCEDURE
48093 ,p_module => l_log_module);
48094
48095 END IF;
48096 --
48097 l_component_type := 'AMB_JLT';
48098 l_component_code := 'FA_CIP_NBV_RETIRED_LOSS';
48099 l_component_type_code := 'S';
48100 l_component_appl_id := 140;
48101 l_amb_context_code := 'DEFAULT';
48102 l_entity_code := 'TRANSACTIONS';
48103 l_event_class_code := 'CIP_RETIREMENTS';
48104 l_event_type_code := 'CIP_RETIREMENTS';
48105 l_line_definition_owner_code := 'S';
48106 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
48107 --
48108 l_balance_type_code := 'A';
48109 l_segment := NULL;
48110 l_ccid := NULL;
48111 l_adr_transaction_coa_id := NULL;
48112 l_adr_accounting_coa_id := NULL;
48113 l_adr_flexfield_segment_code := NULL;
48114 l_adr_flex_value_set_id := NULL;
48115 l_adr_value_type_code := NULL;
48116 l_adr_value_combination_id := NULL;
48117 l_adr_value_segment_code := NULL;
48118
48122 l_budgetary_control_flag := 'N';
48119 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
48120 l_bflow_class_code := ''; -- 4219869 Business Flow
48121 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
48123
48124 l_bflow_applied_to_amt_idx := NULL; -- 5132302
48125 l_bflow_applied_to_amt := NULL; -- 5132302
48126 l_entered_amt_idx := NULL; -- 4262811
48127 l_accted_amt_idx := NULL; -- 4262811
48128 l_acc_rev_flag := NULL; -- 4262811
48129 l_accrual_line_num := NULL; -- 4262811
48130 l_tmp_amt := NULL; -- 4262811
48131 --
48132
48133 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
48134 l_balance_type_code <> 'B' THEN
48135 IF NVL(p_source_48,'
48136 ') = 'NBV RETIRED' AND
48137 p_source_54 < 0
48138 THEN
48139
48140 --
48141 XLA_AE_LINES_PKG.SetNewLine;
48142
48143 p_balance_type_code := l_balance_type_code;
48144 -- set the flag so later we will know whether the gain loss line needs to be created
48145
48146 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
48147 p_actual_flag :='A';
48148 END IF;
48149
48150 --
48151 -- bulk performance
48152 --
48153 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
48154 p_header_num => 0); -- 4262811
48155 --
48156 -- set accounting line options
48157 --
48158 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
48159 p_natural_side_code => 'D'
48160 , p_gain_or_loss_flag => 'N'
48161 , p_gl_transfer_mode_code => 'S'
48162 , p_acct_entry_type_code => 'A'
48163 , p_switch_side_flag => 'Y'
48164 , p_merge_duplicate_code => 'N'
48165 );
48166 --
48167 l_acc_rev_natural_side_code := 'C'; -- 4262811
48168 --
48169 --
48170 -- set accounting line type info
48171 --
48172 xla_ae_lines_pkg.SetAcctLineType
48173 (p_component_type => l_component_type
48174 ,p_event_type_code => l_event_type_code
48175 ,p_line_definition_owner_code => l_line_definition_owner_code
48176 ,p_line_definition_code => l_line_definition_code
48177 ,p_accounting_line_code => l_component_code
48178 ,p_accounting_line_type_code => l_component_type_code
48179 ,p_accounting_line_appl_id => l_component_appl_id
48180 ,p_amb_context_code => l_amb_context_code
48181 ,p_entity_code => l_entity_code
48182 ,p_event_class_code => l_event_class_code);
48183 --
48184 -- set accounting class
48185 --
48186 xla_ae_lines_pkg.SetAcctClass(
48187 p_accounting_class_code => 'ASSET'
48188 , p_ae_header_id => l_ae_header_id
48189 );
48190
48191 --
48192 -- set rounding class
48193 --
48194 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
48195 'ASSET';
48196
48197 --
48198 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
48199 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
48200 --
48201 -- bulk performance
48202 --
48203 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
48204
48205 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
48206 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
48207
48208 -- 4955764
48209 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
48210 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
48211
48212 -- 4458381 Public Sector Enh
48213
48214 --
48215 -- set accounting attributes for the line type
48216 --
48217 l_entered_amt_idx := 4;
48218 l_accted_amt_idx := 6;
48219 l_bflow_applied_to_amt_idx := NULL; -- 5132302
48220 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
48221 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
48222 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
48223 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
48224 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
48225 l_rec_acct_attrs.array_char_value(3) := p_source_51;
48226 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
48227 l_rec_acct_attrs.array_num_value(4) := p_source_52;
48228 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
48229 l_rec_acct_attrs.array_char_value(5) := p_source_53;
48230 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
48231 l_rec_acct_attrs.array_num_value(6) := p_source_52;
48232
48233 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
48234 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
48235
48236 ---------------------------------------------------------------------------------------------------------------
48237 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
48241 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
48238 ---------------------------------------------------------------------------------------------------------------
48239 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
48240
48242 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
48243
48244 IF xla_accounting_cache_pkg.GetValueChar
48245 (p_source_code => 'LEDGER_CATEGORY_CODE'
48246 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
48247 AND l_bflow_method_code = 'PRIOR_ENTRY'
48248 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
48249 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
48250 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
48251 )
48252 THEN
48253 xla_ae_lines_pkg.BflowUpgEntry
48254 (p_business_method_code => l_bflow_method_code
48255 ,p_business_class_code => l_bflow_class_code
48256 ,p_balance_type => l_balance_type_code);
48257 ELSE
48258 NULL;
48259 -- No business flow processing for business flow method of NONE.
48260 END IF;
48261
48262 --
48263 -- call analytical criteria
48264 --
48265
48266 --
48267 -- call description
48268 --
48269
48270 xla_ae_lines_pkg.SetLineDescription(
48271 p_ae_header_id => l_ae_header_id
48272 ,p_description => Description_34 (
48273 p_application_id => p_application_id
48274 , p_ae_header_id => l_ae_header_id
48275 , p_source_1 => p_source_1
48276 )
48277 );
48278
48279
48280 --
48281 -- call ADRs
48282 -- Bug 4922099
48283 --
48284 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
48285 (NVL(l_actual_upg_option, 'N') = 'O') OR
48286 (NVL(l_enc_upg_option, 'N') = 'O')
48287 )
48288 THEN
48289 NULL;
48290 --
48291 --
48292
48293 l_ccid := AcctDerRule_174(
48294 p_application_id => p_application_id
48295 , p_ae_header_id => l_ae_header_id
48296 , p_source_5 => p_source_5
48297 , p_source_32 => p_source_32
48298 , x_transaction_coa_id => l_adr_transaction_coa_id
48299 , x_accounting_coa_id => l_adr_accounting_coa_id
48300 , x_value_type_code => l_adr_value_type_code
48301 , p_side => 'NA'
48302 );
48303
48304 xla_ae_lines_pkg.set_ccid(
48305 p_code_combination_id => l_ccid
48306 , p_value_type_code => l_adr_value_type_code
48307 , p_transaction_coa_id => l_adr_transaction_coa_id
48308 , p_accounting_coa_id => l_adr_accounting_coa_id
48309 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
48310 , p_adr_type_code => 'S'
48311 , p_component_type => l_component_type
48312 , p_component_code => l_component_code
48313 , p_component_type_code => l_component_type_code
48314 , p_component_appl_id => l_component_appl_id
48315 , p_amb_context_code => l_amb_context_code
48316 , p_side => 'NA'
48317 );
48318
48319
48320 l_segment := AcctDerRule_169(
48321 p_application_id => p_application_id
48322 , p_ae_header_id => l_ae_header_id
48323 , p_source_5 => p_source_5
48324 , p_source_31 => p_source_31
48325 , x_transaction_coa_id => l_adr_transaction_coa_id
48326 , x_accounting_coa_id => l_adr_accounting_coa_id
48327 , x_flexfield_segment_code => l_adr_flexfield_segment_code
48328 , x_flex_value_set_id => l_adr_flex_value_set_id
48329 , x_value_type_code => l_adr_value_type_code
48330 , x_value_combination_id => l_adr_value_combination_id
48331 , x_value_segment_code => l_adr_value_segment_code
48332 , p_side => 'NA'
48333 , p_override_seg_flag => 'Y'
48334 );
48335
48336 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
48337
48338 xla_ae_lines_pkg.set_segment(
48339 p_to_segment_code => 'GL_BALANCING'
48340 , p_segment_value => l_segment
48341 , p_from_segment_code => l_adr_value_segment_code
48342 , p_from_combination_id => l_adr_value_combination_id
48343 , p_value_type_code => l_adr_value_type_code
48344 , p_transaction_coa_id => l_adr_transaction_coa_id
48345 , p_accounting_coa_id => l_adr_accounting_coa_id
48346 , p_flexfield_segment_code => l_adr_flexfield_segment_code
48347 , p_flex_value_set_id => l_adr_flex_value_set_id
48348 , p_adr_code => 'FA_EXPENSE_ACCT'
48349 , p_adr_type_code => 'S'
48350 , p_component_type => l_component_type
48351 , p_component_code => l_component_code
48352 , p_component_type_code => l_component_type_code
48353 , p_component_appl_id => l_component_appl_id
48354 , p_amb_context_code => l_amb_context_code
48355 , p_entity_code => 'TRANSACTIONS'
48356 , p_event_class_code => 'CIP_RETIREMENTS'
48360 END IF;
48357 , p_side => 'NA'
48358 );
48359
48361
48362 l_segment := AcctDerRule_161(
48363 p_application_id => p_application_id
48364 , p_ae_header_id => l_ae_header_id
48365 , p_source_5 => p_source_5
48366 , p_source_24 => p_source_24
48367 , x_transaction_coa_id => l_adr_transaction_coa_id
48368 , x_accounting_coa_id => l_adr_accounting_coa_id
48369 , x_flexfield_segment_code => l_adr_flexfield_segment_code
48370 , x_flex_value_set_id => l_adr_flex_value_set_id
48371 , x_value_type_code => l_adr_value_type_code
48372 , x_value_combination_id => l_adr_value_combination_id
48373 , x_value_segment_code => l_adr_value_segment_code
48374 , p_side => 'NA'
48375 , p_override_seg_flag => 'Y'
48376 );
48377
48378 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
48379
48380 xla_ae_lines_pkg.set_segment(
48381 p_to_segment_code => 'GL_ACCOUNT'
48382 , p_segment_value => l_segment
48383 , p_from_segment_code => l_adr_value_segment_code
48384 , p_from_combination_id => l_adr_value_combination_id
48385 , p_value_type_code => l_adr_value_type_code
48386 , p_transaction_coa_id => l_adr_transaction_coa_id
48387 , p_accounting_coa_id => l_adr_accounting_coa_id
48388 , p_flexfield_segment_code => l_adr_flexfield_segment_code
48389 , p_flex_value_set_id => l_adr_flex_value_set_id
48390 , p_adr_code => 'FA_NBV_RETIRED_LOSS_SEGMENT'
48391 , p_adr_type_code => 'S'
48392 , p_component_type => l_component_type
48393 , p_component_code => l_component_code
48394 , p_component_type_code => l_component_type_code
48395 , p_component_appl_id => l_component_appl_id
48396 , p_amb_context_code => l_amb_context_code
48397 , p_entity_code => 'TRANSACTIONS'
48398 , p_event_class_code => 'CIP_RETIREMENTS'
48399 , p_side => 'NA'
48400 );
48401
48402 END IF;
48403
48404 --
48405 --
48406 END IF;
48407 --
48408 -- Bug 4922099
48409 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
48410 (NVL(l_enc_upg_option, 'N') = 'O')
48411 ) AND
48412 (l_bflow_method_code = 'PRIOR_ENTRY')
48413 )
48414 THEN
48415 IF
48416 --
48417 1 = 2
48418 --
48419 THEN
48420 xla_accounting_err_pkg.build_message
48421 (p_appli_s_name => 'XLA'
48422 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
48423 ,p_token_1 => 'LINE_NUMBER'
48424 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
48425 ,p_token_2 => 'LINE_TYPE_NAME'
48426 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
48427 l_component_type
48428 ,l_component_code
48429 ,l_component_type_code
48430 ,l_component_appl_id
48431 ,l_amb_context_code
48432 ,l_entity_code
48433 ,l_event_class_code
48434 )
48435 ,p_token_3 => 'OWNER'
48436 ,p_value_3 => xla_lookups_pkg.get_meaning(
48437 p_lookup_type => 'XLA_OWNER_TYPE'
48438 ,p_lookup_code => l_component_type_code
48439 )
48440 ,p_token_4 => 'PRODUCT_NAME'
48441 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
48442 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
48443 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
48444 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
48445 ,p_ae_header_id => NULL
48446 );
48447
48448 IF (C_LEVEL_ERROR>= g_log_level) THEN
48449 trace
48450 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
48451 ,p_level => C_LEVEL_ERROR
48452 ,p_module => l_log_module);
48453 END IF;
48454 END IF;
48455 END IF;
48456 --
48457 --
48461 -- Prior Entry. Currently, the following code is always generated.
48458 ------------------------------------------------------------------------------------------------
48459 -- 4219869 Business Flow
48460 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
48462 ------------------------------------------------------------------------------------------------
48463 XLA_AE_LINES_PKG.ValidateCurrentLine;
48464
48465 ------------------------------------------------------------------------------------
48466 -- 4219869 Business Flow
48467 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
48468 ------------------------------------------------------------------------------------
48469 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
48470
48471 ----------------------------------------------------------------------------------
48472 -- 4219869 Business Flow
48473 -- Update journal entry status -- Need to generate this within IF <condition>
48474 ----------------------------------------------------------------------------------
48475 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
48476 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
48477 ,p_balance_type_code => l_balance_type_code
48478 );
48479
48480 -------------------------------------------------------------------------------------------
48481 -- 4262811 - Generate the Accrual Reversal lines
48482 -------------------------------------------------------------------------------------------
48483 BEGIN
48484 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
48485 (g_array_event(p_event_id).array_value_num('header_index'));
48486 IF l_acc_rev_flag IS NULL THEN
48487 l_acc_rev_flag := 'N';
48488 END IF;
48489 EXCEPTION
48490 WHEN OTHERS THEN
48491 l_acc_rev_flag := 'N';
48492 END;
48493 --
48494 IF (l_acc_rev_flag = 'Y') THEN
48495
48496 -- 4645092 ------------------------------------------------------------------------------
48497 -- To allow MPA report to determine if it should generate report process
48498 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
48499 ------------------------------------------------------------------------------------------
48500
48501 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
48502 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
48503 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
48504 -- call ADRs
48505 -- Bug 4922099
48506 --
48507 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
48508 (NVL(l_actual_upg_option, 'N') = 'O') OR
48509 (NVL(l_enc_upg_option, 'N') = 'O')
48510 )
48511 THEN
48512 NULL;
48513 --
48514 --
48515
48516 l_ccid := AcctDerRule_174(
48517 p_application_id => p_application_id
48518 , p_ae_header_id => l_ae_header_id
48519 , p_source_5 => p_source_5
48520 , p_source_32 => p_source_32
48521 , x_transaction_coa_id => l_adr_transaction_coa_id
48522 , x_accounting_coa_id => l_adr_accounting_coa_id
48523 , x_value_type_code => l_adr_value_type_code
48524 , p_side => 'NA'
48525 );
48526
48527 xla_ae_lines_pkg.set_ccid(
48528 p_code_combination_id => l_ccid
48529 , p_value_type_code => l_adr_value_type_code
48530 , p_transaction_coa_id => l_adr_transaction_coa_id
48531 , p_accounting_coa_id => l_adr_accounting_coa_id
48532 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
48533 , p_adr_type_code => 'S'
48534 , p_component_type => l_component_type
48535 , p_component_code => l_component_code
48536 , p_component_type_code => l_component_type_code
48537 , p_component_appl_id => l_component_appl_id
48538 , p_amb_context_code => l_amb_context_code
48539 , p_side => 'NA'
48540 );
48541
48542
48543 l_segment := AcctDerRule_169(
48544 p_application_id => p_application_id
48545 , p_ae_header_id => l_ae_header_id
48546 , p_source_5 => p_source_5
48547 , p_source_31 => p_source_31
48548 , x_transaction_coa_id => l_adr_transaction_coa_id
48549 , x_accounting_coa_id => l_adr_accounting_coa_id
48550 , x_flexfield_segment_code => l_adr_flexfield_segment_code
48551 , x_flex_value_set_id => l_adr_flex_value_set_id
48552 , x_value_type_code => l_adr_value_type_code
48553 , x_value_combination_id => l_adr_value_combination_id
48554 , x_value_segment_code => l_adr_value_segment_code
48555 , p_side => 'NA'
48556 , p_override_seg_flag => 'Y'
48557 );
48558
48559 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
48560
48561 xla_ae_lines_pkg.set_segment(
48562 p_to_segment_code => 'GL_BALANCING'
48563 , p_segment_value => l_segment
48564 , p_from_segment_code => l_adr_value_segment_code
48565 , p_from_combination_id => l_adr_value_combination_id
48566 , p_value_type_code => l_adr_value_type_code
48567 , p_transaction_coa_id => l_adr_transaction_coa_id
48571 , p_adr_code => 'FA_EXPENSE_ACCT'
48568 , p_accounting_coa_id => l_adr_accounting_coa_id
48569 , p_flexfield_segment_code => l_adr_flexfield_segment_code
48570 , p_flex_value_set_id => l_adr_flex_value_set_id
48572 , p_adr_type_code => 'S'
48573 , p_component_type => l_component_type
48574 , p_component_code => l_component_code
48575 , p_component_type_code => l_component_type_code
48576 , p_component_appl_id => l_component_appl_id
48577 , p_amb_context_code => l_amb_context_code
48578 , p_entity_code => 'TRANSACTIONS'
48579 , p_event_class_code => 'CIP_RETIREMENTS'
48580 , p_side => 'NA'
48581 );
48582
48583 END IF;
48584
48585 l_segment := AcctDerRule_161(
48586 p_application_id => p_application_id
48587 , p_ae_header_id => l_ae_header_id
48588 , p_source_5 => p_source_5
48589 , p_source_24 => p_source_24
48590 , x_transaction_coa_id => l_adr_transaction_coa_id
48591 , x_accounting_coa_id => l_adr_accounting_coa_id
48592 , x_flexfield_segment_code => l_adr_flexfield_segment_code
48593 , x_flex_value_set_id => l_adr_flex_value_set_id
48594 , x_value_type_code => l_adr_value_type_code
48595 , x_value_combination_id => l_adr_value_combination_id
48596 , x_value_segment_code => l_adr_value_segment_code
48597 , p_side => 'NA'
48598 , p_override_seg_flag => 'Y'
48599 );
48600
48601 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
48602
48603 xla_ae_lines_pkg.set_segment(
48604 p_to_segment_code => 'GL_ACCOUNT'
48605 , p_segment_value => l_segment
48606 , p_from_segment_code => l_adr_value_segment_code
48607 , p_from_combination_id => l_adr_value_combination_id
48608 , p_value_type_code => l_adr_value_type_code
48609 , p_transaction_coa_id => l_adr_transaction_coa_id
48610 , p_accounting_coa_id => l_adr_accounting_coa_id
48611 , p_flexfield_segment_code => l_adr_flexfield_segment_code
48612 , p_flex_value_set_id => l_adr_flex_value_set_id
48613 , p_adr_code => 'FA_NBV_RETIRED_LOSS_SEGMENT'
48614 , p_adr_type_code => 'S'
48615 , p_component_type => l_component_type
48616 , p_component_code => l_component_code
48617 , p_component_type_code => l_component_type_code
48618 , p_component_appl_id => l_component_appl_id
48619 , p_amb_context_code => l_amb_context_code
48620 , p_entity_code => 'TRANSACTIONS'
48621 , p_event_class_code => 'CIP_RETIREMENTS'
48622 , p_side => 'NA'
48623 );
48624
48625 END IF;
48626
48627 --
48628 --
48629 END IF;
48630
48631 --
48632 -- Update the line information that should be overwritten
48633 --
48634 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
48635 p_header_num => 1);
48636 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
48637
48638 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
48639
48640 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
48641 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
48642 END IF;
48643
48644 --
48645 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
48646 --
48647 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
48648 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
48649 ELSE
48650 ---------------------------------------------------------------------------------------------------
48651 -- 4262811a Switch Sign
48652 ---------------------------------------------------------------------------------------------------
48653 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
48654 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
48655 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
48656 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
48657 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
48658 -- 5132302
48659 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
48660 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
48661
48662 END IF;
48663
48664 -- 4955764
48665 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
48666 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
48667
48668
48669 XLA_AE_LINES_PKG.ValidateCurrentLine;
48670 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
48671
48675
48672 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
48673 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
48674 ,p_balance_type_code => l_balance_type_code);
48676 END IF;
48677
48678 -----------------------------------------------------------------------------------------
48679 -- 4262811 Multiperiod Accounting
48680 -----------------------------------------------------------------------------------------
48681 -- No MPA option is assigned.
48682
48683
48684 END IF;
48685 END IF;
48686 --
48687
48688 --
48689 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
48690 trace
48691 (p_msg => 'END of AcctLineType_232'
48692 ,p_level => C_LEVEL_PROCEDURE
48693 ,p_module => l_log_module);
48694 END IF;
48695 --
48696 EXCEPTION
48697 WHEN xla_exceptions_pkg.application_exception THEN
48698 RAISE;
48699 WHEN OTHERS THEN
48700 xla_exceptions_pkg.raise_message
48701 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_232');
48702 END AcctLineType_232;
48703 --
48704
48705 ---------------------------------------
48706 --
48707 -- PRIVATE FUNCTION
48708 -- AcctLineType_233
48709 --
48710 ---------------------------------------
48711 PROCEDURE AcctLineType_233 (
48712 p_application_id IN NUMBER
48713 ,p_event_id IN NUMBER
48714 ,p_calculate_acctd_flag IN VARCHAR2
48715 ,p_calculate_g_l_flag IN VARCHAR2
48716 ,p_actual_flag IN OUT VARCHAR2
48717 ,p_balance_type_code OUT VARCHAR2
48718 ,p_gain_or_loss_ref OUT VARCHAR2
48719
48720 --Period Close Date
48721 , p_source_1 IN DATE
48722 --Generated Code Combination Identifier
48723 , p_source_5 IN NUMBER
48724 --Proceeds Of Sale Clearing Account
48725 , p_source_25 IN VARCHAR2
48726 --Expense Account Code Combination Identifier
48727 , p_source_31 IN NUMBER
48728 --Default Code Combination Identifier
48729 , p_source_32 IN NUMBER
48730 --Adjustment Type
48731 , p_source_48 IN VARCHAR2
48732 --Transaction Header Identifier
48733 , p_source_49 IN NUMBER
48734 --Adjustment Line Identifier
48735 , p_source_50 IN NUMBER
48736 --Distribution Type Code
48737 , p_source_51 IN VARCHAR2
48738 --Entered Amount
48739 , p_source_52 IN NUMBER
48740 --Currency Code
48741 , p_source_53 IN VARCHAR2
48742 )
48743 IS
48744
48745 l_component_type VARCHAR2(80);
48746 l_component_code VARCHAR2(30);
48747 l_component_type_code VARCHAR2(1);
48748 l_component_appl_id INTEGER;
48749 l_amb_context_code VARCHAR2(30);
48750 l_entity_code VARCHAR2(30);
48751 l_event_class_code VARCHAR2(30);
48752 l_ae_header_id NUMBER;
48753 l_event_type_code VARCHAR2(30);
48754 l_line_definition_code VARCHAR2(30);
48755 l_line_definition_owner_code VARCHAR2(1);
48756 --
48757 -- adr variables
48758 l_segment VARCHAR2(30);
48759 l_ccid NUMBER;
48760 l_adr_transaction_coa_id NUMBER;
48761 l_adr_accounting_coa_id NUMBER;
48762 l_adr_flexfield_segment_code VARCHAR2(30);
48763 l_adr_flex_value_set_id NUMBER;
48764 l_adr_value_type_code VARCHAR2(30);
48765 l_adr_value_combination_id NUMBER;
48766 l_adr_value_segment_code VARCHAR2(30);
48767
48768 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
48769 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
48770 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
48771 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
48772
48773 -- 4262811 Variables ------------------------------------------------------------------------------------------
48774 l_entered_amt_idx NUMBER;
48775 l_accted_amt_idx NUMBER;
48776 l_acc_rev_flag VARCHAR2(1);
48777 l_accrual_line_num NUMBER;
48778 l_tmp_amt NUMBER;
48779 l_acc_rev_natural_side_code VARCHAR2(1);
48780
48781 l_num_entries NUMBER;
48782 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
48783 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
48784 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
48785 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
48786 l_recog_line_1 NUMBER;
48787 l_recog_line_2 NUMBER;
48788
48789 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
48790 l_bflow_applied_to_amt NUMBER; -- 5132302
48791 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
48792
48793 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
48794
48795 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
48796 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
48797
48798 ---------------------------------------------------------------------------------------------------------------
48799
48800
48801 --
48802 -- bulk performance
48803 --
48804 l_balance_type_code VARCHAR2(1);
48808 --
48805 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
48806 l_log_module VARCHAR2(240);
48807
48809 -- Upgrade strategy
48810 --
48811 l_actual_upg_option VARCHAR2(1);
48812 l_enc_upg_option VARCHAR2(1);
48813
48814 --
48815 BEGIN
48816 --
48817 IF g_log_enabled THEN
48818 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_233';
48819 END IF;
48820 --
48821 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
48822
48823 trace
48824 (p_msg => 'BEGIN of AcctLineType_233'
48825 ,p_level => C_LEVEL_PROCEDURE
48826 ,p_module => l_log_module);
48827
48828 END IF;
48829 --
48830 l_component_type := 'AMB_JLT';
48831 l_component_code := 'FA_CIP_PROC_OF_SALE_CLR';
48832 l_component_type_code := 'S';
48833 l_component_appl_id := 140;
48834 l_amb_context_code := 'DEFAULT';
48835 l_entity_code := 'TRANSACTIONS';
48836 l_event_class_code := 'CIP_RETIREMENTS';
48837 l_event_type_code := 'CIP_REINSTATEMENTS';
48838 l_line_definition_owner_code := 'S';
48839 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
48840 --
48841 l_balance_type_code := 'A';
48842 l_segment := NULL;
48843 l_ccid := NULL;
48844 l_adr_transaction_coa_id := NULL;
48845 l_adr_accounting_coa_id := NULL;
48846 l_adr_flexfield_segment_code := NULL;
48847 l_adr_flex_value_set_id := NULL;
48848 l_adr_value_type_code := NULL;
48849 l_adr_value_combination_id := NULL;
48850 l_adr_value_segment_code := NULL;
48851
48852 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
48853 l_bflow_class_code := ''; -- 4219869 Business Flow
48854 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
48855 l_budgetary_control_flag := 'N';
48856
48857 l_bflow_applied_to_amt_idx := NULL; -- 5132302
48858 l_bflow_applied_to_amt := NULL; -- 5132302
48859 l_entered_amt_idx := NULL; -- 4262811
48860 l_accted_amt_idx := NULL; -- 4262811
48861 l_acc_rev_flag := NULL; -- 4262811
48862 l_accrual_line_num := NULL; -- 4262811
48863 l_tmp_amt := NULL; -- 4262811
48864 --
48865
48866 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
48867 l_balance_type_code <> 'B' THEN
48868 IF NVL(p_source_48,'
48869 ') = 'PROCEEDS CLR'
48870 THEN
48871
48872 --
48873 XLA_AE_LINES_PKG.SetNewLine;
48874
48875 p_balance_type_code := l_balance_type_code;
48876 -- set the flag so later we will know whether the gain loss line needs to be created
48877
48878 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
48879 p_actual_flag :='A';
48880 END IF;
48881
48882 --
48883 -- bulk performance
48884 --
48885 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
48886 p_header_num => 0); -- 4262811
48887 --
48888 -- set accounting line options
48889 --
48890 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
48891 p_natural_side_code => 'D'
48892 , p_gain_or_loss_flag => 'N'
48893 , p_gl_transfer_mode_code => 'S'
48894 , p_acct_entry_type_code => 'A'
48895 , p_switch_side_flag => 'Y'
48896 , p_merge_duplicate_code => 'N'
48897 );
48898 --
48899 l_acc_rev_natural_side_code := 'C'; -- 4262811
48900 --
48901 --
48902 -- set accounting line type info
48903 --
48904 xla_ae_lines_pkg.SetAcctLineType
48905 (p_component_type => l_component_type
48906 ,p_event_type_code => l_event_type_code
48907 ,p_line_definition_owner_code => l_line_definition_owner_code
48908 ,p_line_definition_code => l_line_definition_code
48909 ,p_accounting_line_code => l_component_code
48910 ,p_accounting_line_type_code => l_component_type_code
48911 ,p_accounting_line_appl_id => l_component_appl_id
48912 ,p_amb_context_code => l_amb_context_code
48913 ,p_entity_code => l_entity_code
48914 ,p_event_class_code => l_event_class_code);
48915 --
48916 -- set accounting class
48917 --
48918 xla_ae_lines_pkg.SetAcctClass(
48919 p_accounting_class_code => 'ASSET'
48920 , p_ae_header_id => l_ae_header_id
48921 );
48922
48923 --
48924 -- set rounding class
48925 --
48926 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
48927 'ASSET';
48928
48929 --
48930 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
48931 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
48932 --
48933 -- bulk performance
48934 --
48935 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
48936
48940 -- 4955764
48937 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
48938 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
48939
48941 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
48942 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
48943
48944 -- 4458381 Public Sector Enh
48945
48946 --
48947 -- set accounting attributes for the line type
48948 --
48949 l_entered_amt_idx := 4;
48950 l_accted_amt_idx := 6;
48951 l_bflow_applied_to_amt_idx := NULL; -- 5132302
48952 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
48953 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
48954 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
48955 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
48956 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
48957 l_rec_acct_attrs.array_char_value(3) := p_source_51;
48958 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
48959 l_rec_acct_attrs.array_num_value(4) := p_source_52;
48960 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
48961 l_rec_acct_attrs.array_char_value(5) := p_source_53;
48962 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
48963 l_rec_acct_attrs.array_num_value(6) := p_source_52;
48964
48965 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
48966 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
48967
48968 ---------------------------------------------------------------------------------------------------------------
48969 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
48970 ---------------------------------------------------------------------------------------------------------------
48971 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
48972
48973 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
48974 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
48975
48976 IF xla_accounting_cache_pkg.GetValueChar
48977 (p_source_code => 'LEDGER_CATEGORY_CODE'
48978 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
48979 AND l_bflow_method_code = 'PRIOR_ENTRY'
48980 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
48981 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
48982 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
48983 )
48984 THEN
48985 xla_ae_lines_pkg.BflowUpgEntry
48986 (p_business_method_code => l_bflow_method_code
48987 ,p_business_class_code => l_bflow_class_code
48988 ,p_balance_type => l_balance_type_code);
48989 ELSE
48990 NULL;
48991 -- No business flow processing for business flow method of NONE.
48992 END IF;
48993
48994 --
48995 -- call analytical criteria
48996 --
48997
48998 --
48999 -- call description
49000 --
49001
49002 xla_ae_lines_pkg.SetLineDescription(
49003 p_ae_header_id => l_ae_header_id
49004 ,p_description => Description_38 (
49005 p_application_id => p_application_id
49006 , p_ae_header_id => l_ae_header_id
49007 , p_source_1 => p_source_1
49008 )
49009 );
49010
49011
49012 --
49013 -- call ADRs
49014 -- Bug 4922099
49015 --
49016 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
49017 (NVL(l_actual_upg_option, 'N') = 'O') OR
49018 (NVL(l_enc_upg_option, 'N') = 'O')
49019 )
49020 THEN
49021 NULL;
49022 --
49023 --
49024
49025 l_ccid := AcctDerRule_174(
49026 p_application_id => p_application_id
49027 , p_ae_header_id => l_ae_header_id
49028 , p_source_5 => p_source_5
49029 , p_source_32 => p_source_32
49030 , x_transaction_coa_id => l_adr_transaction_coa_id
49031 , x_accounting_coa_id => l_adr_accounting_coa_id
49032 , x_value_type_code => l_adr_value_type_code
49033 , p_side => 'NA'
49034 );
49035
49036 xla_ae_lines_pkg.set_ccid(
49037 p_code_combination_id => l_ccid
49038 , p_value_type_code => l_adr_value_type_code
49039 , p_transaction_coa_id => l_adr_transaction_coa_id
49040 , p_accounting_coa_id => l_adr_accounting_coa_id
49041 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
49042 , p_adr_type_code => 'S'
49043 , p_component_type => l_component_type
49044 , p_component_code => l_component_code
49045 , p_component_type_code => l_component_type_code
49046 , p_component_appl_id => l_component_appl_id
49047 , p_amb_context_code => l_amb_context_code
49048 , p_side => 'NA'
49049 );
49050
49051
49052 l_segment := AcctDerRule_169(
49053 p_application_id => p_application_id
49054 , p_ae_header_id => l_ae_header_id
49055 , p_source_5 => p_source_5
49059 , x_flexfield_segment_code => l_adr_flexfield_segment_code
49056 , p_source_31 => p_source_31
49057 , x_transaction_coa_id => l_adr_transaction_coa_id
49058 , x_accounting_coa_id => l_adr_accounting_coa_id
49060 , x_flex_value_set_id => l_adr_flex_value_set_id
49061 , x_value_type_code => l_adr_value_type_code
49062 , x_value_combination_id => l_adr_value_combination_id
49063 , x_value_segment_code => l_adr_value_segment_code
49064 , p_side => 'NA'
49065 , p_override_seg_flag => 'Y'
49066 );
49067
49068 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
49069
49070 xla_ae_lines_pkg.set_segment(
49071 p_to_segment_code => 'GL_BALANCING'
49072 , p_segment_value => l_segment
49073 , p_from_segment_code => l_adr_value_segment_code
49074 , p_from_combination_id => l_adr_value_combination_id
49075 , p_value_type_code => l_adr_value_type_code
49076 , p_transaction_coa_id => l_adr_transaction_coa_id
49077 , p_accounting_coa_id => l_adr_accounting_coa_id
49078 , p_flexfield_segment_code => l_adr_flexfield_segment_code
49079 , p_flex_value_set_id => l_adr_flex_value_set_id
49080 , p_adr_code => 'FA_EXPENSE_ACCT'
49081 , p_adr_type_code => 'S'
49082 , p_component_type => l_component_type
49083 , p_component_code => l_component_code
49084 , p_component_type_code => l_component_type_code
49085 , p_component_appl_id => l_component_appl_id
49086 , p_amb_context_code => l_amb_context_code
49087 , p_entity_code => 'TRANSACTIONS'
49088 , p_event_class_code => 'CIP_RETIREMENTS'
49089 , p_side => 'NA'
49090 );
49091
49092 END IF;
49093
49094 l_segment := AcctDerRule_162(
49095 p_application_id => p_application_id
49096 , p_ae_header_id => l_ae_header_id
49097 , p_source_5 => p_source_5
49098 , p_source_25 => p_source_25
49099 , x_transaction_coa_id => l_adr_transaction_coa_id
49100 , x_accounting_coa_id => l_adr_accounting_coa_id
49101 , x_flexfield_segment_code => l_adr_flexfield_segment_code
49102 , x_flex_value_set_id => l_adr_flex_value_set_id
49103 , x_value_type_code => l_adr_value_type_code
49104 , x_value_combination_id => l_adr_value_combination_id
49105 , x_value_segment_code => l_adr_value_segment_code
49106 , p_side => 'NA'
49107 , p_override_seg_flag => 'Y'
49108 );
49109
49110 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
49111
49112 xla_ae_lines_pkg.set_segment(
49113 p_to_segment_code => 'GL_ACCOUNT'
49114 , p_segment_value => l_segment
49115 , p_from_segment_code => l_adr_value_segment_code
49116 , p_from_combination_id => l_adr_value_combination_id
49117 , p_value_type_code => l_adr_value_type_code
49118 , p_transaction_coa_id => l_adr_transaction_coa_id
49119 , p_accounting_coa_id => l_adr_accounting_coa_id
49120 , p_flexfield_segment_code => l_adr_flexfield_segment_code
49121 , p_flex_value_set_id => l_adr_flex_value_set_id
49122 , p_adr_code => 'FA_PROC_OF_SALE_CLR_SEGMENT'
49123 , p_adr_type_code => 'S'
49124 , p_component_type => l_component_type
49125 , p_component_code => l_component_code
49126 , p_component_type_code => l_component_type_code
49127 , p_component_appl_id => l_component_appl_id
49128 , p_amb_context_code => l_amb_context_code
49129 , p_entity_code => 'TRANSACTIONS'
49130 , p_event_class_code => 'CIP_RETIREMENTS'
49131 , p_side => 'NA'
49132 );
49133
49134 END IF;
49135
49136 --
49137 --
49138 END IF;
49139 --
49140 -- Bug 4922099
49141 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
49142 (NVL(l_enc_upg_option, 'N') = 'O')
49143 ) AND
49144 (l_bflow_method_code = 'PRIOR_ENTRY')
49145 )
49146 THEN
49147 IF
49148 --
49149 1 = 2
49150 --
49151 THEN
49152 xla_accounting_err_pkg.build_message
49153 (p_appli_s_name => 'XLA'
49154 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
49155 ,p_token_1 => 'LINE_NUMBER'
49156 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
49157 ,p_token_2 => 'LINE_TYPE_NAME'
49158 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
49159 l_component_type
49160 ,l_component_code
49161 ,l_component_type_code
49162 ,l_component_appl_id
49163 ,l_amb_context_code
49167 ,p_token_3 => 'OWNER'
49164 ,l_entity_code
49165 ,l_event_class_code
49166 )
49168 ,p_value_3 => xla_lookups_pkg.get_meaning(
49169 p_lookup_type => 'XLA_OWNER_TYPE'
49170 ,p_lookup_code => l_component_type_code
49171 )
49172 ,p_token_4 => 'PRODUCT_NAME'
49173 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
49174 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
49175 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
49176 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
49177 ,p_ae_header_id => NULL
49178 );
49179
49180 IF (C_LEVEL_ERROR>= g_log_level) THEN
49181 trace
49182 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
49183 ,p_level => C_LEVEL_ERROR
49184 ,p_module => l_log_module);
49185 END IF;
49186 END IF;
49187 END IF;
49188 --
49189 --
49190 ------------------------------------------------------------------------------------------------
49191 -- 4219869 Business Flow
49192 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
49193 -- Prior Entry. Currently, the following code is always generated.
49194 ------------------------------------------------------------------------------------------------
49195 XLA_AE_LINES_PKG.ValidateCurrentLine;
49196
49197 ------------------------------------------------------------------------------------
49198 -- 4219869 Business Flow
49199 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
49200 ------------------------------------------------------------------------------------
49201 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
49202
49203 ----------------------------------------------------------------------------------
49204 -- 4219869 Business Flow
49205 -- Update journal entry status -- Need to generate this within IF <condition>
49206 ----------------------------------------------------------------------------------
49207 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
49208 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
49209 ,p_balance_type_code => l_balance_type_code
49210 );
49211
49212 -------------------------------------------------------------------------------------------
49213 -- 4262811 - Generate the Accrual Reversal lines
49214 -------------------------------------------------------------------------------------------
49215 BEGIN
49216 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
49217 (g_array_event(p_event_id).array_value_num('header_index'));
49218 IF l_acc_rev_flag IS NULL THEN
49219 l_acc_rev_flag := 'N';
49220 END IF;
49221 EXCEPTION
49222 WHEN OTHERS THEN
49223 l_acc_rev_flag := 'N';
49224 END;
49225 --
49226 IF (l_acc_rev_flag = 'Y') THEN
49227
49228 -- 4645092 ------------------------------------------------------------------------------
49229 -- To allow MPA report to determine if it should generate report process
49230 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
49231 ------------------------------------------------------------------------------------------
49232
49233 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
49234 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
49235 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
49236 -- call ADRs
49237 -- Bug 4922099
49238 --
49239 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
49240 (NVL(l_actual_upg_option, 'N') = 'O') OR
49241 (NVL(l_enc_upg_option, 'N') = 'O')
49242 )
49243 THEN
49244 NULL;
49245 --
49246 --
49247
49248 l_ccid := AcctDerRule_174(
49249 p_application_id => p_application_id
49250 , p_ae_header_id => l_ae_header_id
49251 , p_source_5 => p_source_5
49252 , p_source_32 => p_source_32
49253 , x_transaction_coa_id => l_adr_transaction_coa_id
49254 , x_accounting_coa_id => l_adr_accounting_coa_id
49255 , x_value_type_code => l_adr_value_type_code
49256 , p_side => 'NA'
49257 );
49258
49259 xla_ae_lines_pkg.set_ccid(
49260 p_code_combination_id => l_ccid
49261 , p_value_type_code => l_adr_value_type_code
49262 , p_transaction_coa_id => l_adr_transaction_coa_id
49263 , p_accounting_coa_id => l_adr_accounting_coa_id
49264 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
49268 , p_component_type_code => l_component_type_code
49265 , p_adr_type_code => 'S'
49266 , p_component_type => l_component_type
49267 , p_component_code => l_component_code
49269 , p_component_appl_id => l_component_appl_id
49270 , p_amb_context_code => l_amb_context_code
49271 , p_side => 'NA'
49272 );
49273
49274
49275 l_segment := AcctDerRule_169(
49276 p_application_id => p_application_id
49277 , p_ae_header_id => l_ae_header_id
49278 , p_source_5 => p_source_5
49279 , p_source_31 => p_source_31
49280 , x_transaction_coa_id => l_adr_transaction_coa_id
49281 , x_accounting_coa_id => l_adr_accounting_coa_id
49282 , x_flexfield_segment_code => l_adr_flexfield_segment_code
49283 , x_flex_value_set_id => l_adr_flex_value_set_id
49284 , x_value_type_code => l_adr_value_type_code
49285 , x_value_combination_id => l_adr_value_combination_id
49286 , x_value_segment_code => l_adr_value_segment_code
49287 , p_side => 'NA'
49288 , p_override_seg_flag => 'Y'
49289 );
49290
49291 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
49292
49293 xla_ae_lines_pkg.set_segment(
49294 p_to_segment_code => 'GL_BALANCING'
49295 , p_segment_value => l_segment
49296 , p_from_segment_code => l_adr_value_segment_code
49297 , p_from_combination_id => l_adr_value_combination_id
49298 , p_value_type_code => l_adr_value_type_code
49299 , p_transaction_coa_id => l_adr_transaction_coa_id
49300 , p_accounting_coa_id => l_adr_accounting_coa_id
49301 , p_flexfield_segment_code => l_adr_flexfield_segment_code
49302 , p_flex_value_set_id => l_adr_flex_value_set_id
49303 , p_adr_code => 'FA_EXPENSE_ACCT'
49304 , p_adr_type_code => 'S'
49305 , p_component_type => l_component_type
49306 , p_component_code => l_component_code
49307 , p_component_type_code => l_component_type_code
49308 , p_component_appl_id => l_component_appl_id
49309 , p_amb_context_code => l_amb_context_code
49310 , p_entity_code => 'TRANSACTIONS'
49311 , p_event_class_code => 'CIP_RETIREMENTS'
49312 , p_side => 'NA'
49313 );
49314
49315 END IF;
49316
49317 l_segment := AcctDerRule_162(
49318 p_application_id => p_application_id
49319 , p_ae_header_id => l_ae_header_id
49320 , p_source_5 => p_source_5
49321 , p_source_25 => p_source_25
49322 , x_transaction_coa_id => l_adr_transaction_coa_id
49323 , x_accounting_coa_id => l_adr_accounting_coa_id
49324 , x_flexfield_segment_code => l_adr_flexfield_segment_code
49325 , x_flex_value_set_id => l_adr_flex_value_set_id
49326 , x_value_type_code => l_adr_value_type_code
49327 , x_value_combination_id => l_adr_value_combination_id
49328 , x_value_segment_code => l_adr_value_segment_code
49329 , p_side => 'NA'
49330 , p_override_seg_flag => 'Y'
49331 );
49332
49333 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
49334
49335 xla_ae_lines_pkg.set_segment(
49336 p_to_segment_code => 'GL_ACCOUNT'
49337 , p_segment_value => l_segment
49338 , p_from_segment_code => l_adr_value_segment_code
49339 , p_from_combination_id => l_adr_value_combination_id
49340 , p_value_type_code => l_adr_value_type_code
49341 , p_transaction_coa_id => l_adr_transaction_coa_id
49342 , p_accounting_coa_id => l_adr_accounting_coa_id
49343 , p_flexfield_segment_code => l_adr_flexfield_segment_code
49344 , p_flex_value_set_id => l_adr_flex_value_set_id
49345 , p_adr_code => 'FA_PROC_OF_SALE_CLR_SEGMENT'
49346 , p_adr_type_code => 'S'
49347 , p_component_type => l_component_type
49348 , p_component_code => l_component_code
49349 , p_component_type_code => l_component_type_code
49350 , p_component_appl_id => l_component_appl_id
49351 , p_amb_context_code => l_amb_context_code
49352 , p_entity_code => 'TRANSACTIONS'
49353 , p_event_class_code => 'CIP_RETIREMENTS'
49354 , p_side => 'NA'
49355 );
49356
49357 END IF;
49358
49359 --
49360 --
49361 END IF;
49362
49363 --
49364 -- Update the line information that should be overwritten
49365 --
49366 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
49367 p_header_num => 1);
49368 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
49369
49370 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
49371
49372 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
49373 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
49377 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
49374 END IF;
49375
49376 --
49378 --
49379 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
49380 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
49381 ELSE
49382 ---------------------------------------------------------------------------------------------------
49383 -- 4262811a Switch Sign
49384 ---------------------------------------------------------------------------------------------------
49385 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
49386 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
49387 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
49388 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
49389 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
49390 -- 5132302
49391 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
49392 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
49393
49394 END IF;
49395
49396 -- 4955764
49397 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
49398 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
49399
49400
49401 XLA_AE_LINES_PKG.ValidateCurrentLine;
49402 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
49403
49404 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
49405 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
49406 ,p_balance_type_code => l_balance_type_code);
49407
49408 END IF;
49409
49410 -----------------------------------------------------------------------------------------
49411 -- 4262811 Multiperiod Accounting
49412 -----------------------------------------------------------------------------------------
49413 -- No MPA option is assigned.
49414
49415
49416 END IF;
49417 END IF;
49418 --
49419
49420 --
49421 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
49422 trace
49423 (p_msg => 'END of AcctLineType_233'
49424 ,p_level => C_LEVEL_PROCEDURE
49425 ,p_module => l_log_module);
49426 END IF;
49427 --
49428 EXCEPTION
49429 WHEN xla_exceptions_pkg.application_exception THEN
49430 RAISE;
49431 WHEN OTHERS THEN
49432 xla_exceptions_pkg.raise_message
49433 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_233');
49434 END AcctLineType_233;
49435 --
49436
49437 ---------------------------------------
49438 --
49439 -- PRIVATE FUNCTION
49440 -- AcctLineType_234
49441 --
49442 ---------------------------------------
49443 PROCEDURE AcctLineType_234 (
49444 p_application_id IN NUMBER
49445 ,p_event_id IN NUMBER
49446 ,p_calculate_acctd_flag IN VARCHAR2
49447 ,p_calculate_g_l_flag IN VARCHAR2
49448 ,p_actual_flag IN OUT VARCHAR2
49449 ,p_balance_type_code OUT VARCHAR2
49450 ,p_gain_or_loss_ref OUT VARCHAR2
49451
49452 --Period Close Date
49453 , p_source_1 IN DATE
49454 --Generated Code Combination Identifier
49455 , p_source_5 IN NUMBER
49456 --Proceeds Of Sale Clearing Account
49457 , p_source_25 IN VARCHAR2
49458 --Expense Account Code Combination Identifier
49459 , p_source_31 IN NUMBER
49460 --Default Code Combination Identifier
49461 , p_source_32 IN NUMBER
49462 --Adjustment Type
49463 , p_source_48 IN VARCHAR2
49464 --Transaction Header Identifier
49465 , p_source_49 IN NUMBER
49466 --Adjustment Line Identifier
49467 , p_source_50 IN NUMBER
49468 --Distribution Type Code
49469 , p_source_51 IN VARCHAR2
49470 --Entered Amount
49471 , p_source_52 IN NUMBER
49472 --Currency Code
49473 , p_source_53 IN VARCHAR2
49474 )
49475 IS
49476
49477 l_component_type VARCHAR2(80);
49478 l_component_code VARCHAR2(30);
49479 l_component_type_code VARCHAR2(1);
49480 l_component_appl_id INTEGER;
49481 l_amb_context_code VARCHAR2(30);
49482 l_entity_code VARCHAR2(30);
49483 l_event_class_code VARCHAR2(30);
49484 l_ae_header_id NUMBER;
49485 l_event_type_code VARCHAR2(30);
49486 l_line_definition_code VARCHAR2(30);
49487 l_line_definition_owner_code VARCHAR2(1);
49488 --
49489 -- adr variables
49490 l_segment VARCHAR2(30);
49491 l_ccid NUMBER;
49492 l_adr_transaction_coa_id NUMBER;
49493 l_adr_accounting_coa_id NUMBER;
49494 l_adr_flexfield_segment_code VARCHAR2(30);
49495 l_adr_flex_value_set_id NUMBER;
49496 l_adr_value_type_code VARCHAR2(30);
49497 l_adr_value_combination_id NUMBER;
49498 l_adr_value_segment_code VARCHAR2(30);
49499
49500 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
49504
49501 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
49502 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
49503 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
49505 -- 4262811 Variables ------------------------------------------------------------------------------------------
49506 l_entered_amt_idx NUMBER;
49507 l_accted_amt_idx NUMBER;
49508 l_acc_rev_flag VARCHAR2(1);
49509 l_accrual_line_num NUMBER;
49510 l_tmp_amt NUMBER;
49511 l_acc_rev_natural_side_code VARCHAR2(1);
49512
49513 l_num_entries NUMBER;
49514 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
49515 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
49516 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
49517 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
49518 l_recog_line_1 NUMBER;
49519 l_recog_line_2 NUMBER;
49520
49521 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
49522 l_bflow_applied_to_amt NUMBER; -- 5132302
49523 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
49524
49525 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
49526
49527 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
49528 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
49529
49530 ---------------------------------------------------------------------------------------------------------------
49531
49532
49533 --
49534 -- bulk performance
49535 --
49536 l_balance_type_code VARCHAR2(1);
49537 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
49538 l_log_module VARCHAR2(240);
49539
49540 --
49541 -- Upgrade strategy
49542 --
49543 l_actual_upg_option VARCHAR2(1);
49544 l_enc_upg_option VARCHAR2(1);
49545
49546 --
49547 BEGIN
49548 --
49549 IF g_log_enabled THEN
49550 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_234';
49551 END IF;
49552 --
49553 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
49554
49555 trace
49556 (p_msg => 'BEGIN of AcctLineType_234'
49557 ,p_level => C_LEVEL_PROCEDURE
49558 ,p_module => l_log_module);
49559
49560 END IF;
49561 --
49562 l_component_type := 'AMB_JLT';
49563 l_component_code := 'FA_CIP_PROC_OF_SALE_CLR';
49564 l_component_type_code := 'S';
49565 l_component_appl_id := 140;
49566 l_amb_context_code := 'DEFAULT';
49567 l_entity_code := 'TRANSACTIONS';
49568 l_event_class_code := 'CIP_RETIREMENTS';
49569 l_event_type_code := 'CIP_RETIREMENTS';
49570 l_line_definition_owner_code := 'S';
49571 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
49572 --
49573 l_balance_type_code := 'A';
49574 l_segment := NULL;
49575 l_ccid := NULL;
49576 l_adr_transaction_coa_id := NULL;
49577 l_adr_accounting_coa_id := NULL;
49578 l_adr_flexfield_segment_code := NULL;
49579 l_adr_flex_value_set_id := NULL;
49580 l_adr_value_type_code := NULL;
49581 l_adr_value_combination_id := NULL;
49582 l_adr_value_segment_code := NULL;
49583
49584 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
49585 l_bflow_class_code := ''; -- 4219869 Business Flow
49586 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
49587 l_budgetary_control_flag := 'N';
49588
49589 l_bflow_applied_to_amt_idx := NULL; -- 5132302
49590 l_bflow_applied_to_amt := NULL; -- 5132302
49591 l_entered_amt_idx := NULL; -- 4262811
49592 l_accted_amt_idx := NULL; -- 4262811
49593 l_acc_rev_flag := NULL; -- 4262811
49594 l_accrual_line_num := NULL; -- 4262811
49595 l_tmp_amt := NULL; -- 4262811
49596 --
49597
49598 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
49599 l_balance_type_code <> 'B' THEN
49600 IF NVL(p_source_48,'
49601 ') = 'PROCEEDS CLR'
49602 THEN
49603
49604 --
49605 XLA_AE_LINES_PKG.SetNewLine;
49606
49607 p_balance_type_code := l_balance_type_code;
49608 -- set the flag so later we will know whether the gain loss line needs to be created
49609
49610 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
49611 p_actual_flag :='A';
49612 END IF;
49613
49614 --
49615 -- bulk performance
49616 --
49617 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
49618 p_header_num => 0); -- 4262811
49619 --
49620 -- set accounting line options
49621 --
49622 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
49623 p_natural_side_code => 'D'
49624 , p_gain_or_loss_flag => 'N'
49625 , p_gl_transfer_mode_code => 'S'
49626 , p_acct_entry_type_code => 'A'
49627 , p_switch_side_flag => 'Y'
49628 , p_merge_duplicate_code => 'N'
49629 );
49630 --
49634 -- set accounting line type info
49631 l_acc_rev_natural_side_code := 'C'; -- 4262811
49632 --
49633 --
49635 --
49636 xla_ae_lines_pkg.SetAcctLineType
49637 (p_component_type => l_component_type
49638 ,p_event_type_code => l_event_type_code
49639 ,p_line_definition_owner_code => l_line_definition_owner_code
49640 ,p_line_definition_code => l_line_definition_code
49641 ,p_accounting_line_code => l_component_code
49642 ,p_accounting_line_type_code => l_component_type_code
49643 ,p_accounting_line_appl_id => l_component_appl_id
49644 ,p_amb_context_code => l_amb_context_code
49645 ,p_entity_code => l_entity_code
49646 ,p_event_class_code => l_event_class_code);
49647 --
49648 -- set accounting class
49649 --
49650 xla_ae_lines_pkg.SetAcctClass(
49651 p_accounting_class_code => 'ASSET'
49652 , p_ae_header_id => l_ae_header_id
49653 );
49654
49655 --
49656 -- set rounding class
49657 --
49658 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
49659 'ASSET';
49660
49661 --
49662 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
49663 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
49664 --
49665 -- bulk performance
49666 --
49667 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
49668
49669 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
49670 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
49671
49672 -- 4955764
49673 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
49674 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
49675
49676 -- 4458381 Public Sector Enh
49677
49678 --
49679 -- set accounting attributes for the line type
49680 --
49681 l_entered_amt_idx := 4;
49682 l_accted_amt_idx := 6;
49683 l_bflow_applied_to_amt_idx := NULL; -- 5132302
49684 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
49685 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
49686 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
49687 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
49688 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
49689 l_rec_acct_attrs.array_char_value(3) := p_source_51;
49690 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
49691 l_rec_acct_attrs.array_num_value(4) := p_source_52;
49692 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
49693 l_rec_acct_attrs.array_char_value(5) := p_source_53;
49694 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
49695 l_rec_acct_attrs.array_num_value(6) := p_source_52;
49696
49697 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
49698 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
49699
49700 ---------------------------------------------------------------------------------------------------------------
49701 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
49702 ---------------------------------------------------------------------------------------------------------------
49703 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
49704
49705 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
49706 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
49707
49708 IF xla_accounting_cache_pkg.GetValueChar
49709 (p_source_code => 'LEDGER_CATEGORY_CODE'
49710 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
49711 AND l_bflow_method_code = 'PRIOR_ENTRY'
49712 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
49713 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
49714 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
49715 )
49716 THEN
49717 xla_ae_lines_pkg.BflowUpgEntry
49718 (p_business_method_code => l_bflow_method_code
49719 ,p_business_class_code => l_bflow_class_code
49720 ,p_balance_type => l_balance_type_code);
49721 ELSE
49722 NULL;
49723 -- No business flow processing for business flow method of NONE.
49724 END IF;
49725
49726 --
49727 -- call analytical criteria
49728 --
49729
49730 --
49731 -- call description
49732 --
49733
49734 xla_ae_lines_pkg.SetLineDescription(
49735 p_ae_header_id => l_ae_header_id
49736 ,p_description => Description_38 (
49737 p_application_id => p_application_id
49738 , p_ae_header_id => l_ae_header_id
49739 , p_source_1 => p_source_1
49740 )
49741 );
49742
49743
49744 --
49745 -- call ADRs
49746 -- Bug 4922099
49747 --
49748 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
49752 THEN
49749 (NVL(l_actual_upg_option, 'N') = 'O') OR
49750 (NVL(l_enc_upg_option, 'N') = 'O')
49751 )
49753 NULL;
49754 --
49755 --
49756
49757 l_ccid := AcctDerRule_174(
49758 p_application_id => p_application_id
49759 , p_ae_header_id => l_ae_header_id
49760 , p_source_5 => p_source_5
49761 , p_source_32 => p_source_32
49762 , x_transaction_coa_id => l_adr_transaction_coa_id
49763 , x_accounting_coa_id => l_adr_accounting_coa_id
49764 , x_value_type_code => l_adr_value_type_code
49765 , p_side => 'NA'
49766 );
49767
49768 xla_ae_lines_pkg.set_ccid(
49769 p_code_combination_id => l_ccid
49770 , p_value_type_code => l_adr_value_type_code
49771 , p_transaction_coa_id => l_adr_transaction_coa_id
49772 , p_accounting_coa_id => l_adr_accounting_coa_id
49773 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
49774 , p_adr_type_code => 'S'
49775 , p_component_type => l_component_type
49776 , p_component_code => l_component_code
49777 , p_component_type_code => l_component_type_code
49778 , p_component_appl_id => l_component_appl_id
49779 , p_amb_context_code => l_amb_context_code
49780 , p_side => 'NA'
49781 );
49782
49783
49784 l_segment := AcctDerRule_169(
49785 p_application_id => p_application_id
49786 , p_ae_header_id => l_ae_header_id
49787 , p_source_5 => p_source_5
49788 , p_source_31 => p_source_31
49789 , x_transaction_coa_id => l_adr_transaction_coa_id
49790 , x_accounting_coa_id => l_adr_accounting_coa_id
49791 , x_flexfield_segment_code => l_adr_flexfield_segment_code
49792 , x_flex_value_set_id => l_adr_flex_value_set_id
49793 , x_value_type_code => l_adr_value_type_code
49794 , x_value_combination_id => l_adr_value_combination_id
49795 , x_value_segment_code => l_adr_value_segment_code
49796 , p_side => 'NA'
49797 , p_override_seg_flag => 'Y'
49798 );
49799
49800 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
49801
49802 xla_ae_lines_pkg.set_segment(
49803 p_to_segment_code => 'GL_BALANCING'
49804 , p_segment_value => l_segment
49805 , p_from_segment_code => l_adr_value_segment_code
49806 , p_from_combination_id => l_adr_value_combination_id
49807 , p_value_type_code => l_adr_value_type_code
49808 , p_transaction_coa_id => l_adr_transaction_coa_id
49809 , p_accounting_coa_id => l_adr_accounting_coa_id
49810 , p_flexfield_segment_code => l_adr_flexfield_segment_code
49811 , p_flex_value_set_id => l_adr_flex_value_set_id
49812 , p_adr_code => 'FA_EXPENSE_ACCT'
49813 , p_adr_type_code => 'S'
49814 , p_component_type => l_component_type
49815 , p_component_code => l_component_code
49816 , p_component_type_code => l_component_type_code
49817 , p_component_appl_id => l_component_appl_id
49818 , p_amb_context_code => l_amb_context_code
49819 , p_entity_code => 'TRANSACTIONS'
49820 , p_event_class_code => 'CIP_RETIREMENTS'
49821 , p_side => 'NA'
49822 );
49823
49824 END IF;
49825
49826 l_segment := AcctDerRule_162(
49827 p_application_id => p_application_id
49828 , p_ae_header_id => l_ae_header_id
49829 , p_source_5 => p_source_5
49830 , p_source_25 => p_source_25
49831 , x_transaction_coa_id => l_adr_transaction_coa_id
49832 , x_accounting_coa_id => l_adr_accounting_coa_id
49833 , x_flexfield_segment_code => l_adr_flexfield_segment_code
49834 , x_flex_value_set_id => l_adr_flex_value_set_id
49835 , x_value_type_code => l_adr_value_type_code
49836 , x_value_combination_id => l_adr_value_combination_id
49837 , x_value_segment_code => l_adr_value_segment_code
49838 , p_side => 'NA'
49839 , p_override_seg_flag => 'Y'
49840 );
49841
49842 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
49843
49844 xla_ae_lines_pkg.set_segment(
49845 p_to_segment_code => 'GL_ACCOUNT'
49846 , p_segment_value => l_segment
49847 , p_from_segment_code => l_adr_value_segment_code
49848 , p_from_combination_id => l_adr_value_combination_id
49849 , p_value_type_code => l_adr_value_type_code
49850 , p_transaction_coa_id => l_adr_transaction_coa_id
49851 , p_accounting_coa_id => l_adr_accounting_coa_id
49852 , p_flexfield_segment_code => l_adr_flexfield_segment_code
49853 , p_flex_value_set_id => l_adr_flex_value_set_id
49854 , p_adr_code => 'FA_PROC_OF_SALE_CLR_SEGMENT'
49855 , p_adr_type_code => 'S'
49856 , p_component_type => l_component_type
49857 , p_component_code => l_component_code
49858 , p_component_type_code => l_component_type_code
49862 , p_event_class_code => 'CIP_RETIREMENTS'
49859 , p_component_appl_id => l_component_appl_id
49860 , p_amb_context_code => l_amb_context_code
49861 , p_entity_code => 'TRANSACTIONS'
49863 , p_side => 'NA'
49864 );
49865
49866 END IF;
49867
49868 --
49869 --
49870 END IF;
49871 --
49872 -- Bug 4922099
49873 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
49874 (NVL(l_enc_upg_option, 'N') = 'O')
49875 ) AND
49876 (l_bflow_method_code = 'PRIOR_ENTRY')
49877 )
49878 THEN
49879 IF
49880 --
49881 1 = 2
49882 --
49883 THEN
49884 xla_accounting_err_pkg.build_message
49885 (p_appli_s_name => 'XLA'
49886 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
49887 ,p_token_1 => 'LINE_NUMBER'
49888 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
49889 ,p_token_2 => 'LINE_TYPE_NAME'
49890 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
49891 l_component_type
49892 ,l_component_code
49893 ,l_component_type_code
49894 ,l_component_appl_id
49895 ,l_amb_context_code
49896 ,l_entity_code
49897 ,l_event_class_code
49898 )
49899 ,p_token_3 => 'OWNER'
49900 ,p_value_3 => xla_lookups_pkg.get_meaning(
49901 p_lookup_type => 'XLA_OWNER_TYPE'
49902 ,p_lookup_code => l_component_type_code
49903 )
49904 ,p_token_4 => 'PRODUCT_NAME'
49905 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
49906 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
49907 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
49908 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
49909 ,p_ae_header_id => NULL
49910 );
49911
49912 IF (C_LEVEL_ERROR>= g_log_level) THEN
49913 trace
49914 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
49915 ,p_level => C_LEVEL_ERROR
49916 ,p_module => l_log_module);
49917 END IF;
49918 END IF;
49919 END IF;
49920 --
49921 --
49922 ------------------------------------------------------------------------------------------------
49923 -- 4219869 Business Flow
49924 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
49925 -- Prior Entry. Currently, the following code is always generated.
49926 ------------------------------------------------------------------------------------------------
49927 XLA_AE_LINES_PKG.ValidateCurrentLine;
49928
49929 ------------------------------------------------------------------------------------
49930 -- 4219869 Business Flow
49931 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
49932 ------------------------------------------------------------------------------------
49933 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
49934
49935 ----------------------------------------------------------------------------------
49936 -- 4219869 Business Flow
49937 -- Update journal entry status -- Need to generate this within IF <condition>
49938 ----------------------------------------------------------------------------------
49939 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
49940 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
49941 ,p_balance_type_code => l_balance_type_code
49942 );
49943
49944 -------------------------------------------------------------------------------------------
49945 -- 4262811 - Generate the Accrual Reversal lines
49946 -------------------------------------------------------------------------------------------
49947 BEGIN
49948 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
49949 (g_array_event(p_event_id).array_value_num('header_index'));
49950 IF l_acc_rev_flag IS NULL THEN
49951 l_acc_rev_flag := 'N';
49952 END IF;
49953 EXCEPTION
49954 WHEN OTHERS THEN
49955 l_acc_rev_flag := 'N';
49956 END;
49957 --
49961 -- To allow MPA report to determine if it should generate report process
49958 IF (l_acc_rev_flag = 'Y') THEN
49959
49960 -- 4645092 ------------------------------------------------------------------------------
49962 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
49963 ------------------------------------------------------------------------------------------
49964
49965 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
49966 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
49967 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
49968 -- call ADRs
49969 -- Bug 4922099
49970 --
49971 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
49972 (NVL(l_actual_upg_option, 'N') = 'O') OR
49973 (NVL(l_enc_upg_option, 'N') = 'O')
49974 )
49975 THEN
49976 NULL;
49977 --
49978 --
49979
49980 l_ccid := AcctDerRule_174(
49981 p_application_id => p_application_id
49982 , p_ae_header_id => l_ae_header_id
49983 , p_source_5 => p_source_5
49984 , p_source_32 => p_source_32
49985 , x_transaction_coa_id => l_adr_transaction_coa_id
49986 , x_accounting_coa_id => l_adr_accounting_coa_id
49987 , x_value_type_code => l_adr_value_type_code
49988 , p_side => 'NA'
49989 );
49990
49991 xla_ae_lines_pkg.set_ccid(
49992 p_code_combination_id => l_ccid
49993 , p_value_type_code => l_adr_value_type_code
49994 , p_transaction_coa_id => l_adr_transaction_coa_id
49995 , p_accounting_coa_id => l_adr_accounting_coa_id
49996 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
49997 , p_adr_type_code => 'S'
49998 , p_component_type => l_component_type
49999 , p_component_code => l_component_code
50000 , p_component_type_code => l_component_type_code
50001 , p_component_appl_id => l_component_appl_id
50002 , p_amb_context_code => l_amb_context_code
50003 , p_side => 'NA'
50004 );
50005
50006
50007 l_segment := AcctDerRule_169(
50008 p_application_id => p_application_id
50009 , p_ae_header_id => l_ae_header_id
50010 , p_source_5 => p_source_5
50011 , p_source_31 => p_source_31
50012 , x_transaction_coa_id => l_adr_transaction_coa_id
50013 , x_accounting_coa_id => l_adr_accounting_coa_id
50014 , x_flexfield_segment_code => l_adr_flexfield_segment_code
50015 , x_flex_value_set_id => l_adr_flex_value_set_id
50016 , x_value_type_code => l_adr_value_type_code
50017 , x_value_combination_id => l_adr_value_combination_id
50018 , x_value_segment_code => l_adr_value_segment_code
50019 , p_side => 'NA'
50020 , p_override_seg_flag => 'Y'
50021 );
50022
50023 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
50024
50025 xla_ae_lines_pkg.set_segment(
50026 p_to_segment_code => 'GL_BALANCING'
50027 , p_segment_value => l_segment
50028 , p_from_segment_code => l_adr_value_segment_code
50029 , p_from_combination_id => l_adr_value_combination_id
50030 , p_value_type_code => l_adr_value_type_code
50031 , p_transaction_coa_id => l_adr_transaction_coa_id
50032 , p_accounting_coa_id => l_adr_accounting_coa_id
50033 , p_flexfield_segment_code => l_adr_flexfield_segment_code
50034 , p_flex_value_set_id => l_adr_flex_value_set_id
50035 , p_adr_code => 'FA_EXPENSE_ACCT'
50036 , p_adr_type_code => 'S'
50037 , p_component_type => l_component_type
50038 , p_component_code => l_component_code
50039 , p_component_type_code => l_component_type_code
50040 , p_component_appl_id => l_component_appl_id
50041 , p_amb_context_code => l_amb_context_code
50042 , p_entity_code => 'TRANSACTIONS'
50043 , p_event_class_code => 'CIP_RETIREMENTS'
50044 , p_side => 'NA'
50045 );
50046
50047 END IF;
50048
50049 l_segment := AcctDerRule_162(
50050 p_application_id => p_application_id
50051 , p_ae_header_id => l_ae_header_id
50052 , p_source_5 => p_source_5
50053 , p_source_25 => p_source_25
50054 , x_transaction_coa_id => l_adr_transaction_coa_id
50055 , x_accounting_coa_id => l_adr_accounting_coa_id
50056 , x_flexfield_segment_code => l_adr_flexfield_segment_code
50057 , x_flex_value_set_id => l_adr_flex_value_set_id
50058 , x_value_type_code => l_adr_value_type_code
50059 , x_value_combination_id => l_adr_value_combination_id
50060 , x_value_segment_code => l_adr_value_segment_code
50061 , p_side => 'NA'
50062 , p_override_seg_flag => 'Y'
50063 );
50064
50065 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
50066
50067 xla_ae_lines_pkg.set_segment(
50068 p_to_segment_code => 'GL_ACCOUNT'
50069 , p_segment_value => l_segment
50070 , p_from_segment_code => l_adr_value_segment_code
50071 , p_from_combination_id => l_adr_value_combination_id
50075 , p_flexfield_segment_code => l_adr_flexfield_segment_code
50072 , p_value_type_code => l_adr_value_type_code
50073 , p_transaction_coa_id => l_adr_transaction_coa_id
50074 , p_accounting_coa_id => l_adr_accounting_coa_id
50076 , p_flex_value_set_id => l_adr_flex_value_set_id
50077 , p_adr_code => 'FA_PROC_OF_SALE_CLR_SEGMENT'
50078 , p_adr_type_code => 'S'
50079 , p_component_type => l_component_type
50080 , p_component_code => l_component_code
50081 , p_component_type_code => l_component_type_code
50082 , p_component_appl_id => l_component_appl_id
50083 , p_amb_context_code => l_amb_context_code
50084 , p_entity_code => 'TRANSACTIONS'
50085 , p_event_class_code => 'CIP_RETIREMENTS'
50086 , p_side => 'NA'
50087 );
50088
50089 END IF;
50090
50091 --
50092 --
50093 END IF;
50094
50095 --
50096 -- Update the line information that should be overwritten
50097 --
50098 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
50099 p_header_num => 1);
50100 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
50101
50102 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
50103
50104 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
50105 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
50106 END IF;
50107
50108 --
50109 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
50110 --
50111 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
50112 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
50113 ELSE
50114 ---------------------------------------------------------------------------------------------------
50115 -- 4262811a Switch Sign
50116 ---------------------------------------------------------------------------------------------------
50117 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
50118 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
50119 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
50120 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
50121 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
50122 -- 5132302
50123 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
50124 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
50125
50126 END IF;
50127
50128 -- 4955764
50129 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
50130 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
50131
50132
50133 XLA_AE_LINES_PKG.ValidateCurrentLine;
50134 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
50135
50136 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
50137 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
50138 ,p_balance_type_code => l_balance_type_code);
50139
50140 END IF;
50141
50142 -----------------------------------------------------------------------------------------
50143 -- 4262811 Multiperiod Accounting
50144 -----------------------------------------------------------------------------------------
50145 -- No MPA option is assigned.
50146
50147
50148 END IF;
50149 END IF;
50150 --
50151
50152 --
50153 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
50154 trace
50155 (p_msg => 'END of AcctLineType_234'
50156 ,p_level => C_LEVEL_PROCEDURE
50157 ,p_module => l_log_module);
50158 END IF;
50159 --
50160 EXCEPTION
50161 WHEN xla_exceptions_pkg.application_exception THEN
50162 RAISE;
50163 WHEN OTHERS THEN
50164 xla_exceptions_pkg.raise_message
50165 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_234');
50166 END AcctLineType_234;
50167 --
50168
50169 ---------------------------------------
50170 --
50171 -- PRIVATE FUNCTION
50172 -- AcctLineType_235
50173 --
50174 ---------------------------------------
50175 PROCEDURE AcctLineType_235 (
50176 p_application_id IN NUMBER
50177 ,p_event_id IN NUMBER
50178 ,p_calculate_acctd_flag IN VARCHAR2
50179 ,p_calculate_g_l_flag IN VARCHAR2
50180 ,p_actual_flag IN OUT VARCHAR2
50181 ,p_balance_type_code OUT VARCHAR2
50182 ,p_gain_or_loss_ref OUT VARCHAR2
50183
50184 --Period Close Date
50185 , p_source_1 IN DATE
50186 --Generated Code Combination Identifier
50187 , p_source_5 IN NUMBER
50188 --Proceeds Of Sale Gain Account
50189 , p_source_26 IN VARCHAR2
50190 --Expense Account Code Combination Identifier
50194 --Adjustment Type
50191 , p_source_31 IN NUMBER
50192 --Default Code Combination Identifier
50193 , p_source_32 IN NUMBER
50195 , p_source_48 IN VARCHAR2
50196 --Transaction Header Identifier
50197 , p_source_49 IN NUMBER
50198 --Adjustment Line Identifier
50199 , p_source_50 IN NUMBER
50200 --Distribution Type Code
50201 , p_source_51 IN VARCHAR2
50202 --Entered Amount
50203 , p_source_52 IN NUMBER
50204 --Currency Code
50205 , p_source_53 IN VARCHAR2
50206 --Gain Loss Amount
50207 , p_source_54 IN NUMBER
50208 )
50209 IS
50210
50211 l_component_type VARCHAR2(80);
50212 l_component_code VARCHAR2(30);
50213 l_component_type_code VARCHAR2(1);
50214 l_component_appl_id INTEGER;
50215 l_amb_context_code VARCHAR2(30);
50216 l_entity_code VARCHAR2(30);
50217 l_event_class_code VARCHAR2(30);
50218 l_ae_header_id NUMBER;
50219 l_event_type_code VARCHAR2(30);
50220 l_line_definition_code VARCHAR2(30);
50221 l_line_definition_owner_code VARCHAR2(1);
50222 --
50223 -- adr variables
50224 l_segment VARCHAR2(30);
50225 l_ccid NUMBER;
50226 l_adr_transaction_coa_id NUMBER;
50227 l_adr_accounting_coa_id NUMBER;
50228 l_adr_flexfield_segment_code VARCHAR2(30);
50229 l_adr_flex_value_set_id NUMBER;
50230 l_adr_value_type_code VARCHAR2(30);
50231 l_adr_value_combination_id NUMBER;
50232 l_adr_value_segment_code VARCHAR2(30);
50233
50234 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
50235 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
50236 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
50237 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
50238
50239 -- 4262811 Variables ------------------------------------------------------------------------------------------
50240 l_entered_amt_idx NUMBER;
50241 l_accted_amt_idx NUMBER;
50242 l_acc_rev_flag VARCHAR2(1);
50243 l_accrual_line_num NUMBER;
50244 l_tmp_amt NUMBER;
50245 l_acc_rev_natural_side_code VARCHAR2(1);
50246
50247 l_num_entries NUMBER;
50248 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
50249 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
50250 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
50251 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
50252 l_recog_line_1 NUMBER;
50253 l_recog_line_2 NUMBER;
50254
50255 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
50256 l_bflow_applied_to_amt NUMBER; -- 5132302
50257 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
50258
50259 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
50260
50261 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
50262 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
50263
50264 ---------------------------------------------------------------------------------------------------------------
50265
50266
50267 --
50268 -- bulk performance
50269 --
50270 l_balance_type_code VARCHAR2(1);
50271 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
50272 l_log_module VARCHAR2(240);
50273
50274 --
50275 -- Upgrade strategy
50276 --
50277 l_actual_upg_option VARCHAR2(1);
50278 l_enc_upg_option VARCHAR2(1);
50279
50280 --
50281 BEGIN
50282 --
50283 IF g_log_enabled THEN
50284 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_235';
50285 END IF;
50286 --
50287 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
50288
50289 trace
50290 (p_msg => 'BEGIN of AcctLineType_235'
50291 ,p_level => C_LEVEL_PROCEDURE
50292 ,p_module => l_log_module);
50293
50294 END IF;
50295 --
50296 l_component_type := 'AMB_JLT';
50297 l_component_code := 'FA_CIP_PROC_OF_SALE_GAIN';
50298 l_component_type_code := 'S';
50299 l_component_appl_id := 140;
50300 l_amb_context_code := 'DEFAULT';
50301 l_entity_code := 'TRANSACTIONS';
50302 l_event_class_code := 'CIP_RETIREMENTS';
50303 l_event_type_code := 'CIP_RETIREMENTS';
50304 l_line_definition_owner_code := 'S';
50305 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
50306 --
50307 l_balance_type_code := 'A';
50308 l_segment := NULL;
50309 l_ccid := NULL;
50310 l_adr_transaction_coa_id := NULL;
50311 l_adr_accounting_coa_id := NULL;
50312 l_adr_flexfield_segment_code := NULL;
50313 l_adr_flex_value_set_id := NULL;
50314 l_adr_value_type_code := NULL;
50315 l_adr_value_combination_id := NULL;
50316 l_adr_value_segment_code := NULL;
50317
50318 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
50319 l_bflow_class_code := ''; -- 4219869 Business Flow
50323 l_bflow_applied_to_amt_idx := NULL; -- 5132302
50320 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
50321 l_budgetary_control_flag := 'N';
50322
50324 l_bflow_applied_to_amt := NULL; -- 5132302
50325 l_entered_amt_idx := NULL; -- 4262811
50326 l_accted_amt_idx := NULL; -- 4262811
50327 l_acc_rev_flag := NULL; -- 4262811
50328 l_accrual_line_num := NULL; -- 4262811
50329 l_tmp_amt := NULL; -- 4262811
50330 --
50331
50332 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
50333 l_balance_type_code <> 'B' THEN
50334 IF NVL(p_source_48,'
50335 ') = 'PROCEEDS' AND
50336 p_source_54 >= 0
50337 THEN
50338
50339 --
50340 XLA_AE_LINES_PKG.SetNewLine;
50341
50342 p_balance_type_code := l_balance_type_code;
50343 -- set the flag so later we will know whether the gain loss line needs to be created
50344
50345 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
50346 p_actual_flag :='A';
50347 END IF;
50348
50349 --
50350 -- bulk performance
50351 --
50352 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
50353 p_header_num => 0); -- 4262811
50354 --
50355 -- set accounting line options
50356 --
50357 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
50358 p_natural_side_code => 'C'
50359 , p_gain_or_loss_flag => 'N'
50360 , p_gl_transfer_mode_code => 'S'
50361 , p_acct_entry_type_code => 'A'
50362 , p_switch_side_flag => 'Y'
50363 , p_merge_duplicate_code => 'N'
50364 );
50365 --
50366 l_acc_rev_natural_side_code := 'D'; -- 4262811
50367 --
50368 --
50369 -- set accounting line type info
50370 --
50371 xla_ae_lines_pkg.SetAcctLineType
50372 (p_component_type => l_component_type
50373 ,p_event_type_code => l_event_type_code
50374 ,p_line_definition_owner_code => l_line_definition_owner_code
50375 ,p_line_definition_code => l_line_definition_code
50376 ,p_accounting_line_code => l_component_code
50377 ,p_accounting_line_type_code => l_component_type_code
50378 ,p_accounting_line_appl_id => l_component_appl_id
50379 ,p_amb_context_code => l_amb_context_code
50380 ,p_entity_code => l_entity_code
50381 ,p_event_class_code => l_event_class_code);
50382 --
50383 -- set accounting class
50384 --
50385 xla_ae_lines_pkg.SetAcctClass(
50386 p_accounting_class_code => 'ASSET'
50387 , p_ae_header_id => l_ae_header_id
50388 );
50389
50390 --
50391 -- set rounding class
50392 --
50393 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
50394 'ASSET';
50395
50396 --
50397 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
50398 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
50399 --
50400 -- bulk performance
50401 --
50402 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
50403
50404 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
50405 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
50406
50407 -- 4955764
50408 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
50409 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
50410
50411 -- 4458381 Public Sector Enh
50412
50413 --
50414 -- set accounting attributes for the line type
50415 --
50416 l_entered_amt_idx := 4;
50417 l_accted_amt_idx := 6;
50418 l_bflow_applied_to_amt_idx := NULL; -- 5132302
50419 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
50420 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
50421 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
50422 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
50423 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
50424 l_rec_acct_attrs.array_char_value(3) := p_source_51;
50425 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
50426 l_rec_acct_attrs.array_num_value(4) := p_source_52;
50427 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
50428 l_rec_acct_attrs.array_char_value(5) := p_source_53;
50429 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
50430 l_rec_acct_attrs.array_num_value(6) := p_source_52;
50431
50432 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
50433 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
50434
50435 ---------------------------------------------------------------------------------------------------------------
50436 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
50440 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
50437 ---------------------------------------------------------------------------------------------------------------
50438 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
50439
50441 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
50442
50443 IF xla_accounting_cache_pkg.GetValueChar
50444 (p_source_code => 'LEDGER_CATEGORY_CODE'
50445 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
50446 AND l_bflow_method_code = 'PRIOR_ENTRY'
50447 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
50448 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
50449 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
50450 )
50451 THEN
50452 xla_ae_lines_pkg.BflowUpgEntry
50453 (p_business_method_code => l_bflow_method_code
50454 ,p_business_class_code => l_bflow_class_code
50455 ,p_balance_type => l_balance_type_code);
50456 ELSE
50457 NULL;
50458 -- No business flow processing for business flow method of NONE.
50459 END IF;
50460
50461 --
50462 -- call analytical criteria
50463 --
50464
50465 --
50466 -- call description
50467 --
50468
50469 xla_ae_lines_pkg.SetLineDescription(
50470 p_ae_header_id => l_ae_header_id
50471 ,p_description => Description_35 (
50472 p_application_id => p_application_id
50473 , p_ae_header_id => l_ae_header_id
50474 , p_source_1 => p_source_1
50475 )
50476 );
50477
50478
50479 --
50480 -- call ADRs
50481 -- Bug 4922099
50482 --
50483 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
50484 (NVL(l_actual_upg_option, 'N') = 'O') OR
50485 (NVL(l_enc_upg_option, 'N') = 'O')
50486 )
50487 THEN
50488 NULL;
50489 --
50490 --
50491
50492 l_ccid := AcctDerRule_174(
50493 p_application_id => p_application_id
50494 , p_ae_header_id => l_ae_header_id
50495 , p_source_5 => p_source_5
50496 , p_source_32 => p_source_32
50497 , x_transaction_coa_id => l_adr_transaction_coa_id
50498 , x_accounting_coa_id => l_adr_accounting_coa_id
50499 , x_value_type_code => l_adr_value_type_code
50500 , p_side => 'NA'
50501 );
50502
50503 xla_ae_lines_pkg.set_ccid(
50504 p_code_combination_id => l_ccid
50505 , p_value_type_code => l_adr_value_type_code
50506 , p_transaction_coa_id => l_adr_transaction_coa_id
50507 , p_accounting_coa_id => l_adr_accounting_coa_id
50508 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
50509 , p_adr_type_code => 'S'
50510 , p_component_type => l_component_type
50511 , p_component_code => l_component_code
50512 , p_component_type_code => l_component_type_code
50513 , p_component_appl_id => l_component_appl_id
50514 , p_amb_context_code => l_amb_context_code
50515 , p_side => 'NA'
50516 );
50517
50518
50519 l_segment := AcctDerRule_169(
50520 p_application_id => p_application_id
50521 , p_ae_header_id => l_ae_header_id
50522 , p_source_5 => p_source_5
50523 , p_source_31 => p_source_31
50524 , x_transaction_coa_id => l_adr_transaction_coa_id
50525 , x_accounting_coa_id => l_adr_accounting_coa_id
50526 , x_flexfield_segment_code => l_adr_flexfield_segment_code
50527 , x_flex_value_set_id => l_adr_flex_value_set_id
50528 , x_value_type_code => l_adr_value_type_code
50529 , x_value_combination_id => l_adr_value_combination_id
50530 , x_value_segment_code => l_adr_value_segment_code
50531 , p_side => 'NA'
50532 , p_override_seg_flag => 'Y'
50533 );
50534
50535 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
50536
50537 xla_ae_lines_pkg.set_segment(
50538 p_to_segment_code => 'GL_BALANCING'
50539 , p_segment_value => l_segment
50540 , p_from_segment_code => l_adr_value_segment_code
50541 , p_from_combination_id => l_adr_value_combination_id
50542 , p_value_type_code => l_adr_value_type_code
50543 , p_transaction_coa_id => l_adr_transaction_coa_id
50544 , p_accounting_coa_id => l_adr_accounting_coa_id
50545 , p_flexfield_segment_code => l_adr_flexfield_segment_code
50546 , p_flex_value_set_id => l_adr_flex_value_set_id
50547 , p_adr_code => 'FA_EXPENSE_ACCT'
50548 , p_adr_type_code => 'S'
50549 , p_component_type => l_component_type
50550 , p_component_code => l_component_code
50551 , p_component_type_code => l_component_type_code
50552 , p_component_appl_id => l_component_appl_id
50553 , p_amb_context_code => l_amb_context_code
50554 , p_entity_code => 'TRANSACTIONS'
50555 , p_event_class_code => 'CIP_RETIREMENTS'
50556 , p_side => 'NA'
50557 );
50558
50559 END IF;
50563 , p_ae_header_id => l_ae_header_id
50560
50561 l_segment := AcctDerRule_163(
50562 p_application_id => p_application_id
50564 , p_source_5 => p_source_5
50565 , p_source_26 => p_source_26
50566 , x_transaction_coa_id => l_adr_transaction_coa_id
50567 , x_accounting_coa_id => l_adr_accounting_coa_id
50568 , x_flexfield_segment_code => l_adr_flexfield_segment_code
50569 , x_flex_value_set_id => l_adr_flex_value_set_id
50570 , x_value_type_code => l_adr_value_type_code
50571 , x_value_combination_id => l_adr_value_combination_id
50572 , x_value_segment_code => l_adr_value_segment_code
50573 , p_side => 'NA'
50574 , p_override_seg_flag => 'Y'
50575 );
50576
50577 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
50578
50579 xla_ae_lines_pkg.set_segment(
50580 p_to_segment_code => 'GL_ACCOUNT'
50581 , p_segment_value => l_segment
50582 , p_from_segment_code => l_adr_value_segment_code
50583 , p_from_combination_id => l_adr_value_combination_id
50584 , p_value_type_code => l_adr_value_type_code
50585 , p_transaction_coa_id => l_adr_transaction_coa_id
50586 , p_accounting_coa_id => l_adr_accounting_coa_id
50587 , p_flexfield_segment_code => l_adr_flexfield_segment_code
50588 , p_flex_value_set_id => l_adr_flex_value_set_id
50589 , p_adr_code => 'FA_PROC_OF_SALE_GAIN_SEGMENT'
50590 , p_adr_type_code => 'S'
50591 , p_component_type => l_component_type
50592 , p_component_code => l_component_code
50593 , p_component_type_code => l_component_type_code
50594 , p_component_appl_id => l_component_appl_id
50595 , p_amb_context_code => l_amb_context_code
50596 , p_entity_code => 'TRANSACTIONS'
50597 , p_event_class_code => 'CIP_RETIREMENTS'
50598 , p_side => 'NA'
50599 );
50600
50601 END IF;
50602
50603 --
50604 --
50605 END IF;
50606 --
50607 -- Bug 4922099
50608 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
50609 (NVL(l_enc_upg_option, 'N') = 'O')
50610 ) AND
50611 (l_bflow_method_code = 'PRIOR_ENTRY')
50612 )
50613 THEN
50614 IF
50615 --
50616 1 = 2
50617 --
50618 THEN
50619 xla_accounting_err_pkg.build_message
50620 (p_appli_s_name => 'XLA'
50621 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
50622 ,p_token_1 => 'LINE_NUMBER'
50623 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
50624 ,p_token_2 => 'LINE_TYPE_NAME'
50625 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
50626 l_component_type
50627 ,l_component_code
50628 ,l_component_type_code
50629 ,l_component_appl_id
50630 ,l_amb_context_code
50631 ,l_entity_code
50632 ,l_event_class_code
50633 )
50634 ,p_token_3 => 'OWNER'
50635 ,p_value_3 => xla_lookups_pkg.get_meaning(
50636 p_lookup_type => 'XLA_OWNER_TYPE'
50637 ,p_lookup_code => l_component_type_code
50638 )
50639 ,p_token_4 => 'PRODUCT_NAME'
50640 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
50641 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
50642 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
50643 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
50644 ,p_ae_header_id => NULL
50645 );
50646
50647 IF (C_LEVEL_ERROR>= g_log_level) THEN
50648 trace
50649 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
50650 ,p_level => C_LEVEL_ERROR
50651 ,p_module => l_log_module);
50652 END IF;
50653 END IF;
50654 END IF;
50655 --
50656 --
50657 ------------------------------------------------------------------------------------------------
50658 -- 4219869 Business Flow
50662 XLA_AE_LINES_PKG.ValidateCurrentLine;
50659 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
50660 -- Prior Entry. Currently, the following code is always generated.
50661 ------------------------------------------------------------------------------------------------
50663
50664 ------------------------------------------------------------------------------------
50665 -- 4219869 Business Flow
50666 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
50667 ------------------------------------------------------------------------------------
50668 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
50669
50670 ----------------------------------------------------------------------------------
50671 -- 4219869 Business Flow
50672 -- Update journal entry status -- Need to generate this within IF <condition>
50673 ----------------------------------------------------------------------------------
50674 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
50675 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
50676 ,p_balance_type_code => l_balance_type_code
50677 );
50678
50679 -------------------------------------------------------------------------------------------
50680 -- 4262811 - Generate the Accrual Reversal lines
50681 -------------------------------------------------------------------------------------------
50682 BEGIN
50683 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
50684 (g_array_event(p_event_id).array_value_num('header_index'));
50685 IF l_acc_rev_flag IS NULL THEN
50686 l_acc_rev_flag := 'N';
50687 END IF;
50688 EXCEPTION
50689 WHEN OTHERS THEN
50690 l_acc_rev_flag := 'N';
50691 END;
50692 --
50693 IF (l_acc_rev_flag = 'Y') THEN
50694
50695 -- 4645092 ------------------------------------------------------------------------------
50696 -- To allow MPA report to determine if it should generate report process
50697 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
50698 ------------------------------------------------------------------------------------------
50699
50700 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
50701 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
50702 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
50703 -- call ADRs
50704 -- Bug 4922099
50705 --
50706 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
50707 (NVL(l_actual_upg_option, 'N') = 'O') OR
50708 (NVL(l_enc_upg_option, 'N') = 'O')
50709 )
50710 THEN
50711 NULL;
50712 --
50713 --
50714
50715 l_ccid := AcctDerRule_174(
50716 p_application_id => p_application_id
50717 , p_ae_header_id => l_ae_header_id
50718 , p_source_5 => p_source_5
50719 , p_source_32 => p_source_32
50720 , x_transaction_coa_id => l_adr_transaction_coa_id
50721 , x_accounting_coa_id => l_adr_accounting_coa_id
50722 , x_value_type_code => l_adr_value_type_code
50723 , p_side => 'NA'
50724 );
50725
50726 xla_ae_lines_pkg.set_ccid(
50727 p_code_combination_id => l_ccid
50728 , p_value_type_code => l_adr_value_type_code
50729 , p_transaction_coa_id => l_adr_transaction_coa_id
50730 , p_accounting_coa_id => l_adr_accounting_coa_id
50731 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
50732 , p_adr_type_code => 'S'
50733 , p_component_type => l_component_type
50734 , p_component_code => l_component_code
50735 , p_component_type_code => l_component_type_code
50736 , p_component_appl_id => l_component_appl_id
50737 , p_amb_context_code => l_amb_context_code
50738 , p_side => 'NA'
50739 );
50740
50741
50742 l_segment := AcctDerRule_169(
50743 p_application_id => p_application_id
50744 , p_ae_header_id => l_ae_header_id
50745 , p_source_5 => p_source_5
50746 , p_source_31 => p_source_31
50747 , x_transaction_coa_id => l_adr_transaction_coa_id
50748 , x_accounting_coa_id => l_adr_accounting_coa_id
50749 , x_flexfield_segment_code => l_adr_flexfield_segment_code
50750 , x_flex_value_set_id => l_adr_flex_value_set_id
50751 , x_value_type_code => l_adr_value_type_code
50752 , x_value_combination_id => l_adr_value_combination_id
50753 , x_value_segment_code => l_adr_value_segment_code
50754 , p_side => 'NA'
50755 , p_override_seg_flag => 'Y'
50756 );
50757
50758 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
50759
50760 xla_ae_lines_pkg.set_segment(
50761 p_to_segment_code => 'GL_BALANCING'
50762 , p_segment_value => l_segment
50763 , p_from_segment_code => l_adr_value_segment_code
50764 , p_from_combination_id => l_adr_value_combination_id
50765 , p_value_type_code => l_adr_value_type_code
50766 , p_transaction_coa_id => l_adr_transaction_coa_id
50767 , p_accounting_coa_id => l_adr_accounting_coa_id
50771 , p_adr_type_code => 'S'
50768 , p_flexfield_segment_code => l_adr_flexfield_segment_code
50769 , p_flex_value_set_id => l_adr_flex_value_set_id
50770 , p_adr_code => 'FA_EXPENSE_ACCT'
50772 , p_component_type => l_component_type
50773 , p_component_code => l_component_code
50774 , p_component_type_code => l_component_type_code
50775 , p_component_appl_id => l_component_appl_id
50776 , p_amb_context_code => l_amb_context_code
50777 , p_entity_code => 'TRANSACTIONS'
50778 , p_event_class_code => 'CIP_RETIREMENTS'
50779 , p_side => 'NA'
50780 );
50781
50782 END IF;
50783
50784 l_segment := AcctDerRule_163(
50785 p_application_id => p_application_id
50786 , p_ae_header_id => l_ae_header_id
50787 , p_source_5 => p_source_5
50788 , p_source_26 => p_source_26
50789 , x_transaction_coa_id => l_adr_transaction_coa_id
50790 , x_accounting_coa_id => l_adr_accounting_coa_id
50791 , x_flexfield_segment_code => l_adr_flexfield_segment_code
50792 , x_flex_value_set_id => l_adr_flex_value_set_id
50793 , x_value_type_code => l_adr_value_type_code
50794 , x_value_combination_id => l_adr_value_combination_id
50795 , x_value_segment_code => l_adr_value_segment_code
50796 , p_side => 'NA'
50797 , p_override_seg_flag => 'Y'
50798 );
50799
50800 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
50801
50802 xla_ae_lines_pkg.set_segment(
50803 p_to_segment_code => 'GL_ACCOUNT'
50804 , p_segment_value => l_segment
50805 , p_from_segment_code => l_adr_value_segment_code
50806 , p_from_combination_id => l_adr_value_combination_id
50807 , p_value_type_code => l_adr_value_type_code
50808 , p_transaction_coa_id => l_adr_transaction_coa_id
50809 , p_accounting_coa_id => l_adr_accounting_coa_id
50810 , p_flexfield_segment_code => l_adr_flexfield_segment_code
50811 , p_flex_value_set_id => l_adr_flex_value_set_id
50812 , p_adr_code => 'FA_PROC_OF_SALE_GAIN_SEGMENT'
50813 , p_adr_type_code => 'S'
50814 , p_component_type => l_component_type
50815 , p_component_code => l_component_code
50816 , p_component_type_code => l_component_type_code
50817 , p_component_appl_id => l_component_appl_id
50818 , p_amb_context_code => l_amb_context_code
50819 , p_entity_code => 'TRANSACTIONS'
50820 , p_event_class_code => 'CIP_RETIREMENTS'
50821 , p_side => 'NA'
50822 );
50823
50824 END IF;
50825
50826 --
50827 --
50828 END IF;
50829
50830 --
50831 -- Update the line information that should be overwritten
50832 --
50833 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
50834 p_header_num => 1);
50835 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
50836
50837 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
50838
50839 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
50840 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
50841 END IF;
50842
50843 --
50844 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
50845 --
50846 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
50847 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
50848 ELSE
50849 ---------------------------------------------------------------------------------------------------
50850 -- 4262811a Switch Sign
50851 ---------------------------------------------------------------------------------------------------
50852 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
50853 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
50854 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
50855 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
50856 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
50857 -- 5132302
50858 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
50859 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
50860
50861 END IF;
50862
50863 -- 4955764
50864 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
50865 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
50866
50867
50868 XLA_AE_LINES_PKG.ValidateCurrentLine;
50869 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
50870
50874
50871 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
50872 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
50873 ,p_balance_type_code => l_balance_type_code);
50875 END IF;
50876
50877 -----------------------------------------------------------------------------------------
50878 -- 4262811 Multiperiod Accounting
50879 -----------------------------------------------------------------------------------------
50880 -- No MPA option is assigned.
50881
50882
50883 END IF;
50884 END IF;
50885 --
50886
50887 --
50888 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
50889 trace
50890 (p_msg => 'END of AcctLineType_235'
50891 ,p_level => C_LEVEL_PROCEDURE
50892 ,p_module => l_log_module);
50893 END IF;
50894 --
50895 EXCEPTION
50896 WHEN xla_exceptions_pkg.application_exception THEN
50897 RAISE;
50898 WHEN OTHERS THEN
50899 xla_exceptions_pkg.raise_message
50900 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_235');
50901 END AcctLineType_235;
50902 --
50903
50904 ---------------------------------------
50905 --
50906 -- PRIVATE FUNCTION
50907 -- AcctLineType_236
50908 --
50909 ---------------------------------------
50910 PROCEDURE AcctLineType_236 (
50911 p_application_id IN NUMBER
50912 ,p_event_id IN NUMBER
50913 ,p_calculate_acctd_flag IN VARCHAR2
50914 ,p_calculate_g_l_flag IN VARCHAR2
50915 ,p_actual_flag IN OUT VARCHAR2
50916 ,p_balance_type_code OUT VARCHAR2
50917 ,p_gain_or_loss_ref OUT VARCHAR2
50918
50919 --Period Close Date
50920 , p_source_1 IN DATE
50921 --Generated Code Combination Identifier
50922 , p_source_5 IN NUMBER
50923 --Proceeds Of Sale Gain Account
50924 , p_source_26 IN VARCHAR2
50925 --Expense Account Code Combination Identifier
50926 , p_source_31 IN NUMBER
50927 --Default Code Combination Identifier
50928 , p_source_32 IN NUMBER
50929 --Adjustment Type
50930 , p_source_48 IN VARCHAR2
50931 --Transaction Header Identifier
50932 , p_source_49 IN NUMBER
50933 --Adjustment Line Identifier
50934 , p_source_50 IN NUMBER
50935 --Distribution Type Code
50936 , p_source_51 IN VARCHAR2
50937 --Entered Amount
50938 , p_source_52 IN NUMBER
50939 --Currency Code
50940 , p_source_53 IN VARCHAR2
50941 --Gain Loss Amount
50942 , p_source_54 IN NUMBER
50943 )
50944 IS
50945
50946 l_component_type VARCHAR2(80);
50947 l_component_code VARCHAR2(30);
50948 l_component_type_code VARCHAR2(1);
50949 l_component_appl_id INTEGER;
50950 l_amb_context_code VARCHAR2(30);
50951 l_entity_code VARCHAR2(30);
50952 l_event_class_code VARCHAR2(30);
50953 l_ae_header_id NUMBER;
50954 l_event_type_code VARCHAR2(30);
50955 l_line_definition_code VARCHAR2(30);
50956 l_line_definition_owner_code VARCHAR2(1);
50957 --
50958 -- adr variables
50959 l_segment VARCHAR2(30);
50960 l_ccid NUMBER;
50961 l_adr_transaction_coa_id NUMBER;
50962 l_adr_accounting_coa_id NUMBER;
50963 l_adr_flexfield_segment_code VARCHAR2(30);
50964 l_adr_flex_value_set_id NUMBER;
50965 l_adr_value_type_code VARCHAR2(30);
50966 l_adr_value_combination_id NUMBER;
50967 l_adr_value_segment_code VARCHAR2(30);
50968
50969 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
50970 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
50971 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
50972 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
50973
50974 -- 4262811 Variables ------------------------------------------------------------------------------------------
50975 l_entered_amt_idx NUMBER;
50976 l_accted_amt_idx NUMBER;
50977 l_acc_rev_flag VARCHAR2(1);
50978 l_accrual_line_num NUMBER;
50979 l_tmp_amt NUMBER;
50980 l_acc_rev_natural_side_code VARCHAR2(1);
50981
50982 l_num_entries NUMBER;
50983 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
50984 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
50985 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
50986 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
50987 l_recog_line_1 NUMBER;
50988 l_recog_line_2 NUMBER;
50989
50990 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
50991 l_bflow_applied_to_amt NUMBER; -- 5132302
50992 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
50993
50994 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
50995
50996 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
50997 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
50998
50999 ---------------------------------------------------------------------------------------------------------------
51000
51001
51002 --
51003 -- bulk performance
51004 --
51005 l_balance_type_code VARCHAR2(1);
51009 --
51006 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
51007 l_log_module VARCHAR2(240);
51008
51010 -- Upgrade strategy
51011 --
51012 l_actual_upg_option VARCHAR2(1);
51013 l_enc_upg_option VARCHAR2(1);
51014
51015 --
51016 BEGIN
51017 --
51018 IF g_log_enabled THEN
51019 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_236';
51020 END IF;
51021 --
51022 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
51023
51024 trace
51025 (p_msg => 'BEGIN of AcctLineType_236'
51026 ,p_level => C_LEVEL_PROCEDURE
51027 ,p_module => l_log_module);
51028
51029 END IF;
51030 --
51031 l_component_type := 'AMB_JLT';
51032 l_component_code := 'FA_CIP_PROC_OF_SALE_GAIN';
51033 l_component_type_code := 'S';
51034 l_component_appl_id := 140;
51035 l_amb_context_code := 'DEFAULT';
51036 l_entity_code := 'TRANSACTIONS';
51037 l_event_class_code := 'CIP_RETIREMENTS';
51038 l_event_type_code := 'CIP_REINSTATEMENTS';
51039 l_line_definition_owner_code := 'S';
51040 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
51041 --
51042 l_balance_type_code := 'A';
51043 l_segment := NULL;
51044 l_ccid := NULL;
51045 l_adr_transaction_coa_id := NULL;
51046 l_adr_accounting_coa_id := NULL;
51047 l_adr_flexfield_segment_code := NULL;
51048 l_adr_flex_value_set_id := NULL;
51049 l_adr_value_type_code := NULL;
51050 l_adr_value_combination_id := NULL;
51051 l_adr_value_segment_code := NULL;
51052
51053 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
51054 l_bflow_class_code := ''; -- 4219869 Business Flow
51055 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
51056 l_budgetary_control_flag := 'N';
51057
51058 l_bflow_applied_to_amt_idx := NULL; -- 5132302
51059 l_bflow_applied_to_amt := NULL; -- 5132302
51060 l_entered_amt_idx := NULL; -- 4262811
51061 l_accted_amt_idx := NULL; -- 4262811
51062 l_acc_rev_flag := NULL; -- 4262811
51063 l_accrual_line_num := NULL; -- 4262811
51064 l_tmp_amt := NULL; -- 4262811
51065 --
51066
51067 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
51068 l_balance_type_code <> 'B' THEN
51069 IF NVL(p_source_48,'
51070 ') = 'PROCEEDS' AND
51071 p_source_54 >= 0
51072 THEN
51073
51074 --
51075 XLA_AE_LINES_PKG.SetNewLine;
51076
51077 p_balance_type_code := l_balance_type_code;
51078 -- set the flag so later we will know whether the gain loss line needs to be created
51079
51080 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
51081 p_actual_flag :='A';
51082 END IF;
51083
51084 --
51085 -- bulk performance
51086 --
51087 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
51088 p_header_num => 0); -- 4262811
51089 --
51090 -- set accounting line options
51091 --
51092 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
51093 p_natural_side_code => 'C'
51094 , p_gain_or_loss_flag => 'N'
51095 , p_gl_transfer_mode_code => 'S'
51096 , p_acct_entry_type_code => 'A'
51097 , p_switch_side_flag => 'Y'
51098 , p_merge_duplicate_code => 'N'
51099 );
51100 --
51101 l_acc_rev_natural_side_code := 'D'; -- 4262811
51102 --
51103 --
51104 -- set accounting line type info
51105 --
51106 xla_ae_lines_pkg.SetAcctLineType
51107 (p_component_type => l_component_type
51108 ,p_event_type_code => l_event_type_code
51109 ,p_line_definition_owner_code => l_line_definition_owner_code
51110 ,p_line_definition_code => l_line_definition_code
51111 ,p_accounting_line_code => l_component_code
51112 ,p_accounting_line_type_code => l_component_type_code
51113 ,p_accounting_line_appl_id => l_component_appl_id
51114 ,p_amb_context_code => l_amb_context_code
51115 ,p_entity_code => l_entity_code
51116 ,p_event_class_code => l_event_class_code);
51117 --
51118 -- set accounting class
51119 --
51120 xla_ae_lines_pkg.SetAcctClass(
51121 p_accounting_class_code => 'ASSET'
51122 , p_ae_header_id => l_ae_header_id
51123 );
51124
51125 --
51126 -- set rounding class
51127 --
51128 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
51129 'ASSET';
51130
51131 --
51132 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
51133 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
51134 --
51135 -- bulk performance
51136 --
51137 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
51138
51142 -- 4955764
51139 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
51140 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
51141
51143 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
51144 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
51145
51146 -- 4458381 Public Sector Enh
51147
51148 --
51149 -- set accounting attributes for the line type
51150 --
51151 l_entered_amt_idx := 4;
51152 l_accted_amt_idx := 6;
51153 l_bflow_applied_to_amt_idx := NULL; -- 5132302
51154 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
51155 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
51156 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
51157 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
51158 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
51159 l_rec_acct_attrs.array_char_value(3) := p_source_51;
51160 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
51161 l_rec_acct_attrs.array_num_value(4) := p_source_52;
51162 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
51163 l_rec_acct_attrs.array_char_value(5) := p_source_53;
51164 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
51165 l_rec_acct_attrs.array_num_value(6) := p_source_52;
51166
51167 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
51168 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
51169
51170 ---------------------------------------------------------------------------------------------------------------
51171 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
51172 ---------------------------------------------------------------------------------------------------------------
51173 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
51174
51175 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
51176 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
51177
51178 IF xla_accounting_cache_pkg.GetValueChar
51179 (p_source_code => 'LEDGER_CATEGORY_CODE'
51180 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
51181 AND l_bflow_method_code = 'PRIOR_ENTRY'
51182 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
51183 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
51184 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
51185 )
51186 THEN
51187 xla_ae_lines_pkg.BflowUpgEntry
51188 (p_business_method_code => l_bflow_method_code
51189 ,p_business_class_code => l_bflow_class_code
51190 ,p_balance_type => l_balance_type_code);
51191 ELSE
51192 NULL;
51193 -- No business flow processing for business flow method of NONE.
51194 END IF;
51195
51196 --
51197 -- call analytical criteria
51198 --
51199
51200 --
51201 -- call description
51202 --
51203
51204 xla_ae_lines_pkg.SetLineDescription(
51205 p_ae_header_id => l_ae_header_id
51206 ,p_description => Description_35 (
51207 p_application_id => p_application_id
51208 , p_ae_header_id => l_ae_header_id
51209 , p_source_1 => p_source_1
51210 )
51211 );
51212
51213
51214 --
51215 -- call ADRs
51216 -- Bug 4922099
51217 --
51218 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
51219 (NVL(l_actual_upg_option, 'N') = 'O') OR
51220 (NVL(l_enc_upg_option, 'N') = 'O')
51221 )
51222 THEN
51223 NULL;
51224 --
51225 --
51226
51227 l_ccid := AcctDerRule_174(
51228 p_application_id => p_application_id
51229 , p_ae_header_id => l_ae_header_id
51230 , p_source_5 => p_source_5
51231 , p_source_32 => p_source_32
51232 , x_transaction_coa_id => l_adr_transaction_coa_id
51233 , x_accounting_coa_id => l_adr_accounting_coa_id
51234 , x_value_type_code => l_adr_value_type_code
51235 , p_side => 'NA'
51236 );
51237
51238 xla_ae_lines_pkg.set_ccid(
51239 p_code_combination_id => l_ccid
51240 , p_value_type_code => l_adr_value_type_code
51241 , p_transaction_coa_id => l_adr_transaction_coa_id
51242 , p_accounting_coa_id => l_adr_accounting_coa_id
51243 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
51244 , p_adr_type_code => 'S'
51245 , p_component_type => l_component_type
51246 , p_component_code => l_component_code
51247 , p_component_type_code => l_component_type_code
51248 , p_component_appl_id => l_component_appl_id
51249 , p_amb_context_code => l_amb_context_code
51250 , p_side => 'NA'
51251 );
51252
51253
51254 l_segment := AcctDerRule_169(
51255 p_application_id => p_application_id
51256 , p_ae_header_id => l_ae_header_id
51260 , x_accounting_coa_id => l_adr_accounting_coa_id
51257 , p_source_5 => p_source_5
51258 , p_source_31 => p_source_31
51259 , x_transaction_coa_id => l_adr_transaction_coa_id
51261 , x_flexfield_segment_code => l_adr_flexfield_segment_code
51262 , x_flex_value_set_id => l_adr_flex_value_set_id
51263 , x_value_type_code => l_adr_value_type_code
51264 , x_value_combination_id => l_adr_value_combination_id
51265 , x_value_segment_code => l_adr_value_segment_code
51266 , p_side => 'NA'
51267 , p_override_seg_flag => 'Y'
51268 );
51269
51270 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
51271
51272 xla_ae_lines_pkg.set_segment(
51273 p_to_segment_code => 'GL_BALANCING'
51274 , p_segment_value => l_segment
51275 , p_from_segment_code => l_adr_value_segment_code
51276 , p_from_combination_id => l_adr_value_combination_id
51277 , p_value_type_code => l_adr_value_type_code
51278 , p_transaction_coa_id => l_adr_transaction_coa_id
51279 , p_accounting_coa_id => l_adr_accounting_coa_id
51280 , p_flexfield_segment_code => l_adr_flexfield_segment_code
51281 , p_flex_value_set_id => l_adr_flex_value_set_id
51282 , p_adr_code => 'FA_EXPENSE_ACCT'
51283 , p_adr_type_code => 'S'
51284 , p_component_type => l_component_type
51285 , p_component_code => l_component_code
51286 , p_component_type_code => l_component_type_code
51287 , p_component_appl_id => l_component_appl_id
51288 , p_amb_context_code => l_amb_context_code
51289 , p_entity_code => 'TRANSACTIONS'
51290 , p_event_class_code => 'CIP_RETIREMENTS'
51291 , p_side => 'NA'
51292 );
51293
51294 END IF;
51295
51296 l_segment := AcctDerRule_163(
51297 p_application_id => p_application_id
51298 , p_ae_header_id => l_ae_header_id
51299 , p_source_5 => p_source_5
51300 , p_source_26 => p_source_26
51301 , x_transaction_coa_id => l_adr_transaction_coa_id
51302 , x_accounting_coa_id => l_adr_accounting_coa_id
51303 , x_flexfield_segment_code => l_adr_flexfield_segment_code
51304 , x_flex_value_set_id => l_adr_flex_value_set_id
51305 , x_value_type_code => l_adr_value_type_code
51306 , x_value_combination_id => l_adr_value_combination_id
51307 , x_value_segment_code => l_adr_value_segment_code
51308 , p_side => 'NA'
51309 , p_override_seg_flag => 'Y'
51310 );
51311
51312 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
51313
51314 xla_ae_lines_pkg.set_segment(
51315 p_to_segment_code => 'GL_ACCOUNT'
51316 , p_segment_value => l_segment
51317 , p_from_segment_code => l_adr_value_segment_code
51318 , p_from_combination_id => l_adr_value_combination_id
51319 , p_value_type_code => l_adr_value_type_code
51320 , p_transaction_coa_id => l_adr_transaction_coa_id
51321 , p_accounting_coa_id => l_adr_accounting_coa_id
51322 , p_flexfield_segment_code => l_adr_flexfield_segment_code
51323 , p_flex_value_set_id => l_adr_flex_value_set_id
51324 , p_adr_code => 'FA_PROC_OF_SALE_GAIN_SEGMENT'
51325 , p_adr_type_code => 'S'
51326 , p_component_type => l_component_type
51327 , p_component_code => l_component_code
51328 , p_component_type_code => l_component_type_code
51329 , p_component_appl_id => l_component_appl_id
51330 , p_amb_context_code => l_amb_context_code
51331 , p_entity_code => 'TRANSACTIONS'
51332 , p_event_class_code => 'CIP_RETIREMENTS'
51333 , p_side => 'NA'
51334 );
51335
51336 END IF;
51337
51338 --
51339 --
51340 END IF;
51341 --
51342 -- Bug 4922099
51343 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
51344 (NVL(l_enc_upg_option, 'N') = 'O')
51345 ) AND
51346 (l_bflow_method_code = 'PRIOR_ENTRY')
51347 )
51348 THEN
51349 IF
51350 --
51351 1 = 2
51352 --
51353 THEN
51354 xla_accounting_err_pkg.build_message
51355 (p_appli_s_name => 'XLA'
51356 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
51357 ,p_token_1 => 'LINE_NUMBER'
51358 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
51359 ,p_token_2 => 'LINE_TYPE_NAME'
51360 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
51361 l_component_type
51362 ,l_component_code
51363 ,l_component_type_code
51367 ,l_event_class_code
51364 ,l_component_appl_id
51365 ,l_amb_context_code
51366 ,l_entity_code
51368 )
51369 ,p_token_3 => 'OWNER'
51370 ,p_value_3 => xla_lookups_pkg.get_meaning(
51371 p_lookup_type => 'XLA_OWNER_TYPE'
51372 ,p_lookup_code => l_component_type_code
51373 )
51374 ,p_token_4 => 'PRODUCT_NAME'
51375 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
51376 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
51377 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
51378 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
51379 ,p_ae_header_id => NULL
51380 );
51381
51382 IF (C_LEVEL_ERROR>= g_log_level) THEN
51383 trace
51384 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
51385 ,p_level => C_LEVEL_ERROR
51386 ,p_module => l_log_module);
51387 END IF;
51388 END IF;
51389 END IF;
51390 --
51391 --
51392 ------------------------------------------------------------------------------------------------
51393 -- 4219869 Business Flow
51394 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
51395 -- Prior Entry. Currently, the following code is always generated.
51396 ------------------------------------------------------------------------------------------------
51397 XLA_AE_LINES_PKG.ValidateCurrentLine;
51398
51399 ------------------------------------------------------------------------------------
51400 -- 4219869 Business Flow
51401 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
51402 ------------------------------------------------------------------------------------
51403 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
51404
51405 ----------------------------------------------------------------------------------
51406 -- 4219869 Business Flow
51407 -- Update journal entry status -- Need to generate this within IF <condition>
51408 ----------------------------------------------------------------------------------
51409 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
51410 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
51411 ,p_balance_type_code => l_balance_type_code
51412 );
51413
51414 -------------------------------------------------------------------------------------------
51415 -- 4262811 - Generate the Accrual Reversal lines
51416 -------------------------------------------------------------------------------------------
51417 BEGIN
51418 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
51419 (g_array_event(p_event_id).array_value_num('header_index'));
51420 IF l_acc_rev_flag IS NULL THEN
51421 l_acc_rev_flag := 'N';
51422 END IF;
51423 EXCEPTION
51424 WHEN OTHERS THEN
51425 l_acc_rev_flag := 'N';
51426 END;
51427 --
51428 IF (l_acc_rev_flag = 'Y') THEN
51429
51430 -- 4645092 ------------------------------------------------------------------------------
51431 -- To allow MPA report to determine if it should generate report process
51432 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
51433 ------------------------------------------------------------------------------------------
51434
51435 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
51436 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
51437 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
51438 -- call ADRs
51439 -- Bug 4922099
51440 --
51441 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
51442 (NVL(l_actual_upg_option, 'N') = 'O') OR
51443 (NVL(l_enc_upg_option, 'N') = 'O')
51444 )
51445 THEN
51446 NULL;
51447 --
51448 --
51449
51450 l_ccid := AcctDerRule_174(
51451 p_application_id => p_application_id
51452 , p_ae_header_id => l_ae_header_id
51453 , p_source_5 => p_source_5
51454 , p_source_32 => p_source_32
51455 , x_transaction_coa_id => l_adr_transaction_coa_id
51456 , x_accounting_coa_id => l_adr_accounting_coa_id
51457 , x_value_type_code => l_adr_value_type_code
51458 , p_side => 'NA'
51459 );
51460
51461 xla_ae_lines_pkg.set_ccid(
51462 p_code_combination_id => l_ccid
51463 , p_value_type_code => l_adr_value_type_code
51464 , p_transaction_coa_id => l_adr_transaction_coa_id
51468 , p_component_type => l_component_type
51465 , p_accounting_coa_id => l_adr_accounting_coa_id
51466 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
51467 , p_adr_type_code => 'S'
51469 , p_component_code => l_component_code
51470 , p_component_type_code => l_component_type_code
51471 , p_component_appl_id => l_component_appl_id
51472 , p_amb_context_code => l_amb_context_code
51473 , p_side => 'NA'
51474 );
51475
51476
51477 l_segment := AcctDerRule_169(
51478 p_application_id => p_application_id
51479 , p_ae_header_id => l_ae_header_id
51480 , p_source_5 => p_source_5
51481 , p_source_31 => p_source_31
51482 , x_transaction_coa_id => l_adr_transaction_coa_id
51483 , x_accounting_coa_id => l_adr_accounting_coa_id
51484 , x_flexfield_segment_code => l_adr_flexfield_segment_code
51485 , x_flex_value_set_id => l_adr_flex_value_set_id
51486 , x_value_type_code => l_adr_value_type_code
51487 , x_value_combination_id => l_adr_value_combination_id
51488 , x_value_segment_code => l_adr_value_segment_code
51489 , p_side => 'NA'
51490 , p_override_seg_flag => 'Y'
51491 );
51492
51493 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
51494
51495 xla_ae_lines_pkg.set_segment(
51496 p_to_segment_code => 'GL_BALANCING'
51497 , p_segment_value => l_segment
51498 , p_from_segment_code => l_adr_value_segment_code
51499 , p_from_combination_id => l_adr_value_combination_id
51500 , p_value_type_code => l_adr_value_type_code
51501 , p_transaction_coa_id => l_adr_transaction_coa_id
51502 , p_accounting_coa_id => l_adr_accounting_coa_id
51503 , p_flexfield_segment_code => l_adr_flexfield_segment_code
51504 , p_flex_value_set_id => l_adr_flex_value_set_id
51505 , p_adr_code => 'FA_EXPENSE_ACCT'
51506 , p_adr_type_code => 'S'
51507 , p_component_type => l_component_type
51508 , p_component_code => l_component_code
51509 , p_component_type_code => l_component_type_code
51510 , p_component_appl_id => l_component_appl_id
51511 , p_amb_context_code => l_amb_context_code
51512 , p_entity_code => 'TRANSACTIONS'
51513 , p_event_class_code => 'CIP_RETIREMENTS'
51514 , p_side => 'NA'
51515 );
51516
51517 END IF;
51518
51519 l_segment := AcctDerRule_163(
51520 p_application_id => p_application_id
51521 , p_ae_header_id => l_ae_header_id
51522 , p_source_5 => p_source_5
51523 , p_source_26 => p_source_26
51524 , x_transaction_coa_id => l_adr_transaction_coa_id
51525 , x_accounting_coa_id => l_adr_accounting_coa_id
51526 , x_flexfield_segment_code => l_adr_flexfield_segment_code
51527 , x_flex_value_set_id => l_adr_flex_value_set_id
51528 , x_value_type_code => l_adr_value_type_code
51529 , x_value_combination_id => l_adr_value_combination_id
51530 , x_value_segment_code => l_adr_value_segment_code
51531 , p_side => 'NA'
51532 , p_override_seg_flag => 'Y'
51533 );
51534
51535 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
51536
51537 xla_ae_lines_pkg.set_segment(
51538 p_to_segment_code => 'GL_ACCOUNT'
51539 , p_segment_value => l_segment
51540 , p_from_segment_code => l_adr_value_segment_code
51541 , p_from_combination_id => l_adr_value_combination_id
51542 , p_value_type_code => l_adr_value_type_code
51543 , p_transaction_coa_id => l_adr_transaction_coa_id
51544 , p_accounting_coa_id => l_adr_accounting_coa_id
51545 , p_flexfield_segment_code => l_adr_flexfield_segment_code
51546 , p_flex_value_set_id => l_adr_flex_value_set_id
51547 , p_adr_code => 'FA_PROC_OF_SALE_GAIN_SEGMENT'
51548 , p_adr_type_code => 'S'
51549 , p_component_type => l_component_type
51550 , p_component_code => l_component_code
51551 , p_component_type_code => l_component_type_code
51552 , p_component_appl_id => l_component_appl_id
51553 , p_amb_context_code => l_amb_context_code
51554 , p_entity_code => 'TRANSACTIONS'
51555 , p_event_class_code => 'CIP_RETIREMENTS'
51556 , p_side => 'NA'
51557 );
51558
51559 END IF;
51560
51561 --
51562 --
51563 END IF;
51564
51565 --
51566 -- Update the line information that should be overwritten
51567 --
51568 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
51569 p_header_num => 1);
51570 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
51571
51572 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
51573
51574 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
51578 --
51575 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
51576 END IF;
51577
51579 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
51580 --
51581 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
51582 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
51583 ELSE
51584 ---------------------------------------------------------------------------------------------------
51585 -- 4262811a Switch Sign
51586 ---------------------------------------------------------------------------------------------------
51587 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
51588 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
51589 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
51590 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
51591 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
51592 -- 5132302
51593 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
51594 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
51595
51596 END IF;
51597
51598 -- 4955764
51599 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
51600 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
51601
51602
51603 XLA_AE_LINES_PKG.ValidateCurrentLine;
51604 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
51605
51606 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
51607 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
51608 ,p_balance_type_code => l_balance_type_code);
51609
51610 END IF;
51611
51612 -----------------------------------------------------------------------------------------
51613 -- 4262811 Multiperiod Accounting
51614 -----------------------------------------------------------------------------------------
51615 -- No MPA option is assigned.
51616
51617
51618 END IF;
51619 END IF;
51620 --
51621
51622 --
51623 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
51624 trace
51625 (p_msg => 'END of AcctLineType_236'
51626 ,p_level => C_LEVEL_PROCEDURE
51627 ,p_module => l_log_module);
51628 END IF;
51629 --
51630 EXCEPTION
51631 WHEN xla_exceptions_pkg.application_exception THEN
51632 RAISE;
51633 WHEN OTHERS THEN
51634 xla_exceptions_pkg.raise_message
51635 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_236');
51636 END AcctLineType_236;
51637 --
51638
51639 ---------------------------------------
51640 --
51641 -- PRIVATE FUNCTION
51642 -- AcctLineType_237
51643 --
51644 ---------------------------------------
51645 PROCEDURE AcctLineType_237 (
51646 p_application_id IN NUMBER
51647 ,p_event_id IN NUMBER
51648 ,p_calculate_acctd_flag IN VARCHAR2
51649 ,p_calculate_g_l_flag IN VARCHAR2
51650 ,p_actual_flag IN OUT VARCHAR2
51651 ,p_balance_type_code OUT VARCHAR2
51652 ,p_gain_or_loss_ref OUT VARCHAR2
51653
51654 --Period Close Date
51655 , p_source_1 IN DATE
51656 --Generated Code Combination Identifier
51657 , p_source_5 IN NUMBER
51658 --Proceeds Of Sale Loss Account
51659 , p_source_27 IN VARCHAR2
51660 --Expense Account Code Combination Identifier
51661 , p_source_31 IN NUMBER
51662 --Default Code Combination Identifier
51663 , p_source_32 IN NUMBER
51664 --Adjustment Type
51665 , p_source_48 IN VARCHAR2
51666 --Transaction Header Identifier
51667 , p_source_49 IN NUMBER
51668 --Adjustment Line Identifier
51669 , p_source_50 IN NUMBER
51670 --Distribution Type Code
51671 , p_source_51 IN VARCHAR2
51672 --Entered Amount
51673 , p_source_52 IN NUMBER
51674 --Currency Code
51675 , p_source_53 IN VARCHAR2
51676 --Gain Loss Amount
51677 , p_source_54 IN NUMBER
51678 )
51679 IS
51680
51681 l_component_type VARCHAR2(80);
51682 l_component_code VARCHAR2(30);
51683 l_component_type_code VARCHAR2(1);
51684 l_component_appl_id INTEGER;
51685 l_amb_context_code VARCHAR2(30);
51686 l_entity_code VARCHAR2(30);
51687 l_event_class_code VARCHAR2(30);
51688 l_ae_header_id NUMBER;
51689 l_event_type_code VARCHAR2(30);
51690 l_line_definition_code VARCHAR2(30);
51691 l_line_definition_owner_code VARCHAR2(1);
51692 --
51693 -- adr variables
51694 l_segment VARCHAR2(30);
51695 l_ccid NUMBER;
51696 l_adr_transaction_coa_id NUMBER;
51697 l_adr_accounting_coa_id NUMBER;
51698 l_adr_flexfield_segment_code VARCHAR2(30);
51699 l_adr_flex_value_set_id NUMBER;
51703
51700 l_adr_value_type_code VARCHAR2(30);
51701 l_adr_value_combination_id NUMBER;
51702 l_adr_value_segment_code VARCHAR2(30);
51704 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
51705 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
51706 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
51707 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
51708
51709 -- 4262811 Variables ------------------------------------------------------------------------------------------
51710 l_entered_amt_idx NUMBER;
51711 l_accted_amt_idx NUMBER;
51712 l_acc_rev_flag VARCHAR2(1);
51713 l_accrual_line_num NUMBER;
51714 l_tmp_amt NUMBER;
51715 l_acc_rev_natural_side_code VARCHAR2(1);
51716
51717 l_num_entries NUMBER;
51718 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
51719 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
51720 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
51721 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
51722 l_recog_line_1 NUMBER;
51723 l_recog_line_2 NUMBER;
51724
51725 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
51726 l_bflow_applied_to_amt NUMBER; -- 5132302
51727 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
51728
51729 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
51730
51731 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
51732 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
51733
51734 ---------------------------------------------------------------------------------------------------------------
51735
51736
51737 --
51738 -- bulk performance
51739 --
51740 l_balance_type_code VARCHAR2(1);
51741 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
51742 l_log_module VARCHAR2(240);
51743
51744 --
51745 -- Upgrade strategy
51746 --
51747 l_actual_upg_option VARCHAR2(1);
51748 l_enc_upg_option VARCHAR2(1);
51749
51750 --
51751 BEGIN
51752 --
51753 IF g_log_enabled THEN
51754 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_237';
51755 END IF;
51756 --
51757 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
51758
51759 trace
51760 (p_msg => 'BEGIN of AcctLineType_237'
51761 ,p_level => C_LEVEL_PROCEDURE
51762 ,p_module => l_log_module);
51763
51764 END IF;
51765 --
51766 l_component_type := 'AMB_JLT';
51767 l_component_code := 'FA_CIP_PROC_OF_SALE_LOSS';
51768 l_component_type_code := 'S';
51769 l_component_appl_id := 140;
51770 l_amb_context_code := 'DEFAULT';
51771 l_entity_code := 'TRANSACTIONS';
51772 l_event_class_code := 'CIP_RETIREMENTS';
51773 l_event_type_code := 'CIP_RETIREMENTS';
51774 l_line_definition_owner_code := 'S';
51775 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
51776 --
51777 l_balance_type_code := 'A';
51778 l_segment := NULL;
51779 l_ccid := NULL;
51780 l_adr_transaction_coa_id := NULL;
51781 l_adr_accounting_coa_id := NULL;
51782 l_adr_flexfield_segment_code := NULL;
51783 l_adr_flex_value_set_id := NULL;
51784 l_adr_value_type_code := NULL;
51785 l_adr_value_combination_id := NULL;
51786 l_adr_value_segment_code := NULL;
51787
51788 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
51789 l_bflow_class_code := ''; -- 4219869 Business Flow
51790 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
51791 l_budgetary_control_flag := 'N';
51792
51793 l_bflow_applied_to_amt_idx := NULL; -- 5132302
51794 l_bflow_applied_to_amt := NULL; -- 5132302
51795 l_entered_amt_idx := NULL; -- 4262811
51796 l_accted_amt_idx := NULL; -- 4262811
51797 l_acc_rev_flag := NULL; -- 4262811
51798 l_accrual_line_num := NULL; -- 4262811
51799 l_tmp_amt := NULL; -- 4262811
51800 --
51801
51802 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
51803 l_balance_type_code <> 'B' THEN
51804 IF NVL(p_source_48,'
51805 ') = 'PROCEEDS' AND
51806 p_source_54 < 0
51807 THEN
51808
51809 --
51810 XLA_AE_LINES_PKG.SetNewLine;
51811
51812 p_balance_type_code := l_balance_type_code;
51813 -- set the flag so later we will know whether the gain loss line needs to be created
51814
51815 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
51816 p_actual_flag :='A';
51817 END IF;
51818
51819 --
51820 -- bulk performance
51821 --
51822 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
51823 p_header_num => 0); -- 4262811
51824 --
51825 -- set accounting line options
51826 --
51830 , p_gl_transfer_mode_code => 'S'
51827 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
51828 p_natural_side_code => 'C'
51829 , p_gain_or_loss_flag => 'N'
51831 , p_acct_entry_type_code => 'A'
51832 , p_switch_side_flag => 'Y'
51833 , p_merge_duplicate_code => 'N'
51834 );
51835 --
51836 l_acc_rev_natural_side_code := 'D'; -- 4262811
51837 --
51838 --
51839 -- set accounting line type info
51840 --
51841 xla_ae_lines_pkg.SetAcctLineType
51842 (p_component_type => l_component_type
51843 ,p_event_type_code => l_event_type_code
51844 ,p_line_definition_owner_code => l_line_definition_owner_code
51845 ,p_line_definition_code => l_line_definition_code
51846 ,p_accounting_line_code => l_component_code
51847 ,p_accounting_line_type_code => l_component_type_code
51848 ,p_accounting_line_appl_id => l_component_appl_id
51849 ,p_amb_context_code => l_amb_context_code
51850 ,p_entity_code => l_entity_code
51851 ,p_event_class_code => l_event_class_code);
51852 --
51853 -- set accounting class
51854 --
51855 xla_ae_lines_pkg.SetAcctClass(
51856 p_accounting_class_code => 'ASSET'
51857 , p_ae_header_id => l_ae_header_id
51858 );
51859
51860 --
51861 -- set rounding class
51862 --
51863 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
51864 'ASSET';
51865
51866 --
51867 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
51868 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
51869 --
51870 -- bulk performance
51871 --
51872 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
51873
51874 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
51875 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
51876
51877 -- 4955764
51878 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
51879 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
51880
51881 -- 4458381 Public Sector Enh
51882
51883 --
51884 -- set accounting attributes for the line type
51885 --
51886 l_entered_amt_idx := 4;
51887 l_accted_amt_idx := 6;
51888 l_bflow_applied_to_amt_idx := NULL; -- 5132302
51889 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
51890 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
51891 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
51892 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
51893 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
51894 l_rec_acct_attrs.array_char_value(3) := p_source_51;
51895 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
51896 l_rec_acct_attrs.array_num_value(4) := p_source_52;
51897 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
51898 l_rec_acct_attrs.array_char_value(5) := p_source_53;
51899 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
51900 l_rec_acct_attrs.array_num_value(6) := p_source_52;
51901
51902 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
51903 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
51904
51905 ---------------------------------------------------------------------------------------------------------------
51906 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
51907 ---------------------------------------------------------------------------------------------------------------
51908 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
51909
51910 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
51911 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
51912
51913 IF xla_accounting_cache_pkg.GetValueChar
51914 (p_source_code => 'LEDGER_CATEGORY_CODE'
51915 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
51916 AND l_bflow_method_code = 'PRIOR_ENTRY'
51917 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
51918 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
51919 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
51920 )
51921 THEN
51922 xla_ae_lines_pkg.BflowUpgEntry
51923 (p_business_method_code => l_bflow_method_code
51924 ,p_business_class_code => l_bflow_class_code
51925 ,p_balance_type => l_balance_type_code);
51926 ELSE
51927 NULL;
51928 -- No business flow processing for business flow method of NONE.
51929 END IF;
51930
51931 --
51932 -- call analytical criteria
51933 --
51934
51935 --
51936 -- call description
51937 --
51938
51939 xla_ae_lines_pkg.SetLineDescription(
51940 p_ae_header_id => l_ae_header_id
51941 ,p_description => Description_35 (
51945 )
51942 p_application_id => p_application_id
51943 , p_ae_header_id => l_ae_header_id
51944 , p_source_1 => p_source_1
51946 );
51947
51948
51949 --
51950 -- call ADRs
51951 -- Bug 4922099
51952 --
51953 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
51954 (NVL(l_actual_upg_option, 'N') = 'O') OR
51955 (NVL(l_enc_upg_option, 'N') = 'O')
51956 )
51957 THEN
51958 NULL;
51959 --
51960 --
51961
51962 l_ccid := AcctDerRule_174(
51963 p_application_id => p_application_id
51964 , p_ae_header_id => l_ae_header_id
51965 , p_source_5 => p_source_5
51966 , p_source_32 => p_source_32
51967 , x_transaction_coa_id => l_adr_transaction_coa_id
51968 , x_accounting_coa_id => l_adr_accounting_coa_id
51969 , x_value_type_code => l_adr_value_type_code
51970 , p_side => 'NA'
51971 );
51972
51973 xla_ae_lines_pkg.set_ccid(
51974 p_code_combination_id => l_ccid
51975 , p_value_type_code => l_adr_value_type_code
51976 , p_transaction_coa_id => l_adr_transaction_coa_id
51977 , p_accounting_coa_id => l_adr_accounting_coa_id
51978 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
51979 , p_adr_type_code => 'S'
51980 , p_component_type => l_component_type
51981 , p_component_code => l_component_code
51982 , p_component_type_code => l_component_type_code
51983 , p_component_appl_id => l_component_appl_id
51984 , p_amb_context_code => l_amb_context_code
51985 , p_side => 'NA'
51986 );
51987
51988
51989 l_segment := AcctDerRule_169(
51990 p_application_id => p_application_id
51991 , p_ae_header_id => l_ae_header_id
51992 , p_source_5 => p_source_5
51993 , p_source_31 => p_source_31
51994 , x_transaction_coa_id => l_adr_transaction_coa_id
51995 , x_accounting_coa_id => l_adr_accounting_coa_id
51996 , x_flexfield_segment_code => l_adr_flexfield_segment_code
51997 , x_flex_value_set_id => l_adr_flex_value_set_id
51998 , x_value_type_code => l_adr_value_type_code
51999 , x_value_combination_id => l_adr_value_combination_id
52000 , x_value_segment_code => l_adr_value_segment_code
52001 , p_side => 'NA'
52002 , p_override_seg_flag => 'Y'
52003 );
52004
52005 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
52006
52007 xla_ae_lines_pkg.set_segment(
52008 p_to_segment_code => 'GL_BALANCING'
52009 , p_segment_value => l_segment
52010 , p_from_segment_code => l_adr_value_segment_code
52011 , p_from_combination_id => l_adr_value_combination_id
52012 , p_value_type_code => l_adr_value_type_code
52013 , p_transaction_coa_id => l_adr_transaction_coa_id
52014 , p_accounting_coa_id => l_adr_accounting_coa_id
52015 , p_flexfield_segment_code => l_adr_flexfield_segment_code
52016 , p_flex_value_set_id => l_adr_flex_value_set_id
52017 , p_adr_code => 'FA_EXPENSE_ACCT'
52018 , p_adr_type_code => 'S'
52019 , p_component_type => l_component_type
52020 , p_component_code => l_component_code
52021 , p_component_type_code => l_component_type_code
52022 , p_component_appl_id => l_component_appl_id
52023 , p_amb_context_code => l_amb_context_code
52024 , p_entity_code => 'TRANSACTIONS'
52025 , p_event_class_code => 'CIP_RETIREMENTS'
52026 , p_side => 'NA'
52027 );
52028
52029 END IF;
52030
52031 l_segment := AcctDerRule_164(
52032 p_application_id => p_application_id
52033 , p_ae_header_id => l_ae_header_id
52034 , p_source_5 => p_source_5
52035 , p_source_27 => p_source_27
52036 , x_transaction_coa_id => l_adr_transaction_coa_id
52037 , x_accounting_coa_id => l_adr_accounting_coa_id
52038 , x_flexfield_segment_code => l_adr_flexfield_segment_code
52039 , x_flex_value_set_id => l_adr_flex_value_set_id
52040 , x_value_type_code => l_adr_value_type_code
52041 , x_value_combination_id => l_adr_value_combination_id
52042 , x_value_segment_code => l_adr_value_segment_code
52043 , p_side => 'NA'
52044 , p_override_seg_flag => 'Y'
52045 );
52046
52047 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
52048
52049 xla_ae_lines_pkg.set_segment(
52050 p_to_segment_code => 'GL_ACCOUNT'
52051 , p_segment_value => l_segment
52052 , p_from_segment_code => l_adr_value_segment_code
52053 , p_from_combination_id => l_adr_value_combination_id
52054 , p_value_type_code => l_adr_value_type_code
52055 , p_transaction_coa_id => l_adr_transaction_coa_id
52056 , p_accounting_coa_id => l_adr_accounting_coa_id
52057 , p_flexfield_segment_code => l_adr_flexfield_segment_code
52058 , p_flex_value_set_id => l_adr_flex_value_set_id
52062 , p_component_code => l_component_code
52059 , p_adr_code => 'FA_PROC_OF_SALE_LOSS_SEGMENT'
52060 , p_adr_type_code => 'S'
52061 , p_component_type => l_component_type
52063 , p_component_type_code => l_component_type_code
52064 , p_component_appl_id => l_component_appl_id
52065 , p_amb_context_code => l_amb_context_code
52066 , p_entity_code => 'TRANSACTIONS'
52067 , p_event_class_code => 'CIP_RETIREMENTS'
52068 , p_side => 'NA'
52069 );
52070
52071 END IF;
52072
52073 --
52074 --
52075 END IF;
52076 --
52077 -- Bug 4922099
52078 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
52079 (NVL(l_enc_upg_option, 'N') = 'O')
52080 ) AND
52081 (l_bflow_method_code = 'PRIOR_ENTRY')
52082 )
52083 THEN
52084 IF
52085 --
52086 1 = 2
52087 --
52088 THEN
52089 xla_accounting_err_pkg.build_message
52090 (p_appli_s_name => 'XLA'
52091 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
52092 ,p_token_1 => 'LINE_NUMBER'
52093 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
52094 ,p_token_2 => 'LINE_TYPE_NAME'
52095 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
52096 l_component_type
52097 ,l_component_code
52098 ,l_component_type_code
52099 ,l_component_appl_id
52100 ,l_amb_context_code
52101 ,l_entity_code
52102 ,l_event_class_code
52103 )
52104 ,p_token_3 => 'OWNER'
52105 ,p_value_3 => xla_lookups_pkg.get_meaning(
52106 p_lookup_type => 'XLA_OWNER_TYPE'
52107 ,p_lookup_code => l_component_type_code
52108 )
52109 ,p_token_4 => 'PRODUCT_NAME'
52110 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
52111 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
52112 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
52113 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
52114 ,p_ae_header_id => NULL
52115 );
52116
52117 IF (C_LEVEL_ERROR>= g_log_level) THEN
52118 trace
52119 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
52120 ,p_level => C_LEVEL_ERROR
52121 ,p_module => l_log_module);
52122 END IF;
52123 END IF;
52124 END IF;
52125 --
52126 --
52127 ------------------------------------------------------------------------------------------------
52128 -- 4219869 Business Flow
52129 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
52130 -- Prior Entry. Currently, the following code is always generated.
52131 ------------------------------------------------------------------------------------------------
52132 XLA_AE_LINES_PKG.ValidateCurrentLine;
52133
52134 ------------------------------------------------------------------------------------
52135 -- 4219869 Business Flow
52136 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
52137 ------------------------------------------------------------------------------------
52138 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
52139
52140 ----------------------------------------------------------------------------------
52141 -- 4219869 Business Flow
52142 -- Update journal entry status -- Need to generate this within IF <condition>
52143 ----------------------------------------------------------------------------------
52144 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
52145 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
52146 ,p_balance_type_code => l_balance_type_code
52147 );
52148
52149 -------------------------------------------------------------------------------------------
52150 -- 4262811 - Generate the Accrual Reversal lines
52151 -------------------------------------------------------------------------------------------
52152 BEGIN
52153 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
52157 END IF;
52154 (g_array_event(p_event_id).array_value_num('header_index'));
52155 IF l_acc_rev_flag IS NULL THEN
52156 l_acc_rev_flag := 'N';
52158 EXCEPTION
52159 WHEN OTHERS THEN
52160 l_acc_rev_flag := 'N';
52161 END;
52162 --
52163 IF (l_acc_rev_flag = 'Y') THEN
52164
52165 -- 4645092 ------------------------------------------------------------------------------
52166 -- To allow MPA report to determine if it should generate report process
52167 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
52168 ------------------------------------------------------------------------------------------
52169
52170 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
52171 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
52172 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
52173 -- call ADRs
52174 -- Bug 4922099
52175 --
52176 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
52177 (NVL(l_actual_upg_option, 'N') = 'O') OR
52178 (NVL(l_enc_upg_option, 'N') = 'O')
52179 )
52180 THEN
52181 NULL;
52182 --
52183 --
52184
52185 l_ccid := AcctDerRule_174(
52186 p_application_id => p_application_id
52187 , p_ae_header_id => l_ae_header_id
52188 , p_source_5 => p_source_5
52189 , p_source_32 => p_source_32
52190 , x_transaction_coa_id => l_adr_transaction_coa_id
52191 , x_accounting_coa_id => l_adr_accounting_coa_id
52192 , x_value_type_code => l_adr_value_type_code
52193 , p_side => 'NA'
52194 );
52195
52196 xla_ae_lines_pkg.set_ccid(
52197 p_code_combination_id => l_ccid
52198 , p_value_type_code => l_adr_value_type_code
52199 , p_transaction_coa_id => l_adr_transaction_coa_id
52200 , p_accounting_coa_id => l_adr_accounting_coa_id
52201 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
52202 , p_adr_type_code => 'S'
52203 , p_component_type => l_component_type
52204 , p_component_code => l_component_code
52205 , p_component_type_code => l_component_type_code
52206 , p_component_appl_id => l_component_appl_id
52207 , p_amb_context_code => l_amb_context_code
52208 , p_side => 'NA'
52209 );
52210
52211
52212 l_segment := AcctDerRule_169(
52213 p_application_id => p_application_id
52214 , p_ae_header_id => l_ae_header_id
52215 , p_source_5 => p_source_5
52216 , p_source_31 => p_source_31
52217 , x_transaction_coa_id => l_adr_transaction_coa_id
52218 , x_accounting_coa_id => l_adr_accounting_coa_id
52219 , x_flexfield_segment_code => l_adr_flexfield_segment_code
52220 , x_flex_value_set_id => l_adr_flex_value_set_id
52221 , x_value_type_code => l_adr_value_type_code
52222 , x_value_combination_id => l_adr_value_combination_id
52223 , x_value_segment_code => l_adr_value_segment_code
52224 , p_side => 'NA'
52225 , p_override_seg_flag => 'Y'
52226 );
52227
52228 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
52229
52230 xla_ae_lines_pkg.set_segment(
52231 p_to_segment_code => 'GL_BALANCING'
52232 , p_segment_value => l_segment
52233 , p_from_segment_code => l_adr_value_segment_code
52234 , p_from_combination_id => l_adr_value_combination_id
52235 , p_value_type_code => l_adr_value_type_code
52236 , p_transaction_coa_id => l_adr_transaction_coa_id
52237 , p_accounting_coa_id => l_adr_accounting_coa_id
52238 , p_flexfield_segment_code => l_adr_flexfield_segment_code
52239 , p_flex_value_set_id => l_adr_flex_value_set_id
52240 , p_adr_code => 'FA_EXPENSE_ACCT'
52241 , p_adr_type_code => 'S'
52242 , p_component_type => l_component_type
52243 , p_component_code => l_component_code
52244 , p_component_type_code => l_component_type_code
52245 , p_component_appl_id => l_component_appl_id
52246 , p_amb_context_code => l_amb_context_code
52247 , p_entity_code => 'TRANSACTIONS'
52248 , p_event_class_code => 'CIP_RETIREMENTS'
52249 , p_side => 'NA'
52250 );
52251
52252 END IF;
52253
52254 l_segment := AcctDerRule_164(
52255 p_application_id => p_application_id
52256 , p_ae_header_id => l_ae_header_id
52257 , p_source_5 => p_source_5
52258 , p_source_27 => p_source_27
52259 , x_transaction_coa_id => l_adr_transaction_coa_id
52260 , x_accounting_coa_id => l_adr_accounting_coa_id
52261 , x_flexfield_segment_code => l_adr_flexfield_segment_code
52262 , x_flex_value_set_id => l_adr_flex_value_set_id
52263 , x_value_type_code => l_adr_value_type_code
52264 , x_value_combination_id => l_adr_value_combination_id
52265 , x_value_segment_code => l_adr_value_segment_code
52266 , p_side => 'NA'
52270 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
52267 , p_override_seg_flag => 'Y'
52268 );
52269
52271
52272 xla_ae_lines_pkg.set_segment(
52273 p_to_segment_code => 'GL_ACCOUNT'
52274 , p_segment_value => l_segment
52275 , p_from_segment_code => l_adr_value_segment_code
52276 , p_from_combination_id => l_adr_value_combination_id
52277 , p_value_type_code => l_adr_value_type_code
52278 , p_transaction_coa_id => l_adr_transaction_coa_id
52279 , p_accounting_coa_id => l_adr_accounting_coa_id
52280 , p_flexfield_segment_code => l_adr_flexfield_segment_code
52281 , p_flex_value_set_id => l_adr_flex_value_set_id
52282 , p_adr_code => 'FA_PROC_OF_SALE_LOSS_SEGMENT'
52283 , p_adr_type_code => 'S'
52284 , p_component_type => l_component_type
52285 , p_component_code => l_component_code
52286 , p_component_type_code => l_component_type_code
52287 , p_component_appl_id => l_component_appl_id
52288 , p_amb_context_code => l_amb_context_code
52289 , p_entity_code => 'TRANSACTIONS'
52290 , p_event_class_code => 'CIP_RETIREMENTS'
52291 , p_side => 'NA'
52292 );
52293
52294 END IF;
52295
52296 --
52297 --
52298 END IF;
52299
52300 --
52301 -- Update the line information that should be overwritten
52302 --
52303 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
52304 p_header_num => 1);
52305 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
52306
52307 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
52308
52309 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
52310 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
52311 END IF;
52312
52313 --
52314 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
52315 --
52316 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
52317 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
52318 ELSE
52319 ---------------------------------------------------------------------------------------------------
52320 -- 4262811a Switch Sign
52321 ---------------------------------------------------------------------------------------------------
52322 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
52323 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
52324 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
52325 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
52326 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
52327 -- 5132302
52328 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
52329 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
52330
52331 END IF;
52332
52333 -- 4955764
52334 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
52335 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
52336
52337
52338 XLA_AE_LINES_PKG.ValidateCurrentLine;
52339 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
52340
52341 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
52342 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
52343 ,p_balance_type_code => l_balance_type_code);
52344
52345 END IF;
52346
52347 -----------------------------------------------------------------------------------------
52348 -- 4262811 Multiperiod Accounting
52349 -----------------------------------------------------------------------------------------
52350 -- No MPA option is assigned.
52351
52352
52353 END IF;
52354 END IF;
52355 --
52356
52357 --
52358 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
52359 trace
52360 (p_msg => 'END of AcctLineType_237'
52361 ,p_level => C_LEVEL_PROCEDURE
52362 ,p_module => l_log_module);
52363 END IF;
52364 --
52365 EXCEPTION
52366 WHEN xla_exceptions_pkg.application_exception THEN
52367 RAISE;
52368 WHEN OTHERS THEN
52369 xla_exceptions_pkg.raise_message
52370 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_237');
52371 END AcctLineType_237;
52372 --
52373
52374 ---------------------------------------
52375 --
52376 -- PRIVATE FUNCTION
52377 -- AcctLineType_238
52378 --
52379 ---------------------------------------
52380 PROCEDURE AcctLineType_238 (
52381 p_application_id IN NUMBER
52382 ,p_event_id IN NUMBER
52383 ,p_calculate_acctd_flag IN VARCHAR2
52384 ,p_calculate_g_l_flag IN VARCHAR2
52385 ,p_actual_flag IN OUT VARCHAR2
52389 --Period Close Date
52386 ,p_balance_type_code OUT VARCHAR2
52387 ,p_gain_or_loss_ref OUT VARCHAR2
52388
52390 , p_source_1 IN DATE
52391 --Generated Code Combination Identifier
52392 , p_source_5 IN NUMBER
52393 --Proceeds Of Sale Loss Account
52394 , p_source_27 IN VARCHAR2
52395 --Expense Account Code Combination Identifier
52396 , p_source_31 IN NUMBER
52397 --Default Code Combination Identifier
52398 , p_source_32 IN NUMBER
52399 --Adjustment Type
52400 , p_source_48 IN VARCHAR2
52401 --Transaction Header Identifier
52402 , p_source_49 IN NUMBER
52403 --Adjustment Line Identifier
52404 , p_source_50 IN NUMBER
52405 --Distribution Type Code
52406 , p_source_51 IN VARCHAR2
52407 --Entered Amount
52408 , p_source_52 IN NUMBER
52409 --Currency Code
52410 , p_source_53 IN VARCHAR2
52411 --Gain Loss Amount
52412 , p_source_54 IN NUMBER
52413 )
52414 IS
52415
52416 l_component_type VARCHAR2(80);
52417 l_component_code VARCHAR2(30);
52418 l_component_type_code VARCHAR2(1);
52419 l_component_appl_id INTEGER;
52420 l_amb_context_code VARCHAR2(30);
52421 l_entity_code VARCHAR2(30);
52422 l_event_class_code VARCHAR2(30);
52423 l_ae_header_id NUMBER;
52424 l_event_type_code VARCHAR2(30);
52425 l_line_definition_code VARCHAR2(30);
52426 l_line_definition_owner_code VARCHAR2(1);
52427 --
52428 -- adr variables
52429 l_segment VARCHAR2(30);
52430 l_ccid NUMBER;
52431 l_adr_transaction_coa_id NUMBER;
52432 l_adr_accounting_coa_id NUMBER;
52433 l_adr_flexfield_segment_code VARCHAR2(30);
52434 l_adr_flex_value_set_id NUMBER;
52435 l_adr_value_type_code VARCHAR2(30);
52436 l_adr_value_combination_id NUMBER;
52437 l_adr_value_segment_code VARCHAR2(30);
52438
52439 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
52440 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
52441 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
52442 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
52443
52444 -- 4262811 Variables ------------------------------------------------------------------------------------------
52445 l_entered_amt_idx NUMBER;
52446 l_accted_amt_idx NUMBER;
52447 l_acc_rev_flag VARCHAR2(1);
52448 l_accrual_line_num NUMBER;
52449 l_tmp_amt NUMBER;
52450 l_acc_rev_natural_side_code VARCHAR2(1);
52451
52452 l_num_entries NUMBER;
52453 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
52454 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
52455 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
52456 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
52457 l_recog_line_1 NUMBER;
52458 l_recog_line_2 NUMBER;
52459
52460 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
52461 l_bflow_applied_to_amt NUMBER; -- 5132302
52462 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
52463
52464 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
52465
52466 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
52467 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
52468
52469 ---------------------------------------------------------------------------------------------------------------
52470
52471
52472 --
52473 -- bulk performance
52474 --
52475 l_balance_type_code VARCHAR2(1);
52476 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
52477 l_log_module VARCHAR2(240);
52478
52479 --
52480 -- Upgrade strategy
52481 --
52482 l_actual_upg_option VARCHAR2(1);
52483 l_enc_upg_option VARCHAR2(1);
52484
52485 --
52486 BEGIN
52487 --
52488 IF g_log_enabled THEN
52489 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_238';
52490 END IF;
52491 --
52492 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
52493
52494 trace
52495 (p_msg => 'BEGIN of AcctLineType_238'
52496 ,p_level => C_LEVEL_PROCEDURE
52497 ,p_module => l_log_module);
52498
52499 END IF;
52500 --
52501 l_component_type := 'AMB_JLT';
52502 l_component_code := 'FA_CIP_PROC_OF_SALE_LOSS';
52503 l_component_type_code := 'S';
52504 l_component_appl_id := 140;
52505 l_amb_context_code := 'DEFAULT';
52506 l_entity_code := 'TRANSACTIONS';
52507 l_event_class_code := 'CIP_RETIREMENTS';
52508 l_event_type_code := 'CIP_REINSTATEMENTS';
52509 l_line_definition_owner_code := 'S';
52510 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
52511 --
52512 l_balance_type_code := 'A';
52513 l_segment := NULL;
52514 l_ccid := NULL;
52515 l_adr_transaction_coa_id := NULL;
52516 l_adr_accounting_coa_id := NULL;
52520 l_adr_value_combination_id := NULL;
52517 l_adr_flexfield_segment_code := NULL;
52518 l_adr_flex_value_set_id := NULL;
52519 l_adr_value_type_code := NULL;
52521 l_adr_value_segment_code := NULL;
52522
52523 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
52524 l_bflow_class_code := ''; -- 4219869 Business Flow
52525 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
52526 l_budgetary_control_flag := 'N';
52527
52528 l_bflow_applied_to_amt_idx := NULL; -- 5132302
52529 l_bflow_applied_to_amt := NULL; -- 5132302
52530 l_entered_amt_idx := NULL; -- 4262811
52531 l_accted_amt_idx := NULL; -- 4262811
52532 l_acc_rev_flag := NULL; -- 4262811
52533 l_accrual_line_num := NULL; -- 4262811
52534 l_tmp_amt := NULL; -- 4262811
52535 --
52536
52537 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
52538 l_balance_type_code <> 'B' THEN
52539 IF NVL(p_source_48,'
52540 ') = 'PROCEEDS' AND
52541 p_source_54 < 0
52542 THEN
52543
52544 --
52545 XLA_AE_LINES_PKG.SetNewLine;
52546
52547 p_balance_type_code := l_balance_type_code;
52548 -- set the flag so later we will know whether the gain loss line needs to be created
52549
52550 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
52551 p_actual_flag :='A';
52552 END IF;
52553
52554 --
52555 -- bulk performance
52556 --
52557 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
52558 p_header_num => 0); -- 4262811
52559 --
52560 -- set accounting line options
52561 --
52562 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
52563 p_natural_side_code => 'C'
52564 , p_gain_or_loss_flag => 'N'
52565 , p_gl_transfer_mode_code => 'S'
52566 , p_acct_entry_type_code => 'A'
52567 , p_switch_side_flag => 'Y'
52568 , p_merge_duplicate_code => 'N'
52569 );
52570 --
52571 l_acc_rev_natural_side_code := 'D'; -- 4262811
52572 --
52573 --
52574 -- set accounting line type info
52575 --
52576 xla_ae_lines_pkg.SetAcctLineType
52577 (p_component_type => l_component_type
52578 ,p_event_type_code => l_event_type_code
52579 ,p_line_definition_owner_code => l_line_definition_owner_code
52580 ,p_line_definition_code => l_line_definition_code
52581 ,p_accounting_line_code => l_component_code
52582 ,p_accounting_line_type_code => l_component_type_code
52583 ,p_accounting_line_appl_id => l_component_appl_id
52584 ,p_amb_context_code => l_amb_context_code
52585 ,p_entity_code => l_entity_code
52586 ,p_event_class_code => l_event_class_code);
52587 --
52588 -- set accounting class
52589 --
52590 xla_ae_lines_pkg.SetAcctClass(
52591 p_accounting_class_code => 'ASSET'
52592 , p_ae_header_id => l_ae_header_id
52593 );
52594
52595 --
52596 -- set rounding class
52597 --
52598 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
52599 'ASSET';
52600
52601 --
52602 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
52603 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
52604 --
52605 -- bulk performance
52606 --
52607 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
52608
52609 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
52610 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
52611
52612 -- 4955764
52613 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
52614 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
52615
52616 -- 4458381 Public Sector Enh
52617
52618 --
52619 -- set accounting attributes for the line type
52620 --
52621 l_entered_amt_idx := 4;
52622 l_accted_amt_idx := 6;
52623 l_bflow_applied_to_amt_idx := NULL; -- 5132302
52624 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
52625 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
52626 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
52627 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
52628 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
52629 l_rec_acct_attrs.array_char_value(3) := p_source_51;
52630 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
52631 l_rec_acct_attrs.array_num_value(4) := p_source_52;
52632 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
52633 l_rec_acct_attrs.array_char_value(5) := p_source_53;
52634 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
52635 l_rec_acct_attrs.array_num_value(6) := p_source_52;
52636
52637 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
52641 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
52638 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
52639
52640 ---------------------------------------------------------------------------------------------------------------
52642 ---------------------------------------------------------------------------------------------------------------
52643 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
52644
52645 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
52646 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
52647
52648 IF xla_accounting_cache_pkg.GetValueChar
52649 (p_source_code => 'LEDGER_CATEGORY_CODE'
52650 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
52651 AND l_bflow_method_code = 'PRIOR_ENTRY'
52652 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
52653 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
52654 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
52655 )
52656 THEN
52657 xla_ae_lines_pkg.BflowUpgEntry
52658 (p_business_method_code => l_bflow_method_code
52659 ,p_business_class_code => l_bflow_class_code
52660 ,p_balance_type => l_balance_type_code);
52661 ELSE
52662 NULL;
52663 -- No business flow processing for business flow method of NONE.
52664 END IF;
52665
52666 --
52667 -- call analytical criteria
52668 --
52669
52670 --
52671 -- call description
52672 --
52673
52674 xla_ae_lines_pkg.SetLineDescription(
52675 p_ae_header_id => l_ae_header_id
52676 ,p_description => Description_35 (
52677 p_application_id => p_application_id
52678 , p_ae_header_id => l_ae_header_id
52679 , p_source_1 => p_source_1
52680 )
52681 );
52682
52683
52684 --
52685 -- call ADRs
52686 -- Bug 4922099
52687 --
52688 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
52689 (NVL(l_actual_upg_option, 'N') = 'O') OR
52690 (NVL(l_enc_upg_option, 'N') = 'O')
52691 )
52692 THEN
52693 NULL;
52694 --
52695 --
52696
52697 l_ccid := AcctDerRule_174(
52698 p_application_id => p_application_id
52699 , p_ae_header_id => l_ae_header_id
52700 , p_source_5 => p_source_5
52701 , p_source_32 => p_source_32
52702 , x_transaction_coa_id => l_adr_transaction_coa_id
52703 , x_accounting_coa_id => l_adr_accounting_coa_id
52704 , x_value_type_code => l_adr_value_type_code
52705 , p_side => 'NA'
52706 );
52707
52708 xla_ae_lines_pkg.set_ccid(
52709 p_code_combination_id => l_ccid
52710 , p_value_type_code => l_adr_value_type_code
52711 , p_transaction_coa_id => l_adr_transaction_coa_id
52712 , p_accounting_coa_id => l_adr_accounting_coa_id
52713 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
52714 , p_adr_type_code => 'S'
52715 , p_component_type => l_component_type
52716 , p_component_code => l_component_code
52717 , p_component_type_code => l_component_type_code
52718 , p_component_appl_id => l_component_appl_id
52719 , p_amb_context_code => l_amb_context_code
52720 , p_side => 'NA'
52721 );
52722
52723
52724 l_segment := AcctDerRule_169(
52725 p_application_id => p_application_id
52726 , p_ae_header_id => l_ae_header_id
52727 , p_source_5 => p_source_5
52728 , p_source_31 => p_source_31
52729 , x_transaction_coa_id => l_adr_transaction_coa_id
52730 , x_accounting_coa_id => l_adr_accounting_coa_id
52731 , x_flexfield_segment_code => l_adr_flexfield_segment_code
52732 , x_flex_value_set_id => l_adr_flex_value_set_id
52733 , x_value_type_code => l_adr_value_type_code
52734 , x_value_combination_id => l_adr_value_combination_id
52735 , x_value_segment_code => l_adr_value_segment_code
52736 , p_side => 'NA'
52737 , p_override_seg_flag => 'Y'
52738 );
52739
52740 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
52741
52742 xla_ae_lines_pkg.set_segment(
52743 p_to_segment_code => 'GL_BALANCING'
52744 , p_segment_value => l_segment
52745 , p_from_segment_code => l_adr_value_segment_code
52746 , p_from_combination_id => l_adr_value_combination_id
52747 , p_value_type_code => l_adr_value_type_code
52748 , p_transaction_coa_id => l_adr_transaction_coa_id
52749 , p_accounting_coa_id => l_adr_accounting_coa_id
52750 , p_flexfield_segment_code => l_adr_flexfield_segment_code
52751 , p_flex_value_set_id => l_adr_flex_value_set_id
52752 , p_adr_code => 'FA_EXPENSE_ACCT'
52753 , p_adr_type_code => 'S'
52754 , p_component_type => l_component_type
52758 , p_amb_context_code => l_amb_context_code
52755 , p_component_code => l_component_code
52756 , p_component_type_code => l_component_type_code
52757 , p_component_appl_id => l_component_appl_id
52759 , p_entity_code => 'TRANSACTIONS'
52760 , p_event_class_code => 'CIP_RETIREMENTS'
52761 , p_side => 'NA'
52762 );
52763
52764 END IF;
52765
52766 l_segment := AcctDerRule_164(
52767 p_application_id => p_application_id
52768 , p_ae_header_id => l_ae_header_id
52769 , p_source_5 => p_source_5
52770 , p_source_27 => p_source_27
52771 , x_transaction_coa_id => l_adr_transaction_coa_id
52772 , x_accounting_coa_id => l_adr_accounting_coa_id
52773 , x_flexfield_segment_code => l_adr_flexfield_segment_code
52774 , x_flex_value_set_id => l_adr_flex_value_set_id
52775 , x_value_type_code => l_adr_value_type_code
52776 , x_value_combination_id => l_adr_value_combination_id
52777 , x_value_segment_code => l_adr_value_segment_code
52778 , p_side => 'NA'
52779 , p_override_seg_flag => 'Y'
52780 );
52781
52782 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
52783
52784 xla_ae_lines_pkg.set_segment(
52785 p_to_segment_code => 'GL_ACCOUNT'
52786 , p_segment_value => l_segment
52787 , p_from_segment_code => l_adr_value_segment_code
52788 , p_from_combination_id => l_adr_value_combination_id
52789 , p_value_type_code => l_adr_value_type_code
52790 , p_transaction_coa_id => l_adr_transaction_coa_id
52791 , p_accounting_coa_id => l_adr_accounting_coa_id
52792 , p_flexfield_segment_code => l_adr_flexfield_segment_code
52793 , p_flex_value_set_id => l_adr_flex_value_set_id
52794 , p_adr_code => 'FA_PROC_OF_SALE_LOSS_SEGMENT'
52795 , p_adr_type_code => 'S'
52796 , p_component_type => l_component_type
52797 , p_component_code => l_component_code
52798 , p_component_type_code => l_component_type_code
52799 , p_component_appl_id => l_component_appl_id
52800 , p_amb_context_code => l_amb_context_code
52801 , p_entity_code => 'TRANSACTIONS'
52802 , p_event_class_code => 'CIP_RETIREMENTS'
52803 , p_side => 'NA'
52804 );
52805
52806 END IF;
52807
52808 --
52809 --
52810 END IF;
52811 --
52812 -- Bug 4922099
52813 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
52814 (NVL(l_enc_upg_option, 'N') = 'O')
52815 ) AND
52816 (l_bflow_method_code = 'PRIOR_ENTRY')
52817 )
52818 THEN
52819 IF
52820 --
52821 1 = 2
52822 --
52823 THEN
52824 xla_accounting_err_pkg.build_message
52825 (p_appli_s_name => 'XLA'
52826 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
52827 ,p_token_1 => 'LINE_NUMBER'
52828 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
52829 ,p_token_2 => 'LINE_TYPE_NAME'
52830 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
52831 l_component_type
52832 ,l_component_code
52833 ,l_component_type_code
52834 ,l_component_appl_id
52835 ,l_amb_context_code
52836 ,l_entity_code
52837 ,l_event_class_code
52838 )
52839 ,p_token_3 => 'OWNER'
52840 ,p_value_3 => xla_lookups_pkg.get_meaning(
52841 p_lookup_type => 'XLA_OWNER_TYPE'
52842 ,p_lookup_code => l_component_type_code
52843 )
52844 ,p_token_4 => 'PRODUCT_NAME'
52845 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
52846 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
52847 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
52848 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
52849 ,p_ae_header_id => NULL
52850 );
52851
52852 IF (C_LEVEL_ERROR>= g_log_level) THEN
52853 trace
52857 END IF;
52854 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
52855 ,p_level => C_LEVEL_ERROR
52856 ,p_module => l_log_module);
52858 END IF;
52859 END IF;
52860 --
52861 --
52862 ------------------------------------------------------------------------------------------------
52863 -- 4219869 Business Flow
52864 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
52865 -- Prior Entry. Currently, the following code is always generated.
52866 ------------------------------------------------------------------------------------------------
52867 XLA_AE_LINES_PKG.ValidateCurrentLine;
52868
52869 ------------------------------------------------------------------------------------
52870 -- 4219869 Business Flow
52871 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
52872 ------------------------------------------------------------------------------------
52873 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
52874
52875 ----------------------------------------------------------------------------------
52876 -- 4219869 Business Flow
52877 -- Update journal entry status -- Need to generate this within IF <condition>
52878 ----------------------------------------------------------------------------------
52879 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
52880 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
52881 ,p_balance_type_code => l_balance_type_code
52882 );
52883
52884 -------------------------------------------------------------------------------------------
52885 -- 4262811 - Generate the Accrual Reversal lines
52886 -------------------------------------------------------------------------------------------
52887 BEGIN
52888 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
52889 (g_array_event(p_event_id).array_value_num('header_index'));
52890 IF l_acc_rev_flag IS NULL THEN
52891 l_acc_rev_flag := 'N';
52892 END IF;
52893 EXCEPTION
52894 WHEN OTHERS THEN
52895 l_acc_rev_flag := 'N';
52896 END;
52897 --
52898 IF (l_acc_rev_flag = 'Y') THEN
52899
52900 -- 4645092 ------------------------------------------------------------------------------
52901 -- To allow MPA report to determine if it should generate report process
52902 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
52903 ------------------------------------------------------------------------------------------
52904
52905 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
52906 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
52907 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
52908 -- call ADRs
52909 -- Bug 4922099
52910 --
52911 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
52912 (NVL(l_actual_upg_option, 'N') = 'O') OR
52913 (NVL(l_enc_upg_option, 'N') = 'O')
52914 )
52915 THEN
52916 NULL;
52917 --
52918 --
52919
52920 l_ccid := AcctDerRule_174(
52921 p_application_id => p_application_id
52922 , p_ae_header_id => l_ae_header_id
52923 , p_source_5 => p_source_5
52924 , p_source_32 => p_source_32
52925 , x_transaction_coa_id => l_adr_transaction_coa_id
52926 , x_accounting_coa_id => l_adr_accounting_coa_id
52927 , x_value_type_code => l_adr_value_type_code
52928 , p_side => 'NA'
52929 );
52930
52931 xla_ae_lines_pkg.set_ccid(
52932 p_code_combination_id => l_ccid
52933 , p_value_type_code => l_adr_value_type_code
52934 , p_transaction_coa_id => l_adr_transaction_coa_id
52935 , p_accounting_coa_id => l_adr_accounting_coa_id
52936 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
52937 , p_adr_type_code => 'S'
52938 , p_component_type => l_component_type
52939 , p_component_code => l_component_code
52940 , p_component_type_code => l_component_type_code
52941 , p_component_appl_id => l_component_appl_id
52942 , p_amb_context_code => l_amb_context_code
52943 , p_side => 'NA'
52944 );
52945
52946
52947 l_segment := AcctDerRule_169(
52948 p_application_id => p_application_id
52949 , p_ae_header_id => l_ae_header_id
52950 , p_source_5 => p_source_5
52951 , p_source_31 => p_source_31
52952 , x_transaction_coa_id => l_adr_transaction_coa_id
52953 , x_accounting_coa_id => l_adr_accounting_coa_id
52954 , x_flexfield_segment_code => l_adr_flexfield_segment_code
52955 , x_flex_value_set_id => l_adr_flex_value_set_id
52956 , x_value_type_code => l_adr_value_type_code
52957 , x_value_combination_id => l_adr_value_combination_id
52958 , x_value_segment_code => l_adr_value_segment_code
52959 , p_side => 'NA'
52960 , p_override_seg_flag => 'Y'
52961 );
52962
52963 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
52964
52965 xla_ae_lines_pkg.set_segment(
52966 p_to_segment_code => 'GL_BALANCING'
52970 , p_value_type_code => l_adr_value_type_code
52967 , p_segment_value => l_segment
52968 , p_from_segment_code => l_adr_value_segment_code
52969 , p_from_combination_id => l_adr_value_combination_id
52971 , p_transaction_coa_id => l_adr_transaction_coa_id
52972 , p_accounting_coa_id => l_adr_accounting_coa_id
52973 , p_flexfield_segment_code => l_adr_flexfield_segment_code
52974 , p_flex_value_set_id => l_adr_flex_value_set_id
52975 , p_adr_code => 'FA_EXPENSE_ACCT'
52976 , p_adr_type_code => 'S'
52977 , p_component_type => l_component_type
52978 , p_component_code => l_component_code
52979 , p_component_type_code => l_component_type_code
52980 , p_component_appl_id => l_component_appl_id
52981 , p_amb_context_code => l_amb_context_code
52982 , p_entity_code => 'TRANSACTIONS'
52983 , p_event_class_code => 'CIP_RETIREMENTS'
52984 , p_side => 'NA'
52985 );
52986
52987 END IF;
52988
52989 l_segment := AcctDerRule_164(
52990 p_application_id => p_application_id
52991 , p_ae_header_id => l_ae_header_id
52992 , p_source_5 => p_source_5
52993 , p_source_27 => p_source_27
52994 , x_transaction_coa_id => l_adr_transaction_coa_id
52995 , x_accounting_coa_id => l_adr_accounting_coa_id
52996 , x_flexfield_segment_code => l_adr_flexfield_segment_code
52997 , x_flex_value_set_id => l_adr_flex_value_set_id
52998 , x_value_type_code => l_adr_value_type_code
52999 , x_value_combination_id => l_adr_value_combination_id
53000 , x_value_segment_code => l_adr_value_segment_code
53001 , p_side => 'NA'
53002 , p_override_seg_flag => 'Y'
53003 );
53004
53005 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
53006
53007 xla_ae_lines_pkg.set_segment(
53008 p_to_segment_code => 'GL_ACCOUNT'
53009 , p_segment_value => l_segment
53010 , p_from_segment_code => l_adr_value_segment_code
53011 , p_from_combination_id => l_adr_value_combination_id
53012 , p_value_type_code => l_adr_value_type_code
53013 , p_transaction_coa_id => l_adr_transaction_coa_id
53014 , p_accounting_coa_id => l_adr_accounting_coa_id
53015 , p_flexfield_segment_code => l_adr_flexfield_segment_code
53016 , p_flex_value_set_id => l_adr_flex_value_set_id
53017 , p_adr_code => 'FA_PROC_OF_SALE_LOSS_SEGMENT'
53018 , p_adr_type_code => 'S'
53019 , p_component_type => l_component_type
53020 , p_component_code => l_component_code
53021 , p_component_type_code => l_component_type_code
53022 , p_component_appl_id => l_component_appl_id
53023 , p_amb_context_code => l_amb_context_code
53024 , p_entity_code => 'TRANSACTIONS'
53025 , p_event_class_code => 'CIP_RETIREMENTS'
53026 , p_side => 'NA'
53027 );
53028
53029 END IF;
53030
53031 --
53032 --
53033 END IF;
53034
53035 --
53036 -- Update the line information that should be overwritten
53037 --
53038 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
53039 p_header_num => 1);
53040 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
53041
53042 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
53043
53044 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
53045 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
53046 END IF;
53047
53048 --
53049 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
53050 --
53051 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
53052 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
53053 ELSE
53054 ---------------------------------------------------------------------------------------------------
53055 -- 4262811a Switch Sign
53056 ---------------------------------------------------------------------------------------------------
53057 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
53058 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
53059 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
53060 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
53061 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
53062 -- 5132302
53063 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
53064 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
53065
53066 END IF;
53067
53068 -- 4955764
53072
53069 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
53070 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
53071
53073 XLA_AE_LINES_PKG.ValidateCurrentLine;
53074 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
53075
53076 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
53077 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
53078 ,p_balance_type_code => l_balance_type_code);
53079
53080 END IF;
53081
53082 -----------------------------------------------------------------------------------------
53083 -- 4262811 Multiperiod Accounting
53084 -----------------------------------------------------------------------------------------
53085 -- No MPA option is assigned.
53086
53087
53088 END IF;
53089 END IF;
53090 --
53091
53092 --
53093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
53094 trace
53095 (p_msg => 'END of AcctLineType_238'
53096 ,p_level => C_LEVEL_PROCEDURE
53097 ,p_module => l_log_module);
53098 END IF;
53099 --
53100 EXCEPTION
53101 WHEN xla_exceptions_pkg.application_exception THEN
53102 RAISE;
53103 WHEN OTHERS THEN
53104 xla_exceptions_pkg.raise_message
53105 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_238');
53106 END AcctLineType_238;
53107 --
53108
53109 ---------------------------------------
53110 --
53111 -- PRIVATE FUNCTION
53112 -- AcctLineType_239
53113 --
53114 ---------------------------------------
53115 PROCEDURE AcctLineType_239 (
53116 p_application_id IN NUMBER
53117 ,p_event_id IN NUMBER
53118 ,p_calculate_acctd_flag IN VARCHAR2
53119 ,p_calculate_g_l_flag IN VARCHAR2
53120 ,p_actual_flag IN OUT VARCHAR2
53121 ,p_balance_type_code OUT VARCHAR2
53122 ,p_gain_or_loss_ref OUT VARCHAR2
53123
53124 --Period Close Date
53125 , p_source_1 IN DATE
53126 --Generated Code Combination Identifier
53127 , p_source_5 IN NUMBER
53128 --CIP Cost Account
53129 , p_source_9 IN VARCHAR2
53130 --Expense Account Code Combination Identifier
53131 , p_source_31 IN NUMBER
53132 --Default Code Combination Identifier
53133 , p_source_32 IN NUMBER
53134 --Adjustment Type
53135 , p_source_48 IN VARCHAR2
53136 --Transaction Header Identifier
53137 , p_source_49 IN NUMBER
53138 --Adjustment Line Identifier
53139 , p_source_50 IN NUMBER
53140 --Distribution Type Code
53141 , p_source_51 IN VARCHAR2
53142 --Entered Amount
53143 , p_source_52 IN NUMBER
53144 --Currency Code
53145 , p_source_53 IN VARCHAR2
53146 --Source Destination Code
53147 , p_source_55 IN VARCHAR2
53148 )
53149 IS
53150
53151 l_component_type VARCHAR2(80);
53152 l_component_code VARCHAR2(30);
53153 l_component_type_code VARCHAR2(1);
53154 l_component_appl_id INTEGER;
53155 l_amb_context_code VARCHAR2(30);
53156 l_entity_code VARCHAR2(30);
53157 l_event_class_code VARCHAR2(30);
53158 l_ae_header_id NUMBER;
53159 l_event_type_code VARCHAR2(30);
53160 l_line_definition_code VARCHAR2(30);
53161 l_line_definition_owner_code VARCHAR2(1);
53162 --
53163 -- adr variables
53164 l_segment VARCHAR2(30);
53165 l_ccid NUMBER;
53166 l_adr_transaction_coa_id NUMBER;
53167 l_adr_accounting_coa_id NUMBER;
53168 l_adr_flexfield_segment_code VARCHAR2(30);
53169 l_adr_flex_value_set_id NUMBER;
53170 l_adr_value_type_code VARCHAR2(30);
53171 l_adr_value_combination_id NUMBER;
53172 l_adr_value_segment_code VARCHAR2(30);
53173
53174 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
53175 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
53176 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
53177 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
53178
53179 -- 4262811 Variables ------------------------------------------------------------------------------------------
53180 l_entered_amt_idx NUMBER;
53181 l_accted_amt_idx NUMBER;
53182 l_acc_rev_flag VARCHAR2(1);
53183 l_accrual_line_num NUMBER;
53184 l_tmp_amt NUMBER;
53185 l_acc_rev_natural_side_code VARCHAR2(1);
53186
53187 l_num_entries NUMBER;
53188 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
53189 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
53190 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
53191 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
53192 l_recog_line_1 NUMBER;
53193 l_recog_line_2 NUMBER;
53194
53195 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
53196 l_bflow_applied_to_amt NUMBER; -- 5132302
53197 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
53198
53202 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
53199 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
53200
53201 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
53203
53204 ---------------------------------------------------------------------------------------------------------------
53205
53206
53207 --
53208 -- bulk performance
53209 --
53210 l_balance_type_code VARCHAR2(1);
53211 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
53212 l_log_module VARCHAR2(240);
53213
53214 --
53215 -- Upgrade strategy
53216 --
53217 l_actual_upg_option VARCHAR2(1);
53218 l_enc_upg_option VARCHAR2(1);
53219
53220 --
53221 BEGIN
53222 --
53223 IF g_log_enabled THEN
53224 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_239';
53225 END IF;
53226 --
53227 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
53228
53229 trace
53230 (p_msg => 'BEGIN of AcctLineType_239'
53231 ,p_level => C_LEVEL_PROCEDURE
53232 ,p_module => l_log_module);
53233
53234 END IF;
53235 --
53236 l_component_type := 'AMB_JLT';
53237 l_component_code := 'FA_CIP_RECLASS_DEST_COST';
53238 l_component_type_code := 'S';
53239 l_component_appl_id := 140;
53240 l_amb_context_code := 'DEFAULT';
53241 l_entity_code := 'TRANSACTIONS';
53242 l_event_class_code := 'CIP_CATEGORY_RECLASS';
53243 l_event_type_code := 'CIP_CATEGORY_RECLASS_ALL';
53244 l_line_definition_owner_code := 'S';
53245 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_CA7';
53246 --
53247 l_balance_type_code := 'A';
53248 l_segment := NULL;
53249 l_ccid := NULL;
53250 l_adr_transaction_coa_id := NULL;
53251 l_adr_accounting_coa_id := NULL;
53252 l_adr_flexfield_segment_code := NULL;
53253 l_adr_flex_value_set_id := NULL;
53254 l_adr_value_type_code := NULL;
53255 l_adr_value_combination_id := NULL;
53256 l_adr_value_segment_code := NULL;
53257
53258 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
53259 l_bflow_class_code := ''; -- 4219869 Business Flow
53260 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
53261 l_budgetary_control_flag := 'N';
53262
53263 l_bflow_applied_to_amt_idx := NULL; -- 5132302
53264 l_bflow_applied_to_amt := NULL; -- 5132302
53265 l_entered_amt_idx := NULL; -- 4262811
53266 l_accted_amt_idx := NULL; -- 4262811
53267 l_acc_rev_flag := NULL; -- 4262811
53268 l_accrual_line_num := NULL; -- 4262811
53269 l_tmp_amt := NULL; -- 4262811
53270 --
53271
53272 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
53273 l_balance_type_code <> 'B' THEN
53274 IF NVL(p_source_48,'
53275 ') = 'CIP COST' AND
53276 NVL(p_source_55,'
53277 ') = 'DEST'
53278 THEN
53279
53280 --
53281 XLA_AE_LINES_PKG.SetNewLine;
53282
53283 p_balance_type_code := l_balance_type_code;
53284 -- set the flag so later we will know whether the gain loss line needs to be created
53285
53286 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
53287 p_actual_flag :='A';
53288 END IF;
53289
53290 --
53291 -- bulk performance
53292 --
53293 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
53294 p_header_num => 0); -- 4262811
53295 --
53296 -- set accounting line options
53297 --
53298 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
53299 p_natural_side_code => 'D'
53300 , p_gain_or_loss_flag => 'N'
53301 , p_gl_transfer_mode_code => 'S'
53302 , p_acct_entry_type_code => 'A'
53303 , p_switch_side_flag => 'Y'
53304 , p_merge_duplicate_code => 'N'
53305 );
53306 --
53307 l_acc_rev_natural_side_code := 'C'; -- 4262811
53308 --
53309 --
53310 -- set accounting line type info
53311 --
53312 xla_ae_lines_pkg.SetAcctLineType
53313 (p_component_type => l_component_type
53314 ,p_event_type_code => l_event_type_code
53315 ,p_line_definition_owner_code => l_line_definition_owner_code
53316 ,p_line_definition_code => l_line_definition_code
53317 ,p_accounting_line_code => l_component_code
53318 ,p_accounting_line_type_code => l_component_type_code
53319 ,p_accounting_line_appl_id => l_component_appl_id
53320 ,p_amb_context_code => l_amb_context_code
53321 ,p_entity_code => l_entity_code
53322 ,p_event_class_code => l_event_class_code);
53323 --
53324 -- set accounting class
53325 --
53326 xla_ae_lines_pkg.SetAcctClass(
53327 p_accounting_class_code => 'ASSET'
53328 , p_ae_header_id => l_ae_header_id
53329 );
53330
53331 --
53332 -- set rounding class
53333 --
53337 --
53334 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
53335 'ASSET';
53336
53338 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
53339 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
53340 --
53341 -- bulk performance
53342 --
53343 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
53344
53345 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
53346 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
53347
53348 -- 4955764
53349 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
53350 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
53351
53352 -- 4458381 Public Sector Enh
53353
53354 --
53355 -- set accounting attributes for the line type
53356 --
53357 l_entered_amt_idx := 4;
53358 l_accted_amt_idx := 6;
53359 l_bflow_applied_to_amt_idx := NULL; -- 5132302
53360 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
53361 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
53362 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
53363 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
53364 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
53365 l_rec_acct_attrs.array_char_value(3) := p_source_51;
53366 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
53367 l_rec_acct_attrs.array_num_value(4) := p_source_52;
53368 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
53369 l_rec_acct_attrs.array_char_value(5) := p_source_53;
53370 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
53371 l_rec_acct_attrs.array_num_value(6) := p_source_52;
53372
53373 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
53374 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
53375
53376 ---------------------------------------------------------------------------------------------------------------
53377 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
53378 ---------------------------------------------------------------------------------------------------------------
53379 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
53380
53381 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
53382 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
53383
53384 IF xla_accounting_cache_pkg.GetValueChar
53385 (p_source_code => 'LEDGER_CATEGORY_CODE'
53386 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
53387 AND l_bflow_method_code = 'PRIOR_ENTRY'
53388 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
53389 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
53390 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
53391 )
53392 THEN
53393 xla_ae_lines_pkg.BflowUpgEntry
53394 (p_business_method_code => l_bflow_method_code
53395 ,p_business_class_code => l_bflow_class_code
53396 ,p_balance_type => l_balance_type_code);
53397 ELSE
53398 NULL;
53399 -- No business flow processing for business flow method of NONE.
53400 END IF;
53401
53402 --
53403 -- call analytical criteria
53404 --
53405
53406 --
53407 -- call description
53408 --
53409
53410 xla_ae_lines_pkg.SetLineDescription(
53411 p_ae_header_id => l_ae_header_id
53412 ,p_description => Description_29 (
53413 p_application_id => p_application_id
53414 , p_ae_header_id => l_ae_header_id
53415 , p_source_1 => p_source_1
53416 )
53417 );
53418
53419
53420 --
53421 -- call ADRs
53422 -- Bug 4922099
53423 --
53424 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
53425 (NVL(l_actual_upg_option, 'N') = 'O') OR
53426 (NVL(l_enc_upg_option, 'N') = 'O')
53427 )
53428 THEN
53429 NULL;
53430 --
53431 --
53432
53433 l_ccid := AcctDerRule_174(
53434 p_application_id => p_application_id
53435 , p_ae_header_id => l_ae_header_id
53436 , p_source_5 => p_source_5
53437 , p_source_32 => p_source_32
53438 , x_transaction_coa_id => l_adr_transaction_coa_id
53439 , x_accounting_coa_id => l_adr_accounting_coa_id
53440 , x_value_type_code => l_adr_value_type_code
53441 , p_side => 'NA'
53442 );
53443
53444 xla_ae_lines_pkg.set_ccid(
53445 p_code_combination_id => l_ccid
53446 , p_value_type_code => l_adr_value_type_code
53447 , p_transaction_coa_id => l_adr_transaction_coa_id
53448 , p_accounting_coa_id => l_adr_accounting_coa_id
53449 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
53450 , p_adr_type_code => 'S'
53451 , p_component_type => l_component_type
53455 , p_amb_context_code => l_amb_context_code
53452 , p_component_code => l_component_code
53453 , p_component_type_code => l_component_type_code
53454 , p_component_appl_id => l_component_appl_id
53456 , p_side => 'NA'
53457 );
53458
53459
53460 l_segment := AcctDerRule_147(
53461 p_application_id => p_application_id
53462 , p_ae_header_id => l_ae_header_id
53463 , p_source_5 => p_source_5
53464 , p_source_9 => p_source_9
53465 , x_transaction_coa_id => l_adr_transaction_coa_id
53466 , x_accounting_coa_id => l_adr_accounting_coa_id
53467 , x_flexfield_segment_code => l_adr_flexfield_segment_code
53468 , x_flex_value_set_id => l_adr_flex_value_set_id
53469 , x_value_type_code => l_adr_value_type_code
53470 , x_value_combination_id => l_adr_value_combination_id
53471 , x_value_segment_code => l_adr_value_segment_code
53472 , p_side => 'NA'
53473 , p_override_seg_flag => 'Y'
53474 );
53475
53476 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
53477
53478 xla_ae_lines_pkg.set_segment(
53479 p_to_segment_code => 'GL_ACCOUNT'
53480 , p_segment_value => l_segment
53481 , p_from_segment_code => l_adr_value_segment_code
53482 , p_from_combination_id => l_adr_value_combination_id
53483 , p_value_type_code => l_adr_value_type_code
53484 , p_transaction_coa_id => l_adr_transaction_coa_id
53485 , p_accounting_coa_id => l_adr_accounting_coa_id
53486 , p_flexfield_segment_code => l_adr_flexfield_segment_code
53487 , p_flex_value_set_id => l_adr_flex_value_set_id
53488 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
53489 , p_adr_type_code => 'S'
53490 , p_component_type => l_component_type
53491 , p_component_code => l_component_code
53492 , p_component_type_code => l_component_type_code
53493 , p_component_appl_id => l_component_appl_id
53494 , p_amb_context_code => l_amb_context_code
53495 , p_entity_code => 'TRANSACTIONS'
53496 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
53497 , p_side => 'NA'
53498 );
53499
53500 END IF;
53501
53502 l_segment := AcctDerRule_169(
53503 p_application_id => p_application_id
53504 , p_ae_header_id => l_ae_header_id
53505 , p_source_5 => p_source_5
53506 , p_source_31 => p_source_31
53507 , x_transaction_coa_id => l_adr_transaction_coa_id
53508 , x_accounting_coa_id => l_adr_accounting_coa_id
53509 , x_flexfield_segment_code => l_adr_flexfield_segment_code
53510 , x_flex_value_set_id => l_adr_flex_value_set_id
53511 , x_value_type_code => l_adr_value_type_code
53512 , x_value_combination_id => l_adr_value_combination_id
53513 , x_value_segment_code => l_adr_value_segment_code
53514 , p_side => 'NA'
53515 , p_override_seg_flag => 'Y'
53516 );
53517
53518 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
53519
53520 xla_ae_lines_pkg.set_segment(
53521 p_to_segment_code => 'GL_BALANCING'
53522 , p_segment_value => l_segment
53523 , p_from_segment_code => l_adr_value_segment_code
53524 , p_from_combination_id => l_adr_value_combination_id
53525 , p_value_type_code => l_adr_value_type_code
53526 , p_transaction_coa_id => l_adr_transaction_coa_id
53527 , p_accounting_coa_id => l_adr_accounting_coa_id
53528 , p_flexfield_segment_code => l_adr_flexfield_segment_code
53529 , p_flex_value_set_id => l_adr_flex_value_set_id
53530 , p_adr_code => 'FA_EXPENSE_ACCT'
53531 , p_adr_type_code => 'S'
53532 , p_component_type => l_component_type
53533 , p_component_code => l_component_code
53534 , p_component_type_code => l_component_type_code
53535 , p_component_appl_id => l_component_appl_id
53536 , p_amb_context_code => l_amb_context_code
53537 , p_entity_code => 'TRANSACTIONS'
53538 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
53539 , p_side => 'NA'
53540 );
53541
53542 END IF;
53543
53544 --
53545 --
53546 END IF;
53547 --
53548 -- Bug 4922099
53549 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
53550 (NVL(l_enc_upg_option, 'N') = 'O')
53551 ) AND
53552 (l_bflow_method_code = 'PRIOR_ENTRY')
53553 )
53554 THEN
53555 IF
53556 --
53557 1 = 2
53558 --
53559 THEN
53560 xla_accounting_err_pkg.build_message
53561 (p_appli_s_name => 'XLA'
53562 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
53563 ,p_token_1 => 'LINE_NUMBER'
53564 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
53568 ,l_component_code
53565 ,p_token_2 => 'LINE_TYPE_NAME'
53566 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
53567 l_component_type
53569 ,l_component_type_code
53570 ,l_component_appl_id
53571 ,l_amb_context_code
53572 ,l_entity_code
53573 ,l_event_class_code
53574 )
53575 ,p_token_3 => 'OWNER'
53576 ,p_value_3 => xla_lookups_pkg.get_meaning(
53577 p_lookup_type => 'XLA_OWNER_TYPE'
53578 ,p_lookup_code => l_component_type_code
53579 )
53580 ,p_token_4 => 'PRODUCT_NAME'
53581 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
53582 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
53583 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
53584 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
53585 ,p_ae_header_id => NULL
53586 );
53587
53588 IF (C_LEVEL_ERROR>= g_log_level) THEN
53589 trace
53590 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
53591 ,p_level => C_LEVEL_ERROR
53592 ,p_module => l_log_module);
53593 END IF;
53594 END IF;
53595 END IF;
53596 --
53597 --
53598 ------------------------------------------------------------------------------------------------
53599 -- 4219869 Business Flow
53600 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
53601 -- Prior Entry. Currently, the following code is always generated.
53602 ------------------------------------------------------------------------------------------------
53603 XLA_AE_LINES_PKG.ValidateCurrentLine;
53604
53605 ------------------------------------------------------------------------------------
53606 -- 4219869 Business Flow
53607 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
53608 ------------------------------------------------------------------------------------
53609 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
53610
53611 ----------------------------------------------------------------------------------
53612 -- 4219869 Business Flow
53613 -- Update journal entry status -- Need to generate this within IF <condition>
53614 ----------------------------------------------------------------------------------
53615 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
53616 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
53617 ,p_balance_type_code => l_balance_type_code
53618 );
53619
53620 -------------------------------------------------------------------------------------------
53621 -- 4262811 - Generate the Accrual Reversal lines
53622 -------------------------------------------------------------------------------------------
53623 BEGIN
53624 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
53625 (g_array_event(p_event_id).array_value_num('header_index'));
53626 IF l_acc_rev_flag IS NULL THEN
53627 l_acc_rev_flag := 'N';
53628 END IF;
53629 EXCEPTION
53630 WHEN OTHERS THEN
53631 l_acc_rev_flag := 'N';
53632 END;
53633 --
53634 IF (l_acc_rev_flag = 'Y') THEN
53635
53636 -- 4645092 ------------------------------------------------------------------------------
53637 -- To allow MPA report to determine if it should generate report process
53638 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
53639 ------------------------------------------------------------------------------------------
53640
53641 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
53642 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
53643 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
53644 -- call ADRs
53645 -- Bug 4922099
53646 --
53647 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
53648 (NVL(l_actual_upg_option, 'N') = 'O') OR
53649 (NVL(l_enc_upg_option, 'N') = 'O')
53650 )
53651 THEN
53652 NULL;
53653 --
53654 --
53655
53656 l_ccid := AcctDerRule_174(
53657 p_application_id => p_application_id
53658 , p_ae_header_id => l_ae_header_id
53659 , p_source_5 => p_source_5
53663 , x_value_type_code => l_adr_value_type_code
53660 , p_source_32 => p_source_32
53661 , x_transaction_coa_id => l_adr_transaction_coa_id
53662 , x_accounting_coa_id => l_adr_accounting_coa_id
53664 , p_side => 'NA'
53665 );
53666
53667 xla_ae_lines_pkg.set_ccid(
53668 p_code_combination_id => l_ccid
53669 , p_value_type_code => l_adr_value_type_code
53670 , p_transaction_coa_id => l_adr_transaction_coa_id
53671 , p_accounting_coa_id => l_adr_accounting_coa_id
53672 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
53673 , p_adr_type_code => 'S'
53674 , p_component_type => l_component_type
53675 , p_component_code => l_component_code
53676 , p_component_type_code => l_component_type_code
53677 , p_component_appl_id => l_component_appl_id
53678 , p_amb_context_code => l_amb_context_code
53679 , p_side => 'NA'
53680 );
53681
53682
53683 l_segment := AcctDerRule_147(
53684 p_application_id => p_application_id
53685 , p_ae_header_id => l_ae_header_id
53686 , p_source_5 => p_source_5
53687 , p_source_9 => p_source_9
53688 , x_transaction_coa_id => l_adr_transaction_coa_id
53689 , x_accounting_coa_id => l_adr_accounting_coa_id
53690 , x_flexfield_segment_code => l_adr_flexfield_segment_code
53691 , x_flex_value_set_id => l_adr_flex_value_set_id
53692 , x_value_type_code => l_adr_value_type_code
53693 , x_value_combination_id => l_adr_value_combination_id
53694 , x_value_segment_code => l_adr_value_segment_code
53695 , p_side => 'NA'
53696 , p_override_seg_flag => 'Y'
53697 );
53698
53699 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
53700
53701 xla_ae_lines_pkg.set_segment(
53702 p_to_segment_code => 'GL_ACCOUNT'
53703 , p_segment_value => l_segment
53704 , p_from_segment_code => l_adr_value_segment_code
53705 , p_from_combination_id => l_adr_value_combination_id
53706 , p_value_type_code => l_adr_value_type_code
53707 , p_transaction_coa_id => l_adr_transaction_coa_id
53708 , p_accounting_coa_id => l_adr_accounting_coa_id
53709 , p_flexfield_segment_code => l_adr_flexfield_segment_code
53710 , p_flex_value_set_id => l_adr_flex_value_set_id
53711 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
53712 , p_adr_type_code => 'S'
53713 , p_component_type => l_component_type
53714 , p_component_code => l_component_code
53715 , p_component_type_code => l_component_type_code
53716 , p_component_appl_id => l_component_appl_id
53717 , p_amb_context_code => l_amb_context_code
53718 , p_entity_code => 'TRANSACTIONS'
53719 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
53720 , p_side => 'NA'
53721 );
53722
53723 END IF;
53724
53725 l_segment := AcctDerRule_169(
53726 p_application_id => p_application_id
53727 , p_ae_header_id => l_ae_header_id
53728 , p_source_5 => p_source_5
53729 , p_source_31 => p_source_31
53730 , x_transaction_coa_id => l_adr_transaction_coa_id
53731 , x_accounting_coa_id => l_adr_accounting_coa_id
53732 , x_flexfield_segment_code => l_adr_flexfield_segment_code
53733 , x_flex_value_set_id => l_adr_flex_value_set_id
53734 , x_value_type_code => l_adr_value_type_code
53735 , x_value_combination_id => l_adr_value_combination_id
53736 , x_value_segment_code => l_adr_value_segment_code
53737 , p_side => 'NA'
53738 , p_override_seg_flag => 'Y'
53739 );
53740
53741 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
53742
53743 xla_ae_lines_pkg.set_segment(
53744 p_to_segment_code => 'GL_BALANCING'
53745 , p_segment_value => l_segment
53746 , p_from_segment_code => l_adr_value_segment_code
53747 , p_from_combination_id => l_adr_value_combination_id
53748 , p_value_type_code => l_adr_value_type_code
53749 , p_transaction_coa_id => l_adr_transaction_coa_id
53750 , p_accounting_coa_id => l_adr_accounting_coa_id
53751 , p_flexfield_segment_code => l_adr_flexfield_segment_code
53752 , p_flex_value_set_id => l_adr_flex_value_set_id
53753 , p_adr_code => 'FA_EXPENSE_ACCT'
53754 , p_adr_type_code => 'S'
53755 , p_component_type => l_component_type
53756 , p_component_code => l_component_code
53757 , p_component_type_code => l_component_type_code
53758 , p_component_appl_id => l_component_appl_id
53759 , p_amb_context_code => l_amb_context_code
53760 , p_entity_code => 'TRANSACTIONS'
53761 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
53762 , p_side => 'NA'
53763 );
53764
53765 END IF;
53766
53767 --
53768 --
53769 END IF;
53773 --
53770
53771 --
53772 -- Update the line information that should be overwritten
53774 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
53775 p_header_num => 1);
53776 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
53777
53778 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
53779
53780 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
53781 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
53782 END IF;
53783
53784 --
53785 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
53786 --
53787 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
53788 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
53789 ELSE
53790 ---------------------------------------------------------------------------------------------------
53791 -- 4262811a Switch Sign
53792 ---------------------------------------------------------------------------------------------------
53793 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
53794 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
53795 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
53796 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
53797 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
53798 -- 5132302
53799 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
53800 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
53801
53802 END IF;
53803
53804 -- 4955764
53805 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
53806 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
53807
53808
53809 XLA_AE_LINES_PKG.ValidateCurrentLine;
53810 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
53811
53812 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
53813 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
53814 ,p_balance_type_code => l_balance_type_code);
53815
53816 END IF;
53817
53818 -----------------------------------------------------------------------------------------
53819 -- 4262811 Multiperiod Accounting
53820 -----------------------------------------------------------------------------------------
53821 -- No MPA option is assigned.
53822
53823
53824 END IF;
53825 END IF;
53826 --
53827
53828 --
53829 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
53830 trace
53831 (p_msg => 'END of AcctLineType_239'
53832 ,p_level => C_LEVEL_PROCEDURE
53833 ,p_module => l_log_module);
53834 END IF;
53835 --
53836 EXCEPTION
53837 WHEN xla_exceptions_pkg.application_exception THEN
53838 RAISE;
53839 WHEN OTHERS THEN
53840 xla_exceptions_pkg.raise_message
53841 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_239');
53842 END AcctLineType_239;
53843 --
53844
53845 ---------------------------------------
53846 --
53847 -- PRIVATE FUNCTION
53848 -- AcctLineType_240
53849 --
53850 ---------------------------------------
53851 PROCEDURE AcctLineType_240 (
53852 p_application_id IN NUMBER
53853 ,p_event_id IN NUMBER
53854 ,p_calculate_acctd_flag IN VARCHAR2
53855 ,p_calculate_g_l_flag IN VARCHAR2
53856 ,p_actual_flag IN OUT VARCHAR2
53857 ,p_balance_type_code OUT VARCHAR2
53858 ,p_gain_or_loss_ref OUT VARCHAR2
53859
53860 --Period Close Date
53861 , p_source_1 IN DATE
53862 --Generated Code Combination Identifier
53863 , p_source_5 IN NUMBER
53864 --Revaluation Reserve Account
53865 , p_source_13 IN VARCHAR2
53866 --Expense Account Code Combination Identifier
53867 , p_source_31 IN NUMBER
53868 --Default Code Combination Identifier
53869 , p_source_32 IN NUMBER
53870 --Adjustment Type
53871 , p_source_48 IN VARCHAR2
53872 --Transaction Header Identifier
53873 , p_source_49 IN NUMBER
53874 --Adjustment Line Identifier
53875 , p_source_50 IN NUMBER
53876 --Distribution Type Code
53877 , p_source_51 IN VARCHAR2
53878 --Entered Amount
53879 , p_source_52 IN NUMBER
53880 --Currency Code
53881 , p_source_53 IN VARCHAR2
53882 --Source Destination Code
53883 , p_source_55 IN VARCHAR2
53884 )
53885 IS
53886
53887 l_component_type VARCHAR2(80);
53888 l_component_code VARCHAR2(30);
53889 l_component_type_code VARCHAR2(1);
53890 l_component_appl_id INTEGER;
53891 l_amb_context_code VARCHAR2(30);
53892 l_entity_code VARCHAR2(30);
53893 l_event_class_code VARCHAR2(30);
53894 l_ae_header_id NUMBER;
53895 l_event_type_code VARCHAR2(30);
53899 -- adr variables
53896 l_line_definition_code VARCHAR2(30);
53897 l_line_definition_owner_code VARCHAR2(1);
53898 --
53900 l_segment VARCHAR2(30);
53901 l_ccid NUMBER;
53902 l_adr_transaction_coa_id NUMBER;
53903 l_adr_accounting_coa_id NUMBER;
53904 l_adr_flexfield_segment_code VARCHAR2(30);
53905 l_adr_flex_value_set_id NUMBER;
53906 l_adr_value_type_code VARCHAR2(30);
53907 l_adr_value_combination_id NUMBER;
53908 l_adr_value_segment_code VARCHAR2(30);
53909
53910 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
53911 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
53912 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
53913 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
53914
53915 -- 4262811 Variables ------------------------------------------------------------------------------------------
53916 l_entered_amt_idx NUMBER;
53917 l_accted_amt_idx NUMBER;
53918 l_acc_rev_flag VARCHAR2(1);
53919 l_accrual_line_num NUMBER;
53920 l_tmp_amt NUMBER;
53921 l_acc_rev_natural_side_code VARCHAR2(1);
53922
53923 l_num_entries NUMBER;
53924 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
53925 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
53926 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
53927 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
53928 l_recog_line_1 NUMBER;
53929 l_recog_line_2 NUMBER;
53930
53931 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
53932 l_bflow_applied_to_amt NUMBER; -- 5132302
53933 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
53934
53935 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
53936
53937 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
53938 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
53939
53940 ---------------------------------------------------------------------------------------------------------------
53941
53942
53943 --
53944 -- bulk performance
53945 --
53946 l_balance_type_code VARCHAR2(1);
53947 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
53948 l_log_module VARCHAR2(240);
53949
53950 --
53951 -- Upgrade strategy
53952 --
53953 l_actual_upg_option VARCHAR2(1);
53954 l_enc_upg_option VARCHAR2(1);
53955
53956 --
53957 BEGIN
53958 --
53959 IF g_log_enabled THEN
53960 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_240';
53961 END IF;
53962 --
53963 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
53964
53965 trace
53966 (p_msg => 'BEGIN of AcctLineType_240'
53967 ,p_level => C_LEVEL_PROCEDURE
53968 ,p_module => l_log_module);
53969
53970 END IF;
53971 --
53972 l_component_type := 'AMB_JLT';
53973 l_component_code := 'FA_CIP_RECLASS_DEST_REVAL_RES';
53974 l_component_type_code := 'S';
53975 l_component_appl_id := 140;
53976 l_amb_context_code := 'DEFAULT';
53977 l_entity_code := 'TRANSACTIONS';
53978 l_event_class_code := 'CIP_CATEGORY_RECLASS';
53979 l_event_type_code := 'CIP_CATEGORY_RECLASS_ALL';
53980 l_line_definition_owner_code := 'S';
53981 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_CA7';
53982 --
53983 l_balance_type_code := 'A';
53984 l_segment := NULL;
53985 l_ccid := NULL;
53986 l_adr_transaction_coa_id := NULL;
53987 l_adr_accounting_coa_id := NULL;
53988 l_adr_flexfield_segment_code := NULL;
53989 l_adr_flex_value_set_id := NULL;
53990 l_adr_value_type_code := NULL;
53991 l_adr_value_combination_id := NULL;
53992 l_adr_value_segment_code := NULL;
53993
53994 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
53995 l_bflow_class_code := ''; -- 4219869 Business Flow
53996 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
53997 l_budgetary_control_flag := 'N';
53998
53999 l_bflow_applied_to_amt_idx := NULL; -- 5132302
54000 l_bflow_applied_to_amt := NULL; -- 5132302
54001 l_entered_amt_idx := NULL; -- 4262811
54002 l_accted_amt_idx := NULL; -- 4262811
54003 l_acc_rev_flag := NULL; -- 4262811
54004 l_accrual_line_num := NULL; -- 4262811
54005 l_tmp_amt := NULL; -- 4262811
54006 --
54007
54008 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
54009 l_balance_type_code <> 'B' THEN
54010 IF NVL(p_source_48,'
54011 ') = 'REVAL RESERVE' AND
54012 NVL(p_source_55,'
54013 ') = 'DEST'
54014 THEN
54015
54016 --
54017 XLA_AE_LINES_PKG.SetNewLine;
54018
54019 p_balance_type_code := l_balance_type_code;
54020 -- set the flag so later we will know whether the gain loss line needs to be created
54021
54022 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
54026 --
54023 p_actual_flag :='A';
54024 END IF;
54025
54027 -- bulk performance
54028 --
54029 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
54030 p_header_num => 0); -- 4262811
54031 --
54032 -- set accounting line options
54033 --
54034 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
54035 p_natural_side_code => 'C'
54036 , p_gain_or_loss_flag => 'N'
54037 , p_gl_transfer_mode_code => 'S'
54038 , p_acct_entry_type_code => 'A'
54039 , p_switch_side_flag => 'Y'
54040 , p_merge_duplicate_code => 'N'
54041 );
54042 --
54043 l_acc_rev_natural_side_code := 'D'; -- 4262811
54044 --
54045 --
54046 -- set accounting line type info
54047 --
54048 xla_ae_lines_pkg.SetAcctLineType
54049 (p_component_type => l_component_type
54050 ,p_event_type_code => l_event_type_code
54051 ,p_line_definition_owner_code => l_line_definition_owner_code
54052 ,p_line_definition_code => l_line_definition_code
54053 ,p_accounting_line_code => l_component_code
54054 ,p_accounting_line_type_code => l_component_type_code
54055 ,p_accounting_line_appl_id => l_component_appl_id
54056 ,p_amb_context_code => l_amb_context_code
54057 ,p_entity_code => l_entity_code
54058 ,p_event_class_code => l_event_class_code);
54059 --
54060 -- set accounting class
54061 --
54062 xla_ae_lines_pkg.SetAcctClass(
54063 p_accounting_class_code => 'ASSET'
54064 , p_ae_header_id => l_ae_header_id
54065 );
54066
54067 --
54068 -- set rounding class
54069 --
54070 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
54071 'ASSET';
54072
54073 --
54074 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
54075 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
54076 --
54077 -- bulk performance
54078 --
54079 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
54080
54081 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
54082 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
54083
54084 -- 4955764
54085 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
54086 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
54087
54088 -- 4458381 Public Sector Enh
54089
54090 --
54091 -- set accounting attributes for the line type
54092 --
54093 l_entered_amt_idx := 4;
54094 l_accted_amt_idx := 6;
54095 l_bflow_applied_to_amt_idx := NULL; -- 5132302
54096 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
54097 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
54098 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
54099 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
54100 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
54101 l_rec_acct_attrs.array_char_value(3) := p_source_51;
54102 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
54103 l_rec_acct_attrs.array_num_value(4) := p_source_52;
54104 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
54105 l_rec_acct_attrs.array_char_value(5) := p_source_53;
54106 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
54107 l_rec_acct_attrs.array_num_value(6) := p_source_52;
54108
54109 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
54110 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
54111
54112 ---------------------------------------------------------------------------------------------------------------
54113 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
54114 ---------------------------------------------------------------------------------------------------------------
54115 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
54116
54117 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
54118 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
54119
54120 IF xla_accounting_cache_pkg.GetValueChar
54121 (p_source_code => 'LEDGER_CATEGORY_CODE'
54122 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
54123 AND l_bflow_method_code = 'PRIOR_ENTRY'
54124 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
54125 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
54126 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
54127 )
54128 THEN
54129 xla_ae_lines_pkg.BflowUpgEntry
54130 (p_business_method_code => l_bflow_method_code
54131 ,p_business_class_code => l_bflow_class_code
54132 ,p_balance_type => l_balance_type_code);
54133 ELSE
54137
54134 NULL;
54135 -- No business flow processing for business flow method of NONE.
54136 END IF;
54138 --
54139 -- call analytical criteria
54140 --
54141
54142 --
54143 -- call description
54144 --
54145
54146 xla_ae_lines_pkg.SetLineDescription(
54147 p_ae_header_id => l_ae_header_id
54148 ,p_description => Description_30 (
54149 p_application_id => p_application_id
54150 , p_ae_header_id => l_ae_header_id
54151 , p_source_1 => p_source_1
54152 )
54153 );
54154
54155
54156 --
54157 -- call ADRs
54158 -- Bug 4922099
54159 --
54160 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
54161 (NVL(l_actual_upg_option, 'N') = 'O') OR
54162 (NVL(l_enc_upg_option, 'N') = 'O')
54163 )
54164 THEN
54165 NULL;
54166 --
54167 --
54168
54169 l_ccid := AcctDerRule_174(
54170 p_application_id => p_application_id
54171 , p_ae_header_id => l_ae_header_id
54172 , p_source_5 => p_source_5
54173 , p_source_32 => p_source_32
54174 , x_transaction_coa_id => l_adr_transaction_coa_id
54175 , x_accounting_coa_id => l_adr_accounting_coa_id
54176 , x_value_type_code => l_adr_value_type_code
54177 , p_side => 'NA'
54178 );
54179
54180 xla_ae_lines_pkg.set_ccid(
54181 p_code_combination_id => l_ccid
54182 , p_value_type_code => l_adr_value_type_code
54183 , p_transaction_coa_id => l_adr_transaction_coa_id
54184 , p_accounting_coa_id => l_adr_accounting_coa_id
54185 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
54186 , p_adr_type_code => 'S'
54187 , p_component_type => l_component_type
54188 , p_component_code => l_component_code
54189 , p_component_type_code => l_component_type_code
54190 , p_component_appl_id => l_component_appl_id
54191 , p_amb_context_code => l_amb_context_code
54192 , p_side => 'NA'
54193 );
54194
54195
54196 l_segment := AcctDerRule_151(
54197 p_application_id => p_application_id
54198 , p_ae_header_id => l_ae_header_id
54199 , p_source_5 => p_source_5
54200 , p_source_13 => p_source_13
54201 , x_transaction_coa_id => l_adr_transaction_coa_id
54202 , x_accounting_coa_id => l_adr_accounting_coa_id
54203 , x_flexfield_segment_code => l_adr_flexfield_segment_code
54204 , x_flex_value_set_id => l_adr_flex_value_set_id
54205 , x_value_type_code => l_adr_value_type_code
54206 , x_value_combination_id => l_adr_value_combination_id
54207 , x_value_segment_code => l_adr_value_segment_code
54208 , p_side => 'NA'
54209 , p_override_seg_flag => 'Y'
54210 );
54211
54212 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
54213
54214 xla_ae_lines_pkg.set_segment(
54215 p_to_segment_code => 'GL_ACCOUNT'
54216 , p_segment_value => l_segment
54217 , p_from_segment_code => l_adr_value_segment_code
54218 , p_from_combination_id => l_adr_value_combination_id
54219 , p_value_type_code => l_adr_value_type_code
54220 , p_transaction_coa_id => l_adr_transaction_coa_id
54221 , p_accounting_coa_id => l_adr_accounting_coa_id
54222 , p_flexfield_segment_code => l_adr_flexfield_segment_code
54223 , p_flex_value_set_id => l_adr_flex_value_set_id
54224 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
54225 , p_adr_type_code => 'S'
54226 , p_component_type => l_component_type
54227 , p_component_code => l_component_code
54228 , p_component_type_code => l_component_type_code
54229 , p_component_appl_id => l_component_appl_id
54230 , p_amb_context_code => l_amb_context_code
54231 , p_entity_code => 'TRANSACTIONS'
54232 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
54233 , p_side => 'NA'
54234 );
54235
54236 END IF;
54237
54238 l_segment := AcctDerRule_169(
54239 p_application_id => p_application_id
54240 , p_ae_header_id => l_ae_header_id
54241 , p_source_5 => p_source_5
54242 , p_source_31 => p_source_31
54243 , x_transaction_coa_id => l_adr_transaction_coa_id
54244 , x_accounting_coa_id => l_adr_accounting_coa_id
54245 , x_flexfield_segment_code => l_adr_flexfield_segment_code
54246 , x_flex_value_set_id => l_adr_flex_value_set_id
54247 , x_value_type_code => l_adr_value_type_code
54248 , x_value_combination_id => l_adr_value_combination_id
54249 , x_value_segment_code => l_adr_value_segment_code
54250 , p_side => 'NA'
54251 , p_override_seg_flag => 'Y'
54252 );
54253
54254 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
54255
54256 xla_ae_lines_pkg.set_segment(
54257 p_to_segment_code => 'GL_BALANCING'
54258 , p_segment_value => l_segment
54262 , p_transaction_coa_id => l_adr_transaction_coa_id
54259 , p_from_segment_code => l_adr_value_segment_code
54260 , p_from_combination_id => l_adr_value_combination_id
54261 , p_value_type_code => l_adr_value_type_code
54263 , p_accounting_coa_id => l_adr_accounting_coa_id
54264 , p_flexfield_segment_code => l_adr_flexfield_segment_code
54265 , p_flex_value_set_id => l_adr_flex_value_set_id
54266 , p_adr_code => 'FA_EXPENSE_ACCT'
54267 , p_adr_type_code => 'S'
54268 , p_component_type => l_component_type
54269 , p_component_code => l_component_code
54270 , p_component_type_code => l_component_type_code
54271 , p_component_appl_id => l_component_appl_id
54272 , p_amb_context_code => l_amb_context_code
54273 , p_entity_code => 'TRANSACTIONS'
54274 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
54275 , p_side => 'NA'
54276 );
54277
54278 END IF;
54279
54280 --
54281 --
54282 END IF;
54283 --
54284 -- Bug 4922099
54285 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
54286 (NVL(l_enc_upg_option, 'N') = 'O')
54287 ) AND
54288 (l_bflow_method_code = 'PRIOR_ENTRY')
54289 )
54290 THEN
54291 IF
54292 --
54293 1 = 2
54294 --
54295 THEN
54296 xla_accounting_err_pkg.build_message
54297 (p_appli_s_name => 'XLA'
54298 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
54299 ,p_token_1 => 'LINE_NUMBER'
54300 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
54301 ,p_token_2 => 'LINE_TYPE_NAME'
54302 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
54303 l_component_type
54304 ,l_component_code
54305 ,l_component_type_code
54306 ,l_component_appl_id
54307 ,l_amb_context_code
54308 ,l_entity_code
54309 ,l_event_class_code
54310 )
54311 ,p_token_3 => 'OWNER'
54312 ,p_value_3 => xla_lookups_pkg.get_meaning(
54313 p_lookup_type => 'XLA_OWNER_TYPE'
54314 ,p_lookup_code => l_component_type_code
54315 )
54316 ,p_token_4 => 'PRODUCT_NAME'
54317 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
54318 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
54319 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
54320 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
54321 ,p_ae_header_id => NULL
54322 );
54323
54324 IF (C_LEVEL_ERROR>= g_log_level) THEN
54325 trace
54326 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
54327 ,p_level => C_LEVEL_ERROR
54328 ,p_module => l_log_module);
54329 END IF;
54330 END IF;
54331 END IF;
54332 --
54333 --
54334 ------------------------------------------------------------------------------------------------
54335 -- 4219869 Business Flow
54336 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
54337 -- Prior Entry. Currently, the following code is always generated.
54338 ------------------------------------------------------------------------------------------------
54339 XLA_AE_LINES_PKG.ValidateCurrentLine;
54340
54341 ------------------------------------------------------------------------------------
54342 -- 4219869 Business Flow
54343 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
54344 ------------------------------------------------------------------------------------
54345 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
54346
54347 ----------------------------------------------------------------------------------
54348 -- 4219869 Business Flow
54349 -- Update journal entry status -- Need to generate this within IF <condition>
54350 ----------------------------------------------------------------------------------
54351 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
54352 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
54353 ,p_balance_type_code => l_balance_type_code
54354 );
54355
54359 BEGIN
54356 -------------------------------------------------------------------------------------------
54357 -- 4262811 - Generate the Accrual Reversal lines
54358 -------------------------------------------------------------------------------------------
54360 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
54361 (g_array_event(p_event_id).array_value_num('header_index'));
54362 IF l_acc_rev_flag IS NULL THEN
54363 l_acc_rev_flag := 'N';
54364 END IF;
54365 EXCEPTION
54366 WHEN OTHERS THEN
54367 l_acc_rev_flag := 'N';
54368 END;
54369 --
54370 IF (l_acc_rev_flag = 'Y') THEN
54371
54372 -- 4645092 ------------------------------------------------------------------------------
54373 -- To allow MPA report to determine if it should generate report process
54374 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
54375 ------------------------------------------------------------------------------------------
54376
54377 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
54378 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
54379 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
54380 -- call ADRs
54381 -- Bug 4922099
54382 --
54383 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
54384 (NVL(l_actual_upg_option, 'N') = 'O') OR
54385 (NVL(l_enc_upg_option, 'N') = 'O')
54386 )
54387 THEN
54388 NULL;
54389 --
54390 --
54391
54392 l_ccid := AcctDerRule_174(
54393 p_application_id => p_application_id
54394 , p_ae_header_id => l_ae_header_id
54395 , p_source_5 => p_source_5
54396 , p_source_32 => p_source_32
54397 , x_transaction_coa_id => l_adr_transaction_coa_id
54398 , x_accounting_coa_id => l_adr_accounting_coa_id
54399 , x_value_type_code => l_adr_value_type_code
54400 , p_side => 'NA'
54401 );
54402
54403 xla_ae_lines_pkg.set_ccid(
54404 p_code_combination_id => l_ccid
54405 , p_value_type_code => l_adr_value_type_code
54406 , p_transaction_coa_id => l_adr_transaction_coa_id
54407 , p_accounting_coa_id => l_adr_accounting_coa_id
54408 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
54409 , p_adr_type_code => 'S'
54410 , p_component_type => l_component_type
54411 , p_component_code => l_component_code
54412 , p_component_type_code => l_component_type_code
54413 , p_component_appl_id => l_component_appl_id
54414 , p_amb_context_code => l_amb_context_code
54415 , p_side => 'NA'
54416 );
54417
54418
54419 l_segment := AcctDerRule_151(
54420 p_application_id => p_application_id
54421 , p_ae_header_id => l_ae_header_id
54422 , p_source_5 => p_source_5
54423 , p_source_13 => p_source_13
54424 , x_transaction_coa_id => l_adr_transaction_coa_id
54425 , x_accounting_coa_id => l_adr_accounting_coa_id
54426 , x_flexfield_segment_code => l_adr_flexfield_segment_code
54427 , x_flex_value_set_id => l_adr_flex_value_set_id
54428 , x_value_type_code => l_adr_value_type_code
54429 , x_value_combination_id => l_adr_value_combination_id
54430 , x_value_segment_code => l_adr_value_segment_code
54431 , p_side => 'NA'
54432 , p_override_seg_flag => 'Y'
54433 );
54434
54435 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
54436
54437 xla_ae_lines_pkg.set_segment(
54438 p_to_segment_code => 'GL_ACCOUNT'
54439 , p_segment_value => l_segment
54440 , p_from_segment_code => l_adr_value_segment_code
54441 , p_from_combination_id => l_adr_value_combination_id
54442 , p_value_type_code => l_adr_value_type_code
54443 , p_transaction_coa_id => l_adr_transaction_coa_id
54444 , p_accounting_coa_id => l_adr_accounting_coa_id
54445 , p_flexfield_segment_code => l_adr_flexfield_segment_code
54446 , p_flex_value_set_id => l_adr_flex_value_set_id
54447 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
54448 , p_adr_type_code => 'S'
54449 , p_component_type => l_component_type
54450 , p_component_code => l_component_code
54451 , p_component_type_code => l_component_type_code
54452 , p_component_appl_id => l_component_appl_id
54453 , p_amb_context_code => l_amb_context_code
54454 , p_entity_code => 'TRANSACTIONS'
54455 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
54456 , p_side => 'NA'
54457 );
54458
54459 END IF;
54460
54461 l_segment := AcctDerRule_169(
54462 p_application_id => p_application_id
54463 , p_ae_header_id => l_ae_header_id
54464 , p_source_5 => p_source_5
54465 , p_source_31 => p_source_31
54466 , x_transaction_coa_id => l_adr_transaction_coa_id
54467 , x_accounting_coa_id => l_adr_accounting_coa_id
54468 , x_flexfield_segment_code => l_adr_flexfield_segment_code
54472 , x_value_segment_code => l_adr_value_segment_code
54469 , x_flex_value_set_id => l_adr_flex_value_set_id
54470 , x_value_type_code => l_adr_value_type_code
54471 , x_value_combination_id => l_adr_value_combination_id
54473 , p_side => 'NA'
54474 , p_override_seg_flag => 'Y'
54475 );
54476
54477 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
54478
54479 xla_ae_lines_pkg.set_segment(
54480 p_to_segment_code => 'GL_BALANCING'
54481 , p_segment_value => l_segment
54482 , p_from_segment_code => l_adr_value_segment_code
54483 , p_from_combination_id => l_adr_value_combination_id
54484 , p_value_type_code => l_adr_value_type_code
54485 , p_transaction_coa_id => l_adr_transaction_coa_id
54486 , p_accounting_coa_id => l_adr_accounting_coa_id
54487 , p_flexfield_segment_code => l_adr_flexfield_segment_code
54488 , p_flex_value_set_id => l_adr_flex_value_set_id
54489 , p_adr_code => 'FA_EXPENSE_ACCT'
54490 , p_adr_type_code => 'S'
54491 , p_component_type => l_component_type
54492 , p_component_code => l_component_code
54493 , p_component_type_code => l_component_type_code
54494 , p_component_appl_id => l_component_appl_id
54495 , p_amb_context_code => l_amb_context_code
54496 , p_entity_code => 'TRANSACTIONS'
54497 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
54498 , p_side => 'NA'
54499 );
54500
54501 END IF;
54502
54503 --
54504 --
54505 END IF;
54506
54507 --
54508 -- Update the line information that should be overwritten
54509 --
54510 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
54511 p_header_num => 1);
54512 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
54513
54514 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
54515
54516 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
54517 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
54518 END IF;
54519
54520 --
54521 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
54522 --
54523 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
54524 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
54525 ELSE
54526 ---------------------------------------------------------------------------------------------------
54527 -- 4262811a Switch Sign
54528 ---------------------------------------------------------------------------------------------------
54529 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
54530 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
54531 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
54532 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
54533 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
54534 -- 5132302
54535 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
54536 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
54537
54538 END IF;
54539
54540 -- 4955764
54541 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
54542 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
54543
54544
54545 XLA_AE_LINES_PKG.ValidateCurrentLine;
54546 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
54547
54548 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
54549 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
54550 ,p_balance_type_code => l_balance_type_code);
54551
54552 END IF;
54553
54554 -----------------------------------------------------------------------------------------
54555 -- 4262811 Multiperiod Accounting
54556 -----------------------------------------------------------------------------------------
54557 -- No MPA option is assigned.
54558
54559
54560 END IF;
54561 END IF;
54562 --
54563
54564 --
54565 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
54566 trace
54567 (p_msg => 'END of AcctLineType_240'
54568 ,p_level => C_LEVEL_PROCEDURE
54569 ,p_module => l_log_module);
54570 END IF;
54571 --
54572 EXCEPTION
54573 WHEN xla_exceptions_pkg.application_exception THEN
54574 RAISE;
54575 WHEN OTHERS THEN
54576 xla_exceptions_pkg.raise_message
54577 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_240');
54578 END AcctLineType_240;
54579 --
54580
54581 ---------------------------------------
54585 --
54582 --
54583 -- PRIVATE FUNCTION
54584 -- AcctLineType_241
54586 ---------------------------------------
54587 PROCEDURE AcctLineType_241 (
54588 p_application_id IN NUMBER
54589 ,p_event_id IN NUMBER
54590 ,p_calculate_acctd_flag IN VARCHAR2
54591 ,p_calculate_g_l_flag IN VARCHAR2
54592 ,p_actual_flag IN OUT VARCHAR2
54593 ,p_balance_type_code OUT VARCHAR2
54594 ,p_gain_or_loss_ref OUT VARCHAR2
54595
54596 --Period Close Date
54597 , p_source_1 IN DATE
54598 --Generated Code Combination Identifier
54599 , p_source_5 IN NUMBER
54600 --CIP Cost Account
54601 , p_source_9 IN VARCHAR2
54602 --Expense Account Code Combination Identifier
54603 , p_source_31 IN NUMBER
54604 --Default Code Combination Identifier
54605 , p_source_32 IN NUMBER
54606 --Adjustment Type
54607 , p_source_48 IN VARCHAR2
54608 --Transaction Header Identifier
54609 , p_source_49 IN NUMBER
54610 --Adjustment Line Identifier
54611 , p_source_50 IN NUMBER
54612 --Distribution Type Code
54613 , p_source_51 IN VARCHAR2
54614 --Entered Amount
54615 , p_source_52 IN NUMBER
54616 --Currency Code
54617 , p_source_53 IN VARCHAR2
54618 --Source Destination Code
54619 , p_source_55 IN VARCHAR2
54620 )
54621 IS
54622
54623 l_component_type VARCHAR2(80);
54624 l_component_code VARCHAR2(30);
54625 l_component_type_code VARCHAR2(1);
54626 l_component_appl_id INTEGER;
54627 l_amb_context_code VARCHAR2(30);
54628 l_entity_code VARCHAR2(30);
54629 l_event_class_code VARCHAR2(30);
54630 l_ae_header_id NUMBER;
54631 l_event_type_code VARCHAR2(30);
54632 l_line_definition_code VARCHAR2(30);
54633 l_line_definition_owner_code VARCHAR2(1);
54634 --
54635 -- adr variables
54636 l_segment VARCHAR2(30);
54637 l_ccid NUMBER;
54638 l_adr_transaction_coa_id NUMBER;
54639 l_adr_accounting_coa_id NUMBER;
54640 l_adr_flexfield_segment_code VARCHAR2(30);
54641 l_adr_flex_value_set_id NUMBER;
54642 l_adr_value_type_code VARCHAR2(30);
54643 l_adr_value_combination_id NUMBER;
54644 l_adr_value_segment_code VARCHAR2(30);
54645
54646 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
54647 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
54648 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
54649 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
54650
54651 -- 4262811 Variables ------------------------------------------------------------------------------------------
54652 l_entered_amt_idx NUMBER;
54653 l_accted_amt_idx NUMBER;
54654 l_acc_rev_flag VARCHAR2(1);
54655 l_accrual_line_num NUMBER;
54656 l_tmp_amt NUMBER;
54657 l_acc_rev_natural_side_code VARCHAR2(1);
54658
54659 l_num_entries NUMBER;
54660 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
54661 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
54662 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
54663 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
54664 l_recog_line_1 NUMBER;
54665 l_recog_line_2 NUMBER;
54666
54667 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
54668 l_bflow_applied_to_amt NUMBER; -- 5132302
54669 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
54670
54671 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
54672
54673 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
54674 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
54675
54676 ---------------------------------------------------------------------------------------------------------------
54677
54678
54679 --
54680 -- bulk performance
54681 --
54682 l_balance_type_code VARCHAR2(1);
54683 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
54684 l_log_module VARCHAR2(240);
54685
54686 --
54687 -- Upgrade strategy
54688 --
54689 l_actual_upg_option VARCHAR2(1);
54690 l_enc_upg_option VARCHAR2(1);
54691
54692 --
54693 BEGIN
54694 --
54695 IF g_log_enabled THEN
54696 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_241';
54697 END IF;
54698 --
54699 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
54700
54701 trace
54702 (p_msg => 'BEGIN of AcctLineType_241'
54703 ,p_level => C_LEVEL_PROCEDURE
54704 ,p_module => l_log_module);
54705
54706 END IF;
54707 --
54708 l_component_type := 'AMB_JLT';
54709 l_component_code := 'FA_CIP_RECLASS_SOURCE_COST';
54710 l_component_type_code := 'S';
54711 l_component_appl_id := 140;
54712 l_amb_context_code := 'DEFAULT';
54713 l_entity_code := 'TRANSACTIONS';
54714 l_event_class_code := 'CIP_CATEGORY_RECLASS';
54718 --
54715 l_event_type_code := 'CIP_CATEGORY_RECLASS_ALL';
54716 l_line_definition_owner_code := 'S';
54717 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_CA7';
54719 l_balance_type_code := 'A';
54720 l_segment := NULL;
54721 l_ccid := NULL;
54722 l_adr_transaction_coa_id := NULL;
54723 l_adr_accounting_coa_id := NULL;
54724 l_adr_flexfield_segment_code := NULL;
54725 l_adr_flex_value_set_id := NULL;
54726 l_adr_value_type_code := NULL;
54727 l_adr_value_combination_id := NULL;
54728 l_adr_value_segment_code := NULL;
54729
54730 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
54731 l_bflow_class_code := ''; -- 4219869 Business Flow
54732 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
54733 l_budgetary_control_flag := 'N';
54734
54735 l_bflow_applied_to_amt_idx := NULL; -- 5132302
54736 l_bflow_applied_to_amt := NULL; -- 5132302
54737 l_entered_amt_idx := NULL; -- 4262811
54738 l_accted_amt_idx := NULL; -- 4262811
54739 l_acc_rev_flag := NULL; -- 4262811
54740 l_accrual_line_num := NULL; -- 4262811
54741 l_tmp_amt := NULL; -- 4262811
54742 --
54743
54744 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
54745 l_balance_type_code <> 'B' THEN
54746 IF NVL(p_source_48,'
54747 ') = 'CIP COST' AND
54748 NVL(p_source_55,'
54749 ') = 'SOURCE'
54750 THEN
54751
54752 --
54753 XLA_AE_LINES_PKG.SetNewLine;
54754
54755 p_balance_type_code := l_balance_type_code;
54756 -- set the flag so later we will know whether the gain loss line needs to be created
54757
54758 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
54759 p_actual_flag :='A';
54760 END IF;
54761
54762 --
54763 -- bulk performance
54764 --
54765 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
54766 p_header_num => 0); -- 4262811
54767 --
54768 -- set accounting line options
54769 --
54770 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
54771 p_natural_side_code => 'C'
54772 , p_gain_or_loss_flag => 'N'
54773 , p_gl_transfer_mode_code => 'S'
54774 , p_acct_entry_type_code => 'A'
54775 , p_switch_side_flag => 'Y'
54776 , p_merge_duplicate_code => 'N'
54777 );
54778 --
54779 l_acc_rev_natural_side_code := 'D'; -- 4262811
54780 --
54781 --
54782 -- set accounting line type info
54783 --
54784 xla_ae_lines_pkg.SetAcctLineType
54785 (p_component_type => l_component_type
54786 ,p_event_type_code => l_event_type_code
54787 ,p_line_definition_owner_code => l_line_definition_owner_code
54788 ,p_line_definition_code => l_line_definition_code
54789 ,p_accounting_line_code => l_component_code
54790 ,p_accounting_line_type_code => l_component_type_code
54791 ,p_accounting_line_appl_id => l_component_appl_id
54792 ,p_amb_context_code => l_amb_context_code
54793 ,p_entity_code => l_entity_code
54794 ,p_event_class_code => l_event_class_code);
54795 --
54796 -- set accounting class
54797 --
54798 xla_ae_lines_pkg.SetAcctClass(
54799 p_accounting_class_code => 'ASSET'
54800 , p_ae_header_id => l_ae_header_id
54801 );
54802
54803 --
54804 -- set rounding class
54805 --
54806 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
54807 'ASSET';
54808
54809 --
54810 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
54811 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
54812 --
54813 -- bulk performance
54814 --
54815 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
54816
54817 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
54818 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
54819
54820 -- 4955764
54821 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
54822 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
54823
54824 -- 4458381 Public Sector Enh
54825
54826 --
54827 -- set accounting attributes for the line type
54828 --
54829 l_entered_amt_idx := 4;
54830 l_accted_amt_idx := 6;
54831 l_bflow_applied_to_amt_idx := NULL; -- 5132302
54832 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
54833 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
54834 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
54835 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
54836 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
54837 l_rec_acct_attrs.array_char_value(3) := p_source_51;
54838 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
54839 l_rec_acct_attrs.array_num_value(4) := p_source_52;
54843 l_rec_acct_attrs.array_num_value(6) := p_source_52;
54840 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
54841 l_rec_acct_attrs.array_char_value(5) := p_source_53;
54842 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
54844
54845 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
54846 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
54847
54848 ---------------------------------------------------------------------------------------------------------------
54849 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
54850 ---------------------------------------------------------------------------------------------------------------
54851 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
54852
54853 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
54854 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
54855
54856 IF xla_accounting_cache_pkg.GetValueChar
54857 (p_source_code => 'LEDGER_CATEGORY_CODE'
54858 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
54859 AND l_bflow_method_code = 'PRIOR_ENTRY'
54860 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
54861 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
54862 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
54863 )
54864 THEN
54865 xla_ae_lines_pkg.BflowUpgEntry
54866 (p_business_method_code => l_bflow_method_code
54867 ,p_business_class_code => l_bflow_class_code
54868 ,p_balance_type => l_balance_type_code);
54869 ELSE
54870 NULL;
54871 -- No business flow processing for business flow method of NONE.
54872 END IF;
54873
54874 --
54875 -- call analytical criteria
54876 --
54877
54878 --
54879 -- call description
54880 --
54881
54882 xla_ae_lines_pkg.SetLineDescription(
54883 p_ae_header_id => l_ae_header_id
54884 ,p_description => Description_65 (
54885 p_application_id => p_application_id
54886 , p_ae_header_id => l_ae_header_id
54887 , p_source_1 => p_source_1
54888 )
54889 );
54890
54891
54892 --
54893 -- call ADRs
54894 -- Bug 4922099
54895 --
54896 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
54897 (NVL(l_actual_upg_option, 'N') = 'O') OR
54898 (NVL(l_enc_upg_option, 'N') = 'O')
54899 )
54900 THEN
54901 NULL;
54902 --
54903 --
54904
54905 l_ccid := AcctDerRule_174(
54906 p_application_id => p_application_id
54907 , p_ae_header_id => l_ae_header_id
54908 , p_source_5 => p_source_5
54909 , p_source_32 => p_source_32
54910 , x_transaction_coa_id => l_adr_transaction_coa_id
54911 , x_accounting_coa_id => l_adr_accounting_coa_id
54912 , x_value_type_code => l_adr_value_type_code
54913 , p_side => 'NA'
54914 );
54915
54916 xla_ae_lines_pkg.set_ccid(
54917 p_code_combination_id => l_ccid
54918 , p_value_type_code => l_adr_value_type_code
54919 , p_transaction_coa_id => l_adr_transaction_coa_id
54920 , p_accounting_coa_id => l_adr_accounting_coa_id
54921 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
54922 , p_adr_type_code => 'S'
54923 , p_component_type => l_component_type
54924 , p_component_code => l_component_code
54925 , p_component_type_code => l_component_type_code
54926 , p_component_appl_id => l_component_appl_id
54927 , p_amb_context_code => l_amb_context_code
54928 , p_side => 'NA'
54929 );
54930
54931
54932 l_segment := AcctDerRule_147(
54933 p_application_id => p_application_id
54934 , p_ae_header_id => l_ae_header_id
54935 , p_source_5 => p_source_5
54936 , p_source_9 => p_source_9
54937 , x_transaction_coa_id => l_adr_transaction_coa_id
54938 , x_accounting_coa_id => l_adr_accounting_coa_id
54939 , x_flexfield_segment_code => l_adr_flexfield_segment_code
54940 , x_flex_value_set_id => l_adr_flex_value_set_id
54941 , x_value_type_code => l_adr_value_type_code
54942 , x_value_combination_id => l_adr_value_combination_id
54943 , x_value_segment_code => l_adr_value_segment_code
54944 , p_side => 'NA'
54945 , p_override_seg_flag => 'Y'
54946 );
54947
54948 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
54949
54950 xla_ae_lines_pkg.set_segment(
54951 p_to_segment_code => 'GL_ACCOUNT'
54952 , p_segment_value => l_segment
54953 , p_from_segment_code => l_adr_value_segment_code
54954 , p_from_combination_id => l_adr_value_combination_id
54955 , p_value_type_code => l_adr_value_type_code
54956 , p_transaction_coa_id => l_adr_transaction_coa_id
54957 , p_accounting_coa_id => l_adr_accounting_coa_id
54961 , p_adr_type_code => 'S'
54958 , p_flexfield_segment_code => l_adr_flexfield_segment_code
54959 , p_flex_value_set_id => l_adr_flex_value_set_id
54960 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
54962 , p_component_type => l_component_type
54963 , p_component_code => l_component_code
54964 , p_component_type_code => l_component_type_code
54965 , p_component_appl_id => l_component_appl_id
54966 , p_amb_context_code => l_amb_context_code
54967 , p_entity_code => 'TRANSACTIONS'
54968 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
54969 , p_side => 'NA'
54970 );
54971
54972 END IF;
54973
54974 l_segment := AcctDerRule_169(
54975 p_application_id => p_application_id
54976 , p_ae_header_id => l_ae_header_id
54977 , p_source_5 => p_source_5
54978 , p_source_31 => p_source_31
54979 , x_transaction_coa_id => l_adr_transaction_coa_id
54980 , x_accounting_coa_id => l_adr_accounting_coa_id
54981 , x_flexfield_segment_code => l_adr_flexfield_segment_code
54982 , x_flex_value_set_id => l_adr_flex_value_set_id
54983 , x_value_type_code => l_adr_value_type_code
54984 , x_value_combination_id => l_adr_value_combination_id
54985 , x_value_segment_code => l_adr_value_segment_code
54986 , p_side => 'NA'
54987 , p_override_seg_flag => 'Y'
54988 );
54989
54990 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
54991
54992 xla_ae_lines_pkg.set_segment(
54993 p_to_segment_code => 'GL_BALANCING'
54994 , p_segment_value => l_segment
54995 , p_from_segment_code => l_adr_value_segment_code
54996 , p_from_combination_id => l_adr_value_combination_id
54997 , p_value_type_code => l_adr_value_type_code
54998 , p_transaction_coa_id => l_adr_transaction_coa_id
54999 , p_accounting_coa_id => l_adr_accounting_coa_id
55000 , p_flexfield_segment_code => l_adr_flexfield_segment_code
55001 , p_flex_value_set_id => l_adr_flex_value_set_id
55002 , p_adr_code => 'FA_EXPENSE_ACCT'
55003 , p_adr_type_code => 'S'
55004 , p_component_type => l_component_type
55005 , p_component_code => l_component_code
55006 , p_component_type_code => l_component_type_code
55007 , p_component_appl_id => l_component_appl_id
55008 , p_amb_context_code => l_amb_context_code
55009 , p_entity_code => 'TRANSACTIONS'
55010 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
55011 , p_side => 'NA'
55012 );
55013
55014 END IF;
55015
55016 --
55017 --
55018 END IF;
55019 --
55020 -- Bug 4922099
55021 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
55022 (NVL(l_enc_upg_option, 'N') = 'O')
55023 ) AND
55024 (l_bflow_method_code = 'PRIOR_ENTRY')
55025 )
55026 THEN
55027 IF
55028 --
55029 1 = 2
55030 --
55031 THEN
55032 xla_accounting_err_pkg.build_message
55033 (p_appli_s_name => 'XLA'
55034 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
55035 ,p_token_1 => 'LINE_NUMBER'
55036 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
55037 ,p_token_2 => 'LINE_TYPE_NAME'
55038 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
55039 l_component_type
55040 ,l_component_code
55041 ,l_component_type_code
55042 ,l_component_appl_id
55043 ,l_amb_context_code
55044 ,l_entity_code
55045 ,l_event_class_code
55046 )
55047 ,p_token_3 => 'OWNER'
55048 ,p_value_3 => xla_lookups_pkg.get_meaning(
55049 p_lookup_type => 'XLA_OWNER_TYPE'
55050 ,p_lookup_code => l_component_type_code
55051 )
55052 ,p_token_4 => 'PRODUCT_NAME'
55053 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
55054 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
55058 );
55055 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
55056 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
55057 ,p_ae_header_id => NULL
55059
55060 IF (C_LEVEL_ERROR>= g_log_level) THEN
55061 trace
55062 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
55063 ,p_level => C_LEVEL_ERROR
55064 ,p_module => l_log_module);
55065 END IF;
55066 END IF;
55067 END IF;
55068 --
55069 --
55070 ------------------------------------------------------------------------------------------------
55071 -- 4219869 Business Flow
55072 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
55073 -- Prior Entry. Currently, the following code is always generated.
55074 ------------------------------------------------------------------------------------------------
55075 XLA_AE_LINES_PKG.ValidateCurrentLine;
55076
55077 ------------------------------------------------------------------------------------
55078 -- 4219869 Business Flow
55079 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
55080 ------------------------------------------------------------------------------------
55081 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
55082
55083 ----------------------------------------------------------------------------------
55084 -- 4219869 Business Flow
55085 -- Update journal entry status -- Need to generate this within IF <condition>
55086 ----------------------------------------------------------------------------------
55087 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
55088 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
55089 ,p_balance_type_code => l_balance_type_code
55090 );
55091
55092 -------------------------------------------------------------------------------------------
55093 -- 4262811 - Generate the Accrual Reversal lines
55094 -------------------------------------------------------------------------------------------
55095 BEGIN
55096 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
55097 (g_array_event(p_event_id).array_value_num('header_index'));
55098 IF l_acc_rev_flag IS NULL THEN
55099 l_acc_rev_flag := 'N';
55100 END IF;
55101 EXCEPTION
55102 WHEN OTHERS THEN
55103 l_acc_rev_flag := 'N';
55104 END;
55105 --
55106 IF (l_acc_rev_flag = 'Y') THEN
55107
55108 -- 4645092 ------------------------------------------------------------------------------
55109 -- To allow MPA report to determine if it should generate report process
55110 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
55111 ------------------------------------------------------------------------------------------
55112
55113 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
55114 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
55115 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
55116 -- call ADRs
55117 -- Bug 4922099
55118 --
55119 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
55120 (NVL(l_actual_upg_option, 'N') = 'O') OR
55121 (NVL(l_enc_upg_option, 'N') = 'O')
55122 )
55123 THEN
55124 NULL;
55125 --
55126 --
55127
55128 l_ccid := AcctDerRule_174(
55129 p_application_id => p_application_id
55130 , p_ae_header_id => l_ae_header_id
55131 , p_source_5 => p_source_5
55132 , p_source_32 => p_source_32
55133 , x_transaction_coa_id => l_adr_transaction_coa_id
55134 , x_accounting_coa_id => l_adr_accounting_coa_id
55135 , x_value_type_code => l_adr_value_type_code
55136 , p_side => 'NA'
55137 );
55138
55139 xla_ae_lines_pkg.set_ccid(
55140 p_code_combination_id => l_ccid
55141 , p_value_type_code => l_adr_value_type_code
55142 , p_transaction_coa_id => l_adr_transaction_coa_id
55143 , p_accounting_coa_id => l_adr_accounting_coa_id
55144 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
55145 , p_adr_type_code => 'S'
55146 , p_component_type => l_component_type
55147 , p_component_code => l_component_code
55148 , p_component_type_code => l_component_type_code
55149 , p_component_appl_id => l_component_appl_id
55150 , p_amb_context_code => l_amb_context_code
55151 , p_side => 'NA'
55152 );
55153
55154
55155 l_segment := AcctDerRule_147(
55156 p_application_id => p_application_id
55157 , p_ae_header_id => l_ae_header_id
55158 , p_source_5 => p_source_5
55159 , p_source_9 => p_source_9
55160 , x_transaction_coa_id => l_adr_transaction_coa_id
55161 , x_accounting_coa_id => l_adr_accounting_coa_id
55162 , x_flexfield_segment_code => l_adr_flexfield_segment_code
55163 , x_flex_value_set_id => l_adr_flex_value_set_id
55167 , p_side => 'NA'
55164 , x_value_type_code => l_adr_value_type_code
55165 , x_value_combination_id => l_adr_value_combination_id
55166 , x_value_segment_code => l_adr_value_segment_code
55168 , p_override_seg_flag => 'Y'
55169 );
55170
55171 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
55172
55173 xla_ae_lines_pkg.set_segment(
55174 p_to_segment_code => 'GL_ACCOUNT'
55175 , p_segment_value => l_segment
55176 , p_from_segment_code => l_adr_value_segment_code
55177 , p_from_combination_id => l_adr_value_combination_id
55178 , p_value_type_code => l_adr_value_type_code
55179 , p_transaction_coa_id => l_adr_transaction_coa_id
55180 , p_accounting_coa_id => l_adr_accounting_coa_id
55181 , p_flexfield_segment_code => l_adr_flexfield_segment_code
55182 , p_flex_value_set_id => l_adr_flex_value_set_id
55183 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
55184 , p_adr_type_code => 'S'
55185 , p_component_type => l_component_type
55186 , p_component_code => l_component_code
55187 , p_component_type_code => l_component_type_code
55188 , p_component_appl_id => l_component_appl_id
55189 , p_amb_context_code => l_amb_context_code
55190 , p_entity_code => 'TRANSACTIONS'
55191 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
55192 , p_side => 'NA'
55193 );
55194
55195 END IF;
55196
55197 l_segment := AcctDerRule_169(
55198 p_application_id => p_application_id
55199 , p_ae_header_id => l_ae_header_id
55200 , p_source_5 => p_source_5
55201 , p_source_31 => p_source_31
55202 , x_transaction_coa_id => l_adr_transaction_coa_id
55203 , x_accounting_coa_id => l_adr_accounting_coa_id
55204 , x_flexfield_segment_code => l_adr_flexfield_segment_code
55205 , x_flex_value_set_id => l_adr_flex_value_set_id
55206 , x_value_type_code => l_adr_value_type_code
55207 , x_value_combination_id => l_adr_value_combination_id
55208 , x_value_segment_code => l_adr_value_segment_code
55209 , p_side => 'NA'
55210 , p_override_seg_flag => 'Y'
55211 );
55212
55213 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
55214
55215 xla_ae_lines_pkg.set_segment(
55216 p_to_segment_code => 'GL_BALANCING'
55217 , p_segment_value => l_segment
55218 , p_from_segment_code => l_adr_value_segment_code
55219 , p_from_combination_id => l_adr_value_combination_id
55220 , p_value_type_code => l_adr_value_type_code
55221 , p_transaction_coa_id => l_adr_transaction_coa_id
55222 , p_accounting_coa_id => l_adr_accounting_coa_id
55223 , p_flexfield_segment_code => l_adr_flexfield_segment_code
55224 , p_flex_value_set_id => l_adr_flex_value_set_id
55225 , p_adr_code => 'FA_EXPENSE_ACCT'
55226 , p_adr_type_code => 'S'
55227 , p_component_type => l_component_type
55228 , p_component_code => l_component_code
55229 , p_component_type_code => l_component_type_code
55230 , p_component_appl_id => l_component_appl_id
55231 , p_amb_context_code => l_amb_context_code
55232 , p_entity_code => 'TRANSACTIONS'
55233 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
55234 , p_side => 'NA'
55235 );
55236
55237 END IF;
55238
55239 --
55240 --
55241 END IF;
55242
55243 --
55244 -- Update the line information that should be overwritten
55245 --
55246 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
55247 p_header_num => 1);
55248 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
55249
55250 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
55251
55252 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
55253 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
55254 END IF;
55255
55256 --
55257 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
55258 --
55259 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
55260 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
55261 ELSE
55262 ---------------------------------------------------------------------------------------------------
55263 -- 4262811a Switch Sign
55264 ---------------------------------------------------------------------------------------------------
55265 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
55266 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
55267 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
55268 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
55272 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
55269 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
55270 -- 5132302
55271 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
55273
55274 END IF;
55275
55276 -- 4955764
55277 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
55278 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
55279
55280
55281 XLA_AE_LINES_PKG.ValidateCurrentLine;
55282 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
55283
55284 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
55285 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
55286 ,p_balance_type_code => l_balance_type_code);
55287
55288 END IF;
55289
55290 -----------------------------------------------------------------------------------------
55291 -- 4262811 Multiperiod Accounting
55292 -----------------------------------------------------------------------------------------
55293 -- No MPA option is assigned.
55294
55295
55296 END IF;
55297 END IF;
55298 --
55299
55300 --
55301 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
55302 trace
55303 (p_msg => 'END of AcctLineType_241'
55304 ,p_level => C_LEVEL_PROCEDURE
55305 ,p_module => l_log_module);
55306 END IF;
55307 --
55308 EXCEPTION
55309 WHEN xla_exceptions_pkg.application_exception THEN
55310 RAISE;
55311 WHEN OTHERS THEN
55312 xla_exceptions_pkg.raise_message
55313 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_241');
55314 END AcctLineType_241;
55315 --
55316
55317 ---------------------------------------
55318 --
55319 -- PRIVATE FUNCTION
55320 -- AcctLineType_242
55321 --
55322 ---------------------------------------
55323 PROCEDURE AcctLineType_242 (
55324 p_application_id IN NUMBER
55325 ,p_event_id IN NUMBER
55326 ,p_calculate_acctd_flag IN VARCHAR2
55327 ,p_calculate_g_l_flag IN VARCHAR2
55328 ,p_actual_flag IN OUT VARCHAR2
55329 ,p_balance_type_code OUT VARCHAR2
55330 ,p_gain_or_loss_ref OUT VARCHAR2
55331
55332 --Period Close Date
55333 , p_source_1 IN DATE
55334 --Generated Code Combination Identifier
55335 , p_source_5 IN NUMBER
55336 --Revaluation Reserve Account
55337 , p_source_13 IN VARCHAR2
55338 --Expense Account Code Combination Identifier
55339 , p_source_31 IN NUMBER
55340 --Default Code Combination Identifier
55341 , p_source_32 IN NUMBER
55342 --Adjustment Type
55343 , p_source_48 IN VARCHAR2
55344 --Transaction Header Identifier
55345 , p_source_49 IN NUMBER
55346 --Adjustment Line Identifier
55347 , p_source_50 IN NUMBER
55348 --Distribution Type Code
55349 , p_source_51 IN VARCHAR2
55350 --Entered Amount
55351 , p_source_52 IN NUMBER
55352 --Currency Code
55353 , p_source_53 IN VARCHAR2
55354 --Source Destination Code
55355 , p_source_55 IN VARCHAR2
55356 )
55357 IS
55358
55359 l_component_type VARCHAR2(80);
55360 l_component_code VARCHAR2(30);
55361 l_component_type_code VARCHAR2(1);
55362 l_component_appl_id INTEGER;
55363 l_amb_context_code VARCHAR2(30);
55364 l_entity_code VARCHAR2(30);
55365 l_event_class_code VARCHAR2(30);
55366 l_ae_header_id NUMBER;
55367 l_event_type_code VARCHAR2(30);
55368 l_line_definition_code VARCHAR2(30);
55369 l_line_definition_owner_code VARCHAR2(1);
55370 --
55371 -- adr variables
55372 l_segment VARCHAR2(30);
55373 l_ccid NUMBER;
55374 l_adr_transaction_coa_id NUMBER;
55375 l_adr_accounting_coa_id NUMBER;
55376 l_adr_flexfield_segment_code VARCHAR2(30);
55377 l_adr_flex_value_set_id NUMBER;
55378 l_adr_value_type_code VARCHAR2(30);
55379 l_adr_value_combination_id NUMBER;
55380 l_adr_value_segment_code VARCHAR2(30);
55381
55382 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
55383 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
55384 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
55385 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
55386
55387 -- 4262811 Variables ------------------------------------------------------------------------------------------
55388 l_entered_amt_idx NUMBER;
55389 l_accted_amt_idx NUMBER;
55390 l_acc_rev_flag VARCHAR2(1);
55391 l_accrual_line_num NUMBER;
55392 l_tmp_amt NUMBER;
55393 l_acc_rev_natural_side_code VARCHAR2(1);
55394
55395 l_num_entries NUMBER;
55396 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
55397 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
55398 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
55399 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
55400 l_recog_line_1 NUMBER;
55404 l_bflow_applied_to_amt NUMBER; -- 5132302
55401 l_recog_line_2 NUMBER;
55402
55403 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
55405 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
55406
55407 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
55408
55409 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
55410 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
55411
55412 ---------------------------------------------------------------------------------------------------------------
55413
55414
55415 --
55416 -- bulk performance
55417 --
55418 l_balance_type_code VARCHAR2(1);
55419 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
55420 l_log_module VARCHAR2(240);
55421
55422 --
55423 -- Upgrade strategy
55424 --
55425 l_actual_upg_option VARCHAR2(1);
55426 l_enc_upg_option VARCHAR2(1);
55427
55428 --
55429 BEGIN
55430 --
55431 IF g_log_enabled THEN
55432 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_242';
55433 END IF;
55434 --
55435 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
55436
55437 trace
55438 (p_msg => 'BEGIN of AcctLineType_242'
55439 ,p_level => C_LEVEL_PROCEDURE
55440 ,p_module => l_log_module);
55441
55442 END IF;
55443 --
55444 l_component_type := 'AMB_JLT';
55445 l_component_code := 'FA_CIP_RECLASS_SRC_REVAL_RES';
55446 l_component_type_code := 'S';
55447 l_component_appl_id := 140;
55448 l_amb_context_code := 'DEFAULT';
55449 l_entity_code := 'TRANSACTIONS';
55450 l_event_class_code := 'CIP_CATEGORY_RECLASS';
55451 l_event_type_code := 'CIP_CATEGORY_RECLASS_ALL';
55452 l_line_definition_owner_code := 'S';
55453 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_CA7';
55454 --
55455 l_balance_type_code := 'A';
55456 l_segment := NULL;
55457 l_ccid := NULL;
55458 l_adr_transaction_coa_id := NULL;
55459 l_adr_accounting_coa_id := NULL;
55460 l_adr_flexfield_segment_code := NULL;
55461 l_adr_flex_value_set_id := NULL;
55462 l_adr_value_type_code := NULL;
55463 l_adr_value_combination_id := NULL;
55464 l_adr_value_segment_code := NULL;
55465
55466 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
55467 l_bflow_class_code := ''; -- 4219869 Business Flow
55468 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
55469 l_budgetary_control_flag := 'N';
55470
55471 l_bflow_applied_to_amt_idx := NULL; -- 5132302
55472 l_bflow_applied_to_amt := NULL; -- 5132302
55473 l_entered_amt_idx := NULL; -- 4262811
55474 l_accted_amt_idx := NULL; -- 4262811
55475 l_acc_rev_flag := NULL; -- 4262811
55476 l_accrual_line_num := NULL; -- 4262811
55477 l_tmp_amt := NULL; -- 4262811
55478 --
55479
55480 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
55481 l_balance_type_code <> 'B' THEN
55482 IF NVL(p_source_48,'
55483 ') = 'REVAL RESERVE' AND
55484 NVL(p_source_55,'
55485 ') = 'SOURCE'
55486 THEN
55487
55488 --
55489 XLA_AE_LINES_PKG.SetNewLine;
55490
55491 p_balance_type_code := l_balance_type_code;
55492 -- set the flag so later we will know whether the gain loss line needs to be created
55493
55494 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
55495 p_actual_flag :='A';
55496 END IF;
55497
55498 --
55499 -- bulk performance
55500 --
55501 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
55502 p_header_num => 0); -- 4262811
55503 --
55504 -- set accounting line options
55505 --
55506 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
55507 p_natural_side_code => 'D'
55508 , p_gain_or_loss_flag => 'N'
55509 , p_gl_transfer_mode_code => 'S'
55510 , p_acct_entry_type_code => 'A'
55511 , p_switch_side_flag => 'Y'
55512 , p_merge_duplicate_code => 'N'
55513 );
55514 --
55515 l_acc_rev_natural_side_code := 'C'; -- 4262811
55516 --
55517 --
55518 -- set accounting line type info
55519 --
55520 xla_ae_lines_pkg.SetAcctLineType
55521 (p_component_type => l_component_type
55522 ,p_event_type_code => l_event_type_code
55523 ,p_line_definition_owner_code => l_line_definition_owner_code
55524 ,p_line_definition_code => l_line_definition_code
55525 ,p_accounting_line_code => l_component_code
55526 ,p_accounting_line_type_code => l_component_type_code
55527 ,p_accounting_line_appl_id => l_component_appl_id
55528 ,p_amb_context_code => l_amb_context_code
55529 ,p_entity_code => l_entity_code
55530 ,p_event_class_code => l_event_class_code);
55531 --
55532 -- set accounting class
55536 , p_ae_header_id => l_ae_header_id
55533 --
55534 xla_ae_lines_pkg.SetAcctClass(
55535 p_accounting_class_code => 'ASSET'
55537 );
55538
55539 --
55540 -- set rounding class
55541 --
55542 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
55543 'ASSET';
55544
55545 --
55546 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
55547 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
55548 --
55549 -- bulk performance
55550 --
55551 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
55552
55553 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
55554 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
55555
55556 -- 4955764
55557 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
55558 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
55559
55560 -- 4458381 Public Sector Enh
55561
55562 --
55563 -- set accounting attributes for the line type
55564 --
55565 l_entered_amt_idx := 4;
55566 l_accted_amt_idx := 6;
55567 l_bflow_applied_to_amt_idx := NULL; -- 5132302
55568 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
55569 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
55570 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
55571 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
55572 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
55573 l_rec_acct_attrs.array_char_value(3) := p_source_51;
55574 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
55575 l_rec_acct_attrs.array_num_value(4) := p_source_52;
55576 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
55577 l_rec_acct_attrs.array_char_value(5) := p_source_53;
55578 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
55579 l_rec_acct_attrs.array_num_value(6) := p_source_52;
55580
55581 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
55582 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
55583
55584 ---------------------------------------------------------------------------------------------------------------
55585 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
55586 ---------------------------------------------------------------------------------------------------------------
55587 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
55588
55589 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
55590 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
55591
55592 IF xla_accounting_cache_pkg.GetValueChar
55593 (p_source_code => 'LEDGER_CATEGORY_CODE'
55594 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
55595 AND l_bflow_method_code = 'PRIOR_ENTRY'
55596 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
55597 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
55598 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
55599 )
55600 THEN
55601 xla_ae_lines_pkg.BflowUpgEntry
55602 (p_business_method_code => l_bflow_method_code
55603 ,p_business_class_code => l_bflow_class_code
55604 ,p_balance_type => l_balance_type_code);
55605 ELSE
55606 NULL;
55607 -- No business flow processing for business flow method of NONE.
55608 END IF;
55609
55610 --
55611 -- call analytical criteria
55612 --
55613
55614 --
55615 -- call description
55616 --
55617
55618 xla_ae_lines_pkg.SetLineDescription(
55619 p_ae_header_id => l_ae_header_id
55620 ,p_description => Description_30 (
55621 p_application_id => p_application_id
55622 , p_ae_header_id => l_ae_header_id
55623 , p_source_1 => p_source_1
55624 )
55625 );
55626
55627
55628 --
55629 -- call ADRs
55630 -- Bug 4922099
55631 --
55632 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
55633 (NVL(l_actual_upg_option, 'N') = 'O') OR
55634 (NVL(l_enc_upg_option, 'N') = 'O')
55635 )
55636 THEN
55637 NULL;
55638 --
55639 --
55640
55641 l_ccid := AcctDerRule_174(
55642 p_application_id => p_application_id
55643 , p_ae_header_id => l_ae_header_id
55644 , p_source_5 => p_source_5
55645 , p_source_32 => p_source_32
55646 , x_transaction_coa_id => l_adr_transaction_coa_id
55647 , x_accounting_coa_id => l_adr_accounting_coa_id
55648 , x_value_type_code => l_adr_value_type_code
55649 , p_side => 'NA'
55650 );
55651
55652 xla_ae_lines_pkg.set_ccid(
55653 p_code_combination_id => l_ccid
55657 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
55654 , p_value_type_code => l_adr_value_type_code
55655 , p_transaction_coa_id => l_adr_transaction_coa_id
55656 , p_accounting_coa_id => l_adr_accounting_coa_id
55658 , p_adr_type_code => 'S'
55659 , p_component_type => l_component_type
55660 , p_component_code => l_component_code
55661 , p_component_type_code => l_component_type_code
55662 , p_component_appl_id => l_component_appl_id
55663 , p_amb_context_code => l_amb_context_code
55664 , p_side => 'NA'
55665 );
55666
55667
55668 l_segment := AcctDerRule_151(
55669 p_application_id => p_application_id
55670 , p_ae_header_id => l_ae_header_id
55671 , p_source_5 => p_source_5
55672 , p_source_13 => p_source_13
55673 , x_transaction_coa_id => l_adr_transaction_coa_id
55674 , x_accounting_coa_id => l_adr_accounting_coa_id
55675 , x_flexfield_segment_code => l_adr_flexfield_segment_code
55676 , x_flex_value_set_id => l_adr_flex_value_set_id
55677 , x_value_type_code => l_adr_value_type_code
55678 , x_value_combination_id => l_adr_value_combination_id
55679 , x_value_segment_code => l_adr_value_segment_code
55680 , p_side => 'NA'
55681 , p_override_seg_flag => 'Y'
55682 );
55683
55684 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
55685
55686 xla_ae_lines_pkg.set_segment(
55687 p_to_segment_code => 'GL_ACCOUNT'
55688 , p_segment_value => l_segment
55689 , p_from_segment_code => l_adr_value_segment_code
55690 , p_from_combination_id => l_adr_value_combination_id
55691 , p_value_type_code => l_adr_value_type_code
55692 , p_transaction_coa_id => l_adr_transaction_coa_id
55693 , p_accounting_coa_id => l_adr_accounting_coa_id
55694 , p_flexfield_segment_code => l_adr_flexfield_segment_code
55695 , p_flex_value_set_id => l_adr_flex_value_set_id
55696 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
55697 , p_adr_type_code => 'S'
55698 , p_component_type => l_component_type
55699 , p_component_code => l_component_code
55700 , p_component_type_code => l_component_type_code
55701 , p_component_appl_id => l_component_appl_id
55702 , p_amb_context_code => l_amb_context_code
55703 , p_entity_code => 'TRANSACTIONS'
55704 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
55705 , p_side => 'NA'
55706 );
55707
55708 END IF;
55709
55710 l_segment := AcctDerRule_169(
55711 p_application_id => p_application_id
55712 , p_ae_header_id => l_ae_header_id
55713 , p_source_5 => p_source_5
55714 , p_source_31 => p_source_31
55715 , x_transaction_coa_id => l_adr_transaction_coa_id
55716 , x_accounting_coa_id => l_adr_accounting_coa_id
55717 , x_flexfield_segment_code => l_adr_flexfield_segment_code
55718 , x_flex_value_set_id => l_adr_flex_value_set_id
55719 , x_value_type_code => l_adr_value_type_code
55720 , x_value_combination_id => l_adr_value_combination_id
55721 , x_value_segment_code => l_adr_value_segment_code
55722 , p_side => 'NA'
55723 , p_override_seg_flag => 'Y'
55724 );
55725
55726 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
55727
55728 xla_ae_lines_pkg.set_segment(
55729 p_to_segment_code => 'GL_BALANCING'
55730 , p_segment_value => l_segment
55731 , p_from_segment_code => l_adr_value_segment_code
55732 , p_from_combination_id => l_adr_value_combination_id
55733 , p_value_type_code => l_adr_value_type_code
55734 , p_transaction_coa_id => l_adr_transaction_coa_id
55735 , p_accounting_coa_id => l_adr_accounting_coa_id
55736 , p_flexfield_segment_code => l_adr_flexfield_segment_code
55737 , p_flex_value_set_id => l_adr_flex_value_set_id
55738 , p_adr_code => 'FA_EXPENSE_ACCT'
55739 , p_adr_type_code => 'S'
55740 , p_component_type => l_component_type
55741 , p_component_code => l_component_code
55742 , p_component_type_code => l_component_type_code
55743 , p_component_appl_id => l_component_appl_id
55744 , p_amb_context_code => l_amb_context_code
55745 , p_entity_code => 'TRANSACTIONS'
55746 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
55747 , p_side => 'NA'
55748 );
55749
55750 END IF;
55751
55752 --
55753 --
55754 END IF;
55755 --
55756 -- Bug 4922099
55757 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
55758 (NVL(l_enc_upg_option, 'N') = 'O')
55759 ) AND
55760 (l_bflow_method_code = 'PRIOR_ENTRY')
55761 )
55762 THEN
55763 IF
55764 --
55765 1 = 2
55766 --
55767 THEN
55768 xla_accounting_err_pkg.build_message
55769 (p_appli_s_name => 'XLA'
55773 ,p_token_2 => 'LINE_TYPE_NAME'
55770 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
55771 ,p_token_1 => 'LINE_NUMBER'
55772 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
55774 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
55775 l_component_type
55776 ,l_component_code
55777 ,l_component_type_code
55778 ,l_component_appl_id
55779 ,l_amb_context_code
55780 ,l_entity_code
55781 ,l_event_class_code
55782 )
55783 ,p_token_3 => 'OWNER'
55784 ,p_value_3 => xla_lookups_pkg.get_meaning(
55785 p_lookup_type => 'XLA_OWNER_TYPE'
55786 ,p_lookup_code => l_component_type_code
55787 )
55788 ,p_token_4 => 'PRODUCT_NAME'
55789 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
55790 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
55791 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
55792 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
55793 ,p_ae_header_id => NULL
55794 );
55795
55796 IF (C_LEVEL_ERROR>= g_log_level) THEN
55797 trace
55798 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
55799 ,p_level => C_LEVEL_ERROR
55800 ,p_module => l_log_module);
55801 END IF;
55802 END IF;
55803 END IF;
55804 --
55805 --
55806 ------------------------------------------------------------------------------------------------
55807 -- 4219869 Business Flow
55808 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
55809 -- Prior Entry. Currently, the following code is always generated.
55810 ------------------------------------------------------------------------------------------------
55811 XLA_AE_LINES_PKG.ValidateCurrentLine;
55812
55813 ------------------------------------------------------------------------------------
55814 -- 4219869 Business Flow
55815 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
55816 ------------------------------------------------------------------------------------
55817 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
55818
55819 ----------------------------------------------------------------------------------
55820 -- 4219869 Business Flow
55821 -- Update journal entry status -- Need to generate this within IF <condition>
55822 ----------------------------------------------------------------------------------
55823 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
55824 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
55825 ,p_balance_type_code => l_balance_type_code
55826 );
55827
55828 -------------------------------------------------------------------------------------------
55829 -- 4262811 - Generate the Accrual Reversal lines
55830 -------------------------------------------------------------------------------------------
55831 BEGIN
55832 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
55833 (g_array_event(p_event_id).array_value_num('header_index'));
55834 IF l_acc_rev_flag IS NULL THEN
55835 l_acc_rev_flag := 'N';
55836 END IF;
55837 EXCEPTION
55838 WHEN OTHERS THEN
55839 l_acc_rev_flag := 'N';
55840 END;
55841 --
55842 IF (l_acc_rev_flag = 'Y') THEN
55843
55844 -- 4645092 ------------------------------------------------------------------------------
55845 -- To allow MPA report to determine if it should generate report process
55846 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
55847 ------------------------------------------------------------------------------------------
55848
55849 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
55850 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
55851 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
55852 -- call ADRs
55853 -- Bug 4922099
55854 --
55855 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
55856 (NVL(l_actual_upg_option, 'N') = 'O') OR
55857 (NVL(l_enc_upg_option, 'N') = 'O')
55858 )
55859 THEN
55860 NULL;
55861 --
55862 --
55866 , p_ae_header_id => l_ae_header_id
55863
55864 l_ccid := AcctDerRule_174(
55865 p_application_id => p_application_id
55867 , p_source_5 => p_source_5
55868 , p_source_32 => p_source_32
55869 , x_transaction_coa_id => l_adr_transaction_coa_id
55870 , x_accounting_coa_id => l_adr_accounting_coa_id
55871 , x_value_type_code => l_adr_value_type_code
55872 , p_side => 'NA'
55873 );
55874
55875 xla_ae_lines_pkg.set_ccid(
55876 p_code_combination_id => l_ccid
55877 , p_value_type_code => l_adr_value_type_code
55878 , p_transaction_coa_id => l_adr_transaction_coa_id
55879 , p_accounting_coa_id => l_adr_accounting_coa_id
55880 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
55881 , p_adr_type_code => 'S'
55882 , p_component_type => l_component_type
55883 , p_component_code => l_component_code
55884 , p_component_type_code => l_component_type_code
55885 , p_component_appl_id => l_component_appl_id
55886 , p_amb_context_code => l_amb_context_code
55887 , p_side => 'NA'
55888 );
55889
55890
55891 l_segment := AcctDerRule_151(
55892 p_application_id => p_application_id
55893 , p_ae_header_id => l_ae_header_id
55894 , p_source_5 => p_source_5
55895 , p_source_13 => p_source_13
55896 , x_transaction_coa_id => l_adr_transaction_coa_id
55897 , x_accounting_coa_id => l_adr_accounting_coa_id
55898 , x_flexfield_segment_code => l_adr_flexfield_segment_code
55899 , x_flex_value_set_id => l_adr_flex_value_set_id
55900 , x_value_type_code => l_adr_value_type_code
55901 , x_value_combination_id => l_adr_value_combination_id
55902 , x_value_segment_code => l_adr_value_segment_code
55903 , p_side => 'NA'
55904 , p_override_seg_flag => 'Y'
55905 );
55906
55907 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
55908
55909 xla_ae_lines_pkg.set_segment(
55910 p_to_segment_code => 'GL_ACCOUNT'
55911 , p_segment_value => l_segment
55912 , p_from_segment_code => l_adr_value_segment_code
55913 , p_from_combination_id => l_adr_value_combination_id
55914 , p_value_type_code => l_adr_value_type_code
55915 , p_transaction_coa_id => l_adr_transaction_coa_id
55916 , p_accounting_coa_id => l_adr_accounting_coa_id
55917 , p_flexfield_segment_code => l_adr_flexfield_segment_code
55918 , p_flex_value_set_id => l_adr_flex_value_set_id
55919 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
55920 , p_adr_type_code => 'S'
55921 , p_component_type => l_component_type
55922 , p_component_code => l_component_code
55923 , p_component_type_code => l_component_type_code
55924 , p_component_appl_id => l_component_appl_id
55925 , p_amb_context_code => l_amb_context_code
55926 , p_entity_code => 'TRANSACTIONS'
55927 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
55928 , p_side => 'NA'
55929 );
55930
55931 END IF;
55932
55933 l_segment := AcctDerRule_169(
55934 p_application_id => p_application_id
55935 , p_ae_header_id => l_ae_header_id
55936 , p_source_5 => p_source_5
55937 , p_source_31 => p_source_31
55938 , x_transaction_coa_id => l_adr_transaction_coa_id
55939 , x_accounting_coa_id => l_adr_accounting_coa_id
55940 , x_flexfield_segment_code => l_adr_flexfield_segment_code
55941 , x_flex_value_set_id => l_adr_flex_value_set_id
55942 , x_value_type_code => l_adr_value_type_code
55943 , x_value_combination_id => l_adr_value_combination_id
55944 , x_value_segment_code => l_adr_value_segment_code
55945 , p_side => 'NA'
55946 , p_override_seg_flag => 'Y'
55947 );
55948
55949 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
55950
55951 xla_ae_lines_pkg.set_segment(
55952 p_to_segment_code => 'GL_BALANCING'
55953 , p_segment_value => l_segment
55954 , p_from_segment_code => l_adr_value_segment_code
55955 , p_from_combination_id => l_adr_value_combination_id
55956 , p_value_type_code => l_adr_value_type_code
55957 , p_transaction_coa_id => l_adr_transaction_coa_id
55958 , p_accounting_coa_id => l_adr_accounting_coa_id
55959 , p_flexfield_segment_code => l_adr_flexfield_segment_code
55960 , p_flex_value_set_id => l_adr_flex_value_set_id
55961 , p_adr_code => 'FA_EXPENSE_ACCT'
55962 , p_adr_type_code => 'S'
55963 , p_component_type => l_component_type
55964 , p_component_code => l_component_code
55965 , p_component_type_code => l_component_type_code
55966 , p_component_appl_id => l_component_appl_id
55967 , p_amb_context_code => l_amb_context_code
55968 , p_entity_code => 'TRANSACTIONS'
55969 , p_event_class_code => 'CIP_CATEGORY_RECLASS'
55973 END IF;
55970 , p_side => 'NA'
55971 );
55972
55974
55975 --
55976 --
55977 END IF;
55978
55979 --
55980 -- Update the line information that should be overwritten
55981 --
55982 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
55983 p_header_num => 1);
55984 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
55985
55986 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
55987
55988 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
55989 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
55990 END IF;
55991
55992 --
55993 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
55994 --
55995 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
55996 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
55997 ELSE
55998 ---------------------------------------------------------------------------------------------------
55999 -- 4262811a Switch Sign
56000 ---------------------------------------------------------------------------------------------------
56001 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
56002 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
56003 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
56004 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
56005 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
56006 -- 5132302
56007 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
56008 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
56009
56010 END IF;
56011
56012 -- 4955764
56013 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
56014 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
56015
56016
56017 XLA_AE_LINES_PKG.ValidateCurrentLine;
56018 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
56019
56020 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
56021 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
56022 ,p_balance_type_code => l_balance_type_code);
56023
56024 END IF;
56025
56026 -----------------------------------------------------------------------------------------
56027 -- 4262811 Multiperiod Accounting
56028 -----------------------------------------------------------------------------------------
56029 -- No MPA option is assigned.
56030
56031
56032 END IF;
56033 END IF;
56034 --
56035
56036 --
56037 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
56038 trace
56039 (p_msg => 'END of AcctLineType_242'
56040 ,p_level => C_LEVEL_PROCEDURE
56041 ,p_module => l_log_module);
56042 END IF;
56043 --
56044 EXCEPTION
56045 WHEN xla_exceptions_pkg.application_exception THEN
56046 RAISE;
56047 WHEN OTHERS THEN
56048 xla_exceptions_pkg.raise_message
56049 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_242');
56050 END AcctLineType_242;
56051 --
56052
56053 ---------------------------------------
56054 --
56055 -- PRIVATE FUNCTION
56056 -- AcctLineType_243
56057 --
56058 ---------------------------------------
56059 PROCEDURE AcctLineType_243 (
56060 p_application_id IN NUMBER
56061 ,p_event_id IN NUMBER
56062 ,p_calculate_acctd_flag IN VARCHAR2
56063 ,p_calculate_g_l_flag IN VARCHAR2
56064 ,p_actual_flag IN OUT VARCHAR2
56065 ,p_balance_type_code OUT VARCHAR2
56066 ,p_gain_or_loss_ref OUT VARCHAR2
56067
56068 --Period Close Date
56069 , p_source_1 IN DATE
56070 --Generated Code Combination Identifier
56071 , p_source_5 IN NUMBER
56072 --CIP Cost Account
56073 , p_source_9 IN VARCHAR2
56074 --Expense Account Code Combination Identifier
56075 , p_source_31 IN NUMBER
56076 --Default Code Combination Identifier
56077 , p_source_32 IN NUMBER
56078 --Adjustment Type
56079 , p_source_48 IN VARCHAR2
56080 --Transaction Header Identifier
56081 , p_source_49 IN NUMBER
56082 --Adjustment Line Identifier
56083 , p_source_50 IN NUMBER
56084 --Distribution Type Code
56085 , p_source_51 IN VARCHAR2
56086 --Entered Amount
56087 , p_source_52 IN NUMBER
56088 --Currency Code
56089 , p_source_53 IN VARCHAR2
56090 )
56091 IS
56092
56093 l_component_type VARCHAR2(80);
56094 l_component_code VARCHAR2(30);
56095 l_component_type_code VARCHAR2(1);
56096 l_component_appl_id INTEGER;
56100 l_ae_header_id NUMBER;
56097 l_amb_context_code VARCHAR2(30);
56098 l_entity_code VARCHAR2(30);
56099 l_event_class_code VARCHAR2(30);
56101 l_event_type_code VARCHAR2(30);
56102 l_line_definition_code VARCHAR2(30);
56103 l_line_definition_owner_code VARCHAR2(1);
56104 --
56105 -- adr variables
56106 l_segment VARCHAR2(30);
56107 l_ccid NUMBER;
56108 l_adr_transaction_coa_id NUMBER;
56109 l_adr_accounting_coa_id NUMBER;
56110 l_adr_flexfield_segment_code VARCHAR2(30);
56111 l_adr_flex_value_set_id NUMBER;
56112 l_adr_value_type_code VARCHAR2(30);
56113 l_adr_value_combination_id NUMBER;
56114 l_adr_value_segment_code VARCHAR2(30);
56115
56116 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
56117 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
56118 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
56119 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
56120
56121 -- 4262811 Variables ------------------------------------------------------------------------------------------
56122 l_entered_amt_idx NUMBER;
56123 l_accted_amt_idx NUMBER;
56124 l_acc_rev_flag VARCHAR2(1);
56125 l_accrual_line_num NUMBER;
56126 l_tmp_amt NUMBER;
56127 l_acc_rev_natural_side_code VARCHAR2(1);
56128
56129 l_num_entries NUMBER;
56130 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
56131 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
56132 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
56133 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
56134 l_recog_line_1 NUMBER;
56135 l_recog_line_2 NUMBER;
56136
56137 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
56138 l_bflow_applied_to_amt NUMBER; -- 5132302
56139 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
56140
56141 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
56142
56143 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
56144 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
56145
56146 ---------------------------------------------------------------------------------------------------------------
56147
56148
56149 --
56150 -- bulk performance
56151 --
56152 l_balance_type_code VARCHAR2(1);
56153 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
56154 l_log_module VARCHAR2(240);
56155
56156 --
56157 -- Upgrade strategy
56158 --
56159 l_actual_upg_option VARCHAR2(1);
56160 l_enc_upg_option VARCHAR2(1);
56161
56162 --
56163 BEGIN
56164 --
56165 IF g_log_enabled THEN
56166 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_243';
56167 END IF;
56168 --
56169 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
56170
56171 trace
56172 (p_msg => 'BEGIN of AcctLineType_243'
56173 ,p_level => C_LEVEL_PROCEDURE
56174 ,p_module => l_log_module);
56175
56176 END IF;
56177 --
56178 l_component_type := 'AMB_JLT';
56179 l_component_code := 'FA_CIP_RETIREMENT_COST';
56180 l_component_type_code := 'S';
56181 l_component_appl_id := 140;
56182 l_amb_context_code := 'DEFAULT';
56183 l_entity_code := 'TRANSACTIONS';
56184 l_event_class_code := 'CIP_RETIREMENTS';
56185 l_event_type_code := 'CIP_REINSTATEMENTS';
56186 l_line_definition_owner_code := 'S';
56187 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
56188 --
56189 l_balance_type_code := 'A';
56190 l_segment := NULL;
56191 l_ccid := NULL;
56192 l_adr_transaction_coa_id := NULL;
56193 l_adr_accounting_coa_id := NULL;
56194 l_adr_flexfield_segment_code := NULL;
56195 l_adr_flex_value_set_id := NULL;
56196 l_adr_value_type_code := NULL;
56197 l_adr_value_combination_id := NULL;
56198 l_adr_value_segment_code := NULL;
56199
56200 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
56201 l_bflow_class_code := ''; -- 4219869 Business Flow
56202 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
56203 l_budgetary_control_flag := 'N';
56204
56205 l_bflow_applied_to_amt_idx := NULL; -- 5132302
56206 l_bflow_applied_to_amt := NULL; -- 5132302
56207 l_entered_amt_idx := NULL; -- 4262811
56208 l_accted_amt_idx := NULL; -- 4262811
56209 l_acc_rev_flag := NULL; -- 4262811
56210 l_accrual_line_num := NULL; -- 4262811
56211 l_tmp_amt := NULL; -- 4262811
56212 --
56213
56214 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
56215 l_balance_type_code <> 'B' THEN
56216 IF NVL(p_source_48,'
56217 ') = 'CIP COST'
56218 THEN
56219
56220 --
56221 XLA_AE_LINES_PKG.SetNewLine;
56222
56223 p_balance_type_code := l_balance_type_code;
56227 p_actual_flag :='A';
56224 -- set the flag so later we will know whether the gain loss line needs to be created
56225
56226 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
56228 END IF;
56229
56230 --
56231 -- bulk performance
56232 --
56233 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
56234 p_header_num => 0); -- 4262811
56235 --
56236 -- set accounting line options
56237 --
56238 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
56239 p_natural_side_code => 'C'
56240 , p_gain_or_loss_flag => 'N'
56241 , p_gl_transfer_mode_code => 'S'
56242 , p_acct_entry_type_code => 'A'
56243 , p_switch_side_flag => 'Y'
56244 , p_merge_duplicate_code => 'N'
56245 );
56246 --
56247 l_acc_rev_natural_side_code := 'D'; -- 4262811
56248 --
56249 --
56250 -- set accounting line type info
56251 --
56252 xla_ae_lines_pkg.SetAcctLineType
56253 (p_component_type => l_component_type
56254 ,p_event_type_code => l_event_type_code
56255 ,p_line_definition_owner_code => l_line_definition_owner_code
56256 ,p_line_definition_code => l_line_definition_code
56257 ,p_accounting_line_code => l_component_code
56258 ,p_accounting_line_type_code => l_component_type_code
56259 ,p_accounting_line_appl_id => l_component_appl_id
56260 ,p_amb_context_code => l_amb_context_code
56261 ,p_entity_code => l_entity_code
56262 ,p_event_class_code => l_event_class_code);
56263 --
56264 -- set accounting class
56265 --
56266 xla_ae_lines_pkg.SetAcctClass(
56267 p_accounting_class_code => 'ASSET'
56268 , p_ae_header_id => l_ae_header_id
56269 );
56270
56271 --
56272 -- set rounding class
56273 --
56274 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
56275 'ASSET';
56276
56277 --
56278 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
56279 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
56280 --
56281 -- bulk performance
56282 --
56283 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
56284
56285 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
56286 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
56287
56288 -- 4955764
56289 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
56290 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
56291
56292 -- 4458381 Public Sector Enh
56293
56294 --
56295 -- set accounting attributes for the line type
56296 --
56297 l_entered_amt_idx := 4;
56298 l_accted_amt_idx := 6;
56299 l_bflow_applied_to_amt_idx := NULL; -- 5132302
56300 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
56301 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
56302 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
56303 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
56304 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
56305 l_rec_acct_attrs.array_char_value(3) := p_source_51;
56306 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
56307 l_rec_acct_attrs.array_num_value(4) := p_source_52;
56308 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
56309 l_rec_acct_attrs.array_char_value(5) := p_source_53;
56310 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
56311 l_rec_acct_attrs.array_num_value(6) := p_source_52;
56312
56313 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
56314 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
56315
56316 ---------------------------------------------------------------------------------------------------------------
56317 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
56318 ---------------------------------------------------------------------------------------------------------------
56319 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
56320
56321 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
56322 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
56323
56324 IF xla_accounting_cache_pkg.GetValueChar
56325 (p_source_code => 'LEDGER_CATEGORY_CODE'
56326 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
56327 AND l_bflow_method_code = 'PRIOR_ENTRY'
56328 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
56329 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
56330 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
56331 )
56332 THEN
56333 xla_ae_lines_pkg.BflowUpgEntry
56334 (p_business_method_code => l_bflow_method_code
56338 NULL;
56335 ,p_business_class_code => l_bflow_class_code
56336 ,p_balance_type => l_balance_type_code);
56337 ELSE
56339 -- No business flow processing for business flow method of NONE.
56340 END IF;
56341
56342 --
56343 -- call analytical criteria
56344 --
56345
56346 --
56347 -- call description
56348 --
56349
56350 xla_ae_lines_pkg.SetLineDescription(
56351 p_ae_header_id => l_ae_header_id
56352 ,p_description => Description_33 (
56353 p_application_id => p_application_id
56354 , p_ae_header_id => l_ae_header_id
56355 , p_source_1 => p_source_1
56356 )
56357 );
56358
56359
56360 --
56361 -- call ADRs
56362 -- Bug 4922099
56363 --
56364 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
56365 (NVL(l_actual_upg_option, 'N') = 'O') OR
56366 (NVL(l_enc_upg_option, 'N') = 'O')
56367 )
56368 THEN
56369 NULL;
56370 --
56371 --
56372
56373 l_ccid := AcctDerRule_174(
56374 p_application_id => p_application_id
56375 , p_ae_header_id => l_ae_header_id
56376 , p_source_5 => p_source_5
56377 , p_source_32 => p_source_32
56378 , x_transaction_coa_id => l_adr_transaction_coa_id
56379 , x_accounting_coa_id => l_adr_accounting_coa_id
56380 , x_value_type_code => l_adr_value_type_code
56381 , p_side => 'NA'
56382 );
56383
56384 xla_ae_lines_pkg.set_ccid(
56385 p_code_combination_id => l_ccid
56386 , p_value_type_code => l_adr_value_type_code
56387 , p_transaction_coa_id => l_adr_transaction_coa_id
56388 , p_accounting_coa_id => l_adr_accounting_coa_id
56389 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
56390 , p_adr_type_code => 'S'
56391 , p_component_type => l_component_type
56392 , p_component_code => l_component_code
56393 , p_component_type_code => l_component_type_code
56394 , p_component_appl_id => l_component_appl_id
56395 , p_amb_context_code => l_amb_context_code
56396 , p_side => 'NA'
56397 );
56398
56399
56400 l_segment := AcctDerRule_147(
56401 p_application_id => p_application_id
56402 , p_ae_header_id => l_ae_header_id
56403 , p_source_5 => p_source_5
56404 , p_source_9 => p_source_9
56405 , x_transaction_coa_id => l_adr_transaction_coa_id
56406 , x_accounting_coa_id => l_adr_accounting_coa_id
56407 , x_flexfield_segment_code => l_adr_flexfield_segment_code
56408 , x_flex_value_set_id => l_adr_flex_value_set_id
56409 , x_value_type_code => l_adr_value_type_code
56410 , x_value_combination_id => l_adr_value_combination_id
56411 , x_value_segment_code => l_adr_value_segment_code
56412 , p_side => 'NA'
56413 , p_override_seg_flag => 'Y'
56414 );
56415
56416 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
56417
56418 xla_ae_lines_pkg.set_segment(
56419 p_to_segment_code => 'GL_ACCOUNT'
56420 , p_segment_value => l_segment
56421 , p_from_segment_code => l_adr_value_segment_code
56422 , p_from_combination_id => l_adr_value_combination_id
56423 , p_value_type_code => l_adr_value_type_code
56424 , p_transaction_coa_id => l_adr_transaction_coa_id
56425 , p_accounting_coa_id => l_adr_accounting_coa_id
56426 , p_flexfield_segment_code => l_adr_flexfield_segment_code
56427 , p_flex_value_set_id => l_adr_flex_value_set_id
56428 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
56429 , p_adr_type_code => 'S'
56430 , p_component_type => l_component_type
56431 , p_component_code => l_component_code
56432 , p_component_type_code => l_component_type_code
56433 , p_component_appl_id => l_component_appl_id
56434 , p_amb_context_code => l_amb_context_code
56435 , p_entity_code => 'TRANSACTIONS'
56436 , p_event_class_code => 'CIP_RETIREMENTS'
56437 , p_side => 'NA'
56438 );
56439
56440 END IF;
56441
56442 l_segment := AcctDerRule_169(
56443 p_application_id => p_application_id
56444 , p_ae_header_id => l_ae_header_id
56445 , p_source_5 => p_source_5
56446 , p_source_31 => p_source_31
56447 , x_transaction_coa_id => l_adr_transaction_coa_id
56448 , x_accounting_coa_id => l_adr_accounting_coa_id
56449 , x_flexfield_segment_code => l_adr_flexfield_segment_code
56450 , x_flex_value_set_id => l_adr_flex_value_set_id
56451 , x_value_type_code => l_adr_value_type_code
56452 , x_value_combination_id => l_adr_value_combination_id
56453 , x_value_segment_code => l_adr_value_segment_code
56454 , p_side => 'NA'
56455 , p_override_seg_flag => 'Y'
56456 );
56457
56458 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
56459
56460 xla_ae_lines_pkg.set_segment(
56464 , p_from_combination_id => l_adr_value_combination_id
56461 p_to_segment_code => 'GL_BALANCING'
56462 , p_segment_value => l_segment
56463 , p_from_segment_code => l_adr_value_segment_code
56465 , p_value_type_code => l_adr_value_type_code
56466 , p_transaction_coa_id => l_adr_transaction_coa_id
56467 , p_accounting_coa_id => l_adr_accounting_coa_id
56468 , p_flexfield_segment_code => l_adr_flexfield_segment_code
56469 , p_flex_value_set_id => l_adr_flex_value_set_id
56470 , p_adr_code => 'FA_EXPENSE_ACCT'
56471 , p_adr_type_code => 'S'
56472 , p_component_type => l_component_type
56473 , p_component_code => l_component_code
56474 , p_component_type_code => l_component_type_code
56475 , p_component_appl_id => l_component_appl_id
56476 , p_amb_context_code => l_amb_context_code
56477 , p_entity_code => 'TRANSACTIONS'
56478 , p_event_class_code => 'CIP_RETIREMENTS'
56479 , p_side => 'NA'
56480 );
56481
56482 END IF;
56483
56484 --
56485 --
56486 END IF;
56487 --
56488 -- Bug 4922099
56489 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
56490 (NVL(l_enc_upg_option, 'N') = 'O')
56491 ) AND
56492 (l_bflow_method_code = 'PRIOR_ENTRY')
56493 )
56494 THEN
56495 IF
56496 --
56497 1 = 2
56498 --
56499 THEN
56500 xla_accounting_err_pkg.build_message
56501 (p_appli_s_name => 'XLA'
56502 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
56503 ,p_token_1 => 'LINE_NUMBER'
56504 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
56505 ,p_token_2 => 'LINE_TYPE_NAME'
56506 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
56507 l_component_type
56508 ,l_component_code
56509 ,l_component_type_code
56510 ,l_component_appl_id
56511 ,l_amb_context_code
56512 ,l_entity_code
56513 ,l_event_class_code
56514 )
56515 ,p_token_3 => 'OWNER'
56516 ,p_value_3 => xla_lookups_pkg.get_meaning(
56517 p_lookup_type => 'XLA_OWNER_TYPE'
56518 ,p_lookup_code => l_component_type_code
56519 )
56520 ,p_token_4 => 'PRODUCT_NAME'
56521 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
56522 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
56523 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
56524 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
56525 ,p_ae_header_id => NULL
56526 );
56527
56528 IF (C_LEVEL_ERROR>= g_log_level) THEN
56529 trace
56530 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
56531 ,p_level => C_LEVEL_ERROR
56532 ,p_module => l_log_module);
56533 END IF;
56534 END IF;
56535 END IF;
56536 --
56537 --
56538 ------------------------------------------------------------------------------------------------
56539 -- 4219869 Business Flow
56540 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
56541 -- Prior Entry. Currently, the following code is always generated.
56542 ------------------------------------------------------------------------------------------------
56543 XLA_AE_LINES_PKG.ValidateCurrentLine;
56544
56545 ------------------------------------------------------------------------------------
56546 -- 4219869 Business Flow
56547 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
56548 ------------------------------------------------------------------------------------
56549 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
56550
56551 ----------------------------------------------------------------------------------
56552 -- 4219869 Business Flow
56553 -- Update journal entry status -- Need to generate this within IF <condition>
56554 ----------------------------------------------------------------------------------
56558 );
56555 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
56556 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
56557 ,p_balance_type_code => l_balance_type_code
56559
56560 -------------------------------------------------------------------------------------------
56561 -- 4262811 - Generate the Accrual Reversal lines
56562 -------------------------------------------------------------------------------------------
56563 BEGIN
56564 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
56565 (g_array_event(p_event_id).array_value_num('header_index'));
56566 IF l_acc_rev_flag IS NULL THEN
56567 l_acc_rev_flag := 'N';
56568 END IF;
56569 EXCEPTION
56570 WHEN OTHERS THEN
56571 l_acc_rev_flag := 'N';
56572 END;
56573 --
56574 IF (l_acc_rev_flag = 'Y') THEN
56575
56576 -- 4645092 ------------------------------------------------------------------------------
56577 -- To allow MPA report to determine if it should generate report process
56578 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
56579 ------------------------------------------------------------------------------------------
56580
56581 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
56582 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
56583 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
56584 -- call ADRs
56585 -- Bug 4922099
56586 --
56587 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
56588 (NVL(l_actual_upg_option, 'N') = 'O') OR
56589 (NVL(l_enc_upg_option, 'N') = 'O')
56590 )
56591 THEN
56592 NULL;
56593 --
56594 --
56595
56596 l_ccid := AcctDerRule_174(
56597 p_application_id => p_application_id
56598 , p_ae_header_id => l_ae_header_id
56599 , p_source_5 => p_source_5
56600 , p_source_32 => p_source_32
56601 , x_transaction_coa_id => l_adr_transaction_coa_id
56602 , x_accounting_coa_id => l_adr_accounting_coa_id
56603 , x_value_type_code => l_adr_value_type_code
56604 , p_side => 'NA'
56605 );
56606
56607 xla_ae_lines_pkg.set_ccid(
56608 p_code_combination_id => l_ccid
56609 , p_value_type_code => l_adr_value_type_code
56610 , p_transaction_coa_id => l_adr_transaction_coa_id
56611 , p_accounting_coa_id => l_adr_accounting_coa_id
56612 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
56613 , p_adr_type_code => 'S'
56614 , p_component_type => l_component_type
56615 , p_component_code => l_component_code
56616 , p_component_type_code => l_component_type_code
56617 , p_component_appl_id => l_component_appl_id
56618 , p_amb_context_code => l_amb_context_code
56619 , p_side => 'NA'
56620 );
56621
56622
56623 l_segment := AcctDerRule_147(
56624 p_application_id => p_application_id
56625 , p_ae_header_id => l_ae_header_id
56626 , p_source_5 => p_source_5
56627 , p_source_9 => p_source_9
56628 , x_transaction_coa_id => l_adr_transaction_coa_id
56629 , x_accounting_coa_id => l_adr_accounting_coa_id
56630 , x_flexfield_segment_code => l_adr_flexfield_segment_code
56631 , x_flex_value_set_id => l_adr_flex_value_set_id
56632 , x_value_type_code => l_adr_value_type_code
56633 , x_value_combination_id => l_adr_value_combination_id
56634 , x_value_segment_code => l_adr_value_segment_code
56635 , p_side => 'NA'
56636 , p_override_seg_flag => 'Y'
56637 );
56638
56639 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
56640
56641 xla_ae_lines_pkg.set_segment(
56642 p_to_segment_code => 'GL_ACCOUNT'
56643 , p_segment_value => l_segment
56644 , p_from_segment_code => l_adr_value_segment_code
56645 , p_from_combination_id => l_adr_value_combination_id
56646 , p_value_type_code => l_adr_value_type_code
56647 , p_transaction_coa_id => l_adr_transaction_coa_id
56648 , p_accounting_coa_id => l_adr_accounting_coa_id
56649 , p_flexfield_segment_code => l_adr_flexfield_segment_code
56650 , p_flex_value_set_id => l_adr_flex_value_set_id
56651 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
56652 , p_adr_type_code => 'S'
56653 , p_component_type => l_component_type
56654 , p_component_code => l_component_code
56655 , p_component_type_code => l_component_type_code
56656 , p_component_appl_id => l_component_appl_id
56657 , p_amb_context_code => l_amb_context_code
56658 , p_entity_code => 'TRANSACTIONS'
56659 , p_event_class_code => 'CIP_RETIREMENTS'
56660 , p_side => 'NA'
56661 );
56662
56663 END IF;
56664
56665 l_segment := AcctDerRule_169(
56666 p_application_id => p_application_id
56667 , p_ae_header_id => l_ae_header_id
56668 , p_source_5 => p_source_5
56669 , p_source_31 => p_source_31
56673 , x_flex_value_set_id => l_adr_flex_value_set_id
56670 , x_transaction_coa_id => l_adr_transaction_coa_id
56671 , x_accounting_coa_id => l_adr_accounting_coa_id
56672 , x_flexfield_segment_code => l_adr_flexfield_segment_code
56674 , x_value_type_code => l_adr_value_type_code
56675 , x_value_combination_id => l_adr_value_combination_id
56676 , x_value_segment_code => l_adr_value_segment_code
56677 , p_side => 'NA'
56678 , p_override_seg_flag => 'Y'
56679 );
56680
56681 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
56682
56683 xla_ae_lines_pkg.set_segment(
56684 p_to_segment_code => 'GL_BALANCING'
56685 , p_segment_value => l_segment
56686 , p_from_segment_code => l_adr_value_segment_code
56687 , p_from_combination_id => l_adr_value_combination_id
56688 , p_value_type_code => l_adr_value_type_code
56689 , p_transaction_coa_id => l_adr_transaction_coa_id
56690 , p_accounting_coa_id => l_adr_accounting_coa_id
56691 , p_flexfield_segment_code => l_adr_flexfield_segment_code
56692 , p_flex_value_set_id => l_adr_flex_value_set_id
56693 , p_adr_code => 'FA_EXPENSE_ACCT'
56694 , p_adr_type_code => 'S'
56695 , p_component_type => l_component_type
56696 , p_component_code => l_component_code
56697 , p_component_type_code => l_component_type_code
56698 , p_component_appl_id => l_component_appl_id
56699 , p_amb_context_code => l_amb_context_code
56700 , p_entity_code => 'TRANSACTIONS'
56701 , p_event_class_code => 'CIP_RETIREMENTS'
56702 , p_side => 'NA'
56703 );
56704
56705 END IF;
56706
56707 --
56708 --
56709 END IF;
56710
56711 --
56712 -- Update the line information that should be overwritten
56713 --
56714 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
56715 p_header_num => 1);
56716 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
56717
56718 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
56719
56720 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
56721 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
56722 END IF;
56723
56724 --
56725 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
56726 --
56727 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
56728 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
56729 ELSE
56730 ---------------------------------------------------------------------------------------------------
56731 -- 4262811a Switch Sign
56732 ---------------------------------------------------------------------------------------------------
56733 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
56734 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
56735 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
56736 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
56737 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
56738 -- 5132302
56739 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
56740 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
56741
56742 END IF;
56743
56744 -- 4955764
56745 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
56746 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
56747
56748
56749 XLA_AE_LINES_PKG.ValidateCurrentLine;
56750 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
56751
56752 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
56753 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
56754 ,p_balance_type_code => l_balance_type_code);
56755
56756 END IF;
56757
56758 -----------------------------------------------------------------------------------------
56759 -- 4262811 Multiperiod Accounting
56760 -----------------------------------------------------------------------------------------
56761 -- No MPA option is assigned.
56762
56763
56764 END IF;
56765 END IF;
56766 --
56767
56768 --
56769 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
56770 trace
56771 (p_msg => 'END of AcctLineType_243'
56772 ,p_level => C_LEVEL_PROCEDURE
56773 ,p_module => l_log_module);
56774 END IF;
56775 --
56776 EXCEPTION
56777 WHEN xla_exceptions_pkg.application_exception THEN
56778 RAISE;
56779 WHEN OTHERS THEN
56780 xla_exceptions_pkg.raise_message
56784
56781 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_243');
56782 END AcctLineType_243;
56783 --
56785 ---------------------------------------
56786 --
56787 -- PRIVATE FUNCTION
56788 -- AcctLineType_244
56789 --
56790 ---------------------------------------
56791 PROCEDURE AcctLineType_244 (
56792 p_application_id IN NUMBER
56793 ,p_event_id IN NUMBER
56794 ,p_calculate_acctd_flag IN VARCHAR2
56795 ,p_calculate_g_l_flag IN VARCHAR2
56796 ,p_actual_flag IN OUT VARCHAR2
56797 ,p_balance_type_code OUT VARCHAR2
56798 ,p_gain_or_loss_ref OUT VARCHAR2
56799
56800 --Period Close Date
56801 , p_source_1 IN DATE
56802 --Generated Code Combination Identifier
56803 , p_source_5 IN NUMBER
56804 --CIP Cost Account
56805 , p_source_9 IN VARCHAR2
56806 --Expense Account Code Combination Identifier
56807 , p_source_31 IN NUMBER
56808 --Default Code Combination Identifier
56809 , p_source_32 IN NUMBER
56810 --Adjustment Type
56811 , p_source_48 IN VARCHAR2
56812 --Transaction Header Identifier
56813 , p_source_49 IN NUMBER
56814 --Adjustment Line Identifier
56815 , p_source_50 IN NUMBER
56816 --Distribution Type Code
56817 , p_source_51 IN VARCHAR2
56818 --Entered Amount
56819 , p_source_52 IN NUMBER
56820 --Currency Code
56821 , p_source_53 IN VARCHAR2
56822 )
56823 IS
56824
56825 l_component_type VARCHAR2(80);
56826 l_component_code VARCHAR2(30);
56827 l_component_type_code VARCHAR2(1);
56828 l_component_appl_id INTEGER;
56829 l_amb_context_code VARCHAR2(30);
56830 l_entity_code VARCHAR2(30);
56831 l_event_class_code VARCHAR2(30);
56832 l_ae_header_id NUMBER;
56833 l_event_type_code VARCHAR2(30);
56834 l_line_definition_code VARCHAR2(30);
56835 l_line_definition_owner_code VARCHAR2(1);
56836 --
56837 -- adr variables
56838 l_segment VARCHAR2(30);
56839 l_ccid NUMBER;
56840 l_adr_transaction_coa_id NUMBER;
56841 l_adr_accounting_coa_id NUMBER;
56842 l_adr_flexfield_segment_code VARCHAR2(30);
56843 l_adr_flex_value_set_id NUMBER;
56844 l_adr_value_type_code VARCHAR2(30);
56845 l_adr_value_combination_id NUMBER;
56846 l_adr_value_segment_code VARCHAR2(30);
56847
56848 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
56849 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
56850 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
56851 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
56852
56853 -- 4262811 Variables ------------------------------------------------------------------------------------------
56854 l_entered_amt_idx NUMBER;
56855 l_accted_amt_idx NUMBER;
56856 l_acc_rev_flag VARCHAR2(1);
56857 l_accrual_line_num NUMBER;
56858 l_tmp_amt NUMBER;
56859 l_acc_rev_natural_side_code VARCHAR2(1);
56860
56861 l_num_entries NUMBER;
56862 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
56863 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
56864 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
56865 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
56866 l_recog_line_1 NUMBER;
56867 l_recog_line_2 NUMBER;
56868
56869 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
56870 l_bflow_applied_to_amt NUMBER; -- 5132302
56871 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
56872
56873 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
56874
56875 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
56876 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
56877
56878 ---------------------------------------------------------------------------------------------------------------
56879
56880
56881 --
56882 -- bulk performance
56883 --
56884 l_balance_type_code VARCHAR2(1);
56885 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
56886 l_log_module VARCHAR2(240);
56887
56888 --
56889 -- Upgrade strategy
56890 --
56891 l_actual_upg_option VARCHAR2(1);
56892 l_enc_upg_option VARCHAR2(1);
56893
56894 --
56895 BEGIN
56896 --
56897 IF g_log_enabled THEN
56898 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_244';
56899 END IF;
56900 --
56901 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
56902
56903 trace
56904 (p_msg => 'BEGIN of AcctLineType_244'
56905 ,p_level => C_LEVEL_PROCEDURE
56906 ,p_module => l_log_module);
56907
56908 END IF;
56909 --
56910 l_component_type := 'AMB_JLT';
56911 l_component_code := 'FA_CIP_RETIREMENT_COST';
56912 l_component_type_code := 'S';
56913 l_component_appl_id := 140;
56914 l_amb_context_code := 'DEFAULT';
56915 l_entity_code := 'TRANSACTIONS';
56919 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
56916 l_event_class_code := 'CIP_RETIREMENTS';
56917 l_event_type_code := 'CIP_RETIREMENTS';
56918 l_line_definition_owner_code := 'S';
56920 --
56921 l_balance_type_code := 'A';
56922 l_segment := NULL;
56923 l_ccid := NULL;
56924 l_adr_transaction_coa_id := NULL;
56925 l_adr_accounting_coa_id := NULL;
56926 l_adr_flexfield_segment_code := NULL;
56927 l_adr_flex_value_set_id := NULL;
56928 l_adr_value_type_code := NULL;
56929 l_adr_value_combination_id := NULL;
56930 l_adr_value_segment_code := NULL;
56931
56932 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
56933 l_bflow_class_code := ''; -- 4219869 Business Flow
56934 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
56935 l_budgetary_control_flag := 'N';
56936
56937 l_bflow_applied_to_amt_idx := NULL; -- 5132302
56938 l_bflow_applied_to_amt := NULL; -- 5132302
56939 l_entered_amt_idx := NULL; -- 4262811
56940 l_accted_amt_idx := NULL; -- 4262811
56941 l_acc_rev_flag := NULL; -- 4262811
56942 l_accrual_line_num := NULL; -- 4262811
56943 l_tmp_amt := NULL; -- 4262811
56944 --
56945
56946 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
56947 l_balance_type_code <> 'B' THEN
56948 IF NVL(p_source_48,'
56949 ') = 'CIP COST'
56950 THEN
56951
56952 --
56953 XLA_AE_LINES_PKG.SetNewLine;
56954
56955 p_balance_type_code := l_balance_type_code;
56956 -- set the flag so later we will know whether the gain loss line needs to be created
56957
56958 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
56959 p_actual_flag :='A';
56960 END IF;
56961
56962 --
56963 -- bulk performance
56964 --
56965 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
56966 p_header_num => 0); -- 4262811
56967 --
56968 -- set accounting line options
56969 --
56970 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
56971 p_natural_side_code => 'C'
56972 , p_gain_or_loss_flag => 'N'
56973 , p_gl_transfer_mode_code => 'S'
56974 , p_acct_entry_type_code => 'A'
56975 , p_switch_side_flag => 'Y'
56976 , p_merge_duplicate_code => 'N'
56977 );
56978 --
56979 l_acc_rev_natural_side_code := 'D'; -- 4262811
56980 --
56981 --
56982 -- set accounting line type info
56983 --
56984 xla_ae_lines_pkg.SetAcctLineType
56985 (p_component_type => l_component_type
56986 ,p_event_type_code => l_event_type_code
56987 ,p_line_definition_owner_code => l_line_definition_owner_code
56988 ,p_line_definition_code => l_line_definition_code
56989 ,p_accounting_line_code => l_component_code
56990 ,p_accounting_line_type_code => l_component_type_code
56991 ,p_accounting_line_appl_id => l_component_appl_id
56992 ,p_amb_context_code => l_amb_context_code
56993 ,p_entity_code => l_entity_code
56994 ,p_event_class_code => l_event_class_code);
56995 --
56996 -- set accounting class
56997 --
56998 xla_ae_lines_pkg.SetAcctClass(
56999 p_accounting_class_code => 'ASSET'
57000 , p_ae_header_id => l_ae_header_id
57001 );
57002
57003 --
57004 -- set rounding class
57005 --
57006 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
57007 'ASSET';
57008
57009 --
57010 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
57011 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
57012 --
57013 -- bulk performance
57014 --
57015 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
57016
57017 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
57018 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
57019
57020 -- 4955764
57021 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
57022 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
57023
57024 -- 4458381 Public Sector Enh
57025
57026 --
57027 -- set accounting attributes for the line type
57028 --
57029 l_entered_amt_idx := 4;
57030 l_accted_amt_idx := 6;
57031 l_bflow_applied_to_amt_idx := NULL; -- 5132302
57032 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
57033 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
57034 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
57035 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
57036 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
57037 l_rec_acct_attrs.array_char_value(3) := p_source_51;
57041 l_rec_acct_attrs.array_char_value(5) := p_source_53;
57038 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
57039 l_rec_acct_attrs.array_num_value(4) := p_source_52;
57040 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
57042 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
57043 l_rec_acct_attrs.array_num_value(6) := p_source_52;
57044
57045 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
57046 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
57047
57048 ---------------------------------------------------------------------------------------------------------------
57049 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
57050 ---------------------------------------------------------------------------------------------------------------
57051 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
57052
57053 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
57054 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
57055
57056 IF xla_accounting_cache_pkg.GetValueChar
57057 (p_source_code => 'LEDGER_CATEGORY_CODE'
57058 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
57059 AND l_bflow_method_code = 'PRIOR_ENTRY'
57060 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
57061 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
57062 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
57063 )
57064 THEN
57065 xla_ae_lines_pkg.BflowUpgEntry
57066 (p_business_method_code => l_bflow_method_code
57067 ,p_business_class_code => l_bflow_class_code
57068 ,p_balance_type => l_balance_type_code);
57069 ELSE
57070 NULL;
57071 -- No business flow processing for business flow method of NONE.
57072 END IF;
57073
57074 --
57075 -- call analytical criteria
57076 --
57077
57078 --
57079 -- call description
57080 --
57081
57082 xla_ae_lines_pkg.SetLineDescription(
57083 p_ae_header_id => l_ae_header_id
57084 ,p_description => Description_31 (
57085 p_application_id => p_application_id
57086 , p_ae_header_id => l_ae_header_id
57087 , p_source_1 => p_source_1
57088 )
57089 );
57090
57091
57092 --
57093 -- call ADRs
57094 -- Bug 4922099
57095 --
57096 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
57097 (NVL(l_actual_upg_option, 'N') = 'O') OR
57098 (NVL(l_enc_upg_option, 'N') = 'O')
57099 )
57100 THEN
57101 NULL;
57102 --
57103 --
57104
57105 l_ccid := AcctDerRule_174(
57106 p_application_id => p_application_id
57107 , p_ae_header_id => l_ae_header_id
57108 , p_source_5 => p_source_5
57109 , p_source_32 => p_source_32
57110 , x_transaction_coa_id => l_adr_transaction_coa_id
57111 , x_accounting_coa_id => l_adr_accounting_coa_id
57112 , x_value_type_code => l_adr_value_type_code
57113 , p_side => 'NA'
57114 );
57115
57116 xla_ae_lines_pkg.set_ccid(
57117 p_code_combination_id => l_ccid
57118 , p_value_type_code => l_adr_value_type_code
57119 , p_transaction_coa_id => l_adr_transaction_coa_id
57120 , p_accounting_coa_id => l_adr_accounting_coa_id
57121 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
57122 , p_adr_type_code => 'S'
57123 , p_component_type => l_component_type
57124 , p_component_code => l_component_code
57125 , p_component_type_code => l_component_type_code
57126 , p_component_appl_id => l_component_appl_id
57127 , p_amb_context_code => l_amb_context_code
57128 , p_side => 'NA'
57129 );
57130
57131
57132 l_segment := AcctDerRule_147(
57133 p_application_id => p_application_id
57134 , p_ae_header_id => l_ae_header_id
57135 , p_source_5 => p_source_5
57136 , p_source_9 => p_source_9
57137 , x_transaction_coa_id => l_adr_transaction_coa_id
57138 , x_accounting_coa_id => l_adr_accounting_coa_id
57139 , x_flexfield_segment_code => l_adr_flexfield_segment_code
57140 , x_flex_value_set_id => l_adr_flex_value_set_id
57141 , x_value_type_code => l_adr_value_type_code
57142 , x_value_combination_id => l_adr_value_combination_id
57143 , x_value_segment_code => l_adr_value_segment_code
57144 , p_side => 'NA'
57145 , p_override_seg_flag => 'Y'
57146 );
57147
57148 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
57149
57150 xla_ae_lines_pkg.set_segment(
57151 p_to_segment_code => 'GL_ACCOUNT'
57152 , p_segment_value => l_segment
57153 , p_from_segment_code => l_adr_value_segment_code
57154 , p_from_combination_id => l_adr_value_combination_id
57155 , p_value_type_code => l_adr_value_type_code
57159 , p_flex_value_set_id => l_adr_flex_value_set_id
57156 , p_transaction_coa_id => l_adr_transaction_coa_id
57157 , p_accounting_coa_id => l_adr_accounting_coa_id
57158 , p_flexfield_segment_code => l_adr_flexfield_segment_code
57160 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
57161 , p_adr_type_code => 'S'
57162 , p_component_type => l_component_type
57163 , p_component_code => l_component_code
57164 , p_component_type_code => l_component_type_code
57165 , p_component_appl_id => l_component_appl_id
57166 , p_amb_context_code => l_amb_context_code
57167 , p_entity_code => 'TRANSACTIONS'
57168 , p_event_class_code => 'CIP_RETIREMENTS'
57169 , p_side => 'NA'
57170 );
57171
57172 END IF;
57173
57174 l_segment := AcctDerRule_169(
57175 p_application_id => p_application_id
57176 , p_ae_header_id => l_ae_header_id
57177 , p_source_5 => p_source_5
57178 , p_source_31 => p_source_31
57179 , x_transaction_coa_id => l_adr_transaction_coa_id
57180 , x_accounting_coa_id => l_adr_accounting_coa_id
57181 , x_flexfield_segment_code => l_adr_flexfield_segment_code
57182 , x_flex_value_set_id => l_adr_flex_value_set_id
57183 , x_value_type_code => l_adr_value_type_code
57184 , x_value_combination_id => l_adr_value_combination_id
57185 , x_value_segment_code => l_adr_value_segment_code
57186 , p_side => 'NA'
57187 , p_override_seg_flag => 'Y'
57188 );
57189
57190 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
57191
57192 xla_ae_lines_pkg.set_segment(
57193 p_to_segment_code => 'GL_BALANCING'
57194 , p_segment_value => l_segment
57195 , p_from_segment_code => l_adr_value_segment_code
57196 , p_from_combination_id => l_adr_value_combination_id
57197 , p_value_type_code => l_adr_value_type_code
57198 , p_transaction_coa_id => l_adr_transaction_coa_id
57199 , p_accounting_coa_id => l_adr_accounting_coa_id
57200 , p_flexfield_segment_code => l_adr_flexfield_segment_code
57201 , p_flex_value_set_id => l_adr_flex_value_set_id
57202 , p_adr_code => 'FA_EXPENSE_ACCT'
57203 , p_adr_type_code => 'S'
57204 , p_component_type => l_component_type
57205 , p_component_code => l_component_code
57206 , p_component_type_code => l_component_type_code
57207 , p_component_appl_id => l_component_appl_id
57208 , p_amb_context_code => l_amb_context_code
57209 , p_entity_code => 'TRANSACTIONS'
57210 , p_event_class_code => 'CIP_RETIREMENTS'
57211 , p_side => 'NA'
57212 );
57213
57214 END IF;
57215
57216 --
57217 --
57218 END IF;
57219 --
57220 -- Bug 4922099
57221 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
57222 (NVL(l_enc_upg_option, 'N') = 'O')
57223 ) AND
57224 (l_bflow_method_code = 'PRIOR_ENTRY')
57225 )
57226 THEN
57227 IF
57228 --
57229 1 = 2
57230 --
57231 THEN
57232 xla_accounting_err_pkg.build_message
57233 (p_appli_s_name => 'XLA'
57234 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
57235 ,p_token_1 => 'LINE_NUMBER'
57236 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
57237 ,p_token_2 => 'LINE_TYPE_NAME'
57238 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
57239 l_component_type
57240 ,l_component_code
57241 ,l_component_type_code
57242 ,l_component_appl_id
57243 ,l_amb_context_code
57244 ,l_entity_code
57245 ,l_event_class_code
57246 )
57247 ,p_token_3 => 'OWNER'
57248 ,p_value_3 => xla_lookups_pkg.get_meaning(
57249 p_lookup_type => 'XLA_OWNER_TYPE'
57250 ,p_lookup_code => l_component_type_code
57251 )
57252 ,p_token_4 => 'PRODUCT_NAME'
57253 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
57254 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
57258 );
57255 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
57256 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
57257 ,p_ae_header_id => NULL
57259
57260 IF (C_LEVEL_ERROR>= g_log_level) THEN
57261 trace
57262 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
57263 ,p_level => C_LEVEL_ERROR
57264 ,p_module => l_log_module);
57265 END IF;
57266 END IF;
57267 END IF;
57268 --
57269 --
57270 ------------------------------------------------------------------------------------------------
57271 -- 4219869 Business Flow
57272 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
57273 -- Prior Entry. Currently, the following code is always generated.
57274 ------------------------------------------------------------------------------------------------
57275 XLA_AE_LINES_PKG.ValidateCurrentLine;
57276
57277 ------------------------------------------------------------------------------------
57278 -- 4219869 Business Flow
57279 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
57280 ------------------------------------------------------------------------------------
57281 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
57282
57283 ----------------------------------------------------------------------------------
57284 -- 4219869 Business Flow
57285 -- Update journal entry status -- Need to generate this within IF <condition>
57286 ----------------------------------------------------------------------------------
57287 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
57288 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
57289 ,p_balance_type_code => l_balance_type_code
57290 );
57291
57292 -------------------------------------------------------------------------------------------
57293 -- 4262811 - Generate the Accrual Reversal lines
57294 -------------------------------------------------------------------------------------------
57295 BEGIN
57296 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
57297 (g_array_event(p_event_id).array_value_num('header_index'));
57298 IF l_acc_rev_flag IS NULL THEN
57299 l_acc_rev_flag := 'N';
57300 END IF;
57301 EXCEPTION
57302 WHEN OTHERS THEN
57303 l_acc_rev_flag := 'N';
57304 END;
57305 --
57306 IF (l_acc_rev_flag = 'Y') THEN
57307
57308 -- 4645092 ------------------------------------------------------------------------------
57309 -- To allow MPA report to determine if it should generate report process
57310 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
57311 ------------------------------------------------------------------------------------------
57312
57313 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
57314 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
57315 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
57316 -- call ADRs
57317 -- Bug 4922099
57318 --
57319 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
57320 (NVL(l_actual_upg_option, 'N') = 'O') OR
57321 (NVL(l_enc_upg_option, 'N') = 'O')
57322 )
57323 THEN
57324 NULL;
57325 --
57326 --
57327
57328 l_ccid := AcctDerRule_174(
57329 p_application_id => p_application_id
57330 , p_ae_header_id => l_ae_header_id
57331 , p_source_5 => p_source_5
57332 , p_source_32 => p_source_32
57333 , x_transaction_coa_id => l_adr_transaction_coa_id
57334 , x_accounting_coa_id => l_adr_accounting_coa_id
57335 , x_value_type_code => l_adr_value_type_code
57336 , p_side => 'NA'
57337 );
57338
57339 xla_ae_lines_pkg.set_ccid(
57340 p_code_combination_id => l_ccid
57341 , p_value_type_code => l_adr_value_type_code
57342 , p_transaction_coa_id => l_adr_transaction_coa_id
57343 , p_accounting_coa_id => l_adr_accounting_coa_id
57344 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
57345 , p_adr_type_code => 'S'
57346 , p_component_type => l_component_type
57347 , p_component_code => l_component_code
57348 , p_component_type_code => l_component_type_code
57349 , p_component_appl_id => l_component_appl_id
57350 , p_amb_context_code => l_amb_context_code
57351 , p_side => 'NA'
57352 );
57353
57354
57355 l_segment := AcctDerRule_147(
57356 p_application_id => p_application_id
57357 , p_ae_header_id => l_ae_header_id
57358 , p_source_5 => p_source_5
57359 , p_source_9 => p_source_9
57360 , x_transaction_coa_id => l_adr_transaction_coa_id
57361 , x_accounting_coa_id => l_adr_accounting_coa_id
57362 , x_flexfield_segment_code => l_adr_flexfield_segment_code
57363 , x_flex_value_set_id => l_adr_flex_value_set_id
57364 , x_value_type_code => l_adr_value_type_code
57368 , p_override_seg_flag => 'Y'
57365 , x_value_combination_id => l_adr_value_combination_id
57366 , x_value_segment_code => l_adr_value_segment_code
57367 , p_side => 'NA'
57369 );
57370
57371 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
57372
57373 xla_ae_lines_pkg.set_segment(
57374 p_to_segment_code => 'GL_ACCOUNT'
57375 , p_segment_value => l_segment
57376 , p_from_segment_code => l_adr_value_segment_code
57377 , p_from_combination_id => l_adr_value_combination_id
57378 , p_value_type_code => l_adr_value_type_code
57379 , p_transaction_coa_id => l_adr_transaction_coa_id
57380 , p_accounting_coa_id => l_adr_accounting_coa_id
57381 , p_flexfield_segment_code => l_adr_flexfield_segment_code
57382 , p_flex_value_set_id => l_adr_flex_value_set_id
57383 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
57384 , p_adr_type_code => 'S'
57385 , p_component_type => l_component_type
57386 , p_component_code => l_component_code
57387 , p_component_type_code => l_component_type_code
57388 , p_component_appl_id => l_component_appl_id
57389 , p_amb_context_code => l_amb_context_code
57390 , p_entity_code => 'TRANSACTIONS'
57391 , p_event_class_code => 'CIP_RETIREMENTS'
57392 , p_side => 'NA'
57393 );
57394
57395 END IF;
57396
57397 l_segment := AcctDerRule_169(
57398 p_application_id => p_application_id
57399 , p_ae_header_id => l_ae_header_id
57400 , p_source_5 => p_source_5
57401 , p_source_31 => p_source_31
57402 , x_transaction_coa_id => l_adr_transaction_coa_id
57403 , x_accounting_coa_id => l_adr_accounting_coa_id
57404 , x_flexfield_segment_code => l_adr_flexfield_segment_code
57405 , x_flex_value_set_id => l_adr_flex_value_set_id
57406 , x_value_type_code => l_adr_value_type_code
57407 , x_value_combination_id => l_adr_value_combination_id
57408 , x_value_segment_code => l_adr_value_segment_code
57409 , p_side => 'NA'
57410 , p_override_seg_flag => 'Y'
57411 );
57412
57413 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
57414
57415 xla_ae_lines_pkg.set_segment(
57416 p_to_segment_code => 'GL_BALANCING'
57417 , p_segment_value => l_segment
57418 , p_from_segment_code => l_adr_value_segment_code
57419 , p_from_combination_id => l_adr_value_combination_id
57420 , p_value_type_code => l_adr_value_type_code
57421 , p_transaction_coa_id => l_adr_transaction_coa_id
57422 , p_accounting_coa_id => l_adr_accounting_coa_id
57423 , p_flexfield_segment_code => l_adr_flexfield_segment_code
57424 , p_flex_value_set_id => l_adr_flex_value_set_id
57425 , p_adr_code => 'FA_EXPENSE_ACCT'
57426 , p_adr_type_code => 'S'
57427 , p_component_type => l_component_type
57428 , p_component_code => l_component_code
57429 , p_component_type_code => l_component_type_code
57430 , p_component_appl_id => l_component_appl_id
57431 , p_amb_context_code => l_amb_context_code
57432 , p_entity_code => 'TRANSACTIONS'
57433 , p_event_class_code => 'CIP_RETIREMENTS'
57434 , p_side => 'NA'
57435 );
57436
57437 END IF;
57438
57439 --
57440 --
57441 END IF;
57442
57443 --
57444 -- Update the line information that should be overwritten
57445 --
57446 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
57447 p_header_num => 1);
57448 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
57449
57450 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
57451
57452 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
57453 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
57454 END IF;
57455
57456 --
57457 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
57458 --
57459 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
57460 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
57461 ELSE
57462 ---------------------------------------------------------------------------------------------------
57463 -- 4262811a Switch Sign
57464 ---------------------------------------------------------------------------------------------------
57465 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
57466 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
57467 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
57471 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
57468 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
57469 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
57470 -- 5132302
57472 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
57473
57474 END IF;
57475
57476 -- 4955764
57477 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
57478 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
57479
57480
57481 XLA_AE_LINES_PKG.ValidateCurrentLine;
57482 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
57483
57484 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
57485 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
57486 ,p_balance_type_code => l_balance_type_code);
57487
57488 END IF;
57489
57490 -----------------------------------------------------------------------------------------
57491 -- 4262811 Multiperiod Accounting
57492 -----------------------------------------------------------------------------------------
57493 -- No MPA option is assigned.
57494
57495
57496 END IF;
57497 END IF;
57498 --
57499
57500 --
57501 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
57502 trace
57503 (p_msg => 'END of AcctLineType_244'
57504 ,p_level => C_LEVEL_PROCEDURE
57505 ,p_module => l_log_module);
57506 END IF;
57507 --
57508 EXCEPTION
57509 WHEN xla_exceptions_pkg.application_exception THEN
57510 RAISE;
57511 WHEN OTHERS THEN
57512 xla_exceptions_pkg.raise_message
57513 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_244');
57514 END AcctLineType_244;
57515 --
57516
57517 ---------------------------------------
57518 --
57519 -- PRIVATE FUNCTION
57520 -- AcctLineType_245
57521 --
57522 ---------------------------------------
57523 PROCEDURE AcctLineType_245 (
57524 p_application_id IN NUMBER
57525 ,p_event_id IN NUMBER
57526 ,p_calculate_acctd_flag IN VARCHAR2
57527 ,p_calculate_g_l_flag IN VARCHAR2
57528 ,p_actual_flag IN OUT VARCHAR2
57529 ,p_balance_type_code OUT VARCHAR2
57530 ,p_gain_or_loss_ref OUT VARCHAR2
57531
57532 --Period Close Date
57533 , p_source_1 IN DATE
57534 --Generated Code Combination Identifier
57535 , p_source_5 IN NUMBER
57536 --Revaluation Reserve Account
57537 , p_source_13 IN VARCHAR2
57538 --Generated Offset Code Combination Identifier
57539 , p_source_19 IN NUMBER
57540 --Expense Account Code Combination Identifier
57541 , p_source_31 IN NUMBER
57542 --Default Code Combination Identifier
57543 , p_source_32 IN NUMBER
57544 --Adjustment Type
57545 , p_source_48 IN VARCHAR2
57546 --Transaction Header Identifier
57547 , p_source_49 IN NUMBER
57548 --Adjustment Line Identifier
57549 , p_source_50 IN NUMBER
57550 --Distribution Type Code
57551 , p_source_51 IN VARCHAR2
57552 --Entered Amount
57553 , p_source_52 IN NUMBER
57554 --Currency Code
57555 , p_source_53 IN VARCHAR2
57556 )
57557 IS
57558
57559 l_component_type VARCHAR2(80);
57560 l_component_code VARCHAR2(30);
57561 l_component_type_code VARCHAR2(1);
57562 l_component_appl_id INTEGER;
57563 l_amb_context_code VARCHAR2(30);
57564 l_entity_code VARCHAR2(30);
57565 l_event_class_code VARCHAR2(30);
57566 l_ae_header_id NUMBER;
57567 l_event_type_code VARCHAR2(30);
57568 l_line_definition_code VARCHAR2(30);
57569 l_line_definition_owner_code VARCHAR2(1);
57570 --
57571 -- adr variables
57572 l_segment VARCHAR2(30);
57573 l_ccid NUMBER;
57574 l_adr_transaction_coa_id NUMBER;
57575 l_adr_accounting_coa_id NUMBER;
57576 l_adr_flexfield_segment_code VARCHAR2(30);
57577 l_adr_flex_value_set_id NUMBER;
57578 l_adr_value_type_code VARCHAR2(30);
57579 l_adr_value_combination_id NUMBER;
57580 l_adr_value_segment_code VARCHAR2(30);
57581
57582 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
57583 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
57584 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
57585 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
57586
57587 -- 4262811 Variables ------------------------------------------------------------------------------------------
57588 l_entered_amt_idx NUMBER;
57589 l_accted_amt_idx NUMBER;
57590 l_acc_rev_flag VARCHAR2(1);
57591 l_accrual_line_num NUMBER;
57592 l_tmp_amt NUMBER;
57593 l_acc_rev_natural_side_code VARCHAR2(1);
57594
57595 l_num_entries NUMBER;
57596 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
57597 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
57601 l_recog_line_2 NUMBER;
57598 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
57599 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
57600 l_recog_line_1 NUMBER;
57602
57603 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
57604 l_bflow_applied_to_amt NUMBER; -- 5132302
57605 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
57606
57607 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
57608
57609 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
57610 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
57611
57612 ---------------------------------------------------------------------------------------------------------------
57613
57614
57615 --
57616 -- bulk performance
57617 --
57618 l_balance_type_code VARCHAR2(1);
57619 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
57620 l_log_module VARCHAR2(240);
57621
57622 --
57623 -- Upgrade strategy
57624 --
57625 l_actual_upg_option VARCHAR2(1);
57626 l_enc_upg_option VARCHAR2(1);
57627
57628 --
57629 BEGIN
57630 --
57631 IF g_log_enabled THEN
57632 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_245';
57633 END IF;
57634 --
57635 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
57636
57637 trace
57638 (p_msg => 'BEGIN of AcctLineType_245'
57639 ,p_level => C_LEVEL_PROCEDURE
57640 ,p_module => l_log_module);
57641
57642 END IF;
57643 --
57644 l_component_type := 'AMB_JLT';
57645 l_component_code := 'FA_CIP_RET_REVAL_RESERVE';
57646 l_component_type_code := 'S';
57647 l_component_appl_id := 140;
57648 l_amb_context_code := 'DEFAULT';
57649 l_entity_code := 'TRANSACTIONS';
57650 l_event_class_code := 'CIP_RETIREMENTS';
57651 l_event_type_code := 'CIP_RETIREMENTS';
57652 l_line_definition_owner_code := 'S';
57653 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
57654 --
57655 l_balance_type_code := 'A';
57656 l_segment := NULL;
57657 l_ccid := NULL;
57658 l_adr_transaction_coa_id := NULL;
57659 l_adr_accounting_coa_id := NULL;
57660 l_adr_flexfield_segment_code := NULL;
57661 l_adr_flex_value_set_id := NULL;
57662 l_adr_value_type_code := NULL;
57663 l_adr_value_combination_id := NULL;
57664 l_adr_value_segment_code := NULL;
57665
57666 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
57667 l_bflow_class_code := ''; -- 4219869 Business Flow
57668 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
57669 l_budgetary_control_flag := 'N';
57670
57671 l_bflow_applied_to_amt_idx := NULL; -- 5132302
57672 l_bflow_applied_to_amt := NULL; -- 5132302
57673 l_entered_amt_idx := NULL; -- 4262811
57674 l_accted_amt_idx := NULL; -- 4262811
57675 l_acc_rev_flag := NULL; -- 4262811
57676 l_accrual_line_num := NULL; -- 4262811
57677 l_tmp_amt := NULL; -- 4262811
57678 --
57679
57680 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
57681 l_balance_type_code <> 'B' THEN
57682 IF NVL(p_source_48,'
57683 ') = 'REVAL RESERVE'
57684 THEN
57685
57686 --
57687 XLA_AE_LINES_PKG.SetNewLine;
57688
57689 p_balance_type_code := l_balance_type_code;
57690 -- set the flag so later we will know whether the gain loss line needs to be created
57691
57692 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
57693 p_actual_flag :='A';
57694 END IF;
57695
57696 --
57697 -- bulk performance
57698 --
57699 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
57700 p_header_num => 0); -- 4262811
57701 --
57702 -- set accounting line options
57703 --
57704 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
57705 p_natural_side_code => 'D'
57706 , p_gain_or_loss_flag => 'N'
57707 , p_gl_transfer_mode_code => 'S'
57708 , p_acct_entry_type_code => 'A'
57709 , p_switch_side_flag => 'Y'
57710 , p_merge_duplicate_code => 'N'
57711 );
57712 --
57713 l_acc_rev_natural_side_code := 'C'; -- 4262811
57714 --
57715 --
57716 -- set accounting line type info
57717 --
57718 xla_ae_lines_pkg.SetAcctLineType
57719 (p_component_type => l_component_type
57720 ,p_event_type_code => l_event_type_code
57721 ,p_line_definition_owner_code => l_line_definition_owner_code
57722 ,p_line_definition_code => l_line_definition_code
57723 ,p_accounting_line_code => l_component_code
57724 ,p_accounting_line_type_code => l_component_type_code
57725 ,p_accounting_line_appl_id => l_component_appl_id
57726 ,p_amb_context_code => l_amb_context_code
57727 ,p_entity_code => l_entity_code
57728 ,p_event_class_code => l_event_class_code);
57729 --
57733 p_accounting_class_code => 'ASSET'
57730 -- set accounting class
57731 --
57732 xla_ae_lines_pkg.SetAcctClass(
57734 , p_ae_header_id => l_ae_header_id
57735 );
57736
57737 --
57738 -- set rounding class
57739 --
57740 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
57741 'ASSET';
57742
57743 --
57744 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
57745 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
57746 --
57747 -- bulk performance
57748 --
57749 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
57750
57751 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
57752 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
57753
57754 -- 4955764
57755 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
57756 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
57757
57758 -- 4458381 Public Sector Enh
57759
57760 --
57761 -- set accounting attributes for the line type
57762 --
57763 l_entered_amt_idx := 4;
57764 l_accted_amt_idx := 6;
57765 l_bflow_applied_to_amt_idx := NULL; -- 5132302
57766 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
57767 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
57768 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
57769 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
57770 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
57771 l_rec_acct_attrs.array_char_value(3) := p_source_51;
57772 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
57773 l_rec_acct_attrs.array_num_value(4) := p_source_52;
57774 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
57775 l_rec_acct_attrs.array_char_value(5) := p_source_53;
57776 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
57777 l_rec_acct_attrs.array_num_value(6) := p_source_52;
57778
57779 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
57780 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
57781
57782 ---------------------------------------------------------------------------------------------------------------
57783 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
57784 ---------------------------------------------------------------------------------------------------------------
57785 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
57786
57787 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
57788 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
57789
57790 IF xla_accounting_cache_pkg.GetValueChar
57791 (p_source_code => 'LEDGER_CATEGORY_CODE'
57792 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
57793 AND l_bflow_method_code = 'PRIOR_ENTRY'
57794 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
57795 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
57796 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
57797 )
57798 THEN
57799 xla_ae_lines_pkg.BflowUpgEntry
57800 (p_business_method_code => l_bflow_method_code
57801 ,p_business_class_code => l_bflow_class_code
57802 ,p_balance_type => l_balance_type_code);
57803 ELSE
57804 NULL;
57805 -- No business flow processing for business flow method of NONE.
57806 END IF;
57807
57808 --
57809 -- call analytical criteria
57810 --
57811
57812 --
57813 -- call description
57814 --
57815
57816 xla_ae_lines_pkg.SetLineDescription(
57817 p_ae_header_id => l_ae_header_id
57818 ,p_description => Description_39 (
57819 p_application_id => p_application_id
57820 , p_ae_header_id => l_ae_header_id
57821 , p_source_1 => p_source_1
57822 )
57823 );
57824
57825
57826 --
57827 -- call ADRs
57828 -- Bug 4922099
57829 --
57830 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
57831 (NVL(l_actual_upg_option, 'N') = 'O') OR
57832 (NVL(l_enc_upg_option, 'N') = 'O')
57833 )
57834 THEN
57835 NULL;
57836 --
57837 --
57838
57839 l_ccid := AcctDerRule_175(
57840 p_application_id => p_application_id
57841 , p_ae_header_id => l_ae_header_id
57842 , p_source_5 => p_source_5
57843 , p_source_19 => p_source_19
57844 , p_source_32 => p_source_32
57845 , x_transaction_coa_id => l_adr_transaction_coa_id
57846 , x_accounting_coa_id => l_adr_accounting_coa_id
57847 , x_value_type_code => l_adr_value_type_code
57848 , p_side => 'NA'
57849 );
57850
57851 xla_ae_lines_pkg.set_ccid(
57852 p_code_combination_id => l_ccid
57856 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
57853 , p_value_type_code => l_adr_value_type_code
57854 , p_transaction_coa_id => l_adr_transaction_coa_id
57855 , p_accounting_coa_id => l_adr_accounting_coa_id
57857 , p_adr_type_code => 'S'
57858 , p_component_type => l_component_type
57859 , p_component_code => l_component_code
57860 , p_component_type_code => l_component_type_code
57861 , p_component_appl_id => l_component_appl_id
57862 , p_amb_context_code => l_amb_context_code
57863 , p_side => 'NA'
57864 );
57865
57866
57867 l_segment := AcctDerRule_151(
57868 p_application_id => p_application_id
57869 , p_ae_header_id => l_ae_header_id
57870 , p_source_5 => p_source_5
57871 , p_source_13 => p_source_13
57872 , x_transaction_coa_id => l_adr_transaction_coa_id
57873 , x_accounting_coa_id => l_adr_accounting_coa_id
57874 , x_flexfield_segment_code => l_adr_flexfield_segment_code
57875 , x_flex_value_set_id => l_adr_flex_value_set_id
57876 , x_value_type_code => l_adr_value_type_code
57877 , x_value_combination_id => l_adr_value_combination_id
57878 , x_value_segment_code => l_adr_value_segment_code
57879 , p_side => 'NA'
57880 , p_override_seg_flag => 'Y'
57881 );
57882
57883 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
57884
57885 xla_ae_lines_pkg.set_segment(
57886 p_to_segment_code => 'GL_ACCOUNT'
57887 , p_segment_value => l_segment
57888 , p_from_segment_code => l_adr_value_segment_code
57889 , p_from_combination_id => l_adr_value_combination_id
57890 , p_value_type_code => l_adr_value_type_code
57891 , p_transaction_coa_id => l_adr_transaction_coa_id
57892 , p_accounting_coa_id => l_adr_accounting_coa_id
57893 , p_flexfield_segment_code => l_adr_flexfield_segment_code
57894 , p_flex_value_set_id => l_adr_flex_value_set_id
57895 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
57896 , p_adr_type_code => 'S'
57897 , p_component_type => l_component_type
57898 , p_component_code => l_component_code
57899 , p_component_type_code => l_component_type_code
57900 , p_component_appl_id => l_component_appl_id
57901 , p_amb_context_code => l_amb_context_code
57902 , p_entity_code => 'TRANSACTIONS'
57903 , p_event_class_code => 'CIP_RETIREMENTS'
57904 , p_side => 'NA'
57905 );
57906
57907 END IF;
57908
57909 l_segment := AcctDerRule_169(
57910 p_application_id => p_application_id
57911 , p_ae_header_id => l_ae_header_id
57912 , p_source_5 => p_source_5
57913 , p_source_31 => p_source_31
57914 , x_transaction_coa_id => l_adr_transaction_coa_id
57915 , x_accounting_coa_id => l_adr_accounting_coa_id
57916 , x_flexfield_segment_code => l_adr_flexfield_segment_code
57917 , x_flex_value_set_id => l_adr_flex_value_set_id
57918 , x_value_type_code => l_adr_value_type_code
57919 , x_value_combination_id => l_adr_value_combination_id
57920 , x_value_segment_code => l_adr_value_segment_code
57921 , p_side => 'NA'
57922 , p_override_seg_flag => 'Y'
57923 );
57924
57925 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
57926
57927 xla_ae_lines_pkg.set_segment(
57928 p_to_segment_code => 'GL_BALANCING'
57929 , p_segment_value => l_segment
57930 , p_from_segment_code => l_adr_value_segment_code
57931 , p_from_combination_id => l_adr_value_combination_id
57932 , p_value_type_code => l_adr_value_type_code
57933 , p_transaction_coa_id => l_adr_transaction_coa_id
57934 , p_accounting_coa_id => l_adr_accounting_coa_id
57935 , p_flexfield_segment_code => l_adr_flexfield_segment_code
57936 , p_flex_value_set_id => l_adr_flex_value_set_id
57937 , p_adr_code => 'FA_EXPENSE_ACCT'
57938 , p_adr_type_code => 'S'
57939 , p_component_type => l_component_type
57940 , p_component_code => l_component_code
57941 , p_component_type_code => l_component_type_code
57942 , p_component_appl_id => l_component_appl_id
57943 , p_amb_context_code => l_amb_context_code
57944 , p_entity_code => 'TRANSACTIONS'
57945 , p_event_class_code => 'CIP_RETIREMENTS'
57946 , p_side => 'NA'
57947 );
57948
57949 END IF;
57950
57951 --
57952 --
57953 END IF;
57954 --
57955 -- Bug 4922099
57956 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
57957 (NVL(l_enc_upg_option, 'N') = 'O')
57958 ) AND
57959 (l_bflow_method_code = 'PRIOR_ENTRY')
57960 )
57961 THEN
57962 IF
57963 --
57964 1 = 2
57965 --
57966 THEN
57970 ,p_token_1 => 'LINE_NUMBER'
57967 xla_accounting_err_pkg.build_message
57968 (p_appli_s_name => 'XLA'
57969 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
57971 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
57972 ,p_token_2 => 'LINE_TYPE_NAME'
57973 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
57974 l_component_type
57975 ,l_component_code
57976 ,l_component_type_code
57977 ,l_component_appl_id
57978 ,l_amb_context_code
57979 ,l_entity_code
57980 ,l_event_class_code
57981 )
57982 ,p_token_3 => 'OWNER'
57983 ,p_value_3 => xla_lookups_pkg.get_meaning(
57984 p_lookup_type => 'XLA_OWNER_TYPE'
57985 ,p_lookup_code => l_component_type_code
57986 )
57987 ,p_token_4 => 'PRODUCT_NAME'
57988 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
57989 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
57990 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
57991 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
57992 ,p_ae_header_id => NULL
57993 );
57994
57995 IF (C_LEVEL_ERROR>= g_log_level) THEN
57996 trace
57997 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
57998 ,p_level => C_LEVEL_ERROR
57999 ,p_module => l_log_module);
58000 END IF;
58001 END IF;
58002 END IF;
58003 --
58004 --
58005 ------------------------------------------------------------------------------------------------
58006 -- 4219869 Business Flow
58007 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
58008 -- Prior Entry. Currently, the following code is always generated.
58009 ------------------------------------------------------------------------------------------------
58010 XLA_AE_LINES_PKG.ValidateCurrentLine;
58011
58012 ------------------------------------------------------------------------------------
58013 -- 4219869 Business Flow
58014 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
58015 ------------------------------------------------------------------------------------
58016 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
58017
58018 ----------------------------------------------------------------------------------
58019 -- 4219869 Business Flow
58020 -- Update journal entry status -- Need to generate this within IF <condition>
58021 ----------------------------------------------------------------------------------
58022 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
58023 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
58024 ,p_balance_type_code => l_balance_type_code
58025 );
58026
58027 -------------------------------------------------------------------------------------------
58028 -- 4262811 - Generate the Accrual Reversal lines
58029 -------------------------------------------------------------------------------------------
58030 BEGIN
58031 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
58032 (g_array_event(p_event_id).array_value_num('header_index'));
58033 IF l_acc_rev_flag IS NULL THEN
58034 l_acc_rev_flag := 'N';
58035 END IF;
58036 EXCEPTION
58037 WHEN OTHERS THEN
58038 l_acc_rev_flag := 'N';
58039 END;
58040 --
58041 IF (l_acc_rev_flag = 'Y') THEN
58042
58043 -- 4645092 ------------------------------------------------------------------------------
58044 -- To allow MPA report to determine if it should generate report process
58045 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
58046 ------------------------------------------------------------------------------------------
58047
58048 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
58049 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
58050 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
58051 -- call ADRs
58052 -- Bug 4922099
58053 --
58054 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
58055 (NVL(l_actual_upg_option, 'N') = 'O') OR
58059 NULL;
58056 (NVL(l_enc_upg_option, 'N') = 'O')
58057 )
58058 THEN
58060 --
58061 --
58062
58063 l_ccid := AcctDerRule_175(
58064 p_application_id => p_application_id
58065 , p_ae_header_id => l_ae_header_id
58066 , p_source_5 => p_source_5
58067 , p_source_19 => p_source_19
58068 , p_source_32 => p_source_32
58069 , x_transaction_coa_id => l_adr_transaction_coa_id
58070 , x_accounting_coa_id => l_adr_accounting_coa_id
58071 , x_value_type_code => l_adr_value_type_code
58072 , p_side => 'NA'
58073 );
58074
58075 xla_ae_lines_pkg.set_ccid(
58076 p_code_combination_id => l_ccid
58077 , p_value_type_code => l_adr_value_type_code
58078 , p_transaction_coa_id => l_adr_transaction_coa_id
58079 , p_accounting_coa_id => l_adr_accounting_coa_id
58080 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
58081 , p_adr_type_code => 'S'
58082 , p_component_type => l_component_type
58083 , p_component_code => l_component_code
58084 , p_component_type_code => l_component_type_code
58085 , p_component_appl_id => l_component_appl_id
58086 , p_amb_context_code => l_amb_context_code
58087 , p_side => 'NA'
58088 );
58089
58090
58091 l_segment := AcctDerRule_151(
58092 p_application_id => p_application_id
58093 , p_ae_header_id => l_ae_header_id
58094 , p_source_5 => p_source_5
58095 , p_source_13 => p_source_13
58096 , x_transaction_coa_id => l_adr_transaction_coa_id
58097 , x_accounting_coa_id => l_adr_accounting_coa_id
58098 , x_flexfield_segment_code => l_adr_flexfield_segment_code
58099 , x_flex_value_set_id => l_adr_flex_value_set_id
58100 , x_value_type_code => l_adr_value_type_code
58101 , x_value_combination_id => l_adr_value_combination_id
58102 , x_value_segment_code => l_adr_value_segment_code
58103 , p_side => 'NA'
58104 , p_override_seg_flag => 'Y'
58105 );
58106
58107 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
58108
58109 xla_ae_lines_pkg.set_segment(
58110 p_to_segment_code => 'GL_ACCOUNT'
58111 , p_segment_value => l_segment
58112 , p_from_segment_code => l_adr_value_segment_code
58113 , p_from_combination_id => l_adr_value_combination_id
58114 , p_value_type_code => l_adr_value_type_code
58115 , p_transaction_coa_id => l_adr_transaction_coa_id
58116 , p_accounting_coa_id => l_adr_accounting_coa_id
58117 , p_flexfield_segment_code => l_adr_flexfield_segment_code
58118 , p_flex_value_set_id => l_adr_flex_value_set_id
58119 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
58120 , p_adr_type_code => 'S'
58121 , p_component_type => l_component_type
58122 , p_component_code => l_component_code
58123 , p_component_type_code => l_component_type_code
58124 , p_component_appl_id => l_component_appl_id
58125 , p_amb_context_code => l_amb_context_code
58126 , p_entity_code => 'TRANSACTIONS'
58127 , p_event_class_code => 'CIP_RETIREMENTS'
58128 , p_side => 'NA'
58129 );
58130
58131 END IF;
58132
58133 l_segment := AcctDerRule_169(
58134 p_application_id => p_application_id
58135 , p_ae_header_id => l_ae_header_id
58136 , p_source_5 => p_source_5
58137 , p_source_31 => p_source_31
58138 , x_transaction_coa_id => l_adr_transaction_coa_id
58139 , x_accounting_coa_id => l_adr_accounting_coa_id
58140 , x_flexfield_segment_code => l_adr_flexfield_segment_code
58141 , x_flex_value_set_id => l_adr_flex_value_set_id
58142 , x_value_type_code => l_adr_value_type_code
58143 , x_value_combination_id => l_adr_value_combination_id
58144 , x_value_segment_code => l_adr_value_segment_code
58145 , p_side => 'NA'
58146 , p_override_seg_flag => 'Y'
58147 );
58148
58149 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
58150
58151 xla_ae_lines_pkg.set_segment(
58152 p_to_segment_code => 'GL_BALANCING'
58153 , p_segment_value => l_segment
58154 , p_from_segment_code => l_adr_value_segment_code
58155 , p_from_combination_id => l_adr_value_combination_id
58156 , p_value_type_code => l_adr_value_type_code
58157 , p_transaction_coa_id => l_adr_transaction_coa_id
58158 , p_accounting_coa_id => l_adr_accounting_coa_id
58159 , p_flexfield_segment_code => l_adr_flexfield_segment_code
58160 , p_flex_value_set_id => l_adr_flex_value_set_id
58161 , p_adr_code => 'FA_EXPENSE_ACCT'
58162 , p_adr_type_code => 'S'
58163 , p_component_type => l_component_type
58164 , p_component_code => l_component_code
58165 , p_component_type_code => l_component_type_code
58166 , p_component_appl_id => l_component_appl_id
58167 , p_amb_context_code => l_amb_context_code
58171 );
58168 , p_entity_code => 'TRANSACTIONS'
58169 , p_event_class_code => 'CIP_RETIREMENTS'
58170 , p_side => 'NA'
58172
58173 END IF;
58174
58175 --
58176 --
58177 END IF;
58178
58179 --
58180 -- Update the line information that should be overwritten
58181 --
58182 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
58183 p_header_num => 1);
58184 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
58185
58186 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
58187
58188 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
58189 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
58190 END IF;
58191
58192 --
58193 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
58194 --
58195 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
58196 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
58197 ELSE
58198 ---------------------------------------------------------------------------------------------------
58199 -- 4262811a Switch Sign
58200 ---------------------------------------------------------------------------------------------------
58201 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
58202 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
58203 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
58204 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
58205 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
58206 -- 5132302
58207 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
58208 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
58209
58210 END IF;
58211
58212 -- 4955764
58213 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
58214 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
58215
58216
58217 XLA_AE_LINES_PKG.ValidateCurrentLine;
58218 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
58219
58220 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
58221 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
58222 ,p_balance_type_code => l_balance_type_code);
58223
58224 END IF;
58225
58226 -----------------------------------------------------------------------------------------
58227 -- 4262811 Multiperiod Accounting
58228 -----------------------------------------------------------------------------------------
58229 -- No MPA option is assigned.
58230
58231
58232 END IF;
58233 END IF;
58234 --
58235
58236 --
58237 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
58238 trace
58239 (p_msg => 'END of AcctLineType_245'
58240 ,p_level => C_LEVEL_PROCEDURE
58241 ,p_module => l_log_module);
58242 END IF;
58243 --
58244 EXCEPTION
58245 WHEN xla_exceptions_pkg.application_exception THEN
58246 RAISE;
58247 WHEN OTHERS THEN
58248 xla_exceptions_pkg.raise_message
58249 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_245');
58250 END AcctLineType_245;
58251 --
58252
58253 ---------------------------------------
58254 --
58255 -- PRIVATE FUNCTION
58256 -- AcctLineType_246
58257 --
58258 ---------------------------------------
58259 PROCEDURE AcctLineType_246 (
58260 p_application_id IN NUMBER
58261 ,p_event_id IN NUMBER
58262 ,p_calculate_acctd_flag IN VARCHAR2
58263 ,p_calculate_g_l_flag IN VARCHAR2
58264 ,p_actual_flag IN OUT VARCHAR2
58265 ,p_balance_type_code OUT VARCHAR2
58266 ,p_gain_or_loss_ref OUT VARCHAR2
58267
58268 --Period Close Date
58269 , p_source_1 IN DATE
58270 --Generated Code Combination Identifier
58271 , p_source_5 IN NUMBER
58272 --Revaluation Reserve Account
58273 , p_source_13 IN VARCHAR2
58274 --Generated Offset Code Combination Identifier
58275 , p_source_19 IN NUMBER
58276 --Expense Account Code Combination Identifier
58277 , p_source_31 IN NUMBER
58278 --Default Code Combination Identifier
58279 , p_source_32 IN NUMBER
58280 --Adjustment Type
58281 , p_source_48 IN VARCHAR2
58282 --Transaction Header Identifier
58283 , p_source_49 IN NUMBER
58284 --Adjustment Line Identifier
58285 , p_source_50 IN NUMBER
58286 --Distribution Type Code
58287 , p_source_51 IN VARCHAR2
58288 --Entered Amount
58289 , p_source_52 IN NUMBER
58290 --Currency Code
58291 , p_source_53 IN VARCHAR2
58292 )
58293 IS
58294
58298 l_component_appl_id INTEGER;
58295 l_component_type VARCHAR2(80);
58296 l_component_code VARCHAR2(30);
58297 l_component_type_code VARCHAR2(1);
58299 l_amb_context_code VARCHAR2(30);
58300 l_entity_code VARCHAR2(30);
58301 l_event_class_code VARCHAR2(30);
58302 l_ae_header_id NUMBER;
58303 l_event_type_code VARCHAR2(30);
58304 l_line_definition_code VARCHAR2(30);
58305 l_line_definition_owner_code VARCHAR2(1);
58306 --
58307 -- adr variables
58308 l_segment VARCHAR2(30);
58309 l_ccid NUMBER;
58310 l_adr_transaction_coa_id NUMBER;
58311 l_adr_accounting_coa_id NUMBER;
58312 l_adr_flexfield_segment_code VARCHAR2(30);
58313 l_adr_flex_value_set_id NUMBER;
58314 l_adr_value_type_code VARCHAR2(30);
58315 l_adr_value_combination_id NUMBER;
58316 l_adr_value_segment_code VARCHAR2(30);
58317
58318 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
58319 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
58320 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
58321 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
58322
58323 -- 4262811 Variables ------------------------------------------------------------------------------------------
58324 l_entered_amt_idx NUMBER;
58325 l_accted_amt_idx NUMBER;
58326 l_acc_rev_flag VARCHAR2(1);
58327 l_accrual_line_num NUMBER;
58328 l_tmp_amt NUMBER;
58329 l_acc_rev_natural_side_code VARCHAR2(1);
58330
58331 l_num_entries NUMBER;
58332 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
58333 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
58334 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
58335 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
58336 l_recog_line_1 NUMBER;
58337 l_recog_line_2 NUMBER;
58338
58339 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
58340 l_bflow_applied_to_amt NUMBER; -- 5132302
58341 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
58342
58343 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
58344
58345 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
58346 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
58347
58348 ---------------------------------------------------------------------------------------------------------------
58349
58350
58351 --
58352 -- bulk performance
58353 --
58354 l_balance_type_code VARCHAR2(1);
58355 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
58356 l_log_module VARCHAR2(240);
58357
58358 --
58359 -- Upgrade strategy
58360 --
58361 l_actual_upg_option VARCHAR2(1);
58362 l_enc_upg_option VARCHAR2(1);
58363
58364 --
58365 BEGIN
58366 --
58367 IF g_log_enabled THEN
58368 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_246';
58369 END IF;
58370 --
58371 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
58372
58373 trace
58374 (p_msg => 'BEGIN of AcctLineType_246'
58375 ,p_level => C_LEVEL_PROCEDURE
58376 ,p_module => l_log_module);
58377
58378 END IF;
58379 --
58380 l_component_type := 'AMB_JLT';
58381 l_component_code := 'FA_CIP_RET_REVAL_RESERVE';
58382 l_component_type_code := 'S';
58383 l_component_appl_id := 140;
58384 l_amb_context_code := 'DEFAULT';
58385 l_entity_code := 'TRANSACTIONS';
58386 l_event_class_code := 'CIP_RETIREMENTS';
58387 l_event_type_code := 'CIP_REINSTATEMENTS';
58388 l_line_definition_owner_code := 'S';
58389 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
58390 --
58391 l_balance_type_code := 'A';
58392 l_segment := NULL;
58393 l_ccid := NULL;
58394 l_adr_transaction_coa_id := NULL;
58395 l_adr_accounting_coa_id := NULL;
58396 l_adr_flexfield_segment_code := NULL;
58397 l_adr_flex_value_set_id := NULL;
58398 l_adr_value_type_code := NULL;
58399 l_adr_value_combination_id := NULL;
58400 l_adr_value_segment_code := NULL;
58401
58402 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
58403 l_bflow_class_code := ''; -- 4219869 Business Flow
58404 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
58405 l_budgetary_control_flag := 'N';
58406
58407 l_bflow_applied_to_amt_idx := NULL; -- 5132302
58408 l_bflow_applied_to_amt := NULL; -- 5132302
58409 l_entered_amt_idx := NULL; -- 4262811
58410 l_accted_amt_idx := NULL; -- 4262811
58411 l_acc_rev_flag := NULL; -- 4262811
58412 l_accrual_line_num := NULL; -- 4262811
58413 l_tmp_amt := NULL; -- 4262811
58414 --
58415
58416 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
58417 l_balance_type_code <> 'B' THEN
58421
58418 IF NVL(p_source_48,'
58419 ') = 'REVAL RESERVE'
58420 THEN
58422 --
58423 XLA_AE_LINES_PKG.SetNewLine;
58424
58425 p_balance_type_code := l_balance_type_code;
58426 -- set the flag so later we will know whether the gain loss line needs to be created
58427
58428 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
58429 p_actual_flag :='A';
58430 END IF;
58431
58432 --
58433 -- bulk performance
58434 --
58435 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
58436 p_header_num => 0); -- 4262811
58437 --
58438 -- set accounting line options
58439 --
58440 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
58441 p_natural_side_code => 'D'
58442 , p_gain_or_loss_flag => 'N'
58443 , p_gl_transfer_mode_code => 'S'
58444 , p_acct_entry_type_code => 'A'
58445 , p_switch_side_flag => 'Y'
58446 , p_merge_duplicate_code => 'N'
58447 );
58448 --
58449 l_acc_rev_natural_side_code := 'C'; -- 4262811
58450 --
58451 --
58452 -- set accounting line type info
58453 --
58454 xla_ae_lines_pkg.SetAcctLineType
58455 (p_component_type => l_component_type
58456 ,p_event_type_code => l_event_type_code
58457 ,p_line_definition_owner_code => l_line_definition_owner_code
58458 ,p_line_definition_code => l_line_definition_code
58459 ,p_accounting_line_code => l_component_code
58460 ,p_accounting_line_type_code => l_component_type_code
58461 ,p_accounting_line_appl_id => l_component_appl_id
58462 ,p_amb_context_code => l_amb_context_code
58463 ,p_entity_code => l_entity_code
58464 ,p_event_class_code => l_event_class_code);
58465 --
58466 -- set accounting class
58467 --
58468 xla_ae_lines_pkg.SetAcctClass(
58469 p_accounting_class_code => 'ASSET'
58470 , p_ae_header_id => l_ae_header_id
58471 );
58472
58473 --
58474 -- set rounding class
58475 --
58476 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
58477 'ASSET';
58478
58479 --
58480 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
58481 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
58482 --
58483 -- bulk performance
58484 --
58485 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
58486
58487 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
58488 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
58489
58490 -- 4955764
58491 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
58492 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
58493
58494 -- 4458381 Public Sector Enh
58495
58496 --
58497 -- set accounting attributes for the line type
58498 --
58499 l_entered_amt_idx := 4;
58500 l_accted_amt_idx := 6;
58501 l_bflow_applied_to_amt_idx := NULL; -- 5132302
58502 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
58503 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
58504 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
58505 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
58506 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
58507 l_rec_acct_attrs.array_char_value(3) := p_source_51;
58508 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
58509 l_rec_acct_attrs.array_num_value(4) := p_source_52;
58510 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
58511 l_rec_acct_attrs.array_char_value(5) := p_source_53;
58512 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
58513 l_rec_acct_attrs.array_num_value(6) := p_source_52;
58514
58515 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
58516 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
58517
58518 ---------------------------------------------------------------------------------------------------------------
58519 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
58520 ---------------------------------------------------------------------------------------------------------------
58521 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
58522
58523 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
58524 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
58525
58526 IF xla_accounting_cache_pkg.GetValueChar
58527 (p_source_code => 'LEDGER_CATEGORY_CODE'
58528 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
58529 AND l_bflow_method_code = 'PRIOR_ENTRY'
58530 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
58534 THEN
58531 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
58532 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
58533 )
58535 xla_ae_lines_pkg.BflowUpgEntry
58536 (p_business_method_code => l_bflow_method_code
58537 ,p_business_class_code => l_bflow_class_code
58538 ,p_balance_type => l_balance_type_code);
58539 ELSE
58540 NULL;
58541 -- No business flow processing for business flow method of NONE.
58542 END IF;
58543
58544 --
58545 -- call analytical criteria
58546 --
58547
58548 --
58549 -- call description
58550 --
58551
58552 xla_ae_lines_pkg.SetLineDescription(
58553 p_ae_header_id => l_ae_header_id
58554 ,p_description => Description_43 (
58555 p_application_id => p_application_id
58556 , p_ae_header_id => l_ae_header_id
58557 , p_source_1 => p_source_1
58558 )
58559 );
58560
58561
58562 --
58563 -- call ADRs
58564 -- Bug 4922099
58565 --
58566 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
58567 (NVL(l_actual_upg_option, 'N') = 'O') OR
58568 (NVL(l_enc_upg_option, 'N') = 'O')
58569 )
58570 THEN
58571 NULL;
58572 --
58573 --
58574
58575 l_ccid := AcctDerRule_175(
58576 p_application_id => p_application_id
58577 , p_ae_header_id => l_ae_header_id
58578 , p_source_5 => p_source_5
58579 , p_source_19 => p_source_19
58580 , p_source_32 => p_source_32
58581 , x_transaction_coa_id => l_adr_transaction_coa_id
58582 , x_accounting_coa_id => l_adr_accounting_coa_id
58583 , x_value_type_code => l_adr_value_type_code
58584 , p_side => 'NA'
58585 );
58586
58587 xla_ae_lines_pkg.set_ccid(
58588 p_code_combination_id => l_ccid
58589 , p_value_type_code => l_adr_value_type_code
58590 , p_transaction_coa_id => l_adr_transaction_coa_id
58591 , p_accounting_coa_id => l_adr_accounting_coa_id
58592 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
58593 , p_adr_type_code => 'S'
58594 , p_component_type => l_component_type
58595 , p_component_code => l_component_code
58596 , p_component_type_code => l_component_type_code
58597 , p_component_appl_id => l_component_appl_id
58598 , p_amb_context_code => l_amb_context_code
58599 , p_side => 'NA'
58600 );
58601
58602
58603 l_segment := AcctDerRule_151(
58604 p_application_id => p_application_id
58605 , p_ae_header_id => l_ae_header_id
58606 , p_source_5 => p_source_5
58607 , p_source_13 => p_source_13
58608 , x_transaction_coa_id => l_adr_transaction_coa_id
58609 , x_accounting_coa_id => l_adr_accounting_coa_id
58610 , x_flexfield_segment_code => l_adr_flexfield_segment_code
58611 , x_flex_value_set_id => l_adr_flex_value_set_id
58612 , x_value_type_code => l_adr_value_type_code
58613 , x_value_combination_id => l_adr_value_combination_id
58614 , x_value_segment_code => l_adr_value_segment_code
58615 , p_side => 'NA'
58616 , p_override_seg_flag => 'Y'
58617 );
58618
58619 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
58620
58621 xla_ae_lines_pkg.set_segment(
58622 p_to_segment_code => 'GL_ACCOUNT'
58623 , p_segment_value => l_segment
58624 , p_from_segment_code => l_adr_value_segment_code
58625 , p_from_combination_id => l_adr_value_combination_id
58626 , p_value_type_code => l_adr_value_type_code
58627 , p_transaction_coa_id => l_adr_transaction_coa_id
58628 , p_accounting_coa_id => l_adr_accounting_coa_id
58629 , p_flexfield_segment_code => l_adr_flexfield_segment_code
58630 , p_flex_value_set_id => l_adr_flex_value_set_id
58631 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
58632 , p_adr_type_code => 'S'
58633 , p_component_type => l_component_type
58634 , p_component_code => l_component_code
58635 , p_component_type_code => l_component_type_code
58636 , p_component_appl_id => l_component_appl_id
58637 , p_amb_context_code => l_amb_context_code
58638 , p_entity_code => 'TRANSACTIONS'
58639 , p_event_class_code => 'CIP_RETIREMENTS'
58640 , p_side => 'NA'
58641 );
58642
58643 END IF;
58644
58645 l_segment := AcctDerRule_169(
58646 p_application_id => p_application_id
58647 , p_ae_header_id => l_ae_header_id
58648 , p_source_5 => p_source_5
58649 , p_source_31 => p_source_31
58650 , x_transaction_coa_id => l_adr_transaction_coa_id
58651 , x_accounting_coa_id => l_adr_accounting_coa_id
58652 , x_flexfield_segment_code => l_adr_flexfield_segment_code
58653 , x_flex_value_set_id => l_adr_flex_value_set_id
58654 , x_value_type_code => l_adr_value_type_code
58655 , x_value_combination_id => l_adr_value_combination_id
58656 , x_value_segment_code => l_adr_value_segment_code
58660
58657 , p_side => 'NA'
58658 , p_override_seg_flag => 'Y'
58659 );
58661 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
58662
58663 xla_ae_lines_pkg.set_segment(
58664 p_to_segment_code => 'GL_BALANCING'
58665 , p_segment_value => l_segment
58666 , p_from_segment_code => l_adr_value_segment_code
58667 , p_from_combination_id => l_adr_value_combination_id
58668 , p_value_type_code => l_adr_value_type_code
58669 , p_transaction_coa_id => l_adr_transaction_coa_id
58670 , p_accounting_coa_id => l_adr_accounting_coa_id
58671 , p_flexfield_segment_code => l_adr_flexfield_segment_code
58672 , p_flex_value_set_id => l_adr_flex_value_set_id
58673 , p_adr_code => 'FA_EXPENSE_ACCT'
58674 , p_adr_type_code => 'S'
58675 , p_component_type => l_component_type
58676 , p_component_code => l_component_code
58677 , p_component_type_code => l_component_type_code
58678 , p_component_appl_id => l_component_appl_id
58679 , p_amb_context_code => l_amb_context_code
58680 , p_entity_code => 'TRANSACTIONS'
58681 , p_event_class_code => 'CIP_RETIREMENTS'
58682 , p_side => 'NA'
58683 );
58684
58685 END IF;
58686
58687 --
58688 --
58689 END IF;
58690 --
58691 -- Bug 4922099
58692 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
58693 (NVL(l_enc_upg_option, 'N') = 'O')
58694 ) AND
58695 (l_bflow_method_code = 'PRIOR_ENTRY')
58696 )
58697 THEN
58698 IF
58699 --
58700 1 = 2
58701 --
58702 THEN
58703 xla_accounting_err_pkg.build_message
58704 (p_appli_s_name => 'XLA'
58705 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
58706 ,p_token_1 => 'LINE_NUMBER'
58707 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
58708 ,p_token_2 => 'LINE_TYPE_NAME'
58709 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
58710 l_component_type
58711 ,l_component_code
58712 ,l_component_type_code
58713 ,l_component_appl_id
58714 ,l_amb_context_code
58715 ,l_entity_code
58716 ,l_event_class_code
58717 )
58718 ,p_token_3 => 'OWNER'
58719 ,p_value_3 => xla_lookups_pkg.get_meaning(
58720 p_lookup_type => 'XLA_OWNER_TYPE'
58721 ,p_lookup_code => l_component_type_code
58722 )
58723 ,p_token_4 => 'PRODUCT_NAME'
58724 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
58725 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
58726 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
58727 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
58728 ,p_ae_header_id => NULL
58729 );
58730
58731 IF (C_LEVEL_ERROR>= g_log_level) THEN
58732 trace
58733 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
58734 ,p_level => C_LEVEL_ERROR
58735 ,p_module => l_log_module);
58736 END IF;
58737 END IF;
58738 END IF;
58739 --
58740 --
58741 ------------------------------------------------------------------------------------------------
58742 -- 4219869 Business Flow
58743 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
58744 -- Prior Entry. Currently, the following code is always generated.
58745 ------------------------------------------------------------------------------------------------
58746 XLA_AE_LINES_PKG.ValidateCurrentLine;
58747
58748 ------------------------------------------------------------------------------------
58749 -- 4219869 Business Flow
58750 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
58751 ------------------------------------------------------------------------------------
58752 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
58753
58757 ----------------------------------------------------------------------------------
58754 ----------------------------------------------------------------------------------
58755 -- 4219869 Business Flow
58756 -- Update journal entry status -- Need to generate this within IF <condition>
58758 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
58759 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
58760 ,p_balance_type_code => l_balance_type_code
58761 );
58762
58763 -------------------------------------------------------------------------------------------
58764 -- 4262811 - Generate the Accrual Reversal lines
58765 -------------------------------------------------------------------------------------------
58766 BEGIN
58767 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
58768 (g_array_event(p_event_id).array_value_num('header_index'));
58769 IF l_acc_rev_flag IS NULL THEN
58770 l_acc_rev_flag := 'N';
58771 END IF;
58772 EXCEPTION
58773 WHEN OTHERS THEN
58774 l_acc_rev_flag := 'N';
58775 END;
58776 --
58777 IF (l_acc_rev_flag = 'Y') THEN
58778
58779 -- 4645092 ------------------------------------------------------------------------------
58780 -- To allow MPA report to determine if it should generate report process
58781 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
58782 ------------------------------------------------------------------------------------------
58783
58784 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
58785 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
58786 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
58787 -- call ADRs
58788 -- Bug 4922099
58789 --
58790 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
58791 (NVL(l_actual_upg_option, 'N') = 'O') OR
58792 (NVL(l_enc_upg_option, 'N') = 'O')
58793 )
58794 THEN
58795 NULL;
58796 --
58797 --
58798
58799 l_ccid := AcctDerRule_175(
58800 p_application_id => p_application_id
58801 , p_ae_header_id => l_ae_header_id
58802 , p_source_5 => p_source_5
58803 , p_source_19 => p_source_19
58804 , p_source_32 => p_source_32
58805 , x_transaction_coa_id => l_adr_transaction_coa_id
58806 , x_accounting_coa_id => l_adr_accounting_coa_id
58807 , x_value_type_code => l_adr_value_type_code
58808 , p_side => 'NA'
58809 );
58810
58811 xla_ae_lines_pkg.set_ccid(
58812 p_code_combination_id => l_ccid
58813 , p_value_type_code => l_adr_value_type_code
58814 , p_transaction_coa_id => l_adr_transaction_coa_id
58815 , p_accounting_coa_id => l_adr_accounting_coa_id
58816 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
58817 , p_adr_type_code => 'S'
58818 , p_component_type => l_component_type
58819 , p_component_code => l_component_code
58820 , p_component_type_code => l_component_type_code
58821 , p_component_appl_id => l_component_appl_id
58822 , p_amb_context_code => l_amb_context_code
58823 , p_side => 'NA'
58824 );
58825
58826
58827 l_segment := AcctDerRule_151(
58828 p_application_id => p_application_id
58829 , p_ae_header_id => l_ae_header_id
58830 , p_source_5 => p_source_5
58831 , p_source_13 => p_source_13
58832 , x_transaction_coa_id => l_adr_transaction_coa_id
58833 , x_accounting_coa_id => l_adr_accounting_coa_id
58834 , x_flexfield_segment_code => l_adr_flexfield_segment_code
58835 , x_flex_value_set_id => l_adr_flex_value_set_id
58836 , x_value_type_code => l_adr_value_type_code
58837 , x_value_combination_id => l_adr_value_combination_id
58838 , x_value_segment_code => l_adr_value_segment_code
58839 , p_side => 'NA'
58840 , p_override_seg_flag => 'Y'
58841 );
58842
58843 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
58844
58845 xla_ae_lines_pkg.set_segment(
58846 p_to_segment_code => 'GL_ACCOUNT'
58847 , p_segment_value => l_segment
58848 , p_from_segment_code => l_adr_value_segment_code
58849 , p_from_combination_id => l_adr_value_combination_id
58850 , p_value_type_code => l_adr_value_type_code
58851 , p_transaction_coa_id => l_adr_transaction_coa_id
58852 , p_accounting_coa_id => l_adr_accounting_coa_id
58853 , p_flexfield_segment_code => l_adr_flexfield_segment_code
58854 , p_flex_value_set_id => l_adr_flex_value_set_id
58855 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
58856 , p_adr_type_code => 'S'
58857 , p_component_type => l_component_type
58858 , p_component_code => l_component_code
58859 , p_component_type_code => l_component_type_code
58860 , p_component_appl_id => l_component_appl_id
58861 , p_amb_context_code => l_amb_context_code
58862 , p_entity_code => 'TRANSACTIONS'
58866
58863 , p_event_class_code => 'CIP_RETIREMENTS'
58864 , p_side => 'NA'
58865 );
58867 END IF;
58868
58869 l_segment := AcctDerRule_169(
58870 p_application_id => p_application_id
58871 , p_ae_header_id => l_ae_header_id
58872 , p_source_5 => p_source_5
58873 , p_source_31 => p_source_31
58874 , x_transaction_coa_id => l_adr_transaction_coa_id
58875 , x_accounting_coa_id => l_adr_accounting_coa_id
58876 , x_flexfield_segment_code => l_adr_flexfield_segment_code
58877 , x_flex_value_set_id => l_adr_flex_value_set_id
58878 , x_value_type_code => l_adr_value_type_code
58879 , x_value_combination_id => l_adr_value_combination_id
58880 , x_value_segment_code => l_adr_value_segment_code
58881 , p_side => 'NA'
58882 , p_override_seg_flag => 'Y'
58883 );
58884
58885 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
58886
58887 xla_ae_lines_pkg.set_segment(
58888 p_to_segment_code => 'GL_BALANCING'
58889 , p_segment_value => l_segment
58890 , p_from_segment_code => l_adr_value_segment_code
58891 , p_from_combination_id => l_adr_value_combination_id
58892 , p_value_type_code => l_adr_value_type_code
58893 , p_transaction_coa_id => l_adr_transaction_coa_id
58894 , p_accounting_coa_id => l_adr_accounting_coa_id
58895 , p_flexfield_segment_code => l_adr_flexfield_segment_code
58896 , p_flex_value_set_id => l_adr_flex_value_set_id
58897 , p_adr_code => 'FA_EXPENSE_ACCT'
58898 , p_adr_type_code => 'S'
58899 , p_component_type => l_component_type
58900 , p_component_code => l_component_code
58901 , p_component_type_code => l_component_type_code
58902 , p_component_appl_id => l_component_appl_id
58903 , p_amb_context_code => l_amb_context_code
58904 , p_entity_code => 'TRANSACTIONS'
58905 , p_event_class_code => 'CIP_RETIREMENTS'
58906 , p_side => 'NA'
58907 );
58908
58909 END IF;
58910
58911 --
58912 --
58913 END IF;
58914
58915 --
58916 -- Update the line information that should be overwritten
58917 --
58918 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
58919 p_header_num => 1);
58920 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
58921
58922 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
58923
58924 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
58925 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
58926 END IF;
58927
58928 --
58929 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
58930 --
58931 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
58932 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
58933 ELSE
58934 ---------------------------------------------------------------------------------------------------
58935 -- 4262811a Switch Sign
58936 ---------------------------------------------------------------------------------------------------
58937 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
58938 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
58939 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
58940 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
58941 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
58942 -- 5132302
58943 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
58944 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
58945
58946 END IF;
58947
58948 -- 4955764
58949 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
58950 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
58951
58952
58953 XLA_AE_LINES_PKG.ValidateCurrentLine;
58954 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
58955
58956 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
58957 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
58958 ,p_balance_type_code => l_balance_type_code);
58959
58960 END IF;
58961
58962 -----------------------------------------------------------------------------------------
58963 -- 4262811 Multiperiod Accounting
58964 -----------------------------------------------------------------------------------------
58965 -- No MPA option is assigned.
58966
58967
58968 END IF;
58969 END IF;
58970 --
58971
58972 --
58976 ,p_level => C_LEVEL_PROCEDURE
58973 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
58974 trace
58975 (p_msg => 'END of AcctLineType_246'
58977 ,p_module => l_log_module);
58978 END IF;
58979 --
58980 EXCEPTION
58981 WHEN xla_exceptions_pkg.application_exception THEN
58982 RAISE;
58983 WHEN OTHERS THEN
58984 xla_exceptions_pkg.raise_message
58985 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_246');
58986 END AcctLineType_246;
58987 --
58988
58989 ---------------------------------------
58990 --
58991 -- PRIVATE FUNCTION
58992 -- AcctLineType_247
58993 --
58994 ---------------------------------------
58995 PROCEDURE AcctLineType_247 (
58996 p_application_id IN NUMBER
58997 ,p_event_id IN NUMBER
58998 ,p_calculate_acctd_flag IN VARCHAR2
58999 ,p_calculate_g_l_flag IN VARCHAR2
59000 ,p_actual_flag IN OUT VARCHAR2
59001 ,p_balance_type_code OUT VARCHAR2
59002 ,p_gain_or_loss_ref OUT VARCHAR2
59003
59004 --Period Close Date
59005 , p_source_1 IN DATE
59006 --Generated Code Combination Identifier
59007 , p_source_5 IN NUMBER
59008 --Revaluation Reserve Retired Gain Account
59009 , p_source_29 IN VARCHAR2
59010 --Expense Account Code Combination Identifier
59011 , p_source_31 IN NUMBER
59012 --Default Code Combination Identifier
59013 , p_source_32 IN NUMBER
59014 --Adjustment Type
59015 , p_source_48 IN VARCHAR2
59016 --Transaction Header Identifier
59017 , p_source_49 IN NUMBER
59018 --Adjustment Line Identifier
59019 , p_source_50 IN NUMBER
59020 --Distribution Type Code
59021 , p_source_51 IN VARCHAR2
59022 --Entered Amount
59023 , p_source_52 IN NUMBER
59024 --Currency Code
59025 , p_source_53 IN VARCHAR2
59026 --Gain Loss Amount
59027 , p_source_54 IN NUMBER
59028 )
59029 IS
59030
59031 l_component_type VARCHAR2(80);
59032 l_component_code VARCHAR2(30);
59033 l_component_type_code VARCHAR2(1);
59034 l_component_appl_id INTEGER;
59035 l_amb_context_code VARCHAR2(30);
59036 l_entity_code VARCHAR2(30);
59037 l_event_class_code VARCHAR2(30);
59038 l_ae_header_id NUMBER;
59039 l_event_type_code VARCHAR2(30);
59040 l_line_definition_code VARCHAR2(30);
59041 l_line_definition_owner_code VARCHAR2(1);
59042 --
59043 -- adr variables
59044 l_segment VARCHAR2(30);
59045 l_ccid NUMBER;
59046 l_adr_transaction_coa_id NUMBER;
59047 l_adr_accounting_coa_id NUMBER;
59048 l_adr_flexfield_segment_code VARCHAR2(30);
59049 l_adr_flex_value_set_id NUMBER;
59050 l_adr_value_type_code VARCHAR2(30);
59051 l_adr_value_combination_id NUMBER;
59052 l_adr_value_segment_code VARCHAR2(30);
59053
59054 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
59055 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
59056 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
59057 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
59058
59059 -- 4262811 Variables ------------------------------------------------------------------------------------------
59060 l_entered_amt_idx NUMBER;
59061 l_accted_amt_idx NUMBER;
59062 l_acc_rev_flag VARCHAR2(1);
59063 l_accrual_line_num NUMBER;
59064 l_tmp_amt NUMBER;
59065 l_acc_rev_natural_side_code VARCHAR2(1);
59066
59067 l_num_entries NUMBER;
59068 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
59069 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
59070 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
59071 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
59072 l_recog_line_1 NUMBER;
59073 l_recog_line_2 NUMBER;
59074
59075 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
59076 l_bflow_applied_to_amt NUMBER; -- 5132302
59077 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
59078
59079 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
59080
59081 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
59082 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
59083
59084 ---------------------------------------------------------------------------------------------------------------
59085
59086
59087 --
59088 -- bulk performance
59089 --
59090 l_balance_type_code VARCHAR2(1);
59091 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
59092 l_log_module VARCHAR2(240);
59093
59094 --
59095 -- Upgrade strategy
59096 --
59097 l_actual_upg_option VARCHAR2(1);
59098 l_enc_upg_option VARCHAR2(1);
59099
59100 --
59101 BEGIN
59102 --
59103 IF g_log_enabled THEN
59104 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_247';
59105 END IF;
59106 --
59107 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
59108
59109 trace
59110 (p_msg => 'BEGIN of AcctLineType_247'
59114 END IF;
59111 ,p_level => C_LEVEL_PROCEDURE
59112 ,p_module => l_log_module);
59113
59115 --
59116 l_component_type := 'AMB_JLT';
59117 l_component_code := 'FA_CIP_RET_REVAL_RESERVE_GAIN';
59118 l_component_type_code := 'S';
59119 l_component_appl_id := 140;
59120 l_amb_context_code := 'DEFAULT';
59121 l_entity_code := 'TRANSACTIONS';
59122 l_event_class_code := 'CIP_RETIREMENTS';
59123 l_event_type_code := 'CIP_RETIREMENTS';
59124 l_line_definition_owner_code := 'S';
59125 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
59126 --
59127 l_balance_type_code := 'A';
59128 l_segment := NULL;
59129 l_ccid := NULL;
59130 l_adr_transaction_coa_id := NULL;
59131 l_adr_accounting_coa_id := NULL;
59132 l_adr_flexfield_segment_code := NULL;
59133 l_adr_flex_value_set_id := NULL;
59134 l_adr_value_type_code := NULL;
59135 l_adr_value_combination_id := NULL;
59136 l_adr_value_segment_code := NULL;
59137
59138 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
59139 l_bflow_class_code := ''; -- 4219869 Business Flow
59140 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
59141 l_budgetary_control_flag := 'N';
59142
59143 l_bflow_applied_to_amt_idx := NULL; -- 5132302
59144 l_bflow_applied_to_amt := NULL; -- 5132302
59145 l_entered_amt_idx := NULL; -- 4262811
59146 l_accted_amt_idx := NULL; -- 4262811
59147 l_acc_rev_flag := NULL; -- 4262811
59148 l_accrual_line_num := NULL; -- 4262811
59149 l_tmp_amt := NULL; -- 4262811
59150 --
59151
59152 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
59153 l_balance_type_code <> 'B' THEN
59154 IF NVL(p_source_48,'
59155 ') = 'REVAL RSV RET' AND
59156 p_source_54 >= 0
59157 THEN
59158
59159 --
59160 XLA_AE_LINES_PKG.SetNewLine;
59161
59162 p_balance_type_code := l_balance_type_code;
59163 -- set the flag so later we will know whether the gain loss line needs to be created
59164
59165 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
59166 p_actual_flag :='A';
59167 END IF;
59168
59169 --
59170 -- bulk performance
59171 --
59172 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
59173 p_header_num => 0); -- 4262811
59174 --
59175 -- set accounting line options
59176 --
59177 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
59178 p_natural_side_code => 'C'
59179 , p_gain_or_loss_flag => 'N'
59180 , p_gl_transfer_mode_code => 'S'
59181 , p_acct_entry_type_code => 'A'
59182 , p_switch_side_flag => 'Y'
59183 , p_merge_duplicate_code => 'N'
59184 );
59185 --
59186 l_acc_rev_natural_side_code := 'D'; -- 4262811
59187 --
59188 --
59189 -- set accounting line type info
59190 --
59191 xla_ae_lines_pkg.SetAcctLineType
59192 (p_component_type => l_component_type
59193 ,p_event_type_code => l_event_type_code
59194 ,p_line_definition_owner_code => l_line_definition_owner_code
59195 ,p_line_definition_code => l_line_definition_code
59196 ,p_accounting_line_code => l_component_code
59197 ,p_accounting_line_type_code => l_component_type_code
59198 ,p_accounting_line_appl_id => l_component_appl_id
59199 ,p_amb_context_code => l_amb_context_code
59200 ,p_entity_code => l_entity_code
59201 ,p_event_class_code => l_event_class_code);
59202 --
59203 -- set accounting class
59204 --
59205 xla_ae_lines_pkg.SetAcctClass(
59206 p_accounting_class_code => 'ASSET'
59207 , p_ae_header_id => l_ae_header_id
59208 );
59209
59210 --
59211 -- set rounding class
59212 --
59213 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
59214 'ASSET';
59215
59216 --
59217 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
59218 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
59219 --
59220 -- bulk performance
59221 --
59222 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
59223
59224 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
59225 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
59226
59227 -- 4955764
59228 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
59229 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
59230
59231 -- 4458381 Public Sector Enh
59232
59233 --
59234 -- set accounting attributes for the line type
59235 --
59236 l_entered_amt_idx := 4;
59237 l_accted_amt_idx := 6;
59238 l_bflow_applied_to_amt_idx := NULL; -- 5132302
59242 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
59239 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
59240 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
59241 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
59243 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
59244 l_rec_acct_attrs.array_char_value(3) := p_source_51;
59245 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
59246 l_rec_acct_attrs.array_num_value(4) := p_source_52;
59247 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
59248 l_rec_acct_attrs.array_char_value(5) := p_source_53;
59249 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
59250 l_rec_acct_attrs.array_num_value(6) := p_source_52;
59251
59252 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
59253 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
59254
59255 ---------------------------------------------------------------------------------------------------------------
59256 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
59257 ---------------------------------------------------------------------------------------------------------------
59258 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
59259
59260 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
59261 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
59262
59263 IF xla_accounting_cache_pkg.GetValueChar
59264 (p_source_code => 'LEDGER_CATEGORY_CODE'
59265 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
59266 AND l_bflow_method_code = 'PRIOR_ENTRY'
59267 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
59268 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
59269 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
59270 )
59271 THEN
59272 xla_ae_lines_pkg.BflowUpgEntry
59273 (p_business_method_code => l_bflow_method_code
59274 ,p_business_class_code => l_bflow_class_code
59275 ,p_balance_type => l_balance_type_code);
59276 ELSE
59277 NULL;
59278 -- No business flow processing for business flow method of NONE.
59279 END IF;
59280
59281 --
59282 -- call analytical criteria
59283 --
59284
59285 --
59286 -- call description
59287 --
59288
59289 xla_ae_lines_pkg.SetLineDescription(
59290 p_ae_header_id => l_ae_header_id
59291 ,p_description => Description_40 (
59292 p_application_id => p_application_id
59293 , p_ae_header_id => l_ae_header_id
59294 , p_source_1 => p_source_1
59295 )
59296 );
59297
59298
59299 --
59300 -- call ADRs
59301 -- Bug 4922099
59302 --
59303 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
59304 (NVL(l_actual_upg_option, 'N') = 'O') OR
59305 (NVL(l_enc_upg_option, 'N') = 'O')
59306 )
59307 THEN
59308 NULL;
59309 --
59310 --
59311
59312 l_ccid := AcctDerRule_174(
59313 p_application_id => p_application_id
59314 , p_ae_header_id => l_ae_header_id
59315 , p_source_5 => p_source_5
59316 , p_source_32 => p_source_32
59317 , x_transaction_coa_id => l_adr_transaction_coa_id
59318 , x_accounting_coa_id => l_adr_accounting_coa_id
59319 , x_value_type_code => l_adr_value_type_code
59320 , p_side => 'NA'
59321 );
59322
59323 xla_ae_lines_pkg.set_ccid(
59324 p_code_combination_id => l_ccid
59325 , p_value_type_code => l_adr_value_type_code
59326 , p_transaction_coa_id => l_adr_transaction_coa_id
59327 , p_accounting_coa_id => l_adr_accounting_coa_id
59328 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
59329 , p_adr_type_code => 'S'
59330 , p_component_type => l_component_type
59331 , p_component_code => l_component_code
59332 , p_component_type_code => l_component_type_code
59333 , p_component_appl_id => l_component_appl_id
59334 , p_amb_context_code => l_amb_context_code
59335 , p_side => 'NA'
59336 );
59337
59338
59339 l_segment := AcctDerRule_169(
59340 p_application_id => p_application_id
59341 , p_ae_header_id => l_ae_header_id
59342 , p_source_5 => p_source_5
59343 , p_source_31 => p_source_31
59344 , x_transaction_coa_id => l_adr_transaction_coa_id
59345 , x_accounting_coa_id => l_adr_accounting_coa_id
59346 , x_flexfield_segment_code => l_adr_flexfield_segment_code
59347 , x_flex_value_set_id => l_adr_flex_value_set_id
59348 , x_value_type_code => l_adr_value_type_code
59349 , x_value_combination_id => l_adr_value_combination_id
59350 , x_value_segment_code => l_adr_value_segment_code
59351 , p_side => 'NA'
59352 , p_override_seg_flag => 'Y'
59353 );
59357 xla_ae_lines_pkg.set_segment(
59354
59355 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
59356
59358 p_to_segment_code => 'GL_BALANCING'
59359 , p_segment_value => l_segment
59360 , p_from_segment_code => l_adr_value_segment_code
59361 , p_from_combination_id => l_adr_value_combination_id
59362 , p_value_type_code => l_adr_value_type_code
59363 , p_transaction_coa_id => l_adr_transaction_coa_id
59364 , p_accounting_coa_id => l_adr_accounting_coa_id
59365 , p_flexfield_segment_code => l_adr_flexfield_segment_code
59366 , p_flex_value_set_id => l_adr_flex_value_set_id
59367 , p_adr_code => 'FA_EXPENSE_ACCT'
59368 , p_adr_type_code => 'S'
59369 , p_component_type => l_component_type
59370 , p_component_code => l_component_code
59371 , p_component_type_code => l_component_type_code
59372 , p_component_appl_id => l_component_appl_id
59373 , p_amb_context_code => l_amb_context_code
59374 , p_entity_code => 'TRANSACTIONS'
59375 , p_event_class_code => 'CIP_RETIREMENTS'
59376 , p_side => 'NA'
59377 );
59378
59379 END IF;
59380
59381 l_segment := AcctDerRule_166(
59382 p_application_id => p_application_id
59383 , p_ae_header_id => l_ae_header_id
59384 , p_source_5 => p_source_5
59385 , p_source_29 => p_source_29
59386 , x_transaction_coa_id => l_adr_transaction_coa_id
59387 , x_accounting_coa_id => l_adr_accounting_coa_id
59388 , x_flexfield_segment_code => l_adr_flexfield_segment_code
59389 , x_flex_value_set_id => l_adr_flex_value_set_id
59390 , x_value_type_code => l_adr_value_type_code
59391 , x_value_combination_id => l_adr_value_combination_id
59392 , x_value_segment_code => l_adr_value_segment_code
59393 , p_side => 'NA'
59394 , p_override_seg_flag => 'Y'
59395 );
59396
59397 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
59398
59399 xla_ae_lines_pkg.set_segment(
59400 p_to_segment_code => 'GL_ACCOUNT'
59401 , p_segment_value => l_segment
59402 , p_from_segment_code => l_adr_value_segment_code
59403 , p_from_combination_id => l_adr_value_combination_id
59404 , p_value_type_code => l_adr_value_type_code
59405 , p_transaction_coa_id => l_adr_transaction_coa_id
59406 , p_accounting_coa_id => l_adr_accounting_coa_id
59407 , p_flexfield_segment_code => l_adr_flexfield_segment_code
59408 , p_flex_value_set_id => l_adr_flex_value_set_id
59409 , p_adr_code => 'FA_REVAL_RES_RET_GAIN_SEGMENT'
59410 , p_adr_type_code => 'S'
59411 , p_component_type => l_component_type
59412 , p_component_code => l_component_code
59413 , p_component_type_code => l_component_type_code
59414 , p_component_appl_id => l_component_appl_id
59415 , p_amb_context_code => l_amb_context_code
59416 , p_entity_code => 'TRANSACTIONS'
59417 , p_event_class_code => 'CIP_RETIREMENTS'
59418 , p_side => 'NA'
59419 );
59420
59421 END IF;
59422
59423 --
59424 --
59425 END IF;
59426 --
59427 -- Bug 4922099
59428 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
59429 (NVL(l_enc_upg_option, 'N') = 'O')
59430 ) AND
59431 (l_bflow_method_code = 'PRIOR_ENTRY')
59432 )
59433 THEN
59434 IF
59435 --
59436 1 = 2
59437 --
59438 THEN
59439 xla_accounting_err_pkg.build_message
59440 (p_appli_s_name => 'XLA'
59441 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
59442 ,p_token_1 => 'LINE_NUMBER'
59443 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
59444 ,p_token_2 => 'LINE_TYPE_NAME'
59445 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
59446 l_component_type
59447 ,l_component_code
59448 ,l_component_type_code
59449 ,l_component_appl_id
59450 ,l_amb_context_code
59451 ,l_entity_code
59452 ,l_event_class_code
59453 )
59454 ,p_token_3 => 'OWNER'
59455 ,p_value_3 => xla_lookups_pkg.get_meaning(
59456 p_lookup_type => 'XLA_OWNER_TYPE'
59460 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
59457 ,p_lookup_code => l_component_type_code
59458 )
59459 ,p_token_4 => 'PRODUCT_NAME'
59461 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
59462 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
59463 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
59464 ,p_ae_header_id => NULL
59465 );
59466
59467 IF (C_LEVEL_ERROR>= g_log_level) THEN
59468 trace
59469 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
59470 ,p_level => C_LEVEL_ERROR
59471 ,p_module => l_log_module);
59472 END IF;
59473 END IF;
59474 END IF;
59475 --
59476 --
59477 ------------------------------------------------------------------------------------------------
59478 -- 4219869 Business Flow
59479 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
59480 -- Prior Entry. Currently, the following code is always generated.
59481 ------------------------------------------------------------------------------------------------
59482 XLA_AE_LINES_PKG.ValidateCurrentLine;
59483
59484 ------------------------------------------------------------------------------------
59485 -- 4219869 Business Flow
59486 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
59487 ------------------------------------------------------------------------------------
59488 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
59489
59490 ----------------------------------------------------------------------------------
59491 -- 4219869 Business Flow
59492 -- Update journal entry status -- Need to generate this within IF <condition>
59493 ----------------------------------------------------------------------------------
59494 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
59495 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
59496 ,p_balance_type_code => l_balance_type_code
59497 );
59498
59499 -------------------------------------------------------------------------------------------
59500 -- 4262811 - Generate the Accrual Reversal lines
59501 -------------------------------------------------------------------------------------------
59502 BEGIN
59503 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
59504 (g_array_event(p_event_id).array_value_num('header_index'));
59505 IF l_acc_rev_flag IS NULL THEN
59506 l_acc_rev_flag := 'N';
59507 END IF;
59508 EXCEPTION
59509 WHEN OTHERS THEN
59510 l_acc_rev_flag := 'N';
59511 END;
59512 --
59513 IF (l_acc_rev_flag = 'Y') THEN
59514
59515 -- 4645092 ------------------------------------------------------------------------------
59516 -- To allow MPA report to determine if it should generate report process
59517 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
59518 ------------------------------------------------------------------------------------------
59519
59520 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
59521 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
59522 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
59523 -- call ADRs
59524 -- Bug 4922099
59525 --
59526 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
59527 (NVL(l_actual_upg_option, 'N') = 'O') OR
59528 (NVL(l_enc_upg_option, 'N') = 'O')
59529 )
59530 THEN
59531 NULL;
59532 --
59533 --
59534
59535 l_ccid := AcctDerRule_174(
59536 p_application_id => p_application_id
59537 , p_ae_header_id => l_ae_header_id
59538 , p_source_5 => p_source_5
59539 , p_source_32 => p_source_32
59540 , x_transaction_coa_id => l_adr_transaction_coa_id
59541 , x_accounting_coa_id => l_adr_accounting_coa_id
59542 , x_value_type_code => l_adr_value_type_code
59543 , p_side => 'NA'
59544 );
59545
59546 xla_ae_lines_pkg.set_ccid(
59547 p_code_combination_id => l_ccid
59548 , p_value_type_code => l_adr_value_type_code
59549 , p_transaction_coa_id => l_adr_transaction_coa_id
59550 , p_accounting_coa_id => l_adr_accounting_coa_id
59551 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
59552 , p_adr_type_code => 'S'
59553 , p_component_type => l_component_type
59554 , p_component_code => l_component_code
59555 , p_component_type_code => l_component_type_code
59556 , p_component_appl_id => l_component_appl_id
59557 , p_amb_context_code => l_amb_context_code
59558 , p_side => 'NA'
59559 );
59560
59561
59562 l_segment := AcctDerRule_169(
59563 p_application_id => p_application_id
59564 , p_ae_header_id => l_ae_header_id
59565 , p_source_5 => p_source_5
59569 , x_flexfield_segment_code => l_adr_flexfield_segment_code
59566 , p_source_31 => p_source_31
59567 , x_transaction_coa_id => l_adr_transaction_coa_id
59568 , x_accounting_coa_id => l_adr_accounting_coa_id
59570 , x_flex_value_set_id => l_adr_flex_value_set_id
59571 , x_value_type_code => l_adr_value_type_code
59572 , x_value_combination_id => l_adr_value_combination_id
59573 , x_value_segment_code => l_adr_value_segment_code
59574 , p_side => 'NA'
59575 , p_override_seg_flag => 'Y'
59576 );
59577
59578 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
59579
59580 xla_ae_lines_pkg.set_segment(
59581 p_to_segment_code => 'GL_BALANCING'
59582 , p_segment_value => l_segment
59583 , p_from_segment_code => l_adr_value_segment_code
59584 , p_from_combination_id => l_adr_value_combination_id
59585 , p_value_type_code => l_adr_value_type_code
59586 , p_transaction_coa_id => l_adr_transaction_coa_id
59587 , p_accounting_coa_id => l_adr_accounting_coa_id
59588 , p_flexfield_segment_code => l_adr_flexfield_segment_code
59589 , p_flex_value_set_id => l_adr_flex_value_set_id
59590 , p_adr_code => 'FA_EXPENSE_ACCT'
59591 , p_adr_type_code => 'S'
59592 , p_component_type => l_component_type
59593 , p_component_code => l_component_code
59594 , p_component_type_code => l_component_type_code
59595 , p_component_appl_id => l_component_appl_id
59596 , p_amb_context_code => l_amb_context_code
59597 , p_entity_code => 'TRANSACTIONS'
59598 , p_event_class_code => 'CIP_RETIREMENTS'
59599 , p_side => 'NA'
59600 );
59601
59602 END IF;
59603
59604 l_segment := AcctDerRule_166(
59605 p_application_id => p_application_id
59606 , p_ae_header_id => l_ae_header_id
59607 , p_source_5 => p_source_5
59608 , p_source_29 => p_source_29
59609 , x_transaction_coa_id => l_adr_transaction_coa_id
59610 , x_accounting_coa_id => l_adr_accounting_coa_id
59611 , x_flexfield_segment_code => l_adr_flexfield_segment_code
59612 , x_flex_value_set_id => l_adr_flex_value_set_id
59613 , x_value_type_code => l_adr_value_type_code
59614 , x_value_combination_id => l_adr_value_combination_id
59615 , x_value_segment_code => l_adr_value_segment_code
59616 , p_side => 'NA'
59617 , p_override_seg_flag => 'Y'
59618 );
59619
59620 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
59621
59622 xla_ae_lines_pkg.set_segment(
59623 p_to_segment_code => 'GL_ACCOUNT'
59624 , p_segment_value => l_segment
59625 , p_from_segment_code => l_adr_value_segment_code
59626 , p_from_combination_id => l_adr_value_combination_id
59627 , p_value_type_code => l_adr_value_type_code
59628 , p_transaction_coa_id => l_adr_transaction_coa_id
59629 , p_accounting_coa_id => l_adr_accounting_coa_id
59630 , p_flexfield_segment_code => l_adr_flexfield_segment_code
59631 , p_flex_value_set_id => l_adr_flex_value_set_id
59632 , p_adr_code => 'FA_REVAL_RES_RET_GAIN_SEGMENT'
59633 , p_adr_type_code => 'S'
59634 , p_component_type => l_component_type
59635 , p_component_code => l_component_code
59636 , p_component_type_code => l_component_type_code
59637 , p_component_appl_id => l_component_appl_id
59638 , p_amb_context_code => l_amb_context_code
59639 , p_entity_code => 'TRANSACTIONS'
59640 , p_event_class_code => 'CIP_RETIREMENTS'
59641 , p_side => 'NA'
59642 );
59643
59644 END IF;
59645
59646 --
59647 --
59648 END IF;
59649
59650 --
59651 -- Update the line information that should be overwritten
59652 --
59653 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
59654 p_header_num => 1);
59655 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
59656
59657 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
59658
59659 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
59660 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
59661 END IF;
59662
59663 --
59664 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
59665 --
59666 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
59667 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
59668 ELSE
59669 ---------------------------------------------------------------------------------------------------
59670 -- 4262811a Switch Sign
59671 ---------------------------------------------------------------------------------------------------
59675 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
59672 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
59673 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
59674 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
59676 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
59677 -- 5132302
59678 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
59679 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
59680
59681 END IF;
59682
59683 -- 4955764
59684 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
59685 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
59686
59687
59688 XLA_AE_LINES_PKG.ValidateCurrentLine;
59689 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
59690
59691 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
59692 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
59693 ,p_balance_type_code => l_balance_type_code);
59694
59695 END IF;
59696
59697 -----------------------------------------------------------------------------------------
59698 -- 4262811 Multiperiod Accounting
59699 -----------------------------------------------------------------------------------------
59700 -- No MPA option is assigned.
59701
59702
59703 END IF;
59704 END IF;
59705 --
59706
59707 --
59708 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
59709 trace
59710 (p_msg => 'END of AcctLineType_247'
59711 ,p_level => C_LEVEL_PROCEDURE
59712 ,p_module => l_log_module);
59713 END IF;
59714 --
59715 EXCEPTION
59716 WHEN xla_exceptions_pkg.application_exception THEN
59717 RAISE;
59718 WHEN OTHERS THEN
59719 xla_exceptions_pkg.raise_message
59720 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_247');
59721 END AcctLineType_247;
59722 --
59723
59724 ---------------------------------------
59725 --
59726 -- PRIVATE FUNCTION
59727 -- AcctLineType_248
59728 --
59729 ---------------------------------------
59730 PROCEDURE AcctLineType_248 (
59731 p_application_id IN NUMBER
59732 ,p_event_id IN NUMBER
59733 ,p_calculate_acctd_flag IN VARCHAR2
59734 ,p_calculate_g_l_flag IN VARCHAR2
59735 ,p_actual_flag IN OUT VARCHAR2
59736 ,p_balance_type_code OUT VARCHAR2
59737 ,p_gain_or_loss_ref OUT VARCHAR2
59738
59739 --Period Close Date
59740 , p_source_1 IN DATE
59741 --Generated Code Combination Identifier
59742 , p_source_5 IN NUMBER
59743 --Revaluation Reserve Retired Loss Account
59744 , p_source_30 IN VARCHAR2
59745 --Expense Account Code Combination Identifier
59746 , p_source_31 IN NUMBER
59747 --Default Code Combination Identifier
59748 , p_source_32 IN NUMBER
59749 --Adjustment Type
59750 , p_source_48 IN VARCHAR2
59751 --Transaction Header Identifier
59752 , p_source_49 IN NUMBER
59753 --Adjustment Line Identifier
59754 , p_source_50 IN NUMBER
59755 --Distribution Type Code
59756 , p_source_51 IN VARCHAR2
59757 --Entered Amount
59758 , p_source_52 IN NUMBER
59759 --Currency Code
59760 , p_source_53 IN VARCHAR2
59761 --Gain Loss Amount
59762 , p_source_54 IN NUMBER
59763 )
59764 IS
59765
59766 l_component_type VARCHAR2(80);
59767 l_component_code VARCHAR2(30);
59768 l_component_type_code VARCHAR2(1);
59769 l_component_appl_id INTEGER;
59770 l_amb_context_code VARCHAR2(30);
59771 l_entity_code VARCHAR2(30);
59772 l_event_class_code VARCHAR2(30);
59773 l_ae_header_id NUMBER;
59774 l_event_type_code VARCHAR2(30);
59775 l_line_definition_code VARCHAR2(30);
59776 l_line_definition_owner_code VARCHAR2(1);
59777 --
59778 -- adr variables
59779 l_segment VARCHAR2(30);
59780 l_ccid NUMBER;
59781 l_adr_transaction_coa_id NUMBER;
59782 l_adr_accounting_coa_id NUMBER;
59783 l_adr_flexfield_segment_code VARCHAR2(30);
59784 l_adr_flex_value_set_id NUMBER;
59785 l_adr_value_type_code VARCHAR2(30);
59786 l_adr_value_combination_id NUMBER;
59787 l_adr_value_segment_code VARCHAR2(30);
59788
59789 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
59790 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
59791 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
59792 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
59793
59794 -- 4262811 Variables ------------------------------------------------------------------------------------------
59795 l_entered_amt_idx NUMBER;
59796 l_accted_amt_idx NUMBER;
59797 l_acc_rev_flag VARCHAR2(1);
59798 l_accrual_line_num NUMBER;
59802 l_num_entries NUMBER;
59799 l_tmp_amt NUMBER;
59800 l_acc_rev_natural_side_code VARCHAR2(1);
59801
59803 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
59804 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
59805 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
59806 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
59807 l_recog_line_1 NUMBER;
59808 l_recog_line_2 NUMBER;
59809
59810 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
59811 l_bflow_applied_to_amt NUMBER; -- 5132302
59812 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
59813
59814 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
59815
59816 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
59817 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
59818
59819 ---------------------------------------------------------------------------------------------------------------
59820
59821
59822 --
59823 -- bulk performance
59824 --
59825 l_balance_type_code VARCHAR2(1);
59826 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
59827 l_log_module VARCHAR2(240);
59828
59829 --
59830 -- Upgrade strategy
59831 --
59832 l_actual_upg_option VARCHAR2(1);
59833 l_enc_upg_option VARCHAR2(1);
59834
59835 --
59836 BEGIN
59837 --
59838 IF g_log_enabled THEN
59839 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_248';
59840 END IF;
59841 --
59842 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
59843
59844 trace
59845 (p_msg => 'BEGIN of AcctLineType_248'
59846 ,p_level => C_LEVEL_PROCEDURE
59847 ,p_module => l_log_module);
59848
59849 END IF;
59850 --
59851 l_component_type := 'AMB_JLT';
59852 l_component_code := 'FA_CIP_RET_REVAL_RESERVE_GAIN';
59853 l_component_type_code := 'S';
59854 l_component_appl_id := 140;
59855 l_amb_context_code := 'DEFAULT';
59856 l_entity_code := 'TRANSACTIONS';
59857 l_event_class_code := 'CIP_RETIREMENTS';
59858 l_event_type_code := 'CIP_REINSTATEMENTS';
59859 l_line_definition_owner_code := 'S';
59860 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
59861 --
59862 l_balance_type_code := 'A';
59863 l_segment := NULL;
59864 l_ccid := NULL;
59865 l_adr_transaction_coa_id := NULL;
59866 l_adr_accounting_coa_id := NULL;
59867 l_adr_flexfield_segment_code := NULL;
59868 l_adr_flex_value_set_id := NULL;
59869 l_adr_value_type_code := NULL;
59870 l_adr_value_combination_id := NULL;
59871 l_adr_value_segment_code := NULL;
59872
59873 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
59874 l_bflow_class_code := ''; -- 4219869 Business Flow
59875 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
59876 l_budgetary_control_flag := 'N';
59877
59878 l_bflow_applied_to_amt_idx := NULL; -- 5132302
59879 l_bflow_applied_to_amt := NULL; -- 5132302
59880 l_entered_amt_idx := NULL; -- 4262811
59881 l_accted_amt_idx := NULL; -- 4262811
59882 l_acc_rev_flag := NULL; -- 4262811
59883 l_accrual_line_num := NULL; -- 4262811
59884 l_tmp_amt := NULL; -- 4262811
59885 --
59886
59887 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
59888 l_balance_type_code <> 'B' THEN
59889 IF NVL(p_source_48,'
59890 ') = 'REVAL RSV RET' AND
59891 p_source_54 >= 0
59892 THEN
59893
59894 --
59895 XLA_AE_LINES_PKG.SetNewLine;
59896
59897 p_balance_type_code := l_balance_type_code;
59898 -- set the flag so later we will know whether the gain loss line needs to be created
59899
59900 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
59901 p_actual_flag :='A';
59902 END IF;
59903
59904 --
59905 -- bulk performance
59906 --
59907 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
59908 p_header_num => 0); -- 4262811
59909 --
59910 -- set accounting line options
59911 --
59912 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
59913 p_natural_side_code => 'C'
59914 , p_gain_or_loss_flag => 'N'
59915 , p_gl_transfer_mode_code => 'S'
59916 , p_acct_entry_type_code => 'A'
59917 , p_switch_side_flag => 'Y'
59918 , p_merge_duplicate_code => 'N'
59919 );
59920 --
59921 l_acc_rev_natural_side_code := 'D'; -- 4262811
59922 --
59923 --
59924 -- set accounting line type info
59925 --
59926 xla_ae_lines_pkg.SetAcctLineType
59927 (p_component_type => l_component_type
59928 ,p_event_type_code => l_event_type_code
59929 ,p_line_definition_owner_code => l_line_definition_owner_code
59933 ,p_accounting_line_appl_id => l_component_appl_id
59930 ,p_line_definition_code => l_line_definition_code
59931 ,p_accounting_line_code => l_component_code
59932 ,p_accounting_line_type_code => l_component_type_code
59934 ,p_amb_context_code => l_amb_context_code
59935 ,p_entity_code => l_entity_code
59936 ,p_event_class_code => l_event_class_code);
59937 --
59938 -- set accounting class
59939 --
59940 xla_ae_lines_pkg.SetAcctClass(
59941 p_accounting_class_code => 'ASSET'
59942 , p_ae_header_id => l_ae_header_id
59943 );
59944
59945 --
59946 -- set rounding class
59947 --
59948 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
59949 'ASSET';
59950
59951 --
59952 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
59953 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
59954 --
59955 -- bulk performance
59956 --
59957 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
59958
59959 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
59960 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
59961
59962 -- 4955764
59963 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
59964 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
59965
59966 -- 4458381 Public Sector Enh
59967
59968 --
59969 -- set accounting attributes for the line type
59970 --
59971 l_entered_amt_idx := 4;
59972 l_accted_amt_idx := 6;
59973 l_bflow_applied_to_amt_idx := NULL; -- 5132302
59974 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
59975 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
59976 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
59977 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
59978 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
59979 l_rec_acct_attrs.array_char_value(3) := p_source_51;
59980 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
59981 l_rec_acct_attrs.array_num_value(4) := p_source_52;
59982 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
59983 l_rec_acct_attrs.array_char_value(5) := p_source_53;
59984 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
59985 l_rec_acct_attrs.array_num_value(6) := p_source_52;
59986
59987 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
59988 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
59989
59990 ---------------------------------------------------------------------------------------------------------------
59991 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
59992 ---------------------------------------------------------------------------------------------------------------
59993 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
59994
59995 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
59996 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
59997
59998 IF xla_accounting_cache_pkg.GetValueChar
59999 (p_source_code => 'LEDGER_CATEGORY_CODE'
60000 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
60001 AND l_bflow_method_code = 'PRIOR_ENTRY'
60002 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
60003 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
60004 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
60005 )
60006 THEN
60007 xla_ae_lines_pkg.BflowUpgEntry
60008 (p_business_method_code => l_bflow_method_code
60009 ,p_business_class_code => l_bflow_class_code
60010 ,p_balance_type => l_balance_type_code);
60011 ELSE
60012 NULL;
60013 -- No business flow processing for business flow method of NONE.
60014 END IF;
60015
60016 --
60017 -- call analytical criteria
60018 --
60019
60020 --
60021 -- call description
60022 --
60023
60024 xla_ae_lines_pkg.SetLineDescription(
60025 p_ae_header_id => l_ae_header_id
60026 ,p_description => Description_40 (
60027 p_application_id => p_application_id
60028 , p_ae_header_id => l_ae_header_id
60029 , p_source_1 => p_source_1
60030 )
60031 );
60032
60033
60034 --
60035 -- call ADRs
60036 -- Bug 4922099
60037 --
60038 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
60039 (NVL(l_actual_upg_option, 'N') = 'O') OR
60040 (NVL(l_enc_upg_option, 'N') = 'O')
60041 )
60042 THEN
60043 NULL;
60044 --
60045 --
60046
60047 l_ccid := AcctDerRule_174(
60048 p_application_id => p_application_id
60049 , p_ae_header_id => l_ae_header_id
60050 , p_source_5 => p_source_5
60051 , p_source_32 => p_source_32
60055 , p_side => 'NA'
60052 , x_transaction_coa_id => l_adr_transaction_coa_id
60053 , x_accounting_coa_id => l_adr_accounting_coa_id
60054 , x_value_type_code => l_adr_value_type_code
60056 );
60057
60058 xla_ae_lines_pkg.set_ccid(
60059 p_code_combination_id => l_ccid
60060 , p_value_type_code => l_adr_value_type_code
60061 , p_transaction_coa_id => l_adr_transaction_coa_id
60062 , p_accounting_coa_id => l_adr_accounting_coa_id
60063 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
60064 , p_adr_type_code => 'S'
60065 , p_component_type => l_component_type
60066 , p_component_code => l_component_code
60067 , p_component_type_code => l_component_type_code
60068 , p_component_appl_id => l_component_appl_id
60069 , p_amb_context_code => l_amb_context_code
60070 , p_side => 'NA'
60071 );
60072
60073
60074 l_segment := AcctDerRule_169(
60075 p_application_id => p_application_id
60076 , p_ae_header_id => l_ae_header_id
60077 , p_source_5 => p_source_5
60078 , p_source_31 => p_source_31
60079 , x_transaction_coa_id => l_adr_transaction_coa_id
60080 , x_accounting_coa_id => l_adr_accounting_coa_id
60081 , x_flexfield_segment_code => l_adr_flexfield_segment_code
60082 , x_flex_value_set_id => l_adr_flex_value_set_id
60083 , x_value_type_code => l_adr_value_type_code
60084 , x_value_combination_id => l_adr_value_combination_id
60085 , x_value_segment_code => l_adr_value_segment_code
60086 , p_side => 'NA'
60087 , p_override_seg_flag => 'Y'
60088 );
60089
60090 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
60091
60092 xla_ae_lines_pkg.set_segment(
60093 p_to_segment_code => 'GL_BALANCING'
60094 , p_segment_value => l_segment
60095 , p_from_segment_code => l_adr_value_segment_code
60096 , p_from_combination_id => l_adr_value_combination_id
60097 , p_value_type_code => l_adr_value_type_code
60098 , p_transaction_coa_id => l_adr_transaction_coa_id
60099 , p_accounting_coa_id => l_adr_accounting_coa_id
60100 , p_flexfield_segment_code => l_adr_flexfield_segment_code
60101 , p_flex_value_set_id => l_adr_flex_value_set_id
60102 , p_adr_code => 'FA_EXPENSE_ACCT'
60103 , p_adr_type_code => 'S'
60104 , p_component_type => l_component_type
60105 , p_component_code => l_component_code
60106 , p_component_type_code => l_component_type_code
60107 , p_component_appl_id => l_component_appl_id
60108 , p_amb_context_code => l_amb_context_code
60109 , p_entity_code => 'TRANSACTIONS'
60110 , p_event_class_code => 'CIP_RETIREMENTS'
60111 , p_side => 'NA'
60112 );
60113
60114 END IF;
60115
60116 l_segment := AcctDerRule_167(
60117 p_application_id => p_application_id
60118 , p_ae_header_id => l_ae_header_id
60119 , p_source_5 => p_source_5
60120 , p_source_30 => p_source_30
60121 , x_transaction_coa_id => l_adr_transaction_coa_id
60122 , x_accounting_coa_id => l_adr_accounting_coa_id
60123 , x_flexfield_segment_code => l_adr_flexfield_segment_code
60124 , x_flex_value_set_id => l_adr_flex_value_set_id
60125 , x_value_type_code => l_adr_value_type_code
60126 , x_value_combination_id => l_adr_value_combination_id
60127 , x_value_segment_code => l_adr_value_segment_code
60128 , p_side => 'NA'
60129 , p_override_seg_flag => 'Y'
60130 );
60131
60132 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
60133
60134 xla_ae_lines_pkg.set_segment(
60135 p_to_segment_code => 'GL_ACCOUNT'
60136 , p_segment_value => l_segment
60137 , p_from_segment_code => l_adr_value_segment_code
60138 , p_from_combination_id => l_adr_value_combination_id
60139 , p_value_type_code => l_adr_value_type_code
60140 , p_transaction_coa_id => l_adr_transaction_coa_id
60141 , p_accounting_coa_id => l_adr_accounting_coa_id
60142 , p_flexfield_segment_code => l_adr_flexfield_segment_code
60143 , p_flex_value_set_id => l_adr_flex_value_set_id
60144 , p_adr_code => 'FA_REVAL_RES_RET_LOSS_SEGMENT'
60145 , p_adr_type_code => 'S'
60146 , p_component_type => l_component_type
60147 , p_component_code => l_component_code
60148 , p_component_type_code => l_component_type_code
60149 , p_component_appl_id => l_component_appl_id
60150 , p_amb_context_code => l_amb_context_code
60151 , p_entity_code => 'TRANSACTIONS'
60152 , p_event_class_code => 'CIP_RETIREMENTS'
60153 , p_side => 'NA'
60154 );
60155
60156 END IF;
60157
60158 --
60159 --
60160 END IF;
60161 --
60162 -- Bug 4922099
60166 (l_bflow_method_code = 'PRIOR_ENTRY')
60163 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
60164 (NVL(l_enc_upg_option, 'N') = 'O')
60165 ) AND
60167 )
60168 THEN
60169 IF
60170 --
60171 1 = 2
60172 --
60173 THEN
60174 xla_accounting_err_pkg.build_message
60175 (p_appli_s_name => 'XLA'
60176 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
60177 ,p_token_1 => 'LINE_NUMBER'
60178 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
60179 ,p_token_2 => 'LINE_TYPE_NAME'
60180 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
60181 l_component_type
60182 ,l_component_code
60183 ,l_component_type_code
60184 ,l_component_appl_id
60185 ,l_amb_context_code
60186 ,l_entity_code
60187 ,l_event_class_code
60188 )
60189 ,p_token_3 => 'OWNER'
60190 ,p_value_3 => xla_lookups_pkg.get_meaning(
60191 p_lookup_type => 'XLA_OWNER_TYPE'
60192 ,p_lookup_code => l_component_type_code
60193 )
60194 ,p_token_4 => 'PRODUCT_NAME'
60195 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
60196 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
60197 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
60198 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
60199 ,p_ae_header_id => NULL
60200 );
60201
60202 IF (C_LEVEL_ERROR>= g_log_level) THEN
60203 trace
60204 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
60205 ,p_level => C_LEVEL_ERROR
60206 ,p_module => l_log_module);
60207 END IF;
60208 END IF;
60209 END IF;
60210 --
60211 --
60212 ------------------------------------------------------------------------------------------------
60213 -- 4219869 Business Flow
60214 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
60215 -- Prior Entry. Currently, the following code is always generated.
60216 ------------------------------------------------------------------------------------------------
60217 XLA_AE_LINES_PKG.ValidateCurrentLine;
60218
60219 ------------------------------------------------------------------------------------
60220 -- 4219869 Business Flow
60221 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
60222 ------------------------------------------------------------------------------------
60223 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
60224
60225 ----------------------------------------------------------------------------------
60226 -- 4219869 Business Flow
60227 -- Update journal entry status -- Need to generate this within IF <condition>
60228 ----------------------------------------------------------------------------------
60229 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
60230 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
60231 ,p_balance_type_code => l_balance_type_code
60232 );
60233
60234 -------------------------------------------------------------------------------------------
60235 -- 4262811 - Generate the Accrual Reversal lines
60236 -------------------------------------------------------------------------------------------
60237 BEGIN
60238 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
60239 (g_array_event(p_event_id).array_value_num('header_index'));
60240 IF l_acc_rev_flag IS NULL THEN
60241 l_acc_rev_flag := 'N';
60242 END IF;
60243 EXCEPTION
60244 WHEN OTHERS THEN
60245 l_acc_rev_flag := 'N';
60246 END;
60247 --
60248 IF (l_acc_rev_flag = 'Y') THEN
60249
60250 -- 4645092 ------------------------------------------------------------------------------
60251 -- To allow MPA report to determine if it should generate report process
60252 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
60253 ------------------------------------------------------------------------------------------
60254
60255 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
60259 -- Bug 4922099
60256 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
60257 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
60258 -- call ADRs
60260 --
60261 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
60262 (NVL(l_actual_upg_option, 'N') = 'O') OR
60263 (NVL(l_enc_upg_option, 'N') = 'O')
60264 )
60265 THEN
60266 NULL;
60267 --
60268 --
60269
60270 l_ccid := AcctDerRule_174(
60271 p_application_id => p_application_id
60272 , p_ae_header_id => l_ae_header_id
60273 , p_source_5 => p_source_5
60274 , p_source_32 => p_source_32
60275 , x_transaction_coa_id => l_adr_transaction_coa_id
60276 , x_accounting_coa_id => l_adr_accounting_coa_id
60277 , x_value_type_code => l_adr_value_type_code
60278 , p_side => 'NA'
60279 );
60280
60281 xla_ae_lines_pkg.set_ccid(
60282 p_code_combination_id => l_ccid
60283 , p_value_type_code => l_adr_value_type_code
60284 , p_transaction_coa_id => l_adr_transaction_coa_id
60285 , p_accounting_coa_id => l_adr_accounting_coa_id
60286 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
60287 , p_adr_type_code => 'S'
60288 , p_component_type => l_component_type
60289 , p_component_code => l_component_code
60290 , p_component_type_code => l_component_type_code
60291 , p_component_appl_id => l_component_appl_id
60292 , p_amb_context_code => l_amb_context_code
60293 , p_side => 'NA'
60294 );
60295
60296
60297 l_segment := AcctDerRule_169(
60298 p_application_id => p_application_id
60299 , p_ae_header_id => l_ae_header_id
60300 , p_source_5 => p_source_5
60301 , p_source_31 => p_source_31
60302 , x_transaction_coa_id => l_adr_transaction_coa_id
60303 , x_accounting_coa_id => l_adr_accounting_coa_id
60304 , x_flexfield_segment_code => l_adr_flexfield_segment_code
60305 , x_flex_value_set_id => l_adr_flex_value_set_id
60306 , x_value_type_code => l_adr_value_type_code
60307 , x_value_combination_id => l_adr_value_combination_id
60308 , x_value_segment_code => l_adr_value_segment_code
60309 , p_side => 'NA'
60310 , p_override_seg_flag => 'Y'
60311 );
60312
60313 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
60314
60315 xla_ae_lines_pkg.set_segment(
60316 p_to_segment_code => 'GL_BALANCING'
60317 , p_segment_value => l_segment
60318 , p_from_segment_code => l_adr_value_segment_code
60319 , p_from_combination_id => l_adr_value_combination_id
60320 , p_value_type_code => l_adr_value_type_code
60321 , p_transaction_coa_id => l_adr_transaction_coa_id
60322 , p_accounting_coa_id => l_adr_accounting_coa_id
60323 , p_flexfield_segment_code => l_adr_flexfield_segment_code
60324 , p_flex_value_set_id => l_adr_flex_value_set_id
60325 , p_adr_code => 'FA_EXPENSE_ACCT'
60326 , p_adr_type_code => 'S'
60327 , p_component_type => l_component_type
60328 , p_component_code => l_component_code
60329 , p_component_type_code => l_component_type_code
60330 , p_component_appl_id => l_component_appl_id
60331 , p_amb_context_code => l_amb_context_code
60332 , p_entity_code => 'TRANSACTIONS'
60333 , p_event_class_code => 'CIP_RETIREMENTS'
60334 , p_side => 'NA'
60335 );
60336
60337 END IF;
60338
60339 l_segment := AcctDerRule_167(
60340 p_application_id => p_application_id
60341 , p_ae_header_id => l_ae_header_id
60342 , p_source_5 => p_source_5
60343 , p_source_30 => p_source_30
60344 , x_transaction_coa_id => l_adr_transaction_coa_id
60345 , x_accounting_coa_id => l_adr_accounting_coa_id
60346 , x_flexfield_segment_code => l_adr_flexfield_segment_code
60347 , x_flex_value_set_id => l_adr_flex_value_set_id
60348 , x_value_type_code => l_adr_value_type_code
60349 , x_value_combination_id => l_adr_value_combination_id
60350 , x_value_segment_code => l_adr_value_segment_code
60351 , p_side => 'NA'
60352 , p_override_seg_flag => 'Y'
60353 );
60354
60355 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
60356
60357 xla_ae_lines_pkg.set_segment(
60358 p_to_segment_code => 'GL_ACCOUNT'
60359 , p_segment_value => l_segment
60360 , p_from_segment_code => l_adr_value_segment_code
60361 , p_from_combination_id => l_adr_value_combination_id
60362 , p_value_type_code => l_adr_value_type_code
60363 , p_transaction_coa_id => l_adr_transaction_coa_id
60364 , p_accounting_coa_id => l_adr_accounting_coa_id
60365 , p_flexfield_segment_code => l_adr_flexfield_segment_code
60366 , p_flex_value_set_id => l_adr_flex_value_set_id
60370 , p_component_code => l_component_code
60367 , p_adr_code => 'FA_REVAL_RES_RET_LOSS_SEGMENT'
60368 , p_adr_type_code => 'S'
60369 , p_component_type => l_component_type
60371 , p_component_type_code => l_component_type_code
60372 , p_component_appl_id => l_component_appl_id
60373 , p_amb_context_code => l_amb_context_code
60374 , p_entity_code => 'TRANSACTIONS'
60375 , p_event_class_code => 'CIP_RETIREMENTS'
60376 , p_side => 'NA'
60377 );
60378
60379 END IF;
60380
60381 --
60382 --
60383 END IF;
60384
60385 --
60386 -- Update the line information that should be overwritten
60387 --
60388 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
60389 p_header_num => 1);
60390 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
60391
60392 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
60393
60394 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
60395 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
60396 END IF;
60397
60398 --
60399 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
60400 --
60401 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
60402 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
60403 ELSE
60404 ---------------------------------------------------------------------------------------------------
60405 -- 4262811a Switch Sign
60406 ---------------------------------------------------------------------------------------------------
60407 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
60408 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
60409 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
60410 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
60411 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
60412 -- 5132302
60413 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
60414 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
60415
60416 END IF;
60417
60418 -- 4955764
60419 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
60420 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
60421
60422
60423 XLA_AE_LINES_PKG.ValidateCurrentLine;
60424 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
60425
60426 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
60427 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
60428 ,p_balance_type_code => l_balance_type_code);
60429
60430 END IF;
60431
60432 -----------------------------------------------------------------------------------------
60433 -- 4262811 Multiperiod Accounting
60434 -----------------------------------------------------------------------------------------
60435 -- No MPA option is assigned.
60436
60437
60438 END IF;
60439 END IF;
60440 --
60441
60442 --
60443 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
60444 trace
60445 (p_msg => 'END of AcctLineType_248'
60446 ,p_level => C_LEVEL_PROCEDURE
60447 ,p_module => l_log_module);
60448 END IF;
60449 --
60450 EXCEPTION
60451 WHEN xla_exceptions_pkg.application_exception THEN
60452 RAISE;
60453 WHEN OTHERS THEN
60454 xla_exceptions_pkg.raise_message
60455 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_248');
60456 END AcctLineType_248;
60457 --
60458
60459 ---------------------------------------
60460 --
60461 -- PRIVATE FUNCTION
60462 -- AcctLineType_249
60463 --
60464 ---------------------------------------
60465 PROCEDURE AcctLineType_249 (
60466 p_application_id IN NUMBER
60467 ,p_event_id IN NUMBER
60468 ,p_calculate_acctd_flag IN VARCHAR2
60469 ,p_calculate_g_l_flag IN VARCHAR2
60470 ,p_actual_flag IN OUT VARCHAR2
60471 ,p_balance_type_code OUT VARCHAR2
60472 ,p_gain_or_loss_ref OUT VARCHAR2
60473
60474 --Period Close Date
60475 , p_source_1 IN DATE
60476 --Generated Code Combination Identifier
60477 , p_source_5 IN NUMBER
60478 --Revaluation Reserve Retired Loss Account
60479 , p_source_30 IN VARCHAR2
60480 --Expense Account Code Combination Identifier
60481 , p_source_31 IN NUMBER
60482 --Default Code Combination Identifier
60483 , p_source_32 IN NUMBER
60484 --Adjustment Type
60485 , p_source_48 IN VARCHAR2
60486 --Transaction Header Identifier
60487 , p_source_49 IN NUMBER
60488 --Adjustment Line Identifier
60489 , p_source_50 IN NUMBER
60493 , p_source_52 IN NUMBER
60490 --Distribution Type Code
60491 , p_source_51 IN VARCHAR2
60492 --Entered Amount
60494 --Currency Code
60495 , p_source_53 IN VARCHAR2
60496 --Gain Loss Amount
60497 , p_source_54 IN NUMBER
60498 )
60499 IS
60500
60501 l_component_type VARCHAR2(80);
60502 l_component_code VARCHAR2(30);
60503 l_component_type_code VARCHAR2(1);
60504 l_component_appl_id INTEGER;
60505 l_amb_context_code VARCHAR2(30);
60506 l_entity_code VARCHAR2(30);
60507 l_event_class_code VARCHAR2(30);
60508 l_ae_header_id NUMBER;
60509 l_event_type_code VARCHAR2(30);
60510 l_line_definition_code VARCHAR2(30);
60511 l_line_definition_owner_code VARCHAR2(1);
60512 --
60513 -- adr variables
60514 l_segment VARCHAR2(30);
60515 l_ccid NUMBER;
60516 l_adr_transaction_coa_id NUMBER;
60517 l_adr_accounting_coa_id NUMBER;
60518 l_adr_flexfield_segment_code VARCHAR2(30);
60519 l_adr_flex_value_set_id NUMBER;
60520 l_adr_value_type_code VARCHAR2(30);
60521 l_adr_value_combination_id NUMBER;
60522 l_adr_value_segment_code VARCHAR2(30);
60523
60524 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
60525 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
60526 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
60527 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
60528
60529 -- 4262811 Variables ------------------------------------------------------------------------------------------
60530 l_entered_amt_idx NUMBER;
60531 l_accted_amt_idx NUMBER;
60532 l_acc_rev_flag VARCHAR2(1);
60533 l_accrual_line_num NUMBER;
60534 l_tmp_amt NUMBER;
60535 l_acc_rev_natural_side_code VARCHAR2(1);
60536
60537 l_num_entries NUMBER;
60538 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
60539 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
60540 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
60541 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
60542 l_recog_line_1 NUMBER;
60543 l_recog_line_2 NUMBER;
60544
60545 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
60546 l_bflow_applied_to_amt NUMBER; -- 5132302
60547 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
60548
60549 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
60550
60551 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
60552 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
60553
60554 ---------------------------------------------------------------------------------------------------------------
60555
60556
60557 --
60558 -- bulk performance
60559 --
60560 l_balance_type_code VARCHAR2(1);
60561 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
60562 l_log_module VARCHAR2(240);
60563
60564 --
60565 -- Upgrade strategy
60566 --
60567 l_actual_upg_option VARCHAR2(1);
60568 l_enc_upg_option VARCHAR2(1);
60569
60570 --
60571 BEGIN
60572 --
60573 IF g_log_enabled THEN
60574 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_249';
60575 END IF;
60576 --
60577 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
60578
60579 trace
60580 (p_msg => 'BEGIN of AcctLineType_249'
60581 ,p_level => C_LEVEL_PROCEDURE
60582 ,p_module => l_log_module);
60583
60584 END IF;
60585 --
60586 l_component_type := 'AMB_JLT';
60587 l_component_code := 'FA_CIP_RET_REVAL_RESERVE_LOSS';
60588 l_component_type_code := 'S';
60589 l_component_appl_id := 140;
60590 l_amb_context_code := 'DEFAULT';
60591 l_entity_code := 'TRANSACTIONS';
60592 l_event_class_code := 'CIP_RETIREMENTS';
60593 l_event_type_code := 'CIP_REINSTATEMENTS';
60594 l_line_definition_owner_code := 'S';
60595 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE8';
60596 --
60597 l_balance_type_code := 'A';
60598 l_segment := NULL;
60599 l_ccid := NULL;
60600 l_adr_transaction_coa_id := NULL;
60601 l_adr_accounting_coa_id := NULL;
60602 l_adr_flexfield_segment_code := NULL;
60603 l_adr_flex_value_set_id := NULL;
60604 l_adr_value_type_code := NULL;
60605 l_adr_value_combination_id := NULL;
60606 l_adr_value_segment_code := NULL;
60607
60608 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
60609 l_bflow_class_code := ''; -- 4219869 Business Flow
60610 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
60611 l_budgetary_control_flag := 'N';
60612
60613 l_bflow_applied_to_amt_idx := NULL; -- 5132302
60614 l_bflow_applied_to_amt := NULL; -- 5132302
60615 l_entered_amt_idx := NULL; -- 4262811
60616 l_accted_amt_idx := NULL; -- 4262811
60617 l_acc_rev_flag := NULL; -- 4262811
60621
60618 l_accrual_line_num := NULL; -- 4262811
60619 l_tmp_amt := NULL; -- 4262811
60620 --
60622 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
60623 l_balance_type_code <> 'B' THEN
60624 IF NVL(p_source_48,'
60625 ') = 'REVAL RSV RET' AND
60626 p_source_54 < 0
60627 THEN
60628
60629 --
60630 XLA_AE_LINES_PKG.SetNewLine;
60631
60632 p_balance_type_code := l_balance_type_code;
60633 -- set the flag so later we will know whether the gain loss line needs to be created
60634
60635 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
60636 p_actual_flag :='A';
60637 END IF;
60638
60639 --
60640 -- bulk performance
60641 --
60642 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
60643 p_header_num => 0); -- 4262811
60644 --
60645 -- set accounting line options
60646 --
60647 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
60648 p_natural_side_code => 'D'
60649 , p_gain_or_loss_flag => 'N'
60650 , p_gl_transfer_mode_code => 'S'
60651 , p_acct_entry_type_code => 'A'
60652 , p_switch_side_flag => 'Y'
60653 , p_merge_duplicate_code => 'N'
60654 );
60655 --
60656 l_acc_rev_natural_side_code := 'C'; -- 4262811
60657 --
60658 --
60659 -- set accounting line type info
60660 --
60661 xla_ae_lines_pkg.SetAcctLineType
60662 (p_component_type => l_component_type
60663 ,p_event_type_code => l_event_type_code
60664 ,p_line_definition_owner_code => l_line_definition_owner_code
60665 ,p_line_definition_code => l_line_definition_code
60666 ,p_accounting_line_code => l_component_code
60667 ,p_accounting_line_type_code => l_component_type_code
60668 ,p_accounting_line_appl_id => l_component_appl_id
60669 ,p_amb_context_code => l_amb_context_code
60670 ,p_entity_code => l_entity_code
60671 ,p_event_class_code => l_event_class_code);
60672 --
60673 -- set accounting class
60674 --
60675 xla_ae_lines_pkg.SetAcctClass(
60676 p_accounting_class_code => 'ASSET'
60677 , p_ae_header_id => l_ae_header_id
60678 );
60679
60680 --
60681 -- set rounding class
60682 --
60683 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
60684 'ASSET';
60685
60686 --
60687 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
60688 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
60689 --
60690 -- bulk performance
60691 --
60692 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
60693
60694 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
60695 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
60696
60697 -- 4955764
60698 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
60699 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
60700
60701 -- 4458381 Public Sector Enh
60702
60703 --
60704 -- set accounting attributes for the line type
60705 --
60706 l_entered_amt_idx := 4;
60707 l_accted_amt_idx := 6;
60708 l_bflow_applied_to_amt_idx := NULL; -- 5132302
60709 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
60710 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
60711 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
60712 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
60713 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
60714 l_rec_acct_attrs.array_char_value(3) := p_source_51;
60715 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
60716 l_rec_acct_attrs.array_num_value(4) := p_source_52;
60717 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
60718 l_rec_acct_attrs.array_char_value(5) := p_source_53;
60719 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
60720 l_rec_acct_attrs.array_num_value(6) := p_source_52;
60721
60722 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
60723 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
60724
60725 ---------------------------------------------------------------------------------------------------------------
60726 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
60727 ---------------------------------------------------------------------------------------------------------------
60728 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
60729
60730 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
60731 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
60732
60733 IF xla_accounting_cache_pkg.GetValueChar
60737 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
60734 (p_source_code => 'LEDGER_CATEGORY_CODE'
60735 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
60736 AND l_bflow_method_code = 'PRIOR_ENTRY'
60738 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
60739 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
60740 )
60741 THEN
60742 xla_ae_lines_pkg.BflowUpgEntry
60743 (p_business_method_code => l_bflow_method_code
60744 ,p_business_class_code => l_bflow_class_code
60745 ,p_balance_type => l_balance_type_code);
60746 ELSE
60747 NULL;
60748 -- No business flow processing for business flow method of NONE.
60749 END IF;
60750
60751 --
60752 -- call analytical criteria
60753 --
60754
60755 --
60756 -- call description
60757 --
60758
60759 xla_ae_lines_pkg.SetLineDescription(
60760 p_ae_header_id => l_ae_header_id
60761 ,p_description => Description_39 (
60762 p_application_id => p_application_id
60763 , p_ae_header_id => l_ae_header_id
60764 , p_source_1 => p_source_1
60765 )
60766 );
60767
60768
60769 --
60770 -- call ADRs
60771 -- Bug 4922099
60772 --
60773 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
60774 (NVL(l_actual_upg_option, 'N') = 'O') OR
60775 (NVL(l_enc_upg_option, 'N') = 'O')
60776 )
60777 THEN
60778 NULL;
60779 --
60780 --
60781
60782 l_ccid := AcctDerRule_174(
60783 p_application_id => p_application_id
60784 , p_ae_header_id => l_ae_header_id
60785 , p_source_5 => p_source_5
60786 , p_source_32 => p_source_32
60787 , x_transaction_coa_id => l_adr_transaction_coa_id
60788 , x_accounting_coa_id => l_adr_accounting_coa_id
60789 , x_value_type_code => l_adr_value_type_code
60790 , p_side => 'NA'
60791 );
60792
60793 xla_ae_lines_pkg.set_ccid(
60794 p_code_combination_id => l_ccid
60795 , p_value_type_code => l_adr_value_type_code
60796 , p_transaction_coa_id => l_adr_transaction_coa_id
60797 , p_accounting_coa_id => l_adr_accounting_coa_id
60798 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
60799 , p_adr_type_code => 'S'
60800 , p_component_type => l_component_type
60801 , p_component_code => l_component_code
60802 , p_component_type_code => l_component_type_code
60803 , p_component_appl_id => l_component_appl_id
60804 , p_amb_context_code => l_amb_context_code
60805 , p_side => 'NA'
60806 );
60807
60808
60809 l_segment := AcctDerRule_169(
60810 p_application_id => p_application_id
60811 , p_ae_header_id => l_ae_header_id
60812 , p_source_5 => p_source_5
60813 , p_source_31 => p_source_31
60814 , x_transaction_coa_id => l_adr_transaction_coa_id
60815 , x_accounting_coa_id => l_adr_accounting_coa_id
60816 , x_flexfield_segment_code => l_adr_flexfield_segment_code
60817 , x_flex_value_set_id => l_adr_flex_value_set_id
60818 , x_value_type_code => l_adr_value_type_code
60819 , x_value_combination_id => l_adr_value_combination_id
60820 , x_value_segment_code => l_adr_value_segment_code
60821 , p_side => 'NA'
60822 , p_override_seg_flag => 'Y'
60823 );
60824
60825 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
60826
60827 xla_ae_lines_pkg.set_segment(
60828 p_to_segment_code => 'GL_BALANCING'
60829 , p_segment_value => l_segment
60830 , p_from_segment_code => l_adr_value_segment_code
60831 , p_from_combination_id => l_adr_value_combination_id
60832 , p_value_type_code => l_adr_value_type_code
60833 , p_transaction_coa_id => l_adr_transaction_coa_id
60834 , p_accounting_coa_id => l_adr_accounting_coa_id
60835 , p_flexfield_segment_code => l_adr_flexfield_segment_code
60836 , p_flex_value_set_id => l_adr_flex_value_set_id
60837 , p_adr_code => 'FA_EXPENSE_ACCT'
60838 , p_adr_type_code => 'S'
60839 , p_component_type => l_component_type
60840 , p_component_code => l_component_code
60841 , p_component_type_code => l_component_type_code
60842 , p_component_appl_id => l_component_appl_id
60843 , p_amb_context_code => l_amb_context_code
60844 , p_entity_code => 'TRANSACTIONS'
60845 , p_event_class_code => 'CIP_RETIREMENTS'
60846 , p_side => 'NA'
60847 );
60848
60849 END IF;
60850
60851 l_segment := AcctDerRule_167(
60852 p_application_id => p_application_id
60853 , p_ae_header_id => l_ae_header_id
60854 , p_source_5 => p_source_5
60855 , p_source_30 => p_source_30
60856 , x_transaction_coa_id => l_adr_transaction_coa_id
60860 , x_value_type_code => l_adr_value_type_code
60857 , x_accounting_coa_id => l_adr_accounting_coa_id
60858 , x_flexfield_segment_code => l_adr_flexfield_segment_code
60859 , x_flex_value_set_id => l_adr_flex_value_set_id
60861 , x_value_combination_id => l_adr_value_combination_id
60862 , x_value_segment_code => l_adr_value_segment_code
60863 , p_side => 'NA'
60864 , p_override_seg_flag => 'Y'
60865 );
60866
60867 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
60868
60869 xla_ae_lines_pkg.set_segment(
60870 p_to_segment_code => 'GL_ACCOUNT'
60871 , p_segment_value => l_segment
60872 , p_from_segment_code => l_adr_value_segment_code
60873 , p_from_combination_id => l_adr_value_combination_id
60874 , p_value_type_code => l_adr_value_type_code
60875 , p_transaction_coa_id => l_adr_transaction_coa_id
60876 , p_accounting_coa_id => l_adr_accounting_coa_id
60877 , p_flexfield_segment_code => l_adr_flexfield_segment_code
60878 , p_flex_value_set_id => l_adr_flex_value_set_id
60879 , p_adr_code => 'FA_REVAL_RES_RET_LOSS_SEGMENT'
60880 , p_adr_type_code => 'S'
60881 , p_component_type => l_component_type
60882 , p_component_code => l_component_code
60883 , p_component_type_code => l_component_type_code
60884 , p_component_appl_id => l_component_appl_id
60885 , p_amb_context_code => l_amb_context_code
60886 , p_entity_code => 'TRANSACTIONS'
60887 , p_event_class_code => 'CIP_RETIREMENTS'
60888 , p_side => 'NA'
60889 );
60890
60891 END IF;
60892
60893 --
60894 --
60895 END IF;
60896 --
60897 -- Bug 4922099
60898 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
60899 (NVL(l_enc_upg_option, 'N') = 'O')
60900 ) AND
60901 (l_bflow_method_code = 'PRIOR_ENTRY')
60902 )
60903 THEN
60904 IF
60905 --
60906 1 = 2
60907 --
60908 THEN
60909 xla_accounting_err_pkg.build_message
60910 (p_appli_s_name => 'XLA'
60911 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
60912 ,p_token_1 => 'LINE_NUMBER'
60913 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
60914 ,p_token_2 => 'LINE_TYPE_NAME'
60915 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
60916 l_component_type
60917 ,l_component_code
60918 ,l_component_type_code
60919 ,l_component_appl_id
60920 ,l_amb_context_code
60921 ,l_entity_code
60922 ,l_event_class_code
60923 )
60924 ,p_token_3 => 'OWNER'
60925 ,p_value_3 => xla_lookups_pkg.get_meaning(
60926 p_lookup_type => 'XLA_OWNER_TYPE'
60927 ,p_lookup_code => l_component_type_code
60928 )
60929 ,p_token_4 => 'PRODUCT_NAME'
60930 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
60931 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
60932 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
60933 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
60934 ,p_ae_header_id => NULL
60935 );
60936
60937 IF (C_LEVEL_ERROR>= g_log_level) THEN
60938 trace
60939 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
60940 ,p_level => C_LEVEL_ERROR
60941 ,p_module => l_log_module);
60942 END IF;
60943 END IF;
60944 END IF;
60945 --
60946 --
60947 ------------------------------------------------------------------------------------------------
60948 -- 4219869 Business Flow
60949 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
60950 -- Prior Entry. Currently, the following code is always generated.
60951 ------------------------------------------------------------------------------------------------
60952 XLA_AE_LINES_PKG.ValidateCurrentLine;
60953
60957 ------------------------------------------------------------------------------------
60954 ------------------------------------------------------------------------------------
60955 -- 4219869 Business Flow
60956 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
60958 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
60959
60960 ----------------------------------------------------------------------------------
60961 -- 4219869 Business Flow
60962 -- Update journal entry status -- Need to generate this within IF <condition>
60963 ----------------------------------------------------------------------------------
60964 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
60965 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
60966 ,p_balance_type_code => l_balance_type_code
60967 );
60968
60969 -------------------------------------------------------------------------------------------
60970 -- 4262811 - Generate the Accrual Reversal lines
60971 -------------------------------------------------------------------------------------------
60972 BEGIN
60973 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
60974 (g_array_event(p_event_id).array_value_num('header_index'));
60975 IF l_acc_rev_flag IS NULL THEN
60976 l_acc_rev_flag := 'N';
60977 END IF;
60978 EXCEPTION
60979 WHEN OTHERS THEN
60980 l_acc_rev_flag := 'N';
60981 END;
60982 --
60983 IF (l_acc_rev_flag = 'Y') THEN
60984
60985 -- 4645092 ------------------------------------------------------------------------------
60986 -- To allow MPA report to determine if it should generate report process
60987 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
60988 ------------------------------------------------------------------------------------------
60989
60990 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
60991 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
60992 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
60993 -- call ADRs
60994 -- Bug 4922099
60995 --
60996 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
60997 (NVL(l_actual_upg_option, 'N') = 'O') OR
60998 (NVL(l_enc_upg_option, 'N') = 'O')
60999 )
61000 THEN
61001 NULL;
61002 --
61003 --
61004
61005 l_ccid := AcctDerRule_174(
61006 p_application_id => p_application_id
61007 , p_ae_header_id => l_ae_header_id
61008 , p_source_5 => p_source_5
61009 , p_source_32 => p_source_32
61010 , x_transaction_coa_id => l_adr_transaction_coa_id
61011 , x_accounting_coa_id => l_adr_accounting_coa_id
61012 , x_value_type_code => l_adr_value_type_code
61013 , p_side => 'NA'
61014 );
61015
61016 xla_ae_lines_pkg.set_ccid(
61017 p_code_combination_id => l_ccid
61018 , p_value_type_code => l_adr_value_type_code
61019 , p_transaction_coa_id => l_adr_transaction_coa_id
61020 , p_accounting_coa_id => l_adr_accounting_coa_id
61021 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
61022 , p_adr_type_code => 'S'
61023 , p_component_type => l_component_type
61024 , p_component_code => l_component_code
61025 , p_component_type_code => l_component_type_code
61026 , p_component_appl_id => l_component_appl_id
61027 , p_amb_context_code => l_amb_context_code
61028 , p_side => 'NA'
61029 );
61030
61031
61032 l_segment := AcctDerRule_169(
61033 p_application_id => p_application_id
61034 , p_ae_header_id => l_ae_header_id
61035 , p_source_5 => p_source_5
61036 , p_source_31 => p_source_31
61037 , x_transaction_coa_id => l_adr_transaction_coa_id
61038 , x_accounting_coa_id => l_adr_accounting_coa_id
61039 , x_flexfield_segment_code => l_adr_flexfield_segment_code
61040 , x_flex_value_set_id => l_adr_flex_value_set_id
61041 , x_value_type_code => l_adr_value_type_code
61042 , x_value_combination_id => l_adr_value_combination_id
61043 , x_value_segment_code => l_adr_value_segment_code
61044 , p_side => 'NA'
61045 , p_override_seg_flag => 'Y'
61046 );
61047
61048 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
61049
61050 xla_ae_lines_pkg.set_segment(
61051 p_to_segment_code => 'GL_BALANCING'
61052 , p_segment_value => l_segment
61053 , p_from_segment_code => l_adr_value_segment_code
61054 , p_from_combination_id => l_adr_value_combination_id
61055 , p_value_type_code => l_adr_value_type_code
61056 , p_transaction_coa_id => l_adr_transaction_coa_id
61057 , p_accounting_coa_id => l_adr_accounting_coa_id
61058 , p_flexfield_segment_code => l_adr_flexfield_segment_code
61059 , p_flex_value_set_id => l_adr_flex_value_set_id
61060 , p_adr_code => 'FA_EXPENSE_ACCT'
61061 , p_adr_type_code => 'S'
61062 , p_component_type => l_component_type
61063 , p_component_code => l_component_code
61067 , p_entity_code => 'TRANSACTIONS'
61064 , p_component_type_code => l_component_type_code
61065 , p_component_appl_id => l_component_appl_id
61066 , p_amb_context_code => l_amb_context_code
61068 , p_event_class_code => 'CIP_RETIREMENTS'
61069 , p_side => 'NA'
61070 );
61071
61072 END IF;
61073
61074 l_segment := AcctDerRule_167(
61075 p_application_id => p_application_id
61076 , p_ae_header_id => l_ae_header_id
61077 , p_source_5 => p_source_5
61078 , p_source_30 => p_source_30
61079 , x_transaction_coa_id => l_adr_transaction_coa_id
61080 , x_accounting_coa_id => l_adr_accounting_coa_id
61081 , x_flexfield_segment_code => l_adr_flexfield_segment_code
61082 , x_flex_value_set_id => l_adr_flex_value_set_id
61083 , x_value_type_code => l_adr_value_type_code
61084 , x_value_combination_id => l_adr_value_combination_id
61085 , x_value_segment_code => l_adr_value_segment_code
61086 , p_side => 'NA'
61087 , p_override_seg_flag => 'Y'
61088 );
61089
61090 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
61091
61092 xla_ae_lines_pkg.set_segment(
61093 p_to_segment_code => 'GL_ACCOUNT'
61094 , p_segment_value => l_segment
61095 , p_from_segment_code => l_adr_value_segment_code
61096 , p_from_combination_id => l_adr_value_combination_id
61097 , p_value_type_code => l_adr_value_type_code
61098 , p_transaction_coa_id => l_adr_transaction_coa_id
61099 , p_accounting_coa_id => l_adr_accounting_coa_id
61100 , p_flexfield_segment_code => l_adr_flexfield_segment_code
61101 , p_flex_value_set_id => l_adr_flex_value_set_id
61102 , p_adr_code => 'FA_REVAL_RES_RET_LOSS_SEGMENT'
61103 , p_adr_type_code => 'S'
61104 , p_component_type => l_component_type
61105 , p_component_code => l_component_code
61106 , p_component_type_code => l_component_type_code
61107 , p_component_appl_id => l_component_appl_id
61108 , p_amb_context_code => l_amb_context_code
61109 , p_entity_code => 'TRANSACTIONS'
61110 , p_event_class_code => 'CIP_RETIREMENTS'
61111 , p_side => 'NA'
61112 );
61113
61114 END IF;
61115
61116 --
61117 --
61118 END IF;
61119
61120 --
61121 -- Update the line information that should be overwritten
61122 --
61123 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
61124 p_header_num => 1);
61125 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
61126
61127 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
61128
61129 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
61130 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
61131 END IF;
61132
61133 --
61134 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
61135 --
61136 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
61137 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
61138 ELSE
61139 ---------------------------------------------------------------------------------------------------
61140 -- 4262811a Switch Sign
61141 ---------------------------------------------------------------------------------------------------
61142 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
61143 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
61144 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
61145 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
61146 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
61147 -- 5132302
61148 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
61149 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
61150
61151 END IF;
61152
61153 -- 4955764
61154 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
61155 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
61156
61157
61158 XLA_AE_LINES_PKG.ValidateCurrentLine;
61159 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
61160
61161 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
61162 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
61163 ,p_balance_type_code => l_balance_type_code);
61164
61165 END IF;
61166
61167 -----------------------------------------------------------------------------------------
61168 -- 4262811 Multiperiod Accounting
61172
61169 -----------------------------------------------------------------------------------------
61170 -- No MPA option is assigned.
61171
61173 END IF;
61174 END IF;
61175 --
61176
61177 --
61178 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
61179 trace
61180 (p_msg => 'END of AcctLineType_249'
61181 ,p_level => C_LEVEL_PROCEDURE
61182 ,p_module => l_log_module);
61183 END IF;
61184 --
61185 EXCEPTION
61186 WHEN xla_exceptions_pkg.application_exception THEN
61187 RAISE;
61188 WHEN OTHERS THEN
61189 xla_exceptions_pkg.raise_message
61190 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_249');
61191 END AcctLineType_249;
61192 --
61193
61194 ---------------------------------------
61195 --
61196 -- PRIVATE FUNCTION
61197 -- AcctLineType_250
61198 --
61199 ---------------------------------------
61200 PROCEDURE AcctLineType_250 (
61201 p_application_id IN NUMBER
61202 ,p_event_id IN NUMBER
61203 ,p_calculate_acctd_flag IN VARCHAR2
61204 ,p_calculate_g_l_flag IN VARCHAR2
61205 ,p_actual_flag IN OUT VARCHAR2
61206 ,p_balance_type_code OUT VARCHAR2
61207 ,p_gain_or_loss_ref OUT VARCHAR2
61208
61209 --Period Close Date
61210 , p_source_1 IN DATE
61211 --Generated Code Combination Identifier
61212 , p_source_5 IN NUMBER
61213 --Revaluation Reserve Retired Loss Account
61214 , p_source_30 IN VARCHAR2
61215 --Expense Account Code Combination Identifier
61216 , p_source_31 IN NUMBER
61217 --Default Code Combination Identifier
61218 , p_source_32 IN NUMBER
61219 --Adjustment Type
61220 , p_source_48 IN VARCHAR2
61221 --Transaction Header Identifier
61222 , p_source_49 IN NUMBER
61223 --Adjustment Line Identifier
61224 , p_source_50 IN NUMBER
61225 --Distribution Type Code
61226 , p_source_51 IN VARCHAR2
61227 --Entered Amount
61228 , p_source_52 IN NUMBER
61229 --Currency Code
61230 , p_source_53 IN VARCHAR2
61231 --Gain Loss Amount
61232 , p_source_54 IN NUMBER
61233 )
61234 IS
61235
61236 l_component_type VARCHAR2(80);
61237 l_component_code VARCHAR2(30);
61238 l_component_type_code VARCHAR2(1);
61239 l_component_appl_id INTEGER;
61240 l_amb_context_code VARCHAR2(30);
61241 l_entity_code VARCHAR2(30);
61242 l_event_class_code VARCHAR2(30);
61243 l_ae_header_id NUMBER;
61244 l_event_type_code VARCHAR2(30);
61245 l_line_definition_code VARCHAR2(30);
61246 l_line_definition_owner_code VARCHAR2(1);
61247 --
61248 -- adr variables
61249 l_segment VARCHAR2(30);
61250 l_ccid NUMBER;
61251 l_adr_transaction_coa_id NUMBER;
61252 l_adr_accounting_coa_id NUMBER;
61253 l_adr_flexfield_segment_code VARCHAR2(30);
61254 l_adr_flex_value_set_id NUMBER;
61255 l_adr_value_type_code VARCHAR2(30);
61256 l_adr_value_combination_id NUMBER;
61257 l_adr_value_segment_code VARCHAR2(30);
61258
61259 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
61260 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
61261 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
61262 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
61263
61264 -- 4262811 Variables ------------------------------------------------------------------------------------------
61265 l_entered_amt_idx NUMBER;
61266 l_accted_amt_idx NUMBER;
61267 l_acc_rev_flag VARCHAR2(1);
61268 l_accrual_line_num NUMBER;
61269 l_tmp_amt NUMBER;
61270 l_acc_rev_natural_side_code VARCHAR2(1);
61271
61272 l_num_entries NUMBER;
61273 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
61274 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
61275 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
61276 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
61277 l_recog_line_1 NUMBER;
61278 l_recog_line_2 NUMBER;
61279
61280 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
61281 l_bflow_applied_to_amt NUMBER; -- 5132302
61282 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
61283
61284 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
61285
61286 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
61287 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
61288
61289 ---------------------------------------------------------------------------------------------------------------
61290
61291
61292 --
61293 -- bulk performance
61294 --
61295 l_balance_type_code VARCHAR2(1);
61296 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
61297 l_log_module VARCHAR2(240);
61298
61299 --
61300 -- Upgrade strategy
61301 --
61302 l_actual_upg_option VARCHAR2(1);
61306 BEGIN
61303 l_enc_upg_option VARCHAR2(1);
61304
61305 --
61307 --
61308 IF g_log_enabled THEN
61309 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_250';
61310 END IF;
61311 --
61312 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
61313
61314 trace
61315 (p_msg => 'BEGIN of AcctLineType_250'
61316 ,p_level => C_LEVEL_PROCEDURE
61317 ,p_module => l_log_module);
61318
61319 END IF;
61320 --
61321 l_component_type := 'AMB_JLT';
61322 l_component_code := 'FA_CIP_RET_REVAL_RESERVE_LOSS';
61323 l_component_type_code := 'S';
61324 l_component_appl_id := 140;
61325 l_amb_context_code := 'DEFAULT';
61326 l_entity_code := 'TRANSACTIONS';
61327 l_event_class_code := 'CIP_RETIREMENTS';
61328 l_event_type_code := 'CIP_RETIREMENTS';
61329 l_line_definition_owner_code := 'S';
61330 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_RE9';
61331 --
61332 l_balance_type_code := 'A';
61333 l_segment := NULL;
61334 l_ccid := NULL;
61335 l_adr_transaction_coa_id := NULL;
61336 l_adr_accounting_coa_id := NULL;
61337 l_adr_flexfield_segment_code := NULL;
61338 l_adr_flex_value_set_id := NULL;
61339 l_adr_value_type_code := NULL;
61340 l_adr_value_combination_id := NULL;
61341 l_adr_value_segment_code := NULL;
61342
61343 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
61344 l_bflow_class_code := ''; -- 4219869 Business Flow
61345 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
61346 l_budgetary_control_flag := 'N';
61347
61348 l_bflow_applied_to_amt_idx := NULL; -- 5132302
61349 l_bflow_applied_to_amt := NULL; -- 5132302
61350 l_entered_amt_idx := NULL; -- 4262811
61351 l_accted_amt_idx := NULL; -- 4262811
61352 l_acc_rev_flag := NULL; -- 4262811
61353 l_accrual_line_num := NULL; -- 4262811
61354 l_tmp_amt := NULL; -- 4262811
61355 --
61356
61357 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
61358 l_balance_type_code <> 'B' THEN
61359 IF NVL(p_source_48,'
61360 ') = 'REVAL RSV RET' AND
61361 p_source_54 < 0
61362 THEN
61363
61364 --
61365 XLA_AE_LINES_PKG.SetNewLine;
61366
61367 p_balance_type_code := l_balance_type_code;
61368 -- set the flag so later we will know whether the gain loss line needs to be created
61369
61370 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
61371 p_actual_flag :='A';
61372 END IF;
61373
61374 --
61375 -- bulk performance
61376 --
61377 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
61378 p_header_num => 0); -- 4262811
61379 --
61380 -- set accounting line options
61381 --
61382 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
61383 p_natural_side_code => 'D'
61384 , p_gain_or_loss_flag => 'N'
61385 , p_gl_transfer_mode_code => 'S'
61386 , p_acct_entry_type_code => 'A'
61387 , p_switch_side_flag => 'Y'
61388 , p_merge_duplicate_code => 'N'
61389 );
61390 --
61391 l_acc_rev_natural_side_code := 'C'; -- 4262811
61392 --
61393 --
61394 -- set accounting line type info
61395 --
61396 xla_ae_lines_pkg.SetAcctLineType
61397 (p_component_type => l_component_type
61398 ,p_event_type_code => l_event_type_code
61399 ,p_line_definition_owner_code => l_line_definition_owner_code
61400 ,p_line_definition_code => l_line_definition_code
61401 ,p_accounting_line_code => l_component_code
61402 ,p_accounting_line_type_code => l_component_type_code
61403 ,p_accounting_line_appl_id => l_component_appl_id
61404 ,p_amb_context_code => l_amb_context_code
61405 ,p_entity_code => l_entity_code
61406 ,p_event_class_code => l_event_class_code);
61407 --
61408 -- set accounting class
61409 --
61410 xla_ae_lines_pkg.SetAcctClass(
61411 p_accounting_class_code => 'ASSET'
61412 , p_ae_header_id => l_ae_header_id
61413 );
61414
61415 --
61416 -- set rounding class
61417 --
61418 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
61419 'ASSET';
61420
61421 --
61422 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
61423 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
61424 --
61425 -- bulk performance
61426 --
61427 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
61428
61429 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
61430 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
61431
61432 -- 4955764
61433 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
61437
61434 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
61435
61436 -- 4458381 Public Sector Enh
61438 --
61439 -- set accounting attributes for the line type
61440 --
61441 l_entered_amt_idx := 4;
61442 l_accted_amt_idx := 6;
61443 l_bflow_applied_to_amt_idx := NULL; -- 5132302
61444 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
61445 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
61446 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
61447 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
61448 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
61449 l_rec_acct_attrs.array_char_value(3) := p_source_51;
61450 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
61451 l_rec_acct_attrs.array_num_value(4) := p_source_52;
61452 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
61453 l_rec_acct_attrs.array_char_value(5) := p_source_53;
61454 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
61455 l_rec_acct_attrs.array_num_value(6) := p_source_52;
61456
61457 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
61458 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
61459
61460 ---------------------------------------------------------------------------------------------------------------
61461 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
61462 ---------------------------------------------------------------------------------------------------------------
61463 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
61464
61465 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
61466 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
61467
61468 IF xla_accounting_cache_pkg.GetValueChar
61469 (p_source_code => 'LEDGER_CATEGORY_CODE'
61470 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
61471 AND l_bflow_method_code = 'PRIOR_ENTRY'
61472 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
61473 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
61474 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
61475 )
61476 THEN
61477 xla_ae_lines_pkg.BflowUpgEntry
61478 (p_business_method_code => l_bflow_method_code
61479 ,p_business_class_code => l_bflow_class_code
61480 ,p_balance_type => l_balance_type_code);
61481 ELSE
61482 NULL;
61483 -- No business flow processing for business flow method of NONE.
61484 END IF;
61485
61486 --
61487 -- call analytical criteria
61488 --
61489
61490 --
61491 -- call description
61492 --
61493
61494 xla_ae_lines_pkg.SetLineDescription(
61495 p_ae_header_id => l_ae_header_id
61496 ,p_description => Description_40 (
61497 p_application_id => p_application_id
61498 , p_ae_header_id => l_ae_header_id
61499 , p_source_1 => p_source_1
61500 )
61501 );
61502
61503
61504 --
61505 -- call ADRs
61506 -- Bug 4922099
61507 --
61508 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
61509 (NVL(l_actual_upg_option, 'N') = 'O') OR
61510 (NVL(l_enc_upg_option, 'N') = 'O')
61511 )
61512 THEN
61513 NULL;
61514 --
61515 --
61516
61517 l_ccid := AcctDerRule_174(
61518 p_application_id => p_application_id
61519 , p_ae_header_id => l_ae_header_id
61520 , p_source_5 => p_source_5
61521 , p_source_32 => p_source_32
61522 , x_transaction_coa_id => l_adr_transaction_coa_id
61523 , x_accounting_coa_id => l_adr_accounting_coa_id
61524 , x_value_type_code => l_adr_value_type_code
61525 , p_side => 'NA'
61526 );
61527
61528 xla_ae_lines_pkg.set_ccid(
61529 p_code_combination_id => l_ccid
61530 , p_value_type_code => l_adr_value_type_code
61531 , p_transaction_coa_id => l_adr_transaction_coa_id
61532 , p_accounting_coa_id => l_adr_accounting_coa_id
61533 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
61534 , p_adr_type_code => 'S'
61535 , p_component_type => l_component_type
61536 , p_component_code => l_component_code
61537 , p_component_type_code => l_component_type_code
61538 , p_component_appl_id => l_component_appl_id
61539 , p_amb_context_code => l_amb_context_code
61540 , p_side => 'NA'
61541 );
61542
61543
61544 l_segment := AcctDerRule_169(
61545 p_application_id => p_application_id
61546 , p_ae_header_id => l_ae_header_id
61547 , p_source_5 => p_source_5
61548 , p_source_31 => p_source_31
61549 , x_transaction_coa_id => l_adr_transaction_coa_id
61550 , x_accounting_coa_id => l_adr_accounting_coa_id
61551 , x_flexfield_segment_code => l_adr_flexfield_segment_code
61552 , x_flex_value_set_id => l_adr_flex_value_set_id
61556 , p_side => 'NA'
61553 , x_value_type_code => l_adr_value_type_code
61554 , x_value_combination_id => l_adr_value_combination_id
61555 , x_value_segment_code => l_adr_value_segment_code
61557 , p_override_seg_flag => 'Y'
61558 );
61559
61560 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
61561
61562 xla_ae_lines_pkg.set_segment(
61563 p_to_segment_code => 'GL_BALANCING'
61564 , p_segment_value => l_segment
61565 , p_from_segment_code => l_adr_value_segment_code
61566 , p_from_combination_id => l_adr_value_combination_id
61567 , p_value_type_code => l_adr_value_type_code
61568 , p_transaction_coa_id => l_adr_transaction_coa_id
61569 , p_accounting_coa_id => l_adr_accounting_coa_id
61570 , p_flexfield_segment_code => l_adr_flexfield_segment_code
61571 , p_flex_value_set_id => l_adr_flex_value_set_id
61572 , p_adr_code => 'FA_EXPENSE_ACCT'
61573 , p_adr_type_code => 'S'
61574 , p_component_type => l_component_type
61575 , p_component_code => l_component_code
61576 , p_component_type_code => l_component_type_code
61577 , p_component_appl_id => l_component_appl_id
61578 , p_amb_context_code => l_amb_context_code
61579 , p_entity_code => 'TRANSACTIONS'
61580 , p_event_class_code => 'CIP_RETIREMENTS'
61581 , p_side => 'NA'
61582 );
61583
61584 END IF;
61585
61586 l_segment := AcctDerRule_167(
61587 p_application_id => p_application_id
61588 , p_ae_header_id => l_ae_header_id
61589 , p_source_5 => p_source_5
61590 , p_source_30 => p_source_30
61591 , x_transaction_coa_id => l_adr_transaction_coa_id
61592 , x_accounting_coa_id => l_adr_accounting_coa_id
61593 , x_flexfield_segment_code => l_adr_flexfield_segment_code
61594 , x_flex_value_set_id => l_adr_flex_value_set_id
61595 , x_value_type_code => l_adr_value_type_code
61596 , x_value_combination_id => l_adr_value_combination_id
61597 , x_value_segment_code => l_adr_value_segment_code
61598 , p_side => 'NA'
61599 , p_override_seg_flag => 'Y'
61600 );
61601
61602 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
61603
61604 xla_ae_lines_pkg.set_segment(
61605 p_to_segment_code => 'GL_ACCOUNT'
61606 , p_segment_value => l_segment
61607 , p_from_segment_code => l_adr_value_segment_code
61608 , p_from_combination_id => l_adr_value_combination_id
61609 , p_value_type_code => l_adr_value_type_code
61610 , p_transaction_coa_id => l_adr_transaction_coa_id
61611 , p_accounting_coa_id => l_adr_accounting_coa_id
61612 , p_flexfield_segment_code => l_adr_flexfield_segment_code
61613 , p_flex_value_set_id => l_adr_flex_value_set_id
61614 , p_adr_code => 'FA_REVAL_RES_RET_LOSS_SEGMENT'
61615 , p_adr_type_code => 'S'
61616 , p_component_type => l_component_type
61617 , p_component_code => l_component_code
61618 , p_component_type_code => l_component_type_code
61619 , p_component_appl_id => l_component_appl_id
61620 , p_amb_context_code => l_amb_context_code
61621 , p_entity_code => 'TRANSACTIONS'
61622 , p_event_class_code => 'CIP_RETIREMENTS'
61623 , p_side => 'NA'
61624 );
61625
61626 END IF;
61627
61628 --
61629 --
61630 END IF;
61631 --
61632 -- Bug 4922099
61633 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
61634 (NVL(l_enc_upg_option, 'N') = 'O')
61635 ) AND
61636 (l_bflow_method_code = 'PRIOR_ENTRY')
61637 )
61638 THEN
61639 IF
61640 --
61641 1 = 2
61642 --
61643 THEN
61644 xla_accounting_err_pkg.build_message
61645 (p_appli_s_name => 'XLA'
61646 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
61647 ,p_token_1 => 'LINE_NUMBER'
61648 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
61649 ,p_token_2 => 'LINE_TYPE_NAME'
61650 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
61651 l_component_type
61652 ,l_component_code
61653 ,l_component_type_code
61654 ,l_component_appl_id
61655 ,l_amb_context_code
61656 ,l_entity_code
61657 ,l_event_class_code
61658 )
61662 ,p_lookup_code => l_component_type_code
61659 ,p_token_3 => 'OWNER'
61660 ,p_value_3 => xla_lookups_pkg.get_meaning(
61661 p_lookup_type => 'XLA_OWNER_TYPE'
61663 )
61664 ,p_token_4 => 'PRODUCT_NAME'
61665 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
61666 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
61667 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
61668 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
61669 ,p_ae_header_id => NULL
61670 );
61671
61672 IF (C_LEVEL_ERROR>= g_log_level) THEN
61673 trace
61674 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
61675 ,p_level => C_LEVEL_ERROR
61676 ,p_module => l_log_module);
61677 END IF;
61678 END IF;
61679 END IF;
61680 --
61681 --
61682 ------------------------------------------------------------------------------------------------
61683 -- 4219869 Business Flow
61684 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
61685 -- Prior Entry. Currently, the following code is always generated.
61686 ------------------------------------------------------------------------------------------------
61687 XLA_AE_LINES_PKG.ValidateCurrentLine;
61688
61689 ------------------------------------------------------------------------------------
61690 -- 4219869 Business Flow
61691 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
61692 ------------------------------------------------------------------------------------
61693 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
61694
61695 ----------------------------------------------------------------------------------
61696 -- 4219869 Business Flow
61697 -- Update journal entry status -- Need to generate this within IF <condition>
61698 ----------------------------------------------------------------------------------
61699 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
61700 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
61701 ,p_balance_type_code => l_balance_type_code
61702 );
61703
61704 -------------------------------------------------------------------------------------------
61705 -- 4262811 - Generate the Accrual Reversal lines
61706 -------------------------------------------------------------------------------------------
61707 BEGIN
61708 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
61709 (g_array_event(p_event_id).array_value_num('header_index'));
61710 IF l_acc_rev_flag IS NULL THEN
61711 l_acc_rev_flag := 'N';
61712 END IF;
61713 EXCEPTION
61714 WHEN OTHERS THEN
61715 l_acc_rev_flag := 'N';
61716 END;
61717 --
61718 IF (l_acc_rev_flag = 'Y') THEN
61719
61720 -- 4645092 ------------------------------------------------------------------------------
61721 -- To allow MPA report to determine if it should generate report process
61722 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
61723 ------------------------------------------------------------------------------------------
61724
61725 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
61726 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
61727 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
61728 -- call ADRs
61729 -- Bug 4922099
61730 --
61731 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
61732 (NVL(l_actual_upg_option, 'N') = 'O') OR
61733 (NVL(l_enc_upg_option, 'N') = 'O')
61734 )
61735 THEN
61736 NULL;
61737 --
61738 --
61739
61740 l_ccid := AcctDerRule_174(
61741 p_application_id => p_application_id
61742 , p_ae_header_id => l_ae_header_id
61743 , p_source_5 => p_source_5
61744 , p_source_32 => p_source_32
61745 , x_transaction_coa_id => l_adr_transaction_coa_id
61746 , x_accounting_coa_id => l_adr_accounting_coa_id
61747 , x_value_type_code => l_adr_value_type_code
61748 , p_side => 'NA'
61749 );
61750
61751 xla_ae_lines_pkg.set_ccid(
61752 p_code_combination_id => l_ccid
61753 , p_value_type_code => l_adr_value_type_code
61754 , p_transaction_coa_id => l_adr_transaction_coa_id
61755 , p_accounting_coa_id => l_adr_accounting_coa_id
61756 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
61757 , p_adr_type_code => 'S'
61758 , p_component_type => l_component_type
61759 , p_component_code => l_component_code
61760 , p_component_type_code => l_component_type_code
61764 );
61761 , p_component_appl_id => l_component_appl_id
61762 , p_amb_context_code => l_amb_context_code
61763 , p_side => 'NA'
61765
61766
61767 l_segment := AcctDerRule_169(
61768 p_application_id => p_application_id
61769 , p_ae_header_id => l_ae_header_id
61770 , p_source_5 => p_source_5
61771 , p_source_31 => p_source_31
61772 , x_transaction_coa_id => l_adr_transaction_coa_id
61773 , x_accounting_coa_id => l_adr_accounting_coa_id
61774 , x_flexfield_segment_code => l_adr_flexfield_segment_code
61775 , x_flex_value_set_id => l_adr_flex_value_set_id
61776 , x_value_type_code => l_adr_value_type_code
61777 , x_value_combination_id => l_adr_value_combination_id
61778 , x_value_segment_code => l_adr_value_segment_code
61779 , p_side => 'NA'
61780 , p_override_seg_flag => 'Y'
61781 );
61782
61783 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
61784
61785 xla_ae_lines_pkg.set_segment(
61786 p_to_segment_code => 'GL_BALANCING'
61787 , p_segment_value => l_segment
61788 , p_from_segment_code => l_adr_value_segment_code
61789 , p_from_combination_id => l_adr_value_combination_id
61790 , p_value_type_code => l_adr_value_type_code
61791 , p_transaction_coa_id => l_adr_transaction_coa_id
61792 , p_accounting_coa_id => l_adr_accounting_coa_id
61793 , p_flexfield_segment_code => l_adr_flexfield_segment_code
61794 , p_flex_value_set_id => l_adr_flex_value_set_id
61795 , p_adr_code => 'FA_EXPENSE_ACCT'
61796 , p_adr_type_code => 'S'
61797 , p_component_type => l_component_type
61798 , p_component_code => l_component_code
61799 , p_component_type_code => l_component_type_code
61800 , p_component_appl_id => l_component_appl_id
61801 , p_amb_context_code => l_amb_context_code
61802 , p_entity_code => 'TRANSACTIONS'
61803 , p_event_class_code => 'CIP_RETIREMENTS'
61804 , p_side => 'NA'
61805 );
61806
61807 END IF;
61808
61809 l_segment := AcctDerRule_167(
61810 p_application_id => p_application_id
61811 , p_ae_header_id => l_ae_header_id
61812 , p_source_5 => p_source_5
61813 , p_source_30 => p_source_30
61814 , x_transaction_coa_id => l_adr_transaction_coa_id
61815 , x_accounting_coa_id => l_adr_accounting_coa_id
61816 , x_flexfield_segment_code => l_adr_flexfield_segment_code
61817 , x_flex_value_set_id => l_adr_flex_value_set_id
61818 , x_value_type_code => l_adr_value_type_code
61819 , x_value_combination_id => l_adr_value_combination_id
61820 , x_value_segment_code => l_adr_value_segment_code
61821 , p_side => 'NA'
61822 , p_override_seg_flag => 'Y'
61823 );
61824
61825 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
61826
61827 xla_ae_lines_pkg.set_segment(
61828 p_to_segment_code => 'GL_ACCOUNT'
61829 , p_segment_value => l_segment
61830 , p_from_segment_code => l_adr_value_segment_code
61831 , p_from_combination_id => l_adr_value_combination_id
61832 , p_value_type_code => l_adr_value_type_code
61833 , p_transaction_coa_id => l_adr_transaction_coa_id
61834 , p_accounting_coa_id => l_adr_accounting_coa_id
61835 , p_flexfield_segment_code => l_adr_flexfield_segment_code
61836 , p_flex_value_set_id => l_adr_flex_value_set_id
61837 , p_adr_code => 'FA_REVAL_RES_RET_LOSS_SEGMENT'
61838 , p_adr_type_code => 'S'
61839 , p_component_type => l_component_type
61840 , p_component_code => l_component_code
61841 , p_component_type_code => l_component_type_code
61842 , p_component_appl_id => l_component_appl_id
61843 , p_amb_context_code => l_amb_context_code
61844 , p_entity_code => 'TRANSACTIONS'
61845 , p_event_class_code => 'CIP_RETIREMENTS'
61846 , p_side => 'NA'
61847 );
61848
61849 END IF;
61850
61851 --
61852 --
61853 END IF;
61854
61855 --
61856 -- Update the line information that should be overwritten
61857 --
61858 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
61859 p_header_num => 1);
61860 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
61861
61862 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
61863
61864 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
61865 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
61866 END IF;
61867
61868 --
61869 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
61870 --
61874 ---------------------------------------------------------------------------------------------------
61871 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
61872 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
61873 ELSE
61875 -- 4262811a Switch Sign
61876 ---------------------------------------------------------------------------------------------------
61877 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
61878 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
61879 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
61880 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
61881 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
61882 -- 5132302
61883 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
61884 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
61885
61886 END IF;
61887
61888 -- 4955764
61889 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
61890 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
61891
61892
61893 XLA_AE_LINES_PKG.ValidateCurrentLine;
61894 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
61895
61896 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
61897 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
61898 ,p_balance_type_code => l_balance_type_code);
61899
61900 END IF;
61901
61902 -----------------------------------------------------------------------------------------
61903 -- 4262811 Multiperiod Accounting
61904 -----------------------------------------------------------------------------------------
61905 -- No MPA option is assigned.
61906
61907
61908 END IF;
61909 END IF;
61910 --
61911
61912 --
61913 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
61914 trace
61915 (p_msg => 'END of AcctLineType_250'
61916 ,p_level => C_LEVEL_PROCEDURE
61917 ,p_module => l_log_module);
61918 END IF;
61919 --
61920 EXCEPTION
61921 WHEN xla_exceptions_pkg.application_exception THEN
61922 RAISE;
61923 WHEN OTHERS THEN
61924 xla_exceptions_pkg.raise_message
61925 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_250');
61926 END AcctLineType_250;
61927 --
61928
61929 ---------------------------------------
61930 --
61931 -- PRIVATE FUNCTION
61932 -- AcctLineType_251
61933 --
61934 ---------------------------------------
61935 PROCEDURE AcctLineType_251 (
61936 p_application_id IN NUMBER
61937 ,p_event_id IN NUMBER
61938 ,p_calculate_acctd_flag IN VARCHAR2
61939 ,p_calculate_g_l_flag IN VARCHAR2
61940 ,p_actual_flag IN OUT VARCHAR2
61941 ,p_balance_type_code OUT VARCHAR2
61942 ,p_gain_or_loss_ref OUT VARCHAR2
61943
61944 --Period Close Date
61945 , p_source_1 IN DATE
61946 --Generated Code Combination Identifier
61947 , p_source_5 IN NUMBER
61948 --CIP Cost Account
61949 , p_source_9 IN VARCHAR2
61950 --Expense Account Code Combination Identifier
61951 , p_source_31 IN NUMBER
61952 --Default Code Combination Identifier
61953 , p_source_32 IN NUMBER
61954 --Adjustment Type
61955 , p_source_48 IN VARCHAR2
61956 --Transaction Header Identifier
61957 , p_source_49 IN NUMBER
61958 --Adjustment Line Identifier
61959 , p_source_50 IN NUMBER
61960 --Distribution Type Code
61961 , p_source_51 IN VARCHAR2
61962 --Entered Amount
61963 , p_source_52 IN NUMBER
61964 --Currency Code
61965 , p_source_53 IN VARCHAR2
61966 )
61967 IS
61968
61969 l_component_type VARCHAR2(80);
61970 l_component_code VARCHAR2(30);
61971 l_component_type_code VARCHAR2(1);
61972 l_component_appl_id INTEGER;
61973 l_amb_context_code VARCHAR2(30);
61974 l_entity_code VARCHAR2(30);
61975 l_event_class_code VARCHAR2(30);
61976 l_ae_header_id NUMBER;
61977 l_event_type_code VARCHAR2(30);
61978 l_line_definition_code VARCHAR2(30);
61979 l_line_definition_owner_code VARCHAR2(1);
61980 --
61981 -- adr variables
61982 l_segment VARCHAR2(30);
61983 l_ccid NUMBER;
61984 l_adr_transaction_coa_id NUMBER;
61985 l_adr_accounting_coa_id NUMBER;
61986 l_adr_flexfield_segment_code VARCHAR2(30);
61987 l_adr_flex_value_set_id NUMBER;
61988 l_adr_value_type_code VARCHAR2(30);
61989 l_adr_value_combination_id NUMBER;
61990 l_adr_value_segment_code VARCHAR2(30);
61991
61992 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
61993 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
61994 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
61995 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
61996
62000 l_acc_rev_flag VARCHAR2(1);
61997 -- 4262811 Variables ------------------------------------------------------------------------------------------
61998 l_entered_amt_idx NUMBER;
61999 l_accted_amt_idx NUMBER;
62001 l_accrual_line_num NUMBER;
62002 l_tmp_amt NUMBER;
62003 l_acc_rev_natural_side_code VARCHAR2(1);
62004
62005 l_num_entries NUMBER;
62006 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
62007 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
62008 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
62009 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
62010 l_recog_line_1 NUMBER;
62011 l_recog_line_2 NUMBER;
62012
62013 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
62014 l_bflow_applied_to_amt NUMBER; -- 5132302
62015 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
62016
62017 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
62018
62019 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
62020 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
62021
62022 ---------------------------------------------------------------------------------------------------------------
62023
62024
62025 --
62026 -- bulk performance
62027 --
62028 l_balance_type_code VARCHAR2(1);
62029 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
62030 l_log_module VARCHAR2(240);
62031
62032 --
62033 -- Upgrade strategy
62034 --
62035 l_actual_upg_option VARCHAR2(1);
62036 l_enc_upg_option VARCHAR2(1);
62037
62038 --
62039 BEGIN
62040 --
62041 IF g_log_enabled THEN
62042 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_251';
62043 END IF;
62044 --
62045 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
62046
62047 trace
62048 (p_msg => 'BEGIN of AcctLineType_251'
62049 ,p_level => C_LEVEL_PROCEDURE
62050 ,p_module => l_log_module);
62051
62052 END IF;
62053 --
62054 l_component_type := 'AMB_JLT';
62055 l_component_code := 'FA_CIP_REVAL_COST';
62056 l_component_type_code := 'S';
62057 l_component_appl_id := 140;
62058 l_amb_context_code := 'DEFAULT';
62059 l_entity_code := 'TRANSACTIONS';
62060 l_event_class_code := 'CIP_REVALUATION';
62061 l_event_type_code := 'CIP_REVALUATION_ALL';
62062 l_line_definition_owner_code := 'S';
62063 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_R10';
62064 --
62065 l_balance_type_code := 'A';
62066 l_segment := NULL;
62067 l_ccid := NULL;
62068 l_adr_transaction_coa_id := NULL;
62069 l_adr_accounting_coa_id := NULL;
62070 l_adr_flexfield_segment_code := NULL;
62071 l_adr_flex_value_set_id := NULL;
62072 l_adr_value_type_code := NULL;
62073 l_adr_value_combination_id := NULL;
62074 l_adr_value_segment_code := NULL;
62075
62076 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
62077 l_bflow_class_code := ''; -- 4219869 Business Flow
62078 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
62079 l_budgetary_control_flag := 'N';
62080
62081 l_bflow_applied_to_amt_idx := NULL; -- 5132302
62082 l_bflow_applied_to_amt := NULL; -- 5132302
62083 l_entered_amt_idx := NULL; -- 4262811
62084 l_accted_amt_idx := NULL; -- 4262811
62085 l_acc_rev_flag := NULL; -- 4262811
62086 l_accrual_line_num := NULL; -- 4262811
62087 l_tmp_amt := NULL; -- 4262811
62088 --
62089
62090 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
62091 l_balance_type_code <> 'B' THEN
62092 IF NVL(p_source_48,'
62093 ') = 'CIP COST'
62094 THEN
62095
62096 --
62097 XLA_AE_LINES_PKG.SetNewLine;
62098
62099 p_balance_type_code := l_balance_type_code;
62100 -- set the flag so later we will know whether the gain loss line needs to be created
62101
62102 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
62103 p_actual_flag :='A';
62104 END IF;
62105
62106 --
62107 -- bulk performance
62108 --
62109 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
62110 p_header_num => 0); -- 4262811
62111 --
62112 -- set accounting line options
62113 --
62114 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
62115 p_natural_side_code => 'D'
62116 , p_gain_or_loss_flag => 'N'
62117 , p_gl_transfer_mode_code => 'S'
62118 , p_acct_entry_type_code => 'A'
62119 , p_switch_side_flag => 'Y'
62120 , p_merge_duplicate_code => 'N'
62121 );
62122 --
62123 l_acc_rev_natural_side_code := 'C'; -- 4262811
62124 --
62125 --
62126 -- set accounting line type info
62127 --
62128 xla_ae_lines_pkg.SetAcctLineType
62132 ,p_line_definition_code => l_line_definition_code
62129 (p_component_type => l_component_type
62130 ,p_event_type_code => l_event_type_code
62131 ,p_line_definition_owner_code => l_line_definition_owner_code
62133 ,p_accounting_line_code => l_component_code
62134 ,p_accounting_line_type_code => l_component_type_code
62135 ,p_accounting_line_appl_id => l_component_appl_id
62136 ,p_amb_context_code => l_amb_context_code
62137 ,p_entity_code => l_entity_code
62138 ,p_event_class_code => l_event_class_code);
62139 --
62140 -- set accounting class
62141 --
62142 xla_ae_lines_pkg.SetAcctClass(
62143 p_accounting_class_code => 'ASSET'
62144 , p_ae_header_id => l_ae_header_id
62145 );
62146
62147 --
62148 -- set rounding class
62149 --
62150 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
62151 'ASSET';
62152
62153 --
62154 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
62155 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
62156 --
62157 -- bulk performance
62158 --
62159 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
62160
62161 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
62162 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
62163
62164 -- 4955764
62165 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
62166 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
62167
62168 -- 4458381 Public Sector Enh
62169
62170 --
62171 -- set accounting attributes for the line type
62172 --
62173 l_entered_amt_idx := 4;
62174 l_accted_amt_idx := 6;
62175 l_bflow_applied_to_amt_idx := NULL; -- 5132302
62176 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
62177 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
62178 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
62179 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
62180 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
62181 l_rec_acct_attrs.array_char_value(3) := p_source_51;
62182 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
62183 l_rec_acct_attrs.array_num_value(4) := p_source_52;
62184 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
62185 l_rec_acct_attrs.array_char_value(5) := p_source_53;
62186 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
62187 l_rec_acct_attrs.array_num_value(6) := p_source_52;
62188
62189 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
62190 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
62191
62192 ---------------------------------------------------------------------------------------------------------------
62193 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
62194 ---------------------------------------------------------------------------------------------------------------
62195 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
62196
62197 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
62198 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
62199
62200 IF xla_accounting_cache_pkg.GetValueChar
62201 (p_source_code => 'LEDGER_CATEGORY_CODE'
62202 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
62203 AND l_bflow_method_code = 'PRIOR_ENTRY'
62204 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
62205 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
62206 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
62207 )
62208 THEN
62209 xla_ae_lines_pkg.BflowUpgEntry
62210 (p_business_method_code => l_bflow_method_code
62211 ,p_business_class_code => l_bflow_class_code
62212 ,p_balance_type => l_balance_type_code);
62213 ELSE
62214 NULL;
62215 -- No business flow processing for business flow method of NONE.
62216 END IF;
62217
62218 --
62219 -- call analytical criteria
62220 --
62221
62222 --
62223 -- call description
62224 --
62225
62226 xla_ae_lines_pkg.SetLineDescription(
62227 p_ae_header_id => l_ae_header_id
62228 ,p_description => Description_42 (
62229 p_application_id => p_application_id
62230 , p_ae_header_id => l_ae_header_id
62231 , p_source_1 => p_source_1
62232 )
62233 );
62234
62235
62236 --
62237 -- call ADRs
62238 -- Bug 4922099
62239 --
62240 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
62241 (NVL(l_actual_upg_option, 'N') = 'O') OR
62242 (NVL(l_enc_upg_option, 'N') = 'O')
62243 )
62244 THEN
62245 NULL;
62246 --
62250 p_application_id => p_application_id
62247 --
62248
62249 l_ccid := AcctDerRule_174(
62251 , p_ae_header_id => l_ae_header_id
62252 , p_source_5 => p_source_5
62253 , p_source_32 => p_source_32
62254 , x_transaction_coa_id => l_adr_transaction_coa_id
62255 , x_accounting_coa_id => l_adr_accounting_coa_id
62256 , x_value_type_code => l_adr_value_type_code
62257 , p_side => 'NA'
62258 );
62259
62260 xla_ae_lines_pkg.set_ccid(
62261 p_code_combination_id => l_ccid
62262 , p_value_type_code => l_adr_value_type_code
62263 , p_transaction_coa_id => l_adr_transaction_coa_id
62264 , p_accounting_coa_id => l_adr_accounting_coa_id
62265 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
62266 , p_adr_type_code => 'S'
62267 , p_component_type => l_component_type
62268 , p_component_code => l_component_code
62269 , p_component_type_code => l_component_type_code
62270 , p_component_appl_id => l_component_appl_id
62271 , p_amb_context_code => l_amb_context_code
62272 , p_side => 'NA'
62273 );
62274
62275
62276 l_segment := AcctDerRule_147(
62277 p_application_id => p_application_id
62278 , p_ae_header_id => l_ae_header_id
62279 , p_source_5 => p_source_5
62280 , p_source_9 => p_source_9
62281 , x_transaction_coa_id => l_adr_transaction_coa_id
62282 , x_accounting_coa_id => l_adr_accounting_coa_id
62283 , x_flexfield_segment_code => l_adr_flexfield_segment_code
62284 , x_flex_value_set_id => l_adr_flex_value_set_id
62285 , x_value_type_code => l_adr_value_type_code
62286 , x_value_combination_id => l_adr_value_combination_id
62287 , x_value_segment_code => l_adr_value_segment_code
62288 , p_side => 'NA'
62289 , p_override_seg_flag => 'Y'
62290 );
62291
62292 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
62293
62294 xla_ae_lines_pkg.set_segment(
62295 p_to_segment_code => 'GL_ACCOUNT'
62296 , p_segment_value => l_segment
62297 , p_from_segment_code => l_adr_value_segment_code
62298 , p_from_combination_id => l_adr_value_combination_id
62299 , p_value_type_code => l_adr_value_type_code
62300 , p_transaction_coa_id => l_adr_transaction_coa_id
62301 , p_accounting_coa_id => l_adr_accounting_coa_id
62302 , p_flexfield_segment_code => l_adr_flexfield_segment_code
62303 , p_flex_value_set_id => l_adr_flex_value_set_id
62304 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
62305 , p_adr_type_code => 'S'
62306 , p_component_type => l_component_type
62307 , p_component_code => l_component_code
62308 , p_component_type_code => l_component_type_code
62309 , p_component_appl_id => l_component_appl_id
62310 , p_amb_context_code => l_amb_context_code
62311 , p_entity_code => 'TRANSACTIONS'
62312 , p_event_class_code => 'CIP_REVALUATION'
62313 , p_side => 'NA'
62314 );
62315
62316 END IF;
62317
62318 l_segment := AcctDerRule_169(
62319 p_application_id => p_application_id
62320 , p_ae_header_id => l_ae_header_id
62321 , p_source_5 => p_source_5
62322 , p_source_31 => p_source_31
62323 , x_transaction_coa_id => l_adr_transaction_coa_id
62324 , x_accounting_coa_id => l_adr_accounting_coa_id
62325 , x_flexfield_segment_code => l_adr_flexfield_segment_code
62326 , x_flex_value_set_id => l_adr_flex_value_set_id
62327 , x_value_type_code => l_adr_value_type_code
62328 , x_value_combination_id => l_adr_value_combination_id
62329 , x_value_segment_code => l_adr_value_segment_code
62330 , p_side => 'NA'
62331 , p_override_seg_flag => 'Y'
62332 );
62333
62334 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
62335
62336 xla_ae_lines_pkg.set_segment(
62337 p_to_segment_code => 'GL_BALANCING'
62338 , p_segment_value => l_segment
62339 , p_from_segment_code => l_adr_value_segment_code
62340 , p_from_combination_id => l_adr_value_combination_id
62341 , p_value_type_code => l_adr_value_type_code
62342 , p_transaction_coa_id => l_adr_transaction_coa_id
62343 , p_accounting_coa_id => l_adr_accounting_coa_id
62344 , p_flexfield_segment_code => l_adr_flexfield_segment_code
62345 , p_flex_value_set_id => l_adr_flex_value_set_id
62346 , p_adr_code => 'FA_EXPENSE_ACCT'
62347 , p_adr_type_code => 'S'
62348 , p_component_type => l_component_type
62349 , p_component_code => l_component_code
62350 , p_component_type_code => l_component_type_code
62351 , p_component_appl_id => l_component_appl_id
62352 , p_amb_context_code => l_amb_context_code
62353 , p_entity_code => 'TRANSACTIONS'
62357
62354 , p_event_class_code => 'CIP_REVALUATION'
62355 , p_side => 'NA'
62356 );
62358 END IF;
62359
62360 --
62361 --
62362 END IF;
62363 --
62364 -- Bug 4922099
62365 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
62366 (NVL(l_enc_upg_option, 'N') = 'O')
62367 ) AND
62368 (l_bflow_method_code = 'PRIOR_ENTRY')
62369 )
62370 THEN
62371 IF
62372 --
62373 1 = 2
62374 --
62375 THEN
62376 xla_accounting_err_pkg.build_message
62377 (p_appli_s_name => 'XLA'
62378 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
62379 ,p_token_1 => 'LINE_NUMBER'
62380 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
62381 ,p_token_2 => 'LINE_TYPE_NAME'
62382 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
62383 l_component_type
62384 ,l_component_code
62385 ,l_component_type_code
62386 ,l_component_appl_id
62387 ,l_amb_context_code
62388 ,l_entity_code
62389 ,l_event_class_code
62390 )
62391 ,p_token_3 => 'OWNER'
62392 ,p_value_3 => xla_lookups_pkg.get_meaning(
62393 p_lookup_type => 'XLA_OWNER_TYPE'
62394 ,p_lookup_code => l_component_type_code
62395 )
62396 ,p_token_4 => 'PRODUCT_NAME'
62397 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
62398 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
62399 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
62400 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
62401 ,p_ae_header_id => NULL
62402 );
62403
62404 IF (C_LEVEL_ERROR>= g_log_level) THEN
62405 trace
62406 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
62407 ,p_level => C_LEVEL_ERROR
62408 ,p_module => l_log_module);
62409 END IF;
62410 END IF;
62411 END IF;
62412 --
62413 --
62414 ------------------------------------------------------------------------------------------------
62415 -- 4219869 Business Flow
62416 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
62417 -- Prior Entry. Currently, the following code is always generated.
62418 ------------------------------------------------------------------------------------------------
62419 XLA_AE_LINES_PKG.ValidateCurrentLine;
62420
62421 ------------------------------------------------------------------------------------
62422 -- 4219869 Business Flow
62423 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
62424 ------------------------------------------------------------------------------------
62425 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
62426
62427 ----------------------------------------------------------------------------------
62428 -- 4219869 Business Flow
62429 -- Update journal entry status -- Need to generate this within IF <condition>
62430 ----------------------------------------------------------------------------------
62431 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
62432 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
62433 ,p_balance_type_code => l_balance_type_code
62434 );
62435
62436 -------------------------------------------------------------------------------------------
62437 -- 4262811 - Generate the Accrual Reversal lines
62438 -------------------------------------------------------------------------------------------
62439 BEGIN
62440 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
62441 (g_array_event(p_event_id).array_value_num('header_index'));
62442 IF l_acc_rev_flag IS NULL THEN
62443 l_acc_rev_flag := 'N';
62444 END IF;
62445 EXCEPTION
62446 WHEN OTHERS THEN
62447 l_acc_rev_flag := 'N';
62448 END;
62449 --
62450 IF (l_acc_rev_flag = 'Y') THEN
62451
62452 -- 4645092 ------------------------------------------------------------------------------
62453 -- To allow MPA report to determine if it should generate report process
62457 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
62454 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
62455 ------------------------------------------------------------------------------------------
62456
62458 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
62459 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
62460 -- call ADRs
62461 -- Bug 4922099
62462 --
62463 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
62464 (NVL(l_actual_upg_option, 'N') = 'O') OR
62465 (NVL(l_enc_upg_option, 'N') = 'O')
62466 )
62467 THEN
62468 NULL;
62469 --
62470 --
62471
62472 l_ccid := AcctDerRule_174(
62473 p_application_id => p_application_id
62474 , p_ae_header_id => l_ae_header_id
62475 , p_source_5 => p_source_5
62476 , p_source_32 => p_source_32
62477 , x_transaction_coa_id => l_adr_transaction_coa_id
62478 , x_accounting_coa_id => l_adr_accounting_coa_id
62479 , x_value_type_code => l_adr_value_type_code
62480 , p_side => 'NA'
62481 );
62482
62483 xla_ae_lines_pkg.set_ccid(
62484 p_code_combination_id => l_ccid
62485 , p_value_type_code => l_adr_value_type_code
62486 , p_transaction_coa_id => l_adr_transaction_coa_id
62487 , p_accounting_coa_id => l_adr_accounting_coa_id
62488 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
62489 , p_adr_type_code => 'S'
62490 , p_component_type => l_component_type
62491 , p_component_code => l_component_code
62492 , p_component_type_code => l_component_type_code
62493 , p_component_appl_id => l_component_appl_id
62494 , p_amb_context_code => l_amb_context_code
62495 , p_side => 'NA'
62496 );
62497
62498
62499 l_segment := AcctDerRule_147(
62500 p_application_id => p_application_id
62501 , p_ae_header_id => l_ae_header_id
62502 , p_source_5 => p_source_5
62503 , p_source_9 => p_source_9
62504 , x_transaction_coa_id => l_adr_transaction_coa_id
62505 , x_accounting_coa_id => l_adr_accounting_coa_id
62506 , x_flexfield_segment_code => l_adr_flexfield_segment_code
62507 , x_flex_value_set_id => l_adr_flex_value_set_id
62508 , x_value_type_code => l_adr_value_type_code
62509 , x_value_combination_id => l_adr_value_combination_id
62510 , x_value_segment_code => l_adr_value_segment_code
62511 , p_side => 'NA'
62512 , p_override_seg_flag => 'Y'
62513 );
62514
62515 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
62516
62517 xla_ae_lines_pkg.set_segment(
62518 p_to_segment_code => 'GL_ACCOUNT'
62519 , p_segment_value => l_segment
62520 , p_from_segment_code => l_adr_value_segment_code
62521 , p_from_combination_id => l_adr_value_combination_id
62522 , p_value_type_code => l_adr_value_type_code
62523 , p_transaction_coa_id => l_adr_transaction_coa_id
62524 , p_accounting_coa_id => l_adr_accounting_coa_id
62525 , p_flexfield_segment_code => l_adr_flexfield_segment_code
62526 , p_flex_value_set_id => l_adr_flex_value_set_id
62527 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
62528 , p_adr_type_code => 'S'
62529 , p_component_type => l_component_type
62530 , p_component_code => l_component_code
62531 , p_component_type_code => l_component_type_code
62532 , p_component_appl_id => l_component_appl_id
62533 , p_amb_context_code => l_amb_context_code
62534 , p_entity_code => 'TRANSACTIONS'
62535 , p_event_class_code => 'CIP_REVALUATION'
62536 , p_side => 'NA'
62537 );
62538
62539 END IF;
62540
62541 l_segment := AcctDerRule_169(
62542 p_application_id => p_application_id
62543 , p_ae_header_id => l_ae_header_id
62544 , p_source_5 => p_source_5
62545 , p_source_31 => p_source_31
62546 , x_transaction_coa_id => l_adr_transaction_coa_id
62547 , x_accounting_coa_id => l_adr_accounting_coa_id
62548 , x_flexfield_segment_code => l_adr_flexfield_segment_code
62549 , x_flex_value_set_id => l_adr_flex_value_set_id
62550 , x_value_type_code => l_adr_value_type_code
62551 , x_value_combination_id => l_adr_value_combination_id
62552 , x_value_segment_code => l_adr_value_segment_code
62553 , p_side => 'NA'
62554 , p_override_seg_flag => 'Y'
62555 );
62556
62557 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
62558
62559 xla_ae_lines_pkg.set_segment(
62560 p_to_segment_code => 'GL_BALANCING'
62561 , p_segment_value => l_segment
62562 , p_from_segment_code => l_adr_value_segment_code
62563 , p_from_combination_id => l_adr_value_combination_id
62564 , p_value_type_code => l_adr_value_type_code
62565 , p_transaction_coa_id => l_adr_transaction_coa_id
62569 , p_adr_code => 'FA_EXPENSE_ACCT'
62566 , p_accounting_coa_id => l_adr_accounting_coa_id
62567 , p_flexfield_segment_code => l_adr_flexfield_segment_code
62568 , p_flex_value_set_id => l_adr_flex_value_set_id
62570 , p_adr_type_code => 'S'
62571 , p_component_type => l_component_type
62572 , p_component_code => l_component_code
62573 , p_component_type_code => l_component_type_code
62574 , p_component_appl_id => l_component_appl_id
62575 , p_amb_context_code => l_amb_context_code
62576 , p_entity_code => 'TRANSACTIONS'
62577 , p_event_class_code => 'CIP_REVALUATION'
62578 , p_side => 'NA'
62579 );
62580
62581 END IF;
62582
62583 --
62584 --
62585 END IF;
62586
62587 --
62588 -- Update the line information that should be overwritten
62589 --
62590 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
62591 p_header_num => 1);
62592 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
62593
62594 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
62595
62596 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
62597 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
62598 END IF;
62599
62600 --
62601 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
62602 --
62603 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
62604 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
62605 ELSE
62606 ---------------------------------------------------------------------------------------------------
62607 -- 4262811a Switch Sign
62608 ---------------------------------------------------------------------------------------------------
62609 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
62610 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
62611 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
62612 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
62613 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
62614 -- 5132302
62615 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
62616 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
62617
62618 END IF;
62619
62620 -- 4955764
62621 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
62622 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
62623
62624
62625 XLA_AE_LINES_PKG.ValidateCurrentLine;
62626 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
62627
62628 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
62629 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
62630 ,p_balance_type_code => l_balance_type_code);
62631
62632 END IF;
62633
62634 -----------------------------------------------------------------------------------------
62635 -- 4262811 Multiperiod Accounting
62636 -----------------------------------------------------------------------------------------
62637 -- No MPA option is assigned.
62638
62639
62640 END IF;
62641 END IF;
62642 --
62643
62644 --
62645 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
62646 trace
62647 (p_msg => 'END of AcctLineType_251'
62648 ,p_level => C_LEVEL_PROCEDURE
62649 ,p_module => l_log_module);
62650 END IF;
62651 --
62652 EXCEPTION
62653 WHEN xla_exceptions_pkg.application_exception THEN
62654 RAISE;
62655 WHEN OTHERS THEN
62656 xla_exceptions_pkg.raise_message
62657 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_251');
62658 END AcctLineType_251;
62659 --
62660
62661 ---------------------------------------
62662 --
62663 -- PRIVATE FUNCTION
62664 -- AcctLineType_252
62665 --
62666 ---------------------------------------
62667 PROCEDURE AcctLineType_252 (
62668 p_application_id IN NUMBER
62669 ,p_event_id IN NUMBER
62670 ,p_calculate_acctd_flag IN VARCHAR2
62671 ,p_calculate_g_l_flag IN VARCHAR2
62672 ,p_actual_flag IN OUT VARCHAR2
62673 ,p_balance_type_code OUT VARCHAR2
62674 ,p_gain_or_loss_ref OUT VARCHAR2
62675
62676 --Period Close Date
62677 , p_source_1 IN DATE
62678 --Generated Code Combination Identifier
62679 , p_source_5 IN NUMBER
62680 --Revaluation Reserve Account
62681 , p_source_13 IN VARCHAR2
62682 --Generated Offset Code Combination Identifier
62683 , p_source_19 IN NUMBER
62684 --Expense Account Code Combination Identifier
62688 --Adjustment Type
62685 , p_source_31 IN NUMBER
62686 --Default Code Combination Identifier
62687 , p_source_32 IN NUMBER
62689 , p_source_48 IN VARCHAR2
62690 --Transaction Header Identifier
62691 , p_source_49 IN NUMBER
62692 --Adjustment Line Identifier
62693 , p_source_50 IN NUMBER
62694 --Distribution Type Code
62695 , p_source_51 IN VARCHAR2
62696 --Entered Amount
62697 , p_source_52 IN NUMBER
62698 --Currency Code
62699 , p_source_53 IN VARCHAR2
62700 )
62701 IS
62702
62703 l_component_type VARCHAR2(80);
62704 l_component_code VARCHAR2(30);
62705 l_component_type_code VARCHAR2(1);
62706 l_component_appl_id INTEGER;
62707 l_amb_context_code VARCHAR2(30);
62708 l_entity_code VARCHAR2(30);
62709 l_event_class_code VARCHAR2(30);
62710 l_ae_header_id NUMBER;
62711 l_event_type_code VARCHAR2(30);
62712 l_line_definition_code VARCHAR2(30);
62713 l_line_definition_owner_code VARCHAR2(1);
62714 --
62715 -- adr variables
62716 l_segment VARCHAR2(30);
62717 l_ccid NUMBER;
62718 l_adr_transaction_coa_id NUMBER;
62719 l_adr_accounting_coa_id NUMBER;
62720 l_adr_flexfield_segment_code VARCHAR2(30);
62721 l_adr_flex_value_set_id NUMBER;
62722 l_adr_value_type_code VARCHAR2(30);
62723 l_adr_value_combination_id NUMBER;
62724 l_adr_value_segment_code VARCHAR2(30);
62725
62726 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
62727 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
62728 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
62729 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
62730
62731 -- 4262811 Variables ------------------------------------------------------------------------------------------
62732 l_entered_amt_idx NUMBER;
62733 l_accted_amt_idx NUMBER;
62734 l_acc_rev_flag VARCHAR2(1);
62735 l_accrual_line_num NUMBER;
62736 l_tmp_amt NUMBER;
62737 l_acc_rev_natural_side_code VARCHAR2(1);
62738
62739 l_num_entries NUMBER;
62740 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
62741 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
62742 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
62743 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
62744 l_recog_line_1 NUMBER;
62745 l_recog_line_2 NUMBER;
62746
62747 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
62748 l_bflow_applied_to_amt NUMBER; -- 5132302
62749 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
62750
62751 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
62752
62753 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
62754 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
62755
62756 ---------------------------------------------------------------------------------------------------------------
62757
62758
62759 --
62760 -- bulk performance
62761 --
62762 l_balance_type_code VARCHAR2(1);
62763 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
62764 l_log_module VARCHAR2(240);
62765
62766 --
62767 -- Upgrade strategy
62768 --
62769 l_actual_upg_option VARCHAR2(1);
62770 l_enc_upg_option VARCHAR2(1);
62771
62772 --
62773 BEGIN
62774 --
62775 IF g_log_enabled THEN
62776 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_252';
62777 END IF;
62778 --
62779 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
62780
62781 trace
62782 (p_msg => 'BEGIN of AcctLineType_252'
62783 ,p_level => C_LEVEL_PROCEDURE
62784 ,p_module => l_log_module);
62785
62786 END IF;
62787 --
62788 l_component_type := 'AMB_JLT';
62789 l_component_code := 'FA_CIP_REVAL_RESERVE';
62790 l_component_type_code := 'S';
62791 l_component_appl_id := 140;
62792 l_amb_context_code := 'DEFAULT';
62793 l_entity_code := 'TRANSACTIONS';
62794 l_event_class_code := 'CIP_REVALUATION';
62795 l_event_type_code := 'CIP_REVALUATION_ALL';
62796 l_line_definition_owner_code := 'S';
62797 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_R10';
62798 --
62799 l_balance_type_code := 'A';
62800 l_segment := NULL;
62801 l_ccid := NULL;
62802 l_adr_transaction_coa_id := NULL;
62803 l_adr_accounting_coa_id := NULL;
62804 l_adr_flexfield_segment_code := NULL;
62805 l_adr_flex_value_set_id := NULL;
62806 l_adr_value_type_code := NULL;
62807 l_adr_value_combination_id := NULL;
62808 l_adr_value_segment_code := NULL;
62809
62810 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
62811 l_bflow_class_code := ''; -- 4219869 Business Flow
62812 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
62813 l_budgetary_control_flag := 'N';
62817 l_entered_amt_idx := NULL; -- 4262811
62814
62815 l_bflow_applied_to_amt_idx := NULL; -- 5132302
62816 l_bflow_applied_to_amt := NULL; -- 5132302
62818 l_accted_amt_idx := NULL; -- 4262811
62819 l_acc_rev_flag := NULL; -- 4262811
62820 l_accrual_line_num := NULL; -- 4262811
62821 l_tmp_amt := NULL; -- 4262811
62822 --
62823
62824 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
62825 l_balance_type_code <> 'B' THEN
62826 IF NVL(p_source_48,'
62827 ') = 'REVAL RESERVE'
62828 THEN
62829
62830 --
62831 XLA_AE_LINES_PKG.SetNewLine;
62832
62833 p_balance_type_code := l_balance_type_code;
62834 -- set the flag so later we will know whether the gain loss line needs to be created
62835
62836 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
62837 p_actual_flag :='A';
62838 END IF;
62839
62840 --
62841 -- bulk performance
62842 --
62843 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
62844 p_header_num => 0); -- 4262811
62845 --
62846 -- set accounting line options
62847 --
62848 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
62849 p_natural_side_code => 'C'
62850 , p_gain_or_loss_flag => 'N'
62851 , p_gl_transfer_mode_code => 'S'
62852 , p_acct_entry_type_code => 'A'
62853 , p_switch_side_flag => 'Y'
62854 , p_merge_duplicate_code => 'N'
62855 );
62856 --
62857 l_acc_rev_natural_side_code := 'D'; -- 4262811
62858 --
62859 --
62860 -- set accounting line type info
62861 --
62862 xla_ae_lines_pkg.SetAcctLineType
62863 (p_component_type => l_component_type
62864 ,p_event_type_code => l_event_type_code
62865 ,p_line_definition_owner_code => l_line_definition_owner_code
62866 ,p_line_definition_code => l_line_definition_code
62867 ,p_accounting_line_code => l_component_code
62868 ,p_accounting_line_type_code => l_component_type_code
62869 ,p_accounting_line_appl_id => l_component_appl_id
62870 ,p_amb_context_code => l_amb_context_code
62871 ,p_entity_code => l_entity_code
62872 ,p_event_class_code => l_event_class_code);
62873 --
62874 -- set accounting class
62875 --
62876 xla_ae_lines_pkg.SetAcctClass(
62877 p_accounting_class_code => 'ASSET'
62878 , p_ae_header_id => l_ae_header_id
62879 );
62880
62881 --
62882 -- set rounding class
62883 --
62884 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
62885 'ASSET';
62886
62887 --
62888 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
62889 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
62890 --
62891 -- bulk performance
62892 --
62893 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
62894
62895 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
62896 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
62897
62898 -- 4955764
62899 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
62900 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
62901
62902 -- 4458381 Public Sector Enh
62903
62904 --
62905 -- set accounting attributes for the line type
62906 --
62907 l_entered_amt_idx := 4;
62908 l_accted_amt_idx := 6;
62909 l_bflow_applied_to_amt_idx := NULL; -- 5132302
62910 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
62911 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
62912 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
62913 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
62914 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
62915 l_rec_acct_attrs.array_char_value(3) := p_source_51;
62916 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
62917 l_rec_acct_attrs.array_num_value(4) := p_source_52;
62918 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
62919 l_rec_acct_attrs.array_char_value(5) := p_source_53;
62920 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
62921 l_rec_acct_attrs.array_num_value(6) := p_source_52;
62922
62923 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
62924 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
62925
62926 ---------------------------------------------------------------------------------------------------------------
62927 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
62928 ---------------------------------------------------------------------------------------------------------------
62929 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
62930
62931 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
62935 (p_source_code => 'LEDGER_CATEGORY_CODE'
62932 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
62933
62934 IF xla_accounting_cache_pkg.GetValueChar
62936 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
62937 AND l_bflow_method_code = 'PRIOR_ENTRY'
62938 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
62939 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
62940 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
62941 )
62942 THEN
62943 xla_ae_lines_pkg.BflowUpgEntry
62944 (p_business_method_code => l_bflow_method_code
62945 ,p_business_class_code => l_bflow_class_code
62946 ,p_balance_type => l_balance_type_code);
62947 ELSE
62948 NULL;
62949 -- No business flow processing for business flow method of NONE.
62950 END IF;
62951
62952 --
62953 -- call analytical criteria
62954 --
62955
62956 --
62957 -- call description
62958 --
62959
62960 xla_ae_lines_pkg.SetLineDescription(
62961 p_ae_header_id => l_ae_header_id
62962 ,p_description => Description_43 (
62963 p_application_id => p_application_id
62964 , p_ae_header_id => l_ae_header_id
62965 , p_source_1 => p_source_1
62966 )
62967 );
62968
62969
62970 --
62971 -- call ADRs
62972 -- Bug 4922099
62973 --
62974 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
62975 (NVL(l_actual_upg_option, 'N') = 'O') OR
62976 (NVL(l_enc_upg_option, 'N') = 'O')
62977 )
62978 THEN
62979 NULL;
62980 --
62981 --
62982
62983 l_ccid := AcctDerRule_175(
62984 p_application_id => p_application_id
62985 , p_ae_header_id => l_ae_header_id
62986 , p_source_5 => p_source_5
62987 , p_source_19 => p_source_19
62988 , p_source_32 => p_source_32
62989 , x_transaction_coa_id => l_adr_transaction_coa_id
62990 , x_accounting_coa_id => l_adr_accounting_coa_id
62991 , x_value_type_code => l_adr_value_type_code
62992 , p_side => 'NA'
62993 );
62994
62995 xla_ae_lines_pkg.set_ccid(
62996 p_code_combination_id => l_ccid
62997 , p_value_type_code => l_adr_value_type_code
62998 , p_transaction_coa_id => l_adr_transaction_coa_id
62999 , p_accounting_coa_id => l_adr_accounting_coa_id
63000 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
63001 , p_adr_type_code => 'S'
63002 , p_component_type => l_component_type
63003 , p_component_code => l_component_code
63004 , p_component_type_code => l_component_type_code
63005 , p_component_appl_id => l_component_appl_id
63006 , p_amb_context_code => l_amb_context_code
63007 , p_side => 'NA'
63008 );
63009
63010
63011 l_segment := AcctDerRule_151(
63012 p_application_id => p_application_id
63013 , p_ae_header_id => l_ae_header_id
63014 , p_source_5 => p_source_5
63015 , p_source_13 => p_source_13
63016 , x_transaction_coa_id => l_adr_transaction_coa_id
63017 , x_accounting_coa_id => l_adr_accounting_coa_id
63018 , x_flexfield_segment_code => l_adr_flexfield_segment_code
63019 , x_flex_value_set_id => l_adr_flex_value_set_id
63020 , x_value_type_code => l_adr_value_type_code
63021 , x_value_combination_id => l_adr_value_combination_id
63022 , x_value_segment_code => l_adr_value_segment_code
63023 , p_side => 'NA'
63024 , p_override_seg_flag => 'Y'
63025 );
63026
63027 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
63028
63029 xla_ae_lines_pkg.set_segment(
63030 p_to_segment_code => 'GL_ACCOUNT'
63031 , p_segment_value => l_segment
63032 , p_from_segment_code => l_adr_value_segment_code
63033 , p_from_combination_id => l_adr_value_combination_id
63034 , p_value_type_code => l_adr_value_type_code
63035 , p_transaction_coa_id => l_adr_transaction_coa_id
63036 , p_accounting_coa_id => l_adr_accounting_coa_id
63037 , p_flexfield_segment_code => l_adr_flexfield_segment_code
63038 , p_flex_value_set_id => l_adr_flex_value_set_id
63039 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
63040 , p_adr_type_code => 'S'
63041 , p_component_type => l_component_type
63042 , p_component_code => l_component_code
63043 , p_component_type_code => l_component_type_code
63044 , p_component_appl_id => l_component_appl_id
63045 , p_amb_context_code => l_amb_context_code
63046 , p_entity_code => 'TRANSACTIONS'
63047 , p_event_class_code => 'CIP_REVALUATION'
63048 , p_side => 'NA'
63049 );
63050
63051 END IF;
63052
63053 l_segment := AcctDerRule_169(
63054 p_application_id => p_application_id
63055 , p_ae_header_id => l_ae_header_id
63059 , x_accounting_coa_id => l_adr_accounting_coa_id
63056 , p_source_5 => p_source_5
63057 , p_source_31 => p_source_31
63058 , x_transaction_coa_id => l_adr_transaction_coa_id
63060 , x_flexfield_segment_code => l_adr_flexfield_segment_code
63061 , x_flex_value_set_id => l_adr_flex_value_set_id
63062 , x_value_type_code => l_adr_value_type_code
63063 , x_value_combination_id => l_adr_value_combination_id
63064 , x_value_segment_code => l_adr_value_segment_code
63065 , p_side => 'NA'
63066 , p_override_seg_flag => 'Y'
63067 );
63068
63069 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
63070
63071 xla_ae_lines_pkg.set_segment(
63072 p_to_segment_code => 'GL_BALANCING'
63073 , p_segment_value => l_segment
63074 , p_from_segment_code => l_adr_value_segment_code
63075 , p_from_combination_id => l_adr_value_combination_id
63076 , p_value_type_code => l_adr_value_type_code
63077 , p_transaction_coa_id => l_adr_transaction_coa_id
63078 , p_accounting_coa_id => l_adr_accounting_coa_id
63079 , p_flexfield_segment_code => l_adr_flexfield_segment_code
63080 , p_flex_value_set_id => l_adr_flex_value_set_id
63081 , p_adr_code => 'FA_EXPENSE_ACCT'
63082 , p_adr_type_code => 'S'
63083 , p_component_type => l_component_type
63084 , p_component_code => l_component_code
63085 , p_component_type_code => l_component_type_code
63086 , p_component_appl_id => l_component_appl_id
63087 , p_amb_context_code => l_amb_context_code
63088 , p_entity_code => 'TRANSACTIONS'
63089 , p_event_class_code => 'CIP_REVALUATION'
63090 , p_side => 'NA'
63091 );
63092
63093 END IF;
63094
63095 --
63096 --
63097 END IF;
63098 --
63099 -- Bug 4922099
63100 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
63101 (NVL(l_enc_upg_option, 'N') = 'O')
63102 ) AND
63103 (l_bflow_method_code = 'PRIOR_ENTRY')
63104 )
63105 THEN
63106 IF
63107 --
63108 1 = 2
63109 --
63110 THEN
63111 xla_accounting_err_pkg.build_message
63112 (p_appli_s_name => 'XLA'
63113 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
63114 ,p_token_1 => 'LINE_NUMBER'
63115 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
63116 ,p_token_2 => 'LINE_TYPE_NAME'
63117 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
63118 l_component_type
63119 ,l_component_code
63120 ,l_component_type_code
63121 ,l_component_appl_id
63122 ,l_amb_context_code
63123 ,l_entity_code
63124 ,l_event_class_code
63125 )
63126 ,p_token_3 => 'OWNER'
63127 ,p_value_3 => xla_lookups_pkg.get_meaning(
63128 p_lookup_type => 'XLA_OWNER_TYPE'
63129 ,p_lookup_code => l_component_type_code
63130 )
63131 ,p_token_4 => 'PRODUCT_NAME'
63132 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
63133 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
63134 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
63135 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
63136 ,p_ae_header_id => NULL
63137 );
63138
63139 IF (C_LEVEL_ERROR>= g_log_level) THEN
63140 trace
63141 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
63142 ,p_level => C_LEVEL_ERROR
63143 ,p_module => l_log_module);
63144 END IF;
63145 END IF;
63146 END IF;
63147 --
63148 --
63149 ------------------------------------------------------------------------------------------------
63150 -- 4219869 Business Flow
63151 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
63155
63152 -- Prior Entry. Currently, the following code is always generated.
63153 ------------------------------------------------------------------------------------------------
63154 XLA_AE_LINES_PKG.ValidateCurrentLine;
63156 ------------------------------------------------------------------------------------
63157 -- 4219869 Business Flow
63158 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
63159 ------------------------------------------------------------------------------------
63160 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
63161
63162 ----------------------------------------------------------------------------------
63163 -- 4219869 Business Flow
63164 -- Update journal entry status -- Need to generate this within IF <condition>
63165 ----------------------------------------------------------------------------------
63166 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
63167 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
63168 ,p_balance_type_code => l_balance_type_code
63169 );
63170
63171 -------------------------------------------------------------------------------------------
63172 -- 4262811 - Generate the Accrual Reversal lines
63173 -------------------------------------------------------------------------------------------
63174 BEGIN
63175 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
63176 (g_array_event(p_event_id).array_value_num('header_index'));
63177 IF l_acc_rev_flag IS NULL THEN
63178 l_acc_rev_flag := 'N';
63179 END IF;
63180 EXCEPTION
63181 WHEN OTHERS THEN
63182 l_acc_rev_flag := 'N';
63183 END;
63184 --
63185 IF (l_acc_rev_flag = 'Y') THEN
63186
63187 -- 4645092 ------------------------------------------------------------------------------
63188 -- To allow MPA report to determine if it should generate report process
63189 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
63190 ------------------------------------------------------------------------------------------
63191
63192 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
63193 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
63194 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
63195 -- call ADRs
63196 -- Bug 4922099
63197 --
63198 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
63199 (NVL(l_actual_upg_option, 'N') = 'O') OR
63200 (NVL(l_enc_upg_option, 'N') = 'O')
63201 )
63202 THEN
63203 NULL;
63204 --
63205 --
63206
63207 l_ccid := AcctDerRule_175(
63208 p_application_id => p_application_id
63209 , p_ae_header_id => l_ae_header_id
63210 , p_source_5 => p_source_5
63211 , p_source_19 => p_source_19
63212 , p_source_32 => p_source_32
63213 , x_transaction_coa_id => l_adr_transaction_coa_id
63214 , x_accounting_coa_id => l_adr_accounting_coa_id
63215 , x_value_type_code => l_adr_value_type_code
63216 , p_side => 'NA'
63217 );
63218
63219 xla_ae_lines_pkg.set_ccid(
63220 p_code_combination_id => l_ccid
63221 , p_value_type_code => l_adr_value_type_code
63222 , p_transaction_coa_id => l_adr_transaction_coa_id
63223 , p_accounting_coa_id => l_adr_accounting_coa_id
63224 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
63225 , p_adr_type_code => 'S'
63226 , p_component_type => l_component_type
63227 , p_component_code => l_component_code
63228 , p_component_type_code => l_component_type_code
63229 , p_component_appl_id => l_component_appl_id
63230 , p_amb_context_code => l_amb_context_code
63231 , p_side => 'NA'
63232 );
63233
63234
63235 l_segment := AcctDerRule_151(
63236 p_application_id => p_application_id
63237 , p_ae_header_id => l_ae_header_id
63238 , p_source_5 => p_source_5
63239 , p_source_13 => p_source_13
63240 , x_transaction_coa_id => l_adr_transaction_coa_id
63241 , x_accounting_coa_id => l_adr_accounting_coa_id
63242 , x_flexfield_segment_code => l_adr_flexfield_segment_code
63243 , x_flex_value_set_id => l_adr_flex_value_set_id
63244 , x_value_type_code => l_adr_value_type_code
63245 , x_value_combination_id => l_adr_value_combination_id
63246 , x_value_segment_code => l_adr_value_segment_code
63247 , p_side => 'NA'
63248 , p_override_seg_flag => 'Y'
63249 );
63250
63251 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
63252
63253 xla_ae_lines_pkg.set_segment(
63254 p_to_segment_code => 'GL_ACCOUNT'
63255 , p_segment_value => l_segment
63256 , p_from_segment_code => l_adr_value_segment_code
63257 , p_from_combination_id => l_adr_value_combination_id
63258 , p_value_type_code => l_adr_value_type_code
63259 , p_transaction_coa_id => l_adr_transaction_coa_id
63260 , p_accounting_coa_id => l_adr_accounting_coa_id
63261 , p_flexfield_segment_code => l_adr_flexfield_segment_code
63265 , p_component_type => l_component_type
63262 , p_flex_value_set_id => l_adr_flex_value_set_id
63263 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
63264 , p_adr_type_code => 'S'
63266 , p_component_code => l_component_code
63267 , p_component_type_code => l_component_type_code
63268 , p_component_appl_id => l_component_appl_id
63269 , p_amb_context_code => l_amb_context_code
63270 , p_entity_code => 'TRANSACTIONS'
63271 , p_event_class_code => 'CIP_REVALUATION'
63272 , p_side => 'NA'
63273 );
63274
63275 END IF;
63276
63277 l_segment := AcctDerRule_169(
63278 p_application_id => p_application_id
63279 , p_ae_header_id => l_ae_header_id
63280 , p_source_5 => p_source_5
63281 , p_source_31 => p_source_31
63282 , x_transaction_coa_id => l_adr_transaction_coa_id
63283 , x_accounting_coa_id => l_adr_accounting_coa_id
63284 , x_flexfield_segment_code => l_adr_flexfield_segment_code
63285 , x_flex_value_set_id => l_adr_flex_value_set_id
63286 , x_value_type_code => l_adr_value_type_code
63287 , x_value_combination_id => l_adr_value_combination_id
63288 , x_value_segment_code => l_adr_value_segment_code
63289 , p_side => 'NA'
63290 , p_override_seg_flag => 'Y'
63291 );
63292
63293 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
63294
63295 xla_ae_lines_pkg.set_segment(
63296 p_to_segment_code => 'GL_BALANCING'
63297 , p_segment_value => l_segment
63298 , p_from_segment_code => l_adr_value_segment_code
63299 , p_from_combination_id => l_adr_value_combination_id
63300 , p_value_type_code => l_adr_value_type_code
63301 , p_transaction_coa_id => l_adr_transaction_coa_id
63302 , p_accounting_coa_id => l_adr_accounting_coa_id
63303 , p_flexfield_segment_code => l_adr_flexfield_segment_code
63304 , p_flex_value_set_id => l_adr_flex_value_set_id
63305 , p_adr_code => 'FA_EXPENSE_ACCT'
63306 , p_adr_type_code => 'S'
63307 , p_component_type => l_component_type
63308 , p_component_code => l_component_code
63309 , p_component_type_code => l_component_type_code
63310 , p_component_appl_id => l_component_appl_id
63311 , p_amb_context_code => l_amb_context_code
63312 , p_entity_code => 'TRANSACTIONS'
63313 , p_event_class_code => 'CIP_REVALUATION'
63314 , p_side => 'NA'
63315 );
63316
63317 END IF;
63318
63319 --
63320 --
63321 END IF;
63322
63323 --
63324 -- Update the line information that should be overwritten
63325 --
63326 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
63327 p_header_num => 1);
63328 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
63329
63330 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
63331
63332 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
63333 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
63334 END IF;
63335
63336 --
63337 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
63338 --
63339 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
63340 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
63341 ELSE
63342 ---------------------------------------------------------------------------------------------------
63343 -- 4262811a Switch Sign
63344 ---------------------------------------------------------------------------------------------------
63345 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
63346 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
63347 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
63348 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
63349 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
63350 -- 5132302
63351 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
63352 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
63353
63354 END IF;
63355
63356 -- 4955764
63357 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
63358 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
63359
63360
63361 XLA_AE_LINES_PKG.ValidateCurrentLine;
63362 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
63363
63364 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
63365 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
63366 ,p_balance_type_code => l_balance_type_code);
63367
63371 -- 4262811 Multiperiod Accounting
63368 END IF;
63369
63370 -----------------------------------------------------------------------------------------
63372 -----------------------------------------------------------------------------------------
63373 -- No MPA option is assigned.
63374
63375
63376 END IF;
63377 END IF;
63378 --
63379
63380 --
63381 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
63382 trace
63383 (p_msg => 'END of AcctLineType_252'
63384 ,p_level => C_LEVEL_PROCEDURE
63385 ,p_module => l_log_module);
63386 END IF;
63387 --
63388 EXCEPTION
63389 WHEN xla_exceptions_pkg.application_exception THEN
63390 RAISE;
63391 WHEN OTHERS THEN
63392 xla_exceptions_pkg.raise_message
63393 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_252');
63394 END AcctLineType_252;
63395 --
63396
63397 ---------------------------------------
63398 --
63399 -- PRIVATE FUNCTION
63400 -- AcctLineType_253
63401 --
63402 ---------------------------------------
63403 PROCEDURE AcctLineType_253 (
63404 p_application_id IN NUMBER
63405 ,p_event_id IN NUMBER
63406 ,p_calculate_acctd_flag IN VARCHAR2
63407 ,p_calculate_g_l_flag IN VARCHAR2
63408 ,p_actual_flag IN OUT VARCHAR2
63409 ,p_balance_type_code OUT VARCHAR2
63410 ,p_gain_or_loss_ref OUT VARCHAR2
63411
63412 --Period Close Date
63413 , p_source_1 IN DATE
63414 --Generated Code Combination Identifier
63415 , p_source_5 IN NUMBER
63416 --CIP Cost Account
63417 , p_source_9 IN VARCHAR2
63418 --Expense Account Code Combination Identifier
63419 , p_source_31 IN NUMBER
63420 --Default Code Combination Identifier
63421 , p_source_32 IN NUMBER
63422 --Adjustment Type
63423 , p_source_48 IN VARCHAR2
63424 --Transaction Header Identifier
63425 , p_source_49 IN NUMBER
63426 --Adjustment Line Identifier
63427 , p_source_50 IN NUMBER
63428 --Distribution Type Code
63429 , p_source_51 IN VARCHAR2
63430 --Entered Amount
63431 , p_source_52 IN NUMBER
63432 --Currency Code
63433 , p_source_53 IN VARCHAR2
63434 --Source Destination Code
63435 , p_source_55 IN VARCHAR2
63436 )
63437 IS
63438
63439 l_component_type VARCHAR2(80);
63440 l_component_code VARCHAR2(30);
63441 l_component_type_code VARCHAR2(1);
63442 l_component_appl_id INTEGER;
63443 l_amb_context_code VARCHAR2(30);
63444 l_entity_code VARCHAR2(30);
63445 l_event_class_code VARCHAR2(30);
63446 l_ae_header_id NUMBER;
63447 l_event_type_code VARCHAR2(30);
63448 l_line_definition_code VARCHAR2(30);
63449 l_line_definition_owner_code VARCHAR2(1);
63450 --
63451 -- adr variables
63452 l_segment VARCHAR2(30);
63453 l_ccid NUMBER;
63454 l_adr_transaction_coa_id NUMBER;
63455 l_adr_accounting_coa_id NUMBER;
63456 l_adr_flexfield_segment_code VARCHAR2(30);
63457 l_adr_flex_value_set_id NUMBER;
63458 l_adr_value_type_code VARCHAR2(30);
63459 l_adr_value_combination_id NUMBER;
63460 l_adr_value_segment_code VARCHAR2(30);
63461
63462 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
63463 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
63464 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
63465 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
63466
63467 -- 4262811 Variables ------------------------------------------------------------------------------------------
63468 l_entered_amt_idx NUMBER;
63469 l_accted_amt_idx NUMBER;
63470 l_acc_rev_flag VARCHAR2(1);
63471 l_accrual_line_num NUMBER;
63472 l_tmp_amt NUMBER;
63473 l_acc_rev_natural_side_code VARCHAR2(1);
63474
63475 l_num_entries NUMBER;
63476 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
63477 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
63478 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
63479 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
63480 l_recog_line_1 NUMBER;
63481 l_recog_line_2 NUMBER;
63482
63483 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
63484 l_bflow_applied_to_amt NUMBER; -- 5132302
63485 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
63486
63487 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
63488
63489 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
63490 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
63491
63492 ---------------------------------------------------------------------------------------------------------------
63493
63494
63495 --
63496 -- bulk performance
63497 --
63498 l_balance_type_code VARCHAR2(1);
63499 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
63500 l_log_module VARCHAR2(240);
63501
63502 --
63506 l_enc_upg_option VARCHAR2(1);
63503 -- Upgrade strategy
63504 --
63505 l_actual_upg_option VARCHAR2(1);
63507
63508 --
63509 BEGIN
63510 --
63511 IF g_log_enabled THEN
63512 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_253';
63513 END IF;
63514 --
63515 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
63516
63517 trace
63518 (p_msg => 'BEGIN of AcctLineType_253'
63519 ,p_level => C_LEVEL_PROCEDURE
63520 ,p_module => l_log_module);
63521
63522 END IF;
63523 --
63524 l_component_type := 'AMB_JLT';
63525 l_component_code := 'FA_CIP_TRANSFER_DEST_COST';
63526 l_component_type_code := 'S';
63527 l_component_appl_id := 140;
63528 l_amb_context_code := 'DEFAULT';
63529 l_entity_code := 'TRANSACTIONS';
63530 l_event_class_code := 'CIP_TRANSFERS';
63531 l_event_type_code := 'CIP_TRANSFERS_ALL';
63532 l_line_definition_owner_code := 'S';
63533 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_T12';
63534 --
63535 l_balance_type_code := 'A';
63536 l_segment := NULL;
63537 l_ccid := NULL;
63538 l_adr_transaction_coa_id := NULL;
63539 l_adr_accounting_coa_id := NULL;
63540 l_adr_flexfield_segment_code := NULL;
63541 l_adr_flex_value_set_id := NULL;
63542 l_adr_value_type_code := NULL;
63543 l_adr_value_combination_id := NULL;
63544 l_adr_value_segment_code := NULL;
63545
63546 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
63547 l_bflow_class_code := ''; -- 4219869 Business Flow
63548 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
63549 l_budgetary_control_flag := 'N';
63550
63551 l_bflow_applied_to_amt_idx := NULL; -- 5132302
63552 l_bflow_applied_to_amt := NULL; -- 5132302
63553 l_entered_amt_idx := NULL; -- 4262811
63554 l_accted_amt_idx := NULL; -- 4262811
63555 l_acc_rev_flag := NULL; -- 4262811
63556 l_accrual_line_num := NULL; -- 4262811
63557 l_tmp_amt := NULL; -- 4262811
63558 --
63559
63560 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
63561 l_balance_type_code <> 'B' THEN
63562 IF NVL(p_source_48,'
63563 ') = 'CIP COST' AND
63564 NVL(p_source_55,'
63565 ') = 'DEST'
63566 THEN
63567
63568 --
63569 XLA_AE_LINES_PKG.SetNewLine;
63570
63571 p_balance_type_code := l_balance_type_code;
63572 -- set the flag so later we will know whether the gain loss line needs to be created
63573
63574 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
63575 p_actual_flag :='A';
63576 END IF;
63577
63578 --
63579 -- bulk performance
63580 --
63581 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
63582 p_header_num => 0); -- 4262811
63583 --
63584 -- set accounting line options
63585 --
63586 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
63587 p_natural_side_code => 'D'
63588 , p_gain_or_loss_flag => 'N'
63589 , p_gl_transfer_mode_code => 'S'
63590 , p_acct_entry_type_code => 'A'
63591 , p_switch_side_flag => 'Y'
63592 , p_merge_duplicate_code => 'N'
63593 );
63594 --
63595 l_acc_rev_natural_side_code := 'C'; -- 4262811
63596 --
63597 --
63598 -- set accounting line type info
63599 --
63600 xla_ae_lines_pkg.SetAcctLineType
63601 (p_component_type => l_component_type
63602 ,p_event_type_code => l_event_type_code
63603 ,p_line_definition_owner_code => l_line_definition_owner_code
63604 ,p_line_definition_code => l_line_definition_code
63605 ,p_accounting_line_code => l_component_code
63606 ,p_accounting_line_type_code => l_component_type_code
63607 ,p_accounting_line_appl_id => l_component_appl_id
63608 ,p_amb_context_code => l_amb_context_code
63609 ,p_entity_code => l_entity_code
63610 ,p_event_class_code => l_event_class_code);
63611 --
63612 -- set accounting class
63613 --
63614 xla_ae_lines_pkg.SetAcctClass(
63615 p_accounting_class_code => 'ASSET'
63616 , p_ae_header_id => l_ae_header_id
63617 );
63618
63619 --
63620 -- set rounding class
63621 --
63622 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
63623 'ASSET';
63624
63625 --
63626 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
63627 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
63628 --
63629 -- bulk performance
63630 --
63631 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
63632
63633 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
63637 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
63634 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
63635
63636 -- 4955764
63638 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
63639
63640 -- 4458381 Public Sector Enh
63641
63642 --
63643 -- set accounting attributes for the line type
63644 --
63645 l_entered_amt_idx := 4;
63646 l_accted_amt_idx := 6;
63647 l_bflow_applied_to_amt_idx := NULL; -- 5132302
63648 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
63649 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
63650 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
63651 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
63652 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
63653 l_rec_acct_attrs.array_char_value(3) := p_source_51;
63654 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
63655 l_rec_acct_attrs.array_num_value(4) := p_source_52;
63656 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
63657 l_rec_acct_attrs.array_char_value(5) := p_source_53;
63658 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
63659 l_rec_acct_attrs.array_num_value(6) := p_source_52;
63660
63661 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
63662 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
63663
63664 ---------------------------------------------------------------------------------------------------------------
63665 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
63666 ---------------------------------------------------------------------------------------------------------------
63667 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
63668
63669 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
63670 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
63671
63672 IF xla_accounting_cache_pkg.GetValueChar
63673 (p_source_code => 'LEDGER_CATEGORY_CODE'
63674 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
63675 AND l_bflow_method_code = 'PRIOR_ENTRY'
63676 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
63677 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
63678 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
63679 )
63680 THEN
63681 xla_ae_lines_pkg.BflowUpgEntry
63682 (p_business_method_code => l_bflow_method_code
63683 ,p_business_class_code => l_bflow_class_code
63684 ,p_balance_type => l_balance_type_code);
63685 ELSE
63686 NULL;
63687 -- No business flow processing for business flow method of NONE.
63688 END IF;
63689
63690 --
63691 -- call analytical criteria
63692 --
63693
63694 --
63695 -- call description
63696 --
63697
63698 xla_ae_lines_pkg.SetLineDescription(
63699 p_ae_header_id => l_ae_header_id
63700 ,p_description => Description_45 (
63701 p_application_id => p_application_id
63702 , p_ae_header_id => l_ae_header_id
63703 , p_source_1 => p_source_1
63704 )
63705 );
63706
63707
63708 --
63709 -- call ADRs
63710 -- Bug 4922099
63711 --
63712 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
63713 (NVL(l_actual_upg_option, 'N') = 'O') OR
63714 (NVL(l_enc_upg_option, 'N') = 'O')
63715 )
63716 THEN
63717 NULL;
63718 --
63719 --
63720
63721 l_ccid := AcctDerRule_174(
63722 p_application_id => p_application_id
63723 , p_ae_header_id => l_ae_header_id
63724 , p_source_5 => p_source_5
63725 , p_source_32 => p_source_32
63726 , x_transaction_coa_id => l_adr_transaction_coa_id
63727 , x_accounting_coa_id => l_adr_accounting_coa_id
63728 , x_value_type_code => l_adr_value_type_code
63729 , p_side => 'NA'
63730 );
63731
63732 xla_ae_lines_pkg.set_ccid(
63733 p_code_combination_id => l_ccid
63734 , p_value_type_code => l_adr_value_type_code
63735 , p_transaction_coa_id => l_adr_transaction_coa_id
63736 , p_accounting_coa_id => l_adr_accounting_coa_id
63737 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
63738 , p_adr_type_code => 'S'
63739 , p_component_type => l_component_type
63740 , p_component_code => l_component_code
63741 , p_component_type_code => l_component_type_code
63742 , p_component_appl_id => l_component_appl_id
63743 , p_amb_context_code => l_amb_context_code
63744 , p_side => 'NA'
63745 );
63746
63747
63748 l_segment := AcctDerRule_147(
63749 p_application_id => p_application_id
63750 , p_ae_header_id => l_ae_header_id
63751 , p_source_5 => p_source_5
63752 , p_source_9 => p_source_9
63756 , x_flex_value_set_id => l_adr_flex_value_set_id
63753 , x_transaction_coa_id => l_adr_transaction_coa_id
63754 , x_accounting_coa_id => l_adr_accounting_coa_id
63755 , x_flexfield_segment_code => l_adr_flexfield_segment_code
63757 , x_value_type_code => l_adr_value_type_code
63758 , x_value_combination_id => l_adr_value_combination_id
63759 , x_value_segment_code => l_adr_value_segment_code
63760 , p_side => 'NA'
63761 , p_override_seg_flag => 'Y'
63762 );
63763
63764 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
63765
63766 xla_ae_lines_pkg.set_segment(
63767 p_to_segment_code => 'GL_ACCOUNT'
63768 , p_segment_value => l_segment
63769 , p_from_segment_code => l_adr_value_segment_code
63770 , p_from_combination_id => l_adr_value_combination_id
63771 , p_value_type_code => l_adr_value_type_code
63772 , p_transaction_coa_id => l_adr_transaction_coa_id
63773 , p_accounting_coa_id => l_adr_accounting_coa_id
63774 , p_flexfield_segment_code => l_adr_flexfield_segment_code
63775 , p_flex_value_set_id => l_adr_flex_value_set_id
63776 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
63777 , p_adr_type_code => 'S'
63778 , p_component_type => l_component_type
63779 , p_component_code => l_component_code
63780 , p_component_type_code => l_component_type_code
63781 , p_component_appl_id => l_component_appl_id
63782 , p_amb_context_code => l_amb_context_code
63783 , p_entity_code => 'TRANSACTIONS'
63784 , p_event_class_code => 'CIP_TRANSFERS'
63785 , p_side => 'NA'
63786 );
63787
63788 END IF;
63789
63790 l_segment := AcctDerRule_169(
63791 p_application_id => p_application_id
63792 , p_ae_header_id => l_ae_header_id
63793 , p_source_5 => p_source_5
63794 , p_source_31 => p_source_31
63795 , x_transaction_coa_id => l_adr_transaction_coa_id
63796 , x_accounting_coa_id => l_adr_accounting_coa_id
63797 , x_flexfield_segment_code => l_adr_flexfield_segment_code
63798 , x_flex_value_set_id => l_adr_flex_value_set_id
63799 , x_value_type_code => l_adr_value_type_code
63800 , x_value_combination_id => l_adr_value_combination_id
63801 , x_value_segment_code => l_adr_value_segment_code
63802 , p_side => 'NA'
63803 , p_override_seg_flag => 'Y'
63804 );
63805
63806 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
63807
63808 xla_ae_lines_pkg.set_segment(
63809 p_to_segment_code => 'GL_BALANCING'
63810 , p_segment_value => l_segment
63811 , p_from_segment_code => l_adr_value_segment_code
63812 , p_from_combination_id => l_adr_value_combination_id
63813 , p_value_type_code => l_adr_value_type_code
63814 , p_transaction_coa_id => l_adr_transaction_coa_id
63815 , p_accounting_coa_id => l_adr_accounting_coa_id
63816 , p_flexfield_segment_code => l_adr_flexfield_segment_code
63817 , p_flex_value_set_id => l_adr_flex_value_set_id
63818 , p_adr_code => 'FA_EXPENSE_ACCT'
63819 , p_adr_type_code => 'S'
63820 , p_component_type => l_component_type
63821 , p_component_code => l_component_code
63822 , p_component_type_code => l_component_type_code
63823 , p_component_appl_id => l_component_appl_id
63824 , p_amb_context_code => l_amb_context_code
63825 , p_entity_code => 'TRANSACTIONS'
63826 , p_event_class_code => 'CIP_TRANSFERS'
63827 , p_side => 'NA'
63828 );
63829
63830 END IF;
63831
63832 --
63833 --
63834 END IF;
63835 --
63836 -- Bug 4922099
63837 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
63838 (NVL(l_enc_upg_option, 'N') = 'O')
63839 ) AND
63840 (l_bflow_method_code = 'PRIOR_ENTRY')
63841 )
63842 THEN
63843 IF
63844 --
63845 1 = 2
63846 --
63847 THEN
63848 xla_accounting_err_pkg.build_message
63849 (p_appli_s_name => 'XLA'
63850 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
63851 ,p_token_1 => 'LINE_NUMBER'
63852 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
63853 ,p_token_2 => 'LINE_TYPE_NAME'
63854 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
63855 l_component_type
63856 ,l_component_code
63857 ,l_component_type_code
63858 ,l_component_appl_id
63859 ,l_amb_context_code
63863 ,p_token_3 => 'OWNER'
63860 ,l_entity_code
63861 ,l_event_class_code
63862 )
63864 ,p_value_3 => xla_lookups_pkg.get_meaning(
63865 p_lookup_type => 'XLA_OWNER_TYPE'
63866 ,p_lookup_code => l_component_type_code
63867 )
63868 ,p_token_4 => 'PRODUCT_NAME'
63869 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
63870 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
63871 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
63872 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
63873 ,p_ae_header_id => NULL
63874 );
63875
63876 IF (C_LEVEL_ERROR>= g_log_level) THEN
63877 trace
63878 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
63879 ,p_level => C_LEVEL_ERROR
63880 ,p_module => l_log_module);
63881 END IF;
63882 END IF;
63883 END IF;
63884 --
63885 --
63886 ------------------------------------------------------------------------------------------------
63887 -- 4219869 Business Flow
63888 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
63889 -- Prior Entry. Currently, the following code is always generated.
63890 ------------------------------------------------------------------------------------------------
63891 XLA_AE_LINES_PKG.ValidateCurrentLine;
63892
63893 ------------------------------------------------------------------------------------
63894 -- 4219869 Business Flow
63895 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
63896 ------------------------------------------------------------------------------------
63897 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
63898
63899 ----------------------------------------------------------------------------------
63900 -- 4219869 Business Flow
63901 -- Update journal entry status -- Need to generate this within IF <condition>
63902 ----------------------------------------------------------------------------------
63903 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
63904 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
63905 ,p_balance_type_code => l_balance_type_code
63906 );
63907
63908 -------------------------------------------------------------------------------------------
63909 -- 4262811 - Generate the Accrual Reversal lines
63910 -------------------------------------------------------------------------------------------
63911 BEGIN
63912 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
63913 (g_array_event(p_event_id).array_value_num('header_index'));
63914 IF l_acc_rev_flag IS NULL THEN
63915 l_acc_rev_flag := 'N';
63916 END IF;
63917 EXCEPTION
63918 WHEN OTHERS THEN
63919 l_acc_rev_flag := 'N';
63920 END;
63921 --
63922 IF (l_acc_rev_flag = 'Y') THEN
63923
63924 -- 4645092 ------------------------------------------------------------------------------
63925 -- To allow MPA report to determine if it should generate report process
63926 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
63927 ------------------------------------------------------------------------------------------
63928
63929 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
63930 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
63931 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
63932 -- call ADRs
63933 -- Bug 4922099
63934 --
63935 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
63936 (NVL(l_actual_upg_option, 'N') = 'O') OR
63937 (NVL(l_enc_upg_option, 'N') = 'O')
63938 )
63939 THEN
63940 NULL;
63941 --
63942 --
63943
63944 l_ccid := AcctDerRule_174(
63945 p_application_id => p_application_id
63946 , p_ae_header_id => l_ae_header_id
63947 , p_source_5 => p_source_5
63948 , p_source_32 => p_source_32
63949 , x_transaction_coa_id => l_adr_transaction_coa_id
63950 , x_accounting_coa_id => l_adr_accounting_coa_id
63951 , x_value_type_code => l_adr_value_type_code
63952 , p_side => 'NA'
63953 );
63954
63955 xla_ae_lines_pkg.set_ccid(
63956 p_code_combination_id => l_ccid
63957 , p_value_type_code => l_adr_value_type_code
63958 , p_transaction_coa_id => l_adr_transaction_coa_id
63959 , p_accounting_coa_id => l_adr_accounting_coa_id
63960 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
63964 , p_component_type_code => l_component_type_code
63961 , p_adr_type_code => 'S'
63962 , p_component_type => l_component_type
63963 , p_component_code => l_component_code
63965 , p_component_appl_id => l_component_appl_id
63966 , p_amb_context_code => l_amb_context_code
63967 , p_side => 'NA'
63968 );
63969
63970
63971 l_segment := AcctDerRule_147(
63972 p_application_id => p_application_id
63973 , p_ae_header_id => l_ae_header_id
63974 , p_source_5 => p_source_5
63975 , p_source_9 => p_source_9
63976 , x_transaction_coa_id => l_adr_transaction_coa_id
63977 , x_accounting_coa_id => l_adr_accounting_coa_id
63978 , x_flexfield_segment_code => l_adr_flexfield_segment_code
63979 , x_flex_value_set_id => l_adr_flex_value_set_id
63980 , x_value_type_code => l_adr_value_type_code
63981 , x_value_combination_id => l_adr_value_combination_id
63982 , x_value_segment_code => l_adr_value_segment_code
63983 , p_side => 'NA'
63984 , p_override_seg_flag => 'Y'
63985 );
63986
63987 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
63988
63989 xla_ae_lines_pkg.set_segment(
63990 p_to_segment_code => 'GL_ACCOUNT'
63991 , p_segment_value => l_segment
63992 , p_from_segment_code => l_adr_value_segment_code
63993 , p_from_combination_id => l_adr_value_combination_id
63994 , p_value_type_code => l_adr_value_type_code
63995 , p_transaction_coa_id => l_adr_transaction_coa_id
63996 , p_accounting_coa_id => l_adr_accounting_coa_id
63997 , p_flexfield_segment_code => l_adr_flexfield_segment_code
63998 , p_flex_value_set_id => l_adr_flex_value_set_id
63999 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
64000 , p_adr_type_code => 'S'
64001 , p_component_type => l_component_type
64002 , p_component_code => l_component_code
64003 , p_component_type_code => l_component_type_code
64004 , p_component_appl_id => l_component_appl_id
64005 , p_amb_context_code => l_amb_context_code
64006 , p_entity_code => 'TRANSACTIONS'
64007 , p_event_class_code => 'CIP_TRANSFERS'
64008 , p_side => 'NA'
64009 );
64010
64011 END IF;
64012
64013 l_segment := AcctDerRule_169(
64014 p_application_id => p_application_id
64015 , p_ae_header_id => l_ae_header_id
64016 , p_source_5 => p_source_5
64017 , p_source_31 => p_source_31
64018 , x_transaction_coa_id => l_adr_transaction_coa_id
64019 , x_accounting_coa_id => l_adr_accounting_coa_id
64020 , x_flexfield_segment_code => l_adr_flexfield_segment_code
64021 , x_flex_value_set_id => l_adr_flex_value_set_id
64022 , x_value_type_code => l_adr_value_type_code
64023 , x_value_combination_id => l_adr_value_combination_id
64024 , x_value_segment_code => l_adr_value_segment_code
64025 , p_side => 'NA'
64026 , p_override_seg_flag => 'Y'
64027 );
64028
64029 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
64030
64031 xla_ae_lines_pkg.set_segment(
64032 p_to_segment_code => 'GL_BALANCING'
64033 , p_segment_value => l_segment
64034 , p_from_segment_code => l_adr_value_segment_code
64035 , p_from_combination_id => l_adr_value_combination_id
64036 , p_value_type_code => l_adr_value_type_code
64037 , p_transaction_coa_id => l_adr_transaction_coa_id
64038 , p_accounting_coa_id => l_adr_accounting_coa_id
64039 , p_flexfield_segment_code => l_adr_flexfield_segment_code
64040 , p_flex_value_set_id => l_adr_flex_value_set_id
64041 , p_adr_code => 'FA_EXPENSE_ACCT'
64042 , p_adr_type_code => 'S'
64043 , p_component_type => l_component_type
64044 , p_component_code => l_component_code
64045 , p_component_type_code => l_component_type_code
64046 , p_component_appl_id => l_component_appl_id
64047 , p_amb_context_code => l_amb_context_code
64048 , p_entity_code => 'TRANSACTIONS'
64049 , p_event_class_code => 'CIP_TRANSFERS'
64050 , p_side => 'NA'
64051 );
64052
64053 END IF;
64054
64055 --
64056 --
64057 END IF;
64058
64059 --
64060 -- Update the line information that should be overwritten
64061 --
64062 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
64063 p_header_num => 1);
64064 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
64065
64066 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
64067
64068 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
64069 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
64070 END IF;
64071
64075 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
64072 --
64073 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
64074 --
64076 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
64077 ELSE
64078 ---------------------------------------------------------------------------------------------------
64079 -- 4262811a Switch Sign
64080 ---------------------------------------------------------------------------------------------------
64081 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
64082 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
64083 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
64084 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
64085 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
64086 -- 5132302
64087 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
64088 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
64089
64090 END IF;
64091
64092 -- 4955764
64093 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
64094 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
64095
64096
64097 XLA_AE_LINES_PKG.ValidateCurrentLine;
64098 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
64099
64100 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
64101 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
64102 ,p_balance_type_code => l_balance_type_code);
64103
64104 END IF;
64105
64106 -----------------------------------------------------------------------------------------
64107 -- 4262811 Multiperiod Accounting
64108 -----------------------------------------------------------------------------------------
64109 -- No MPA option is assigned.
64110
64111
64112 END IF;
64113 END IF;
64114 --
64115
64116 --
64117 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
64118 trace
64119 (p_msg => 'END of AcctLineType_253'
64120 ,p_level => C_LEVEL_PROCEDURE
64121 ,p_module => l_log_module);
64122 END IF;
64123 --
64124 EXCEPTION
64125 WHEN xla_exceptions_pkg.application_exception THEN
64126 RAISE;
64127 WHEN OTHERS THEN
64128 xla_exceptions_pkg.raise_message
64129 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_253');
64130 END AcctLineType_253;
64131 --
64132
64133 ---------------------------------------
64134 --
64135 -- PRIVATE FUNCTION
64136 -- AcctLineType_254
64137 --
64138 ---------------------------------------
64139 PROCEDURE AcctLineType_254 (
64140 p_application_id IN NUMBER
64141 ,p_event_id IN NUMBER
64142 ,p_calculate_acctd_flag IN VARCHAR2
64143 ,p_calculate_g_l_flag IN VARCHAR2
64144 ,p_actual_flag IN OUT VARCHAR2
64145 ,p_balance_type_code OUT VARCHAR2
64146 ,p_gain_or_loss_ref OUT VARCHAR2
64147
64148 --Period Close Date
64149 , p_source_1 IN DATE
64150 --Generated Code Combination Identifier
64151 , p_source_5 IN NUMBER
64152 --Revaluation Reserve Account
64153 , p_source_13 IN VARCHAR2
64154 --Generated Offset Code Combination Identifier
64155 , p_source_19 IN NUMBER
64156 --Expense Account Code Combination Identifier
64157 , p_source_31 IN NUMBER
64158 --Default Code Combination Identifier
64159 , p_source_32 IN NUMBER
64160 --Adjustment Type
64161 , p_source_48 IN VARCHAR2
64162 --Transaction Header Identifier
64163 , p_source_49 IN NUMBER
64164 --Adjustment Line Identifier
64165 , p_source_50 IN NUMBER
64166 --Distribution Type Code
64167 , p_source_51 IN VARCHAR2
64168 --Entered Amount
64169 , p_source_52 IN NUMBER
64170 --Currency Code
64171 , p_source_53 IN VARCHAR2
64172 --Source Destination Code
64173 , p_source_55 IN VARCHAR2
64174 )
64175 IS
64176
64177 l_component_type VARCHAR2(80);
64178 l_component_code VARCHAR2(30);
64179 l_component_type_code VARCHAR2(1);
64180 l_component_appl_id INTEGER;
64181 l_amb_context_code VARCHAR2(30);
64182 l_entity_code VARCHAR2(30);
64183 l_event_class_code VARCHAR2(30);
64184 l_ae_header_id NUMBER;
64185 l_event_type_code VARCHAR2(30);
64186 l_line_definition_code VARCHAR2(30);
64187 l_line_definition_owner_code VARCHAR2(1);
64188 --
64189 -- adr variables
64190 l_segment VARCHAR2(30);
64191 l_ccid NUMBER;
64192 l_adr_transaction_coa_id NUMBER;
64193 l_adr_accounting_coa_id NUMBER;
64194 l_adr_flexfield_segment_code VARCHAR2(30);
64195 l_adr_flex_value_set_id NUMBER;
64196 l_adr_value_type_code VARCHAR2(30);
64200 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
64197 l_adr_value_combination_id NUMBER;
64198 l_adr_value_segment_code VARCHAR2(30);
64199
64201 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
64202 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
64203 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
64204
64205 -- 4262811 Variables ------------------------------------------------------------------------------------------
64206 l_entered_amt_idx NUMBER;
64207 l_accted_amt_idx NUMBER;
64208 l_acc_rev_flag VARCHAR2(1);
64209 l_accrual_line_num NUMBER;
64210 l_tmp_amt NUMBER;
64211 l_acc_rev_natural_side_code VARCHAR2(1);
64212
64213 l_num_entries NUMBER;
64214 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
64215 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
64216 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
64217 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
64218 l_recog_line_1 NUMBER;
64219 l_recog_line_2 NUMBER;
64220
64221 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
64222 l_bflow_applied_to_amt NUMBER; -- 5132302
64223 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
64224
64225 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
64226
64227 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
64228 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
64229
64230 ---------------------------------------------------------------------------------------------------------------
64231
64232
64233 --
64234 -- bulk performance
64235 --
64236 l_balance_type_code VARCHAR2(1);
64237 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
64238 l_log_module VARCHAR2(240);
64239
64240 --
64241 -- Upgrade strategy
64242 --
64243 l_actual_upg_option VARCHAR2(1);
64244 l_enc_upg_option VARCHAR2(1);
64245
64246 --
64247 BEGIN
64248 --
64249 IF g_log_enabled THEN
64250 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_254';
64251 END IF;
64252 --
64253 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
64254
64255 trace
64256 (p_msg => 'BEGIN of AcctLineType_254'
64257 ,p_level => C_LEVEL_PROCEDURE
64258 ,p_module => l_log_module);
64259
64260 END IF;
64261 --
64262 l_component_type := 'AMB_JLT';
64263 l_component_code := 'FA_CIP_TRANSFER_DEST_REVAL_RES';
64264 l_component_type_code := 'S';
64265 l_component_appl_id := 140;
64266 l_amb_context_code := 'DEFAULT';
64267 l_entity_code := 'TRANSACTIONS';
64268 l_event_class_code := 'CIP_TRANSFERS';
64269 l_event_type_code := 'CIP_TRANSFERS_ALL';
64270 l_line_definition_owner_code := 'S';
64271 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_T12';
64272 --
64273 l_balance_type_code := 'A';
64274 l_segment := NULL;
64275 l_ccid := NULL;
64276 l_adr_transaction_coa_id := NULL;
64277 l_adr_accounting_coa_id := NULL;
64278 l_adr_flexfield_segment_code := NULL;
64279 l_adr_flex_value_set_id := NULL;
64280 l_adr_value_type_code := NULL;
64281 l_adr_value_combination_id := NULL;
64282 l_adr_value_segment_code := NULL;
64283
64284 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
64285 l_bflow_class_code := ''; -- 4219869 Business Flow
64286 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
64287 l_budgetary_control_flag := 'N';
64288
64289 l_bflow_applied_to_amt_idx := NULL; -- 5132302
64290 l_bflow_applied_to_amt := NULL; -- 5132302
64291 l_entered_amt_idx := NULL; -- 4262811
64292 l_accted_amt_idx := NULL; -- 4262811
64293 l_acc_rev_flag := NULL; -- 4262811
64294 l_accrual_line_num := NULL; -- 4262811
64295 l_tmp_amt := NULL; -- 4262811
64296 --
64297
64298 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
64299 l_balance_type_code <> 'B' THEN
64300 IF NVL(p_source_48,'
64301 ') = 'REVAL RESERVE' AND
64302 NVL(p_source_55,'
64303 ') = 'DEST'
64304 THEN
64305
64306 --
64307 XLA_AE_LINES_PKG.SetNewLine;
64308
64309 p_balance_type_code := l_balance_type_code;
64310 -- set the flag so later we will know whether the gain loss line needs to be created
64311
64312 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
64313 p_actual_flag :='A';
64314 END IF;
64315
64316 --
64317 -- bulk performance
64318 --
64319 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
64320 p_header_num => 0); -- 4262811
64321 --
64322 -- set accounting line options
64323 --
64324 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
64325 p_natural_side_code => 'C'
64326 , p_gain_or_loss_flag => 'N'
64330 , p_merge_duplicate_code => 'N'
64327 , p_gl_transfer_mode_code => 'S'
64328 , p_acct_entry_type_code => 'A'
64329 , p_switch_side_flag => 'Y'
64331 );
64332 --
64333 l_acc_rev_natural_side_code := 'D'; -- 4262811
64334 --
64335 --
64336 -- set accounting line type info
64337 --
64338 xla_ae_lines_pkg.SetAcctLineType
64339 (p_component_type => l_component_type
64340 ,p_event_type_code => l_event_type_code
64341 ,p_line_definition_owner_code => l_line_definition_owner_code
64342 ,p_line_definition_code => l_line_definition_code
64343 ,p_accounting_line_code => l_component_code
64344 ,p_accounting_line_type_code => l_component_type_code
64345 ,p_accounting_line_appl_id => l_component_appl_id
64346 ,p_amb_context_code => l_amb_context_code
64347 ,p_entity_code => l_entity_code
64348 ,p_event_class_code => l_event_class_code);
64349 --
64350 -- set accounting class
64351 --
64352 xla_ae_lines_pkg.SetAcctClass(
64353 p_accounting_class_code => 'ASSET'
64354 , p_ae_header_id => l_ae_header_id
64355 );
64356
64357 --
64358 -- set rounding class
64359 --
64360 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
64361 'ASSET';
64362
64363 --
64364 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
64365 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
64366 --
64367 -- bulk performance
64368 --
64369 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
64370
64371 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
64372 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
64373
64374 -- 4955764
64375 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
64376 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
64377
64378 -- 4458381 Public Sector Enh
64379
64380 --
64381 -- set accounting attributes for the line type
64382 --
64383 l_entered_amt_idx := 4;
64384 l_accted_amt_idx := 6;
64385 l_bflow_applied_to_amt_idx := NULL; -- 5132302
64386 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
64387 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
64388 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
64389 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
64390 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
64391 l_rec_acct_attrs.array_char_value(3) := p_source_51;
64392 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
64393 l_rec_acct_attrs.array_num_value(4) := p_source_52;
64394 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
64395 l_rec_acct_attrs.array_char_value(5) := p_source_53;
64396 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
64397 l_rec_acct_attrs.array_num_value(6) := p_source_52;
64398
64399 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
64400 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
64401
64402 ---------------------------------------------------------------------------------------------------------------
64403 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
64404 ---------------------------------------------------------------------------------------------------------------
64405 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
64406
64407 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
64408 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
64409
64410 IF xla_accounting_cache_pkg.GetValueChar
64411 (p_source_code => 'LEDGER_CATEGORY_CODE'
64412 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
64413 AND l_bflow_method_code = 'PRIOR_ENTRY'
64414 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
64415 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
64416 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
64417 )
64418 THEN
64419 xla_ae_lines_pkg.BflowUpgEntry
64420 (p_business_method_code => l_bflow_method_code
64421 ,p_business_class_code => l_bflow_class_code
64422 ,p_balance_type => l_balance_type_code);
64423 ELSE
64424 NULL;
64425 -- No business flow processing for business flow method of NONE.
64426 END IF;
64427
64428 --
64429 -- call analytical criteria
64430 --
64431
64432 --
64433 -- call description
64434 --
64435
64436 xla_ae_lines_pkg.SetLineDescription(
64437 p_ae_header_id => l_ae_header_id
64438 ,p_description => Description_48 (
64439 p_application_id => p_application_id
64440 , p_ae_header_id => l_ae_header_id
64441 , p_source_1 => p_source_1
64445
64442 )
64443 );
64444
64446 --
64447 -- call ADRs
64448 -- Bug 4922099
64449 --
64450 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
64451 (NVL(l_actual_upg_option, 'N') = 'O') OR
64452 (NVL(l_enc_upg_option, 'N') = 'O')
64453 )
64454 THEN
64455 NULL;
64456 --
64457 --
64458
64459 l_ccid := AcctDerRule_175(
64460 p_application_id => p_application_id
64461 , p_ae_header_id => l_ae_header_id
64462 , p_source_5 => p_source_5
64463 , p_source_19 => p_source_19
64464 , p_source_32 => p_source_32
64465 , x_transaction_coa_id => l_adr_transaction_coa_id
64466 , x_accounting_coa_id => l_adr_accounting_coa_id
64467 , x_value_type_code => l_adr_value_type_code
64468 , p_side => 'NA'
64469 );
64470
64471 xla_ae_lines_pkg.set_ccid(
64472 p_code_combination_id => l_ccid
64473 , p_value_type_code => l_adr_value_type_code
64474 , p_transaction_coa_id => l_adr_transaction_coa_id
64475 , p_accounting_coa_id => l_adr_accounting_coa_id
64476 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
64477 , p_adr_type_code => 'S'
64478 , p_component_type => l_component_type
64479 , p_component_code => l_component_code
64480 , p_component_type_code => l_component_type_code
64481 , p_component_appl_id => l_component_appl_id
64482 , p_amb_context_code => l_amb_context_code
64483 , p_side => 'NA'
64484 );
64485
64486
64487 l_segment := AcctDerRule_151(
64488 p_application_id => p_application_id
64489 , p_ae_header_id => l_ae_header_id
64490 , p_source_5 => p_source_5
64491 , p_source_13 => p_source_13
64492 , x_transaction_coa_id => l_adr_transaction_coa_id
64493 , x_accounting_coa_id => l_adr_accounting_coa_id
64494 , x_flexfield_segment_code => l_adr_flexfield_segment_code
64495 , x_flex_value_set_id => l_adr_flex_value_set_id
64496 , x_value_type_code => l_adr_value_type_code
64497 , x_value_combination_id => l_adr_value_combination_id
64498 , x_value_segment_code => l_adr_value_segment_code
64499 , p_side => 'NA'
64500 , p_override_seg_flag => 'Y'
64501 );
64502
64503 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
64504
64505 xla_ae_lines_pkg.set_segment(
64506 p_to_segment_code => 'GL_ACCOUNT'
64507 , p_segment_value => l_segment
64508 , p_from_segment_code => l_adr_value_segment_code
64509 , p_from_combination_id => l_adr_value_combination_id
64510 , p_value_type_code => l_adr_value_type_code
64511 , p_transaction_coa_id => l_adr_transaction_coa_id
64512 , p_accounting_coa_id => l_adr_accounting_coa_id
64513 , p_flexfield_segment_code => l_adr_flexfield_segment_code
64514 , p_flex_value_set_id => l_adr_flex_value_set_id
64515 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
64516 , p_adr_type_code => 'S'
64517 , p_component_type => l_component_type
64518 , p_component_code => l_component_code
64519 , p_component_type_code => l_component_type_code
64520 , p_component_appl_id => l_component_appl_id
64521 , p_amb_context_code => l_amb_context_code
64522 , p_entity_code => 'TRANSACTIONS'
64523 , p_event_class_code => 'CIP_TRANSFERS'
64524 , p_side => 'NA'
64525 );
64526
64527 END IF;
64528
64529 l_segment := AcctDerRule_169(
64530 p_application_id => p_application_id
64531 , p_ae_header_id => l_ae_header_id
64532 , p_source_5 => p_source_5
64533 , p_source_31 => p_source_31
64534 , x_transaction_coa_id => l_adr_transaction_coa_id
64535 , x_accounting_coa_id => l_adr_accounting_coa_id
64536 , x_flexfield_segment_code => l_adr_flexfield_segment_code
64537 , x_flex_value_set_id => l_adr_flex_value_set_id
64538 , x_value_type_code => l_adr_value_type_code
64539 , x_value_combination_id => l_adr_value_combination_id
64540 , x_value_segment_code => l_adr_value_segment_code
64541 , p_side => 'NA'
64542 , p_override_seg_flag => 'Y'
64543 );
64544
64545 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
64546
64547 xla_ae_lines_pkg.set_segment(
64548 p_to_segment_code => 'GL_BALANCING'
64549 , p_segment_value => l_segment
64550 , p_from_segment_code => l_adr_value_segment_code
64551 , p_from_combination_id => l_adr_value_combination_id
64552 , p_value_type_code => l_adr_value_type_code
64553 , p_transaction_coa_id => l_adr_transaction_coa_id
64554 , p_accounting_coa_id => l_adr_accounting_coa_id
64555 , p_flexfield_segment_code => l_adr_flexfield_segment_code
64556 , p_flex_value_set_id => l_adr_flex_value_set_id
64557 , p_adr_code => 'FA_EXPENSE_ACCT'
64561 , p_component_type_code => l_component_type_code
64558 , p_adr_type_code => 'S'
64559 , p_component_type => l_component_type
64560 , p_component_code => l_component_code
64562 , p_component_appl_id => l_component_appl_id
64563 , p_amb_context_code => l_amb_context_code
64564 , p_entity_code => 'TRANSACTIONS'
64565 , p_event_class_code => 'CIP_TRANSFERS'
64566 , p_side => 'NA'
64567 );
64568
64569 END IF;
64570
64571 --
64572 --
64573 END IF;
64574 --
64575 -- Bug 4922099
64576 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
64577 (NVL(l_enc_upg_option, 'N') = 'O')
64578 ) AND
64579 (l_bflow_method_code = 'PRIOR_ENTRY')
64580 )
64581 THEN
64582 IF
64583 --
64584 1 = 2
64585 --
64586 THEN
64587 xla_accounting_err_pkg.build_message
64588 (p_appli_s_name => 'XLA'
64589 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
64590 ,p_token_1 => 'LINE_NUMBER'
64591 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
64592 ,p_token_2 => 'LINE_TYPE_NAME'
64593 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
64594 l_component_type
64595 ,l_component_code
64596 ,l_component_type_code
64597 ,l_component_appl_id
64598 ,l_amb_context_code
64599 ,l_entity_code
64600 ,l_event_class_code
64601 )
64602 ,p_token_3 => 'OWNER'
64603 ,p_value_3 => xla_lookups_pkg.get_meaning(
64604 p_lookup_type => 'XLA_OWNER_TYPE'
64605 ,p_lookup_code => l_component_type_code
64606 )
64607 ,p_token_4 => 'PRODUCT_NAME'
64608 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
64609 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
64610 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
64611 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
64612 ,p_ae_header_id => NULL
64613 );
64614
64615 IF (C_LEVEL_ERROR>= g_log_level) THEN
64616 trace
64617 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
64618 ,p_level => C_LEVEL_ERROR
64619 ,p_module => l_log_module);
64620 END IF;
64621 END IF;
64622 END IF;
64623 --
64624 --
64625 ------------------------------------------------------------------------------------------------
64626 -- 4219869 Business Flow
64627 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
64628 -- Prior Entry. Currently, the following code is always generated.
64629 ------------------------------------------------------------------------------------------------
64630 XLA_AE_LINES_PKG.ValidateCurrentLine;
64631
64632 ------------------------------------------------------------------------------------
64633 -- 4219869 Business Flow
64634 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
64635 ------------------------------------------------------------------------------------
64636 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
64637
64638 ----------------------------------------------------------------------------------
64639 -- 4219869 Business Flow
64640 -- Update journal entry status -- Need to generate this within IF <condition>
64641 ----------------------------------------------------------------------------------
64642 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
64643 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
64644 ,p_balance_type_code => l_balance_type_code
64645 );
64646
64647 -------------------------------------------------------------------------------------------
64648 -- 4262811 - Generate the Accrual Reversal lines
64649 -------------------------------------------------------------------------------------------
64650 BEGIN
64651 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
64655 END IF;
64652 (g_array_event(p_event_id).array_value_num('header_index'));
64653 IF l_acc_rev_flag IS NULL THEN
64654 l_acc_rev_flag := 'N';
64656 EXCEPTION
64657 WHEN OTHERS THEN
64658 l_acc_rev_flag := 'N';
64659 END;
64660 --
64661 IF (l_acc_rev_flag = 'Y') THEN
64662
64663 -- 4645092 ------------------------------------------------------------------------------
64664 -- To allow MPA report to determine if it should generate report process
64665 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
64666 ------------------------------------------------------------------------------------------
64667
64668 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
64669 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
64670 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
64671 -- call ADRs
64672 -- Bug 4922099
64673 --
64674 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
64675 (NVL(l_actual_upg_option, 'N') = 'O') OR
64676 (NVL(l_enc_upg_option, 'N') = 'O')
64677 )
64678 THEN
64679 NULL;
64680 --
64681 --
64682
64683 l_ccid := AcctDerRule_175(
64684 p_application_id => p_application_id
64685 , p_ae_header_id => l_ae_header_id
64686 , p_source_5 => p_source_5
64687 , p_source_19 => p_source_19
64688 , p_source_32 => p_source_32
64689 , x_transaction_coa_id => l_adr_transaction_coa_id
64690 , x_accounting_coa_id => l_adr_accounting_coa_id
64691 , x_value_type_code => l_adr_value_type_code
64692 , p_side => 'NA'
64693 );
64694
64695 xla_ae_lines_pkg.set_ccid(
64696 p_code_combination_id => l_ccid
64697 , p_value_type_code => l_adr_value_type_code
64698 , p_transaction_coa_id => l_adr_transaction_coa_id
64699 , p_accounting_coa_id => l_adr_accounting_coa_id
64700 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
64701 , p_adr_type_code => 'S'
64702 , p_component_type => l_component_type
64703 , p_component_code => l_component_code
64704 , p_component_type_code => l_component_type_code
64705 , p_component_appl_id => l_component_appl_id
64706 , p_amb_context_code => l_amb_context_code
64707 , p_side => 'NA'
64708 );
64709
64710
64711 l_segment := AcctDerRule_151(
64712 p_application_id => p_application_id
64713 , p_ae_header_id => l_ae_header_id
64714 , p_source_5 => p_source_5
64715 , p_source_13 => p_source_13
64716 , x_transaction_coa_id => l_adr_transaction_coa_id
64717 , x_accounting_coa_id => l_adr_accounting_coa_id
64718 , x_flexfield_segment_code => l_adr_flexfield_segment_code
64719 , x_flex_value_set_id => l_adr_flex_value_set_id
64720 , x_value_type_code => l_adr_value_type_code
64721 , x_value_combination_id => l_adr_value_combination_id
64722 , x_value_segment_code => l_adr_value_segment_code
64723 , p_side => 'NA'
64724 , p_override_seg_flag => 'Y'
64725 );
64726
64727 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
64728
64729 xla_ae_lines_pkg.set_segment(
64730 p_to_segment_code => 'GL_ACCOUNT'
64731 , p_segment_value => l_segment
64732 , p_from_segment_code => l_adr_value_segment_code
64733 , p_from_combination_id => l_adr_value_combination_id
64734 , p_value_type_code => l_adr_value_type_code
64735 , p_transaction_coa_id => l_adr_transaction_coa_id
64736 , p_accounting_coa_id => l_adr_accounting_coa_id
64737 , p_flexfield_segment_code => l_adr_flexfield_segment_code
64738 , p_flex_value_set_id => l_adr_flex_value_set_id
64739 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
64740 , p_adr_type_code => 'S'
64741 , p_component_type => l_component_type
64742 , p_component_code => l_component_code
64743 , p_component_type_code => l_component_type_code
64744 , p_component_appl_id => l_component_appl_id
64745 , p_amb_context_code => l_amb_context_code
64746 , p_entity_code => 'TRANSACTIONS'
64747 , p_event_class_code => 'CIP_TRANSFERS'
64748 , p_side => 'NA'
64749 );
64750
64751 END IF;
64752
64753 l_segment := AcctDerRule_169(
64754 p_application_id => p_application_id
64755 , p_ae_header_id => l_ae_header_id
64756 , p_source_5 => p_source_5
64757 , p_source_31 => p_source_31
64758 , x_transaction_coa_id => l_adr_transaction_coa_id
64759 , x_accounting_coa_id => l_adr_accounting_coa_id
64760 , x_flexfield_segment_code => l_adr_flexfield_segment_code
64761 , x_flex_value_set_id => l_adr_flex_value_set_id
64762 , x_value_type_code => l_adr_value_type_code
64763 , x_value_combination_id => l_adr_value_combination_id
64764 , x_value_segment_code => l_adr_value_segment_code
64765 , p_side => 'NA'
64769 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
64766 , p_override_seg_flag => 'Y'
64767 );
64768
64770
64771 xla_ae_lines_pkg.set_segment(
64772 p_to_segment_code => 'GL_BALANCING'
64773 , p_segment_value => l_segment
64774 , p_from_segment_code => l_adr_value_segment_code
64775 , p_from_combination_id => l_adr_value_combination_id
64776 , p_value_type_code => l_adr_value_type_code
64777 , p_transaction_coa_id => l_adr_transaction_coa_id
64778 , p_accounting_coa_id => l_adr_accounting_coa_id
64779 , p_flexfield_segment_code => l_adr_flexfield_segment_code
64780 , p_flex_value_set_id => l_adr_flex_value_set_id
64781 , p_adr_code => 'FA_EXPENSE_ACCT'
64782 , p_adr_type_code => 'S'
64783 , p_component_type => l_component_type
64784 , p_component_code => l_component_code
64785 , p_component_type_code => l_component_type_code
64786 , p_component_appl_id => l_component_appl_id
64787 , p_amb_context_code => l_amb_context_code
64788 , p_entity_code => 'TRANSACTIONS'
64789 , p_event_class_code => 'CIP_TRANSFERS'
64790 , p_side => 'NA'
64791 );
64792
64793 END IF;
64794
64795 --
64796 --
64797 END IF;
64798
64799 --
64800 -- Update the line information that should be overwritten
64801 --
64802 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
64803 p_header_num => 1);
64804 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
64805
64806 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
64807
64808 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
64809 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
64810 END IF;
64811
64812 --
64813 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
64814 --
64815 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
64816 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
64817 ELSE
64818 ---------------------------------------------------------------------------------------------------
64819 -- 4262811a Switch Sign
64820 ---------------------------------------------------------------------------------------------------
64821 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
64822 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
64823 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
64824 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
64825 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
64826 -- 5132302
64827 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
64828 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
64829
64830 END IF;
64831
64832 -- 4955764
64833 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
64834 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
64835
64836
64837 XLA_AE_LINES_PKG.ValidateCurrentLine;
64838 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
64839
64840 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
64841 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
64842 ,p_balance_type_code => l_balance_type_code);
64843
64844 END IF;
64845
64846 -----------------------------------------------------------------------------------------
64847 -- 4262811 Multiperiod Accounting
64848 -----------------------------------------------------------------------------------------
64849 -- No MPA option is assigned.
64850
64851
64852 END IF;
64853 END IF;
64854 --
64855
64856 --
64857 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
64858 trace
64859 (p_msg => 'END of AcctLineType_254'
64860 ,p_level => C_LEVEL_PROCEDURE
64861 ,p_module => l_log_module);
64862 END IF;
64863 --
64864 EXCEPTION
64865 WHEN xla_exceptions_pkg.application_exception THEN
64866 RAISE;
64867 WHEN OTHERS THEN
64868 xla_exceptions_pkg.raise_message
64869 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_254');
64870 END AcctLineType_254;
64871 --
64872
64873 ---------------------------------------
64874 --
64875 -- PRIVATE FUNCTION
64876 -- AcctLineType_255
64877 --
64878 ---------------------------------------
64879 PROCEDURE AcctLineType_255 (
64880 p_application_id IN NUMBER
64881 ,p_event_id IN NUMBER
64882 ,p_calculate_acctd_flag IN VARCHAR2
64883 ,p_calculate_g_l_flag IN VARCHAR2
64887
64884 ,p_actual_flag IN OUT VARCHAR2
64885 ,p_balance_type_code OUT VARCHAR2
64886 ,p_gain_or_loss_ref OUT VARCHAR2
64888 --Period Close Date
64889 , p_source_1 IN DATE
64890 --Generated Code Combination Identifier
64891 , p_source_5 IN NUMBER
64892 --Intercompany Payables Account
64893 , p_source_21 IN VARCHAR2
64894 --Expense Account Code Combination Identifier
64895 , p_source_31 IN NUMBER
64896 --Default Code Combination Identifier
64897 , p_source_32 IN NUMBER
64898 --Adjustment Type
64899 , p_source_48 IN VARCHAR2
64900 --Transaction Header Identifier
64901 , p_source_49 IN NUMBER
64902 --Adjustment Line Identifier
64903 , p_source_50 IN NUMBER
64904 --Distribution Type Code
64905 , p_source_51 IN VARCHAR2
64906 --Entered Amount
64907 , p_source_52 IN NUMBER
64908 --Currency Code
64909 , p_source_53 IN VARCHAR2
64910 )
64911 IS
64912
64913 l_component_type VARCHAR2(80);
64914 l_component_code VARCHAR2(30);
64915 l_component_type_code VARCHAR2(1);
64916 l_component_appl_id INTEGER;
64917 l_amb_context_code VARCHAR2(30);
64918 l_entity_code VARCHAR2(30);
64919 l_event_class_code VARCHAR2(30);
64920 l_ae_header_id NUMBER;
64921 l_event_type_code VARCHAR2(30);
64922 l_line_definition_code VARCHAR2(30);
64923 l_line_definition_owner_code VARCHAR2(1);
64924 --
64925 -- adr variables
64926 l_segment VARCHAR2(30);
64927 l_ccid NUMBER;
64928 l_adr_transaction_coa_id NUMBER;
64929 l_adr_accounting_coa_id NUMBER;
64930 l_adr_flexfield_segment_code VARCHAR2(30);
64931 l_adr_flex_value_set_id NUMBER;
64932 l_adr_value_type_code VARCHAR2(30);
64933 l_adr_value_combination_id NUMBER;
64934 l_adr_value_segment_code VARCHAR2(30);
64935
64936 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
64937 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
64938 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
64939 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
64940
64941 -- 4262811 Variables ------------------------------------------------------------------------------------------
64942 l_entered_amt_idx NUMBER;
64943 l_accted_amt_idx NUMBER;
64944 l_acc_rev_flag VARCHAR2(1);
64945 l_accrual_line_num NUMBER;
64946 l_tmp_amt NUMBER;
64947 l_acc_rev_natural_side_code VARCHAR2(1);
64948
64949 l_num_entries NUMBER;
64950 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
64951 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
64952 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
64953 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
64954 l_recog_line_1 NUMBER;
64955 l_recog_line_2 NUMBER;
64956
64957 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
64958 l_bflow_applied_to_amt NUMBER; -- 5132302
64959 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
64960
64961 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
64962
64963 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
64964 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
64965
64966 ---------------------------------------------------------------------------------------------------------------
64967
64968
64969 --
64970 -- bulk performance
64971 --
64972 l_balance_type_code VARCHAR2(1);
64973 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
64974 l_log_module VARCHAR2(240);
64975
64976 --
64977 -- Upgrade strategy
64978 --
64979 l_actual_upg_option VARCHAR2(1);
64980 l_enc_upg_option VARCHAR2(1);
64981
64982 --
64983 BEGIN
64984 --
64985 IF g_log_enabled THEN
64986 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_255';
64987 END IF;
64988 --
64989 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
64990
64991 trace
64992 (p_msg => 'BEGIN of AcctLineType_255'
64993 ,p_level => C_LEVEL_PROCEDURE
64994 ,p_module => l_log_module);
64995
64996 END IF;
64997 --
64998 l_component_type := 'AMB_JLT';
64999 l_component_code := 'FA_CIP_TRANSFER_IC_PAY';
65000 l_component_type_code := 'S';
65001 l_component_appl_id := 140;
65002 l_amb_context_code := 'DEFAULT';
65003 l_entity_code := 'TRANSACTIONS';
65004 l_event_class_code := 'CIP_TRANSFERS';
65005 l_event_type_code := 'CIP_TRANSFERS_ALL';
65006 l_line_definition_owner_code := 'S';
65007 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_T12';
65008 --
65009 l_balance_type_code := 'A';
65010 l_segment := NULL;
65011 l_ccid := NULL;
65012 l_adr_transaction_coa_id := NULL;
65013 l_adr_accounting_coa_id := NULL;
65014 l_adr_flexfield_segment_code := NULL;
65018 l_adr_value_segment_code := NULL;
65015 l_adr_flex_value_set_id := NULL;
65016 l_adr_value_type_code := NULL;
65017 l_adr_value_combination_id := NULL;
65019
65020 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
65021 l_bflow_class_code := ''; -- 4219869 Business Flow
65022 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
65023 l_budgetary_control_flag := 'N';
65024
65025 l_bflow_applied_to_amt_idx := NULL; -- 5132302
65026 l_bflow_applied_to_amt := NULL; -- 5132302
65027 l_entered_amt_idx := NULL; -- 4262811
65028 l_accted_amt_idx := NULL; -- 4262811
65029 l_acc_rev_flag := NULL; -- 4262811
65030 l_accrual_line_num := NULL; -- 4262811
65031 l_tmp_amt := NULL; -- 4262811
65032 --
65033
65034 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
65035 l_balance_type_code <> 'B' THEN
65036 IF NVL(p_source_48,'
65037 ') = 'INTERCO AP'
65038 THEN
65039
65040 --
65041 XLA_AE_LINES_PKG.SetNewLine;
65042
65043 p_balance_type_code := l_balance_type_code;
65044 -- set the flag so later we will know whether the gain loss line needs to be created
65045
65046 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
65047 p_actual_flag :='A';
65048 END IF;
65049
65050 --
65051 -- bulk performance
65052 --
65053 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
65054 p_header_num => 0); -- 4262811
65055 --
65056 -- set accounting line options
65057 --
65058 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
65059 p_natural_side_code => 'C'
65060 , p_gain_or_loss_flag => 'N'
65061 , p_gl_transfer_mode_code => 'S'
65062 , p_acct_entry_type_code => 'A'
65063 , p_switch_side_flag => 'Y'
65064 , p_merge_duplicate_code => 'N'
65065 );
65066 --
65067 l_acc_rev_natural_side_code := 'D'; -- 4262811
65068 --
65069 --
65070 -- set accounting line type info
65071 --
65072 xla_ae_lines_pkg.SetAcctLineType
65073 (p_component_type => l_component_type
65074 ,p_event_type_code => l_event_type_code
65075 ,p_line_definition_owner_code => l_line_definition_owner_code
65076 ,p_line_definition_code => l_line_definition_code
65077 ,p_accounting_line_code => l_component_code
65078 ,p_accounting_line_type_code => l_component_type_code
65079 ,p_accounting_line_appl_id => l_component_appl_id
65080 ,p_amb_context_code => l_amb_context_code
65081 ,p_entity_code => l_entity_code
65082 ,p_event_class_code => l_event_class_code);
65083 --
65084 -- set accounting class
65085 --
65086 xla_ae_lines_pkg.SetAcctClass(
65087 p_accounting_class_code => 'LIABILITY'
65088 , p_ae_header_id => l_ae_header_id
65089 );
65090
65091 --
65092 -- set rounding class
65093 --
65094 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
65095 'LIABILITY';
65096
65097 --
65098 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
65099 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
65100 --
65101 -- bulk performance
65102 --
65103 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
65104
65105 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
65106 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
65107
65108 -- 4955764
65109 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
65110 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
65111
65112 -- 4458381 Public Sector Enh
65113
65114 --
65115 -- set accounting attributes for the line type
65116 --
65117 l_entered_amt_idx := 4;
65118 l_accted_amt_idx := 6;
65119 l_bflow_applied_to_amt_idx := NULL; -- 5132302
65120 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
65121 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
65122 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
65123 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
65124 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
65125 l_rec_acct_attrs.array_char_value(3) := p_source_51;
65126 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
65127 l_rec_acct_attrs.array_num_value(4) := p_source_52;
65128 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
65129 l_rec_acct_attrs.array_char_value(5) := p_source_53;
65130 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
65131 l_rec_acct_attrs.array_num_value(6) := p_source_52;
65132
65133 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
65137 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
65134 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
65135
65136 ---------------------------------------------------------------------------------------------------------------
65138 ---------------------------------------------------------------------------------------------------------------
65139 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
65140
65141 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
65142 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
65143
65144 IF xla_accounting_cache_pkg.GetValueChar
65145 (p_source_code => 'LEDGER_CATEGORY_CODE'
65146 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
65147 AND l_bflow_method_code = 'PRIOR_ENTRY'
65148 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
65149 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
65150 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
65151 )
65152 THEN
65153 xla_ae_lines_pkg.BflowUpgEntry
65154 (p_business_method_code => l_bflow_method_code
65155 ,p_business_class_code => l_bflow_class_code
65156 ,p_balance_type => l_balance_type_code);
65157 ELSE
65158 NULL;
65159 -- No business flow processing for business flow method of NONE.
65160 END IF;
65161
65162 --
65163 -- call analytical criteria
65164 --
65165
65166 --
65167 -- call description
65168 --
65169
65170 xla_ae_lines_pkg.SetLineDescription(
65171 p_ae_header_id => l_ae_header_id
65172 ,p_description => Description_46 (
65173 p_application_id => p_application_id
65174 , p_ae_header_id => l_ae_header_id
65175 , p_source_1 => p_source_1
65176 )
65177 );
65178
65179
65180 --
65181 -- call ADRs
65182 -- Bug 4922099
65183 --
65184 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
65185 (NVL(l_actual_upg_option, 'N') = 'O') OR
65186 (NVL(l_enc_upg_option, 'N') = 'O')
65187 )
65188 THEN
65189 NULL;
65190 --
65191 --
65192
65193 l_ccid := AcctDerRule_174(
65194 p_application_id => p_application_id
65195 , p_ae_header_id => l_ae_header_id
65196 , p_source_5 => p_source_5
65197 , p_source_32 => p_source_32
65198 , x_transaction_coa_id => l_adr_transaction_coa_id
65199 , x_accounting_coa_id => l_adr_accounting_coa_id
65200 , x_value_type_code => l_adr_value_type_code
65201 , p_side => 'NA'
65202 );
65203
65204 xla_ae_lines_pkg.set_ccid(
65205 p_code_combination_id => l_ccid
65206 , p_value_type_code => l_adr_value_type_code
65207 , p_transaction_coa_id => l_adr_transaction_coa_id
65208 , p_accounting_coa_id => l_adr_accounting_coa_id
65209 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
65210 , p_adr_type_code => 'S'
65211 , p_component_type => l_component_type
65212 , p_component_code => l_component_code
65213 , p_component_type_code => l_component_type_code
65214 , p_component_appl_id => l_component_appl_id
65215 , p_amb_context_code => l_amb_context_code
65216 , p_side => 'NA'
65217 );
65218
65219
65220 l_segment := AcctDerRule_169(
65221 p_application_id => p_application_id
65222 , p_ae_header_id => l_ae_header_id
65223 , p_source_5 => p_source_5
65224 , p_source_31 => p_source_31
65225 , x_transaction_coa_id => l_adr_transaction_coa_id
65226 , x_accounting_coa_id => l_adr_accounting_coa_id
65227 , x_flexfield_segment_code => l_adr_flexfield_segment_code
65228 , x_flex_value_set_id => l_adr_flex_value_set_id
65229 , x_value_type_code => l_adr_value_type_code
65230 , x_value_combination_id => l_adr_value_combination_id
65231 , x_value_segment_code => l_adr_value_segment_code
65232 , p_side => 'NA'
65233 , p_override_seg_flag => 'Y'
65234 );
65235
65236 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
65237
65238 xla_ae_lines_pkg.set_segment(
65239 p_to_segment_code => 'GL_BALANCING'
65240 , p_segment_value => l_segment
65241 , p_from_segment_code => l_adr_value_segment_code
65242 , p_from_combination_id => l_adr_value_combination_id
65243 , p_value_type_code => l_adr_value_type_code
65244 , p_transaction_coa_id => l_adr_transaction_coa_id
65245 , p_accounting_coa_id => l_adr_accounting_coa_id
65246 , p_flexfield_segment_code => l_adr_flexfield_segment_code
65247 , p_flex_value_set_id => l_adr_flex_value_set_id
65248 , p_adr_code => 'FA_EXPENSE_ACCT'
65249 , p_adr_type_code => 'S'
65250 , p_component_type => l_component_type
65251 , p_component_code => l_component_code
65255 , p_entity_code => 'TRANSACTIONS'
65252 , p_component_type_code => l_component_type_code
65253 , p_component_appl_id => l_component_appl_id
65254 , p_amb_context_code => l_amb_context_code
65256 , p_event_class_code => 'CIP_TRANSFERS'
65257 , p_side => 'NA'
65258 );
65259
65260 END IF;
65261
65262 l_segment := AcctDerRule_158(
65263 p_application_id => p_application_id
65264 , p_ae_header_id => l_ae_header_id
65265 , p_source_5 => p_source_5
65266 , p_source_21 => p_source_21
65267 , x_transaction_coa_id => l_adr_transaction_coa_id
65268 , x_accounting_coa_id => l_adr_accounting_coa_id
65269 , x_flexfield_segment_code => l_adr_flexfield_segment_code
65270 , x_flex_value_set_id => l_adr_flex_value_set_id
65271 , x_value_type_code => l_adr_value_type_code
65272 , x_value_combination_id => l_adr_value_combination_id
65273 , x_value_segment_code => l_adr_value_segment_code
65274 , p_side => 'NA'
65275 , p_override_seg_flag => 'Y'
65276 );
65277
65278 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
65279
65280 xla_ae_lines_pkg.set_segment(
65281 p_to_segment_code => 'GL_ACCOUNT'
65282 , p_segment_value => l_segment
65283 , p_from_segment_code => l_adr_value_segment_code
65284 , p_from_combination_id => l_adr_value_combination_id
65285 , p_value_type_code => l_adr_value_type_code
65286 , p_transaction_coa_id => l_adr_transaction_coa_id
65287 , p_accounting_coa_id => l_adr_accounting_coa_id
65288 , p_flexfield_segment_code => l_adr_flexfield_segment_code
65289 , p_flex_value_set_id => l_adr_flex_value_set_id
65290 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
65291 , p_adr_type_code => 'S'
65292 , p_component_type => l_component_type
65293 , p_component_code => l_component_code
65294 , p_component_type_code => l_component_type_code
65295 , p_component_appl_id => l_component_appl_id
65296 , p_amb_context_code => l_amb_context_code
65297 , p_entity_code => 'TRANSACTIONS'
65298 , p_event_class_code => 'CIP_TRANSFERS'
65299 , p_side => 'NA'
65300 );
65301
65302 END IF;
65303
65304 --
65305 --
65306 END IF;
65307 --
65308 -- Bug 4922099
65309 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
65310 (NVL(l_enc_upg_option, 'N') = 'O')
65311 ) AND
65312 (l_bflow_method_code = 'PRIOR_ENTRY')
65313 )
65314 THEN
65315 IF
65316 --
65317 1 = 2
65318 --
65319 THEN
65320 xla_accounting_err_pkg.build_message
65321 (p_appli_s_name => 'XLA'
65322 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
65323 ,p_token_1 => 'LINE_NUMBER'
65324 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
65325 ,p_token_2 => 'LINE_TYPE_NAME'
65326 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
65327 l_component_type
65328 ,l_component_code
65329 ,l_component_type_code
65330 ,l_component_appl_id
65331 ,l_amb_context_code
65332 ,l_entity_code
65333 ,l_event_class_code
65334 )
65335 ,p_token_3 => 'OWNER'
65336 ,p_value_3 => xla_lookups_pkg.get_meaning(
65337 p_lookup_type => 'XLA_OWNER_TYPE'
65338 ,p_lookup_code => l_component_type_code
65339 )
65340 ,p_token_4 => 'PRODUCT_NAME'
65341 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
65342 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
65343 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
65344 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
65345 ,p_ae_header_id => NULL
65346 );
65347
65348 IF (C_LEVEL_ERROR>= g_log_level) THEN
65349 trace
65350 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
65354 END IF;
65351 ,p_level => C_LEVEL_ERROR
65352 ,p_module => l_log_module);
65353 END IF;
65355 END IF;
65356 --
65357 --
65358 ------------------------------------------------------------------------------------------------
65359 -- 4219869 Business Flow
65360 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
65361 -- Prior Entry. Currently, the following code is always generated.
65362 ------------------------------------------------------------------------------------------------
65363 XLA_AE_LINES_PKG.ValidateCurrentLine;
65364
65365 ------------------------------------------------------------------------------------
65366 -- 4219869 Business Flow
65367 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
65368 ------------------------------------------------------------------------------------
65369 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
65370
65371 ----------------------------------------------------------------------------------
65372 -- 4219869 Business Flow
65373 -- Update journal entry status -- Need to generate this within IF <condition>
65374 ----------------------------------------------------------------------------------
65375 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
65376 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
65377 ,p_balance_type_code => l_balance_type_code
65378 );
65379
65380 -------------------------------------------------------------------------------------------
65381 -- 4262811 - Generate the Accrual Reversal lines
65382 -------------------------------------------------------------------------------------------
65383 BEGIN
65384 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
65385 (g_array_event(p_event_id).array_value_num('header_index'));
65386 IF l_acc_rev_flag IS NULL THEN
65387 l_acc_rev_flag := 'N';
65388 END IF;
65389 EXCEPTION
65390 WHEN OTHERS THEN
65391 l_acc_rev_flag := 'N';
65392 END;
65393 --
65394 IF (l_acc_rev_flag = 'Y') THEN
65395
65396 -- 4645092 ------------------------------------------------------------------------------
65397 -- To allow MPA report to determine if it should generate report process
65398 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
65399 ------------------------------------------------------------------------------------------
65400
65401 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
65402 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
65403 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
65404 -- call ADRs
65405 -- Bug 4922099
65406 --
65407 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
65408 (NVL(l_actual_upg_option, 'N') = 'O') OR
65409 (NVL(l_enc_upg_option, 'N') = 'O')
65410 )
65411 THEN
65412 NULL;
65413 --
65414 --
65415
65416 l_ccid := AcctDerRule_174(
65417 p_application_id => p_application_id
65418 , p_ae_header_id => l_ae_header_id
65419 , p_source_5 => p_source_5
65420 , p_source_32 => p_source_32
65421 , x_transaction_coa_id => l_adr_transaction_coa_id
65422 , x_accounting_coa_id => l_adr_accounting_coa_id
65423 , x_value_type_code => l_adr_value_type_code
65424 , p_side => 'NA'
65425 );
65426
65427 xla_ae_lines_pkg.set_ccid(
65428 p_code_combination_id => l_ccid
65429 , p_value_type_code => l_adr_value_type_code
65430 , p_transaction_coa_id => l_adr_transaction_coa_id
65431 , p_accounting_coa_id => l_adr_accounting_coa_id
65432 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
65433 , p_adr_type_code => 'S'
65434 , p_component_type => l_component_type
65435 , p_component_code => l_component_code
65436 , p_component_type_code => l_component_type_code
65437 , p_component_appl_id => l_component_appl_id
65438 , p_amb_context_code => l_amb_context_code
65439 , p_side => 'NA'
65440 );
65441
65442
65443 l_segment := AcctDerRule_169(
65444 p_application_id => p_application_id
65445 , p_ae_header_id => l_ae_header_id
65446 , p_source_5 => p_source_5
65447 , p_source_31 => p_source_31
65448 , x_transaction_coa_id => l_adr_transaction_coa_id
65449 , x_accounting_coa_id => l_adr_accounting_coa_id
65450 , x_flexfield_segment_code => l_adr_flexfield_segment_code
65451 , x_flex_value_set_id => l_adr_flex_value_set_id
65452 , x_value_type_code => l_adr_value_type_code
65453 , x_value_combination_id => l_adr_value_combination_id
65454 , x_value_segment_code => l_adr_value_segment_code
65455 , p_side => 'NA'
65456 , p_override_seg_flag => 'Y'
65457 );
65458
65459 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
65460
65461 xla_ae_lines_pkg.set_segment(
65462 p_to_segment_code => 'GL_BALANCING'
65463 , p_segment_value => l_segment
65467 , p_transaction_coa_id => l_adr_transaction_coa_id
65464 , p_from_segment_code => l_adr_value_segment_code
65465 , p_from_combination_id => l_adr_value_combination_id
65466 , p_value_type_code => l_adr_value_type_code
65468 , p_accounting_coa_id => l_adr_accounting_coa_id
65469 , p_flexfield_segment_code => l_adr_flexfield_segment_code
65470 , p_flex_value_set_id => l_adr_flex_value_set_id
65471 , p_adr_code => 'FA_EXPENSE_ACCT'
65472 , p_adr_type_code => 'S'
65473 , p_component_type => l_component_type
65474 , p_component_code => l_component_code
65475 , p_component_type_code => l_component_type_code
65476 , p_component_appl_id => l_component_appl_id
65477 , p_amb_context_code => l_amb_context_code
65478 , p_entity_code => 'TRANSACTIONS'
65479 , p_event_class_code => 'CIP_TRANSFERS'
65480 , p_side => 'NA'
65481 );
65482
65483 END IF;
65484
65485 l_segment := AcctDerRule_158(
65486 p_application_id => p_application_id
65487 , p_ae_header_id => l_ae_header_id
65488 , p_source_5 => p_source_5
65489 , p_source_21 => p_source_21
65490 , x_transaction_coa_id => l_adr_transaction_coa_id
65491 , x_accounting_coa_id => l_adr_accounting_coa_id
65492 , x_flexfield_segment_code => l_adr_flexfield_segment_code
65493 , x_flex_value_set_id => l_adr_flex_value_set_id
65494 , x_value_type_code => l_adr_value_type_code
65495 , x_value_combination_id => l_adr_value_combination_id
65496 , x_value_segment_code => l_adr_value_segment_code
65497 , p_side => 'NA'
65498 , p_override_seg_flag => 'Y'
65499 );
65500
65501 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
65502
65503 xla_ae_lines_pkg.set_segment(
65504 p_to_segment_code => 'GL_ACCOUNT'
65505 , p_segment_value => l_segment
65506 , p_from_segment_code => l_adr_value_segment_code
65507 , p_from_combination_id => l_adr_value_combination_id
65508 , p_value_type_code => l_adr_value_type_code
65509 , p_transaction_coa_id => l_adr_transaction_coa_id
65510 , p_accounting_coa_id => l_adr_accounting_coa_id
65511 , p_flexfield_segment_code => l_adr_flexfield_segment_code
65512 , p_flex_value_set_id => l_adr_flex_value_set_id
65513 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
65514 , p_adr_type_code => 'S'
65515 , p_component_type => l_component_type
65516 , p_component_code => l_component_code
65517 , p_component_type_code => l_component_type_code
65518 , p_component_appl_id => l_component_appl_id
65519 , p_amb_context_code => l_amb_context_code
65520 , p_entity_code => 'TRANSACTIONS'
65521 , p_event_class_code => 'CIP_TRANSFERS'
65522 , p_side => 'NA'
65523 );
65524
65525 END IF;
65526
65527 --
65528 --
65529 END IF;
65530
65531 --
65532 -- Update the line information that should be overwritten
65533 --
65534 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
65535 p_header_num => 1);
65536 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
65537
65538 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
65539
65540 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
65541 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
65542 END IF;
65543
65544 --
65545 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
65546 --
65547 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
65548 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
65549 ELSE
65550 ---------------------------------------------------------------------------------------------------
65551 -- 4262811a Switch Sign
65552 ---------------------------------------------------------------------------------------------------
65553 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
65554 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
65555 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
65556 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
65557 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
65558 -- 5132302
65559 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
65560 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
65561
65562 END IF;
65563
65564 -- 4955764
65568
65565 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
65566 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
65567
65569 XLA_AE_LINES_PKG.ValidateCurrentLine;
65570 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
65571
65572 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
65573 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
65574 ,p_balance_type_code => l_balance_type_code);
65575
65576 END IF;
65577
65578 -----------------------------------------------------------------------------------------
65579 -- 4262811 Multiperiod Accounting
65580 -----------------------------------------------------------------------------------------
65581 -- No MPA option is assigned.
65582
65583
65584 END IF;
65585 END IF;
65586 --
65587
65588 --
65589 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
65590 trace
65591 (p_msg => 'END of AcctLineType_255'
65592 ,p_level => C_LEVEL_PROCEDURE
65593 ,p_module => l_log_module);
65594 END IF;
65595 --
65596 EXCEPTION
65597 WHEN xla_exceptions_pkg.application_exception THEN
65598 RAISE;
65599 WHEN OTHERS THEN
65600 xla_exceptions_pkg.raise_message
65601 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_255');
65602 END AcctLineType_255;
65603 --
65604
65605 ---------------------------------------
65606 --
65607 -- PRIVATE FUNCTION
65608 -- AcctLineType_256
65609 --
65610 ---------------------------------------
65611 PROCEDURE AcctLineType_256 (
65612 p_application_id IN NUMBER
65613 ,p_event_id IN NUMBER
65614 ,p_calculate_acctd_flag IN VARCHAR2
65615 ,p_calculate_g_l_flag IN VARCHAR2
65616 ,p_actual_flag IN OUT VARCHAR2
65617 ,p_balance_type_code OUT VARCHAR2
65618 ,p_gain_or_loss_ref OUT VARCHAR2
65619
65620 --Period Close Date
65621 , p_source_1 IN DATE
65622 --Generated Code Combination Identifier
65623 , p_source_5 IN NUMBER
65624 --Intercompany Receivables Account
65625 , p_source_22 IN VARCHAR2
65626 --Expense Account Code Combination Identifier
65627 , p_source_31 IN NUMBER
65628 --Default Code Combination Identifier
65629 , p_source_32 IN NUMBER
65630 --Adjustment Type
65631 , p_source_48 IN VARCHAR2
65632 --Transaction Header Identifier
65633 , p_source_49 IN NUMBER
65634 --Adjustment Line Identifier
65635 , p_source_50 IN NUMBER
65636 --Distribution Type Code
65637 , p_source_51 IN VARCHAR2
65638 --Entered Amount
65639 , p_source_52 IN NUMBER
65640 --Currency Code
65641 , p_source_53 IN VARCHAR2
65642 )
65643 IS
65644
65645 l_component_type VARCHAR2(80);
65646 l_component_code VARCHAR2(30);
65647 l_component_type_code VARCHAR2(1);
65648 l_component_appl_id INTEGER;
65649 l_amb_context_code VARCHAR2(30);
65650 l_entity_code VARCHAR2(30);
65651 l_event_class_code VARCHAR2(30);
65652 l_ae_header_id NUMBER;
65653 l_event_type_code VARCHAR2(30);
65654 l_line_definition_code VARCHAR2(30);
65655 l_line_definition_owner_code VARCHAR2(1);
65656 --
65657 -- adr variables
65658 l_segment VARCHAR2(30);
65659 l_ccid NUMBER;
65660 l_adr_transaction_coa_id NUMBER;
65661 l_adr_accounting_coa_id NUMBER;
65662 l_adr_flexfield_segment_code VARCHAR2(30);
65663 l_adr_flex_value_set_id NUMBER;
65664 l_adr_value_type_code VARCHAR2(30);
65665 l_adr_value_combination_id NUMBER;
65666 l_adr_value_segment_code VARCHAR2(30);
65667
65668 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
65669 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
65670 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
65671 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
65672
65673 -- 4262811 Variables ------------------------------------------------------------------------------------------
65674 l_entered_amt_idx NUMBER;
65675 l_accted_amt_idx NUMBER;
65676 l_acc_rev_flag VARCHAR2(1);
65677 l_accrual_line_num NUMBER;
65678 l_tmp_amt NUMBER;
65679 l_acc_rev_natural_side_code VARCHAR2(1);
65680
65681 l_num_entries NUMBER;
65682 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
65683 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
65684 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
65685 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
65686 l_recog_line_1 NUMBER;
65687 l_recog_line_2 NUMBER;
65688
65689 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
65690 l_bflow_applied_to_amt NUMBER; -- 5132302
65691 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
65692
65693 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
65694
65698 ---------------------------------------------------------------------------------------------------------------
65695 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
65696 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
65697
65699
65700
65701 --
65702 -- bulk performance
65703 --
65704 l_balance_type_code VARCHAR2(1);
65705 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
65706 l_log_module VARCHAR2(240);
65707
65708 --
65709 -- Upgrade strategy
65710 --
65711 l_actual_upg_option VARCHAR2(1);
65712 l_enc_upg_option VARCHAR2(1);
65713
65714 --
65715 BEGIN
65716 --
65717 IF g_log_enabled THEN
65718 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_256';
65719 END IF;
65720 --
65721 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
65722
65723 trace
65724 (p_msg => 'BEGIN of AcctLineType_256'
65725 ,p_level => C_LEVEL_PROCEDURE
65726 ,p_module => l_log_module);
65727
65728 END IF;
65729 --
65730 l_component_type := 'AMB_JLT';
65731 l_component_code := 'FA_CIP_TRANSFER_IC_REC';
65732 l_component_type_code := 'S';
65733 l_component_appl_id := 140;
65734 l_amb_context_code := 'DEFAULT';
65735 l_entity_code := 'TRANSACTIONS';
65736 l_event_class_code := 'CIP_TRANSFERS';
65737 l_event_type_code := 'CIP_TRANSFERS_ALL';
65738 l_line_definition_owner_code := 'S';
65739 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_T12';
65740 --
65741 l_balance_type_code := 'A';
65742 l_segment := NULL;
65743 l_ccid := NULL;
65744 l_adr_transaction_coa_id := NULL;
65745 l_adr_accounting_coa_id := NULL;
65746 l_adr_flexfield_segment_code := NULL;
65747 l_adr_flex_value_set_id := NULL;
65748 l_adr_value_type_code := NULL;
65749 l_adr_value_combination_id := NULL;
65750 l_adr_value_segment_code := NULL;
65751
65752 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
65753 l_bflow_class_code := ''; -- 4219869 Business Flow
65754 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
65755 l_budgetary_control_flag := 'N';
65756
65757 l_bflow_applied_to_amt_idx := NULL; -- 5132302
65758 l_bflow_applied_to_amt := NULL; -- 5132302
65759 l_entered_amt_idx := NULL; -- 4262811
65760 l_accted_amt_idx := NULL; -- 4262811
65761 l_acc_rev_flag := NULL; -- 4262811
65762 l_accrual_line_num := NULL; -- 4262811
65763 l_tmp_amt := NULL; -- 4262811
65764 --
65765
65766 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
65767 l_balance_type_code <> 'B' THEN
65768 IF NVL(p_source_48,'
65769 ') = 'INTERCO AR'
65770 THEN
65771
65772 --
65773 XLA_AE_LINES_PKG.SetNewLine;
65774
65775 p_balance_type_code := l_balance_type_code;
65776 -- set the flag so later we will know whether the gain loss line needs to be created
65777
65778 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
65779 p_actual_flag :='A';
65780 END IF;
65781
65782 --
65783 -- bulk performance
65784 --
65785 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
65786 p_header_num => 0); -- 4262811
65787 --
65788 -- set accounting line options
65789 --
65790 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
65791 p_natural_side_code => 'D'
65792 , p_gain_or_loss_flag => 'N'
65793 , p_gl_transfer_mode_code => 'S'
65794 , p_acct_entry_type_code => 'A'
65795 , p_switch_side_flag => 'Y'
65796 , p_merge_duplicate_code => 'N'
65797 );
65798 --
65799 l_acc_rev_natural_side_code := 'C'; -- 4262811
65800 --
65801 --
65802 -- set accounting line type info
65803 --
65804 xla_ae_lines_pkg.SetAcctLineType
65805 (p_component_type => l_component_type
65806 ,p_event_type_code => l_event_type_code
65807 ,p_line_definition_owner_code => l_line_definition_owner_code
65808 ,p_line_definition_code => l_line_definition_code
65809 ,p_accounting_line_code => l_component_code
65810 ,p_accounting_line_type_code => l_component_type_code
65811 ,p_accounting_line_appl_id => l_component_appl_id
65812 ,p_amb_context_code => l_amb_context_code
65813 ,p_entity_code => l_entity_code
65814 ,p_event_class_code => l_event_class_code);
65815 --
65816 -- set accounting class
65817 --
65818 xla_ae_lines_pkg.SetAcctClass(
65819 p_accounting_class_code => 'ASSET'
65820 , p_ae_header_id => l_ae_header_id
65821 );
65822
65823 --
65824 -- set rounding class
65825 --
65826 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
65827 'ASSET';
65828
65829 --
65830 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
65834 --
65831 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
65832 --
65833 -- bulk performance
65835 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
65836
65837 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
65838 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
65839
65840 -- 4955764
65841 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
65842 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
65843
65844 -- 4458381 Public Sector Enh
65845
65846 --
65847 -- set accounting attributes for the line type
65848 --
65849 l_entered_amt_idx := 4;
65850 l_accted_amt_idx := 6;
65851 l_bflow_applied_to_amt_idx := NULL; -- 5132302
65852 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
65853 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
65854 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
65855 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
65856 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
65857 l_rec_acct_attrs.array_char_value(3) := p_source_51;
65858 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
65859 l_rec_acct_attrs.array_num_value(4) := p_source_52;
65860 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
65861 l_rec_acct_attrs.array_char_value(5) := p_source_53;
65862 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
65863 l_rec_acct_attrs.array_num_value(6) := p_source_52;
65864
65865 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
65866 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
65867
65868 ---------------------------------------------------------------------------------------------------------------
65869 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
65870 ---------------------------------------------------------------------------------------------------------------
65871 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
65872
65873 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
65874 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
65875
65876 IF xla_accounting_cache_pkg.GetValueChar
65877 (p_source_code => 'LEDGER_CATEGORY_CODE'
65878 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
65879 AND l_bflow_method_code = 'PRIOR_ENTRY'
65880 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
65881 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
65882 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
65883 )
65884 THEN
65885 xla_ae_lines_pkg.BflowUpgEntry
65886 (p_business_method_code => l_bflow_method_code
65887 ,p_business_class_code => l_bflow_class_code
65888 ,p_balance_type => l_balance_type_code);
65889 ELSE
65890 NULL;
65891 -- No business flow processing for business flow method of NONE.
65892 END IF;
65893
65894 --
65895 -- call analytical criteria
65896 --
65897
65898 --
65899 -- call description
65900 --
65901
65902 xla_ae_lines_pkg.SetLineDescription(
65903 p_ae_header_id => l_ae_header_id
65904 ,p_description => Description_47 (
65905 p_application_id => p_application_id
65906 , p_ae_header_id => l_ae_header_id
65907 , p_source_1 => p_source_1
65908 )
65909 );
65910
65911
65912 --
65913 -- call ADRs
65914 -- Bug 4922099
65915 --
65916 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
65917 (NVL(l_actual_upg_option, 'N') = 'O') OR
65918 (NVL(l_enc_upg_option, 'N') = 'O')
65919 )
65920 THEN
65921 NULL;
65922 --
65923 --
65924
65925 l_ccid := AcctDerRule_174(
65926 p_application_id => p_application_id
65927 , p_ae_header_id => l_ae_header_id
65928 , p_source_5 => p_source_5
65929 , p_source_32 => p_source_32
65930 , x_transaction_coa_id => l_adr_transaction_coa_id
65931 , x_accounting_coa_id => l_adr_accounting_coa_id
65932 , x_value_type_code => l_adr_value_type_code
65933 , p_side => 'NA'
65934 );
65935
65936 xla_ae_lines_pkg.set_ccid(
65937 p_code_combination_id => l_ccid
65938 , p_value_type_code => l_adr_value_type_code
65939 , p_transaction_coa_id => l_adr_transaction_coa_id
65940 , p_accounting_coa_id => l_adr_accounting_coa_id
65941 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
65942 , p_adr_type_code => 'S'
65943 , p_component_type => l_component_type
65944 , p_component_code => l_component_code
65945 , p_component_type_code => l_component_type_code
65946 , p_component_appl_id => l_component_appl_id
65947 , p_amb_context_code => l_amb_context_code
65951
65948 , p_side => 'NA'
65949 );
65950
65952 l_segment := AcctDerRule_169(
65953 p_application_id => p_application_id
65954 , p_ae_header_id => l_ae_header_id
65955 , p_source_5 => p_source_5
65956 , p_source_31 => p_source_31
65957 , x_transaction_coa_id => l_adr_transaction_coa_id
65958 , x_accounting_coa_id => l_adr_accounting_coa_id
65959 , x_flexfield_segment_code => l_adr_flexfield_segment_code
65960 , x_flex_value_set_id => l_adr_flex_value_set_id
65961 , x_value_type_code => l_adr_value_type_code
65962 , x_value_combination_id => l_adr_value_combination_id
65963 , x_value_segment_code => l_adr_value_segment_code
65964 , p_side => 'NA'
65965 , p_override_seg_flag => 'Y'
65966 );
65967
65968 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
65969
65970 xla_ae_lines_pkg.set_segment(
65971 p_to_segment_code => 'GL_BALANCING'
65972 , p_segment_value => l_segment
65973 , p_from_segment_code => l_adr_value_segment_code
65974 , p_from_combination_id => l_adr_value_combination_id
65975 , p_value_type_code => l_adr_value_type_code
65976 , p_transaction_coa_id => l_adr_transaction_coa_id
65977 , p_accounting_coa_id => l_adr_accounting_coa_id
65978 , p_flexfield_segment_code => l_adr_flexfield_segment_code
65979 , p_flex_value_set_id => l_adr_flex_value_set_id
65980 , p_adr_code => 'FA_EXPENSE_ACCT'
65981 , p_adr_type_code => 'S'
65982 , p_component_type => l_component_type
65983 , p_component_code => l_component_code
65984 , p_component_type_code => l_component_type_code
65985 , p_component_appl_id => l_component_appl_id
65986 , p_amb_context_code => l_amb_context_code
65987 , p_entity_code => 'TRANSACTIONS'
65988 , p_event_class_code => 'CIP_TRANSFERS'
65989 , p_side => 'NA'
65990 );
65991
65992 END IF;
65993
65994 l_segment := AcctDerRule_159(
65995 p_application_id => p_application_id
65996 , p_ae_header_id => l_ae_header_id
65997 , p_source_5 => p_source_5
65998 , p_source_22 => p_source_22
65999 , x_transaction_coa_id => l_adr_transaction_coa_id
66000 , x_accounting_coa_id => l_adr_accounting_coa_id
66001 , x_flexfield_segment_code => l_adr_flexfield_segment_code
66002 , x_flex_value_set_id => l_adr_flex_value_set_id
66003 , x_value_type_code => l_adr_value_type_code
66004 , x_value_combination_id => l_adr_value_combination_id
66005 , x_value_segment_code => l_adr_value_segment_code
66006 , p_side => 'NA'
66007 , p_override_seg_flag => 'Y'
66008 );
66009
66010 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
66011
66012 xla_ae_lines_pkg.set_segment(
66013 p_to_segment_code => 'GL_ACCOUNT'
66014 , p_segment_value => l_segment
66015 , p_from_segment_code => l_adr_value_segment_code
66016 , p_from_combination_id => l_adr_value_combination_id
66017 , p_value_type_code => l_adr_value_type_code
66018 , p_transaction_coa_id => l_adr_transaction_coa_id
66019 , p_accounting_coa_id => l_adr_accounting_coa_id
66020 , p_flexfield_segment_code => l_adr_flexfield_segment_code
66021 , p_flex_value_set_id => l_adr_flex_value_set_id
66022 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
66023 , p_adr_type_code => 'S'
66024 , p_component_type => l_component_type
66025 , p_component_code => l_component_code
66026 , p_component_type_code => l_component_type_code
66027 , p_component_appl_id => l_component_appl_id
66028 , p_amb_context_code => l_amb_context_code
66029 , p_entity_code => 'TRANSACTIONS'
66030 , p_event_class_code => 'CIP_TRANSFERS'
66031 , p_side => 'NA'
66032 );
66033
66034 END IF;
66035
66036 --
66037 --
66038 END IF;
66039 --
66040 -- Bug 4922099
66041 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
66042 (NVL(l_enc_upg_option, 'N') = 'O')
66043 ) AND
66044 (l_bflow_method_code = 'PRIOR_ENTRY')
66045 )
66046 THEN
66047 IF
66048 --
66049 1 = 2
66050 --
66051 THEN
66052 xla_accounting_err_pkg.build_message
66053 (p_appli_s_name => 'XLA'
66054 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
66055 ,p_token_1 => 'LINE_NUMBER'
66056 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
66057 ,p_token_2 => 'LINE_TYPE_NAME'
66058 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
66062 ,l_component_appl_id
66059 l_component_type
66060 ,l_component_code
66061 ,l_component_type_code
66063 ,l_amb_context_code
66064 ,l_entity_code
66065 ,l_event_class_code
66066 )
66067 ,p_token_3 => 'OWNER'
66068 ,p_value_3 => xla_lookups_pkg.get_meaning(
66069 p_lookup_type => 'XLA_OWNER_TYPE'
66070 ,p_lookup_code => l_component_type_code
66071 )
66072 ,p_token_4 => 'PRODUCT_NAME'
66073 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
66074 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
66075 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
66076 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
66077 ,p_ae_header_id => NULL
66078 );
66079
66080 IF (C_LEVEL_ERROR>= g_log_level) THEN
66081 trace
66082 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
66083 ,p_level => C_LEVEL_ERROR
66084 ,p_module => l_log_module);
66085 END IF;
66086 END IF;
66087 END IF;
66088 --
66089 --
66090 ------------------------------------------------------------------------------------------------
66091 -- 4219869 Business Flow
66092 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
66093 -- Prior Entry. Currently, the following code is always generated.
66094 ------------------------------------------------------------------------------------------------
66095 XLA_AE_LINES_PKG.ValidateCurrentLine;
66096
66097 ------------------------------------------------------------------------------------
66098 -- 4219869 Business Flow
66099 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
66100 ------------------------------------------------------------------------------------
66101 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
66102
66103 ----------------------------------------------------------------------------------
66104 -- 4219869 Business Flow
66105 -- Update journal entry status -- Need to generate this within IF <condition>
66106 ----------------------------------------------------------------------------------
66107 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
66108 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
66109 ,p_balance_type_code => l_balance_type_code
66110 );
66111
66112 -------------------------------------------------------------------------------------------
66113 -- 4262811 - Generate the Accrual Reversal lines
66114 -------------------------------------------------------------------------------------------
66115 BEGIN
66116 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
66117 (g_array_event(p_event_id).array_value_num('header_index'));
66118 IF l_acc_rev_flag IS NULL THEN
66119 l_acc_rev_flag := 'N';
66120 END IF;
66121 EXCEPTION
66122 WHEN OTHERS THEN
66123 l_acc_rev_flag := 'N';
66124 END;
66125 --
66126 IF (l_acc_rev_flag = 'Y') THEN
66127
66128 -- 4645092 ------------------------------------------------------------------------------
66129 -- To allow MPA report to determine if it should generate report process
66130 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
66131 ------------------------------------------------------------------------------------------
66132
66133 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
66134 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
66135 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
66136 -- call ADRs
66137 -- Bug 4922099
66138 --
66139 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
66140 (NVL(l_actual_upg_option, 'N') = 'O') OR
66141 (NVL(l_enc_upg_option, 'N') = 'O')
66142 )
66143 THEN
66144 NULL;
66145 --
66146 --
66147
66148 l_ccid := AcctDerRule_174(
66149 p_application_id => p_application_id
66150 , p_ae_header_id => l_ae_header_id
66151 , p_source_5 => p_source_5
66152 , p_source_32 => p_source_32
66153 , x_transaction_coa_id => l_adr_transaction_coa_id
66154 , x_accounting_coa_id => l_adr_accounting_coa_id
66158
66155 , x_value_type_code => l_adr_value_type_code
66156 , p_side => 'NA'
66157 );
66159 xla_ae_lines_pkg.set_ccid(
66160 p_code_combination_id => l_ccid
66161 , p_value_type_code => l_adr_value_type_code
66162 , p_transaction_coa_id => l_adr_transaction_coa_id
66163 , p_accounting_coa_id => l_adr_accounting_coa_id
66164 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
66165 , p_adr_type_code => 'S'
66166 , p_component_type => l_component_type
66167 , p_component_code => l_component_code
66168 , p_component_type_code => l_component_type_code
66169 , p_component_appl_id => l_component_appl_id
66170 , p_amb_context_code => l_amb_context_code
66171 , p_side => 'NA'
66172 );
66173
66174
66175 l_segment := AcctDerRule_169(
66176 p_application_id => p_application_id
66177 , p_ae_header_id => l_ae_header_id
66178 , p_source_5 => p_source_5
66179 , p_source_31 => p_source_31
66180 , x_transaction_coa_id => l_adr_transaction_coa_id
66181 , x_accounting_coa_id => l_adr_accounting_coa_id
66182 , x_flexfield_segment_code => l_adr_flexfield_segment_code
66183 , x_flex_value_set_id => l_adr_flex_value_set_id
66184 , x_value_type_code => l_adr_value_type_code
66185 , x_value_combination_id => l_adr_value_combination_id
66186 , x_value_segment_code => l_adr_value_segment_code
66187 , p_side => 'NA'
66188 , p_override_seg_flag => 'Y'
66189 );
66190
66191 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
66192
66193 xla_ae_lines_pkg.set_segment(
66194 p_to_segment_code => 'GL_BALANCING'
66195 , p_segment_value => l_segment
66196 , p_from_segment_code => l_adr_value_segment_code
66197 , p_from_combination_id => l_adr_value_combination_id
66198 , p_value_type_code => l_adr_value_type_code
66199 , p_transaction_coa_id => l_adr_transaction_coa_id
66200 , p_accounting_coa_id => l_adr_accounting_coa_id
66201 , p_flexfield_segment_code => l_adr_flexfield_segment_code
66202 , p_flex_value_set_id => l_adr_flex_value_set_id
66203 , p_adr_code => 'FA_EXPENSE_ACCT'
66204 , p_adr_type_code => 'S'
66205 , p_component_type => l_component_type
66206 , p_component_code => l_component_code
66207 , p_component_type_code => l_component_type_code
66208 , p_component_appl_id => l_component_appl_id
66209 , p_amb_context_code => l_amb_context_code
66210 , p_entity_code => 'TRANSACTIONS'
66211 , p_event_class_code => 'CIP_TRANSFERS'
66212 , p_side => 'NA'
66213 );
66214
66215 END IF;
66216
66217 l_segment := AcctDerRule_159(
66218 p_application_id => p_application_id
66219 , p_ae_header_id => l_ae_header_id
66220 , p_source_5 => p_source_5
66221 , p_source_22 => p_source_22
66222 , x_transaction_coa_id => l_adr_transaction_coa_id
66223 , x_accounting_coa_id => l_adr_accounting_coa_id
66224 , x_flexfield_segment_code => l_adr_flexfield_segment_code
66225 , x_flex_value_set_id => l_adr_flex_value_set_id
66226 , x_value_type_code => l_adr_value_type_code
66227 , x_value_combination_id => l_adr_value_combination_id
66228 , x_value_segment_code => l_adr_value_segment_code
66229 , p_side => 'NA'
66230 , p_override_seg_flag => 'Y'
66231 );
66232
66233 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
66234
66235 xla_ae_lines_pkg.set_segment(
66236 p_to_segment_code => 'GL_ACCOUNT'
66237 , p_segment_value => l_segment
66238 , p_from_segment_code => l_adr_value_segment_code
66239 , p_from_combination_id => l_adr_value_combination_id
66240 , p_value_type_code => l_adr_value_type_code
66241 , p_transaction_coa_id => l_adr_transaction_coa_id
66242 , p_accounting_coa_id => l_adr_accounting_coa_id
66243 , p_flexfield_segment_code => l_adr_flexfield_segment_code
66244 , p_flex_value_set_id => l_adr_flex_value_set_id
66245 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
66246 , p_adr_type_code => 'S'
66247 , p_component_type => l_component_type
66248 , p_component_code => l_component_code
66249 , p_component_type_code => l_component_type_code
66250 , p_component_appl_id => l_component_appl_id
66251 , p_amb_context_code => l_amb_context_code
66252 , p_entity_code => 'TRANSACTIONS'
66253 , p_event_class_code => 'CIP_TRANSFERS'
66254 , p_side => 'NA'
66255 );
66256
66257 END IF;
66258
66259 --
66260 --
66261 END IF;
66262
66263 --
66264 -- Update the line information that should be overwritten
66265 --
66266 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
66267 p_header_num => 1);
66271
66268 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
66269
66270 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
66272 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
66273 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
66274 END IF;
66275
66276 --
66277 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
66278 --
66279 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
66280 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
66281 ELSE
66282 ---------------------------------------------------------------------------------------------------
66283 -- 4262811a Switch Sign
66284 ---------------------------------------------------------------------------------------------------
66285 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
66286 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
66287 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
66288 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
66289 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
66290 -- 5132302
66291 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
66292 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
66293
66294 END IF;
66295
66296 -- 4955764
66297 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
66298 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
66299
66300
66301 XLA_AE_LINES_PKG.ValidateCurrentLine;
66302 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
66303
66304 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
66305 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
66306 ,p_balance_type_code => l_balance_type_code);
66307
66308 END IF;
66309
66310 -----------------------------------------------------------------------------------------
66311 -- 4262811 Multiperiod Accounting
66312 -----------------------------------------------------------------------------------------
66313 -- No MPA option is assigned.
66314
66315
66316 END IF;
66317 END IF;
66318 --
66319
66320 --
66321 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
66322 trace
66323 (p_msg => 'END of AcctLineType_256'
66324 ,p_level => C_LEVEL_PROCEDURE
66325 ,p_module => l_log_module);
66326 END IF;
66327 --
66328 EXCEPTION
66329 WHEN xla_exceptions_pkg.application_exception THEN
66330 RAISE;
66331 WHEN OTHERS THEN
66332 xla_exceptions_pkg.raise_message
66333 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_256');
66334 END AcctLineType_256;
66335 --
66336
66337 ---------------------------------------
66338 --
66339 -- PRIVATE FUNCTION
66340 -- AcctLineType_257
66341 --
66342 ---------------------------------------
66343 PROCEDURE AcctLineType_257 (
66344 p_application_id IN NUMBER
66345 ,p_event_id IN NUMBER
66346 ,p_calculate_acctd_flag IN VARCHAR2
66347 ,p_calculate_g_l_flag IN VARCHAR2
66348 ,p_actual_flag IN OUT VARCHAR2
66349 ,p_balance_type_code OUT VARCHAR2
66350 ,p_gain_or_loss_ref OUT VARCHAR2
66351
66352 --Period Close Date
66353 , p_source_1 IN DATE
66354 --Generated Code Combination Identifier
66355 , p_source_5 IN NUMBER
66356 --CIP Cost Account
66357 , p_source_9 IN VARCHAR2
66358 --Expense Account Code Combination Identifier
66359 , p_source_31 IN NUMBER
66360 --Default Code Combination Identifier
66361 , p_source_32 IN NUMBER
66362 --Adjustment Type
66363 , p_source_48 IN VARCHAR2
66364 --Transaction Header Identifier
66365 , p_source_49 IN NUMBER
66366 --Adjustment Line Identifier
66367 , p_source_50 IN NUMBER
66368 --Distribution Type Code
66369 , p_source_51 IN VARCHAR2
66370 --Entered Amount
66371 , p_source_52 IN NUMBER
66372 --Currency Code
66373 , p_source_53 IN VARCHAR2
66374 --Source Destination Code
66375 , p_source_55 IN VARCHAR2
66376 )
66377 IS
66378
66379 l_component_type VARCHAR2(80);
66380 l_component_code VARCHAR2(30);
66381 l_component_type_code VARCHAR2(1);
66382 l_component_appl_id INTEGER;
66383 l_amb_context_code VARCHAR2(30);
66384 l_entity_code VARCHAR2(30);
66385 l_event_class_code VARCHAR2(30);
66386 l_ae_header_id NUMBER;
66387 l_event_type_code VARCHAR2(30);
66388 l_line_definition_code VARCHAR2(30);
66389 l_line_definition_owner_code VARCHAR2(1);
66390 --
66391 -- adr variables
66392 l_segment VARCHAR2(30);
66396 l_adr_flexfield_segment_code VARCHAR2(30);
66393 l_ccid NUMBER;
66394 l_adr_transaction_coa_id NUMBER;
66395 l_adr_accounting_coa_id NUMBER;
66397 l_adr_flex_value_set_id NUMBER;
66398 l_adr_value_type_code VARCHAR2(30);
66399 l_adr_value_combination_id NUMBER;
66400 l_adr_value_segment_code VARCHAR2(30);
66401
66402 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
66403 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
66404 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
66405 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
66406
66407 -- 4262811 Variables ------------------------------------------------------------------------------------------
66408 l_entered_amt_idx NUMBER;
66409 l_accted_amt_idx NUMBER;
66410 l_acc_rev_flag VARCHAR2(1);
66411 l_accrual_line_num NUMBER;
66412 l_tmp_amt NUMBER;
66413 l_acc_rev_natural_side_code VARCHAR2(1);
66414
66415 l_num_entries NUMBER;
66416 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
66417 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
66418 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
66419 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
66420 l_recog_line_1 NUMBER;
66421 l_recog_line_2 NUMBER;
66422
66423 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
66424 l_bflow_applied_to_amt NUMBER; -- 5132302
66425 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
66426
66427 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
66428
66429 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
66430 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
66431
66432 ---------------------------------------------------------------------------------------------------------------
66433
66434
66435 --
66436 -- bulk performance
66437 --
66438 l_balance_type_code VARCHAR2(1);
66439 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
66440 l_log_module VARCHAR2(240);
66441
66442 --
66443 -- Upgrade strategy
66444 --
66445 l_actual_upg_option VARCHAR2(1);
66446 l_enc_upg_option VARCHAR2(1);
66447
66448 --
66449 BEGIN
66450 --
66451 IF g_log_enabled THEN
66452 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_257';
66453 END IF;
66454 --
66455 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
66456
66457 trace
66458 (p_msg => 'BEGIN of AcctLineType_257'
66459 ,p_level => C_LEVEL_PROCEDURE
66460 ,p_module => l_log_module);
66461
66462 END IF;
66463 --
66464 l_component_type := 'AMB_JLT';
66465 l_component_code := 'FA_CIP_TRANSFER_SOURCE_COST';
66466 l_component_type_code := 'S';
66467 l_component_appl_id := 140;
66468 l_amb_context_code := 'DEFAULT';
66469 l_entity_code := 'TRANSACTIONS';
66470 l_event_class_code := 'CIP_TRANSFERS';
66471 l_event_type_code := 'CIP_TRANSFERS_ALL';
66472 l_line_definition_owner_code := 'S';
66473 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_T12';
66474 --
66475 l_balance_type_code := 'A';
66476 l_segment := NULL;
66477 l_ccid := NULL;
66478 l_adr_transaction_coa_id := NULL;
66479 l_adr_accounting_coa_id := NULL;
66480 l_adr_flexfield_segment_code := NULL;
66481 l_adr_flex_value_set_id := NULL;
66482 l_adr_value_type_code := NULL;
66483 l_adr_value_combination_id := NULL;
66484 l_adr_value_segment_code := NULL;
66485
66486 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
66487 l_bflow_class_code := ''; -- 4219869 Business Flow
66488 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
66489 l_budgetary_control_flag := 'N';
66490
66491 l_bflow_applied_to_amt_idx := NULL; -- 5132302
66492 l_bflow_applied_to_amt := NULL; -- 5132302
66493 l_entered_amt_idx := NULL; -- 4262811
66494 l_accted_amt_idx := NULL; -- 4262811
66495 l_acc_rev_flag := NULL; -- 4262811
66496 l_accrual_line_num := NULL; -- 4262811
66497 l_tmp_amt := NULL; -- 4262811
66498 --
66499
66500 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
66501 l_balance_type_code <> 'B' THEN
66502 IF NVL(p_source_48,'
66503 ') = 'CIP COST' AND
66504 NVL(p_source_55,'
66505 ') = 'SOURCE'
66506 THEN
66507
66508 --
66509 XLA_AE_LINES_PKG.SetNewLine;
66510
66511 p_balance_type_code := l_balance_type_code;
66512 -- set the flag so later we will know whether the gain loss line needs to be created
66513
66514 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
66515 p_actual_flag :='A';
66516 END IF;
66517
66518 --
66519 -- bulk performance
66520 --
66524 -- set accounting line options
66521 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
66522 p_header_num => 0); -- 4262811
66523 --
66525 --
66526 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
66527 p_natural_side_code => 'C'
66528 , p_gain_or_loss_flag => 'N'
66529 , p_gl_transfer_mode_code => 'S'
66530 , p_acct_entry_type_code => 'A'
66531 , p_switch_side_flag => 'Y'
66532 , p_merge_duplicate_code => 'N'
66533 );
66534 --
66535 l_acc_rev_natural_side_code := 'D'; -- 4262811
66536 --
66537 --
66538 -- set accounting line type info
66539 --
66540 xla_ae_lines_pkg.SetAcctLineType
66541 (p_component_type => l_component_type
66542 ,p_event_type_code => l_event_type_code
66543 ,p_line_definition_owner_code => l_line_definition_owner_code
66544 ,p_line_definition_code => l_line_definition_code
66545 ,p_accounting_line_code => l_component_code
66546 ,p_accounting_line_type_code => l_component_type_code
66547 ,p_accounting_line_appl_id => l_component_appl_id
66548 ,p_amb_context_code => l_amb_context_code
66549 ,p_entity_code => l_entity_code
66550 ,p_event_class_code => l_event_class_code);
66551 --
66552 -- set accounting class
66553 --
66554 xla_ae_lines_pkg.SetAcctClass(
66555 p_accounting_class_code => 'ASSET'
66556 , p_ae_header_id => l_ae_header_id
66557 );
66558
66559 --
66560 -- set rounding class
66561 --
66562 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
66563 'ASSET';
66564
66565 --
66566 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
66567 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
66568 --
66569 -- bulk performance
66570 --
66571 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
66572
66573 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
66574 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
66575
66576 -- 4955764
66577 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
66578 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
66579
66580 -- 4458381 Public Sector Enh
66581
66582 --
66583 -- set accounting attributes for the line type
66584 --
66585 l_entered_amt_idx := 4;
66586 l_accted_amt_idx := 6;
66587 l_bflow_applied_to_amt_idx := NULL; -- 5132302
66588 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
66589 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
66590 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
66591 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
66592 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
66593 l_rec_acct_attrs.array_char_value(3) := p_source_51;
66594 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
66595 l_rec_acct_attrs.array_num_value(4) := p_source_52;
66596 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
66597 l_rec_acct_attrs.array_char_value(5) := p_source_53;
66598 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
66599 l_rec_acct_attrs.array_num_value(6) := p_source_52;
66600
66601 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
66602 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
66603
66604 ---------------------------------------------------------------------------------------------------------------
66605 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
66606 ---------------------------------------------------------------------------------------------------------------
66607 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
66608
66609 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
66610 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
66611
66612 IF xla_accounting_cache_pkg.GetValueChar
66613 (p_source_code => 'LEDGER_CATEGORY_CODE'
66614 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
66615 AND l_bflow_method_code = 'PRIOR_ENTRY'
66616 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
66617 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
66618 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
66619 )
66620 THEN
66621 xla_ae_lines_pkg.BflowUpgEntry
66622 (p_business_method_code => l_bflow_method_code
66623 ,p_business_class_code => l_bflow_class_code
66624 ,p_balance_type => l_balance_type_code);
66625 ELSE
66626 NULL;
66627 -- No business flow processing for business flow method of NONE.
66628 END IF;
66629
66630 --
66634 --
66631 -- call analytical criteria
66632 --
66633
66635 -- call description
66636 --
66637
66638 xla_ae_lines_pkg.SetLineDescription(
66639 p_ae_header_id => l_ae_header_id
66640 ,p_description => Description_45 (
66641 p_application_id => p_application_id
66642 , p_ae_header_id => l_ae_header_id
66643 , p_source_1 => p_source_1
66644 )
66645 );
66646
66647
66648 --
66649 -- call ADRs
66650 -- Bug 4922099
66651 --
66652 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
66653 (NVL(l_actual_upg_option, 'N') = 'O') OR
66654 (NVL(l_enc_upg_option, 'N') = 'O')
66655 )
66656 THEN
66657 NULL;
66658 --
66659 --
66660
66661 l_ccid := AcctDerRule_174(
66662 p_application_id => p_application_id
66663 , p_ae_header_id => l_ae_header_id
66664 , p_source_5 => p_source_5
66665 , p_source_32 => p_source_32
66666 , x_transaction_coa_id => l_adr_transaction_coa_id
66667 , x_accounting_coa_id => l_adr_accounting_coa_id
66668 , x_value_type_code => l_adr_value_type_code
66669 , p_side => 'NA'
66670 );
66671
66672 xla_ae_lines_pkg.set_ccid(
66673 p_code_combination_id => l_ccid
66674 , p_value_type_code => l_adr_value_type_code
66675 , p_transaction_coa_id => l_adr_transaction_coa_id
66676 , p_accounting_coa_id => l_adr_accounting_coa_id
66677 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
66678 , p_adr_type_code => 'S'
66679 , p_component_type => l_component_type
66680 , p_component_code => l_component_code
66681 , p_component_type_code => l_component_type_code
66682 , p_component_appl_id => l_component_appl_id
66683 , p_amb_context_code => l_amb_context_code
66684 , p_side => 'NA'
66685 );
66686
66687
66688 l_segment := AcctDerRule_147(
66689 p_application_id => p_application_id
66690 , p_ae_header_id => l_ae_header_id
66691 , p_source_5 => p_source_5
66692 , p_source_9 => p_source_9
66693 , x_transaction_coa_id => l_adr_transaction_coa_id
66694 , x_accounting_coa_id => l_adr_accounting_coa_id
66695 , x_flexfield_segment_code => l_adr_flexfield_segment_code
66696 , x_flex_value_set_id => l_adr_flex_value_set_id
66697 , x_value_type_code => l_adr_value_type_code
66698 , x_value_combination_id => l_adr_value_combination_id
66699 , x_value_segment_code => l_adr_value_segment_code
66700 , p_side => 'NA'
66701 , p_override_seg_flag => 'Y'
66702 );
66703
66704 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
66705
66706 xla_ae_lines_pkg.set_segment(
66707 p_to_segment_code => 'GL_ACCOUNT'
66708 , p_segment_value => l_segment
66709 , p_from_segment_code => l_adr_value_segment_code
66710 , p_from_combination_id => l_adr_value_combination_id
66711 , p_value_type_code => l_adr_value_type_code
66712 , p_transaction_coa_id => l_adr_transaction_coa_id
66713 , p_accounting_coa_id => l_adr_accounting_coa_id
66714 , p_flexfield_segment_code => l_adr_flexfield_segment_code
66715 , p_flex_value_set_id => l_adr_flex_value_set_id
66716 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
66717 , p_adr_type_code => 'S'
66718 , p_component_type => l_component_type
66719 , p_component_code => l_component_code
66720 , p_component_type_code => l_component_type_code
66721 , p_component_appl_id => l_component_appl_id
66722 , p_amb_context_code => l_amb_context_code
66723 , p_entity_code => 'TRANSACTIONS'
66724 , p_event_class_code => 'CIP_TRANSFERS'
66725 , p_side => 'NA'
66726 );
66727
66728 END IF;
66729
66730 l_segment := AcctDerRule_169(
66731 p_application_id => p_application_id
66732 , p_ae_header_id => l_ae_header_id
66733 , p_source_5 => p_source_5
66734 , p_source_31 => p_source_31
66735 , x_transaction_coa_id => l_adr_transaction_coa_id
66736 , x_accounting_coa_id => l_adr_accounting_coa_id
66737 , x_flexfield_segment_code => l_adr_flexfield_segment_code
66738 , x_flex_value_set_id => l_adr_flex_value_set_id
66739 , x_value_type_code => l_adr_value_type_code
66740 , x_value_combination_id => l_adr_value_combination_id
66741 , x_value_segment_code => l_adr_value_segment_code
66742 , p_side => 'NA'
66743 , p_override_seg_flag => 'Y'
66744 );
66745
66746 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
66747
66748 xla_ae_lines_pkg.set_segment(
66749 p_to_segment_code => 'GL_BALANCING'
66750 , p_segment_value => l_segment
66751 , p_from_segment_code => l_adr_value_segment_code
66752 , p_from_combination_id => l_adr_value_combination_id
66753 , p_value_type_code => l_adr_value_type_code
66757 , p_flex_value_set_id => l_adr_flex_value_set_id
66754 , p_transaction_coa_id => l_adr_transaction_coa_id
66755 , p_accounting_coa_id => l_adr_accounting_coa_id
66756 , p_flexfield_segment_code => l_adr_flexfield_segment_code
66758 , p_adr_code => 'FA_EXPENSE_ACCT'
66759 , p_adr_type_code => 'S'
66760 , p_component_type => l_component_type
66761 , p_component_code => l_component_code
66762 , p_component_type_code => l_component_type_code
66763 , p_component_appl_id => l_component_appl_id
66764 , p_amb_context_code => l_amb_context_code
66765 , p_entity_code => 'TRANSACTIONS'
66766 , p_event_class_code => 'CIP_TRANSFERS'
66767 , p_side => 'NA'
66768 );
66769
66770 END IF;
66771
66772 --
66773 --
66774 END IF;
66775 --
66776 -- Bug 4922099
66777 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
66778 (NVL(l_enc_upg_option, 'N') = 'O')
66779 ) AND
66780 (l_bflow_method_code = 'PRIOR_ENTRY')
66781 )
66782 THEN
66783 IF
66784 --
66785 1 = 2
66786 --
66787 THEN
66788 xla_accounting_err_pkg.build_message
66789 (p_appli_s_name => 'XLA'
66790 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
66791 ,p_token_1 => 'LINE_NUMBER'
66792 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
66793 ,p_token_2 => 'LINE_TYPE_NAME'
66794 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
66795 l_component_type
66796 ,l_component_code
66797 ,l_component_type_code
66798 ,l_component_appl_id
66799 ,l_amb_context_code
66800 ,l_entity_code
66801 ,l_event_class_code
66802 )
66803 ,p_token_3 => 'OWNER'
66804 ,p_value_3 => xla_lookups_pkg.get_meaning(
66805 p_lookup_type => 'XLA_OWNER_TYPE'
66806 ,p_lookup_code => l_component_type_code
66807 )
66808 ,p_token_4 => 'PRODUCT_NAME'
66809 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
66810 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
66811 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
66812 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
66813 ,p_ae_header_id => NULL
66814 );
66815
66816 IF (C_LEVEL_ERROR>= g_log_level) THEN
66817 trace
66818 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
66819 ,p_level => C_LEVEL_ERROR
66820 ,p_module => l_log_module);
66821 END IF;
66822 END IF;
66823 END IF;
66824 --
66825 --
66826 ------------------------------------------------------------------------------------------------
66827 -- 4219869 Business Flow
66828 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
66829 -- Prior Entry. Currently, the following code is always generated.
66830 ------------------------------------------------------------------------------------------------
66831 XLA_AE_LINES_PKG.ValidateCurrentLine;
66832
66833 ------------------------------------------------------------------------------------
66834 -- 4219869 Business Flow
66835 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
66836 ------------------------------------------------------------------------------------
66837 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
66838
66839 ----------------------------------------------------------------------------------
66840 -- 4219869 Business Flow
66841 -- Update journal entry status -- Need to generate this within IF <condition>
66842 ----------------------------------------------------------------------------------
66843 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
66844 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
66845 ,p_balance_type_code => l_balance_type_code
66846 );
66847
66848 -------------------------------------------------------------------------------------------
66852 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
66849 -- 4262811 - Generate the Accrual Reversal lines
66850 -------------------------------------------------------------------------------------------
66851 BEGIN
66853 (g_array_event(p_event_id).array_value_num('header_index'));
66854 IF l_acc_rev_flag IS NULL THEN
66855 l_acc_rev_flag := 'N';
66856 END IF;
66857 EXCEPTION
66858 WHEN OTHERS THEN
66859 l_acc_rev_flag := 'N';
66860 END;
66861 --
66862 IF (l_acc_rev_flag = 'Y') THEN
66863
66864 -- 4645092 ------------------------------------------------------------------------------
66865 -- To allow MPA report to determine if it should generate report process
66866 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
66867 ------------------------------------------------------------------------------------------
66868
66869 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
66870 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
66871 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
66872 -- call ADRs
66873 -- Bug 4922099
66874 --
66875 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
66876 (NVL(l_actual_upg_option, 'N') = 'O') OR
66877 (NVL(l_enc_upg_option, 'N') = 'O')
66878 )
66879 THEN
66880 NULL;
66881 --
66882 --
66883
66884 l_ccid := AcctDerRule_174(
66885 p_application_id => p_application_id
66886 , p_ae_header_id => l_ae_header_id
66887 , p_source_5 => p_source_5
66888 , p_source_32 => p_source_32
66889 , x_transaction_coa_id => l_adr_transaction_coa_id
66890 , x_accounting_coa_id => l_adr_accounting_coa_id
66891 , x_value_type_code => l_adr_value_type_code
66892 , p_side => 'NA'
66893 );
66894
66895 xla_ae_lines_pkg.set_ccid(
66896 p_code_combination_id => l_ccid
66897 , p_value_type_code => l_adr_value_type_code
66898 , p_transaction_coa_id => l_adr_transaction_coa_id
66899 , p_accounting_coa_id => l_adr_accounting_coa_id
66900 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
66901 , p_adr_type_code => 'S'
66902 , p_component_type => l_component_type
66903 , p_component_code => l_component_code
66904 , p_component_type_code => l_component_type_code
66905 , p_component_appl_id => l_component_appl_id
66906 , p_amb_context_code => l_amb_context_code
66907 , p_side => 'NA'
66908 );
66909
66910
66911 l_segment := AcctDerRule_147(
66912 p_application_id => p_application_id
66913 , p_ae_header_id => l_ae_header_id
66914 , p_source_5 => p_source_5
66915 , p_source_9 => p_source_9
66916 , x_transaction_coa_id => l_adr_transaction_coa_id
66917 , x_accounting_coa_id => l_adr_accounting_coa_id
66918 , x_flexfield_segment_code => l_adr_flexfield_segment_code
66919 , x_flex_value_set_id => l_adr_flex_value_set_id
66920 , x_value_type_code => l_adr_value_type_code
66921 , x_value_combination_id => l_adr_value_combination_id
66922 , x_value_segment_code => l_adr_value_segment_code
66923 , p_side => 'NA'
66924 , p_override_seg_flag => 'Y'
66925 );
66926
66927 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
66928
66929 xla_ae_lines_pkg.set_segment(
66930 p_to_segment_code => 'GL_ACCOUNT'
66931 , p_segment_value => l_segment
66932 , p_from_segment_code => l_adr_value_segment_code
66933 , p_from_combination_id => l_adr_value_combination_id
66934 , p_value_type_code => l_adr_value_type_code
66935 , p_transaction_coa_id => l_adr_transaction_coa_id
66936 , p_accounting_coa_id => l_adr_accounting_coa_id
66937 , p_flexfield_segment_code => l_adr_flexfield_segment_code
66938 , p_flex_value_set_id => l_adr_flex_value_set_id
66939 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
66940 , p_adr_type_code => 'S'
66941 , p_component_type => l_component_type
66942 , p_component_code => l_component_code
66943 , p_component_type_code => l_component_type_code
66944 , p_component_appl_id => l_component_appl_id
66945 , p_amb_context_code => l_amb_context_code
66946 , p_entity_code => 'TRANSACTIONS'
66947 , p_event_class_code => 'CIP_TRANSFERS'
66948 , p_side => 'NA'
66949 );
66950
66951 END IF;
66952
66953 l_segment := AcctDerRule_169(
66954 p_application_id => p_application_id
66955 , p_ae_header_id => l_ae_header_id
66956 , p_source_5 => p_source_5
66957 , p_source_31 => p_source_31
66958 , x_transaction_coa_id => l_adr_transaction_coa_id
66959 , x_accounting_coa_id => l_adr_accounting_coa_id
66960 , x_flexfield_segment_code => l_adr_flexfield_segment_code
66961 , x_flex_value_set_id => l_adr_flex_value_set_id
66965 , p_side => 'NA'
66962 , x_value_type_code => l_adr_value_type_code
66963 , x_value_combination_id => l_adr_value_combination_id
66964 , x_value_segment_code => l_adr_value_segment_code
66966 , p_override_seg_flag => 'Y'
66967 );
66968
66969 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
66970
66971 xla_ae_lines_pkg.set_segment(
66972 p_to_segment_code => 'GL_BALANCING'
66973 , p_segment_value => l_segment
66974 , p_from_segment_code => l_adr_value_segment_code
66975 , p_from_combination_id => l_adr_value_combination_id
66976 , p_value_type_code => l_adr_value_type_code
66977 , p_transaction_coa_id => l_adr_transaction_coa_id
66978 , p_accounting_coa_id => l_adr_accounting_coa_id
66979 , p_flexfield_segment_code => l_adr_flexfield_segment_code
66980 , p_flex_value_set_id => l_adr_flex_value_set_id
66981 , p_adr_code => 'FA_EXPENSE_ACCT'
66982 , p_adr_type_code => 'S'
66983 , p_component_type => l_component_type
66984 , p_component_code => l_component_code
66985 , p_component_type_code => l_component_type_code
66986 , p_component_appl_id => l_component_appl_id
66987 , p_amb_context_code => l_amb_context_code
66988 , p_entity_code => 'TRANSACTIONS'
66989 , p_event_class_code => 'CIP_TRANSFERS'
66990 , p_side => 'NA'
66991 );
66992
66993 END IF;
66994
66995 --
66996 --
66997 END IF;
66998
66999 --
67000 -- Update the line information that should be overwritten
67001 --
67002 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
67003 p_header_num => 1);
67004 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
67005
67006 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
67007
67008 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
67009 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
67010 END IF;
67011
67012 --
67013 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
67014 --
67015 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
67016 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
67017 ELSE
67018 ---------------------------------------------------------------------------------------------------
67019 -- 4262811a Switch Sign
67020 ---------------------------------------------------------------------------------------------------
67021 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
67022 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
67023 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
67024 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
67025 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
67026 -- 5132302
67027 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
67028 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
67029
67030 END IF;
67031
67032 -- 4955764
67033 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
67034 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
67035
67036
67037 XLA_AE_LINES_PKG.ValidateCurrentLine;
67038 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
67039
67040 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
67041 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
67042 ,p_balance_type_code => l_balance_type_code);
67043
67044 END IF;
67045
67046 -----------------------------------------------------------------------------------------
67047 -- 4262811 Multiperiod Accounting
67048 -----------------------------------------------------------------------------------------
67049 -- No MPA option is assigned.
67050
67051
67052 END IF;
67053 END IF;
67054 --
67055
67056 --
67057 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
67058 trace
67059 (p_msg => 'END of AcctLineType_257'
67060 ,p_level => C_LEVEL_PROCEDURE
67061 ,p_module => l_log_module);
67062 END IF;
67063 --
67064 EXCEPTION
67065 WHEN xla_exceptions_pkg.application_exception THEN
67066 RAISE;
67067 WHEN OTHERS THEN
67068 xla_exceptions_pkg.raise_message
67069 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_257');
67070 END AcctLineType_257;
67071 --
67072
67073 ---------------------------------------
67074 --
67075 -- PRIVATE FUNCTION
67076 -- AcctLineType_258
67077 --
67081 ,p_event_id IN NUMBER
67078 ---------------------------------------
67079 PROCEDURE AcctLineType_258 (
67080 p_application_id IN NUMBER
67082 ,p_calculate_acctd_flag IN VARCHAR2
67083 ,p_calculate_g_l_flag IN VARCHAR2
67084 ,p_actual_flag IN OUT VARCHAR2
67085 ,p_balance_type_code OUT VARCHAR2
67086 ,p_gain_or_loss_ref OUT VARCHAR2
67087
67088 --Period Close Date
67089 , p_source_1 IN DATE
67090 --Generated Code Combination Identifier
67091 , p_source_5 IN NUMBER
67092 --Revaluation Reserve Account
67093 , p_source_13 IN VARCHAR2
67094 --Generated Offset Code Combination Identifier
67095 , p_source_19 IN NUMBER
67096 --Default Code Combination Identifier
67097 , p_source_32 IN NUMBER
67098 --Adjustment Type
67099 , p_source_48 IN VARCHAR2
67100 --Transaction Header Identifier
67101 , p_source_49 IN NUMBER
67102 --Adjustment Line Identifier
67103 , p_source_50 IN NUMBER
67104 --Distribution Type Code
67105 , p_source_51 IN VARCHAR2
67106 --Entered Amount
67107 , p_source_52 IN NUMBER
67108 --Currency Code
67109 , p_source_53 IN VARCHAR2
67110 --Source Destination Code
67111 , p_source_55 IN VARCHAR2
67112 )
67113 IS
67114
67115 l_component_type VARCHAR2(80);
67116 l_component_code VARCHAR2(30);
67117 l_component_type_code VARCHAR2(1);
67118 l_component_appl_id INTEGER;
67119 l_amb_context_code VARCHAR2(30);
67120 l_entity_code VARCHAR2(30);
67121 l_event_class_code VARCHAR2(30);
67122 l_ae_header_id NUMBER;
67123 l_event_type_code VARCHAR2(30);
67124 l_line_definition_code VARCHAR2(30);
67125 l_line_definition_owner_code VARCHAR2(1);
67126 --
67127 -- adr variables
67128 l_segment VARCHAR2(30);
67129 l_ccid NUMBER;
67130 l_adr_transaction_coa_id NUMBER;
67131 l_adr_accounting_coa_id NUMBER;
67132 l_adr_flexfield_segment_code VARCHAR2(30);
67133 l_adr_flex_value_set_id NUMBER;
67134 l_adr_value_type_code VARCHAR2(30);
67135 l_adr_value_combination_id NUMBER;
67136 l_adr_value_segment_code VARCHAR2(30);
67137
67138 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
67139 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
67140 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
67141 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
67142
67143 -- 4262811 Variables ------------------------------------------------------------------------------------------
67144 l_entered_amt_idx NUMBER;
67145 l_accted_amt_idx NUMBER;
67146 l_acc_rev_flag VARCHAR2(1);
67147 l_accrual_line_num NUMBER;
67148 l_tmp_amt NUMBER;
67149 l_acc_rev_natural_side_code VARCHAR2(1);
67150
67151 l_num_entries NUMBER;
67152 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
67153 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
67154 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
67155 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
67156 l_recog_line_1 NUMBER;
67157 l_recog_line_2 NUMBER;
67158
67159 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
67160 l_bflow_applied_to_amt NUMBER; -- 5132302
67161 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
67162
67163 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
67164
67165 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
67166 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
67167
67168 ---------------------------------------------------------------------------------------------------------------
67169
67170
67171 --
67172 -- bulk performance
67173 --
67174 l_balance_type_code VARCHAR2(1);
67175 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
67176 l_log_module VARCHAR2(240);
67177
67178 --
67179 -- Upgrade strategy
67180 --
67181 l_actual_upg_option VARCHAR2(1);
67182 l_enc_upg_option VARCHAR2(1);
67183
67184 --
67185 BEGIN
67186 --
67187 IF g_log_enabled THEN
67188 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_258';
67189 END IF;
67190 --
67191 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
67192
67193 trace
67194 (p_msg => 'BEGIN of AcctLineType_258'
67195 ,p_level => C_LEVEL_PROCEDURE
67196 ,p_module => l_log_module);
67197
67198 END IF;
67199 --
67200 l_component_type := 'AMB_JLT';
67201 l_component_code := 'FA_CIP_TRANSFER_SRC_REVAL_RES';
67202 l_component_type_code := 'S';
67203 l_component_appl_id := 140;
67204 l_amb_context_code := 'DEFAULT';
67205 l_entity_code := 'TRANSACTIONS';
67206 l_event_class_code := 'CIP_TRANSFERS';
67207 l_event_type_code := 'CIP_TRANSFERS_ALL';
67208 l_line_definition_owner_code := 'S';
67209 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_T12';
67210 --
67214 l_adr_transaction_coa_id := NULL;
67211 l_balance_type_code := 'A';
67212 l_segment := NULL;
67213 l_ccid := NULL;
67215 l_adr_accounting_coa_id := NULL;
67216 l_adr_flexfield_segment_code := NULL;
67217 l_adr_flex_value_set_id := NULL;
67218 l_adr_value_type_code := NULL;
67219 l_adr_value_combination_id := NULL;
67220 l_adr_value_segment_code := NULL;
67221
67222 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
67223 l_bflow_class_code := ''; -- 4219869 Business Flow
67224 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
67225 l_budgetary_control_flag := 'N';
67226
67227 l_bflow_applied_to_amt_idx := NULL; -- 5132302
67228 l_bflow_applied_to_amt := NULL; -- 5132302
67229 l_entered_amt_idx := NULL; -- 4262811
67230 l_accted_amt_idx := NULL; -- 4262811
67231 l_acc_rev_flag := NULL; -- 4262811
67232 l_accrual_line_num := NULL; -- 4262811
67233 l_tmp_amt := NULL; -- 4262811
67234 --
67235
67236 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
67237 l_balance_type_code <> 'B' THEN
67238 IF NVL(p_source_48,'
67239 ') = 'REVAL RESERVE' AND
67240 NVL(p_source_55,'
67241 ') = 'SOURCE'
67242 THEN
67243
67244 --
67245 XLA_AE_LINES_PKG.SetNewLine;
67246
67247 p_balance_type_code := l_balance_type_code;
67248 -- set the flag so later we will know whether the gain loss line needs to be created
67249
67250 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
67251 p_actual_flag :='A';
67252 END IF;
67253
67254 --
67255 -- bulk performance
67256 --
67257 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
67258 p_header_num => 0); -- 4262811
67259 --
67260 -- set accounting line options
67261 --
67262 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
67263 p_natural_side_code => 'D'
67264 , p_gain_or_loss_flag => 'N'
67265 , p_gl_transfer_mode_code => 'S'
67266 , p_acct_entry_type_code => 'A'
67267 , p_switch_side_flag => 'Y'
67268 , p_merge_duplicate_code => 'N'
67269 );
67270 --
67271 l_acc_rev_natural_side_code := 'C'; -- 4262811
67272 --
67273 --
67274 -- set accounting line type info
67275 --
67276 xla_ae_lines_pkg.SetAcctLineType
67277 (p_component_type => l_component_type
67278 ,p_event_type_code => l_event_type_code
67279 ,p_line_definition_owner_code => l_line_definition_owner_code
67280 ,p_line_definition_code => l_line_definition_code
67281 ,p_accounting_line_code => l_component_code
67282 ,p_accounting_line_type_code => l_component_type_code
67283 ,p_accounting_line_appl_id => l_component_appl_id
67284 ,p_amb_context_code => l_amb_context_code
67285 ,p_entity_code => l_entity_code
67286 ,p_event_class_code => l_event_class_code);
67287 --
67288 -- set accounting class
67289 --
67290 xla_ae_lines_pkg.SetAcctClass(
67291 p_accounting_class_code => 'ASSET'
67292 , p_ae_header_id => l_ae_header_id
67293 );
67294
67295 --
67296 -- set rounding class
67297 --
67298 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
67299 'ASSET';
67300
67301 --
67302 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
67303 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
67304 --
67305 -- bulk performance
67306 --
67307 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
67308
67309 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
67310 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
67311
67312 -- 4955764
67313 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
67314 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
67315
67316 -- 4458381 Public Sector Enh
67317
67318 --
67319 -- set accounting attributes for the line type
67320 --
67321 l_entered_amt_idx := 4;
67322 l_accted_amt_idx := 6;
67323 l_bflow_applied_to_amt_idx := NULL; -- 5132302
67324 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
67325 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
67326 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
67327 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
67328 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
67329 l_rec_acct_attrs.array_char_value(3) := p_source_51;
67330 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
67331 l_rec_acct_attrs.array_num_value(4) := p_source_52;
67332 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
67333 l_rec_acct_attrs.array_char_value(5) := p_source_53;
67337 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
67334 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
67335 l_rec_acct_attrs.array_num_value(6) := p_source_52;
67336
67338 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
67339
67340 ---------------------------------------------------------------------------------------------------------------
67341 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
67342 ---------------------------------------------------------------------------------------------------------------
67343 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
67344
67345 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
67346 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
67347
67348 IF xla_accounting_cache_pkg.GetValueChar
67349 (p_source_code => 'LEDGER_CATEGORY_CODE'
67350 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
67351 AND l_bflow_method_code = 'PRIOR_ENTRY'
67352 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
67353 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
67354 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
67355 )
67356 THEN
67357 xla_ae_lines_pkg.BflowUpgEntry
67358 (p_business_method_code => l_bflow_method_code
67359 ,p_business_class_code => l_bflow_class_code
67360 ,p_balance_type => l_balance_type_code);
67361 ELSE
67362 NULL;
67363 -- No business flow processing for business flow method of NONE.
67364 END IF;
67365
67366 --
67367 -- call analytical criteria
67368 --
67369
67370 --
67371 -- call description
67372 --
67373
67374 xla_ae_lines_pkg.SetLineDescription(
67375 p_ae_header_id => l_ae_header_id
67376 ,p_description => Description_48 (
67377 p_application_id => p_application_id
67378 , p_ae_header_id => l_ae_header_id
67379 , p_source_1 => p_source_1
67380 )
67381 );
67382
67383
67384 --
67385 -- call ADRs
67386 -- Bug 4922099
67387 --
67388 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
67389 (NVL(l_actual_upg_option, 'N') = 'O') OR
67390 (NVL(l_enc_upg_option, 'N') = 'O')
67391 )
67392 THEN
67393 NULL;
67394 --
67395 --
67396
67397 l_ccid := AcctDerRule_175(
67398 p_application_id => p_application_id
67399 , p_ae_header_id => l_ae_header_id
67400 , p_source_5 => p_source_5
67401 , p_source_19 => p_source_19
67402 , p_source_32 => p_source_32
67403 , x_transaction_coa_id => l_adr_transaction_coa_id
67404 , x_accounting_coa_id => l_adr_accounting_coa_id
67405 , x_value_type_code => l_adr_value_type_code
67406 , p_side => 'NA'
67407 );
67408
67409 xla_ae_lines_pkg.set_ccid(
67410 p_code_combination_id => l_ccid
67411 , p_value_type_code => l_adr_value_type_code
67412 , p_transaction_coa_id => l_adr_transaction_coa_id
67413 , p_accounting_coa_id => l_adr_accounting_coa_id
67414 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
67415 , p_adr_type_code => 'S'
67416 , p_component_type => l_component_type
67417 , p_component_code => l_component_code
67418 , p_component_type_code => l_component_type_code
67419 , p_component_appl_id => l_component_appl_id
67420 , p_amb_context_code => l_amb_context_code
67421 , p_side => 'NA'
67422 );
67423
67424
67425 l_segment := AcctDerRule_151(
67426 p_application_id => p_application_id
67427 , p_ae_header_id => l_ae_header_id
67428 , p_source_5 => p_source_5
67429 , p_source_13 => p_source_13
67430 , x_transaction_coa_id => l_adr_transaction_coa_id
67431 , x_accounting_coa_id => l_adr_accounting_coa_id
67432 , x_flexfield_segment_code => l_adr_flexfield_segment_code
67433 , x_flex_value_set_id => l_adr_flex_value_set_id
67434 , x_value_type_code => l_adr_value_type_code
67435 , x_value_combination_id => l_adr_value_combination_id
67436 , x_value_segment_code => l_adr_value_segment_code
67437 , p_side => 'NA'
67438 , p_override_seg_flag => 'Y'
67439 );
67440
67441 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
67442
67443 xla_ae_lines_pkg.set_segment(
67444 p_to_segment_code => 'GL_ACCOUNT'
67445 , p_segment_value => l_segment
67446 , p_from_segment_code => l_adr_value_segment_code
67447 , p_from_combination_id => l_adr_value_combination_id
67448 , p_value_type_code => l_adr_value_type_code
67449 , p_transaction_coa_id => l_adr_transaction_coa_id
67450 , p_accounting_coa_id => l_adr_accounting_coa_id
67454 , p_adr_type_code => 'S'
67451 , p_flexfield_segment_code => l_adr_flexfield_segment_code
67452 , p_flex_value_set_id => l_adr_flex_value_set_id
67453 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
67455 , p_component_type => l_component_type
67456 , p_component_code => l_component_code
67457 , p_component_type_code => l_component_type_code
67458 , p_component_appl_id => l_component_appl_id
67459 , p_amb_context_code => l_amb_context_code
67460 , p_entity_code => 'TRANSACTIONS'
67461 , p_event_class_code => 'CIP_TRANSFERS'
67462 , p_side => 'NA'
67463 );
67464
67465 END IF;
67466
67467 --
67468 --
67469 END IF;
67470 --
67471 -- Bug 4922099
67472 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
67473 (NVL(l_enc_upg_option, 'N') = 'O')
67474 ) AND
67475 (l_bflow_method_code = 'PRIOR_ENTRY')
67476 )
67477 THEN
67478 IF
67479 --
67480 1 = 2
67481 --
67482 THEN
67483 xla_accounting_err_pkg.build_message
67484 (p_appli_s_name => 'XLA'
67485 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
67486 ,p_token_1 => 'LINE_NUMBER'
67487 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
67488 ,p_token_2 => 'LINE_TYPE_NAME'
67489 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
67490 l_component_type
67491 ,l_component_code
67492 ,l_component_type_code
67493 ,l_component_appl_id
67494 ,l_amb_context_code
67495 ,l_entity_code
67496 ,l_event_class_code
67497 )
67498 ,p_token_3 => 'OWNER'
67499 ,p_value_3 => xla_lookups_pkg.get_meaning(
67500 p_lookup_type => 'XLA_OWNER_TYPE'
67501 ,p_lookup_code => l_component_type_code
67502 )
67503 ,p_token_4 => 'PRODUCT_NAME'
67504 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
67505 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
67506 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
67507 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
67508 ,p_ae_header_id => NULL
67509 );
67510
67511 IF (C_LEVEL_ERROR>= g_log_level) THEN
67512 trace
67513 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
67514 ,p_level => C_LEVEL_ERROR
67515 ,p_module => l_log_module);
67516 END IF;
67517 END IF;
67518 END IF;
67519 --
67520 --
67521 ------------------------------------------------------------------------------------------------
67522 -- 4219869 Business Flow
67523 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
67524 -- Prior Entry. Currently, the following code is always generated.
67525 ------------------------------------------------------------------------------------------------
67526 XLA_AE_LINES_PKG.ValidateCurrentLine;
67527
67528 ------------------------------------------------------------------------------------
67529 -- 4219869 Business Flow
67530 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
67531 ------------------------------------------------------------------------------------
67532 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
67533
67534 ----------------------------------------------------------------------------------
67535 -- 4219869 Business Flow
67536 -- Update journal entry status -- Need to generate this within IF <condition>
67537 ----------------------------------------------------------------------------------
67538 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
67539 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
67540 ,p_balance_type_code => l_balance_type_code
67541 );
67542
67543 -------------------------------------------------------------------------------------------
67544 -- 4262811 - Generate the Accrual Reversal lines
67548 (g_array_event(p_event_id).array_value_num('header_index'));
67545 -------------------------------------------------------------------------------------------
67546 BEGIN
67547 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
67549 IF l_acc_rev_flag IS NULL THEN
67550 l_acc_rev_flag := 'N';
67551 END IF;
67552 EXCEPTION
67553 WHEN OTHERS THEN
67554 l_acc_rev_flag := 'N';
67555 END;
67556 --
67557 IF (l_acc_rev_flag = 'Y') THEN
67558
67559 -- 4645092 ------------------------------------------------------------------------------
67560 -- To allow MPA report to determine if it should generate report process
67561 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
67562 ------------------------------------------------------------------------------------------
67563
67564 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
67565 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
67566 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
67567 -- call ADRs
67568 -- Bug 4922099
67569 --
67570 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
67571 (NVL(l_actual_upg_option, 'N') = 'O') OR
67572 (NVL(l_enc_upg_option, 'N') = 'O')
67573 )
67574 THEN
67575 NULL;
67576 --
67577 --
67578
67579 l_ccid := AcctDerRule_175(
67580 p_application_id => p_application_id
67581 , p_ae_header_id => l_ae_header_id
67582 , p_source_5 => p_source_5
67583 , p_source_19 => p_source_19
67584 , p_source_32 => p_source_32
67585 , x_transaction_coa_id => l_adr_transaction_coa_id
67586 , x_accounting_coa_id => l_adr_accounting_coa_id
67587 , x_value_type_code => l_adr_value_type_code
67588 , p_side => 'NA'
67589 );
67590
67591 xla_ae_lines_pkg.set_ccid(
67592 p_code_combination_id => l_ccid
67593 , p_value_type_code => l_adr_value_type_code
67594 , p_transaction_coa_id => l_adr_transaction_coa_id
67595 , p_accounting_coa_id => l_adr_accounting_coa_id
67596 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
67597 , p_adr_type_code => 'S'
67598 , p_component_type => l_component_type
67599 , p_component_code => l_component_code
67600 , p_component_type_code => l_component_type_code
67601 , p_component_appl_id => l_component_appl_id
67602 , p_amb_context_code => l_amb_context_code
67603 , p_side => 'NA'
67604 );
67605
67606
67607 l_segment := AcctDerRule_151(
67608 p_application_id => p_application_id
67609 , p_ae_header_id => l_ae_header_id
67610 , p_source_5 => p_source_5
67611 , p_source_13 => p_source_13
67612 , x_transaction_coa_id => l_adr_transaction_coa_id
67613 , x_accounting_coa_id => l_adr_accounting_coa_id
67614 , x_flexfield_segment_code => l_adr_flexfield_segment_code
67615 , x_flex_value_set_id => l_adr_flex_value_set_id
67616 , x_value_type_code => l_adr_value_type_code
67617 , x_value_combination_id => l_adr_value_combination_id
67618 , x_value_segment_code => l_adr_value_segment_code
67619 , p_side => 'NA'
67620 , p_override_seg_flag => 'Y'
67621 );
67622
67623 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
67624
67625 xla_ae_lines_pkg.set_segment(
67626 p_to_segment_code => 'GL_ACCOUNT'
67627 , p_segment_value => l_segment
67628 , p_from_segment_code => l_adr_value_segment_code
67629 , p_from_combination_id => l_adr_value_combination_id
67630 , p_value_type_code => l_adr_value_type_code
67631 , p_transaction_coa_id => l_adr_transaction_coa_id
67632 , p_accounting_coa_id => l_adr_accounting_coa_id
67633 , p_flexfield_segment_code => l_adr_flexfield_segment_code
67634 , p_flex_value_set_id => l_adr_flex_value_set_id
67635 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
67636 , p_adr_type_code => 'S'
67637 , p_component_type => l_component_type
67638 , p_component_code => l_component_code
67639 , p_component_type_code => l_component_type_code
67640 , p_component_appl_id => l_component_appl_id
67641 , p_amb_context_code => l_amb_context_code
67642 , p_entity_code => 'TRANSACTIONS'
67643 , p_event_class_code => 'CIP_TRANSFERS'
67644 , p_side => 'NA'
67645 );
67646
67647 END IF;
67648
67649 --
67650 --
67651 END IF;
67652
67653 --
67654 -- Update the line information that should be overwritten
67655 --
67656 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
67657 p_header_num => 1);
67658 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
67659
67660 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
67661
67662 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
67666 --
67663 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
67664 END IF;
67665
67667 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
67668 --
67669 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
67670 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
67671 ELSE
67672 ---------------------------------------------------------------------------------------------------
67673 -- 4262811a Switch Sign
67674 ---------------------------------------------------------------------------------------------------
67675 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
67676 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
67677 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
67678 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
67679 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
67680 -- 5132302
67681 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
67682 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
67683
67684 END IF;
67685
67686 -- 4955764
67687 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
67688 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
67689
67690
67691 XLA_AE_LINES_PKG.ValidateCurrentLine;
67692 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
67693
67694 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
67695 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
67696 ,p_balance_type_code => l_balance_type_code);
67697
67698 END IF;
67699
67700 -----------------------------------------------------------------------------------------
67701 -- 4262811 Multiperiod Accounting
67702 -----------------------------------------------------------------------------------------
67703 -- No MPA option is assigned.
67704
67705
67706 END IF;
67707 END IF;
67708 --
67709
67710 --
67711 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
67712 trace
67713 (p_msg => 'END of AcctLineType_258'
67714 ,p_level => C_LEVEL_PROCEDURE
67715 ,p_module => l_log_module);
67716 END IF;
67717 --
67718 EXCEPTION
67719 WHEN xla_exceptions_pkg.application_exception THEN
67720 RAISE;
67721 WHEN OTHERS THEN
67722 xla_exceptions_pkg.raise_message
67723 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_258');
67724 END AcctLineType_258;
67725 --
67726
67727 ---------------------------------------
67728 --
67729 -- PRIVATE FUNCTION
67730 -- AcctLineType_259
67731 --
67732 ---------------------------------------
67733 PROCEDURE AcctLineType_259 (
67734 p_application_id IN NUMBER
67735 ,p_event_id IN NUMBER
67736 ,p_calculate_acctd_flag IN VARCHAR2
67737 ,p_calculate_g_l_flag IN VARCHAR2
67738 ,p_actual_flag IN OUT VARCHAR2
67739 ,p_balance_type_code OUT VARCHAR2
67740 ,p_gain_or_loss_ref OUT VARCHAR2
67741
67742 --Period Close Date
67743 , p_source_1 IN DATE
67744 --Generated Code Combination Identifier
67745 , p_source_5 IN NUMBER
67746 --CIP Cost Account
67747 , p_source_9 IN VARCHAR2
67748 --Expense Account Code Combination Identifier
67749 , p_source_31 IN NUMBER
67750 --Default Code Combination Identifier
67751 , p_source_32 IN NUMBER
67752 --Adjustment Type
67753 , p_source_48 IN VARCHAR2
67754 --Transaction Header Identifier
67755 , p_source_49 IN NUMBER
67756 --Adjustment Line Identifier
67757 , p_source_50 IN NUMBER
67758 --Distribution Type Code
67759 , p_source_51 IN VARCHAR2
67760 --Entered Amount
67761 , p_source_52 IN NUMBER
67762 --Currency Code
67763 , p_source_53 IN VARCHAR2
67764 --Source Destination Code
67765 , p_source_55 IN VARCHAR2
67766 )
67767 IS
67768
67769 l_component_type VARCHAR2(80);
67770 l_component_code VARCHAR2(30);
67771 l_component_type_code VARCHAR2(1);
67772 l_component_appl_id INTEGER;
67773 l_amb_context_code VARCHAR2(30);
67774 l_entity_code VARCHAR2(30);
67775 l_event_class_code VARCHAR2(30);
67776 l_ae_header_id NUMBER;
67777 l_event_type_code VARCHAR2(30);
67778 l_line_definition_code VARCHAR2(30);
67779 l_line_definition_owner_code VARCHAR2(1);
67780 --
67781 -- adr variables
67782 l_segment VARCHAR2(30);
67783 l_ccid NUMBER;
67784 l_adr_transaction_coa_id NUMBER;
67785 l_adr_accounting_coa_id NUMBER;
67786 l_adr_flexfield_segment_code VARCHAR2(30);
67787 l_adr_flex_value_set_id NUMBER;
67788 l_adr_value_type_code VARCHAR2(30);
67792 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
67789 l_adr_value_combination_id NUMBER;
67790 l_adr_value_segment_code VARCHAR2(30);
67791
67793 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
67794 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
67795 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
67796
67797 -- 4262811 Variables ------------------------------------------------------------------------------------------
67798 l_entered_amt_idx NUMBER;
67799 l_accted_amt_idx NUMBER;
67800 l_acc_rev_flag VARCHAR2(1);
67801 l_accrual_line_num NUMBER;
67802 l_tmp_amt NUMBER;
67803 l_acc_rev_natural_side_code VARCHAR2(1);
67804
67805 l_num_entries NUMBER;
67806 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
67807 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
67808 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
67809 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
67810 l_recog_line_1 NUMBER;
67811 l_recog_line_2 NUMBER;
67812
67813 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
67814 l_bflow_applied_to_amt NUMBER; -- 5132302
67815 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
67816
67817 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
67818
67819 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
67820 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
67821
67822 ---------------------------------------------------------------------------------------------------------------
67823
67824
67825 --
67826 -- bulk performance
67827 --
67828 l_balance_type_code VARCHAR2(1);
67829 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
67830 l_log_module VARCHAR2(240);
67831
67832 --
67833 -- Upgrade strategy
67834 --
67835 l_actual_upg_option VARCHAR2(1);
67836 l_enc_upg_option VARCHAR2(1);
67837
67838 --
67839 BEGIN
67840 --
67841 IF g_log_enabled THEN
67842 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_259';
67843 END IF;
67844 --
67845 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
67846
67847 trace
67848 (p_msg => 'BEGIN of AcctLineType_259'
67849 ,p_level => C_LEVEL_PROCEDURE
67850 ,p_module => l_log_module);
67851
67852 END IF;
67853 --
67854 l_component_type := 'AMB_JLT';
67855 l_component_code := 'FA_CIP_UNITADJ_DEST_COST';
67856 l_component_type_code := 'S';
67857 l_component_appl_id := 140;
67858 l_amb_context_code := 'DEFAULT';
67859 l_entity_code := 'TRANSACTIONS';
67860 l_event_class_code := 'CIP_UNIT_ADJUSTMENTS';
67861 l_event_type_code := 'CIP_UNIT_ADJUSTMENTS_ALL';
67862 l_line_definition_owner_code := 'S';
67863 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_U13';
67864 --
67865 l_balance_type_code := 'A';
67866 l_segment := NULL;
67867 l_ccid := NULL;
67868 l_adr_transaction_coa_id := NULL;
67869 l_adr_accounting_coa_id := NULL;
67870 l_adr_flexfield_segment_code := NULL;
67871 l_adr_flex_value_set_id := NULL;
67872 l_adr_value_type_code := NULL;
67873 l_adr_value_combination_id := NULL;
67874 l_adr_value_segment_code := NULL;
67875
67876 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
67877 l_bflow_class_code := ''; -- 4219869 Business Flow
67878 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
67879 l_budgetary_control_flag := 'N';
67880
67881 l_bflow_applied_to_amt_idx := NULL; -- 5132302
67882 l_bflow_applied_to_amt := NULL; -- 5132302
67883 l_entered_amt_idx := NULL; -- 4262811
67884 l_accted_amt_idx := NULL; -- 4262811
67885 l_acc_rev_flag := NULL; -- 4262811
67886 l_accrual_line_num := NULL; -- 4262811
67887 l_tmp_amt := NULL; -- 4262811
67888 --
67889
67890 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
67891 l_balance_type_code <> 'B' THEN
67892 IF NVL(p_source_48,'
67893 ') = 'CIP COST' AND
67894 NVL(p_source_55,'
67895 ') = 'DEST'
67896 THEN
67897
67898 --
67899 XLA_AE_LINES_PKG.SetNewLine;
67900
67901 p_balance_type_code := l_balance_type_code;
67902 -- set the flag so later we will know whether the gain loss line needs to be created
67903
67904 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
67905 p_actual_flag :='A';
67906 END IF;
67907
67908 --
67909 -- bulk performance
67910 --
67911 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
67912 p_header_num => 0); -- 4262811
67913 --
67914 -- set accounting line options
67915 --
67916 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
67920 , p_acct_entry_type_code => 'A'
67917 p_natural_side_code => 'D'
67918 , p_gain_or_loss_flag => 'N'
67919 , p_gl_transfer_mode_code => 'S'
67921 , p_switch_side_flag => 'Y'
67922 , p_merge_duplicate_code => 'N'
67923 );
67924 --
67925 l_acc_rev_natural_side_code := 'C'; -- 4262811
67926 --
67927 --
67928 -- set accounting line type info
67929 --
67930 xla_ae_lines_pkg.SetAcctLineType
67931 (p_component_type => l_component_type
67932 ,p_event_type_code => l_event_type_code
67933 ,p_line_definition_owner_code => l_line_definition_owner_code
67934 ,p_line_definition_code => l_line_definition_code
67935 ,p_accounting_line_code => l_component_code
67936 ,p_accounting_line_type_code => l_component_type_code
67937 ,p_accounting_line_appl_id => l_component_appl_id
67938 ,p_amb_context_code => l_amb_context_code
67939 ,p_entity_code => l_entity_code
67940 ,p_event_class_code => l_event_class_code);
67941 --
67942 -- set accounting class
67943 --
67944 xla_ae_lines_pkg.SetAcctClass(
67945 p_accounting_class_code => 'ASSET'
67946 , p_ae_header_id => l_ae_header_id
67947 );
67948
67949 --
67950 -- set rounding class
67951 --
67952 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
67953 'ASSET';
67954
67955 --
67956 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
67957 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
67958 --
67959 -- bulk performance
67960 --
67961 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
67962
67963 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
67964 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
67965
67966 -- 4955764
67967 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
67968 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
67969
67970 -- 4458381 Public Sector Enh
67971
67972 --
67973 -- set accounting attributes for the line type
67974 --
67975 l_entered_amt_idx := 4;
67976 l_accted_amt_idx := 6;
67977 l_bflow_applied_to_amt_idx := NULL; -- 5132302
67978 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
67979 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
67980 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
67981 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
67982 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
67983 l_rec_acct_attrs.array_char_value(3) := p_source_51;
67984 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
67985 l_rec_acct_attrs.array_num_value(4) := p_source_52;
67986 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
67987 l_rec_acct_attrs.array_char_value(5) := p_source_53;
67988 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
67989 l_rec_acct_attrs.array_num_value(6) := p_source_52;
67990
67991 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
67992 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
67993
67994 ---------------------------------------------------------------------------------------------------------------
67995 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
67996 ---------------------------------------------------------------------------------------------------------------
67997 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
67998
67999 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
68000 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
68001
68002 IF xla_accounting_cache_pkg.GetValueChar
68003 (p_source_code => 'LEDGER_CATEGORY_CODE'
68004 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
68005 AND l_bflow_method_code = 'PRIOR_ENTRY'
68006 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
68007 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
68008 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
68009 )
68010 THEN
68011 xla_ae_lines_pkg.BflowUpgEntry
68012 (p_business_method_code => l_bflow_method_code
68013 ,p_business_class_code => l_bflow_class_code
68014 ,p_balance_type => l_balance_type_code);
68015 ELSE
68016 NULL;
68017 -- No business flow processing for business flow method of NONE.
68018 END IF;
68019
68020 --
68021 -- call analytical criteria
68022 --
68023
68024 --
68025 -- call description
68026 --
68027
68028 xla_ae_lines_pkg.SetLineDescription(
68029 p_ae_header_id => l_ae_header_id
68033 , p_source_1 => p_source_1
68030 ,p_description => Description_49 (
68031 p_application_id => p_application_id
68032 , p_ae_header_id => l_ae_header_id
68034 )
68035 );
68036
68037
68038 --
68039 -- call ADRs
68040 -- Bug 4922099
68041 --
68042 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
68043 (NVL(l_actual_upg_option, 'N') = 'O') OR
68044 (NVL(l_enc_upg_option, 'N') = 'O')
68045 )
68046 THEN
68047 NULL;
68048 --
68049 --
68050
68051 l_ccid := AcctDerRule_174(
68052 p_application_id => p_application_id
68053 , p_ae_header_id => l_ae_header_id
68054 , p_source_5 => p_source_5
68055 , p_source_32 => p_source_32
68056 , x_transaction_coa_id => l_adr_transaction_coa_id
68057 , x_accounting_coa_id => l_adr_accounting_coa_id
68058 , x_value_type_code => l_adr_value_type_code
68059 , p_side => 'NA'
68060 );
68061
68062 xla_ae_lines_pkg.set_ccid(
68063 p_code_combination_id => l_ccid
68064 , p_value_type_code => l_adr_value_type_code
68065 , p_transaction_coa_id => l_adr_transaction_coa_id
68066 , p_accounting_coa_id => l_adr_accounting_coa_id
68067 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
68068 , p_adr_type_code => 'S'
68069 , p_component_type => l_component_type
68070 , p_component_code => l_component_code
68071 , p_component_type_code => l_component_type_code
68072 , p_component_appl_id => l_component_appl_id
68073 , p_amb_context_code => l_amb_context_code
68074 , p_side => 'NA'
68075 );
68076
68077
68078 l_segment := AcctDerRule_147(
68079 p_application_id => p_application_id
68080 , p_ae_header_id => l_ae_header_id
68081 , p_source_5 => p_source_5
68082 , p_source_9 => p_source_9
68083 , x_transaction_coa_id => l_adr_transaction_coa_id
68084 , x_accounting_coa_id => l_adr_accounting_coa_id
68085 , x_flexfield_segment_code => l_adr_flexfield_segment_code
68086 , x_flex_value_set_id => l_adr_flex_value_set_id
68087 , x_value_type_code => l_adr_value_type_code
68088 , x_value_combination_id => l_adr_value_combination_id
68089 , x_value_segment_code => l_adr_value_segment_code
68090 , p_side => 'NA'
68091 , p_override_seg_flag => 'Y'
68092 );
68093
68094 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
68095
68096 xla_ae_lines_pkg.set_segment(
68097 p_to_segment_code => 'GL_ACCOUNT'
68098 , p_segment_value => l_segment
68099 , p_from_segment_code => l_adr_value_segment_code
68100 , p_from_combination_id => l_adr_value_combination_id
68101 , p_value_type_code => l_adr_value_type_code
68102 , p_transaction_coa_id => l_adr_transaction_coa_id
68103 , p_accounting_coa_id => l_adr_accounting_coa_id
68104 , p_flexfield_segment_code => l_adr_flexfield_segment_code
68105 , p_flex_value_set_id => l_adr_flex_value_set_id
68106 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
68107 , p_adr_type_code => 'S'
68108 , p_component_type => l_component_type
68109 , p_component_code => l_component_code
68110 , p_component_type_code => l_component_type_code
68111 , p_component_appl_id => l_component_appl_id
68112 , p_amb_context_code => l_amb_context_code
68113 , p_entity_code => 'TRANSACTIONS'
68114 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
68115 , p_side => 'NA'
68116 );
68117
68118 END IF;
68119
68120 l_segment := AcctDerRule_169(
68121 p_application_id => p_application_id
68122 , p_ae_header_id => l_ae_header_id
68123 , p_source_5 => p_source_5
68124 , p_source_31 => p_source_31
68125 , x_transaction_coa_id => l_adr_transaction_coa_id
68126 , x_accounting_coa_id => l_adr_accounting_coa_id
68127 , x_flexfield_segment_code => l_adr_flexfield_segment_code
68128 , x_flex_value_set_id => l_adr_flex_value_set_id
68129 , x_value_type_code => l_adr_value_type_code
68130 , x_value_combination_id => l_adr_value_combination_id
68131 , x_value_segment_code => l_adr_value_segment_code
68132 , p_side => 'NA'
68133 , p_override_seg_flag => 'Y'
68134 );
68135
68136 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
68137
68138 xla_ae_lines_pkg.set_segment(
68139 p_to_segment_code => 'GL_BALANCING'
68140 , p_segment_value => l_segment
68141 , p_from_segment_code => l_adr_value_segment_code
68142 , p_from_combination_id => l_adr_value_combination_id
68143 , p_value_type_code => l_adr_value_type_code
68144 , p_transaction_coa_id => l_adr_transaction_coa_id
68145 , p_accounting_coa_id => l_adr_accounting_coa_id
68146 , p_flexfield_segment_code => l_adr_flexfield_segment_code
68147 , p_flex_value_set_id => l_adr_flex_value_set_id
68151 , p_component_code => l_component_code
68148 , p_adr_code => 'FA_EXPENSE_ACCT'
68149 , p_adr_type_code => 'S'
68150 , p_component_type => l_component_type
68152 , p_component_type_code => l_component_type_code
68153 , p_component_appl_id => l_component_appl_id
68154 , p_amb_context_code => l_amb_context_code
68155 , p_entity_code => 'TRANSACTIONS'
68156 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
68157 , p_side => 'NA'
68158 );
68159
68160 END IF;
68161
68162 --
68163 --
68164 END IF;
68165 --
68166 -- Bug 4922099
68167 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
68168 (NVL(l_enc_upg_option, 'N') = 'O')
68169 ) AND
68170 (l_bflow_method_code = 'PRIOR_ENTRY')
68171 )
68172 THEN
68173 IF
68174 --
68175 1 = 2
68176 --
68177 THEN
68178 xla_accounting_err_pkg.build_message
68179 (p_appli_s_name => 'XLA'
68180 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
68181 ,p_token_1 => 'LINE_NUMBER'
68182 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
68183 ,p_token_2 => 'LINE_TYPE_NAME'
68184 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
68185 l_component_type
68186 ,l_component_code
68187 ,l_component_type_code
68188 ,l_component_appl_id
68189 ,l_amb_context_code
68190 ,l_entity_code
68191 ,l_event_class_code
68192 )
68193 ,p_token_3 => 'OWNER'
68194 ,p_value_3 => xla_lookups_pkg.get_meaning(
68195 p_lookup_type => 'XLA_OWNER_TYPE'
68196 ,p_lookup_code => l_component_type_code
68197 )
68198 ,p_token_4 => 'PRODUCT_NAME'
68199 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
68200 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
68201 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
68202 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
68203 ,p_ae_header_id => NULL
68204 );
68205
68206 IF (C_LEVEL_ERROR>= g_log_level) THEN
68207 trace
68208 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
68209 ,p_level => C_LEVEL_ERROR
68210 ,p_module => l_log_module);
68211 END IF;
68212 END IF;
68213 END IF;
68214 --
68215 --
68216 ------------------------------------------------------------------------------------------------
68217 -- 4219869 Business Flow
68218 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
68219 -- Prior Entry. Currently, the following code is always generated.
68220 ------------------------------------------------------------------------------------------------
68221 XLA_AE_LINES_PKG.ValidateCurrentLine;
68222
68223 ------------------------------------------------------------------------------------
68224 -- 4219869 Business Flow
68225 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
68226 ------------------------------------------------------------------------------------
68227 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
68228
68229 ----------------------------------------------------------------------------------
68230 -- 4219869 Business Flow
68231 -- Update journal entry status -- Need to generate this within IF <condition>
68232 ----------------------------------------------------------------------------------
68233 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
68234 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
68235 ,p_balance_type_code => l_balance_type_code
68236 );
68237
68238 -------------------------------------------------------------------------------------------
68239 -- 4262811 - Generate the Accrual Reversal lines
68240 -------------------------------------------------------------------------------------------
68241 BEGIN
68242 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
68246 END IF;
68243 (g_array_event(p_event_id).array_value_num('header_index'));
68244 IF l_acc_rev_flag IS NULL THEN
68245 l_acc_rev_flag := 'N';
68247 EXCEPTION
68248 WHEN OTHERS THEN
68249 l_acc_rev_flag := 'N';
68250 END;
68251 --
68252 IF (l_acc_rev_flag = 'Y') THEN
68253
68254 -- 4645092 ------------------------------------------------------------------------------
68255 -- To allow MPA report to determine if it should generate report process
68256 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
68257 ------------------------------------------------------------------------------------------
68258
68259 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
68260 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
68261 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
68262 -- call ADRs
68263 -- Bug 4922099
68264 --
68265 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
68266 (NVL(l_actual_upg_option, 'N') = 'O') OR
68267 (NVL(l_enc_upg_option, 'N') = 'O')
68268 )
68269 THEN
68270 NULL;
68271 --
68272 --
68273
68274 l_ccid := AcctDerRule_174(
68275 p_application_id => p_application_id
68276 , p_ae_header_id => l_ae_header_id
68277 , p_source_5 => p_source_5
68278 , p_source_32 => p_source_32
68279 , x_transaction_coa_id => l_adr_transaction_coa_id
68280 , x_accounting_coa_id => l_adr_accounting_coa_id
68281 , x_value_type_code => l_adr_value_type_code
68282 , p_side => 'NA'
68283 );
68284
68285 xla_ae_lines_pkg.set_ccid(
68286 p_code_combination_id => l_ccid
68287 , p_value_type_code => l_adr_value_type_code
68288 , p_transaction_coa_id => l_adr_transaction_coa_id
68289 , p_accounting_coa_id => l_adr_accounting_coa_id
68290 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
68291 , p_adr_type_code => 'S'
68292 , p_component_type => l_component_type
68293 , p_component_code => l_component_code
68294 , p_component_type_code => l_component_type_code
68295 , p_component_appl_id => l_component_appl_id
68296 , p_amb_context_code => l_amb_context_code
68297 , p_side => 'NA'
68298 );
68299
68300
68301 l_segment := AcctDerRule_147(
68302 p_application_id => p_application_id
68303 , p_ae_header_id => l_ae_header_id
68304 , p_source_5 => p_source_5
68305 , p_source_9 => p_source_9
68306 , x_transaction_coa_id => l_adr_transaction_coa_id
68307 , x_accounting_coa_id => l_adr_accounting_coa_id
68308 , x_flexfield_segment_code => l_adr_flexfield_segment_code
68309 , x_flex_value_set_id => l_adr_flex_value_set_id
68310 , x_value_type_code => l_adr_value_type_code
68311 , x_value_combination_id => l_adr_value_combination_id
68312 , x_value_segment_code => l_adr_value_segment_code
68313 , p_side => 'NA'
68314 , p_override_seg_flag => 'Y'
68315 );
68316
68317 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
68318
68319 xla_ae_lines_pkg.set_segment(
68320 p_to_segment_code => 'GL_ACCOUNT'
68321 , p_segment_value => l_segment
68322 , p_from_segment_code => l_adr_value_segment_code
68323 , p_from_combination_id => l_adr_value_combination_id
68324 , p_value_type_code => l_adr_value_type_code
68325 , p_transaction_coa_id => l_adr_transaction_coa_id
68326 , p_accounting_coa_id => l_adr_accounting_coa_id
68327 , p_flexfield_segment_code => l_adr_flexfield_segment_code
68328 , p_flex_value_set_id => l_adr_flex_value_set_id
68329 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
68330 , p_adr_type_code => 'S'
68331 , p_component_type => l_component_type
68332 , p_component_code => l_component_code
68333 , p_component_type_code => l_component_type_code
68334 , p_component_appl_id => l_component_appl_id
68335 , p_amb_context_code => l_amb_context_code
68336 , p_entity_code => 'TRANSACTIONS'
68337 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
68338 , p_side => 'NA'
68339 );
68340
68341 END IF;
68342
68343 l_segment := AcctDerRule_169(
68344 p_application_id => p_application_id
68345 , p_ae_header_id => l_ae_header_id
68346 , p_source_5 => p_source_5
68347 , p_source_31 => p_source_31
68348 , x_transaction_coa_id => l_adr_transaction_coa_id
68349 , x_accounting_coa_id => l_adr_accounting_coa_id
68350 , x_flexfield_segment_code => l_adr_flexfield_segment_code
68351 , x_flex_value_set_id => l_adr_flex_value_set_id
68352 , x_value_type_code => l_adr_value_type_code
68353 , x_value_combination_id => l_adr_value_combination_id
68354 , x_value_segment_code => l_adr_value_segment_code
68355 , p_side => 'NA'
68359 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
68356 , p_override_seg_flag => 'Y'
68357 );
68358
68360
68361 xla_ae_lines_pkg.set_segment(
68362 p_to_segment_code => 'GL_BALANCING'
68363 , p_segment_value => l_segment
68364 , p_from_segment_code => l_adr_value_segment_code
68365 , p_from_combination_id => l_adr_value_combination_id
68366 , p_value_type_code => l_adr_value_type_code
68367 , p_transaction_coa_id => l_adr_transaction_coa_id
68368 , p_accounting_coa_id => l_adr_accounting_coa_id
68369 , p_flexfield_segment_code => l_adr_flexfield_segment_code
68370 , p_flex_value_set_id => l_adr_flex_value_set_id
68371 , p_adr_code => 'FA_EXPENSE_ACCT'
68372 , p_adr_type_code => 'S'
68373 , p_component_type => l_component_type
68374 , p_component_code => l_component_code
68375 , p_component_type_code => l_component_type_code
68376 , p_component_appl_id => l_component_appl_id
68377 , p_amb_context_code => l_amb_context_code
68378 , p_entity_code => 'TRANSACTIONS'
68379 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
68380 , p_side => 'NA'
68381 );
68382
68383 END IF;
68384
68385 --
68386 --
68387 END IF;
68388
68389 --
68390 -- Update the line information that should be overwritten
68391 --
68392 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
68393 p_header_num => 1);
68394 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
68395
68396 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
68397
68398 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
68399 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
68400 END IF;
68401
68402 --
68403 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
68404 --
68405 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
68406 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
68407 ELSE
68408 ---------------------------------------------------------------------------------------------------
68409 -- 4262811a Switch Sign
68410 ---------------------------------------------------------------------------------------------------
68411 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
68412 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
68413 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
68414 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
68415 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
68416 -- 5132302
68417 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
68418 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
68419
68420 END IF;
68421
68422 -- 4955764
68423 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
68424 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
68425
68426
68427 XLA_AE_LINES_PKG.ValidateCurrentLine;
68428 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
68429
68430 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
68431 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
68432 ,p_balance_type_code => l_balance_type_code);
68433
68434 END IF;
68435
68436 -----------------------------------------------------------------------------------------
68437 -- 4262811 Multiperiod Accounting
68438 -----------------------------------------------------------------------------------------
68439 -- No MPA option is assigned.
68440
68441
68442 END IF;
68443 END IF;
68444 --
68445
68446 --
68447 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
68448 trace
68449 (p_msg => 'END of AcctLineType_259'
68450 ,p_level => C_LEVEL_PROCEDURE
68451 ,p_module => l_log_module);
68452 END IF;
68453 --
68454 EXCEPTION
68455 WHEN xla_exceptions_pkg.application_exception THEN
68456 RAISE;
68457 WHEN OTHERS THEN
68458 xla_exceptions_pkg.raise_message
68459 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_259');
68460 END AcctLineType_259;
68461 --
68462
68463 ---------------------------------------
68464 --
68465 -- PRIVATE FUNCTION
68466 -- AcctLineType_260
68467 --
68468 ---------------------------------------
68469 PROCEDURE AcctLineType_260 (
68470 p_application_id IN NUMBER
68471 ,p_event_id IN NUMBER
68472 ,p_calculate_acctd_flag IN VARCHAR2
68476 ,p_gain_or_loss_ref OUT VARCHAR2
68473 ,p_calculate_g_l_flag IN VARCHAR2
68474 ,p_actual_flag IN OUT VARCHAR2
68475 ,p_balance_type_code OUT VARCHAR2
68477
68478 --Period Close Date
68479 , p_source_1 IN DATE
68480 --Generated Code Combination Identifier
68481 , p_source_5 IN NUMBER
68482 --Revaluation Reserve Account
68483 , p_source_13 IN VARCHAR2
68484 --Generated Offset Code Combination Identifier
68485 , p_source_19 IN NUMBER
68486 --Expense Account Code Combination Identifier
68487 , p_source_31 IN NUMBER
68488 --Default Code Combination Identifier
68489 , p_source_32 IN NUMBER
68490 --Adjustment Type
68491 , p_source_48 IN VARCHAR2
68492 --Transaction Header Identifier
68493 , p_source_49 IN NUMBER
68494 --Adjustment Line Identifier
68495 , p_source_50 IN NUMBER
68496 --Distribution Type Code
68497 , p_source_51 IN VARCHAR2
68498 --Entered Amount
68499 , p_source_52 IN NUMBER
68500 --Currency Code
68501 , p_source_53 IN VARCHAR2
68502 --Source Destination Code
68503 , p_source_55 IN VARCHAR2
68504 )
68505 IS
68506
68507 l_component_type VARCHAR2(80);
68508 l_component_code VARCHAR2(30);
68509 l_component_type_code VARCHAR2(1);
68510 l_component_appl_id INTEGER;
68511 l_amb_context_code VARCHAR2(30);
68512 l_entity_code VARCHAR2(30);
68513 l_event_class_code VARCHAR2(30);
68514 l_ae_header_id NUMBER;
68515 l_event_type_code VARCHAR2(30);
68516 l_line_definition_code VARCHAR2(30);
68517 l_line_definition_owner_code VARCHAR2(1);
68518 --
68519 -- adr variables
68520 l_segment VARCHAR2(30);
68521 l_ccid NUMBER;
68522 l_adr_transaction_coa_id NUMBER;
68523 l_adr_accounting_coa_id NUMBER;
68524 l_adr_flexfield_segment_code VARCHAR2(30);
68525 l_adr_flex_value_set_id NUMBER;
68526 l_adr_value_type_code VARCHAR2(30);
68527 l_adr_value_combination_id NUMBER;
68528 l_adr_value_segment_code VARCHAR2(30);
68529
68530 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
68531 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
68532 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
68533 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
68534
68535 -- 4262811 Variables ------------------------------------------------------------------------------------------
68536 l_entered_amt_idx NUMBER;
68537 l_accted_amt_idx NUMBER;
68538 l_acc_rev_flag VARCHAR2(1);
68539 l_accrual_line_num NUMBER;
68540 l_tmp_amt NUMBER;
68541 l_acc_rev_natural_side_code VARCHAR2(1);
68542
68543 l_num_entries NUMBER;
68544 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
68545 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
68546 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
68547 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
68548 l_recog_line_1 NUMBER;
68549 l_recog_line_2 NUMBER;
68550
68551 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
68552 l_bflow_applied_to_amt NUMBER; -- 5132302
68553 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
68554
68555 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
68556
68557 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
68558 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
68559
68560 ---------------------------------------------------------------------------------------------------------------
68561
68562
68563 --
68564 -- bulk performance
68565 --
68566 l_balance_type_code VARCHAR2(1);
68567 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
68568 l_log_module VARCHAR2(240);
68569
68570 --
68571 -- Upgrade strategy
68572 --
68573 l_actual_upg_option VARCHAR2(1);
68574 l_enc_upg_option VARCHAR2(1);
68575
68576 --
68577 BEGIN
68578 --
68579 IF g_log_enabled THEN
68580 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_260';
68581 END IF;
68582 --
68583 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
68584
68585 trace
68586 (p_msg => 'BEGIN of AcctLineType_260'
68587 ,p_level => C_LEVEL_PROCEDURE
68588 ,p_module => l_log_module);
68589
68590 END IF;
68591 --
68592 l_component_type := 'AMB_JLT';
68593 l_component_code := 'FA_CIP_UNITADJ_DEST_REVAL_RES';
68594 l_component_type_code := 'S';
68595 l_component_appl_id := 140;
68596 l_amb_context_code := 'DEFAULT';
68597 l_entity_code := 'TRANSACTIONS';
68598 l_event_class_code := 'CIP_UNIT_ADJUSTMENTS';
68599 l_event_type_code := 'CIP_UNIT_ADJUSTMENTS_ALL';
68600 l_line_definition_owner_code := 'S';
68601 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_U13';
68602 --
68603 l_balance_type_code := 'A';
68604 l_segment := NULL;
68608 l_adr_flexfield_segment_code := NULL;
68605 l_ccid := NULL;
68606 l_adr_transaction_coa_id := NULL;
68607 l_adr_accounting_coa_id := NULL;
68609 l_adr_flex_value_set_id := NULL;
68610 l_adr_value_type_code := NULL;
68611 l_adr_value_combination_id := NULL;
68612 l_adr_value_segment_code := NULL;
68613
68614 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
68615 l_bflow_class_code := ''; -- 4219869 Business Flow
68616 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
68617 l_budgetary_control_flag := 'N';
68618
68619 l_bflow_applied_to_amt_idx := NULL; -- 5132302
68620 l_bflow_applied_to_amt := NULL; -- 5132302
68621 l_entered_amt_idx := NULL; -- 4262811
68622 l_accted_amt_idx := NULL; -- 4262811
68623 l_acc_rev_flag := NULL; -- 4262811
68624 l_accrual_line_num := NULL; -- 4262811
68625 l_tmp_amt := NULL; -- 4262811
68626 --
68627
68628 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
68629 l_balance_type_code <> 'B' THEN
68630 IF NVL(p_source_48,'
68631 ') = 'REVAL RESERVE' AND
68632 NVL(p_source_55,'
68633 ') = 'DEST'
68634 THEN
68635
68636 --
68637 XLA_AE_LINES_PKG.SetNewLine;
68638
68639 p_balance_type_code := l_balance_type_code;
68640 -- set the flag so later we will know whether the gain loss line needs to be created
68641
68642 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
68643 p_actual_flag :='A';
68644 END IF;
68645
68646 --
68647 -- bulk performance
68648 --
68649 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
68650 p_header_num => 0); -- 4262811
68651 --
68652 -- set accounting line options
68653 --
68654 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
68655 p_natural_side_code => 'C'
68656 , p_gain_or_loss_flag => 'N'
68657 , p_gl_transfer_mode_code => 'S'
68658 , p_acct_entry_type_code => 'A'
68659 , p_switch_side_flag => 'Y'
68660 , p_merge_duplicate_code => 'N'
68661 );
68662 --
68663 l_acc_rev_natural_side_code := 'D'; -- 4262811
68664 --
68665 --
68666 -- set accounting line type info
68667 --
68668 xla_ae_lines_pkg.SetAcctLineType
68669 (p_component_type => l_component_type
68670 ,p_event_type_code => l_event_type_code
68671 ,p_line_definition_owner_code => l_line_definition_owner_code
68672 ,p_line_definition_code => l_line_definition_code
68673 ,p_accounting_line_code => l_component_code
68674 ,p_accounting_line_type_code => l_component_type_code
68675 ,p_accounting_line_appl_id => l_component_appl_id
68676 ,p_amb_context_code => l_amb_context_code
68677 ,p_entity_code => l_entity_code
68678 ,p_event_class_code => l_event_class_code);
68679 --
68680 -- set accounting class
68681 --
68682 xla_ae_lines_pkg.SetAcctClass(
68683 p_accounting_class_code => 'ASSET'
68684 , p_ae_header_id => l_ae_header_id
68685 );
68686
68687 --
68688 -- set rounding class
68689 --
68690 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
68691 'ASSET';
68692
68693 --
68694 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
68695 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
68696 --
68697 -- bulk performance
68698 --
68699 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
68700
68701 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
68702 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
68703
68704 -- 4955764
68705 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
68706 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
68707
68708 -- 4458381 Public Sector Enh
68709
68710 --
68711 -- set accounting attributes for the line type
68712 --
68713 l_entered_amt_idx := 4;
68714 l_accted_amt_idx := 6;
68715 l_bflow_applied_to_amt_idx := NULL; -- 5132302
68716 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
68717 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
68718 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
68719 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
68720 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
68721 l_rec_acct_attrs.array_char_value(3) := p_source_51;
68722 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
68723 l_rec_acct_attrs.array_num_value(4) := p_source_52;
68724 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
68725 l_rec_acct_attrs.array_char_value(5) := p_source_53;
68726 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
68730 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
68727 l_rec_acct_attrs.array_num_value(6) := p_source_52;
68728
68729 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
68731
68732 ---------------------------------------------------------------------------------------------------------------
68733 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
68734 ---------------------------------------------------------------------------------------------------------------
68735 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
68736
68737 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
68738 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
68739
68740 IF xla_accounting_cache_pkg.GetValueChar
68741 (p_source_code => 'LEDGER_CATEGORY_CODE'
68742 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
68743 AND l_bflow_method_code = 'PRIOR_ENTRY'
68744 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
68745 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
68746 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
68747 )
68748 THEN
68749 xla_ae_lines_pkg.BflowUpgEntry
68750 (p_business_method_code => l_bflow_method_code
68751 ,p_business_class_code => l_bflow_class_code
68752 ,p_balance_type => l_balance_type_code);
68753 ELSE
68754 NULL;
68755 -- No business flow processing for business flow method of NONE.
68756 END IF;
68757
68758 --
68759 -- call analytical criteria
68760 --
68761
68762 --
68763 -- call description
68764 --
68765
68766 xla_ae_lines_pkg.SetLineDescription(
68767 p_ae_header_id => l_ae_header_id
68768 ,p_description => Description_52 (
68769 p_application_id => p_application_id
68770 , p_ae_header_id => l_ae_header_id
68771 , p_source_1 => p_source_1
68772 )
68773 );
68774
68775
68776 --
68777 -- call ADRs
68778 -- Bug 4922099
68779 --
68780 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
68781 (NVL(l_actual_upg_option, 'N') = 'O') OR
68782 (NVL(l_enc_upg_option, 'N') = 'O')
68783 )
68784 THEN
68785 NULL;
68786 --
68787 --
68788
68789 l_ccid := AcctDerRule_175(
68790 p_application_id => p_application_id
68791 , p_ae_header_id => l_ae_header_id
68792 , p_source_5 => p_source_5
68793 , p_source_19 => p_source_19
68794 , p_source_32 => p_source_32
68795 , x_transaction_coa_id => l_adr_transaction_coa_id
68796 , x_accounting_coa_id => l_adr_accounting_coa_id
68797 , x_value_type_code => l_adr_value_type_code
68798 , p_side => 'NA'
68799 );
68800
68801 xla_ae_lines_pkg.set_ccid(
68802 p_code_combination_id => l_ccid
68803 , p_value_type_code => l_adr_value_type_code
68804 , p_transaction_coa_id => l_adr_transaction_coa_id
68805 , p_accounting_coa_id => l_adr_accounting_coa_id
68806 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
68807 , p_adr_type_code => 'S'
68808 , p_component_type => l_component_type
68809 , p_component_code => l_component_code
68810 , p_component_type_code => l_component_type_code
68811 , p_component_appl_id => l_component_appl_id
68812 , p_amb_context_code => l_amb_context_code
68813 , p_side => 'NA'
68814 );
68815
68816
68817 l_segment := AcctDerRule_151(
68818 p_application_id => p_application_id
68819 , p_ae_header_id => l_ae_header_id
68820 , p_source_5 => p_source_5
68821 , p_source_13 => p_source_13
68822 , x_transaction_coa_id => l_adr_transaction_coa_id
68823 , x_accounting_coa_id => l_adr_accounting_coa_id
68824 , x_flexfield_segment_code => l_adr_flexfield_segment_code
68825 , x_flex_value_set_id => l_adr_flex_value_set_id
68826 , x_value_type_code => l_adr_value_type_code
68827 , x_value_combination_id => l_adr_value_combination_id
68828 , x_value_segment_code => l_adr_value_segment_code
68829 , p_side => 'NA'
68830 , p_override_seg_flag => 'Y'
68831 );
68832
68833 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
68834
68835 xla_ae_lines_pkg.set_segment(
68836 p_to_segment_code => 'GL_ACCOUNT'
68837 , p_segment_value => l_segment
68838 , p_from_segment_code => l_adr_value_segment_code
68839 , p_from_combination_id => l_adr_value_combination_id
68840 , p_value_type_code => l_adr_value_type_code
68841 , p_transaction_coa_id => l_adr_transaction_coa_id
68842 , p_accounting_coa_id => l_adr_accounting_coa_id
68843 , p_flexfield_segment_code => l_adr_flexfield_segment_code
68844 , p_flex_value_set_id => l_adr_flex_value_set_id
68848 , p_component_code => l_component_code
68845 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
68846 , p_adr_type_code => 'S'
68847 , p_component_type => l_component_type
68849 , p_component_type_code => l_component_type_code
68850 , p_component_appl_id => l_component_appl_id
68851 , p_amb_context_code => l_amb_context_code
68852 , p_entity_code => 'TRANSACTIONS'
68853 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
68854 , p_side => 'NA'
68855 );
68856
68857 END IF;
68858
68859 l_segment := AcctDerRule_169(
68860 p_application_id => p_application_id
68861 , p_ae_header_id => l_ae_header_id
68862 , p_source_5 => p_source_5
68863 , p_source_31 => p_source_31
68864 , x_transaction_coa_id => l_adr_transaction_coa_id
68865 , x_accounting_coa_id => l_adr_accounting_coa_id
68866 , x_flexfield_segment_code => l_adr_flexfield_segment_code
68867 , x_flex_value_set_id => l_adr_flex_value_set_id
68868 , x_value_type_code => l_adr_value_type_code
68869 , x_value_combination_id => l_adr_value_combination_id
68870 , x_value_segment_code => l_adr_value_segment_code
68871 , p_side => 'NA'
68872 , p_override_seg_flag => 'Y'
68873 );
68874
68875 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
68876
68877 xla_ae_lines_pkg.set_segment(
68878 p_to_segment_code => 'GL_BALANCING'
68879 , p_segment_value => l_segment
68880 , p_from_segment_code => l_adr_value_segment_code
68881 , p_from_combination_id => l_adr_value_combination_id
68882 , p_value_type_code => l_adr_value_type_code
68883 , p_transaction_coa_id => l_adr_transaction_coa_id
68884 , p_accounting_coa_id => l_adr_accounting_coa_id
68885 , p_flexfield_segment_code => l_adr_flexfield_segment_code
68886 , p_flex_value_set_id => l_adr_flex_value_set_id
68887 , p_adr_code => 'FA_EXPENSE_ACCT'
68888 , p_adr_type_code => 'S'
68889 , p_component_type => l_component_type
68890 , p_component_code => l_component_code
68891 , p_component_type_code => l_component_type_code
68892 , p_component_appl_id => l_component_appl_id
68893 , p_amb_context_code => l_amb_context_code
68894 , p_entity_code => 'TRANSACTIONS'
68895 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
68896 , p_side => 'NA'
68897 );
68898
68899 END IF;
68900
68901 --
68902 --
68903 END IF;
68904 --
68905 -- Bug 4922099
68906 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
68907 (NVL(l_enc_upg_option, 'N') = 'O')
68908 ) AND
68909 (l_bflow_method_code = 'PRIOR_ENTRY')
68910 )
68911 THEN
68912 IF
68913 --
68914 1 = 2
68915 --
68916 THEN
68917 xla_accounting_err_pkg.build_message
68918 (p_appli_s_name => 'XLA'
68919 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
68920 ,p_token_1 => 'LINE_NUMBER'
68921 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
68922 ,p_token_2 => 'LINE_TYPE_NAME'
68923 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
68924 l_component_type
68925 ,l_component_code
68926 ,l_component_type_code
68927 ,l_component_appl_id
68928 ,l_amb_context_code
68929 ,l_entity_code
68930 ,l_event_class_code
68931 )
68932 ,p_token_3 => 'OWNER'
68933 ,p_value_3 => xla_lookups_pkg.get_meaning(
68934 p_lookup_type => 'XLA_OWNER_TYPE'
68935 ,p_lookup_code => l_component_type_code
68936 )
68937 ,p_token_4 => 'PRODUCT_NAME'
68938 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
68939 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
68940 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
68944
68941 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
68942 ,p_ae_header_id => NULL
68943 );
68945 IF (C_LEVEL_ERROR>= g_log_level) THEN
68946 trace
68947 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
68948 ,p_level => C_LEVEL_ERROR
68949 ,p_module => l_log_module);
68950 END IF;
68951 END IF;
68952 END IF;
68953 --
68954 --
68955 ------------------------------------------------------------------------------------------------
68956 -- 4219869 Business Flow
68957 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
68958 -- Prior Entry. Currently, the following code is always generated.
68959 ------------------------------------------------------------------------------------------------
68960 XLA_AE_LINES_PKG.ValidateCurrentLine;
68961
68962 ------------------------------------------------------------------------------------
68963 -- 4219869 Business Flow
68964 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
68965 ------------------------------------------------------------------------------------
68966 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
68967
68968 ----------------------------------------------------------------------------------
68969 -- 4219869 Business Flow
68970 -- Update journal entry status -- Need to generate this within IF <condition>
68971 ----------------------------------------------------------------------------------
68972 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
68973 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
68974 ,p_balance_type_code => l_balance_type_code
68975 );
68976
68977 -------------------------------------------------------------------------------------------
68978 -- 4262811 - Generate the Accrual Reversal lines
68979 -------------------------------------------------------------------------------------------
68980 BEGIN
68981 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
68982 (g_array_event(p_event_id).array_value_num('header_index'));
68983 IF l_acc_rev_flag IS NULL THEN
68984 l_acc_rev_flag := 'N';
68985 END IF;
68986 EXCEPTION
68987 WHEN OTHERS THEN
68988 l_acc_rev_flag := 'N';
68989 END;
68990 --
68991 IF (l_acc_rev_flag = 'Y') THEN
68992
68993 -- 4645092 ------------------------------------------------------------------------------
68994 -- To allow MPA report to determine if it should generate report process
68995 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
68996 ------------------------------------------------------------------------------------------
68997
68998 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
68999 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
69000 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
69001 -- call ADRs
69002 -- Bug 4922099
69003 --
69004 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
69005 (NVL(l_actual_upg_option, 'N') = 'O') OR
69006 (NVL(l_enc_upg_option, 'N') = 'O')
69007 )
69008 THEN
69009 NULL;
69010 --
69011 --
69012
69013 l_ccid := AcctDerRule_175(
69014 p_application_id => p_application_id
69015 , p_ae_header_id => l_ae_header_id
69016 , p_source_5 => p_source_5
69017 , p_source_19 => p_source_19
69018 , p_source_32 => p_source_32
69019 , x_transaction_coa_id => l_adr_transaction_coa_id
69020 , x_accounting_coa_id => l_adr_accounting_coa_id
69021 , x_value_type_code => l_adr_value_type_code
69022 , p_side => 'NA'
69023 );
69024
69025 xla_ae_lines_pkg.set_ccid(
69026 p_code_combination_id => l_ccid
69027 , p_value_type_code => l_adr_value_type_code
69028 , p_transaction_coa_id => l_adr_transaction_coa_id
69029 , p_accounting_coa_id => l_adr_accounting_coa_id
69030 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
69031 , p_adr_type_code => 'S'
69032 , p_component_type => l_component_type
69033 , p_component_code => l_component_code
69034 , p_component_type_code => l_component_type_code
69035 , p_component_appl_id => l_component_appl_id
69036 , p_amb_context_code => l_amb_context_code
69037 , p_side => 'NA'
69038 );
69039
69040
69041 l_segment := AcctDerRule_151(
69042 p_application_id => p_application_id
69043 , p_ae_header_id => l_ae_header_id
69044 , p_source_5 => p_source_5
69045 , p_source_13 => p_source_13
69046 , x_transaction_coa_id => l_adr_transaction_coa_id
69047 , x_accounting_coa_id => l_adr_accounting_coa_id
69048 , x_flexfield_segment_code => l_adr_flexfield_segment_code
69049 , x_flex_value_set_id => l_adr_flex_value_set_id
69050 , x_value_type_code => l_adr_value_type_code
69051 , x_value_combination_id => l_adr_value_combination_id
69055 );
69052 , x_value_segment_code => l_adr_value_segment_code
69053 , p_side => 'NA'
69054 , p_override_seg_flag => 'Y'
69056
69057 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
69058
69059 xla_ae_lines_pkg.set_segment(
69060 p_to_segment_code => 'GL_ACCOUNT'
69061 , p_segment_value => l_segment
69062 , p_from_segment_code => l_adr_value_segment_code
69063 , p_from_combination_id => l_adr_value_combination_id
69064 , p_value_type_code => l_adr_value_type_code
69065 , p_transaction_coa_id => l_adr_transaction_coa_id
69066 , p_accounting_coa_id => l_adr_accounting_coa_id
69067 , p_flexfield_segment_code => l_adr_flexfield_segment_code
69068 , p_flex_value_set_id => l_adr_flex_value_set_id
69069 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
69070 , p_adr_type_code => 'S'
69071 , p_component_type => l_component_type
69072 , p_component_code => l_component_code
69073 , p_component_type_code => l_component_type_code
69074 , p_component_appl_id => l_component_appl_id
69075 , p_amb_context_code => l_amb_context_code
69076 , p_entity_code => 'TRANSACTIONS'
69077 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
69078 , p_side => 'NA'
69079 );
69080
69081 END IF;
69082
69083 l_segment := AcctDerRule_169(
69084 p_application_id => p_application_id
69085 , p_ae_header_id => l_ae_header_id
69086 , p_source_5 => p_source_5
69087 , p_source_31 => p_source_31
69088 , x_transaction_coa_id => l_adr_transaction_coa_id
69089 , x_accounting_coa_id => l_adr_accounting_coa_id
69090 , x_flexfield_segment_code => l_adr_flexfield_segment_code
69091 , x_flex_value_set_id => l_adr_flex_value_set_id
69092 , x_value_type_code => l_adr_value_type_code
69093 , x_value_combination_id => l_adr_value_combination_id
69094 , x_value_segment_code => l_adr_value_segment_code
69095 , p_side => 'NA'
69096 , p_override_seg_flag => 'Y'
69097 );
69098
69099 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
69100
69101 xla_ae_lines_pkg.set_segment(
69102 p_to_segment_code => 'GL_BALANCING'
69103 , p_segment_value => l_segment
69104 , p_from_segment_code => l_adr_value_segment_code
69105 , p_from_combination_id => l_adr_value_combination_id
69106 , p_value_type_code => l_adr_value_type_code
69107 , p_transaction_coa_id => l_adr_transaction_coa_id
69108 , p_accounting_coa_id => l_adr_accounting_coa_id
69109 , p_flexfield_segment_code => l_adr_flexfield_segment_code
69110 , p_flex_value_set_id => l_adr_flex_value_set_id
69111 , p_adr_code => 'FA_EXPENSE_ACCT'
69112 , p_adr_type_code => 'S'
69113 , p_component_type => l_component_type
69114 , p_component_code => l_component_code
69115 , p_component_type_code => l_component_type_code
69116 , p_component_appl_id => l_component_appl_id
69117 , p_amb_context_code => l_amb_context_code
69118 , p_entity_code => 'TRANSACTIONS'
69119 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
69120 , p_side => 'NA'
69121 );
69122
69123 END IF;
69124
69125 --
69126 --
69127 END IF;
69128
69129 --
69130 -- Update the line information that should be overwritten
69131 --
69132 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
69133 p_header_num => 1);
69134 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
69135
69136 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
69137
69138 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
69139 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
69140 END IF;
69141
69142 --
69143 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
69144 --
69145 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
69146 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
69147 ELSE
69148 ---------------------------------------------------------------------------------------------------
69149 -- 4262811a Switch Sign
69150 ---------------------------------------------------------------------------------------------------
69151 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
69152 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
69153 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
69154 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
69158 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
69155 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
69156 -- 5132302
69157 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
69159
69160 END IF;
69161
69162 -- 4955764
69163 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
69164 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
69165
69166
69167 XLA_AE_LINES_PKG.ValidateCurrentLine;
69168 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
69169
69170 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
69171 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
69172 ,p_balance_type_code => l_balance_type_code);
69173
69174 END IF;
69175
69176 -----------------------------------------------------------------------------------------
69177 -- 4262811 Multiperiod Accounting
69178 -----------------------------------------------------------------------------------------
69179 -- No MPA option is assigned.
69180
69181
69182 END IF;
69183 END IF;
69184 --
69185
69186 --
69187 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
69188 trace
69189 (p_msg => 'END of AcctLineType_260'
69190 ,p_level => C_LEVEL_PROCEDURE
69191 ,p_module => l_log_module);
69192 END IF;
69193 --
69194 EXCEPTION
69195 WHEN xla_exceptions_pkg.application_exception THEN
69196 RAISE;
69197 WHEN OTHERS THEN
69198 xla_exceptions_pkg.raise_message
69199 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_260');
69200 END AcctLineType_260;
69201 --
69202
69203 ---------------------------------------
69204 --
69205 -- PRIVATE FUNCTION
69206 -- AcctLineType_261
69207 --
69208 ---------------------------------------
69209 PROCEDURE AcctLineType_261 (
69210 p_application_id IN NUMBER
69211 ,p_event_id IN NUMBER
69212 ,p_calculate_acctd_flag IN VARCHAR2
69213 ,p_calculate_g_l_flag IN VARCHAR2
69214 ,p_actual_flag IN OUT VARCHAR2
69215 ,p_balance_type_code OUT VARCHAR2
69216 ,p_gain_or_loss_ref OUT VARCHAR2
69217
69218 --Period Close Date
69219 , p_source_1 IN DATE
69220 --Generated Code Combination Identifier
69221 , p_source_5 IN NUMBER
69222 --Intercompany Payables Account
69223 , p_source_21 IN VARCHAR2
69224 --Expense Account Code Combination Identifier
69225 , p_source_31 IN NUMBER
69226 --Default Code Combination Identifier
69227 , p_source_32 IN NUMBER
69228 --Adjustment Type
69229 , p_source_48 IN VARCHAR2
69230 --Transaction Header Identifier
69231 , p_source_49 IN NUMBER
69232 --Adjustment Line Identifier
69233 , p_source_50 IN NUMBER
69234 --Distribution Type Code
69235 , p_source_51 IN VARCHAR2
69236 --Entered Amount
69237 , p_source_52 IN NUMBER
69238 --Currency Code
69239 , p_source_53 IN VARCHAR2
69240 )
69241 IS
69242
69243 l_component_type VARCHAR2(80);
69244 l_component_code VARCHAR2(30);
69245 l_component_type_code VARCHAR2(1);
69246 l_component_appl_id INTEGER;
69247 l_amb_context_code VARCHAR2(30);
69248 l_entity_code VARCHAR2(30);
69249 l_event_class_code VARCHAR2(30);
69250 l_ae_header_id NUMBER;
69251 l_event_type_code VARCHAR2(30);
69252 l_line_definition_code VARCHAR2(30);
69253 l_line_definition_owner_code VARCHAR2(1);
69254 --
69255 -- adr variables
69256 l_segment VARCHAR2(30);
69257 l_ccid NUMBER;
69258 l_adr_transaction_coa_id NUMBER;
69259 l_adr_accounting_coa_id NUMBER;
69260 l_adr_flexfield_segment_code VARCHAR2(30);
69261 l_adr_flex_value_set_id NUMBER;
69262 l_adr_value_type_code VARCHAR2(30);
69263 l_adr_value_combination_id NUMBER;
69264 l_adr_value_segment_code VARCHAR2(30);
69265
69266 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
69267 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
69268 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
69269 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
69270
69271 -- 4262811 Variables ------------------------------------------------------------------------------------------
69272 l_entered_amt_idx NUMBER;
69273 l_accted_amt_idx NUMBER;
69274 l_acc_rev_flag VARCHAR2(1);
69275 l_accrual_line_num NUMBER;
69276 l_tmp_amt NUMBER;
69277 l_acc_rev_natural_side_code VARCHAR2(1);
69278
69279 l_num_entries NUMBER;
69280 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
69281 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
69282 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
69283 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
69284 l_recog_line_1 NUMBER;
69285 l_recog_line_2 NUMBER;
69286
69290
69287 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
69288 l_bflow_applied_to_amt NUMBER; -- 5132302
69289 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
69291 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
69292
69293 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
69294 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
69295
69296 ---------------------------------------------------------------------------------------------------------------
69297
69298
69299 --
69300 -- bulk performance
69301 --
69302 l_balance_type_code VARCHAR2(1);
69303 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
69304 l_log_module VARCHAR2(240);
69305
69306 --
69307 -- Upgrade strategy
69308 --
69309 l_actual_upg_option VARCHAR2(1);
69310 l_enc_upg_option VARCHAR2(1);
69311
69312 --
69313 BEGIN
69314 --
69315 IF g_log_enabled THEN
69316 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_261';
69317 END IF;
69318 --
69319 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
69320
69321 trace
69322 (p_msg => 'BEGIN of AcctLineType_261'
69323 ,p_level => C_LEVEL_PROCEDURE
69324 ,p_module => l_log_module);
69325
69326 END IF;
69327 --
69328 l_component_type := 'AMB_JLT';
69329 l_component_code := 'FA_CIP_UNITADJ_IC_PAY';
69330 l_component_type_code := 'S';
69331 l_component_appl_id := 140;
69332 l_amb_context_code := 'DEFAULT';
69333 l_entity_code := 'TRANSACTIONS';
69334 l_event_class_code := 'CIP_UNIT_ADJUSTMENTS';
69335 l_event_type_code := 'CIP_UNIT_ADJUSTMENTS_ALL';
69336 l_line_definition_owner_code := 'S';
69337 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_U13';
69338 --
69339 l_balance_type_code := 'A';
69340 l_segment := NULL;
69341 l_ccid := NULL;
69342 l_adr_transaction_coa_id := NULL;
69343 l_adr_accounting_coa_id := NULL;
69344 l_adr_flexfield_segment_code := NULL;
69345 l_adr_flex_value_set_id := NULL;
69346 l_adr_value_type_code := NULL;
69347 l_adr_value_combination_id := NULL;
69348 l_adr_value_segment_code := NULL;
69349
69350 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
69351 l_bflow_class_code := ''; -- 4219869 Business Flow
69352 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
69353 l_budgetary_control_flag := 'N';
69354
69355 l_bflow_applied_to_amt_idx := NULL; -- 5132302
69356 l_bflow_applied_to_amt := NULL; -- 5132302
69357 l_entered_amt_idx := NULL; -- 4262811
69358 l_accted_amt_idx := NULL; -- 4262811
69359 l_acc_rev_flag := NULL; -- 4262811
69360 l_accrual_line_num := NULL; -- 4262811
69361 l_tmp_amt := NULL; -- 4262811
69362 --
69363
69364 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
69365 l_balance_type_code <> 'B' THEN
69366 IF NVL(p_source_48,'
69367 ') = 'INTERCO AP'
69368 THEN
69369
69370 --
69371 XLA_AE_LINES_PKG.SetNewLine;
69372
69373 p_balance_type_code := l_balance_type_code;
69374 -- set the flag so later we will know whether the gain loss line needs to be created
69375
69376 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
69377 p_actual_flag :='A';
69378 END IF;
69379
69380 --
69381 -- bulk performance
69382 --
69383 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
69384 p_header_num => 0); -- 4262811
69385 --
69386 -- set accounting line options
69387 --
69388 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
69389 p_natural_side_code => 'C'
69390 , p_gain_or_loss_flag => 'N'
69391 , p_gl_transfer_mode_code => 'S'
69392 , p_acct_entry_type_code => 'A'
69393 , p_switch_side_flag => 'Y'
69394 , p_merge_duplicate_code => 'N'
69395 );
69396 --
69397 l_acc_rev_natural_side_code := 'D'; -- 4262811
69398 --
69399 --
69400 -- set accounting line type info
69401 --
69402 xla_ae_lines_pkg.SetAcctLineType
69403 (p_component_type => l_component_type
69404 ,p_event_type_code => l_event_type_code
69405 ,p_line_definition_owner_code => l_line_definition_owner_code
69406 ,p_line_definition_code => l_line_definition_code
69407 ,p_accounting_line_code => l_component_code
69408 ,p_accounting_line_type_code => l_component_type_code
69409 ,p_accounting_line_appl_id => l_component_appl_id
69410 ,p_amb_context_code => l_amb_context_code
69411 ,p_entity_code => l_entity_code
69412 ,p_event_class_code => l_event_class_code);
69413 --
69414 -- set accounting class
69415 --
69416 xla_ae_lines_pkg.SetAcctClass(
69420
69417 p_accounting_class_code => 'LIABILITY'
69418 , p_ae_header_id => l_ae_header_id
69419 );
69421 --
69422 -- set rounding class
69423 --
69424 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
69425 'LIABILITY';
69426
69427 --
69428 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
69429 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
69430 --
69431 -- bulk performance
69432 --
69433 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
69434
69435 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
69436 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
69437
69438 -- 4955764
69439 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
69440 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
69441
69442 -- 4458381 Public Sector Enh
69443
69444 --
69445 -- set accounting attributes for the line type
69446 --
69447 l_entered_amt_idx := 4;
69448 l_accted_amt_idx := 6;
69449 l_bflow_applied_to_amt_idx := NULL; -- 5132302
69450 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
69451 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
69452 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
69453 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
69454 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
69455 l_rec_acct_attrs.array_char_value(3) := p_source_51;
69456 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
69457 l_rec_acct_attrs.array_num_value(4) := p_source_52;
69458 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
69459 l_rec_acct_attrs.array_char_value(5) := p_source_53;
69460 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
69461 l_rec_acct_attrs.array_num_value(6) := p_source_52;
69462
69463 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
69464 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
69465
69466 ---------------------------------------------------------------------------------------------------------------
69467 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
69468 ---------------------------------------------------------------------------------------------------------------
69469 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
69470
69471 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
69472 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
69473
69474 IF xla_accounting_cache_pkg.GetValueChar
69475 (p_source_code => 'LEDGER_CATEGORY_CODE'
69476 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
69477 AND l_bflow_method_code = 'PRIOR_ENTRY'
69478 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
69479 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
69480 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
69481 )
69482 THEN
69483 xla_ae_lines_pkg.BflowUpgEntry
69484 (p_business_method_code => l_bflow_method_code
69485 ,p_business_class_code => l_bflow_class_code
69486 ,p_balance_type => l_balance_type_code);
69487 ELSE
69488 NULL;
69489 -- No business flow processing for business flow method of NONE.
69490 END IF;
69491
69492 --
69493 -- call analytical criteria
69494 --
69495
69496 --
69497 -- call description
69498 --
69499
69500 xla_ae_lines_pkg.SetLineDescription(
69501 p_ae_header_id => l_ae_header_id
69502 ,p_description => Description_50 (
69503 p_application_id => p_application_id
69504 , p_ae_header_id => l_ae_header_id
69505 , p_source_1 => p_source_1
69506 )
69507 );
69508
69509
69510 --
69511 -- call ADRs
69512 -- Bug 4922099
69513 --
69514 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
69515 (NVL(l_actual_upg_option, 'N') = 'O') OR
69516 (NVL(l_enc_upg_option, 'N') = 'O')
69517 )
69518 THEN
69519 NULL;
69520 --
69521 --
69522
69523 l_ccid := AcctDerRule_174(
69524 p_application_id => p_application_id
69525 , p_ae_header_id => l_ae_header_id
69526 , p_source_5 => p_source_5
69527 , p_source_32 => p_source_32
69528 , x_transaction_coa_id => l_adr_transaction_coa_id
69529 , x_accounting_coa_id => l_adr_accounting_coa_id
69530 , x_value_type_code => l_adr_value_type_code
69531 , p_side => 'NA'
69532 );
69533
69534 xla_ae_lines_pkg.set_ccid(
69535 p_code_combination_id => l_ccid
69536 , p_value_type_code => l_adr_value_type_code
69537 , p_transaction_coa_id => l_adr_transaction_coa_id
69541 , p_component_type => l_component_type
69538 , p_accounting_coa_id => l_adr_accounting_coa_id
69539 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
69540 , p_adr_type_code => 'S'
69542 , p_component_code => l_component_code
69543 , p_component_type_code => l_component_type_code
69544 , p_component_appl_id => l_component_appl_id
69545 , p_amb_context_code => l_amb_context_code
69546 , p_side => 'NA'
69547 );
69548
69549
69550 l_segment := AcctDerRule_169(
69551 p_application_id => p_application_id
69552 , p_ae_header_id => l_ae_header_id
69553 , p_source_5 => p_source_5
69554 , p_source_31 => p_source_31
69555 , x_transaction_coa_id => l_adr_transaction_coa_id
69556 , x_accounting_coa_id => l_adr_accounting_coa_id
69557 , x_flexfield_segment_code => l_adr_flexfield_segment_code
69558 , x_flex_value_set_id => l_adr_flex_value_set_id
69559 , x_value_type_code => l_adr_value_type_code
69560 , x_value_combination_id => l_adr_value_combination_id
69561 , x_value_segment_code => l_adr_value_segment_code
69562 , p_side => 'NA'
69563 , p_override_seg_flag => 'Y'
69564 );
69565
69566 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
69567
69568 xla_ae_lines_pkg.set_segment(
69569 p_to_segment_code => 'GL_BALANCING'
69570 , p_segment_value => l_segment
69571 , p_from_segment_code => l_adr_value_segment_code
69572 , p_from_combination_id => l_adr_value_combination_id
69573 , p_value_type_code => l_adr_value_type_code
69574 , p_transaction_coa_id => l_adr_transaction_coa_id
69575 , p_accounting_coa_id => l_adr_accounting_coa_id
69576 , p_flexfield_segment_code => l_adr_flexfield_segment_code
69577 , p_flex_value_set_id => l_adr_flex_value_set_id
69578 , p_adr_code => 'FA_EXPENSE_ACCT'
69579 , p_adr_type_code => 'S'
69580 , p_component_type => l_component_type
69581 , p_component_code => l_component_code
69582 , p_component_type_code => l_component_type_code
69583 , p_component_appl_id => l_component_appl_id
69584 , p_amb_context_code => l_amb_context_code
69585 , p_entity_code => 'TRANSACTIONS'
69586 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
69587 , p_side => 'NA'
69588 );
69589
69590 END IF;
69591
69592 l_segment := AcctDerRule_158(
69593 p_application_id => p_application_id
69594 , p_ae_header_id => l_ae_header_id
69595 , p_source_5 => p_source_5
69596 , p_source_21 => p_source_21
69597 , x_transaction_coa_id => l_adr_transaction_coa_id
69598 , x_accounting_coa_id => l_adr_accounting_coa_id
69599 , x_flexfield_segment_code => l_adr_flexfield_segment_code
69600 , x_flex_value_set_id => l_adr_flex_value_set_id
69601 , x_value_type_code => l_adr_value_type_code
69602 , x_value_combination_id => l_adr_value_combination_id
69603 , x_value_segment_code => l_adr_value_segment_code
69604 , p_side => 'NA'
69605 , p_override_seg_flag => 'Y'
69606 );
69607
69608 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
69609
69610 xla_ae_lines_pkg.set_segment(
69611 p_to_segment_code => 'GL_ACCOUNT'
69612 , p_segment_value => l_segment
69613 , p_from_segment_code => l_adr_value_segment_code
69614 , p_from_combination_id => l_adr_value_combination_id
69615 , p_value_type_code => l_adr_value_type_code
69616 , p_transaction_coa_id => l_adr_transaction_coa_id
69617 , p_accounting_coa_id => l_adr_accounting_coa_id
69618 , p_flexfield_segment_code => l_adr_flexfield_segment_code
69619 , p_flex_value_set_id => l_adr_flex_value_set_id
69620 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
69621 , p_adr_type_code => 'S'
69622 , p_component_type => l_component_type
69623 , p_component_code => l_component_code
69624 , p_component_type_code => l_component_type_code
69625 , p_component_appl_id => l_component_appl_id
69626 , p_amb_context_code => l_amb_context_code
69627 , p_entity_code => 'TRANSACTIONS'
69628 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
69629 , p_side => 'NA'
69630 );
69631
69632 END IF;
69633
69634 --
69635 --
69636 END IF;
69637 --
69638 -- Bug 4922099
69639 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
69640 (NVL(l_enc_upg_option, 'N') = 'O')
69641 ) AND
69642 (l_bflow_method_code = 'PRIOR_ENTRY')
69643 )
69644 THEN
69645 IF
69646 --
69647 1 = 2
69648 --
69649 THEN
69650 xla_accounting_err_pkg.build_message
69651 (p_appli_s_name => 'XLA'
69652 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
69656 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
69653 ,p_token_1 => 'LINE_NUMBER'
69654 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
69655 ,p_token_2 => 'LINE_TYPE_NAME'
69657 l_component_type
69658 ,l_component_code
69659 ,l_component_type_code
69660 ,l_component_appl_id
69661 ,l_amb_context_code
69662 ,l_entity_code
69663 ,l_event_class_code
69664 )
69665 ,p_token_3 => 'OWNER'
69666 ,p_value_3 => xla_lookups_pkg.get_meaning(
69667 p_lookup_type => 'XLA_OWNER_TYPE'
69668 ,p_lookup_code => l_component_type_code
69669 )
69670 ,p_token_4 => 'PRODUCT_NAME'
69671 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
69672 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
69673 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
69674 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
69675 ,p_ae_header_id => NULL
69676 );
69677
69678 IF (C_LEVEL_ERROR>= g_log_level) THEN
69679 trace
69680 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
69681 ,p_level => C_LEVEL_ERROR
69682 ,p_module => l_log_module);
69683 END IF;
69684 END IF;
69685 END IF;
69686 --
69687 --
69688 ------------------------------------------------------------------------------------------------
69689 -- 4219869 Business Flow
69690 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
69691 -- Prior Entry. Currently, the following code is always generated.
69692 ------------------------------------------------------------------------------------------------
69693 XLA_AE_LINES_PKG.ValidateCurrentLine;
69694
69695 ------------------------------------------------------------------------------------
69696 -- 4219869 Business Flow
69697 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
69698 ------------------------------------------------------------------------------------
69699 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
69700
69701 ----------------------------------------------------------------------------------
69702 -- 4219869 Business Flow
69703 -- Update journal entry status -- Need to generate this within IF <condition>
69704 ----------------------------------------------------------------------------------
69705 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
69706 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
69707 ,p_balance_type_code => l_balance_type_code
69708 );
69709
69710 -------------------------------------------------------------------------------------------
69711 -- 4262811 - Generate the Accrual Reversal lines
69712 -------------------------------------------------------------------------------------------
69713 BEGIN
69714 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
69715 (g_array_event(p_event_id).array_value_num('header_index'));
69716 IF l_acc_rev_flag IS NULL THEN
69717 l_acc_rev_flag := 'N';
69718 END IF;
69719 EXCEPTION
69720 WHEN OTHERS THEN
69721 l_acc_rev_flag := 'N';
69722 END;
69723 --
69724 IF (l_acc_rev_flag = 'Y') THEN
69725
69726 -- 4645092 ------------------------------------------------------------------------------
69727 -- To allow MPA report to determine if it should generate report process
69728 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
69729 ------------------------------------------------------------------------------------------
69730
69731 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
69732 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
69733 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
69734 -- call ADRs
69735 -- Bug 4922099
69736 --
69737 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
69738 (NVL(l_actual_upg_option, 'N') = 'O') OR
69739 (NVL(l_enc_upg_option, 'N') = 'O')
69740 )
69741 THEN
69742 NULL;
69743 --
69744 --
69745
69746 l_ccid := AcctDerRule_174(
69750 , p_source_32 => p_source_32
69747 p_application_id => p_application_id
69748 , p_ae_header_id => l_ae_header_id
69749 , p_source_5 => p_source_5
69751 , x_transaction_coa_id => l_adr_transaction_coa_id
69752 , x_accounting_coa_id => l_adr_accounting_coa_id
69753 , x_value_type_code => l_adr_value_type_code
69754 , p_side => 'NA'
69755 );
69756
69757 xla_ae_lines_pkg.set_ccid(
69758 p_code_combination_id => l_ccid
69759 , p_value_type_code => l_adr_value_type_code
69760 , p_transaction_coa_id => l_adr_transaction_coa_id
69761 , p_accounting_coa_id => l_adr_accounting_coa_id
69762 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
69763 , p_adr_type_code => 'S'
69764 , p_component_type => l_component_type
69765 , p_component_code => l_component_code
69766 , p_component_type_code => l_component_type_code
69767 , p_component_appl_id => l_component_appl_id
69768 , p_amb_context_code => l_amb_context_code
69769 , p_side => 'NA'
69770 );
69771
69772
69773 l_segment := AcctDerRule_169(
69774 p_application_id => p_application_id
69775 , p_ae_header_id => l_ae_header_id
69776 , p_source_5 => p_source_5
69777 , p_source_31 => p_source_31
69778 , x_transaction_coa_id => l_adr_transaction_coa_id
69779 , x_accounting_coa_id => l_adr_accounting_coa_id
69780 , x_flexfield_segment_code => l_adr_flexfield_segment_code
69781 , x_flex_value_set_id => l_adr_flex_value_set_id
69782 , x_value_type_code => l_adr_value_type_code
69783 , x_value_combination_id => l_adr_value_combination_id
69784 , x_value_segment_code => l_adr_value_segment_code
69785 , p_side => 'NA'
69786 , p_override_seg_flag => 'Y'
69787 );
69788
69789 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
69790
69791 xla_ae_lines_pkg.set_segment(
69792 p_to_segment_code => 'GL_BALANCING'
69793 , p_segment_value => l_segment
69794 , p_from_segment_code => l_adr_value_segment_code
69795 , p_from_combination_id => l_adr_value_combination_id
69796 , p_value_type_code => l_adr_value_type_code
69797 , p_transaction_coa_id => l_adr_transaction_coa_id
69798 , p_accounting_coa_id => l_adr_accounting_coa_id
69799 , p_flexfield_segment_code => l_adr_flexfield_segment_code
69800 , p_flex_value_set_id => l_adr_flex_value_set_id
69801 , p_adr_code => 'FA_EXPENSE_ACCT'
69802 , p_adr_type_code => 'S'
69803 , p_component_type => l_component_type
69804 , p_component_code => l_component_code
69805 , p_component_type_code => l_component_type_code
69806 , p_component_appl_id => l_component_appl_id
69807 , p_amb_context_code => l_amb_context_code
69808 , p_entity_code => 'TRANSACTIONS'
69809 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
69810 , p_side => 'NA'
69811 );
69812
69813 END IF;
69814
69815 l_segment := AcctDerRule_158(
69816 p_application_id => p_application_id
69817 , p_ae_header_id => l_ae_header_id
69818 , p_source_5 => p_source_5
69819 , p_source_21 => p_source_21
69820 , x_transaction_coa_id => l_adr_transaction_coa_id
69821 , x_accounting_coa_id => l_adr_accounting_coa_id
69822 , x_flexfield_segment_code => l_adr_flexfield_segment_code
69823 , x_flex_value_set_id => l_adr_flex_value_set_id
69824 , x_value_type_code => l_adr_value_type_code
69825 , x_value_combination_id => l_adr_value_combination_id
69826 , x_value_segment_code => l_adr_value_segment_code
69827 , p_side => 'NA'
69828 , p_override_seg_flag => 'Y'
69829 );
69830
69831 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
69832
69833 xla_ae_lines_pkg.set_segment(
69834 p_to_segment_code => 'GL_ACCOUNT'
69835 , p_segment_value => l_segment
69836 , p_from_segment_code => l_adr_value_segment_code
69837 , p_from_combination_id => l_adr_value_combination_id
69838 , p_value_type_code => l_adr_value_type_code
69839 , p_transaction_coa_id => l_adr_transaction_coa_id
69840 , p_accounting_coa_id => l_adr_accounting_coa_id
69841 , p_flexfield_segment_code => l_adr_flexfield_segment_code
69842 , p_flex_value_set_id => l_adr_flex_value_set_id
69843 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
69844 , p_adr_type_code => 'S'
69845 , p_component_type => l_component_type
69846 , p_component_code => l_component_code
69847 , p_component_type_code => l_component_type_code
69848 , p_component_appl_id => l_component_appl_id
69849 , p_amb_context_code => l_amb_context_code
69850 , p_entity_code => 'TRANSACTIONS'
69851 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
69855 END IF;
69852 , p_side => 'NA'
69853 );
69854
69856
69857 --
69858 --
69859 END IF;
69860
69861 --
69862 -- Update the line information that should be overwritten
69863 --
69864 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
69865 p_header_num => 1);
69866 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
69867
69868 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
69869
69870 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
69871 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
69872 END IF;
69873
69874 --
69875 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
69876 --
69877 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
69878 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
69879 ELSE
69880 ---------------------------------------------------------------------------------------------------
69881 -- 4262811a Switch Sign
69882 ---------------------------------------------------------------------------------------------------
69883 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
69884 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
69885 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
69886 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
69887 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
69888 -- 5132302
69889 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
69890 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
69891
69892 END IF;
69893
69894 -- 4955764
69895 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
69896 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
69897
69898
69899 XLA_AE_LINES_PKG.ValidateCurrentLine;
69900 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
69901
69902 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
69903 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
69904 ,p_balance_type_code => l_balance_type_code);
69905
69906 END IF;
69907
69908 -----------------------------------------------------------------------------------------
69909 -- 4262811 Multiperiod Accounting
69910 -----------------------------------------------------------------------------------------
69911 -- No MPA option is assigned.
69912
69913
69914 END IF;
69915 END IF;
69916 --
69917
69918 --
69919 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
69920 trace
69921 (p_msg => 'END of AcctLineType_261'
69922 ,p_level => C_LEVEL_PROCEDURE
69923 ,p_module => l_log_module);
69924 END IF;
69925 --
69926 EXCEPTION
69927 WHEN xla_exceptions_pkg.application_exception THEN
69928 RAISE;
69929 WHEN OTHERS THEN
69930 xla_exceptions_pkg.raise_message
69931 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_261');
69932 END AcctLineType_261;
69933 --
69934
69935 ---------------------------------------
69936 --
69937 -- PRIVATE FUNCTION
69938 -- AcctLineType_262
69939 --
69940 ---------------------------------------
69941 PROCEDURE AcctLineType_262 (
69942 p_application_id IN NUMBER
69943 ,p_event_id IN NUMBER
69944 ,p_calculate_acctd_flag IN VARCHAR2
69945 ,p_calculate_g_l_flag IN VARCHAR2
69946 ,p_actual_flag IN OUT VARCHAR2
69947 ,p_balance_type_code OUT VARCHAR2
69948 ,p_gain_or_loss_ref OUT VARCHAR2
69949
69950 --Period Close Date
69951 , p_source_1 IN DATE
69952 --Generated Code Combination Identifier
69953 , p_source_5 IN NUMBER
69954 --Intercompany Receivables Account
69955 , p_source_22 IN VARCHAR2
69956 --Expense Account Code Combination Identifier
69957 , p_source_31 IN NUMBER
69958 --Default Code Combination Identifier
69959 , p_source_32 IN NUMBER
69960 --Adjustment Type
69961 , p_source_48 IN VARCHAR2
69962 --Transaction Header Identifier
69963 , p_source_49 IN NUMBER
69964 --Adjustment Line Identifier
69965 , p_source_50 IN NUMBER
69966 --Distribution Type Code
69967 , p_source_51 IN VARCHAR2
69968 --Entered Amount
69969 , p_source_52 IN NUMBER
69970 --Currency Code
69971 , p_source_53 IN VARCHAR2
69972 )
69973 IS
69974
69975 l_component_type VARCHAR2(80);
69976 l_component_code VARCHAR2(30);
69977 l_component_type_code VARCHAR2(1);
69978 l_component_appl_id INTEGER;
69979 l_amb_context_code VARCHAR2(30);
69983 l_event_type_code VARCHAR2(30);
69980 l_entity_code VARCHAR2(30);
69981 l_event_class_code VARCHAR2(30);
69982 l_ae_header_id NUMBER;
69984 l_line_definition_code VARCHAR2(30);
69985 l_line_definition_owner_code VARCHAR2(1);
69986 --
69987 -- adr variables
69988 l_segment VARCHAR2(30);
69989 l_ccid NUMBER;
69990 l_adr_transaction_coa_id NUMBER;
69991 l_adr_accounting_coa_id NUMBER;
69992 l_adr_flexfield_segment_code VARCHAR2(30);
69993 l_adr_flex_value_set_id NUMBER;
69994 l_adr_value_type_code VARCHAR2(30);
69995 l_adr_value_combination_id NUMBER;
69996 l_adr_value_segment_code VARCHAR2(30);
69997
69998 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
69999 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
70000 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
70001 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
70002
70003 -- 4262811 Variables ------------------------------------------------------------------------------------------
70004 l_entered_amt_idx NUMBER;
70005 l_accted_amt_idx NUMBER;
70006 l_acc_rev_flag VARCHAR2(1);
70007 l_accrual_line_num NUMBER;
70008 l_tmp_amt NUMBER;
70009 l_acc_rev_natural_side_code VARCHAR2(1);
70010
70011 l_num_entries NUMBER;
70012 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
70013 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
70014 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
70015 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
70016 l_recog_line_1 NUMBER;
70017 l_recog_line_2 NUMBER;
70018
70019 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
70020 l_bflow_applied_to_amt NUMBER; -- 5132302
70021 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
70022
70023 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
70024
70025 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
70026 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
70027
70028 ---------------------------------------------------------------------------------------------------------------
70029
70030
70031 --
70032 -- bulk performance
70033 --
70034 l_balance_type_code VARCHAR2(1);
70035 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
70036 l_log_module VARCHAR2(240);
70037
70038 --
70039 -- Upgrade strategy
70040 --
70041 l_actual_upg_option VARCHAR2(1);
70042 l_enc_upg_option VARCHAR2(1);
70043
70044 --
70045 BEGIN
70046 --
70047 IF g_log_enabled THEN
70048 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_262';
70049 END IF;
70050 --
70051 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
70052
70053 trace
70054 (p_msg => 'BEGIN of AcctLineType_262'
70055 ,p_level => C_LEVEL_PROCEDURE
70056 ,p_module => l_log_module);
70057
70058 END IF;
70059 --
70060 l_component_type := 'AMB_JLT';
70061 l_component_code := 'FA_CIP_UNITADJ_IC_REC';
70062 l_component_type_code := 'S';
70063 l_component_appl_id := 140;
70064 l_amb_context_code := 'DEFAULT';
70065 l_entity_code := 'TRANSACTIONS';
70066 l_event_class_code := 'CIP_UNIT_ADJUSTMENTS';
70067 l_event_type_code := 'CIP_UNIT_ADJUSTMENTS_ALL';
70068 l_line_definition_owner_code := 'S';
70069 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_U13';
70070 --
70071 l_balance_type_code := 'A';
70072 l_segment := NULL;
70073 l_ccid := NULL;
70074 l_adr_transaction_coa_id := NULL;
70075 l_adr_accounting_coa_id := NULL;
70076 l_adr_flexfield_segment_code := NULL;
70077 l_adr_flex_value_set_id := NULL;
70078 l_adr_value_type_code := NULL;
70079 l_adr_value_combination_id := NULL;
70080 l_adr_value_segment_code := NULL;
70081
70082 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
70083 l_bflow_class_code := ''; -- 4219869 Business Flow
70084 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
70085 l_budgetary_control_flag := 'N';
70086
70087 l_bflow_applied_to_amt_idx := NULL; -- 5132302
70088 l_bflow_applied_to_amt := NULL; -- 5132302
70089 l_entered_amt_idx := NULL; -- 4262811
70090 l_accted_amt_idx := NULL; -- 4262811
70091 l_acc_rev_flag := NULL; -- 4262811
70092 l_accrual_line_num := NULL; -- 4262811
70093 l_tmp_amt := NULL; -- 4262811
70094 --
70095
70096 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
70097 l_balance_type_code <> 'B' THEN
70098 IF NVL(p_source_48,'
70099 ') = 'INTERCO AR'
70100 THEN
70101
70102 --
70103 XLA_AE_LINES_PKG.SetNewLine;
70104
70105 p_balance_type_code := l_balance_type_code;
70106 -- set the flag so later we will know whether the gain loss line needs to be created
70107
70111
70108 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
70109 p_actual_flag :='A';
70110 END IF;
70112 --
70113 -- bulk performance
70114 --
70115 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
70116 p_header_num => 0); -- 4262811
70117 --
70118 -- set accounting line options
70119 --
70120 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
70121 p_natural_side_code => 'D'
70122 , p_gain_or_loss_flag => 'N'
70123 , p_gl_transfer_mode_code => 'S'
70124 , p_acct_entry_type_code => 'A'
70125 , p_switch_side_flag => 'Y'
70126 , p_merge_duplicate_code => 'N'
70127 );
70128 --
70129 l_acc_rev_natural_side_code := 'C'; -- 4262811
70130 --
70131 --
70132 -- set accounting line type info
70133 --
70134 xla_ae_lines_pkg.SetAcctLineType
70135 (p_component_type => l_component_type
70136 ,p_event_type_code => l_event_type_code
70137 ,p_line_definition_owner_code => l_line_definition_owner_code
70138 ,p_line_definition_code => l_line_definition_code
70139 ,p_accounting_line_code => l_component_code
70140 ,p_accounting_line_type_code => l_component_type_code
70141 ,p_accounting_line_appl_id => l_component_appl_id
70142 ,p_amb_context_code => l_amb_context_code
70143 ,p_entity_code => l_entity_code
70144 ,p_event_class_code => l_event_class_code);
70145 --
70146 -- set accounting class
70147 --
70148 xla_ae_lines_pkg.SetAcctClass(
70149 p_accounting_class_code => 'ASSET'
70150 , p_ae_header_id => l_ae_header_id
70151 );
70152
70153 --
70154 -- set rounding class
70155 --
70156 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
70157 'ASSET';
70158
70159 --
70160 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
70161 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
70162 --
70163 -- bulk performance
70164 --
70165 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
70166
70167 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
70168 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
70169
70170 -- 4955764
70171 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
70172 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
70173
70174 -- 4458381 Public Sector Enh
70175
70176 --
70177 -- set accounting attributes for the line type
70178 --
70179 l_entered_amt_idx := 4;
70180 l_accted_amt_idx := 6;
70181 l_bflow_applied_to_amt_idx := NULL; -- 5132302
70182 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
70183 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
70184 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
70185 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
70186 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
70187 l_rec_acct_attrs.array_char_value(3) := p_source_51;
70188 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
70189 l_rec_acct_attrs.array_num_value(4) := p_source_52;
70190 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
70191 l_rec_acct_attrs.array_char_value(5) := p_source_53;
70192 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
70193 l_rec_acct_attrs.array_num_value(6) := p_source_52;
70194
70195 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
70196 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
70197
70198 ---------------------------------------------------------------------------------------------------------------
70199 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
70200 ---------------------------------------------------------------------------------------------------------------
70201 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
70202
70203 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
70204 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
70205
70206 IF xla_accounting_cache_pkg.GetValueChar
70207 (p_source_code => 'LEDGER_CATEGORY_CODE'
70208 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
70209 AND l_bflow_method_code = 'PRIOR_ENTRY'
70210 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
70211 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
70212 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
70213 )
70214 THEN
70215 xla_ae_lines_pkg.BflowUpgEntry
70216 (p_business_method_code => l_bflow_method_code
70217 ,p_business_class_code => l_bflow_class_code
70221 -- No business flow processing for business flow method of NONE.
70218 ,p_balance_type => l_balance_type_code);
70219 ELSE
70220 NULL;
70222 END IF;
70223
70224 --
70225 -- call analytical criteria
70226 --
70227
70228 --
70229 -- call description
70230 --
70231
70232 xla_ae_lines_pkg.SetLineDescription(
70233 p_ae_header_id => l_ae_header_id
70234 ,p_description => Description_51 (
70235 p_application_id => p_application_id
70236 , p_ae_header_id => l_ae_header_id
70237 , p_source_1 => p_source_1
70238 )
70239 );
70240
70241
70242 --
70243 -- call ADRs
70244 -- Bug 4922099
70245 --
70246 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
70247 (NVL(l_actual_upg_option, 'N') = 'O') OR
70248 (NVL(l_enc_upg_option, 'N') = 'O')
70249 )
70250 THEN
70251 NULL;
70252 --
70253 --
70254
70255 l_ccid := AcctDerRule_174(
70256 p_application_id => p_application_id
70257 , p_ae_header_id => l_ae_header_id
70258 , p_source_5 => p_source_5
70259 , p_source_32 => p_source_32
70260 , x_transaction_coa_id => l_adr_transaction_coa_id
70261 , x_accounting_coa_id => l_adr_accounting_coa_id
70262 , x_value_type_code => l_adr_value_type_code
70263 , p_side => 'NA'
70264 );
70265
70266 xla_ae_lines_pkg.set_ccid(
70267 p_code_combination_id => l_ccid
70268 , p_value_type_code => l_adr_value_type_code
70269 , p_transaction_coa_id => l_adr_transaction_coa_id
70270 , p_accounting_coa_id => l_adr_accounting_coa_id
70271 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
70272 , p_adr_type_code => 'S'
70273 , p_component_type => l_component_type
70274 , p_component_code => l_component_code
70275 , p_component_type_code => l_component_type_code
70276 , p_component_appl_id => l_component_appl_id
70277 , p_amb_context_code => l_amb_context_code
70278 , p_side => 'NA'
70279 );
70280
70281
70282 l_segment := AcctDerRule_169(
70283 p_application_id => p_application_id
70284 , p_ae_header_id => l_ae_header_id
70285 , p_source_5 => p_source_5
70286 , p_source_31 => p_source_31
70287 , x_transaction_coa_id => l_adr_transaction_coa_id
70288 , x_accounting_coa_id => l_adr_accounting_coa_id
70289 , x_flexfield_segment_code => l_adr_flexfield_segment_code
70290 , x_flex_value_set_id => l_adr_flex_value_set_id
70291 , x_value_type_code => l_adr_value_type_code
70292 , x_value_combination_id => l_adr_value_combination_id
70293 , x_value_segment_code => l_adr_value_segment_code
70294 , p_side => 'NA'
70295 , p_override_seg_flag => 'Y'
70296 );
70297
70298 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
70299
70300 xla_ae_lines_pkg.set_segment(
70301 p_to_segment_code => 'GL_BALANCING'
70302 , p_segment_value => l_segment
70303 , p_from_segment_code => l_adr_value_segment_code
70304 , p_from_combination_id => l_adr_value_combination_id
70305 , p_value_type_code => l_adr_value_type_code
70306 , p_transaction_coa_id => l_adr_transaction_coa_id
70307 , p_accounting_coa_id => l_adr_accounting_coa_id
70308 , p_flexfield_segment_code => l_adr_flexfield_segment_code
70309 , p_flex_value_set_id => l_adr_flex_value_set_id
70310 , p_adr_code => 'FA_EXPENSE_ACCT'
70311 , p_adr_type_code => 'S'
70312 , p_component_type => l_component_type
70313 , p_component_code => l_component_code
70314 , p_component_type_code => l_component_type_code
70315 , p_component_appl_id => l_component_appl_id
70316 , p_amb_context_code => l_amb_context_code
70317 , p_entity_code => 'TRANSACTIONS'
70318 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
70319 , p_side => 'NA'
70320 );
70321
70322 END IF;
70323
70324 l_segment := AcctDerRule_159(
70325 p_application_id => p_application_id
70326 , p_ae_header_id => l_ae_header_id
70327 , p_source_5 => p_source_5
70328 , p_source_22 => p_source_22
70329 , x_transaction_coa_id => l_adr_transaction_coa_id
70330 , x_accounting_coa_id => l_adr_accounting_coa_id
70331 , x_flexfield_segment_code => l_adr_flexfield_segment_code
70332 , x_flex_value_set_id => l_adr_flex_value_set_id
70333 , x_value_type_code => l_adr_value_type_code
70334 , x_value_combination_id => l_adr_value_combination_id
70335 , x_value_segment_code => l_adr_value_segment_code
70336 , p_side => 'NA'
70337 , p_override_seg_flag => 'Y'
70338 );
70339
70340 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
70341
70342 xla_ae_lines_pkg.set_segment(
70346 , p_from_combination_id => l_adr_value_combination_id
70343 p_to_segment_code => 'GL_ACCOUNT'
70344 , p_segment_value => l_segment
70345 , p_from_segment_code => l_adr_value_segment_code
70347 , p_value_type_code => l_adr_value_type_code
70348 , p_transaction_coa_id => l_adr_transaction_coa_id
70349 , p_accounting_coa_id => l_adr_accounting_coa_id
70350 , p_flexfield_segment_code => l_adr_flexfield_segment_code
70351 , p_flex_value_set_id => l_adr_flex_value_set_id
70352 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
70353 , p_adr_type_code => 'S'
70354 , p_component_type => l_component_type
70355 , p_component_code => l_component_code
70356 , p_component_type_code => l_component_type_code
70357 , p_component_appl_id => l_component_appl_id
70358 , p_amb_context_code => l_amb_context_code
70359 , p_entity_code => 'TRANSACTIONS'
70360 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
70361 , p_side => 'NA'
70362 );
70363
70364 END IF;
70365
70366 --
70367 --
70368 END IF;
70369 --
70370 -- Bug 4922099
70371 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
70372 (NVL(l_enc_upg_option, 'N') = 'O')
70373 ) AND
70374 (l_bflow_method_code = 'PRIOR_ENTRY')
70375 )
70376 THEN
70377 IF
70378 --
70379 1 = 2
70380 --
70381 THEN
70382 xla_accounting_err_pkg.build_message
70383 (p_appli_s_name => 'XLA'
70384 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
70385 ,p_token_1 => 'LINE_NUMBER'
70386 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
70387 ,p_token_2 => 'LINE_TYPE_NAME'
70388 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
70389 l_component_type
70390 ,l_component_code
70391 ,l_component_type_code
70392 ,l_component_appl_id
70393 ,l_amb_context_code
70394 ,l_entity_code
70395 ,l_event_class_code
70396 )
70397 ,p_token_3 => 'OWNER'
70398 ,p_value_3 => xla_lookups_pkg.get_meaning(
70399 p_lookup_type => 'XLA_OWNER_TYPE'
70400 ,p_lookup_code => l_component_type_code
70401 )
70402 ,p_token_4 => 'PRODUCT_NAME'
70403 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
70404 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
70405 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
70406 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
70407 ,p_ae_header_id => NULL
70408 );
70409
70410 IF (C_LEVEL_ERROR>= g_log_level) THEN
70411 trace
70412 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
70413 ,p_level => C_LEVEL_ERROR
70414 ,p_module => l_log_module);
70415 END IF;
70416 END IF;
70417 END IF;
70418 --
70419 --
70420 ------------------------------------------------------------------------------------------------
70421 -- 4219869 Business Flow
70422 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
70423 -- Prior Entry. Currently, the following code is always generated.
70424 ------------------------------------------------------------------------------------------------
70425 XLA_AE_LINES_PKG.ValidateCurrentLine;
70426
70427 ------------------------------------------------------------------------------------
70428 -- 4219869 Business Flow
70429 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
70430 ------------------------------------------------------------------------------------
70431 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
70432
70433 ----------------------------------------------------------------------------------
70434 -- 4219869 Business Flow
70435 -- Update journal entry status -- Need to generate this within IF <condition>
70436 ----------------------------------------------------------------------------------
70440 );
70437 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
70438 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
70439 ,p_balance_type_code => l_balance_type_code
70441
70442 -------------------------------------------------------------------------------------------
70443 -- 4262811 - Generate the Accrual Reversal lines
70444 -------------------------------------------------------------------------------------------
70445 BEGIN
70446 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
70447 (g_array_event(p_event_id).array_value_num('header_index'));
70448 IF l_acc_rev_flag IS NULL THEN
70449 l_acc_rev_flag := 'N';
70450 END IF;
70451 EXCEPTION
70452 WHEN OTHERS THEN
70453 l_acc_rev_flag := 'N';
70454 END;
70455 --
70456 IF (l_acc_rev_flag = 'Y') THEN
70457
70458 -- 4645092 ------------------------------------------------------------------------------
70459 -- To allow MPA report to determine if it should generate report process
70460 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
70461 ------------------------------------------------------------------------------------------
70462
70463 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
70464 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
70465 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
70466 -- call ADRs
70467 -- Bug 4922099
70468 --
70469 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
70470 (NVL(l_actual_upg_option, 'N') = 'O') OR
70471 (NVL(l_enc_upg_option, 'N') = 'O')
70472 )
70473 THEN
70474 NULL;
70475 --
70476 --
70477
70478 l_ccid := AcctDerRule_174(
70479 p_application_id => p_application_id
70480 , p_ae_header_id => l_ae_header_id
70481 , p_source_5 => p_source_5
70482 , p_source_32 => p_source_32
70483 , x_transaction_coa_id => l_adr_transaction_coa_id
70484 , x_accounting_coa_id => l_adr_accounting_coa_id
70485 , x_value_type_code => l_adr_value_type_code
70486 , p_side => 'NA'
70487 );
70488
70489 xla_ae_lines_pkg.set_ccid(
70490 p_code_combination_id => l_ccid
70491 , p_value_type_code => l_adr_value_type_code
70492 , p_transaction_coa_id => l_adr_transaction_coa_id
70493 , p_accounting_coa_id => l_adr_accounting_coa_id
70494 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
70495 , p_adr_type_code => 'S'
70496 , p_component_type => l_component_type
70497 , p_component_code => l_component_code
70498 , p_component_type_code => l_component_type_code
70499 , p_component_appl_id => l_component_appl_id
70500 , p_amb_context_code => l_amb_context_code
70501 , p_side => 'NA'
70502 );
70503
70504
70505 l_segment := AcctDerRule_169(
70506 p_application_id => p_application_id
70507 , p_ae_header_id => l_ae_header_id
70508 , p_source_5 => p_source_5
70509 , p_source_31 => p_source_31
70510 , x_transaction_coa_id => l_adr_transaction_coa_id
70511 , x_accounting_coa_id => l_adr_accounting_coa_id
70512 , x_flexfield_segment_code => l_adr_flexfield_segment_code
70513 , x_flex_value_set_id => l_adr_flex_value_set_id
70514 , x_value_type_code => l_adr_value_type_code
70515 , x_value_combination_id => l_adr_value_combination_id
70516 , x_value_segment_code => l_adr_value_segment_code
70517 , p_side => 'NA'
70518 , p_override_seg_flag => 'Y'
70519 );
70520
70521 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
70522
70523 xla_ae_lines_pkg.set_segment(
70524 p_to_segment_code => 'GL_BALANCING'
70525 , p_segment_value => l_segment
70526 , p_from_segment_code => l_adr_value_segment_code
70527 , p_from_combination_id => l_adr_value_combination_id
70528 , p_value_type_code => l_adr_value_type_code
70529 , p_transaction_coa_id => l_adr_transaction_coa_id
70530 , p_accounting_coa_id => l_adr_accounting_coa_id
70531 , p_flexfield_segment_code => l_adr_flexfield_segment_code
70532 , p_flex_value_set_id => l_adr_flex_value_set_id
70533 , p_adr_code => 'FA_EXPENSE_ACCT'
70534 , p_adr_type_code => 'S'
70535 , p_component_type => l_component_type
70536 , p_component_code => l_component_code
70537 , p_component_type_code => l_component_type_code
70538 , p_component_appl_id => l_component_appl_id
70539 , p_amb_context_code => l_amb_context_code
70540 , p_entity_code => 'TRANSACTIONS'
70541 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
70542 , p_side => 'NA'
70543 );
70544
70545 END IF;
70546
70547 l_segment := AcctDerRule_159(
70548 p_application_id => p_application_id
70549 , p_ae_header_id => l_ae_header_id
70550 , p_source_5 => p_source_5
70551 , p_source_22 => p_source_22
70552 , x_transaction_coa_id => l_adr_transaction_coa_id
70556 , x_value_type_code => l_adr_value_type_code
70553 , x_accounting_coa_id => l_adr_accounting_coa_id
70554 , x_flexfield_segment_code => l_adr_flexfield_segment_code
70555 , x_flex_value_set_id => l_adr_flex_value_set_id
70557 , x_value_combination_id => l_adr_value_combination_id
70558 , x_value_segment_code => l_adr_value_segment_code
70559 , p_side => 'NA'
70560 , p_override_seg_flag => 'Y'
70561 );
70562
70563 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
70564
70565 xla_ae_lines_pkg.set_segment(
70566 p_to_segment_code => 'GL_ACCOUNT'
70567 , p_segment_value => l_segment
70568 , p_from_segment_code => l_adr_value_segment_code
70569 , p_from_combination_id => l_adr_value_combination_id
70570 , p_value_type_code => l_adr_value_type_code
70571 , p_transaction_coa_id => l_adr_transaction_coa_id
70572 , p_accounting_coa_id => l_adr_accounting_coa_id
70573 , p_flexfield_segment_code => l_adr_flexfield_segment_code
70574 , p_flex_value_set_id => l_adr_flex_value_set_id
70575 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
70576 , p_adr_type_code => 'S'
70577 , p_component_type => l_component_type
70578 , p_component_code => l_component_code
70579 , p_component_type_code => l_component_type_code
70580 , p_component_appl_id => l_component_appl_id
70581 , p_amb_context_code => l_amb_context_code
70582 , p_entity_code => 'TRANSACTIONS'
70583 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
70584 , p_side => 'NA'
70585 );
70586
70587 END IF;
70588
70589 --
70590 --
70591 END IF;
70592
70593 --
70594 -- Update the line information that should be overwritten
70595 --
70596 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
70597 p_header_num => 1);
70598 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
70599
70600 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
70601
70602 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
70603 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
70604 END IF;
70605
70606 --
70607 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
70608 --
70609 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
70610 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
70611 ELSE
70612 ---------------------------------------------------------------------------------------------------
70613 -- 4262811a Switch Sign
70614 ---------------------------------------------------------------------------------------------------
70615 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
70616 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
70617 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
70618 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
70619 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
70620 -- 5132302
70621 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
70622 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
70623
70624 END IF;
70625
70626 -- 4955764
70627 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
70628 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
70629
70630
70631 XLA_AE_LINES_PKG.ValidateCurrentLine;
70632 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
70633
70634 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
70635 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
70636 ,p_balance_type_code => l_balance_type_code);
70637
70638 END IF;
70639
70640 -----------------------------------------------------------------------------------------
70641 -- 4262811 Multiperiod Accounting
70642 -----------------------------------------------------------------------------------------
70643 -- No MPA option is assigned.
70644
70645
70646 END IF;
70647 END IF;
70648 --
70649
70650 --
70651 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
70652 trace
70653 (p_msg => 'END of AcctLineType_262'
70654 ,p_level => C_LEVEL_PROCEDURE
70655 ,p_module => l_log_module);
70656 END IF;
70657 --
70658 EXCEPTION
70659 WHEN xla_exceptions_pkg.application_exception THEN
70660 RAISE;
70661 WHEN OTHERS THEN
70662 xla_exceptions_pkg.raise_message
70663 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_262');
70667 ---------------------------------------
70664 END AcctLineType_262;
70665 --
70666
70668 --
70669 -- PRIVATE FUNCTION
70670 -- AcctLineType_263
70671 --
70672 ---------------------------------------
70673 PROCEDURE AcctLineType_263 (
70674 p_application_id IN NUMBER
70675 ,p_event_id IN NUMBER
70676 ,p_calculate_acctd_flag IN VARCHAR2
70677 ,p_calculate_g_l_flag IN VARCHAR2
70678 ,p_actual_flag IN OUT VARCHAR2
70679 ,p_balance_type_code OUT VARCHAR2
70680 ,p_gain_or_loss_ref OUT VARCHAR2
70681
70682 --Period Close Date
70683 , p_source_1 IN DATE
70684 --Generated Code Combination Identifier
70685 , p_source_5 IN NUMBER
70686 --CIP Cost Account
70687 , p_source_9 IN VARCHAR2
70688 --Expense Account Code Combination Identifier
70689 , p_source_31 IN NUMBER
70690 --Default Code Combination Identifier
70691 , p_source_32 IN NUMBER
70692 --Adjustment Type
70693 , p_source_48 IN VARCHAR2
70694 --Transaction Header Identifier
70695 , p_source_49 IN NUMBER
70696 --Adjustment Line Identifier
70697 , p_source_50 IN NUMBER
70698 --Distribution Type Code
70699 , p_source_51 IN VARCHAR2
70700 --Entered Amount
70701 , p_source_52 IN NUMBER
70702 --Currency Code
70703 , p_source_53 IN VARCHAR2
70704 --Source Destination Code
70705 , p_source_55 IN VARCHAR2
70706 )
70707 IS
70708
70709 l_component_type VARCHAR2(80);
70710 l_component_code VARCHAR2(30);
70711 l_component_type_code VARCHAR2(1);
70712 l_component_appl_id INTEGER;
70713 l_amb_context_code VARCHAR2(30);
70714 l_entity_code VARCHAR2(30);
70715 l_event_class_code VARCHAR2(30);
70716 l_ae_header_id NUMBER;
70717 l_event_type_code VARCHAR2(30);
70718 l_line_definition_code VARCHAR2(30);
70719 l_line_definition_owner_code VARCHAR2(1);
70720 --
70721 -- adr variables
70722 l_segment VARCHAR2(30);
70723 l_ccid NUMBER;
70724 l_adr_transaction_coa_id NUMBER;
70725 l_adr_accounting_coa_id NUMBER;
70726 l_adr_flexfield_segment_code VARCHAR2(30);
70727 l_adr_flex_value_set_id NUMBER;
70728 l_adr_value_type_code VARCHAR2(30);
70729 l_adr_value_combination_id NUMBER;
70730 l_adr_value_segment_code VARCHAR2(30);
70731
70732 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
70733 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
70734 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
70735 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
70736
70737 -- 4262811 Variables ------------------------------------------------------------------------------------------
70738 l_entered_amt_idx NUMBER;
70739 l_accted_amt_idx NUMBER;
70740 l_acc_rev_flag VARCHAR2(1);
70741 l_accrual_line_num NUMBER;
70742 l_tmp_amt NUMBER;
70743 l_acc_rev_natural_side_code VARCHAR2(1);
70744
70745 l_num_entries NUMBER;
70746 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
70747 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
70748 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
70749 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
70750 l_recog_line_1 NUMBER;
70751 l_recog_line_2 NUMBER;
70752
70753 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
70754 l_bflow_applied_to_amt NUMBER; -- 5132302
70755 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
70756
70757 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
70758
70759 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
70760 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
70761
70762 ---------------------------------------------------------------------------------------------------------------
70763
70764
70765 --
70766 -- bulk performance
70767 --
70768 l_balance_type_code VARCHAR2(1);
70769 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
70770 l_log_module VARCHAR2(240);
70771
70772 --
70773 -- Upgrade strategy
70774 --
70775 l_actual_upg_option VARCHAR2(1);
70776 l_enc_upg_option VARCHAR2(1);
70777
70778 --
70779 BEGIN
70780 --
70781 IF g_log_enabled THEN
70782 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_263';
70783 END IF;
70784 --
70785 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
70786
70787 trace
70788 (p_msg => 'BEGIN of AcctLineType_263'
70789 ,p_level => C_LEVEL_PROCEDURE
70790 ,p_module => l_log_module);
70791
70792 END IF;
70793 --
70794 l_component_type := 'AMB_JLT';
70795 l_component_code := 'FA_CIP_UNITADJ_SOURCE_COST';
70796 l_component_type_code := 'S';
70797 l_component_appl_id := 140;
70798 l_amb_context_code := 'DEFAULT';
70802 l_line_definition_owner_code := 'S';
70799 l_entity_code := 'TRANSACTIONS';
70800 l_event_class_code := 'CIP_UNIT_ADJUSTMENTS';
70801 l_event_type_code := 'CIP_UNIT_ADJUSTMENTS_ALL';
70803 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_U13';
70804 --
70805 l_balance_type_code := 'A';
70806 l_segment := NULL;
70807 l_ccid := NULL;
70808 l_adr_transaction_coa_id := NULL;
70809 l_adr_accounting_coa_id := NULL;
70810 l_adr_flexfield_segment_code := NULL;
70811 l_adr_flex_value_set_id := NULL;
70812 l_adr_value_type_code := NULL;
70813 l_adr_value_combination_id := NULL;
70814 l_adr_value_segment_code := NULL;
70815
70816 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
70817 l_bflow_class_code := ''; -- 4219869 Business Flow
70818 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
70819 l_budgetary_control_flag := 'N';
70820
70821 l_bflow_applied_to_amt_idx := NULL; -- 5132302
70822 l_bflow_applied_to_amt := NULL; -- 5132302
70823 l_entered_amt_idx := NULL; -- 4262811
70824 l_accted_amt_idx := NULL; -- 4262811
70825 l_acc_rev_flag := NULL; -- 4262811
70826 l_accrual_line_num := NULL; -- 4262811
70827 l_tmp_amt := NULL; -- 4262811
70828 --
70829
70830 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
70831 l_balance_type_code <> 'B' THEN
70832 IF NVL(p_source_48,'
70833 ') = 'CIP COST' AND
70834 NVL(p_source_55,'
70835 ') = 'SOURCE'
70836 THEN
70837
70838 --
70839 XLA_AE_LINES_PKG.SetNewLine;
70840
70841 p_balance_type_code := l_balance_type_code;
70842 -- set the flag so later we will know whether the gain loss line needs to be created
70843
70844 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
70845 p_actual_flag :='A';
70846 END IF;
70847
70848 --
70849 -- bulk performance
70850 --
70851 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
70852 p_header_num => 0); -- 4262811
70853 --
70854 -- set accounting line options
70855 --
70856 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
70857 p_natural_side_code => 'C'
70858 , p_gain_or_loss_flag => 'N'
70859 , p_gl_transfer_mode_code => 'S'
70860 , p_acct_entry_type_code => 'A'
70861 , p_switch_side_flag => 'Y'
70862 , p_merge_duplicate_code => 'N'
70863 );
70864 --
70865 l_acc_rev_natural_side_code := 'D'; -- 4262811
70866 --
70867 --
70868 -- set accounting line type info
70869 --
70870 xla_ae_lines_pkg.SetAcctLineType
70871 (p_component_type => l_component_type
70872 ,p_event_type_code => l_event_type_code
70873 ,p_line_definition_owner_code => l_line_definition_owner_code
70874 ,p_line_definition_code => l_line_definition_code
70875 ,p_accounting_line_code => l_component_code
70876 ,p_accounting_line_type_code => l_component_type_code
70877 ,p_accounting_line_appl_id => l_component_appl_id
70878 ,p_amb_context_code => l_amb_context_code
70879 ,p_entity_code => l_entity_code
70880 ,p_event_class_code => l_event_class_code);
70881 --
70882 -- set accounting class
70883 --
70884 xla_ae_lines_pkg.SetAcctClass(
70885 p_accounting_class_code => 'ASSET'
70886 , p_ae_header_id => l_ae_header_id
70887 );
70888
70889 --
70890 -- set rounding class
70891 --
70892 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
70893 'ASSET';
70894
70895 --
70896 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
70897 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
70898 --
70899 -- bulk performance
70900 --
70901 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
70902
70903 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
70904 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
70905
70906 -- 4955764
70907 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
70908 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
70909
70910 -- 4458381 Public Sector Enh
70911
70912 --
70913 -- set accounting attributes for the line type
70914 --
70915 l_entered_amt_idx := 4;
70916 l_accted_amt_idx := 6;
70917 l_bflow_applied_to_amt_idx := NULL; -- 5132302
70918 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
70919 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
70920 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
70921 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
70922 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
70926 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
70923 l_rec_acct_attrs.array_char_value(3) := p_source_51;
70924 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
70925 l_rec_acct_attrs.array_num_value(4) := p_source_52;
70927 l_rec_acct_attrs.array_char_value(5) := p_source_53;
70928 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
70929 l_rec_acct_attrs.array_num_value(6) := p_source_52;
70930
70931 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
70932 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
70933
70934 ---------------------------------------------------------------------------------------------------------------
70935 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
70936 ---------------------------------------------------------------------------------------------------------------
70937 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
70938
70939 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
70940 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
70941
70942 IF xla_accounting_cache_pkg.GetValueChar
70943 (p_source_code => 'LEDGER_CATEGORY_CODE'
70944 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
70945 AND l_bflow_method_code = 'PRIOR_ENTRY'
70946 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
70947 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
70948 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
70949 )
70950 THEN
70951 xla_ae_lines_pkg.BflowUpgEntry
70952 (p_business_method_code => l_bflow_method_code
70953 ,p_business_class_code => l_bflow_class_code
70954 ,p_balance_type => l_balance_type_code);
70955 ELSE
70956 NULL;
70957 -- No business flow processing for business flow method of NONE.
70958 END IF;
70959
70960 --
70961 -- call analytical criteria
70962 --
70963
70964 --
70965 -- call description
70966 --
70967
70968 xla_ae_lines_pkg.SetLineDescription(
70969 p_ae_header_id => l_ae_header_id
70970 ,p_description => Description_49 (
70971 p_application_id => p_application_id
70972 , p_ae_header_id => l_ae_header_id
70973 , p_source_1 => p_source_1
70974 )
70975 );
70976
70977
70978 --
70979 -- call ADRs
70980 -- Bug 4922099
70981 --
70982 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
70983 (NVL(l_actual_upg_option, 'N') = 'O') OR
70984 (NVL(l_enc_upg_option, 'N') = 'O')
70985 )
70986 THEN
70987 NULL;
70988 --
70989 --
70990
70991 l_ccid := AcctDerRule_174(
70992 p_application_id => p_application_id
70993 , p_ae_header_id => l_ae_header_id
70994 , p_source_5 => p_source_5
70995 , p_source_32 => p_source_32
70996 , x_transaction_coa_id => l_adr_transaction_coa_id
70997 , x_accounting_coa_id => l_adr_accounting_coa_id
70998 , x_value_type_code => l_adr_value_type_code
70999 , p_side => 'NA'
71000 );
71001
71002 xla_ae_lines_pkg.set_ccid(
71003 p_code_combination_id => l_ccid
71004 , p_value_type_code => l_adr_value_type_code
71005 , p_transaction_coa_id => l_adr_transaction_coa_id
71006 , p_accounting_coa_id => l_adr_accounting_coa_id
71007 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
71008 , p_adr_type_code => 'S'
71009 , p_component_type => l_component_type
71010 , p_component_code => l_component_code
71011 , p_component_type_code => l_component_type_code
71012 , p_component_appl_id => l_component_appl_id
71013 , p_amb_context_code => l_amb_context_code
71014 , p_side => 'NA'
71015 );
71016
71017
71018 l_segment := AcctDerRule_147(
71019 p_application_id => p_application_id
71020 , p_ae_header_id => l_ae_header_id
71021 , p_source_5 => p_source_5
71022 , p_source_9 => p_source_9
71023 , x_transaction_coa_id => l_adr_transaction_coa_id
71024 , x_accounting_coa_id => l_adr_accounting_coa_id
71025 , x_flexfield_segment_code => l_adr_flexfield_segment_code
71026 , x_flex_value_set_id => l_adr_flex_value_set_id
71027 , x_value_type_code => l_adr_value_type_code
71028 , x_value_combination_id => l_adr_value_combination_id
71029 , x_value_segment_code => l_adr_value_segment_code
71030 , p_side => 'NA'
71031 , p_override_seg_flag => 'Y'
71032 );
71033
71034 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
71035
71036 xla_ae_lines_pkg.set_segment(
71037 p_to_segment_code => 'GL_ACCOUNT'
71038 , p_segment_value => l_segment
71039 , p_from_segment_code => l_adr_value_segment_code
71040 , p_from_combination_id => l_adr_value_combination_id
71041 , p_value_type_code => l_adr_value_type_code
71045 , p_flex_value_set_id => l_adr_flex_value_set_id
71042 , p_transaction_coa_id => l_adr_transaction_coa_id
71043 , p_accounting_coa_id => l_adr_accounting_coa_id
71044 , p_flexfield_segment_code => l_adr_flexfield_segment_code
71046 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
71047 , p_adr_type_code => 'S'
71048 , p_component_type => l_component_type
71049 , p_component_code => l_component_code
71050 , p_component_type_code => l_component_type_code
71051 , p_component_appl_id => l_component_appl_id
71052 , p_amb_context_code => l_amb_context_code
71053 , p_entity_code => 'TRANSACTIONS'
71054 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
71055 , p_side => 'NA'
71056 );
71057
71058 END IF;
71059
71060 l_segment := AcctDerRule_169(
71061 p_application_id => p_application_id
71062 , p_ae_header_id => l_ae_header_id
71063 , p_source_5 => p_source_5
71064 , p_source_31 => p_source_31
71065 , x_transaction_coa_id => l_adr_transaction_coa_id
71066 , x_accounting_coa_id => l_adr_accounting_coa_id
71067 , x_flexfield_segment_code => l_adr_flexfield_segment_code
71068 , x_flex_value_set_id => l_adr_flex_value_set_id
71069 , x_value_type_code => l_adr_value_type_code
71070 , x_value_combination_id => l_adr_value_combination_id
71071 , x_value_segment_code => l_adr_value_segment_code
71072 , p_side => 'NA'
71073 , p_override_seg_flag => 'Y'
71074 );
71075
71076 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
71077
71078 xla_ae_lines_pkg.set_segment(
71079 p_to_segment_code => 'GL_BALANCING'
71080 , p_segment_value => l_segment
71081 , p_from_segment_code => l_adr_value_segment_code
71082 , p_from_combination_id => l_adr_value_combination_id
71083 , p_value_type_code => l_adr_value_type_code
71084 , p_transaction_coa_id => l_adr_transaction_coa_id
71085 , p_accounting_coa_id => l_adr_accounting_coa_id
71086 , p_flexfield_segment_code => l_adr_flexfield_segment_code
71087 , p_flex_value_set_id => l_adr_flex_value_set_id
71088 , p_adr_code => 'FA_EXPENSE_ACCT'
71089 , p_adr_type_code => 'S'
71090 , p_component_type => l_component_type
71091 , p_component_code => l_component_code
71092 , p_component_type_code => l_component_type_code
71093 , p_component_appl_id => l_component_appl_id
71094 , p_amb_context_code => l_amb_context_code
71095 , p_entity_code => 'TRANSACTIONS'
71096 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
71097 , p_side => 'NA'
71098 );
71099
71100 END IF;
71101
71102 --
71103 --
71104 END IF;
71105 --
71106 -- Bug 4922099
71107 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
71108 (NVL(l_enc_upg_option, 'N') = 'O')
71109 ) AND
71110 (l_bflow_method_code = 'PRIOR_ENTRY')
71111 )
71112 THEN
71113 IF
71114 --
71115 1 = 2
71116 --
71117 THEN
71118 xla_accounting_err_pkg.build_message
71119 (p_appli_s_name => 'XLA'
71120 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
71121 ,p_token_1 => 'LINE_NUMBER'
71122 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
71123 ,p_token_2 => 'LINE_TYPE_NAME'
71124 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
71125 l_component_type
71126 ,l_component_code
71127 ,l_component_type_code
71128 ,l_component_appl_id
71129 ,l_amb_context_code
71130 ,l_entity_code
71131 ,l_event_class_code
71132 )
71133 ,p_token_3 => 'OWNER'
71134 ,p_value_3 => xla_lookups_pkg.get_meaning(
71135 p_lookup_type => 'XLA_OWNER_TYPE'
71136 ,p_lookup_code => l_component_type_code
71137 )
71138 ,p_token_4 => 'PRODUCT_NAME'
71139 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
71143 ,p_ae_header_id => NULL
71140 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
71141 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
71142 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
71144 );
71145
71146 IF (C_LEVEL_ERROR>= g_log_level) THEN
71147 trace
71148 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
71149 ,p_level => C_LEVEL_ERROR
71150 ,p_module => l_log_module);
71151 END IF;
71152 END IF;
71153 END IF;
71154 --
71155 --
71156 ------------------------------------------------------------------------------------------------
71157 -- 4219869 Business Flow
71158 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
71159 -- Prior Entry. Currently, the following code is always generated.
71160 ------------------------------------------------------------------------------------------------
71161 XLA_AE_LINES_PKG.ValidateCurrentLine;
71162
71163 ------------------------------------------------------------------------------------
71164 -- 4219869 Business Flow
71165 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
71166 ------------------------------------------------------------------------------------
71167 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
71168
71169 ----------------------------------------------------------------------------------
71170 -- 4219869 Business Flow
71171 -- Update journal entry status -- Need to generate this within IF <condition>
71172 ----------------------------------------------------------------------------------
71173 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
71174 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
71175 ,p_balance_type_code => l_balance_type_code
71176 );
71177
71178 -------------------------------------------------------------------------------------------
71179 -- 4262811 - Generate the Accrual Reversal lines
71180 -------------------------------------------------------------------------------------------
71181 BEGIN
71182 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
71183 (g_array_event(p_event_id).array_value_num('header_index'));
71184 IF l_acc_rev_flag IS NULL THEN
71185 l_acc_rev_flag := 'N';
71186 END IF;
71187 EXCEPTION
71188 WHEN OTHERS THEN
71189 l_acc_rev_flag := 'N';
71190 END;
71191 --
71192 IF (l_acc_rev_flag = 'Y') THEN
71193
71194 -- 4645092 ------------------------------------------------------------------------------
71195 -- To allow MPA report to determine if it should generate report process
71196 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
71197 ------------------------------------------------------------------------------------------
71198
71199 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
71200 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
71201 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
71202 -- call ADRs
71203 -- Bug 4922099
71204 --
71205 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
71206 (NVL(l_actual_upg_option, 'N') = 'O') OR
71207 (NVL(l_enc_upg_option, 'N') = 'O')
71208 )
71209 THEN
71210 NULL;
71211 --
71212 --
71213
71214 l_ccid := AcctDerRule_174(
71215 p_application_id => p_application_id
71216 , p_ae_header_id => l_ae_header_id
71217 , p_source_5 => p_source_5
71218 , p_source_32 => p_source_32
71219 , x_transaction_coa_id => l_adr_transaction_coa_id
71220 , x_accounting_coa_id => l_adr_accounting_coa_id
71221 , x_value_type_code => l_adr_value_type_code
71222 , p_side => 'NA'
71223 );
71224
71225 xla_ae_lines_pkg.set_ccid(
71226 p_code_combination_id => l_ccid
71227 , p_value_type_code => l_adr_value_type_code
71228 , p_transaction_coa_id => l_adr_transaction_coa_id
71229 , p_accounting_coa_id => l_adr_accounting_coa_id
71230 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
71231 , p_adr_type_code => 'S'
71232 , p_component_type => l_component_type
71233 , p_component_code => l_component_code
71234 , p_component_type_code => l_component_type_code
71235 , p_component_appl_id => l_component_appl_id
71236 , p_amb_context_code => l_amb_context_code
71237 , p_side => 'NA'
71238 );
71239
71240
71241 l_segment := AcctDerRule_147(
71242 p_application_id => p_application_id
71243 , p_ae_header_id => l_ae_header_id
71244 , p_source_5 => p_source_5
71245 , p_source_9 => p_source_9
71246 , x_transaction_coa_id => l_adr_transaction_coa_id
71247 , x_accounting_coa_id => l_adr_accounting_coa_id
71248 , x_flexfield_segment_code => l_adr_flexfield_segment_code
71252 , x_value_segment_code => l_adr_value_segment_code
71249 , x_flex_value_set_id => l_adr_flex_value_set_id
71250 , x_value_type_code => l_adr_value_type_code
71251 , x_value_combination_id => l_adr_value_combination_id
71253 , p_side => 'NA'
71254 , p_override_seg_flag => 'Y'
71255 );
71256
71257 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
71258
71259 xla_ae_lines_pkg.set_segment(
71260 p_to_segment_code => 'GL_ACCOUNT'
71261 , p_segment_value => l_segment
71262 , p_from_segment_code => l_adr_value_segment_code
71263 , p_from_combination_id => l_adr_value_combination_id
71264 , p_value_type_code => l_adr_value_type_code
71265 , p_transaction_coa_id => l_adr_transaction_coa_id
71266 , p_accounting_coa_id => l_adr_accounting_coa_id
71267 , p_flexfield_segment_code => l_adr_flexfield_segment_code
71268 , p_flex_value_set_id => l_adr_flex_value_set_id
71269 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
71270 , p_adr_type_code => 'S'
71271 , p_component_type => l_component_type
71272 , p_component_code => l_component_code
71273 , p_component_type_code => l_component_type_code
71274 , p_component_appl_id => l_component_appl_id
71275 , p_amb_context_code => l_amb_context_code
71276 , p_entity_code => 'TRANSACTIONS'
71277 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
71278 , p_side => 'NA'
71279 );
71280
71281 END IF;
71282
71283 l_segment := AcctDerRule_169(
71284 p_application_id => p_application_id
71285 , p_ae_header_id => l_ae_header_id
71286 , p_source_5 => p_source_5
71287 , p_source_31 => p_source_31
71288 , x_transaction_coa_id => l_adr_transaction_coa_id
71289 , x_accounting_coa_id => l_adr_accounting_coa_id
71290 , x_flexfield_segment_code => l_adr_flexfield_segment_code
71291 , x_flex_value_set_id => l_adr_flex_value_set_id
71292 , x_value_type_code => l_adr_value_type_code
71293 , x_value_combination_id => l_adr_value_combination_id
71294 , x_value_segment_code => l_adr_value_segment_code
71295 , p_side => 'NA'
71296 , p_override_seg_flag => 'Y'
71297 );
71298
71299 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
71300
71301 xla_ae_lines_pkg.set_segment(
71302 p_to_segment_code => 'GL_BALANCING'
71303 , p_segment_value => l_segment
71304 , p_from_segment_code => l_adr_value_segment_code
71305 , p_from_combination_id => l_adr_value_combination_id
71306 , p_value_type_code => l_adr_value_type_code
71307 , p_transaction_coa_id => l_adr_transaction_coa_id
71308 , p_accounting_coa_id => l_adr_accounting_coa_id
71309 , p_flexfield_segment_code => l_adr_flexfield_segment_code
71310 , p_flex_value_set_id => l_adr_flex_value_set_id
71311 , p_adr_code => 'FA_EXPENSE_ACCT'
71312 , p_adr_type_code => 'S'
71313 , p_component_type => l_component_type
71314 , p_component_code => l_component_code
71315 , p_component_type_code => l_component_type_code
71316 , p_component_appl_id => l_component_appl_id
71317 , p_amb_context_code => l_amb_context_code
71318 , p_entity_code => 'TRANSACTIONS'
71319 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
71320 , p_side => 'NA'
71321 );
71322
71323 END IF;
71324
71325 --
71326 --
71327 END IF;
71328
71329 --
71330 -- Update the line information that should be overwritten
71331 --
71332 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
71333 p_header_num => 1);
71334 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
71335
71336 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
71337
71338 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
71339 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
71340 END IF;
71341
71342 --
71343 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
71344 --
71345 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
71346 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
71347 ELSE
71348 ---------------------------------------------------------------------------------------------------
71349 -- 4262811a Switch Sign
71350 ---------------------------------------------------------------------------------------------------
71351 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
71352 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
71356 -- 5132302
71353 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
71354 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
71355 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
71357 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
71358 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
71359
71360 END IF;
71361
71362 -- 4955764
71363 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
71364 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
71365
71366
71367 XLA_AE_LINES_PKG.ValidateCurrentLine;
71368 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
71369
71370 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
71371 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
71372 ,p_balance_type_code => l_balance_type_code);
71373
71374 END IF;
71375
71376 -----------------------------------------------------------------------------------------
71377 -- 4262811 Multiperiod Accounting
71378 -----------------------------------------------------------------------------------------
71379 -- No MPA option is assigned.
71380
71381
71382 END IF;
71383 END IF;
71384 --
71385
71386 --
71387 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
71388 trace
71389 (p_msg => 'END of AcctLineType_263'
71390 ,p_level => C_LEVEL_PROCEDURE
71391 ,p_module => l_log_module);
71392 END IF;
71393 --
71394 EXCEPTION
71395 WHEN xla_exceptions_pkg.application_exception THEN
71396 RAISE;
71397 WHEN OTHERS THEN
71398 xla_exceptions_pkg.raise_message
71399 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_263');
71400 END AcctLineType_263;
71401 --
71402
71403 ---------------------------------------
71404 --
71405 -- PRIVATE FUNCTION
71406 -- AcctLineType_264
71407 --
71408 ---------------------------------------
71409 PROCEDURE AcctLineType_264 (
71410 p_application_id IN NUMBER
71411 ,p_event_id IN NUMBER
71412 ,p_calculate_acctd_flag IN VARCHAR2
71413 ,p_calculate_g_l_flag IN VARCHAR2
71414 ,p_actual_flag IN OUT VARCHAR2
71415 ,p_balance_type_code OUT VARCHAR2
71416 ,p_gain_or_loss_ref OUT VARCHAR2
71417
71418 --Period Close Date
71419 , p_source_1 IN DATE
71420 --Generated Code Combination Identifier
71421 , p_source_5 IN NUMBER
71422 --Revaluation Reserve Account
71423 , p_source_13 IN VARCHAR2
71424 --Generated Offset Code Combination Identifier
71425 , p_source_19 IN NUMBER
71426 --Expense Account Code Combination Identifier
71427 , p_source_31 IN NUMBER
71428 --Default Code Combination Identifier
71429 , p_source_32 IN NUMBER
71430 --Adjustment Type
71431 , p_source_48 IN VARCHAR2
71432 --Transaction Header Identifier
71433 , p_source_49 IN NUMBER
71434 --Adjustment Line Identifier
71435 , p_source_50 IN NUMBER
71436 --Distribution Type Code
71437 , p_source_51 IN VARCHAR2
71438 --Entered Amount
71439 , p_source_52 IN NUMBER
71440 --Currency Code
71441 , p_source_53 IN VARCHAR2
71442 --Source Destination Code
71443 , p_source_55 IN VARCHAR2
71444 )
71445 IS
71446
71447 l_component_type VARCHAR2(80);
71448 l_component_code VARCHAR2(30);
71449 l_component_type_code VARCHAR2(1);
71450 l_component_appl_id INTEGER;
71451 l_amb_context_code VARCHAR2(30);
71452 l_entity_code VARCHAR2(30);
71453 l_event_class_code VARCHAR2(30);
71454 l_ae_header_id NUMBER;
71455 l_event_type_code VARCHAR2(30);
71456 l_line_definition_code VARCHAR2(30);
71457 l_line_definition_owner_code VARCHAR2(1);
71458 --
71459 -- adr variables
71460 l_segment VARCHAR2(30);
71461 l_ccid NUMBER;
71462 l_adr_transaction_coa_id NUMBER;
71463 l_adr_accounting_coa_id NUMBER;
71464 l_adr_flexfield_segment_code VARCHAR2(30);
71465 l_adr_flex_value_set_id NUMBER;
71466 l_adr_value_type_code VARCHAR2(30);
71467 l_adr_value_combination_id NUMBER;
71468 l_adr_value_segment_code VARCHAR2(30);
71469
71470 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
71471 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
71472 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
71473 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
71474
71475 -- 4262811 Variables ------------------------------------------------------------------------------------------
71476 l_entered_amt_idx NUMBER;
71477 l_accted_amt_idx NUMBER;
71478 l_acc_rev_flag VARCHAR2(1);
71479 l_accrual_line_num NUMBER;
71480 l_tmp_amt NUMBER;
71481 l_acc_rev_natural_side_code VARCHAR2(1);
71482
71483 l_num_entries NUMBER;
71484 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
71488 l_recog_line_1 NUMBER;
71485 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
71486 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
71487 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
71489 l_recog_line_2 NUMBER;
71490
71491 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
71492 l_bflow_applied_to_amt NUMBER; -- 5132302
71493 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
71494
71495 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
71496
71497 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
71498 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
71499
71500 ---------------------------------------------------------------------------------------------------------------
71501
71502
71503 --
71504 -- bulk performance
71505 --
71506 l_balance_type_code VARCHAR2(1);
71507 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
71508 l_log_module VARCHAR2(240);
71509
71510 --
71511 -- Upgrade strategy
71512 --
71513 l_actual_upg_option VARCHAR2(1);
71514 l_enc_upg_option VARCHAR2(1);
71515
71516 --
71517 BEGIN
71518 --
71519 IF g_log_enabled THEN
71520 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_264';
71521 END IF;
71522 --
71523 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
71524
71525 trace
71526 (p_msg => 'BEGIN of AcctLineType_264'
71527 ,p_level => C_LEVEL_PROCEDURE
71528 ,p_module => l_log_module);
71529
71530 END IF;
71531 --
71532 l_component_type := 'AMB_JLT';
71533 l_component_code := 'FA_CIP_UNITADJ_SRC_REVAL_RES';
71534 l_component_type_code := 'S';
71535 l_component_appl_id := 140;
71536 l_amb_context_code := 'DEFAULT';
71537 l_entity_code := 'TRANSACTIONS';
71538 l_event_class_code := 'CIP_UNIT_ADJUSTMENTS';
71539 l_event_type_code := 'CIP_UNIT_ADJUSTMENTS_ALL';
71540 l_line_definition_owner_code := 'S';
71541 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_U13';
71542 --
71543 l_balance_type_code := 'A';
71544 l_segment := NULL;
71545 l_ccid := NULL;
71546 l_adr_transaction_coa_id := NULL;
71547 l_adr_accounting_coa_id := NULL;
71548 l_adr_flexfield_segment_code := NULL;
71549 l_adr_flex_value_set_id := NULL;
71550 l_adr_value_type_code := NULL;
71551 l_adr_value_combination_id := NULL;
71552 l_adr_value_segment_code := NULL;
71553
71554 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
71555 l_bflow_class_code := ''; -- 4219869 Business Flow
71556 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
71557 l_budgetary_control_flag := 'N';
71558
71559 l_bflow_applied_to_amt_idx := NULL; -- 5132302
71560 l_bflow_applied_to_amt := NULL; -- 5132302
71561 l_entered_amt_idx := NULL; -- 4262811
71562 l_accted_amt_idx := NULL; -- 4262811
71563 l_acc_rev_flag := NULL; -- 4262811
71564 l_accrual_line_num := NULL; -- 4262811
71565 l_tmp_amt := NULL; -- 4262811
71566 --
71567
71568 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
71569 l_balance_type_code <> 'B' THEN
71570 IF NVL(p_source_48,'
71571 ') = 'REVAL RESERVE' AND
71572 NVL(p_source_55,'
71573 ') = 'SOURCE'
71574 THEN
71575
71576 --
71577 XLA_AE_LINES_PKG.SetNewLine;
71578
71579 p_balance_type_code := l_balance_type_code;
71580 -- set the flag so later we will know whether the gain loss line needs to be created
71581
71582 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
71583 p_actual_flag :='A';
71584 END IF;
71585
71586 --
71587 -- bulk performance
71588 --
71589 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
71590 p_header_num => 0); -- 4262811
71591 --
71592 -- set accounting line options
71593 --
71594 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
71595 p_natural_side_code => 'D'
71596 , p_gain_or_loss_flag => 'N'
71597 , p_gl_transfer_mode_code => 'S'
71598 , p_acct_entry_type_code => 'A'
71599 , p_switch_side_flag => 'Y'
71600 , p_merge_duplicate_code => 'N'
71601 );
71602 --
71603 l_acc_rev_natural_side_code := 'C'; -- 4262811
71604 --
71605 --
71606 -- set accounting line type info
71607 --
71608 xla_ae_lines_pkg.SetAcctLineType
71609 (p_component_type => l_component_type
71610 ,p_event_type_code => l_event_type_code
71611 ,p_line_definition_owner_code => l_line_definition_owner_code
71612 ,p_line_definition_code => l_line_definition_code
71613 ,p_accounting_line_code => l_component_code
71614 ,p_accounting_line_type_code => l_component_type_code
71615 ,p_accounting_line_appl_id => l_component_appl_id
71619 --
71616 ,p_amb_context_code => l_amb_context_code
71617 ,p_entity_code => l_entity_code
71618 ,p_event_class_code => l_event_class_code);
71620 -- set accounting class
71621 --
71622 xla_ae_lines_pkg.SetAcctClass(
71623 p_accounting_class_code => 'ASSET'
71624 , p_ae_header_id => l_ae_header_id
71625 );
71626
71627 --
71628 -- set rounding class
71629 --
71630 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
71631 'ASSET';
71632
71633 --
71634 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
71635 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
71636 --
71637 -- bulk performance
71638 --
71639 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
71640
71641 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
71642 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
71643
71644 -- 4955764
71645 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
71646 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
71647
71648 -- 4458381 Public Sector Enh
71649
71650 --
71651 -- set accounting attributes for the line type
71652 --
71653 l_entered_amt_idx := 4;
71654 l_accted_amt_idx := 6;
71655 l_bflow_applied_to_amt_idx := NULL; -- 5132302
71656 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
71657 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
71658 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
71659 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
71660 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
71661 l_rec_acct_attrs.array_char_value(3) := p_source_51;
71662 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
71663 l_rec_acct_attrs.array_num_value(4) := p_source_52;
71664 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
71665 l_rec_acct_attrs.array_char_value(5) := p_source_53;
71666 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
71667 l_rec_acct_attrs.array_num_value(6) := p_source_52;
71668
71669 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
71670 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
71671
71672 ---------------------------------------------------------------------------------------------------------------
71673 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
71674 ---------------------------------------------------------------------------------------------------------------
71675 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
71676
71677 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
71678 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
71679
71680 IF xla_accounting_cache_pkg.GetValueChar
71681 (p_source_code => 'LEDGER_CATEGORY_CODE'
71682 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
71683 AND l_bflow_method_code = 'PRIOR_ENTRY'
71684 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
71685 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
71686 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
71687 )
71688 THEN
71689 xla_ae_lines_pkg.BflowUpgEntry
71690 (p_business_method_code => l_bflow_method_code
71691 ,p_business_class_code => l_bflow_class_code
71692 ,p_balance_type => l_balance_type_code);
71693 ELSE
71694 NULL;
71695 -- No business flow processing for business flow method of NONE.
71696 END IF;
71697
71698 --
71699 -- call analytical criteria
71700 --
71701
71702 --
71703 -- call description
71704 --
71705
71706 xla_ae_lines_pkg.SetLineDescription(
71707 p_ae_header_id => l_ae_header_id
71708 ,p_description => Description_52 (
71709 p_application_id => p_application_id
71710 , p_ae_header_id => l_ae_header_id
71711 , p_source_1 => p_source_1
71712 )
71713 );
71714
71715
71716 --
71717 -- call ADRs
71718 -- Bug 4922099
71719 --
71720 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
71721 (NVL(l_actual_upg_option, 'N') = 'O') OR
71722 (NVL(l_enc_upg_option, 'N') = 'O')
71723 )
71724 THEN
71725 NULL;
71726 --
71727 --
71728
71729 l_ccid := AcctDerRule_175(
71730 p_application_id => p_application_id
71731 , p_ae_header_id => l_ae_header_id
71732 , p_source_5 => p_source_5
71733 , p_source_19 => p_source_19
71734 , p_source_32 => p_source_32
71735 , x_transaction_coa_id => l_adr_transaction_coa_id
71736 , x_accounting_coa_id => l_adr_accounting_coa_id
71740
71737 , x_value_type_code => l_adr_value_type_code
71738 , p_side => 'NA'
71739 );
71741 xla_ae_lines_pkg.set_ccid(
71742 p_code_combination_id => l_ccid
71743 , p_value_type_code => l_adr_value_type_code
71744 , p_transaction_coa_id => l_adr_transaction_coa_id
71745 , p_accounting_coa_id => l_adr_accounting_coa_id
71746 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
71747 , p_adr_type_code => 'S'
71748 , p_component_type => l_component_type
71749 , p_component_code => l_component_code
71750 , p_component_type_code => l_component_type_code
71751 , p_component_appl_id => l_component_appl_id
71752 , p_amb_context_code => l_amb_context_code
71753 , p_side => 'NA'
71754 );
71755
71756
71757 l_segment := AcctDerRule_151(
71758 p_application_id => p_application_id
71759 , p_ae_header_id => l_ae_header_id
71760 , p_source_5 => p_source_5
71761 , p_source_13 => p_source_13
71762 , x_transaction_coa_id => l_adr_transaction_coa_id
71763 , x_accounting_coa_id => l_adr_accounting_coa_id
71764 , x_flexfield_segment_code => l_adr_flexfield_segment_code
71765 , x_flex_value_set_id => l_adr_flex_value_set_id
71766 , x_value_type_code => l_adr_value_type_code
71767 , x_value_combination_id => l_adr_value_combination_id
71768 , x_value_segment_code => l_adr_value_segment_code
71769 , p_side => 'NA'
71770 , p_override_seg_flag => 'Y'
71771 );
71772
71773 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
71774
71775 xla_ae_lines_pkg.set_segment(
71776 p_to_segment_code => 'GL_ACCOUNT'
71777 , p_segment_value => l_segment
71778 , p_from_segment_code => l_adr_value_segment_code
71779 , p_from_combination_id => l_adr_value_combination_id
71780 , p_value_type_code => l_adr_value_type_code
71781 , p_transaction_coa_id => l_adr_transaction_coa_id
71782 , p_accounting_coa_id => l_adr_accounting_coa_id
71783 , p_flexfield_segment_code => l_adr_flexfield_segment_code
71784 , p_flex_value_set_id => l_adr_flex_value_set_id
71785 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
71786 , p_adr_type_code => 'S'
71787 , p_component_type => l_component_type
71788 , p_component_code => l_component_code
71789 , p_component_type_code => l_component_type_code
71790 , p_component_appl_id => l_component_appl_id
71791 , p_amb_context_code => l_amb_context_code
71792 , p_entity_code => 'TRANSACTIONS'
71793 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
71794 , p_side => 'NA'
71795 );
71796
71797 END IF;
71798
71799 l_segment := AcctDerRule_169(
71800 p_application_id => p_application_id
71801 , p_ae_header_id => l_ae_header_id
71802 , p_source_5 => p_source_5
71803 , p_source_31 => p_source_31
71804 , x_transaction_coa_id => l_adr_transaction_coa_id
71805 , x_accounting_coa_id => l_adr_accounting_coa_id
71806 , x_flexfield_segment_code => l_adr_flexfield_segment_code
71807 , x_flex_value_set_id => l_adr_flex_value_set_id
71808 , x_value_type_code => l_adr_value_type_code
71809 , x_value_combination_id => l_adr_value_combination_id
71810 , x_value_segment_code => l_adr_value_segment_code
71811 , p_side => 'NA'
71812 , p_override_seg_flag => 'Y'
71813 );
71814
71815 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
71816
71817 xla_ae_lines_pkg.set_segment(
71818 p_to_segment_code => 'GL_BALANCING'
71819 , p_segment_value => l_segment
71820 , p_from_segment_code => l_adr_value_segment_code
71821 , p_from_combination_id => l_adr_value_combination_id
71822 , p_value_type_code => l_adr_value_type_code
71823 , p_transaction_coa_id => l_adr_transaction_coa_id
71824 , p_accounting_coa_id => l_adr_accounting_coa_id
71825 , p_flexfield_segment_code => l_adr_flexfield_segment_code
71826 , p_flex_value_set_id => l_adr_flex_value_set_id
71827 , p_adr_code => 'FA_EXPENSE_ACCT'
71828 , p_adr_type_code => 'S'
71829 , p_component_type => l_component_type
71830 , p_component_code => l_component_code
71831 , p_component_type_code => l_component_type_code
71832 , p_component_appl_id => l_component_appl_id
71833 , p_amb_context_code => l_amb_context_code
71834 , p_entity_code => 'TRANSACTIONS'
71835 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
71836 , p_side => 'NA'
71837 );
71838
71839 END IF;
71840
71841 --
71842 --
71843 END IF;
71844 --
71845 -- Bug 4922099
71846 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
71850 )
71847 (NVL(l_enc_upg_option, 'N') = 'O')
71848 ) AND
71849 (l_bflow_method_code = 'PRIOR_ENTRY')
71851 THEN
71852 IF
71853 --
71854 1 = 2
71855 --
71856 THEN
71857 xla_accounting_err_pkg.build_message
71858 (p_appli_s_name => 'XLA'
71859 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
71860 ,p_token_1 => 'LINE_NUMBER'
71861 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
71862 ,p_token_2 => 'LINE_TYPE_NAME'
71863 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
71864 l_component_type
71865 ,l_component_code
71866 ,l_component_type_code
71867 ,l_component_appl_id
71868 ,l_amb_context_code
71869 ,l_entity_code
71870 ,l_event_class_code
71871 )
71872 ,p_token_3 => 'OWNER'
71873 ,p_value_3 => xla_lookups_pkg.get_meaning(
71874 p_lookup_type => 'XLA_OWNER_TYPE'
71875 ,p_lookup_code => l_component_type_code
71876 )
71877 ,p_token_4 => 'PRODUCT_NAME'
71878 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
71879 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
71880 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
71881 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
71882 ,p_ae_header_id => NULL
71883 );
71884
71885 IF (C_LEVEL_ERROR>= g_log_level) THEN
71886 trace
71887 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
71888 ,p_level => C_LEVEL_ERROR
71889 ,p_module => l_log_module);
71890 END IF;
71891 END IF;
71892 END IF;
71893 --
71894 --
71895 ------------------------------------------------------------------------------------------------
71896 -- 4219869 Business Flow
71897 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
71898 -- Prior Entry. Currently, the following code is always generated.
71899 ------------------------------------------------------------------------------------------------
71900 XLA_AE_LINES_PKG.ValidateCurrentLine;
71901
71902 ------------------------------------------------------------------------------------
71903 -- 4219869 Business Flow
71904 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
71905 ------------------------------------------------------------------------------------
71906 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
71907
71908 ----------------------------------------------------------------------------------
71909 -- 4219869 Business Flow
71910 -- Update journal entry status -- Need to generate this within IF <condition>
71911 ----------------------------------------------------------------------------------
71912 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
71913 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
71914 ,p_balance_type_code => l_balance_type_code
71915 );
71916
71917 -------------------------------------------------------------------------------------------
71918 -- 4262811 - Generate the Accrual Reversal lines
71919 -------------------------------------------------------------------------------------------
71920 BEGIN
71921 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
71922 (g_array_event(p_event_id).array_value_num('header_index'));
71923 IF l_acc_rev_flag IS NULL THEN
71924 l_acc_rev_flag := 'N';
71925 END IF;
71926 EXCEPTION
71927 WHEN OTHERS THEN
71928 l_acc_rev_flag := 'N';
71929 END;
71930 --
71931 IF (l_acc_rev_flag = 'Y') THEN
71932
71933 -- 4645092 ------------------------------------------------------------------------------
71934 -- To allow MPA report to determine if it should generate report process
71935 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
71936 ------------------------------------------------------------------------------------------
71937
71938 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
71939 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
71940 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
71944 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
71941 -- call ADRs
71942 -- Bug 4922099
71943 --
71945 (NVL(l_actual_upg_option, 'N') = 'O') OR
71946 (NVL(l_enc_upg_option, 'N') = 'O')
71947 )
71948 THEN
71949 NULL;
71950 --
71951 --
71952
71953 l_ccid := AcctDerRule_175(
71954 p_application_id => p_application_id
71955 , p_ae_header_id => l_ae_header_id
71956 , p_source_5 => p_source_5
71957 , p_source_19 => p_source_19
71958 , p_source_32 => p_source_32
71959 , x_transaction_coa_id => l_adr_transaction_coa_id
71960 , x_accounting_coa_id => l_adr_accounting_coa_id
71961 , x_value_type_code => l_adr_value_type_code
71962 , p_side => 'NA'
71963 );
71964
71965 xla_ae_lines_pkg.set_ccid(
71966 p_code_combination_id => l_ccid
71967 , p_value_type_code => l_adr_value_type_code
71968 , p_transaction_coa_id => l_adr_transaction_coa_id
71969 , p_accounting_coa_id => l_adr_accounting_coa_id
71970 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
71971 , p_adr_type_code => 'S'
71972 , p_component_type => l_component_type
71973 , p_component_code => l_component_code
71974 , p_component_type_code => l_component_type_code
71975 , p_component_appl_id => l_component_appl_id
71976 , p_amb_context_code => l_amb_context_code
71977 , p_side => 'NA'
71978 );
71979
71980
71981 l_segment := AcctDerRule_151(
71982 p_application_id => p_application_id
71983 , p_ae_header_id => l_ae_header_id
71984 , p_source_5 => p_source_5
71985 , p_source_13 => p_source_13
71986 , x_transaction_coa_id => l_adr_transaction_coa_id
71987 , x_accounting_coa_id => l_adr_accounting_coa_id
71988 , x_flexfield_segment_code => l_adr_flexfield_segment_code
71989 , x_flex_value_set_id => l_adr_flex_value_set_id
71990 , x_value_type_code => l_adr_value_type_code
71991 , x_value_combination_id => l_adr_value_combination_id
71992 , x_value_segment_code => l_adr_value_segment_code
71993 , p_side => 'NA'
71994 , p_override_seg_flag => 'Y'
71995 );
71996
71997 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
71998
71999 xla_ae_lines_pkg.set_segment(
72000 p_to_segment_code => 'GL_ACCOUNT'
72001 , p_segment_value => l_segment
72002 , p_from_segment_code => l_adr_value_segment_code
72003 , p_from_combination_id => l_adr_value_combination_id
72004 , p_value_type_code => l_adr_value_type_code
72005 , p_transaction_coa_id => l_adr_transaction_coa_id
72006 , p_accounting_coa_id => l_adr_accounting_coa_id
72007 , p_flexfield_segment_code => l_adr_flexfield_segment_code
72008 , p_flex_value_set_id => l_adr_flex_value_set_id
72009 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
72010 , p_adr_type_code => 'S'
72011 , p_component_type => l_component_type
72012 , p_component_code => l_component_code
72013 , p_component_type_code => l_component_type_code
72014 , p_component_appl_id => l_component_appl_id
72015 , p_amb_context_code => l_amb_context_code
72016 , p_entity_code => 'TRANSACTIONS'
72017 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
72018 , p_side => 'NA'
72019 );
72020
72021 END IF;
72022
72023 l_segment := AcctDerRule_169(
72024 p_application_id => p_application_id
72025 , p_ae_header_id => l_ae_header_id
72026 , p_source_5 => p_source_5
72027 , p_source_31 => p_source_31
72028 , x_transaction_coa_id => l_adr_transaction_coa_id
72029 , x_accounting_coa_id => l_adr_accounting_coa_id
72030 , x_flexfield_segment_code => l_adr_flexfield_segment_code
72031 , x_flex_value_set_id => l_adr_flex_value_set_id
72032 , x_value_type_code => l_adr_value_type_code
72033 , x_value_combination_id => l_adr_value_combination_id
72034 , x_value_segment_code => l_adr_value_segment_code
72035 , p_side => 'NA'
72036 , p_override_seg_flag => 'Y'
72037 );
72038
72039 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
72040
72041 xla_ae_lines_pkg.set_segment(
72042 p_to_segment_code => 'GL_BALANCING'
72043 , p_segment_value => l_segment
72044 , p_from_segment_code => l_adr_value_segment_code
72045 , p_from_combination_id => l_adr_value_combination_id
72046 , p_value_type_code => l_adr_value_type_code
72047 , p_transaction_coa_id => l_adr_transaction_coa_id
72048 , p_accounting_coa_id => l_adr_accounting_coa_id
72049 , p_flexfield_segment_code => l_adr_flexfield_segment_code
72050 , p_flex_value_set_id => l_adr_flex_value_set_id
72051 , p_adr_code => 'FA_EXPENSE_ACCT'
72052 , p_adr_type_code => 'S'
72053 , p_component_type => l_component_type
72057 , p_amb_context_code => l_amb_context_code
72054 , p_component_code => l_component_code
72055 , p_component_type_code => l_component_type_code
72056 , p_component_appl_id => l_component_appl_id
72058 , p_entity_code => 'TRANSACTIONS'
72059 , p_event_class_code => 'CIP_UNIT_ADJUSTMENTS'
72060 , p_side => 'NA'
72061 );
72062
72063 END IF;
72064
72065 --
72066 --
72067 END IF;
72068
72069 --
72070 -- Update the line information that should be overwritten
72071 --
72072 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
72073 p_header_num => 1);
72074 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
72075
72076 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
72077
72078 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
72079 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
72080 END IF;
72081
72082 --
72083 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
72084 --
72085 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
72086 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
72087 ELSE
72088 ---------------------------------------------------------------------------------------------------
72089 -- 4262811a Switch Sign
72090 ---------------------------------------------------------------------------------------------------
72091 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
72092 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
72093 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
72094 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
72095 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
72096 -- 5132302
72097 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
72098 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
72099
72100 END IF;
72101
72102 -- 4955764
72103 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
72104 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
72105
72106
72107 XLA_AE_LINES_PKG.ValidateCurrentLine;
72108 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
72109
72110 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
72111 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
72112 ,p_balance_type_code => l_balance_type_code);
72113
72114 END IF;
72115
72116 -----------------------------------------------------------------------------------------
72117 -- 4262811 Multiperiod Accounting
72118 -----------------------------------------------------------------------------------------
72119 -- No MPA option is assigned.
72120
72121
72122 END IF;
72123 END IF;
72124 --
72125
72126 --
72127 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
72128 trace
72129 (p_msg => 'END of AcctLineType_264'
72130 ,p_level => C_LEVEL_PROCEDURE
72131 ,p_module => l_log_module);
72132 END IF;
72133 --
72134 EXCEPTION
72135 WHEN xla_exceptions_pkg.application_exception THEN
72136 RAISE;
72137 WHEN OTHERS THEN
72138 xla_exceptions_pkg.raise_message
72139 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_264');
72140 END AcctLineType_264;
72141 --
72142
72143 ---------------------------------------
72144 --
72145 -- PRIVATE FUNCTION
72146 -- AcctLineType_265
72147 --
72148 ---------------------------------------
72149 PROCEDURE AcctLineType_265 (
72150 p_application_id IN NUMBER
72151 ,p_event_id IN NUMBER
72152 ,p_calculate_acctd_flag IN VARCHAR2
72153 ,p_calculate_g_l_flag IN VARCHAR2
72154 ,p_actual_flag IN OUT VARCHAR2
72155 ,p_balance_type_code OUT VARCHAR2
72156 ,p_gain_or_loss_ref OUT VARCHAR2
72157
72158 --Period Close Date
72159 , p_source_1 IN DATE
72160 --Generated Code Combination Identifier
72161 , p_source_5 IN NUMBER
72162 --Cost Of Removal Clearing Account
72163 , p_source_14 IN VARCHAR2
72164 --Expense Account Code Combination Identifier
72165 , p_source_31 IN NUMBER
72166 --Default Code Combination Identifier
72167 , p_source_32 IN NUMBER
72168 --Adjustment Type
72169 , p_source_48 IN VARCHAR2
72170 --Transaction Header Identifier
72171 , p_source_49 IN NUMBER
72172 --Adjustment Line Identifier
72173 , p_source_50 IN NUMBER
72174 --Distribution Type Code
72175 , p_source_51 IN VARCHAR2
72176 --Entered Amount
72177 , p_source_52 IN NUMBER
72181 IS
72178 --Currency Code
72179 , p_source_53 IN VARCHAR2
72180 )
72182
72183 l_component_type VARCHAR2(80);
72184 l_component_code VARCHAR2(30);
72185 l_component_type_code VARCHAR2(1);
72186 l_component_appl_id INTEGER;
72187 l_amb_context_code VARCHAR2(30);
72188 l_entity_code VARCHAR2(30);
72189 l_event_class_code VARCHAR2(30);
72190 l_ae_header_id NUMBER;
72191 l_event_type_code VARCHAR2(30);
72192 l_line_definition_code VARCHAR2(30);
72193 l_line_definition_owner_code VARCHAR2(1);
72194 --
72195 -- adr variables
72196 l_segment VARCHAR2(30);
72197 l_ccid NUMBER;
72198 l_adr_transaction_coa_id NUMBER;
72199 l_adr_accounting_coa_id NUMBER;
72200 l_adr_flexfield_segment_code VARCHAR2(30);
72201 l_adr_flex_value_set_id NUMBER;
72202 l_adr_value_type_code VARCHAR2(30);
72203 l_adr_value_combination_id NUMBER;
72204 l_adr_value_segment_code VARCHAR2(30);
72205
72206 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
72207 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
72208 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
72209 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
72210
72211 -- 4262811 Variables ------------------------------------------------------------------------------------------
72212 l_entered_amt_idx NUMBER;
72213 l_accted_amt_idx NUMBER;
72214 l_acc_rev_flag VARCHAR2(1);
72215 l_accrual_line_num NUMBER;
72216 l_tmp_amt NUMBER;
72217 l_acc_rev_natural_side_code VARCHAR2(1);
72218
72219 l_num_entries NUMBER;
72220 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
72221 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
72222 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
72223 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
72224 l_recog_line_1 NUMBER;
72225 l_recog_line_2 NUMBER;
72226
72227 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
72228 l_bflow_applied_to_amt NUMBER; -- 5132302
72229 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
72230
72231 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
72232
72233 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
72234 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
72235
72236 ---------------------------------------------------------------------------------------------------------------
72237
72238
72239 --
72240 -- bulk performance
72241 --
72242 l_balance_type_code VARCHAR2(1);
72243 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
72244 l_log_module VARCHAR2(240);
72245
72246 --
72247 -- Upgrade strategy
72248 --
72249 l_actual_upg_option VARCHAR2(1);
72250 l_enc_upg_option VARCHAR2(1);
72251
72252 --
72253 BEGIN
72254 --
72255 IF g_log_enabled THEN
72256 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_265';
72257 END IF;
72258 --
72259 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
72260
72261 trace
72262 (p_msg => 'BEGIN of AcctLineType_265'
72263 ,p_level => C_LEVEL_PROCEDURE
72264 ,p_module => l_log_module);
72265
72266 END IF;
72267 --
72268 l_component_type := 'AMB_JLT';
72269 l_component_code := 'FA_COST_OF_REMOVAL_CLR';
72270 l_component_type_code := 'S';
72271 l_component_appl_id := 140;
72272 l_amb_context_code := 'DEFAULT';
72273 l_entity_code := 'TRANSACTIONS';
72274 l_event_class_code := 'RETIREMENTS';
72275 l_event_type_code := 'RETIREMENTS';
72276 l_line_definition_owner_code := 'S';
72277 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
72278 --
72279 l_balance_type_code := 'A';
72280 l_segment := NULL;
72281 l_ccid := NULL;
72282 l_adr_transaction_coa_id := NULL;
72283 l_adr_accounting_coa_id := NULL;
72284 l_adr_flexfield_segment_code := NULL;
72285 l_adr_flex_value_set_id := NULL;
72286 l_adr_value_type_code := NULL;
72287 l_adr_value_combination_id := NULL;
72288 l_adr_value_segment_code := NULL;
72289
72290 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
72291 l_bflow_class_code := ''; -- 4219869 Business Flow
72292 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
72293 l_budgetary_control_flag := 'N';
72294
72295 l_bflow_applied_to_amt_idx := NULL; -- 5132302
72296 l_bflow_applied_to_amt := NULL; -- 5132302
72297 l_entered_amt_idx := NULL; -- 4262811
72298 l_accted_amt_idx := NULL; -- 4262811
72299 l_acc_rev_flag := NULL; -- 4262811
72300 l_accrual_line_num := NULL; -- 4262811
72301 l_tmp_amt := NULL; -- 4262811
72302 --
72303
72307 ') = 'REMOVALCOST CLR'
72304 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
72305 l_balance_type_code <> 'B' THEN
72306 IF NVL(p_source_48,'
72308 THEN
72309
72310 --
72311 XLA_AE_LINES_PKG.SetNewLine;
72312
72313 p_balance_type_code := l_balance_type_code;
72314 -- set the flag so later we will know whether the gain loss line needs to be created
72315
72316 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
72317 p_actual_flag :='A';
72318 END IF;
72319
72320 --
72321 -- bulk performance
72322 --
72323 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
72324 p_header_num => 0); -- 4262811
72325 --
72326 -- set accounting line options
72327 --
72328 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
72329 p_natural_side_code => 'C'
72330 , p_gain_or_loss_flag => 'N'
72331 , p_gl_transfer_mode_code => 'S'
72332 , p_acct_entry_type_code => 'A'
72333 , p_switch_side_flag => 'Y'
72334 , p_merge_duplicate_code => 'N'
72335 );
72336 --
72337 l_acc_rev_natural_side_code := 'D'; -- 4262811
72338 --
72339 --
72340 -- set accounting line type info
72341 --
72342 xla_ae_lines_pkg.SetAcctLineType
72343 (p_component_type => l_component_type
72344 ,p_event_type_code => l_event_type_code
72345 ,p_line_definition_owner_code => l_line_definition_owner_code
72346 ,p_line_definition_code => l_line_definition_code
72347 ,p_accounting_line_code => l_component_code
72348 ,p_accounting_line_type_code => l_component_type_code
72349 ,p_accounting_line_appl_id => l_component_appl_id
72350 ,p_amb_context_code => l_amb_context_code
72351 ,p_entity_code => l_entity_code
72352 ,p_event_class_code => l_event_class_code);
72353 --
72354 -- set accounting class
72355 --
72356 xla_ae_lines_pkg.SetAcctClass(
72357 p_accounting_class_code => 'ASSET'
72358 , p_ae_header_id => l_ae_header_id
72359 );
72360
72361 --
72362 -- set rounding class
72363 --
72364 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
72365 'ASSET';
72366
72367 --
72368 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
72369 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
72370 --
72371 -- bulk performance
72372 --
72373 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
72374
72375 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
72376 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
72377
72378 -- 4955764
72379 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
72380 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
72381
72382 -- 4458381 Public Sector Enh
72383
72384 --
72385 -- set accounting attributes for the line type
72386 --
72387 l_entered_amt_idx := 4;
72388 l_accted_amt_idx := 6;
72389 l_bflow_applied_to_amt_idx := NULL; -- 5132302
72390 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
72391 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
72392 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
72393 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
72394 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
72395 l_rec_acct_attrs.array_char_value(3) := p_source_51;
72396 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
72397 l_rec_acct_attrs.array_num_value(4) := p_source_52;
72398 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
72399 l_rec_acct_attrs.array_char_value(5) := p_source_53;
72400 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
72401 l_rec_acct_attrs.array_num_value(6) := p_source_52;
72402
72403 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
72404 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
72405
72406 ---------------------------------------------------------------------------------------------------------------
72407 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
72408 ---------------------------------------------------------------------------------------------------------------
72409 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
72410
72411 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
72412 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
72413
72414 IF xla_accounting_cache_pkg.GetValueChar
72415 (p_source_code => 'LEDGER_CATEGORY_CODE'
72416 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
72417 AND l_bflow_method_code = 'PRIOR_ENTRY'
72421 )
72418 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
72419 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
72420 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
72422 THEN
72423 xla_ae_lines_pkg.BflowUpgEntry
72424 (p_business_method_code => l_bflow_method_code
72425 ,p_business_class_code => l_bflow_class_code
72426 ,p_balance_type => l_balance_type_code);
72427 ELSE
72428 NULL;
72429 -- No business flow processing for business flow method of NONE.
72430 END IF;
72431
72432 --
72433 -- call analytical criteria
72434 --
72435
72436 --
72437 -- call description
72438 --
72439
72440 xla_ae_lines_pkg.SetLineDescription(
72441 p_ae_header_id => l_ae_header_id
72442 ,p_description => Description_87 (
72443 p_application_id => p_application_id
72444 , p_ae_header_id => l_ae_header_id
72445 , p_source_1 => p_source_1
72446 )
72447 );
72448
72449
72450 --
72451 -- call ADRs
72452 -- Bug 4922099
72453 --
72454 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
72455 (NVL(l_actual_upg_option, 'N') = 'O') OR
72456 (NVL(l_enc_upg_option, 'N') = 'O')
72457 )
72458 THEN
72459 NULL;
72460 --
72461 --
72462
72463 l_ccid := AcctDerRule_174(
72464 p_application_id => p_application_id
72465 , p_ae_header_id => l_ae_header_id
72466 , p_source_5 => p_source_5
72467 , p_source_32 => p_source_32
72468 , x_transaction_coa_id => l_adr_transaction_coa_id
72469 , x_accounting_coa_id => l_adr_accounting_coa_id
72470 , x_value_type_code => l_adr_value_type_code
72471 , p_side => 'NA'
72472 );
72473
72474 xla_ae_lines_pkg.set_ccid(
72475 p_code_combination_id => l_ccid
72476 , p_value_type_code => l_adr_value_type_code
72477 , p_transaction_coa_id => l_adr_transaction_coa_id
72478 , p_accounting_coa_id => l_adr_accounting_coa_id
72479 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
72480 , p_adr_type_code => 'S'
72481 , p_component_type => l_component_type
72482 , p_component_code => l_component_code
72483 , p_component_type_code => l_component_type_code
72484 , p_component_appl_id => l_component_appl_id
72485 , p_amb_context_code => l_amb_context_code
72486 , p_side => 'NA'
72487 );
72488
72489
72490 l_segment := AcctDerRule_152(
72491 p_application_id => p_application_id
72492 , p_ae_header_id => l_ae_header_id
72493 , p_source_5 => p_source_5
72494 , p_source_14 => p_source_14
72495 , x_transaction_coa_id => l_adr_transaction_coa_id
72496 , x_accounting_coa_id => l_adr_accounting_coa_id
72497 , x_flexfield_segment_code => l_adr_flexfield_segment_code
72498 , x_flex_value_set_id => l_adr_flex_value_set_id
72499 , x_value_type_code => l_adr_value_type_code
72500 , x_value_combination_id => l_adr_value_combination_id
72501 , x_value_segment_code => l_adr_value_segment_code
72502 , p_side => 'NA'
72503 , p_override_seg_flag => 'Y'
72504 );
72505
72506 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
72507
72508 xla_ae_lines_pkg.set_segment(
72509 p_to_segment_code => 'GL_ACCOUNT'
72510 , p_segment_value => l_segment
72511 , p_from_segment_code => l_adr_value_segment_code
72512 , p_from_combination_id => l_adr_value_combination_id
72513 , p_value_type_code => l_adr_value_type_code
72514 , p_transaction_coa_id => l_adr_transaction_coa_id
72515 , p_accounting_coa_id => l_adr_accounting_coa_id
72516 , p_flexfield_segment_code => l_adr_flexfield_segment_code
72517 , p_flex_value_set_id => l_adr_flex_value_set_id
72518 , p_adr_code => 'FA_COST_OF_REMOVAL_CLR_SEGMENT'
72519 , p_adr_type_code => 'S'
72520 , p_component_type => l_component_type
72521 , p_component_code => l_component_code
72522 , p_component_type_code => l_component_type_code
72523 , p_component_appl_id => l_component_appl_id
72524 , p_amb_context_code => l_amb_context_code
72525 , p_entity_code => 'TRANSACTIONS'
72526 , p_event_class_code => 'RETIREMENTS'
72527 , p_side => 'NA'
72528 );
72529
72530 END IF;
72531
72532 l_segment := AcctDerRule_169(
72533 p_application_id => p_application_id
72534 , p_ae_header_id => l_ae_header_id
72535 , p_source_5 => p_source_5
72536 , p_source_31 => p_source_31
72537 , x_transaction_coa_id => l_adr_transaction_coa_id
72538 , x_accounting_coa_id => l_adr_accounting_coa_id
72539 , x_flexfield_segment_code => l_adr_flexfield_segment_code
72540 , x_flex_value_set_id => l_adr_flex_value_set_id
72541 , x_value_type_code => l_adr_value_type_code
72545 , p_override_seg_flag => 'Y'
72542 , x_value_combination_id => l_adr_value_combination_id
72543 , x_value_segment_code => l_adr_value_segment_code
72544 , p_side => 'NA'
72546 );
72547
72548 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
72549
72550 xla_ae_lines_pkg.set_segment(
72551 p_to_segment_code => 'GL_BALANCING'
72552 , p_segment_value => l_segment
72553 , p_from_segment_code => l_adr_value_segment_code
72554 , p_from_combination_id => l_adr_value_combination_id
72555 , p_value_type_code => l_adr_value_type_code
72556 , p_transaction_coa_id => l_adr_transaction_coa_id
72557 , p_accounting_coa_id => l_adr_accounting_coa_id
72558 , p_flexfield_segment_code => l_adr_flexfield_segment_code
72559 , p_flex_value_set_id => l_adr_flex_value_set_id
72560 , p_adr_code => 'FA_EXPENSE_ACCT'
72561 , p_adr_type_code => 'S'
72562 , p_component_type => l_component_type
72563 , p_component_code => l_component_code
72564 , p_component_type_code => l_component_type_code
72565 , p_component_appl_id => l_component_appl_id
72566 , p_amb_context_code => l_amb_context_code
72567 , p_entity_code => 'TRANSACTIONS'
72568 , p_event_class_code => 'RETIREMENTS'
72569 , p_side => 'NA'
72570 );
72571
72572 END IF;
72573
72574 --
72575 --
72576 END IF;
72577 --
72578 -- Bug 4922099
72579 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
72580 (NVL(l_enc_upg_option, 'N') = 'O')
72581 ) AND
72582 (l_bflow_method_code = 'PRIOR_ENTRY')
72583 )
72584 THEN
72585 IF
72586 --
72587 1 = 2
72588 --
72589 THEN
72590 xla_accounting_err_pkg.build_message
72591 (p_appli_s_name => 'XLA'
72592 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
72593 ,p_token_1 => 'LINE_NUMBER'
72594 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
72595 ,p_token_2 => 'LINE_TYPE_NAME'
72596 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
72597 l_component_type
72598 ,l_component_code
72599 ,l_component_type_code
72600 ,l_component_appl_id
72601 ,l_amb_context_code
72602 ,l_entity_code
72603 ,l_event_class_code
72604 )
72605 ,p_token_3 => 'OWNER'
72606 ,p_value_3 => xla_lookups_pkg.get_meaning(
72607 p_lookup_type => 'XLA_OWNER_TYPE'
72608 ,p_lookup_code => l_component_type_code
72609 )
72610 ,p_token_4 => 'PRODUCT_NAME'
72611 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
72612 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
72613 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
72614 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
72615 ,p_ae_header_id => NULL
72616 );
72617
72618 IF (C_LEVEL_ERROR>= g_log_level) THEN
72619 trace
72620 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
72621 ,p_level => C_LEVEL_ERROR
72622 ,p_module => l_log_module);
72623 END IF;
72624 END IF;
72625 END IF;
72626 --
72627 --
72628 ------------------------------------------------------------------------------------------------
72629 -- 4219869 Business Flow
72630 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
72631 -- Prior Entry. Currently, the following code is always generated.
72632 ------------------------------------------------------------------------------------------------
72633 XLA_AE_LINES_PKG.ValidateCurrentLine;
72634
72635 ------------------------------------------------------------------------------------
72636 -- 4219869 Business Flow
72637 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
72638 ------------------------------------------------------------------------------------
72642 -- 4219869 Business Flow
72639 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
72640
72641 ----------------------------------------------------------------------------------
72643 -- Update journal entry status -- Need to generate this within IF <condition>
72644 ----------------------------------------------------------------------------------
72645 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
72646 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
72647 ,p_balance_type_code => l_balance_type_code
72648 );
72649
72650 -------------------------------------------------------------------------------------------
72651 -- 4262811 - Generate the Accrual Reversal lines
72652 -------------------------------------------------------------------------------------------
72653 BEGIN
72654 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
72655 (g_array_event(p_event_id).array_value_num('header_index'));
72656 IF l_acc_rev_flag IS NULL THEN
72657 l_acc_rev_flag := 'N';
72658 END IF;
72659 EXCEPTION
72660 WHEN OTHERS THEN
72661 l_acc_rev_flag := 'N';
72662 END;
72663 --
72664 IF (l_acc_rev_flag = 'Y') THEN
72665
72666 -- 4645092 ------------------------------------------------------------------------------
72667 -- To allow MPA report to determine if it should generate report process
72668 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
72669 ------------------------------------------------------------------------------------------
72670
72671 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
72672 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
72673 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
72674 -- call ADRs
72675 -- Bug 4922099
72676 --
72677 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
72678 (NVL(l_actual_upg_option, 'N') = 'O') OR
72679 (NVL(l_enc_upg_option, 'N') = 'O')
72680 )
72681 THEN
72682 NULL;
72683 --
72684 --
72685
72686 l_ccid := AcctDerRule_174(
72687 p_application_id => p_application_id
72688 , p_ae_header_id => l_ae_header_id
72689 , p_source_5 => p_source_5
72690 , p_source_32 => p_source_32
72691 , x_transaction_coa_id => l_adr_transaction_coa_id
72692 , x_accounting_coa_id => l_adr_accounting_coa_id
72693 , x_value_type_code => l_adr_value_type_code
72694 , p_side => 'NA'
72695 );
72696
72697 xla_ae_lines_pkg.set_ccid(
72698 p_code_combination_id => l_ccid
72699 , p_value_type_code => l_adr_value_type_code
72700 , p_transaction_coa_id => l_adr_transaction_coa_id
72701 , p_accounting_coa_id => l_adr_accounting_coa_id
72702 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
72703 , p_adr_type_code => 'S'
72704 , p_component_type => l_component_type
72705 , p_component_code => l_component_code
72706 , p_component_type_code => l_component_type_code
72707 , p_component_appl_id => l_component_appl_id
72708 , p_amb_context_code => l_amb_context_code
72709 , p_side => 'NA'
72710 );
72711
72712
72713 l_segment := AcctDerRule_152(
72714 p_application_id => p_application_id
72715 , p_ae_header_id => l_ae_header_id
72716 , p_source_5 => p_source_5
72717 , p_source_14 => p_source_14
72718 , x_transaction_coa_id => l_adr_transaction_coa_id
72719 , x_accounting_coa_id => l_adr_accounting_coa_id
72720 , x_flexfield_segment_code => l_adr_flexfield_segment_code
72721 , x_flex_value_set_id => l_adr_flex_value_set_id
72722 , x_value_type_code => l_adr_value_type_code
72723 , x_value_combination_id => l_adr_value_combination_id
72724 , x_value_segment_code => l_adr_value_segment_code
72725 , p_side => 'NA'
72726 , p_override_seg_flag => 'Y'
72727 );
72728
72729 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
72730
72731 xla_ae_lines_pkg.set_segment(
72732 p_to_segment_code => 'GL_ACCOUNT'
72733 , p_segment_value => l_segment
72734 , p_from_segment_code => l_adr_value_segment_code
72735 , p_from_combination_id => l_adr_value_combination_id
72736 , p_value_type_code => l_adr_value_type_code
72737 , p_transaction_coa_id => l_adr_transaction_coa_id
72738 , p_accounting_coa_id => l_adr_accounting_coa_id
72739 , p_flexfield_segment_code => l_adr_flexfield_segment_code
72740 , p_flex_value_set_id => l_adr_flex_value_set_id
72741 , p_adr_code => 'FA_COST_OF_REMOVAL_CLR_SEGMENT'
72742 , p_adr_type_code => 'S'
72743 , p_component_type => l_component_type
72744 , p_component_code => l_component_code
72745 , p_component_type_code => l_component_type_code
72746 , p_component_appl_id => l_component_appl_id
72747 , p_amb_context_code => l_amb_context_code
72748 , p_entity_code => 'TRANSACTIONS'
72752
72749 , p_event_class_code => 'RETIREMENTS'
72750 , p_side => 'NA'
72751 );
72753 END IF;
72754
72755 l_segment := AcctDerRule_169(
72756 p_application_id => p_application_id
72757 , p_ae_header_id => l_ae_header_id
72758 , p_source_5 => p_source_5
72759 , p_source_31 => p_source_31
72760 , x_transaction_coa_id => l_adr_transaction_coa_id
72761 , x_accounting_coa_id => l_adr_accounting_coa_id
72762 , x_flexfield_segment_code => l_adr_flexfield_segment_code
72763 , x_flex_value_set_id => l_adr_flex_value_set_id
72764 , x_value_type_code => l_adr_value_type_code
72765 , x_value_combination_id => l_adr_value_combination_id
72766 , x_value_segment_code => l_adr_value_segment_code
72767 , p_side => 'NA'
72768 , p_override_seg_flag => 'Y'
72769 );
72770
72771 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
72772
72773 xla_ae_lines_pkg.set_segment(
72774 p_to_segment_code => 'GL_BALANCING'
72775 , p_segment_value => l_segment
72776 , p_from_segment_code => l_adr_value_segment_code
72777 , p_from_combination_id => l_adr_value_combination_id
72778 , p_value_type_code => l_adr_value_type_code
72779 , p_transaction_coa_id => l_adr_transaction_coa_id
72780 , p_accounting_coa_id => l_adr_accounting_coa_id
72781 , p_flexfield_segment_code => l_adr_flexfield_segment_code
72782 , p_flex_value_set_id => l_adr_flex_value_set_id
72783 , p_adr_code => 'FA_EXPENSE_ACCT'
72784 , p_adr_type_code => 'S'
72785 , p_component_type => l_component_type
72786 , p_component_code => l_component_code
72787 , p_component_type_code => l_component_type_code
72788 , p_component_appl_id => l_component_appl_id
72789 , p_amb_context_code => l_amb_context_code
72790 , p_entity_code => 'TRANSACTIONS'
72791 , p_event_class_code => 'RETIREMENTS'
72792 , p_side => 'NA'
72793 );
72794
72795 END IF;
72796
72797 --
72798 --
72799 END IF;
72800
72801 --
72802 -- Update the line information that should be overwritten
72803 --
72804 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
72805 p_header_num => 1);
72806 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
72807
72808 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
72809
72810 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
72811 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
72812 END IF;
72813
72814 --
72815 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
72816 --
72817 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
72818 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
72819 ELSE
72820 ---------------------------------------------------------------------------------------------------
72821 -- 4262811a Switch Sign
72822 ---------------------------------------------------------------------------------------------------
72823 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
72824 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
72825 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
72826 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
72827 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
72828 -- 5132302
72829 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
72830 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
72831
72832 END IF;
72833
72834 -- 4955764
72835 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
72836 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
72837
72838
72839 XLA_AE_LINES_PKG.ValidateCurrentLine;
72840 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
72841
72842 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
72843 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
72844 ,p_balance_type_code => l_balance_type_code);
72845
72846 END IF;
72847
72848 -----------------------------------------------------------------------------------------
72849 -- 4262811 Multiperiod Accounting
72850 -----------------------------------------------------------------------------------------
72851 -- No MPA option is assigned.
72852
72853
72854 END IF;
72855 END IF;
72856 --
72857
72858 --
72859 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
72860 trace
72864 END IF;
72861 (p_msg => 'END of AcctLineType_265'
72862 ,p_level => C_LEVEL_PROCEDURE
72863 ,p_module => l_log_module);
72865 --
72866 EXCEPTION
72867 WHEN xla_exceptions_pkg.application_exception THEN
72868 RAISE;
72869 WHEN OTHERS THEN
72870 xla_exceptions_pkg.raise_message
72871 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_265');
72872 END AcctLineType_265;
72873 --
72874
72875 ---------------------------------------
72876 --
72877 -- PRIVATE FUNCTION
72878 -- AcctLineType_266
72879 --
72880 ---------------------------------------
72881 PROCEDURE AcctLineType_266 (
72882 p_application_id IN NUMBER
72883 ,p_event_id IN NUMBER
72884 ,p_calculate_acctd_flag IN VARCHAR2
72885 ,p_calculate_g_l_flag IN VARCHAR2
72886 ,p_actual_flag IN OUT VARCHAR2
72887 ,p_balance_type_code OUT VARCHAR2
72888 ,p_gain_or_loss_ref OUT VARCHAR2
72889
72890 --Period Close Date
72891 , p_source_1 IN DATE
72892 --Generated Code Combination Identifier
72893 , p_source_5 IN NUMBER
72894 --Cost Of Removal Clearing Account
72895 , p_source_14 IN VARCHAR2
72896 --Expense Account Code Combination Identifier
72897 , p_source_31 IN NUMBER
72898 --Default Code Combination Identifier
72899 , p_source_32 IN NUMBER
72900 --Adjustment Type
72901 , p_source_48 IN VARCHAR2
72902 --Transaction Header Identifier
72903 , p_source_49 IN NUMBER
72904 --Adjustment Line Identifier
72905 , p_source_50 IN NUMBER
72906 --Distribution Type Code
72907 , p_source_51 IN VARCHAR2
72908 --Entered Amount
72909 , p_source_52 IN NUMBER
72910 --Currency Code
72911 , p_source_53 IN VARCHAR2
72912 )
72913 IS
72914
72915 l_component_type VARCHAR2(80);
72916 l_component_code VARCHAR2(30);
72917 l_component_type_code VARCHAR2(1);
72918 l_component_appl_id INTEGER;
72919 l_amb_context_code VARCHAR2(30);
72920 l_entity_code VARCHAR2(30);
72921 l_event_class_code VARCHAR2(30);
72922 l_ae_header_id NUMBER;
72923 l_event_type_code VARCHAR2(30);
72924 l_line_definition_code VARCHAR2(30);
72925 l_line_definition_owner_code VARCHAR2(1);
72926 --
72927 -- adr variables
72928 l_segment VARCHAR2(30);
72929 l_ccid NUMBER;
72930 l_adr_transaction_coa_id NUMBER;
72931 l_adr_accounting_coa_id NUMBER;
72932 l_adr_flexfield_segment_code VARCHAR2(30);
72933 l_adr_flex_value_set_id NUMBER;
72934 l_adr_value_type_code VARCHAR2(30);
72935 l_adr_value_combination_id NUMBER;
72936 l_adr_value_segment_code VARCHAR2(30);
72937
72938 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
72939 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
72940 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
72941 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
72942
72943 -- 4262811 Variables ------------------------------------------------------------------------------------------
72944 l_entered_amt_idx NUMBER;
72945 l_accted_amt_idx NUMBER;
72946 l_acc_rev_flag VARCHAR2(1);
72947 l_accrual_line_num NUMBER;
72948 l_tmp_amt NUMBER;
72949 l_acc_rev_natural_side_code VARCHAR2(1);
72950
72951 l_num_entries NUMBER;
72952 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
72953 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
72954 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
72955 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
72956 l_recog_line_1 NUMBER;
72957 l_recog_line_2 NUMBER;
72958
72959 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
72960 l_bflow_applied_to_amt NUMBER; -- 5132302
72961 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
72962
72963 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
72964
72965 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
72966 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
72967
72968 ---------------------------------------------------------------------------------------------------------------
72969
72970
72971 --
72972 -- bulk performance
72973 --
72974 l_balance_type_code VARCHAR2(1);
72975 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
72976 l_log_module VARCHAR2(240);
72977
72978 --
72979 -- Upgrade strategy
72980 --
72981 l_actual_upg_option VARCHAR2(1);
72982 l_enc_upg_option VARCHAR2(1);
72983
72984 --
72985 BEGIN
72986 --
72987 IF g_log_enabled THEN
72988 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_266';
72989 END IF;
72990 --
72991 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
72992
72993 trace
72994 (p_msg => 'BEGIN of AcctLineType_266'
72995 ,p_level => C_LEVEL_PROCEDURE
72999 --
72996 ,p_module => l_log_module);
72997
72998 END IF;
73000 l_component_type := 'AMB_JLT';
73001 l_component_code := 'FA_COST_OF_REMOVAL_CLR';
73002 l_component_type_code := 'S';
73003 l_component_appl_id := 140;
73004 l_amb_context_code := 'DEFAULT';
73005 l_entity_code := 'TRANSACTIONS';
73006 l_event_class_code := 'RETIREMENTS';
73007 l_event_type_code := 'REINSTATEMENTS';
73008 l_line_definition_owner_code := 'S';
73009 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
73010 --
73011 l_balance_type_code := 'A';
73012 l_segment := NULL;
73013 l_ccid := NULL;
73014 l_adr_transaction_coa_id := NULL;
73015 l_adr_accounting_coa_id := NULL;
73016 l_adr_flexfield_segment_code := NULL;
73017 l_adr_flex_value_set_id := NULL;
73018 l_adr_value_type_code := NULL;
73019 l_adr_value_combination_id := NULL;
73020 l_adr_value_segment_code := NULL;
73021
73022 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
73023 l_bflow_class_code := ''; -- 4219869 Business Flow
73024 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
73025 l_budgetary_control_flag := 'N';
73026
73027 l_bflow_applied_to_amt_idx := NULL; -- 5132302
73028 l_bflow_applied_to_amt := NULL; -- 5132302
73029 l_entered_amt_idx := NULL; -- 4262811
73030 l_accted_amt_idx := NULL; -- 4262811
73031 l_acc_rev_flag := NULL; -- 4262811
73032 l_accrual_line_num := NULL; -- 4262811
73033 l_tmp_amt := NULL; -- 4262811
73034 --
73035
73036 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
73037 l_balance_type_code <> 'B' THEN
73038 IF NVL(p_source_48,'
73039 ') = 'REMOVALCOST CLR'
73040 THEN
73041
73042 --
73043 XLA_AE_LINES_PKG.SetNewLine;
73044
73045 p_balance_type_code := l_balance_type_code;
73046 -- set the flag so later we will know whether the gain loss line needs to be created
73047
73048 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
73049 p_actual_flag :='A';
73050 END IF;
73051
73052 --
73053 -- bulk performance
73054 --
73055 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
73056 p_header_num => 0); -- 4262811
73057 --
73058 -- set accounting line options
73059 --
73060 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
73061 p_natural_side_code => 'C'
73062 , p_gain_or_loss_flag => 'N'
73063 , p_gl_transfer_mode_code => 'S'
73064 , p_acct_entry_type_code => 'A'
73065 , p_switch_side_flag => 'Y'
73066 , p_merge_duplicate_code => 'N'
73067 );
73068 --
73069 l_acc_rev_natural_side_code := 'D'; -- 4262811
73070 --
73071 --
73072 -- set accounting line type info
73073 --
73074 xla_ae_lines_pkg.SetAcctLineType
73075 (p_component_type => l_component_type
73076 ,p_event_type_code => l_event_type_code
73077 ,p_line_definition_owner_code => l_line_definition_owner_code
73078 ,p_line_definition_code => l_line_definition_code
73079 ,p_accounting_line_code => l_component_code
73080 ,p_accounting_line_type_code => l_component_type_code
73081 ,p_accounting_line_appl_id => l_component_appl_id
73082 ,p_amb_context_code => l_amb_context_code
73083 ,p_entity_code => l_entity_code
73084 ,p_event_class_code => l_event_class_code);
73085 --
73086 -- set accounting class
73087 --
73088 xla_ae_lines_pkg.SetAcctClass(
73089 p_accounting_class_code => 'ASSET'
73090 , p_ae_header_id => l_ae_header_id
73091 );
73092
73093 --
73094 -- set rounding class
73095 --
73096 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
73097 'ASSET';
73098
73099 --
73100 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
73101 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
73102 --
73103 -- bulk performance
73104 --
73105 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
73106
73107 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
73108 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
73109
73110 -- 4955764
73111 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
73112 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
73113
73114 -- 4458381 Public Sector Enh
73115
73116 --
73117 -- set accounting attributes for the line type
73118 --
73119 l_entered_amt_idx := 4;
73120 l_accted_amt_idx := 6;
73121 l_bflow_applied_to_amt_idx := NULL; -- 5132302
73122 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
73126 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
73123 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
73124 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
73125 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
73127 l_rec_acct_attrs.array_char_value(3) := p_source_51;
73128 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
73129 l_rec_acct_attrs.array_num_value(4) := p_source_52;
73130 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
73131 l_rec_acct_attrs.array_char_value(5) := p_source_53;
73132 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
73133 l_rec_acct_attrs.array_num_value(6) := p_source_52;
73134
73135 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
73136 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
73137
73138 ---------------------------------------------------------------------------------------------------------------
73139 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
73140 ---------------------------------------------------------------------------------------------------------------
73141 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
73142
73143 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
73144 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
73145
73146 IF xla_accounting_cache_pkg.GetValueChar
73147 (p_source_code => 'LEDGER_CATEGORY_CODE'
73148 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
73149 AND l_bflow_method_code = 'PRIOR_ENTRY'
73150 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
73151 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
73152 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
73153 )
73154 THEN
73155 xla_ae_lines_pkg.BflowUpgEntry
73156 (p_business_method_code => l_bflow_method_code
73157 ,p_business_class_code => l_bflow_class_code
73158 ,p_balance_type => l_balance_type_code);
73159 ELSE
73160 NULL;
73161 -- No business flow processing for business flow method of NONE.
73162 END IF;
73163
73164 --
73165 -- call analytical criteria
73166 --
73167
73168 --
73169 -- call description
73170 --
73171
73172 xla_ae_lines_pkg.SetLineDescription(
73173 p_ae_header_id => l_ae_header_id
73174 ,p_description => Description_87 (
73175 p_application_id => p_application_id
73176 , p_ae_header_id => l_ae_header_id
73177 , p_source_1 => p_source_1
73178 )
73179 );
73180
73181
73182 --
73183 -- call ADRs
73184 -- Bug 4922099
73185 --
73186 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
73187 (NVL(l_actual_upg_option, 'N') = 'O') OR
73188 (NVL(l_enc_upg_option, 'N') = 'O')
73189 )
73190 THEN
73191 NULL;
73192 --
73193 --
73194
73195 l_ccid := AcctDerRule_174(
73196 p_application_id => p_application_id
73197 , p_ae_header_id => l_ae_header_id
73198 , p_source_5 => p_source_5
73199 , p_source_32 => p_source_32
73200 , x_transaction_coa_id => l_adr_transaction_coa_id
73201 , x_accounting_coa_id => l_adr_accounting_coa_id
73202 , x_value_type_code => l_adr_value_type_code
73203 , p_side => 'NA'
73204 );
73205
73206 xla_ae_lines_pkg.set_ccid(
73207 p_code_combination_id => l_ccid
73208 , p_value_type_code => l_adr_value_type_code
73209 , p_transaction_coa_id => l_adr_transaction_coa_id
73210 , p_accounting_coa_id => l_adr_accounting_coa_id
73211 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
73212 , p_adr_type_code => 'S'
73213 , p_component_type => l_component_type
73214 , p_component_code => l_component_code
73215 , p_component_type_code => l_component_type_code
73216 , p_component_appl_id => l_component_appl_id
73217 , p_amb_context_code => l_amb_context_code
73218 , p_side => 'NA'
73219 );
73220
73221
73222 l_segment := AcctDerRule_152(
73223 p_application_id => p_application_id
73224 , p_ae_header_id => l_ae_header_id
73225 , p_source_5 => p_source_5
73226 , p_source_14 => p_source_14
73227 , x_transaction_coa_id => l_adr_transaction_coa_id
73228 , x_accounting_coa_id => l_adr_accounting_coa_id
73229 , x_flexfield_segment_code => l_adr_flexfield_segment_code
73230 , x_flex_value_set_id => l_adr_flex_value_set_id
73231 , x_value_type_code => l_adr_value_type_code
73232 , x_value_combination_id => l_adr_value_combination_id
73233 , x_value_segment_code => l_adr_value_segment_code
73234 , p_side => 'NA'
73235 , p_override_seg_flag => 'Y'
73236 );
73237
73238 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
73242 , p_segment_value => l_segment
73239
73240 xla_ae_lines_pkg.set_segment(
73241 p_to_segment_code => 'GL_ACCOUNT'
73243 , p_from_segment_code => l_adr_value_segment_code
73244 , p_from_combination_id => l_adr_value_combination_id
73245 , p_value_type_code => l_adr_value_type_code
73246 , p_transaction_coa_id => l_adr_transaction_coa_id
73247 , p_accounting_coa_id => l_adr_accounting_coa_id
73248 , p_flexfield_segment_code => l_adr_flexfield_segment_code
73249 , p_flex_value_set_id => l_adr_flex_value_set_id
73250 , p_adr_code => 'FA_COST_OF_REMOVAL_CLR_SEGMENT'
73251 , p_adr_type_code => 'S'
73252 , p_component_type => l_component_type
73253 , p_component_code => l_component_code
73254 , p_component_type_code => l_component_type_code
73255 , p_component_appl_id => l_component_appl_id
73256 , p_amb_context_code => l_amb_context_code
73257 , p_entity_code => 'TRANSACTIONS'
73258 , p_event_class_code => 'RETIREMENTS'
73259 , p_side => 'NA'
73260 );
73261
73262 END IF;
73263
73264 l_segment := AcctDerRule_169(
73265 p_application_id => p_application_id
73266 , p_ae_header_id => l_ae_header_id
73267 , p_source_5 => p_source_5
73268 , p_source_31 => p_source_31
73269 , x_transaction_coa_id => l_adr_transaction_coa_id
73270 , x_accounting_coa_id => l_adr_accounting_coa_id
73271 , x_flexfield_segment_code => l_adr_flexfield_segment_code
73272 , x_flex_value_set_id => l_adr_flex_value_set_id
73273 , x_value_type_code => l_adr_value_type_code
73274 , x_value_combination_id => l_adr_value_combination_id
73275 , x_value_segment_code => l_adr_value_segment_code
73276 , p_side => 'NA'
73277 , p_override_seg_flag => 'Y'
73278 );
73279
73280 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
73281
73282 xla_ae_lines_pkg.set_segment(
73283 p_to_segment_code => 'GL_BALANCING'
73284 , p_segment_value => l_segment
73285 , p_from_segment_code => l_adr_value_segment_code
73286 , p_from_combination_id => l_adr_value_combination_id
73287 , p_value_type_code => l_adr_value_type_code
73288 , p_transaction_coa_id => l_adr_transaction_coa_id
73289 , p_accounting_coa_id => l_adr_accounting_coa_id
73290 , p_flexfield_segment_code => l_adr_flexfield_segment_code
73291 , p_flex_value_set_id => l_adr_flex_value_set_id
73292 , p_adr_code => 'FA_EXPENSE_ACCT'
73293 , p_adr_type_code => 'S'
73294 , p_component_type => l_component_type
73295 , p_component_code => l_component_code
73296 , p_component_type_code => l_component_type_code
73297 , p_component_appl_id => l_component_appl_id
73298 , p_amb_context_code => l_amb_context_code
73299 , p_entity_code => 'TRANSACTIONS'
73300 , p_event_class_code => 'RETIREMENTS'
73301 , p_side => 'NA'
73302 );
73303
73304 END IF;
73305
73306 --
73307 --
73308 END IF;
73309 --
73310 -- Bug 4922099
73311 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
73312 (NVL(l_enc_upg_option, 'N') = 'O')
73313 ) AND
73314 (l_bflow_method_code = 'PRIOR_ENTRY')
73315 )
73316 THEN
73317 IF
73318 --
73319 1 = 2
73320 --
73321 THEN
73322 xla_accounting_err_pkg.build_message
73323 (p_appli_s_name => 'XLA'
73324 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
73325 ,p_token_1 => 'LINE_NUMBER'
73326 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
73327 ,p_token_2 => 'LINE_TYPE_NAME'
73328 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
73329 l_component_type
73330 ,l_component_code
73331 ,l_component_type_code
73332 ,l_component_appl_id
73333 ,l_amb_context_code
73334 ,l_entity_code
73335 ,l_event_class_code
73336 )
73337 ,p_token_3 => 'OWNER'
73338 ,p_value_3 => xla_lookups_pkg.get_meaning(
73339 p_lookup_type => 'XLA_OWNER_TYPE'
73340 ,p_lookup_code => l_component_type_code
73344 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
73341 )
73342 ,p_token_4 => 'PRODUCT_NAME'
73343 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
73345 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
73346 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
73347 ,p_ae_header_id => NULL
73348 );
73349
73350 IF (C_LEVEL_ERROR>= g_log_level) THEN
73351 trace
73352 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
73353 ,p_level => C_LEVEL_ERROR
73354 ,p_module => l_log_module);
73355 END IF;
73356 END IF;
73357 END IF;
73358 --
73359 --
73360 ------------------------------------------------------------------------------------------------
73361 -- 4219869 Business Flow
73362 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
73363 -- Prior Entry. Currently, the following code is always generated.
73364 ------------------------------------------------------------------------------------------------
73365 XLA_AE_LINES_PKG.ValidateCurrentLine;
73366
73367 ------------------------------------------------------------------------------------
73368 -- 4219869 Business Flow
73369 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
73370 ------------------------------------------------------------------------------------
73371 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
73372
73373 ----------------------------------------------------------------------------------
73374 -- 4219869 Business Flow
73375 -- Update journal entry status -- Need to generate this within IF <condition>
73376 ----------------------------------------------------------------------------------
73377 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
73378 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
73379 ,p_balance_type_code => l_balance_type_code
73380 );
73381
73382 -------------------------------------------------------------------------------------------
73383 -- 4262811 - Generate the Accrual Reversal lines
73384 -------------------------------------------------------------------------------------------
73385 BEGIN
73386 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
73387 (g_array_event(p_event_id).array_value_num('header_index'));
73388 IF l_acc_rev_flag IS NULL THEN
73389 l_acc_rev_flag := 'N';
73390 END IF;
73391 EXCEPTION
73392 WHEN OTHERS THEN
73393 l_acc_rev_flag := 'N';
73394 END;
73395 --
73396 IF (l_acc_rev_flag = 'Y') THEN
73397
73398 -- 4645092 ------------------------------------------------------------------------------
73399 -- To allow MPA report to determine if it should generate report process
73400 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
73401 ------------------------------------------------------------------------------------------
73402
73403 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
73404 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
73405 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
73406 -- call ADRs
73407 -- Bug 4922099
73408 --
73409 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
73410 (NVL(l_actual_upg_option, 'N') = 'O') OR
73411 (NVL(l_enc_upg_option, 'N') = 'O')
73412 )
73413 THEN
73414 NULL;
73415 --
73416 --
73417
73418 l_ccid := AcctDerRule_174(
73419 p_application_id => p_application_id
73420 , p_ae_header_id => l_ae_header_id
73421 , p_source_5 => p_source_5
73422 , p_source_32 => p_source_32
73423 , x_transaction_coa_id => l_adr_transaction_coa_id
73424 , x_accounting_coa_id => l_adr_accounting_coa_id
73425 , x_value_type_code => l_adr_value_type_code
73426 , p_side => 'NA'
73427 );
73428
73429 xla_ae_lines_pkg.set_ccid(
73430 p_code_combination_id => l_ccid
73431 , p_value_type_code => l_adr_value_type_code
73432 , p_transaction_coa_id => l_adr_transaction_coa_id
73433 , p_accounting_coa_id => l_adr_accounting_coa_id
73434 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
73435 , p_adr_type_code => 'S'
73436 , p_component_type => l_component_type
73437 , p_component_code => l_component_code
73438 , p_component_type_code => l_component_type_code
73439 , p_component_appl_id => l_component_appl_id
73440 , p_amb_context_code => l_amb_context_code
73441 , p_side => 'NA'
73442 );
73443
73444
73445 l_segment := AcctDerRule_152(
73446 p_application_id => p_application_id
73447 , p_ae_header_id => l_ae_header_id
73448 , p_source_5 => p_source_5
73449 , p_source_14 => p_source_14
73453 , x_flex_value_set_id => l_adr_flex_value_set_id
73450 , x_transaction_coa_id => l_adr_transaction_coa_id
73451 , x_accounting_coa_id => l_adr_accounting_coa_id
73452 , x_flexfield_segment_code => l_adr_flexfield_segment_code
73454 , x_value_type_code => l_adr_value_type_code
73455 , x_value_combination_id => l_adr_value_combination_id
73456 , x_value_segment_code => l_adr_value_segment_code
73457 , p_side => 'NA'
73458 , p_override_seg_flag => 'Y'
73459 );
73460
73461 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
73462
73463 xla_ae_lines_pkg.set_segment(
73464 p_to_segment_code => 'GL_ACCOUNT'
73465 , p_segment_value => l_segment
73466 , p_from_segment_code => l_adr_value_segment_code
73467 , p_from_combination_id => l_adr_value_combination_id
73468 , p_value_type_code => l_adr_value_type_code
73469 , p_transaction_coa_id => l_adr_transaction_coa_id
73470 , p_accounting_coa_id => l_adr_accounting_coa_id
73471 , p_flexfield_segment_code => l_adr_flexfield_segment_code
73472 , p_flex_value_set_id => l_adr_flex_value_set_id
73473 , p_adr_code => 'FA_COST_OF_REMOVAL_CLR_SEGMENT'
73474 , p_adr_type_code => 'S'
73475 , p_component_type => l_component_type
73476 , p_component_code => l_component_code
73477 , p_component_type_code => l_component_type_code
73478 , p_component_appl_id => l_component_appl_id
73479 , p_amb_context_code => l_amb_context_code
73480 , p_entity_code => 'TRANSACTIONS'
73481 , p_event_class_code => 'RETIREMENTS'
73482 , p_side => 'NA'
73483 );
73484
73485 END IF;
73486
73487 l_segment := AcctDerRule_169(
73488 p_application_id => p_application_id
73489 , p_ae_header_id => l_ae_header_id
73490 , p_source_5 => p_source_5
73491 , p_source_31 => p_source_31
73492 , x_transaction_coa_id => l_adr_transaction_coa_id
73493 , x_accounting_coa_id => l_adr_accounting_coa_id
73494 , x_flexfield_segment_code => l_adr_flexfield_segment_code
73495 , x_flex_value_set_id => l_adr_flex_value_set_id
73496 , x_value_type_code => l_adr_value_type_code
73497 , x_value_combination_id => l_adr_value_combination_id
73498 , x_value_segment_code => l_adr_value_segment_code
73499 , p_side => 'NA'
73500 , p_override_seg_flag => 'Y'
73501 );
73502
73503 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
73504
73505 xla_ae_lines_pkg.set_segment(
73506 p_to_segment_code => 'GL_BALANCING'
73507 , p_segment_value => l_segment
73508 , p_from_segment_code => l_adr_value_segment_code
73509 , p_from_combination_id => l_adr_value_combination_id
73510 , p_value_type_code => l_adr_value_type_code
73511 , p_transaction_coa_id => l_adr_transaction_coa_id
73512 , p_accounting_coa_id => l_adr_accounting_coa_id
73513 , p_flexfield_segment_code => l_adr_flexfield_segment_code
73514 , p_flex_value_set_id => l_adr_flex_value_set_id
73515 , p_adr_code => 'FA_EXPENSE_ACCT'
73516 , p_adr_type_code => 'S'
73517 , p_component_type => l_component_type
73518 , p_component_code => l_component_code
73519 , p_component_type_code => l_component_type_code
73520 , p_component_appl_id => l_component_appl_id
73521 , p_amb_context_code => l_amb_context_code
73522 , p_entity_code => 'TRANSACTIONS'
73523 , p_event_class_code => 'RETIREMENTS'
73524 , p_side => 'NA'
73525 );
73526
73527 END IF;
73528
73529 --
73530 --
73531 END IF;
73532
73533 --
73534 -- Update the line information that should be overwritten
73535 --
73536 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
73537 p_header_num => 1);
73538 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
73539
73540 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
73541
73542 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
73543 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
73544 END IF;
73545
73546 --
73547 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
73548 --
73549 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
73550 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
73551 ELSE
73552 ---------------------------------------------------------------------------------------------------
73553 -- 4262811a Switch Sign
73554 ---------------------------------------------------------------------------------------------------
73558 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
73555 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
73556 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
73557 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
73559 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
73560 -- 5132302
73561 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
73562 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
73563
73564 END IF;
73565
73566 -- 4955764
73567 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
73568 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
73569
73570
73571 XLA_AE_LINES_PKG.ValidateCurrentLine;
73572 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
73573
73574 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
73575 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
73576 ,p_balance_type_code => l_balance_type_code);
73577
73578 END IF;
73579
73580 -----------------------------------------------------------------------------------------
73581 -- 4262811 Multiperiod Accounting
73582 -----------------------------------------------------------------------------------------
73583 -- No MPA option is assigned.
73584
73585
73586 END IF;
73587 END IF;
73588 --
73589
73590 --
73591 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
73592 trace
73593 (p_msg => 'END of AcctLineType_266'
73594 ,p_level => C_LEVEL_PROCEDURE
73595 ,p_module => l_log_module);
73596 END IF;
73597 --
73598 EXCEPTION
73599 WHEN xla_exceptions_pkg.application_exception THEN
73600 RAISE;
73601 WHEN OTHERS THEN
73602 xla_exceptions_pkg.raise_message
73603 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_266');
73604 END AcctLineType_266;
73605 --
73606
73607 ---------------------------------------
73608 --
73609 -- PRIVATE FUNCTION
73610 -- AcctLineType_267
73611 --
73612 ---------------------------------------
73613 PROCEDURE AcctLineType_267 (
73614 p_application_id IN NUMBER
73615 ,p_event_id IN NUMBER
73616 ,p_calculate_acctd_flag IN VARCHAR2
73617 ,p_calculate_g_l_flag IN VARCHAR2
73618 ,p_actual_flag IN OUT VARCHAR2
73619 ,p_balance_type_code OUT VARCHAR2
73620 ,p_gain_or_loss_ref OUT VARCHAR2
73621
73622 --Period Close Date
73623 , p_source_1 IN DATE
73624 --Generated Code Combination Identifier
73625 , p_source_5 IN NUMBER
73626 --Cost Of Removal Gain Account
73627 , p_source_15 IN VARCHAR2
73628 --Expense Account Code Combination Identifier
73629 , p_source_31 IN NUMBER
73630 --Default Code Combination Identifier
73631 , p_source_32 IN NUMBER
73632 --Adjustment Type
73633 , p_source_48 IN VARCHAR2
73634 --Transaction Header Identifier
73635 , p_source_49 IN NUMBER
73636 --Adjustment Line Identifier
73637 , p_source_50 IN NUMBER
73638 --Distribution Type Code
73639 , p_source_51 IN VARCHAR2
73640 --Entered Amount
73641 , p_source_52 IN NUMBER
73642 --Currency Code
73643 , p_source_53 IN VARCHAR2
73644 --Gain Loss Amount
73645 , p_source_54 IN NUMBER
73646 )
73647 IS
73648
73649 l_component_type VARCHAR2(80);
73650 l_component_code VARCHAR2(30);
73651 l_component_type_code VARCHAR2(1);
73652 l_component_appl_id INTEGER;
73653 l_amb_context_code VARCHAR2(30);
73654 l_entity_code VARCHAR2(30);
73655 l_event_class_code VARCHAR2(30);
73656 l_ae_header_id NUMBER;
73657 l_event_type_code VARCHAR2(30);
73658 l_line_definition_code VARCHAR2(30);
73659 l_line_definition_owner_code VARCHAR2(1);
73660 --
73661 -- adr variables
73662 l_segment VARCHAR2(30);
73663 l_ccid NUMBER;
73664 l_adr_transaction_coa_id NUMBER;
73665 l_adr_accounting_coa_id NUMBER;
73666 l_adr_flexfield_segment_code VARCHAR2(30);
73667 l_adr_flex_value_set_id NUMBER;
73668 l_adr_value_type_code VARCHAR2(30);
73669 l_adr_value_combination_id NUMBER;
73670 l_adr_value_segment_code VARCHAR2(30);
73671
73672 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
73673 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
73674 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
73675 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
73676
73677 -- 4262811 Variables ------------------------------------------------------------------------------------------
73678 l_entered_amt_idx NUMBER;
73679 l_accted_amt_idx NUMBER;
73680 l_acc_rev_flag VARCHAR2(1);
73681 l_accrual_line_num NUMBER;
73682 l_tmp_amt NUMBER;
73686 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
73683 l_acc_rev_natural_side_code VARCHAR2(1);
73684
73685 l_num_entries NUMBER;
73687 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
73688 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
73689 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
73690 l_recog_line_1 NUMBER;
73691 l_recog_line_2 NUMBER;
73692
73693 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
73694 l_bflow_applied_to_amt NUMBER; -- 5132302
73695 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
73696
73697 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
73698
73699 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
73700 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
73701
73702 ---------------------------------------------------------------------------------------------------------------
73703
73704
73705 --
73706 -- bulk performance
73707 --
73708 l_balance_type_code VARCHAR2(1);
73709 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
73710 l_log_module VARCHAR2(240);
73711
73712 --
73713 -- Upgrade strategy
73714 --
73715 l_actual_upg_option VARCHAR2(1);
73716 l_enc_upg_option VARCHAR2(1);
73717
73718 --
73719 BEGIN
73720 --
73721 IF g_log_enabled THEN
73722 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_267';
73723 END IF;
73724 --
73725 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
73726
73727 trace
73728 (p_msg => 'BEGIN of AcctLineType_267'
73729 ,p_level => C_LEVEL_PROCEDURE
73730 ,p_module => l_log_module);
73731
73732 END IF;
73733 --
73734 l_component_type := 'AMB_JLT';
73735 l_component_code := 'FA_COST_OF_REMOVAL_GAIN';
73736 l_component_type_code := 'S';
73737 l_component_appl_id := 140;
73738 l_amb_context_code := 'DEFAULT';
73739 l_entity_code := 'TRANSACTIONS';
73740 l_event_class_code := 'RETIREMENTS';
73741 l_event_type_code := 'RETIREMENTS';
73742 l_line_definition_owner_code := 'S';
73743 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
73744 --
73745 l_balance_type_code := 'A';
73746 l_segment := NULL;
73747 l_ccid := NULL;
73748 l_adr_transaction_coa_id := NULL;
73749 l_adr_accounting_coa_id := NULL;
73750 l_adr_flexfield_segment_code := NULL;
73751 l_adr_flex_value_set_id := NULL;
73752 l_adr_value_type_code := NULL;
73753 l_adr_value_combination_id := NULL;
73754 l_adr_value_segment_code := NULL;
73755
73756 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
73757 l_bflow_class_code := ''; -- 4219869 Business Flow
73758 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
73759 l_budgetary_control_flag := 'N';
73760
73761 l_bflow_applied_to_amt_idx := NULL; -- 5132302
73762 l_bflow_applied_to_amt := NULL; -- 5132302
73763 l_entered_amt_idx := NULL; -- 4262811
73764 l_accted_amt_idx := NULL; -- 4262811
73765 l_acc_rev_flag := NULL; -- 4262811
73766 l_accrual_line_num := NULL; -- 4262811
73767 l_tmp_amt := NULL; -- 4262811
73768 --
73769
73770 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
73771 l_balance_type_code <> 'B' THEN
73772 IF NVL(p_source_48,'
73773 ') = 'REMOVALCOST' AND
73774 p_source_54 >= 0
73775 THEN
73776
73777 --
73778 XLA_AE_LINES_PKG.SetNewLine;
73779
73780 p_balance_type_code := l_balance_type_code;
73781 -- set the flag so later we will know whether the gain loss line needs to be created
73782
73783 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
73784 p_actual_flag :='A';
73785 END IF;
73786
73787 --
73788 -- bulk performance
73789 --
73790 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
73791 p_header_num => 0); -- 4262811
73792 --
73793 -- set accounting line options
73794 --
73795 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
73796 p_natural_side_code => 'D'
73797 , p_gain_or_loss_flag => 'N'
73798 , p_gl_transfer_mode_code => 'S'
73799 , p_acct_entry_type_code => 'A'
73800 , p_switch_side_flag => 'Y'
73801 , p_merge_duplicate_code => 'N'
73802 );
73803 --
73804 l_acc_rev_natural_side_code := 'C'; -- 4262811
73805 --
73806 --
73807 -- set accounting line type info
73808 --
73809 xla_ae_lines_pkg.SetAcctLineType
73810 (p_component_type => l_component_type
73811 ,p_event_type_code => l_event_type_code
73812 ,p_line_definition_owner_code => l_line_definition_owner_code
73813 ,p_line_definition_code => l_line_definition_code
73814 ,p_accounting_line_code => l_component_code
73818 ,p_entity_code => l_entity_code
73815 ,p_accounting_line_type_code => l_component_type_code
73816 ,p_accounting_line_appl_id => l_component_appl_id
73817 ,p_amb_context_code => l_amb_context_code
73819 ,p_event_class_code => l_event_class_code);
73820 --
73821 -- set accounting class
73822 --
73823 xla_ae_lines_pkg.SetAcctClass(
73824 p_accounting_class_code => 'ASSET'
73825 , p_ae_header_id => l_ae_header_id
73826 );
73827
73828 --
73829 -- set rounding class
73830 --
73831 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
73832 'ASSET';
73833
73834 --
73835 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
73836 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
73837 --
73838 -- bulk performance
73839 --
73840 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
73841
73842 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
73843 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
73844
73845 -- 4955764
73846 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
73847 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
73848
73849 -- 4458381 Public Sector Enh
73850
73851 --
73852 -- set accounting attributes for the line type
73853 --
73854 l_entered_amt_idx := 4;
73855 l_accted_amt_idx := 6;
73856 l_bflow_applied_to_amt_idx := NULL; -- 5132302
73857 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
73858 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
73859 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
73860 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
73861 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
73862 l_rec_acct_attrs.array_char_value(3) := p_source_51;
73863 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
73864 l_rec_acct_attrs.array_num_value(4) := p_source_52;
73865 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
73866 l_rec_acct_attrs.array_char_value(5) := p_source_53;
73867 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
73868 l_rec_acct_attrs.array_num_value(6) := p_source_52;
73869
73870 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
73871 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
73872
73873 ---------------------------------------------------------------------------------------------------------------
73874 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
73875 ---------------------------------------------------------------------------------------------------------------
73876 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
73877
73878 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
73879 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
73880
73881 IF xla_accounting_cache_pkg.GetValueChar
73882 (p_source_code => 'LEDGER_CATEGORY_CODE'
73883 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
73884 AND l_bflow_method_code = 'PRIOR_ENTRY'
73885 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
73886 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
73887 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
73888 )
73889 THEN
73890 xla_ae_lines_pkg.BflowUpgEntry
73891 (p_business_method_code => l_bflow_method_code
73892 ,p_business_class_code => l_bflow_class_code
73893 ,p_balance_type => l_balance_type_code);
73894 ELSE
73895 NULL;
73896 -- No business flow processing for business flow method of NONE.
73897 END IF;
73898
73899 --
73900 -- call analytical criteria
73901 --
73902
73903 --
73904 -- call description
73905 --
73906
73907 xla_ae_lines_pkg.SetLineDescription(
73908 p_ae_header_id => l_ae_header_id
73909 ,p_description => Description_78 (
73910 p_application_id => p_application_id
73911 , p_ae_header_id => l_ae_header_id
73912 , p_source_1 => p_source_1
73913 )
73914 );
73915
73916
73917 --
73918 -- call ADRs
73919 -- Bug 4922099
73920 --
73921 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
73922 (NVL(l_actual_upg_option, 'N') = 'O') OR
73923 (NVL(l_enc_upg_option, 'N') = 'O')
73924 )
73925 THEN
73926 NULL;
73927 --
73928 --
73929
73930 l_ccid := AcctDerRule_174(
73931 p_application_id => p_application_id
73932 , p_ae_header_id => l_ae_header_id
73933 , p_source_5 => p_source_5
73934 , p_source_32 => p_source_32
73935 , x_transaction_coa_id => l_adr_transaction_coa_id
73936 , x_accounting_coa_id => l_adr_accounting_coa_id
73940
73937 , x_value_type_code => l_adr_value_type_code
73938 , p_side => 'NA'
73939 );
73941 xla_ae_lines_pkg.set_ccid(
73942 p_code_combination_id => l_ccid
73943 , p_value_type_code => l_adr_value_type_code
73944 , p_transaction_coa_id => l_adr_transaction_coa_id
73945 , p_accounting_coa_id => l_adr_accounting_coa_id
73946 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
73947 , p_adr_type_code => 'S'
73948 , p_component_type => l_component_type
73949 , p_component_code => l_component_code
73950 , p_component_type_code => l_component_type_code
73951 , p_component_appl_id => l_component_appl_id
73952 , p_amb_context_code => l_amb_context_code
73953 , p_side => 'NA'
73954 );
73955
73956
73957 l_segment := AcctDerRule_153(
73958 p_application_id => p_application_id
73959 , p_ae_header_id => l_ae_header_id
73960 , p_source_5 => p_source_5
73961 , p_source_15 => p_source_15
73962 , x_transaction_coa_id => l_adr_transaction_coa_id
73963 , x_accounting_coa_id => l_adr_accounting_coa_id
73964 , x_flexfield_segment_code => l_adr_flexfield_segment_code
73965 , x_flex_value_set_id => l_adr_flex_value_set_id
73966 , x_value_type_code => l_adr_value_type_code
73967 , x_value_combination_id => l_adr_value_combination_id
73968 , x_value_segment_code => l_adr_value_segment_code
73969 , p_side => 'NA'
73970 , p_override_seg_flag => 'Y'
73971 );
73972
73973 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
73974
73975 xla_ae_lines_pkg.set_segment(
73976 p_to_segment_code => 'GL_ACCOUNT'
73977 , p_segment_value => l_segment
73978 , p_from_segment_code => l_adr_value_segment_code
73979 , p_from_combination_id => l_adr_value_combination_id
73980 , p_value_type_code => l_adr_value_type_code
73981 , p_transaction_coa_id => l_adr_transaction_coa_id
73982 , p_accounting_coa_id => l_adr_accounting_coa_id
73983 , p_flexfield_segment_code => l_adr_flexfield_segment_code
73984 , p_flex_value_set_id => l_adr_flex_value_set_id
73985 , p_adr_code => 'FA_COST_OF_REM_GAIN_SEGMENT'
73986 , p_adr_type_code => 'S'
73987 , p_component_type => l_component_type
73988 , p_component_code => l_component_code
73989 , p_component_type_code => l_component_type_code
73990 , p_component_appl_id => l_component_appl_id
73991 , p_amb_context_code => l_amb_context_code
73992 , p_entity_code => 'TRANSACTIONS'
73993 , p_event_class_code => 'RETIREMENTS'
73994 , p_side => 'NA'
73995 );
73996
73997 END IF;
73998
73999 l_segment := AcctDerRule_169(
74000 p_application_id => p_application_id
74001 , p_ae_header_id => l_ae_header_id
74002 , p_source_5 => p_source_5
74003 , p_source_31 => p_source_31
74004 , x_transaction_coa_id => l_adr_transaction_coa_id
74005 , x_accounting_coa_id => l_adr_accounting_coa_id
74006 , x_flexfield_segment_code => l_adr_flexfield_segment_code
74007 , x_flex_value_set_id => l_adr_flex_value_set_id
74008 , x_value_type_code => l_adr_value_type_code
74009 , x_value_combination_id => l_adr_value_combination_id
74010 , x_value_segment_code => l_adr_value_segment_code
74011 , p_side => 'NA'
74012 , p_override_seg_flag => 'Y'
74013 );
74014
74015 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
74016
74017 xla_ae_lines_pkg.set_segment(
74018 p_to_segment_code => 'GL_BALANCING'
74019 , p_segment_value => l_segment
74020 , p_from_segment_code => l_adr_value_segment_code
74021 , p_from_combination_id => l_adr_value_combination_id
74022 , p_value_type_code => l_adr_value_type_code
74023 , p_transaction_coa_id => l_adr_transaction_coa_id
74024 , p_accounting_coa_id => l_adr_accounting_coa_id
74025 , p_flexfield_segment_code => l_adr_flexfield_segment_code
74026 , p_flex_value_set_id => l_adr_flex_value_set_id
74027 , p_adr_code => 'FA_EXPENSE_ACCT'
74028 , p_adr_type_code => 'S'
74029 , p_component_type => l_component_type
74030 , p_component_code => l_component_code
74031 , p_component_type_code => l_component_type_code
74032 , p_component_appl_id => l_component_appl_id
74033 , p_amb_context_code => l_amb_context_code
74034 , p_entity_code => 'TRANSACTIONS'
74035 , p_event_class_code => 'RETIREMENTS'
74036 , p_side => 'NA'
74037 );
74038
74039 END IF;
74040
74041 --
74042 --
74043 END IF;
74044 --
74045 -- Bug 4922099
74046 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
74047 (NVL(l_enc_upg_option, 'N') = 'O')
74048 ) AND
74049 (l_bflow_method_code = 'PRIOR_ENTRY')
74053 --
74050 )
74051 THEN
74052 IF
74054 1 = 2
74055 --
74056 THEN
74057 xla_accounting_err_pkg.build_message
74058 (p_appli_s_name => 'XLA'
74059 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
74060 ,p_token_1 => 'LINE_NUMBER'
74061 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
74062 ,p_token_2 => 'LINE_TYPE_NAME'
74063 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
74064 l_component_type
74065 ,l_component_code
74066 ,l_component_type_code
74067 ,l_component_appl_id
74068 ,l_amb_context_code
74069 ,l_entity_code
74070 ,l_event_class_code
74071 )
74072 ,p_token_3 => 'OWNER'
74073 ,p_value_3 => xla_lookups_pkg.get_meaning(
74074 p_lookup_type => 'XLA_OWNER_TYPE'
74075 ,p_lookup_code => l_component_type_code
74076 )
74077 ,p_token_4 => 'PRODUCT_NAME'
74078 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
74079 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
74080 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
74081 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
74082 ,p_ae_header_id => NULL
74083 );
74084
74085 IF (C_LEVEL_ERROR>= g_log_level) THEN
74086 trace
74087 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
74088 ,p_level => C_LEVEL_ERROR
74089 ,p_module => l_log_module);
74090 END IF;
74091 END IF;
74092 END IF;
74093 --
74094 --
74095 ------------------------------------------------------------------------------------------------
74096 -- 4219869 Business Flow
74097 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
74098 -- Prior Entry. Currently, the following code is always generated.
74099 ------------------------------------------------------------------------------------------------
74100 XLA_AE_LINES_PKG.ValidateCurrentLine;
74101
74102 ------------------------------------------------------------------------------------
74103 -- 4219869 Business Flow
74104 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
74105 ------------------------------------------------------------------------------------
74106 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
74107
74108 ----------------------------------------------------------------------------------
74109 -- 4219869 Business Flow
74110 -- Update journal entry status -- Need to generate this within IF <condition>
74111 ----------------------------------------------------------------------------------
74112 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
74113 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
74114 ,p_balance_type_code => l_balance_type_code
74115 );
74116
74117 -------------------------------------------------------------------------------------------
74118 -- 4262811 - Generate the Accrual Reversal lines
74119 -------------------------------------------------------------------------------------------
74120 BEGIN
74121 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
74122 (g_array_event(p_event_id).array_value_num('header_index'));
74123 IF l_acc_rev_flag IS NULL THEN
74124 l_acc_rev_flag := 'N';
74125 END IF;
74126 EXCEPTION
74127 WHEN OTHERS THEN
74128 l_acc_rev_flag := 'N';
74129 END;
74130 --
74131 IF (l_acc_rev_flag = 'Y') THEN
74132
74133 -- 4645092 ------------------------------------------------------------------------------
74134 -- To allow MPA report to determine if it should generate report process
74135 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
74136 ------------------------------------------------------------------------------------------
74137
74138 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
74139 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
74140 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
74144 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
74141 -- call ADRs
74142 -- Bug 4922099
74143 --
74145 (NVL(l_actual_upg_option, 'N') = 'O') OR
74146 (NVL(l_enc_upg_option, 'N') = 'O')
74147 )
74148 THEN
74149 NULL;
74150 --
74151 --
74152
74153 l_ccid := AcctDerRule_174(
74154 p_application_id => p_application_id
74155 , p_ae_header_id => l_ae_header_id
74156 , p_source_5 => p_source_5
74157 , p_source_32 => p_source_32
74158 , x_transaction_coa_id => l_adr_transaction_coa_id
74159 , x_accounting_coa_id => l_adr_accounting_coa_id
74160 , x_value_type_code => l_adr_value_type_code
74161 , p_side => 'NA'
74162 );
74163
74164 xla_ae_lines_pkg.set_ccid(
74165 p_code_combination_id => l_ccid
74166 , p_value_type_code => l_adr_value_type_code
74167 , p_transaction_coa_id => l_adr_transaction_coa_id
74168 , p_accounting_coa_id => l_adr_accounting_coa_id
74169 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
74170 , p_adr_type_code => 'S'
74171 , p_component_type => l_component_type
74172 , p_component_code => l_component_code
74173 , p_component_type_code => l_component_type_code
74174 , p_component_appl_id => l_component_appl_id
74175 , p_amb_context_code => l_amb_context_code
74176 , p_side => 'NA'
74177 );
74178
74179
74180 l_segment := AcctDerRule_153(
74181 p_application_id => p_application_id
74182 , p_ae_header_id => l_ae_header_id
74183 , p_source_5 => p_source_5
74184 , p_source_15 => p_source_15
74185 , x_transaction_coa_id => l_adr_transaction_coa_id
74186 , x_accounting_coa_id => l_adr_accounting_coa_id
74187 , x_flexfield_segment_code => l_adr_flexfield_segment_code
74188 , x_flex_value_set_id => l_adr_flex_value_set_id
74189 , x_value_type_code => l_adr_value_type_code
74190 , x_value_combination_id => l_adr_value_combination_id
74191 , x_value_segment_code => l_adr_value_segment_code
74192 , p_side => 'NA'
74193 , p_override_seg_flag => 'Y'
74194 );
74195
74196 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
74197
74198 xla_ae_lines_pkg.set_segment(
74199 p_to_segment_code => 'GL_ACCOUNT'
74200 , p_segment_value => l_segment
74201 , p_from_segment_code => l_adr_value_segment_code
74202 , p_from_combination_id => l_adr_value_combination_id
74203 , p_value_type_code => l_adr_value_type_code
74204 , p_transaction_coa_id => l_adr_transaction_coa_id
74205 , p_accounting_coa_id => l_adr_accounting_coa_id
74206 , p_flexfield_segment_code => l_adr_flexfield_segment_code
74207 , p_flex_value_set_id => l_adr_flex_value_set_id
74208 , p_adr_code => 'FA_COST_OF_REM_GAIN_SEGMENT'
74209 , p_adr_type_code => 'S'
74210 , p_component_type => l_component_type
74211 , p_component_code => l_component_code
74212 , p_component_type_code => l_component_type_code
74213 , p_component_appl_id => l_component_appl_id
74214 , p_amb_context_code => l_amb_context_code
74215 , p_entity_code => 'TRANSACTIONS'
74216 , p_event_class_code => 'RETIREMENTS'
74217 , p_side => 'NA'
74218 );
74219
74220 END IF;
74221
74222 l_segment := AcctDerRule_169(
74223 p_application_id => p_application_id
74224 , p_ae_header_id => l_ae_header_id
74225 , p_source_5 => p_source_5
74226 , p_source_31 => p_source_31
74227 , x_transaction_coa_id => l_adr_transaction_coa_id
74228 , x_accounting_coa_id => l_adr_accounting_coa_id
74229 , x_flexfield_segment_code => l_adr_flexfield_segment_code
74230 , x_flex_value_set_id => l_adr_flex_value_set_id
74231 , x_value_type_code => l_adr_value_type_code
74232 , x_value_combination_id => l_adr_value_combination_id
74233 , x_value_segment_code => l_adr_value_segment_code
74234 , p_side => 'NA'
74235 , p_override_seg_flag => 'Y'
74236 );
74237
74238 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
74239
74240 xla_ae_lines_pkg.set_segment(
74241 p_to_segment_code => 'GL_BALANCING'
74242 , p_segment_value => l_segment
74243 , p_from_segment_code => l_adr_value_segment_code
74244 , p_from_combination_id => l_adr_value_combination_id
74245 , p_value_type_code => l_adr_value_type_code
74246 , p_transaction_coa_id => l_adr_transaction_coa_id
74247 , p_accounting_coa_id => l_adr_accounting_coa_id
74248 , p_flexfield_segment_code => l_adr_flexfield_segment_code
74249 , p_flex_value_set_id => l_adr_flex_value_set_id
74250 , p_adr_code => 'FA_EXPENSE_ACCT'
74251 , p_adr_type_code => 'S'
74252 , p_component_type => l_component_type
74256 , p_amb_context_code => l_amb_context_code
74253 , p_component_code => l_component_code
74254 , p_component_type_code => l_component_type_code
74255 , p_component_appl_id => l_component_appl_id
74257 , p_entity_code => 'TRANSACTIONS'
74258 , p_event_class_code => 'RETIREMENTS'
74259 , p_side => 'NA'
74260 );
74261
74262 END IF;
74263
74264 --
74265 --
74266 END IF;
74267
74268 --
74269 -- Update the line information that should be overwritten
74270 --
74271 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
74272 p_header_num => 1);
74273 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
74274
74275 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
74276
74277 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
74278 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
74279 END IF;
74280
74281 --
74282 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
74283 --
74284 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
74285 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
74286 ELSE
74287 ---------------------------------------------------------------------------------------------------
74288 -- 4262811a Switch Sign
74289 ---------------------------------------------------------------------------------------------------
74290 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
74291 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
74292 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
74293 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
74294 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
74295 -- 5132302
74296 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
74297 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
74298
74299 END IF;
74300
74301 -- 4955764
74302 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
74303 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
74304
74305
74306 XLA_AE_LINES_PKG.ValidateCurrentLine;
74307 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
74308
74309 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
74310 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
74311 ,p_balance_type_code => l_balance_type_code);
74312
74313 END IF;
74314
74315 -----------------------------------------------------------------------------------------
74316 -- 4262811 Multiperiod Accounting
74317 -----------------------------------------------------------------------------------------
74318 -- No MPA option is assigned.
74319
74320
74321 END IF;
74322 END IF;
74323 --
74324
74325 --
74326 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
74327 trace
74328 (p_msg => 'END of AcctLineType_267'
74329 ,p_level => C_LEVEL_PROCEDURE
74330 ,p_module => l_log_module);
74331 END IF;
74332 --
74333 EXCEPTION
74334 WHEN xla_exceptions_pkg.application_exception THEN
74335 RAISE;
74336 WHEN OTHERS THEN
74337 xla_exceptions_pkg.raise_message
74338 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_267');
74339 END AcctLineType_267;
74340 --
74341
74342 ---------------------------------------
74343 --
74344 -- PRIVATE FUNCTION
74345 -- AcctLineType_268
74346 --
74347 ---------------------------------------
74348 PROCEDURE AcctLineType_268 (
74349 p_application_id IN NUMBER
74350 ,p_event_id IN NUMBER
74351 ,p_calculate_acctd_flag IN VARCHAR2
74352 ,p_calculate_g_l_flag IN VARCHAR2
74353 ,p_actual_flag IN OUT VARCHAR2
74354 ,p_balance_type_code OUT VARCHAR2
74355 ,p_gain_or_loss_ref OUT VARCHAR2
74356
74357 --Period Close Date
74358 , p_source_1 IN DATE
74359 --Generated Code Combination Identifier
74360 , p_source_5 IN NUMBER
74361 --Cost Of Removal Gain Account
74362 , p_source_15 IN VARCHAR2
74363 --Expense Account Code Combination Identifier
74364 , p_source_31 IN NUMBER
74365 --Default Code Combination Identifier
74366 , p_source_32 IN NUMBER
74367 --Adjustment Type
74368 , p_source_48 IN VARCHAR2
74369 --Transaction Header Identifier
74370 , p_source_49 IN NUMBER
74371 --Adjustment Line Identifier
74372 , p_source_50 IN NUMBER
74373 --Distribution Type Code
74374 , p_source_51 IN VARCHAR2
74375 --Entered Amount
74376 , p_source_52 IN NUMBER
74377 --Currency Code
74378 , p_source_53 IN VARCHAR2
74382 IS
74379 --Gain Loss Amount
74380 , p_source_54 IN NUMBER
74381 )
74383
74384 l_component_type VARCHAR2(80);
74385 l_component_code VARCHAR2(30);
74386 l_component_type_code VARCHAR2(1);
74387 l_component_appl_id INTEGER;
74388 l_amb_context_code VARCHAR2(30);
74389 l_entity_code VARCHAR2(30);
74390 l_event_class_code VARCHAR2(30);
74391 l_ae_header_id NUMBER;
74392 l_event_type_code VARCHAR2(30);
74393 l_line_definition_code VARCHAR2(30);
74394 l_line_definition_owner_code VARCHAR2(1);
74395 --
74396 -- adr variables
74397 l_segment VARCHAR2(30);
74398 l_ccid NUMBER;
74399 l_adr_transaction_coa_id NUMBER;
74400 l_adr_accounting_coa_id NUMBER;
74401 l_adr_flexfield_segment_code VARCHAR2(30);
74402 l_adr_flex_value_set_id NUMBER;
74403 l_adr_value_type_code VARCHAR2(30);
74404 l_adr_value_combination_id NUMBER;
74405 l_adr_value_segment_code VARCHAR2(30);
74406
74407 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
74408 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
74409 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
74410 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
74411
74412 -- 4262811 Variables ------------------------------------------------------------------------------------------
74413 l_entered_amt_idx NUMBER;
74414 l_accted_amt_idx NUMBER;
74415 l_acc_rev_flag VARCHAR2(1);
74416 l_accrual_line_num NUMBER;
74417 l_tmp_amt NUMBER;
74418 l_acc_rev_natural_side_code VARCHAR2(1);
74419
74420 l_num_entries NUMBER;
74421 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
74422 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
74423 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
74424 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
74425 l_recog_line_1 NUMBER;
74426 l_recog_line_2 NUMBER;
74427
74428 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
74429 l_bflow_applied_to_amt NUMBER; -- 5132302
74430 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
74431
74432 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
74433
74434 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
74435 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
74436
74437 ---------------------------------------------------------------------------------------------------------------
74438
74439
74440 --
74441 -- bulk performance
74442 --
74443 l_balance_type_code VARCHAR2(1);
74444 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
74445 l_log_module VARCHAR2(240);
74446
74447 --
74448 -- Upgrade strategy
74449 --
74450 l_actual_upg_option VARCHAR2(1);
74451 l_enc_upg_option VARCHAR2(1);
74452
74453 --
74454 BEGIN
74455 --
74456 IF g_log_enabled THEN
74457 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_268';
74458 END IF;
74459 --
74460 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
74461
74462 trace
74463 (p_msg => 'BEGIN of AcctLineType_268'
74464 ,p_level => C_LEVEL_PROCEDURE
74465 ,p_module => l_log_module);
74466
74467 END IF;
74468 --
74469 l_component_type := 'AMB_JLT';
74470 l_component_code := 'FA_COST_OF_REMOVAL_GAIN';
74471 l_component_type_code := 'S';
74472 l_component_appl_id := 140;
74473 l_amb_context_code := 'DEFAULT';
74474 l_entity_code := 'TRANSACTIONS';
74475 l_event_class_code := 'RETIREMENTS';
74476 l_event_type_code := 'REINSTATEMENTS';
74477 l_line_definition_owner_code := 'S';
74478 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
74479 --
74480 l_balance_type_code := 'A';
74481 l_segment := NULL;
74482 l_ccid := NULL;
74483 l_adr_transaction_coa_id := NULL;
74484 l_adr_accounting_coa_id := NULL;
74485 l_adr_flexfield_segment_code := NULL;
74486 l_adr_flex_value_set_id := NULL;
74487 l_adr_value_type_code := NULL;
74488 l_adr_value_combination_id := NULL;
74489 l_adr_value_segment_code := NULL;
74490
74491 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
74492 l_bflow_class_code := ''; -- 4219869 Business Flow
74493 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
74494 l_budgetary_control_flag := 'N';
74495
74496 l_bflow_applied_to_amt_idx := NULL; -- 5132302
74497 l_bflow_applied_to_amt := NULL; -- 5132302
74498 l_entered_amt_idx := NULL; -- 4262811
74499 l_accted_amt_idx := NULL; -- 4262811
74500 l_acc_rev_flag := NULL; -- 4262811
74501 l_accrual_line_num := NULL; -- 4262811
74502 l_tmp_amt := NULL; -- 4262811
74503 --
74504
74508 ') = 'REMOVALCOST' AND
74505 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
74506 l_balance_type_code <> 'B' THEN
74507 IF NVL(p_source_48,'
74509 p_source_54 >= 0
74510 THEN
74511
74512 --
74513 XLA_AE_LINES_PKG.SetNewLine;
74514
74515 p_balance_type_code := l_balance_type_code;
74516 -- set the flag so later we will know whether the gain loss line needs to be created
74517
74518 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
74519 p_actual_flag :='A';
74520 END IF;
74521
74522 --
74523 -- bulk performance
74524 --
74525 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
74526 p_header_num => 0); -- 4262811
74527 --
74528 -- set accounting line options
74529 --
74530 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
74531 p_natural_side_code => 'D'
74532 , p_gain_or_loss_flag => 'N'
74533 , p_gl_transfer_mode_code => 'S'
74534 , p_acct_entry_type_code => 'A'
74535 , p_switch_side_flag => 'Y'
74536 , p_merge_duplicate_code => 'N'
74537 );
74538 --
74539 l_acc_rev_natural_side_code := 'C'; -- 4262811
74540 --
74541 --
74542 -- set accounting line type info
74543 --
74544 xla_ae_lines_pkg.SetAcctLineType
74545 (p_component_type => l_component_type
74546 ,p_event_type_code => l_event_type_code
74547 ,p_line_definition_owner_code => l_line_definition_owner_code
74548 ,p_line_definition_code => l_line_definition_code
74549 ,p_accounting_line_code => l_component_code
74550 ,p_accounting_line_type_code => l_component_type_code
74551 ,p_accounting_line_appl_id => l_component_appl_id
74552 ,p_amb_context_code => l_amb_context_code
74553 ,p_entity_code => l_entity_code
74554 ,p_event_class_code => l_event_class_code);
74555 --
74556 -- set accounting class
74557 --
74558 xla_ae_lines_pkg.SetAcctClass(
74559 p_accounting_class_code => 'ASSET'
74560 , p_ae_header_id => l_ae_header_id
74561 );
74562
74563 --
74564 -- set rounding class
74565 --
74566 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
74567 'ASSET';
74568
74569 --
74570 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
74571 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
74572 --
74573 -- bulk performance
74574 --
74575 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
74576
74577 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
74578 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
74579
74580 -- 4955764
74581 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
74582 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
74583
74584 -- 4458381 Public Sector Enh
74585
74586 --
74587 -- set accounting attributes for the line type
74588 --
74589 l_entered_amt_idx := 4;
74590 l_accted_amt_idx := 6;
74591 l_bflow_applied_to_amt_idx := NULL; -- 5132302
74592 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
74593 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
74594 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
74595 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
74596 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
74597 l_rec_acct_attrs.array_char_value(3) := p_source_51;
74598 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
74599 l_rec_acct_attrs.array_num_value(4) := p_source_52;
74600 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
74601 l_rec_acct_attrs.array_char_value(5) := p_source_53;
74602 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
74603 l_rec_acct_attrs.array_num_value(6) := p_source_52;
74604
74605 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
74606 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
74607
74608 ---------------------------------------------------------------------------------------------------------------
74609 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
74610 ---------------------------------------------------------------------------------------------------------------
74611 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
74612
74613 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
74614 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
74615
74616 IF xla_accounting_cache_pkg.GetValueChar
74617 (p_source_code => 'LEDGER_CATEGORY_CODE'
74621 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
74618 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
74619 AND l_bflow_method_code = 'PRIOR_ENTRY'
74620 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
74622 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
74623 )
74624 THEN
74625 xla_ae_lines_pkg.BflowUpgEntry
74626 (p_business_method_code => l_bflow_method_code
74627 ,p_business_class_code => l_bflow_class_code
74628 ,p_balance_type => l_balance_type_code);
74629 ELSE
74630 NULL;
74631 -- No business flow processing for business flow method of NONE.
74632 END IF;
74633
74634 --
74635 -- call analytical criteria
74636 --
74637
74638 --
74639 -- call description
74640 --
74641
74642 xla_ae_lines_pkg.SetLineDescription(
74643 p_ae_header_id => l_ae_header_id
74644 ,p_description => Description_78 (
74645 p_application_id => p_application_id
74646 , p_ae_header_id => l_ae_header_id
74647 , p_source_1 => p_source_1
74648 )
74649 );
74650
74651
74652 --
74653 -- call ADRs
74654 -- Bug 4922099
74655 --
74656 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
74657 (NVL(l_actual_upg_option, 'N') = 'O') OR
74658 (NVL(l_enc_upg_option, 'N') = 'O')
74659 )
74660 THEN
74661 NULL;
74662 --
74663 --
74664
74665 l_ccid := AcctDerRule_174(
74666 p_application_id => p_application_id
74667 , p_ae_header_id => l_ae_header_id
74668 , p_source_5 => p_source_5
74669 , p_source_32 => p_source_32
74670 , x_transaction_coa_id => l_adr_transaction_coa_id
74671 , x_accounting_coa_id => l_adr_accounting_coa_id
74672 , x_value_type_code => l_adr_value_type_code
74673 , p_side => 'NA'
74674 );
74675
74676 xla_ae_lines_pkg.set_ccid(
74677 p_code_combination_id => l_ccid
74678 , p_value_type_code => l_adr_value_type_code
74679 , p_transaction_coa_id => l_adr_transaction_coa_id
74680 , p_accounting_coa_id => l_adr_accounting_coa_id
74681 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
74682 , p_adr_type_code => 'S'
74683 , p_component_type => l_component_type
74684 , p_component_code => l_component_code
74685 , p_component_type_code => l_component_type_code
74686 , p_component_appl_id => l_component_appl_id
74687 , p_amb_context_code => l_amb_context_code
74688 , p_side => 'NA'
74689 );
74690
74691
74692 l_segment := AcctDerRule_153(
74693 p_application_id => p_application_id
74694 , p_ae_header_id => l_ae_header_id
74695 , p_source_5 => p_source_5
74696 , p_source_15 => p_source_15
74697 , x_transaction_coa_id => l_adr_transaction_coa_id
74698 , x_accounting_coa_id => l_adr_accounting_coa_id
74699 , x_flexfield_segment_code => l_adr_flexfield_segment_code
74700 , x_flex_value_set_id => l_adr_flex_value_set_id
74701 , x_value_type_code => l_adr_value_type_code
74702 , x_value_combination_id => l_adr_value_combination_id
74703 , x_value_segment_code => l_adr_value_segment_code
74704 , p_side => 'NA'
74705 , p_override_seg_flag => 'Y'
74706 );
74707
74708 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
74709
74710 xla_ae_lines_pkg.set_segment(
74711 p_to_segment_code => 'GL_ACCOUNT'
74712 , p_segment_value => l_segment
74713 , p_from_segment_code => l_adr_value_segment_code
74714 , p_from_combination_id => l_adr_value_combination_id
74715 , p_value_type_code => l_adr_value_type_code
74716 , p_transaction_coa_id => l_adr_transaction_coa_id
74717 , p_accounting_coa_id => l_adr_accounting_coa_id
74718 , p_flexfield_segment_code => l_adr_flexfield_segment_code
74719 , p_flex_value_set_id => l_adr_flex_value_set_id
74720 , p_adr_code => 'FA_COST_OF_REM_GAIN_SEGMENT'
74721 , p_adr_type_code => 'S'
74722 , p_component_type => l_component_type
74723 , p_component_code => l_component_code
74724 , p_component_type_code => l_component_type_code
74725 , p_component_appl_id => l_component_appl_id
74726 , p_amb_context_code => l_amb_context_code
74727 , p_entity_code => 'TRANSACTIONS'
74728 , p_event_class_code => 'RETIREMENTS'
74729 , p_side => 'NA'
74730 );
74731
74732 END IF;
74733
74734 l_segment := AcctDerRule_169(
74735 p_application_id => p_application_id
74736 , p_ae_header_id => l_ae_header_id
74737 , p_source_5 => p_source_5
74738 , p_source_31 => p_source_31
74739 , x_transaction_coa_id => l_adr_transaction_coa_id
74740 , x_accounting_coa_id => l_adr_accounting_coa_id
74741 , x_flexfield_segment_code => l_adr_flexfield_segment_code
74745 , x_value_segment_code => l_adr_value_segment_code
74742 , x_flex_value_set_id => l_adr_flex_value_set_id
74743 , x_value_type_code => l_adr_value_type_code
74744 , x_value_combination_id => l_adr_value_combination_id
74746 , p_side => 'NA'
74747 , p_override_seg_flag => 'Y'
74748 );
74749
74750 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
74751
74752 xla_ae_lines_pkg.set_segment(
74753 p_to_segment_code => 'GL_BALANCING'
74754 , p_segment_value => l_segment
74755 , p_from_segment_code => l_adr_value_segment_code
74756 , p_from_combination_id => l_adr_value_combination_id
74757 , p_value_type_code => l_adr_value_type_code
74758 , p_transaction_coa_id => l_adr_transaction_coa_id
74759 , p_accounting_coa_id => l_adr_accounting_coa_id
74760 , p_flexfield_segment_code => l_adr_flexfield_segment_code
74761 , p_flex_value_set_id => l_adr_flex_value_set_id
74762 , p_adr_code => 'FA_EXPENSE_ACCT'
74763 , p_adr_type_code => 'S'
74764 , p_component_type => l_component_type
74765 , p_component_code => l_component_code
74766 , p_component_type_code => l_component_type_code
74767 , p_component_appl_id => l_component_appl_id
74768 , p_amb_context_code => l_amb_context_code
74769 , p_entity_code => 'TRANSACTIONS'
74770 , p_event_class_code => 'RETIREMENTS'
74771 , p_side => 'NA'
74772 );
74773
74774 END IF;
74775
74776 --
74777 --
74778 END IF;
74779 --
74780 -- Bug 4922099
74781 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
74782 (NVL(l_enc_upg_option, 'N') = 'O')
74783 ) AND
74784 (l_bflow_method_code = 'PRIOR_ENTRY')
74785 )
74786 THEN
74787 IF
74788 --
74789 1 = 2
74790 --
74791 THEN
74792 xla_accounting_err_pkg.build_message
74793 (p_appli_s_name => 'XLA'
74794 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
74795 ,p_token_1 => 'LINE_NUMBER'
74796 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
74797 ,p_token_2 => 'LINE_TYPE_NAME'
74798 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
74799 l_component_type
74800 ,l_component_code
74801 ,l_component_type_code
74802 ,l_component_appl_id
74803 ,l_amb_context_code
74804 ,l_entity_code
74805 ,l_event_class_code
74806 )
74807 ,p_token_3 => 'OWNER'
74808 ,p_value_3 => xla_lookups_pkg.get_meaning(
74809 p_lookup_type => 'XLA_OWNER_TYPE'
74810 ,p_lookup_code => l_component_type_code
74811 )
74812 ,p_token_4 => 'PRODUCT_NAME'
74813 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
74814 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
74815 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
74816 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
74817 ,p_ae_header_id => NULL
74818 );
74819
74820 IF (C_LEVEL_ERROR>= g_log_level) THEN
74821 trace
74822 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
74823 ,p_level => C_LEVEL_ERROR
74824 ,p_module => l_log_module);
74825 END IF;
74826 END IF;
74827 END IF;
74828 --
74829 --
74830 ------------------------------------------------------------------------------------------------
74831 -- 4219869 Business Flow
74832 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
74833 -- Prior Entry. Currently, the following code is always generated.
74834 ------------------------------------------------------------------------------------------------
74835 XLA_AE_LINES_PKG.ValidateCurrentLine;
74836
74837 ------------------------------------------------------------------------------------
74838 -- 4219869 Business Flow
74839 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
74843 ----------------------------------------------------------------------------------
74840 ------------------------------------------------------------------------------------
74841 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
74842
74844 -- 4219869 Business Flow
74845 -- Update journal entry status -- Need to generate this within IF <condition>
74846 ----------------------------------------------------------------------------------
74847 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
74848 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
74849 ,p_balance_type_code => l_balance_type_code
74850 );
74851
74852 -------------------------------------------------------------------------------------------
74853 -- 4262811 - Generate the Accrual Reversal lines
74854 -------------------------------------------------------------------------------------------
74855 BEGIN
74856 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
74857 (g_array_event(p_event_id).array_value_num('header_index'));
74858 IF l_acc_rev_flag IS NULL THEN
74859 l_acc_rev_flag := 'N';
74860 END IF;
74861 EXCEPTION
74862 WHEN OTHERS THEN
74863 l_acc_rev_flag := 'N';
74864 END;
74865 --
74866 IF (l_acc_rev_flag = 'Y') THEN
74867
74868 -- 4645092 ------------------------------------------------------------------------------
74869 -- To allow MPA report to determine if it should generate report process
74870 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
74871 ------------------------------------------------------------------------------------------
74872
74873 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
74874 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
74875 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
74876 -- call ADRs
74877 -- Bug 4922099
74878 --
74879 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
74880 (NVL(l_actual_upg_option, 'N') = 'O') OR
74881 (NVL(l_enc_upg_option, 'N') = 'O')
74882 )
74883 THEN
74884 NULL;
74885 --
74886 --
74887
74888 l_ccid := AcctDerRule_174(
74889 p_application_id => p_application_id
74890 , p_ae_header_id => l_ae_header_id
74891 , p_source_5 => p_source_5
74892 , p_source_32 => p_source_32
74893 , x_transaction_coa_id => l_adr_transaction_coa_id
74894 , x_accounting_coa_id => l_adr_accounting_coa_id
74895 , x_value_type_code => l_adr_value_type_code
74896 , p_side => 'NA'
74897 );
74898
74899 xla_ae_lines_pkg.set_ccid(
74900 p_code_combination_id => l_ccid
74901 , p_value_type_code => l_adr_value_type_code
74902 , p_transaction_coa_id => l_adr_transaction_coa_id
74903 , p_accounting_coa_id => l_adr_accounting_coa_id
74904 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
74905 , p_adr_type_code => 'S'
74906 , p_component_type => l_component_type
74907 , p_component_code => l_component_code
74908 , p_component_type_code => l_component_type_code
74909 , p_component_appl_id => l_component_appl_id
74910 , p_amb_context_code => l_amb_context_code
74911 , p_side => 'NA'
74912 );
74913
74914
74915 l_segment := AcctDerRule_153(
74916 p_application_id => p_application_id
74917 , p_ae_header_id => l_ae_header_id
74918 , p_source_5 => p_source_5
74919 , p_source_15 => p_source_15
74920 , x_transaction_coa_id => l_adr_transaction_coa_id
74921 , x_accounting_coa_id => l_adr_accounting_coa_id
74922 , x_flexfield_segment_code => l_adr_flexfield_segment_code
74923 , x_flex_value_set_id => l_adr_flex_value_set_id
74924 , x_value_type_code => l_adr_value_type_code
74925 , x_value_combination_id => l_adr_value_combination_id
74926 , x_value_segment_code => l_adr_value_segment_code
74927 , p_side => 'NA'
74928 , p_override_seg_flag => 'Y'
74929 );
74930
74931 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
74932
74933 xla_ae_lines_pkg.set_segment(
74934 p_to_segment_code => 'GL_ACCOUNT'
74935 , p_segment_value => l_segment
74936 , p_from_segment_code => l_adr_value_segment_code
74937 , p_from_combination_id => l_adr_value_combination_id
74938 , p_value_type_code => l_adr_value_type_code
74939 , p_transaction_coa_id => l_adr_transaction_coa_id
74940 , p_accounting_coa_id => l_adr_accounting_coa_id
74941 , p_flexfield_segment_code => l_adr_flexfield_segment_code
74942 , p_flex_value_set_id => l_adr_flex_value_set_id
74943 , p_adr_code => 'FA_COST_OF_REM_GAIN_SEGMENT'
74944 , p_adr_type_code => 'S'
74945 , p_component_type => l_component_type
74946 , p_component_code => l_component_code
74947 , p_component_type_code => l_component_type_code
74948 , p_component_appl_id => l_component_appl_id
74949 , p_amb_context_code => l_amb_context_code
74953 );
74950 , p_entity_code => 'TRANSACTIONS'
74951 , p_event_class_code => 'RETIREMENTS'
74952 , p_side => 'NA'
74954
74955 END IF;
74956
74957 l_segment := AcctDerRule_169(
74958 p_application_id => p_application_id
74959 , p_ae_header_id => l_ae_header_id
74960 , p_source_5 => p_source_5
74961 , p_source_31 => p_source_31
74962 , x_transaction_coa_id => l_adr_transaction_coa_id
74963 , x_accounting_coa_id => l_adr_accounting_coa_id
74964 , x_flexfield_segment_code => l_adr_flexfield_segment_code
74965 , x_flex_value_set_id => l_adr_flex_value_set_id
74966 , x_value_type_code => l_adr_value_type_code
74967 , x_value_combination_id => l_adr_value_combination_id
74968 , x_value_segment_code => l_adr_value_segment_code
74969 , p_side => 'NA'
74970 , p_override_seg_flag => 'Y'
74971 );
74972
74973 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
74974
74975 xla_ae_lines_pkg.set_segment(
74976 p_to_segment_code => 'GL_BALANCING'
74977 , p_segment_value => l_segment
74978 , p_from_segment_code => l_adr_value_segment_code
74979 , p_from_combination_id => l_adr_value_combination_id
74980 , p_value_type_code => l_adr_value_type_code
74981 , p_transaction_coa_id => l_adr_transaction_coa_id
74982 , p_accounting_coa_id => l_adr_accounting_coa_id
74983 , p_flexfield_segment_code => l_adr_flexfield_segment_code
74984 , p_flex_value_set_id => l_adr_flex_value_set_id
74985 , p_adr_code => 'FA_EXPENSE_ACCT'
74986 , p_adr_type_code => 'S'
74987 , p_component_type => l_component_type
74988 , p_component_code => l_component_code
74989 , p_component_type_code => l_component_type_code
74990 , p_component_appl_id => l_component_appl_id
74991 , p_amb_context_code => l_amb_context_code
74992 , p_entity_code => 'TRANSACTIONS'
74993 , p_event_class_code => 'RETIREMENTS'
74994 , p_side => 'NA'
74995 );
74996
74997 END IF;
74998
74999 --
75000 --
75001 END IF;
75002
75003 --
75004 -- Update the line information that should be overwritten
75005 --
75006 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
75007 p_header_num => 1);
75008 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
75009
75010 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
75011
75012 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
75013 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
75014 END IF;
75015
75016 --
75017 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
75018 --
75019 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
75020 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
75021 ELSE
75022 ---------------------------------------------------------------------------------------------------
75023 -- 4262811a Switch Sign
75024 ---------------------------------------------------------------------------------------------------
75025 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
75026 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
75027 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
75028 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
75029 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
75030 -- 5132302
75031 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
75032 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
75033
75034 END IF;
75035
75036 -- 4955764
75037 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
75038 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
75039
75040
75041 XLA_AE_LINES_PKG.ValidateCurrentLine;
75042 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
75043
75044 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
75045 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
75046 ,p_balance_type_code => l_balance_type_code);
75047
75048 END IF;
75049
75050 -----------------------------------------------------------------------------------------
75051 -- 4262811 Multiperiod Accounting
75052 -----------------------------------------------------------------------------------------
75053 -- No MPA option is assigned.
75054
75055
75056 END IF;
75057 END IF;
75061 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
75058 --
75059
75060 --
75062 trace
75063 (p_msg => 'END of AcctLineType_268'
75064 ,p_level => C_LEVEL_PROCEDURE
75065 ,p_module => l_log_module);
75066 END IF;
75067 --
75068 EXCEPTION
75069 WHEN xla_exceptions_pkg.application_exception THEN
75070 RAISE;
75071 WHEN OTHERS THEN
75072 xla_exceptions_pkg.raise_message
75073 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_268');
75074 END AcctLineType_268;
75075 --
75076
75077 ---------------------------------------
75078 --
75079 -- PRIVATE FUNCTION
75080 -- AcctLineType_269
75081 --
75082 ---------------------------------------
75083 PROCEDURE AcctLineType_269 (
75084 p_application_id IN NUMBER
75085 ,p_event_id IN NUMBER
75086 ,p_calculate_acctd_flag IN VARCHAR2
75087 ,p_calculate_g_l_flag IN VARCHAR2
75088 ,p_actual_flag IN OUT VARCHAR2
75089 ,p_balance_type_code OUT VARCHAR2
75090 ,p_gain_or_loss_ref OUT VARCHAR2
75091
75092 --Period Close Date
75093 , p_source_1 IN DATE
75094 --Generated Code Combination Identifier
75095 , p_source_5 IN NUMBER
75096 --Cost Of Removal Loss Account
75097 , p_source_16 IN VARCHAR2
75098 --Expense Account Code Combination Identifier
75099 , p_source_31 IN NUMBER
75100 --Default Code Combination Identifier
75101 , p_source_32 IN NUMBER
75102 --Adjustment Type
75103 , p_source_48 IN VARCHAR2
75104 --Transaction Header Identifier
75105 , p_source_49 IN NUMBER
75106 --Adjustment Line Identifier
75107 , p_source_50 IN NUMBER
75108 --Distribution Type Code
75109 , p_source_51 IN VARCHAR2
75110 --Entered Amount
75111 , p_source_52 IN NUMBER
75112 --Currency Code
75113 , p_source_53 IN VARCHAR2
75114 --Gain Loss Amount
75115 , p_source_54 IN NUMBER
75116 )
75117 IS
75118
75119 l_component_type VARCHAR2(80);
75120 l_component_code VARCHAR2(30);
75121 l_component_type_code VARCHAR2(1);
75122 l_component_appl_id INTEGER;
75123 l_amb_context_code VARCHAR2(30);
75124 l_entity_code VARCHAR2(30);
75125 l_event_class_code VARCHAR2(30);
75126 l_ae_header_id NUMBER;
75127 l_event_type_code VARCHAR2(30);
75128 l_line_definition_code VARCHAR2(30);
75129 l_line_definition_owner_code VARCHAR2(1);
75130 --
75131 -- adr variables
75132 l_segment VARCHAR2(30);
75133 l_ccid NUMBER;
75134 l_adr_transaction_coa_id NUMBER;
75135 l_adr_accounting_coa_id NUMBER;
75136 l_adr_flexfield_segment_code VARCHAR2(30);
75137 l_adr_flex_value_set_id NUMBER;
75138 l_adr_value_type_code VARCHAR2(30);
75139 l_adr_value_combination_id NUMBER;
75140 l_adr_value_segment_code VARCHAR2(30);
75141
75142 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
75143 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
75144 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
75145 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
75146
75147 -- 4262811 Variables ------------------------------------------------------------------------------------------
75148 l_entered_amt_idx NUMBER;
75149 l_accted_amt_idx NUMBER;
75150 l_acc_rev_flag VARCHAR2(1);
75151 l_accrual_line_num NUMBER;
75152 l_tmp_amt NUMBER;
75153 l_acc_rev_natural_side_code VARCHAR2(1);
75154
75155 l_num_entries NUMBER;
75156 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
75157 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
75158 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
75159 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
75160 l_recog_line_1 NUMBER;
75161 l_recog_line_2 NUMBER;
75162
75163 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
75164 l_bflow_applied_to_amt NUMBER; -- 5132302
75165 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
75166
75167 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
75168
75169 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
75170 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
75171
75172 ---------------------------------------------------------------------------------------------------------------
75173
75174
75175 --
75176 -- bulk performance
75177 --
75178 l_balance_type_code VARCHAR2(1);
75179 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
75180 l_log_module VARCHAR2(240);
75181
75182 --
75183 -- Upgrade strategy
75184 --
75185 l_actual_upg_option VARCHAR2(1);
75186 l_enc_upg_option VARCHAR2(1);
75187
75188 --
75189 BEGIN
75190 --
75191 IF g_log_enabled THEN
75192 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_269';
75193 END IF;
75194 --
75198 (p_msg => 'BEGIN of AcctLineType_269'
75195 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
75196
75197 trace
75199 ,p_level => C_LEVEL_PROCEDURE
75200 ,p_module => l_log_module);
75201
75202 END IF;
75203 --
75204 l_component_type := 'AMB_JLT';
75205 l_component_code := 'FA_COST_OF_REMOVAL_LOSS';
75206 l_component_type_code := 'S';
75207 l_component_appl_id := 140;
75208 l_amb_context_code := 'DEFAULT';
75209 l_entity_code := 'TRANSACTIONS';
75210 l_event_class_code := 'RETIREMENTS';
75211 l_event_type_code := 'REINSTATEMENTS';
75212 l_line_definition_owner_code := 'S';
75213 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
75214 --
75215 l_balance_type_code := 'A';
75216 l_segment := NULL;
75217 l_ccid := NULL;
75218 l_adr_transaction_coa_id := NULL;
75219 l_adr_accounting_coa_id := NULL;
75220 l_adr_flexfield_segment_code := NULL;
75221 l_adr_flex_value_set_id := NULL;
75222 l_adr_value_type_code := NULL;
75223 l_adr_value_combination_id := NULL;
75224 l_adr_value_segment_code := NULL;
75225
75226 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
75227 l_bflow_class_code := ''; -- 4219869 Business Flow
75228 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
75229 l_budgetary_control_flag := 'N';
75230
75231 l_bflow_applied_to_amt_idx := NULL; -- 5132302
75232 l_bflow_applied_to_amt := NULL; -- 5132302
75233 l_entered_amt_idx := NULL; -- 4262811
75234 l_accted_amt_idx := NULL; -- 4262811
75235 l_acc_rev_flag := NULL; -- 4262811
75236 l_accrual_line_num := NULL; -- 4262811
75237 l_tmp_amt := NULL; -- 4262811
75238 --
75239
75240 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
75241 l_balance_type_code <> 'B' THEN
75242 IF NVL(p_source_48,'
75243 ') = 'REMOVALCOST' AND
75244 p_source_54 < 0
75245 THEN
75246
75247 --
75248 XLA_AE_LINES_PKG.SetNewLine;
75249
75250 p_balance_type_code := l_balance_type_code;
75251 -- set the flag so later we will know whether the gain loss line needs to be created
75252
75253 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
75254 p_actual_flag :='A';
75255 END IF;
75256
75257 --
75258 -- bulk performance
75259 --
75260 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
75261 p_header_num => 0); -- 4262811
75262 --
75263 -- set accounting line options
75264 --
75265 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
75266 p_natural_side_code => 'D'
75267 , p_gain_or_loss_flag => 'N'
75268 , p_gl_transfer_mode_code => 'S'
75269 , p_acct_entry_type_code => 'A'
75270 , p_switch_side_flag => 'Y'
75271 , p_merge_duplicate_code => 'N'
75272 );
75273 --
75274 l_acc_rev_natural_side_code := 'C'; -- 4262811
75275 --
75276 --
75277 -- set accounting line type info
75278 --
75279 xla_ae_lines_pkg.SetAcctLineType
75280 (p_component_type => l_component_type
75281 ,p_event_type_code => l_event_type_code
75282 ,p_line_definition_owner_code => l_line_definition_owner_code
75283 ,p_line_definition_code => l_line_definition_code
75284 ,p_accounting_line_code => l_component_code
75285 ,p_accounting_line_type_code => l_component_type_code
75286 ,p_accounting_line_appl_id => l_component_appl_id
75287 ,p_amb_context_code => l_amb_context_code
75288 ,p_entity_code => l_entity_code
75289 ,p_event_class_code => l_event_class_code);
75290 --
75291 -- set accounting class
75292 --
75293 xla_ae_lines_pkg.SetAcctClass(
75294 p_accounting_class_code => 'ASSET'
75295 , p_ae_header_id => l_ae_header_id
75296 );
75297
75298 --
75299 -- set rounding class
75300 --
75301 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
75302 'ASSET';
75303
75304 --
75305 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
75306 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
75307 --
75308 -- bulk performance
75309 --
75310 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
75311
75312 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
75313 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
75314
75315 -- 4955764
75316 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
75317 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
75318
75319 -- 4458381 Public Sector Enh
75320
75321 --
75322 -- set accounting attributes for the line type
75323 --
75324 l_entered_amt_idx := 4;
75325 l_accted_amt_idx := 6;
75329 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
75326 l_bflow_applied_to_amt_idx := NULL; -- 5132302
75327 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
75328 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
75330 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
75331 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
75332 l_rec_acct_attrs.array_char_value(3) := p_source_51;
75333 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
75334 l_rec_acct_attrs.array_num_value(4) := p_source_52;
75335 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
75336 l_rec_acct_attrs.array_char_value(5) := p_source_53;
75337 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
75338 l_rec_acct_attrs.array_num_value(6) := p_source_52;
75339
75340 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
75341 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
75342
75343 ---------------------------------------------------------------------------------------------------------------
75344 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
75345 ---------------------------------------------------------------------------------------------------------------
75346 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
75347
75348 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
75349 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
75350
75351 IF xla_accounting_cache_pkg.GetValueChar
75352 (p_source_code => 'LEDGER_CATEGORY_CODE'
75353 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
75354 AND l_bflow_method_code = 'PRIOR_ENTRY'
75355 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
75356 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
75357 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
75358 )
75359 THEN
75360 xla_ae_lines_pkg.BflowUpgEntry
75361 (p_business_method_code => l_bflow_method_code
75362 ,p_business_class_code => l_bflow_class_code
75363 ,p_balance_type => l_balance_type_code);
75364 ELSE
75365 NULL;
75366 -- No business flow processing for business flow method of NONE.
75367 END IF;
75368
75369 --
75370 -- call analytical criteria
75371 --
75372
75373 --
75374 -- call description
75375 --
75376
75377 xla_ae_lines_pkg.SetLineDescription(
75378 p_ae_header_id => l_ae_header_id
75379 ,p_description => Description_78 (
75380 p_application_id => p_application_id
75381 , p_ae_header_id => l_ae_header_id
75382 , p_source_1 => p_source_1
75383 )
75384 );
75385
75386
75387 --
75388 -- call ADRs
75389 -- Bug 4922099
75390 --
75391 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
75392 (NVL(l_actual_upg_option, 'N') = 'O') OR
75393 (NVL(l_enc_upg_option, 'N') = 'O')
75394 )
75395 THEN
75396 NULL;
75397 --
75398 --
75399
75400 l_ccid := AcctDerRule_174(
75401 p_application_id => p_application_id
75402 , p_ae_header_id => l_ae_header_id
75403 , p_source_5 => p_source_5
75404 , p_source_32 => p_source_32
75405 , x_transaction_coa_id => l_adr_transaction_coa_id
75406 , x_accounting_coa_id => l_adr_accounting_coa_id
75407 , x_value_type_code => l_adr_value_type_code
75408 , p_side => 'NA'
75409 );
75410
75411 xla_ae_lines_pkg.set_ccid(
75412 p_code_combination_id => l_ccid
75413 , p_value_type_code => l_adr_value_type_code
75414 , p_transaction_coa_id => l_adr_transaction_coa_id
75415 , p_accounting_coa_id => l_adr_accounting_coa_id
75416 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
75417 , p_adr_type_code => 'S'
75418 , p_component_type => l_component_type
75419 , p_component_code => l_component_code
75420 , p_component_type_code => l_component_type_code
75421 , p_component_appl_id => l_component_appl_id
75422 , p_amb_context_code => l_amb_context_code
75423 , p_side => 'NA'
75424 );
75425
75426
75427 l_segment := AcctDerRule_154(
75428 p_application_id => p_application_id
75429 , p_ae_header_id => l_ae_header_id
75430 , p_source_5 => p_source_5
75431 , p_source_16 => p_source_16
75432 , x_transaction_coa_id => l_adr_transaction_coa_id
75433 , x_accounting_coa_id => l_adr_accounting_coa_id
75434 , x_flexfield_segment_code => l_adr_flexfield_segment_code
75435 , x_flex_value_set_id => l_adr_flex_value_set_id
75436 , x_value_type_code => l_adr_value_type_code
75437 , x_value_combination_id => l_adr_value_combination_id
75438 , x_value_segment_code => l_adr_value_segment_code
75439 , p_side => 'NA'
75440 , p_override_seg_flag => 'Y'
75441 );
75445 xla_ae_lines_pkg.set_segment(
75442
75443 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
75444
75446 p_to_segment_code => 'GL_ACCOUNT'
75447 , p_segment_value => l_segment
75448 , p_from_segment_code => l_adr_value_segment_code
75449 , p_from_combination_id => l_adr_value_combination_id
75450 , p_value_type_code => l_adr_value_type_code
75451 , p_transaction_coa_id => l_adr_transaction_coa_id
75452 , p_accounting_coa_id => l_adr_accounting_coa_id
75453 , p_flexfield_segment_code => l_adr_flexfield_segment_code
75454 , p_flex_value_set_id => l_adr_flex_value_set_id
75455 , p_adr_code => 'FA_COST_OF_REM_LOSS_SEGMENT'
75456 , p_adr_type_code => 'S'
75457 , p_component_type => l_component_type
75458 , p_component_code => l_component_code
75459 , p_component_type_code => l_component_type_code
75460 , p_component_appl_id => l_component_appl_id
75461 , p_amb_context_code => l_amb_context_code
75462 , p_entity_code => 'TRANSACTIONS'
75463 , p_event_class_code => 'RETIREMENTS'
75464 , p_side => 'NA'
75465 );
75466
75467 END IF;
75468
75469 l_segment := AcctDerRule_169(
75470 p_application_id => p_application_id
75471 , p_ae_header_id => l_ae_header_id
75472 , p_source_5 => p_source_5
75473 , p_source_31 => p_source_31
75474 , x_transaction_coa_id => l_adr_transaction_coa_id
75475 , x_accounting_coa_id => l_adr_accounting_coa_id
75476 , x_flexfield_segment_code => l_adr_flexfield_segment_code
75477 , x_flex_value_set_id => l_adr_flex_value_set_id
75478 , x_value_type_code => l_adr_value_type_code
75479 , x_value_combination_id => l_adr_value_combination_id
75480 , x_value_segment_code => l_adr_value_segment_code
75481 , p_side => 'NA'
75482 , p_override_seg_flag => 'Y'
75483 );
75484
75485 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
75486
75487 xla_ae_lines_pkg.set_segment(
75488 p_to_segment_code => 'GL_BALANCING'
75489 , p_segment_value => l_segment
75490 , p_from_segment_code => l_adr_value_segment_code
75491 , p_from_combination_id => l_adr_value_combination_id
75492 , p_value_type_code => l_adr_value_type_code
75493 , p_transaction_coa_id => l_adr_transaction_coa_id
75494 , p_accounting_coa_id => l_adr_accounting_coa_id
75495 , p_flexfield_segment_code => l_adr_flexfield_segment_code
75496 , p_flex_value_set_id => l_adr_flex_value_set_id
75497 , p_adr_code => 'FA_EXPENSE_ACCT'
75498 , p_adr_type_code => 'S'
75499 , p_component_type => l_component_type
75500 , p_component_code => l_component_code
75501 , p_component_type_code => l_component_type_code
75502 , p_component_appl_id => l_component_appl_id
75503 , p_amb_context_code => l_amb_context_code
75504 , p_entity_code => 'TRANSACTIONS'
75505 , p_event_class_code => 'RETIREMENTS'
75506 , p_side => 'NA'
75507 );
75508
75509 END IF;
75510
75511 --
75512 --
75513 END IF;
75514 --
75515 -- Bug 4922099
75516 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
75517 (NVL(l_enc_upg_option, 'N') = 'O')
75518 ) AND
75519 (l_bflow_method_code = 'PRIOR_ENTRY')
75520 )
75521 THEN
75522 IF
75523 --
75524 1 = 2
75525 --
75526 THEN
75527 xla_accounting_err_pkg.build_message
75528 (p_appli_s_name => 'XLA'
75529 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
75530 ,p_token_1 => 'LINE_NUMBER'
75531 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
75532 ,p_token_2 => 'LINE_TYPE_NAME'
75533 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
75534 l_component_type
75535 ,l_component_code
75536 ,l_component_type_code
75537 ,l_component_appl_id
75538 ,l_amb_context_code
75539 ,l_entity_code
75540 ,l_event_class_code
75541 )
75542 ,p_token_3 => 'OWNER'
75543 ,p_value_3 => xla_lookups_pkg.get_meaning(
75547 ,p_token_4 => 'PRODUCT_NAME'
75544 p_lookup_type => 'XLA_OWNER_TYPE'
75545 ,p_lookup_code => l_component_type_code
75546 )
75548 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
75549 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
75550 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
75551 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
75552 ,p_ae_header_id => NULL
75553 );
75554
75555 IF (C_LEVEL_ERROR>= g_log_level) THEN
75556 trace
75557 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
75558 ,p_level => C_LEVEL_ERROR
75559 ,p_module => l_log_module);
75560 END IF;
75561 END IF;
75562 END IF;
75563 --
75564 --
75565 ------------------------------------------------------------------------------------------------
75566 -- 4219869 Business Flow
75567 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
75568 -- Prior Entry. Currently, the following code is always generated.
75569 ------------------------------------------------------------------------------------------------
75570 XLA_AE_LINES_PKG.ValidateCurrentLine;
75571
75572 ------------------------------------------------------------------------------------
75573 -- 4219869 Business Flow
75574 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
75575 ------------------------------------------------------------------------------------
75576 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
75577
75578 ----------------------------------------------------------------------------------
75579 -- 4219869 Business Flow
75580 -- Update journal entry status -- Need to generate this within IF <condition>
75581 ----------------------------------------------------------------------------------
75582 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
75583 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
75584 ,p_balance_type_code => l_balance_type_code
75585 );
75586
75587 -------------------------------------------------------------------------------------------
75588 -- 4262811 - Generate the Accrual Reversal lines
75589 -------------------------------------------------------------------------------------------
75590 BEGIN
75591 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
75592 (g_array_event(p_event_id).array_value_num('header_index'));
75593 IF l_acc_rev_flag IS NULL THEN
75594 l_acc_rev_flag := 'N';
75595 END IF;
75596 EXCEPTION
75597 WHEN OTHERS THEN
75598 l_acc_rev_flag := 'N';
75599 END;
75600 --
75601 IF (l_acc_rev_flag = 'Y') THEN
75602
75603 -- 4645092 ------------------------------------------------------------------------------
75604 -- To allow MPA report to determine if it should generate report process
75605 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
75606 ------------------------------------------------------------------------------------------
75607
75608 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
75609 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
75610 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
75611 -- call ADRs
75612 -- Bug 4922099
75613 --
75614 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
75615 (NVL(l_actual_upg_option, 'N') = 'O') OR
75616 (NVL(l_enc_upg_option, 'N') = 'O')
75617 )
75618 THEN
75619 NULL;
75620 --
75621 --
75622
75623 l_ccid := AcctDerRule_174(
75624 p_application_id => p_application_id
75625 , p_ae_header_id => l_ae_header_id
75626 , p_source_5 => p_source_5
75627 , p_source_32 => p_source_32
75628 , x_transaction_coa_id => l_adr_transaction_coa_id
75629 , x_accounting_coa_id => l_adr_accounting_coa_id
75630 , x_value_type_code => l_adr_value_type_code
75631 , p_side => 'NA'
75632 );
75633
75634 xla_ae_lines_pkg.set_ccid(
75635 p_code_combination_id => l_ccid
75636 , p_value_type_code => l_adr_value_type_code
75637 , p_transaction_coa_id => l_adr_transaction_coa_id
75638 , p_accounting_coa_id => l_adr_accounting_coa_id
75639 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
75640 , p_adr_type_code => 'S'
75641 , p_component_type => l_component_type
75642 , p_component_code => l_component_code
75643 , p_component_type_code => l_component_type_code
75644 , p_component_appl_id => l_component_appl_id
75645 , p_amb_context_code => l_amb_context_code
75646 , p_side => 'NA'
75647 );
75648
75652 , p_ae_header_id => l_ae_header_id
75649
75650 l_segment := AcctDerRule_154(
75651 p_application_id => p_application_id
75653 , p_source_5 => p_source_5
75654 , p_source_16 => p_source_16
75655 , x_transaction_coa_id => l_adr_transaction_coa_id
75656 , x_accounting_coa_id => l_adr_accounting_coa_id
75657 , x_flexfield_segment_code => l_adr_flexfield_segment_code
75658 , x_flex_value_set_id => l_adr_flex_value_set_id
75659 , x_value_type_code => l_adr_value_type_code
75660 , x_value_combination_id => l_adr_value_combination_id
75661 , x_value_segment_code => l_adr_value_segment_code
75662 , p_side => 'NA'
75663 , p_override_seg_flag => 'Y'
75664 );
75665
75666 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
75667
75668 xla_ae_lines_pkg.set_segment(
75669 p_to_segment_code => 'GL_ACCOUNT'
75670 , p_segment_value => l_segment
75671 , p_from_segment_code => l_adr_value_segment_code
75672 , p_from_combination_id => l_adr_value_combination_id
75673 , p_value_type_code => l_adr_value_type_code
75674 , p_transaction_coa_id => l_adr_transaction_coa_id
75675 , p_accounting_coa_id => l_adr_accounting_coa_id
75676 , p_flexfield_segment_code => l_adr_flexfield_segment_code
75677 , p_flex_value_set_id => l_adr_flex_value_set_id
75678 , p_adr_code => 'FA_COST_OF_REM_LOSS_SEGMENT'
75679 , p_adr_type_code => 'S'
75680 , p_component_type => l_component_type
75681 , p_component_code => l_component_code
75682 , p_component_type_code => l_component_type_code
75683 , p_component_appl_id => l_component_appl_id
75684 , p_amb_context_code => l_amb_context_code
75685 , p_entity_code => 'TRANSACTIONS'
75686 , p_event_class_code => 'RETIREMENTS'
75687 , p_side => 'NA'
75688 );
75689
75690 END IF;
75691
75692 l_segment := AcctDerRule_169(
75693 p_application_id => p_application_id
75694 , p_ae_header_id => l_ae_header_id
75695 , p_source_5 => p_source_5
75696 , p_source_31 => p_source_31
75697 , x_transaction_coa_id => l_adr_transaction_coa_id
75698 , x_accounting_coa_id => l_adr_accounting_coa_id
75699 , x_flexfield_segment_code => l_adr_flexfield_segment_code
75700 , x_flex_value_set_id => l_adr_flex_value_set_id
75701 , x_value_type_code => l_adr_value_type_code
75702 , x_value_combination_id => l_adr_value_combination_id
75703 , x_value_segment_code => l_adr_value_segment_code
75704 , p_side => 'NA'
75705 , p_override_seg_flag => 'Y'
75706 );
75707
75708 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
75709
75710 xla_ae_lines_pkg.set_segment(
75711 p_to_segment_code => 'GL_BALANCING'
75712 , p_segment_value => l_segment
75713 , p_from_segment_code => l_adr_value_segment_code
75714 , p_from_combination_id => l_adr_value_combination_id
75715 , p_value_type_code => l_adr_value_type_code
75716 , p_transaction_coa_id => l_adr_transaction_coa_id
75717 , p_accounting_coa_id => l_adr_accounting_coa_id
75718 , p_flexfield_segment_code => l_adr_flexfield_segment_code
75719 , p_flex_value_set_id => l_adr_flex_value_set_id
75720 , p_adr_code => 'FA_EXPENSE_ACCT'
75721 , p_adr_type_code => 'S'
75722 , p_component_type => l_component_type
75723 , p_component_code => l_component_code
75724 , p_component_type_code => l_component_type_code
75725 , p_component_appl_id => l_component_appl_id
75726 , p_amb_context_code => l_amb_context_code
75727 , p_entity_code => 'TRANSACTIONS'
75728 , p_event_class_code => 'RETIREMENTS'
75729 , p_side => 'NA'
75730 );
75731
75732 END IF;
75733
75734 --
75735 --
75736 END IF;
75737
75738 --
75739 -- Update the line information that should be overwritten
75740 --
75741 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
75742 p_header_num => 1);
75743 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
75744
75745 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
75746
75747 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
75748 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
75749 END IF;
75750
75751 --
75752 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
75753 --
75754 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
75755 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
75756 ELSE
75757 ---------------------------------------------------------------------------------------------------
75758 -- 4262811a Switch Sign
75762 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
75759 ---------------------------------------------------------------------------------------------------
75760 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
75761 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
75763 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
75764 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
75765 -- 5132302
75766 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
75767 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
75768
75769 END IF;
75770
75771 -- 4955764
75772 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
75773 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
75774
75775
75776 XLA_AE_LINES_PKG.ValidateCurrentLine;
75777 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
75778
75779 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
75780 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
75781 ,p_balance_type_code => l_balance_type_code);
75782
75783 END IF;
75784
75785 -----------------------------------------------------------------------------------------
75786 -- 4262811 Multiperiod Accounting
75787 -----------------------------------------------------------------------------------------
75788 -- No MPA option is assigned.
75789
75790
75791 END IF;
75792 END IF;
75793 --
75794
75795 --
75796 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
75797 trace
75798 (p_msg => 'END of AcctLineType_269'
75799 ,p_level => C_LEVEL_PROCEDURE
75800 ,p_module => l_log_module);
75801 END IF;
75802 --
75803 EXCEPTION
75804 WHEN xla_exceptions_pkg.application_exception THEN
75805 RAISE;
75806 WHEN OTHERS THEN
75807 xla_exceptions_pkg.raise_message
75808 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_269');
75809 END AcctLineType_269;
75810 --
75811
75812 ---------------------------------------
75813 --
75814 -- PRIVATE FUNCTION
75815 -- AcctLineType_270
75816 --
75817 ---------------------------------------
75818 PROCEDURE AcctLineType_270 (
75819 p_application_id IN NUMBER
75820 ,p_event_id IN NUMBER
75821 ,p_calculate_acctd_flag IN VARCHAR2
75822 ,p_calculate_g_l_flag IN VARCHAR2
75823 ,p_actual_flag IN OUT VARCHAR2
75824 ,p_balance_type_code OUT VARCHAR2
75825 ,p_gain_or_loss_ref OUT VARCHAR2
75826
75827 --Period Close Date
75828 , p_source_1 IN DATE
75829 --Generated Code Combination Identifier
75830 , p_source_5 IN NUMBER
75831 --Cost Of Removal Loss Account
75832 , p_source_16 IN VARCHAR2
75833 --Expense Account Code Combination Identifier
75834 , p_source_31 IN NUMBER
75835 --Default Code Combination Identifier
75836 , p_source_32 IN NUMBER
75837 --Adjustment Type
75838 , p_source_48 IN VARCHAR2
75839 --Transaction Header Identifier
75840 , p_source_49 IN NUMBER
75841 --Adjustment Line Identifier
75842 , p_source_50 IN NUMBER
75843 --Distribution Type Code
75844 , p_source_51 IN VARCHAR2
75845 --Entered Amount
75846 , p_source_52 IN NUMBER
75847 --Currency Code
75848 , p_source_53 IN VARCHAR2
75849 --Gain Loss Amount
75850 , p_source_54 IN NUMBER
75851 )
75852 IS
75853
75854 l_component_type VARCHAR2(80);
75855 l_component_code VARCHAR2(30);
75856 l_component_type_code VARCHAR2(1);
75857 l_component_appl_id INTEGER;
75858 l_amb_context_code VARCHAR2(30);
75859 l_entity_code VARCHAR2(30);
75860 l_event_class_code VARCHAR2(30);
75861 l_ae_header_id NUMBER;
75862 l_event_type_code VARCHAR2(30);
75863 l_line_definition_code VARCHAR2(30);
75864 l_line_definition_owner_code VARCHAR2(1);
75865 --
75866 -- adr variables
75867 l_segment VARCHAR2(30);
75868 l_ccid NUMBER;
75869 l_adr_transaction_coa_id NUMBER;
75870 l_adr_accounting_coa_id NUMBER;
75871 l_adr_flexfield_segment_code VARCHAR2(30);
75872 l_adr_flex_value_set_id NUMBER;
75873 l_adr_value_type_code VARCHAR2(30);
75874 l_adr_value_combination_id NUMBER;
75875 l_adr_value_segment_code VARCHAR2(30);
75876
75877 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
75878 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
75879 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
75880 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
75881
75882 -- 4262811 Variables ------------------------------------------------------------------------------------------
75883 l_entered_amt_idx NUMBER;
75884 l_accted_amt_idx NUMBER;
75885 l_acc_rev_flag VARCHAR2(1);
75889
75886 l_accrual_line_num NUMBER;
75887 l_tmp_amt NUMBER;
75888 l_acc_rev_natural_side_code VARCHAR2(1);
75890 l_num_entries NUMBER;
75891 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
75892 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
75893 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
75894 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
75895 l_recog_line_1 NUMBER;
75896 l_recog_line_2 NUMBER;
75897
75898 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
75899 l_bflow_applied_to_amt NUMBER; -- 5132302
75900 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
75901
75902 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
75903
75904 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
75905 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
75906
75907 ---------------------------------------------------------------------------------------------------------------
75908
75909
75910 --
75911 -- bulk performance
75912 --
75913 l_balance_type_code VARCHAR2(1);
75914 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
75915 l_log_module VARCHAR2(240);
75916
75917 --
75918 -- Upgrade strategy
75919 --
75920 l_actual_upg_option VARCHAR2(1);
75921 l_enc_upg_option VARCHAR2(1);
75922
75923 --
75924 BEGIN
75925 --
75926 IF g_log_enabled THEN
75927 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_270';
75928 END IF;
75929 --
75930 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
75931
75932 trace
75933 (p_msg => 'BEGIN of AcctLineType_270'
75934 ,p_level => C_LEVEL_PROCEDURE
75935 ,p_module => l_log_module);
75936
75937 END IF;
75938 --
75939 l_component_type := 'AMB_JLT';
75940 l_component_code := 'FA_COST_OF_REMOVAL_LOSS';
75941 l_component_type_code := 'S';
75942 l_component_appl_id := 140;
75943 l_amb_context_code := 'DEFAULT';
75944 l_entity_code := 'TRANSACTIONS';
75945 l_event_class_code := 'RETIREMENTS';
75946 l_event_type_code := 'RETIREMENTS';
75947 l_line_definition_owner_code := 'S';
75948 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
75949 --
75950 l_balance_type_code := 'A';
75951 l_segment := NULL;
75952 l_ccid := NULL;
75953 l_adr_transaction_coa_id := NULL;
75954 l_adr_accounting_coa_id := NULL;
75955 l_adr_flexfield_segment_code := NULL;
75956 l_adr_flex_value_set_id := NULL;
75957 l_adr_value_type_code := NULL;
75958 l_adr_value_combination_id := NULL;
75959 l_adr_value_segment_code := NULL;
75960
75961 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
75962 l_bflow_class_code := ''; -- 4219869 Business Flow
75963 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
75964 l_budgetary_control_flag := 'N';
75965
75966 l_bflow_applied_to_amt_idx := NULL; -- 5132302
75967 l_bflow_applied_to_amt := NULL; -- 5132302
75968 l_entered_amt_idx := NULL; -- 4262811
75969 l_accted_amt_idx := NULL; -- 4262811
75970 l_acc_rev_flag := NULL; -- 4262811
75971 l_accrual_line_num := NULL; -- 4262811
75972 l_tmp_amt := NULL; -- 4262811
75973 --
75974
75975 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
75976 l_balance_type_code <> 'B' THEN
75977 IF NVL(p_source_48,'
75978 ') = 'REMOVALCOST' AND
75979 p_source_54 < 0
75980 THEN
75981
75982 --
75983 XLA_AE_LINES_PKG.SetNewLine;
75984
75985 p_balance_type_code := l_balance_type_code;
75986 -- set the flag so later we will know whether the gain loss line needs to be created
75987
75988 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
75989 p_actual_flag :='A';
75990 END IF;
75991
75992 --
75993 -- bulk performance
75994 --
75995 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
75996 p_header_num => 0); -- 4262811
75997 --
75998 -- set accounting line options
75999 --
76000 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
76001 p_natural_side_code => 'D'
76002 , p_gain_or_loss_flag => 'N'
76003 , p_gl_transfer_mode_code => 'S'
76004 , p_acct_entry_type_code => 'A'
76005 , p_switch_side_flag => 'Y'
76006 , p_merge_duplicate_code => 'N'
76007 );
76008 --
76009 l_acc_rev_natural_side_code := 'C'; -- 4262811
76010 --
76011 --
76012 -- set accounting line type info
76013 --
76014 xla_ae_lines_pkg.SetAcctLineType
76015 (p_component_type => l_component_type
76016 ,p_event_type_code => l_event_type_code
76020 ,p_accounting_line_type_code => l_component_type_code
76017 ,p_line_definition_owner_code => l_line_definition_owner_code
76018 ,p_line_definition_code => l_line_definition_code
76019 ,p_accounting_line_code => l_component_code
76021 ,p_accounting_line_appl_id => l_component_appl_id
76022 ,p_amb_context_code => l_amb_context_code
76023 ,p_entity_code => l_entity_code
76024 ,p_event_class_code => l_event_class_code);
76025 --
76026 -- set accounting class
76027 --
76028 xla_ae_lines_pkg.SetAcctClass(
76029 p_accounting_class_code => 'ASSET'
76030 , p_ae_header_id => l_ae_header_id
76031 );
76032
76033 --
76034 -- set rounding class
76035 --
76036 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
76037 'ASSET';
76038
76039 --
76040 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
76041 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
76042 --
76043 -- bulk performance
76044 --
76045 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
76046
76047 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
76048 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
76049
76050 -- 4955764
76051 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
76052 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
76053
76054 -- 4458381 Public Sector Enh
76055
76056 --
76057 -- set accounting attributes for the line type
76058 --
76059 l_entered_amt_idx := 4;
76060 l_accted_amt_idx := 6;
76061 l_bflow_applied_to_amt_idx := NULL; -- 5132302
76062 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
76063 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
76064 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
76065 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
76066 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
76067 l_rec_acct_attrs.array_char_value(3) := p_source_51;
76068 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
76069 l_rec_acct_attrs.array_num_value(4) := p_source_52;
76070 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
76071 l_rec_acct_attrs.array_char_value(5) := p_source_53;
76072 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
76073 l_rec_acct_attrs.array_num_value(6) := p_source_52;
76074
76075 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
76076 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
76077
76078 ---------------------------------------------------------------------------------------------------------------
76079 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
76080 ---------------------------------------------------------------------------------------------------------------
76081 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
76082
76083 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
76084 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
76085
76086 IF xla_accounting_cache_pkg.GetValueChar
76087 (p_source_code => 'LEDGER_CATEGORY_CODE'
76088 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
76089 AND l_bflow_method_code = 'PRIOR_ENTRY'
76090 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
76091 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
76092 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
76093 )
76094 THEN
76095 xla_ae_lines_pkg.BflowUpgEntry
76096 (p_business_method_code => l_bflow_method_code
76097 ,p_business_class_code => l_bflow_class_code
76098 ,p_balance_type => l_balance_type_code);
76099 ELSE
76100 NULL;
76101 -- No business flow processing for business flow method of NONE.
76102 END IF;
76103
76104 --
76105 -- call analytical criteria
76106 --
76107
76108 --
76109 -- call description
76110 --
76111
76112 xla_ae_lines_pkg.SetLineDescription(
76113 p_ae_header_id => l_ae_header_id
76114 ,p_description => Description_78 (
76115 p_application_id => p_application_id
76116 , p_ae_header_id => l_ae_header_id
76117 , p_source_1 => p_source_1
76118 )
76119 );
76120
76121
76122 --
76123 -- call ADRs
76124 -- Bug 4922099
76125 --
76126 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
76127 (NVL(l_actual_upg_option, 'N') = 'O') OR
76128 (NVL(l_enc_upg_option, 'N') = 'O')
76129 )
76130 THEN
76131 NULL;
76132 --
76133 --
76134
76135 l_ccid := AcctDerRule_174(
76136 p_application_id => p_application_id
76140 , x_transaction_coa_id => l_adr_transaction_coa_id
76137 , p_ae_header_id => l_ae_header_id
76138 , p_source_5 => p_source_5
76139 , p_source_32 => p_source_32
76141 , x_accounting_coa_id => l_adr_accounting_coa_id
76142 , x_value_type_code => l_adr_value_type_code
76143 , p_side => 'NA'
76144 );
76145
76146 xla_ae_lines_pkg.set_ccid(
76147 p_code_combination_id => l_ccid
76148 , p_value_type_code => l_adr_value_type_code
76149 , p_transaction_coa_id => l_adr_transaction_coa_id
76150 , p_accounting_coa_id => l_adr_accounting_coa_id
76151 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
76152 , p_adr_type_code => 'S'
76153 , p_component_type => l_component_type
76154 , p_component_code => l_component_code
76155 , p_component_type_code => l_component_type_code
76156 , p_component_appl_id => l_component_appl_id
76157 , p_amb_context_code => l_amb_context_code
76158 , p_side => 'NA'
76159 );
76160
76161
76162 l_segment := AcctDerRule_154(
76163 p_application_id => p_application_id
76164 , p_ae_header_id => l_ae_header_id
76165 , p_source_5 => p_source_5
76166 , p_source_16 => p_source_16
76167 , x_transaction_coa_id => l_adr_transaction_coa_id
76168 , x_accounting_coa_id => l_adr_accounting_coa_id
76169 , x_flexfield_segment_code => l_adr_flexfield_segment_code
76170 , x_flex_value_set_id => l_adr_flex_value_set_id
76171 , x_value_type_code => l_adr_value_type_code
76172 , x_value_combination_id => l_adr_value_combination_id
76173 , x_value_segment_code => l_adr_value_segment_code
76174 , p_side => 'NA'
76175 , p_override_seg_flag => 'Y'
76176 );
76177
76178 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
76179
76180 xla_ae_lines_pkg.set_segment(
76181 p_to_segment_code => 'GL_ACCOUNT'
76182 , p_segment_value => l_segment
76183 , p_from_segment_code => l_adr_value_segment_code
76184 , p_from_combination_id => l_adr_value_combination_id
76185 , p_value_type_code => l_adr_value_type_code
76186 , p_transaction_coa_id => l_adr_transaction_coa_id
76187 , p_accounting_coa_id => l_adr_accounting_coa_id
76188 , p_flexfield_segment_code => l_adr_flexfield_segment_code
76189 , p_flex_value_set_id => l_adr_flex_value_set_id
76190 , p_adr_code => 'FA_COST_OF_REM_LOSS_SEGMENT'
76191 , p_adr_type_code => 'S'
76192 , p_component_type => l_component_type
76193 , p_component_code => l_component_code
76194 , p_component_type_code => l_component_type_code
76195 , p_component_appl_id => l_component_appl_id
76196 , p_amb_context_code => l_amb_context_code
76197 , p_entity_code => 'TRANSACTIONS'
76198 , p_event_class_code => 'RETIREMENTS'
76199 , p_side => 'NA'
76200 );
76201
76202 END IF;
76203
76204 l_segment := AcctDerRule_169(
76205 p_application_id => p_application_id
76206 , p_ae_header_id => l_ae_header_id
76207 , p_source_5 => p_source_5
76208 , p_source_31 => p_source_31
76209 , x_transaction_coa_id => l_adr_transaction_coa_id
76210 , x_accounting_coa_id => l_adr_accounting_coa_id
76211 , x_flexfield_segment_code => l_adr_flexfield_segment_code
76212 , x_flex_value_set_id => l_adr_flex_value_set_id
76213 , x_value_type_code => l_adr_value_type_code
76214 , x_value_combination_id => l_adr_value_combination_id
76215 , x_value_segment_code => l_adr_value_segment_code
76216 , p_side => 'NA'
76217 , p_override_seg_flag => 'Y'
76218 );
76219
76220 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
76221
76222 xla_ae_lines_pkg.set_segment(
76223 p_to_segment_code => 'GL_BALANCING'
76224 , p_segment_value => l_segment
76225 , p_from_segment_code => l_adr_value_segment_code
76226 , p_from_combination_id => l_adr_value_combination_id
76227 , p_value_type_code => l_adr_value_type_code
76228 , p_transaction_coa_id => l_adr_transaction_coa_id
76229 , p_accounting_coa_id => l_adr_accounting_coa_id
76230 , p_flexfield_segment_code => l_adr_flexfield_segment_code
76231 , p_flex_value_set_id => l_adr_flex_value_set_id
76232 , p_adr_code => 'FA_EXPENSE_ACCT'
76233 , p_adr_type_code => 'S'
76234 , p_component_type => l_component_type
76235 , p_component_code => l_component_code
76236 , p_component_type_code => l_component_type_code
76237 , p_component_appl_id => l_component_appl_id
76238 , p_amb_context_code => l_amb_context_code
76239 , p_entity_code => 'TRANSACTIONS'
76240 , p_event_class_code => 'RETIREMENTS'
76241 , p_side => 'NA'
76242 );
76243
76244 END IF;
76245
76246 --
76247 --
76248 END IF;
76249 --
76253 ) AND
76250 -- Bug 4922099
76251 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
76252 (NVL(l_enc_upg_option, 'N') = 'O')
76254 (l_bflow_method_code = 'PRIOR_ENTRY')
76255 )
76256 THEN
76257 IF
76258 --
76259 1 = 2
76260 --
76261 THEN
76262 xla_accounting_err_pkg.build_message
76263 (p_appli_s_name => 'XLA'
76264 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
76265 ,p_token_1 => 'LINE_NUMBER'
76266 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
76267 ,p_token_2 => 'LINE_TYPE_NAME'
76268 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
76269 l_component_type
76270 ,l_component_code
76271 ,l_component_type_code
76272 ,l_component_appl_id
76273 ,l_amb_context_code
76274 ,l_entity_code
76275 ,l_event_class_code
76276 )
76277 ,p_token_3 => 'OWNER'
76278 ,p_value_3 => xla_lookups_pkg.get_meaning(
76279 p_lookup_type => 'XLA_OWNER_TYPE'
76280 ,p_lookup_code => l_component_type_code
76281 )
76282 ,p_token_4 => 'PRODUCT_NAME'
76283 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
76284 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
76285 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
76286 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
76287 ,p_ae_header_id => NULL
76288 );
76289
76290 IF (C_LEVEL_ERROR>= g_log_level) THEN
76291 trace
76292 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
76293 ,p_level => C_LEVEL_ERROR
76294 ,p_module => l_log_module);
76295 END IF;
76296 END IF;
76297 END IF;
76298 --
76299 --
76300 ------------------------------------------------------------------------------------------------
76301 -- 4219869 Business Flow
76302 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
76303 -- Prior Entry. Currently, the following code is always generated.
76304 ------------------------------------------------------------------------------------------------
76305 XLA_AE_LINES_PKG.ValidateCurrentLine;
76306
76307 ------------------------------------------------------------------------------------
76308 -- 4219869 Business Flow
76309 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
76310 ------------------------------------------------------------------------------------
76311 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
76312
76313 ----------------------------------------------------------------------------------
76314 -- 4219869 Business Flow
76315 -- Update journal entry status -- Need to generate this within IF <condition>
76316 ----------------------------------------------------------------------------------
76317 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
76318 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
76319 ,p_balance_type_code => l_balance_type_code
76320 );
76321
76322 -------------------------------------------------------------------------------------------
76323 -- 4262811 - Generate the Accrual Reversal lines
76324 -------------------------------------------------------------------------------------------
76325 BEGIN
76326 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
76327 (g_array_event(p_event_id).array_value_num('header_index'));
76328 IF l_acc_rev_flag IS NULL THEN
76329 l_acc_rev_flag := 'N';
76330 END IF;
76331 EXCEPTION
76332 WHEN OTHERS THEN
76333 l_acc_rev_flag := 'N';
76334 END;
76335 --
76336 IF (l_acc_rev_flag = 'Y') THEN
76337
76338 -- 4645092 ------------------------------------------------------------------------------
76339 -- To allow MPA report to determine if it should generate report process
76340 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
76341 ------------------------------------------------------------------------------------------
76342
76343 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
76347 -- Bug 4922099
76344 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
76345 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
76346 -- call ADRs
76348 --
76349 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
76350 (NVL(l_actual_upg_option, 'N') = 'O') OR
76351 (NVL(l_enc_upg_option, 'N') = 'O')
76352 )
76353 THEN
76354 NULL;
76355 --
76356 --
76357
76358 l_ccid := AcctDerRule_174(
76359 p_application_id => p_application_id
76360 , p_ae_header_id => l_ae_header_id
76361 , p_source_5 => p_source_5
76362 , p_source_32 => p_source_32
76363 , x_transaction_coa_id => l_adr_transaction_coa_id
76364 , x_accounting_coa_id => l_adr_accounting_coa_id
76365 , x_value_type_code => l_adr_value_type_code
76366 , p_side => 'NA'
76367 );
76368
76369 xla_ae_lines_pkg.set_ccid(
76370 p_code_combination_id => l_ccid
76371 , p_value_type_code => l_adr_value_type_code
76372 , p_transaction_coa_id => l_adr_transaction_coa_id
76373 , p_accounting_coa_id => l_adr_accounting_coa_id
76374 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
76375 , p_adr_type_code => 'S'
76376 , p_component_type => l_component_type
76377 , p_component_code => l_component_code
76378 , p_component_type_code => l_component_type_code
76379 , p_component_appl_id => l_component_appl_id
76380 , p_amb_context_code => l_amb_context_code
76381 , p_side => 'NA'
76382 );
76383
76384
76385 l_segment := AcctDerRule_154(
76386 p_application_id => p_application_id
76387 , p_ae_header_id => l_ae_header_id
76388 , p_source_5 => p_source_5
76389 , p_source_16 => p_source_16
76390 , x_transaction_coa_id => l_adr_transaction_coa_id
76391 , x_accounting_coa_id => l_adr_accounting_coa_id
76392 , x_flexfield_segment_code => l_adr_flexfield_segment_code
76393 , x_flex_value_set_id => l_adr_flex_value_set_id
76394 , x_value_type_code => l_adr_value_type_code
76395 , x_value_combination_id => l_adr_value_combination_id
76396 , x_value_segment_code => l_adr_value_segment_code
76397 , p_side => 'NA'
76398 , p_override_seg_flag => 'Y'
76399 );
76400
76401 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
76402
76403 xla_ae_lines_pkg.set_segment(
76404 p_to_segment_code => 'GL_ACCOUNT'
76405 , p_segment_value => l_segment
76406 , p_from_segment_code => l_adr_value_segment_code
76407 , p_from_combination_id => l_adr_value_combination_id
76408 , p_value_type_code => l_adr_value_type_code
76409 , p_transaction_coa_id => l_adr_transaction_coa_id
76410 , p_accounting_coa_id => l_adr_accounting_coa_id
76411 , p_flexfield_segment_code => l_adr_flexfield_segment_code
76412 , p_flex_value_set_id => l_adr_flex_value_set_id
76413 , p_adr_code => 'FA_COST_OF_REM_LOSS_SEGMENT'
76414 , p_adr_type_code => 'S'
76415 , p_component_type => l_component_type
76416 , p_component_code => l_component_code
76417 , p_component_type_code => l_component_type_code
76418 , p_component_appl_id => l_component_appl_id
76419 , p_amb_context_code => l_amb_context_code
76420 , p_entity_code => 'TRANSACTIONS'
76421 , p_event_class_code => 'RETIREMENTS'
76422 , p_side => 'NA'
76423 );
76424
76425 END IF;
76426
76427 l_segment := AcctDerRule_169(
76428 p_application_id => p_application_id
76429 , p_ae_header_id => l_ae_header_id
76430 , p_source_5 => p_source_5
76431 , p_source_31 => p_source_31
76432 , x_transaction_coa_id => l_adr_transaction_coa_id
76433 , x_accounting_coa_id => l_adr_accounting_coa_id
76434 , x_flexfield_segment_code => l_adr_flexfield_segment_code
76435 , x_flex_value_set_id => l_adr_flex_value_set_id
76436 , x_value_type_code => l_adr_value_type_code
76437 , x_value_combination_id => l_adr_value_combination_id
76438 , x_value_segment_code => l_adr_value_segment_code
76439 , p_side => 'NA'
76440 , p_override_seg_flag => 'Y'
76441 );
76442
76443 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
76444
76445 xla_ae_lines_pkg.set_segment(
76446 p_to_segment_code => 'GL_BALANCING'
76447 , p_segment_value => l_segment
76448 , p_from_segment_code => l_adr_value_segment_code
76449 , p_from_combination_id => l_adr_value_combination_id
76450 , p_value_type_code => l_adr_value_type_code
76451 , p_transaction_coa_id => l_adr_transaction_coa_id
76452 , p_accounting_coa_id => l_adr_accounting_coa_id
76453 , p_flexfield_segment_code => l_adr_flexfield_segment_code
76454 , p_flex_value_set_id => l_adr_flex_value_set_id
76458 , p_component_code => l_component_code
76455 , p_adr_code => 'FA_EXPENSE_ACCT'
76456 , p_adr_type_code => 'S'
76457 , p_component_type => l_component_type
76459 , p_component_type_code => l_component_type_code
76460 , p_component_appl_id => l_component_appl_id
76461 , p_amb_context_code => l_amb_context_code
76462 , p_entity_code => 'TRANSACTIONS'
76463 , p_event_class_code => 'RETIREMENTS'
76464 , p_side => 'NA'
76465 );
76466
76467 END IF;
76468
76469 --
76470 --
76471 END IF;
76472
76473 --
76474 -- Update the line information that should be overwritten
76475 --
76476 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
76477 p_header_num => 1);
76478 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
76479
76480 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
76481
76482 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
76483 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
76484 END IF;
76485
76486 --
76487 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
76488 --
76489 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
76490 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
76491 ELSE
76492 ---------------------------------------------------------------------------------------------------
76493 -- 4262811a Switch Sign
76494 ---------------------------------------------------------------------------------------------------
76495 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
76496 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
76497 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
76498 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
76499 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
76500 -- 5132302
76501 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
76502 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
76503
76504 END IF;
76505
76506 -- 4955764
76507 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
76508 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
76509
76510
76511 XLA_AE_LINES_PKG.ValidateCurrentLine;
76512 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
76513
76514 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
76515 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
76516 ,p_balance_type_code => l_balance_type_code);
76517
76518 END IF;
76519
76520 -----------------------------------------------------------------------------------------
76521 -- 4262811 Multiperiod Accounting
76522 -----------------------------------------------------------------------------------------
76523 -- No MPA option is assigned.
76524
76525
76526 END IF;
76527 END IF;
76528 --
76529
76530 --
76531 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
76532 trace
76533 (p_msg => 'END of AcctLineType_270'
76534 ,p_level => C_LEVEL_PROCEDURE
76535 ,p_module => l_log_module);
76536 END IF;
76537 --
76538 EXCEPTION
76539 WHEN xla_exceptions_pkg.application_exception THEN
76540 RAISE;
76541 WHEN OTHERS THEN
76542 xla_exceptions_pkg.raise_message
76543 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_270');
76544 END AcctLineType_270;
76545 --
76546
76547 ---------------------------------------
76548 --
76549 -- PRIVATE FUNCTION
76550 -- AcctLineType_271
76551 --
76552 ---------------------------------------
76553 PROCEDURE AcctLineType_271 (
76554 p_application_id IN NUMBER
76555 ,p_event_id IN NUMBER
76556 ,p_calculate_acctd_flag IN VARCHAR2
76557 ,p_calculate_g_l_flag IN VARCHAR2
76558 ,p_actual_flag IN OUT VARCHAR2
76559 ,p_balance_type_code OUT VARCHAR2
76560 ,p_gain_or_loss_ref OUT VARCHAR2
76561
76562 --Period Close Date
76563 , p_source_1 IN DATE
76564 --Generated Code Combination Identifier
76565 , p_source_5 IN NUMBER
76566 --Deferred Depreciation Expense Account
76567 , p_source_17 IN VARCHAR2
76568 --Expense Account Code Combination Identifier
76569 , p_source_31 IN NUMBER
76570 --Default Code Combination Identifier
76571 , p_source_32 IN NUMBER
76572 --Distribution Type Code
76573 , p_source_51 IN VARCHAR2
76574 --Entered Amount
76575 , p_source_52 IN NUMBER
76576 --Currency Code
76580 --Period Counter
76577 , p_source_53 IN VARCHAR2
76578 --Asset Identifier
76579 , p_source_56 IN NUMBER
76581 , p_source_57 IN NUMBER
76582 --Distribution Identifier
76583 , p_source_58 IN NUMBER
76584 --Book Type Code
76585 , p_source_59 IN VARCHAR2
76586 --Tax Book Type Code
76587 , p_source_60 IN VARCHAR2
76588 )
76589 IS
76590
76591 l_component_type VARCHAR2(80);
76592 l_component_code VARCHAR2(30);
76593 l_component_type_code VARCHAR2(1);
76594 l_component_appl_id INTEGER;
76595 l_amb_context_code VARCHAR2(30);
76596 l_entity_code VARCHAR2(30);
76597 l_event_class_code VARCHAR2(30);
76598 l_ae_header_id NUMBER;
76599 l_event_type_code VARCHAR2(30);
76600 l_line_definition_code VARCHAR2(30);
76601 l_line_definition_owner_code VARCHAR2(1);
76602 --
76603 -- adr variables
76604 l_segment VARCHAR2(30);
76605 l_ccid NUMBER;
76606 l_adr_transaction_coa_id NUMBER;
76607 l_adr_accounting_coa_id NUMBER;
76608 l_adr_flexfield_segment_code VARCHAR2(30);
76609 l_adr_flex_value_set_id NUMBER;
76610 l_adr_value_type_code VARCHAR2(30);
76611 l_adr_value_combination_id NUMBER;
76612 l_adr_value_segment_code VARCHAR2(30);
76613
76614 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
76615 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
76616 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
76617 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
76618
76619 -- 4262811 Variables ------------------------------------------------------------------------------------------
76620 l_entered_amt_idx NUMBER;
76621 l_accted_amt_idx NUMBER;
76622 l_acc_rev_flag VARCHAR2(1);
76623 l_accrual_line_num NUMBER;
76624 l_tmp_amt NUMBER;
76625 l_acc_rev_natural_side_code VARCHAR2(1);
76626
76627 l_num_entries NUMBER;
76628 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
76629 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
76630 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
76631 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
76632 l_recog_line_1 NUMBER;
76633 l_recog_line_2 NUMBER;
76634
76635 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
76636 l_bflow_applied_to_amt NUMBER; -- 5132302
76637 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
76638
76639 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
76640
76641 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
76642 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
76643
76644 ---------------------------------------------------------------------------------------------------------------
76645
76646
76647 --
76648 -- bulk performance
76649 --
76650 l_balance_type_code VARCHAR2(1);
76651 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
76652 l_log_module VARCHAR2(240);
76653
76654 --
76655 -- Upgrade strategy
76656 --
76657 l_actual_upg_option VARCHAR2(1);
76658 l_enc_upg_option VARCHAR2(1);
76659
76660 --
76661 BEGIN
76662 --
76663 IF g_log_enabled THEN
76664 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_271';
76665 END IF;
76666 --
76667 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
76668
76669 trace
76670 (p_msg => 'BEGIN of AcctLineType_271'
76671 ,p_level => C_LEVEL_PROCEDURE
76672 ,p_module => l_log_module);
76673
76674 END IF;
76675 --
76676 l_component_type := 'AMB_JLT';
76677 l_component_code := 'FA_DEF_DEPRN_EXP';
76678 l_component_type_code := 'S';
76679 l_component_appl_id := 140;
76680 l_amb_context_code := 'DEFAULT';
76681 l_entity_code := 'DEFERRED_DEPRECIATION';
76682 l_event_class_code := 'DEFERRED_DEPRECIATION';
76683 l_event_type_code := 'DEFERRED_DEPRECIATION_ALL';
76684 l_line_definition_owner_code := 'S';
76685 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEFER14';
76686 --
76687 l_balance_type_code := 'A';
76688 l_segment := NULL;
76689 l_ccid := NULL;
76690 l_adr_transaction_coa_id := NULL;
76691 l_adr_accounting_coa_id := NULL;
76692 l_adr_flexfield_segment_code := NULL;
76693 l_adr_flex_value_set_id := NULL;
76694 l_adr_value_type_code := NULL;
76695 l_adr_value_combination_id := NULL;
76696 l_adr_value_segment_code := NULL;
76697
76698 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
76699 l_bflow_class_code := ''; -- 4219869 Business Flow
76700 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
76701 l_budgetary_control_flag := 'N';
76702
76703 l_bflow_applied_to_amt_idx := NULL; -- 5132302
76704 l_bflow_applied_to_amt := NULL; -- 5132302
76705 l_entered_amt_idx := NULL; -- 4262811
76706 l_accted_amt_idx := NULL; -- 4262811
76710 --
76707 l_acc_rev_flag := NULL; -- 4262811
76708 l_accrual_line_num := NULL; -- 4262811
76709 l_tmp_amt := NULL; -- 4262811
76711
76712 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
76713 l_balance_type_code <> 'B' THEN
76714
76715 --
76716 XLA_AE_LINES_PKG.SetNewLine;
76717
76718 p_balance_type_code := l_balance_type_code;
76719 -- set the flag so later we will know whether the gain loss line needs to be created
76720
76721 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
76722 p_actual_flag :='A';
76723 END IF;
76724
76725 --
76726 -- bulk performance
76727 --
76728 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
76729 p_header_num => 0); -- 4262811
76730 --
76731 -- set accounting line options
76732 --
76733 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
76734 p_natural_side_code => 'D'
76735 , p_gain_or_loss_flag => 'N'
76736 , p_gl_transfer_mode_code => 'S'
76737 , p_acct_entry_type_code => 'A'
76738 , p_switch_side_flag => 'Y'
76739 , p_merge_duplicate_code => 'N'
76740 );
76741 --
76742 l_acc_rev_natural_side_code := 'C'; -- 4262811
76743 --
76744 --
76745 -- set accounting line type info
76746 --
76747 xla_ae_lines_pkg.SetAcctLineType
76748 (p_component_type => l_component_type
76749 ,p_event_type_code => l_event_type_code
76750 ,p_line_definition_owner_code => l_line_definition_owner_code
76751 ,p_line_definition_code => l_line_definition_code
76752 ,p_accounting_line_code => l_component_code
76753 ,p_accounting_line_type_code => l_component_type_code
76754 ,p_accounting_line_appl_id => l_component_appl_id
76755 ,p_amb_context_code => l_amb_context_code
76756 ,p_entity_code => l_entity_code
76757 ,p_event_class_code => l_event_class_code);
76758 --
76759 -- set accounting class
76760 --
76761 xla_ae_lines_pkg.SetAcctClass(
76762 p_accounting_class_code => 'EXPENSE'
76763 , p_ae_header_id => l_ae_header_id
76764 );
76765
76766 --
76767 -- set rounding class
76768 --
76769 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
76770 'EXPENSE';
76771
76772 --
76773 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
76774 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
76775 --
76776 -- bulk performance
76777 --
76778 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
76779
76780 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
76781 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
76782
76783 -- 4955764
76784 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
76785 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
76786
76787 -- 4458381 Public Sector Enh
76788
76789 --
76790 -- set accounting attributes for the line type
76791 --
76792 l_entered_amt_idx := 7;
76793 l_accted_amt_idx := 9;
76794 l_bflow_applied_to_amt_idx := NULL; -- 5132302
76795 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
76796 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
76797 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
76798 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
76799 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
76800 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_58);
76801 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
76802 l_rec_acct_attrs.array_char_value(4) := p_source_59;
76803 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
76804 l_rec_acct_attrs.array_char_value(5) := p_source_60;
76805 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
76806 l_rec_acct_attrs.array_char_value(6) := p_source_51;
76807 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
76808 l_rec_acct_attrs.array_num_value(7) := p_source_52;
76809 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
76810 l_rec_acct_attrs.array_char_value(8) := p_source_53;
76811 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
76812 l_rec_acct_attrs.array_num_value(9) := p_source_52;
76813
76814 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
76815 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
76816
76817 ---------------------------------------------------------------------------------------------------------------
76818 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
76819 ---------------------------------------------------------------------------------------------------------------
76823 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
76820 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
76821
76822 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
76824
76825 IF xla_accounting_cache_pkg.GetValueChar
76826 (p_source_code => 'LEDGER_CATEGORY_CODE'
76827 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
76828 AND l_bflow_method_code = 'PRIOR_ENTRY'
76829 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
76830 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
76831 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
76832 )
76833 THEN
76834 xla_ae_lines_pkg.BflowUpgEntry
76835 (p_business_method_code => l_bflow_method_code
76836 ,p_business_class_code => l_bflow_class_code
76837 ,p_balance_type => l_balance_type_code);
76838 ELSE
76839 NULL;
76840 -- No business flow processing for business flow method of NONE.
76841 END IF;
76842
76843 --
76844 -- call analytical criteria
76845 --
76846
76847 --
76848 -- call description
76849 --
76850
76851 xla_ae_lines_pkg.SetLineDescription(
76852 p_ae_header_id => l_ae_header_id
76853 ,p_description => Description_55 (
76854 p_application_id => p_application_id
76855 , p_ae_header_id => l_ae_header_id
76856 , p_source_1 => p_source_1
76857 )
76858 );
76859
76860
76861 --
76862 -- call ADRs
76863 -- Bug 4922099
76864 --
76865 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
76866 (NVL(l_actual_upg_option, 'N') = 'O') OR
76867 (NVL(l_enc_upg_option, 'N') = 'O')
76868 )
76869 THEN
76870 NULL;
76871 --
76872 --
76873
76874 l_ccid := AcctDerRule_174(
76875 p_application_id => p_application_id
76876 , p_ae_header_id => l_ae_header_id
76877 , p_source_5 => p_source_5
76878 , p_source_32 => p_source_32
76879 , x_transaction_coa_id => l_adr_transaction_coa_id
76880 , x_accounting_coa_id => l_adr_accounting_coa_id
76881 , x_value_type_code => l_adr_value_type_code
76882 , p_side => 'NA'
76883 );
76884
76885 xla_ae_lines_pkg.set_ccid(
76886 p_code_combination_id => l_ccid
76887 , p_value_type_code => l_adr_value_type_code
76888 , p_transaction_coa_id => l_adr_transaction_coa_id
76889 , p_accounting_coa_id => l_adr_accounting_coa_id
76890 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
76891 , p_adr_type_code => 'S'
76892 , p_component_type => l_component_type
76893 , p_component_code => l_component_code
76894 , p_component_type_code => l_component_type_code
76895 , p_component_appl_id => l_component_appl_id
76896 , p_amb_context_code => l_amb_context_code
76897 , p_side => 'NA'
76898 );
76899
76900
76901 l_segment := AcctDerRule_155(
76902 p_application_id => p_application_id
76903 , p_ae_header_id => l_ae_header_id
76904 , p_source_5 => p_source_5
76905 , p_source_17 => p_source_17
76906 , x_transaction_coa_id => l_adr_transaction_coa_id
76907 , x_accounting_coa_id => l_adr_accounting_coa_id
76908 , x_flexfield_segment_code => l_adr_flexfield_segment_code
76909 , x_flex_value_set_id => l_adr_flex_value_set_id
76910 , x_value_type_code => l_adr_value_type_code
76911 , x_value_combination_id => l_adr_value_combination_id
76912 , x_value_segment_code => l_adr_value_segment_code
76913 , p_side => 'NA'
76914 , p_override_seg_flag => 'Y'
76915 );
76916
76917 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
76918
76919 xla_ae_lines_pkg.set_segment(
76920 p_to_segment_code => 'GL_ACCOUNT'
76921 , p_segment_value => l_segment
76922 , p_from_segment_code => l_adr_value_segment_code
76923 , p_from_combination_id => l_adr_value_combination_id
76924 , p_value_type_code => l_adr_value_type_code
76925 , p_transaction_coa_id => l_adr_transaction_coa_id
76926 , p_accounting_coa_id => l_adr_accounting_coa_id
76927 , p_flexfield_segment_code => l_adr_flexfield_segment_code
76928 , p_flex_value_set_id => l_adr_flex_value_set_id
76929 , p_adr_code => 'FA_DEF_DEPRN_EXPENSE_SEGMENT'
76930 , p_adr_type_code => 'S'
76931 , p_component_type => l_component_type
76932 , p_component_code => l_component_code
76933 , p_component_type_code => l_component_type_code
76934 , p_component_appl_id => l_component_appl_id
76935 , p_amb_context_code => l_amb_context_code
76936 , p_entity_code => 'DEFERRED_DEPRECIATION'
76937 , p_event_class_code => 'DEFERRED_DEPRECIATION'
76938 , p_side => 'NA'
76939 );
76940
76944 p_application_id => p_application_id
76941 END IF;
76942
76943 l_segment := AcctDerRule_169(
76945 , p_ae_header_id => l_ae_header_id
76946 , p_source_5 => p_source_5
76947 , p_source_31 => p_source_31
76948 , x_transaction_coa_id => l_adr_transaction_coa_id
76949 , x_accounting_coa_id => l_adr_accounting_coa_id
76950 , x_flexfield_segment_code => l_adr_flexfield_segment_code
76951 , x_flex_value_set_id => l_adr_flex_value_set_id
76952 , x_value_type_code => l_adr_value_type_code
76953 , x_value_combination_id => l_adr_value_combination_id
76954 , x_value_segment_code => l_adr_value_segment_code
76955 , p_side => 'NA'
76956 , p_override_seg_flag => 'Y'
76957 );
76958
76959 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
76960
76961 xla_ae_lines_pkg.set_segment(
76962 p_to_segment_code => 'GL_BALANCING'
76963 , p_segment_value => l_segment
76964 , p_from_segment_code => l_adr_value_segment_code
76965 , p_from_combination_id => l_adr_value_combination_id
76966 , p_value_type_code => l_adr_value_type_code
76967 , p_transaction_coa_id => l_adr_transaction_coa_id
76968 , p_accounting_coa_id => l_adr_accounting_coa_id
76969 , p_flexfield_segment_code => l_adr_flexfield_segment_code
76970 , p_flex_value_set_id => l_adr_flex_value_set_id
76971 , p_adr_code => 'FA_EXPENSE_ACCT'
76972 , p_adr_type_code => 'S'
76973 , p_component_type => l_component_type
76974 , p_component_code => l_component_code
76975 , p_component_type_code => l_component_type_code
76976 , p_component_appl_id => l_component_appl_id
76977 , p_amb_context_code => l_amb_context_code
76978 , p_entity_code => 'DEFERRED_DEPRECIATION'
76979 , p_event_class_code => 'DEFERRED_DEPRECIATION'
76980 , p_side => 'NA'
76981 );
76982
76983 END IF;
76984
76985 --
76986 --
76987 END IF;
76988 --
76989 -- Bug 4922099
76990 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
76991 (NVL(l_enc_upg_option, 'N') = 'O')
76992 ) AND
76993 (l_bflow_method_code = 'PRIOR_ENTRY')
76994 )
76995 THEN
76996 IF
76997 --
76998 1 = 2
76999 --
77000 THEN
77001 xla_accounting_err_pkg.build_message
77002 (p_appli_s_name => 'XLA'
77003 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
77004 ,p_token_1 => 'LINE_NUMBER'
77005 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
77006 ,p_token_2 => 'LINE_TYPE_NAME'
77007 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
77008 l_component_type
77009 ,l_component_code
77010 ,l_component_type_code
77011 ,l_component_appl_id
77012 ,l_amb_context_code
77013 ,l_entity_code
77014 ,l_event_class_code
77015 )
77016 ,p_token_3 => 'OWNER'
77017 ,p_value_3 => xla_lookups_pkg.get_meaning(
77018 p_lookup_type => 'XLA_OWNER_TYPE'
77019 ,p_lookup_code => l_component_type_code
77020 )
77021 ,p_token_4 => 'PRODUCT_NAME'
77022 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
77023 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
77024 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
77025 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
77026 ,p_ae_header_id => NULL
77027 );
77028
77029 IF (C_LEVEL_ERROR>= g_log_level) THEN
77030 trace
77031 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
77032 ,p_level => C_LEVEL_ERROR
77033 ,p_module => l_log_module);
77034 END IF;
77035 END IF;
77036 END IF;
77037 --
77038 --
77042 -- Prior Entry. Currently, the following code is always generated.
77039 ------------------------------------------------------------------------------------------------
77040 -- 4219869 Business Flow
77041 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
77043 ------------------------------------------------------------------------------------------------
77044 XLA_AE_LINES_PKG.ValidateCurrentLine;
77045
77046 ------------------------------------------------------------------------------------
77047 -- 4219869 Business Flow
77048 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
77049 ------------------------------------------------------------------------------------
77050 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
77051
77052 ----------------------------------------------------------------------------------
77053 -- 4219869 Business Flow
77054 -- Update journal entry status -- Need to generate this within IF <condition>
77055 ----------------------------------------------------------------------------------
77056 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
77057 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
77058 ,p_balance_type_code => l_balance_type_code
77059 );
77060
77061 -------------------------------------------------------------------------------------------
77062 -- 4262811 - Generate the Accrual Reversal lines
77063 -------------------------------------------------------------------------------------------
77064 BEGIN
77065 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
77066 (g_array_event(p_event_id).array_value_num('header_index'));
77067 IF l_acc_rev_flag IS NULL THEN
77068 l_acc_rev_flag := 'N';
77069 END IF;
77070 EXCEPTION
77071 WHEN OTHERS THEN
77072 l_acc_rev_flag := 'N';
77073 END;
77074 --
77075 IF (l_acc_rev_flag = 'Y') THEN
77076
77077 -- 4645092 ------------------------------------------------------------------------------
77078 -- To allow MPA report to determine if it should generate report process
77079 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
77080 ------------------------------------------------------------------------------------------
77081
77082 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
77083 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
77084 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
77085 -- call ADRs
77086 -- Bug 4922099
77087 --
77088 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
77089 (NVL(l_actual_upg_option, 'N') = 'O') OR
77090 (NVL(l_enc_upg_option, 'N') = 'O')
77091 )
77092 THEN
77093 NULL;
77094 --
77095 --
77096
77097 l_ccid := AcctDerRule_174(
77098 p_application_id => p_application_id
77099 , p_ae_header_id => l_ae_header_id
77100 , p_source_5 => p_source_5
77101 , p_source_32 => p_source_32
77102 , x_transaction_coa_id => l_adr_transaction_coa_id
77103 , x_accounting_coa_id => l_adr_accounting_coa_id
77104 , x_value_type_code => l_adr_value_type_code
77105 , p_side => 'NA'
77106 );
77107
77108 xla_ae_lines_pkg.set_ccid(
77109 p_code_combination_id => l_ccid
77110 , p_value_type_code => l_adr_value_type_code
77111 , p_transaction_coa_id => l_adr_transaction_coa_id
77112 , p_accounting_coa_id => l_adr_accounting_coa_id
77113 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
77114 , p_adr_type_code => 'S'
77115 , p_component_type => l_component_type
77116 , p_component_code => l_component_code
77117 , p_component_type_code => l_component_type_code
77118 , p_component_appl_id => l_component_appl_id
77119 , p_amb_context_code => l_amb_context_code
77120 , p_side => 'NA'
77121 );
77122
77123
77124 l_segment := AcctDerRule_155(
77125 p_application_id => p_application_id
77126 , p_ae_header_id => l_ae_header_id
77127 , p_source_5 => p_source_5
77128 , p_source_17 => p_source_17
77129 , x_transaction_coa_id => l_adr_transaction_coa_id
77130 , x_accounting_coa_id => l_adr_accounting_coa_id
77131 , x_flexfield_segment_code => l_adr_flexfield_segment_code
77132 , x_flex_value_set_id => l_adr_flex_value_set_id
77133 , x_value_type_code => l_adr_value_type_code
77134 , x_value_combination_id => l_adr_value_combination_id
77135 , x_value_segment_code => l_adr_value_segment_code
77136 , p_side => 'NA'
77137 , p_override_seg_flag => 'Y'
77138 );
77139
77140 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
77141
77142 xla_ae_lines_pkg.set_segment(
77143 p_to_segment_code => 'GL_ACCOUNT'
77144 , p_segment_value => l_segment
77145 , p_from_segment_code => l_adr_value_segment_code
77146 , p_from_combination_id => l_adr_value_combination_id
77147 , p_value_type_code => l_adr_value_type_code
77148 , p_transaction_coa_id => l_adr_transaction_coa_id
77152 , p_adr_code => 'FA_DEF_DEPRN_EXPENSE_SEGMENT'
77149 , p_accounting_coa_id => l_adr_accounting_coa_id
77150 , p_flexfield_segment_code => l_adr_flexfield_segment_code
77151 , p_flex_value_set_id => l_adr_flex_value_set_id
77153 , p_adr_type_code => 'S'
77154 , p_component_type => l_component_type
77155 , p_component_code => l_component_code
77156 , p_component_type_code => l_component_type_code
77157 , p_component_appl_id => l_component_appl_id
77158 , p_amb_context_code => l_amb_context_code
77159 , p_entity_code => 'DEFERRED_DEPRECIATION'
77160 , p_event_class_code => 'DEFERRED_DEPRECIATION'
77161 , p_side => 'NA'
77162 );
77163
77164 END IF;
77165
77166 l_segment := AcctDerRule_169(
77167 p_application_id => p_application_id
77168 , p_ae_header_id => l_ae_header_id
77169 , p_source_5 => p_source_5
77170 , p_source_31 => p_source_31
77171 , x_transaction_coa_id => l_adr_transaction_coa_id
77172 , x_accounting_coa_id => l_adr_accounting_coa_id
77173 , x_flexfield_segment_code => l_adr_flexfield_segment_code
77174 , x_flex_value_set_id => l_adr_flex_value_set_id
77175 , x_value_type_code => l_adr_value_type_code
77176 , x_value_combination_id => l_adr_value_combination_id
77177 , x_value_segment_code => l_adr_value_segment_code
77178 , p_side => 'NA'
77179 , p_override_seg_flag => 'Y'
77180 );
77181
77182 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
77183
77184 xla_ae_lines_pkg.set_segment(
77185 p_to_segment_code => 'GL_BALANCING'
77186 , p_segment_value => l_segment
77187 , p_from_segment_code => l_adr_value_segment_code
77188 , p_from_combination_id => l_adr_value_combination_id
77189 , p_value_type_code => l_adr_value_type_code
77190 , p_transaction_coa_id => l_adr_transaction_coa_id
77191 , p_accounting_coa_id => l_adr_accounting_coa_id
77192 , p_flexfield_segment_code => l_adr_flexfield_segment_code
77193 , p_flex_value_set_id => l_adr_flex_value_set_id
77194 , p_adr_code => 'FA_EXPENSE_ACCT'
77195 , p_adr_type_code => 'S'
77196 , p_component_type => l_component_type
77197 , p_component_code => l_component_code
77198 , p_component_type_code => l_component_type_code
77199 , p_component_appl_id => l_component_appl_id
77200 , p_amb_context_code => l_amb_context_code
77201 , p_entity_code => 'DEFERRED_DEPRECIATION'
77202 , p_event_class_code => 'DEFERRED_DEPRECIATION'
77203 , p_side => 'NA'
77204 );
77205
77206 END IF;
77207
77208 --
77209 --
77210 END IF;
77211
77212 --
77213 -- Update the line information that should be overwritten
77214 --
77215 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
77216 p_header_num => 1);
77217 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
77218
77219 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
77220
77221 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
77222 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
77223 END IF;
77224
77225 --
77226 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
77227 --
77228 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
77229 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
77230 ELSE
77231 ---------------------------------------------------------------------------------------------------
77232 -- 4262811a Switch Sign
77233 ---------------------------------------------------------------------------------------------------
77234 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
77235 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
77236 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
77237 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
77238 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
77239 -- 5132302
77240 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
77241 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
77242
77243 END IF;
77244
77245 -- 4955764
77246 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
77247 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
77248
77249
77250 XLA_AE_LINES_PKG.ValidateCurrentLine;
77251 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
77252
77256
77253 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
77254 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
77255 ,p_balance_type_code => l_balance_type_code);
77257 END IF;
77258
77259 -----------------------------------------------------------------------------------------
77260 -- 4262811 Multiperiod Accounting
77261 -----------------------------------------------------------------------------------------
77262 -- No MPA option is assigned.
77263
77264
77265 END IF;
77266 --
77267
77268 --
77269 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
77270 trace
77271 (p_msg => 'END of AcctLineType_271'
77272 ,p_level => C_LEVEL_PROCEDURE
77273 ,p_module => l_log_module);
77274 END IF;
77275 --
77276 EXCEPTION
77277 WHEN xla_exceptions_pkg.application_exception THEN
77278 RAISE;
77279 WHEN OTHERS THEN
77280 xla_exceptions_pkg.raise_message
77281 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_271');
77282 END AcctLineType_271;
77283 --
77284
77285 ---------------------------------------
77286 --
77287 -- PRIVATE FUNCTION
77288 -- AcctLineType_272
77289 --
77290 ---------------------------------------
77291 PROCEDURE AcctLineType_272 (
77292 p_application_id IN NUMBER
77293 ,p_event_id IN NUMBER
77294 ,p_calculate_acctd_flag IN VARCHAR2
77295 ,p_calculate_g_l_flag IN VARCHAR2
77296 ,p_actual_flag IN OUT VARCHAR2
77297 ,p_balance_type_code OUT VARCHAR2
77298 ,p_gain_or_loss_ref OUT VARCHAR2
77299
77300 --Period Close Date
77301 , p_source_1 IN DATE
77302 --Generated Code Combination Identifier
77303 , p_source_5 IN NUMBER
77304 --Deferred Depreciation Reserve Account
77305 , p_source_18 IN VARCHAR2
77306 --Generated Offset Code Combination Identifier
77307 , p_source_19 IN NUMBER
77308 --Expense Account Code Combination Identifier
77309 , p_source_31 IN NUMBER
77310 --Default Code Combination Identifier
77311 , p_source_32 IN NUMBER
77312 --Distribution Type Code
77313 , p_source_51 IN VARCHAR2
77314 --Entered Amount
77315 , p_source_52 IN NUMBER
77316 --Currency Code
77317 , p_source_53 IN VARCHAR2
77318 --Asset Identifier
77319 , p_source_56 IN NUMBER
77320 --Period Counter
77321 , p_source_57 IN NUMBER
77322 --Distribution Identifier
77323 , p_source_58 IN NUMBER
77324 --Book Type Code
77325 , p_source_59 IN VARCHAR2
77326 --Tax Book Type Code
77327 , p_source_60 IN VARCHAR2
77328 )
77329 IS
77330
77331 l_component_type VARCHAR2(80);
77332 l_component_code VARCHAR2(30);
77333 l_component_type_code VARCHAR2(1);
77334 l_component_appl_id INTEGER;
77335 l_amb_context_code VARCHAR2(30);
77336 l_entity_code VARCHAR2(30);
77337 l_event_class_code VARCHAR2(30);
77338 l_ae_header_id NUMBER;
77339 l_event_type_code VARCHAR2(30);
77340 l_line_definition_code VARCHAR2(30);
77341 l_line_definition_owner_code VARCHAR2(1);
77342 --
77343 -- adr variables
77344 l_segment VARCHAR2(30);
77345 l_ccid NUMBER;
77346 l_adr_transaction_coa_id NUMBER;
77347 l_adr_accounting_coa_id NUMBER;
77348 l_adr_flexfield_segment_code VARCHAR2(30);
77349 l_adr_flex_value_set_id NUMBER;
77350 l_adr_value_type_code VARCHAR2(30);
77351 l_adr_value_combination_id NUMBER;
77352 l_adr_value_segment_code VARCHAR2(30);
77353
77354 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
77355 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
77356 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
77357 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
77358
77359 -- 4262811 Variables ------------------------------------------------------------------------------------------
77360 l_entered_amt_idx NUMBER;
77361 l_accted_amt_idx NUMBER;
77362 l_acc_rev_flag VARCHAR2(1);
77363 l_accrual_line_num NUMBER;
77364 l_tmp_amt NUMBER;
77365 l_acc_rev_natural_side_code VARCHAR2(1);
77366
77367 l_num_entries NUMBER;
77368 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
77369 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
77370 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
77371 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
77372 l_recog_line_1 NUMBER;
77373 l_recog_line_2 NUMBER;
77374
77375 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
77376 l_bflow_applied_to_amt NUMBER; -- 5132302
77377 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
77378
77379 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
77380
77381 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
77382 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
77383
77387 --
77384 ---------------------------------------------------------------------------------------------------------------
77385
77386
77388 -- bulk performance
77389 --
77390 l_balance_type_code VARCHAR2(1);
77391 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
77392 l_log_module VARCHAR2(240);
77393
77394 --
77395 -- Upgrade strategy
77396 --
77397 l_actual_upg_option VARCHAR2(1);
77398 l_enc_upg_option VARCHAR2(1);
77399
77400 --
77401 BEGIN
77402 --
77403 IF g_log_enabled THEN
77404 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_272';
77405 END IF;
77406 --
77407 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
77408
77409 trace
77410 (p_msg => 'BEGIN of AcctLineType_272'
77411 ,p_level => C_LEVEL_PROCEDURE
77412 ,p_module => l_log_module);
77413
77414 END IF;
77415 --
77416 l_component_type := 'AMB_JLT';
77417 l_component_code := 'FA_DEF_DEPRN_RESERVE';
77418 l_component_type_code := 'S';
77419 l_component_appl_id := 140;
77420 l_amb_context_code := 'DEFAULT';
77421 l_entity_code := 'DEFERRED_DEPRECIATION';
77422 l_event_class_code := 'DEFERRED_DEPRECIATION';
77423 l_event_type_code := 'DEFERRED_DEPRECIATION_ALL';
77424 l_line_definition_owner_code := 'S';
77425 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEFER14';
77426 --
77427 l_balance_type_code := 'A';
77428 l_segment := NULL;
77429 l_ccid := NULL;
77430 l_adr_transaction_coa_id := NULL;
77431 l_adr_accounting_coa_id := NULL;
77432 l_adr_flexfield_segment_code := NULL;
77433 l_adr_flex_value_set_id := NULL;
77434 l_adr_value_type_code := NULL;
77435 l_adr_value_combination_id := NULL;
77436 l_adr_value_segment_code := NULL;
77437
77438 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
77439 l_bflow_class_code := ''; -- 4219869 Business Flow
77440 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
77441 l_budgetary_control_flag := 'N';
77442
77443 l_bflow_applied_to_amt_idx := NULL; -- 5132302
77444 l_bflow_applied_to_amt := NULL; -- 5132302
77445 l_entered_amt_idx := NULL; -- 4262811
77446 l_accted_amt_idx := NULL; -- 4262811
77447 l_acc_rev_flag := NULL; -- 4262811
77448 l_accrual_line_num := NULL; -- 4262811
77449 l_tmp_amt := NULL; -- 4262811
77450 --
77451
77452 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
77453 l_balance_type_code <> 'B' THEN
77454
77455 --
77456 XLA_AE_LINES_PKG.SetNewLine;
77457
77458 p_balance_type_code := l_balance_type_code;
77459 -- set the flag so later we will know whether the gain loss line needs to be created
77460
77461 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
77462 p_actual_flag :='A';
77463 END IF;
77464
77465 --
77466 -- bulk performance
77467 --
77468 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
77469 p_header_num => 0); -- 4262811
77470 --
77471 -- set accounting line options
77472 --
77473 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
77474 p_natural_side_code => 'C'
77475 , p_gain_or_loss_flag => 'N'
77476 , p_gl_transfer_mode_code => 'S'
77477 , p_acct_entry_type_code => 'A'
77478 , p_switch_side_flag => 'Y'
77479 , p_merge_duplicate_code => 'N'
77480 );
77481 --
77482 l_acc_rev_natural_side_code := 'D'; -- 4262811
77483 --
77484 --
77485 -- set accounting line type info
77486 --
77487 xla_ae_lines_pkg.SetAcctLineType
77488 (p_component_type => l_component_type
77489 ,p_event_type_code => l_event_type_code
77490 ,p_line_definition_owner_code => l_line_definition_owner_code
77491 ,p_line_definition_code => l_line_definition_code
77492 ,p_accounting_line_code => l_component_code
77493 ,p_accounting_line_type_code => l_component_type_code
77494 ,p_accounting_line_appl_id => l_component_appl_id
77495 ,p_amb_context_code => l_amb_context_code
77496 ,p_entity_code => l_entity_code
77497 ,p_event_class_code => l_event_class_code);
77498 --
77499 -- set accounting class
77500 --
77501 xla_ae_lines_pkg.SetAcctClass(
77502 p_accounting_class_code => 'ASSET'
77503 , p_ae_header_id => l_ae_header_id
77504 );
77505
77506 --
77507 -- set rounding class
77508 --
77509 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
77510 'ASSET';
77511
77512 --
77513 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
77514 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
77515 --
77516 -- bulk performance
77517 --
77521 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
77518 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
77519
77520 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
77522
77523 -- 4955764
77524 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
77525 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
77526
77527 -- 4458381 Public Sector Enh
77528
77529 --
77530 -- set accounting attributes for the line type
77531 --
77532 l_entered_amt_idx := 7;
77533 l_accted_amt_idx := 9;
77534 l_bflow_applied_to_amt_idx := NULL; -- 5132302
77535 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
77536 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
77537 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
77538 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
77539 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
77540 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_58);
77541 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
77542 l_rec_acct_attrs.array_char_value(4) := p_source_59;
77543 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
77544 l_rec_acct_attrs.array_char_value(5) := p_source_60;
77545 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
77546 l_rec_acct_attrs.array_char_value(6) := p_source_51;
77547 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
77548 l_rec_acct_attrs.array_num_value(7) := p_source_52;
77549 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
77550 l_rec_acct_attrs.array_char_value(8) := p_source_53;
77551 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
77552 l_rec_acct_attrs.array_num_value(9) := p_source_52;
77553
77554 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
77555 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
77556
77557 ---------------------------------------------------------------------------------------------------------------
77558 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
77559 ---------------------------------------------------------------------------------------------------------------
77560 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
77561
77562 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
77563 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
77564
77565 IF xla_accounting_cache_pkg.GetValueChar
77566 (p_source_code => 'LEDGER_CATEGORY_CODE'
77567 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
77568 AND l_bflow_method_code = 'PRIOR_ENTRY'
77569 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
77570 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
77571 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
77572 )
77573 THEN
77574 xla_ae_lines_pkg.BflowUpgEntry
77575 (p_business_method_code => l_bflow_method_code
77576 ,p_business_class_code => l_bflow_class_code
77577 ,p_balance_type => l_balance_type_code);
77578 ELSE
77579 NULL;
77580 -- No business flow processing for business flow method of NONE.
77581 END IF;
77582
77583 --
77584 -- call analytical criteria
77585 --
77586
77587 --
77588 -- call description
77589 --
77590
77591 xla_ae_lines_pkg.SetLineDescription(
77592 p_ae_header_id => l_ae_header_id
77593 ,p_description => Description_56 (
77594 p_application_id => p_application_id
77595 , p_ae_header_id => l_ae_header_id
77596 , p_source_1 => p_source_1
77597 )
77598 );
77599
77600
77601 --
77602 -- call ADRs
77603 -- Bug 4922099
77604 --
77605 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
77606 (NVL(l_actual_upg_option, 'N') = 'O') OR
77607 (NVL(l_enc_upg_option, 'N') = 'O')
77608 )
77609 THEN
77610 NULL;
77611 --
77612 --
77613
77614 l_ccid := AcctDerRule_175(
77615 p_application_id => p_application_id
77616 , p_ae_header_id => l_ae_header_id
77617 , p_source_5 => p_source_5
77618 , p_source_19 => p_source_19
77619 , p_source_32 => p_source_32
77620 , x_transaction_coa_id => l_adr_transaction_coa_id
77621 , x_accounting_coa_id => l_adr_accounting_coa_id
77622 , x_value_type_code => l_adr_value_type_code
77623 , p_side => 'NA'
77624 );
77625
77626 xla_ae_lines_pkg.set_ccid(
77627 p_code_combination_id => l_ccid
77628 , p_value_type_code => l_adr_value_type_code
77629 , p_transaction_coa_id => l_adr_transaction_coa_id
77630 , p_accounting_coa_id => l_adr_accounting_coa_id
77631 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
77632 , p_adr_type_code => 'S'
77633 , p_component_type => l_component_type
77637 , p_amb_context_code => l_amb_context_code
77634 , p_component_code => l_component_code
77635 , p_component_type_code => l_component_type_code
77636 , p_component_appl_id => l_component_appl_id
77638 , p_side => 'NA'
77639 );
77640
77641
77642 l_segment := AcctDerRule_156(
77643 p_application_id => p_application_id
77644 , p_ae_header_id => l_ae_header_id
77645 , p_source_18 => p_source_18
77646 , p_source_19 => p_source_19
77647 , x_transaction_coa_id => l_adr_transaction_coa_id
77648 , x_accounting_coa_id => l_adr_accounting_coa_id
77649 , x_flexfield_segment_code => l_adr_flexfield_segment_code
77650 , x_flex_value_set_id => l_adr_flex_value_set_id
77651 , x_value_type_code => l_adr_value_type_code
77652 , x_value_combination_id => l_adr_value_combination_id
77653 , x_value_segment_code => l_adr_value_segment_code
77654 , p_side => 'NA'
77655 , p_override_seg_flag => 'Y'
77656 );
77657
77658 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
77659
77660 xla_ae_lines_pkg.set_segment(
77661 p_to_segment_code => 'GL_ACCOUNT'
77662 , p_segment_value => l_segment
77663 , p_from_segment_code => l_adr_value_segment_code
77664 , p_from_combination_id => l_adr_value_combination_id
77665 , p_value_type_code => l_adr_value_type_code
77666 , p_transaction_coa_id => l_adr_transaction_coa_id
77667 , p_accounting_coa_id => l_adr_accounting_coa_id
77668 , p_flexfield_segment_code => l_adr_flexfield_segment_code
77669 , p_flex_value_set_id => l_adr_flex_value_set_id
77670 , p_adr_code => 'FA_DEF_DEPRN_RESERVE_SEGMENT'
77671 , p_adr_type_code => 'S'
77672 , p_component_type => l_component_type
77673 , p_component_code => l_component_code
77674 , p_component_type_code => l_component_type_code
77675 , p_component_appl_id => l_component_appl_id
77676 , p_amb_context_code => l_amb_context_code
77677 , p_entity_code => 'DEFERRED_DEPRECIATION'
77678 , p_event_class_code => 'DEFERRED_DEPRECIATION'
77679 , p_side => 'NA'
77680 );
77681
77682 END IF;
77683
77684 l_segment := AcctDerRule_169(
77685 p_application_id => p_application_id
77686 , p_ae_header_id => l_ae_header_id
77687 , p_source_5 => p_source_5
77688 , p_source_31 => p_source_31
77689 , x_transaction_coa_id => l_adr_transaction_coa_id
77690 , x_accounting_coa_id => l_adr_accounting_coa_id
77691 , x_flexfield_segment_code => l_adr_flexfield_segment_code
77692 , x_flex_value_set_id => l_adr_flex_value_set_id
77693 , x_value_type_code => l_adr_value_type_code
77694 , x_value_combination_id => l_adr_value_combination_id
77695 , x_value_segment_code => l_adr_value_segment_code
77696 , p_side => 'NA'
77697 , p_override_seg_flag => 'Y'
77698 );
77699
77700 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
77701
77702 xla_ae_lines_pkg.set_segment(
77703 p_to_segment_code => 'GL_BALANCING'
77704 , p_segment_value => l_segment
77705 , p_from_segment_code => l_adr_value_segment_code
77706 , p_from_combination_id => l_adr_value_combination_id
77707 , p_value_type_code => l_adr_value_type_code
77708 , p_transaction_coa_id => l_adr_transaction_coa_id
77709 , p_accounting_coa_id => l_adr_accounting_coa_id
77710 , p_flexfield_segment_code => l_adr_flexfield_segment_code
77711 , p_flex_value_set_id => l_adr_flex_value_set_id
77712 , p_adr_code => 'FA_EXPENSE_ACCT'
77713 , p_adr_type_code => 'S'
77714 , p_component_type => l_component_type
77715 , p_component_code => l_component_code
77716 , p_component_type_code => l_component_type_code
77717 , p_component_appl_id => l_component_appl_id
77718 , p_amb_context_code => l_amb_context_code
77719 , p_entity_code => 'DEFERRED_DEPRECIATION'
77720 , p_event_class_code => 'DEFERRED_DEPRECIATION'
77721 , p_side => 'NA'
77722 );
77723
77724 END IF;
77725
77726 --
77727 --
77728 END IF;
77729 --
77730 -- Bug 4922099
77731 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
77732 (NVL(l_enc_upg_option, 'N') = 'O')
77733 ) AND
77734 (l_bflow_method_code = 'PRIOR_ENTRY')
77735 )
77736 THEN
77737 IF
77738 --
77739 1 = 2
77740 --
77741 THEN
77742 xla_accounting_err_pkg.build_message
77743 (p_appli_s_name => 'XLA'
77744 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
77745 ,p_token_1 => 'LINE_NUMBER'
77746 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
77750 ,l_component_code
77747 ,p_token_2 => 'LINE_TYPE_NAME'
77748 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
77749 l_component_type
77751 ,l_component_type_code
77752 ,l_component_appl_id
77753 ,l_amb_context_code
77754 ,l_entity_code
77755 ,l_event_class_code
77756 )
77757 ,p_token_3 => 'OWNER'
77758 ,p_value_3 => xla_lookups_pkg.get_meaning(
77759 p_lookup_type => 'XLA_OWNER_TYPE'
77760 ,p_lookup_code => l_component_type_code
77761 )
77762 ,p_token_4 => 'PRODUCT_NAME'
77763 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
77764 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
77765 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
77766 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
77767 ,p_ae_header_id => NULL
77768 );
77769
77770 IF (C_LEVEL_ERROR>= g_log_level) THEN
77771 trace
77772 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
77773 ,p_level => C_LEVEL_ERROR
77774 ,p_module => l_log_module);
77775 END IF;
77776 END IF;
77777 END IF;
77778 --
77779 --
77780 ------------------------------------------------------------------------------------------------
77781 -- 4219869 Business Flow
77782 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
77783 -- Prior Entry. Currently, the following code is always generated.
77784 ------------------------------------------------------------------------------------------------
77785 XLA_AE_LINES_PKG.ValidateCurrentLine;
77786
77787 ------------------------------------------------------------------------------------
77788 -- 4219869 Business Flow
77789 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
77790 ------------------------------------------------------------------------------------
77791 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
77792
77793 ----------------------------------------------------------------------------------
77794 -- 4219869 Business Flow
77795 -- Update journal entry status -- Need to generate this within IF <condition>
77796 ----------------------------------------------------------------------------------
77797 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
77798 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
77799 ,p_balance_type_code => l_balance_type_code
77800 );
77801
77802 -------------------------------------------------------------------------------------------
77803 -- 4262811 - Generate the Accrual Reversal lines
77804 -------------------------------------------------------------------------------------------
77805 BEGIN
77806 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
77807 (g_array_event(p_event_id).array_value_num('header_index'));
77808 IF l_acc_rev_flag IS NULL THEN
77809 l_acc_rev_flag := 'N';
77810 END IF;
77811 EXCEPTION
77812 WHEN OTHERS THEN
77813 l_acc_rev_flag := 'N';
77814 END;
77815 --
77816 IF (l_acc_rev_flag = 'Y') THEN
77817
77818 -- 4645092 ------------------------------------------------------------------------------
77819 -- To allow MPA report to determine if it should generate report process
77820 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
77821 ------------------------------------------------------------------------------------------
77822
77823 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
77824 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
77825 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
77826 -- call ADRs
77827 -- Bug 4922099
77828 --
77829 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
77830 (NVL(l_actual_upg_option, 'N') = 'O') OR
77831 (NVL(l_enc_upg_option, 'N') = 'O')
77832 )
77833 THEN
77834 NULL;
77835 --
77836 --
77837
77838 l_ccid := AcctDerRule_175(
77839 p_application_id => p_application_id
77840 , p_ae_header_id => l_ae_header_id
77841 , p_source_5 => p_source_5
77842 , p_source_19 => p_source_19
77846 , x_value_type_code => l_adr_value_type_code
77843 , p_source_32 => p_source_32
77844 , x_transaction_coa_id => l_adr_transaction_coa_id
77845 , x_accounting_coa_id => l_adr_accounting_coa_id
77847 , p_side => 'NA'
77848 );
77849
77850 xla_ae_lines_pkg.set_ccid(
77851 p_code_combination_id => l_ccid
77852 , p_value_type_code => l_adr_value_type_code
77853 , p_transaction_coa_id => l_adr_transaction_coa_id
77854 , p_accounting_coa_id => l_adr_accounting_coa_id
77855 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
77856 , p_adr_type_code => 'S'
77857 , p_component_type => l_component_type
77858 , p_component_code => l_component_code
77859 , p_component_type_code => l_component_type_code
77860 , p_component_appl_id => l_component_appl_id
77861 , p_amb_context_code => l_amb_context_code
77862 , p_side => 'NA'
77863 );
77864
77865
77866 l_segment := AcctDerRule_156(
77867 p_application_id => p_application_id
77868 , p_ae_header_id => l_ae_header_id
77869 , p_source_18 => p_source_18
77870 , p_source_19 => p_source_19
77871 , x_transaction_coa_id => l_adr_transaction_coa_id
77872 , x_accounting_coa_id => l_adr_accounting_coa_id
77873 , x_flexfield_segment_code => l_adr_flexfield_segment_code
77874 , x_flex_value_set_id => l_adr_flex_value_set_id
77875 , x_value_type_code => l_adr_value_type_code
77876 , x_value_combination_id => l_adr_value_combination_id
77877 , x_value_segment_code => l_adr_value_segment_code
77878 , p_side => 'NA'
77879 , p_override_seg_flag => 'Y'
77880 );
77881
77882 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
77883
77884 xla_ae_lines_pkg.set_segment(
77885 p_to_segment_code => 'GL_ACCOUNT'
77886 , p_segment_value => l_segment
77887 , p_from_segment_code => l_adr_value_segment_code
77888 , p_from_combination_id => l_adr_value_combination_id
77889 , p_value_type_code => l_adr_value_type_code
77890 , p_transaction_coa_id => l_adr_transaction_coa_id
77891 , p_accounting_coa_id => l_adr_accounting_coa_id
77892 , p_flexfield_segment_code => l_adr_flexfield_segment_code
77893 , p_flex_value_set_id => l_adr_flex_value_set_id
77894 , p_adr_code => 'FA_DEF_DEPRN_RESERVE_SEGMENT'
77895 , p_adr_type_code => 'S'
77896 , p_component_type => l_component_type
77897 , p_component_code => l_component_code
77898 , p_component_type_code => l_component_type_code
77899 , p_component_appl_id => l_component_appl_id
77900 , p_amb_context_code => l_amb_context_code
77901 , p_entity_code => 'DEFERRED_DEPRECIATION'
77902 , p_event_class_code => 'DEFERRED_DEPRECIATION'
77903 , p_side => 'NA'
77904 );
77905
77906 END IF;
77907
77908 l_segment := AcctDerRule_169(
77909 p_application_id => p_application_id
77910 , p_ae_header_id => l_ae_header_id
77911 , p_source_5 => p_source_5
77912 , p_source_31 => p_source_31
77913 , x_transaction_coa_id => l_adr_transaction_coa_id
77914 , x_accounting_coa_id => l_adr_accounting_coa_id
77915 , x_flexfield_segment_code => l_adr_flexfield_segment_code
77916 , x_flex_value_set_id => l_adr_flex_value_set_id
77917 , x_value_type_code => l_adr_value_type_code
77918 , x_value_combination_id => l_adr_value_combination_id
77919 , x_value_segment_code => l_adr_value_segment_code
77920 , p_side => 'NA'
77921 , p_override_seg_flag => 'Y'
77922 );
77923
77924 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
77925
77926 xla_ae_lines_pkg.set_segment(
77927 p_to_segment_code => 'GL_BALANCING'
77928 , p_segment_value => l_segment
77929 , p_from_segment_code => l_adr_value_segment_code
77930 , p_from_combination_id => l_adr_value_combination_id
77931 , p_value_type_code => l_adr_value_type_code
77932 , p_transaction_coa_id => l_adr_transaction_coa_id
77933 , p_accounting_coa_id => l_adr_accounting_coa_id
77934 , p_flexfield_segment_code => l_adr_flexfield_segment_code
77935 , p_flex_value_set_id => l_adr_flex_value_set_id
77936 , p_adr_code => 'FA_EXPENSE_ACCT'
77937 , p_adr_type_code => 'S'
77938 , p_component_type => l_component_type
77939 , p_component_code => l_component_code
77940 , p_component_type_code => l_component_type_code
77941 , p_component_appl_id => l_component_appl_id
77942 , p_amb_context_code => l_amb_context_code
77943 , p_entity_code => 'DEFERRED_DEPRECIATION'
77944 , p_event_class_code => 'DEFERRED_DEPRECIATION'
77945 , p_side => 'NA'
77946 );
77947
77948 END IF;
77949
77950 --
77954 --
77951 --
77952 END IF;
77953
77955 -- Update the line information that should be overwritten
77956 --
77957 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
77958 p_header_num => 1);
77959 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
77960
77961 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
77962
77963 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
77964 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
77965 END IF;
77966
77967 --
77968 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
77969 --
77970 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
77971 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
77972 ELSE
77973 ---------------------------------------------------------------------------------------------------
77974 -- 4262811a Switch Sign
77975 ---------------------------------------------------------------------------------------------------
77976 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
77977 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
77978 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
77979 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
77980 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
77981 -- 5132302
77982 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
77983 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
77984
77985 END IF;
77986
77987 -- 4955764
77988 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
77989 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
77990
77991
77992 XLA_AE_LINES_PKG.ValidateCurrentLine;
77993 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
77994
77995 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
77996 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
77997 ,p_balance_type_code => l_balance_type_code);
77998
77999 END IF;
78000
78001 -----------------------------------------------------------------------------------------
78002 -- 4262811 Multiperiod Accounting
78003 -----------------------------------------------------------------------------------------
78004 -- No MPA option is assigned.
78005
78006
78007 END IF;
78008 --
78009
78010 --
78011 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
78012 trace
78013 (p_msg => 'END of AcctLineType_272'
78014 ,p_level => C_LEVEL_PROCEDURE
78015 ,p_module => l_log_module);
78016 END IF;
78017 --
78018 EXCEPTION
78019 WHEN xla_exceptions_pkg.application_exception THEN
78020 RAISE;
78021 WHEN OTHERS THEN
78022 xla_exceptions_pkg.raise_message
78023 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_272');
78024 END AcctLineType_272;
78025 --
78026
78027 ---------------------------------------
78028 --
78029 -- PRIVATE FUNCTION
78030 -- AcctLineType_273
78031 --
78032 ---------------------------------------
78033 PROCEDURE AcctLineType_273 (
78034 p_application_id IN NUMBER
78035 ,p_event_id IN NUMBER
78036 ,p_calculate_acctd_flag IN VARCHAR2
78037 ,p_calculate_g_l_flag IN VARCHAR2
78038 ,p_actual_flag IN OUT VARCHAR2
78039 ,p_balance_type_code OUT VARCHAR2
78040 ,p_gain_or_loss_ref OUT VARCHAR2
78041
78042 --Period Close Date
78043 , p_source_1 IN DATE
78044 --Generated Code Combination Identifier
78045 , p_source_5 IN NUMBER
78046 --Net Book Value Retired Gain Account
78047 , p_source_23 IN VARCHAR2
78048 --Expense Account Code Combination Identifier
78049 , p_source_31 IN NUMBER
78050 --Default Code Combination Identifier
78051 , p_source_32 IN NUMBER
78052 --Adjustment Type
78053 , p_source_48 IN VARCHAR2
78054 --Transaction Header Identifier
78055 , p_source_49 IN NUMBER
78056 --Adjustment Line Identifier
78057 , p_source_50 IN NUMBER
78058 --Distribution Type Code
78059 , p_source_51 IN VARCHAR2
78060 --Entered Amount
78061 , p_source_52 IN NUMBER
78062 --Currency Code
78063 , p_source_53 IN VARCHAR2
78064 --Gain Loss Amount
78065 , p_source_54 IN NUMBER
78066 )
78067 IS
78068
78069 l_component_type VARCHAR2(80);
78070 l_component_code VARCHAR2(30);
78071 l_component_type_code VARCHAR2(1);
78072 l_component_appl_id INTEGER;
78073 l_amb_context_code VARCHAR2(30);
78074 l_entity_code VARCHAR2(30);
78075 l_event_class_code VARCHAR2(30);
78079 l_line_definition_owner_code VARCHAR2(1);
78076 l_ae_header_id NUMBER;
78077 l_event_type_code VARCHAR2(30);
78078 l_line_definition_code VARCHAR2(30);
78080 --
78081 -- adr variables
78082 l_segment VARCHAR2(30);
78083 l_ccid NUMBER;
78084 l_adr_transaction_coa_id NUMBER;
78085 l_adr_accounting_coa_id NUMBER;
78086 l_adr_flexfield_segment_code VARCHAR2(30);
78087 l_adr_flex_value_set_id NUMBER;
78088 l_adr_value_type_code VARCHAR2(30);
78089 l_adr_value_combination_id NUMBER;
78090 l_adr_value_segment_code VARCHAR2(30);
78091
78092 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
78093 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
78094 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
78095 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
78096
78097 -- 4262811 Variables ------------------------------------------------------------------------------------------
78098 l_entered_amt_idx NUMBER;
78099 l_accted_amt_idx NUMBER;
78100 l_acc_rev_flag VARCHAR2(1);
78101 l_accrual_line_num NUMBER;
78102 l_tmp_amt NUMBER;
78103 l_acc_rev_natural_side_code VARCHAR2(1);
78104
78105 l_num_entries NUMBER;
78106 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
78107 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
78108 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
78109 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
78110 l_recog_line_1 NUMBER;
78111 l_recog_line_2 NUMBER;
78112
78113 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
78114 l_bflow_applied_to_amt NUMBER; -- 5132302
78115 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
78116
78117 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
78118
78119 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
78120 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
78121
78122 ---------------------------------------------------------------------------------------------------------------
78123
78124
78125 --
78126 -- bulk performance
78127 --
78128 l_balance_type_code VARCHAR2(1);
78129 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
78130 l_log_module VARCHAR2(240);
78131
78132 --
78133 -- Upgrade strategy
78134 --
78135 l_actual_upg_option VARCHAR2(1);
78136 l_enc_upg_option VARCHAR2(1);
78137
78138 --
78139 BEGIN
78140 --
78141 IF g_log_enabled THEN
78142 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_273';
78143 END IF;
78144 --
78145 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
78146
78147 trace
78148 (p_msg => 'BEGIN of AcctLineType_273'
78149 ,p_level => C_LEVEL_PROCEDURE
78150 ,p_module => l_log_module);
78151
78152 END IF;
78153 --
78154 l_component_type := 'AMB_JLT';
78155 l_component_code := 'FA_NBV_RETIRED_GAIN';
78156 l_component_type_code := 'S';
78157 l_component_appl_id := 140;
78158 l_amb_context_code := 'DEFAULT';
78159 l_entity_code := 'TRANSACTIONS';
78160 l_event_class_code := 'RETIREMENTS';
78161 l_event_type_code := 'RETIREMENTS';
78162 l_line_definition_owner_code := 'S';
78163 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
78164 --
78165 l_balance_type_code := 'A';
78166 l_segment := NULL;
78167 l_ccid := NULL;
78168 l_adr_transaction_coa_id := NULL;
78169 l_adr_accounting_coa_id := NULL;
78170 l_adr_flexfield_segment_code := NULL;
78171 l_adr_flex_value_set_id := NULL;
78172 l_adr_value_type_code := NULL;
78173 l_adr_value_combination_id := NULL;
78174 l_adr_value_segment_code := NULL;
78175
78176 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
78177 l_bflow_class_code := ''; -- 4219869 Business Flow
78178 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
78179 l_budgetary_control_flag := 'N';
78180
78181 l_bflow_applied_to_amt_idx := NULL; -- 5132302
78182 l_bflow_applied_to_amt := NULL; -- 5132302
78183 l_entered_amt_idx := NULL; -- 4262811
78184 l_accted_amt_idx := NULL; -- 4262811
78185 l_acc_rev_flag := NULL; -- 4262811
78186 l_accrual_line_num := NULL; -- 4262811
78187 l_tmp_amt := NULL; -- 4262811
78188 --
78189
78190 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
78191 l_balance_type_code <> 'B' THEN
78192 IF NVL(p_source_48,'
78193 ') = 'NBV RETIRED' AND
78194 p_source_54 >= 0
78195 THEN
78196
78197 --
78198 XLA_AE_LINES_PKG.SetNewLine;
78199
78200 p_balance_type_code := l_balance_type_code;
78201 -- set the flag so later we will know whether the gain loss line needs to be created
78202
78203 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
78207 --
78204 p_actual_flag :='A';
78205 END IF;
78206
78208 -- bulk performance
78209 --
78210 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
78211 p_header_num => 0); -- 4262811
78212 --
78213 -- set accounting line options
78214 --
78215 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
78216 p_natural_side_code => 'D'
78217 , p_gain_or_loss_flag => 'N'
78218 , p_gl_transfer_mode_code => 'S'
78219 , p_acct_entry_type_code => 'A'
78220 , p_switch_side_flag => 'Y'
78221 , p_merge_duplicate_code => 'N'
78222 );
78223 --
78224 l_acc_rev_natural_side_code := 'C'; -- 4262811
78225 --
78226 --
78227 -- set accounting line type info
78228 --
78229 xla_ae_lines_pkg.SetAcctLineType
78230 (p_component_type => l_component_type
78231 ,p_event_type_code => l_event_type_code
78232 ,p_line_definition_owner_code => l_line_definition_owner_code
78233 ,p_line_definition_code => l_line_definition_code
78234 ,p_accounting_line_code => l_component_code
78235 ,p_accounting_line_type_code => l_component_type_code
78236 ,p_accounting_line_appl_id => l_component_appl_id
78237 ,p_amb_context_code => l_amb_context_code
78238 ,p_entity_code => l_entity_code
78239 ,p_event_class_code => l_event_class_code);
78240 --
78241 -- set accounting class
78242 --
78243 xla_ae_lines_pkg.SetAcctClass(
78244 p_accounting_class_code => 'ASSET'
78245 , p_ae_header_id => l_ae_header_id
78246 );
78247
78248 --
78249 -- set rounding class
78250 --
78251 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
78252 'ASSET';
78253
78254 --
78255 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
78256 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
78257 --
78258 -- bulk performance
78259 --
78260 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
78261
78262 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
78263 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
78264
78265 -- 4955764
78266 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
78267 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
78268
78269 -- 4458381 Public Sector Enh
78270
78271 --
78272 -- set accounting attributes for the line type
78273 --
78274 l_entered_amt_idx := 4;
78275 l_accted_amt_idx := 6;
78276 l_bflow_applied_to_amt_idx := NULL; -- 5132302
78277 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
78278 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
78279 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
78280 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
78281 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
78282 l_rec_acct_attrs.array_char_value(3) := p_source_51;
78283 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
78284 l_rec_acct_attrs.array_num_value(4) := p_source_52;
78285 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
78286 l_rec_acct_attrs.array_char_value(5) := p_source_53;
78287 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
78288 l_rec_acct_attrs.array_num_value(6) := p_source_52;
78289
78290 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
78291 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
78292
78293 ---------------------------------------------------------------------------------------------------------------
78294 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
78295 ---------------------------------------------------------------------------------------------------------------
78296 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
78297
78298 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
78299 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
78300
78301 IF xla_accounting_cache_pkg.GetValueChar
78302 (p_source_code => 'LEDGER_CATEGORY_CODE'
78303 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
78304 AND l_bflow_method_code = 'PRIOR_ENTRY'
78305 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
78306 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
78307 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
78308 )
78309 THEN
78310 xla_ae_lines_pkg.BflowUpgEntry
78311 (p_business_method_code => l_bflow_method_code
78312 ,p_business_class_code => l_bflow_class_code
78313 ,p_balance_type => l_balance_type_code);
78314 ELSE
78315 NULL;
78319 --
78316 -- No business flow processing for business flow method of NONE.
78317 END IF;
78318
78320 -- call analytical criteria
78321 --
78322
78323 --
78324 -- call description
78325 --
78326
78327 xla_ae_lines_pkg.SetLineDescription(
78328 p_ae_header_id => l_ae_header_id
78329 ,p_description => Description_80 (
78330 p_application_id => p_application_id
78331 , p_ae_header_id => l_ae_header_id
78332 , p_source_1 => p_source_1
78333 )
78334 );
78335
78336
78337 --
78338 -- call ADRs
78339 -- Bug 4922099
78340 --
78341 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
78342 (NVL(l_actual_upg_option, 'N') = 'O') OR
78343 (NVL(l_enc_upg_option, 'N') = 'O')
78344 )
78345 THEN
78346 NULL;
78347 --
78348 --
78349
78350 l_ccid := AcctDerRule_174(
78351 p_application_id => p_application_id
78352 , p_ae_header_id => l_ae_header_id
78353 , p_source_5 => p_source_5
78354 , p_source_32 => p_source_32
78355 , x_transaction_coa_id => l_adr_transaction_coa_id
78356 , x_accounting_coa_id => l_adr_accounting_coa_id
78357 , x_value_type_code => l_adr_value_type_code
78358 , p_side => 'NA'
78359 );
78360
78361 xla_ae_lines_pkg.set_ccid(
78362 p_code_combination_id => l_ccid
78363 , p_value_type_code => l_adr_value_type_code
78364 , p_transaction_coa_id => l_adr_transaction_coa_id
78365 , p_accounting_coa_id => l_adr_accounting_coa_id
78366 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
78367 , p_adr_type_code => 'S'
78368 , p_component_type => l_component_type
78369 , p_component_code => l_component_code
78370 , p_component_type_code => l_component_type_code
78371 , p_component_appl_id => l_component_appl_id
78372 , p_amb_context_code => l_amb_context_code
78373 , p_side => 'NA'
78374 );
78375
78376
78377 l_segment := AcctDerRule_169(
78378 p_application_id => p_application_id
78379 , p_ae_header_id => l_ae_header_id
78380 , p_source_5 => p_source_5
78381 , p_source_31 => p_source_31
78382 , x_transaction_coa_id => l_adr_transaction_coa_id
78383 , x_accounting_coa_id => l_adr_accounting_coa_id
78384 , x_flexfield_segment_code => l_adr_flexfield_segment_code
78385 , x_flex_value_set_id => l_adr_flex_value_set_id
78386 , x_value_type_code => l_adr_value_type_code
78387 , x_value_combination_id => l_adr_value_combination_id
78388 , x_value_segment_code => l_adr_value_segment_code
78389 , p_side => 'NA'
78390 , p_override_seg_flag => 'Y'
78391 );
78392
78393 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
78394
78395 xla_ae_lines_pkg.set_segment(
78396 p_to_segment_code => 'GL_BALANCING'
78397 , p_segment_value => l_segment
78398 , p_from_segment_code => l_adr_value_segment_code
78399 , p_from_combination_id => l_adr_value_combination_id
78400 , p_value_type_code => l_adr_value_type_code
78401 , p_transaction_coa_id => l_adr_transaction_coa_id
78402 , p_accounting_coa_id => l_adr_accounting_coa_id
78403 , p_flexfield_segment_code => l_adr_flexfield_segment_code
78404 , p_flex_value_set_id => l_adr_flex_value_set_id
78405 , p_adr_code => 'FA_EXPENSE_ACCT'
78406 , p_adr_type_code => 'S'
78407 , p_component_type => l_component_type
78408 , p_component_code => l_component_code
78409 , p_component_type_code => l_component_type_code
78410 , p_component_appl_id => l_component_appl_id
78411 , p_amb_context_code => l_amb_context_code
78412 , p_entity_code => 'TRANSACTIONS'
78413 , p_event_class_code => 'RETIREMENTS'
78414 , p_side => 'NA'
78415 );
78416
78417 END IF;
78418
78419 l_segment := AcctDerRule_160(
78420 p_application_id => p_application_id
78421 , p_ae_header_id => l_ae_header_id
78422 , p_source_5 => p_source_5
78423 , p_source_23 => p_source_23
78424 , x_transaction_coa_id => l_adr_transaction_coa_id
78425 , x_accounting_coa_id => l_adr_accounting_coa_id
78426 , x_flexfield_segment_code => l_adr_flexfield_segment_code
78427 , x_flex_value_set_id => l_adr_flex_value_set_id
78428 , x_value_type_code => l_adr_value_type_code
78429 , x_value_combination_id => l_adr_value_combination_id
78430 , x_value_segment_code => l_adr_value_segment_code
78431 , p_side => 'NA'
78432 , p_override_seg_flag => 'Y'
78433 );
78434
78435 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
78436
78437 xla_ae_lines_pkg.set_segment(
78438 p_to_segment_code => 'GL_ACCOUNT'
78439 , p_segment_value => l_segment
78443 , p_transaction_coa_id => l_adr_transaction_coa_id
78440 , p_from_segment_code => l_adr_value_segment_code
78441 , p_from_combination_id => l_adr_value_combination_id
78442 , p_value_type_code => l_adr_value_type_code
78444 , p_accounting_coa_id => l_adr_accounting_coa_id
78445 , p_flexfield_segment_code => l_adr_flexfield_segment_code
78446 , p_flex_value_set_id => l_adr_flex_value_set_id
78447 , p_adr_code => 'FA_NBV_RETIRED_GAIN_SEGMENT'
78448 , p_adr_type_code => 'S'
78449 , p_component_type => l_component_type
78450 , p_component_code => l_component_code
78451 , p_component_type_code => l_component_type_code
78452 , p_component_appl_id => l_component_appl_id
78453 , p_amb_context_code => l_amb_context_code
78454 , p_entity_code => 'TRANSACTIONS'
78455 , p_event_class_code => 'RETIREMENTS'
78456 , p_side => 'NA'
78457 );
78458
78459 END IF;
78460
78461 --
78462 --
78463 END IF;
78464 --
78465 -- Bug 4922099
78466 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
78467 (NVL(l_enc_upg_option, 'N') = 'O')
78468 ) AND
78469 (l_bflow_method_code = 'PRIOR_ENTRY')
78470 )
78471 THEN
78472 IF
78473 --
78474 1 = 2
78475 --
78476 THEN
78477 xla_accounting_err_pkg.build_message
78478 (p_appli_s_name => 'XLA'
78479 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
78480 ,p_token_1 => 'LINE_NUMBER'
78481 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
78482 ,p_token_2 => 'LINE_TYPE_NAME'
78483 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
78484 l_component_type
78485 ,l_component_code
78486 ,l_component_type_code
78487 ,l_component_appl_id
78488 ,l_amb_context_code
78489 ,l_entity_code
78490 ,l_event_class_code
78491 )
78492 ,p_token_3 => 'OWNER'
78493 ,p_value_3 => xla_lookups_pkg.get_meaning(
78494 p_lookup_type => 'XLA_OWNER_TYPE'
78495 ,p_lookup_code => l_component_type_code
78496 )
78497 ,p_token_4 => 'PRODUCT_NAME'
78498 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
78499 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
78500 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
78501 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
78502 ,p_ae_header_id => NULL
78503 );
78504
78505 IF (C_LEVEL_ERROR>= g_log_level) THEN
78506 trace
78507 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
78508 ,p_level => C_LEVEL_ERROR
78509 ,p_module => l_log_module);
78510 END IF;
78511 END IF;
78512 END IF;
78513 --
78514 --
78515 ------------------------------------------------------------------------------------------------
78516 -- 4219869 Business Flow
78517 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
78518 -- Prior Entry. Currently, the following code is always generated.
78519 ------------------------------------------------------------------------------------------------
78520 XLA_AE_LINES_PKG.ValidateCurrentLine;
78521
78522 ------------------------------------------------------------------------------------
78523 -- 4219869 Business Flow
78524 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
78525 ------------------------------------------------------------------------------------
78526 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
78527
78528 ----------------------------------------------------------------------------------
78529 -- 4219869 Business Flow
78530 -- Update journal entry status -- Need to generate this within IF <condition>
78531 ----------------------------------------------------------------------------------
78532 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
78533 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
78537 -------------------------------------------------------------------------------------------
78534 ,p_balance_type_code => l_balance_type_code
78535 );
78536
78538 -- 4262811 - Generate the Accrual Reversal lines
78539 -------------------------------------------------------------------------------------------
78540 BEGIN
78541 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
78542 (g_array_event(p_event_id).array_value_num('header_index'));
78543 IF l_acc_rev_flag IS NULL THEN
78544 l_acc_rev_flag := 'N';
78545 END IF;
78546 EXCEPTION
78547 WHEN OTHERS THEN
78548 l_acc_rev_flag := 'N';
78549 END;
78550 --
78551 IF (l_acc_rev_flag = 'Y') THEN
78552
78553 -- 4645092 ------------------------------------------------------------------------------
78554 -- To allow MPA report to determine if it should generate report process
78555 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
78556 ------------------------------------------------------------------------------------------
78557
78558 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
78559 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
78560 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
78561 -- call ADRs
78562 -- Bug 4922099
78563 --
78564 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
78565 (NVL(l_actual_upg_option, 'N') = 'O') OR
78566 (NVL(l_enc_upg_option, 'N') = 'O')
78567 )
78568 THEN
78569 NULL;
78570 --
78571 --
78572
78573 l_ccid := AcctDerRule_174(
78574 p_application_id => p_application_id
78575 , p_ae_header_id => l_ae_header_id
78576 , p_source_5 => p_source_5
78577 , p_source_32 => p_source_32
78578 , x_transaction_coa_id => l_adr_transaction_coa_id
78579 , x_accounting_coa_id => l_adr_accounting_coa_id
78580 , x_value_type_code => l_adr_value_type_code
78581 , p_side => 'NA'
78582 );
78583
78584 xla_ae_lines_pkg.set_ccid(
78585 p_code_combination_id => l_ccid
78586 , p_value_type_code => l_adr_value_type_code
78587 , p_transaction_coa_id => l_adr_transaction_coa_id
78588 , p_accounting_coa_id => l_adr_accounting_coa_id
78589 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
78590 , p_adr_type_code => 'S'
78591 , p_component_type => l_component_type
78592 , p_component_code => l_component_code
78593 , p_component_type_code => l_component_type_code
78594 , p_component_appl_id => l_component_appl_id
78595 , p_amb_context_code => l_amb_context_code
78596 , p_side => 'NA'
78597 );
78598
78599
78600 l_segment := AcctDerRule_169(
78601 p_application_id => p_application_id
78602 , p_ae_header_id => l_ae_header_id
78603 , p_source_5 => p_source_5
78604 , p_source_31 => p_source_31
78605 , x_transaction_coa_id => l_adr_transaction_coa_id
78606 , x_accounting_coa_id => l_adr_accounting_coa_id
78607 , x_flexfield_segment_code => l_adr_flexfield_segment_code
78608 , x_flex_value_set_id => l_adr_flex_value_set_id
78609 , x_value_type_code => l_adr_value_type_code
78610 , x_value_combination_id => l_adr_value_combination_id
78611 , x_value_segment_code => l_adr_value_segment_code
78612 , p_side => 'NA'
78613 , p_override_seg_flag => 'Y'
78614 );
78615
78616 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
78617
78618 xla_ae_lines_pkg.set_segment(
78619 p_to_segment_code => 'GL_BALANCING'
78620 , p_segment_value => l_segment
78621 , p_from_segment_code => l_adr_value_segment_code
78622 , p_from_combination_id => l_adr_value_combination_id
78623 , p_value_type_code => l_adr_value_type_code
78624 , p_transaction_coa_id => l_adr_transaction_coa_id
78625 , p_accounting_coa_id => l_adr_accounting_coa_id
78626 , p_flexfield_segment_code => l_adr_flexfield_segment_code
78627 , p_flex_value_set_id => l_adr_flex_value_set_id
78628 , p_adr_code => 'FA_EXPENSE_ACCT'
78629 , p_adr_type_code => 'S'
78630 , p_component_type => l_component_type
78631 , p_component_code => l_component_code
78632 , p_component_type_code => l_component_type_code
78633 , p_component_appl_id => l_component_appl_id
78634 , p_amb_context_code => l_amb_context_code
78635 , p_entity_code => 'TRANSACTIONS'
78636 , p_event_class_code => 'RETIREMENTS'
78637 , p_side => 'NA'
78638 );
78639
78640 END IF;
78641
78642 l_segment := AcctDerRule_160(
78643 p_application_id => p_application_id
78644 , p_ae_header_id => l_ae_header_id
78645 , p_source_5 => p_source_5
78646 , p_source_23 => p_source_23
78647 , x_transaction_coa_id => l_adr_transaction_coa_id
78648 , x_accounting_coa_id => l_adr_accounting_coa_id
78649 , x_flexfield_segment_code => l_adr_flexfield_segment_code
78653 , x_value_segment_code => l_adr_value_segment_code
78650 , x_flex_value_set_id => l_adr_flex_value_set_id
78651 , x_value_type_code => l_adr_value_type_code
78652 , x_value_combination_id => l_adr_value_combination_id
78654 , p_side => 'NA'
78655 , p_override_seg_flag => 'Y'
78656 );
78657
78658 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
78659
78660 xla_ae_lines_pkg.set_segment(
78661 p_to_segment_code => 'GL_ACCOUNT'
78662 , p_segment_value => l_segment
78663 , p_from_segment_code => l_adr_value_segment_code
78664 , p_from_combination_id => l_adr_value_combination_id
78665 , p_value_type_code => l_adr_value_type_code
78666 , p_transaction_coa_id => l_adr_transaction_coa_id
78667 , p_accounting_coa_id => l_adr_accounting_coa_id
78668 , p_flexfield_segment_code => l_adr_flexfield_segment_code
78669 , p_flex_value_set_id => l_adr_flex_value_set_id
78670 , p_adr_code => 'FA_NBV_RETIRED_GAIN_SEGMENT'
78671 , p_adr_type_code => 'S'
78672 , p_component_type => l_component_type
78673 , p_component_code => l_component_code
78674 , p_component_type_code => l_component_type_code
78675 , p_component_appl_id => l_component_appl_id
78676 , p_amb_context_code => l_amb_context_code
78677 , p_entity_code => 'TRANSACTIONS'
78678 , p_event_class_code => 'RETIREMENTS'
78679 , p_side => 'NA'
78680 );
78681
78682 END IF;
78683
78684 --
78685 --
78686 END IF;
78687
78688 --
78689 -- Update the line information that should be overwritten
78690 --
78691 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
78692 p_header_num => 1);
78693 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
78694
78695 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
78696
78697 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
78698 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
78699 END IF;
78700
78701 --
78702 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
78703 --
78704 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
78705 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
78706 ELSE
78707 ---------------------------------------------------------------------------------------------------
78708 -- 4262811a Switch Sign
78709 ---------------------------------------------------------------------------------------------------
78710 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
78711 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
78712 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
78713 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
78714 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
78715 -- 5132302
78716 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
78717 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
78718
78719 END IF;
78720
78721 -- 4955764
78722 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
78723 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
78724
78725
78726 XLA_AE_LINES_PKG.ValidateCurrentLine;
78727 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
78728
78729 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
78730 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
78731 ,p_balance_type_code => l_balance_type_code);
78732
78733 END IF;
78734
78735 -----------------------------------------------------------------------------------------
78736 -- 4262811 Multiperiod Accounting
78737 -----------------------------------------------------------------------------------------
78738 -- No MPA option is assigned.
78739
78740
78741 END IF;
78742 END IF;
78743 --
78744
78745 --
78746 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
78747 trace
78748 (p_msg => 'END of AcctLineType_273'
78749 ,p_level => C_LEVEL_PROCEDURE
78750 ,p_module => l_log_module);
78751 END IF;
78752 --
78753 EXCEPTION
78754 WHEN xla_exceptions_pkg.application_exception THEN
78755 RAISE;
78756 WHEN OTHERS THEN
78757 xla_exceptions_pkg.raise_message
78758 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_273');
78759 END AcctLineType_273;
78760 --
78761
78762 ---------------------------------------
78763 --
78764 -- PRIVATE FUNCTION
78768 PROCEDURE AcctLineType_274 (
78765 -- AcctLineType_274
78766 --
78767 ---------------------------------------
78769 p_application_id IN NUMBER
78770 ,p_event_id IN NUMBER
78771 ,p_calculate_acctd_flag IN VARCHAR2
78772 ,p_calculate_g_l_flag IN VARCHAR2
78773 ,p_actual_flag IN OUT VARCHAR2
78774 ,p_balance_type_code OUT VARCHAR2
78775 ,p_gain_or_loss_ref OUT VARCHAR2
78776
78777 --Period Close Date
78778 , p_source_1 IN DATE
78779 --Generated Code Combination Identifier
78780 , p_source_5 IN NUMBER
78781 --Net Book Value Retired Gain Account
78782 , p_source_23 IN VARCHAR2
78783 --Expense Account Code Combination Identifier
78784 , p_source_31 IN NUMBER
78785 --Default Code Combination Identifier
78786 , p_source_32 IN NUMBER
78787 --Adjustment Type
78788 , p_source_48 IN VARCHAR2
78789 --Transaction Header Identifier
78790 , p_source_49 IN NUMBER
78791 --Adjustment Line Identifier
78792 , p_source_50 IN NUMBER
78793 --Distribution Type Code
78794 , p_source_51 IN VARCHAR2
78795 --Entered Amount
78796 , p_source_52 IN NUMBER
78797 --Currency Code
78798 , p_source_53 IN VARCHAR2
78799 --Gain Loss Amount
78800 , p_source_54 IN NUMBER
78801 )
78802 IS
78803
78804 l_component_type VARCHAR2(80);
78805 l_component_code VARCHAR2(30);
78806 l_component_type_code VARCHAR2(1);
78807 l_component_appl_id INTEGER;
78808 l_amb_context_code VARCHAR2(30);
78809 l_entity_code VARCHAR2(30);
78810 l_event_class_code VARCHAR2(30);
78811 l_ae_header_id NUMBER;
78812 l_event_type_code VARCHAR2(30);
78813 l_line_definition_code VARCHAR2(30);
78814 l_line_definition_owner_code VARCHAR2(1);
78815 --
78816 -- adr variables
78817 l_segment VARCHAR2(30);
78818 l_ccid NUMBER;
78819 l_adr_transaction_coa_id NUMBER;
78820 l_adr_accounting_coa_id NUMBER;
78821 l_adr_flexfield_segment_code VARCHAR2(30);
78822 l_adr_flex_value_set_id NUMBER;
78823 l_adr_value_type_code VARCHAR2(30);
78824 l_adr_value_combination_id NUMBER;
78825 l_adr_value_segment_code VARCHAR2(30);
78826
78827 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
78828 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
78829 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
78830 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
78831
78832 -- 4262811 Variables ------------------------------------------------------------------------------------------
78833 l_entered_amt_idx NUMBER;
78834 l_accted_amt_idx NUMBER;
78835 l_acc_rev_flag VARCHAR2(1);
78836 l_accrual_line_num NUMBER;
78837 l_tmp_amt NUMBER;
78838 l_acc_rev_natural_side_code VARCHAR2(1);
78839
78840 l_num_entries NUMBER;
78841 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
78842 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
78843 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
78844 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
78845 l_recog_line_1 NUMBER;
78846 l_recog_line_2 NUMBER;
78847
78848 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
78849 l_bflow_applied_to_amt NUMBER; -- 5132302
78850 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
78851
78852 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
78853
78854 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
78855 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
78856
78857 ---------------------------------------------------------------------------------------------------------------
78858
78859
78860 --
78861 -- bulk performance
78862 --
78863 l_balance_type_code VARCHAR2(1);
78864 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
78865 l_log_module VARCHAR2(240);
78866
78867 --
78868 -- Upgrade strategy
78869 --
78870 l_actual_upg_option VARCHAR2(1);
78871 l_enc_upg_option VARCHAR2(1);
78872
78873 --
78874 BEGIN
78875 --
78876 IF g_log_enabled THEN
78877 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_274';
78878 END IF;
78879 --
78880 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
78881
78882 trace
78883 (p_msg => 'BEGIN of AcctLineType_274'
78884 ,p_level => C_LEVEL_PROCEDURE
78885 ,p_module => l_log_module);
78886
78887 END IF;
78888 --
78889 l_component_type := 'AMB_JLT';
78890 l_component_code := 'FA_NBV_RETIRED_GAIN';
78891 l_component_type_code := 'S';
78892 l_component_appl_id := 140;
78893 l_amb_context_code := 'DEFAULT';
78894 l_entity_code := 'TRANSACTIONS';
78895 l_event_class_code := 'RETIREMENTS';
78899 --
78896 l_event_type_code := 'REINSTATEMENTS';
78897 l_line_definition_owner_code := 'S';
78898 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
78900 l_balance_type_code := 'A';
78901 l_segment := NULL;
78902 l_ccid := NULL;
78903 l_adr_transaction_coa_id := NULL;
78904 l_adr_accounting_coa_id := NULL;
78905 l_adr_flexfield_segment_code := NULL;
78906 l_adr_flex_value_set_id := NULL;
78907 l_adr_value_type_code := NULL;
78908 l_adr_value_combination_id := NULL;
78909 l_adr_value_segment_code := NULL;
78910
78911 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
78912 l_bflow_class_code := ''; -- 4219869 Business Flow
78913 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
78914 l_budgetary_control_flag := 'N';
78915
78916 l_bflow_applied_to_amt_idx := NULL; -- 5132302
78917 l_bflow_applied_to_amt := NULL; -- 5132302
78918 l_entered_amt_idx := NULL; -- 4262811
78919 l_accted_amt_idx := NULL; -- 4262811
78920 l_acc_rev_flag := NULL; -- 4262811
78921 l_accrual_line_num := NULL; -- 4262811
78922 l_tmp_amt := NULL; -- 4262811
78923 --
78924
78925 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
78926 l_balance_type_code <> 'B' THEN
78927 IF NVL(p_source_48,'
78928 ') = 'NBV RETIRED' AND
78929 p_source_54 >= 0
78930 THEN
78931
78932 --
78933 XLA_AE_LINES_PKG.SetNewLine;
78934
78935 p_balance_type_code := l_balance_type_code;
78936 -- set the flag so later we will know whether the gain loss line needs to be created
78937
78938 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
78939 p_actual_flag :='A';
78940 END IF;
78941
78942 --
78943 -- bulk performance
78944 --
78945 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
78946 p_header_num => 0); -- 4262811
78947 --
78948 -- set accounting line options
78949 --
78950 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
78951 p_natural_side_code => 'D'
78952 , p_gain_or_loss_flag => 'N'
78953 , p_gl_transfer_mode_code => 'S'
78954 , p_acct_entry_type_code => 'A'
78955 , p_switch_side_flag => 'Y'
78956 , p_merge_duplicate_code => 'N'
78957 );
78958 --
78959 l_acc_rev_natural_side_code := 'C'; -- 4262811
78960 --
78961 --
78962 -- set accounting line type info
78963 --
78964 xla_ae_lines_pkg.SetAcctLineType
78965 (p_component_type => l_component_type
78966 ,p_event_type_code => l_event_type_code
78967 ,p_line_definition_owner_code => l_line_definition_owner_code
78968 ,p_line_definition_code => l_line_definition_code
78969 ,p_accounting_line_code => l_component_code
78970 ,p_accounting_line_type_code => l_component_type_code
78971 ,p_accounting_line_appl_id => l_component_appl_id
78972 ,p_amb_context_code => l_amb_context_code
78973 ,p_entity_code => l_entity_code
78974 ,p_event_class_code => l_event_class_code);
78975 --
78976 -- set accounting class
78977 --
78978 xla_ae_lines_pkg.SetAcctClass(
78979 p_accounting_class_code => 'ASSET'
78980 , p_ae_header_id => l_ae_header_id
78981 );
78982
78983 --
78984 -- set rounding class
78985 --
78986 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
78987 'ASSET';
78988
78989 --
78990 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
78991 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
78992 --
78993 -- bulk performance
78994 --
78995 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
78996
78997 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
78998 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
78999
79000 -- 4955764
79001 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
79002 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
79003
79004 -- 4458381 Public Sector Enh
79005
79006 --
79007 -- set accounting attributes for the line type
79008 --
79009 l_entered_amt_idx := 4;
79010 l_accted_amt_idx := 6;
79011 l_bflow_applied_to_amt_idx := NULL; -- 5132302
79012 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
79013 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
79014 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
79015 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
79016 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
79017 l_rec_acct_attrs.array_char_value(3) := p_source_51;
79018 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
79022 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
79019 l_rec_acct_attrs.array_num_value(4) := p_source_52;
79020 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
79021 l_rec_acct_attrs.array_char_value(5) := p_source_53;
79023 l_rec_acct_attrs.array_num_value(6) := p_source_52;
79024
79025 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
79026 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
79027
79028 ---------------------------------------------------------------------------------------------------------------
79029 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
79030 ---------------------------------------------------------------------------------------------------------------
79031 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
79032
79033 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
79034 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
79035
79036 IF xla_accounting_cache_pkg.GetValueChar
79037 (p_source_code => 'LEDGER_CATEGORY_CODE'
79038 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
79039 AND l_bflow_method_code = 'PRIOR_ENTRY'
79040 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
79041 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
79042 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
79043 )
79044 THEN
79045 xla_ae_lines_pkg.BflowUpgEntry
79046 (p_business_method_code => l_bflow_method_code
79047 ,p_business_class_code => l_bflow_class_code
79048 ,p_balance_type => l_balance_type_code);
79049 ELSE
79050 NULL;
79051 -- No business flow processing for business flow method of NONE.
79052 END IF;
79053
79054 --
79055 -- call analytical criteria
79056 --
79057
79058 --
79059 -- call description
79060 --
79061
79062 xla_ae_lines_pkg.SetLineDescription(
79063 p_ae_header_id => l_ae_header_id
79064 ,p_description => Description_80 (
79065 p_application_id => p_application_id
79066 , p_ae_header_id => l_ae_header_id
79067 , p_source_1 => p_source_1
79068 )
79069 );
79070
79071
79072 --
79073 -- call ADRs
79074 -- Bug 4922099
79075 --
79076 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
79077 (NVL(l_actual_upg_option, 'N') = 'O') OR
79078 (NVL(l_enc_upg_option, 'N') = 'O')
79079 )
79080 THEN
79081 NULL;
79082 --
79083 --
79084
79085 l_ccid := AcctDerRule_174(
79086 p_application_id => p_application_id
79087 , p_ae_header_id => l_ae_header_id
79088 , p_source_5 => p_source_5
79089 , p_source_32 => p_source_32
79090 , x_transaction_coa_id => l_adr_transaction_coa_id
79091 , x_accounting_coa_id => l_adr_accounting_coa_id
79092 , x_value_type_code => l_adr_value_type_code
79093 , p_side => 'NA'
79094 );
79095
79096 xla_ae_lines_pkg.set_ccid(
79097 p_code_combination_id => l_ccid
79098 , p_value_type_code => l_adr_value_type_code
79099 , p_transaction_coa_id => l_adr_transaction_coa_id
79100 , p_accounting_coa_id => l_adr_accounting_coa_id
79101 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
79102 , p_adr_type_code => 'S'
79103 , p_component_type => l_component_type
79104 , p_component_code => l_component_code
79105 , p_component_type_code => l_component_type_code
79106 , p_component_appl_id => l_component_appl_id
79107 , p_amb_context_code => l_amb_context_code
79108 , p_side => 'NA'
79109 );
79110
79111
79112 l_segment := AcctDerRule_169(
79113 p_application_id => p_application_id
79114 , p_ae_header_id => l_ae_header_id
79115 , p_source_5 => p_source_5
79116 , p_source_31 => p_source_31
79117 , x_transaction_coa_id => l_adr_transaction_coa_id
79118 , x_accounting_coa_id => l_adr_accounting_coa_id
79119 , x_flexfield_segment_code => l_adr_flexfield_segment_code
79120 , x_flex_value_set_id => l_adr_flex_value_set_id
79121 , x_value_type_code => l_adr_value_type_code
79122 , x_value_combination_id => l_adr_value_combination_id
79123 , x_value_segment_code => l_adr_value_segment_code
79124 , p_side => 'NA'
79125 , p_override_seg_flag => 'Y'
79126 );
79127
79128 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
79129
79130 xla_ae_lines_pkg.set_segment(
79131 p_to_segment_code => 'GL_BALANCING'
79132 , p_segment_value => l_segment
79133 , p_from_segment_code => l_adr_value_segment_code
79134 , p_from_combination_id => l_adr_value_combination_id
79135 , p_value_type_code => l_adr_value_type_code
79136 , p_transaction_coa_id => l_adr_transaction_coa_id
79137 , p_accounting_coa_id => l_adr_accounting_coa_id
79141 , p_adr_type_code => 'S'
79138 , p_flexfield_segment_code => l_adr_flexfield_segment_code
79139 , p_flex_value_set_id => l_adr_flex_value_set_id
79140 , p_adr_code => 'FA_EXPENSE_ACCT'
79142 , p_component_type => l_component_type
79143 , p_component_code => l_component_code
79144 , p_component_type_code => l_component_type_code
79145 , p_component_appl_id => l_component_appl_id
79146 , p_amb_context_code => l_amb_context_code
79147 , p_entity_code => 'TRANSACTIONS'
79148 , p_event_class_code => 'RETIREMENTS'
79149 , p_side => 'NA'
79150 );
79151
79152 END IF;
79153
79154 l_segment := AcctDerRule_160(
79155 p_application_id => p_application_id
79156 , p_ae_header_id => l_ae_header_id
79157 , p_source_5 => p_source_5
79158 , p_source_23 => p_source_23
79159 , x_transaction_coa_id => l_adr_transaction_coa_id
79160 , x_accounting_coa_id => l_adr_accounting_coa_id
79161 , x_flexfield_segment_code => l_adr_flexfield_segment_code
79162 , x_flex_value_set_id => l_adr_flex_value_set_id
79163 , x_value_type_code => l_adr_value_type_code
79164 , x_value_combination_id => l_adr_value_combination_id
79165 , x_value_segment_code => l_adr_value_segment_code
79166 , p_side => 'NA'
79167 , p_override_seg_flag => 'Y'
79168 );
79169
79170 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
79171
79172 xla_ae_lines_pkg.set_segment(
79173 p_to_segment_code => 'GL_ACCOUNT'
79174 , p_segment_value => l_segment
79175 , p_from_segment_code => l_adr_value_segment_code
79176 , p_from_combination_id => l_adr_value_combination_id
79177 , p_value_type_code => l_adr_value_type_code
79178 , p_transaction_coa_id => l_adr_transaction_coa_id
79179 , p_accounting_coa_id => l_adr_accounting_coa_id
79180 , p_flexfield_segment_code => l_adr_flexfield_segment_code
79181 , p_flex_value_set_id => l_adr_flex_value_set_id
79182 , p_adr_code => 'FA_NBV_RETIRED_GAIN_SEGMENT'
79183 , p_adr_type_code => 'S'
79184 , p_component_type => l_component_type
79185 , p_component_code => l_component_code
79186 , p_component_type_code => l_component_type_code
79187 , p_component_appl_id => l_component_appl_id
79188 , p_amb_context_code => l_amb_context_code
79189 , p_entity_code => 'TRANSACTIONS'
79190 , p_event_class_code => 'RETIREMENTS'
79191 , p_side => 'NA'
79192 );
79193
79194 END IF;
79195
79196 --
79197 --
79198 END IF;
79199 --
79200 -- Bug 4922099
79201 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
79202 (NVL(l_enc_upg_option, 'N') = 'O')
79203 ) AND
79204 (l_bflow_method_code = 'PRIOR_ENTRY')
79205 )
79206 THEN
79207 IF
79208 --
79209 1 = 2
79210 --
79211 THEN
79212 xla_accounting_err_pkg.build_message
79213 (p_appli_s_name => 'XLA'
79214 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
79215 ,p_token_1 => 'LINE_NUMBER'
79216 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
79217 ,p_token_2 => 'LINE_TYPE_NAME'
79218 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
79219 l_component_type
79220 ,l_component_code
79221 ,l_component_type_code
79222 ,l_component_appl_id
79223 ,l_amb_context_code
79224 ,l_entity_code
79225 ,l_event_class_code
79226 )
79227 ,p_token_3 => 'OWNER'
79228 ,p_value_3 => xla_lookups_pkg.get_meaning(
79229 p_lookup_type => 'XLA_OWNER_TYPE'
79230 ,p_lookup_code => l_component_type_code
79231 )
79232 ,p_token_4 => 'PRODUCT_NAME'
79233 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
79234 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
79235 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
79239
79236 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
79237 ,p_ae_header_id => NULL
79238 );
79240 IF (C_LEVEL_ERROR>= g_log_level) THEN
79241 trace
79242 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
79243 ,p_level => C_LEVEL_ERROR
79244 ,p_module => l_log_module);
79245 END IF;
79246 END IF;
79247 END IF;
79248 --
79249 --
79250 ------------------------------------------------------------------------------------------------
79251 -- 4219869 Business Flow
79252 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
79253 -- Prior Entry. Currently, the following code is always generated.
79254 ------------------------------------------------------------------------------------------------
79255 XLA_AE_LINES_PKG.ValidateCurrentLine;
79256
79257 ------------------------------------------------------------------------------------
79258 -- 4219869 Business Flow
79259 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
79260 ------------------------------------------------------------------------------------
79261 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
79262
79263 ----------------------------------------------------------------------------------
79264 -- 4219869 Business Flow
79265 -- Update journal entry status -- Need to generate this within IF <condition>
79266 ----------------------------------------------------------------------------------
79267 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
79268 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
79269 ,p_balance_type_code => l_balance_type_code
79270 );
79271
79272 -------------------------------------------------------------------------------------------
79273 -- 4262811 - Generate the Accrual Reversal lines
79274 -------------------------------------------------------------------------------------------
79275 BEGIN
79276 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
79277 (g_array_event(p_event_id).array_value_num('header_index'));
79278 IF l_acc_rev_flag IS NULL THEN
79279 l_acc_rev_flag := 'N';
79280 END IF;
79281 EXCEPTION
79282 WHEN OTHERS THEN
79283 l_acc_rev_flag := 'N';
79284 END;
79285 --
79286 IF (l_acc_rev_flag = 'Y') THEN
79287
79288 -- 4645092 ------------------------------------------------------------------------------
79289 -- To allow MPA report to determine if it should generate report process
79290 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
79291 ------------------------------------------------------------------------------------------
79292
79293 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
79294 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
79295 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
79296 -- call ADRs
79297 -- Bug 4922099
79298 --
79299 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
79300 (NVL(l_actual_upg_option, 'N') = 'O') OR
79301 (NVL(l_enc_upg_option, 'N') = 'O')
79302 )
79303 THEN
79304 NULL;
79305 --
79306 --
79307
79308 l_ccid := AcctDerRule_174(
79309 p_application_id => p_application_id
79310 , p_ae_header_id => l_ae_header_id
79311 , p_source_5 => p_source_5
79312 , p_source_32 => p_source_32
79313 , x_transaction_coa_id => l_adr_transaction_coa_id
79314 , x_accounting_coa_id => l_adr_accounting_coa_id
79315 , x_value_type_code => l_adr_value_type_code
79316 , p_side => 'NA'
79317 );
79318
79319 xla_ae_lines_pkg.set_ccid(
79320 p_code_combination_id => l_ccid
79321 , p_value_type_code => l_adr_value_type_code
79322 , p_transaction_coa_id => l_adr_transaction_coa_id
79323 , p_accounting_coa_id => l_adr_accounting_coa_id
79324 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
79325 , p_adr_type_code => 'S'
79326 , p_component_type => l_component_type
79327 , p_component_code => l_component_code
79328 , p_component_type_code => l_component_type_code
79329 , p_component_appl_id => l_component_appl_id
79330 , p_amb_context_code => l_amb_context_code
79331 , p_side => 'NA'
79332 );
79333
79334
79335 l_segment := AcctDerRule_169(
79336 p_application_id => p_application_id
79337 , p_ae_header_id => l_ae_header_id
79338 , p_source_5 => p_source_5
79339 , p_source_31 => p_source_31
79340 , x_transaction_coa_id => l_adr_transaction_coa_id
79341 , x_accounting_coa_id => l_adr_accounting_coa_id
79342 , x_flexfield_segment_code => l_adr_flexfield_segment_code
79343 , x_flex_value_set_id => l_adr_flex_value_set_id
79344 , x_value_type_code => l_adr_value_type_code
79345 , x_value_combination_id => l_adr_value_combination_id
79349 );
79346 , x_value_segment_code => l_adr_value_segment_code
79347 , p_side => 'NA'
79348 , p_override_seg_flag => 'Y'
79350
79351 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
79352
79353 xla_ae_lines_pkg.set_segment(
79354 p_to_segment_code => 'GL_BALANCING'
79355 , p_segment_value => l_segment
79356 , p_from_segment_code => l_adr_value_segment_code
79357 , p_from_combination_id => l_adr_value_combination_id
79358 , p_value_type_code => l_adr_value_type_code
79359 , p_transaction_coa_id => l_adr_transaction_coa_id
79360 , p_accounting_coa_id => l_adr_accounting_coa_id
79361 , p_flexfield_segment_code => l_adr_flexfield_segment_code
79362 , p_flex_value_set_id => l_adr_flex_value_set_id
79363 , p_adr_code => 'FA_EXPENSE_ACCT'
79364 , p_adr_type_code => 'S'
79365 , p_component_type => l_component_type
79366 , p_component_code => l_component_code
79367 , p_component_type_code => l_component_type_code
79368 , p_component_appl_id => l_component_appl_id
79369 , p_amb_context_code => l_amb_context_code
79370 , p_entity_code => 'TRANSACTIONS'
79371 , p_event_class_code => 'RETIREMENTS'
79372 , p_side => 'NA'
79373 );
79374
79375 END IF;
79376
79377 l_segment := AcctDerRule_160(
79378 p_application_id => p_application_id
79379 , p_ae_header_id => l_ae_header_id
79380 , p_source_5 => p_source_5
79381 , p_source_23 => p_source_23
79382 , x_transaction_coa_id => l_adr_transaction_coa_id
79383 , x_accounting_coa_id => l_adr_accounting_coa_id
79384 , x_flexfield_segment_code => l_adr_flexfield_segment_code
79385 , x_flex_value_set_id => l_adr_flex_value_set_id
79386 , x_value_type_code => l_adr_value_type_code
79387 , x_value_combination_id => l_adr_value_combination_id
79388 , x_value_segment_code => l_adr_value_segment_code
79389 , p_side => 'NA'
79390 , p_override_seg_flag => 'Y'
79391 );
79392
79393 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
79394
79395 xla_ae_lines_pkg.set_segment(
79396 p_to_segment_code => 'GL_ACCOUNT'
79397 , p_segment_value => l_segment
79398 , p_from_segment_code => l_adr_value_segment_code
79399 , p_from_combination_id => l_adr_value_combination_id
79400 , p_value_type_code => l_adr_value_type_code
79401 , p_transaction_coa_id => l_adr_transaction_coa_id
79402 , p_accounting_coa_id => l_adr_accounting_coa_id
79403 , p_flexfield_segment_code => l_adr_flexfield_segment_code
79404 , p_flex_value_set_id => l_adr_flex_value_set_id
79405 , p_adr_code => 'FA_NBV_RETIRED_GAIN_SEGMENT'
79406 , p_adr_type_code => 'S'
79407 , p_component_type => l_component_type
79408 , p_component_code => l_component_code
79409 , p_component_type_code => l_component_type_code
79410 , p_component_appl_id => l_component_appl_id
79411 , p_amb_context_code => l_amb_context_code
79412 , p_entity_code => 'TRANSACTIONS'
79413 , p_event_class_code => 'RETIREMENTS'
79414 , p_side => 'NA'
79415 );
79416
79417 END IF;
79418
79419 --
79420 --
79421 END IF;
79422
79423 --
79424 -- Update the line information that should be overwritten
79425 --
79426 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
79427 p_header_num => 1);
79428 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
79429
79430 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
79431
79432 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
79433 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
79434 END IF;
79435
79436 --
79437 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
79438 --
79439 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
79440 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
79441 ELSE
79442 ---------------------------------------------------------------------------------------------------
79443 -- 4262811a Switch Sign
79444 ---------------------------------------------------------------------------------------------------
79445 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
79446 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
79447 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
79448 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
79452 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
79449 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
79450 -- 5132302
79451 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
79453
79454 END IF;
79455
79456 -- 4955764
79457 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
79458 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
79459
79460
79461 XLA_AE_LINES_PKG.ValidateCurrentLine;
79462 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
79463
79464 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
79465 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
79466 ,p_balance_type_code => l_balance_type_code);
79467
79468 END IF;
79469
79470 -----------------------------------------------------------------------------------------
79471 -- 4262811 Multiperiod Accounting
79472 -----------------------------------------------------------------------------------------
79473 -- No MPA option is assigned.
79474
79475
79476 END IF;
79477 END IF;
79478 --
79479
79480 --
79481 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
79482 trace
79483 (p_msg => 'END of AcctLineType_274'
79484 ,p_level => C_LEVEL_PROCEDURE
79485 ,p_module => l_log_module);
79486 END IF;
79487 --
79488 EXCEPTION
79489 WHEN xla_exceptions_pkg.application_exception THEN
79490 RAISE;
79491 WHEN OTHERS THEN
79492 xla_exceptions_pkg.raise_message
79493 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_274');
79494 END AcctLineType_274;
79495 --
79496
79497 ---------------------------------------
79498 --
79499 -- PRIVATE FUNCTION
79500 -- AcctLineType_275
79501 --
79502 ---------------------------------------
79503 PROCEDURE AcctLineType_275 (
79504 p_application_id IN NUMBER
79505 ,p_event_id IN NUMBER
79506 ,p_calculate_acctd_flag IN VARCHAR2
79507 ,p_calculate_g_l_flag IN VARCHAR2
79508 ,p_actual_flag IN OUT VARCHAR2
79509 ,p_balance_type_code OUT VARCHAR2
79510 ,p_gain_or_loss_ref OUT VARCHAR2
79511
79512 --Period Close Date
79513 , p_source_1 IN DATE
79514 --Generated Code Combination Identifier
79515 , p_source_5 IN NUMBER
79516 --Net Book Value Retired Loss Account
79517 , p_source_24 IN VARCHAR2
79518 --Expense Account Code Combination Identifier
79519 , p_source_31 IN NUMBER
79520 --Default Code Combination Identifier
79521 , p_source_32 IN NUMBER
79522 --Adjustment Type
79523 , p_source_48 IN VARCHAR2
79524 --Transaction Header Identifier
79525 , p_source_49 IN NUMBER
79526 --Adjustment Line Identifier
79527 , p_source_50 IN NUMBER
79528 --Distribution Type Code
79529 , p_source_51 IN VARCHAR2
79530 --Entered Amount
79531 , p_source_52 IN NUMBER
79532 --Currency Code
79533 , p_source_53 IN VARCHAR2
79534 --Gain Loss Amount
79535 , p_source_54 IN NUMBER
79536 )
79537 IS
79538
79539 l_component_type VARCHAR2(80);
79540 l_component_code VARCHAR2(30);
79541 l_component_type_code VARCHAR2(1);
79542 l_component_appl_id INTEGER;
79543 l_amb_context_code VARCHAR2(30);
79544 l_entity_code VARCHAR2(30);
79545 l_event_class_code VARCHAR2(30);
79546 l_ae_header_id NUMBER;
79547 l_event_type_code VARCHAR2(30);
79548 l_line_definition_code VARCHAR2(30);
79549 l_line_definition_owner_code VARCHAR2(1);
79550 --
79551 -- adr variables
79552 l_segment VARCHAR2(30);
79553 l_ccid NUMBER;
79554 l_adr_transaction_coa_id NUMBER;
79555 l_adr_accounting_coa_id NUMBER;
79556 l_adr_flexfield_segment_code VARCHAR2(30);
79557 l_adr_flex_value_set_id NUMBER;
79558 l_adr_value_type_code VARCHAR2(30);
79559 l_adr_value_combination_id NUMBER;
79560 l_adr_value_segment_code VARCHAR2(30);
79561
79562 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
79563 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
79564 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
79565 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
79566
79567 -- 4262811 Variables ------------------------------------------------------------------------------------------
79568 l_entered_amt_idx NUMBER;
79569 l_accted_amt_idx NUMBER;
79570 l_acc_rev_flag VARCHAR2(1);
79571 l_accrual_line_num NUMBER;
79572 l_tmp_amt NUMBER;
79573 l_acc_rev_natural_side_code VARCHAR2(1);
79574
79575 l_num_entries NUMBER;
79576 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
79577 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
79578 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
79579 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
79580 l_recog_line_1 NUMBER;
79581 l_recog_line_2 NUMBER;
79582
79586
79583 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
79584 l_bflow_applied_to_amt NUMBER; -- 5132302
79585 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
79587 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
79588
79589 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
79590 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
79591
79592 ---------------------------------------------------------------------------------------------------------------
79593
79594
79595 --
79596 -- bulk performance
79597 --
79598 l_balance_type_code VARCHAR2(1);
79599 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
79600 l_log_module VARCHAR2(240);
79601
79602 --
79603 -- Upgrade strategy
79604 --
79605 l_actual_upg_option VARCHAR2(1);
79606 l_enc_upg_option VARCHAR2(1);
79607
79608 --
79609 BEGIN
79610 --
79611 IF g_log_enabled THEN
79612 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_275';
79613 END IF;
79614 --
79615 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
79616
79617 trace
79618 (p_msg => 'BEGIN of AcctLineType_275'
79619 ,p_level => C_LEVEL_PROCEDURE
79620 ,p_module => l_log_module);
79621
79622 END IF;
79623 --
79624 l_component_type := 'AMB_JLT';
79625 l_component_code := 'FA_NBV_RETIRED_LOSS';
79626 l_component_type_code := 'S';
79627 l_component_appl_id := 140;
79628 l_amb_context_code := 'DEFAULT';
79629 l_entity_code := 'TRANSACTIONS';
79630 l_event_class_code := 'RETIREMENTS';
79631 l_event_type_code := 'RETIREMENTS';
79632 l_line_definition_owner_code := 'S';
79633 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
79634 --
79635 l_balance_type_code := 'A';
79636 l_segment := NULL;
79637 l_ccid := NULL;
79638 l_adr_transaction_coa_id := NULL;
79639 l_adr_accounting_coa_id := NULL;
79640 l_adr_flexfield_segment_code := NULL;
79641 l_adr_flex_value_set_id := NULL;
79642 l_adr_value_type_code := NULL;
79643 l_adr_value_combination_id := NULL;
79644 l_adr_value_segment_code := NULL;
79645
79646 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
79647 l_bflow_class_code := ''; -- 4219869 Business Flow
79648 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
79649 l_budgetary_control_flag := 'N';
79650
79651 l_bflow_applied_to_amt_idx := NULL; -- 5132302
79652 l_bflow_applied_to_amt := NULL; -- 5132302
79653 l_entered_amt_idx := NULL; -- 4262811
79654 l_accted_amt_idx := NULL; -- 4262811
79655 l_acc_rev_flag := NULL; -- 4262811
79656 l_accrual_line_num := NULL; -- 4262811
79657 l_tmp_amt := NULL; -- 4262811
79658 --
79659
79660 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
79661 l_balance_type_code <> 'B' THEN
79662 IF NVL(p_source_48,'
79663 ') = 'NBV RETIRED' AND
79664 p_source_54 < 0
79665 THEN
79666
79667 --
79668 XLA_AE_LINES_PKG.SetNewLine;
79669
79670 p_balance_type_code := l_balance_type_code;
79671 -- set the flag so later we will know whether the gain loss line needs to be created
79672
79673 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
79674 p_actual_flag :='A';
79675 END IF;
79676
79677 --
79678 -- bulk performance
79679 --
79680 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
79681 p_header_num => 0); -- 4262811
79682 --
79683 -- set accounting line options
79684 --
79685 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
79686 p_natural_side_code => 'D'
79687 , p_gain_or_loss_flag => 'N'
79688 , p_gl_transfer_mode_code => 'S'
79689 , p_acct_entry_type_code => 'A'
79690 , p_switch_side_flag => 'Y'
79691 , p_merge_duplicate_code => 'N'
79692 );
79693 --
79694 l_acc_rev_natural_side_code := 'C'; -- 4262811
79695 --
79696 --
79697 -- set accounting line type info
79698 --
79699 xla_ae_lines_pkg.SetAcctLineType
79700 (p_component_type => l_component_type
79701 ,p_event_type_code => l_event_type_code
79702 ,p_line_definition_owner_code => l_line_definition_owner_code
79703 ,p_line_definition_code => l_line_definition_code
79704 ,p_accounting_line_code => l_component_code
79705 ,p_accounting_line_type_code => l_component_type_code
79706 ,p_accounting_line_appl_id => l_component_appl_id
79707 ,p_amb_context_code => l_amb_context_code
79708 ,p_entity_code => l_entity_code
79709 ,p_event_class_code => l_event_class_code);
79710 --
79711 -- set accounting class
79712 --
79713 xla_ae_lines_pkg.SetAcctClass(
79714 p_accounting_class_code => 'ASSET'
79718 --
79715 , p_ae_header_id => l_ae_header_id
79716 );
79717
79719 -- set rounding class
79720 --
79721 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
79722 'ASSET';
79723
79724 --
79725 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
79726 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
79727 --
79728 -- bulk performance
79729 --
79730 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
79731
79732 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
79733 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
79734
79735 -- 4955764
79736 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
79737 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
79738
79739 -- 4458381 Public Sector Enh
79740
79741 --
79742 -- set accounting attributes for the line type
79743 --
79744 l_entered_amt_idx := 4;
79745 l_accted_amt_idx := 6;
79746 l_bflow_applied_to_amt_idx := NULL; -- 5132302
79747 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
79748 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
79749 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
79750 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
79751 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
79752 l_rec_acct_attrs.array_char_value(3) := p_source_51;
79753 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
79754 l_rec_acct_attrs.array_num_value(4) := p_source_52;
79755 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
79756 l_rec_acct_attrs.array_char_value(5) := p_source_53;
79757 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
79758 l_rec_acct_attrs.array_num_value(6) := p_source_52;
79759
79760 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
79761 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
79762
79763 ---------------------------------------------------------------------------------------------------------------
79764 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
79765 ---------------------------------------------------------------------------------------------------------------
79766 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
79767
79768 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
79769 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
79770
79771 IF xla_accounting_cache_pkg.GetValueChar
79772 (p_source_code => 'LEDGER_CATEGORY_CODE'
79773 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
79774 AND l_bflow_method_code = 'PRIOR_ENTRY'
79775 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
79776 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
79777 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
79778 )
79779 THEN
79780 xla_ae_lines_pkg.BflowUpgEntry
79781 (p_business_method_code => l_bflow_method_code
79782 ,p_business_class_code => l_bflow_class_code
79783 ,p_balance_type => l_balance_type_code);
79784 ELSE
79785 NULL;
79786 -- No business flow processing for business flow method of NONE.
79787 END IF;
79788
79789 --
79790 -- call analytical criteria
79791 --
79792
79793 --
79794 -- call description
79795 --
79796
79797 xla_ae_lines_pkg.SetLineDescription(
79798 p_ae_header_id => l_ae_header_id
79799 ,p_description => Description_80 (
79800 p_application_id => p_application_id
79801 , p_ae_header_id => l_ae_header_id
79802 , p_source_1 => p_source_1
79803 )
79804 );
79805
79806
79807 --
79808 -- call ADRs
79809 -- Bug 4922099
79810 --
79811 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
79812 (NVL(l_actual_upg_option, 'N') = 'O') OR
79813 (NVL(l_enc_upg_option, 'N') = 'O')
79814 )
79815 THEN
79816 NULL;
79817 --
79818 --
79819
79820 l_ccid := AcctDerRule_174(
79821 p_application_id => p_application_id
79822 , p_ae_header_id => l_ae_header_id
79823 , p_source_5 => p_source_5
79824 , p_source_32 => p_source_32
79825 , x_transaction_coa_id => l_adr_transaction_coa_id
79826 , x_accounting_coa_id => l_adr_accounting_coa_id
79827 , x_value_type_code => l_adr_value_type_code
79828 , p_side => 'NA'
79829 );
79830
79831 xla_ae_lines_pkg.set_ccid(
79832 p_code_combination_id => l_ccid
79833 , p_value_type_code => l_adr_value_type_code
79834 , p_transaction_coa_id => l_adr_transaction_coa_id
79838 , p_component_type => l_component_type
79835 , p_accounting_coa_id => l_adr_accounting_coa_id
79836 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
79837 , p_adr_type_code => 'S'
79839 , p_component_code => l_component_code
79840 , p_component_type_code => l_component_type_code
79841 , p_component_appl_id => l_component_appl_id
79842 , p_amb_context_code => l_amb_context_code
79843 , p_side => 'NA'
79844 );
79845
79846
79847 l_segment := AcctDerRule_169(
79848 p_application_id => p_application_id
79849 , p_ae_header_id => l_ae_header_id
79850 , p_source_5 => p_source_5
79851 , p_source_31 => p_source_31
79852 , x_transaction_coa_id => l_adr_transaction_coa_id
79853 , x_accounting_coa_id => l_adr_accounting_coa_id
79854 , x_flexfield_segment_code => l_adr_flexfield_segment_code
79855 , x_flex_value_set_id => l_adr_flex_value_set_id
79856 , x_value_type_code => l_adr_value_type_code
79857 , x_value_combination_id => l_adr_value_combination_id
79858 , x_value_segment_code => l_adr_value_segment_code
79859 , p_side => 'NA'
79860 , p_override_seg_flag => 'Y'
79861 );
79862
79863 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
79864
79865 xla_ae_lines_pkg.set_segment(
79866 p_to_segment_code => 'GL_BALANCING'
79867 , p_segment_value => l_segment
79868 , p_from_segment_code => l_adr_value_segment_code
79869 , p_from_combination_id => l_adr_value_combination_id
79870 , p_value_type_code => l_adr_value_type_code
79871 , p_transaction_coa_id => l_adr_transaction_coa_id
79872 , p_accounting_coa_id => l_adr_accounting_coa_id
79873 , p_flexfield_segment_code => l_adr_flexfield_segment_code
79874 , p_flex_value_set_id => l_adr_flex_value_set_id
79875 , p_adr_code => 'FA_EXPENSE_ACCT'
79876 , p_adr_type_code => 'S'
79877 , p_component_type => l_component_type
79878 , p_component_code => l_component_code
79879 , p_component_type_code => l_component_type_code
79880 , p_component_appl_id => l_component_appl_id
79881 , p_amb_context_code => l_amb_context_code
79882 , p_entity_code => 'TRANSACTIONS'
79883 , p_event_class_code => 'RETIREMENTS'
79884 , p_side => 'NA'
79885 );
79886
79887 END IF;
79888
79889 l_segment := AcctDerRule_161(
79890 p_application_id => p_application_id
79891 , p_ae_header_id => l_ae_header_id
79892 , p_source_5 => p_source_5
79893 , p_source_24 => p_source_24
79894 , x_transaction_coa_id => l_adr_transaction_coa_id
79895 , x_accounting_coa_id => l_adr_accounting_coa_id
79896 , x_flexfield_segment_code => l_adr_flexfield_segment_code
79897 , x_flex_value_set_id => l_adr_flex_value_set_id
79898 , x_value_type_code => l_adr_value_type_code
79899 , x_value_combination_id => l_adr_value_combination_id
79900 , x_value_segment_code => l_adr_value_segment_code
79901 , p_side => 'NA'
79902 , p_override_seg_flag => 'Y'
79903 );
79904
79905 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
79906
79907 xla_ae_lines_pkg.set_segment(
79908 p_to_segment_code => 'GL_ACCOUNT'
79909 , p_segment_value => l_segment
79910 , p_from_segment_code => l_adr_value_segment_code
79911 , p_from_combination_id => l_adr_value_combination_id
79912 , p_value_type_code => l_adr_value_type_code
79913 , p_transaction_coa_id => l_adr_transaction_coa_id
79914 , p_accounting_coa_id => l_adr_accounting_coa_id
79915 , p_flexfield_segment_code => l_adr_flexfield_segment_code
79916 , p_flex_value_set_id => l_adr_flex_value_set_id
79917 , p_adr_code => 'FA_NBV_RETIRED_LOSS_SEGMENT'
79918 , p_adr_type_code => 'S'
79919 , p_component_type => l_component_type
79920 , p_component_code => l_component_code
79921 , p_component_type_code => l_component_type_code
79922 , p_component_appl_id => l_component_appl_id
79923 , p_amb_context_code => l_amb_context_code
79924 , p_entity_code => 'TRANSACTIONS'
79925 , p_event_class_code => 'RETIREMENTS'
79926 , p_side => 'NA'
79927 );
79928
79929 END IF;
79930
79931 --
79932 --
79933 END IF;
79934 --
79935 -- Bug 4922099
79936 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
79937 (NVL(l_enc_upg_option, 'N') = 'O')
79938 ) AND
79939 (l_bflow_method_code = 'PRIOR_ENTRY')
79940 )
79941 THEN
79942 IF
79943 --
79944 1 = 2
79945 --
79946 THEN
79947 xla_accounting_err_pkg.build_message
79948 (p_appli_s_name => 'XLA'
79952 ,p_token_2 => 'LINE_TYPE_NAME'
79949 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
79950 ,p_token_1 => 'LINE_NUMBER'
79951 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
79953 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
79954 l_component_type
79955 ,l_component_code
79956 ,l_component_type_code
79957 ,l_component_appl_id
79958 ,l_amb_context_code
79959 ,l_entity_code
79960 ,l_event_class_code
79961 )
79962 ,p_token_3 => 'OWNER'
79963 ,p_value_3 => xla_lookups_pkg.get_meaning(
79964 p_lookup_type => 'XLA_OWNER_TYPE'
79965 ,p_lookup_code => l_component_type_code
79966 )
79967 ,p_token_4 => 'PRODUCT_NAME'
79968 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
79969 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
79970 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
79971 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
79972 ,p_ae_header_id => NULL
79973 );
79974
79975 IF (C_LEVEL_ERROR>= g_log_level) THEN
79976 trace
79977 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
79978 ,p_level => C_LEVEL_ERROR
79979 ,p_module => l_log_module);
79980 END IF;
79981 END IF;
79982 END IF;
79983 --
79984 --
79985 ------------------------------------------------------------------------------------------------
79986 -- 4219869 Business Flow
79987 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
79988 -- Prior Entry. Currently, the following code is always generated.
79989 ------------------------------------------------------------------------------------------------
79990 XLA_AE_LINES_PKG.ValidateCurrentLine;
79991
79992 ------------------------------------------------------------------------------------
79993 -- 4219869 Business Flow
79994 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
79995 ------------------------------------------------------------------------------------
79996 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
79997
79998 ----------------------------------------------------------------------------------
79999 -- 4219869 Business Flow
80000 -- Update journal entry status -- Need to generate this within IF <condition>
80001 ----------------------------------------------------------------------------------
80002 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
80003 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
80004 ,p_balance_type_code => l_balance_type_code
80005 );
80006
80007 -------------------------------------------------------------------------------------------
80008 -- 4262811 - Generate the Accrual Reversal lines
80009 -------------------------------------------------------------------------------------------
80010 BEGIN
80011 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
80012 (g_array_event(p_event_id).array_value_num('header_index'));
80013 IF l_acc_rev_flag IS NULL THEN
80014 l_acc_rev_flag := 'N';
80015 END IF;
80016 EXCEPTION
80017 WHEN OTHERS THEN
80018 l_acc_rev_flag := 'N';
80019 END;
80020 --
80021 IF (l_acc_rev_flag = 'Y') THEN
80022
80023 -- 4645092 ------------------------------------------------------------------------------
80024 -- To allow MPA report to determine if it should generate report process
80025 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
80026 ------------------------------------------------------------------------------------------
80027
80028 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
80029 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
80030 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
80031 -- call ADRs
80032 -- Bug 4922099
80033 --
80034 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
80035 (NVL(l_actual_upg_option, 'N') = 'O') OR
80036 (NVL(l_enc_upg_option, 'N') = 'O')
80037 )
80038 THEN
80039 NULL;
80040 --
80041 --
80042
80043 l_ccid := AcctDerRule_174(
80047 , p_source_32 => p_source_32
80044 p_application_id => p_application_id
80045 , p_ae_header_id => l_ae_header_id
80046 , p_source_5 => p_source_5
80048 , x_transaction_coa_id => l_adr_transaction_coa_id
80049 , x_accounting_coa_id => l_adr_accounting_coa_id
80050 , x_value_type_code => l_adr_value_type_code
80051 , p_side => 'NA'
80052 );
80053
80054 xla_ae_lines_pkg.set_ccid(
80055 p_code_combination_id => l_ccid
80056 , p_value_type_code => l_adr_value_type_code
80057 , p_transaction_coa_id => l_adr_transaction_coa_id
80058 , p_accounting_coa_id => l_adr_accounting_coa_id
80059 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
80060 , p_adr_type_code => 'S'
80061 , p_component_type => l_component_type
80062 , p_component_code => l_component_code
80063 , p_component_type_code => l_component_type_code
80064 , p_component_appl_id => l_component_appl_id
80065 , p_amb_context_code => l_amb_context_code
80066 , p_side => 'NA'
80067 );
80068
80069
80070 l_segment := AcctDerRule_169(
80071 p_application_id => p_application_id
80072 , p_ae_header_id => l_ae_header_id
80073 , p_source_5 => p_source_5
80074 , p_source_31 => p_source_31
80075 , x_transaction_coa_id => l_adr_transaction_coa_id
80076 , x_accounting_coa_id => l_adr_accounting_coa_id
80077 , x_flexfield_segment_code => l_adr_flexfield_segment_code
80078 , x_flex_value_set_id => l_adr_flex_value_set_id
80079 , x_value_type_code => l_adr_value_type_code
80080 , x_value_combination_id => l_adr_value_combination_id
80081 , x_value_segment_code => l_adr_value_segment_code
80082 , p_side => 'NA'
80083 , p_override_seg_flag => 'Y'
80084 );
80085
80086 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
80087
80088 xla_ae_lines_pkg.set_segment(
80089 p_to_segment_code => 'GL_BALANCING'
80090 , p_segment_value => l_segment
80091 , p_from_segment_code => l_adr_value_segment_code
80092 , p_from_combination_id => l_adr_value_combination_id
80093 , p_value_type_code => l_adr_value_type_code
80094 , p_transaction_coa_id => l_adr_transaction_coa_id
80095 , p_accounting_coa_id => l_adr_accounting_coa_id
80096 , p_flexfield_segment_code => l_adr_flexfield_segment_code
80097 , p_flex_value_set_id => l_adr_flex_value_set_id
80098 , p_adr_code => 'FA_EXPENSE_ACCT'
80099 , p_adr_type_code => 'S'
80100 , p_component_type => l_component_type
80101 , p_component_code => l_component_code
80102 , p_component_type_code => l_component_type_code
80103 , p_component_appl_id => l_component_appl_id
80104 , p_amb_context_code => l_amb_context_code
80105 , p_entity_code => 'TRANSACTIONS'
80106 , p_event_class_code => 'RETIREMENTS'
80107 , p_side => 'NA'
80108 );
80109
80110 END IF;
80111
80112 l_segment := AcctDerRule_161(
80113 p_application_id => p_application_id
80114 , p_ae_header_id => l_ae_header_id
80115 , p_source_5 => p_source_5
80116 , p_source_24 => p_source_24
80117 , x_transaction_coa_id => l_adr_transaction_coa_id
80118 , x_accounting_coa_id => l_adr_accounting_coa_id
80119 , x_flexfield_segment_code => l_adr_flexfield_segment_code
80120 , x_flex_value_set_id => l_adr_flex_value_set_id
80121 , x_value_type_code => l_adr_value_type_code
80122 , x_value_combination_id => l_adr_value_combination_id
80123 , x_value_segment_code => l_adr_value_segment_code
80124 , p_side => 'NA'
80125 , p_override_seg_flag => 'Y'
80126 );
80127
80128 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
80129
80130 xla_ae_lines_pkg.set_segment(
80131 p_to_segment_code => 'GL_ACCOUNT'
80132 , p_segment_value => l_segment
80133 , p_from_segment_code => l_adr_value_segment_code
80134 , p_from_combination_id => l_adr_value_combination_id
80135 , p_value_type_code => l_adr_value_type_code
80136 , p_transaction_coa_id => l_adr_transaction_coa_id
80137 , p_accounting_coa_id => l_adr_accounting_coa_id
80138 , p_flexfield_segment_code => l_adr_flexfield_segment_code
80139 , p_flex_value_set_id => l_adr_flex_value_set_id
80140 , p_adr_code => 'FA_NBV_RETIRED_LOSS_SEGMENT'
80141 , p_adr_type_code => 'S'
80142 , p_component_type => l_component_type
80143 , p_component_code => l_component_code
80144 , p_component_type_code => l_component_type_code
80145 , p_component_appl_id => l_component_appl_id
80146 , p_amb_context_code => l_amb_context_code
80147 , p_entity_code => 'TRANSACTIONS'
80148 , p_event_class_code => 'RETIREMENTS'
80149 , p_side => 'NA'
80153
80150 );
80151
80152 END IF;
80154 --
80155 --
80156 END IF;
80157
80158 --
80159 -- Update the line information that should be overwritten
80160 --
80161 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
80162 p_header_num => 1);
80163 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
80164
80165 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
80166
80167 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
80168 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
80169 END IF;
80170
80171 --
80172 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
80173 --
80174 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
80175 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
80176 ELSE
80177 ---------------------------------------------------------------------------------------------------
80178 -- 4262811a Switch Sign
80179 ---------------------------------------------------------------------------------------------------
80180 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
80181 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
80182 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
80183 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
80184 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
80185 -- 5132302
80186 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
80187 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
80188
80189 END IF;
80190
80191 -- 4955764
80192 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
80193 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
80194
80195
80196 XLA_AE_LINES_PKG.ValidateCurrentLine;
80197 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
80198
80199 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
80200 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
80201 ,p_balance_type_code => l_balance_type_code);
80202
80203 END IF;
80204
80205 -----------------------------------------------------------------------------------------
80206 -- 4262811 Multiperiod Accounting
80207 -----------------------------------------------------------------------------------------
80208 -- No MPA option is assigned.
80209
80210
80211 END IF;
80212 END IF;
80213 --
80214
80215 --
80216 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
80217 trace
80218 (p_msg => 'END of AcctLineType_275'
80219 ,p_level => C_LEVEL_PROCEDURE
80220 ,p_module => l_log_module);
80221 END IF;
80222 --
80223 EXCEPTION
80224 WHEN xla_exceptions_pkg.application_exception THEN
80225 RAISE;
80226 WHEN OTHERS THEN
80227 xla_exceptions_pkg.raise_message
80228 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_275');
80229 END AcctLineType_275;
80230 --
80231
80232 ---------------------------------------
80233 --
80234 -- PRIVATE FUNCTION
80235 -- AcctLineType_276
80236 --
80237 ---------------------------------------
80238 PROCEDURE AcctLineType_276 (
80239 p_application_id IN NUMBER
80240 ,p_event_id IN NUMBER
80241 ,p_calculate_acctd_flag IN VARCHAR2
80242 ,p_calculate_g_l_flag IN VARCHAR2
80243 ,p_actual_flag IN OUT VARCHAR2
80244 ,p_balance_type_code OUT VARCHAR2
80245 ,p_gain_or_loss_ref OUT VARCHAR2
80246
80247 --Period Close Date
80248 , p_source_1 IN DATE
80249 --Generated Code Combination Identifier
80250 , p_source_5 IN NUMBER
80251 --Net Book Value Retired Loss Account
80252 , p_source_24 IN VARCHAR2
80253 --Expense Account Code Combination Identifier
80254 , p_source_31 IN NUMBER
80255 --Default Code Combination Identifier
80256 , p_source_32 IN NUMBER
80257 --Adjustment Type
80258 , p_source_48 IN VARCHAR2
80259 --Transaction Header Identifier
80260 , p_source_49 IN NUMBER
80261 --Adjustment Line Identifier
80262 , p_source_50 IN NUMBER
80263 --Distribution Type Code
80264 , p_source_51 IN VARCHAR2
80265 --Entered Amount
80266 , p_source_52 IN NUMBER
80267 --Currency Code
80268 , p_source_53 IN VARCHAR2
80269 --Gain Loss Amount
80270 , p_source_54 IN NUMBER
80271 )
80272 IS
80273
80274 l_component_type VARCHAR2(80);
80275 l_component_code VARCHAR2(30);
80276 l_component_type_code VARCHAR2(1);
80280 l_event_class_code VARCHAR2(30);
80277 l_component_appl_id INTEGER;
80278 l_amb_context_code VARCHAR2(30);
80279 l_entity_code VARCHAR2(30);
80281 l_ae_header_id NUMBER;
80282 l_event_type_code VARCHAR2(30);
80283 l_line_definition_code VARCHAR2(30);
80284 l_line_definition_owner_code VARCHAR2(1);
80285 --
80286 -- adr variables
80287 l_segment VARCHAR2(30);
80288 l_ccid NUMBER;
80289 l_adr_transaction_coa_id NUMBER;
80290 l_adr_accounting_coa_id NUMBER;
80291 l_adr_flexfield_segment_code VARCHAR2(30);
80292 l_adr_flex_value_set_id NUMBER;
80293 l_adr_value_type_code VARCHAR2(30);
80294 l_adr_value_combination_id NUMBER;
80295 l_adr_value_segment_code VARCHAR2(30);
80296
80297 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
80298 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
80299 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
80300 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
80301
80302 -- 4262811 Variables ------------------------------------------------------------------------------------------
80303 l_entered_amt_idx NUMBER;
80304 l_accted_amt_idx NUMBER;
80305 l_acc_rev_flag VARCHAR2(1);
80306 l_accrual_line_num NUMBER;
80307 l_tmp_amt NUMBER;
80308 l_acc_rev_natural_side_code VARCHAR2(1);
80309
80310 l_num_entries NUMBER;
80311 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
80312 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
80313 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
80314 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
80315 l_recog_line_1 NUMBER;
80316 l_recog_line_2 NUMBER;
80317
80318 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
80319 l_bflow_applied_to_amt NUMBER; -- 5132302
80320 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
80321
80322 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
80323
80324 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
80325 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
80326
80327 ---------------------------------------------------------------------------------------------------------------
80328
80329
80330 --
80331 -- bulk performance
80332 --
80333 l_balance_type_code VARCHAR2(1);
80334 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
80335 l_log_module VARCHAR2(240);
80336
80337 --
80338 -- Upgrade strategy
80339 --
80340 l_actual_upg_option VARCHAR2(1);
80341 l_enc_upg_option VARCHAR2(1);
80342
80343 --
80344 BEGIN
80345 --
80346 IF g_log_enabled THEN
80347 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_276';
80348 END IF;
80349 --
80350 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
80351
80352 trace
80353 (p_msg => 'BEGIN of AcctLineType_276'
80354 ,p_level => C_LEVEL_PROCEDURE
80355 ,p_module => l_log_module);
80356
80357 END IF;
80358 --
80359 l_component_type := 'AMB_JLT';
80360 l_component_code := 'FA_NBV_RETIRED_LOSS';
80361 l_component_type_code := 'S';
80362 l_component_appl_id := 140;
80363 l_amb_context_code := 'DEFAULT';
80364 l_entity_code := 'TRANSACTIONS';
80365 l_event_class_code := 'RETIREMENTS';
80366 l_event_type_code := 'REINSTATEMENTS';
80367 l_line_definition_owner_code := 'S';
80368 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
80369 --
80370 l_balance_type_code := 'A';
80371 l_segment := NULL;
80372 l_ccid := NULL;
80373 l_adr_transaction_coa_id := NULL;
80374 l_adr_accounting_coa_id := NULL;
80375 l_adr_flexfield_segment_code := NULL;
80376 l_adr_flex_value_set_id := NULL;
80377 l_adr_value_type_code := NULL;
80378 l_adr_value_combination_id := NULL;
80379 l_adr_value_segment_code := NULL;
80380
80381 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
80382 l_bflow_class_code := ''; -- 4219869 Business Flow
80383 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
80384 l_budgetary_control_flag := 'N';
80385
80386 l_bflow_applied_to_amt_idx := NULL; -- 5132302
80387 l_bflow_applied_to_amt := NULL; -- 5132302
80388 l_entered_amt_idx := NULL; -- 4262811
80389 l_accted_amt_idx := NULL; -- 4262811
80390 l_acc_rev_flag := NULL; -- 4262811
80391 l_accrual_line_num := NULL; -- 4262811
80392 l_tmp_amt := NULL; -- 4262811
80393 --
80394
80395 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
80396 l_balance_type_code <> 'B' THEN
80397 IF NVL(p_source_48,'
80398 ') = 'NBV RETIRED' AND
80399 p_source_54 < 0
80400 THEN
80401
80402 --
80406 -- set the flag so later we will know whether the gain loss line needs to be created
80403 XLA_AE_LINES_PKG.SetNewLine;
80404
80405 p_balance_type_code := l_balance_type_code;
80407
80408 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
80409 p_actual_flag :='A';
80410 END IF;
80411
80412 --
80413 -- bulk performance
80414 --
80415 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
80416 p_header_num => 0); -- 4262811
80417 --
80418 -- set accounting line options
80419 --
80420 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
80421 p_natural_side_code => 'D'
80422 , p_gain_or_loss_flag => 'N'
80423 , p_gl_transfer_mode_code => 'S'
80424 , p_acct_entry_type_code => 'A'
80425 , p_switch_side_flag => 'Y'
80426 , p_merge_duplicate_code => 'N'
80427 );
80428 --
80429 l_acc_rev_natural_side_code := 'C'; -- 4262811
80430 --
80431 --
80432 -- set accounting line type info
80433 --
80434 xla_ae_lines_pkg.SetAcctLineType
80435 (p_component_type => l_component_type
80436 ,p_event_type_code => l_event_type_code
80437 ,p_line_definition_owner_code => l_line_definition_owner_code
80438 ,p_line_definition_code => l_line_definition_code
80439 ,p_accounting_line_code => l_component_code
80440 ,p_accounting_line_type_code => l_component_type_code
80441 ,p_accounting_line_appl_id => l_component_appl_id
80442 ,p_amb_context_code => l_amb_context_code
80443 ,p_entity_code => l_entity_code
80444 ,p_event_class_code => l_event_class_code);
80445 --
80446 -- set accounting class
80447 --
80448 xla_ae_lines_pkg.SetAcctClass(
80449 p_accounting_class_code => 'ASSET'
80450 , p_ae_header_id => l_ae_header_id
80451 );
80452
80453 --
80454 -- set rounding class
80455 --
80456 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
80457 'ASSET';
80458
80459 --
80460 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
80461 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
80462 --
80463 -- bulk performance
80464 --
80465 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
80466
80467 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
80468 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
80469
80470 -- 4955764
80471 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
80472 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
80473
80474 -- 4458381 Public Sector Enh
80475
80476 --
80477 -- set accounting attributes for the line type
80478 --
80479 l_entered_amt_idx := 4;
80480 l_accted_amt_idx := 6;
80481 l_bflow_applied_to_amt_idx := NULL; -- 5132302
80482 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
80483 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
80484 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
80485 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
80486 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
80487 l_rec_acct_attrs.array_char_value(3) := p_source_51;
80488 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
80489 l_rec_acct_attrs.array_num_value(4) := p_source_52;
80490 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
80491 l_rec_acct_attrs.array_char_value(5) := p_source_53;
80492 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
80493 l_rec_acct_attrs.array_num_value(6) := p_source_52;
80494
80495 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
80496 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
80497
80498 ---------------------------------------------------------------------------------------------------------------
80499 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
80500 ---------------------------------------------------------------------------------------------------------------
80501 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
80502
80503 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
80504 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
80505
80506 IF xla_accounting_cache_pkg.GetValueChar
80507 (p_source_code => 'LEDGER_CATEGORY_CODE'
80508 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
80509 AND l_bflow_method_code = 'PRIOR_ENTRY'
80510 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
80511 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
80512 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
80513 )
80514 THEN
80515 xla_ae_lines_pkg.BflowUpgEntry
80516 (p_business_method_code => l_bflow_method_code
80520 NULL;
80517 ,p_business_class_code => l_bflow_class_code
80518 ,p_balance_type => l_balance_type_code);
80519 ELSE
80521 -- No business flow processing for business flow method of NONE.
80522 END IF;
80523
80524 --
80525 -- call analytical criteria
80526 --
80527
80528 --
80529 -- call description
80530 --
80531
80532 xla_ae_lines_pkg.SetLineDescription(
80533 p_ae_header_id => l_ae_header_id
80534 ,p_description => Description_80 (
80535 p_application_id => p_application_id
80536 , p_ae_header_id => l_ae_header_id
80537 , p_source_1 => p_source_1
80538 )
80539 );
80540
80541
80542 --
80543 -- call ADRs
80544 -- Bug 4922099
80545 --
80546 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
80547 (NVL(l_actual_upg_option, 'N') = 'O') OR
80548 (NVL(l_enc_upg_option, 'N') = 'O')
80549 )
80550 THEN
80551 NULL;
80552 --
80553 --
80554
80555 l_ccid := AcctDerRule_174(
80556 p_application_id => p_application_id
80557 , p_ae_header_id => l_ae_header_id
80558 , p_source_5 => p_source_5
80559 , p_source_32 => p_source_32
80560 , x_transaction_coa_id => l_adr_transaction_coa_id
80561 , x_accounting_coa_id => l_adr_accounting_coa_id
80562 , x_value_type_code => l_adr_value_type_code
80563 , p_side => 'NA'
80564 );
80565
80566 xla_ae_lines_pkg.set_ccid(
80567 p_code_combination_id => l_ccid
80568 , p_value_type_code => l_adr_value_type_code
80569 , p_transaction_coa_id => l_adr_transaction_coa_id
80570 , p_accounting_coa_id => l_adr_accounting_coa_id
80571 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
80572 , p_adr_type_code => 'S'
80573 , p_component_type => l_component_type
80574 , p_component_code => l_component_code
80575 , p_component_type_code => l_component_type_code
80576 , p_component_appl_id => l_component_appl_id
80577 , p_amb_context_code => l_amb_context_code
80578 , p_side => 'NA'
80579 );
80580
80581
80582 l_segment := AcctDerRule_169(
80583 p_application_id => p_application_id
80584 , p_ae_header_id => l_ae_header_id
80585 , p_source_5 => p_source_5
80586 , p_source_31 => p_source_31
80587 , x_transaction_coa_id => l_adr_transaction_coa_id
80588 , x_accounting_coa_id => l_adr_accounting_coa_id
80589 , x_flexfield_segment_code => l_adr_flexfield_segment_code
80590 , x_flex_value_set_id => l_adr_flex_value_set_id
80591 , x_value_type_code => l_adr_value_type_code
80592 , x_value_combination_id => l_adr_value_combination_id
80593 , x_value_segment_code => l_adr_value_segment_code
80594 , p_side => 'NA'
80595 , p_override_seg_flag => 'Y'
80596 );
80597
80598 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
80599
80600 xla_ae_lines_pkg.set_segment(
80601 p_to_segment_code => 'GL_BALANCING'
80602 , p_segment_value => l_segment
80603 , p_from_segment_code => l_adr_value_segment_code
80604 , p_from_combination_id => l_adr_value_combination_id
80605 , p_value_type_code => l_adr_value_type_code
80606 , p_transaction_coa_id => l_adr_transaction_coa_id
80607 , p_accounting_coa_id => l_adr_accounting_coa_id
80608 , p_flexfield_segment_code => l_adr_flexfield_segment_code
80609 , p_flex_value_set_id => l_adr_flex_value_set_id
80610 , p_adr_code => 'FA_EXPENSE_ACCT'
80611 , p_adr_type_code => 'S'
80612 , p_component_type => l_component_type
80613 , p_component_code => l_component_code
80614 , p_component_type_code => l_component_type_code
80615 , p_component_appl_id => l_component_appl_id
80616 , p_amb_context_code => l_amb_context_code
80617 , p_entity_code => 'TRANSACTIONS'
80618 , p_event_class_code => 'RETIREMENTS'
80619 , p_side => 'NA'
80620 );
80621
80622 END IF;
80623
80624 l_segment := AcctDerRule_161(
80625 p_application_id => p_application_id
80626 , p_ae_header_id => l_ae_header_id
80627 , p_source_5 => p_source_5
80628 , p_source_24 => p_source_24
80629 , x_transaction_coa_id => l_adr_transaction_coa_id
80630 , x_accounting_coa_id => l_adr_accounting_coa_id
80631 , x_flexfield_segment_code => l_adr_flexfield_segment_code
80632 , x_flex_value_set_id => l_adr_flex_value_set_id
80633 , x_value_type_code => l_adr_value_type_code
80634 , x_value_combination_id => l_adr_value_combination_id
80635 , x_value_segment_code => l_adr_value_segment_code
80636 , p_side => 'NA'
80637 , p_override_seg_flag => 'Y'
80638 );
80639
80640 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
80641
80642 xla_ae_lines_pkg.set_segment(
80646 , p_from_combination_id => l_adr_value_combination_id
80643 p_to_segment_code => 'GL_ACCOUNT'
80644 , p_segment_value => l_segment
80645 , p_from_segment_code => l_adr_value_segment_code
80647 , p_value_type_code => l_adr_value_type_code
80648 , p_transaction_coa_id => l_adr_transaction_coa_id
80649 , p_accounting_coa_id => l_adr_accounting_coa_id
80650 , p_flexfield_segment_code => l_adr_flexfield_segment_code
80651 , p_flex_value_set_id => l_adr_flex_value_set_id
80652 , p_adr_code => 'FA_NBV_RETIRED_LOSS_SEGMENT'
80653 , p_adr_type_code => 'S'
80654 , p_component_type => l_component_type
80655 , p_component_code => l_component_code
80656 , p_component_type_code => l_component_type_code
80657 , p_component_appl_id => l_component_appl_id
80658 , p_amb_context_code => l_amb_context_code
80659 , p_entity_code => 'TRANSACTIONS'
80660 , p_event_class_code => 'RETIREMENTS'
80661 , p_side => 'NA'
80662 );
80663
80664 END IF;
80665
80666 --
80667 --
80668 END IF;
80669 --
80670 -- Bug 4922099
80671 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
80672 (NVL(l_enc_upg_option, 'N') = 'O')
80673 ) AND
80674 (l_bflow_method_code = 'PRIOR_ENTRY')
80675 )
80676 THEN
80677 IF
80678 --
80679 1 = 2
80680 --
80681 THEN
80682 xla_accounting_err_pkg.build_message
80683 (p_appli_s_name => 'XLA'
80684 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
80685 ,p_token_1 => 'LINE_NUMBER'
80686 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
80687 ,p_token_2 => 'LINE_TYPE_NAME'
80688 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
80689 l_component_type
80690 ,l_component_code
80691 ,l_component_type_code
80692 ,l_component_appl_id
80693 ,l_amb_context_code
80694 ,l_entity_code
80695 ,l_event_class_code
80696 )
80697 ,p_token_3 => 'OWNER'
80698 ,p_value_3 => xla_lookups_pkg.get_meaning(
80699 p_lookup_type => 'XLA_OWNER_TYPE'
80700 ,p_lookup_code => l_component_type_code
80701 )
80702 ,p_token_4 => 'PRODUCT_NAME'
80703 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
80704 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
80705 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
80706 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
80707 ,p_ae_header_id => NULL
80708 );
80709
80710 IF (C_LEVEL_ERROR>= g_log_level) THEN
80711 trace
80712 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
80713 ,p_level => C_LEVEL_ERROR
80714 ,p_module => l_log_module);
80715 END IF;
80716 END IF;
80717 END IF;
80718 --
80719 --
80720 ------------------------------------------------------------------------------------------------
80721 -- 4219869 Business Flow
80722 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
80723 -- Prior Entry. Currently, the following code is always generated.
80724 ------------------------------------------------------------------------------------------------
80725 XLA_AE_LINES_PKG.ValidateCurrentLine;
80726
80727 ------------------------------------------------------------------------------------
80728 -- 4219869 Business Flow
80729 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
80730 ------------------------------------------------------------------------------------
80731 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
80732
80733 ----------------------------------------------------------------------------------
80734 -- 4219869 Business Flow
80735 -- Update journal entry status -- Need to generate this within IF <condition>
80736 ----------------------------------------------------------------------------------
80740 );
80737 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
80738 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
80739 ,p_balance_type_code => l_balance_type_code
80741
80742 -------------------------------------------------------------------------------------------
80743 -- 4262811 - Generate the Accrual Reversal lines
80744 -------------------------------------------------------------------------------------------
80745 BEGIN
80746 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
80747 (g_array_event(p_event_id).array_value_num('header_index'));
80748 IF l_acc_rev_flag IS NULL THEN
80749 l_acc_rev_flag := 'N';
80750 END IF;
80751 EXCEPTION
80752 WHEN OTHERS THEN
80753 l_acc_rev_flag := 'N';
80754 END;
80755 --
80756 IF (l_acc_rev_flag = 'Y') THEN
80757
80758 -- 4645092 ------------------------------------------------------------------------------
80759 -- To allow MPA report to determine if it should generate report process
80760 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
80761 ------------------------------------------------------------------------------------------
80762
80763 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
80764 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
80765 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
80766 -- call ADRs
80767 -- Bug 4922099
80768 --
80769 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
80770 (NVL(l_actual_upg_option, 'N') = 'O') OR
80771 (NVL(l_enc_upg_option, 'N') = 'O')
80772 )
80773 THEN
80774 NULL;
80775 --
80776 --
80777
80778 l_ccid := AcctDerRule_174(
80779 p_application_id => p_application_id
80780 , p_ae_header_id => l_ae_header_id
80781 , p_source_5 => p_source_5
80782 , p_source_32 => p_source_32
80783 , x_transaction_coa_id => l_adr_transaction_coa_id
80784 , x_accounting_coa_id => l_adr_accounting_coa_id
80785 , x_value_type_code => l_adr_value_type_code
80786 , p_side => 'NA'
80787 );
80788
80789 xla_ae_lines_pkg.set_ccid(
80790 p_code_combination_id => l_ccid
80791 , p_value_type_code => l_adr_value_type_code
80792 , p_transaction_coa_id => l_adr_transaction_coa_id
80793 , p_accounting_coa_id => l_adr_accounting_coa_id
80794 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
80795 , p_adr_type_code => 'S'
80796 , p_component_type => l_component_type
80797 , p_component_code => l_component_code
80798 , p_component_type_code => l_component_type_code
80799 , p_component_appl_id => l_component_appl_id
80800 , p_amb_context_code => l_amb_context_code
80801 , p_side => 'NA'
80802 );
80803
80804
80805 l_segment := AcctDerRule_169(
80806 p_application_id => p_application_id
80807 , p_ae_header_id => l_ae_header_id
80808 , p_source_5 => p_source_5
80809 , p_source_31 => p_source_31
80810 , x_transaction_coa_id => l_adr_transaction_coa_id
80811 , x_accounting_coa_id => l_adr_accounting_coa_id
80812 , x_flexfield_segment_code => l_adr_flexfield_segment_code
80813 , x_flex_value_set_id => l_adr_flex_value_set_id
80814 , x_value_type_code => l_adr_value_type_code
80815 , x_value_combination_id => l_adr_value_combination_id
80816 , x_value_segment_code => l_adr_value_segment_code
80817 , p_side => 'NA'
80818 , p_override_seg_flag => 'Y'
80819 );
80820
80821 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
80822
80823 xla_ae_lines_pkg.set_segment(
80824 p_to_segment_code => 'GL_BALANCING'
80825 , p_segment_value => l_segment
80826 , p_from_segment_code => l_adr_value_segment_code
80827 , p_from_combination_id => l_adr_value_combination_id
80828 , p_value_type_code => l_adr_value_type_code
80829 , p_transaction_coa_id => l_adr_transaction_coa_id
80830 , p_accounting_coa_id => l_adr_accounting_coa_id
80831 , p_flexfield_segment_code => l_adr_flexfield_segment_code
80832 , p_flex_value_set_id => l_adr_flex_value_set_id
80833 , p_adr_code => 'FA_EXPENSE_ACCT'
80834 , p_adr_type_code => 'S'
80835 , p_component_type => l_component_type
80836 , p_component_code => l_component_code
80837 , p_component_type_code => l_component_type_code
80838 , p_component_appl_id => l_component_appl_id
80839 , p_amb_context_code => l_amb_context_code
80840 , p_entity_code => 'TRANSACTIONS'
80841 , p_event_class_code => 'RETIREMENTS'
80842 , p_side => 'NA'
80843 );
80844
80845 END IF;
80846
80847 l_segment := AcctDerRule_161(
80848 p_application_id => p_application_id
80849 , p_ae_header_id => l_ae_header_id
80853 , x_accounting_coa_id => l_adr_accounting_coa_id
80850 , p_source_5 => p_source_5
80851 , p_source_24 => p_source_24
80852 , x_transaction_coa_id => l_adr_transaction_coa_id
80854 , x_flexfield_segment_code => l_adr_flexfield_segment_code
80855 , x_flex_value_set_id => l_adr_flex_value_set_id
80856 , x_value_type_code => l_adr_value_type_code
80857 , x_value_combination_id => l_adr_value_combination_id
80858 , x_value_segment_code => l_adr_value_segment_code
80859 , p_side => 'NA'
80860 , p_override_seg_flag => 'Y'
80861 );
80862
80863 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
80864
80865 xla_ae_lines_pkg.set_segment(
80866 p_to_segment_code => 'GL_ACCOUNT'
80867 , p_segment_value => l_segment
80868 , p_from_segment_code => l_adr_value_segment_code
80869 , p_from_combination_id => l_adr_value_combination_id
80870 , p_value_type_code => l_adr_value_type_code
80871 , p_transaction_coa_id => l_adr_transaction_coa_id
80872 , p_accounting_coa_id => l_adr_accounting_coa_id
80873 , p_flexfield_segment_code => l_adr_flexfield_segment_code
80874 , p_flex_value_set_id => l_adr_flex_value_set_id
80875 , p_adr_code => 'FA_NBV_RETIRED_LOSS_SEGMENT'
80876 , p_adr_type_code => 'S'
80877 , p_component_type => l_component_type
80878 , p_component_code => l_component_code
80879 , p_component_type_code => l_component_type_code
80880 , p_component_appl_id => l_component_appl_id
80881 , p_amb_context_code => l_amb_context_code
80882 , p_entity_code => 'TRANSACTIONS'
80883 , p_event_class_code => 'RETIREMENTS'
80884 , p_side => 'NA'
80885 );
80886
80887 END IF;
80888
80889 --
80890 --
80891 END IF;
80892
80893 --
80894 -- Update the line information that should be overwritten
80895 --
80896 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
80897 p_header_num => 1);
80898 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
80899
80900 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
80901
80902 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
80903 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
80904 END IF;
80905
80906 --
80907 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
80908 --
80909 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
80910 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
80911 ELSE
80912 ---------------------------------------------------------------------------------------------------
80913 -- 4262811a Switch Sign
80914 ---------------------------------------------------------------------------------------------------
80915 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
80916 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
80917 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
80918 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
80919 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
80920 -- 5132302
80921 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
80922 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
80923
80924 END IF;
80925
80926 -- 4955764
80927 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
80928 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
80929
80930
80931 XLA_AE_LINES_PKG.ValidateCurrentLine;
80932 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
80933
80934 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
80935 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
80936 ,p_balance_type_code => l_balance_type_code);
80937
80938 END IF;
80939
80940 -----------------------------------------------------------------------------------------
80941 -- 4262811 Multiperiod Accounting
80942 -----------------------------------------------------------------------------------------
80943 -- No MPA option is assigned.
80944
80945
80946 END IF;
80947 END IF;
80948 --
80949
80950 --
80951 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
80952 trace
80953 (p_msg => 'END of AcctLineType_276'
80954 ,p_level => C_LEVEL_PROCEDURE
80955 ,p_module => l_log_module);
80956 END IF;
80957 --
80958 EXCEPTION
80959 WHEN xla_exceptions_pkg.application_exception THEN
80960 RAISE;
80961 WHEN OTHERS THEN
80962 xla_exceptions_pkg.raise_message
80966
80963 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_276');
80964 END AcctLineType_276;
80965 --
80967 ---------------------------------------
80968 --
80969 -- PRIVATE FUNCTION
80970 -- AcctLineType_277
80971 --
80972 ---------------------------------------
80973 PROCEDURE AcctLineType_277 (
80974 p_application_id IN NUMBER
80975 ,p_event_id IN NUMBER
80976 ,p_calculate_acctd_flag IN VARCHAR2
80977 ,p_calculate_g_l_flag IN VARCHAR2
80978 ,p_actual_flag IN OUT VARCHAR2
80979 ,p_balance_type_code OUT VARCHAR2
80980 ,p_gain_or_loss_ref OUT VARCHAR2
80981
80982 --Period Close Date
80983 , p_source_1 IN DATE
80984 --Bonus Depreciation Expense Account
80985 , p_source_4 IN VARCHAR2
80986 --Generated Code Combination Identifier
80987 , p_source_5 IN NUMBER
80988 --Expense Account Code Combination Identifier
80989 , p_source_31 IN NUMBER
80990 --Bonus Generated Code Combination Identifier
80991 , p_source_33 IN NUMBER
80992 --Distribution Type Code
80993 , p_source_51 IN VARCHAR2
80994 --Currency Code
80995 , p_source_53 IN VARCHAR2
80996 --Asset Identifier
80997 , p_source_56 IN NUMBER
80998 --Period Counter
80999 , p_source_57 IN NUMBER
81000 --Distribution Identifier
81001 , p_source_58 IN NUMBER
81002 --Book Type Code
81003 , p_source_59 IN VARCHAR2
81004 --Bonus Entered Amount
81005 , p_source_61 IN NUMBER
81006 --Depreciation Run Identifier
81007 , p_source_62 IN NUMBER
81008 )
81009 IS
81010
81011 l_component_type VARCHAR2(80);
81012 l_component_code VARCHAR2(30);
81013 l_component_type_code VARCHAR2(1);
81014 l_component_appl_id INTEGER;
81015 l_amb_context_code VARCHAR2(30);
81016 l_entity_code VARCHAR2(30);
81017 l_event_class_code VARCHAR2(30);
81018 l_ae_header_id NUMBER;
81019 l_event_type_code VARCHAR2(30);
81020 l_line_definition_code VARCHAR2(30);
81021 l_line_definition_owner_code VARCHAR2(1);
81022 --
81023 -- adr variables
81024 l_segment VARCHAR2(30);
81025 l_ccid NUMBER;
81026 l_adr_transaction_coa_id NUMBER;
81027 l_adr_accounting_coa_id NUMBER;
81028 l_adr_flexfield_segment_code VARCHAR2(30);
81029 l_adr_flex_value_set_id NUMBER;
81030 l_adr_value_type_code VARCHAR2(30);
81031 l_adr_value_combination_id NUMBER;
81032 l_adr_value_segment_code VARCHAR2(30);
81033
81034 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
81035 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
81036 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
81037 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
81038
81039 -- 4262811 Variables ------------------------------------------------------------------------------------------
81040 l_entered_amt_idx NUMBER;
81041 l_accted_amt_idx NUMBER;
81042 l_acc_rev_flag VARCHAR2(1);
81043 l_accrual_line_num NUMBER;
81044 l_tmp_amt NUMBER;
81045 l_acc_rev_natural_side_code VARCHAR2(1);
81046
81047 l_num_entries NUMBER;
81048 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
81049 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
81050 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
81051 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
81052 l_recog_line_1 NUMBER;
81053 l_recog_line_2 NUMBER;
81054
81055 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
81056 l_bflow_applied_to_amt NUMBER; -- 5132302
81057 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
81058
81059 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
81060
81061 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
81062 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
81063
81064 ---------------------------------------------------------------------------------------------------------------
81065
81066
81067 --
81068 -- bulk performance
81069 --
81070 l_balance_type_code VARCHAR2(1);
81071 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
81072 l_log_module VARCHAR2(240);
81073
81074 --
81075 -- Upgrade strategy
81076 --
81077 l_actual_upg_option VARCHAR2(1);
81078 l_enc_upg_option VARCHAR2(1);
81079
81080 --
81081 BEGIN
81082 --
81083 IF g_log_enabled THEN
81084 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_277';
81085 END IF;
81086 --
81087 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
81088
81089 trace
81090 (p_msg => 'BEGIN of AcctLineType_277'
81091 ,p_level => C_LEVEL_PROCEDURE
81092 ,p_module => l_log_module);
81093
81094 END IF;
81095 --
81096 l_component_type := 'AMB_JLT';
81097 l_component_code := 'FA_PER_BONUS_DEPRN_EXP';
81098 l_component_type_code := 'S';
81099 l_component_appl_id := 140;
81103 l_event_type_code := 'DEPRECIATION_ALL';
81100 l_amb_context_code := 'DEFAULT';
81101 l_entity_code := 'DEPRECIATION';
81102 l_event_class_code := 'DEPRECIATION';
81104 l_line_definition_owner_code := 'S';
81105 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEPRE16';
81106 --
81107 l_balance_type_code := 'A';
81108 l_segment := NULL;
81109 l_ccid := NULL;
81110 l_adr_transaction_coa_id := NULL;
81111 l_adr_accounting_coa_id := NULL;
81112 l_adr_flexfield_segment_code := NULL;
81113 l_adr_flex_value_set_id := NULL;
81114 l_adr_value_type_code := NULL;
81115 l_adr_value_combination_id := NULL;
81116 l_adr_value_segment_code := NULL;
81117
81118 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
81119 l_bflow_class_code := ''; -- 4219869 Business Flow
81120 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
81121 l_budgetary_control_flag := 'N';
81122
81123 l_bflow_applied_to_amt_idx := NULL; -- 5132302
81124 l_bflow_applied_to_amt := NULL; -- 5132302
81125 l_entered_amt_idx := NULL; -- 4262811
81126 l_accted_amt_idx := NULL; -- 4262811
81127 l_acc_rev_flag := NULL; -- 4262811
81128 l_accrual_line_num := NULL; -- 4262811
81129 l_tmp_amt := NULL; -- 4262811
81130 --
81131
81132 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
81133 l_balance_type_code <> 'B' THEN
81134 IF NVL(p_source_61,9E125) <> 0 AND
81135 NVL(p_source_51,'
81136 ') = 'DEPRN'
81137 THEN
81138
81139 --
81140 XLA_AE_LINES_PKG.SetNewLine;
81141
81142 p_balance_type_code := l_balance_type_code;
81143 -- set the flag so later we will know whether the gain loss line needs to be created
81144
81145 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
81146 p_actual_flag :='A';
81147 END IF;
81148
81149 --
81150 -- bulk performance
81151 --
81152 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
81153 p_header_num => 0); -- 4262811
81154 --
81155 -- set accounting line options
81156 --
81157 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
81158 p_natural_side_code => 'D'
81159 , p_gain_or_loss_flag => 'N'
81160 , p_gl_transfer_mode_code => 'S'
81161 , p_acct_entry_type_code => 'A'
81162 , p_switch_side_flag => 'Y'
81163 , p_merge_duplicate_code => 'N'
81164 );
81165 --
81166 l_acc_rev_natural_side_code := 'C'; -- 4262811
81167 --
81168 --
81169 -- set accounting line type info
81170 --
81171 xla_ae_lines_pkg.SetAcctLineType
81172 (p_component_type => l_component_type
81173 ,p_event_type_code => l_event_type_code
81174 ,p_line_definition_owner_code => l_line_definition_owner_code
81175 ,p_line_definition_code => l_line_definition_code
81176 ,p_accounting_line_code => l_component_code
81177 ,p_accounting_line_type_code => l_component_type_code
81178 ,p_accounting_line_appl_id => l_component_appl_id
81179 ,p_amb_context_code => l_amb_context_code
81180 ,p_entity_code => l_entity_code
81181 ,p_event_class_code => l_event_class_code);
81182 --
81183 -- set accounting class
81184 --
81185 xla_ae_lines_pkg.SetAcctClass(
81186 p_accounting_class_code => 'EXPENSE'
81187 , p_ae_header_id => l_ae_header_id
81188 );
81189
81190 --
81191 -- set rounding class
81192 --
81193 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
81194 'EXPENSE';
81195
81196 --
81197 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
81198 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
81199 --
81200 -- bulk performance
81201 --
81202 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
81203
81204 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
81205 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
81206
81207 -- 4955764
81208 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
81209 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
81210
81211 -- 4458381 Public Sector Enh
81212
81213 --
81214 -- set accounting attributes for the line type
81215 --
81216 l_entered_amt_idx := 7;
81217 l_accted_amt_idx := 9;
81218 l_bflow_applied_to_amt_idx := NULL; -- 5132302
81219 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
81220 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
81221 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
81222 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
81223 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
81227 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
81224 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
81225 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
81226 l_rec_acct_attrs.array_char_value(4) := p_source_59;
81228 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
81229 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
81230 l_rec_acct_attrs.array_char_value(6) := p_source_51;
81231 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
81232 l_rec_acct_attrs.array_num_value(7) := p_source_61;
81233 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
81234 l_rec_acct_attrs.array_char_value(8) := p_source_53;
81235 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
81236 l_rec_acct_attrs.array_num_value(9) := p_source_61;
81237
81238 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
81239 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
81240
81241 ---------------------------------------------------------------------------------------------------------------
81242 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
81243 ---------------------------------------------------------------------------------------------------------------
81244 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
81245
81246 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
81247 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
81248
81249 IF xla_accounting_cache_pkg.GetValueChar
81250 (p_source_code => 'LEDGER_CATEGORY_CODE'
81251 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
81252 AND l_bflow_method_code = 'PRIOR_ENTRY'
81253 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
81254 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
81255 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
81256 )
81257 THEN
81258 xla_ae_lines_pkg.BflowUpgEntry
81259 (p_business_method_code => l_bflow_method_code
81260 ,p_business_class_code => l_bflow_class_code
81261 ,p_balance_type => l_balance_type_code);
81262 ELSE
81263 NULL;
81264 -- No business flow processing for business flow method of NONE.
81265 END IF;
81266
81267 --
81268 -- call analytical criteria
81269 --
81270
81271 --
81272 -- call description
81273 --
81274
81275 xla_ae_lines_pkg.SetLineDescription(
81276 p_ae_header_id => l_ae_header_id
81277 ,p_description => Description_2 (
81278 p_application_id => p_application_id
81279 , p_ae_header_id => l_ae_header_id
81280 , p_source_1 => p_source_1
81281 )
81282 );
81283
81284
81285 --
81286 -- call ADRs
81287 -- Bug 4922099
81288 --
81289 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
81290 (NVL(l_actual_upg_option, 'N') = 'O') OR
81291 (NVL(l_enc_upg_option, 'N') = 'O')
81292 )
81293 THEN
81294 NULL;
81295 --
81296 --
81297
81298 l_ccid := AcctDerRule_177(
81299 p_application_id => p_application_id
81300 , p_ae_header_id => l_ae_header_id
81301 , p_source_31 => p_source_31
81302 , p_source_33 => p_source_33
81303 , x_transaction_coa_id => l_adr_transaction_coa_id
81304 , x_accounting_coa_id => l_adr_accounting_coa_id
81305 , x_value_type_code => l_adr_value_type_code
81306 , p_side => 'NA'
81307 );
81308
81309 xla_ae_lines_pkg.set_ccid(
81310 p_code_combination_id => l_ccid
81311 , p_value_type_code => l_adr_value_type_code
81312 , p_transaction_coa_id => l_adr_transaction_coa_id
81313 , p_accounting_coa_id => l_adr_accounting_coa_id
81314 , p_adr_code => 'FA_PER_BONUS_DEPRN_EXPENSE'
81315 , p_adr_type_code => 'S'
81316 , p_component_type => l_component_type
81317 , p_component_code => l_component_code
81318 , p_component_type_code => l_component_type_code
81319 , p_component_appl_id => l_component_appl_id
81320 , p_amb_context_code => l_amb_context_code
81321 , p_side => 'NA'
81322 );
81323
81324
81325 l_segment := AcctDerRule_144(
81326 p_application_id => p_application_id
81327 , p_ae_header_id => l_ae_header_id
81328 , p_source_4 => p_source_4
81329 , p_source_5 => p_source_5
81330 , x_transaction_coa_id => l_adr_transaction_coa_id
81331 , x_accounting_coa_id => l_adr_accounting_coa_id
81332 , x_flexfield_segment_code => l_adr_flexfield_segment_code
81333 , x_flex_value_set_id => l_adr_flex_value_set_id
81334 , x_value_type_code => l_adr_value_type_code
81335 , x_value_combination_id => l_adr_value_combination_id
81336 , x_value_segment_code => l_adr_value_segment_code
81337 , p_side => 'NA'
81341 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
81338 , p_override_seg_flag => 'Y'
81339 );
81340
81342
81343 xla_ae_lines_pkg.set_segment(
81344 p_to_segment_code => 'GL_ACCOUNT'
81345 , p_segment_value => l_segment
81346 , p_from_segment_code => l_adr_value_segment_code
81347 , p_from_combination_id => l_adr_value_combination_id
81348 , p_value_type_code => l_adr_value_type_code
81349 , p_transaction_coa_id => l_adr_transaction_coa_id
81350 , p_accounting_coa_id => l_adr_accounting_coa_id
81351 , p_flexfield_segment_code => l_adr_flexfield_segment_code
81352 , p_flex_value_set_id => l_adr_flex_value_set_id
81353 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
81354 , p_adr_type_code => 'S'
81355 , p_component_type => l_component_type
81356 , p_component_code => l_component_code
81357 , p_component_type_code => l_component_type_code
81358 , p_component_appl_id => l_component_appl_id
81359 , p_amb_context_code => l_amb_context_code
81360 , p_entity_code => 'DEPRECIATION'
81361 , p_event_class_code => 'DEPRECIATION'
81362 , p_side => 'NA'
81363 );
81364
81365 END IF;
81366
81367 --
81368 --
81369 END IF;
81370 --
81371 -- Bug 4922099
81372 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
81373 (NVL(l_enc_upg_option, 'N') = 'O')
81374 ) AND
81375 (l_bflow_method_code = 'PRIOR_ENTRY')
81376 )
81377 THEN
81378 IF
81379 --
81380 1 = 2
81381 --
81382 THEN
81383 xla_accounting_err_pkg.build_message
81384 (p_appli_s_name => 'XLA'
81385 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
81386 ,p_token_1 => 'LINE_NUMBER'
81387 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
81388 ,p_token_2 => 'LINE_TYPE_NAME'
81389 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
81390 l_component_type
81391 ,l_component_code
81392 ,l_component_type_code
81393 ,l_component_appl_id
81394 ,l_amb_context_code
81395 ,l_entity_code
81396 ,l_event_class_code
81397 )
81398 ,p_token_3 => 'OWNER'
81399 ,p_value_3 => xla_lookups_pkg.get_meaning(
81400 p_lookup_type => 'XLA_OWNER_TYPE'
81401 ,p_lookup_code => l_component_type_code
81402 )
81403 ,p_token_4 => 'PRODUCT_NAME'
81404 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
81405 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
81406 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
81407 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
81408 ,p_ae_header_id => NULL
81409 );
81410
81411 IF (C_LEVEL_ERROR>= g_log_level) THEN
81412 trace
81413 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
81414 ,p_level => C_LEVEL_ERROR
81415 ,p_module => l_log_module);
81416 END IF;
81417 END IF;
81418 END IF;
81419 --
81420 --
81421 ------------------------------------------------------------------------------------------------
81422 -- 4219869 Business Flow
81423 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
81424 -- Prior Entry. Currently, the following code is always generated.
81425 ------------------------------------------------------------------------------------------------
81426 XLA_AE_LINES_PKG.ValidateCurrentLine;
81427
81428 ------------------------------------------------------------------------------------
81429 -- 4219869 Business Flow
81430 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
81431 ------------------------------------------------------------------------------------
81432 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
81433
81434 ----------------------------------------------------------------------------------
81438 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
81435 -- 4219869 Business Flow
81436 -- Update journal entry status -- Need to generate this within IF <condition>
81437 ----------------------------------------------------------------------------------
81439 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
81440 ,p_balance_type_code => l_balance_type_code
81441 );
81442
81443 -------------------------------------------------------------------------------------------
81444 -- 4262811 - Generate the Accrual Reversal lines
81445 -------------------------------------------------------------------------------------------
81446 BEGIN
81447 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
81448 (g_array_event(p_event_id).array_value_num('header_index'));
81449 IF l_acc_rev_flag IS NULL THEN
81450 l_acc_rev_flag := 'N';
81451 END IF;
81452 EXCEPTION
81453 WHEN OTHERS THEN
81454 l_acc_rev_flag := 'N';
81455 END;
81456 --
81457 IF (l_acc_rev_flag = 'Y') THEN
81458
81459 -- 4645092 ------------------------------------------------------------------------------
81460 -- To allow MPA report to determine if it should generate report process
81461 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
81462 ------------------------------------------------------------------------------------------
81463
81464 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
81465 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
81466 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
81467 -- call ADRs
81468 -- Bug 4922099
81469 --
81470 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
81471 (NVL(l_actual_upg_option, 'N') = 'O') OR
81472 (NVL(l_enc_upg_option, 'N') = 'O')
81473 )
81474 THEN
81475 NULL;
81476 --
81477 --
81478
81479 l_ccid := AcctDerRule_177(
81480 p_application_id => p_application_id
81481 , p_ae_header_id => l_ae_header_id
81482 , p_source_31 => p_source_31
81483 , p_source_33 => p_source_33
81484 , x_transaction_coa_id => l_adr_transaction_coa_id
81485 , x_accounting_coa_id => l_adr_accounting_coa_id
81486 , x_value_type_code => l_adr_value_type_code
81487 , p_side => 'NA'
81488 );
81489
81490 xla_ae_lines_pkg.set_ccid(
81491 p_code_combination_id => l_ccid
81492 , p_value_type_code => l_adr_value_type_code
81493 , p_transaction_coa_id => l_adr_transaction_coa_id
81494 , p_accounting_coa_id => l_adr_accounting_coa_id
81495 , p_adr_code => 'FA_PER_BONUS_DEPRN_EXPENSE'
81496 , p_adr_type_code => 'S'
81497 , p_component_type => l_component_type
81498 , p_component_code => l_component_code
81499 , p_component_type_code => l_component_type_code
81500 , p_component_appl_id => l_component_appl_id
81501 , p_amb_context_code => l_amb_context_code
81502 , p_side => 'NA'
81503 );
81504
81505
81506 l_segment := AcctDerRule_144(
81507 p_application_id => p_application_id
81508 , p_ae_header_id => l_ae_header_id
81509 , p_source_4 => p_source_4
81510 , p_source_5 => p_source_5
81511 , x_transaction_coa_id => l_adr_transaction_coa_id
81512 , x_accounting_coa_id => l_adr_accounting_coa_id
81513 , x_flexfield_segment_code => l_adr_flexfield_segment_code
81514 , x_flex_value_set_id => l_adr_flex_value_set_id
81515 , x_value_type_code => l_adr_value_type_code
81516 , x_value_combination_id => l_adr_value_combination_id
81517 , x_value_segment_code => l_adr_value_segment_code
81518 , p_side => 'NA'
81519 , p_override_seg_flag => 'Y'
81520 );
81521
81522 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
81523
81524 xla_ae_lines_pkg.set_segment(
81525 p_to_segment_code => 'GL_ACCOUNT'
81526 , p_segment_value => l_segment
81527 , p_from_segment_code => l_adr_value_segment_code
81528 , p_from_combination_id => l_adr_value_combination_id
81529 , p_value_type_code => l_adr_value_type_code
81530 , p_transaction_coa_id => l_adr_transaction_coa_id
81531 , p_accounting_coa_id => l_adr_accounting_coa_id
81532 , p_flexfield_segment_code => l_adr_flexfield_segment_code
81533 , p_flex_value_set_id => l_adr_flex_value_set_id
81534 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
81535 , p_adr_type_code => 'S'
81536 , p_component_type => l_component_type
81537 , p_component_code => l_component_code
81538 , p_component_type_code => l_component_type_code
81539 , p_component_appl_id => l_component_appl_id
81540 , p_amb_context_code => l_amb_context_code
81541 , p_entity_code => 'DEPRECIATION'
81542 , p_event_class_code => 'DEPRECIATION'
81543 , p_side => 'NA'
81544 );
81545
81546 END IF;
81547
81548 --
81549 --
81550 END IF;
81551
81552 --
81556 p_header_num => 1);
81553 -- Update the line information that should be overwritten
81554 --
81555 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
81557 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
81558
81559 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
81560
81561 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
81562 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
81563 END IF;
81564
81565 --
81566 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
81567 --
81568 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
81569 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
81570 ELSE
81571 ---------------------------------------------------------------------------------------------------
81572 -- 4262811a Switch Sign
81573 ---------------------------------------------------------------------------------------------------
81574 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
81575 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
81576 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
81577 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
81578 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
81579 -- 5132302
81580 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
81581 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
81582
81583 END IF;
81584
81585 -- 4955764
81586 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
81587 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
81588
81589
81590 XLA_AE_LINES_PKG.ValidateCurrentLine;
81591 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
81592
81593 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
81594 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
81595 ,p_balance_type_code => l_balance_type_code);
81596
81597 END IF;
81598
81599 -----------------------------------------------------------------------------------------
81600 -- 4262811 Multiperiod Accounting
81601 -----------------------------------------------------------------------------------------
81602 -- No MPA option is assigned.
81603
81604
81605 END IF;
81606 END IF;
81607 --
81608
81609 --
81610 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
81611 trace
81612 (p_msg => 'END of AcctLineType_277'
81613 ,p_level => C_LEVEL_PROCEDURE
81614 ,p_module => l_log_module);
81615 END IF;
81616 --
81617 EXCEPTION
81618 WHEN xla_exceptions_pkg.application_exception THEN
81619 RAISE;
81620 WHEN OTHERS THEN
81621 xla_exceptions_pkg.raise_message
81622 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_277');
81623 END AcctLineType_277;
81624 --
81625
81626 ---------------------------------------
81627 --
81628 -- PRIVATE FUNCTION
81629 -- AcctLineType_278
81630 --
81631 ---------------------------------------
81632 PROCEDURE AcctLineType_278 (
81633 p_application_id IN NUMBER
81634 ,p_event_id IN NUMBER
81635 ,p_calculate_acctd_flag IN VARCHAR2
81636 ,p_calculate_g_l_flag IN VARCHAR2
81637 ,p_actual_flag IN OUT VARCHAR2
81638 ,p_balance_type_code OUT VARCHAR2
81639 ,p_gain_or_loss_ref OUT VARCHAR2
81640
81641 --Period Close Date
81642 , p_source_1 IN DATE
81643 --Generated Code Combination Identifier
81644 , p_source_5 IN NUMBER
81645 --Bonus Reserve Account
81646 , p_source_6 IN VARCHAR2
81647 --Expense Account Code Combination Identifier
81648 , p_source_31 IN NUMBER
81649 --Default Code Combination Identifier
81650 , p_source_32 IN NUMBER
81651 --Bonus Generated Offset Code Combination Identifier
81652 , p_source_34 IN NUMBER
81653 --Distribution Type Code
81654 , p_source_51 IN VARCHAR2
81655 --Currency Code
81656 , p_source_53 IN VARCHAR2
81657 --Asset Identifier
81658 , p_source_56 IN NUMBER
81659 --Period Counter
81660 , p_source_57 IN NUMBER
81661 --Distribution Identifier
81662 , p_source_58 IN NUMBER
81663 --Book Type Code
81664 , p_source_59 IN VARCHAR2
81665 --Bonus Entered Amount
81666 , p_source_61 IN NUMBER
81667 --Depreciation Run Identifier
81668 , p_source_62 IN NUMBER
81669 )
81670 IS
81671
81672 l_component_type VARCHAR2(80);
81673 l_component_code VARCHAR2(30);
81674 l_component_type_code VARCHAR2(1);
81675 l_component_appl_id INTEGER;
81676 l_amb_context_code VARCHAR2(30);
81680 l_event_type_code VARCHAR2(30);
81677 l_entity_code VARCHAR2(30);
81678 l_event_class_code VARCHAR2(30);
81679 l_ae_header_id NUMBER;
81681 l_line_definition_code VARCHAR2(30);
81682 l_line_definition_owner_code VARCHAR2(1);
81683 --
81684 -- adr variables
81685 l_segment VARCHAR2(30);
81686 l_ccid NUMBER;
81687 l_adr_transaction_coa_id NUMBER;
81688 l_adr_accounting_coa_id NUMBER;
81689 l_adr_flexfield_segment_code VARCHAR2(30);
81690 l_adr_flex_value_set_id NUMBER;
81691 l_adr_value_type_code VARCHAR2(30);
81692 l_adr_value_combination_id NUMBER;
81693 l_adr_value_segment_code VARCHAR2(30);
81694
81695 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
81696 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
81697 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
81698 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
81699
81700 -- 4262811 Variables ------------------------------------------------------------------------------------------
81701 l_entered_amt_idx NUMBER;
81702 l_accted_amt_idx NUMBER;
81703 l_acc_rev_flag VARCHAR2(1);
81704 l_accrual_line_num NUMBER;
81705 l_tmp_amt NUMBER;
81706 l_acc_rev_natural_side_code VARCHAR2(1);
81707
81708 l_num_entries NUMBER;
81709 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
81710 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
81711 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
81712 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
81713 l_recog_line_1 NUMBER;
81714 l_recog_line_2 NUMBER;
81715
81716 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
81717 l_bflow_applied_to_amt NUMBER; -- 5132302
81718 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
81719
81720 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
81721
81722 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
81723 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
81724
81725 ---------------------------------------------------------------------------------------------------------------
81726
81727
81728 --
81729 -- bulk performance
81730 --
81731 l_balance_type_code VARCHAR2(1);
81732 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
81733 l_log_module VARCHAR2(240);
81734
81735 --
81736 -- Upgrade strategy
81737 --
81738 l_actual_upg_option VARCHAR2(1);
81739 l_enc_upg_option VARCHAR2(1);
81740
81741 --
81742 BEGIN
81743 --
81744 IF g_log_enabled THEN
81745 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_278';
81746 END IF;
81747 --
81748 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
81749
81750 trace
81751 (p_msg => 'BEGIN of AcctLineType_278'
81752 ,p_level => C_LEVEL_PROCEDURE
81753 ,p_module => l_log_module);
81754
81755 END IF;
81756 --
81757 l_component_type := 'AMB_JLT';
81758 l_component_code := 'FA_PER_BONUS_DEPRN_RESERVE';
81759 l_component_type_code := 'S';
81760 l_component_appl_id := 140;
81761 l_amb_context_code := 'DEFAULT';
81762 l_entity_code := 'DEPRECIATION';
81763 l_event_class_code := 'DEPRECIATION';
81764 l_event_type_code := 'DEPRECIATION_ALL';
81765 l_line_definition_owner_code := 'S';
81766 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEPRE16';
81767 --
81768 l_balance_type_code := 'A';
81769 l_segment := NULL;
81770 l_ccid := NULL;
81771 l_adr_transaction_coa_id := NULL;
81772 l_adr_accounting_coa_id := NULL;
81773 l_adr_flexfield_segment_code := NULL;
81774 l_adr_flex_value_set_id := NULL;
81775 l_adr_value_type_code := NULL;
81776 l_adr_value_combination_id := NULL;
81777 l_adr_value_segment_code := NULL;
81778
81779 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
81780 l_bflow_class_code := ''; -- 4219869 Business Flow
81781 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
81782 l_budgetary_control_flag := 'N';
81783
81784 l_bflow_applied_to_amt_idx := NULL; -- 5132302
81785 l_bflow_applied_to_amt := NULL; -- 5132302
81786 l_entered_amt_idx := NULL; -- 4262811
81787 l_accted_amt_idx := NULL; -- 4262811
81788 l_acc_rev_flag := NULL; -- 4262811
81789 l_accrual_line_num := NULL; -- 4262811
81790 l_tmp_amt := NULL; -- 4262811
81791 --
81792
81793 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
81794 l_balance_type_code <> 'B' THEN
81795 IF NVL(p_source_61,9E125) <> 0 AND
81796 NVL(p_source_51,'
81797 ') = 'DEPRN'
81798 THEN
81799
81800 --
81801 XLA_AE_LINES_PKG.SetNewLine;
81802
81803 p_balance_type_code := l_balance_type_code;
81807 p_actual_flag :='A';
81804 -- set the flag so later we will know whether the gain loss line needs to be created
81805
81806 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
81808 END IF;
81809
81810 --
81811 -- bulk performance
81812 --
81813 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
81814 p_header_num => 0); -- 4262811
81815 --
81816 -- set accounting line options
81817 --
81818 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
81819 p_natural_side_code => 'C'
81820 , p_gain_or_loss_flag => 'N'
81821 , p_gl_transfer_mode_code => 'S'
81822 , p_acct_entry_type_code => 'A'
81823 , p_switch_side_flag => 'Y'
81824 , p_merge_duplicate_code => 'N'
81825 );
81826 --
81827 l_acc_rev_natural_side_code := 'D'; -- 4262811
81828 --
81829 --
81830 -- set accounting line type info
81831 --
81832 xla_ae_lines_pkg.SetAcctLineType
81833 (p_component_type => l_component_type
81834 ,p_event_type_code => l_event_type_code
81835 ,p_line_definition_owner_code => l_line_definition_owner_code
81836 ,p_line_definition_code => l_line_definition_code
81837 ,p_accounting_line_code => l_component_code
81838 ,p_accounting_line_type_code => l_component_type_code
81839 ,p_accounting_line_appl_id => l_component_appl_id
81840 ,p_amb_context_code => l_amb_context_code
81841 ,p_entity_code => l_entity_code
81842 ,p_event_class_code => l_event_class_code);
81843 --
81844 -- set accounting class
81845 --
81846 xla_ae_lines_pkg.SetAcctClass(
81847 p_accounting_class_code => 'ASSET'
81848 , p_ae_header_id => l_ae_header_id
81849 );
81850
81851 --
81852 -- set rounding class
81853 --
81854 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
81855 'ASSET';
81856
81857 --
81858 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
81859 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
81860 --
81861 -- bulk performance
81862 --
81863 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
81864
81865 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
81866 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
81867
81868 -- 4955764
81869 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
81870 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
81871
81872 -- 4458381 Public Sector Enh
81873
81874 --
81875 -- set accounting attributes for the line type
81876 --
81877 l_entered_amt_idx := 7;
81878 l_accted_amt_idx := 9;
81879 l_bflow_applied_to_amt_idx := NULL; -- 5132302
81880 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
81881 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
81882 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
81883 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
81884 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
81885 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
81886 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
81887 l_rec_acct_attrs.array_char_value(4) := p_source_59;
81888 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
81889 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
81890 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
81891 l_rec_acct_attrs.array_char_value(6) := p_source_51;
81892 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
81893 l_rec_acct_attrs.array_num_value(7) := p_source_61;
81894 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
81895 l_rec_acct_attrs.array_char_value(8) := p_source_53;
81896 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
81897 l_rec_acct_attrs.array_num_value(9) := p_source_61;
81898
81899 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
81900 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
81901
81902 ---------------------------------------------------------------------------------------------------------------
81903 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
81904 ---------------------------------------------------------------------------------------------------------------
81905 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
81906
81907 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
81908 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
81909
81910 IF xla_accounting_cache_pkg.GetValueChar
81911 (p_source_code => 'LEDGER_CATEGORY_CODE'
81915 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
81912 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
81913 AND l_bflow_method_code = 'PRIOR_ENTRY'
81914 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
81916 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
81917 )
81918 THEN
81919 xla_ae_lines_pkg.BflowUpgEntry
81920 (p_business_method_code => l_bflow_method_code
81921 ,p_business_class_code => l_bflow_class_code
81922 ,p_balance_type => l_balance_type_code);
81923 ELSE
81924 NULL;
81925 -- No business flow processing for business flow method of NONE.
81926 END IF;
81927
81928 --
81929 -- call analytical criteria
81930 --
81931
81932 --
81933 -- call description
81934 --
81935
81936 xla_ae_lines_pkg.SetLineDescription(
81937 p_ae_header_id => l_ae_header_id
81938 ,p_description => Description_3 (
81939 p_application_id => p_application_id
81940 , p_ae_header_id => l_ae_header_id
81941 , p_source_1 => p_source_1
81942 )
81943 );
81944
81945
81946 --
81947 -- call ADRs
81948 -- Bug 4922099
81949 --
81950 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
81951 (NVL(l_actual_upg_option, 'N') = 'O') OR
81952 (NVL(l_enc_upg_option, 'N') = 'O')
81953 )
81954 THEN
81955 NULL;
81956 --
81957 --
81958
81959 l_ccid := AcctDerRule_178(
81960 p_application_id => p_application_id
81961 , p_ae_header_id => l_ae_header_id
81962 , p_source_32 => p_source_32
81963 , p_source_34 => p_source_34
81964 , x_transaction_coa_id => l_adr_transaction_coa_id
81965 , x_accounting_coa_id => l_adr_accounting_coa_id
81966 , x_value_type_code => l_adr_value_type_code
81967 , p_side => 'NA'
81968 );
81969
81970 xla_ae_lines_pkg.set_ccid(
81971 p_code_combination_id => l_ccid
81972 , p_value_type_code => l_adr_value_type_code
81973 , p_transaction_coa_id => l_adr_transaction_coa_id
81974 , p_accounting_coa_id => l_adr_accounting_coa_id
81975 , p_adr_code => 'FA_PER_BONUS_DEPRN_RESERVE'
81976 , p_adr_type_code => 'S'
81977 , p_component_type => l_component_type
81978 , p_component_code => l_component_code
81979 , p_component_type_code => l_component_type_code
81980 , p_component_appl_id => l_component_appl_id
81981 , p_amb_context_code => l_amb_context_code
81982 , p_side => 'NA'
81983 );
81984
81985
81986 l_segment := AcctDerRule_145(
81987 p_application_id => p_application_id
81988 , p_ae_header_id => l_ae_header_id
81989 , p_source_5 => p_source_5
81990 , p_source_6 => p_source_6
81991 , x_transaction_coa_id => l_adr_transaction_coa_id
81992 , x_accounting_coa_id => l_adr_accounting_coa_id
81993 , x_flexfield_segment_code => l_adr_flexfield_segment_code
81994 , x_flex_value_set_id => l_adr_flex_value_set_id
81995 , x_value_type_code => l_adr_value_type_code
81996 , x_value_combination_id => l_adr_value_combination_id
81997 , x_value_segment_code => l_adr_value_segment_code
81998 , p_side => 'NA'
81999 , p_override_seg_flag => 'Y'
82000 );
82001
82002 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
82003
82004 xla_ae_lines_pkg.set_segment(
82005 p_to_segment_code => 'GL_ACCOUNT'
82006 , p_segment_value => l_segment
82007 , p_from_segment_code => l_adr_value_segment_code
82008 , p_from_combination_id => l_adr_value_combination_id
82009 , p_value_type_code => l_adr_value_type_code
82010 , p_transaction_coa_id => l_adr_transaction_coa_id
82011 , p_accounting_coa_id => l_adr_accounting_coa_id
82012 , p_flexfield_segment_code => l_adr_flexfield_segment_code
82013 , p_flex_value_set_id => l_adr_flex_value_set_id
82014 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
82015 , p_adr_type_code => 'S'
82016 , p_component_type => l_component_type
82017 , p_component_code => l_component_code
82018 , p_component_type_code => l_component_type_code
82019 , p_component_appl_id => l_component_appl_id
82020 , p_amb_context_code => l_amb_context_code
82021 , p_entity_code => 'DEPRECIATION'
82022 , p_event_class_code => 'DEPRECIATION'
82023 , p_side => 'NA'
82024 );
82025
82026 END IF;
82027
82028 l_segment := AcctDerRule_169(
82029 p_application_id => p_application_id
82030 , p_ae_header_id => l_ae_header_id
82031 , p_source_5 => p_source_5
82032 , p_source_31 => p_source_31
82033 , x_transaction_coa_id => l_adr_transaction_coa_id
82034 , x_accounting_coa_id => l_adr_accounting_coa_id
82035 , x_flexfield_segment_code => l_adr_flexfield_segment_code
82036 , x_flex_value_set_id => l_adr_flex_value_set_id
82040 , p_side => 'NA'
82037 , x_value_type_code => l_adr_value_type_code
82038 , x_value_combination_id => l_adr_value_combination_id
82039 , x_value_segment_code => l_adr_value_segment_code
82041 , p_override_seg_flag => 'Y'
82042 );
82043
82044 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
82045
82046 xla_ae_lines_pkg.set_segment(
82047 p_to_segment_code => 'GL_BALANCING'
82048 , p_segment_value => l_segment
82049 , p_from_segment_code => l_adr_value_segment_code
82050 , p_from_combination_id => l_adr_value_combination_id
82051 , p_value_type_code => l_adr_value_type_code
82052 , p_transaction_coa_id => l_adr_transaction_coa_id
82053 , p_accounting_coa_id => l_adr_accounting_coa_id
82054 , p_flexfield_segment_code => l_adr_flexfield_segment_code
82055 , p_flex_value_set_id => l_adr_flex_value_set_id
82056 , p_adr_code => 'FA_EXPENSE_ACCT'
82057 , p_adr_type_code => 'S'
82058 , p_component_type => l_component_type
82059 , p_component_code => l_component_code
82060 , p_component_type_code => l_component_type_code
82061 , p_component_appl_id => l_component_appl_id
82062 , p_amb_context_code => l_amb_context_code
82063 , p_entity_code => 'DEPRECIATION'
82064 , p_event_class_code => 'DEPRECIATION'
82065 , p_side => 'NA'
82066 );
82067
82068 END IF;
82069
82070 --
82071 --
82072 END IF;
82073 --
82074 -- Bug 4922099
82075 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
82076 (NVL(l_enc_upg_option, 'N') = 'O')
82077 ) AND
82078 (l_bflow_method_code = 'PRIOR_ENTRY')
82079 )
82080 THEN
82081 IF
82082 --
82083 1 = 2
82084 --
82085 THEN
82086 xla_accounting_err_pkg.build_message
82087 (p_appli_s_name => 'XLA'
82088 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
82089 ,p_token_1 => 'LINE_NUMBER'
82090 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
82091 ,p_token_2 => 'LINE_TYPE_NAME'
82092 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
82093 l_component_type
82094 ,l_component_code
82095 ,l_component_type_code
82096 ,l_component_appl_id
82097 ,l_amb_context_code
82098 ,l_entity_code
82099 ,l_event_class_code
82100 )
82101 ,p_token_3 => 'OWNER'
82102 ,p_value_3 => xla_lookups_pkg.get_meaning(
82103 p_lookup_type => 'XLA_OWNER_TYPE'
82104 ,p_lookup_code => l_component_type_code
82105 )
82106 ,p_token_4 => 'PRODUCT_NAME'
82107 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
82108 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
82109 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
82110 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
82111 ,p_ae_header_id => NULL
82112 );
82113
82114 IF (C_LEVEL_ERROR>= g_log_level) THEN
82115 trace
82116 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
82117 ,p_level => C_LEVEL_ERROR
82118 ,p_module => l_log_module);
82119 END IF;
82120 END IF;
82121 END IF;
82122 --
82123 --
82124 ------------------------------------------------------------------------------------------------
82125 -- 4219869 Business Flow
82126 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
82127 -- Prior Entry. Currently, the following code is always generated.
82128 ------------------------------------------------------------------------------------------------
82129 XLA_AE_LINES_PKG.ValidateCurrentLine;
82130
82131 ------------------------------------------------------------------------------------
82132 -- 4219869 Business Flow
82133 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
82134 ------------------------------------------------------------------------------------
82138 -- 4219869 Business Flow
82135 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
82136
82137 ----------------------------------------------------------------------------------
82139 -- Update journal entry status -- Need to generate this within IF <condition>
82140 ----------------------------------------------------------------------------------
82141 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
82142 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
82143 ,p_balance_type_code => l_balance_type_code
82144 );
82145
82146 -------------------------------------------------------------------------------------------
82147 -- 4262811 - Generate the Accrual Reversal lines
82148 -------------------------------------------------------------------------------------------
82149 BEGIN
82150 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
82151 (g_array_event(p_event_id).array_value_num('header_index'));
82152 IF l_acc_rev_flag IS NULL THEN
82153 l_acc_rev_flag := 'N';
82154 END IF;
82155 EXCEPTION
82156 WHEN OTHERS THEN
82157 l_acc_rev_flag := 'N';
82158 END;
82159 --
82160 IF (l_acc_rev_flag = 'Y') THEN
82161
82162 -- 4645092 ------------------------------------------------------------------------------
82163 -- To allow MPA report to determine if it should generate report process
82164 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
82165 ------------------------------------------------------------------------------------------
82166
82167 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
82168 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
82169 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
82170 -- call ADRs
82171 -- Bug 4922099
82172 --
82173 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
82174 (NVL(l_actual_upg_option, 'N') = 'O') OR
82175 (NVL(l_enc_upg_option, 'N') = 'O')
82176 )
82177 THEN
82178 NULL;
82179 --
82180 --
82181
82182 l_ccid := AcctDerRule_178(
82183 p_application_id => p_application_id
82184 , p_ae_header_id => l_ae_header_id
82185 , p_source_32 => p_source_32
82186 , p_source_34 => p_source_34
82187 , x_transaction_coa_id => l_adr_transaction_coa_id
82188 , x_accounting_coa_id => l_adr_accounting_coa_id
82189 , x_value_type_code => l_adr_value_type_code
82190 , p_side => 'NA'
82191 );
82192
82193 xla_ae_lines_pkg.set_ccid(
82194 p_code_combination_id => l_ccid
82195 , p_value_type_code => l_adr_value_type_code
82196 , p_transaction_coa_id => l_adr_transaction_coa_id
82197 , p_accounting_coa_id => l_adr_accounting_coa_id
82198 , p_adr_code => 'FA_PER_BONUS_DEPRN_RESERVE'
82199 , p_adr_type_code => 'S'
82200 , p_component_type => l_component_type
82201 , p_component_code => l_component_code
82202 , p_component_type_code => l_component_type_code
82203 , p_component_appl_id => l_component_appl_id
82204 , p_amb_context_code => l_amb_context_code
82205 , p_side => 'NA'
82206 );
82207
82208
82209 l_segment := AcctDerRule_145(
82210 p_application_id => p_application_id
82211 , p_ae_header_id => l_ae_header_id
82212 , p_source_5 => p_source_5
82213 , p_source_6 => p_source_6
82214 , x_transaction_coa_id => l_adr_transaction_coa_id
82215 , x_accounting_coa_id => l_adr_accounting_coa_id
82216 , x_flexfield_segment_code => l_adr_flexfield_segment_code
82217 , x_flex_value_set_id => l_adr_flex_value_set_id
82218 , x_value_type_code => l_adr_value_type_code
82219 , x_value_combination_id => l_adr_value_combination_id
82220 , x_value_segment_code => l_adr_value_segment_code
82221 , p_side => 'NA'
82222 , p_override_seg_flag => 'Y'
82223 );
82224
82225 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
82226
82227 xla_ae_lines_pkg.set_segment(
82228 p_to_segment_code => 'GL_ACCOUNT'
82229 , p_segment_value => l_segment
82230 , p_from_segment_code => l_adr_value_segment_code
82231 , p_from_combination_id => l_adr_value_combination_id
82232 , p_value_type_code => l_adr_value_type_code
82233 , p_transaction_coa_id => l_adr_transaction_coa_id
82234 , p_accounting_coa_id => l_adr_accounting_coa_id
82235 , p_flexfield_segment_code => l_adr_flexfield_segment_code
82236 , p_flex_value_set_id => l_adr_flex_value_set_id
82237 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
82238 , p_adr_type_code => 'S'
82239 , p_component_type => l_component_type
82240 , p_component_code => l_component_code
82241 , p_component_type_code => l_component_type_code
82242 , p_component_appl_id => l_component_appl_id
82243 , p_amb_context_code => l_amb_context_code
82244 , p_entity_code => 'DEPRECIATION'
82245 , p_event_class_code => 'DEPRECIATION'
82249 END IF;
82246 , p_side => 'NA'
82247 );
82248
82250
82251 l_segment := AcctDerRule_169(
82252 p_application_id => p_application_id
82253 , p_ae_header_id => l_ae_header_id
82254 , p_source_5 => p_source_5
82255 , p_source_31 => p_source_31
82256 , x_transaction_coa_id => l_adr_transaction_coa_id
82257 , x_accounting_coa_id => l_adr_accounting_coa_id
82258 , x_flexfield_segment_code => l_adr_flexfield_segment_code
82259 , x_flex_value_set_id => l_adr_flex_value_set_id
82260 , x_value_type_code => l_adr_value_type_code
82261 , x_value_combination_id => l_adr_value_combination_id
82262 , x_value_segment_code => l_adr_value_segment_code
82263 , p_side => 'NA'
82264 , p_override_seg_flag => 'Y'
82265 );
82266
82267 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
82268
82269 xla_ae_lines_pkg.set_segment(
82270 p_to_segment_code => 'GL_BALANCING'
82271 , p_segment_value => l_segment
82272 , p_from_segment_code => l_adr_value_segment_code
82273 , p_from_combination_id => l_adr_value_combination_id
82274 , p_value_type_code => l_adr_value_type_code
82275 , p_transaction_coa_id => l_adr_transaction_coa_id
82276 , p_accounting_coa_id => l_adr_accounting_coa_id
82277 , p_flexfield_segment_code => l_adr_flexfield_segment_code
82278 , p_flex_value_set_id => l_adr_flex_value_set_id
82279 , p_adr_code => 'FA_EXPENSE_ACCT'
82280 , p_adr_type_code => 'S'
82281 , p_component_type => l_component_type
82282 , p_component_code => l_component_code
82283 , p_component_type_code => l_component_type_code
82284 , p_component_appl_id => l_component_appl_id
82285 , p_amb_context_code => l_amb_context_code
82286 , p_entity_code => 'DEPRECIATION'
82287 , p_event_class_code => 'DEPRECIATION'
82288 , p_side => 'NA'
82289 );
82290
82291 END IF;
82292
82293 --
82294 --
82295 END IF;
82296
82297 --
82298 -- Update the line information that should be overwritten
82299 --
82300 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
82301 p_header_num => 1);
82302 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
82303
82304 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
82305
82306 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
82307 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
82308 END IF;
82309
82310 --
82311 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
82312 --
82313 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
82314 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
82315 ELSE
82316 ---------------------------------------------------------------------------------------------------
82317 -- 4262811a Switch Sign
82318 ---------------------------------------------------------------------------------------------------
82319 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
82320 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
82321 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
82322 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
82323 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
82324 -- 5132302
82325 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
82326 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
82327
82328 END IF;
82329
82330 -- 4955764
82331 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
82332 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
82333
82334
82335 XLA_AE_LINES_PKG.ValidateCurrentLine;
82336 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
82337
82338 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
82339 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
82340 ,p_balance_type_code => l_balance_type_code);
82341
82342 END IF;
82343
82344 -----------------------------------------------------------------------------------------
82345 -- 4262811 Multiperiod Accounting
82346 -----------------------------------------------------------------------------------------
82347 -- No MPA option is assigned.
82348
82349
82350 END IF;
82351 END IF;
82352 --
82353
82354 --
82355 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
82359 ,p_module => l_log_module);
82356 trace
82357 (p_msg => 'END of AcctLineType_278'
82358 ,p_level => C_LEVEL_PROCEDURE
82360 END IF;
82361 --
82362 EXCEPTION
82363 WHEN xla_exceptions_pkg.application_exception THEN
82364 RAISE;
82365 WHEN OTHERS THEN
82366 xla_exceptions_pkg.raise_message
82367 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_278');
82368 END AcctLineType_278;
82369 --
82370
82371 ---------------------------------------
82372 --
82373 -- PRIVATE FUNCTION
82374 -- AcctLineType_279
82375 --
82376 ---------------------------------------
82377 PROCEDURE AcctLineType_279 (
82378 p_application_id IN NUMBER
82379 ,p_event_id IN NUMBER
82380 ,p_calculate_acctd_flag IN VARCHAR2
82381 ,p_calculate_g_l_flag IN VARCHAR2
82382 ,p_actual_flag IN OUT VARCHAR2
82383 ,p_balance_type_code OUT VARCHAR2
82384 ,p_gain_or_loss_ref OUT VARCHAR2
82385
82386 --Period Close Date
82387 , p_source_1 IN DATE
82388 --Generated Code Combination Identifier
82389 , p_source_5 IN NUMBER
82390 --Expense Account Code Combination Identifier
82391 , p_source_31 IN NUMBER
82392 --Distribution Type Code
82393 , p_source_51 IN VARCHAR2
82394 --Entered Amount
82395 , p_source_52 IN NUMBER
82396 --Currency Code
82397 , p_source_53 IN VARCHAR2
82398 --Asset Identifier
82399 , p_source_56 IN NUMBER
82400 --Period Counter
82401 , p_source_57 IN NUMBER
82402 --Distribution Identifier
82403 , p_source_58 IN NUMBER
82404 --Book Type Code
82405 , p_source_59 IN VARCHAR2
82406 --Depreciation Run Identifier
82407 , p_source_62 IN NUMBER
82408 )
82409 IS
82410
82411 l_component_type VARCHAR2(80);
82412 l_component_code VARCHAR2(30);
82413 l_component_type_code VARCHAR2(1);
82414 l_component_appl_id INTEGER;
82415 l_amb_context_code VARCHAR2(30);
82416 l_entity_code VARCHAR2(30);
82417 l_event_class_code VARCHAR2(30);
82418 l_ae_header_id NUMBER;
82419 l_event_type_code VARCHAR2(30);
82420 l_line_definition_code VARCHAR2(30);
82421 l_line_definition_owner_code VARCHAR2(1);
82422 --
82423 -- adr variables
82424 l_segment VARCHAR2(30);
82425 l_ccid NUMBER;
82426 l_adr_transaction_coa_id NUMBER;
82427 l_adr_accounting_coa_id NUMBER;
82428 l_adr_flexfield_segment_code VARCHAR2(30);
82429 l_adr_flex_value_set_id NUMBER;
82430 l_adr_value_type_code VARCHAR2(30);
82431 l_adr_value_combination_id NUMBER;
82432 l_adr_value_segment_code VARCHAR2(30);
82433
82434 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
82435 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
82436 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
82437 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
82438
82439 -- 4262811 Variables ------------------------------------------------------------------------------------------
82440 l_entered_amt_idx NUMBER;
82441 l_accted_amt_idx NUMBER;
82442 l_acc_rev_flag VARCHAR2(1);
82443 l_accrual_line_num NUMBER;
82444 l_tmp_amt NUMBER;
82445 l_acc_rev_natural_side_code VARCHAR2(1);
82446
82447 l_num_entries NUMBER;
82448 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
82449 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
82450 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
82451 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
82452 l_recog_line_1 NUMBER;
82453 l_recog_line_2 NUMBER;
82454
82455 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
82456 l_bflow_applied_to_amt NUMBER; -- 5132302
82457 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
82458
82459 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
82460
82461 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
82462 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
82463
82464 ---------------------------------------------------------------------------------------------------------------
82465
82466
82467 --
82468 -- bulk performance
82469 --
82470 l_balance_type_code VARCHAR2(1);
82471 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
82472 l_log_module VARCHAR2(240);
82473
82474 --
82475 -- Upgrade strategy
82476 --
82477 l_actual_upg_option VARCHAR2(1);
82478 l_enc_upg_option VARCHAR2(1);
82479
82480 --
82481 BEGIN
82482 --
82483 IF g_log_enabled THEN
82484 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_279';
82485 END IF;
82486 --
82487 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
82488
82489 trace
82490 (p_msg => 'BEGIN of AcctLineType_279'
82491 ,p_level => C_LEVEL_PROCEDURE
82495 --
82492 ,p_module => l_log_module);
82493
82494 END IF;
82496 l_component_type := 'AMB_JLT';
82497 l_component_code := 'FA_PER_DEPRN_EXP';
82498 l_component_type_code := 'S';
82499 l_component_appl_id := 140;
82500 l_amb_context_code := 'DEFAULT';
82501 l_entity_code := 'DEPRECIATION';
82502 l_event_class_code := 'DEPRECIATION';
82503 l_event_type_code := 'DEPRECIATION_ALL';
82504 l_line_definition_owner_code := 'S';
82505 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEPRE16';
82506 --
82507 l_balance_type_code := 'A';
82508 l_segment := NULL;
82509 l_ccid := NULL;
82510 l_adr_transaction_coa_id := NULL;
82511 l_adr_accounting_coa_id := NULL;
82512 l_adr_flexfield_segment_code := NULL;
82513 l_adr_flex_value_set_id := NULL;
82514 l_adr_value_type_code := NULL;
82515 l_adr_value_combination_id := NULL;
82516 l_adr_value_segment_code := NULL;
82517
82518 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
82519 l_bflow_class_code := ''; -- 4219869 Business Flow
82520 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
82521 l_budgetary_control_flag := 'N';
82522
82523 l_bflow_applied_to_amt_idx := NULL; -- 5132302
82524 l_bflow_applied_to_amt := NULL; -- 5132302
82525 l_entered_amt_idx := NULL; -- 4262811
82526 l_accted_amt_idx := NULL; -- 4262811
82527 l_acc_rev_flag := NULL; -- 4262811
82528 l_accrual_line_num := NULL; -- 4262811
82529 l_tmp_amt := NULL; -- 4262811
82530 --
82531
82532 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
82533 l_balance_type_code <> 'B' THEN
82534 IF NVL(p_source_52,9E125) <> 0 AND
82535 NVL(p_source_51,'
82536 ') = 'DEPRN'
82537 THEN
82538
82539 --
82540 XLA_AE_LINES_PKG.SetNewLine;
82541
82542 p_balance_type_code := l_balance_type_code;
82543 -- set the flag so later we will know whether the gain loss line needs to be created
82544
82545 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
82546 p_actual_flag :='A';
82547 END IF;
82548
82549 --
82550 -- bulk performance
82551 --
82552 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
82553 p_header_num => 0); -- 4262811
82554 --
82555 -- set accounting line options
82556 --
82557 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
82558 p_natural_side_code => 'D'
82559 , p_gain_or_loss_flag => 'N'
82560 , p_gl_transfer_mode_code => 'S'
82561 , p_acct_entry_type_code => 'A'
82562 , p_switch_side_flag => 'Y'
82563 , p_merge_duplicate_code => 'N'
82564 );
82565 --
82566 l_acc_rev_natural_side_code := 'C'; -- 4262811
82567 --
82568 --
82569 -- set accounting line type info
82570 --
82571 xla_ae_lines_pkg.SetAcctLineType
82572 (p_component_type => l_component_type
82573 ,p_event_type_code => l_event_type_code
82574 ,p_line_definition_owner_code => l_line_definition_owner_code
82575 ,p_line_definition_code => l_line_definition_code
82576 ,p_accounting_line_code => l_component_code
82577 ,p_accounting_line_type_code => l_component_type_code
82578 ,p_accounting_line_appl_id => l_component_appl_id
82579 ,p_amb_context_code => l_amb_context_code
82580 ,p_entity_code => l_entity_code
82581 ,p_event_class_code => l_event_class_code);
82582 --
82583 -- set accounting class
82584 --
82585 xla_ae_lines_pkg.SetAcctClass(
82586 p_accounting_class_code => 'EXPENSE'
82587 , p_ae_header_id => l_ae_header_id
82588 );
82589
82590 --
82591 -- set rounding class
82592 --
82593 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
82594 'EXPENSE';
82595
82596 --
82597 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
82598 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
82599 --
82600 -- bulk performance
82601 --
82602 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
82603
82604 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
82605 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
82606
82607 -- 4955764
82608 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
82609 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
82610
82611 -- 4458381 Public Sector Enh
82612
82613 --
82614 -- set accounting attributes for the line type
82615 --
82616 l_entered_amt_idx := 7;
82617 l_accted_amt_idx := 9;
82618 l_bflow_applied_to_amt_idx := NULL; -- 5132302
82619 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
82620 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
82624 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
82621 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
82622 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
82623 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
82625 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
82626 l_rec_acct_attrs.array_char_value(4) := p_source_59;
82627 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
82628 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
82629 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
82630 l_rec_acct_attrs.array_char_value(6) := p_source_51;
82631 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
82632 l_rec_acct_attrs.array_num_value(7) := p_source_52;
82633 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
82634 l_rec_acct_attrs.array_char_value(8) := p_source_53;
82635 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
82636 l_rec_acct_attrs.array_num_value(9) := p_source_52;
82637
82638 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
82639 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
82640
82641 ---------------------------------------------------------------------------------------------------------------
82642 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
82643 ---------------------------------------------------------------------------------------------------------------
82644 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
82645
82646 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
82647 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
82648
82649 IF xla_accounting_cache_pkg.GetValueChar
82650 (p_source_code => 'LEDGER_CATEGORY_CODE'
82651 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
82652 AND l_bflow_method_code = 'PRIOR_ENTRY'
82653 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
82654 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
82655 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
82656 )
82657 THEN
82658 xla_ae_lines_pkg.BflowUpgEntry
82659 (p_business_method_code => l_bflow_method_code
82660 ,p_business_class_code => l_bflow_class_code
82661 ,p_balance_type => l_balance_type_code);
82662 ELSE
82663 NULL;
82664 -- No business flow processing for business flow method of NONE.
82665 END IF;
82666
82667 --
82668 -- call analytical criteria
82669 --
82670
82671 --
82672 -- call description
82673 --
82674
82675 xla_ae_lines_pkg.SetLineDescription(
82676 p_ae_header_id => l_ae_header_id
82677 ,p_description => Description_57 (
82678 p_application_id => p_application_id
82679 , p_ae_header_id => l_ae_header_id
82680 , p_source_1 => p_source_1
82681 )
82682 );
82683
82684
82685 --
82686 -- call ADRs
82687 -- Bug 4922099
82688 --
82689 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
82690 (NVL(l_actual_upg_option, 'N') = 'O') OR
82691 (NVL(l_enc_upg_option, 'N') = 'O')
82692 )
82693 THEN
82694 NULL;
82695 --
82696 --
82697
82698 l_ccid := AcctDerRule_176(
82699 p_application_id => p_application_id
82700 , p_ae_header_id => l_ae_header_id
82701 , p_source_5 => p_source_5
82702 , p_source_31 => p_source_31
82703 , x_transaction_coa_id => l_adr_transaction_coa_id
82704 , x_accounting_coa_id => l_adr_accounting_coa_id
82705 , x_value_type_code => l_adr_value_type_code
82706 , p_side => 'NA'
82707 );
82708
82709 xla_ae_lines_pkg.set_ccid(
82710 p_code_combination_id => l_ccid
82711 , p_value_type_code => l_adr_value_type_code
82712 , p_transaction_coa_id => l_adr_transaction_coa_id
82713 , p_accounting_coa_id => l_adr_accounting_coa_id
82714 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
82715 , p_adr_type_code => 'S'
82716 , p_component_type => l_component_type
82717 , p_component_code => l_component_code
82718 , p_component_type_code => l_component_type_code
82719 , p_component_appl_id => l_component_appl_id
82720 , p_amb_context_code => l_amb_context_code
82721 , p_side => 'NA'
82722 );
82723
82724
82725 --
82726 --
82727 END IF;
82728 --
82729 -- Bug 4922099
82730 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
82731 (NVL(l_enc_upg_option, 'N') = 'O')
82732 ) AND
82733 (l_bflow_method_code = 'PRIOR_ENTRY')
82734 )
82735 THEN
82736 IF
82737 --
82738 1 = 2
82739 --
82740 THEN
82741 xla_accounting_err_pkg.build_message
82742 (p_appli_s_name => 'XLA'
82743 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
82747 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
82744 ,p_token_1 => 'LINE_NUMBER'
82745 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
82746 ,p_token_2 => 'LINE_TYPE_NAME'
82748 l_component_type
82749 ,l_component_code
82750 ,l_component_type_code
82751 ,l_component_appl_id
82752 ,l_amb_context_code
82753 ,l_entity_code
82754 ,l_event_class_code
82755 )
82756 ,p_token_3 => 'OWNER'
82757 ,p_value_3 => xla_lookups_pkg.get_meaning(
82758 p_lookup_type => 'XLA_OWNER_TYPE'
82759 ,p_lookup_code => l_component_type_code
82760 )
82761 ,p_token_4 => 'PRODUCT_NAME'
82762 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
82763 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
82764 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
82765 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
82766 ,p_ae_header_id => NULL
82767 );
82768
82769 IF (C_LEVEL_ERROR>= g_log_level) THEN
82770 trace
82771 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
82772 ,p_level => C_LEVEL_ERROR
82773 ,p_module => l_log_module);
82774 END IF;
82775 END IF;
82776 END IF;
82777 --
82778 --
82779 ------------------------------------------------------------------------------------------------
82780 -- 4219869 Business Flow
82781 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
82782 -- Prior Entry. Currently, the following code is always generated.
82783 ------------------------------------------------------------------------------------------------
82784 XLA_AE_LINES_PKG.ValidateCurrentLine;
82785
82786 ------------------------------------------------------------------------------------
82787 -- 4219869 Business Flow
82788 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
82789 ------------------------------------------------------------------------------------
82790 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
82791
82792 ----------------------------------------------------------------------------------
82793 -- 4219869 Business Flow
82794 -- Update journal entry status -- Need to generate this within IF <condition>
82795 ----------------------------------------------------------------------------------
82796 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
82797 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
82798 ,p_balance_type_code => l_balance_type_code
82799 );
82800
82801 -------------------------------------------------------------------------------------------
82802 -- 4262811 - Generate the Accrual Reversal lines
82803 -------------------------------------------------------------------------------------------
82804 BEGIN
82805 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
82806 (g_array_event(p_event_id).array_value_num('header_index'));
82807 IF l_acc_rev_flag IS NULL THEN
82808 l_acc_rev_flag := 'N';
82809 END IF;
82810 EXCEPTION
82811 WHEN OTHERS THEN
82812 l_acc_rev_flag := 'N';
82813 END;
82814 --
82815 IF (l_acc_rev_flag = 'Y') THEN
82816
82817 -- 4645092 ------------------------------------------------------------------------------
82818 -- To allow MPA report to determine if it should generate report process
82819 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
82820 ------------------------------------------------------------------------------------------
82821
82822 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
82823 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
82824 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
82825 -- call ADRs
82826 -- Bug 4922099
82827 --
82828 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
82829 (NVL(l_actual_upg_option, 'N') = 'O') OR
82830 (NVL(l_enc_upg_option, 'N') = 'O')
82831 )
82832 THEN
82833 NULL;
82834 --
82835 --
82836
82837 l_ccid := AcctDerRule_176(
82841 , p_source_31 => p_source_31
82838 p_application_id => p_application_id
82839 , p_ae_header_id => l_ae_header_id
82840 , p_source_5 => p_source_5
82842 , x_transaction_coa_id => l_adr_transaction_coa_id
82843 , x_accounting_coa_id => l_adr_accounting_coa_id
82844 , x_value_type_code => l_adr_value_type_code
82845 , p_side => 'NA'
82846 );
82847
82848 xla_ae_lines_pkg.set_ccid(
82849 p_code_combination_id => l_ccid
82850 , p_value_type_code => l_adr_value_type_code
82851 , p_transaction_coa_id => l_adr_transaction_coa_id
82852 , p_accounting_coa_id => l_adr_accounting_coa_id
82853 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
82854 , p_adr_type_code => 'S'
82855 , p_component_type => l_component_type
82856 , p_component_code => l_component_code
82857 , p_component_type_code => l_component_type_code
82858 , p_component_appl_id => l_component_appl_id
82859 , p_amb_context_code => l_amb_context_code
82860 , p_side => 'NA'
82861 );
82862
82863
82864 --
82865 --
82866 END IF;
82867
82868 --
82869 -- Update the line information that should be overwritten
82870 --
82871 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
82872 p_header_num => 1);
82873 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
82874
82875 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
82876
82877 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
82878 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
82879 END IF;
82880
82881 --
82882 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
82883 --
82884 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
82885 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
82886 ELSE
82887 ---------------------------------------------------------------------------------------------------
82888 -- 4262811a Switch Sign
82889 ---------------------------------------------------------------------------------------------------
82890 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
82891 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
82892 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
82893 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
82894 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
82895 -- 5132302
82896 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
82897 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
82898
82899 END IF;
82900
82901 -- 4955764
82902 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
82903 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
82904
82905
82906 XLA_AE_LINES_PKG.ValidateCurrentLine;
82907 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
82908
82909 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
82910 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
82911 ,p_balance_type_code => l_balance_type_code);
82912
82913 END IF;
82914
82915 -----------------------------------------------------------------------------------------
82916 -- 4262811 Multiperiod Accounting
82917 -----------------------------------------------------------------------------------------
82918 -- No MPA option is assigned.
82919
82920
82921 END IF;
82922 END IF;
82923 --
82924
82925 --
82926 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
82927 trace
82928 (p_msg => 'END of AcctLineType_279'
82929 ,p_level => C_LEVEL_PROCEDURE
82930 ,p_module => l_log_module);
82931 END IF;
82932 --
82933 EXCEPTION
82934 WHEN xla_exceptions_pkg.application_exception THEN
82935 RAISE;
82936 WHEN OTHERS THEN
82937 xla_exceptions_pkg.raise_message
82938 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_279');
82939 END AcctLineType_279;
82940 --
82941
82942 ---------------------------------------
82943 --
82944 -- PRIVATE FUNCTION
82945 -- AcctLineType_280
82946 --
82947 ---------------------------------------
82948 PROCEDURE AcctLineType_280 (
82949 p_application_id IN NUMBER
82950 ,p_event_id IN NUMBER
82951 ,p_calculate_acctd_flag IN VARCHAR2
82952 ,p_calculate_g_l_flag IN VARCHAR2
82953 ,p_actual_flag IN OUT VARCHAR2
82954 ,p_balance_type_code OUT VARCHAR2
82955 ,p_gain_or_loss_ref OUT VARCHAR2
82959 --Generated Code Combination Identifier
82956
82957 --Period Close Date
82958 , p_source_1 IN DATE
82960 , p_source_5 IN NUMBER
82961 --Depreciation Reserve Account
82962 , p_source_12 IN VARCHAR2
82963 --Generated Offset Code Combination Identifier
82964 , p_source_19 IN NUMBER
82965 --Expense Account Code Combination Identifier
82966 , p_source_31 IN NUMBER
82967 --Default Code Combination Identifier
82968 , p_source_32 IN NUMBER
82969 --Distribution Type Code
82970 , p_source_51 IN VARCHAR2
82971 --Entered Amount
82972 , p_source_52 IN NUMBER
82973 --Currency Code
82974 , p_source_53 IN VARCHAR2
82975 --Asset Identifier
82976 , p_source_56 IN NUMBER
82977 --Period Counter
82978 , p_source_57 IN NUMBER
82979 --Distribution Identifier
82980 , p_source_58 IN NUMBER
82981 --Book Type Code
82982 , p_source_59 IN VARCHAR2
82983 --Depreciation Run Identifier
82984 , p_source_62 IN NUMBER
82985 )
82986 IS
82987
82988 l_component_type VARCHAR2(80);
82989 l_component_code VARCHAR2(30);
82990 l_component_type_code VARCHAR2(1);
82991 l_component_appl_id INTEGER;
82992 l_amb_context_code VARCHAR2(30);
82993 l_entity_code VARCHAR2(30);
82994 l_event_class_code VARCHAR2(30);
82995 l_ae_header_id NUMBER;
82996 l_event_type_code VARCHAR2(30);
82997 l_line_definition_code VARCHAR2(30);
82998 l_line_definition_owner_code VARCHAR2(1);
82999 --
83000 -- adr variables
83001 l_segment VARCHAR2(30);
83002 l_ccid NUMBER;
83003 l_adr_transaction_coa_id NUMBER;
83004 l_adr_accounting_coa_id NUMBER;
83005 l_adr_flexfield_segment_code VARCHAR2(30);
83006 l_adr_flex_value_set_id NUMBER;
83007 l_adr_value_type_code VARCHAR2(30);
83008 l_adr_value_combination_id NUMBER;
83009 l_adr_value_segment_code VARCHAR2(30);
83010
83011 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
83012 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
83013 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
83014 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
83015
83016 -- 4262811 Variables ------------------------------------------------------------------------------------------
83017 l_entered_amt_idx NUMBER;
83018 l_accted_amt_idx NUMBER;
83019 l_acc_rev_flag VARCHAR2(1);
83020 l_accrual_line_num NUMBER;
83021 l_tmp_amt NUMBER;
83022 l_acc_rev_natural_side_code VARCHAR2(1);
83023
83024 l_num_entries NUMBER;
83025 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
83026 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
83027 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
83028 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
83029 l_recog_line_1 NUMBER;
83030 l_recog_line_2 NUMBER;
83031
83032 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
83033 l_bflow_applied_to_amt NUMBER; -- 5132302
83034 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
83035
83036 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
83037
83038 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
83039 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
83040
83041 ---------------------------------------------------------------------------------------------------------------
83042
83043
83044 --
83045 -- bulk performance
83046 --
83047 l_balance_type_code VARCHAR2(1);
83048 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
83049 l_log_module VARCHAR2(240);
83050
83051 --
83052 -- Upgrade strategy
83053 --
83054 l_actual_upg_option VARCHAR2(1);
83055 l_enc_upg_option VARCHAR2(1);
83056
83057 --
83058 BEGIN
83059 --
83060 IF g_log_enabled THEN
83061 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_280';
83062 END IF;
83063 --
83064 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
83065
83066 trace
83067 (p_msg => 'BEGIN of AcctLineType_280'
83068 ,p_level => C_LEVEL_PROCEDURE
83069 ,p_module => l_log_module);
83070
83071 END IF;
83072 --
83073 l_component_type := 'AMB_JLT';
83074 l_component_code := 'FA_PER_DEPRN_RESERVE';
83075 l_component_type_code := 'S';
83076 l_component_appl_id := 140;
83077 l_amb_context_code := 'DEFAULT';
83078 l_entity_code := 'DEPRECIATION';
83079 l_event_class_code := 'DEPRECIATION';
83080 l_event_type_code := 'DEPRECIATION_ALL';
83081 l_line_definition_owner_code := 'S';
83082 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEPRE16';
83083 --
83084 l_balance_type_code := 'A';
83085 l_segment := NULL;
83086 l_ccid := NULL;
83090 l_adr_flex_value_set_id := NULL;
83087 l_adr_transaction_coa_id := NULL;
83088 l_adr_accounting_coa_id := NULL;
83089 l_adr_flexfield_segment_code := NULL;
83091 l_adr_value_type_code := NULL;
83092 l_adr_value_combination_id := NULL;
83093 l_adr_value_segment_code := NULL;
83094
83095 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
83096 l_bflow_class_code := ''; -- 4219869 Business Flow
83097 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
83098 l_budgetary_control_flag := 'N';
83099
83100 l_bflow_applied_to_amt_idx := NULL; -- 5132302
83101 l_bflow_applied_to_amt := NULL; -- 5132302
83102 l_entered_amt_idx := NULL; -- 4262811
83103 l_accted_amt_idx := NULL; -- 4262811
83104 l_acc_rev_flag := NULL; -- 4262811
83105 l_accrual_line_num := NULL; -- 4262811
83106 l_tmp_amt := NULL; -- 4262811
83107 --
83108
83109 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
83110 l_balance_type_code <> 'B' THEN
83111 IF NVL(p_source_52,9E125) <> 0 AND
83112 NVL(p_source_51,'
83113 ') = 'DEPRN'
83114 THEN
83115
83116 --
83117 XLA_AE_LINES_PKG.SetNewLine;
83118
83119 p_balance_type_code := l_balance_type_code;
83120 -- set the flag so later we will know whether the gain loss line needs to be created
83121
83122 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
83123 p_actual_flag :='A';
83124 END IF;
83125
83126 --
83127 -- bulk performance
83128 --
83129 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
83130 p_header_num => 0); -- 4262811
83131 --
83132 -- set accounting line options
83133 --
83134 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
83135 p_natural_side_code => 'C'
83136 , p_gain_or_loss_flag => 'N'
83137 , p_gl_transfer_mode_code => 'S'
83138 , p_acct_entry_type_code => 'A'
83139 , p_switch_side_flag => 'Y'
83140 , p_merge_duplicate_code => 'N'
83141 );
83142 --
83143 l_acc_rev_natural_side_code := 'D'; -- 4262811
83144 --
83145 --
83146 -- set accounting line type info
83147 --
83148 xla_ae_lines_pkg.SetAcctLineType
83149 (p_component_type => l_component_type
83150 ,p_event_type_code => l_event_type_code
83151 ,p_line_definition_owner_code => l_line_definition_owner_code
83152 ,p_line_definition_code => l_line_definition_code
83153 ,p_accounting_line_code => l_component_code
83154 ,p_accounting_line_type_code => l_component_type_code
83155 ,p_accounting_line_appl_id => l_component_appl_id
83156 ,p_amb_context_code => l_amb_context_code
83157 ,p_entity_code => l_entity_code
83158 ,p_event_class_code => l_event_class_code);
83159 --
83160 -- set accounting class
83161 --
83162 xla_ae_lines_pkg.SetAcctClass(
83163 p_accounting_class_code => 'ASSET'
83164 , p_ae_header_id => l_ae_header_id
83165 );
83166
83167 --
83168 -- set rounding class
83169 --
83170 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
83171 'ASSET';
83172
83173 --
83174 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
83175 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
83176 --
83177 -- bulk performance
83178 --
83179 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
83180
83181 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
83182 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
83183
83184 -- 4955764
83185 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
83186 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
83187
83188 -- 4458381 Public Sector Enh
83189
83190 --
83191 -- set accounting attributes for the line type
83192 --
83193 l_entered_amt_idx := 7;
83194 l_accted_amt_idx := 9;
83195 l_bflow_applied_to_amt_idx := NULL; -- 5132302
83196 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
83197 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
83198 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
83199 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
83200 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
83201 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
83202 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
83203 l_rec_acct_attrs.array_char_value(4) := p_source_59;
83204 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
83205 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
83206 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
83207 l_rec_acct_attrs.array_char_value(6) := p_source_51;
83208 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
83212 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
83209 l_rec_acct_attrs.array_num_value(7) := p_source_52;
83210 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
83211 l_rec_acct_attrs.array_char_value(8) := p_source_53;
83213 l_rec_acct_attrs.array_num_value(9) := p_source_52;
83214
83215 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
83216 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
83217
83218 ---------------------------------------------------------------------------------------------------------------
83219 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
83220 ---------------------------------------------------------------------------------------------------------------
83221 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
83222
83223 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
83224 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
83225
83226 IF xla_accounting_cache_pkg.GetValueChar
83227 (p_source_code => 'LEDGER_CATEGORY_CODE'
83228 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
83229 AND l_bflow_method_code = 'PRIOR_ENTRY'
83230 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
83231 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
83232 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
83233 )
83234 THEN
83235 xla_ae_lines_pkg.BflowUpgEntry
83236 (p_business_method_code => l_bflow_method_code
83237 ,p_business_class_code => l_bflow_class_code
83238 ,p_balance_type => l_balance_type_code);
83239 ELSE
83240 NULL;
83241 -- No business flow processing for business flow method of NONE.
83242 END IF;
83243
83244 --
83245 -- call analytical criteria
83246 --
83247
83248 --
83249 -- call description
83250 --
83251
83252 xla_ae_lines_pkg.SetLineDescription(
83253 p_ae_header_id => l_ae_header_id
83254 ,p_description => Description_59 (
83255 p_application_id => p_application_id
83256 , p_ae_header_id => l_ae_header_id
83257 , p_source_1 => p_source_1
83258 )
83259 );
83260
83261
83262 --
83263 -- call ADRs
83264 -- Bug 4922099
83265 --
83266 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
83267 (NVL(l_actual_upg_option, 'N') = 'O') OR
83268 (NVL(l_enc_upg_option, 'N') = 'O')
83269 )
83270 THEN
83271 NULL;
83272 --
83273 --
83274
83275 l_ccid := AcctDerRule_175(
83276 p_application_id => p_application_id
83277 , p_ae_header_id => l_ae_header_id
83278 , p_source_5 => p_source_5
83279 , p_source_19 => p_source_19
83280 , p_source_32 => p_source_32
83281 , x_transaction_coa_id => l_adr_transaction_coa_id
83282 , x_accounting_coa_id => l_adr_accounting_coa_id
83283 , x_value_type_code => l_adr_value_type_code
83284 , p_side => 'NA'
83285 );
83286
83287 xla_ae_lines_pkg.set_ccid(
83288 p_code_combination_id => l_ccid
83289 , p_value_type_code => l_adr_value_type_code
83290 , p_transaction_coa_id => l_adr_transaction_coa_id
83291 , p_accounting_coa_id => l_adr_accounting_coa_id
83292 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
83293 , p_adr_type_code => 'S'
83294 , p_component_type => l_component_type
83295 , p_component_code => l_component_code
83296 , p_component_type_code => l_component_type_code
83297 , p_component_appl_id => l_component_appl_id
83298 , p_amb_context_code => l_amb_context_code
83299 , p_side => 'NA'
83300 );
83301
83302
83303 l_segment := AcctDerRule_150(
83304 p_application_id => p_application_id
83305 , p_ae_header_id => l_ae_header_id
83306 , p_source_5 => p_source_5
83307 , p_source_12 => p_source_12
83308 , x_transaction_coa_id => l_adr_transaction_coa_id
83309 , x_accounting_coa_id => l_adr_accounting_coa_id
83310 , x_flexfield_segment_code => l_adr_flexfield_segment_code
83311 , x_flex_value_set_id => l_adr_flex_value_set_id
83312 , x_value_type_code => l_adr_value_type_code
83313 , x_value_combination_id => l_adr_value_combination_id
83314 , x_value_segment_code => l_adr_value_segment_code
83315 , p_side => 'NA'
83316 , p_override_seg_flag => 'Y'
83317 );
83318
83319 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
83320
83321 xla_ae_lines_pkg.set_segment(
83322 p_to_segment_code => 'GL_ACCOUNT'
83323 , p_segment_value => l_segment
83324 , p_from_segment_code => l_adr_value_segment_code
83325 , p_from_combination_id => l_adr_value_combination_id
83326 , p_value_type_code => l_adr_value_type_code
83330 , p_flex_value_set_id => l_adr_flex_value_set_id
83327 , p_transaction_coa_id => l_adr_transaction_coa_id
83328 , p_accounting_coa_id => l_adr_accounting_coa_id
83329 , p_flexfield_segment_code => l_adr_flexfield_segment_code
83331 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
83332 , p_adr_type_code => 'S'
83333 , p_component_type => l_component_type
83334 , p_component_code => l_component_code
83335 , p_component_type_code => l_component_type_code
83336 , p_component_appl_id => l_component_appl_id
83337 , p_amb_context_code => l_amb_context_code
83338 , p_entity_code => 'DEPRECIATION'
83339 , p_event_class_code => 'DEPRECIATION'
83340 , p_side => 'NA'
83341 );
83342
83343 END IF;
83344
83345 l_segment := AcctDerRule_169(
83346 p_application_id => p_application_id
83347 , p_ae_header_id => l_ae_header_id
83348 , p_source_5 => p_source_5
83349 , p_source_31 => p_source_31
83350 , x_transaction_coa_id => l_adr_transaction_coa_id
83351 , x_accounting_coa_id => l_adr_accounting_coa_id
83352 , x_flexfield_segment_code => l_adr_flexfield_segment_code
83353 , x_flex_value_set_id => l_adr_flex_value_set_id
83354 , x_value_type_code => l_adr_value_type_code
83355 , x_value_combination_id => l_adr_value_combination_id
83356 , x_value_segment_code => l_adr_value_segment_code
83357 , p_side => 'NA'
83358 , p_override_seg_flag => 'Y'
83359 );
83360
83361 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
83362
83363 xla_ae_lines_pkg.set_segment(
83364 p_to_segment_code => 'GL_BALANCING'
83365 , p_segment_value => l_segment
83366 , p_from_segment_code => l_adr_value_segment_code
83367 , p_from_combination_id => l_adr_value_combination_id
83368 , p_value_type_code => l_adr_value_type_code
83369 , p_transaction_coa_id => l_adr_transaction_coa_id
83370 , p_accounting_coa_id => l_adr_accounting_coa_id
83371 , p_flexfield_segment_code => l_adr_flexfield_segment_code
83372 , p_flex_value_set_id => l_adr_flex_value_set_id
83373 , p_adr_code => 'FA_EXPENSE_ACCT'
83374 , p_adr_type_code => 'S'
83375 , p_component_type => l_component_type
83376 , p_component_code => l_component_code
83377 , p_component_type_code => l_component_type_code
83378 , p_component_appl_id => l_component_appl_id
83379 , p_amb_context_code => l_amb_context_code
83380 , p_entity_code => 'DEPRECIATION'
83381 , p_event_class_code => 'DEPRECIATION'
83382 , p_side => 'NA'
83383 );
83384
83385 END IF;
83386
83387 --
83388 --
83389 END IF;
83390 --
83391 -- Bug 4922099
83392 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
83393 (NVL(l_enc_upg_option, 'N') = 'O')
83394 ) AND
83395 (l_bflow_method_code = 'PRIOR_ENTRY')
83396 )
83397 THEN
83398 IF
83399 --
83400 1 = 2
83401 --
83402 THEN
83403 xla_accounting_err_pkg.build_message
83404 (p_appli_s_name => 'XLA'
83405 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
83406 ,p_token_1 => 'LINE_NUMBER'
83407 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
83408 ,p_token_2 => 'LINE_TYPE_NAME'
83409 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
83410 l_component_type
83411 ,l_component_code
83412 ,l_component_type_code
83413 ,l_component_appl_id
83414 ,l_amb_context_code
83415 ,l_entity_code
83416 ,l_event_class_code
83417 )
83418 ,p_token_3 => 'OWNER'
83419 ,p_value_3 => xla_lookups_pkg.get_meaning(
83420 p_lookup_type => 'XLA_OWNER_TYPE'
83421 ,p_lookup_code => l_component_type_code
83422 )
83423 ,p_token_4 => 'PRODUCT_NAME'
83424 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
83428 ,p_ae_header_id => NULL
83425 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
83426 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
83427 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
83429 );
83430
83431 IF (C_LEVEL_ERROR>= g_log_level) THEN
83432 trace
83433 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
83434 ,p_level => C_LEVEL_ERROR
83435 ,p_module => l_log_module);
83436 END IF;
83437 END IF;
83438 END IF;
83439 --
83440 --
83441 ------------------------------------------------------------------------------------------------
83442 -- 4219869 Business Flow
83443 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
83444 -- Prior Entry. Currently, the following code is always generated.
83445 ------------------------------------------------------------------------------------------------
83446 XLA_AE_LINES_PKG.ValidateCurrentLine;
83447
83448 ------------------------------------------------------------------------------------
83449 -- 4219869 Business Flow
83450 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
83451 ------------------------------------------------------------------------------------
83452 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
83453
83454 ----------------------------------------------------------------------------------
83455 -- 4219869 Business Flow
83456 -- Update journal entry status -- Need to generate this within IF <condition>
83457 ----------------------------------------------------------------------------------
83458 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
83459 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
83460 ,p_balance_type_code => l_balance_type_code
83461 );
83462
83463 -------------------------------------------------------------------------------------------
83464 -- 4262811 - Generate the Accrual Reversal lines
83465 -------------------------------------------------------------------------------------------
83466 BEGIN
83467 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
83468 (g_array_event(p_event_id).array_value_num('header_index'));
83469 IF l_acc_rev_flag IS NULL THEN
83470 l_acc_rev_flag := 'N';
83471 END IF;
83472 EXCEPTION
83473 WHEN OTHERS THEN
83474 l_acc_rev_flag := 'N';
83475 END;
83476 --
83477 IF (l_acc_rev_flag = 'Y') THEN
83478
83479 -- 4645092 ------------------------------------------------------------------------------
83480 -- To allow MPA report to determine if it should generate report process
83481 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
83482 ------------------------------------------------------------------------------------------
83483
83484 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
83485 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
83486 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
83487 -- call ADRs
83488 -- Bug 4922099
83489 --
83490 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
83491 (NVL(l_actual_upg_option, 'N') = 'O') OR
83492 (NVL(l_enc_upg_option, 'N') = 'O')
83493 )
83494 THEN
83495 NULL;
83496 --
83497 --
83498
83499 l_ccid := AcctDerRule_175(
83500 p_application_id => p_application_id
83501 , p_ae_header_id => l_ae_header_id
83502 , p_source_5 => p_source_5
83503 , p_source_19 => p_source_19
83504 , p_source_32 => p_source_32
83505 , x_transaction_coa_id => l_adr_transaction_coa_id
83506 , x_accounting_coa_id => l_adr_accounting_coa_id
83507 , x_value_type_code => l_adr_value_type_code
83508 , p_side => 'NA'
83509 );
83510
83511 xla_ae_lines_pkg.set_ccid(
83512 p_code_combination_id => l_ccid
83513 , p_value_type_code => l_adr_value_type_code
83514 , p_transaction_coa_id => l_adr_transaction_coa_id
83515 , p_accounting_coa_id => l_adr_accounting_coa_id
83516 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
83517 , p_adr_type_code => 'S'
83518 , p_component_type => l_component_type
83519 , p_component_code => l_component_code
83520 , p_component_type_code => l_component_type_code
83521 , p_component_appl_id => l_component_appl_id
83522 , p_amb_context_code => l_amb_context_code
83523 , p_side => 'NA'
83524 );
83525
83526
83527 l_segment := AcctDerRule_150(
83528 p_application_id => p_application_id
83529 , p_ae_header_id => l_ae_header_id
83530 , p_source_5 => p_source_5
83531 , p_source_12 => p_source_12
83532 , x_transaction_coa_id => l_adr_transaction_coa_id
83533 , x_accounting_coa_id => l_adr_accounting_coa_id
83537 , x_value_combination_id => l_adr_value_combination_id
83534 , x_flexfield_segment_code => l_adr_flexfield_segment_code
83535 , x_flex_value_set_id => l_adr_flex_value_set_id
83536 , x_value_type_code => l_adr_value_type_code
83538 , x_value_segment_code => l_adr_value_segment_code
83539 , p_side => 'NA'
83540 , p_override_seg_flag => 'Y'
83541 );
83542
83543 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
83544
83545 xla_ae_lines_pkg.set_segment(
83546 p_to_segment_code => 'GL_ACCOUNT'
83547 , p_segment_value => l_segment
83548 , p_from_segment_code => l_adr_value_segment_code
83549 , p_from_combination_id => l_adr_value_combination_id
83550 , p_value_type_code => l_adr_value_type_code
83551 , p_transaction_coa_id => l_adr_transaction_coa_id
83552 , p_accounting_coa_id => l_adr_accounting_coa_id
83553 , p_flexfield_segment_code => l_adr_flexfield_segment_code
83554 , p_flex_value_set_id => l_adr_flex_value_set_id
83555 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
83556 , p_adr_type_code => 'S'
83557 , p_component_type => l_component_type
83558 , p_component_code => l_component_code
83559 , p_component_type_code => l_component_type_code
83560 , p_component_appl_id => l_component_appl_id
83561 , p_amb_context_code => l_amb_context_code
83562 , p_entity_code => 'DEPRECIATION'
83563 , p_event_class_code => 'DEPRECIATION'
83564 , p_side => 'NA'
83565 );
83566
83567 END IF;
83568
83569 l_segment := AcctDerRule_169(
83570 p_application_id => p_application_id
83571 , p_ae_header_id => l_ae_header_id
83572 , p_source_5 => p_source_5
83573 , p_source_31 => p_source_31
83574 , x_transaction_coa_id => l_adr_transaction_coa_id
83575 , x_accounting_coa_id => l_adr_accounting_coa_id
83576 , x_flexfield_segment_code => l_adr_flexfield_segment_code
83577 , x_flex_value_set_id => l_adr_flex_value_set_id
83578 , x_value_type_code => l_adr_value_type_code
83579 , x_value_combination_id => l_adr_value_combination_id
83580 , x_value_segment_code => l_adr_value_segment_code
83581 , p_side => 'NA'
83582 , p_override_seg_flag => 'Y'
83583 );
83584
83585 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
83586
83587 xla_ae_lines_pkg.set_segment(
83588 p_to_segment_code => 'GL_BALANCING'
83589 , p_segment_value => l_segment
83590 , p_from_segment_code => l_adr_value_segment_code
83591 , p_from_combination_id => l_adr_value_combination_id
83592 , p_value_type_code => l_adr_value_type_code
83593 , p_transaction_coa_id => l_adr_transaction_coa_id
83594 , p_accounting_coa_id => l_adr_accounting_coa_id
83595 , p_flexfield_segment_code => l_adr_flexfield_segment_code
83596 , p_flex_value_set_id => l_adr_flex_value_set_id
83597 , p_adr_code => 'FA_EXPENSE_ACCT'
83598 , p_adr_type_code => 'S'
83599 , p_component_type => l_component_type
83600 , p_component_code => l_component_code
83601 , p_component_type_code => l_component_type_code
83602 , p_component_appl_id => l_component_appl_id
83603 , p_amb_context_code => l_amb_context_code
83604 , p_entity_code => 'DEPRECIATION'
83605 , p_event_class_code => 'DEPRECIATION'
83606 , p_side => 'NA'
83607 );
83608
83609 END IF;
83610
83611 --
83612 --
83613 END IF;
83614
83615 --
83616 -- Update the line information that should be overwritten
83617 --
83618 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
83619 p_header_num => 1);
83620 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
83621
83622 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
83623
83624 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
83625 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
83626 END IF;
83627
83628 --
83629 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
83630 --
83631 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
83632 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
83633 ELSE
83634 ---------------------------------------------------------------------------------------------------
83635 -- 4262811a Switch Sign
83636 ---------------------------------------------------------------------------------------------------
83637 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
83638 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
83642 -- 5132302
83639 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
83640 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
83641 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
83643 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
83644 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
83645
83646 END IF;
83647
83648 -- 4955764
83649 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
83650 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
83651
83652
83653 XLA_AE_LINES_PKG.ValidateCurrentLine;
83654 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
83655
83656 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
83657 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
83658 ,p_balance_type_code => l_balance_type_code);
83659
83660 END IF;
83661
83662 -----------------------------------------------------------------------------------------
83663 -- 4262811 Multiperiod Accounting
83664 -----------------------------------------------------------------------------------------
83665 -- No MPA option is assigned.
83666
83667
83668 END IF;
83669 END IF;
83670 --
83671
83672 --
83673 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
83674 trace
83675 (p_msg => 'END of AcctLineType_280'
83676 ,p_level => C_LEVEL_PROCEDURE
83677 ,p_module => l_log_module);
83678 END IF;
83679 --
83680 EXCEPTION
83681 WHEN xla_exceptions_pkg.application_exception THEN
83682 RAISE;
83683 WHEN OTHERS THEN
83684 xla_exceptions_pkg.raise_message
83685 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_280');
83686 END AcctLineType_280;
83687 --
83688
83689 ---------------------------------------
83690 --
83691 -- PRIVATE FUNCTION
83692 -- AcctLineType_281
83693 --
83694 ---------------------------------------
83695 PROCEDURE AcctLineType_281 (
83696 p_application_id IN NUMBER
83697 ,p_event_id IN NUMBER
83698 ,p_calculate_acctd_flag IN VARCHAR2
83699 ,p_calculate_g_l_flag IN VARCHAR2
83700 ,p_actual_flag IN OUT VARCHAR2
83701 ,p_balance_type_code OUT VARCHAR2
83702 ,p_gain_or_loss_ref OUT VARCHAR2
83703
83704 --Period Close Date
83705 , p_source_1 IN DATE
83706 --Generated Code Combination Identifier
83707 , p_source_5 IN NUMBER
83708 --Revaluation Amortization Account
83709 , p_source_28 IN VARCHAR2
83710 --Expense Account Code Combination Identifier
83711 , p_source_31 IN NUMBER
83712 --Default Code Combination Identifier
83713 , p_source_32 IN NUMBER
83714 --Revaluation Generated Code Combination Identifier
83715 , p_source_35 IN NUMBER
83716 --Distribution Type Code
83717 , p_source_51 IN VARCHAR2
83718 --Currency Code
83719 , p_source_53 IN VARCHAR2
83720 --Asset Identifier
83721 , p_source_56 IN NUMBER
83722 --Period Counter
83723 , p_source_57 IN NUMBER
83724 --Distribution Identifier
83725 , p_source_58 IN NUMBER
83726 --Book Type Code
83727 , p_source_59 IN VARCHAR2
83728 --Depreciation Run Identifier
83729 , p_source_62 IN NUMBER
83730 --Revaluation Entered Amount
83731 , p_source_63 IN NUMBER
83732 )
83733 IS
83734
83735 l_component_type VARCHAR2(80);
83736 l_component_code VARCHAR2(30);
83737 l_component_type_code VARCHAR2(1);
83738 l_component_appl_id INTEGER;
83739 l_amb_context_code VARCHAR2(30);
83740 l_entity_code VARCHAR2(30);
83741 l_event_class_code VARCHAR2(30);
83742 l_ae_header_id NUMBER;
83743 l_event_type_code VARCHAR2(30);
83744 l_line_definition_code VARCHAR2(30);
83745 l_line_definition_owner_code VARCHAR2(1);
83746 --
83747 -- adr variables
83748 l_segment VARCHAR2(30);
83749 l_ccid NUMBER;
83750 l_adr_transaction_coa_id NUMBER;
83751 l_adr_accounting_coa_id NUMBER;
83752 l_adr_flexfield_segment_code VARCHAR2(30);
83753 l_adr_flex_value_set_id NUMBER;
83754 l_adr_value_type_code VARCHAR2(30);
83755 l_adr_value_combination_id NUMBER;
83756 l_adr_value_segment_code VARCHAR2(30);
83757
83758 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
83759 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
83760 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
83761 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
83762
83763 -- 4262811 Variables ------------------------------------------------------------------------------------------
83764 l_entered_amt_idx NUMBER;
83765 l_accted_amt_idx NUMBER;
83766 l_acc_rev_flag VARCHAR2(1);
83767 l_accrual_line_num NUMBER;
83768 l_tmp_amt NUMBER;
83769 l_acc_rev_natural_side_code VARCHAR2(1);
83770
83771 l_num_entries NUMBER;
83775 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
83772 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
83773 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
83774 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
83776 l_recog_line_1 NUMBER;
83777 l_recog_line_2 NUMBER;
83778
83779 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
83780 l_bflow_applied_to_amt NUMBER; -- 5132302
83781 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
83782
83783 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
83784
83785 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
83786 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
83787
83788 ---------------------------------------------------------------------------------------------------------------
83789
83790
83791 --
83792 -- bulk performance
83793 --
83794 l_balance_type_code VARCHAR2(1);
83795 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
83796 l_log_module VARCHAR2(240);
83797
83798 --
83799 -- Upgrade strategy
83800 --
83801 l_actual_upg_option VARCHAR2(1);
83802 l_enc_upg_option VARCHAR2(1);
83803
83804 --
83805 BEGIN
83806 --
83807 IF g_log_enabled THEN
83808 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_281';
83809 END IF;
83810 --
83811 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
83812
83813 trace
83814 (p_msg => 'BEGIN of AcctLineType_281'
83815 ,p_level => C_LEVEL_PROCEDURE
83816 ,p_module => l_log_module);
83817
83818 END IF;
83819 --
83820 l_component_type := 'AMB_JLT';
83821 l_component_code := 'FA_PER_DEPRN_REVAL_AMORT';
83822 l_component_type_code := 'S';
83823 l_component_appl_id := 140;
83824 l_amb_context_code := 'DEFAULT';
83825 l_entity_code := 'DEPRECIATION';
83826 l_event_class_code := 'DEPRECIATION';
83827 l_event_type_code := 'DEPRECIATION_ALL';
83828 l_line_definition_owner_code := 'S';
83829 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEPRE16';
83830 --
83831 l_balance_type_code := 'A';
83832 l_segment := NULL;
83833 l_ccid := NULL;
83834 l_adr_transaction_coa_id := NULL;
83835 l_adr_accounting_coa_id := NULL;
83836 l_adr_flexfield_segment_code := NULL;
83837 l_adr_flex_value_set_id := NULL;
83838 l_adr_value_type_code := NULL;
83839 l_adr_value_combination_id := NULL;
83840 l_adr_value_segment_code := NULL;
83841
83842 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
83843 l_bflow_class_code := ''; -- 4219869 Business Flow
83844 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
83845 l_budgetary_control_flag := 'N';
83846
83847 l_bflow_applied_to_amt_idx := NULL; -- 5132302
83848 l_bflow_applied_to_amt := NULL; -- 5132302
83849 l_entered_amt_idx := NULL; -- 4262811
83850 l_accted_amt_idx := NULL; -- 4262811
83851 l_acc_rev_flag := NULL; -- 4262811
83852 l_accrual_line_num := NULL; -- 4262811
83853 l_tmp_amt := NULL; -- 4262811
83854 --
83855
83856 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
83857 l_balance_type_code <> 'B' THEN
83858 IF NVL(p_source_63,9E125) <> 0 AND
83859 NVL(p_source_51,'
83860 ') = 'DEPRN'
83861 THEN
83862
83863 --
83864 XLA_AE_LINES_PKG.SetNewLine;
83865
83866 p_balance_type_code := l_balance_type_code;
83867 -- set the flag so later we will know whether the gain loss line needs to be created
83868
83869 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
83870 p_actual_flag :='A';
83871 END IF;
83872
83873 --
83874 -- bulk performance
83875 --
83876 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
83877 p_header_num => 0); -- 4262811
83878 --
83879 -- set accounting line options
83880 --
83881 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
83882 p_natural_side_code => 'C'
83883 , p_gain_or_loss_flag => 'N'
83884 , p_gl_transfer_mode_code => 'S'
83885 , p_acct_entry_type_code => 'A'
83886 , p_switch_side_flag => 'Y'
83887 , p_merge_duplicate_code => 'N'
83888 );
83889 --
83890 l_acc_rev_natural_side_code := 'D'; -- 4262811
83891 --
83892 --
83893 -- set accounting line type info
83894 --
83895 xla_ae_lines_pkg.SetAcctLineType
83896 (p_component_type => l_component_type
83897 ,p_event_type_code => l_event_type_code
83898 ,p_line_definition_owner_code => l_line_definition_owner_code
83899 ,p_line_definition_code => l_line_definition_code
83900 ,p_accounting_line_code => l_component_code
83901 ,p_accounting_line_type_code => l_component_type_code
83905 ,p_event_class_code => l_event_class_code);
83902 ,p_accounting_line_appl_id => l_component_appl_id
83903 ,p_amb_context_code => l_amb_context_code
83904 ,p_entity_code => l_entity_code
83906 --
83907 -- set accounting class
83908 --
83909 xla_ae_lines_pkg.SetAcctClass(
83910 p_accounting_class_code => 'EXPENSE'
83911 , p_ae_header_id => l_ae_header_id
83912 );
83913
83914 --
83915 -- set rounding class
83916 --
83917 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
83918 'EXPENSE';
83919
83920 --
83921 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
83922 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
83923 --
83924 -- bulk performance
83925 --
83926 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
83927
83928 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
83929 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
83930
83931 -- 4955764
83932 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
83933 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
83934
83935 -- 4458381 Public Sector Enh
83936
83937 --
83938 -- set accounting attributes for the line type
83939 --
83940 l_entered_amt_idx := 7;
83941 l_accted_amt_idx := 9;
83942 l_bflow_applied_to_amt_idx := NULL; -- 5132302
83943 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
83944 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
83945 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
83946 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
83947 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
83948 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
83949 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
83950 l_rec_acct_attrs.array_char_value(4) := p_source_59;
83951 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
83952 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
83953 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
83954 l_rec_acct_attrs.array_char_value(6) := p_source_51;
83955 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
83956 l_rec_acct_attrs.array_num_value(7) := p_source_63;
83957 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
83958 l_rec_acct_attrs.array_char_value(8) := p_source_53;
83959 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
83960 l_rec_acct_attrs.array_num_value(9) := p_source_63;
83961
83962 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
83963 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
83964
83965 ---------------------------------------------------------------------------------------------------------------
83966 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
83967 ---------------------------------------------------------------------------------------------------------------
83968 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
83969
83970 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
83971 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
83972
83973 IF xla_accounting_cache_pkg.GetValueChar
83974 (p_source_code => 'LEDGER_CATEGORY_CODE'
83975 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
83976 AND l_bflow_method_code = 'PRIOR_ENTRY'
83977 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
83978 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
83979 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
83980 )
83981 THEN
83982 xla_ae_lines_pkg.BflowUpgEntry
83983 (p_business_method_code => l_bflow_method_code
83984 ,p_business_class_code => l_bflow_class_code
83985 ,p_balance_type => l_balance_type_code);
83986 ELSE
83987 NULL;
83988 -- No business flow processing for business flow method of NONE.
83989 END IF;
83990
83991 --
83992 -- call analytical criteria
83993 --
83994
83995 --
83996 -- call description
83997 --
83998
83999 xla_ae_lines_pkg.SetLineDescription(
84000 p_ae_header_id => l_ae_header_id
84001 ,p_description => Description_60 (
84002 p_application_id => p_application_id
84003 , p_ae_header_id => l_ae_header_id
84004 , p_source_1 => p_source_1
84005 )
84006 );
84007
84008
84009 --
84010 -- call ADRs
84011 -- Bug 4922099
84012 --
84013 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
84014 (NVL(l_actual_upg_option, 'N') = 'O') OR
84015 (NVL(l_enc_upg_option, 'N') = 'O')
84016 )
84020 --
84017 THEN
84018 NULL;
84019 --
84021
84022 l_ccid := AcctDerRule_179(
84023 p_application_id => p_application_id
84024 , p_ae_header_id => l_ae_header_id
84025 , p_source_32 => p_source_32
84026 , p_source_35 => p_source_35
84027 , x_transaction_coa_id => l_adr_transaction_coa_id
84028 , x_accounting_coa_id => l_adr_accounting_coa_id
84029 , x_value_type_code => l_adr_value_type_code
84030 , p_side => 'NA'
84031 );
84032
84033 xla_ae_lines_pkg.set_ccid(
84034 p_code_combination_id => l_ccid
84035 , p_value_type_code => l_adr_value_type_code
84036 , p_transaction_coa_id => l_adr_transaction_coa_id
84037 , p_accounting_coa_id => l_adr_accounting_coa_id
84038 , p_adr_code => 'FA_PER_REVAL_AMORTIZATION'
84039 , p_adr_type_code => 'S'
84040 , p_component_type => l_component_type
84041 , p_component_code => l_component_code
84042 , p_component_type_code => l_component_type_code
84043 , p_component_appl_id => l_component_appl_id
84044 , p_amb_context_code => l_amb_context_code
84045 , p_side => 'NA'
84046 );
84047
84048
84049 l_segment := AcctDerRule_169(
84050 p_application_id => p_application_id
84051 , p_ae_header_id => l_ae_header_id
84052 , p_source_5 => p_source_5
84053 , p_source_31 => p_source_31
84054 , x_transaction_coa_id => l_adr_transaction_coa_id
84055 , x_accounting_coa_id => l_adr_accounting_coa_id
84056 , x_flexfield_segment_code => l_adr_flexfield_segment_code
84057 , x_flex_value_set_id => l_adr_flex_value_set_id
84058 , x_value_type_code => l_adr_value_type_code
84059 , x_value_combination_id => l_adr_value_combination_id
84060 , x_value_segment_code => l_adr_value_segment_code
84061 , p_side => 'NA'
84062 , p_override_seg_flag => 'Y'
84063 );
84064
84065 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
84066
84067 xla_ae_lines_pkg.set_segment(
84068 p_to_segment_code => 'GL_BALANCING'
84069 , p_segment_value => l_segment
84070 , p_from_segment_code => l_adr_value_segment_code
84071 , p_from_combination_id => l_adr_value_combination_id
84072 , p_value_type_code => l_adr_value_type_code
84073 , p_transaction_coa_id => l_adr_transaction_coa_id
84074 , p_accounting_coa_id => l_adr_accounting_coa_id
84075 , p_flexfield_segment_code => l_adr_flexfield_segment_code
84076 , p_flex_value_set_id => l_adr_flex_value_set_id
84077 , p_adr_code => 'FA_EXPENSE_ACCT'
84078 , p_adr_type_code => 'S'
84079 , p_component_type => l_component_type
84080 , p_component_code => l_component_code
84081 , p_component_type_code => l_component_type_code
84082 , p_component_appl_id => l_component_appl_id
84083 , p_amb_context_code => l_amb_context_code
84084 , p_entity_code => 'DEPRECIATION'
84085 , p_event_class_code => 'DEPRECIATION'
84086 , p_side => 'NA'
84087 );
84088
84089 END IF;
84090
84091 l_segment := AcctDerRule_165(
84092 p_application_id => p_application_id
84093 , p_ae_header_id => l_ae_header_id
84094 , p_source_5 => p_source_5
84095 , p_source_28 => p_source_28
84096 , x_transaction_coa_id => l_adr_transaction_coa_id
84097 , x_accounting_coa_id => l_adr_accounting_coa_id
84098 , x_flexfield_segment_code => l_adr_flexfield_segment_code
84099 , x_flex_value_set_id => l_adr_flex_value_set_id
84100 , x_value_type_code => l_adr_value_type_code
84101 , x_value_combination_id => l_adr_value_combination_id
84102 , x_value_segment_code => l_adr_value_segment_code
84103 , p_side => 'NA'
84104 , p_override_seg_flag => 'Y'
84105 );
84106
84107 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
84108
84109 xla_ae_lines_pkg.set_segment(
84110 p_to_segment_code => 'GL_ACCOUNT'
84111 , p_segment_value => l_segment
84112 , p_from_segment_code => l_adr_value_segment_code
84113 , p_from_combination_id => l_adr_value_combination_id
84114 , p_value_type_code => l_adr_value_type_code
84115 , p_transaction_coa_id => l_adr_transaction_coa_id
84116 , p_accounting_coa_id => l_adr_accounting_coa_id
84117 , p_flexfield_segment_code => l_adr_flexfield_segment_code
84118 , p_flex_value_set_id => l_adr_flex_value_set_id
84119 , p_adr_code => 'FA_REVAL_AMORT_SEGMENT'
84120 , p_adr_type_code => 'S'
84121 , p_component_type => l_component_type
84122 , p_component_code => l_component_code
84123 , p_component_type_code => l_component_type_code
84124 , p_component_appl_id => l_component_appl_id
84125 , p_amb_context_code => l_amb_context_code
84129 );
84126 , p_entity_code => 'DEPRECIATION'
84127 , p_event_class_code => 'DEPRECIATION'
84128 , p_side => 'NA'
84130
84131 END IF;
84132
84133 --
84134 --
84135 END IF;
84136 --
84137 -- Bug 4922099
84138 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
84139 (NVL(l_enc_upg_option, 'N') = 'O')
84140 ) AND
84141 (l_bflow_method_code = 'PRIOR_ENTRY')
84142 )
84143 THEN
84144 IF
84145 --
84146 1 = 2
84147 --
84148 THEN
84149 xla_accounting_err_pkg.build_message
84150 (p_appli_s_name => 'XLA'
84151 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
84152 ,p_token_1 => 'LINE_NUMBER'
84153 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
84154 ,p_token_2 => 'LINE_TYPE_NAME'
84155 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
84156 l_component_type
84157 ,l_component_code
84158 ,l_component_type_code
84159 ,l_component_appl_id
84160 ,l_amb_context_code
84161 ,l_entity_code
84162 ,l_event_class_code
84163 )
84164 ,p_token_3 => 'OWNER'
84165 ,p_value_3 => xla_lookups_pkg.get_meaning(
84166 p_lookup_type => 'XLA_OWNER_TYPE'
84167 ,p_lookup_code => l_component_type_code
84168 )
84169 ,p_token_4 => 'PRODUCT_NAME'
84170 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
84171 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
84172 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
84173 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
84174 ,p_ae_header_id => NULL
84175 );
84176
84177 IF (C_LEVEL_ERROR>= g_log_level) THEN
84178 trace
84179 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
84180 ,p_level => C_LEVEL_ERROR
84181 ,p_module => l_log_module);
84182 END IF;
84183 END IF;
84184 END IF;
84185 --
84186 --
84187 ------------------------------------------------------------------------------------------------
84188 -- 4219869 Business Flow
84189 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
84190 -- Prior Entry. Currently, the following code is always generated.
84191 ------------------------------------------------------------------------------------------------
84192 XLA_AE_LINES_PKG.ValidateCurrentLine;
84193
84194 ------------------------------------------------------------------------------------
84195 -- 4219869 Business Flow
84196 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
84197 ------------------------------------------------------------------------------------
84198 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
84199
84200 ----------------------------------------------------------------------------------
84201 -- 4219869 Business Flow
84202 -- Update journal entry status -- Need to generate this within IF <condition>
84203 ----------------------------------------------------------------------------------
84204 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
84205 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
84206 ,p_balance_type_code => l_balance_type_code
84207 );
84208
84209 -------------------------------------------------------------------------------------------
84210 -- 4262811 - Generate the Accrual Reversal lines
84211 -------------------------------------------------------------------------------------------
84212 BEGIN
84213 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
84214 (g_array_event(p_event_id).array_value_num('header_index'));
84215 IF l_acc_rev_flag IS NULL THEN
84216 l_acc_rev_flag := 'N';
84217 END IF;
84218 EXCEPTION
84219 WHEN OTHERS THEN
84220 l_acc_rev_flag := 'N';
84221 END;
84222 --
84223 IF (l_acc_rev_flag = 'Y') THEN
84224
84225 -- 4645092 ------------------------------------------------------------------------------
84226 -- To allow MPA report to determine if it should generate report process
84230 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
84227 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
84228 ------------------------------------------------------------------------------------------
84229
84231 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
84232 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
84233 -- call ADRs
84234 -- Bug 4922099
84235 --
84236 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
84237 (NVL(l_actual_upg_option, 'N') = 'O') OR
84238 (NVL(l_enc_upg_option, 'N') = 'O')
84239 )
84240 THEN
84241 NULL;
84242 --
84243 --
84244
84245 l_ccid := AcctDerRule_179(
84246 p_application_id => p_application_id
84247 , p_ae_header_id => l_ae_header_id
84248 , p_source_32 => p_source_32
84249 , p_source_35 => p_source_35
84250 , x_transaction_coa_id => l_adr_transaction_coa_id
84251 , x_accounting_coa_id => l_adr_accounting_coa_id
84252 , x_value_type_code => l_adr_value_type_code
84253 , p_side => 'NA'
84254 );
84255
84256 xla_ae_lines_pkg.set_ccid(
84257 p_code_combination_id => l_ccid
84258 , p_value_type_code => l_adr_value_type_code
84259 , p_transaction_coa_id => l_adr_transaction_coa_id
84260 , p_accounting_coa_id => l_adr_accounting_coa_id
84261 , p_adr_code => 'FA_PER_REVAL_AMORTIZATION'
84262 , p_adr_type_code => 'S'
84263 , p_component_type => l_component_type
84264 , p_component_code => l_component_code
84265 , p_component_type_code => l_component_type_code
84266 , p_component_appl_id => l_component_appl_id
84267 , p_amb_context_code => l_amb_context_code
84268 , p_side => 'NA'
84269 );
84270
84271
84272 l_segment := AcctDerRule_169(
84273 p_application_id => p_application_id
84274 , p_ae_header_id => l_ae_header_id
84275 , p_source_5 => p_source_5
84276 , p_source_31 => p_source_31
84277 , x_transaction_coa_id => l_adr_transaction_coa_id
84278 , x_accounting_coa_id => l_adr_accounting_coa_id
84279 , x_flexfield_segment_code => l_adr_flexfield_segment_code
84280 , x_flex_value_set_id => l_adr_flex_value_set_id
84281 , x_value_type_code => l_adr_value_type_code
84282 , x_value_combination_id => l_adr_value_combination_id
84283 , x_value_segment_code => l_adr_value_segment_code
84284 , p_side => 'NA'
84285 , p_override_seg_flag => 'Y'
84286 );
84287
84288 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
84289
84290 xla_ae_lines_pkg.set_segment(
84291 p_to_segment_code => 'GL_BALANCING'
84292 , p_segment_value => l_segment
84293 , p_from_segment_code => l_adr_value_segment_code
84294 , p_from_combination_id => l_adr_value_combination_id
84295 , p_value_type_code => l_adr_value_type_code
84296 , p_transaction_coa_id => l_adr_transaction_coa_id
84297 , p_accounting_coa_id => l_adr_accounting_coa_id
84298 , p_flexfield_segment_code => l_adr_flexfield_segment_code
84299 , p_flex_value_set_id => l_adr_flex_value_set_id
84300 , p_adr_code => 'FA_EXPENSE_ACCT'
84301 , p_adr_type_code => 'S'
84302 , p_component_type => l_component_type
84303 , p_component_code => l_component_code
84304 , p_component_type_code => l_component_type_code
84305 , p_component_appl_id => l_component_appl_id
84306 , p_amb_context_code => l_amb_context_code
84307 , p_entity_code => 'DEPRECIATION'
84308 , p_event_class_code => 'DEPRECIATION'
84309 , p_side => 'NA'
84310 );
84311
84312 END IF;
84313
84314 l_segment := AcctDerRule_165(
84315 p_application_id => p_application_id
84316 , p_ae_header_id => l_ae_header_id
84317 , p_source_5 => p_source_5
84318 , p_source_28 => p_source_28
84319 , x_transaction_coa_id => l_adr_transaction_coa_id
84320 , x_accounting_coa_id => l_adr_accounting_coa_id
84321 , x_flexfield_segment_code => l_adr_flexfield_segment_code
84322 , x_flex_value_set_id => l_adr_flex_value_set_id
84323 , x_value_type_code => l_adr_value_type_code
84324 , x_value_combination_id => l_adr_value_combination_id
84325 , x_value_segment_code => l_adr_value_segment_code
84326 , p_side => 'NA'
84327 , p_override_seg_flag => 'Y'
84328 );
84329
84330 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
84331
84332 xla_ae_lines_pkg.set_segment(
84333 p_to_segment_code => 'GL_ACCOUNT'
84334 , p_segment_value => l_segment
84335 , p_from_segment_code => l_adr_value_segment_code
84336 , p_from_combination_id => l_adr_value_combination_id
84337 , p_value_type_code => l_adr_value_type_code
84338 , p_transaction_coa_id => l_adr_transaction_coa_id
84342 , p_adr_code => 'FA_REVAL_AMORT_SEGMENT'
84339 , p_accounting_coa_id => l_adr_accounting_coa_id
84340 , p_flexfield_segment_code => l_adr_flexfield_segment_code
84341 , p_flex_value_set_id => l_adr_flex_value_set_id
84343 , p_adr_type_code => 'S'
84344 , p_component_type => l_component_type
84345 , p_component_code => l_component_code
84346 , p_component_type_code => l_component_type_code
84347 , p_component_appl_id => l_component_appl_id
84348 , p_amb_context_code => l_amb_context_code
84349 , p_entity_code => 'DEPRECIATION'
84350 , p_event_class_code => 'DEPRECIATION'
84351 , p_side => 'NA'
84352 );
84353
84354 END IF;
84355
84356 --
84357 --
84358 END IF;
84359
84360 --
84361 -- Update the line information that should be overwritten
84362 --
84363 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
84364 p_header_num => 1);
84365 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
84366
84367 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
84368
84369 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
84370 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
84371 END IF;
84372
84373 --
84374 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
84375 --
84376 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
84377 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
84378 ELSE
84379 ---------------------------------------------------------------------------------------------------
84380 -- 4262811a Switch Sign
84381 ---------------------------------------------------------------------------------------------------
84382 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
84383 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
84384 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
84385 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
84386 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
84387 -- 5132302
84388 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
84389 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
84390
84391 END IF;
84392
84393 -- 4955764
84394 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
84395 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
84396
84397
84398 XLA_AE_LINES_PKG.ValidateCurrentLine;
84399 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
84400
84401 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
84402 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
84403 ,p_balance_type_code => l_balance_type_code);
84404
84405 END IF;
84406
84407 -----------------------------------------------------------------------------------------
84408 -- 4262811 Multiperiod Accounting
84409 -----------------------------------------------------------------------------------------
84410 -- No MPA option is assigned.
84411
84412
84413 END IF;
84414 END IF;
84415 --
84416
84417 --
84418 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
84419 trace
84420 (p_msg => 'END of AcctLineType_281'
84421 ,p_level => C_LEVEL_PROCEDURE
84422 ,p_module => l_log_module);
84423 END IF;
84424 --
84425 EXCEPTION
84426 WHEN xla_exceptions_pkg.application_exception THEN
84427 RAISE;
84428 WHEN OTHERS THEN
84429 xla_exceptions_pkg.raise_message
84430 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_281');
84431 END AcctLineType_281;
84432 --
84433
84434 ---------------------------------------
84435 --
84436 -- PRIVATE FUNCTION
84437 -- AcctLineType_282
84438 --
84439 ---------------------------------------
84440 PROCEDURE AcctLineType_282 (
84441 p_application_id IN NUMBER
84442 ,p_event_id IN NUMBER
84443 ,p_calculate_acctd_flag IN VARCHAR2
84444 ,p_calculate_g_l_flag IN VARCHAR2
84445 ,p_actual_flag IN OUT VARCHAR2
84446 ,p_balance_type_code OUT VARCHAR2
84447 ,p_gain_or_loss_ref OUT VARCHAR2
84448
84449 --Period Close Date
84450 , p_source_1 IN DATE
84451 --Generated Code Combination Identifier
84452 , p_source_5 IN NUMBER
84453 --Revaluation Reserve Account
84454 , p_source_13 IN VARCHAR2
84455 --Expense Account Code Combination Identifier
84456 , p_source_31 IN NUMBER
84457 --Default Code Combination Identifier
84461 --Distribution Type Code
84458 , p_source_32 IN NUMBER
84459 --Revaluation Generated Offset Code Combination Identifier
84460 , p_source_36 IN NUMBER
84462 , p_source_51 IN VARCHAR2
84463 --Currency Code
84464 , p_source_53 IN VARCHAR2
84465 --Asset Identifier
84466 , p_source_56 IN NUMBER
84467 --Period Counter
84468 , p_source_57 IN NUMBER
84469 --Distribution Identifier
84470 , p_source_58 IN NUMBER
84471 --Book Type Code
84472 , p_source_59 IN VARCHAR2
84473 --Depreciation Run Identifier
84474 , p_source_62 IN NUMBER
84475 --Revaluation Entered Amount
84476 , p_source_63 IN NUMBER
84477 )
84478 IS
84479
84480 l_component_type VARCHAR2(80);
84481 l_component_code VARCHAR2(30);
84482 l_component_type_code VARCHAR2(1);
84483 l_component_appl_id INTEGER;
84484 l_amb_context_code VARCHAR2(30);
84485 l_entity_code VARCHAR2(30);
84486 l_event_class_code VARCHAR2(30);
84487 l_ae_header_id NUMBER;
84488 l_event_type_code VARCHAR2(30);
84489 l_line_definition_code VARCHAR2(30);
84490 l_line_definition_owner_code VARCHAR2(1);
84491 --
84492 -- adr variables
84493 l_segment VARCHAR2(30);
84494 l_ccid NUMBER;
84495 l_adr_transaction_coa_id NUMBER;
84496 l_adr_accounting_coa_id NUMBER;
84497 l_adr_flexfield_segment_code VARCHAR2(30);
84498 l_adr_flex_value_set_id NUMBER;
84499 l_adr_value_type_code VARCHAR2(30);
84500 l_adr_value_combination_id NUMBER;
84501 l_adr_value_segment_code VARCHAR2(30);
84502
84503 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
84504 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
84505 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
84506 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
84507
84508 -- 4262811 Variables ------------------------------------------------------------------------------------------
84509 l_entered_amt_idx NUMBER;
84510 l_accted_amt_idx NUMBER;
84511 l_acc_rev_flag VARCHAR2(1);
84512 l_accrual_line_num NUMBER;
84513 l_tmp_amt NUMBER;
84514 l_acc_rev_natural_side_code VARCHAR2(1);
84515
84516 l_num_entries NUMBER;
84517 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
84518 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
84519 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
84520 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
84521 l_recog_line_1 NUMBER;
84522 l_recog_line_2 NUMBER;
84523
84524 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
84525 l_bflow_applied_to_amt NUMBER; -- 5132302
84526 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
84527
84528 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
84529
84530 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
84531 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
84532
84533 ---------------------------------------------------------------------------------------------------------------
84534
84535
84536 --
84537 -- bulk performance
84538 --
84539 l_balance_type_code VARCHAR2(1);
84540 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
84541 l_log_module VARCHAR2(240);
84542
84543 --
84544 -- Upgrade strategy
84545 --
84546 l_actual_upg_option VARCHAR2(1);
84547 l_enc_upg_option VARCHAR2(1);
84548
84549 --
84550 BEGIN
84551 --
84552 IF g_log_enabled THEN
84553 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_282';
84554 END IF;
84555 --
84556 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
84557
84558 trace
84559 (p_msg => 'BEGIN of AcctLineType_282'
84560 ,p_level => C_LEVEL_PROCEDURE
84561 ,p_module => l_log_module);
84562
84563 END IF;
84564 --
84565 l_component_type := 'AMB_JLT';
84566 l_component_code := 'FA_PER_DEPRN_REVAL_RESERVE';
84567 l_component_type_code := 'S';
84568 l_component_appl_id := 140;
84569 l_amb_context_code := 'DEFAULT';
84570 l_entity_code := 'DEPRECIATION';
84571 l_event_class_code := 'DEPRECIATION';
84572 l_event_type_code := 'DEPRECIATION_ALL';
84573 l_line_definition_owner_code := 'S';
84574 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEPRE16';
84575 --
84576 l_balance_type_code := 'A';
84577 l_segment := NULL;
84578 l_ccid := NULL;
84579 l_adr_transaction_coa_id := NULL;
84580 l_adr_accounting_coa_id := NULL;
84581 l_adr_flexfield_segment_code := NULL;
84582 l_adr_flex_value_set_id := NULL;
84583 l_adr_value_type_code := NULL;
84584 l_adr_value_combination_id := NULL;
84585 l_adr_value_segment_code := NULL;
84586
84590 l_budgetary_control_flag := 'N';
84587 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
84588 l_bflow_class_code := ''; -- 4219869 Business Flow
84589 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
84591
84592 l_bflow_applied_to_amt_idx := NULL; -- 5132302
84593 l_bflow_applied_to_amt := NULL; -- 5132302
84594 l_entered_amt_idx := NULL; -- 4262811
84595 l_accted_amt_idx := NULL; -- 4262811
84596 l_acc_rev_flag := NULL; -- 4262811
84597 l_accrual_line_num := NULL; -- 4262811
84598 l_tmp_amt := NULL; -- 4262811
84599 --
84600
84601 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
84602 l_balance_type_code <> 'B' THEN
84603 IF NVL(p_source_63,9E125) <> 0 AND
84604 NVL(p_source_51,'
84605 ') = 'DEPRN'
84606 THEN
84607
84608 --
84609 XLA_AE_LINES_PKG.SetNewLine;
84610
84611 p_balance_type_code := l_balance_type_code;
84612 -- set the flag so later we will know whether the gain loss line needs to be created
84613
84614 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
84615 p_actual_flag :='A';
84616 END IF;
84617
84618 --
84619 -- bulk performance
84620 --
84621 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
84622 p_header_num => 0); -- 4262811
84623 --
84624 -- set accounting line options
84625 --
84626 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
84627 p_natural_side_code => 'D'
84628 , p_gain_or_loss_flag => 'N'
84629 , p_gl_transfer_mode_code => 'S'
84630 , p_acct_entry_type_code => 'A'
84631 , p_switch_side_flag => 'Y'
84632 , p_merge_duplicate_code => 'N'
84633 );
84634 --
84635 l_acc_rev_natural_side_code := 'C'; -- 4262811
84636 --
84637 --
84638 -- set accounting line type info
84639 --
84640 xla_ae_lines_pkg.SetAcctLineType
84641 (p_component_type => l_component_type
84642 ,p_event_type_code => l_event_type_code
84643 ,p_line_definition_owner_code => l_line_definition_owner_code
84644 ,p_line_definition_code => l_line_definition_code
84645 ,p_accounting_line_code => l_component_code
84646 ,p_accounting_line_type_code => l_component_type_code
84647 ,p_accounting_line_appl_id => l_component_appl_id
84648 ,p_amb_context_code => l_amb_context_code
84649 ,p_entity_code => l_entity_code
84650 ,p_event_class_code => l_event_class_code);
84651 --
84652 -- set accounting class
84653 --
84654 xla_ae_lines_pkg.SetAcctClass(
84655 p_accounting_class_code => 'ASSET'
84656 , p_ae_header_id => l_ae_header_id
84657 );
84658
84659 --
84660 -- set rounding class
84661 --
84662 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
84663 'ASSET';
84664
84665 --
84666 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
84667 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
84668 --
84669 -- bulk performance
84670 --
84671 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
84672
84673 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
84674 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
84675
84676 -- 4955764
84677 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
84678 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
84679
84680 -- 4458381 Public Sector Enh
84681
84682 --
84683 -- set accounting attributes for the line type
84684 --
84685 l_entered_amt_idx := 7;
84686 l_accted_amt_idx := 9;
84687 l_bflow_applied_to_amt_idx := NULL; -- 5132302
84688 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
84689 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
84690 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
84691 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
84692 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
84693 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
84694 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
84695 l_rec_acct_attrs.array_char_value(4) := p_source_59;
84696 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
84697 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
84698 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
84699 l_rec_acct_attrs.array_char_value(6) := p_source_51;
84700 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
84701 l_rec_acct_attrs.array_num_value(7) := p_source_63;
84702 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
84703 l_rec_acct_attrs.array_char_value(8) := p_source_53;
84704 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
84705 l_rec_acct_attrs.array_num_value(9) := p_source_63;
84706
84710 ---------------------------------------------------------------------------------------------------------------
84707 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
84708 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
84709
84711 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
84712 ---------------------------------------------------------------------------------------------------------------
84713 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
84714
84715 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
84716 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
84717
84718 IF xla_accounting_cache_pkg.GetValueChar
84719 (p_source_code => 'LEDGER_CATEGORY_CODE'
84720 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
84721 AND l_bflow_method_code = 'PRIOR_ENTRY'
84722 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
84723 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
84724 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
84725 )
84726 THEN
84727 xla_ae_lines_pkg.BflowUpgEntry
84728 (p_business_method_code => l_bflow_method_code
84729 ,p_business_class_code => l_bflow_class_code
84730 ,p_balance_type => l_balance_type_code);
84731 ELSE
84732 NULL;
84733 -- No business flow processing for business flow method of NONE.
84734 END IF;
84735
84736 --
84737 -- call analytical criteria
84738 --
84739
84740 --
84741 -- call description
84742 --
84743
84744 xla_ae_lines_pkg.SetLineDescription(
84745 p_ae_header_id => l_ae_header_id
84746 ,p_description => Description_61 (
84747 p_application_id => p_application_id
84748 , p_ae_header_id => l_ae_header_id
84749 , p_source_1 => p_source_1
84750 )
84751 );
84752
84753
84754 --
84755 -- call ADRs
84756 -- Bug 4922099
84757 --
84758 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
84759 (NVL(l_actual_upg_option, 'N') = 'O') OR
84760 (NVL(l_enc_upg_option, 'N') = 'O')
84761 )
84762 THEN
84763 NULL;
84764 --
84765 --
84766
84767 l_ccid := AcctDerRule_180(
84768 p_application_id => p_application_id
84769 , p_ae_header_id => l_ae_header_id
84770 , p_source_32 => p_source_32
84771 , p_source_36 => p_source_36
84772 , x_transaction_coa_id => l_adr_transaction_coa_id
84773 , x_accounting_coa_id => l_adr_accounting_coa_id
84774 , x_value_type_code => l_adr_value_type_code
84775 , p_side => 'NA'
84776 );
84777
84778 xla_ae_lines_pkg.set_ccid(
84779 p_code_combination_id => l_ccid
84780 , p_value_type_code => l_adr_value_type_code
84781 , p_transaction_coa_id => l_adr_transaction_coa_id
84782 , p_accounting_coa_id => l_adr_accounting_coa_id
84783 , p_adr_code => 'FA_PER_REVAL_RESERVE'
84784 , p_adr_type_code => 'S'
84785 , p_component_type => l_component_type
84786 , p_component_code => l_component_code
84787 , p_component_type_code => l_component_type_code
84788 , p_component_appl_id => l_component_appl_id
84789 , p_amb_context_code => l_amb_context_code
84790 , p_side => 'NA'
84791 );
84792
84793
84794 l_segment := AcctDerRule_151(
84795 p_application_id => p_application_id
84796 , p_ae_header_id => l_ae_header_id
84797 , p_source_5 => p_source_5
84798 , p_source_13 => p_source_13
84799 , x_transaction_coa_id => l_adr_transaction_coa_id
84800 , x_accounting_coa_id => l_adr_accounting_coa_id
84801 , x_flexfield_segment_code => l_adr_flexfield_segment_code
84802 , x_flex_value_set_id => l_adr_flex_value_set_id
84803 , x_value_type_code => l_adr_value_type_code
84804 , x_value_combination_id => l_adr_value_combination_id
84805 , x_value_segment_code => l_adr_value_segment_code
84806 , p_side => 'NA'
84807 , p_override_seg_flag => 'Y'
84808 );
84809
84810 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
84811
84812 xla_ae_lines_pkg.set_segment(
84813 p_to_segment_code => 'GL_ACCOUNT'
84814 , p_segment_value => l_segment
84815 , p_from_segment_code => l_adr_value_segment_code
84816 , p_from_combination_id => l_adr_value_combination_id
84817 , p_value_type_code => l_adr_value_type_code
84818 , p_transaction_coa_id => l_adr_transaction_coa_id
84819 , p_accounting_coa_id => l_adr_accounting_coa_id
84820 , p_flexfield_segment_code => l_adr_flexfield_segment_code
84821 , p_flex_value_set_id => l_adr_flex_value_set_id
84822 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
84823 , p_adr_type_code => 'S'
84824 , p_component_type => l_component_type
84828 , p_amb_context_code => l_amb_context_code
84825 , p_component_code => l_component_code
84826 , p_component_type_code => l_component_type_code
84827 , p_component_appl_id => l_component_appl_id
84829 , p_entity_code => 'DEPRECIATION'
84830 , p_event_class_code => 'DEPRECIATION'
84831 , p_side => 'NA'
84832 );
84833
84834 END IF;
84835
84836 l_segment := AcctDerRule_169(
84837 p_application_id => p_application_id
84838 , p_ae_header_id => l_ae_header_id
84839 , p_source_5 => p_source_5
84840 , p_source_31 => p_source_31
84841 , x_transaction_coa_id => l_adr_transaction_coa_id
84842 , x_accounting_coa_id => l_adr_accounting_coa_id
84843 , x_flexfield_segment_code => l_adr_flexfield_segment_code
84844 , x_flex_value_set_id => l_adr_flex_value_set_id
84845 , x_value_type_code => l_adr_value_type_code
84846 , x_value_combination_id => l_adr_value_combination_id
84847 , x_value_segment_code => l_adr_value_segment_code
84848 , p_side => 'NA'
84849 , p_override_seg_flag => 'Y'
84850 );
84851
84852 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
84853
84854 xla_ae_lines_pkg.set_segment(
84855 p_to_segment_code => 'GL_BALANCING'
84856 , p_segment_value => l_segment
84857 , p_from_segment_code => l_adr_value_segment_code
84858 , p_from_combination_id => l_adr_value_combination_id
84859 , p_value_type_code => l_adr_value_type_code
84860 , p_transaction_coa_id => l_adr_transaction_coa_id
84861 , p_accounting_coa_id => l_adr_accounting_coa_id
84862 , p_flexfield_segment_code => l_adr_flexfield_segment_code
84863 , p_flex_value_set_id => l_adr_flex_value_set_id
84864 , p_adr_code => 'FA_EXPENSE_ACCT'
84865 , p_adr_type_code => 'S'
84866 , p_component_type => l_component_type
84867 , p_component_code => l_component_code
84868 , p_component_type_code => l_component_type_code
84869 , p_component_appl_id => l_component_appl_id
84870 , p_amb_context_code => l_amb_context_code
84871 , p_entity_code => 'DEPRECIATION'
84872 , p_event_class_code => 'DEPRECIATION'
84873 , p_side => 'NA'
84874 );
84875
84876 END IF;
84877
84878 --
84879 --
84880 END IF;
84881 --
84882 -- Bug 4922099
84883 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
84884 (NVL(l_enc_upg_option, 'N') = 'O')
84885 ) AND
84886 (l_bflow_method_code = 'PRIOR_ENTRY')
84887 )
84888 THEN
84889 IF
84890 --
84891 1 = 2
84892 --
84893 THEN
84894 xla_accounting_err_pkg.build_message
84895 (p_appli_s_name => 'XLA'
84896 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
84897 ,p_token_1 => 'LINE_NUMBER'
84898 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
84899 ,p_token_2 => 'LINE_TYPE_NAME'
84900 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
84901 l_component_type
84902 ,l_component_code
84903 ,l_component_type_code
84904 ,l_component_appl_id
84905 ,l_amb_context_code
84906 ,l_entity_code
84907 ,l_event_class_code
84908 )
84909 ,p_token_3 => 'OWNER'
84910 ,p_value_3 => xla_lookups_pkg.get_meaning(
84911 p_lookup_type => 'XLA_OWNER_TYPE'
84912 ,p_lookup_code => l_component_type_code
84913 )
84914 ,p_token_4 => 'PRODUCT_NAME'
84915 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
84916 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
84917 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
84918 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
84919 ,p_ae_header_id => NULL
84920 );
84921
84922 IF (C_LEVEL_ERROR>= g_log_level) THEN
84923 trace
84927 END IF;
84924 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
84925 ,p_level => C_LEVEL_ERROR
84926 ,p_module => l_log_module);
84928 END IF;
84929 END IF;
84930 --
84931 --
84932 ------------------------------------------------------------------------------------------------
84933 -- 4219869 Business Flow
84934 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
84935 -- Prior Entry. Currently, the following code is always generated.
84936 ------------------------------------------------------------------------------------------------
84937 XLA_AE_LINES_PKG.ValidateCurrentLine;
84938
84939 ------------------------------------------------------------------------------------
84940 -- 4219869 Business Flow
84941 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
84942 ------------------------------------------------------------------------------------
84943 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
84944
84945 ----------------------------------------------------------------------------------
84946 -- 4219869 Business Flow
84947 -- Update journal entry status -- Need to generate this within IF <condition>
84948 ----------------------------------------------------------------------------------
84949 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
84950 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
84951 ,p_balance_type_code => l_balance_type_code
84952 );
84953
84954 -------------------------------------------------------------------------------------------
84955 -- 4262811 - Generate the Accrual Reversal lines
84956 -------------------------------------------------------------------------------------------
84957 BEGIN
84958 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
84959 (g_array_event(p_event_id).array_value_num('header_index'));
84960 IF l_acc_rev_flag IS NULL THEN
84961 l_acc_rev_flag := 'N';
84962 END IF;
84963 EXCEPTION
84964 WHEN OTHERS THEN
84965 l_acc_rev_flag := 'N';
84966 END;
84967 --
84968 IF (l_acc_rev_flag = 'Y') THEN
84969
84970 -- 4645092 ------------------------------------------------------------------------------
84971 -- To allow MPA report to determine if it should generate report process
84972 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
84973 ------------------------------------------------------------------------------------------
84974
84975 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
84976 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
84977 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
84978 -- call ADRs
84979 -- Bug 4922099
84980 --
84981 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
84982 (NVL(l_actual_upg_option, 'N') = 'O') OR
84983 (NVL(l_enc_upg_option, 'N') = 'O')
84984 )
84985 THEN
84986 NULL;
84987 --
84988 --
84989
84990 l_ccid := AcctDerRule_180(
84991 p_application_id => p_application_id
84992 , p_ae_header_id => l_ae_header_id
84993 , p_source_32 => p_source_32
84994 , p_source_36 => p_source_36
84995 , x_transaction_coa_id => l_adr_transaction_coa_id
84996 , x_accounting_coa_id => l_adr_accounting_coa_id
84997 , x_value_type_code => l_adr_value_type_code
84998 , p_side => 'NA'
84999 );
85000
85001 xla_ae_lines_pkg.set_ccid(
85002 p_code_combination_id => l_ccid
85003 , p_value_type_code => l_adr_value_type_code
85004 , p_transaction_coa_id => l_adr_transaction_coa_id
85005 , p_accounting_coa_id => l_adr_accounting_coa_id
85006 , p_adr_code => 'FA_PER_REVAL_RESERVE'
85007 , p_adr_type_code => 'S'
85008 , p_component_type => l_component_type
85009 , p_component_code => l_component_code
85010 , p_component_type_code => l_component_type_code
85011 , p_component_appl_id => l_component_appl_id
85012 , p_amb_context_code => l_amb_context_code
85013 , p_side => 'NA'
85014 );
85015
85016
85017 l_segment := AcctDerRule_151(
85018 p_application_id => p_application_id
85019 , p_ae_header_id => l_ae_header_id
85020 , p_source_5 => p_source_5
85021 , p_source_13 => p_source_13
85022 , x_transaction_coa_id => l_adr_transaction_coa_id
85023 , x_accounting_coa_id => l_adr_accounting_coa_id
85024 , x_flexfield_segment_code => l_adr_flexfield_segment_code
85025 , x_flex_value_set_id => l_adr_flex_value_set_id
85026 , x_value_type_code => l_adr_value_type_code
85027 , x_value_combination_id => l_adr_value_combination_id
85028 , x_value_segment_code => l_adr_value_segment_code
85029 , p_side => 'NA'
85030 , p_override_seg_flag => 'Y'
85031 );
85032
85033 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
85034
85035 xla_ae_lines_pkg.set_segment(
85039 , p_from_combination_id => l_adr_value_combination_id
85036 p_to_segment_code => 'GL_ACCOUNT'
85037 , p_segment_value => l_segment
85038 , p_from_segment_code => l_adr_value_segment_code
85040 , p_value_type_code => l_adr_value_type_code
85041 , p_transaction_coa_id => l_adr_transaction_coa_id
85042 , p_accounting_coa_id => l_adr_accounting_coa_id
85043 , p_flexfield_segment_code => l_adr_flexfield_segment_code
85044 , p_flex_value_set_id => l_adr_flex_value_set_id
85045 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
85046 , p_adr_type_code => 'S'
85047 , p_component_type => l_component_type
85048 , p_component_code => l_component_code
85049 , p_component_type_code => l_component_type_code
85050 , p_component_appl_id => l_component_appl_id
85051 , p_amb_context_code => l_amb_context_code
85052 , p_entity_code => 'DEPRECIATION'
85053 , p_event_class_code => 'DEPRECIATION'
85054 , p_side => 'NA'
85055 );
85056
85057 END IF;
85058
85059 l_segment := AcctDerRule_169(
85060 p_application_id => p_application_id
85061 , p_ae_header_id => l_ae_header_id
85062 , p_source_5 => p_source_5
85063 , p_source_31 => p_source_31
85064 , x_transaction_coa_id => l_adr_transaction_coa_id
85065 , x_accounting_coa_id => l_adr_accounting_coa_id
85066 , x_flexfield_segment_code => l_adr_flexfield_segment_code
85067 , x_flex_value_set_id => l_adr_flex_value_set_id
85068 , x_value_type_code => l_adr_value_type_code
85069 , x_value_combination_id => l_adr_value_combination_id
85070 , x_value_segment_code => l_adr_value_segment_code
85071 , p_side => 'NA'
85072 , p_override_seg_flag => 'Y'
85073 );
85074
85075 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
85076
85077 xla_ae_lines_pkg.set_segment(
85078 p_to_segment_code => 'GL_BALANCING'
85079 , p_segment_value => l_segment
85080 , p_from_segment_code => l_adr_value_segment_code
85081 , p_from_combination_id => l_adr_value_combination_id
85082 , p_value_type_code => l_adr_value_type_code
85083 , p_transaction_coa_id => l_adr_transaction_coa_id
85084 , p_accounting_coa_id => l_adr_accounting_coa_id
85085 , p_flexfield_segment_code => l_adr_flexfield_segment_code
85086 , p_flex_value_set_id => l_adr_flex_value_set_id
85087 , p_adr_code => 'FA_EXPENSE_ACCT'
85088 , p_adr_type_code => 'S'
85089 , p_component_type => l_component_type
85090 , p_component_code => l_component_code
85091 , p_component_type_code => l_component_type_code
85092 , p_component_appl_id => l_component_appl_id
85093 , p_amb_context_code => l_amb_context_code
85094 , p_entity_code => 'DEPRECIATION'
85095 , p_event_class_code => 'DEPRECIATION'
85096 , p_side => 'NA'
85097 );
85098
85099 END IF;
85100
85101 --
85102 --
85103 END IF;
85104
85105 --
85106 -- Update the line information that should be overwritten
85107 --
85108 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
85109 p_header_num => 1);
85110 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
85111
85112 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
85113
85114 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
85115 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
85116 END IF;
85117
85118 --
85119 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
85120 --
85121 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
85122 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
85123 ELSE
85124 ---------------------------------------------------------------------------------------------------
85125 -- 4262811a Switch Sign
85126 ---------------------------------------------------------------------------------------------------
85127 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
85128 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
85129 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
85130 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
85131 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
85132 -- 5132302
85133 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
85134 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
85135
85139 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
85136 END IF;
85137
85138 -- 4955764
85140 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
85141
85142
85143 XLA_AE_LINES_PKG.ValidateCurrentLine;
85144 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
85145
85146 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
85147 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
85148 ,p_balance_type_code => l_balance_type_code);
85149
85150 END IF;
85151
85152 -----------------------------------------------------------------------------------------
85153 -- 4262811 Multiperiod Accounting
85154 -----------------------------------------------------------------------------------------
85155 -- No MPA option is assigned.
85156
85157
85158 END IF;
85159 END IF;
85160 --
85161
85162 --
85163 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
85164 trace
85165 (p_msg => 'END of AcctLineType_282'
85166 ,p_level => C_LEVEL_PROCEDURE
85167 ,p_module => l_log_module);
85168 END IF;
85169 --
85170 EXCEPTION
85171 WHEN xla_exceptions_pkg.application_exception THEN
85172 RAISE;
85173 WHEN OTHERS THEN
85174 xla_exceptions_pkg.raise_message
85175 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_282');
85176 END AcctLineType_282;
85177 --
85178
85179 ---------------------------------------
85180 --
85181 -- PRIVATE FUNCTION
85182 -- AcctLineType_283
85183 --
85184 ---------------------------------------
85185 PROCEDURE AcctLineType_283 (
85186 p_application_id IN NUMBER
85187 ,p_event_id IN NUMBER
85188 ,p_calculate_acctd_flag IN VARCHAR2
85189 ,p_calculate_g_l_flag IN VARCHAR2
85190 ,p_actual_flag IN OUT VARCHAR2
85191 ,p_balance_type_code OUT VARCHAR2
85192 ,p_gain_or_loss_ref OUT VARCHAR2
85193
85194 --Period Close Date
85195 , p_source_1 IN DATE
85196 --Generated Code Combination Identifier
85197 , p_source_5 IN NUMBER
85198 --Expense Account Code Combination Identifier
85199 , p_source_31 IN NUMBER
85200 --Distribution Type Code
85201 , p_source_51 IN VARCHAR2
85202 --Currency Code
85203 , p_source_53 IN VARCHAR2
85204 --Asset Identifier
85205 , p_source_56 IN NUMBER
85206 --Period Counter
85207 , p_source_57 IN NUMBER
85208 --Distribution Identifier
85209 , p_source_58 IN NUMBER
85210 --Book Type Code
85211 , p_source_59 IN VARCHAR2
85212 --Bonus Entered Amount
85213 , p_source_61 IN NUMBER
85214 --Depreciation Run Identifier
85215 , p_source_62 IN NUMBER
85216 )
85217 IS
85218
85219 l_component_type VARCHAR2(80);
85220 l_component_code VARCHAR2(30);
85221 l_component_type_code VARCHAR2(1);
85222 l_component_appl_id INTEGER;
85223 l_amb_context_code VARCHAR2(30);
85224 l_entity_code VARCHAR2(30);
85225 l_event_class_code VARCHAR2(30);
85226 l_ae_header_id NUMBER;
85227 l_event_type_code VARCHAR2(30);
85228 l_line_definition_code VARCHAR2(30);
85229 l_line_definition_owner_code VARCHAR2(1);
85230 --
85231 -- adr variables
85232 l_segment VARCHAR2(30);
85233 l_ccid NUMBER;
85234 l_adr_transaction_coa_id NUMBER;
85235 l_adr_accounting_coa_id NUMBER;
85236 l_adr_flexfield_segment_code VARCHAR2(30);
85237 l_adr_flex_value_set_id NUMBER;
85238 l_adr_value_type_code VARCHAR2(30);
85239 l_adr_value_combination_id NUMBER;
85240 l_adr_value_segment_code VARCHAR2(30);
85241
85242 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
85243 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
85244 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
85245 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
85246
85247 -- 4262811 Variables ------------------------------------------------------------------------------------------
85248 l_entered_amt_idx NUMBER;
85249 l_accted_amt_idx NUMBER;
85250 l_acc_rev_flag VARCHAR2(1);
85251 l_accrual_line_num NUMBER;
85252 l_tmp_amt NUMBER;
85253 l_acc_rev_natural_side_code VARCHAR2(1);
85254
85255 l_num_entries NUMBER;
85256 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
85257 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
85258 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
85259 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
85260 l_recog_line_1 NUMBER;
85261 l_recog_line_2 NUMBER;
85262
85263 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
85264 l_bflow_applied_to_amt NUMBER; -- 5132302
85265 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
85266
85267 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
85268
85269 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
85273
85270 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
85271
85272 ---------------------------------------------------------------------------------------------------------------
85274
85275 --
85276 -- bulk performance
85277 --
85278 l_balance_type_code VARCHAR2(1);
85279 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
85280 l_log_module VARCHAR2(240);
85281
85282 --
85283 -- Upgrade strategy
85284 --
85285 l_actual_upg_option VARCHAR2(1);
85286 l_enc_upg_option VARCHAR2(1);
85287
85288 --
85289 BEGIN
85290 --
85291 IF g_log_enabled THEN
85292 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_283';
85293 END IF;
85294 --
85295 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
85296
85297 trace
85298 (p_msg => 'BEGIN of AcctLineType_283'
85299 ,p_level => C_LEVEL_PROCEDURE
85300 ,p_module => l_log_module);
85301
85302 END IF;
85303 --
85304 l_component_type := 'AMB_JLT';
85305 l_component_code := 'FA_PER_EXP_BAL';
85306 l_component_type_code := 'S';
85307 l_component_appl_id := 140;
85308 l_amb_context_code := 'DEFAULT';
85309 l_entity_code := 'DEPRECIATION';
85310 l_event_class_code := 'DEPRECIATION';
85311 l_event_type_code := 'DEPRECIATION_ALL';
85312 l_line_definition_owner_code := 'S';
85313 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEPRE16';
85314 --
85315 l_balance_type_code := 'A';
85316 l_segment := NULL;
85317 l_ccid := NULL;
85318 l_adr_transaction_coa_id := NULL;
85319 l_adr_accounting_coa_id := NULL;
85320 l_adr_flexfield_segment_code := NULL;
85321 l_adr_flex_value_set_id := NULL;
85322 l_adr_value_type_code := NULL;
85323 l_adr_value_combination_id := NULL;
85324 l_adr_value_segment_code := NULL;
85325
85326 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
85327 l_bflow_class_code := ''; -- 4219869 Business Flow
85328 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
85329 l_budgetary_control_flag := 'N';
85330
85331 l_bflow_applied_to_amt_idx := NULL; -- 5132302
85332 l_bflow_applied_to_amt := NULL; -- 5132302
85333 l_entered_amt_idx := NULL; -- 4262811
85334 l_accted_amt_idx := NULL; -- 4262811
85335 l_acc_rev_flag := NULL; -- 4262811
85336 l_accrual_line_num := NULL; -- 4262811
85337 l_tmp_amt := NULL; -- 4262811
85338 --
85339
85340 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
85341 l_balance_type_code <> 'B' THEN
85342 IF NVL(p_source_61,9E125) <> 0 AND
85343 NVL(p_source_51,'
85344 ') = 'DEPRN'
85345 THEN
85346
85347 --
85348 XLA_AE_LINES_PKG.SetNewLine;
85349
85350 p_balance_type_code := l_balance_type_code;
85351 -- set the flag so later we will know whether the gain loss line needs to be created
85352
85353 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
85354 p_actual_flag :='A';
85355 END IF;
85356
85357 --
85358 -- bulk performance
85359 --
85360 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
85361 p_header_num => 0); -- 4262811
85362 --
85363 -- set accounting line options
85364 --
85365 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
85366 p_natural_side_code => 'C'
85367 , p_gain_or_loss_flag => 'N'
85368 , p_gl_transfer_mode_code => 'S'
85369 , p_acct_entry_type_code => 'A'
85370 , p_switch_side_flag => 'Y'
85371 , p_merge_duplicate_code => 'N'
85372 );
85373 --
85374 l_acc_rev_natural_side_code := 'D'; -- 4262811
85375 --
85376 --
85377 -- set accounting line type info
85378 --
85379 xla_ae_lines_pkg.SetAcctLineType
85380 (p_component_type => l_component_type
85381 ,p_event_type_code => l_event_type_code
85382 ,p_line_definition_owner_code => l_line_definition_owner_code
85383 ,p_line_definition_code => l_line_definition_code
85384 ,p_accounting_line_code => l_component_code
85385 ,p_accounting_line_type_code => l_component_type_code
85386 ,p_accounting_line_appl_id => l_component_appl_id
85387 ,p_amb_context_code => l_amb_context_code
85388 ,p_entity_code => l_entity_code
85389 ,p_event_class_code => l_event_class_code);
85390 --
85391 -- set accounting class
85392 --
85393 xla_ae_lines_pkg.SetAcctClass(
85394 p_accounting_class_code => 'EXPENSE'
85395 , p_ae_header_id => l_ae_header_id
85396 );
85397
85398 --
85399 -- set rounding class
85400 --
85401 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
85402 'EXPENSE';
85403
85404 --
85405 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
85409 --
85406 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
85407 --
85408 -- bulk performance
85410 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
85411
85412 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
85413 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
85414
85415 -- 4955764
85416 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
85417 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
85418
85419 -- 4458381 Public Sector Enh
85420
85421 --
85422 -- set accounting attributes for the line type
85423 --
85424 l_entered_amt_idx := 7;
85425 l_accted_amt_idx := 9;
85426 l_bflow_applied_to_amt_idx := NULL; -- 5132302
85427 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
85428 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
85429 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
85430 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
85431 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
85432 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
85433 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
85434 l_rec_acct_attrs.array_char_value(4) := p_source_59;
85435 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
85436 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
85437 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
85438 l_rec_acct_attrs.array_char_value(6) := p_source_51;
85439 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
85440 l_rec_acct_attrs.array_num_value(7) := p_source_61;
85441 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
85442 l_rec_acct_attrs.array_char_value(8) := p_source_53;
85443 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
85444 l_rec_acct_attrs.array_num_value(9) := p_source_61;
85445
85446 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
85447 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
85448
85449 ---------------------------------------------------------------------------------------------------------------
85450 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
85451 ---------------------------------------------------------------------------------------------------------------
85452 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
85453
85454 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
85455 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
85456
85457 IF xla_accounting_cache_pkg.GetValueChar
85458 (p_source_code => 'LEDGER_CATEGORY_CODE'
85459 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
85460 AND l_bflow_method_code = 'PRIOR_ENTRY'
85461 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
85462 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
85463 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
85464 )
85465 THEN
85466 xla_ae_lines_pkg.BflowUpgEntry
85467 (p_business_method_code => l_bflow_method_code
85468 ,p_business_class_code => l_bflow_class_code
85469 ,p_balance_type => l_balance_type_code);
85470 ELSE
85471 NULL;
85472 -- No business flow processing for business flow method of NONE.
85473 END IF;
85474
85475 --
85476 -- call analytical criteria
85477 --
85478
85479 --
85480 -- call description
85481 --
85482
85483 xla_ae_lines_pkg.SetLineDescription(
85484 p_ae_header_id => l_ae_header_id
85485 ,p_description => Description_57 (
85486 p_application_id => p_application_id
85487 , p_ae_header_id => l_ae_header_id
85488 , p_source_1 => p_source_1
85489 )
85490 );
85491
85492
85493 --
85494 -- call ADRs
85495 -- Bug 4922099
85496 --
85497 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
85498 (NVL(l_actual_upg_option, 'N') = 'O') OR
85499 (NVL(l_enc_upg_option, 'N') = 'O')
85500 )
85501 THEN
85502 NULL;
85503 --
85504 --
85505
85506 l_ccid := AcctDerRule_176(
85507 p_application_id => p_application_id
85508 , p_ae_header_id => l_ae_header_id
85509 , p_source_5 => p_source_5
85510 , p_source_31 => p_source_31
85511 , x_transaction_coa_id => l_adr_transaction_coa_id
85512 , x_accounting_coa_id => l_adr_accounting_coa_id
85513 , x_value_type_code => l_adr_value_type_code
85514 , p_side => 'NA'
85515 );
85516
85517 xla_ae_lines_pkg.set_ccid(
85518 p_code_combination_id => l_ccid
85519 , p_value_type_code => l_adr_value_type_code
85520 , p_transaction_coa_id => l_adr_transaction_coa_id
85521 , p_accounting_coa_id => l_adr_accounting_coa_id
85525 , p_component_code => l_component_code
85522 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
85523 , p_adr_type_code => 'S'
85524 , p_component_type => l_component_type
85526 , p_component_type_code => l_component_type_code
85527 , p_component_appl_id => l_component_appl_id
85528 , p_amb_context_code => l_amb_context_code
85529 , p_side => 'NA'
85530 );
85531
85532
85533 --
85534 --
85535 END IF;
85536 --
85537 -- Bug 4922099
85538 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
85539 (NVL(l_enc_upg_option, 'N') = 'O')
85540 ) AND
85541 (l_bflow_method_code = 'PRIOR_ENTRY')
85542 )
85543 THEN
85544 IF
85545 --
85546 1 = 2
85547 --
85548 THEN
85549 xla_accounting_err_pkg.build_message
85550 (p_appli_s_name => 'XLA'
85551 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
85552 ,p_token_1 => 'LINE_NUMBER'
85553 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
85554 ,p_token_2 => 'LINE_TYPE_NAME'
85555 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
85556 l_component_type
85557 ,l_component_code
85558 ,l_component_type_code
85559 ,l_component_appl_id
85560 ,l_amb_context_code
85561 ,l_entity_code
85562 ,l_event_class_code
85563 )
85564 ,p_token_3 => 'OWNER'
85565 ,p_value_3 => xla_lookups_pkg.get_meaning(
85566 p_lookup_type => 'XLA_OWNER_TYPE'
85567 ,p_lookup_code => l_component_type_code
85568 )
85569 ,p_token_4 => 'PRODUCT_NAME'
85570 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
85571 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
85572 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
85573 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
85574 ,p_ae_header_id => NULL
85575 );
85576
85577 IF (C_LEVEL_ERROR>= g_log_level) THEN
85578 trace
85579 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
85580 ,p_level => C_LEVEL_ERROR
85581 ,p_module => l_log_module);
85582 END IF;
85583 END IF;
85584 END IF;
85585 --
85586 --
85587 ------------------------------------------------------------------------------------------------
85588 -- 4219869 Business Flow
85589 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
85590 -- Prior Entry. Currently, the following code is always generated.
85591 ------------------------------------------------------------------------------------------------
85592 XLA_AE_LINES_PKG.ValidateCurrentLine;
85593
85594 ------------------------------------------------------------------------------------
85595 -- 4219869 Business Flow
85596 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
85597 ------------------------------------------------------------------------------------
85598 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
85599
85600 ----------------------------------------------------------------------------------
85601 -- 4219869 Business Flow
85602 -- Update journal entry status -- Need to generate this within IF <condition>
85603 ----------------------------------------------------------------------------------
85604 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
85605 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
85606 ,p_balance_type_code => l_balance_type_code
85607 );
85608
85609 -------------------------------------------------------------------------------------------
85610 -- 4262811 - Generate the Accrual Reversal lines
85611 -------------------------------------------------------------------------------------------
85612 BEGIN
85613 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
85614 (g_array_event(p_event_id).array_value_num('header_index'));
85615 IF l_acc_rev_flag IS NULL THEN
85619 WHEN OTHERS THEN
85616 l_acc_rev_flag := 'N';
85617 END IF;
85618 EXCEPTION
85620 l_acc_rev_flag := 'N';
85621 END;
85622 --
85623 IF (l_acc_rev_flag = 'Y') THEN
85624
85625 -- 4645092 ------------------------------------------------------------------------------
85626 -- To allow MPA report to determine if it should generate report process
85627 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
85628 ------------------------------------------------------------------------------------------
85629
85630 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
85631 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
85632 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
85633 -- call ADRs
85634 -- Bug 4922099
85635 --
85636 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
85637 (NVL(l_actual_upg_option, 'N') = 'O') OR
85638 (NVL(l_enc_upg_option, 'N') = 'O')
85639 )
85640 THEN
85641 NULL;
85642 --
85643 --
85644
85645 l_ccid := AcctDerRule_176(
85646 p_application_id => p_application_id
85647 , p_ae_header_id => l_ae_header_id
85648 , p_source_5 => p_source_5
85649 , p_source_31 => p_source_31
85650 , x_transaction_coa_id => l_adr_transaction_coa_id
85651 , x_accounting_coa_id => l_adr_accounting_coa_id
85652 , x_value_type_code => l_adr_value_type_code
85653 , p_side => 'NA'
85654 );
85655
85656 xla_ae_lines_pkg.set_ccid(
85657 p_code_combination_id => l_ccid
85658 , p_value_type_code => l_adr_value_type_code
85659 , p_transaction_coa_id => l_adr_transaction_coa_id
85660 , p_accounting_coa_id => l_adr_accounting_coa_id
85661 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
85662 , p_adr_type_code => 'S'
85663 , p_component_type => l_component_type
85664 , p_component_code => l_component_code
85665 , p_component_type_code => l_component_type_code
85666 , p_component_appl_id => l_component_appl_id
85667 , p_amb_context_code => l_amb_context_code
85668 , p_side => 'NA'
85669 );
85670
85671
85672 --
85673 --
85674 END IF;
85675
85676 --
85677 -- Update the line information that should be overwritten
85678 --
85679 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
85680 p_header_num => 1);
85681 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
85682
85683 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
85684
85685 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
85686 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
85687 END IF;
85688
85689 --
85690 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
85691 --
85692 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
85693 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
85694 ELSE
85695 ---------------------------------------------------------------------------------------------------
85696 -- 4262811a Switch Sign
85697 ---------------------------------------------------------------------------------------------------
85698 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
85699 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
85700 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
85701 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
85702 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
85703 -- 5132302
85704 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
85705 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
85706
85707 END IF;
85708
85709 -- 4955764
85710 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
85711 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
85712
85713
85714 XLA_AE_LINES_PKG.ValidateCurrentLine;
85715 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
85716
85717 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
85718 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
85719 ,p_balance_type_code => l_balance_type_code);
85720
85721 END IF;
85722
85723 -----------------------------------------------------------------------------------------
85724 -- 4262811 Multiperiod Accounting
85725 -----------------------------------------------------------------------------------------
85726 -- No MPA option is assigned.
85727
85728
85729 END IF;
85733 --
85730 END IF;
85731 --
85732
85734 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
85735 trace
85736 (p_msg => 'END of AcctLineType_283'
85737 ,p_level => C_LEVEL_PROCEDURE
85738 ,p_module => l_log_module);
85739 END IF;
85740 --
85741 EXCEPTION
85742 WHEN xla_exceptions_pkg.application_exception THEN
85743 RAISE;
85744 WHEN OTHERS THEN
85745 xla_exceptions_pkg.raise_message
85746 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_283');
85747 END AcctLineType_283;
85748 --
85749
85750 ---------------------------------------
85751 --
85752 -- PRIVATE FUNCTION
85753 -- AcctLineType_284
85754 --
85755 ---------------------------------------
85756 PROCEDURE AcctLineType_284 (
85757 p_application_id IN NUMBER
85758 ,p_event_id IN NUMBER
85759 ,p_calculate_acctd_flag IN VARCHAR2
85760 ,p_calculate_g_l_flag IN VARCHAR2
85761 ,p_actual_flag IN OUT VARCHAR2
85762 ,p_balance_type_code OUT VARCHAR2
85763 ,p_gain_or_loss_ref OUT VARCHAR2
85764
85765 --Period Close Date
85766 , p_source_1 IN DATE
85767 --Generated Code Combination Identifier
85768 , p_source_5 IN NUMBER
85769 --Depreciation Reserve Account
85770 , p_source_12 IN VARCHAR2
85771 --Generated Offset Code Combination Identifier
85772 , p_source_19 IN NUMBER
85773 --Expense Account Code Combination Identifier
85774 , p_source_31 IN NUMBER
85775 --Default Code Combination Identifier
85776 , p_source_32 IN NUMBER
85777 --Distribution Type Code
85778 , p_source_51 IN VARCHAR2
85779 --Currency Code
85780 , p_source_53 IN VARCHAR2
85781 --Asset Identifier
85782 , p_source_56 IN NUMBER
85783 --Period Counter
85784 , p_source_57 IN NUMBER
85785 --Distribution Identifier
85786 , p_source_58 IN NUMBER
85787 --Book Type Code
85788 , p_source_59 IN VARCHAR2
85789 --Bonus Entered Amount
85790 , p_source_61 IN NUMBER
85791 --Depreciation Run Identifier
85792 , p_source_62 IN NUMBER
85793 )
85794 IS
85795
85796 l_component_type VARCHAR2(80);
85797 l_component_code VARCHAR2(30);
85798 l_component_type_code VARCHAR2(1);
85799 l_component_appl_id INTEGER;
85800 l_amb_context_code VARCHAR2(30);
85801 l_entity_code VARCHAR2(30);
85802 l_event_class_code VARCHAR2(30);
85803 l_ae_header_id NUMBER;
85804 l_event_type_code VARCHAR2(30);
85805 l_line_definition_code VARCHAR2(30);
85806 l_line_definition_owner_code VARCHAR2(1);
85807 --
85808 -- adr variables
85809 l_segment VARCHAR2(30);
85810 l_ccid NUMBER;
85811 l_adr_transaction_coa_id NUMBER;
85812 l_adr_accounting_coa_id NUMBER;
85813 l_adr_flexfield_segment_code VARCHAR2(30);
85814 l_adr_flex_value_set_id NUMBER;
85815 l_adr_value_type_code VARCHAR2(30);
85816 l_adr_value_combination_id NUMBER;
85817 l_adr_value_segment_code VARCHAR2(30);
85818
85819 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
85820 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
85821 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
85822 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
85823
85824 -- 4262811 Variables ------------------------------------------------------------------------------------------
85825 l_entered_amt_idx NUMBER;
85826 l_accted_amt_idx NUMBER;
85827 l_acc_rev_flag VARCHAR2(1);
85828 l_accrual_line_num NUMBER;
85829 l_tmp_amt NUMBER;
85830 l_acc_rev_natural_side_code VARCHAR2(1);
85831
85832 l_num_entries NUMBER;
85833 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
85834 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
85835 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
85836 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
85837 l_recog_line_1 NUMBER;
85838 l_recog_line_2 NUMBER;
85839
85840 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
85841 l_bflow_applied_to_amt NUMBER; -- 5132302
85842 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
85843
85844 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
85845
85846 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
85847 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
85848
85849 ---------------------------------------------------------------------------------------------------------------
85850
85851
85852 --
85853 -- bulk performance
85854 --
85855 l_balance_type_code VARCHAR2(1);
85856 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
85857 l_log_module VARCHAR2(240);
85858
85859 --
85860 -- Upgrade strategy
85861 --
85862 l_actual_upg_option VARCHAR2(1);
85863 l_enc_upg_option VARCHAR2(1);
85864
85865 --
85866 BEGIN
85867 --
85868 IF g_log_enabled THEN
85872 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
85869 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_284';
85870 END IF;
85871 --
85873
85874 trace
85875 (p_msg => 'BEGIN of AcctLineType_284'
85876 ,p_level => C_LEVEL_PROCEDURE
85877 ,p_module => l_log_module);
85878
85879 END IF;
85880 --
85881 l_component_type := 'AMB_JLT';
85882 l_component_code := 'FA_PER_RESERVE_BAL';
85883 l_component_type_code := 'S';
85884 l_component_appl_id := 140;
85885 l_amb_context_code := 'DEFAULT';
85886 l_entity_code := 'DEPRECIATION';
85887 l_event_class_code := 'DEPRECIATION';
85888 l_event_type_code := 'DEPRECIATION_ALL';
85889 l_line_definition_owner_code := 'S';
85890 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEPRE16';
85891 --
85892 l_balance_type_code := 'A';
85893 l_segment := NULL;
85894 l_ccid := NULL;
85895 l_adr_transaction_coa_id := NULL;
85896 l_adr_accounting_coa_id := NULL;
85897 l_adr_flexfield_segment_code := NULL;
85898 l_adr_flex_value_set_id := NULL;
85899 l_adr_value_type_code := NULL;
85900 l_adr_value_combination_id := NULL;
85901 l_adr_value_segment_code := NULL;
85902
85903 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
85904 l_bflow_class_code := ''; -- 4219869 Business Flow
85905 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
85906 l_budgetary_control_flag := 'N';
85907
85908 l_bflow_applied_to_amt_idx := NULL; -- 5132302
85909 l_bflow_applied_to_amt := NULL; -- 5132302
85910 l_entered_amt_idx := NULL; -- 4262811
85911 l_accted_amt_idx := NULL; -- 4262811
85912 l_acc_rev_flag := NULL; -- 4262811
85913 l_accrual_line_num := NULL; -- 4262811
85914 l_tmp_amt := NULL; -- 4262811
85915 --
85916
85917 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
85918 l_balance_type_code <> 'B' THEN
85919 IF NVL(p_source_61,9E125) <> 0 AND
85920 NVL(p_source_51,'
85921 ') = 'DEPRN'
85922 THEN
85923
85924 --
85925 XLA_AE_LINES_PKG.SetNewLine;
85926
85927 p_balance_type_code := l_balance_type_code;
85928 -- set the flag so later we will know whether the gain loss line needs to be created
85929
85930 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
85931 p_actual_flag :='A';
85932 END IF;
85933
85934 --
85935 -- bulk performance
85936 --
85937 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
85938 p_header_num => 0); -- 4262811
85939 --
85940 -- set accounting line options
85941 --
85942 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
85943 p_natural_side_code => 'D'
85944 , p_gain_or_loss_flag => 'N'
85945 , p_gl_transfer_mode_code => 'S'
85946 , p_acct_entry_type_code => 'A'
85947 , p_switch_side_flag => 'Y'
85948 , p_merge_duplicate_code => 'N'
85949 );
85950 --
85951 l_acc_rev_natural_side_code := 'C'; -- 4262811
85952 --
85953 --
85954 -- set accounting line type info
85955 --
85956 xla_ae_lines_pkg.SetAcctLineType
85957 (p_component_type => l_component_type
85958 ,p_event_type_code => l_event_type_code
85959 ,p_line_definition_owner_code => l_line_definition_owner_code
85960 ,p_line_definition_code => l_line_definition_code
85961 ,p_accounting_line_code => l_component_code
85962 ,p_accounting_line_type_code => l_component_type_code
85963 ,p_accounting_line_appl_id => l_component_appl_id
85964 ,p_amb_context_code => l_amb_context_code
85965 ,p_entity_code => l_entity_code
85966 ,p_event_class_code => l_event_class_code);
85967 --
85968 -- set accounting class
85969 --
85970 xla_ae_lines_pkg.SetAcctClass(
85971 p_accounting_class_code => 'ASSET'
85972 , p_ae_header_id => l_ae_header_id
85973 );
85974
85975 --
85976 -- set rounding class
85977 --
85978 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
85979 'ASSET';
85980
85981 --
85982 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
85983 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
85984 --
85985 -- bulk performance
85986 --
85987 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
85988
85989 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
85990 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
85991
85992 -- 4955764
85993 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
85994 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
85995
85996 -- 4458381 Public Sector Enh
86000 --
85997
85998 --
85999 -- set accounting attributes for the line type
86001 l_entered_amt_idx := 7;
86002 l_accted_amt_idx := 9;
86003 l_bflow_applied_to_amt_idx := NULL; -- 5132302
86004 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
86005 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
86006 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
86007 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
86008 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
86009 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
86010 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
86011 l_rec_acct_attrs.array_char_value(4) := p_source_59;
86012 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
86013 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
86014 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
86015 l_rec_acct_attrs.array_char_value(6) := p_source_51;
86016 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
86017 l_rec_acct_attrs.array_num_value(7) := p_source_61;
86018 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
86019 l_rec_acct_attrs.array_char_value(8) := p_source_53;
86020 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
86021 l_rec_acct_attrs.array_num_value(9) := p_source_61;
86022
86023 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
86024 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
86025
86026 ---------------------------------------------------------------------------------------------------------------
86027 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
86028 ---------------------------------------------------------------------------------------------------------------
86029 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
86030
86031 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
86032 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
86033
86034 IF xla_accounting_cache_pkg.GetValueChar
86035 (p_source_code => 'LEDGER_CATEGORY_CODE'
86036 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
86037 AND l_bflow_method_code = 'PRIOR_ENTRY'
86038 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
86039 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
86040 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
86041 )
86042 THEN
86043 xla_ae_lines_pkg.BflowUpgEntry
86044 (p_business_method_code => l_bflow_method_code
86045 ,p_business_class_code => l_bflow_class_code
86046 ,p_balance_type => l_balance_type_code);
86047 ELSE
86048 NULL;
86049 -- No business flow processing for business flow method of NONE.
86050 END IF;
86051
86052 --
86053 -- call analytical criteria
86054 --
86055
86056 --
86057 -- call description
86058 --
86059
86060 xla_ae_lines_pkg.SetLineDescription(
86061 p_ae_header_id => l_ae_header_id
86062 ,p_description => Description_59 (
86063 p_application_id => p_application_id
86064 , p_ae_header_id => l_ae_header_id
86065 , p_source_1 => p_source_1
86066 )
86067 );
86068
86069
86070 --
86071 -- call ADRs
86072 -- Bug 4922099
86073 --
86074 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
86075 (NVL(l_actual_upg_option, 'N') = 'O') OR
86076 (NVL(l_enc_upg_option, 'N') = 'O')
86077 )
86078 THEN
86079 NULL;
86080 --
86081 --
86082
86083 l_ccid := AcctDerRule_175(
86084 p_application_id => p_application_id
86085 , p_ae_header_id => l_ae_header_id
86086 , p_source_5 => p_source_5
86087 , p_source_19 => p_source_19
86088 , p_source_32 => p_source_32
86089 , x_transaction_coa_id => l_adr_transaction_coa_id
86090 , x_accounting_coa_id => l_adr_accounting_coa_id
86091 , x_value_type_code => l_adr_value_type_code
86092 , p_side => 'NA'
86093 );
86094
86095 xla_ae_lines_pkg.set_ccid(
86096 p_code_combination_id => l_ccid
86097 , p_value_type_code => l_adr_value_type_code
86098 , p_transaction_coa_id => l_adr_transaction_coa_id
86099 , p_accounting_coa_id => l_adr_accounting_coa_id
86100 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
86101 , p_adr_type_code => 'S'
86102 , p_component_type => l_component_type
86103 , p_component_code => l_component_code
86104 , p_component_type_code => l_component_type_code
86105 , p_component_appl_id => l_component_appl_id
86106 , p_amb_context_code => l_amb_context_code
86107 , p_side => 'NA'
86108 );
86109
86110
86111 l_segment := AcctDerRule_150(
86112 p_application_id => p_application_id
86113 , p_ae_header_id => l_ae_header_id
86114 , p_source_5 => p_source_5
86118 , x_flexfield_segment_code => l_adr_flexfield_segment_code
86115 , p_source_12 => p_source_12
86116 , x_transaction_coa_id => l_adr_transaction_coa_id
86117 , x_accounting_coa_id => l_adr_accounting_coa_id
86119 , x_flex_value_set_id => l_adr_flex_value_set_id
86120 , x_value_type_code => l_adr_value_type_code
86121 , x_value_combination_id => l_adr_value_combination_id
86122 , x_value_segment_code => l_adr_value_segment_code
86123 , p_side => 'NA'
86124 , p_override_seg_flag => 'Y'
86125 );
86126
86127 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
86128
86129 xla_ae_lines_pkg.set_segment(
86130 p_to_segment_code => 'GL_ACCOUNT'
86131 , p_segment_value => l_segment
86132 , p_from_segment_code => l_adr_value_segment_code
86133 , p_from_combination_id => l_adr_value_combination_id
86134 , p_value_type_code => l_adr_value_type_code
86135 , p_transaction_coa_id => l_adr_transaction_coa_id
86136 , p_accounting_coa_id => l_adr_accounting_coa_id
86137 , p_flexfield_segment_code => l_adr_flexfield_segment_code
86138 , p_flex_value_set_id => l_adr_flex_value_set_id
86139 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
86140 , p_adr_type_code => 'S'
86141 , p_component_type => l_component_type
86142 , p_component_code => l_component_code
86143 , p_component_type_code => l_component_type_code
86144 , p_component_appl_id => l_component_appl_id
86145 , p_amb_context_code => l_amb_context_code
86146 , p_entity_code => 'DEPRECIATION'
86147 , p_event_class_code => 'DEPRECIATION'
86148 , p_side => 'NA'
86149 );
86150
86151 END IF;
86152
86153 l_segment := AcctDerRule_169(
86154 p_application_id => p_application_id
86155 , p_ae_header_id => l_ae_header_id
86156 , p_source_5 => p_source_5
86157 , p_source_31 => p_source_31
86158 , x_transaction_coa_id => l_adr_transaction_coa_id
86159 , x_accounting_coa_id => l_adr_accounting_coa_id
86160 , x_flexfield_segment_code => l_adr_flexfield_segment_code
86161 , x_flex_value_set_id => l_adr_flex_value_set_id
86162 , x_value_type_code => l_adr_value_type_code
86163 , x_value_combination_id => l_adr_value_combination_id
86164 , x_value_segment_code => l_adr_value_segment_code
86165 , p_side => 'NA'
86166 , p_override_seg_flag => 'Y'
86167 );
86168
86169 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
86170
86171 xla_ae_lines_pkg.set_segment(
86172 p_to_segment_code => 'GL_BALANCING'
86173 , p_segment_value => l_segment
86174 , p_from_segment_code => l_adr_value_segment_code
86175 , p_from_combination_id => l_adr_value_combination_id
86176 , p_value_type_code => l_adr_value_type_code
86177 , p_transaction_coa_id => l_adr_transaction_coa_id
86178 , p_accounting_coa_id => l_adr_accounting_coa_id
86179 , p_flexfield_segment_code => l_adr_flexfield_segment_code
86180 , p_flex_value_set_id => l_adr_flex_value_set_id
86181 , p_adr_code => 'FA_EXPENSE_ACCT'
86182 , p_adr_type_code => 'S'
86183 , p_component_type => l_component_type
86184 , p_component_code => l_component_code
86185 , p_component_type_code => l_component_type_code
86186 , p_component_appl_id => l_component_appl_id
86187 , p_amb_context_code => l_amb_context_code
86188 , p_entity_code => 'DEPRECIATION'
86189 , p_event_class_code => 'DEPRECIATION'
86190 , p_side => 'NA'
86191 );
86192
86193 END IF;
86194
86195 --
86196 --
86197 END IF;
86198 --
86199 -- Bug 4922099
86200 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
86201 (NVL(l_enc_upg_option, 'N') = 'O')
86202 ) AND
86203 (l_bflow_method_code = 'PRIOR_ENTRY')
86204 )
86205 THEN
86206 IF
86207 --
86208 1 = 2
86209 --
86210 THEN
86211 xla_accounting_err_pkg.build_message
86212 (p_appli_s_name => 'XLA'
86213 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
86214 ,p_token_1 => 'LINE_NUMBER'
86215 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
86216 ,p_token_2 => 'LINE_TYPE_NAME'
86217 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
86218 l_component_type
86219 ,l_component_code
86220 ,l_component_type_code
86224 ,l_event_class_code
86221 ,l_component_appl_id
86222 ,l_amb_context_code
86223 ,l_entity_code
86225 )
86226 ,p_token_3 => 'OWNER'
86227 ,p_value_3 => xla_lookups_pkg.get_meaning(
86228 p_lookup_type => 'XLA_OWNER_TYPE'
86229 ,p_lookup_code => l_component_type_code
86230 )
86231 ,p_token_4 => 'PRODUCT_NAME'
86232 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
86233 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
86234 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
86235 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
86236 ,p_ae_header_id => NULL
86237 );
86238
86239 IF (C_LEVEL_ERROR>= g_log_level) THEN
86240 trace
86241 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
86242 ,p_level => C_LEVEL_ERROR
86243 ,p_module => l_log_module);
86244 END IF;
86245 END IF;
86246 END IF;
86247 --
86248 --
86249 ------------------------------------------------------------------------------------------------
86250 -- 4219869 Business Flow
86251 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
86252 -- Prior Entry. Currently, the following code is always generated.
86253 ------------------------------------------------------------------------------------------------
86254 XLA_AE_LINES_PKG.ValidateCurrentLine;
86255
86256 ------------------------------------------------------------------------------------
86257 -- 4219869 Business Flow
86258 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
86259 ------------------------------------------------------------------------------------
86260 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
86261
86262 ----------------------------------------------------------------------------------
86263 -- 4219869 Business Flow
86264 -- Update journal entry status -- Need to generate this within IF <condition>
86265 ----------------------------------------------------------------------------------
86266 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
86267 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
86268 ,p_balance_type_code => l_balance_type_code
86269 );
86270
86271 -------------------------------------------------------------------------------------------
86272 -- 4262811 - Generate the Accrual Reversal lines
86273 -------------------------------------------------------------------------------------------
86274 BEGIN
86275 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
86276 (g_array_event(p_event_id).array_value_num('header_index'));
86277 IF l_acc_rev_flag IS NULL THEN
86278 l_acc_rev_flag := 'N';
86279 END IF;
86280 EXCEPTION
86281 WHEN OTHERS THEN
86282 l_acc_rev_flag := 'N';
86283 END;
86284 --
86285 IF (l_acc_rev_flag = 'Y') THEN
86286
86287 -- 4645092 ------------------------------------------------------------------------------
86288 -- To allow MPA report to determine if it should generate report process
86289 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
86290 ------------------------------------------------------------------------------------------
86291
86292 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
86293 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
86294 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
86295 -- call ADRs
86296 -- Bug 4922099
86297 --
86298 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
86299 (NVL(l_actual_upg_option, 'N') = 'O') OR
86300 (NVL(l_enc_upg_option, 'N') = 'O')
86301 )
86302 THEN
86303 NULL;
86304 --
86305 --
86306
86307 l_ccid := AcctDerRule_175(
86308 p_application_id => p_application_id
86309 , p_ae_header_id => l_ae_header_id
86310 , p_source_5 => p_source_5
86311 , p_source_19 => p_source_19
86312 , p_source_32 => p_source_32
86313 , x_transaction_coa_id => l_adr_transaction_coa_id
86314 , x_accounting_coa_id => l_adr_accounting_coa_id
86315 , x_value_type_code => l_adr_value_type_code
86316 , p_side => 'NA'
86317 );
86318
86319 xla_ae_lines_pkg.set_ccid(
86320 p_code_combination_id => l_ccid
86321 , p_value_type_code => l_adr_value_type_code
86325 , p_adr_type_code => 'S'
86322 , p_transaction_coa_id => l_adr_transaction_coa_id
86323 , p_accounting_coa_id => l_adr_accounting_coa_id
86324 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
86326 , p_component_type => l_component_type
86327 , p_component_code => l_component_code
86328 , p_component_type_code => l_component_type_code
86329 , p_component_appl_id => l_component_appl_id
86330 , p_amb_context_code => l_amb_context_code
86331 , p_side => 'NA'
86332 );
86333
86334
86335 l_segment := AcctDerRule_150(
86336 p_application_id => p_application_id
86337 , p_ae_header_id => l_ae_header_id
86338 , p_source_5 => p_source_5
86339 , p_source_12 => p_source_12
86340 , x_transaction_coa_id => l_adr_transaction_coa_id
86341 , x_accounting_coa_id => l_adr_accounting_coa_id
86342 , x_flexfield_segment_code => l_adr_flexfield_segment_code
86343 , x_flex_value_set_id => l_adr_flex_value_set_id
86344 , x_value_type_code => l_adr_value_type_code
86345 , x_value_combination_id => l_adr_value_combination_id
86346 , x_value_segment_code => l_adr_value_segment_code
86347 , p_side => 'NA'
86348 , p_override_seg_flag => 'Y'
86349 );
86350
86351 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
86352
86353 xla_ae_lines_pkg.set_segment(
86354 p_to_segment_code => 'GL_ACCOUNT'
86355 , p_segment_value => l_segment
86356 , p_from_segment_code => l_adr_value_segment_code
86357 , p_from_combination_id => l_adr_value_combination_id
86358 , p_value_type_code => l_adr_value_type_code
86359 , p_transaction_coa_id => l_adr_transaction_coa_id
86360 , p_accounting_coa_id => l_adr_accounting_coa_id
86361 , p_flexfield_segment_code => l_adr_flexfield_segment_code
86362 , p_flex_value_set_id => l_adr_flex_value_set_id
86363 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
86364 , p_adr_type_code => 'S'
86365 , p_component_type => l_component_type
86366 , p_component_code => l_component_code
86367 , p_component_type_code => l_component_type_code
86368 , p_component_appl_id => l_component_appl_id
86369 , p_amb_context_code => l_amb_context_code
86370 , p_entity_code => 'DEPRECIATION'
86371 , p_event_class_code => 'DEPRECIATION'
86372 , p_side => 'NA'
86373 );
86374
86375 END IF;
86376
86377 l_segment := AcctDerRule_169(
86378 p_application_id => p_application_id
86379 , p_ae_header_id => l_ae_header_id
86380 , p_source_5 => p_source_5
86381 , p_source_31 => p_source_31
86382 , x_transaction_coa_id => l_adr_transaction_coa_id
86383 , x_accounting_coa_id => l_adr_accounting_coa_id
86384 , x_flexfield_segment_code => l_adr_flexfield_segment_code
86385 , x_flex_value_set_id => l_adr_flex_value_set_id
86386 , x_value_type_code => l_adr_value_type_code
86387 , x_value_combination_id => l_adr_value_combination_id
86388 , x_value_segment_code => l_adr_value_segment_code
86389 , p_side => 'NA'
86390 , p_override_seg_flag => 'Y'
86391 );
86392
86393 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
86394
86395 xla_ae_lines_pkg.set_segment(
86396 p_to_segment_code => 'GL_BALANCING'
86397 , p_segment_value => l_segment
86398 , p_from_segment_code => l_adr_value_segment_code
86399 , p_from_combination_id => l_adr_value_combination_id
86400 , p_value_type_code => l_adr_value_type_code
86401 , p_transaction_coa_id => l_adr_transaction_coa_id
86402 , p_accounting_coa_id => l_adr_accounting_coa_id
86403 , p_flexfield_segment_code => l_adr_flexfield_segment_code
86404 , p_flex_value_set_id => l_adr_flex_value_set_id
86405 , p_adr_code => 'FA_EXPENSE_ACCT'
86406 , p_adr_type_code => 'S'
86407 , p_component_type => l_component_type
86408 , p_component_code => l_component_code
86409 , p_component_type_code => l_component_type_code
86410 , p_component_appl_id => l_component_appl_id
86411 , p_amb_context_code => l_amb_context_code
86412 , p_entity_code => 'DEPRECIATION'
86413 , p_event_class_code => 'DEPRECIATION'
86414 , p_side => 'NA'
86415 );
86416
86417 END IF;
86418
86419 --
86420 --
86421 END IF;
86422
86423 --
86424 -- Update the line information that should be overwritten
86425 --
86426 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
86427 p_header_num => 1);
86428 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
86429
86430 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
86431
86432 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
86436 --
86433 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
86434 END IF;
86435
86437 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
86438 --
86439 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
86440 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
86441 ELSE
86442 ---------------------------------------------------------------------------------------------------
86443 -- 4262811a Switch Sign
86444 ---------------------------------------------------------------------------------------------------
86445 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
86446 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
86447 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
86448 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
86449 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
86450 -- 5132302
86451 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
86452 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
86453
86454 END IF;
86455
86456 -- 4955764
86457 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
86458 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
86459
86460
86461 XLA_AE_LINES_PKG.ValidateCurrentLine;
86462 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
86463
86464 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
86465 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
86466 ,p_balance_type_code => l_balance_type_code);
86467
86468 END IF;
86469
86470 -----------------------------------------------------------------------------------------
86471 -- 4262811 Multiperiod Accounting
86472 -----------------------------------------------------------------------------------------
86473 -- No MPA option is assigned.
86474
86475
86476 END IF;
86477 END IF;
86478 --
86479
86480 --
86481 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
86482 trace
86483 (p_msg => 'END of AcctLineType_284'
86484 ,p_level => C_LEVEL_PROCEDURE
86485 ,p_module => l_log_module);
86486 END IF;
86487 --
86488 EXCEPTION
86489 WHEN xla_exceptions_pkg.application_exception THEN
86490 RAISE;
86491 WHEN OTHERS THEN
86492 xla_exceptions_pkg.raise_message
86493 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_284');
86494 END AcctLineType_284;
86495 --
86496
86497 ---------------------------------------
86498 --
86499 -- PRIVATE FUNCTION
86500 -- AcctLineType_285
86501 --
86502 ---------------------------------------
86503 PROCEDURE AcctLineType_285 (
86504 p_application_id IN NUMBER
86505 ,p_event_id IN NUMBER
86506 ,p_calculate_acctd_flag IN VARCHAR2
86507 ,p_calculate_g_l_flag IN VARCHAR2
86508 ,p_actual_flag IN OUT VARCHAR2
86509 ,p_balance_type_code OUT VARCHAR2
86510 ,p_gain_or_loss_ref OUT VARCHAR2
86511
86512 --Period Close Date
86513 , p_source_1 IN DATE
86514 --Generated Code Combination Identifier
86515 , p_source_5 IN NUMBER
86516 --Proceeds Of Sale Clearing Account
86517 , p_source_25 IN VARCHAR2
86518 --Expense Account Code Combination Identifier
86519 , p_source_31 IN NUMBER
86520 --Default Code Combination Identifier
86521 , p_source_32 IN NUMBER
86522 --Adjustment Type
86523 , p_source_48 IN VARCHAR2
86524 --Transaction Header Identifier
86525 , p_source_49 IN NUMBER
86526 --Adjustment Line Identifier
86527 , p_source_50 IN NUMBER
86528 --Distribution Type Code
86529 , p_source_51 IN VARCHAR2
86530 --Entered Amount
86531 , p_source_52 IN NUMBER
86532 --Currency Code
86533 , p_source_53 IN VARCHAR2
86534 )
86535 IS
86536
86537 l_component_type VARCHAR2(80);
86538 l_component_code VARCHAR2(30);
86539 l_component_type_code VARCHAR2(1);
86540 l_component_appl_id INTEGER;
86541 l_amb_context_code VARCHAR2(30);
86542 l_entity_code VARCHAR2(30);
86543 l_event_class_code VARCHAR2(30);
86544 l_ae_header_id NUMBER;
86545 l_event_type_code VARCHAR2(30);
86546 l_line_definition_code VARCHAR2(30);
86547 l_line_definition_owner_code VARCHAR2(1);
86548 --
86549 -- adr variables
86550 l_segment VARCHAR2(30);
86551 l_ccid NUMBER;
86552 l_adr_transaction_coa_id NUMBER;
86553 l_adr_accounting_coa_id NUMBER;
86554 l_adr_flexfield_segment_code VARCHAR2(30);
86555 l_adr_flex_value_set_id NUMBER;
86556 l_adr_value_type_code VARCHAR2(30);
86557 l_adr_value_combination_id NUMBER;
86561 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
86558 l_adr_value_segment_code VARCHAR2(30);
86559
86560 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
86562 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
86563 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
86564
86565 -- 4262811 Variables ------------------------------------------------------------------------------------------
86566 l_entered_amt_idx NUMBER;
86567 l_accted_amt_idx NUMBER;
86568 l_acc_rev_flag VARCHAR2(1);
86569 l_accrual_line_num NUMBER;
86570 l_tmp_amt NUMBER;
86571 l_acc_rev_natural_side_code VARCHAR2(1);
86572
86573 l_num_entries NUMBER;
86574 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
86575 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
86576 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
86577 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
86578 l_recog_line_1 NUMBER;
86579 l_recog_line_2 NUMBER;
86580
86581 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
86582 l_bflow_applied_to_amt NUMBER; -- 5132302
86583 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
86584
86585 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
86586
86587 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
86588 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
86589
86590 ---------------------------------------------------------------------------------------------------------------
86591
86592
86593 --
86594 -- bulk performance
86595 --
86596 l_balance_type_code VARCHAR2(1);
86597 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
86598 l_log_module VARCHAR2(240);
86599
86600 --
86601 -- Upgrade strategy
86602 --
86603 l_actual_upg_option VARCHAR2(1);
86604 l_enc_upg_option VARCHAR2(1);
86605
86606 --
86607 BEGIN
86608 --
86609 IF g_log_enabled THEN
86610 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_285';
86611 END IF;
86612 --
86613 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
86614
86615 trace
86616 (p_msg => 'BEGIN of AcctLineType_285'
86617 ,p_level => C_LEVEL_PROCEDURE
86618 ,p_module => l_log_module);
86619
86620 END IF;
86621 --
86622 l_component_type := 'AMB_JLT';
86623 l_component_code := 'FA_PROC_OF_SALE_CLR';
86624 l_component_type_code := 'S';
86625 l_component_appl_id := 140;
86626 l_amb_context_code := 'DEFAULT';
86627 l_entity_code := 'TRANSACTIONS';
86628 l_event_class_code := 'RETIREMENTS';
86629 l_event_type_code := 'RETIREMENTS';
86630 l_line_definition_owner_code := 'S';
86631 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
86632 --
86633 l_balance_type_code := 'A';
86634 l_segment := NULL;
86635 l_ccid := NULL;
86636 l_adr_transaction_coa_id := NULL;
86637 l_adr_accounting_coa_id := NULL;
86638 l_adr_flexfield_segment_code := NULL;
86639 l_adr_flex_value_set_id := NULL;
86640 l_adr_value_type_code := NULL;
86641 l_adr_value_combination_id := NULL;
86642 l_adr_value_segment_code := NULL;
86643
86644 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
86645 l_bflow_class_code := ''; -- 4219869 Business Flow
86646 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
86647 l_budgetary_control_flag := 'N';
86648
86649 l_bflow_applied_to_amt_idx := NULL; -- 5132302
86650 l_bflow_applied_to_amt := NULL; -- 5132302
86651 l_entered_amt_idx := NULL; -- 4262811
86652 l_accted_amt_idx := NULL; -- 4262811
86653 l_acc_rev_flag := NULL; -- 4262811
86654 l_accrual_line_num := NULL; -- 4262811
86655 l_tmp_amt := NULL; -- 4262811
86656 --
86657
86658 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
86659 l_balance_type_code <> 'B' THEN
86660 IF NVL(p_source_48,'
86661 ') = 'PROCEEDS CLR'
86662 THEN
86663
86664 --
86665 XLA_AE_LINES_PKG.SetNewLine;
86666
86667 p_balance_type_code := l_balance_type_code;
86668 -- set the flag so later we will know whether the gain loss line needs to be created
86669
86670 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
86671 p_actual_flag :='A';
86672 END IF;
86673
86674 --
86675 -- bulk performance
86676 --
86677 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
86678 p_header_num => 0); -- 4262811
86679 --
86680 -- set accounting line options
86681 --
86682 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
86683 p_natural_side_code => 'D'
86684 , p_gain_or_loss_flag => 'N'
86685 , p_gl_transfer_mode_code => 'S'
86689 );
86686 , p_acct_entry_type_code => 'A'
86687 , p_switch_side_flag => 'Y'
86688 , p_merge_duplicate_code => 'N'
86690 --
86691 l_acc_rev_natural_side_code := 'C'; -- 4262811
86692 --
86693 --
86694 -- set accounting line type info
86695 --
86696 xla_ae_lines_pkg.SetAcctLineType
86697 (p_component_type => l_component_type
86698 ,p_event_type_code => l_event_type_code
86699 ,p_line_definition_owner_code => l_line_definition_owner_code
86700 ,p_line_definition_code => l_line_definition_code
86701 ,p_accounting_line_code => l_component_code
86702 ,p_accounting_line_type_code => l_component_type_code
86703 ,p_accounting_line_appl_id => l_component_appl_id
86704 ,p_amb_context_code => l_amb_context_code
86705 ,p_entity_code => l_entity_code
86706 ,p_event_class_code => l_event_class_code);
86707 --
86708 -- set accounting class
86709 --
86710 xla_ae_lines_pkg.SetAcctClass(
86711 p_accounting_class_code => 'ASSET'
86712 , p_ae_header_id => l_ae_header_id
86713 );
86714
86715 --
86716 -- set rounding class
86717 --
86718 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
86719 'ASSET';
86720
86721 --
86722 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
86723 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
86724 --
86725 -- bulk performance
86726 --
86727 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
86728
86729 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
86730 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
86731
86732 -- 4955764
86733 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
86734 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
86735
86736 -- 4458381 Public Sector Enh
86737
86738 --
86739 -- set accounting attributes for the line type
86740 --
86741 l_entered_amt_idx := 4;
86742 l_accted_amt_idx := 6;
86743 l_bflow_applied_to_amt_idx := NULL; -- 5132302
86744 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
86745 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
86746 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
86747 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
86748 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
86749 l_rec_acct_attrs.array_char_value(3) := p_source_51;
86750 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
86751 l_rec_acct_attrs.array_num_value(4) := p_source_52;
86752 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
86753 l_rec_acct_attrs.array_char_value(5) := p_source_53;
86754 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
86755 l_rec_acct_attrs.array_num_value(6) := p_source_52;
86756
86757 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
86758 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
86759
86760 ---------------------------------------------------------------------------------------------------------------
86761 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
86762 ---------------------------------------------------------------------------------------------------------------
86763 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
86764
86765 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
86766 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
86767
86768 IF xla_accounting_cache_pkg.GetValueChar
86769 (p_source_code => 'LEDGER_CATEGORY_CODE'
86770 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
86771 AND l_bflow_method_code = 'PRIOR_ENTRY'
86772 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
86773 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
86774 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
86775 )
86776 THEN
86777 xla_ae_lines_pkg.BflowUpgEntry
86778 (p_business_method_code => l_bflow_method_code
86779 ,p_business_class_code => l_bflow_class_code
86780 ,p_balance_type => l_balance_type_code);
86781 ELSE
86782 NULL;
86783 -- No business flow processing for business flow method of NONE.
86784 END IF;
86785
86786 --
86787 -- call analytical criteria
86788 --
86789
86790 --
86791 -- call description
86792 --
86793
86794 xla_ae_lines_pkg.SetLineDescription(
86795 p_ae_header_id => l_ae_header_id
86796 ,p_description => Description_88 (
86797 p_application_id => p_application_id
86798 , p_ae_header_id => l_ae_header_id
86802
86799 , p_source_1 => p_source_1
86800 )
86801 );
86803
86804 --
86805 -- call ADRs
86806 -- Bug 4922099
86807 --
86808 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
86809 (NVL(l_actual_upg_option, 'N') = 'O') OR
86810 (NVL(l_enc_upg_option, 'N') = 'O')
86811 )
86812 THEN
86813 NULL;
86814 --
86815 --
86816
86817 l_ccid := AcctDerRule_174(
86818 p_application_id => p_application_id
86819 , p_ae_header_id => l_ae_header_id
86820 , p_source_5 => p_source_5
86821 , p_source_32 => p_source_32
86822 , x_transaction_coa_id => l_adr_transaction_coa_id
86823 , x_accounting_coa_id => l_adr_accounting_coa_id
86824 , x_value_type_code => l_adr_value_type_code
86825 , p_side => 'NA'
86826 );
86827
86828 xla_ae_lines_pkg.set_ccid(
86829 p_code_combination_id => l_ccid
86830 , p_value_type_code => l_adr_value_type_code
86831 , p_transaction_coa_id => l_adr_transaction_coa_id
86832 , p_accounting_coa_id => l_adr_accounting_coa_id
86833 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
86834 , p_adr_type_code => 'S'
86835 , p_component_type => l_component_type
86836 , p_component_code => l_component_code
86837 , p_component_type_code => l_component_type_code
86838 , p_component_appl_id => l_component_appl_id
86839 , p_amb_context_code => l_amb_context_code
86840 , p_side => 'NA'
86841 );
86842
86843
86844 l_segment := AcctDerRule_169(
86845 p_application_id => p_application_id
86846 , p_ae_header_id => l_ae_header_id
86847 , p_source_5 => p_source_5
86848 , p_source_31 => p_source_31
86849 , x_transaction_coa_id => l_adr_transaction_coa_id
86850 , x_accounting_coa_id => l_adr_accounting_coa_id
86851 , x_flexfield_segment_code => l_adr_flexfield_segment_code
86852 , x_flex_value_set_id => l_adr_flex_value_set_id
86853 , x_value_type_code => l_adr_value_type_code
86854 , x_value_combination_id => l_adr_value_combination_id
86855 , x_value_segment_code => l_adr_value_segment_code
86856 , p_side => 'NA'
86857 , p_override_seg_flag => 'Y'
86858 );
86859
86860 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
86861
86862 xla_ae_lines_pkg.set_segment(
86863 p_to_segment_code => 'GL_BALANCING'
86864 , p_segment_value => l_segment
86865 , p_from_segment_code => l_adr_value_segment_code
86866 , p_from_combination_id => l_adr_value_combination_id
86867 , p_value_type_code => l_adr_value_type_code
86868 , p_transaction_coa_id => l_adr_transaction_coa_id
86869 , p_accounting_coa_id => l_adr_accounting_coa_id
86870 , p_flexfield_segment_code => l_adr_flexfield_segment_code
86871 , p_flex_value_set_id => l_adr_flex_value_set_id
86872 , p_adr_code => 'FA_EXPENSE_ACCT'
86873 , p_adr_type_code => 'S'
86874 , p_component_type => l_component_type
86875 , p_component_code => l_component_code
86876 , p_component_type_code => l_component_type_code
86877 , p_component_appl_id => l_component_appl_id
86878 , p_amb_context_code => l_amb_context_code
86879 , p_entity_code => 'TRANSACTIONS'
86880 , p_event_class_code => 'RETIREMENTS'
86881 , p_side => 'NA'
86882 );
86883
86884 END IF;
86885
86886 l_segment := AcctDerRule_162(
86887 p_application_id => p_application_id
86888 , p_ae_header_id => l_ae_header_id
86889 , p_source_5 => p_source_5
86890 , p_source_25 => p_source_25
86891 , x_transaction_coa_id => l_adr_transaction_coa_id
86892 , x_accounting_coa_id => l_adr_accounting_coa_id
86893 , x_flexfield_segment_code => l_adr_flexfield_segment_code
86894 , x_flex_value_set_id => l_adr_flex_value_set_id
86895 , x_value_type_code => l_adr_value_type_code
86896 , x_value_combination_id => l_adr_value_combination_id
86897 , x_value_segment_code => l_adr_value_segment_code
86898 , p_side => 'NA'
86899 , p_override_seg_flag => 'Y'
86900 );
86901
86902 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
86903
86904 xla_ae_lines_pkg.set_segment(
86905 p_to_segment_code => 'GL_ACCOUNT'
86906 , p_segment_value => l_segment
86907 , p_from_segment_code => l_adr_value_segment_code
86908 , p_from_combination_id => l_adr_value_combination_id
86909 , p_value_type_code => l_adr_value_type_code
86910 , p_transaction_coa_id => l_adr_transaction_coa_id
86911 , p_accounting_coa_id => l_adr_accounting_coa_id
86912 , p_flexfield_segment_code => l_adr_flexfield_segment_code
86913 , p_flex_value_set_id => l_adr_flex_value_set_id
86914 , p_adr_code => 'FA_PROC_OF_SALE_CLR_SEGMENT'
86915 , p_adr_type_code => 'S'
86919 , p_component_appl_id => l_component_appl_id
86916 , p_component_type => l_component_type
86917 , p_component_code => l_component_code
86918 , p_component_type_code => l_component_type_code
86920 , p_amb_context_code => l_amb_context_code
86921 , p_entity_code => 'TRANSACTIONS'
86922 , p_event_class_code => 'RETIREMENTS'
86923 , p_side => 'NA'
86924 );
86925
86926 END IF;
86927
86928 --
86929 --
86930 END IF;
86931 --
86932 -- Bug 4922099
86933 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
86934 (NVL(l_enc_upg_option, 'N') = 'O')
86935 ) AND
86936 (l_bflow_method_code = 'PRIOR_ENTRY')
86937 )
86938 THEN
86939 IF
86940 --
86941 1 = 2
86942 --
86943 THEN
86944 xla_accounting_err_pkg.build_message
86945 (p_appli_s_name => 'XLA'
86946 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
86947 ,p_token_1 => 'LINE_NUMBER'
86948 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
86949 ,p_token_2 => 'LINE_TYPE_NAME'
86950 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
86951 l_component_type
86952 ,l_component_code
86953 ,l_component_type_code
86954 ,l_component_appl_id
86955 ,l_amb_context_code
86956 ,l_entity_code
86957 ,l_event_class_code
86958 )
86959 ,p_token_3 => 'OWNER'
86960 ,p_value_3 => xla_lookups_pkg.get_meaning(
86961 p_lookup_type => 'XLA_OWNER_TYPE'
86962 ,p_lookup_code => l_component_type_code
86963 )
86964 ,p_token_4 => 'PRODUCT_NAME'
86965 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
86966 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
86967 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
86968 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
86969 ,p_ae_header_id => NULL
86970 );
86971
86972 IF (C_LEVEL_ERROR>= g_log_level) THEN
86973 trace
86974 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
86975 ,p_level => C_LEVEL_ERROR
86976 ,p_module => l_log_module);
86977 END IF;
86978 END IF;
86979 END IF;
86980 --
86981 --
86982 ------------------------------------------------------------------------------------------------
86983 -- 4219869 Business Flow
86984 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
86985 -- Prior Entry. Currently, the following code is always generated.
86986 ------------------------------------------------------------------------------------------------
86987 XLA_AE_LINES_PKG.ValidateCurrentLine;
86988
86989 ------------------------------------------------------------------------------------
86990 -- 4219869 Business Flow
86991 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
86992 ------------------------------------------------------------------------------------
86993 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
86994
86995 ----------------------------------------------------------------------------------
86996 -- 4219869 Business Flow
86997 -- Update journal entry status -- Need to generate this within IF <condition>
86998 ----------------------------------------------------------------------------------
86999 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
87000 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
87001 ,p_balance_type_code => l_balance_type_code
87002 );
87003
87004 -------------------------------------------------------------------------------------------
87005 -- 4262811 - Generate the Accrual Reversal lines
87006 -------------------------------------------------------------------------------------------
87007 BEGIN
87008 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
87009 (g_array_event(p_event_id).array_value_num('header_index'));
87010 IF l_acc_rev_flag IS NULL THEN
87011 l_acc_rev_flag := 'N';
87012 END IF;
87013 EXCEPTION
87017 --
87014 WHEN OTHERS THEN
87015 l_acc_rev_flag := 'N';
87016 END;
87018 IF (l_acc_rev_flag = 'Y') THEN
87019
87020 -- 4645092 ------------------------------------------------------------------------------
87021 -- To allow MPA report to determine if it should generate report process
87022 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
87023 ------------------------------------------------------------------------------------------
87024
87025 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
87026 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
87027 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
87028 -- call ADRs
87029 -- Bug 4922099
87030 --
87031 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
87032 (NVL(l_actual_upg_option, 'N') = 'O') OR
87033 (NVL(l_enc_upg_option, 'N') = 'O')
87034 )
87035 THEN
87036 NULL;
87037 --
87038 --
87039
87040 l_ccid := AcctDerRule_174(
87041 p_application_id => p_application_id
87042 , p_ae_header_id => l_ae_header_id
87043 , p_source_5 => p_source_5
87044 , p_source_32 => p_source_32
87045 , x_transaction_coa_id => l_adr_transaction_coa_id
87046 , x_accounting_coa_id => l_adr_accounting_coa_id
87047 , x_value_type_code => l_adr_value_type_code
87048 , p_side => 'NA'
87049 );
87050
87051 xla_ae_lines_pkg.set_ccid(
87052 p_code_combination_id => l_ccid
87053 , p_value_type_code => l_adr_value_type_code
87054 , p_transaction_coa_id => l_adr_transaction_coa_id
87055 , p_accounting_coa_id => l_adr_accounting_coa_id
87056 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
87057 , p_adr_type_code => 'S'
87058 , p_component_type => l_component_type
87059 , p_component_code => l_component_code
87060 , p_component_type_code => l_component_type_code
87061 , p_component_appl_id => l_component_appl_id
87062 , p_amb_context_code => l_amb_context_code
87063 , p_side => 'NA'
87064 );
87065
87066
87067 l_segment := AcctDerRule_169(
87068 p_application_id => p_application_id
87069 , p_ae_header_id => l_ae_header_id
87070 , p_source_5 => p_source_5
87071 , p_source_31 => p_source_31
87072 , x_transaction_coa_id => l_adr_transaction_coa_id
87073 , x_accounting_coa_id => l_adr_accounting_coa_id
87074 , x_flexfield_segment_code => l_adr_flexfield_segment_code
87075 , x_flex_value_set_id => l_adr_flex_value_set_id
87076 , x_value_type_code => l_adr_value_type_code
87077 , x_value_combination_id => l_adr_value_combination_id
87078 , x_value_segment_code => l_adr_value_segment_code
87079 , p_side => 'NA'
87080 , p_override_seg_flag => 'Y'
87081 );
87082
87083 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
87084
87085 xla_ae_lines_pkg.set_segment(
87086 p_to_segment_code => 'GL_BALANCING'
87087 , p_segment_value => l_segment
87088 , p_from_segment_code => l_adr_value_segment_code
87089 , p_from_combination_id => l_adr_value_combination_id
87090 , p_value_type_code => l_adr_value_type_code
87091 , p_transaction_coa_id => l_adr_transaction_coa_id
87092 , p_accounting_coa_id => l_adr_accounting_coa_id
87093 , p_flexfield_segment_code => l_adr_flexfield_segment_code
87094 , p_flex_value_set_id => l_adr_flex_value_set_id
87095 , p_adr_code => 'FA_EXPENSE_ACCT'
87096 , p_adr_type_code => 'S'
87097 , p_component_type => l_component_type
87098 , p_component_code => l_component_code
87099 , p_component_type_code => l_component_type_code
87100 , p_component_appl_id => l_component_appl_id
87101 , p_amb_context_code => l_amb_context_code
87102 , p_entity_code => 'TRANSACTIONS'
87103 , p_event_class_code => 'RETIREMENTS'
87104 , p_side => 'NA'
87105 );
87106
87107 END IF;
87108
87109 l_segment := AcctDerRule_162(
87110 p_application_id => p_application_id
87111 , p_ae_header_id => l_ae_header_id
87112 , p_source_5 => p_source_5
87113 , p_source_25 => p_source_25
87114 , x_transaction_coa_id => l_adr_transaction_coa_id
87115 , x_accounting_coa_id => l_adr_accounting_coa_id
87116 , x_flexfield_segment_code => l_adr_flexfield_segment_code
87117 , x_flex_value_set_id => l_adr_flex_value_set_id
87118 , x_value_type_code => l_adr_value_type_code
87119 , x_value_combination_id => l_adr_value_combination_id
87120 , x_value_segment_code => l_adr_value_segment_code
87121 , p_side => 'NA'
87122 , p_override_seg_flag => 'Y'
87123 );
87124
87125 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
87126
87127 xla_ae_lines_pkg.set_segment(
87128 p_to_segment_code => 'GL_ACCOUNT'
87132 , p_value_type_code => l_adr_value_type_code
87129 , p_segment_value => l_segment
87130 , p_from_segment_code => l_adr_value_segment_code
87131 , p_from_combination_id => l_adr_value_combination_id
87133 , p_transaction_coa_id => l_adr_transaction_coa_id
87134 , p_accounting_coa_id => l_adr_accounting_coa_id
87135 , p_flexfield_segment_code => l_adr_flexfield_segment_code
87136 , p_flex_value_set_id => l_adr_flex_value_set_id
87137 , p_adr_code => 'FA_PROC_OF_SALE_CLR_SEGMENT'
87138 , p_adr_type_code => 'S'
87139 , p_component_type => l_component_type
87140 , p_component_code => l_component_code
87141 , p_component_type_code => l_component_type_code
87142 , p_component_appl_id => l_component_appl_id
87143 , p_amb_context_code => l_amb_context_code
87144 , p_entity_code => 'TRANSACTIONS'
87145 , p_event_class_code => 'RETIREMENTS'
87146 , p_side => 'NA'
87147 );
87148
87149 END IF;
87150
87151 --
87152 --
87153 END IF;
87154
87155 --
87156 -- Update the line information that should be overwritten
87157 --
87158 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
87159 p_header_num => 1);
87160 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
87161
87162 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
87163
87164 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
87165 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
87166 END IF;
87167
87168 --
87169 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
87170 --
87171 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
87172 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
87173 ELSE
87174 ---------------------------------------------------------------------------------------------------
87175 -- 4262811a Switch Sign
87176 ---------------------------------------------------------------------------------------------------
87177 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
87178 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
87179 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
87180 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
87181 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
87182 -- 5132302
87183 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
87184 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
87185
87186 END IF;
87187
87188 -- 4955764
87189 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
87190 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
87191
87192
87193 XLA_AE_LINES_PKG.ValidateCurrentLine;
87194 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
87195
87196 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
87197 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
87198 ,p_balance_type_code => l_balance_type_code);
87199
87200 END IF;
87201
87202 -----------------------------------------------------------------------------------------
87203 -- 4262811 Multiperiod Accounting
87204 -----------------------------------------------------------------------------------------
87205 -- No MPA option is assigned.
87206
87207
87208 END IF;
87209 END IF;
87210 --
87211
87212 --
87213 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
87214 trace
87215 (p_msg => 'END of AcctLineType_285'
87216 ,p_level => C_LEVEL_PROCEDURE
87217 ,p_module => l_log_module);
87218 END IF;
87219 --
87220 EXCEPTION
87221 WHEN xla_exceptions_pkg.application_exception THEN
87222 RAISE;
87223 WHEN OTHERS THEN
87224 xla_exceptions_pkg.raise_message
87225 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_285');
87226 END AcctLineType_285;
87227 --
87228
87229 ---------------------------------------
87230 --
87231 -- PRIVATE FUNCTION
87232 -- AcctLineType_286
87233 --
87234 ---------------------------------------
87235 PROCEDURE AcctLineType_286 (
87236 p_application_id IN NUMBER
87237 ,p_event_id IN NUMBER
87238 ,p_calculate_acctd_flag IN VARCHAR2
87239 ,p_calculate_g_l_flag IN VARCHAR2
87240 ,p_actual_flag IN OUT VARCHAR2
87241 ,p_balance_type_code OUT VARCHAR2
87242 ,p_gain_or_loss_ref OUT VARCHAR2
87243
87244 --Period Close Date
87245 , p_source_1 IN DATE
87249 , p_source_25 IN VARCHAR2
87246 --Generated Code Combination Identifier
87247 , p_source_5 IN NUMBER
87248 --Proceeds Of Sale Clearing Account
87250 --Expense Account Code Combination Identifier
87251 , p_source_31 IN NUMBER
87252 --Default Code Combination Identifier
87253 , p_source_32 IN NUMBER
87254 --Adjustment Type
87255 , p_source_48 IN VARCHAR2
87256 --Transaction Header Identifier
87257 , p_source_49 IN NUMBER
87258 --Adjustment Line Identifier
87259 , p_source_50 IN NUMBER
87260 --Distribution Type Code
87261 , p_source_51 IN VARCHAR2
87262 --Entered Amount
87263 , p_source_52 IN NUMBER
87264 --Currency Code
87265 , p_source_53 IN VARCHAR2
87266 )
87267 IS
87268
87269 l_component_type VARCHAR2(80);
87270 l_component_code VARCHAR2(30);
87271 l_component_type_code VARCHAR2(1);
87272 l_component_appl_id INTEGER;
87273 l_amb_context_code VARCHAR2(30);
87274 l_entity_code VARCHAR2(30);
87275 l_event_class_code VARCHAR2(30);
87276 l_ae_header_id NUMBER;
87277 l_event_type_code VARCHAR2(30);
87278 l_line_definition_code VARCHAR2(30);
87279 l_line_definition_owner_code VARCHAR2(1);
87280 --
87281 -- adr variables
87282 l_segment VARCHAR2(30);
87283 l_ccid NUMBER;
87284 l_adr_transaction_coa_id NUMBER;
87285 l_adr_accounting_coa_id NUMBER;
87286 l_adr_flexfield_segment_code VARCHAR2(30);
87287 l_adr_flex_value_set_id NUMBER;
87288 l_adr_value_type_code VARCHAR2(30);
87289 l_adr_value_combination_id NUMBER;
87290 l_adr_value_segment_code VARCHAR2(30);
87291
87292 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
87293 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
87294 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
87295 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
87296
87297 -- 4262811 Variables ------------------------------------------------------------------------------------------
87298 l_entered_amt_idx NUMBER;
87299 l_accted_amt_idx NUMBER;
87300 l_acc_rev_flag VARCHAR2(1);
87301 l_accrual_line_num NUMBER;
87302 l_tmp_amt NUMBER;
87303 l_acc_rev_natural_side_code VARCHAR2(1);
87304
87305 l_num_entries NUMBER;
87306 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
87307 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
87308 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
87309 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
87310 l_recog_line_1 NUMBER;
87311 l_recog_line_2 NUMBER;
87312
87313 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
87314 l_bflow_applied_to_amt NUMBER; -- 5132302
87315 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
87316
87317 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
87318
87319 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
87320 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
87321
87322 ---------------------------------------------------------------------------------------------------------------
87323
87324
87325 --
87326 -- bulk performance
87327 --
87328 l_balance_type_code VARCHAR2(1);
87329 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
87330 l_log_module VARCHAR2(240);
87331
87332 --
87333 -- Upgrade strategy
87334 --
87335 l_actual_upg_option VARCHAR2(1);
87336 l_enc_upg_option VARCHAR2(1);
87337
87338 --
87339 BEGIN
87340 --
87341 IF g_log_enabled THEN
87342 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_286';
87343 END IF;
87344 --
87345 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
87346
87347 trace
87348 (p_msg => 'BEGIN of AcctLineType_286'
87349 ,p_level => C_LEVEL_PROCEDURE
87350 ,p_module => l_log_module);
87351
87352 END IF;
87353 --
87354 l_component_type := 'AMB_JLT';
87355 l_component_code := 'FA_PROC_OF_SALE_CLR';
87356 l_component_type_code := 'S';
87357 l_component_appl_id := 140;
87358 l_amb_context_code := 'DEFAULT';
87359 l_entity_code := 'TRANSACTIONS';
87360 l_event_class_code := 'RETIREMENTS';
87361 l_event_type_code := 'REINSTATEMENTS';
87362 l_line_definition_owner_code := 'S';
87363 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
87364 --
87365 l_balance_type_code := 'A';
87366 l_segment := NULL;
87367 l_ccid := NULL;
87368 l_adr_transaction_coa_id := NULL;
87369 l_adr_accounting_coa_id := NULL;
87370 l_adr_flexfield_segment_code := NULL;
87371 l_adr_flex_value_set_id := NULL;
87372 l_adr_value_type_code := NULL;
87373 l_adr_value_combination_id := NULL;
87374 l_adr_value_segment_code := NULL;
87378 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
87375
87376 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
87377 l_bflow_class_code := ''; -- 4219869 Business Flow
87379 l_budgetary_control_flag := 'N';
87380
87381 l_bflow_applied_to_amt_idx := NULL; -- 5132302
87382 l_bflow_applied_to_amt := NULL; -- 5132302
87383 l_entered_amt_idx := NULL; -- 4262811
87384 l_accted_amt_idx := NULL; -- 4262811
87385 l_acc_rev_flag := NULL; -- 4262811
87386 l_accrual_line_num := NULL; -- 4262811
87387 l_tmp_amt := NULL; -- 4262811
87388 --
87389
87390 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
87391 l_balance_type_code <> 'B' THEN
87392 IF NVL(p_source_48,'
87393 ') = 'PROCEEDS CLR'
87394 THEN
87395
87396 --
87397 XLA_AE_LINES_PKG.SetNewLine;
87398
87399 p_balance_type_code := l_balance_type_code;
87400 -- set the flag so later we will know whether the gain loss line needs to be created
87401
87402 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
87403 p_actual_flag :='A';
87404 END IF;
87405
87406 --
87407 -- bulk performance
87408 --
87409 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
87410 p_header_num => 0); -- 4262811
87411 --
87412 -- set accounting line options
87413 --
87414 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
87415 p_natural_side_code => 'D'
87416 , p_gain_or_loss_flag => 'N'
87417 , p_gl_transfer_mode_code => 'S'
87418 , p_acct_entry_type_code => 'A'
87419 , p_switch_side_flag => 'Y'
87420 , p_merge_duplicate_code => 'N'
87421 );
87422 --
87423 l_acc_rev_natural_side_code := 'C'; -- 4262811
87424 --
87425 --
87426 -- set accounting line type info
87427 --
87428 xla_ae_lines_pkg.SetAcctLineType
87429 (p_component_type => l_component_type
87430 ,p_event_type_code => l_event_type_code
87431 ,p_line_definition_owner_code => l_line_definition_owner_code
87432 ,p_line_definition_code => l_line_definition_code
87433 ,p_accounting_line_code => l_component_code
87434 ,p_accounting_line_type_code => l_component_type_code
87435 ,p_accounting_line_appl_id => l_component_appl_id
87436 ,p_amb_context_code => l_amb_context_code
87437 ,p_entity_code => l_entity_code
87438 ,p_event_class_code => l_event_class_code);
87439 --
87440 -- set accounting class
87441 --
87442 xla_ae_lines_pkg.SetAcctClass(
87443 p_accounting_class_code => 'ASSET'
87444 , p_ae_header_id => l_ae_header_id
87445 );
87446
87447 --
87448 -- set rounding class
87449 --
87450 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
87451 'ASSET';
87452
87453 --
87454 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
87455 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
87456 --
87457 -- bulk performance
87458 --
87459 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
87460
87461 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
87462 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
87463
87464 -- 4955764
87465 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
87466 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
87467
87468 -- 4458381 Public Sector Enh
87469
87470 --
87471 -- set accounting attributes for the line type
87472 --
87473 l_entered_amt_idx := 4;
87474 l_accted_amt_idx := 6;
87475 l_bflow_applied_to_amt_idx := NULL; -- 5132302
87476 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
87477 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
87478 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
87479 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
87480 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
87481 l_rec_acct_attrs.array_char_value(3) := p_source_51;
87482 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
87483 l_rec_acct_attrs.array_num_value(4) := p_source_52;
87484 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
87485 l_rec_acct_attrs.array_char_value(5) := p_source_53;
87486 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
87487 l_rec_acct_attrs.array_num_value(6) := p_source_52;
87488
87489 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
87490 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
87491
87492 ---------------------------------------------------------------------------------------------------------------
87493 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
87497 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
87494 ---------------------------------------------------------------------------------------------------------------
87495 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
87496
87498 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
87499
87500 IF xla_accounting_cache_pkg.GetValueChar
87501 (p_source_code => 'LEDGER_CATEGORY_CODE'
87502 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
87503 AND l_bflow_method_code = 'PRIOR_ENTRY'
87504 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
87505 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
87506 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
87507 )
87508 THEN
87509 xla_ae_lines_pkg.BflowUpgEntry
87510 (p_business_method_code => l_bflow_method_code
87511 ,p_business_class_code => l_bflow_class_code
87512 ,p_balance_type => l_balance_type_code);
87513 ELSE
87514 NULL;
87515 -- No business flow processing for business flow method of NONE.
87516 END IF;
87517
87518 --
87519 -- call analytical criteria
87520 --
87521
87522 --
87523 -- call description
87524 --
87525
87526 xla_ae_lines_pkg.SetLineDescription(
87527 p_ae_header_id => l_ae_header_id
87528 ,p_description => Description_88 (
87529 p_application_id => p_application_id
87530 , p_ae_header_id => l_ae_header_id
87531 , p_source_1 => p_source_1
87532 )
87533 );
87534
87535
87536 --
87537 -- call ADRs
87538 -- Bug 4922099
87539 --
87540 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
87541 (NVL(l_actual_upg_option, 'N') = 'O') OR
87542 (NVL(l_enc_upg_option, 'N') = 'O')
87543 )
87544 THEN
87545 NULL;
87546 --
87547 --
87548
87549 l_ccid := AcctDerRule_174(
87550 p_application_id => p_application_id
87551 , p_ae_header_id => l_ae_header_id
87552 , p_source_5 => p_source_5
87553 , p_source_32 => p_source_32
87554 , x_transaction_coa_id => l_adr_transaction_coa_id
87555 , x_accounting_coa_id => l_adr_accounting_coa_id
87556 , x_value_type_code => l_adr_value_type_code
87557 , p_side => 'NA'
87558 );
87559
87560 xla_ae_lines_pkg.set_ccid(
87561 p_code_combination_id => l_ccid
87562 , p_value_type_code => l_adr_value_type_code
87563 , p_transaction_coa_id => l_adr_transaction_coa_id
87564 , p_accounting_coa_id => l_adr_accounting_coa_id
87565 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
87566 , p_adr_type_code => 'S'
87567 , p_component_type => l_component_type
87568 , p_component_code => l_component_code
87569 , p_component_type_code => l_component_type_code
87570 , p_component_appl_id => l_component_appl_id
87571 , p_amb_context_code => l_amb_context_code
87572 , p_side => 'NA'
87573 );
87574
87575
87576 l_segment := AcctDerRule_169(
87577 p_application_id => p_application_id
87578 , p_ae_header_id => l_ae_header_id
87579 , p_source_5 => p_source_5
87580 , p_source_31 => p_source_31
87581 , x_transaction_coa_id => l_adr_transaction_coa_id
87582 , x_accounting_coa_id => l_adr_accounting_coa_id
87583 , x_flexfield_segment_code => l_adr_flexfield_segment_code
87584 , x_flex_value_set_id => l_adr_flex_value_set_id
87585 , x_value_type_code => l_adr_value_type_code
87586 , x_value_combination_id => l_adr_value_combination_id
87587 , x_value_segment_code => l_adr_value_segment_code
87588 , p_side => 'NA'
87589 , p_override_seg_flag => 'Y'
87590 );
87591
87592 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
87593
87594 xla_ae_lines_pkg.set_segment(
87595 p_to_segment_code => 'GL_BALANCING'
87596 , p_segment_value => l_segment
87597 , p_from_segment_code => l_adr_value_segment_code
87598 , p_from_combination_id => l_adr_value_combination_id
87599 , p_value_type_code => l_adr_value_type_code
87600 , p_transaction_coa_id => l_adr_transaction_coa_id
87601 , p_accounting_coa_id => l_adr_accounting_coa_id
87602 , p_flexfield_segment_code => l_adr_flexfield_segment_code
87603 , p_flex_value_set_id => l_adr_flex_value_set_id
87604 , p_adr_code => 'FA_EXPENSE_ACCT'
87605 , p_adr_type_code => 'S'
87606 , p_component_type => l_component_type
87607 , p_component_code => l_component_code
87608 , p_component_type_code => l_component_type_code
87609 , p_component_appl_id => l_component_appl_id
87610 , p_amb_context_code => l_amb_context_code
87611 , p_entity_code => 'TRANSACTIONS'
87612 , p_event_class_code => 'RETIREMENTS'
87613 , p_side => 'NA'
87614 );
87618 l_segment := AcctDerRule_162(
87615
87616 END IF;
87617
87619 p_application_id => p_application_id
87620 , p_ae_header_id => l_ae_header_id
87621 , p_source_5 => p_source_5
87622 , p_source_25 => p_source_25
87623 , x_transaction_coa_id => l_adr_transaction_coa_id
87624 , x_accounting_coa_id => l_adr_accounting_coa_id
87625 , x_flexfield_segment_code => l_adr_flexfield_segment_code
87626 , x_flex_value_set_id => l_adr_flex_value_set_id
87627 , x_value_type_code => l_adr_value_type_code
87628 , x_value_combination_id => l_adr_value_combination_id
87629 , x_value_segment_code => l_adr_value_segment_code
87630 , p_side => 'NA'
87631 , p_override_seg_flag => 'Y'
87632 );
87633
87634 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
87635
87636 xla_ae_lines_pkg.set_segment(
87637 p_to_segment_code => 'GL_ACCOUNT'
87638 , p_segment_value => l_segment
87639 , p_from_segment_code => l_adr_value_segment_code
87640 , p_from_combination_id => l_adr_value_combination_id
87641 , p_value_type_code => l_adr_value_type_code
87642 , p_transaction_coa_id => l_adr_transaction_coa_id
87643 , p_accounting_coa_id => l_adr_accounting_coa_id
87644 , p_flexfield_segment_code => l_adr_flexfield_segment_code
87645 , p_flex_value_set_id => l_adr_flex_value_set_id
87646 , p_adr_code => 'FA_PROC_OF_SALE_CLR_SEGMENT'
87647 , p_adr_type_code => 'S'
87648 , p_component_type => l_component_type
87649 , p_component_code => l_component_code
87650 , p_component_type_code => l_component_type_code
87651 , p_component_appl_id => l_component_appl_id
87652 , p_amb_context_code => l_amb_context_code
87653 , p_entity_code => 'TRANSACTIONS'
87654 , p_event_class_code => 'RETIREMENTS'
87655 , p_side => 'NA'
87656 );
87657
87658 END IF;
87659
87660 --
87661 --
87662 END IF;
87663 --
87664 -- Bug 4922099
87665 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
87666 (NVL(l_enc_upg_option, 'N') = 'O')
87667 ) AND
87668 (l_bflow_method_code = 'PRIOR_ENTRY')
87669 )
87670 THEN
87671 IF
87672 --
87673 1 = 2
87674 --
87675 THEN
87676 xla_accounting_err_pkg.build_message
87677 (p_appli_s_name => 'XLA'
87678 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
87679 ,p_token_1 => 'LINE_NUMBER'
87680 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
87681 ,p_token_2 => 'LINE_TYPE_NAME'
87682 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
87683 l_component_type
87684 ,l_component_code
87685 ,l_component_type_code
87686 ,l_component_appl_id
87687 ,l_amb_context_code
87688 ,l_entity_code
87689 ,l_event_class_code
87690 )
87691 ,p_token_3 => 'OWNER'
87692 ,p_value_3 => xla_lookups_pkg.get_meaning(
87693 p_lookup_type => 'XLA_OWNER_TYPE'
87694 ,p_lookup_code => l_component_type_code
87695 )
87696 ,p_token_4 => 'PRODUCT_NAME'
87697 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
87698 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
87699 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
87700 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
87701 ,p_ae_header_id => NULL
87702 );
87703
87704 IF (C_LEVEL_ERROR>= g_log_level) THEN
87705 trace
87706 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
87707 ,p_level => C_LEVEL_ERROR
87708 ,p_module => l_log_module);
87709 END IF;
87710 END IF;
87711 END IF;
87712 --
87713 --
87714 ------------------------------------------------------------------------------------------------
87715 -- 4219869 Business Flow
87719 XLA_AE_LINES_PKG.ValidateCurrentLine;
87716 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
87717 -- Prior Entry. Currently, the following code is always generated.
87718 ------------------------------------------------------------------------------------------------
87720
87721 ------------------------------------------------------------------------------------
87722 -- 4219869 Business Flow
87723 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
87724 ------------------------------------------------------------------------------------
87725 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
87726
87727 ----------------------------------------------------------------------------------
87728 -- 4219869 Business Flow
87729 -- Update journal entry status -- Need to generate this within IF <condition>
87730 ----------------------------------------------------------------------------------
87731 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
87732 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
87733 ,p_balance_type_code => l_balance_type_code
87734 );
87735
87736 -------------------------------------------------------------------------------------------
87737 -- 4262811 - Generate the Accrual Reversal lines
87738 -------------------------------------------------------------------------------------------
87739 BEGIN
87740 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
87741 (g_array_event(p_event_id).array_value_num('header_index'));
87742 IF l_acc_rev_flag IS NULL THEN
87743 l_acc_rev_flag := 'N';
87744 END IF;
87745 EXCEPTION
87746 WHEN OTHERS THEN
87747 l_acc_rev_flag := 'N';
87748 END;
87749 --
87750 IF (l_acc_rev_flag = 'Y') THEN
87751
87752 -- 4645092 ------------------------------------------------------------------------------
87753 -- To allow MPA report to determine if it should generate report process
87754 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
87755 ------------------------------------------------------------------------------------------
87756
87757 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
87758 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
87759 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
87760 -- call ADRs
87761 -- Bug 4922099
87762 --
87763 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
87764 (NVL(l_actual_upg_option, 'N') = 'O') OR
87765 (NVL(l_enc_upg_option, 'N') = 'O')
87766 )
87767 THEN
87768 NULL;
87769 --
87770 --
87771
87772 l_ccid := AcctDerRule_174(
87773 p_application_id => p_application_id
87774 , p_ae_header_id => l_ae_header_id
87775 , p_source_5 => p_source_5
87776 , p_source_32 => p_source_32
87777 , x_transaction_coa_id => l_adr_transaction_coa_id
87778 , x_accounting_coa_id => l_adr_accounting_coa_id
87779 , x_value_type_code => l_adr_value_type_code
87780 , p_side => 'NA'
87781 );
87782
87783 xla_ae_lines_pkg.set_ccid(
87784 p_code_combination_id => l_ccid
87785 , p_value_type_code => l_adr_value_type_code
87786 , p_transaction_coa_id => l_adr_transaction_coa_id
87787 , p_accounting_coa_id => l_adr_accounting_coa_id
87788 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
87789 , p_adr_type_code => 'S'
87790 , p_component_type => l_component_type
87791 , p_component_code => l_component_code
87792 , p_component_type_code => l_component_type_code
87793 , p_component_appl_id => l_component_appl_id
87794 , p_amb_context_code => l_amb_context_code
87795 , p_side => 'NA'
87796 );
87797
87798
87799 l_segment := AcctDerRule_169(
87800 p_application_id => p_application_id
87801 , p_ae_header_id => l_ae_header_id
87802 , p_source_5 => p_source_5
87803 , p_source_31 => p_source_31
87804 , x_transaction_coa_id => l_adr_transaction_coa_id
87805 , x_accounting_coa_id => l_adr_accounting_coa_id
87806 , x_flexfield_segment_code => l_adr_flexfield_segment_code
87807 , x_flex_value_set_id => l_adr_flex_value_set_id
87808 , x_value_type_code => l_adr_value_type_code
87809 , x_value_combination_id => l_adr_value_combination_id
87810 , x_value_segment_code => l_adr_value_segment_code
87811 , p_side => 'NA'
87812 , p_override_seg_flag => 'Y'
87813 );
87814
87815 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
87816
87817 xla_ae_lines_pkg.set_segment(
87818 p_to_segment_code => 'GL_BALANCING'
87819 , p_segment_value => l_segment
87820 , p_from_segment_code => l_adr_value_segment_code
87821 , p_from_combination_id => l_adr_value_combination_id
87822 , p_value_type_code => l_adr_value_type_code
87823 , p_transaction_coa_id => l_adr_transaction_coa_id
87824 , p_accounting_coa_id => l_adr_accounting_coa_id
87828 , p_adr_type_code => 'S'
87825 , p_flexfield_segment_code => l_adr_flexfield_segment_code
87826 , p_flex_value_set_id => l_adr_flex_value_set_id
87827 , p_adr_code => 'FA_EXPENSE_ACCT'
87829 , p_component_type => l_component_type
87830 , p_component_code => l_component_code
87831 , p_component_type_code => l_component_type_code
87832 , p_component_appl_id => l_component_appl_id
87833 , p_amb_context_code => l_amb_context_code
87834 , p_entity_code => 'TRANSACTIONS'
87835 , p_event_class_code => 'RETIREMENTS'
87836 , p_side => 'NA'
87837 );
87838
87839 END IF;
87840
87841 l_segment := AcctDerRule_162(
87842 p_application_id => p_application_id
87843 , p_ae_header_id => l_ae_header_id
87844 , p_source_5 => p_source_5
87845 , p_source_25 => p_source_25
87846 , x_transaction_coa_id => l_adr_transaction_coa_id
87847 , x_accounting_coa_id => l_adr_accounting_coa_id
87848 , x_flexfield_segment_code => l_adr_flexfield_segment_code
87849 , x_flex_value_set_id => l_adr_flex_value_set_id
87850 , x_value_type_code => l_adr_value_type_code
87851 , x_value_combination_id => l_adr_value_combination_id
87852 , x_value_segment_code => l_adr_value_segment_code
87853 , p_side => 'NA'
87854 , p_override_seg_flag => 'Y'
87855 );
87856
87857 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
87858
87859 xla_ae_lines_pkg.set_segment(
87860 p_to_segment_code => 'GL_ACCOUNT'
87861 , p_segment_value => l_segment
87862 , p_from_segment_code => l_adr_value_segment_code
87863 , p_from_combination_id => l_adr_value_combination_id
87864 , p_value_type_code => l_adr_value_type_code
87865 , p_transaction_coa_id => l_adr_transaction_coa_id
87866 , p_accounting_coa_id => l_adr_accounting_coa_id
87867 , p_flexfield_segment_code => l_adr_flexfield_segment_code
87868 , p_flex_value_set_id => l_adr_flex_value_set_id
87869 , p_adr_code => 'FA_PROC_OF_SALE_CLR_SEGMENT'
87870 , p_adr_type_code => 'S'
87871 , p_component_type => l_component_type
87872 , p_component_code => l_component_code
87873 , p_component_type_code => l_component_type_code
87874 , p_component_appl_id => l_component_appl_id
87875 , p_amb_context_code => l_amb_context_code
87876 , p_entity_code => 'TRANSACTIONS'
87877 , p_event_class_code => 'RETIREMENTS'
87878 , p_side => 'NA'
87879 );
87880
87881 END IF;
87882
87883 --
87884 --
87885 END IF;
87886
87887 --
87888 -- Update the line information that should be overwritten
87889 --
87890 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
87891 p_header_num => 1);
87892 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
87893
87894 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
87895
87896 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
87897 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
87898 END IF;
87899
87900 --
87901 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
87902 --
87903 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
87904 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
87905 ELSE
87906 ---------------------------------------------------------------------------------------------------
87907 -- 4262811a Switch Sign
87908 ---------------------------------------------------------------------------------------------------
87909 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
87910 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
87911 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
87912 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
87913 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
87914 -- 5132302
87915 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
87916 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
87917
87918 END IF;
87919
87920 -- 4955764
87921 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
87922 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
87923
87924
87925 XLA_AE_LINES_PKG.ValidateCurrentLine;
87926 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
87927
87931
87928 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
87929 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
87930 ,p_balance_type_code => l_balance_type_code);
87932 END IF;
87933
87934 -----------------------------------------------------------------------------------------
87935 -- 4262811 Multiperiod Accounting
87936 -----------------------------------------------------------------------------------------
87937 -- No MPA option is assigned.
87938
87939
87940 END IF;
87941 END IF;
87942 --
87943
87944 --
87945 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
87946 trace
87947 (p_msg => 'END of AcctLineType_286'
87948 ,p_level => C_LEVEL_PROCEDURE
87949 ,p_module => l_log_module);
87950 END IF;
87951 --
87952 EXCEPTION
87953 WHEN xla_exceptions_pkg.application_exception THEN
87954 RAISE;
87955 WHEN OTHERS THEN
87956 xla_exceptions_pkg.raise_message
87957 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_286');
87958 END AcctLineType_286;
87959 --
87960
87961 ---------------------------------------
87962 --
87963 -- PRIVATE FUNCTION
87964 -- AcctLineType_287
87965 --
87966 ---------------------------------------
87967 PROCEDURE AcctLineType_287 (
87968 p_application_id IN NUMBER
87969 ,p_event_id IN NUMBER
87970 ,p_calculate_acctd_flag IN VARCHAR2
87971 ,p_calculate_g_l_flag IN VARCHAR2
87972 ,p_actual_flag IN OUT VARCHAR2
87973 ,p_balance_type_code OUT VARCHAR2
87974 ,p_gain_or_loss_ref OUT VARCHAR2
87975
87976 --Period Close Date
87977 , p_source_1 IN DATE
87978 --Generated Code Combination Identifier
87979 , p_source_5 IN NUMBER
87980 --Proceeds Of Sale Gain Account
87981 , p_source_26 IN VARCHAR2
87982 --Expense Account Code Combination Identifier
87983 , p_source_31 IN NUMBER
87984 --Default Code Combination Identifier
87985 , p_source_32 IN NUMBER
87986 --Adjustment Type
87987 , p_source_48 IN VARCHAR2
87988 --Transaction Header Identifier
87989 , p_source_49 IN NUMBER
87990 --Adjustment Line Identifier
87991 , p_source_50 IN NUMBER
87992 --Distribution Type Code
87993 , p_source_51 IN VARCHAR2
87994 --Entered Amount
87995 , p_source_52 IN NUMBER
87996 --Currency Code
87997 , p_source_53 IN VARCHAR2
87998 --Gain Loss Amount
87999 , p_source_54 IN NUMBER
88000 )
88001 IS
88002
88003 l_component_type VARCHAR2(80);
88004 l_component_code VARCHAR2(30);
88005 l_component_type_code VARCHAR2(1);
88006 l_component_appl_id INTEGER;
88007 l_amb_context_code VARCHAR2(30);
88008 l_entity_code VARCHAR2(30);
88009 l_event_class_code VARCHAR2(30);
88010 l_ae_header_id NUMBER;
88011 l_event_type_code VARCHAR2(30);
88012 l_line_definition_code VARCHAR2(30);
88013 l_line_definition_owner_code VARCHAR2(1);
88014 --
88015 -- adr variables
88016 l_segment VARCHAR2(30);
88017 l_ccid NUMBER;
88018 l_adr_transaction_coa_id NUMBER;
88019 l_adr_accounting_coa_id NUMBER;
88020 l_adr_flexfield_segment_code VARCHAR2(30);
88021 l_adr_flex_value_set_id NUMBER;
88022 l_adr_value_type_code VARCHAR2(30);
88023 l_adr_value_combination_id NUMBER;
88024 l_adr_value_segment_code VARCHAR2(30);
88025
88026 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
88027 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
88028 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
88029 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
88030
88031 -- 4262811 Variables ------------------------------------------------------------------------------------------
88032 l_entered_amt_idx NUMBER;
88033 l_accted_amt_idx NUMBER;
88034 l_acc_rev_flag VARCHAR2(1);
88035 l_accrual_line_num NUMBER;
88036 l_tmp_amt NUMBER;
88037 l_acc_rev_natural_side_code VARCHAR2(1);
88038
88039 l_num_entries NUMBER;
88040 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
88041 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
88042 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
88043 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
88044 l_recog_line_1 NUMBER;
88045 l_recog_line_2 NUMBER;
88046
88047 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
88048 l_bflow_applied_to_amt NUMBER; -- 5132302
88049 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
88050
88051 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
88052
88053 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
88054 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
88055
88056 ---------------------------------------------------------------------------------------------------------------
88057
88058
88059 --
88060 -- bulk performance
88061 --
88062 l_balance_type_code VARCHAR2(1);
88066 --
88063 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
88064 l_log_module VARCHAR2(240);
88065
88067 -- Upgrade strategy
88068 --
88069 l_actual_upg_option VARCHAR2(1);
88070 l_enc_upg_option VARCHAR2(1);
88071
88072 --
88073 BEGIN
88074 --
88075 IF g_log_enabled THEN
88076 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_287';
88077 END IF;
88078 --
88079 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
88080
88081 trace
88082 (p_msg => 'BEGIN of AcctLineType_287'
88083 ,p_level => C_LEVEL_PROCEDURE
88084 ,p_module => l_log_module);
88085
88086 END IF;
88087 --
88088 l_component_type := 'AMB_JLT';
88089 l_component_code := 'FA_PROC_OF_SALE_GAIN';
88090 l_component_type_code := 'S';
88091 l_component_appl_id := 140;
88092 l_amb_context_code := 'DEFAULT';
88093 l_entity_code := 'TRANSACTIONS';
88094 l_event_class_code := 'RETIREMENTS';
88095 l_event_type_code := 'RETIREMENTS';
88096 l_line_definition_owner_code := 'S';
88097 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
88098 --
88099 l_balance_type_code := 'A';
88100 l_segment := NULL;
88101 l_ccid := NULL;
88102 l_adr_transaction_coa_id := NULL;
88103 l_adr_accounting_coa_id := NULL;
88104 l_adr_flexfield_segment_code := NULL;
88105 l_adr_flex_value_set_id := NULL;
88106 l_adr_value_type_code := NULL;
88107 l_adr_value_combination_id := NULL;
88108 l_adr_value_segment_code := NULL;
88109
88110 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
88111 l_bflow_class_code := ''; -- 4219869 Business Flow
88112 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
88113 l_budgetary_control_flag := 'N';
88114
88115 l_bflow_applied_to_amt_idx := NULL; -- 5132302
88116 l_bflow_applied_to_amt := NULL; -- 5132302
88117 l_entered_amt_idx := NULL; -- 4262811
88118 l_accted_amt_idx := NULL; -- 4262811
88119 l_acc_rev_flag := NULL; -- 4262811
88120 l_accrual_line_num := NULL; -- 4262811
88121 l_tmp_amt := NULL; -- 4262811
88122 --
88123
88124 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
88125 l_balance_type_code <> 'B' THEN
88126 IF NVL(p_source_48,'
88127 ') = 'PROCEEDS' AND
88128 p_source_54 >= 0
88129 THEN
88130
88131 --
88132 XLA_AE_LINES_PKG.SetNewLine;
88133
88134 p_balance_type_code := l_balance_type_code;
88135 -- set the flag so later we will know whether the gain loss line needs to be created
88136
88137 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
88138 p_actual_flag :='A';
88139 END IF;
88140
88141 --
88142 -- bulk performance
88143 --
88144 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
88145 p_header_num => 0); -- 4262811
88146 --
88147 -- set accounting line options
88148 --
88149 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
88150 p_natural_side_code => 'C'
88151 , p_gain_or_loss_flag => 'N'
88152 , p_gl_transfer_mode_code => 'S'
88153 , p_acct_entry_type_code => 'A'
88154 , p_switch_side_flag => 'Y'
88155 , p_merge_duplicate_code => 'N'
88156 );
88157 --
88158 l_acc_rev_natural_side_code := 'D'; -- 4262811
88159 --
88160 --
88161 -- set accounting line type info
88162 --
88163 xla_ae_lines_pkg.SetAcctLineType
88164 (p_component_type => l_component_type
88165 ,p_event_type_code => l_event_type_code
88166 ,p_line_definition_owner_code => l_line_definition_owner_code
88167 ,p_line_definition_code => l_line_definition_code
88168 ,p_accounting_line_code => l_component_code
88169 ,p_accounting_line_type_code => l_component_type_code
88170 ,p_accounting_line_appl_id => l_component_appl_id
88171 ,p_amb_context_code => l_amb_context_code
88172 ,p_entity_code => l_entity_code
88173 ,p_event_class_code => l_event_class_code);
88174 --
88175 -- set accounting class
88176 --
88177 xla_ae_lines_pkg.SetAcctClass(
88178 p_accounting_class_code => 'ASSET'
88179 , p_ae_header_id => l_ae_header_id
88180 );
88181
88182 --
88183 -- set rounding class
88184 --
88185 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
88186 'ASSET';
88187
88188 --
88189 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
88190 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
88191 --
88192 -- bulk performance
88193 --
88194 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
88195
88196 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
88200 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
88197 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
88198
88199 -- 4955764
88201 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
88202
88203 -- 4458381 Public Sector Enh
88204
88205 --
88206 -- set accounting attributes for the line type
88207 --
88208 l_entered_amt_idx := 4;
88209 l_accted_amt_idx := 6;
88210 l_bflow_applied_to_amt_idx := NULL; -- 5132302
88211 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
88212 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
88213 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
88214 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
88215 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
88216 l_rec_acct_attrs.array_char_value(3) := p_source_51;
88217 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
88218 l_rec_acct_attrs.array_num_value(4) := p_source_52;
88219 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
88220 l_rec_acct_attrs.array_char_value(5) := p_source_53;
88221 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
88222 l_rec_acct_attrs.array_num_value(6) := p_source_52;
88223
88224 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
88225 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
88226
88227 ---------------------------------------------------------------------------------------------------------------
88228 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
88229 ---------------------------------------------------------------------------------------------------------------
88230 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
88231
88232 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
88233 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
88234
88235 IF xla_accounting_cache_pkg.GetValueChar
88236 (p_source_code => 'LEDGER_CATEGORY_CODE'
88237 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
88238 AND l_bflow_method_code = 'PRIOR_ENTRY'
88239 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
88240 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
88241 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
88242 )
88243 THEN
88244 xla_ae_lines_pkg.BflowUpgEntry
88245 (p_business_method_code => l_bflow_method_code
88246 ,p_business_class_code => l_bflow_class_code
88247 ,p_balance_type => l_balance_type_code);
88248 ELSE
88249 NULL;
88250 -- No business flow processing for business flow method of NONE.
88251 END IF;
88252
88253 --
88254 -- call analytical criteria
88255 --
88256
88257 --
88258 -- call description
88259 --
88260
88261 xla_ae_lines_pkg.SetLineDescription(
88262 p_ae_header_id => l_ae_header_id
88263 ,p_description => Description_81 (
88264 p_application_id => p_application_id
88265 , p_ae_header_id => l_ae_header_id
88266 , p_source_1 => p_source_1
88267 )
88268 );
88269
88270
88271 --
88272 -- call ADRs
88273 -- Bug 4922099
88274 --
88275 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
88276 (NVL(l_actual_upg_option, 'N') = 'O') OR
88277 (NVL(l_enc_upg_option, 'N') = 'O')
88278 )
88279 THEN
88280 NULL;
88281 --
88282 --
88283
88284 l_ccid := AcctDerRule_174(
88285 p_application_id => p_application_id
88286 , p_ae_header_id => l_ae_header_id
88287 , p_source_5 => p_source_5
88288 , p_source_32 => p_source_32
88289 , x_transaction_coa_id => l_adr_transaction_coa_id
88290 , x_accounting_coa_id => l_adr_accounting_coa_id
88291 , x_value_type_code => l_adr_value_type_code
88292 , p_side => 'NA'
88293 );
88294
88295 xla_ae_lines_pkg.set_ccid(
88296 p_code_combination_id => l_ccid
88297 , p_value_type_code => l_adr_value_type_code
88298 , p_transaction_coa_id => l_adr_transaction_coa_id
88299 , p_accounting_coa_id => l_adr_accounting_coa_id
88300 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
88301 , p_adr_type_code => 'S'
88302 , p_component_type => l_component_type
88303 , p_component_code => l_component_code
88304 , p_component_type_code => l_component_type_code
88305 , p_component_appl_id => l_component_appl_id
88306 , p_amb_context_code => l_amb_context_code
88307 , p_side => 'NA'
88308 );
88309
88310
88311 l_segment := AcctDerRule_169(
88312 p_application_id => p_application_id
88313 , p_ae_header_id => l_ae_header_id
88314 , p_source_5 => p_source_5
88315 , p_source_31 => p_source_31
88316 , x_transaction_coa_id => l_adr_transaction_coa_id
88320 , x_value_type_code => l_adr_value_type_code
88317 , x_accounting_coa_id => l_adr_accounting_coa_id
88318 , x_flexfield_segment_code => l_adr_flexfield_segment_code
88319 , x_flex_value_set_id => l_adr_flex_value_set_id
88321 , x_value_combination_id => l_adr_value_combination_id
88322 , x_value_segment_code => l_adr_value_segment_code
88323 , p_side => 'NA'
88324 , p_override_seg_flag => 'Y'
88325 );
88326
88327 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
88328
88329 xla_ae_lines_pkg.set_segment(
88330 p_to_segment_code => 'GL_BALANCING'
88331 , p_segment_value => l_segment
88332 , p_from_segment_code => l_adr_value_segment_code
88333 , p_from_combination_id => l_adr_value_combination_id
88334 , p_value_type_code => l_adr_value_type_code
88335 , p_transaction_coa_id => l_adr_transaction_coa_id
88336 , p_accounting_coa_id => l_adr_accounting_coa_id
88337 , p_flexfield_segment_code => l_adr_flexfield_segment_code
88338 , p_flex_value_set_id => l_adr_flex_value_set_id
88339 , p_adr_code => 'FA_EXPENSE_ACCT'
88340 , p_adr_type_code => 'S'
88341 , p_component_type => l_component_type
88342 , p_component_code => l_component_code
88343 , p_component_type_code => l_component_type_code
88344 , p_component_appl_id => l_component_appl_id
88345 , p_amb_context_code => l_amb_context_code
88346 , p_entity_code => 'TRANSACTIONS'
88347 , p_event_class_code => 'RETIREMENTS'
88348 , p_side => 'NA'
88349 );
88350
88351 END IF;
88352
88353 l_segment := AcctDerRule_163(
88354 p_application_id => p_application_id
88355 , p_ae_header_id => l_ae_header_id
88356 , p_source_5 => p_source_5
88357 , p_source_26 => p_source_26
88358 , x_transaction_coa_id => l_adr_transaction_coa_id
88359 , x_accounting_coa_id => l_adr_accounting_coa_id
88360 , x_flexfield_segment_code => l_adr_flexfield_segment_code
88361 , x_flex_value_set_id => l_adr_flex_value_set_id
88362 , x_value_type_code => l_adr_value_type_code
88363 , x_value_combination_id => l_adr_value_combination_id
88364 , x_value_segment_code => l_adr_value_segment_code
88365 , p_side => 'NA'
88366 , p_override_seg_flag => 'Y'
88367 );
88368
88369 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
88370
88371 xla_ae_lines_pkg.set_segment(
88372 p_to_segment_code => 'GL_ACCOUNT'
88373 , p_segment_value => l_segment
88374 , p_from_segment_code => l_adr_value_segment_code
88375 , p_from_combination_id => l_adr_value_combination_id
88376 , p_value_type_code => l_adr_value_type_code
88377 , p_transaction_coa_id => l_adr_transaction_coa_id
88378 , p_accounting_coa_id => l_adr_accounting_coa_id
88379 , p_flexfield_segment_code => l_adr_flexfield_segment_code
88380 , p_flex_value_set_id => l_adr_flex_value_set_id
88381 , p_adr_code => 'FA_PROC_OF_SALE_GAIN_SEGMENT'
88382 , p_adr_type_code => 'S'
88383 , p_component_type => l_component_type
88384 , p_component_code => l_component_code
88385 , p_component_type_code => l_component_type_code
88386 , p_component_appl_id => l_component_appl_id
88387 , p_amb_context_code => l_amb_context_code
88388 , p_entity_code => 'TRANSACTIONS'
88389 , p_event_class_code => 'RETIREMENTS'
88390 , p_side => 'NA'
88391 );
88392
88393 END IF;
88394
88395 --
88396 --
88397 END IF;
88398 --
88399 -- Bug 4922099
88400 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
88401 (NVL(l_enc_upg_option, 'N') = 'O')
88402 ) AND
88403 (l_bflow_method_code = 'PRIOR_ENTRY')
88404 )
88405 THEN
88406 IF
88407 --
88408 1 = 2
88409 --
88410 THEN
88411 xla_accounting_err_pkg.build_message
88412 (p_appli_s_name => 'XLA'
88413 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
88414 ,p_token_1 => 'LINE_NUMBER'
88415 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
88416 ,p_token_2 => 'LINE_TYPE_NAME'
88417 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
88418 l_component_type
88419 ,l_component_code
88420 ,l_component_type_code
88421 ,l_component_appl_id
88425 )
88422 ,l_amb_context_code
88423 ,l_entity_code
88424 ,l_event_class_code
88426 ,p_token_3 => 'OWNER'
88427 ,p_value_3 => xla_lookups_pkg.get_meaning(
88428 p_lookup_type => 'XLA_OWNER_TYPE'
88429 ,p_lookup_code => l_component_type_code
88430 )
88431 ,p_token_4 => 'PRODUCT_NAME'
88432 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
88433 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
88434 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
88435 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
88436 ,p_ae_header_id => NULL
88437 );
88438
88439 IF (C_LEVEL_ERROR>= g_log_level) THEN
88440 trace
88441 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
88442 ,p_level => C_LEVEL_ERROR
88443 ,p_module => l_log_module);
88444 END IF;
88445 END IF;
88446 END IF;
88447 --
88448 --
88449 ------------------------------------------------------------------------------------------------
88450 -- 4219869 Business Flow
88451 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
88452 -- Prior Entry. Currently, the following code is always generated.
88453 ------------------------------------------------------------------------------------------------
88454 XLA_AE_LINES_PKG.ValidateCurrentLine;
88455
88456 ------------------------------------------------------------------------------------
88457 -- 4219869 Business Flow
88458 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
88459 ------------------------------------------------------------------------------------
88460 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
88461
88462 ----------------------------------------------------------------------------------
88463 -- 4219869 Business Flow
88464 -- Update journal entry status -- Need to generate this within IF <condition>
88465 ----------------------------------------------------------------------------------
88466 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
88467 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
88468 ,p_balance_type_code => l_balance_type_code
88469 );
88470
88471 -------------------------------------------------------------------------------------------
88472 -- 4262811 - Generate the Accrual Reversal lines
88473 -------------------------------------------------------------------------------------------
88474 BEGIN
88475 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
88476 (g_array_event(p_event_id).array_value_num('header_index'));
88477 IF l_acc_rev_flag IS NULL THEN
88478 l_acc_rev_flag := 'N';
88479 END IF;
88480 EXCEPTION
88481 WHEN OTHERS THEN
88482 l_acc_rev_flag := 'N';
88483 END;
88484 --
88485 IF (l_acc_rev_flag = 'Y') THEN
88486
88487 -- 4645092 ------------------------------------------------------------------------------
88488 -- To allow MPA report to determine if it should generate report process
88489 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
88490 ------------------------------------------------------------------------------------------
88491
88492 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
88493 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
88494 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
88495 -- call ADRs
88496 -- Bug 4922099
88497 --
88498 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
88499 (NVL(l_actual_upg_option, 'N') = 'O') OR
88500 (NVL(l_enc_upg_option, 'N') = 'O')
88501 )
88502 THEN
88503 NULL;
88504 --
88505 --
88506
88507 l_ccid := AcctDerRule_174(
88508 p_application_id => p_application_id
88509 , p_ae_header_id => l_ae_header_id
88510 , p_source_5 => p_source_5
88511 , p_source_32 => p_source_32
88512 , x_transaction_coa_id => l_adr_transaction_coa_id
88513 , x_accounting_coa_id => l_adr_accounting_coa_id
88514 , x_value_type_code => l_adr_value_type_code
88515 , p_side => 'NA'
88516 );
88517
88518 xla_ae_lines_pkg.set_ccid(
88519 p_code_combination_id => l_ccid
88520 , p_value_type_code => l_adr_value_type_code
88521 , p_transaction_coa_id => l_adr_transaction_coa_id
88525 , p_component_type => l_component_type
88522 , p_accounting_coa_id => l_adr_accounting_coa_id
88523 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
88524 , p_adr_type_code => 'S'
88526 , p_component_code => l_component_code
88527 , p_component_type_code => l_component_type_code
88528 , p_component_appl_id => l_component_appl_id
88529 , p_amb_context_code => l_amb_context_code
88530 , p_side => 'NA'
88531 );
88532
88533
88534 l_segment := AcctDerRule_169(
88535 p_application_id => p_application_id
88536 , p_ae_header_id => l_ae_header_id
88537 , p_source_5 => p_source_5
88538 , p_source_31 => p_source_31
88539 , x_transaction_coa_id => l_adr_transaction_coa_id
88540 , x_accounting_coa_id => l_adr_accounting_coa_id
88541 , x_flexfield_segment_code => l_adr_flexfield_segment_code
88542 , x_flex_value_set_id => l_adr_flex_value_set_id
88543 , x_value_type_code => l_adr_value_type_code
88544 , x_value_combination_id => l_adr_value_combination_id
88545 , x_value_segment_code => l_adr_value_segment_code
88546 , p_side => 'NA'
88547 , p_override_seg_flag => 'Y'
88548 );
88549
88550 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
88551
88552 xla_ae_lines_pkg.set_segment(
88553 p_to_segment_code => 'GL_BALANCING'
88554 , p_segment_value => l_segment
88555 , p_from_segment_code => l_adr_value_segment_code
88556 , p_from_combination_id => l_adr_value_combination_id
88557 , p_value_type_code => l_adr_value_type_code
88558 , p_transaction_coa_id => l_adr_transaction_coa_id
88559 , p_accounting_coa_id => l_adr_accounting_coa_id
88560 , p_flexfield_segment_code => l_adr_flexfield_segment_code
88561 , p_flex_value_set_id => l_adr_flex_value_set_id
88562 , p_adr_code => 'FA_EXPENSE_ACCT'
88563 , p_adr_type_code => 'S'
88564 , p_component_type => l_component_type
88565 , p_component_code => l_component_code
88566 , p_component_type_code => l_component_type_code
88567 , p_component_appl_id => l_component_appl_id
88568 , p_amb_context_code => l_amb_context_code
88569 , p_entity_code => 'TRANSACTIONS'
88570 , p_event_class_code => 'RETIREMENTS'
88571 , p_side => 'NA'
88572 );
88573
88574 END IF;
88575
88576 l_segment := AcctDerRule_163(
88577 p_application_id => p_application_id
88578 , p_ae_header_id => l_ae_header_id
88579 , p_source_5 => p_source_5
88580 , p_source_26 => p_source_26
88581 , x_transaction_coa_id => l_adr_transaction_coa_id
88582 , x_accounting_coa_id => l_adr_accounting_coa_id
88583 , x_flexfield_segment_code => l_adr_flexfield_segment_code
88584 , x_flex_value_set_id => l_adr_flex_value_set_id
88585 , x_value_type_code => l_adr_value_type_code
88586 , x_value_combination_id => l_adr_value_combination_id
88587 , x_value_segment_code => l_adr_value_segment_code
88588 , p_side => 'NA'
88589 , p_override_seg_flag => 'Y'
88590 );
88591
88592 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
88593
88594 xla_ae_lines_pkg.set_segment(
88595 p_to_segment_code => 'GL_ACCOUNT'
88596 , p_segment_value => l_segment
88597 , p_from_segment_code => l_adr_value_segment_code
88598 , p_from_combination_id => l_adr_value_combination_id
88599 , p_value_type_code => l_adr_value_type_code
88600 , p_transaction_coa_id => l_adr_transaction_coa_id
88601 , p_accounting_coa_id => l_adr_accounting_coa_id
88602 , p_flexfield_segment_code => l_adr_flexfield_segment_code
88603 , p_flex_value_set_id => l_adr_flex_value_set_id
88604 , p_adr_code => 'FA_PROC_OF_SALE_GAIN_SEGMENT'
88605 , p_adr_type_code => 'S'
88606 , p_component_type => l_component_type
88607 , p_component_code => l_component_code
88608 , p_component_type_code => l_component_type_code
88609 , p_component_appl_id => l_component_appl_id
88610 , p_amb_context_code => l_amb_context_code
88611 , p_entity_code => 'TRANSACTIONS'
88612 , p_event_class_code => 'RETIREMENTS'
88613 , p_side => 'NA'
88614 );
88615
88616 END IF;
88617
88618 --
88619 --
88620 END IF;
88621
88622 --
88623 -- Update the line information that should be overwritten
88624 --
88625 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
88626 p_header_num => 1);
88627 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
88628
88629 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
88630
88631 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
88632 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
88636 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
88633 END IF;
88634
88635 --
88637 --
88638 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
88639 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
88640 ELSE
88641 ---------------------------------------------------------------------------------------------------
88642 -- 4262811a Switch Sign
88643 ---------------------------------------------------------------------------------------------------
88644 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
88645 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
88646 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
88647 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
88648 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
88649 -- 5132302
88650 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
88651 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
88652
88653 END IF;
88654
88655 -- 4955764
88656 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
88657 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
88658
88659
88660 XLA_AE_LINES_PKG.ValidateCurrentLine;
88661 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
88662
88663 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
88664 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
88665 ,p_balance_type_code => l_balance_type_code);
88666
88667 END IF;
88668
88669 -----------------------------------------------------------------------------------------
88670 -- 4262811 Multiperiod Accounting
88671 -----------------------------------------------------------------------------------------
88672 -- No MPA option is assigned.
88673
88674
88675 END IF;
88676 END IF;
88677 --
88678
88679 --
88680 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
88681 trace
88682 (p_msg => 'END of AcctLineType_287'
88683 ,p_level => C_LEVEL_PROCEDURE
88684 ,p_module => l_log_module);
88685 END IF;
88686 --
88687 EXCEPTION
88688 WHEN xla_exceptions_pkg.application_exception THEN
88689 RAISE;
88690 WHEN OTHERS THEN
88691 xla_exceptions_pkg.raise_message
88692 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_287');
88693 END AcctLineType_287;
88694 --
88695
88696 ---------------------------------------
88697 --
88698 -- PRIVATE FUNCTION
88699 -- AcctLineType_288
88700 --
88701 ---------------------------------------
88702 PROCEDURE AcctLineType_288 (
88703 p_application_id IN NUMBER
88704 ,p_event_id IN NUMBER
88705 ,p_calculate_acctd_flag IN VARCHAR2
88706 ,p_calculate_g_l_flag IN VARCHAR2
88707 ,p_actual_flag IN OUT VARCHAR2
88708 ,p_balance_type_code OUT VARCHAR2
88709 ,p_gain_or_loss_ref OUT VARCHAR2
88710
88711 --Period Close Date
88712 , p_source_1 IN DATE
88713 --Generated Code Combination Identifier
88714 , p_source_5 IN NUMBER
88715 --Proceeds Of Sale Gain Account
88716 , p_source_26 IN VARCHAR2
88717 --Expense Account Code Combination Identifier
88718 , p_source_31 IN NUMBER
88719 --Default Code Combination Identifier
88720 , p_source_32 IN NUMBER
88721 --Adjustment Type
88722 , p_source_48 IN VARCHAR2
88723 --Transaction Header Identifier
88724 , p_source_49 IN NUMBER
88725 --Adjustment Line Identifier
88726 , p_source_50 IN NUMBER
88727 --Distribution Type Code
88728 , p_source_51 IN VARCHAR2
88729 --Entered Amount
88730 , p_source_52 IN NUMBER
88731 --Currency Code
88732 , p_source_53 IN VARCHAR2
88733 --Gain Loss Amount
88734 , p_source_54 IN NUMBER
88735 )
88736 IS
88737
88738 l_component_type VARCHAR2(80);
88739 l_component_code VARCHAR2(30);
88740 l_component_type_code VARCHAR2(1);
88741 l_component_appl_id INTEGER;
88742 l_amb_context_code VARCHAR2(30);
88743 l_entity_code VARCHAR2(30);
88744 l_event_class_code VARCHAR2(30);
88745 l_ae_header_id NUMBER;
88746 l_event_type_code VARCHAR2(30);
88747 l_line_definition_code VARCHAR2(30);
88748 l_line_definition_owner_code VARCHAR2(1);
88749 --
88750 -- adr variables
88751 l_segment VARCHAR2(30);
88752 l_ccid NUMBER;
88753 l_adr_transaction_coa_id NUMBER;
88754 l_adr_accounting_coa_id NUMBER;
88755 l_adr_flexfield_segment_code VARCHAR2(30);
88756 l_adr_flex_value_set_id NUMBER;
88757 l_adr_value_type_code VARCHAR2(30);
88758 l_adr_value_combination_id NUMBER;
88759 l_adr_value_segment_code VARCHAR2(30);
88760
88764 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
88761 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
88762 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
88763 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
88765
88766 -- 4262811 Variables ------------------------------------------------------------------------------------------
88767 l_entered_amt_idx NUMBER;
88768 l_accted_amt_idx NUMBER;
88769 l_acc_rev_flag VARCHAR2(1);
88770 l_accrual_line_num NUMBER;
88771 l_tmp_amt NUMBER;
88772 l_acc_rev_natural_side_code VARCHAR2(1);
88773
88774 l_num_entries NUMBER;
88775 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
88776 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
88777 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
88778 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
88779 l_recog_line_1 NUMBER;
88780 l_recog_line_2 NUMBER;
88781
88782 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
88783 l_bflow_applied_to_amt NUMBER; -- 5132302
88784 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
88785
88786 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
88787
88788 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
88789 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
88790
88791 ---------------------------------------------------------------------------------------------------------------
88792
88793
88794 --
88795 -- bulk performance
88796 --
88797 l_balance_type_code VARCHAR2(1);
88798 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
88799 l_log_module VARCHAR2(240);
88800
88801 --
88802 -- Upgrade strategy
88803 --
88804 l_actual_upg_option VARCHAR2(1);
88805 l_enc_upg_option VARCHAR2(1);
88806
88807 --
88808 BEGIN
88809 --
88810 IF g_log_enabled THEN
88811 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_288';
88812 END IF;
88813 --
88814 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
88815
88816 trace
88817 (p_msg => 'BEGIN of AcctLineType_288'
88818 ,p_level => C_LEVEL_PROCEDURE
88819 ,p_module => l_log_module);
88820
88821 END IF;
88822 --
88823 l_component_type := 'AMB_JLT';
88824 l_component_code := 'FA_PROC_OF_SALE_GAIN';
88825 l_component_type_code := 'S';
88826 l_component_appl_id := 140;
88827 l_amb_context_code := 'DEFAULT';
88828 l_entity_code := 'TRANSACTIONS';
88829 l_event_class_code := 'RETIREMENTS';
88830 l_event_type_code := 'REINSTATEMENTS';
88831 l_line_definition_owner_code := 'S';
88832 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
88833 --
88834 l_balance_type_code := 'A';
88835 l_segment := NULL;
88836 l_ccid := NULL;
88837 l_adr_transaction_coa_id := NULL;
88838 l_adr_accounting_coa_id := NULL;
88839 l_adr_flexfield_segment_code := NULL;
88840 l_adr_flex_value_set_id := NULL;
88841 l_adr_value_type_code := NULL;
88842 l_adr_value_combination_id := NULL;
88843 l_adr_value_segment_code := NULL;
88844
88845 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
88846 l_bflow_class_code := ''; -- 4219869 Business Flow
88847 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
88848 l_budgetary_control_flag := 'N';
88849
88850 l_bflow_applied_to_amt_idx := NULL; -- 5132302
88851 l_bflow_applied_to_amt := NULL; -- 5132302
88852 l_entered_amt_idx := NULL; -- 4262811
88853 l_accted_amt_idx := NULL; -- 4262811
88854 l_acc_rev_flag := NULL; -- 4262811
88855 l_accrual_line_num := NULL; -- 4262811
88856 l_tmp_amt := NULL; -- 4262811
88857 --
88858
88859 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
88860 l_balance_type_code <> 'B' THEN
88861 IF NVL(p_source_48,'
88862 ') = 'PROCEEDS' AND
88863 p_source_54 >= 0
88864 THEN
88865
88866 --
88867 XLA_AE_LINES_PKG.SetNewLine;
88868
88869 p_balance_type_code := l_balance_type_code;
88870 -- set the flag so later we will know whether the gain loss line needs to be created
88871
88872 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
88873 p_actual_flag :='A';
88874 END IF;
88875
88876 --
88877 -- bulk performance
88878 --
88879 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
88880 p_header_num => 0); -- 4262811
88881 --
88882 -- set accounting line options
88883 --
88884 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
88885 p_natural_side_code => 'C'
88886 , p_gain_or_loss_flag => 'N'
88887 , p_gl_transfer_mode_code => 'S'
88891 );
88888 , p_acct_entry_type_code => 'A'
88889 , p_switch_side_flag => 'Y'
88890 , p_merge_duplicate_code => 'N'
88892 --
88893 l_acc_rev_natural_side_code := 'D'; -- 4262811
88894 --
88895 --
88896 -- set accounting line type info
88897 --
88898 xla_ae_lines_pkg.SetAcctLineType
88899 (p_component_type => l_component_type
88900 ,p_event_type_code => l_event_type_code
88901 ,p_line_definition_owner_code => l_line_definition_owner_code
88902 ,p_line_definition_code => l_line_definition_code
88903 ,p_accounting_line_code => l_component_code
88904 ,p_accounting_line_type_code => l_component_type_code
88905 ,p_accounting_line_appl_id => l_component_appl_id
88906 ,p_amb_context_code => l_amb_context_code
88907 ,p_entity_code => l_entity_code
88908 ,p_event_class_code => l_event_class_code);
88909 --
88910 -- set accounting class
88911 --
88912 xla_ae_lines_pkg.SetAcctClass(
88913 p_accounting_class_code => 'ASSET'
88914 , p_ae_header_id => l_ae_header_id
88915 );
88916
88917 --
88918 -- set rounding class
88919 --
88920 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
88921 'ASSET';
88922
88923 --
88924 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
88925 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
88926 --
88927 -- bulk performance
88928 --
88929 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
88930
88931 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
88932 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
88933
88934 -- 4955764
88935 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
88936 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
88937
88938 -- 4458381 Public Sector Enh
88939
88940 --
88941 -- set accounting attributes for the line type
88942 --
88943 l_entered_amt_idx := 4;
88944 l_accted_amt_idx := 6;
88945 l_bflow_applied_to_amt_idx := NULL; -- 5132302
88946 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
88947 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
88948 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
88949 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
88950 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
88951 l_rec_acct_attrs.array_char_value(3) := p_source_51;
88952 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
88953 l_rec_acct_attrs.array_num_value(4) := p_source_52;
88954 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
88955 l_rec_acct_attrs.array_char_value(5) := p_source_53;
88956 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
88957 l_rec_acct_attrs.array_num_value(6) := p_source_52;
88958
88959 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
88960 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
88961
88962 ---------------------------------------------------------------------------------------------------------------
88963 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
88964 ---------------------------------------------------------------------------------------------------------------
88965 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
88966
88967 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
88968 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
88969
88970 IF xla_accounting_cache_pkg.GetValueChar
88971 (p_source_code => 'LEDGER_CATEGORY_CODE'
88972 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
88973 AND l_bflow_method_code = 'PRIOR_ENTRY'
88974 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
88975 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
88976 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
88977 )
88978 THEN
88979 xla_ae_lines_pkg.BflowUpgEntry
88980 (p_business_method_code => l_bflow_method_code
88981 ,p_business_class_code => l_bflow_class_code
88982 ,p_balance_type => l_balance_type_code);
88983 ELSE
88984 NULL;
88985 -- No business flow processing for business flow method of NONE.
88986 END IF;
88987
88988 --
88989 -- call analytical criteria
88990 --
88991
88992 --
88993 -- call description
88994 --
88995
88996 xla_ae_lines_pkg.SetLineDescription(
88997 p_ae_header_id => l_ae_header_id
88998 ,p_description => Description_81 (
88999 p_application_id => p_application_id
89000 , p_ae_header_id => l_ae_header_id
89004
89001 , p_source_1 => p_source_1
89002 )
89003 );
89005
89006 --
89007 -- call ADRs
89008 -- Bug 4922099
89009 --
89010 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
89011 (NVL(l_actual_upg_option, 'N') = 'O') OR
89012 (NVL(l_enc_upg_option, 'N') = 'O')
89013 )
89014 THEN
89015 NULL;
89016 --
89017 --
89018
89019 l_ccid := AcctDerRule_174(
89020 p_application_id => p_application_id
89021 , p_ae_header_id => l_ae_header_id
89022 , p_source_5 => p_source_5
89023 , p_source_32 => p_source_32
89024 , x_transaction_coa_id => l_adr_transaction_coa_id
89025 , x_accounting_coa_id => l_adr_accounting_coa_id
89026 , x_value_type_code => l_adr_value_type_code
89027 , p_side => 'NA'
89028 );
89029
89030 xla_ae_lines_pkg.set_ccid(
89031 p_code_combination_id => l_ccid
89032 , p_value_type_code => l_adr_value_type_code
89033 , p_transaction_coa_id => l_adr_transaction_coa_id
89034 , p_accounting_coa_id => l_adr_accounting_coa_id
89035 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
89036 , p_adr_type_code => 'S'
89037 , p_component_type => l_component_type
89038 , p_component_code => l_component_code
89039 , p_component_type_code => l_component_type_code
89040 , p_component_appl_id => l_component_appl_id
89041 , p_amb_context_code => l_amb_context_code
89042 , p_side => 'NA'
89043 );
89044
89045
89046 l_segment := AcctDerRule_169(
89047 p_application_id => p_application_id
89048 , p_ae_header_id => l_ae_header_id
89049 , p_source_5 => p_source_5
89050 , p_source_31 => p_source_31
89051 , x_transaction_coa_id => l_adr_transaction_coa_id
89052 , x_accounting_coa_id => l_adr_accounting_coa_id
89053 , x_flexfield_segment_code => l_adr_flexfield_segment_code
89054 , x_flex_value_set_id => l_adr_flex_value_set_id
89055 , x_value_type_code => l_adr_value_type_code
89056 , x_value_combination_id => l_adr_value_combination_id
89057 , x_value_segment_code => l_adr_value_segment_code
89058 , p_side => 'NA'
89059 , p_override_seg_flag => 'Y'
89060 );
89061
89062 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
89063
89064 xla_ae_lines_pkg.set_segment(
89065 p_to_segment_code => 'GL_BALANCING'
89066 , p_segment_value => l_segment
89067 , p_from_segment_code => l_adr_value_segment_code
89068 , p_from_combination_id => l_adr_value_combination_id
89069 , p_value_type_code => l_adr_value_type_code
89070 , p_transaction_coa_id => l_adr_transaction_coa_id
89071 , p_accounting_coa_id => l_adr_accounting_coa_id
89072 , p_flexfield_segment_code => l_adr_flexfield_segment_code
89073 , p_flex_value_set_id => l_adr_flex_value_set_id
89074 , p_adr_code => 'FA_EXPENSE_ACCT'
89075 , p_adr_type_code => 'S'
89076 , p_component_type => l_component_type
89077 , p_component_code => l_component_code
89078 , p_component_type_code => l_component_type_code
89079 , p_component_appl_id => l_component_appl_id
89080 , p_amb_context_code => l_amb_context_code
89081 , p_entity_code => 'TRANSACTIONS'
89082 , p_event_class_code => 'RETIREMENTS'
89083 , p_side => 'NA'
89084 );
89085
89086 END IF;
89087
89088 l_segment := AcctDerRule_163(
89089 p_application_id => p_application_id
89090 , p_ae_header_id => l_ae_header_id
89091 , p_source_5 => p_source_5
89092 , p_source_26 => p_source_26
89093 , x_transaction_coa_id => l_adr_transaction_coa_id
89094 , x_accounting_coa_id => l_adr_accounting_coa_id
89095 , x_flexfield_segment_code => l_adr_flexfield_segment_code
89096 , x_flex_value_set_id => l_adr_flex_value_set_id
89097 , x_value_type_code => l_adr_value_type_code
89098 , x_value_combination_id => l_adr_value_combination_id
89099 , x_value_segment_code => l_adr_value_segment_code
89100 , p_side => 'NA'
89101 , p_override_seg_flag => 'Y'
89102 );
89103
89104 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
89105
89106 xla_ae_lines_pkg.set_segment(
89107 p_to_segment_code => 'GL_ACCOUNT'
89108 , p_segment_value => l_segment
89109 , p_from_segment_code => l_adr_value_segment_code
89110 , p_from_combination_id => l_adr_value_combination_id
89111 , p_value_type_code => l_adr_value_type_code
89112 , p_transaction_coa_id => l_adr_transaction_coa_id
89113 , p_accounting_coa_id => l_adr_accounting_coa_id
89114 , p_flexfield_segment_code => l_adr_flexfield_segment_code
89115 , p_flex_value_set_id => l_adr_flex_value_set_id
89116 , p_adr_code => 'FA_PROC_OF_SALE_GAIN_SEGMENT'
89117 , p_adr_type_code => 'S'
89118 , p_component_type => l_component_type
89122 , p_amb_context_code => l_amb_context_code
89119 , p_component_code => l_component_code
89120 , p_component_type_code => l_component_type_code
89121 , p_component_appl_id => l_component_appl_id
89123 , p_entity_code => 'TRANSACTIONS'
89124 , p_event_class_code => 'RETIREMENTS'
89125 , p_side => 'NA'
89126 );
89127
89128 END IF;
89129
89130 --
89131 --
89132 END IF;
89133 --
89134 -- Bug 4922099
89135 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
89136 (NVL(l_enc_upg_option, 'N') = 'O')
89137 ) AND
89138 (l_bflow_method_code = 'PRIOR_ENTRY')
89139 )
89140 THEN
89141 IF
89142 --
89143 1 = 2
89144 --
89145 THEN
89146 xla_accounting_err_pkg.build_message
89147 (p_appli_s_name => 'XLA'
89148 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
89149 ,p_token_1 => 'LINE_NUMBER'
89150 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
89151 ,p_token_2 => 'LINE_TYPE_NAME'
89152 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
89153 l_component_type
89154 ,l_component_code
89155 ,l_component_type_code
89156 ,l_component_appl_id
89157 ,l_amb_context_code
89158 ,l_entity_code
89159 ,l_event_class_code
89160 )
89161 ,p_token_3 => 'OWNER'
89162 ,p_value_3 => xla_lookups_pkg.get_meaning(
89163 p_lookup_type => 'XLA_OWNER_TYPE'
89164 ,p_lookup_code => l_component_type_code
89165 )
89166 ,p_token_4 => 'PRODUCT_NAME'
89167 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
89168 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
89169 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
89170 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
89171 ,p_ae_header_id => NULL
89172 );
89173
89174 IF (C_LEVEL_ERROR>= g_log_level) THEN
89175 trace
89176 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
89177 ,p_level => C_LEVEL_ERROR
89178 ,p_module => l_log_module);
89179 END IF;
89180 END IF;
89181 END IF;
89182 --
89183 --
89184 ------------------------------------------------------------------------------------------------
89185 -- 4219869 Business Flow
89186 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
89187 -- Prior Entry. Currently, the following code is always generated.
89188 ------------------------------------------------------------------------------------------------
89189 XLA_AE_LINES_PKG.ValidateCurrentLine;
89190
89191 ------------------------------------------------------------------------------------
89192 -- 4219869 Business Flow
89193 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
89194 ------------------------------------------------------------------------------------
89195 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
89196
89197 ----------------------------------------------------------------------------------
89198 -- 4219869 Business Flow
89199 -- Update journal entry status -- Need to generate this within IF <condition>
89200 ----------------------------------------------------------------------------------
89201 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
89202 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
89203 ,p_balance_type_code => l_balance_type_code
89204 );
89205
89206 -------------------------------------------------------------------------------------------
89207 -- 4262811 - Generate the Accrual Reversal lines
89208 -------------------------------------------------------------------------------------------
89209 BEGIN
89210 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
89211 (g_array_event(p_event_id).array_value_num('header_index'));
89212 IF l_acc_rev_flag IS NULL THEN
89213 l_acc_rev_flag := 'N';
89214 END IF;
89215 EXCEPTION
89216 WHEN OTHERS THEN
89220 IF (l_acc_rev_flag = 'Y') THEN
89217 l_acc_rev_flag := 'N';
89218 END;
89219 --
89221
89222 -- 4645092 ------------------------------------------------------------------------------
89223 -- To allow MPA report to determine if it should generate report process
89224 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
89225 ------------------------------------------------------------------------------------------
89226
89227 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
89228 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
89229 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
89230 -- call ADRs
89231 -- Bug 4922099
89232 --
89233 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
89234 (NVL(l_actual_upg_option, 'N') = 'O') OR
89235 (NVL(l_enc_upg_option, 'N') = 'O')
89236 )
89237 THEN
89238 NULL;
89239 --
89240 --
89241
89242 l_ccid := AcctDerRule_174(
89243 p_application_id => p_application_id
89244 , p_ae_header_id => l_ae_header_id
89245 , p_source_5 => p_source_5
89246 , p_source_32 => p_source_32
89247 , x_transaction_coa_id => l_adr_transaction_coa_id
89248 , x_accounting_coa_id => l_adr_accounting_coa_id
89249 , x_value_type_code => l_adr_value_type_code
89250 , p_side => 'NA'
89251 );
89252
89253 xla_ae_lines_pkg.set_ccid(
89254 p_code_combination_id => l_ccid
89255 , p_value_type_code => l_adr_value_type_code
89256 , p_transaction_coa_id => l_adr_transaction_coa_id
89257 , p_accounting_coa_id => l_adr_accounting_coa_id
89258 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
89259 , p_adr_type_code => 'S'
89260 , p_component_type => l_component_type
89261 , p_component_code => l_component_code
89262 , p_component_type_code => l_component_type_code
89263 , p_component_appl_id => l_component_appl_id
89264 , p_amb_context_code => l_amb_context_code
89265 , p_side => 'NA'
89266 );
89267
89268
89269 l_segment := AcctDerRule_169(
89270 p_application_id => p_application_id
89271 , p_ae_header_id => l_ae_header_id
89272 , p_source_5 => p_source_5
89273 , p_source_31 => p_source_31
89274 , x_transaction_coa_id => l_adr_transaction_coa_id
89275 , x_accounting_coa_id => l_adr_accounting_coa_id
89276 , x_flexfield_segment_code => l_adr_flexfield_segment_code
89277 , x_flex_value_set_id => l_adr_flex_value_set_id
89278 , x_value_type_code => l_adr_value_type_code
89279 , x_value_combination_id => l_adr_value_combination_id
89280 , x_value_segment_code => l_adr_value_segment_code
89281 , p_side => 'NA'
89282 , p_override_seg_flag => 'Y'
89283 );
89284
89285 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
89286
89287 xla_ae_lines_pkg.set_segment(
89288 p_to_segment_code => 'GL_BALANCING'
89289 , p_segment_value => l_segment
89290 , p_from_segment_code => l_adr_value_segment_code
89291 , p_from_combination_id => l_adr_value_combination_id
89292 , p_value_type_code => l_adr_value_type_code
89293 , p_transaction_coa_id => l_adr_transaction_coa_id
89294 , p_accounting_coa_id => l_adr_accounting_coa_id
89295 , p_flexfield_segment_code => l_adr_flexfield_segment_code
89296 , p_flex_value_set_id => l_adr_flex_value_set_id
89297 , p_adr_code => 'FA_EXPENSE_ACCT'
89298 , p_adr_type_code => 'S'
89299 , p_component_type => l_component_type
89300 , p_component_code => l_component_code
89301 , p_component_type_code => l_component_type_code
89302 , p_component_appl_id => l_component_appl_id
89303 , p_amb_context_code => l_amb_context_code
89304 , p_entity_code => 'TRANSACTIONS'
89305 , p_event_class_code => 'RETIREMENTS'
89306 , p_side => 'NA'
89307 );
89308
89309 END IF;
89310
89311 l_segment := AcctDerRule_163(
89312 p_application_id => p_application_id
89313 , p_ae_header_id => l_ae_header_id
89314 , p_source_5 => p_source_5
89315 , p_source_26 => p_source_26
89316 , x_transaction_coa_id => l_adr_transaction_coa_id
89317 , x_accounting_coa_id => l_adr_accounting_coa_id
89318 , x_flexfield_segment_code => l_adr_flexfield_segment_code
89319 , x_flex_value_set_id => l_adr_flex_value_set_id
89320 , x_value_type_code => l_adr_value_type_code
89321 , x_value_combination_id => l_adr_value_combination_id
89322 , x_value_segment_code => l_adr_value_segment_code
89323 , p_side => 'NA'
89324 , p_override_seg_flag => 'Y'
89325 );
89326
89327 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
89328
89329 xla_ae_lines_pkg.set_segment(
89330 p_to_segment_code => 'GL_ACCOUNT'
89334 , p_value_type_code => l_adr_value_type_code
89331 , p_segment_value => l_segment
89332 , p_from_segment_code => l_adr_value_segment_code
89333 , p_from_combination_id => l_adr_value_combination_id
89335 , p_transaction_coa_id => l_adr_transaction_coa_id
89336 , p_accounting_coa_id => l_adr_accounting_coa_id
89337 , p_flexfield_segment_code => l_adr_flexfield_segment_code
89338 , p_flex_value_set_id => l_adr_flex_value_set_id
89339 , p_adr_code => 'FA_PROC_OF_SALE_GAIN_SEGMENT'
89340 , p_adr_type_code => 'S'
89341 , p_component_type => l_component_type
89342 , p_component_code => l_component_code
89343 , p_component_type_code => l_component_type_code
89344 , p_component_appl_id => l_component_appl_id
89345 , p_amb_context_code => l_amb_context_code
89346 , p_entity_code => 'TRANSACTIONS'
89347 , p_event_class_code => 'RETIREMENTS'
89348 , p_side => 'NA'
89349 );
89350
89351 END IF;
89352
89353 --
89354 --
89355 END IF;
89356
89357 --
89358 -- Update the line information that should be overwritten
89359 --
89360 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
89361 p_header_num => 1);
89362 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
89363
89364 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
89365
89366 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
89367 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
89368 END IF;
89369
89370 --
89371 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
89372 --
89373 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
89374 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
89375 ELSE
89376 ---------------------------------------------------------------------------------------------------
89377 -- 4262811a Switch Sign
89378 ---------------------------------------------------------------------------------------------------
89379 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
89380 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
89381 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
89382 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
89383 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
89384 -- 5132302
89385 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
89386 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
89387
89388 END IF;
89389
89390 -- 4955764
89391 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
89392 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
89393
89394
89395 XLA_AE_LINES_PKG.ValidateCurrentLine;
89396 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
89397
89398 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
89399 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
89400 ,p_balance_type_code => l_balance_type_code);
89401
89402 END IF;
89403
89404 -----------------------------------------------------------------------------------------
89405 -- 4262811 Multiperiod Accounting
89406 -----------------------------------------------------------------------------------------
89407 -- No MPA option is assigned.
89408
89409
89410 END IF;
89411 END IF;
89412 --
89413
89414 --
89415 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
89416 trace
89417 (p_msg => 'END of AcctLineType_288'
89418 ,p_level => C_LEVEL_PROCEDURE
89419 ,p_module => l_log_module);
89420 END IF;
89421 --
89422 EXCEPTION
89423 WHEN xla_exceptions_pkg.application_exception THEN
89424 RAISE;
89425 WHEN OTHERS THEN
89426 xla_exceptions_pkg.raise_message
89427 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_288');
89428 END AcctLineType_288;
89429 --
89430
89431 ---------------------------------------
89432 --
89433 -- PRIVATE FUNCTION
89434 -- AcctLineType_289
89435 --
89436 ---------------------------------------
89437 PROCEDURE AcctLineType_289 (
89438 p_application_id IN NUMBER
89439 ,p_event_id IN NUMBER
89440 ,p_calculate_acctd_flag IN VARCHAR2
89441 ,p_calculate_g_l_flag IN VARCHAR2
89442 ,p_actual_flag IN OUT VARCHAR2
89443 ,p_balance_type_code OUT VARCHAR2
89444 ,p_gain_or_loss_ref OUT VARCHAR2
89445
89446 --Period Close Date
89447 , p_source_1 IN DATE
89451 , p_source_27 IN VARCHAR2
89448 --Generated Code Combination Identifier
89449 , p_source_5 IN NUMBER
89450 --Proceeds Of Sale Loss Account
89452 --Expense Account Code Combination Identifier
89453 , p_source_31 IN NUMBER
89454 --Default Code Combination Identifier
89455 , p_source_32 IN NUMBER
89456 --Adjustment Type
89457 , p_source_48 IN VARCHAR2
89458 --Transaction Header Identifier
89459 , p_source_49 IN NUMBER
89460 --Adjustment Line Identifier
89461 , p_source_50 IN NUMBER
89462 --Distribution Type Code
89463 , p_source_51 IN VARCHAR2
89464 --Entered Amount
89465 , p_source_52 IN NUMBER
89466 --Currency Code
89467 , p_source_53 IN VARCHAR2
89468 --Gain Loss Amount
89469 , p_source_54 IN NUMBER
89470 )
89471 IS
89472
89473 l_component_type VARCHAR2(80);
89474 l_component_code VARCHAR2(30);
89475 l_component_type_code VARCHAR2(1);
89476 l_component_appl_id INTEGER;
89477 l_amb_context_code VARCHAR2(30);
89478 l_entity_code VARCHAR2(30);
89479 l_event_class_code VARCHAR2(30);
89480 l_ae_header_id NUMBER;
89481 l_event_type_code VARCHAR2(30);
89482 l_line_definition_code VARCHAR2(30);
89483 l_line_definition_owner_code VARCHAR2(1);
89484 --
89485 -- adr variables
89486 l_segment VARCHAR2(30);
89487 l_ccid NUMBER;
89488 l_adr_transaction_coa_id NUMBER;
89489 l_adr_accounting_coa_id NUMBER;
89490 l_adr_flexfield_segment_code VARCHAR2(30);
89491 l_adr_flex_value_set_id NUMBER;
89492 l_adr_value_type_code VARCHAR2(30);
89493 l_adr_value_combination_id NUMBER;
89494 l_adr_value_segment_code VARCHAR2(30);
89495
89496 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
89497 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
89498 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
89499 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
89500
89501 -- 4262811 Variables ------------------------------------------------------------------------------------------
89502 l_entered_amt_idx NUMBER;
89503 l_accted_amt_idx NUMBER;
89504 l_acc_rev_flag VARCHAR2(1);
89505 l_accrual_line_num NUMBER;
89506 l_tmp_amt NUMBER;
89507 l_acc_rev_natural_side_code VARCHAR2(1);
89508
89509 l_num_entries NUMBER;
89510 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
89511 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
89512 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
89513 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
89514 l_recog_line_1 NUMBER;
89515 l_recog_line_2 NUMBER;
89516
89517 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
89518 l_bflow_applied_to_amt NUMBER; -- 5132302
89519 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
89520
89521 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
89522
89523 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
89524 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
89525
89526 ---------------------------------------------------------------------------------------------------------------
89527
89528
89529 --
89530 -- bulk performance
89531 --
89532 l_balance_type_code VARCHAR2(1);
89533 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
89534 l_log_module VARCHAR2(240);
89535
89536 --
89537 -- Upgrade strategy
89538 --
89539 l_actual_upg_option VARCHAR2(1);
89540 l_enc_upg_option VARCHAR2(1);
89541
89542 --
89543 BEGIN
89544 --
89545 IF g_log_enabled THEN
89546 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_289';
89547 END IF;
89548 --
89549 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
89550
89551 trace
89552 (p_msg => 'BEGIN of AcctLineType_289'
89553 ,p_level => C_LEVEL_PROCEDURE
89554 ,p_module => l_log_module);
89555
89556 END IF;
89557 --
89558 l_component_type := 'AMB_JLT';
89559 l_component_code := 'FA_PROC_OF_SALE_LOSS';
89560 l_component_type_code := 'S';
89561 l_component_appl_id := 140;
89562 l_amb_context_code := 'DEFAULT';
89563 l_entity_code := 'TRANSACTIONS';
89564 l_event_class_code := 'RETIREMENTS';
89565 l_event_type_code := 'RETIREMENTS';
89566 l_line_definition_owner_code := 'S';
89567 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
89568 --
89569 l_balance_type_code := 'A';
89570 l_segment := NULL;
89571 l_ccid := NULL;
89572 l_adr_transaction_coa_id := NULL;
89573 l_adr_accounting_coa_id := NULL;
89574 l_adr_flexfield_segment_code := NULL;
89575 l_adr_flex_value_set_id := NULL;
89576 l_adr_value_type_code := NULL;
89577 l_adr_value_combination_id := NULL;
89581 l_bflow_class_code := ''; -- 4219869 Business Flow
89578 l_adr_value_segment_code := NULL;
89579
89580 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
89582 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
89583 l_budgetary_control_flag := 'N';
89584
89585 l_bflow_applied_to_amt_idx := NULL; -- 5132302
89586 l_bflow_applied_to_amt := NULL; -- 5132302
89587 l_entered_amt_idx := NULL; -- 4262811
89588 l_accted_amt_idx := NULL; -- 4262811
89589 l_acc_rev_flag := NULL; -- 4262811
89590 l_accrual_line_num := NULL; -- 4262811
89591 l_tmp_amt := NULL; -- 4262811
89592 --
89593
89594 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
89595 l_balance_type_code <> 'B' THEN
89596 IF NVL(p_source_48,'
89597 ') = 'PROCEEDS' AND
89598 p_source_54 < 0
89599 THEN
89600
89601 --
89602 XLA_AE_LINES_PKG.SetNewLine;
89603
89604 p_balance_type_code := l_balance_type_code;
89605 -- set the flag so later we will know whether the gain loss line needs to be created
89606
89607 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
89608 p_actual_flag :='A';
89609 END IF;
89610
89611 --
89612 -- bulk performance
89613 --
89614 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
89615 p_header_num => 0); -- 4262811
89616 --
89617 -- set accounting line options
89618 --
89619 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
89620 p_natural_side_code => 'C'
89621 , p_gain_or_loss_flag => 'N'
89622 , p_gl_transfer_mode_code => 'S'
89623 , p_acct_entry_type_code => 'A'
89624 , p_switch_side_flag => 'Y'
89625 , p_merge_duplicate_code => 'N'
89626 );
89627 --
89628 l_acc_rev_natural_side_code := 'D'; -- 4262811
89629 --
89630 --
89631 -- set accounting line type info
89632 --
89633 xla_ae_lines_pkg.SetAcctLineType
89634 (p_component_type => l_component_type
89635 ,p_event_type_code => l_event_type_code
89636 ,p_line_definition_owner_code => l_line_definition_owner_code
89637 ,p_line_definition_code => l_line_definition_code
89638 ,p_accounting_line_code => l_component_code
89639 ,p_accounting_line_type_code => l_component_type_code
89640 ,p_accounting_line_appl_id => l_component_appl_id
89641 ,p_amb_context_code => l_amb_context_code
89642 ,p_entity_code => l_entity_code
89643 ,p_event_class_code => l_event_class_code);
89644 --
89645 -- set accounting class
89646 --
89647 xla_ae_lines_pkg.SetAcctClass(
89648 p_accounting_class_code => 'ASSET'
89649 , p_ae_header_id => l_ae_header_id
89650 );
89651
89652 --
89653 -- set rounding class
89654 --
89655 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
89656 'ASSET';
89657
89658 --
89659 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
89660 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
89661 --
89662 -- bulk performance
89663 --
89664 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
89665
89666 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
89667 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
89668
89669 -- 4955764
89670 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
89671 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
89672
89673 -- 4458381 Public Sector Enh
89674
89675 --
89676 -- set accounting attributes for the line type
89677 --
89678 l_entered_amt_idx := 4;
89679 l_accted_amt_idx := 6;
89680 l_bflow_applied_to_amt_idx := NULL; -- 5132302
89681 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
89682 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
89683 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
89684 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
89685 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
89686 l_rec_acct_attrs.array_char_value(3) := p_source_51;
89687 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
89688 l_rec_acct_attrs.array_num_value(4) := p_source_52;
89689 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
89690 l_rec_acct_attrs.array_char_value(5) := p_source_53;
89691 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
89692 l_rec_acct_attrs.array_num_value(6) := p_source_52;
89693
89694 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
89695 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
89696
89697 ---------------------------------------------------------------------------------------------------------------
89698 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
89702 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
89699 ---------------------------------------------------------------------------------------------------------------
89700 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
89701
89703 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
89704
89705 IF xla_accounting_cache_pkg.GetValueChar
89706 (p_source_code => 'LEDGER_CATEGORY_CODE'
89707 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
89708 AND l_bflow_method_code = 'PRIOR_ENTRY'
89709 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
89710 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
89711 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
89712 )
89713 THEN
89714 xla_ae_lines_pkg.BflowUpgEntry
89715 (p_business_method_code => l_bflow_method_code
89716 ,p_business_class_code => l_bflow_class_code
89717 ,p_balance_type => l_balance_type_code);
89718 ELSE
89719 NULL;
89720 -- No business flow processing for business flow method of NONE.
89721 END IF;
89722
89723 --
89724 -- call analytical criteria
89725 --
89726
89727 --
89728 -- call description
89729 --
89730
89731 xla_ae_lines_pkg.SetLineDescription(
89732 p_ae_header_id => l_ae_header_id
89733 ,p_description => Description_81 (
89734 p_application_id => p_application_id
89735 , p_ae_header_id => l_ae_header_id
89736 , p_source_1 => p_source_1
89737 )
89738 );
89739
89740
89741 --
89742 -- call ADRs
89743 -- Bug 4922099
89744 --
89745 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
89746 (NVL(l_actual_upg_option, 'N') = 'O') OR
89747 (NVL(l_enc_upg_option, 'N') = 'O')
89748 )
89749 THEN
89750 NULL;
89751 --
89752 --
89753
89754 l_ccid := AcctDerRule_174(
89755 p_application_id => p_application_id
89756 , p_ae_header_id => l_ae_header_id
89757 , p_source_5 => p_source_5
89758 , p_source_32 => p_source_32
89759 , x_transaction_coa_id => l_adr_transaction_coa_id
89760 , x_accounting_coa_id => l_adr_accounting_coa_id
89761 , x_value_type_code => l_adr_value_type_code
89762 , p_side => 'NA'
89763 );
89764
89765 xla_ae_lines_pkg.set_ccid(
89766 p_code_combination_id => l_ccid
89767 , p_value_type_code => l_adr_value_type_code
89768 , p_transaction_coa_id => l_adr_transaction_coa_id
89769 , p_accounting_coa_id => l_adr_accounting_coa_id
89770 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
89771 , p_adr_type_code => 'S'
89772 , p_component_type => l_component_type
89773 , p_component_code => l_component_code
89774 , p_component_type_code => l_component_type_code
89775 , p_component_appl_id => l_component_appl_id
89776 , p_amb_context_code => l_amb_context_code
89777 , p_side => 'NA'
89778 );
89779
89780
89781 l_segment := AcctDerRule_169(
89782 p_application_id => p_application_id
89783 , p_ae_header_id => l_ae_header_id
89784 , p_source_5 => p_source_5
89785 , p_source_31 => p_source_31
89786 , x_transaction_coa_id => l_adr_transaction_coa_id
89787 , x_accounting_coa_id => l_adr_accounting_coa_id
89788 , x_flexfield_segment_code => l_adr_flexfield_segment_code
89789 , x_flex_value_set_id => l_adr_flex_value_set_id
89790 , x_value_type_code => l_adr_value_type_code
89791 , x_value_combination_id => l_adr_value_combination_id
89792 , x_value_segment_code => l_adr_value_segment_code
89793 , p_side => 'NA'
89794 , p_override_seg_flag => 'Y'
89795 );
89796
89797 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
89798
89799 xla_ae_lines_pkg.set_segment(
89800 p_to_segment_code => 'GL_BALANCING'
89801 , p_segment_value => l_segment
89802 , p_from_segment_code => l_adr_value_segment_code
89803 , p_from_combination_id => l_adr_value_combination_id
89804 , p_value_type_code => l_adr_value_type_code
89805 , p_transaction_coa_id => l_adr_transaction_coa_id
89806 , p_accounting_coa_id => l_adr_accounting_coa_id
89807 , p_flexfield_segment_code => l_adr_flexfield_segment_code
89808 , p_flex_value_set_id => l_adr_flex_value_set_id
89809 , p_adr_code => 'FA_EXPENSE_ACCT'
89810 , p_adr_type_code => 'S'
89811 , p_component_type => l_component_type
89812 , p_component_code => l_component_code
89813 , p_component_type_code => l_component_type_code
89814 , p_component_appl_id => l_component_appl_id
89815 , p_amb_context_code => l_amb_context_code
89816 , p_entity_code => 'TRANSACTIONS'
89817 , p_event_class_code => 'RETIREMENTS'
89821 END IF;
89818 , p_side => 'NA'
89819 );
89820
89822
89823 l_segment := AcctDerRule_164(
89824 p_application_id => p_application_id
89825 , p_ae_header_id => l_ae_header_id
89826 , p_source_5 => p_source_5
89827 , p_source_27 => p_source_27
89828 , x_transaction_coa_id => l_adr_transaction_coa_id
89829 , x_accounting_coa_id => l_adr_accounting_coa_id
89830 , x_flexfield_segment_code => l_adr_flexfield_segment_code
89831 , x_flex_value_set_id => l_adr_flex_value_set_id
89832 , x_value_type_code => l_adr_value_type_code
89833 , x_value_combination_id => l_adr_value_combination_id
89834 , x_value_segment_code => l_adr_value_segment_code
89835 , p_side => 'NA'
89836 , p_override_seg_flag => 'Y'
89837 );
89838
89839 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
89840
89841 xla_ae_lines_pkg.set_segment(
89842 p_to_segment_code => 'GL_ACCOUNT'
89843 , p_segment_value => l_segment
89844 , p_from_segment_code => l_adr_value_segment_code
89845 , p_from_combination_id => l_adr_value_combination_id
89846 , p_value_type_code => l_adr_value_type_code
89847 , p_transaction_coa_id => l_adr_transaction_coa_id
89848 , p_accounting_coa_id => l_adr_accounting_coa_id
89849 , p_flexfield_segment_code => l_adr_flexfield_segment_code
89850 , p_flex_value_set_id => l_adr_flex_value_set_id
89851 , p_adr_code => 'FA_PROC_OF_SALE_LOSS_SEGMENT'
89852 , p_adr_type_code => 'S'
89853 , p_component_type => l_component_type
89854 , p_component_code => l_component_code
89855 , p_component_type_code => l_component_type_code
89856 , p_component_appl_id => l_component_appl_id
89857 , p_amb_context_code => l_amb_context_code
89858 , p_entity_code => 'TRANSACTIONS'
89859 , p_event_class_code => 'RETIREMENTS'
89860 , p_side => 'NA'
89861 );
89862
89863 END IF;
89864
89865 --
89866 --
89867 END IF;
89868 --
89869 -- Bug 4922099
89870 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
89871 (NVL(l_enc_upg_option, 'N') = 'O')
89872 ) AND
89873 (l_bflow_method_code = 'PRIOR_ENTRY')
89874 )
89875 THEN
89876 IF
89877 --
89878 1 = 2
89879 --
89880 THEN
89881 xla_accounting_err_pkg.build_message
89882 (p_appli_s_name => 'XLA'
89883 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
89884 ,p_token_1 => 'LINE_NUMBER'
89885 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
89886 ,p_token_2 => 'LINE_TYPE_NAME'
89887 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
89888 l_component_type
89889 ,l_component_code
89890 ,l_component_type_code
89891 ,l_component_appl_id
89892 ,l_amb_context_code
89893 ,l_entity_code
89894 ,l_event_class_code
89895 )
89896 ,p_token_3 => 'OWNER'
89897 ,p_value_3 => xla_lookups_pkg.get_meaning(
89898 p_lookup_type => 'XLA_OWNER_TYPE'
89899 ,p_lookup_code => l_component_type_code
89900 )
89901 ,p_token_4 => 'PRODUCT_NAME'
89902 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
89903 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
89904 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
89905 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
89906 ,p_ae_header_id => NULL
89907 );
89908
89909 IF (C_LEVEL_ERROR>= g_log_level) THEN
89910 trace
89911 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
89912 ,p_level => C_LEVEL_ERROR
89913 ,p_module => l_log_module);
89914 END IF;
89915 END IF;
89916 END IF;
89917 --
89918 --
89922 -- Prior Entry. Currently, the following code is always generated.
89919 ------------------------------------------------------------------------------------------------
89920 -- 4219869 Business Flow
89921 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
89923 ------------------------------------------------------------------------------------------------
89924 XLA_AE_LINES_PKG.ValidateCurrentLine;
89925
89926 ------------------------------------------------------------------------------------
89927 -- 4219869 Business Flow
89928 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
89929 ------------------------------------------------------------------------------------
89930 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
89931
89932 ----------------------------------------------------------------------------------
89933 -- 4219869 Business Flow
89934 -- Update journal entry status -- Need to generate this within IF <condition>
89935 ----------------------------------------------------------------------------------
89936 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
89937 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
89938 ,p_balance_type_code => l_balance_type_code
89939 );
89940
89941 -------------------------------------------------------------------------------------------
89942 -- 4262811 - Generate the Accrual Reversal lines
89943 -------------------------------------------------------------------------------------------
89944 BEGIN
89945 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
89946 (g_array_event(p_event_id).array_value_num('header_index'));
89947 IF l_acc_rev_flag IS NULL THEN
89948 l_acc_rev_flag := 'N';
89949 END IF;
89950 EXCEPTION
89951 WHEN OTHERS THEN
89952 l_acc_rev_flag := 'N';
89953 END;
89954 --
89955 IF (l_acc_rev_flag = 'Y') THEN
89956
89957 -- 4645092 ------------------------------------------------------------------------------
89958 -- To allow MPA report to determine if it should generate report process
89959 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
89960 ------------------------------------------------------------------------------------------
89961
89962 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
89963 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
89964 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
89965 -- call ADRs
89966 -- Bug 4922099
89967 --
89968 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
89969 (NVL(l_actual_upg_option, 'N') = 'O') OR
89970 (NVL(l_enc_upg_option, 'N') = 'O')
89971 )
89972 THEN
89973 NULL;
89974 --
89975 --
89976
89977 l_ccid := AcctDerRule_174(
89978 p_application_id => p_application_id
89979 , p_ae_header_id => l_ae_header_id
89980 , p_source_5 => p_source_5
89981 , p_source_32 => p_source_32
89982 , x_transaction_coa_id => l_adr_transaction_coa_id
89983 , x_accounting_coa_id => l_adr_accounting_coa_id
89984 , x_value_type_code => l_adr_value_type_code
89985 , p_side => 'NA'
89986 );
89987
89988 xla_ae_lines_pkg.set_ccid(
89989 p_code_combination_id => l_ccid
89990 , p_value_type_code => l_adr_value_type_code
89991 , p_transaction_coa_id => l_adr_transaction_coa_id
89992 , p_accounting_coa_id => l_adr_accounting_coa_id
89993 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
89994 , p_adr_type_code => 'S'
89995 , p_component_type => l_component_type
89996 , p_component_code => l_component_code
89997 , p_component_type_code => l_component_type_code
89998 , p_component_appl_id => l_component_appl_id
89999 , p_amb_context_code => l_amb_context_code
90000 , p_side => 'NA'
90001 );
90002
90003
90004 l_segment := AcctDerRule_169(
90005 p_application_id => p_application_id
90006 , p_ae_header_id => l_ae_header_id
90007 , p_source_5 => p_source_5
90008 , p_source_31 => p_source_31
90009 , x_transaction_coa_id => l_adr_transaction_coa_id
90010 , x_accounting_coa_id => l_adr_accounting_coa_id
90011 , x_flexfield_segment_code => l_adr_flexfield_segment_code
90012 , x_flex_value_set_id => l_adr_flex_value_set_id
90013 , x_value_type_code => l_adr_value_type_code
90014 , x_value_combination_id => l_adr_value_combination_id
90015 , x_value_segment_code => l_adr_value_segment_code
90016 , p_side => 'NA'
90017 , p_override_seg_flag => 'Y'
90018 );
90019
90020 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
90021
90022 xla_ae_lines_pkg.set_segment(
90023 p_to_segment_code => 'GL_BALANCING'
90024 , p_segment_value => l_segment
90025 , p_from_segment_code => l_adr_value_segment_code
90026 , p_from_combination_id => l_adr_value_combination_id
90030 , p_flexfield_segment_code => l_adr_flexfield_segment_code
90027 , p_value_type_code => l_adr_value_type_code
90028 , p_transaction_coa_id => l_adr_transaction_coa_id
90029 , p_accounting_coa_id => l_adr_accounting_coa_id
90031 , p_flex_value_set_id => l_adr_flex_value_set_id
90032 , p_adr_code => 'FA_EXPENSE_ACCT'
90033 , p_adr_type_code => 'S'
90034 , p_component_type => l_component_type
90035 , p_component_code => l_component_code
90036 , p_component_type_code => l_component_type_code
90037 , p_component_appl_id => l_component_appl_id
90038 , p_amb_context_code => l_amb_context_code
90039 , p_entity_code => 'TRANSACTIONS'
90040 , p_event_class_code => 'RETIREMENTS'
90041 , p_side => 'NA'
90042 );
90043
90044 END IF;
90045
90046 l_segment := AcctDerRule_164(
90047 p_application_id => p_application_id
90048 , p_ae_header_id => l_ae_header_id
90049 , p_source_5 => p_source_5
90050 , p_source_27 => p_source_27
90051 , x_transaction_coa_id => l_adr_transaction_coa_id
90052 , x_accounting_coa_id => l_adr_accounting_coa_id
90053 , x_flexfield_segment_code => l_adr_flexfield_segment_code
90054 , x_flex_value_set_id => l_adr_flex_value_set_id
90055 , x_value_type_code => l_adr_value_type_code
90056 , x_value_combination_id => l_adr_value_combination_id
90057 , x_value_segment_code => l_adr_value_segment_code
90058 , p_side => 'NA'
90059 , p_override_seg_flag => 'Y'
90060 );
90061
90062 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
90063
90064 xla_ae_lines_pkg.set_segment(
90065 p_to_segment_code => 'GL_ACCOUNT'
90066 , p_segment_value => l_segment
90067 , p_from_segment_code => l_adr_value_segment_code
90068 , p_from_combination_id => l_adr_value_combination_id
90069 , p_value_type_code => l_adr_value_type_code
90070 , p_transaction_coa_id => l_adr_transaction_coa_id
90071 , p_accounting_coa_id => l_adr_accounting_coa_id
90072 , p_flexfield_segment_code => l_adr_flexfield_segment_code
90073 , p_flex_value_set_id => l_adr_flex_value_set_id
90074 , p_adr_code => 'FA_PROC_OF_SALE_LOSS_SEGMENT'
90075 , p_adr_type_code => 'S'
90076 , p_component_type => l_component_type
90077 , p_component_code => l_component_code
90078 , p_component_type_code => l_component_type_code
90079 , p_component_appl_id => l_component_appl_id
90080 , p_amb_context_code => l_amb_context_code
90081 , p_entity_code => 'TRANSACTIONS'
90082 , p_event_class_code => 'RETIREMENTS'
90083 , p_side => 'NA'
90084 );
90085
90086 END IF;
90087
90088 --
90089 --
90090 END IF;
90091
90092 --
90093 -- Update the line information that should be overwritten
90094 --
90095 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
90096 p_header_num => 1);
90097 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
90098
90099 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
90100
90101 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
90102 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
90103 END IF;
90104
90105 --
90106 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
90107 --
90108 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
90109 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
90110 ELSE
90111 ---------------------------------------------------------------------------------------------------
90112 -- 4262811a Switch Sign
90113 ---------------------------------------------------------------------------------------------------
90114 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
90115 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
90116 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
90117 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
90118 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
90119 -- 5132302
90120 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
90121 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
90122
90123 END IF;
90124
90125 -- 4955764
90126 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
90127 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
90128
90129
90130 XLA_AE_LINES_PKG.ValidateCurrentLine;
90134 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
90131 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
90132
90133 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
90135 ,p_balance_type_code => l_balance_type_code);
90136
90137 END IF;
90138
90139 -----------------------------------------------------------------------------------------
90140 -- 4262811 Multiperiod Accounting
90141 -----------------------------------------------------------------------------------------
90142 -- No MPA option is assigned.
90143
90144
90145 END IF;
90146 END IF;
90147 --
90148
90149 --
90150 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
90151 trace
90152 (p_msg => 'END of AcctLineType_289'
90153 ,p_level => C_LEVEL_PROCEDURE
90154 ,p_module => l_log_module);
90155 END IF;
90156 --
90157 EXCEPTION
90158 WHEN xla_exceptions_pkg.application_exception THEN
90159 RAISE;
90160 WHEN OTHERS THEN
90161 xla_exceptions_pkg.raise_message
90162 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_289');
90163 END AcctLineType_289;
90164 --
90165
90166 ---------------------------------------
90167 --
90168 -- PRIVATE FUNCTION
90169 -- AcctLineType_290
90170 --
90171 ---------------------------------------
90172 PROCEDURE AcctLineType_290 (
90173 p_application_id IN NUMBER
90174 ,p_event_id IN NUMBER
90175 ,p_calculate_acctd_flag IN VARCHAR2
90176 ,p_calculate_g_l_flag IN VARCHAR2
90177 ,p_actual_flag IN OUT VARCHAR2
90178 ,p_balance_type_code OUT VARCHAR2
90179 ,p_gain_or_loss_ref OUT VARCHAR2
90180
90181 --Period Close Date
90182 , p_source_1 IN DATE
90183 --Generated Code Combination Identifier
90184 , p_source_5 IN NUMBER
90185 --Proceeds Of Sale Loss Account
90186 , p_source_27 IN VARCHAR2
90187 --Expense Account Code Combination Identifier
90188 , p_source_31 IN NUMBER
90189 --Default Code Combination Identifier
90190 , p_source_32 IN NUMBER
90191 --Adjustment Type
90192 , p_source_48 IN VARCHAR2
90193 --Transaction Header Identifier
90194 , p_source_49 IN NUMBER
90195 --Adjustment Line Identifier
90196 , p_source_50 IN NUMBER
90197 --Distribution Type Code
90198 , p_source_51 IN VARCHAR2
90199 --Entered Amount
90200 , p_source_52 IN NUMBER
90201 --Currency Code
90202 , p_source_53 IN VARCHAR2
90203 --Gain Loss Amount
90204 , p_source_54 IN NUMBER
90205 )
90206 IS
90207
90208 l_component_type VARCHAR2(80);
90209 l_component_code VARCHAR2(30);
90210 l_component_type_code VARCHAR2(1);
90211 l_component_appl_id INTEGER;
90212 l_amb_context_code VARCHAR2(30);
90213 l_entity_code VARCHAR2(30);
90214 l_event_class_code VARCHAR2(30);
90215 l_ae_header_id NUMBER;
90216 l_event_type_code VARCHAR2(30);
90217 l_line_definition_code VARCHAR2(30);
90218 l_line_definition_owner_code VARCHAR2(1);
90219 --
90220 -- adr variables
90221 l_segment VARCHAR2(30);
90222 l_ccid NUMBER;
90223 l_adr_transaction_coa_id NUMBER;
90224 l_adr_accounting_coa_id NUMBER;
90225 l_adr_flexfield_segment_code VARCHAR2(30);
90226 l_adr_flex_value_set_id NUMBER;
90227 l_adr_value_type_code VARCHAR2(30);
90228 l_adr_value_combination_id NUMBER;
90229 l_adr_value_segment_code VARCHAR2(30);
90230
90231 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
90232 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
90233 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
90234 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
90235
90236 -- 4262811 Variables ------------------------------------------------------------------------------------------
90237 l_entered_amt_idx NUMBER;
90238 l_accted_amt_idx NUMBER;
90239 l_acc_rev_flag VARCHAR2(1);
90240 l_accrual_line_num NUMBER;
90241 l_tmp_amt NUMBER;
90242 l_acc_rev_natural_side_code VARCHAR2(1);
90243
90244 l_num_entries NUMBER;
90245 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
90246 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
90247 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
90248 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
90249 l_recog_line_1 NUMBER;
90250 l_recog_line_2 NUMBER;
90251
90252 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
90253 l_bflow_applied_to_amt NUMBER; -- 5132302
90254 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
90255
90256 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
90257
90258 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
90259 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
90260
90261 ---------------------------------------------------------------------------------------------------------------
90262
90263
90264 --
90268 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
90265 -- bulk performance
90266 --
90267 l_balance_type_code VARCHAR2(1);
90269 l_log_module VARCHAR2(240);
90270
90271 --
90272 -- Upgrade strategy
90273 --
90274 l_actual_upg_option VARCHAR2(1);
90275 l_enc_upg_option VARCHAR2(1);
90276
90277 --
90278 BEGIN
90279 --
90280 IF g_log_enabled THEN
90281 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_290';
90282 END IF;
90283 --
90284 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
90285
90286 trace
90287 (p_msg => 'BEGIN of AcctLineType_290'
90288 ,p_level => C_LEVEL_PROCEDURE
90289 ,p_module => l_log_module);
90290
90291 END IF;
90292 --
90293 l_component_type := 'AMB_JLT';
90294 l_component_code := 'FA_PROC_OF_SALE_LOSS';
90295 l_component_type_code := 'S';
90296 l_component_appl_id := 140;
90297 l_amb_context_code := 'DEFAULT';
90298 l_entity_code := 'TRANSACTIONS';
90299 l_event_class_code := 'RETIREMENTS';
90300 l_event_type_code := 'REINSTATEMENTS';
90301 l_line_definition_owner_code := 'S';
90302 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
90303 --
90304 l_balance_type_code := 'A';
90305 l_segment := NULL;
90306 l_ccid := NULL;
90307 l_adr_transaction_coa_id := NULL;
90308 l_adr_accounting_coa_id := NULL;
90309 l_adr_flexfield_segment_code := NULL;
90310 l_adr_flex_value_set_id := NULL;
90311 l_adr_value_type_code := NULL;
90312 l_adr_value_combination_id := NULL;
90313 l_adr_value_segment_code := NULL;
90314
90315 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
90316 l_bflow_class_code := ''; -- 4219869 Business Flow
90317 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
90318 l_budgetary_control_flag := 'N';
90319
90320 l_bflow_applied_to_amt_idx := NULL; -- 5132302
90321 l_bflow_applied_to_amt := NULL; -- 5132302
90322 l_entered_amt_idx := NULL; -- 4262811
90323 l_accted_amt_idx := NULL; -- 4262811
90324 l_acc_rev_flag := NULL; -- 4262811
90325 l_accrual_line_num := NULL; -- 4262811
90326 l_tmp_amt := NULL; -- 4262811
90327 --
90328
90329 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
90330 l_balance_type_code <> 'B' THEN
90331 IF NVL(p_source_48,'
90332 ') = 'PROCEEDS' AND
90333 p_source_54 < 0
90334 THEN
90335
90336 --
90337 XLA_AE_LINES_PKG.SetNewLine;
90338
90339 p_balance_type_code := l_balance_type_code;
90340 -- set the flag so later we will know whether the gain loss line needs to be created
90341
90342 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
90343 p_actual_flag :='A';
90344 END IF;
90345
90346 --
90347 -- bulk performance
90348 --
90349 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
90350 p_header_num => 0); -- 4262811
90351 --
90352 -- set accounting line options
90353 --
90354 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
90355 p_natural_side_code => 'C'
90356 , p_gain_or_loss_flag => 'N'
90357 , p_gl_transfer_mode_code => 'S'
90358 , p_acct_entry_type_code => 'A'
90359 , p_switch_side_flag => 'Y'
90360 , p_merge_duplicate_code => 'N'
90361 );
90362 --
90363 l_acc_rev_natural_side_code := 'D'; -- 4262811
90364 --
90365 --
90366 -- set accounting line type info
90367 --
90368 xla_ae_lines_pkg.SetAcctLineType
90369 (p_component_type => l_component_type
90370 ,p_event_type_code => l_event_type_code
90371 ,p_line_definition_owner_code => l_line_definition_owner_code
90372 ,p_line_definition_code => l_line_definition_code
90373 ,p_accounting_line_code => l_component_code
90374 ,p_accounting_line_type_code => l_component_type_code
90375 ,p_accounting_line_appl_id => l_component_appl_id
90376 ,p_amb_context_code => l_amb_context_code
90377 ,p_entity_code => l_entity_code
90378 ,p_event_class_code => l_event_class_code);
90379 --
90380 -- set accounting class
90381 --
90382 xla_ae_lines_pkg.SetAcctClass(
90383 p_accounting_class_code => 'ASSET'
90384 , p_ae_header_id => l_ae_header_id
90385 );
90386
90387 --
90388 -- set rounding class
90389 --
90390 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
90391 'ASSET';
90392
90393 --
90394 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
90395 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
90396 --
90397 -- bulk performance
90398 --
90399 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
90403
90400
90401 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
90402 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
90404 -- 4955764
90405 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
90406 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
90407
90408 -- 4458381 Public Sector Enh
90409
90410 --
90411 -- set accounting attributes for the line type
90412 --
90413 l_entered_amt_idx := 4;
90414 l_accted_amt_idx := 6;
90415 l_bflow_applied_to_amt_idx := NULL; -- 5132302
90416 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
90417 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
90418 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
90419 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
90420 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
90421 l_rec_acct_attrs.array_char_value(3) := p_source_51;
90422 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
90423 l_rec_acct_attrs.array_num_value(4) := p_source_52;
90424 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
90425 l_rec_acct_attrs.array_char_value(5) := p_source_53;
90426 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
90427 l_rec_acct_attrs.array_num_value(6) := p_source_52;
90428
90429 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
90430 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
90431
90432 ---------------------------------------------------------------------------------------------------------------
90433 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
90434 ---------------------------------------------------------------------------------------------------------------
90435 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
90436
90437 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
90438 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
90439
90440 IF xla_accounting_cache_pkg.GetValueChar
90441 (p_source_code => 'LEDGER_CATEGORY_CODE'
90442 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
90443 AND l_bflow_method_code = 'PRIOR_ENTRY'
90444 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
90445 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
90446 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
90447 )
90448 THEN
90449 xla_ae_lines_pkg.BflowUpgEntry
90450 (p_business_method_code => l_bflow_method_code
90451 ,p_business_class_code => l_bflow_class_code
90452 ,p_balance_type => l_balance_type_code);
90453 ELSE
90454 NULL;
90455 -- No business flow processing for business flow method of NONE.
90456 END IF;
90457
90458 --
90459 -- call analytical criteria
90460 --
90461
90462 --
90463 -- call description
90464 --
90465
90466 xla_ae_lines_pkg.SetLineDescription(
90467 p_ae_header_id => l_ae_header_id
90468 ,p_description => Description_81 (
90469 p_application_id => p_application_id
90470 , p_ae_header_id => l_ae_header_id
90471 , p_source_1 => p_source_1
90472 )
90473 );
90474
90475
90476 --
90477 -- call ADRs
90478 -- Bug 4922099
90479 --
90480 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
90481 (NVL(l_actual_upg_option, 'N') = 'O') OR
90482 (NVL(l_enc_upg_option, 'N') = 'O')
90483 )
90484 THEN
90485 NULL;
90486 --
90487 --
90488
90489 l_ccid := AcctDerRule_174(
90490 p_application_id => p_application_id
90491 , p_ae_header_id => l_ae_header_id
90492 , p_source_5 => p_source_5
90493 , p_source_32 => p_source_32
90494 , x_transaction_coa_id => l_adr_transaction_coa_id
90495 , x_accounting_coa_id => l_adr_accounting_coa_id
90496 , x_value_type_code => l_adr_value_type_code
90497 , p_side => 'NA'
90498 );
90499
90500 xla_ae_lines_pkg.set_ccid(
90501 p_code_combination_id => l_ccid
90502 , p_value_type_code => l_adr_value_type_code
90503 , p_transaction_coa_id => l_adr_transaction_coa_id
90504 , p_accounting_coa_id => l_adr_accounting_coa_id
90505 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
90506 , p_adr_type_code => 'S'
90507 , p_component_type => l_component_type
90508 , p_component_code => l_component_code
90509 , p_component_type_code => l_component_type_code
90510 , p_component_appl_id => l_component_appl_id
90511 , p_amb_context_code => l_amb_context_code
90512 , p_side => 'NA'
90513 );
90514
90515
90516 l_segment := AcctDerRule_169(
90517 p_application_id => p_application_id
90521 , x_transaction_coa_id => l_adr_transaction_coa_id
90518 , p_ae_header_id => l_ae_header_id
90519 , p_source_5 => p_source_5
90520 , p_source_31 => p_source_31
90522 , x_accounting_coa_id => l_adr_accounting_coa_id
90523 , x_flexfield_segment_code => l_adr_flexfield_segment_code
90524 , x_flex_value_set_id => l_adr_flex_value_set_id
90525 , x_value_type_code => l_adr_value_type_code
90526 , x_value_combination_id => l_adr_value_combination_id
90527 , x_value_segment_code => l_adr_value_segment_code
90528 , p_side => 'NA'
90529 , p_override_seg_flag => 'Y'
90530 );
90531
90532 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
90533
90534 xla_ae_lines_pkg.set_segment(
90535 p_to_segment_code => 'GL_BALANCING'
90536 , p_segment_value => l_segment
90537 , p_from_segment_code => l_adr_value_segment_code
90538 , p_from_combination_id => l_adr_value_combination_id
90539 , p_value_type_code => l_adr_value_type_code
90540 , p_transaction_coa_id => l_adr_transaction_coa_id
90541 , p_accounting_coa_id => l_adr_accounting_coa_id
90542 , p_flexfield_segment_code => l_adr_flexfield_segment_code
90543 , p_flex_value_set_id => l_adr_flex_value_set_id
90544 , p_adr_code => 'FA_EXPENSE_ACCT'
90545 , p_adr_type_code => 'S'
90546 , p_component_type => l_component_type
90547 , p_component_code => l_component_code
90548 , p_component_type_code => l_component_type_code
90549 , p_component_appl_id => l_component_appl_id
90550 , p_amb_context_code => l_amb_context_code
90551 , p_entity_code => 'TRANSACTIONS'
90552 , p_event_class_code => 'RETIREMENTS'
90553 , p_side => 'NA'
90554 );
90555
90556 END IF;
90557
90558 l_segment := AcctDerRule_164(
90559 p_application_id => p_application_id
90560 , p_ae_header_id => l_ae_header_id
90561 , p_source_5 => p_source_5
90562 , p_source_27 => p_source_27
90563 , x_transaction_coa_id => l_adr_transaction_coa_id
90564 , x_accounting_coa_id => l_adr_accounting_coa_id
90565 , x_flexfield_segment_code => l_adr_flexfield_segment_code
90566 , x_flex_value_set_id => l_adr_flex_value_set_id
90567 , x_value_type_code => l_adr_value_type_code
90568 , x_value_combination_id => l_adr_value_combination_id
90569 , x_value_segment_code => l_adr_value_segment_code
90570 , p_side => 'NA'
90571 , p_override_seg_flag => 'Y'
90572 );
90573
90574 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
90575
90576 xla_ae_lines_pkg.set_segment(
90577 p_to_segment_code => 'GL_ACCOUNT'
90578 , p_segment_value => l_segment
90579 , p_from_segment_code => l_adr_value_segment_code
90580 , p_from_combination_id => l_adr_value_combination_id
90581 , p_value_type_code => l_adr_value_type_code
90582 , p_transaction_coa_id => l_adr_transaction_coa_id
90583 , p_accounting_coa_id => l_adr_accounting_coa_id
90584 , p_flexfield_segment_code => l_adr_flexfield_segment_code
90585 , p_flex_value_set_id => l_adr_flex_value_set_id
90586 , p_adr_code => 'FA_PROC_OF_SALE_LOSS_SEGMENT'
90587 , p_adr_type_code => 'S'
90588 , p_component_type => l_component_type
90589 , p_component_code => l_component_code
90590 , p_component_type_code => l_component_type_code
90591 , p_component_appl_id => l_component_appl_id
90592 , p_amb_context_code => l_amb_context_code
90593 , p_entity_code => 'TRANSACTIONS'
90594 , p_event_class_code => 'RETIREMENTS'
90595 , p_side => 'NA'
90596 );
90597
90598 END IF;
90599
90600 --
90601 --
90602 END IF;
90603 --
90604 -- Bug 4922099
90605 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
90606 (NVL(l_enc_upg_option, 'N') = 'O')
90607 ) AND
90608 (l_bflow_method_code = 'PRIOR_ENTRY')
90609 )
90610 THEN
90611 IF
90612 --
90613 1 = 2
90614 --
90615 THEN
90616 xla_accounting_err_pkg.build_message
90617 (p_appli_s_name => 'XLA'
90618 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
90619 ,p_token_1 => 'LINE_NUMBER'
90620 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
90621 ,p_token_2 => 'LINE_TYPE_NAME'
90622 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
90623 l_component_type
90624 ,l_component_code
90628 ,l_entity_code
90625 ,l_component_type_code
90626 ,l_component_appl_id
90627 ,l_amb_context_code
90629 ,l_event_class_code
90630 )
90631 ,p_token_3 => 'OWNER'
90632 ,p_value_3 => xla_lookups_pkg.get_meaning(
90633 p_lookup_type => 'XLA_OWNER_TYPE'
90634 ,p_lookup_code => l_component_type_code
90635 )
90636 ,p_token_4 => 'PRODUCT_NAME'
90637 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
90638 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
90639 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
90640 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
90641 ,p_ae_header_id => NULL
90642 );
90643
90644 IF (C_LEVEL_ERROR>= g_log_level) THEN
90645 trace
90646 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
90647 ,p_level => C_LEVEL_ERROR
90648 ,p_module => l_log_module);
90649 END IF;
90650 END IF;
90651 END IF;
90652 --
90653 --
90654 ------------------------------------------------------------------------------------------------
90655 -- 4219869 Business Flow
90656 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
90657 -- Prior Entry. Currently, the following code is always generated.
90658 ------------------------------------------------------------------------------------------------
90659 XLA_AE_LINES_PKG.ValidateCurrentLine;
90660
90661 ------------------------------------------------------------------------------------
90662 -- 4219869 Business Flow
90663 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
90664 ------------------------------------------------------------------------------------
90665 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
90666
90667 ----------------------------------------------------------------------------------
90668 -- 4219869 Business Flow
90669 -- Update journal entry status -- Need to generate this within IF <condition>
90670 ----------------------------------------------------------------------------------
90671 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
90672 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
90673 ,p_balance_type_code => l_balance_type_code
90674 );
90675
90676 -------------------------------------------------------------------------------------------
90677 -- 4262811 - Generate the Accrual Reversal lines
90678 -------------------------------------------------------------------------------------------
90679 BEGIN
90680 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
90681 (g_array_event(p_event_id).array_value_num('header_index'));
90682 IF l_acc_rev_flag IS NULL THEN
90683 l_acc_rev_flag := 'N';
90684 END IF;
90685 EXCEPTION
90686 WHEN OTHERS THEN
90687 l_acc_rev_flag := 'N';
90688 END;
90689 --
90690 IF (l_acc_rev_flag = 'Y') THEN
90691
90692 -- 4645092 ------------------------------------------------------------------------------
90693 -- To allow MPA report to determine if it should generate report process
90694 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
90695 ------------------------------------------------------------------------------------------
90696
90697 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
90698 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
90699 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
90700 -- call ADRs
90701 -- Bug 4922099
90702 --
90703 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
90704 (NVL(l_actual_upg_option, 'N') = 'O') OR
90705 (NVL(l_enc_upg_option, 'N') = 'O')
90706 )
90707 THEN
90708 NULL;
90709 --
90710 --
90711
90712 l_ccid := AcctDerRule_174(
90713 p_application_id => p_application_id
90714 , p_ae_header_id => l_ae_header_id
90715 , p_source_5 => p_source_5
90716 , p_source_32 => p_source_32
90717 , x_transaction_coa_id => l_adr_transaction_coa_id
90718 , x_accounting_coa_id => l_adr_accounting_coa_id
90719 , x_value_type_code => l_adr_value_type_code
90720 , p_side => 'NA'
90721 );
90722
90723 xla_ae_lines_pkg.set_ccid(
90724 p_code_combination_id => l_ccid
90725 , p_value_type_code => l_adr_value_type_code
90729 , p_adr_type_code => 'S'
90726 , p_transaction_coa_id => l_adr_transaction_coa_id
90727 , p_accounting_coa_id => l_adr_accounting_coa_id
90728 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
90730 , p_component_type => l_component_type
90731 , p_component_code => l_component_code
90732 , p_component_type_code => l_component_type_code
90733 , p_component_appl_id => l_component_appl_id
90734 , p_amb_context_code => l_amb_context_code
90735 , p_side => 'NA'
90736 );
90737
90738
90739 l_segment := AcctDerRule_169(
90740 p_application_id => p_application_id
90741 , p_ae_header_id => l_ae_header_id
90742 , p_source_5 => p_source_5
90743 , p_source_31 => p_source_31
90744 , x_transaction_coa_id => l_adr_transaction_coa_id
90745 , x_accounting_coa_id => l_adr_accounting_coa_id
90746 , x_flexfield_segment_code => l_adr_flexfield_segment_code
90747 , x_flex_value_set_id => l_adr_flex_value_set_id
90748 , x_value_type_code => l_adr_value_type_code
90749 , x_value_combination_id => l_adr_value_combination_id
90750 , x_value_segment_code => l_adr_value_segment_code
90751 , p_side => 'NA'
90752 , p_override_seg_flag => 'Y'
90753 );
90754
90755 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
90756
90757 xla_ae_lines_pkg.set_segment(
90758 p_to_segment_code => 'GL_BALANCING'
90759 , p_segment_value => l_segment
90760 , p_from_segment_code => l_adr_value_segment_code
90761 , p_from_combination_id => l_adr_value_combination_id
90762 , p_value_type_code => l_adr_value_type_code
90763 , p_transaction_coa_id => l_adr_transaction_coa_id
90764 , p_accounting_coa_id => l_adr_accounting_coa_id
90765 , p_flexfield_segment_code => l_adr_flexfield_segment_code
90766 , p_flex_value_set_id => l_adr_flex_value_set_id
90767 , p_adr_code => 'FA_EXPENSE_ACCT'
90768 , p_adr_type_code => 'S'
90769 , p_component_type => l_component_type
90770 , p_component_code => l_component_code
90771 , p_component_type_code => l_component_type_code
90772 , p_component_appl_id => l_component_appl_id
90773 , p_amb_context_code => l_amb_context_code
90774 , p_entity_code => 'TRANSACTIONS'
90775 , p_event_class_code => 'RETIREMENTS'
90776 , p_side => 'NA'
90777 );
90778
90779 END IF;
90780
90781 l_segment := AcctDerRule_164(
90782 p_application_id => p_application_id
90783 , p_ae_header_id => l_ae_header_id
90784 , p_source_5 => p_source_5
90785 , p_source_27 => p_source_27
90786 , x_transaction_coa_id => l_adr_transaction_coa_id
90787 , x_accounting_coa_id => l_adr_accounting_coa_id
90788 , x_flexfield_segment_code => l_adr_flexfield_segment_code
90789 , x_flex_value_set_id => l_adr_flex_value_set_id
90790 , x_value_type_code => l_adr_value_type_code
90791 , x_value_combination_id => l_adr_value_combination_id
90792 , x_value_segment_code => l_adr_value_segment_code
90793 , p_side => 'NA'
90794 , p_override_seg_flag => 'Y'
90795 );
90796
90797 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
90798
90799 xla_ae_lines_pkg.set_segment(
90800 p_to_segment_code => 'GL_ACCOUNT'
90801 , p_segment_value => l_segment
90802 , p_from_segment_code => l_adr_value_segment_code
90803 , p_from_combination_id => l_adr_value_combination_id
90804 , p_value_type_code => l_adr_value_type_code
90805 , p_transaction_coa_id => l_adr_transaction_coa_id
90806 , p_accounting_coa_id => l_adr_accounting_coa_id
90807 , p_flexfield_segment_code => l_adr_flexfield_segment_code
90808 , p_flex_value_set_id => l_adr_flex_value_set_id
90809 , p_adr_code => 'FA_PROC_OF_SALE_LOSS_SEGMENT'
90810 , p_adr_type_code => 'S'
90811 , p_component_type => l_component_type
90812 , p_component_code => l_component_code
90813 , p_component_type_code => l_component_type_code
90814 , p_component_appl_id => l_component_appl_id
90815 , p_amb_context_code => l_amb_context_code
90816 , p_entity_code => 'TRANSACTIONS'
90817 , p_event_class_code => 'RETIREMENTS'
90818 , p_side => 'NA'
90819 );
90820
90821 END IF;
90822
90823 --
90824 --
90825 END IF;
90826
90827 --
90828 -- Update the line information that should be overwritten
90829 --
90830 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
90831 p_header_num => 1);
90832 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
90833
90834 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
90835
90839
90836 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
90837 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
90838 END IF;
90840 --
90841 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
90842 --
90843 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
90844 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
90845 ELSE
90846 ---------------------------------------------------------------------------------------------------
90847 -- 4262811a Switch Sign
90848 ---------------------------------------------------------------------------------------------------
90849 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
90850 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
90851 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
90852 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
90853 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
90854 -- 5132302
90855 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
90856 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
90857
90858 END IF;
90859
90860 -- 4955764
90861 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
90862 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
90863
90864
90865 XLA_AE_LINES_PKG.ValidateCurrentLine;
90866 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
90867
90868 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
90869 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
90870 ,p_balance_type_code => l_balance_type_code);
90871
90872 END IF;
90873
90874 -----------------------------------------------------------------------------------------
90875 -- 4262811 Multiperiod Accounting
90876 -----------------------------------------------------------------------------------------
90877 -- No MPA option is assigned.
90878
90879
90880 END IF;
90881 END IF;
90882 --
90883
90884 --
90885 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
90886 trace
90887 (p_msg => 'END of AcctLineType_290'
90888 ,p_level => C_LEVEL_PROCEDURE
90889 ,p_module => l_log_module);
90890 END IF;
90891 --
90892 EXCEPTION
90893 WHEN xla_exceptions_pkg.application_exception THEN
90894 RAISE;
90895 WHEN OTHERS THEN
90896 xla_exceptions_pkg.raise_message
90897 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_290');
90898 END AcctLineType_290;
90899 --
90900
90901 ---------------------------------------
90902 --
90903 -- PRIVATE FUNCTION
90904 -- AcctLineType_291
90905 --
90906 ---------------------------------------
90907 PROCEDURE AcctLineType_291 (
90908 p_application_id IN NUMBER
90909 ,p_event_id IN NUMBER
90910 ,p_calculate_acctd_flag IN VARCHAR2
90911 ,p_calculate_g_l_flag IN VARCHAR2
90912 ,p_actual_flag IN OUT VARCHAR2
90913 ,p_balance_type_code OUT VARCHAR2
90914 ,p_gain_or_loss_ref OUT VARCHAR2
90915
90916 --Period Close Date
90917 , p_source_1 IN DATE
90918 --Bonus Depreciation Expense Account
90919 , p_source_4 IN VARCHAR2
90920 --Generated Code Combination Identifier
90921 , p_source_5 IN NUMBER
90922 --Expense Account Code Combination Identifier
90923 , p_source_31 IN NUMBER
90924 --Adjustment Type
90925 , p_source_48 IN VARCHAR2
90926 --Transaction Header Identifier
90927 , p_source_49 IN NUMBER
90928 --Adjustment Line Identifier
90929 , p_source_50 IN NUMBER
90930 --Distribution Type Code
90931 , p_source_51 IN VARCHAR2
90932 --Entered Amount
90933 , p_source_52 IN NUMBER
90934 --Currency Code
90935 , p_source_53 IN VARCHAR2
90936 --Source Destination Code
90937 , p_source_55 IN VARCHAR2
90938 )
90939 IS
90940
90941 l_component_type VARCHAR2(80);
90942 l_component_code VARCHAR2(30);
90943 l_component_type_code VARCHAR2(1);
90944 l_component_appl_id INTEGER;
90945 l_amb_context_code VARCHAR2(30);
90946 l_entity_code VARCHAR2(30);
90947 l_event_class_code VARCHAR2(30);
90948 l_ae_header_id NUMBER;
90949 l_event_type_code VARCHAR2(30);
90950 l_line_definition_code VARCHAR2(30);
90951 l_line_definition_owner_code VARCHAR2(1);
90952 --
90953 -- adr variables
90954 l_segment VARCHAR2(30);
90955 l_ccid NUMBER;
90956 l_adr_transaction_coa_id NUMBER;
90957 l_adr_accounting_coa_id NUMBER;
90958 l_adr_flexfield_segment_code VARCHAR2(30);
90959 l_adr_flex_value_set_id NUMBER;
90960 l_adr_value_type_code VARCHAR2(30);
90964 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
90961 l_adr_value_combination_id NUMBER;
90962 l_adr_value_segment_code VARCHAR2(30);
90963
90965 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
90966 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
90967 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
90968
90969 -- 4262811 Variables ------------------------------------------------------------------------------------------
90970 l_entered_amt_idx NUMBER;
90971 l_accted_amt_idx NUMBER;
90972 l_acc_rev_flag VARCHAR2(1);
90973 l_accrual_line_num NUMBER;
90974 l_tmp_amt NUMBER;
90975 l_acc_rev_natural_side_code VARCHAR2(1);
90976
90977 l_num_entries NUMBER;
90978 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
90979 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
90980 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
90981 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
90982 l_recog_line_1 NUMBER;
90983 l_recog_line_2 NUMBER;
90984
90985 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
90986 l_bflow_applied_to_amt NUMBER; -- 5132302
90987 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
90988
90989 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
90990
90991 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
90992 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
90993
90994 ---------------------------------------------------------------------------------------------------------------
90995
90996
90997 --
90998 -- bulk performance
90999 --
91000 l_balance_type_code VARCHAR2(1);
91001 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
91002 l_log_module VARCHAR2(240);
91003
91004 --
91005 -- Upgrade strategy
91006 --
91007 l_actual_upg_option VARCHAR2(1);
91008 l_enc_upg_option VARCHAR2(1);
91009
91010 --
91011 BEGIN
91012 --
91013 IF g_log_enabled THEN
91014 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_291';
91015 END IF;
91016 --
91017 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
91018
91019 trace
91020 (p_msg => 'BEGIN of AcctLineType_291'
91021 ,p_level => C_LEVEL_PROCEDURE
91022 ,p_module => l_log_module);
91023
91024 END IF;
91025 --
91026 l_component_type := 'AMB_JLT';
91027 l_component_code := 'FA_RECLASS_DEST_BONUS_EXP';
91028 l_component_type_code := 'S';
91029 l_component_appl_id := 140;
91030 l_amb_context_code := 'DEFAULT';
91031 l_entity_code := 'TRANSACTIONS';
91032 l_event_class_code := 'CATEGORY_RECLASS';
91033 l_event_type_code := 'CATEGORY_RECLASS_ALL';
91034 l_line_definition_owner_code := 'S';
91035 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
91036 --
91037 l_balance_type_code := 'A';
91038 l_segment := NULL;
91039 l_ccid := NULL;
91040 l_adr_transaction_coa_id := NULL;
91041 l_adr_accounting_coa_id := NULL;
91042 l_adr_flexfield_segment_code := NULL;
91043 l_adr_flex_value_set_id := NULL;
91044 l_adr_value_type_code := NULL;
91045 l_adr_value_combination_id := NULL;
91046 l_adr_value_segment_code := NULL;
91047
91048 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
91049 l_bflow_class_code := ''; -- 4219869 Business Flow
91050 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
91051 l_budgetary_control_flag := 'N';
91052
91053 l_bflow_applied_to_amt_idx := NULL; -- 5132302
91054 l_bflow_applied_to_amt := NULL; -- 5132302
91055 l_entered_amt_idx := NULL; -- 4262811
91056 l_accted_amt_idx := NULL; -- 4262811
91057 l_acc_rev_flag := NULL; -- 4262811
91058 l_accrual_line_num := NULL; -- 4262811
91059 l_tmp_amt := NULL; -- 4262811
91060 --
91061
91062 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
91063 l_balance_type_code <> 'B' THEN
91064 IF NVL(p_source_48,'
91065 ') = 'BONUS EXPENSE' AND
91066 NVL(p_source_55,'
91067 ') = 'DEST'
91068 THEN
91069
91070 --
91071 XLA_AE_LINES_PKG.SetNewLine;
91072
91073 p_balance_type_code := l_balance_type_code;
91074 -- set the flag so later we will know whether the gain loss line needs to be created
91075
91076 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
91077 p_actual_flag :='A';
91078 END IF;
91079
91080 --
91081 -- bulk performance
91082 --
91083 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
91084 p_header_num => 0); -- 4262811
91085 --
91086 -- set accounting line options
91087 --
91088 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
91092 , p_acct_entry_type_code => 'A'
91089 p_natural_side_code => 'D'
91090 , p_gain_or_loss_flag => 'N'
91091 , p_gl_transfer_mode_code => 'S'
91093 , p_switch_side_flag => 'Y'
91094 , p_merge_duplicate_code => 'N'
91095 );
91096 --
91097 l_acc_rev_natural_side_code := 'C'; -- 4262811
91098 --
91099 --
91100 -- set accounting line type info
91101 --
91102 xla_ae_lines_pkg.SetAcctLineType
91103 (p_component_type => l_component_type
91104 ,p_event_type_code => l_event_type_code
91105 ,p_line_definition_owner_code => l_line_definition_owner_code
91106 ,p_line_definition_code => l_line_definition_code
91107 ,p_accounting_line_code => l_component_code
91108 ,p_accounting_line_type_code => l_component_type_code
91109 ,p_accounting_line_appl_id => l_component_appl_id
91110 ,p_amb_context_code => l_amb_context_code
91111 ,p_entity_code => l_entity_code
91112 ,p_event_class_code => l_event_class_code);
91113 --
91114 -- set accounting class
91115 --
91116 xla_ae_lines_pkg.SetAcctClass(
91117 p_accounting_class_code => 'EXPENSE'
91118 , p_ae_header_id => l_ae_header_id
91119 );
91120
91121 --
91122 -- set rounding class
91123 --
91124 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
91125 'EXPENSE';
91126
91127 --
91128 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
91129 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
91130 --
91131 -- bulk performance
91132 --
91133 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
91134
91135 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
91136 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
91137
91138 -- 4955764
91139 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
91140 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
91141
91142 -- 4458381 Public Sector Enh
91143
91144 --
91145 -- set accounting attributes for the line type
91146 --
91147 l_entered_amt_idx := 4;
91148 l_accted_amt_idx := 6;
91149 l_bflow_applied_to_amt_idx := NULL; -- 5132302
91150 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
91151 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
91152 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
91153 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
91154 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
91155 l_rec_acct_attrs.array_char_value(3) := p_source_51;
91156 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
91157 l_rec_acct_attrs.array_num_value(4) := p_source_52;
91158 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
91159 l_rec_acct_attrs.array_char_value(5) := p_source_53;
91160 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
91161 l_rec_acct_attrs.array_num_value(6) := p_source_52;
91162
91163 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
91164 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
91165
91166 ---------------------------------------------------------------------------------------------------------------
91167 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
91168 ---------------------------------------------------------------------------------------------------------------
91169 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
91170
91171 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
91172 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
91173
91174 IF xla_accounting_cache_pkg.GetValueChar
91175 (p_source_code => 'LEDGER_CATEGORY_CODE'
91176 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
91177 AND l_bflow_method_code = 'PRIOR_ENTRY'
91178 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
91179 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
91180 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
91181 )
91182 THEN
91183 xla_ae_lines_pkg.BflowUpgEntry
91184 (p_business_method_code => l_bflow_method_code
91185 ,p_business_class_code => l_bflow_class_code
91186 ,p_balance_type => l_balance_type_code);
91187 ELSE
91188 NULL;
91189 -- No business flow processing for business flow method of NONE.
91190 END IF;
91191
91192 --
91193 -- call analytical criteria
91194 --
91195
91196 --
91197 -- call description
91198 --
91199
91200 xla_ae_lines_pkg.SetLineDescription(
91201 p_ae_header_id => l_ae_header_id
91202 ,p_description => Description_63 (
91206 )
91203 p_application_id => p_application_id
91204 , p_ae_header_id => l_ae_header_id
91205 , p_source_1 => p_source_1
91207 );
91208
91209
91210 --
91211 -- call ADRs
91212 -- Bug 4922099
91213 --
91214 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
91215 (NVL(l_actual_upg_option, 'N') = 'O') OR
91216 (NVL(l_enc_upg_option, 'N') = 'O')
91217 )
91218 THEN
91219 NULL;
91220 --
91221 --
91222
91223 l_ccid := AcctDerRule_176(
91224 p_application_id => p_application_id
91225 , p_ae_header_id => l_ae_header_id
91226 , p_source_5 => p_source_5
91227 , p_source_31 => p_source_31
91228 , x_transaction_coa_id => l_adr_transaction_coa_id
91229 , x_accounting_coa_id => l_adr_accounting_coa_id
91230 , x_value_type_code => l_adr_value_type_code
91231 , p_side => 'NA'
91232 );
91233
91234 xla_ae_lines_pkg.set_ccid(
91235 p_code_combination_id => l_ccid
91236 , p_value_type_code => l_adr_value_type_code
91237 , p_transaction_coa_id => l_adr_transaction_coa_id
91238 , p_accounting_coa_id => l_adr_accounting_coa_id
91239 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
91240 , p_adr_type_code => 'S'
91241 , p_component_type => l_component_type
91242 , p_component_code => l_component_code
91243 , p_component_type_code => l_component_type_code
91244 , p_component_appl_id => l_component_appl_id
91245 , p_amb_context_code => l_amb_context_code
91246 , p_side => 'NA'
91247 );
91248
91249
91250 l_segment := AcctDerRule_144(
91251 p_application_id => p_application_id
91252 , p_ae_header_id => l_ae_header_id
91253 , p_source_4 => p_source_4
91254 , p_source_5 => p_source_5
91255 , x_transaction_coa_id => l_adr_transaction_coa_id
91256 , x_accounting_coa_id => l_adr_accounting_coa_id
91257 , x_flexfield_segment_code => l_adr_flexfield_segment_code
91258 , x_flex_value_set_id => l_adr_flex_value_set_id
91259 , x_value_type_code => l_adr_value_type_code
91260 , x_value_combination_id => l_adr_value_combination_id
91261 , x_value_segment_code => l_adr_value_segment_code
91262 , p_side => 'NA'
91263 , p_override_seg_flag => 'Y'
91264 );
91265
91266 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
91267
91268 xla_ae_lines_pkg.set_segment(
91269 p_to_segment_code => 'GL_ACCOUNT'
91270 , p_segment_value => l_segment
91271 , p_from_segment_code => l_adr_value_segment_code
91272 , p_from_combination_id => l_adr_value_combination_id
91273 , p_value_type_code => l_adr_value_type_code
91274 , p_transaction_coa_id => l_adr_transaction_coa_id
91275 , p_accounting_coa_id => l_adr_accounting_coa_id
91276 , p_flexfield_segment_code => l_adr_flexfield_segment_code
91277 , p_flex_value_set_id => l_adr_flex_value_set_id
91278 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
91279 , p_adr_type_code => 'S'
91280 , p_component_type => l_component_type
91281 , p_component_code => l_component_code
91282 , p_component_type_code => l_component_type_code
91283 , p_component_appl_id => l_component_appl_id
91284 , p_amb_context_code => l_amb_context_code
91285 , p_entity_code => 'TRANSACTIONS'
91286 , p_event_class_code => 'CATEGORY_RECLASS'
91287 , p_side => 'NA'
91288 );
91289
91290 END IF;
91291
91292 --
91293 --
91294 END IF;
91295 --
91296 -- Bug 4922099
91297 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
91298 (NVL(l_enc_upg_option, 'N') = 'O')
91299 ) AND
91300 (l_bflow_method_code = 'PRIOR_ENTRY')
91301 )
91302 THEN
91303 IF
91304 --
91305 1 = 2
91306 --
91307 THEN
91308 xla_accounting_err_pkg.build_message
91309 (p_appli_s_name => 'XLA'
91310 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
91311 ,p_token_1 => 'LINE_NUMBER'
91312 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
91313 ,p_token_2 => 'LINE_TYPE_NAME'
91314 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
91315 l_component_type
91316 ,l_component_code
91317 ,l_component_type_code
91318 ,l_component_appl_id
91319 ,l_amb_context_code
91320 ,l_entity_code
91324 ,p_value_3 => xla_lookups_pkg.get_meaning(
91321 ,l_event_class_code
91322 )
91323 ,p_token_3 => 'OWNER'
91325 p_lookup_type => 'XLA_OWNER_TYPE'
91326 ,p_lookup_code => l_component_type_code
91327 )
91328 ,p_token_4 => 'PRODUCT_NAME'
91329 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
91330 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
91331 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
91332 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
91333 ,p_ae_header_id => NULL
91334 );
91335
91336 IF (C_LEVEL_ERROR>= g_log_level) THEN
91337 trace
91338 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
91339 ,p_level => C_LEVEL_ERROR
91340 ,p_module => l_log_module);
91341 END IF;
91342 END IF;
91343 END IF;
91344 --
91345 --
91346 ------------------------------------------------------------------------------------------------
91347 -- 4219869 Business Flow
91348 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
91349 -- Prior Entry. Currently, the following code is always generated.
91350 ------------------------------------------------------------------------------------------------
91351 XLA_AE_LINES_PKG.ValidateCurrentLine;
91352
91353 ------------------------------------------------------------------------------------
91354 -- 4219869 Business Flow
91355 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
91356 ------------------------------------------------------------------------------------
91357 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
91358
91359 ----------------------------------------------------------------------------------
91360 -- 4219869 Business Flow
91361 -- Update journal entry status -- Need to generate this within IF <condition>
91362 ----------------------------------------------------------------------------------
91363 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
91364 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
91365 ,p_balance_type_code => l_balance_type_code
91366 );
91367
91368 -------------------------------------------------------------------------------------------
91369 -- 4262811 - Generate the Accrual Reversal lines
91370 -------------------------------------------------------------------------------------------
91371 BEGIN
91372 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
91373 (g_array_event(p_event_id).array_value_num('header_index'));
91374 IF l_acc_rev_flag IS NULL THEN
91375 l_acc_rev_flag := 'N';
91376 END IF;
91377 EXCEPTION
91378 WHEN OTHERS THEN
91379 l_acc_rev_flag := 'N';
91380 END;
91381 --
91382 IF (l_acc_rev_flag = 'Y') THEN
91383
91384 -- 4645092 ------------------------------------------------------------------------------
91385 -- To allow MPA report to determine if it should generate report process
91386 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
91387 ------------------------------------------------------------------------------------------
91388
91389 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
91390 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
91391 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
91392 -- call ADRs
91393 -- Bug 4922099
91394 --
91395 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
91396 (NVL(l_actual_upg_option, 'N') = 'O') OR
91397 (NVL(l_enc_upg_option, 'N') = 'O')
91398 )
91399 THEN
91400 NULL;
91401 --
91402 --
91403
91404 l_ccid := AcctDerRule_176(
91405 p_application_id => p_application_id
91406 , p_ae_header_id => l_ae_header_id
91407 , p_source_5 => p_source_5
91408 , p_source_31 => p_source_31
91409 , x_transaction_coa_id => l_adr_transaction_coa_id
91410 , x_accounting_coa_id => l_adr_accounting_coa_id
91411 , x_value_type_code => l_adr_value_type_code
91412 , p_side => 'NA'
91413 );
91414
91415 xla_ae_lines_pkg.set_ccid(
91416 p_code_combination_id => l_ccid
91417 , p_value_type_code => l_adr_value_type_code
91418 , p_transaction_coa_id => l_adr_transaction_coa_id
91419 , p_accounting_coa_id => l_adr_accounting_coa_id
91420 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
91421 , p_adr_type_code => 'S'
91425 , p_component_appl_id => l_component_appl_id
91422 , p_component_type => l_component_type
91423 , p_component_code => l_component_code
91424 , p_component_type_code => l_component_type_code
91426 , p_amb_context_code => l_amb_context_code
91427 , p_side => 'NA'
91428 );
91429
91430
91431 l_segment := AcctDerRule_144(
91432 p_application_id => p_application_id
91433 , p_ae_header_id => l_ae_header_id
91434 , p_source_4 => p_source_4
91435 , p_source_5 => p_source_5
91436 , x_transaction_coa_id => l_adr_transaction_coa_id
91437 , x_accounting_coa_id => l_adr_accounting_coa_id
91438 , x_flexfield_segment_code => l_adr_flexfield_segment_code
91439 , x_flex_value_set_id => l_adr_flex_value_set_id
91440 , x_value_type_code => l_adr_value_type_code
91441 , x_value_combination_id => l_adr_value_combination_id
91442 , x_value_segment_code => l_adr_value_segment_code
91443 , p_side => 'NA'
91444 , p_override_seg_flag => 'Y'
91445 );
91446
91447 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
91448
91449 xla_ae_lines_pkg.set_segment(
91450 p_to_segment_code => 'GL_ACCOUNT'
91451 , p_segment_value => l_segment
91452 , p_from_segment_code => l_adr_value_segment_code
91453 , p_from_combination_id => l_adr_value_combination_id
91454 , p_value_type_code => l_adr_value_type_code
91455 , p_transaction_coa_id => l_adr_transaction_coa_id
91456 , p_accounting_coa_id => l_adr_accounting_coa_id
91457 , p_flexfield_segment_code => l_adr_flexfield_segment_code
91458 , p_flex_value_set_id => l_adr_flex_value_set_id
91459 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
91460 , p_adr_type_code => 'S'
91461 , p_component_type => l_component_type
91462 , p_component_code => l_component_code
91463 , p_component_type_code => l_component_type_code
91464 , p_component_appl_id => l_component_appl_id
91465 , p_amb_context_code => l_amb_context_code
91466 , p_entity_code => 'TRANSACTIONS'
91467 , p_event_class_code => 'CATEGORY_RECLASS'
91468 , p_side => 'NA'
91469 );
91470
91471 END IF;
91472
91473 --
91474 --
91475 END IF;
91476
91477 --
91478 -- Update the line information that should be overwritten
91479 --
91480 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
91481 p_header_num => 1);
91482 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
91483
91484 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
91485
91486 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
91487 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
91488 END IF;
91489
91490 --
91491 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
91492 --
91493 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
91494 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
91495 ELSE
91496 ---------------------------------------------------------------------------------------------------
91497 -- 4262811a Switch Sign
91498 ---------------------------------------------------------------------------------------------------
91499 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
91500 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
91501 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
91502 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
91503 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
91504 -- 5132302
91505 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
91506 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
91507
91508 END IF;
91509
91510 -- 4955764
91511 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
91512 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
91513
91514
91515 XLA_AE_LINES_PKG.ValidateCurrentLine;
91516 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
91517
91518 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
91519 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
91520 ,p_balance_type_code => l_balance_type_code);
91521
91522 END IF;
91523
91524 -----------------------------------------------------------------------------------------
91525 -- 4262811 Multiperiod Accounting
91529
91526 -----------------------------------------------------------------------------------------
91527 -- No MPA option is assigned.
91528
91530 END IF;
91531 END IF;
91532 --
91533
91534 --
91535 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
91536 trace
91537 (p_msg => 'END of AcctLineType_291'
91538 ,p_level => C_LEVEL_PROCEDURE
91539 ,p_module => l_log_module);
91540 END IF;
91541 --
91542 EXCEPTION
91543 WHEN xla_exceptions_pkg.application_exception THEN
91544 RAISE;
91545 WHEN OTHERS THEN
91546 xla_exceptions_pkg.raise_message
91547 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_291');
91548 END AcctLineType_291;
91549 --
91550
91551 ---------------------------------------
91552 --
91553 -- PRIVATE FUNCTION
91554 -- AcctLineType_292
91555 --
91556 ---------------------------------------
91557 PROCEDURE AcctLineType_292 (
91558 p_application_id IN NUMBER
91559 ,p_event_id IN NUMBER
91560 ,p_calculate_acctd_flag IN VARCHAR2
91561 ,p_calculate_g_l_flag IN VARCHAR2
91562 ,p_actual_flag IN OUT VARCHAR2
91563 ,p_balance_type_code OUT VARCHAR2
91564 ,p_gain_or_loss_ref OUT VARCHAR2
91565
91566 --Period Close Date
91567 , p_source_1 IN DATE
91568 --Generated Code Combination Identifier
91569 , p_source_5 IN NUMBER
91570 --Bonus Reserve Account
91571 , p_source_6 IN VARCHAR2
91572 --Generated Offset Code Combination Identifier
91573 , p_source_19 IN NUMBER
91574 --Expense Account Code Combination Identifier
91575 , p_source_31 IN NUMBER
91576 --Default Code Combination Identifier
91577 , p_source_32 IN NUMBER
91578 --Adjustment Type
91579 , p_source_48 IN VARCHAR2
91580 --Transaction Header Identifier
91581 , p_source_49 IN NUMBER
91582 --Adjustment Line Identifier
91583 , p_source_50 IN NUMBER
91584 --Distribution Type Code
91585 , p_source_51 IN VARCHAR2
91586 --Entered Amount
91587 , p_source_52 IN NUMBER
91588 --Currency Code
91589 , p_source_53 IN VARCHAR2
91590 --Source Destination Code
91591 , p_source_55 IN VARCHAR2
91592 )
91593 IS
91594
91595 l_component_type VARCHAR2(80);
91596 l_component_code VARCHAR2(30);
91597 l_component_type_code VARCHAR2(1);
91598 l_component_appl_id INTEGER;
91599 l_amb_context_code VARCHAR2(30);
91600 l_entity_code VARCHAR2(30);
91601 l_event_class_code VARCHAR2(30);
91602 l_ae_header_id NUMBER;
91603 l_event_type_code VARCHAR2(30);
91604 l_line_definition_code VARCHAR2(30);
91605 l_line_definition_owner_code VARCHAR2(1);
91606 --
91607 -- adr variables
91608 l_segment VARCHAR2(30);
91609 l_ccid NUMBER;
91610 l_adr_transaction_coa_id NUMBER;
91611 l_adr_accounting_coa_id NUMBER;
91612 l_adr_flexfield_segment_code VARCHAR2(30);
91613 l_adr_flex_value_set_id NUMBER;
91614 l_adr_value_type_code VARCHAR2(30);
91615 l_adr_value_combination_id NUMBER;
91616 l_adr_value_segment_code VARCHAR2(30);
91617
91618 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
91619 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
91620 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
91621 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
91622
91623 -- 4262811 Variables ------------------------------------------------------------------------------------------
91624 l_entered_amt_idx NUMBER;
91625 l_accted_amt_idx NUMBER;
91626 l_acc_rev_flag VARCHAR2(1);
91627 l_accrual_line_num NUMBER;
91628 l_tmp_amt NUMBER;
91629 l_acc_rev_natural_side_code VARCHAR2(1);
91630
91631 l_num_entries NUMBER;
91632 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
91633 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
91634 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
91635 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
91636 l_recog_line_1 NUMBER;
91637 l_recog_line_2 NUMBER;
91638
91639 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
91640 l_bflow_applied_to_amt NUMBER; -- 5132302
91641 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
91642
91643 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
91644
91645 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
91646 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
91647
91648 ---------------------------------------------------------------------------------------------------------------
91649
91650
91651 --
91652 -- bulk performance
91653 --
91654 l_balance_type_code VARCHAR2(1);
91655 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
91656 l_log_module VARCHAR2(240);
91657
91658 --
91659 -- Upgrade strategy
91663
91660 --
91661 l_actual_upg_option VARCHAR2(1);
91662 l_enc_upg_option VARCHAR2(1);
91664 --
91665 BEGIN
91666 --
91667 IF g_log_enabled THEN
91668 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_292';
91669 END IF;
91670 --
91671 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
91672
91673 trace
91674 (p_msg => 'BEGIN of AcctLineType_292'
91675 ,p_level => C_LEVEL_PROCEDURE
91676 ,p_module => l_log_module);
91677
91678 END IF;
91679 --
91680 l_component_type := 'AMB_JLT';
91681 l_component_code := 'FA_RECLASS_DEST_BONUS_RESERVE';
91682 l_component_type_code := 'S';
91683 l_component_appl_id := 140;
91684 l_amb_context_code := 'DEFAULT';
91685 l_entity_code := 'TRANSACTIONS';
91686 l_event_class_code := 'CATEGORY_RECLASS';
91687 l_event_type_code := 'CATEGORY_RECLASS_ALL';
91688 l_line_definition_owner_code := 'S';
91689 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
91690 --
91691 l_balance_type_code := 'A';
91692 l_segment := NULL;
91693 l_ccid := NULL;
91694 l_adr_transaction_coa_id := NULL;
91695 l_adr_accounting_coa_id := NULL;
91696 l_adr_flexfield_segment_code := NULL;
91697 l_adr_flex_value_set_id := NULL;
91698 l_adr_value_type_code := NULL;
91699 l_adr_value_combination_id := NULL;
91700 l_adr_value_segment_code := NULL;
91701
91702 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
91703 l_bflow_class_code := ''; -- 4219869 Business Flow
91704 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
91705 l_budgetary_control_flag := 'N';
91706
91707 l_bflow_applied_to_amt_idx := NULL; -- 5132302
91708 l_bflow_applied_to_amt := NULL; -- 5132302
91709 l_entered_amt_idx := NULL; -- 4262811
91710 l_accted_amt_idx := NULL; -- 4262811
91711 l_acc_rev_flag := NULL; -- 4262811
91712 l_accrual_line_num := NULL; -- 4262811
91713 l_tmp_amt := NULL; -- 4262811
91714 --
91715
91716 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
91717 l_balance_type_code <> 'B' THEN
91718 IF (NVL(p_source_48,'
91719 ') = 'BONUS EXPENSE' OR
91720 NVL(p_source_48,'
91721 ') = 'BONUS RESERVE') AND
91722 NVL(p_source_55,'
91723 ') = 'DEST'
91724 THEN
91725
91726 --
91727 XLA_AE_LINES_PKG.SetNewLine;
91728
91729 p_balance_type_code := l_balance_type_code;
91730 -- set the flag so later we will know whether the gain loss line needs to be created
91731
91732 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
91733 p_actual_flag :='A';
91734 END IF;
91735
91736 --
91737 -- bulk performance
91738 --
91739 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
91740 p_header_num => 0); -- 4262811
91741 --
91742 -- set accounting line options
91743 --
91744 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
91745 p_natural_side_code => 'C'
91746 , p_gain_or_loss_flag => 'N'
91747 , p_gl_transfer_mode_code => 'S'
91748 , p_acct_entry_type_code => 'A'
91749 , p_switch_side_flag => 'Y'
91750 , p_merge_duplicate_code => 'N'
91751 );
91752 --
91753 l_acc_rev_natural_side_code := 'D'; -- 4262811
91754 --
91755 --
91756 -- set accounting line type info
91757 --
91758 xla_ae_lines_pkg.SetAcctLineType
91759 (p_component_type => l_component_type
91760 ,p_event_type_code => l_event_type_code
91761 ,p_line_definition_owner_code => l_line_definition_owner_code
91762 ,p_line_definition_code => l_line_definition_code
91763 ,p_accounting_line_code => l_component_code
91764 ,p_accounting_line_type_code => l_component_type_code
91765 ,p_accounting_line_appl_id => l_component_appl_id
91766 ,p_amb_context_code => l_amb_context_code
91767 ,p_entity_code => l_entity_code
91768 ,p_event_class_code => l_event_class_code);
91769 --
91770 -- set accounting class
91771 --
91772 xla_ae_lines_pkg.SetAcctClass(
91773 p_accounting_class_code => 'ASSET'
91774 , p_ae_header_id => l_ae_header_id
91775 );
91776
91777 --
91778 -- set rounding class
91779 --
91780 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
91781 'ASSET';
91782
91783 --
91784 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
91785 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
91786 --
91787 -- bulk performance
91788 --
91789 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
91790
91791 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
91792 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
91793
91797
91794 -- 4955764
91795 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
91796 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
91798 -- 4458381 Public Sector Enh
91799
91800 --
91801 -- set accounting attributes for the line type
91802 --
91803 l_entered_amt_idx := 4;
91804 l_accted_amt_idx := 6;
91805 l_bflow_applied_to_amt_idx := NULL; -- 5132302
91806 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
91807 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
91808 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
91809 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
91810 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
91811 l_rec_acct_attrs.array_char_value(3) := p_source_51;
91812 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
91813 l_rec_acct_attrs.array_num_value(4) := p_source_52;
91814 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
91815 l_rec_acct_attrs.array_char_value(5) := p_source_53;
91816 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
91817 l_rec_acct_attrs.array_num_value(6) := p_source_52;
91818
91819 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
91820 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
91821
91822 ---------------------------------------------------------------------------------------------------------------
91823 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
91824 ---------------------------------------------------------------------------------------------------------------
91825 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
91826
91827 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
91828 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
91829
91830 IF xla_accounting_cache_pkg.GetValueChar
91831 (p_source_code => 'LEDGER_CATEGORY_CODE'
91832 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
91833 AND l_bflow_method_code = 'PRIOR_ENTRY'
91834 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
91835 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
91836 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
91837 )
91838 THEN
91839 xla_ae_lines_pkg.BflowUpgEntry
91840 (p_business_method_code => l_bflow_method_code
91841 ,p_business_class_code => l_bflow_class_code
91842 ,p_balance_type => l_balance_type_code);
91843 ELSE
91844 NULL;
91845 -- No business flow processing for business flow method of NONE.
91846 END IF;
91847
91848 --
91849 -- call analytical criteria
91850 --
91851
91852 --
91853 -- call description
91854 --
91855
91856 xla_ae_lines_pkg.SetLineDescription(
91857 p_ae_header_id => l_ae_header_id
91858 ,p_description => Description_64 (
91859 p_application_id => p_application_id
91860 , p_ae_header_id => l_ae_header_id
91861 , p_source_1 => p_source_1
91862 )
91863 );
91864
91865
91866 --
91867 -- call ADRs
91868 -- Bug 4922099
91869 --
91870 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
91871 (NVL(l_actual_upg_option, 'N') = 'O') OR
91872 (NVL(l_enc_upg_option, 'N') = 'O')
91873 )
91874 THEN
91875 NULL;
91876 --
91877 --
91878
91879 l_ccid := AcctDerRule_175(
91880 p_application_id => p_application_id
91881 , p_ae_header_id => l_ae_header_id
91882 , p_source_5 => p_source_5
91883 , p_source_19 => p_source_19
91884 , p_source_32 => p_source_32
91885 , x_transaction_coa_id => l_adr_transaction_coa_id
91886 , x_accounting_coa_id => l_adr_accounting_coa_id
91887 , x_value_type_code => l_adr_value_type_code
91888 , p_side => 'NA'
91889 );
91890
91891 xla_ae_lines_pkg.set_ccid(
91892 p_code_combination_id => l_ccid
91893 , p_value_type_code => l_adr_value_type_code
91894 , p_transaction_coa_id => l_adr_transaction_coa_id
91895 , p_accounting_coa_id => l_adr_accounting_coa_id
91896 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
91897 , p_adr_type_code => 'S'
91898 , p_component_type => l_component_type
91899 , p_component_code => l_component_code
91900 , p_component_type_code => l_component_type_code
91901 , p_component_appl_id => l_component_appl_id
91902 , p_amb_context_code => l_amb_context_code
91903 , p_side => 'NA'
91904 );
91905
91906
91907 l_segment := AcctDerRule_145(
91908 p_application_id => p_application_id
91909 , p_ae_header_id => l_ae_header_id
91910 , p_source_5 => p_source_5
91911 , p_source_6 => p_source_6
91912 , x_transaction_coa_id => l_adr_transaction_coa_id
91913 , x_accounting_coa_id => l_adr_accounting_coa_id
91917 , x_value_combination_id => l_adr_value_combination_id
91914 , x_flexfield_segment_code => l_adr_flexfield_segment_code
91915 , x_flex_value_set_id => l_adr_flex_value_set_id
91916 , x_value_type_code => l_adr_value_type_code
91918 , x_value_segment_code => l_adr_value_segment_code
91919 , p_side => 'NA'
91920 , p_override_seg_flag => 'Y'
91921 );
91922
91923 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
91924
91925 xla_ae_lines_pkg.set_segment(
91926 p_to_segment_code => 'GL_ACCOUNT'
91927 , p_segment_value => l_segment
91928 , p_from_segment_code => l_adr_value_segment_code
91929 , p_from_combination_id => l_adr_value_combination_id
91930 , p_value_type_code => l_adr_value_type_code
91931 , p_transaction_coa_id => l_adr_transaction_coa_id
91932 , p_accounting_coa_id => l_adr_accounting_coa_id
91933 , p_flexfield_segment_code => l_adr_flexfield_segment_code
91934 , p_flex_value_set_id => l_adr_flex_value_set_id
91935 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
91936 , p_adr_type_code => 'S'
91937 , p_component_type => l_component_type
91938 , p_component_code => l_component_code
91939 , p_component_type_code => l_component_type_code
91940 , p_component_appl_id => l_component_appl_id
91941 , p_amb_context_code => l_amb_context_code
91942 , p_entity_code => 'TRANSACTIONS'
91943 , p_event_class_code => 'CATEGORY_RECLASS'
91944 , p_side => 'NA'
91945 );
91946
91947 END IF;
91948
91949 l_segment := AcctDerRule_169(
91950 p_application_id => p_application_id
91951 , p_ae_header_id => l_ae_header_id
91952 , p_source_5 => p_source_5
91953 , p_source_31 => p_source_31
91954 , x_transaction_coa_id => l_adr_transaction_coa_id
91955 , x_accounting_coa_id => l_adr_accounting_coa_id
91956 , x_flexfield_segment_code => l_adr_flexfield_segment_code
91957 , x_flex_value_set_id => l_adr_flex_value_set_id
91958 , x_value_type_code => l_adr_value_type_code
91959 , x_value_combination_id => l_adr_value_combination_id
91960 , x_value_segment_code => l_adr_value_segment_code
91961 , p_side => 'NA'
91962 , p_override_seg_flag => 'Y'
91963 );
91964
91965 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
91966
91967 xla_ae_lines_pkg.set_segment(
91968 p_to_segment_code => 'GL_BALANCING'
91969 , p_segment_value => l_segment
91970 , p_from_segment_code => l_adr_value_segment_code
91971 , p_from_combination_id => l_adr_value_combination_id
91972 , p_value_type_code => l_adr_value_type_code
91973 , p_transaction_coa_id => l_adr_transaction_coa_id
91974 , p_accounting_coa_id => l_adr_accounting_coa_id
91975 , p_flexfield_segment_code => l_adr_flexfield_segment_code
91976 , p_flex_value_set_id => l_adr_flex_value_set_id
91977 , p_adr_code => 'FA_EXPENSE_ACCT'
91978 , p_adr_type_code => 'S'
91979 , p_component_type => l_component_type
91980 , p_component_code => l_component_code
91981 , p_component_type_code => l_component_type_code
91982 , p_component_appl_id => l_component_appl_id
91983 , p_amb_context_code => l_amb_context_code
91984 , p_entity_code => 'TRANSACTIONS'
91985 , p_event_class_code => 'CATEGORY_RECLASS'
91986 , p_side => 'NA'
91987 );
91988
91989 END IF;
91990
91991 --
91992 --
91993 END IF;
91994 --
91995 -- Bug 4922099
91996 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
91997 (NVL(l_enc_upg_option, 'N') = 'O')
91998 ) AND
91999 (l_bflow_method_code = 'PRIOR_ENTRY')
92000 )
92001 THEN
92002 IF
92003 --
92004 1 = 2
92005 --
92006 THEN
92007 xla_accounting_err_pkg.build_message
92008 (p_appli_s_name => 'XLA'
92009 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
92010 ,p_token_1 => 'LINE_NUMBER'
92011 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
92012 ,p_token_2 => 'LINE_TYPE_NAME'
92013 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
92014 l_component_type
92015 ,l_component_code
92016 ,l_component_type_code
92017 ,l_component_appl_id
92018 ,l_amb_context_code
92019 ,l_entity_code
92023 ,p_value_3 => xla_lookups_pkg.get_meaning(
92020 ,l_event_class_code
92021 )
92022 ,p_token_3 => 'OWNER'
92024 p_lookup_type => 'XLA_OWNER_TYPE'
92025 ,p_lookup_code => l_component_type_code
92026 )
92027 ,p_token_4 => 'PRODUCT_NAME'
92028 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
92029 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
92030 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
92031 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
92032 ,p_ae_header_id => NULL
92033 );
92034
92035 IF (C_LEVEL_ERROR>= g_log_level) THEN
92036 trace
92037 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
92038 ,p_level => C_LEVEL_ERROR
92039 ,p_module => l_log_module);
92040 END IF;
92041 END IF;
92042 END IF;
92043 --
92044 --
92045 ------------------------------------------------------------------------------------------------
92046 -- 4219869 Business Flow
92047 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
92048 -- Prior Entry. Currently, the following code is always generated.
92049 ------------------------------------------------------------------------------------------------
92050 XLA_AE_LINES_PKG.ValidateCurrentLine;
92051
92052 ------------------------------------------------------------------------------------
92053 -- 4219869 Business Flow
92054 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
92055 ------------------------------------------------------------------------------------
92056 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
92057
92058 ----------------------------------------------------------------------------------
92059 -- 4219869 Business Flow
92060 -- Update journal entry status -- Need to generate this within IF <condition>
92061 ----------------------------------------------------------------------------------
92062 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
92063 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
92064 ,p_balance_type_code => l_balance_type_code
92065 );
92066
92067 -------------------------------------------------------------------------------------------
92068 -- 4262811 - Generate the Accrual Reversal lines
92069 -------------------------------------------------------------------------------------------
92070 BEGIN
92071 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
92072 (g_array_event(p_event_id).array_value_num('header_index'));
92073 IF l_acc_rev_flag IS NULL THEN
92074 l_acc_rev_flag := 'N';
92075 END IF;
92076 EXCEPTION
92077 WHEN OTHERS THEN
92078 l_acc_rev_flag := 'N';
92079 END;
92080 --
92081 IF (l_acc_rev_flag = 'Y') THEN
92082
92083 -- 4645092 ------------------------------------------------------------------------------
92084 -- To allow MPA report to determine if it should generate report process
92085 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
92086 ------------------------------------------------------------------------------------------
92087
92088 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
92089 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
92090 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
92091 -- call ADRs
92092 -- Bug 4922099
92093 --
92094 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
92095 (NVL(l_actual_upg_option, 'N') = 'O') OR
92096 (NVL(l_enc_upg_option, 'N') = 'O')
92097 )
92098 THEN
92099 NULL;
92100 --
92101 --
92102
92103 l_ccid := AcctDerRule_175(
92104 p_application_id => p_application_id
92105 , p_ae_header_id => l_ae_header_id
92106 , p_source_5 => p_source_5
92107 , p_source_19 => p_source_19
92108 , p_source_32 => p_source_32
92109 , x_transaction_coa_id => l_adr_transaction_coa_id
92110 , x_accounting_coa_id => l_adr_accounting_coa_id
92111 , x_value_type_code => l_adr_value_type_code
92112 , p_side => 'NA'
92113 );
92114
92115 xla_ae_lines_pkg.set_ccid(
92116 p_code_combination_id => l_ccid
92117 , p_value_type_code => l_adr_value_type_code
92118 , p_transaction_coa_id => l_adr_transaction_coa_id
92119 , p_accounting_coa_id => l_adr_accounting_coa_id
92120 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
92121 , p_adr_type_code => 'S'
92125 , p_component_appl_id => l_component_appl_id
92122 , p_component_type => l_component_type
92123 , p_component_code => l_component_code
92124 , p_component_type_code => l_component_type_code
92126 , p_amb_context_code => l_amb_context_code
92127 , p_side => 'NA'
92128 );
92129
92130
92131 l_segment := AcctDerRule_145(
92132 p_application_id => p_application_id
92133 , p_ae_header_id => l_ae_header_id
92134 , p_source_5 => p_source_5
92135 , p_source_6 => p_source_6
92136 , x_transaction_coa_id => l_adr_transaction_coa_id
92137 , x_accounting_coa_id => l_adr_accounting_coa_id
92138 , x_flexfield_segment_code => l_adr_flexfield_segment_code
92139 , x_flex_value_set_id => l_adr_flex_value_set_id
92140 , x_value_type_code => l_adr_value_type_code
92141 , x_value_combination_id => l_adr_value_combination_id
92142 , x_value_segment_code => l_adr_value_segment_code
92143 , p_side => 'NA'
92144 , p_override_seg_flag => 'Y'
92145 );
92146
92147 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
92148
92149 xla_ae_lines_pkg.set_segment(
92150 p_to_segment_code => 'GL_ACCOUNT'
92151 , p_segment_value => l_segment
92152 , p_from_segment_code => l_adr_value_segment_code
92153 , p_from_combination_id => l_adr_value_combination_id
92154 , p_value_type_code => l_adr_value_type_code
92155 , p_transaction_coa_id => l_adr_transaction_coa_id
92156 , p_accounting_coa_id => l_adr_accounting_coa_id
92157 , p_flexfield_segment_code => l_adr_flexfield_segment_code
92158 , p_flex_value_set_id => l_adr_flex_value_set_id
92159 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
92160 , p_adr_type_code => 'S'
92161 , p_component_type => l_component_type
92162 , p_component_code => l_component_code
92163 , p_component_type_code => l_component_type_code
92164 , p_component_appl_id => l_component_appl_id
92165 , p_amb_context_code => l_amb_context_code
92166 , p_entity_code => 'TRANSACTIONS'
92167 , p_event_class_code => 'CATEGORY_RECLASS'
92168 , p_side => 'NA'
92169 );
92170
92171 END IF;
92172
92173 l_segment := AcctDerRule_169(
92174 p_application_id => p_application_id
92175 , p_ae_header_id => l_ae_header_id
92176 , p_source_5 => p_source_5
92177 , p_source_31 => p_source_31
92178 , x_transaction_coa_id => l_adr_transaction_coa_id
92179 , x_accounting_coa_id => l_adr_accounting_coa_id
92180 , x_flexfield_segment_code => l_adr_flexfield_segment_code
92181 , x_flex_value_set_id => l_adr_flex_value_set_id
92182 , x_value_type_code => l_adr_value_type_code
92183 , x_value_combination_id => l_adr_value_combination_id
92184 , x_value_segment_code => l_adr_value_segment_code
92185 , p_side => 'NA'
92186 , p_override_seg_flag => 'Y'
92187 );
92188
92189 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
92190
92191 xla_ae_lines_pkg.set_segment(
92192 p_to_segment_code => 'GL_BALANCING'
92193 , p_segment_value => l_segment
92194 , p_from_segment_code => l_adr_value_segment_code
92195 , p_from_combination_id => l_adr_value_combination_id
92196 , p_value_type_code => l_adr_value_type_code
92197 , p_transaction_coa_id => l_adr_transaction_coa_id
92198 , p_accounting_coa_id => l_adr_accounting_coa_id
92199 , p_flexfield_segment_code => l_adr_flexfield_segment_code
92200 , p_flex_value_set_id => l_adr_flex_value_set_id
92201 , p_adr_code => 'FA_EXPENSE_ACCT'
92202 , p_adr_type_code => 'S'
92203 , p_component_type => l_component_type
92204 , p_component_code => l_component_code
92205 , p_component_type_code => l_component_type_code
92206 , p_component_appl_id => l_component_appl_id
92207 , p_amb_context_code => l_amb_context_code
92208 , p_entity_code => 'TRANSACTIONS'
92209 , p_event_class_code => 'CATEGORY_RECLASS'
92210 , p_side => 'NA'
92211 );
92212
92213 END IF;
92214
92215 --
92216 --
92217 END IF;
92218
92219 --
92220 -- Update the line information that should be overwritten
92221 --
92222 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
92223 p_header_num => 1);
92224 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
92225
92226 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
92227
92228 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
92229 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
92230 END IF;
92234 --
92231
92232 --
92233 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
92235 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
92236 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
92237 ELSE
92238 ---------------------------------------------------------------------------------------------------
92239 -- 4262811a Switch Sign
92240 ---------------------------------------------------------------------------------------------------
92241 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
92242 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
92243 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
92244 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
92245 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
92246 -- 5132302
92247 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
92248 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
92249
92250 END IF;
92251
92252 -- 4955764
92253 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
92254 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
92255
92256
92257 XLA_AE_LINES_PKG.ValidateCurrentLine;
92258 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
92259
92260 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
92261 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
92262 ,p_balance_type_code => l_balance_type_code);
92263
92264 END IF;
92265
92266 -----------------------------------------------------------------------------------------
92267 -- 4262811 Multiperiod Accounting
92268 -----------------------------------------------------------------------------------------
92269 -- No MPA option is assigned.
92270
92271
92272 END IF;
92273 END IF;
92274 --
92275
92276 --
92277 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
92278 trace
92279 (p_msg => 'END of AcctLineType_292'
92280 ,p_level => C_LEVEL_PROCEDURE
92281 ,p_module => l_log_module);
92282 END IF;
92283 --
92284 EXCEPTION
92285 WHEN xla_exceptions_pkg.application_exception THEN
92286 RAISE;
92287 WHEN OTHERS THEN
92288 xla_exceptions_pkg.raise_message
92289 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_292');
92290 END AcctLineType_292;
92291 --
92292
92293 ---------------------------------------
92294 --
92295 -- PRIVATE FUNCTION
92296 -- AcctLineType_293
92297 --
92298 ---------------------------------------
92299 PROCEDURE AcctLineType_293 (
92300 p_application_id IN NUMBER
92301 ,p_event_id IN NUMBER
92302 ,p_calculate_acctd_flag IN VARCHAR2
92303 ,p_calculate_g_l_flag IN VARCHAR2
92304 ,p_actual_flag IN OUT VARCHAR2
92305 ,p_balance_type_code OUT VARCHAR2
92306 ,p_gain_or_loss_ref OUT VARCHAR2
92307
92308 --Period Close Date
92309 , p_source_1 IN DATE
92310 --Generated Code Combination Identifier
92311 , p_source_5 IN NUMBER
92312 --Asset Cost Account
92313 , p_source_11 IN VARCHAR2
92314 --Expense Account Code Combination Identifier
92315 , p_source_31 IN NUMBER
92316 --Default Code Combination Identifier
92317 , p_source_32 IN NUMBER
92318 --Adjustment Type
92319 , p_source_48 IN VARCHAR2
92320 --Transaction Header Identifier
92321 , p_source_49 IN NUMBER
92322 --Adjustment Line Identifier
92323 , p_source_50 IN NUMBER
92324 --Distribution Type Code
92325 , p_source_51 IN VARCHAR2
92326 --Entered Amount
92327 , p_source_52 IN NUMBER
92328 --Currency Code
92329 , p_source_53 IN VARCHAR2
92330 --Source Destination Code
92331 , p_source_55 IN VARCHAR2
92332 )
92333 IS
92334
92335 l_component_type VARCHAR2(80);
92336 l_component_code VARCHAR2(30);
92337 l_component_type_code VARCHAR2(1);
92338 l_component_appl_id INTEGER;
92339 l_amb_context_code VARCHAR2(30);
92340 l_entity_code VARCHAR2(30);
92341 l_event_class_code VARCHAR2(30);
92342 l_ae_header_id NUMBER;
92343 l_event_type_code VARCHAR2(30);
92344 l_line_definition_code VARCHAR2(30);
92345 l_line_definition_owner_code VARCHAR2(1);
92346 --
92347 -- adr variables
92348 l_segment VARCHAR2(30);
92349 l_ccid NUMBER;
92350 l_adr_transaction_coa_id NUMBER;
92351 l_adr_accounting_coa_id NUMBER;
92352 l_adr_flexfield_segment_code VARCHAR2(30);
92353 l_adr_flex_value_set_id NUMBER;
92354 l_adr_value_type_code VARCHAR2(30);
92355 l_adr_value_combination_id NUMBER;
92356 l_adr_value_segment_code VARCHAR2(30);
92357
92358 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
92362
92359 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
92360 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
92361 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
92363 -- 4262811 Variables ------------------------------------------------------------------------------------------
92364 l_entered_amt_idx NUMBER;
92365 l_accted_amt_idx NUMBER;
92366 l_acc_rev_flag VARCHAR2(1);
92367 l_accrual_line_num NUMBER;
92368 l_tmp_amt NUMBER;
92369 l_acc_rev_natural_side_code VARCHAR2(1);
92370
92371 l_num_entries NUMBER;
92372 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
92373 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
92374 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
92375 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
92376 l_recog_line_1 NUMBER;
92377 l_recog_line_2 NUMBER;
92378
92379 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
92380 l_bflow_applied_to_amt NUMBER; -- 5132302
92381 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
92382
92383 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
92384
92385 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
92386 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
92387
92388 ---------------------------------------------------------------------------------------------------------------
92389
92390
92391 --
92392 -- bulk performance
92393 --
92394 l_balance_type_code VARCHAR2(1);
92395 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
92396 l_log_module VARCHAR2(240);
92397
92398 --
92399 -- Upgrade strategy
92400 --
92401 l_actual_upg_option VARCHAR2(1);
92402 l_enc_upg_option VARCHAR2(1);
92403
92404 --
92405 BEGIN
92406 --
92407 IF g_log_enabled THEN
92408 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_293';
92409 END IF;
92410 --
92411 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
92412
92413 trace
92414 (p_msg => 'BEGIN of AcctLineType_293'
92415 ,p_level => C_LEVEL_PROCEDURE
92416 ,p_module => l_log_module);
92417
92418 END IF;
92419 --
92420 l_component_type := 'AMB_JLT';
92421 l_component_code := 'FA_RECLASS_DEST_COST';
92422 l_component_type_code := 'S';
92423 l_component_appl_id := 140;
92424 l_amb_context_code := 'DEFAULT';
92425 l_entity_code := 'TRANSACTIONS';
92426 l_event_class_code := 'CATEGORY_RECLASS';
92427 l_event_type_code := 'CATEGORY_RECLASS_ALL';
92428 l_line_definition_owner_code := 'S';
92429 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
92430 --
92431 l_balance_type_code := 'A';
92432 l_segment := NULL;
92433 l_ccid := NULL;
92434 l_adr_transaction_coa_id := NULL;
92435 l_adr_accounting_coa_id := NULL;
92436 l_adr_flexfield_segment_code := NULL;
92437 l_adr_flex_value_set_id := NULL;
92438 l_adr_value_type_code := NULL;
92439 l_adr_value_combination_id := NULL;
92440 l_adr_value_segment_code := NULL;
92441
92442 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
92443 l_bflow_class_code := ''; -- 4219869 Business Flow
92444 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
92445 l_budgetary_control_flag := 'N';
92446
92447 l_bflow_applied_to_amt_idx := NULL; -- 5132302
92448 l_bflow_applied_to_amt := NULL; -- 5132302
92449 l_entered_amt_idx := NULL; -- 4262811
92450 l_accted_amt_idx := NULL; -- 4262811
92451 l_acc_rev_flag := NULL; -- 4262811
92452 l_accrual_line_num := NULL; -- 4262811
92453 l_tmp_amt := NULL; -- 4262811
92454 --
92455
92456 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
92457 l_balance_type_code <> 'B' THEN
92458 IF NVL(p_source_48,'
92459 ') = 'COST' AND
92460 NVL(p_source_55,'
92461 ') = 'DEST'
92462 THEN
92463
92464 --
92465 XLA_AE_LINES_PKG.SetNewLine;
92466
92467 p_balance_type_code := l_balance_type_code;
92468 -- set the flag so later we will know whether the gain loss line needs to be created
92469
92470 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
92471 p_actual_flag :='A';
92472 END IF;
92473
92474 --
92475 -- bulk performance
92476 --
92477 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
92478 p_header_num => 0); -- 4262811
92479 --
92480 -- set accounting line options
92481 --
92482 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
92483 p_natural_side_code => 'D'
92484 , p_gain_or_loss_flag => 'N'
92485 , p_gl_transfer_mode_code => 'S'
92486 , p_acct_entry_type_code => 'A'
92487 , p_switch_side_flag => 'Y'
92488 , p_merge_duplicate_code => 'N'
92492 --
92489 );
92490 --
92491 l_acc_rev_natural_side_code := 'C'; -- 4262811
92493 --
92494 -- set accounting line type info
92495 --
92496 xla_ae_lines_pkg.SetAcctLineType
92497 (p_component_type => l_component_type
92498 ,p_event_type_code => l_event_type_code
92499 ,p_line_definition_owner_code => l_line_definition_owner_code
92500 ,p_line_definition_code => l_line_definition_code
92501 ,p_accounting_line_code => l_component_code
92502 ,p_accounting_line_type_code => l_component_type_code
92503 ,p_accounting_line_appl_id => l_component_appl_id
92504 ,p_amb_context_code => l_amb_context_code
92505 ,p_entity_code => l_entity_code
92506 ,p_event_class_code => l_event_class_code);
92507 --
92508 -- set accounting class
92509 --
92510 xla_ae_lines_pkg.SetAcctClass(
92511 p_accounting_class_code => 'ASSET'
92512 , p_ae_header_id => l_ae_header_id
92513 );
92514
92515 --
92516 -- set rounding class
92517 --
92518 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
92519 'ASSET';
92520
92521 --
92522 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
92523 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
92524 --
92525 -- bulk performance
92526 --
92527 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
92528
92529 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
92530 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
92531
92532 -- 4955764
92533 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
92534 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
92535
92536 -- 4458381 Public Sector Enh
92537
92538 --
92539 -- set accounting attributes for the line type
92540 --
92541 l_entered_amt_idx := 4;
92542 l_accted_amt_idx := 6;
92543 l_bflow_applied_to_amt_idx := NULL; -- 5132302
92544 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
92545 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
92546 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
92547 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
92548 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
92549 l_rec_acct_attrs.array_char_value(3) := p_source_51;
92550 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
92551 l_rec_acct_attrs.array_num_value(4) := p_source_52;
92552 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
92553 l_rec_acct_attrs.array_char_value(5) := p_source_53;
92554 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
92555 l_rec_acct_attrs.array_num_value(6) := p_source_52;
92556
92557 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
92558 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
92559
92560 ---------------------------------------------------------------------------------------------------------------
92561 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
92562 ---------------------------------------------------------------------------------------------------------------
92563 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
92564
92565 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
92566 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
92567
92568 IF xla_accounting_cache_pkg.GetValueChar
92569 (p_source_code => 'LEDGER_CATEGORY_CODE'
92570 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
92571 AND l_bflow_method_code = 'PRIOR_ENTRY'
92572 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
92573 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
92574 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
92575 )
92576 THEN
92577 xla_ae_lines_pkg.BflowUpgEntry
92578 (p_business_method_code => l_bflow_method_code
92579 ,p_business_class_code => l_bflow_class_code
92580 ,p_balance_type => l_balance_type_code);
92581 ELSE
92582 NULL;
92583 -- No business flow processing for business flow method of NONE.
92584 END IF;
92585
92586 --
92587 -- call analytical criteria
92588 --
92589
92590 --
92591 -- call description
92592 --
92593
92594 xla_ae_lines_pkg.SetLineDescription(
92595 p_ae_header_id => l_ae_header_id
92596 ,p_description => Description_65 (
92597 p_application_id => p_application_id
92598 , p_ae_header_id => l_ae_header_id
92599 , p_source_1 => p_source_1
92600 )
92601 );
92602
92603
92604 --
92605 -- call ADRs
92606 -- Bug 4922099
92607 --
92608 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
92612 THEN
92609 (NVL(l_actual_upg_option, 'N') = 'O') OR
92610 (NVL(l_enc_upg_option, 'N') = 'O')
92611 )
92613 NULL;
92614 --
92615 --
92616
92617 l_ccid := AcctDerRule_174(
92618 p_application_id => p_application_id
92619 , p_ae_header_id => l_ae_header_id
92620 , p_source_5 => p_source_5
92621 , p_source_32 => p_source_32
92622 , x_transaction_coa_id => l_adr_transaction_coa_id
92623 , x_accounting_coa_id => l_adr_accounting_coa_id
92624 , x_value_type_code => l_adr_value_type_code
92625 , p_side => 'NA'
92626 );
92627
92628 xla_ae_lines_pkg.set_ccid(
92629 p_code_combination_id => l_ccid
92630 , p_value_type_code => l_adr_value_type_code
92631 , p_transaction_coa_id => l_adr_transaction_coa_id
92632 , p_accounting_coa_id => l_adr_accounting_coa_id
92633 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
92634 , p_adr_type_code => 'S'
92635 , p_component_type => l_component_type
92636 , p_component_code => l_component_code
92637 , p_component_type_code => l_component_type_code
92638 , p_component_appl_id => l_component_appl_id
92639 , p_amb_context_code => l_amb_context_code
92640 , p_side => 'NA'
92641 );
92642
92643
92644 l_segment := AcctDerRule_149(
92645 p_application_id => p_application_id
92646 , p_ae_header_id => l_ae_header_id
92647 , p_source_5 => p_source_5
92648 , p_source_11 => p_source_11
92649 , x_transaction_coa_id => l_adr_transaction_coa_id
92650 , x_accounting_coa_id => l_adr_accounting_coa_id
92651 , x_flexfield_segment_code => l_adr_flexfield_segment_code
92652 , x_flex_value_set_id => l_adr_flex_value_set_id
92653 , x_value_type_code => l_adr_value_type_code
92654 , x_value_combination_id => l_adr_value_combination_id
92655 , x_value_segment_code => l_adr_value_segment_code
92656 , p_side => 'NA'
92657 , p_override_seg_flag => 'Y'
92658 );
92659
92660 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
92661
92662 xla_ae_lines_pkg.set_segment(
92663 p_to_segment_code => 'GL_ACCOUNT'
92664 , p_segment_value => l_segment
92665 , p_from_segment_code => l_adr_value_segment_code
92666 , p_from_combination_id => l_adr_value_combination_id
92667 , p_value_type_code => l_adr_value_type_code
92668 , p_transaction_coa_id => l_adr_transaction_coa_id
92669 , p_accounting_coa_id => l_adr_accounting_coa_id
92670 , p_flexfield_segment_code => l_adr_flexfield_segment_code
92671 , p_flex_value_set_id => l_adr_flex_value_set_id
92672 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
92673 , p_adr_type_code => 'S'
92674 , p_component_type => l_component_type
92675 , p_component_code => l_component_code
92676 , p_component_type_code => l_component_type_code
92677 , p_component_appl_id => l_component_appl_id
92678 , p_amb_context_code => l_amb_context_code
92679 , p_entity_code => 'TRANSACTIONS'
92680 , p_event_class_code => 'CATEGORY_RECLASS'
92681 , p_side => 'NA'
92682 );
92683
92684 END IF;
92685
92686 l_segment := AcctDerRule_169(
92687 p_application_id => p_application_id
92688 , p_ae_header_id => l_ae_header_id
92689 , p_source_5 => p_source_5
92690 , p_source_31 => p_source_31
92691 , x_transaction_coa_id => l_adr_transaction_coa_id
92692 , x_accounting_coa_id => l_adr_accounting_coa_id
92693 , x_flexfield_segment_code => l_adr_flexfield_segment_code
92694 , x_flex_value_set_id => l_adr_flex_value_set_id
92695 , x_value_type_code => l_adr_value_type_code
92696 , x_value_combination_id => l_adr_value_combination_id
92697 , x_value_segment_code => l_adr_value_segment_code
92698 , p_side => 'NA'
92699 , p_override_seg_flag => 'Y'
92700 );
92701
92702 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
92703
92704 xla_ae_lines_pkg.set_segment(
92705 p_to_segment_code => 'GL_BALANCING'
92706 , p_segment_value => l_segment
92707 , p_from_segment_code => l_adr_value_segment_code
92708 , p_from_combination_id => l_adr_value_combination_id
92709 , p_value_type_code => l_adr_value_type_code
92710 , p_transaction_coa_id => l_adr_transaction_coa_id
92711 , p_accounting_coa_id => l_adr_accounting_coa_id
92712 , p_flexfield_segment_code => l_adr_flexfield_segment_code
92713 , p_flex_value_set_id => l_adr_flex_value_set_id
92714 , p_adr_code => 'FA_EXPENSE_ACCT'
92715 , p_adr_type_code => 'S'
92716 , p_component_type => l_component_type
92717 , p_component_code => l_component_code
92718 , p_component_type_code => l_component_type_code
92722 , p_event_class_code => 'CATEGORY_RECLASS'
92719 , p_component_appl_id => l_component_appl_id
92720 , p_amb_context_code => l_amb_context_code
92721 , p_entity_code => 'TRANSACTIONS'
92723 , p_side => 'NA'
92724 );
92725
92726 END IF;
92727
92728 --
92729 --
92730 END IF;
92731 --
92732 -- Bug 4922099
92733 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
92734 (NVL(l_enc_upg_option, 'N') = 'O')
92735 ) AND
92736 (l_bflow_method_code = 'PRIOR_ENTRY')
92737 )
92738 THEN
92739 IF
92740 --
92741 1 = 2
92742 --
92743 THEN
92744 xla_accounting_err_pkg.build_message
92745 (p_appli_s_name => 'XLA'
92746 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
92747 ,p_token_1 => 'LINE_NUMBER'
92748 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
92749 ,p_token_2 => 'LINE_TYPE_NAME'
92750 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
92751 l_component_type
92752 ,l_component_code
92753 ,l_component_type_code
92754 ,l_component_appl_id
92755 ,l_amb_context_code
92756 ,l_entity_code
92757 ,l_event_class_code
92758 )
92759 ,p_token_3 => 'OWNER'
92760 ,p_value_3 => xla_lookups_pkg.get_meaning(
92761 p_lookup_type => 'XLA_OWNER_TYPE'
92762 ,p_lookup_code => l_component_type_code
92763 )
92764 ,p_token_4 => 'PRODUCT_NAME'
92765 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
92766 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
92767 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
92768 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
92769 ,p_ae_header_id => NULL
92770 );
92771
92772 IF (C_LEVEL_ERROR>= g_log_level) THEN
92773 trace
92774 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
92775 ,p_level => C_LEVEL_ERROR
92776 ,p_module => l_log_module);
92777 END IF;
92778 END IF;
92779 END IF;
92780 --
92781 --
92782 ------------------------------------------------------------------------------------------------
92783 -- 4219869 Business Flow
92784 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
92785 -- Prior Entry. Currently, the following code is always generated.
92786 ------------------------------------------------------------------------------------------------
92787 XLA_AE_LINES_PKG.ValidateCurrentLine;
92788
92789 ------------------------------------------------------------------------------------
92790 -- 4219869 Business Flow
92791 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
92792 ------------------------------------------------------------------------------------
92793 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
92794
92795 ----------------------------------------------------------------------------------
92796 -- 4219869 Business Flow
92797 -- Update journal entry status -- Need to generate this within IF <condition>
92798 ----------------------------------------------------------------------------------
92799 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
92800 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
92801 ,p_balance_type_code => l_balance_type_code
92802 );
92803
92804 -------------------------------------------------------------------------------------------
92805 -- 4262811 - Generate the Accrual Reversal lines
92806 -------------------------------------------------------------------------------------------
92807 BEGIN
92808 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
92809 (g_array_event(p_event_id).array_value_num('header_index'));
92810 IF l_acc_rev_flag IS NULL THEN
92811 l_acc_rev_flag := 'N';
92812 END IF;
92813 EXCEPTION
92814 WHEN OTHERS THEN
92818 IF (l_acc_rev_flag = 'Y') THEN
92815 l_acc_rev_flag := 'N';
92816 END;
92817 --
92819
92820 -- 4645092 ------------------------------------------------------------------------------
92821 -- To allow MPA report to determine if it should generate report process
92822 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
92823 ------------------------------------------------------------------------------------------
92824
92825 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
92826 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
92827 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
92828 -- call ADRs
92829 -- Bug 4922099
92830 --
92831 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
92832 (NVL(l_actual_upg_option, 'N') = 'O') OR
92833 (NVL(l_enc_upg_option, 'N') = 'O')
92834 )
92835 THEN
92836 NULL;
92837 --
92838 --
92839
92840 l_ccid := AcctDerRule_174(
92841 p_application_id => p_application_id
92842 , p_ae_header_id => l_ae_header_id
92843 , p_source_5 => p_source_5
92844 , p_source_32 => p_source_32
92845 , x_transaction_coa_id => l_adr_transaction_coa_id
92846 , x_accounting_coa_id => l_adr_accounting_coa_id
92847 , x_value_type_code => l_adr_value_type_code
92848 , p_side => 'NA'
92849 );
92850
92851 xla_ae_lines_pkg.set_ccid(
92852 p_code_combination_id => l_ccid
92853 , p_value_type_code => l_adr_value_type_code
92854 , p_transaction_coa_id => l_adr_transaction_coa_id
92855 , p_accounting_coa_id => l_adr_accounting_coa_id
92856 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
92857 , p_adr_type_code => 'S'
92858 , p_component_type => l_component_type
92859 , p_component_code => l_component_code
92860 , p_component_type_code => l_component_type_code
92861 , p_component_appl_id => l_component_appl_id
92862 , p_amb_context_code => l_amb_context_code
92863 , p_side => 'NA'
92864 );
92865
92866
92867 l_segment := AcctDerRule_149(
92868 p_application_id => p_application_id
92869 , p_ae_header_id => l_ae_header_id
92870 , p_source_5 => p_source_5
92871 , p_source_11 => p_source_11
92872 , x_transaction_coa_id => l_adr_transaction_coa_id
92873 , x_accounting_coa_id => l_adr_accounting_coa_id
92874 , x_flexfield_segment_code => l_adr_flexfield_segment_code
92875 , x_flex_value_set_id => l_adr_flex_value_set_id
92876 , x_value_type_code => l_adr_value_type_code
92877 , x_value_combination_id => l_adr_value_combination_id
92878 , x_value_segment_code => l_adr_value_segment_code
92879 , p_side => 'NA'
92880 , p_override_seg_flag => 'Y'
92881 );
92882
92883 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
92884
92885 xla_ae_lines_pkg.set_segment(
92886 p_to_segment_code => 'GL_ACCOUNT'
92887 , p_segment_value => l_segment
92888 , p_from_segment_code => l_adr_value_segment_code
92889 , p_from_combination_id => l_adr_value_combination_id
92890 , p_value_type_code => l_adr_value_type_code
92891 , p_transaction_coa_id => l_adr_transaction_coa_id
92892 , p_accounting_coa_id => l_adr_accounting_coa_id
92893 , p_flexfield_segment_code => l_adr_flexfield_segment_code
92894 , p_flex_value_set_id => l_adr_flex_value_set_id
92895 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
92896 , p_adr_type_code => 'S'
92897 , p_component_type => l_component_type
92898 , p_component_code => l_component_code
92899 , p_component_type_code => l_component_type_code
92900 , p_component_appl_id => l_component_appl_id
92901 , p_amb_context_code => l_amb_context_code
92902 , p_entity_code => 'TRANSACTIONS'
92903 , p_event_class_code => 'CATEGORY_RECLASS'
92904 , p_side => 'NA'
92905 );
92906
92907 END IF;
92908
92909 l_segment := AcctDerRule_169(
92910 p_application_id => p_application_id
92911 , p_ae_header_id => l_ae_header_id
92912 , p_source_5 => p_source_5
92913 , p_source_31 => p_source_31
92914 , x_transaction_coa_id => l_adr_transaction_coa_id
92915 , x_accounting_coa_id => l_adr_accounting_coa_id
92916 , x_flexfield_segment_code => l_adr_flexfield_segment_code
92917 , x_flex_value_set_id => l_adr_flex_value_set_id
92918 , x_value_type_code => l_adr_value_type_code
92919 , x_value_combination_id => l_adr_value_combination_id
92920 , x_value_segment_code => l_adr_value_segment_code
92921 , p_side => 'NA'
92922 , p_override_seg_flag => 'Y'
92923 );
92924
92925 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
92926
92927 xla_ae_lines_pkg.set_segment(
92928 p_to_segment_code => 'GL_BALANCING'
92929 , p_segment_value => l_segment
92933 , p_transaction_coa_id => l_adr_transaction_coa_id
92930 , p_from_segment_code => l_adr_value_segment_code
92931 , p_from_combination_id => l_adr_value_combination_id
92932 , p_value_type_code => l_adr_value_type_code
92934 , p_accounting_coa_id => l_adr_accounting_coa_id
92935 , p_flexfield_segment_code => l_adr_flexfield_segment_code
92936 , p_flex_value_set_id => l_adr_flex_value_set_id
92937 , p_adr_code => 'FA_EXPENSE_ACCT'
92938 , p_adr_type_code => 'S'
92939 , p_component_type => l_component_type
92940 , p_component_code => l_component_code
92941 , p_component_type_code => l_component_type_code
92942 , p_component_appl_id => l_component_appl_id
92943 , p_amb_context_code => l_amb_context_code
92944 , p_entity_code => 'TRANSACTIONS'
92945 , p_event_class_code => 'CATEGORY_RECLASS'
92946 , p_side => 'NA'
92947 );
92948
92949 END IF;
92950
92951 --
92952 --
92953 END IF;
92954
92955 --
92956 -- Update the line information that should be overwritten
92957 --
92958 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
92959 p_header_num => 1);
92960 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
92961
92962 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
92963
92964 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
92965 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
92966 END IF;
92967
92968 --
92969 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
92970 --
92971 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
92972 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
92973 ELSE
92974 ---------------------------------------------------------------------------------------------------
92975 -- 4262811a Switch Sign
92976 ---------------------------------------------------------------------------------------------------
92977 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
92978 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
92979 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
92980 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
92981 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
92982 -- 5132302
92983 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
92984 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
92985
92986 END IF;
92987
92988 -- 4955764
92989 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
92990 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
92991
92992
92993 XLA_AE_LINES_PKG.ValidateCurrentLine;
92994 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
92995
92996 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
92997 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
92998 ,p_balance_type_code => l_balance_type_code);
92999
93000 END IF;
93001
93002 -----------------------------------------------------------------------------------------
93003 -- 4262811 Multiperiod Accounting
93004 -----------------------------------------------------------------------------------------
93005 -- No MPA option is assigned.
93006
93007
93008 END IF;
93009 END IF;
93010 --
93011
93012 --
93013 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
93014 trace
93015 (p_msg => 'END of AcctLineType_293'
93016 ,p_level => C_LEVEL_PROCEDURE
93017 ,p_module => l_log_module);
93018 END IF;
93019 --
93020 EXCEPTION
93021 WHEN xla_exceptions_pkg.application_exception THEN
93022 RAISE;
93023 WHEN OTHERS THEN
93024 xla_exceptions_pkg.raise_message
93025 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_293');
93026 END AcctLineType_293;
93027 --
93028
93029 ---------------------------------------
93030 --
93031 -- PRIVATE FUNCTION
93032 -- AcctLineType_294
93033 --
93034 ---------------------------------------
93035 PROCEDURE AcctLineType_294 (
93036 p_application_id IN NUMBER
93037 ,p_event_id IN NUMBER
93038 ,p_calculate_acctd_flag IN VARCHAR2
93039 ,p_calculate_g_l_flag IN VARCHAR2
93040 ,p_actual_flag IN OUT VARCHAR2
93041 ,p_balance_type_code OUT VARCHAR2
93042 ,p_gain_or_loss_ref OUT VARCHAR2
93043
93044 --Period Close Date
93045 , p_source_1 IN DATE
93046 --Generated Code Combination Identifier
93047 , p_source_5 IN NUMBER
93051 , p_source_48 IN VARCHAR2
93048 --Expense Account Code Combination Identifier
93049 , p_source_31 IN NUMBER
93050 --Adjustment Type
93052 --Transaction Header Identifier
93053 , p_source_49 IN NUMBER
93054 --Adjustment Line Identifier
93055 , p_source_50 IN NUMBER
93056 --Distribution Type Code
93057 , p_source_51 IN VARCHAR2
93058 --Entered Amount
93059 , p_source_52 IN NUMBER
93060 --Currency Code
93061 , p_source_53 IN VARCHAR2
93062 --Source Destination Code
93063 , p_source_55 IN VARCHAR2
93064 )
93065 IS
93066
93067 l_component_type VARCHAR2(80);
93068 l_component_code VARCHAR2(30);
93069 l_component_type_code VARCHAR2(1);
93070 l_component_appl_id INTEGER;
93071 l_amb_context_code VARCHAR2(30);
93072 l_entity_code VARCHAR2(30);
93073 l_event_class_code VARCHAR2(30);
93074 l_ae_header_id NUMBER;
93075 l_event_type_code VARCHAR2(30);
93076 l_line_definition_code VARCHAR2(30);
93077 l_line_definition_owner_code VARCHAR2(1);
93078 --
93079 -- adr variables
93080 l_segment VARCHAR2(30);
93081 l_ccid NUMBER;
93082 l_adr_transaction_coa_id NUMBER;
93083 l_adr_accounting_coa_id NUMBER;
93084 l_adr_flexfield_segment_code VARCHAR2(30);
93085 l_adr_flex_value_set_id NUMBER;
93086 l_adr_value_type_code VARCHAR2(30);
93087 l_adr_value_combination_id NUMBER;
93088 l_adr_value_segment_code VARCHAR2(30);
93089
93090 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
93091 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
93092 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
93093 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
93094
93095 -- 4262811 Variables ------------------------------------------------------------------------------------------
93096 l_entered_amt_idx NUMBER;
93097 l_accted_amt_idx NUMBER;
93098 l_acc_rev_flag VARCHAR2(1);
93099 l_accrual_line_num NUMBER;
93100 l_tmp_amt NUMBER;
93101 l_acc_rev_natural_side_code VARCHAR2(1);
93102
93103 l_num_entries NUMBER;
93104 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
93105 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
93106 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
93107 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
93108 l_recog_line_1 NUMBER;
93109 l_recog_line_2 NUMBER;
93110
93111 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
93112 l_bflow_applied_to_amt NUMBER; -- 5132302
93113 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
93114
93115 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
93116
93117 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
93118 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
93119
93120 ---------------------------------------------------------------------------------------------------------------
93121
93122
93123 --
93124 -- bulk performance
93125 --
93126 l_balance_type_code VARCHAR2(1);
93127 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
93128 l_log_module VARCHAR2(240);
93129
93130 --
93131 -- Upgrade strategy
93132 --
93133 l_actual_upg_option VARCHAR2(1);
93134 l_enc_upg_option VARCHAR2(1);
93135
93136 --
93137 BEGIN
93138 --
93139 IF g_log_enabled THEN
93140 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_294';
93141 END IF;
93142 --
93143 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
93144
93145 trace
93146 (p_msg => 'BEGIN of AcctLineType_294'
93147 ,p_level => C_LEVEL_PROCEDURE
93148 ,p_module => l_log_module);
93149
93150 END IF;
93151 --
93152 l_component_type := 'AMB_JLT';
93153 l_component_code := 'FA_RECLASS_DEST_DEPRN_EXP';
93154 l_component_type_code := 'S';
93155 l_component_appl_id := 140;
93156 l_amb_context_code := 'DEFAULT';
93157 l_entity_code := 'TRANSACTIONS';
93158 l_event_class_code := 'CATEGORY_RECLASS';
93159 l_event_type_code := 'CATEGORY_RECLASS_ALL';
93160 l_line_definition_owner_code := 'S';
93161 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
93162 --
93163 l_balance_type_code := 'A';
93164 l_segment := NULL;
93165 l_ccid := NULL;
93166 l_adr_transaction_coa_id := NULL;
93167 l_adr_accounting_coa_id := NULL;
93168 l_adr_flexfield_segment_code := NULL;
93169 l_adr_flex_value_set_id := NULL;
93170 l_adr_value_type_code := NULL;
93171 l_adr_value_combination_id := NULL;
93172 l_adr_value_segment_code := NULL;
93173
93174 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
93175 l_bflow_class_code := ''; -- 4219869 Business Flow
93176 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
93180 l_bflow_applied_to_amt := NULL; -- 5132302
93177 l_budgetary_control_flag := 'N';
93178
93179 l_bflow_applied_to_amt_idx := NULL; -- 5132302
93181 l_entered_amt_idx := NULL; -- 4262811
93182 l_accted_amt_idx := NULL; -- 4262811
93183 l_acc_rev_flag := NULL; -- 4262811
93184 l_accrual_line_num := NULL; -- 4262811
93185 l_tmp_amt := NULL; -- 4262811
93186 --
93187
93188 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
93189 l_balance_type_code <> 'B' THEN
93190 IF NVL(p_source_48,'
93191 ') = 'EXPENSE' AND
93192 NVL(p_source_55,'
93193 ') = 'DEST'
93194 THEN
93195
93196 --
93197 XLA_AE_LINES_PKG.SetNewLine;
93198
93199 p_balance_type_code := l_balance_type_code;
93200 -- set the flag so later we will know whether the gain loss line needs to be created
93201
93202 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
93203 p_actual_flag :='A';
93204 END IF;
93205
93206 --
93207 -- bulk performance
93208 --
93209 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
93210 p_header_num => 0); -- 4262811
93211 --
93212 -- set accounting line options
93213 --
93214 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
93215 p_natural_side_code => 'D'
93216 , p_gain_or_loss_flag => 'N'
93217 , p_gl_transfer_mode_code => 'S'
93218 , p_acct_entry_type_code => 'A'
93219 , p_switch_side_flag => 'Y'
93220 , p_merge_duplicate_code => 'N'
93221 );
93222 --
93223 l_acc_rev_natural_side_code := 'C'; -- 4262811
93224 --
93225 --
93226 -- set accounting line type info
93227 --
93228 xla_ae_lines_pkg.SetAcctLineType
93229 (p_component_type => l_component_type
93230 ,p_event_type_code => l_event_type_code
93231 ,p_line_definition_owner_code => l_line_definition_owner_code
93232 ,p_line_definition_code => l_line_definition_code
93233 ,p_accounting_line_code => l_component_code
93234 ,p_accounting_line_type_code => l_component_type_code
93235 ,p_accounting_line_appl_id => l_component_appl_id
93236 ,p_amb_context_code => l_amb_context_code
93237 ,p_entity_code => l_entity_code
93238 ,p_event_class_code => l_event_class_code);
93239 --
93240 -- set accounting class
93241 --
93242 xla_ae_lines_pkg.SetAcctClass(
93243 p_accounting_class_code => 'EXPENSE'
93244 , p_ae_header_id => l_ae_header_id
93245 );
93246
93247 --
93248 -- set rounding class
93249 --
93250 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
93251 'EXPENSE';
93252
93253 --
93254 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
93255 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
93256 --
93257 -- bulk performance
93258 --
93259 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
93260
93261 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
93262 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
93263
93264 -- 4955764
93265 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
93266 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
93267
93268 -- 4458381 Public Sector Enh
93269
93270 --
93271 -- set accounting attributes for the line type
93272 --
93273 l_entered_amt_idx := 4;
93274 l_accted_amt_idx := 6;
93275 l_bflow_applied_to_amt_idx := NULL; -- 5132302
93276 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
93277 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
93278 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
93279 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
93280 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
93281 l_rec_acct_attrs.array_char_value(3) := p_source_51;
93282 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
93283 l_rec_acct_attrs.array_num_value(4) := p_source_52;
93284 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
93285 l_rec_acct_attrs.array_char_value(5) := p_source_53;
93286 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
93287 l_rec_acct_attrs.array_num_value(6) := p_source_52;
93288
93289 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
93290 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
93291
93292 ---------------------------------------------------------------------------------------------------------------
93293 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
93297 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
93294 ---------------------------------------------------------------------------------------------------------------
93295 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
93296
93298 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
93299
93300 IF xla_accounting_cache_pkg.GetValueChar
93301 (p_source_code => 'LEDGER_CATEGORY_CODE'
93302 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
93303 AND l_bflow_method_code = 'PRIOR_ENTRY'
93304 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
93305 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
93306 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
93307 )
93308 THEN
93309 xla_ae_lines_pkg.BflowUpgEntry
93310 (p_business_method_code => l_bflow_method_code
93311 ,p_business_class_code => l_bflow_class_code
93312 ,p_balance_type => l_balance_type_code);
93313 ELSE
93314 NULL;
93315 -- No business flow processing for business flow method of NONE.
93316 END IF;
93317
93318 --
93319 -- call analytical criteria
93320 --
93321
93322 --
93323 -- call description
93324 --
93325
93326 xla_ae_lines_pkg.SetLineDescription(
93327 p_ae_header_id => l_ae_header_id
93328 ,p_description => Description_66 (
93329 p_application_id => p_application_id
93330 , p_ae_header_id => l_ae_header_id
93331 , p_source_1 => p_source_1
93332 )
93333 );
93334
93335
93336 --
93337 -- call ADRs
93338 -- Bug 4922099
93339 --
93340 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
93341 (NVL(l_actual_upg_option, 'N') = 'O') OR
93342 (NVL(l_enc_upg_option, 'N') = 'O')
93343 )
93344 THEN
93345 NULL;
93346 --
93347 --
93348
93349 l_ccid := AcctDerRule_176(
93350 p_application_id => p_application_id
93351 , p_ae_header_id => l_ae_header_id
93352 , p_source_5 => p_source_5
93353 , p_source_31 => p_source_31
93354 , x_transaction_coa_id => l_adr_transaction_coa_id
93355 , x_accounting_coa_id => l_adr_accounting_coa_id
93356 , x_value_type_code => l_adr_value_type_code
93357 , p_side => 'NA'
93358 );
93359
93360 xla_ae_lines_pkg.set_ccid(
93361 p_code_combination_id => l_ccid
93362 , p_value_type_code => l_adr_value_type_code
93363 , p_transaction_coa_id => l_adr_transaction_coa_id
93364 , p_accounting_coa_id => l_adr_accounting_coa_id
93365 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
93366 , p_adr_type_code => 'S'
93367 , p_component_type => l_component_type
93368 , p_component_code => l_component_code
93369 , p_component_type_code => l_component_type_code
93370 , p_component_appl_id => l_component_appl_id
93371 , p_amb_context_code => l_amb_context_code
93372 , p_side => 'NA'
93373 );
93374
93375
93376 --
93377 --
93378 END IF;
93379 --
93380 -- Bug 4922099
93381 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
93382 (NVL(l_enc_upg_option, 'N') = 'O')
93383 ) AND
93384 (l_bflow_method_code = 'PRIOR_ENTRY')
93385 )
93386 THEN
93387 IF
93388 --
93389 1 = 2
93390 --
93391 THEN
93392 xla_accounting_err_pkg.build_message
93393 (p_appli_s_name => 'XLA'
93394 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
93395 ,p_token_1 => 'LINE_NUMBER'
93396 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
93397 ,p_token_2 => 'LINE_TYPE_NAME'
93398 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
93399 l_component_type
93400 ,l_component_code
93401 ,l_component_type_code
93402 ,l_component_appl_id
93403 ,l_amb_context_code
93404 ,l_entity_code
93405 ,l_event_class_code
93406 )
93407 ,p_token_3 => 'OWNER'
93408 ,p_value_3 => xla_lookups_pkg.get_meaning(
93409 p_lookup_type => 'XLA_OWNER_TYPE'
93410 ,p_lookup_code => l_component_type_code
93414 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
93411 )
93412 ,p_token_4 => 'PRODUCT_NAME'
93413 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
93415 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
93416 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
93417 ,p_ae_header_id => NULL
93418 );
93419
93420 IF (C_LEVEL_ERROR>= g_log_level) THEN
93421 trace
93422 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
93423 ,p_level => C_LEVEL_ERROR
93424 ,p_module => l_log_module);
93425 END IF;
93426 END IF;
93427 END IF;
93428 --
93429 --
93430 ------------------------------------------------------------------------------------------------
93431 -- 4219869 Business Flow
93432 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
93433 -- Prior Entry. Currently, the following code is always generated.
93434 ------------------------------------------------------------------------------------------------
93435 XLA_AE_LINES_PKG.ValidateCurrentLine;
93436
93437 ------------------------------------------------------------------------------------
93438 -- 4219869 Business Flow
93439 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
93440 ------------------------------------------------------------------------------------
93441 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
93442
93443 ----------------------------------------------------------------------------------
93444 -- 4219869 Business Flow
93445 -- Update journal entry status -- Need to generate this within IF <condition>
93446 ----------------------------------------------------------------------------------
93447 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
93448 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
93449 ,p_balance_type_code => l_balance_type_code
93450 );
93451
93452 -------------------------------------------------------------------------------------------
93453 -- 4262811 - Generate the Accrual Reversal lines
93454 -------------------------------------------------------------------------------------------
93455 BEGIN
93456 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
93457 (g_array_event(p_event_id).array_value_num('header_index'));
93458 IF l_acc_rev_flag IS NULL THEN
93459 l_acc_rev_flag := 'N';
93460 END IF;
93461 EXCEPTION
93462 WHEN OTHERS THEN
93463 l_acc_rev_flag := 'N';
93464 END;
93465 --
93466 IF (l_acc_rev_flag = 'Y') THEN
93467
93468 -- 4645092 ------------------------------------------------------------------------------
93469 -- To allow MPA report to determine if it should generate report process
93470 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
93471 ------------------------------------------------------------------------------------------
93472
93473 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
93474 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
93475 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
93476 -- call ADRs
93477 -- Bug 4922099
93478 --
93479 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
93480 (NVL(l_actual_upg_option, 'N') = 'O') OR
93481 (NVL(l_enc_upg_option, 'N') = 'O')
93482 )
93483 THEN
93484 NULL;
93485 --
93486 --
93487
93488 l_ccid := AcctDerRule_176(
93489 p_application_id => p_application_id
93490 , p_ae_header_id => l_ae_header_id
93491 , p_source_5 => p_source_5
93492 , p_source_31 => p_source_31
93493 , x_transaction_coa_id => l_adr_transaction_coa_id
93494 , x_accounting_coa_id => l_adr_accounting_coa_id
93495 , x_value_type_code => l_adr_value_type_code
93496 , p_side => 'NA'
93497 );
93498
93499 xla_ae_lines_pkg.set_ccid(
93500 p_code_combination_id => l_ccid
93501 , p_value_type_code => l_adr_value_type_code
93502 , p_transaction_coa_id => l_adr_transaction_coa_id
93503 , p_accounting_coa_id => l_adr_accounting_coa_id
93504 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
93505 , p_adr_type_code => 'S'
93506 , p_component_type => l_component_type
93507 , p_component_code => l_component_code
93508 , p_component_type_code => l_component_type_code
93509 , p_component_appl_id => l_component_appl_id
93510 , p_amb_context_code => l_amb_context_code
93511 , p_side => 'NA'
93512 );
93513
93514
93515 --
93516 --
93517 END IF;
93518
93519 --
93520 -- Update the line information that should be overwritten
93521 --
93522 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
93526 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
93523 p_header_num => 1);
93524 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
93525
93527
93528 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
93529 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
93530 END IF;
93531
93532 --
93533 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
93534 --
93535 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
93536 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
93537 ELSE
93538 ---------------------------------------------------------------------------------------------------
93539 -- 4262811a Switch Sign
93540 ---------------------------------------------------------------------------------------------------
93541 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
93542 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
93543 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
93544 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
93545 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
93546 -- 5132302
93547 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
93548 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
93549
93550 END IF;
93551
93552 -- 4955764
93553 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
93554 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
93555
93556
93557 XLA_AE_LINES_PKG.ValidateCurrentLine;
93558 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
93559
93560 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
93561 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
93562 ,p_balance_type_code => l_balance_type_code);
93563
93564 END IF;
93565
93566 -----------------------------------------------------------------------------------------
93567 -- 4262811 Multiperiod Accounting
93568 -----------------------------------------------------------------------------------------
93569 -- No MPA option is assigned.
93570
93571
93572 END IF;
93573 END IF;
93574 --
93575
93576 --
93577 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
93578 trace
93579 (p_msg => 'END of AcctLineType_294'
93580 ,p_level => C_LEVEL_PROCEDURE
93581 ,p_module => l_log_module);
93582 END IF;
93583 --
93584 EXCEPTION
93585 WHEN xla_exceptions_pkg.application_exception THEN
93586 RAISE;
93587 WHEN OTHERS THEN
93588 xla_exceptions_pkg.raise_message
93589 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_294');
93590 END AcctLineType_294;
93591 --
93592
93593 ---------------------------------------
93594 --
93595 -- PRIVATE FUNCTION
93596 -- AcctLineType_295
93597 --
93598 ---------------------------------------
93599 PROCEDURE AcctLineType_295 (
93600 p_application_id IN NUMBER
93601 ,p_event_id IN NUMBER
93602 ,p_calculate_acctd_flag IN VARCHAR2
93603 ,p_calculate_g_l_flag IN VARCHAR2
93604 ,p_actual_flag IN OUT VARCHAR2
93605 ,p_balance_type_code OUT VARCHAR2
93606 ,p_gain_or_loss_ref OUT VARCHAR2
93607
93608 --Period Close Date
93609 , p_source_1 IN DATE
93610 --Generated Code Combination Identifier
93611 , p_source_5 IN NUMBER
93612 --Depreciation Reserve Account
93613 , p_source_12 IN VARCHAR2
93614 --Expense Account Code Combination Identifier
93615 , p_source_31 IN NUMBER
93616 --Default Code Combination Identifier
93617 , p_source_32 IN NUMBER
93618 --Adjustment Type
93619 , p_source_48 IN VARCHAR2
93620 --Transaction Header Identifier
93621 , p_source_49 IN NUMBER
93622 --Adjustment Line Identifier
93623 , p_source_50 IN NUMBER
93624 --Distribution Type Code
93625 , p_source_51 IN VARCHAR2
93626 --Entered Amount
93627 , p_source_52 IN NUMBER
93628 --Currency Code
93629 , p_source_53 IN VARCHAR2
93630 --Source Destination Code
93631 , p_source_55 IN VARCHAR2
93632 )
93633 IS
93634
93635 l_component_type VARCHAR2(80);
93636 l_component_code VARCHAR2(30);
93637 l_component_type_code VARCHAR2(1);
93638 l_component_appl_id INTEGER;
93639 l_amb_context_code VARCHAR2(30);
93640 l_entity_code VARCHAR2(30);
93641 l_event_class_code VARCHAR2(30);
93642 l_ae_header_id NUMBER;
93643 l_event_type_code VARCHAR2(30);
93644 l_line_definition_code VARCHAR2(30);
93645 l_line_definition_owner_code VARCHAR2(1);
93646 --
93650 l_adr_transaction_coa_id NUMBER;
93647 -- adr variables
93648 l_segment VARCHAR2(30);
93649 l_ccid NUMBER;
93651 l_adr_accounting_coa_id NUMBER;
93652 l_adr_flexfield_segment_code VARCHAR2(30);
93653 l_adr_flex_value_set_id NUMBER;
93654 l_adr_value_type_code VARCHAR2(30);
93655 l_adr_value_combination_id NUMBER;
93656 l_adr_value_segment_code VARCHAR2(30);
93657
93658 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
93659 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
93660 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
93661 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
93662
93663 -- 4262811 Variables ------------------------------------------------------------------------------------------
93664 l_entered_amt_idx NUMBER;
93665 l_accted_amt_idx NUMBER;
93666 l_acc_rev_flag VARCHAR2(1);
93667 l_accrual_line_num NUMBER;
93668 l_tmp_amt NUMBER;
93669 l_acc_rev_natural_side_code VARCHAR2(1);
93670
93671 l_num_entries NUMBER;
93672 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
93673 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
93674 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
93675 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
93676 l_recog_line_1 NUMBER;
93677 l_recog_line_2 NUMBER;
93678
93679 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
93680 l_bflow_applied_to_amt NUMBER; -- 5132302
93681 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
93682
93683 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
93684
93685 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
93686 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
93687
93688 ---------------------------------------------------------------------------------------------------------------
93689
93690
93691 --
93692 -- bulk performance
93693 --
93694 l_balance_type_code VARCHAR2(1);
93695 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
93696 l_log_module VARCHAR2(240);
93697
93698 --
93699 -- Upgrade strategy
93700 --
93701 l_actual_upg_option VARCHAR2(1);
93702 l_enc_upg_option VARCHAR2(1);
93703
93704 --
93705 BEGIN
93706 --
93707 IF g_log_enabled THEN
93708 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_295';
93709 END IF;
93710 --
93711 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
93712
93713 trace
93714 (p_msg => 'BEGIN of AcctLineType_295'
93715 ,p_level => C_LEVEL_PROCEDURE
93716 ,p_module => l_log_module);
93717
93718 END IF;
93719 --
93720 l_component_type := 'AMB_JLT';
93721 l_component_code := 'FA_RECLASS_DEST_DEPRN_RESERVE';
93722 l_component_type_code := 'S';
93723 l_component_appl_id := 140;
93724 l_amb_context_code := 'DEFAULT';
93725 l_entity_code := 'TRANSACTIONS';
93726 l_event_class_code := 'CATEGORY_RECLASS';
93727 l_event_type_code := 'CATEGORY_RECLASS_ALL';
93728 l_line_definition_owner_code := 'S';
93729 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
93730 --
93731 l_balance_type_code := 'A';
93732 l_segment := NULL;
93733 l_ccid := NULL;
93734 l_adr_transaction_coa_id := NULL;
93735 l_adr_accounting_coa_id := NULL;
93736 l_adr_flexfield_segment_code := NULL;
93737 l_adr_flex_value_set_id := NULL;
93738 l_adr_value_type_code := NULL;
93739 l_adr_value_combination_id := NULL;
93740 l_adr_value_segment_code := NULL;
93741
93742 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
93743 l_bflow_class_code := ''; -- 4219869 Business Flow
93744 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
93745 l_budgetary_control_flag := 'N';
93746
93747 l_bflow_applied_to_amt_idx := NULL; -- 5132302
93748 l_bflow_applied_to_amt := NULL; -- 5132302
93749 l_entered_amt_idx := NULL; -- 4262811
93750 l_accted_amt_idx := NULL; -- 4262811
93751 l_acc_rev_flag := NULL; -- 4262811
93752 l_accrual_line_num := NULL; -- 4262811
93753 l_tmp_amt := NULL; -- 4262811
93754 --
93755
93756 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
93757 l_balance_type_code <> 'B' THEN
93758 IF (NVL(p_source_48,'
93759 ') = 'EXPENSE' OR
93760 NVL(p_source_48,'
93761 ') = 'RESERVE') AND
93762 NVL(p_source_55,'
93763 ') = 'DEST'
93764 THEN
93765
93766 --
93767 XLA_AE_LINES_PKG.SetNewLine;
93768
93769 p_balance_type_code := l_balance_type_code;
93770 -- set the flag so later we will know whether the gain loss line needs to be created
93771
93772 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
93773 p_actual_flag :='A';
93774 END IF;
93775
93779 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
93776 --
93777 -- bulk performance
93778 --
93780 p_header_num => 0); -- 4262811
93781 --
93782 -- set accounting line options
93783 --
93784 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
93785 p_natural_side_code => 'C'
93786 , p_gain_or_loss_flag => 'N'
93787 , p_gl_transfer_mode_code => 'S'
93788 , p_acct_entry_type_code => 'A'
93789 , p_switch_side_flag => 'Y'
93790 , p_merge_duplicate_code => 'N'
93791 );
93792 --
93793 l_acc_rev_natural_side_code := 'D'; -- 4262811
93794 --
93795 --
93796 -- set accounting line type info
93797 --
93798 xla_ae_lines_pkg.SetAcctLineType
93799 (p_component_type => l_component_type
93800 ,p_event_type_code => l_event_type_code
93801 ,p_line_definition_owner_code => l_line_definition_owner_code
93802 ,p_line_definition_code => l_line_definition_code
93803 ,p_accounting_line_code => l_component_code
93804 ,p_accounting_line_type_code => l_component_type_code
93805 ,p_accounting_line_appl_id => l_component_appl_id
93806 ,p_amb_context_code => l_amb_context_code
93807 ,p_entity_code => l_entity_code
93808 ,p_event_class_code => l_event_class_code);
93809 --
93810 -- set accounting class
93811 --
93812 xla_ae_lines_pkg.SetAcctClass(
93813 p_accounting_class_code => 'ASSET'
93814 , p_ae_header_id => l_ae_header_id
93815 );
93816
93817 --
93818 -- set rounding class
93819 --
93820 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
93821 'ASSET';
93822
93823 --
93824 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
93825 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
93826 --
93827 -- bulk performance
93828 --
93829 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
93830
93831 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
93832 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
93833
93834 -- 4955764
93835 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
93836 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
93837
93838 -- 4458381 Public Sector Enh
93839
93840 --
93841 -- set accounting attributes for the line type
93842 --
93843 l_entered_amt_idx := 4;
93844 l_accted_amt_idx := 6;
93845 l_bflow_applied_to_amt_idx := NULL; -- 5132302
93846 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
93847 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
93848 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
93849 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
93850 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
93851 l_rec_acct_attrs.array_char_value(3) := p_source_51;
93852 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
93853 l_rec_acct_attrs.array_num_value(4) := p_source_52;
93854 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
93855 l_rec_acct_attrs.array_char_value(5) := p_source_53;
93856 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
93857 l_rec_acct_attrs.array_num_value(6) := p_source_52;
93858
93859 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
93860 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
93861
93862 ---------------------------------------------------------------------------------------------------------------
93863 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
93864 ---------------------------------------------------------------------------------------------------------------
93865 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
93866
93867 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
93868 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
93869
93870 IF xla_accounting_cache_pkg.GetValueChar
93871 (p_source_code => 'LEDGER_CATEGORY_CODE'
93872 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
93873 AND l_bflow_method_code = 'PRIOR_ENTRY'
93874 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
93875 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
93876 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
93877 )
93878 THEN
93879 xla_ae_lines_pkg.BflowUpgEntry
93880 (p_business_method_code => l_bflow_method_code
93881 ,p_business_class_code => l_bflow_class_code
93882 ,p_balance_type => l_balance_type_code);
93883 ELSE
93884 NULL;
93888 --
93885 -- No business flow processing for business flow method of NONE.
93886 END IF;
93887
93889 -- call analytical criteria
93890 --
93891
93892 --
93893 -- call description
93894 --
93895
93896 xla_ae_lines_pkg.SetLineDescription(
93897 p_ae_header_id => l_ae_header_id
93898 ,p_description => Description_67 (
93899 p_application_id => p_application_id
93900 , p_ae_header_id => l_ae_header_id
93901 , p_source_1 => p_source_1
93902 )
93903 );
93904
93905
93906 --
93907 -- call ADRs
93908 -- Bug 4922099
93909 --
93910 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
93911 (NVL(l_actual_upg_option, 'N') = 'O') OR
93912 (NVL(l_enc_upg_option, 'N') = 'O')
93913 )
93914 THEN
93915 NULL;
93916 --
93917 --
93918
93919 l_ccid := AcctDerRule_174(
93920 p_application_id => p_application_id
93921 , p_ae_header_id => l_ae_header_id
93922 , p_source_5 => p_source_5
93923 , p_source_32 => p_source_32
93924 , x_transaction_coa_id => l_adr_transaction_coa_id
93925 , x_accounting_coa_id => l_adr_accounting_coa_id
93926 , x_value_type_code => l_adr_value_type_code
93927 , p_side => 'NA'
93928 );
93929
93930 xla_ae_lines_pkg.set_ccid(
93931 p_code_combination_id => l_ccid
93932 , p_value_type_code => l_adr_value_type_code
93933 , p_transaction_coa_id => l_adr_transaction_coa_id
93934 , p_accounting_coa_id => l_adr_accounting_coa_id
93935 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
93936 , p_adr_type_code => 'S'
93937 , p_component_type => l_component_type
93938 , p_component_code => l_component_code
93939 , p_component_type_code => l_component_type_code
93940 , p_component_appl_id => l_component_appl_id
93941 , p_amb_context_code => l_amb_context_code
93942 , p_side => 'NA'
93943 );
93944
93945
93946 l_segment := AcctDerRule_150(
93947 p_application_id => p_application_id
93948 , p_ae_header_id => l_ae_header_id
93949 , p_source_5 => p_source_5
93950 , p_source_12 => p_source_12
93951 , x_transaction_coa_id => l_adr_transaction_coa_id
93952 , x_accounting_coa_id => l_adr_accounting_coa_id
93953 , x_flexfield_segment_code => l_adr_flexfield_segment_code
93954 , x_flex_value_set_id => l_adr_flex_value_set_id
93955 , x_value_type_code => l_adr_value_type_code
93956 , x_value_combination_id => l_adr_value_combination_id
93957 , x_value_segment_code => l_adr_value_segment_code
93958 , p_side => 'NA'
93959 , p_override_seg_flag => 'Y'
93960 );
93961
93962 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
93963
93964 xla_ae_lines_pkg.set_segment(
93965 p_to_segment_code => 'GL_ACCOUNT'
93966 , p_segment_value => l_segment
93967 , p_from_segment_code => l_adr_value_segment_code
93968 , p_from_combination_id => l_adr_value_combination_id
93969 , p_value_type_code => l_adr_value_type_code
93970 , p_transaction_coa_id => l_adr_transaction_coa_id
93971 , p_accounting_coa_id => l_adr_accounting_coa_id
93972 , p_flexfield_segment_code => l_adr_flexfield_segment_code
93973 , p_flex_value_set_id => l_adr_flex_value_set_id
93974 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
93975 , p_adr_type_code => 'S'
93976 , p_component_type => l_component_type
93977 , p_component_code => l_component_code
93978 , p_component_type_code => l_component_type_code
93979 , p_component_appl_id => l_component_appl_id
93980 , p_amb_context_code => l_amb_context_code
93981 , p_entity_code => 'TRANSACTIONS'
93982 , p_event_class_code => 'CATEGORY_RECLASS'
93983 , p_side => 'NA'
93984 );
93985
93986 END IF;
93987
93988 l_segment := AcctDerRule_169(
93989 p_application_id => p_application_id
93990 , p_ae_header_id => l_ae_header_id
93991 , p_source_5 => p_source_5
93992 , p_source_31 => p_source_31
93993 , x_transaction_coa_id => l_adr_transaction_coa_id
93994 , x_accounting_coa_id => l_adr_accounting_coa_id
93995 , x_flexfield_segment_code => l_adr_flexfield_segment_code
93996 , x_flex_value_set_id => l_adr_flex_value_set_id
93997 , x_value_type_code => l_adr_value_type_code
93998 , x_value_combination_id => l_adr_value_combination_id
93999 , x_value_segment_code => l_adr_value_segment_code
94000 , p_side => 'NA'
94001 , p_override_seg_flag => 'Y'
94002 );
94003
94004 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
94005
94006 xla_ae_lines_pkg.set_segment(
94007 p_to_segment_code => 'GL_BALANCING'
94008 , p_segment_value => l_segment
94009 , p_from_segment_code => l_adr_value_segment_code
94013 , p_accounting_coa_id => l_adr_accounting_coa_id
94010 , p_from_combination_id => l_adr_value_combination_id
94011 , p_value_type_code => l_adr_value_type_code
94012 , p_transaction_coa_id => l_adr_transaction_coa_id
94014 , p_flexfield_segment_code => l_adr_flexfield_segment_code
94015 , p_flex_value_set_id => l_adr_flex_value_set_id
94016 , p_adr_code => 'FA_EXPENSE_ACCT'
94017 , p_adr_type_code => 'S'
94018 , p_component_type => l_component_type
94019 , p_component_code => l_component_code
94020 , p_component_type_code => l_component_type_code
94021 , p_component_appl_id => l_component_appl_id
94022 , p_amb_context_code => l_amb_context_code
94023 , p_entity_code => 'TRANSACTIONS'
94024 , p_event_class_code => 'CATEGORY_RECLASS'
94025 , p_side => 'NA'
94026 );
94027
94028 END IF;
94029
94030 --
94031 --
94032 END IF;
94033 --
94034 -- Bug 4922099
94035 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
94036 (NVL(l_enc_upg_option, 'N') = 'O')
94037 ) AND
94038 (l_bflow_method_code = 'PRIOR_ENTRY')
94039 )
94040 THEN
94041 IF
94042 --
94043 1 = 2
94044 --
94045 THEN
94046 xla_accounting_err_pkg.build_message
94047 (p_appli_s_name => 'XLA'
94048 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
94049 ,p_token_1 => 'LINE_NUMBER'
94050 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
94051 ,p_token_2 => 'LINE_TYPE_NAME'
94052 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
94053 l_component_type
94054 ,l_component_code
94055 ,l_component_type_code
94056 ,l_component_appl_id
94057 ,l_amb_context_code
94058 ,l_entity_code
94059 ,l_event_class_code
94060 )
94061 ,p_token_3 => 'OWNER'
94062 ,p_value_3 => xla_lookups_pkg.get_meaning(
94063 p_lookup_type => 'XLA_OWNER_TYPE'
94064 ,p_lookup_code => l_component_type_code
94065 )
94066 ,p_token_4 => 'PRODUCT_NAME'
94067 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
94068 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
94069 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
94070 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
94071 ,p_ae_header_id => NULL
94072 );
94073
94074 IF (C_LEVEL_ERROR>= g_log_level) THEN
94075 trace
94076 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
94077 ,p_level => C_LEVEL_ERROR
94078 ,p_module => l_log_module);
94079 END IF;
94080 END IF;
94081 END IF;
94082 --
94083 --
94084 ------------------------------------------------------------------------------------------------
94085 -- 4219869 Business Flow
94086 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
94087 -- Prior Entry. Currently, the following code is always generated.
94088 ------------------------------------------------------------------------------------------------
94089 XLA_AE_LINES_PKG.ValidateCurrentLine;
94090
94091 ------------------------------------------------------------------------------------
94092 -- 4219869 Business Flow
94093 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
94094 ------------------------------------------------------------------------------------
94095 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
94096
94097 ----------------------------------------------------------------------------------
94098 -- 4219869 Business Flow
94099 -- Update journal entry status -- Need to generate this within IF <condition>
94100 ----------------------------------------------------------------------------------
94101 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
94102 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
94103 ,p_balance_type_code => l_balance_type_code
94104 );
94105
94109 BEGIN
94106 -------------------------------------------------------------------------------------------
94107 -- 4262811 - Generate the Accrual Reversal lines
94108 -------------------------------------------------------------------------------------------
94110 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
94111 (g_array_event(p_event_id).array_value_num('header_index'));
94112 IF l_acc_rev_flag IS NULL THEN
94113 l_acc_rev_flag := 'N';
94114 END IF;
94115 EXCEPTION
94116 WHEN OTHERS THEN
94117 l_acc_rev_flag := 'N';
94118 END;
94119 --
94120 IF (l_acc_rev_flag = 'Y') THEN
94121
94122 -- 4645092 ------------------------------------------------------------------------------
94123 -- To allow MPA report to determine if it should generate report process
94124 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
94125 ------------------------------------------------------------------------------------------
94126
94127 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
94128 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
94129 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
94130 -- call ADRs
94131 -- Bug 4922099
94132 --
94133 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
94134 (NVL(l_actual_upg_option, 'N') = 'O') OR
94135 (NVL(l_enc_upg_option, 'N') = 'O')
94136 )
94137 THEN
94138 NULL;
94139 --
94140 --
94141
94142 l_ccid := AcctDerRule_174(
94143 p_application_id => p_application_id
94144 , p_ae_header_id => l_ae_header_id
94145 , p_source_5 => p_source_5
94146 , p_source_32 => p_source_32
94147 , x_transaction_coa_id => l_adr_transaction_coa_id
94148 , x_accounting_coa_id => l_adr_accounting_coa_id
94149 , x_value_type_code => l_adr_value_type_code
94150 , p_side => 'NA'
94151 );
94152
94153 xla_ae_lines_pkg.set_ccid(
94154 p_code_combination_id => l_ccid
94155 , p_value_type_code => l_adr_value_type_code
94156 , p_transaction_coa_id => l_adr_transaction_coa_id
94157 , p_accounting_coa_id => l_adr_accounting_coa_id
94158 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
94159 , p_adr_type_code => 'S'
94160 , p_component_type => l_component_type
94161 , p_component_code => l_component_code
94162 , p_component_type_code => l_component_type_code
94163 , p_component_appl_id => l_component_appl_id
94164 , p_amb_context_code => l_amb_context_code
94165 , p_side => 'NA'
94166 );
94167
94168
94169 l_segment := AcctDerRule_150(
94170 p_application_id => p_application_id
94171 , p_ae_header_id => l_ae_header_id
94172 , p_source_5 => p_source_5
94173 , p_source_12 => p_source_12
94174 , x_transaction_coa_id => l_adr_transaction_coa_id
94175 , x_accounting_coa_id => l_adr_accounting_coa_id
94176 , x_flexfield_segment_code => l_adr_flexfield_segment_code
94177 , x_flex_value_set_id => l_adr_flex_value_set_id
94178 , x_value_type_code => l_adr_value_type_code
94179 , x_value_combination_id => l_adr_value_combination_id
94180 , x_value_segment_code => l_adr_value_segment_code
94181 , p_side => 'NA'
94182 , p_override_seg_flag => 'Y'
94183 );
94184
94185 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
94186
94187 xla_ae_lines_pkg.set_segment(
94188 p_to_segment_code => 'GL_ACCOUNT'
94189 , p_segment_value => l_segment
94190 , p_from_segment_code => l_adr_value_segment_code
94191 , p_from_combination_id => l_adr_value_combination_id
94192 , p_value_type_code => l_adr_value_type_code
94193 , p_transaction_coa_id => l_adr_transaction_coa_id
94194 , p_accounting_coa_id => l_adr_accounting_coa_id
94195 , p_flexfield_segment_code => l_adr_flexfield_segment_code
94196 , p_flex_value_set_id => l_adr_flex_value_set_id
94197 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
94198 , p_adr_type_code => 'S'
94199 , p_component_type => l_component_type
94200 , p_component_code => l_component_code
94201 , p_component_type_code => l_component_type_code
94202 , p_component_appl_id => l_component_appl_id
94203 , p_amb_context_code => l_amb_context_code
94204 , p_entity_code => 'TRANSACTIONS'
94205 , p_event_class_code => 'CATEGORY_RECLASS'
94206 , p_side => 'NA'
94207 );
94208
94209 END IF;
94210
94211 l_segment := AcctDerRule_169(
94212 p_application_id => p_application_id
94213 , p_ae_header_id => l_ae_header_id
94214 , p_source_5 => p_source_5
94215 , p_source_31 => p_source_31
94216 , x_transaction_coa_id => l_adr_transaction_coa_id
94217 , x_accounting_coa_id => l_adr_accounting_coa_id
94218 , x_flexfield_segment_code => l_adr_flexfield_segment_code
94222 , x_value_segment_code => l_adr_value_segment_code
94219 , x_flex_value_set_id => l_adr_flex_value_set_id
94220 , x_value_type_code => l_adr_value_type_code
94221 , x_value_combination_id => l_adr_value_combination_id
94223 , p_side => 'NA'
94224 , p_override_seg_flag => 'Y'
94225 );
94226
94227 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
94228
94229 xla_ae_lines_pkg.set_segment(
94230 p_to_segment_code => 'GL_BALANCING'
94231 , p_segment_value => l_segment
94232 , p_from_segment_code => l_adr_value_segment_code
94233 , p_from_combination_id => l_adr_value_combination_id
94234 , p_value_type_code => l_adr_value_type_code
94235 , p_transaction_coa_id => l_adr_transaction_coa_id
94236 , p_accounting_coa_id => l_adr_accounting_coa_id
94237 , p_flexfield_segment_code => l_adr_flexfield_segment_code
94238 , p_flex_value_set_id => l_adr_flex_value_set_id
94239 , p_adr_code => 'FA_EXPENSE_ACCT'
94240 , p_adr_type_code => 'S'
94241 , p_component_type => l_component_type
94242 , p_component_code => l_component_code
94243 , p_component_type_code => l_component_type_code
94244 , p_component_appl_id => l_component_appl_id
94245 , p_amb_context_code => l_amb_context_code
94246 , p_entity_code => 'TRANSACTIONS'
94247 , p_event_class_code => 'CATEGORY_RECLASS'
94248 , p_side => 'NA'
94249 );
94250
94251 END IF;
94252
94253 --
94254 --
94255 END IF;
94256
94257 --
94258 -- Update the line information that should be overwritten
94259 --
94260 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
94261 p_header_num => 1);
94262 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
94263
94264 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
94265
94266 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
94267 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
94268 END IF;
94269
94270 --
94271 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
94272 --
94273 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
94274 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
94275 ELSE
94276 ---------------------------------------------------------------------------------------------------
94277 -- 4262811a Switch Sign
94278 ---------------------------------------------------------------------------------------------------
94279 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
94280 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
94281 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
94282 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
94283 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
94284 -- 5132302
94285 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
94286 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
94287
94288 END IF;
94289
94290 -- 4955764
94291 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
94292 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
94293
94294
94295 XLA_AE_LINES_PKG.ValidateCurrentLine;
94296 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
94297
94298 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
94299 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
94300 ,p_balance_type_code => l_balance_type_code);
94301
94302 END IF;
94303
94304 -----------------------------------------------------------------------------------------
94305 -- 4262811 Multiperiod Accounting
94306 -----------------------------------------------------------------------------------------
94307 -- No MPA option is assigned.
94308
94309
94310 END IF;
94311 END IF;
94312 --
94313
94314 --
94315 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
94316 trace
94317 (p_msg => 'END of AcctLineType_295'
94318 ,p_level => C_LEVEL_PROCEDURE
94319 ,p_module => l_log_module);
94320 END IF;
94321 --
94322 EXCEPTION
94323 WHEN xla_exceptions_pkg.application_exception THEN
94324 RAISE;
94325 WHEN OTHERS THEN
94326 xla_exceptions_pkg.raise_message
94327 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_295');
94328 END AcctLineType_295;
94329 --
94330
94331 ---------------------------------------
94332 --
94336 ---------------------------------------
94333 -- PRIVATE FUNCTION
94334 -- AcctLineType_296
94335 --
94337 PROCEDURE AcctLineType_296 (
94338 p_application_id IN NUMBER
94339 ,p_event_id IN NUMBER
94340 ,p_calculate_acctd_flag IN VARCHAR2
94341 ,p_calculate_g_l_flag IN VARCHAR2
94342 ,p_actual_flag IN OUT VARCHAR2
94343 ,p_balance_type_code OUT VARCHAR2
94344 ,p_gain_or_loss_ref OUT VARCHAR2
94345
94346 --Period Close Date
94347 , p_source_1 IN DATE
94348 --Generated Code Combination Identifier
94349 , p_source_5 IN NUMBER
94350 --Revaluation Reserve Account
94351 , p_source_13 IN VARCHAR2
94352 --Expense Account Code Combination Identifier
94353 , p_source_31 IN NUMBER
94354 --Default Code Combination Identifier
94355 , p_source_32 IN NUMBER
94356 --Adjustment Type
94357 , p_source_48 IN VARCHAR2
94358 --Transaction Header Identifier
94359 , p_source_49 IN NUMBER
94360 --Adjustment Line Identifier
94361 , p_source_50 IN NUMBER
94362 --Distribution Type Code
94363 , p_source_51 IN VARCHAR2
94364 --Entered Amount
94365 , p_source_52 IN NUMBER
94366 --Currency Code
94367 , p_source_53 IN VARCHAR2
94368 --Source Destination Code
94369 , p_source_55 IN VARCHAR2
94370 )
94371 IS
94372
94373 l_component_type VARCHAR2(80);
94374 l_component_code VARCHAR2(30);
94375 l_component_type_code VARCHAR2(1);
94376 l_component_appl_id INTEGER;
94377 l_amb_context_code VARCHAR2(30);
94378 l_entity_code VARCHAR2(30);
94379 l_event_class_code VARCHAR2(30);
94380 l_ae_header_id NUMBER;
94381 l_event_type_code VARCHAR2(30);
94382 l_line_definition_code VARCHAR2(30);
94383 l_line_definition_owner_code VARCHAR2(1);
94384 --
94385 -- adr variables
94386 l_segment VARCHAR2(30);
94387 l_ccid NUMBER;
94388 l_adr_transaction_coa_id NUMBER;
94389 l_adr_accounting_coa_id NUMBER;
94390 l_adr_flexfield_segment_code VARCHAR2(30);
94391 l_adr_flex_value_set_id NUMBER;
94392 l_adr_value_type_code VARCHAR2(30);
94393 l_adr_value_combination_id NUMBER;
94394 l_adr_value_segment_code VARCHAR2(30);
94395
94396 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
94397 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
94398 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
94399 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
94400
94401 -- 4262811 Variables ------------------------------------------------------------------------------------------
94402 l_entered_amt_idx NUMBER;
94403 l_accted_amt_idx NUMBER;
94404 l_acc_rev_flag VARCHAR2(1);
94405 l_accrual_line_num NUMBER;
94406 l_tmp_amt NUMBER;
94407 l_acc_rev_natural_side_code VARCHAR2(1);
94408
94409 l_num_entries NUMBER;
94410 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
94411 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
94412 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
94413 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
94414 l_recog_line_1 NUMBER;
94415 l_recog_line_2 NUMBER;
94416
94417 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
94418 l_bflow_applied_to_amt NUMBER; -- 5132302
94419 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
94420
94421 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
94422
94423 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
94424 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
94425
94426 ---------------------------------------------------------------------------------------------------------------
94427
94428
94429 --
94430 -- bulk performance
94431 --
94432 l_balance_type_code VARCHAR2(1);
94433 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
94434 l_log_module VARCHAR2(240);
94435
94436 --
94437 -- Upgrade strategy
94438 --
94439 l_actual_upg_option VARCHAR2(1);
94440 l_enc_upg_option VARCHAR2(1);
94441
94442 --
94443 BEGIN
94444 --
94445 IF g_log_enabled THEN
94446 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_296';
94447 END IF;
94448 --
94449 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
94450
94451 trace
94452 (p_msg => 'BEGIN of AcctLineType_296'
94453 ,p_level => C_LEVEL_PROCEDURE
94454 ,p_module => l_log_module);
94455
94456 END IF;
94457 --
94458 l_component_type := 'AMB_JLT';
94459 l_component_code := 'FA_RECLASS_DEST_REVAL_RESERVE';
94460 l_component_type_code := 'S';
94461 l_component_appl_id := 140;
94462 l_amb_context_code := 'DEFAULT';
94463 l_entity_code := 'TRANSACTIONS';
94464 l_event_class_code := 'CATEGORY_RECLASS';
94465 l_event_type_code := 'CATEGORY_RECLASS_ALL';
94469 l_balance_type_code := 'A';
94466 l_line_definition_owner_code := 'S';
94467 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
94468 --
94470 l_segment := NULL;
94471 l_ccid := NULL;
94472 l_adr_transaction_coa_id := NULL;
94473 l_adr_accounting_coa_id := NULL;
94474 l_adr_flexfield_segment_code := NULL;
94475 l_adr_flex_value_set_id := NULL;
94476 l_adr_value_type_code := NULL;
94477 l_adr_value_combination_id := NULL;
94478 l_adr_value_segment_code := NULL;
94479
94480 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
94481 l_bflow_class_code := ''; -- 4219869 Business Flow
94482 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
94483 l_budgetary_control_flag := 'N';
94484
94485 l_bflow_applied_to_amt_idx := NULL; -- 5132302
94486 l_bflow_applied_to_amt := NULL; -- 5132302
94487 l_entered_amt_idx := NULL; -- 4262811
94488 l_accted_amt_idx := NULL; -- 4262811
94489 l_acc_rev_flag := NULL; -- 4262811
94490 l_accrual_line_num := NULL; -- 4262811
94491 l_tmp_amt := NULL; -- 4262811
94492 --
94493
94494 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
94495 l_balance_type_code <> 'B' THEN
94496 IF NVL(p_source_48,'
94497 ') = 'REVAL RESERVE' AND
94498 NVL(p_source_55,'
94499 ') = 'DEST'
94500 THEN
94501
94502 --
94503 XLA_AE_LINES_PKG.SetNewLine;
94504
94505 p_balance_type_code := l_balance_type_code;
94506 -- set the flag so later we will know whether the gain loss line needs to be created
94507
94508 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
94509 p_actual_flag :='A';
94510 END IF;
94511
94512 --
94513 -- bulk performance
94514 --
94515 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
94516 p_header_num => 0); -- 4262811
94517 --
94518 -- set accounting line options
94519 --
94520 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
94521 p_natural_side_code => 'C'
94522 , p_gain_or_loss_flag => 'N'
94523 , p_gl_transfer_mode_code => 'S'
94524 , p_acct_entry_type_code => 'A'
94525 , p_switch_side_flag => 'Y'
94526 , p_merge_duplicate_code => 'N'
94527 );
94528 --
94529 l_acc_rev_natural_side_code := 'D'; -- 4262811
94530 --
94531 --
94532 -- set accounting line type info
94533 --
94534 xla_ae_lines_pkg.SetAcctLineType
94535 (p_component_type => l_component_type
94536 ,p_event_type_code => l_event_type_code
94537 ,p_line_definition_owner_code => l_line_definition_owner_code
94538 ,p_line_definition_code => l_line_definition_code
94539 ,p_accounting_line_code => l_component_code
94540 ,p_accounting_line_type_code => l_component_type_code
94541 ,p_accounting_line_appl_id => l_component_appl_id
94542 ,p_amb_context_code => l_amb_context_code
94543 ,p_entity_code => l_entity_code
94544 ,p_event_class_code => l_event_class_code);
94545 --
94546 -- set accounting class
94547 --
94548 xla_ae_lines_pkg.SetAcctClass(
94549 p_accounting_class_code => 'ASSET'
94550 , p_ae_header_id => l_ae_header_id
94551 );
94552
94553 --
94554 -- set rounding class
94555 --
94556 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
94557 'ASSET';
94558
94559 --
94560 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
94561 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
94562 --
94563 -- bulk performance
94564 --
94565 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
94566
94567 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
94568 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
94569
94570 -- 4955764
94571 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
94572 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
94573
94574 -- 4458381 Public Sector Enh
94575
94576 --
94577 -- set accounting attributes for the line type
94578 --
94579 l_entered_amt_idx := 4;
94580 l_accted_amt_idx := 6;
94581 l_bflow_applied_to_amt_idx := NULL; -- 5132302
94582 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
94583 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
94584 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
94585 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
94586 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
94587 l_rec_acct_attrs.array_char_value(3) := p_source_51;
94588 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
94589 l_rec_acct_attrs.array_num_value(4) := p_source_52;
94590 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
94594
94591 l_rec_acct_attrs.array_char_value(5) := p_source_53;
94592 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
94593 l_rec_acct_attrs.array_num_value(6) := p_source_52;
94595 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
94596 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
94597
94598 ---------------------------------------------------------------------------------------------------------------
94599 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
94600 ---------------------------------------------------------------------------------------------------------------
94601 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
94602
94603 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
94604 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
94605
94606 IF xla_accounting_cache_pkg.GetValueChar
94607 (p_source_code => 'LEDGER_CATEGORY_CODE'
94608 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
94609 AND l_bflow_method_code = 'PRIOR_ENTRY'
94610 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
94611 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
94612 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
94613 )
94614 THEN
94615 xla_ae_lines_pkg.BflowUpgEntry
94616 (p_business_method_code => l_bflow_method_code
94617 ,p_business_class_code => l_bflow_class_code
94618 ,p_balance_type => l_balance_type_code);
94619 ELSE
94620 NULL;
94621 -- No business flow processing for business flow method of NONE.
94622 END IF;
94623
94624 --
94625 -- call analytical criteria
94626 --
94627
94628 --
94629 -- call description
94630 --
94631
94632 xla_ae_lines_pkg.SetLineDescription(
94633 p_ae_header_id => l_ae_header_id
94634 ,p_description => Description_68 (
94635 p_application_id => p_application_id
94636 , p_ae_header_id => l_ae_header_id
94637 , p_source_1 => p_source_1
94638 )
94639 );
94640
94641
94642 --
94643 -- call ADRs
94644 -- Bug 4922099
94645 --
94646 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
94647 (NVL(l_actual_upg_option, 'N') = 'O') OR
94648 (NVL(l_enc_upg_option, 'N') = 'O')
94649 )
94650 THEN
94651 NULL;
94652 --
94653 --
94654
94655 l_ccid := AcctDerRule_174(
94656 p_application_id => p_application_id
94657 , p_ae_header_id => l_ae_header_id
94658 , p_source_5 => p_source_5
94659 , p_source_32 => p_source_32
94660 , x_transaction_coa_id => l_adr_transaction_coa_id
94661 , x_accounting_coa_id => l_adr_accounting_coa_id
94662 , x_value_type_code => l_adr_value_type_code
94663 , p_side => 'NA'
94664 );
94665
94666 xla_ae_lines_pkg.set_ccid(
94667 p_code_combination_id => l_ccid
94668 , p_value_type_code => l_adr_value_type_code
94669 , p_transaction_coa_id => l_adr_transaction_coa_id
94670 , p_accounting_coa_id => l_adr_accounting_coa_id
94671 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
94672 , p_adr_type_code => 'S'
94673 , p_component_type => l_component_type
94674 , p_component_code => l_component_code
94675 , p_component_type_code => l_component_type_code
94676 , p_component_appl_id => l_component_appl_id
94677 , p_amb_context_code => l_amb_context_code
94678 , p_side => 'NA'
94679 );
94680
94681
94682 l_segment := AcctDerRule_151(
94683 p_application_id => p_application_id
94684 , p_ae_header_id => l_ae_header_id
94685 , p_source_5 => p_source_5
94686 , p_source_13 => p_source_13
94687 , x_transaction_coa_id => l_adr_transaction_coa_id
94688 , x_accounting_coa_id => l_adr_accounting_coa_id
94689 , x_flexfield_segment_code => l_adr_flexfield_segment_code
94690 , x_flex_value_set_id => l_adr_flex_value_set_id
94691 , x_value_type_code => l_adr_value_type_code
94692 , x_value_combination_id => l_adr_value_combination_id
94693 , x_value_segment_code => l_adr_value_segment_code
94694 , p_side => 'NA'
94695 , p_override_seg_flag => 'Y'
94696 );
94697
94698 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
94699
94700 xla_ae_lines_pkg.set_segment(
94701 p_to_segment_code => 'GL_ACCOUNT'
94702 , p_segment_value => l_segment
94703 , p_from_segment_code => l_adr_value_segment_code
94704 , p_from_combination_id => l_adr_value_combination_id
94705 , p_value_type_code => l_adr_value_type_code
94706 , p_transaction_coa_id => l_adr_transaction_coa_id
94707 , p_accounting_coa_id => l_adr_accounting_coa_id
94708 , p_flexfield_segment_code => l_adr_flexfield_segment_code
94712 , p_component_type => l_component_type
94709 , p_flex_value_set_id => l_adr_flex_value_set_id
94710 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
94711 , p_adr_type_code => 'S'
94713 , p_component_code => l_component_code
94714 , p_component_type_code => l_component_type_code
94715 , p_component_appl_id => l_component_appl_id
94716 , p_amb_context_code => l_amb_context_code
94717 , p_entity_code => 'TRANSACTIONS'
94718 , p_event_class_code => 'CATEGORY_RECLASS'
94719 , p_side => 'NA'
94720 );
94721
94722 END IF;
94723
94724 l_segment := AcctDerRule_169(
94725 p_application_id => p_application_id
94726 , p_ae_header_id => l_ae_header_id
94727 , p_source_5 => p_source_5
94728 , p_source_31 => p_source_31
94729 , x_transaction_coa_id => l_adr_transaction_coa_id
94730 , x_accounting_coa_id => l_adr_accounting_coa_id
94731 , x_flexfield_segment_code => l_adr_flexfield_segment_code
94732 , x_flex_value_set_id => l_adr_flex_value_set_id
94733 , x_value_type_code => l_adr_value_type_code
94734 , x_value_combination_id => l_adr_value_combination_id
94735 , x_value_segment_code => l_adr_value_segment_code
94736 , p_side => 'NA'
94737 , p_override_seg_flag => 'Y'
94738 );
94739
94740 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
94741
94742 xla_ae_lines_pkg.set_segment(
94743 p_to_segment_code => 'GL_BALANCING'
94744 , p_segment_value => l_segment
94745 , p_from_segment_code => l_adr_value_segment_code
94746 , p_from_combination_id => l_adr_value_combination_id
94747 , p_value_type_code => l_adr_value_type_code
94748 , p_transaction_coa_id => l_adr_transaction_coa_id
94749 , p_accounting_coa_id => l_adr_accounting_coa_id
94750 , p_flexfield_segment_code => l_adr_flexfield_segment_code
94751 , p_flex_value_set_id => l_adr_flex_value_set_id
94752 , p_adr_code => 'FA_EXPENSE_ACCT'
94753 , p_adr_type_code => 'S'
94754 , p_component_type => l_component_type
94755 , p_component_code => l_component_code
94756 , p_component_type_code => l_component_type_code
94757 , p_component_appl_id => l_component_appl_id
94758 , p_amb_context_code => l_amb_context_code
94759 , p_entity_code => 'TRANSACTIONS'
94760 , p_event_class_code => 'CATEGORY_RECLASS'
94761 , p_side => 'NA'
94762 );
94763
94764 END IF;
94765
94766 --
94767 --
94768 END IF;
94769 --
94770 -- Bug 4922099
94771 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
94772 (NVL(l_enc_upg_option, 'N') = 'O')
94773 ) AND
94774 (l_bflow_method_code = 'PRIOR_ENTRY')
94775 )
94776 THEN
94777 IF
94778 --
94779 1 = 2
94780 --
94781 THEN
94782 xla_accounting_err_pkg.build_message
94783 (p_appli_s_name => 'XLA'
94784 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
94785 ,p_token_1 => 'LINE_NUMBER'
94786 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
94787 ,p_token_2 => 'LINE_TYPE_NAME'
94788 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
94789 l_component_type
94790 ,l_component_code
94791 ,l_component_type_code
94792 ,l_component_appl_id
94793 ,l_amb_context_code
94794 ,l_entity_code
94795 ,l_event_class_code
94796 )
94797 ,p_token_3 => 'OWNER'
94798 ,p_value_3 => xla_lookups_pkg.get_meaning(
94799 p_lookup_type => 'XLA_OWNER_TYPE'
94800 ,p_lookup_code => l_component_type_code
94801 )
94802 ,p_token_4 => 'PRODUCT_NAME'
94803 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
94804 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
94805 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
94809
94806 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
94807 ,p_ae_header_id => NULL
94808 );
94810 IF (C_LEVEL_ERROR>= g_log_level) THEN
94811 trace
94812 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
94813 ,p_level => C_LEVEL_ERROR
94814 ,p_module => l_log_module);
94815 END IF;
94816 END IF;
94817 END IF;
94818 --
94819 --
94820 ------------------------------------------------------------------------------------------------
94821 -- 4219869 Business Flow
94822 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
94823 -- Prior Entry. Currently, the following code is always generated.
94824 ------------------------------------------------------------------------------------------------
94825 XLA_AE_LINES_PKG.ValidateCurrentLine;
94826
94827 ------------------------------------------------------------------------------------
94828 -- 4219869 Business Flow
94829 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
94830 ------------------------------------------------------------------------------------
94831 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
94832
94833 ----------------------------------------------------------------------------------
94834 -- 4219869 Business Flow
94835 -- Update journal entry status -- Need to generate this within IF <condition>
94836 ----------------------------------------------------------------------------------
94837 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
94838 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
94839 ,p_balance_type_code => l_balance_type_code
94840 );
94841
94842 -------------------------------------------------------------------------------------------
94843 -- 4262811 - Generate the Accrual Reversal lines
94844 -------------------------------------------------------------------------------------------
94845 BEGIN
94846 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
94847 (g_array_event(p_event_id).array_value_num('header_index'));
94848 IF l_acc_rev_flag IS NULL THEN
94849 l_acc_rev_flag := 'N';
94850 END IF;
94851 EXCEPTION
94852 WHEN OTHERS THEN
94853 l_acc_rev_flag := 'N';
94854 END;
94855 --
94856 IF (l_acc_rev_flag = 'Y') THEN
94857
94858 -- 4645092 ------------------------------------------------------------------------------
94859 -- To allow MPA report to determine if it should generate report process
94860 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
94861 ------------------------------------------------------------------------------------------
94862
94863 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
94864 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
94865 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
94866 -- call ADRs
94867 -- Bug 4922099
94868 --
94869 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
94870 (NVL(l_actual_upg_option, 'N') = 'O') OR
94871 (NVL(l_enc_upg_option, 'N') = 'O')
94872 )
94873 THEN
94874 NULL;
94875 --
94876 --
94877
94878 l_ccid := AcctDerRule_174(
94879 p_application_id => p_application_id
94880 , p_ae_header_id => l_ae_header_id
94881 , p_source_5 => p_source_5
94882 , p_source_32 => p_source_32
94883 , x_transaction_coa_id => l_adr_transaction_coa_id
94884 , x_accounting_coa_id => l_adr_accounting_coa_id
94885 , x_value_type_code => l_adr_value_type_code
94886 , p_side => 'NA'
94887 );
94888
94889 xla_ae_lines_pkg.set_ccid(
94890 p_code_combination_id => l_ccid
94891 , p_value_type_code => l_adr_value_type_code
94892 , p_transaction_coa_id => l_adr_transaction_coa_id
94893 , p_accounting_coa_id => l_adr_accounting_coa_id
94894 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
94895 , p_adr_type_code => 'S'
94896 , p_component_type => l_component_type
94897 , p_component_code => l_component_code
94898 , p_component_type_code => l_component_type_code
94899 , p_component_appl_id => l_component_appl_id
94900 , p_amb_context_code => l_amb_context_code
94901 , p_side => 'NA'
94902 );
94903
94904
94905 l_segment := AcctDerRule_151(
94906 p_application_id => p_application_id
94907 , p_ae_header_id => l_ae_header_id
94908 , p_source_5 => p_source_5
94909 , p_source_13 => p_source_13
94910 , x_transaction_coa_id => l_adr_transaction_coa_id
94911 , x_accounting_coa_id => l_adr_accounting_coa_id
94912 , x_flexfield_segment_code => l_adr_flexfield_segment_code
94913 , x_flex_value_set_id => l_adr_flex_value_set_id
94914 , x_value_type_code => l_adr_value_type_code
94918 , p_override_seg_flag => 'Y'
94915 , x_value_combination_id => l_adr_value_combination_id
94916 , x_value_segment_code => l_adr_value_segment_code
94917 , p_side => 'NA'
94919 );
94920
94921 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
94922
94923 xla_ae_lines_pkg.set_segment(
94924 p_to_segment_code => 'GL_ACCOUNT'
94925 , p_segment_value => l_segment
94926 , p_from_segment_code => l_adr_value_segment_code
94927 , p_from_combination_id => l_adr_value_combination_id
94928 , p_value_type_code => l_adr_value_type_code
94929 , p_transaction_coa_id => l_adr_transaction_coa_id
94930 , p_accounting_coa_id => l_adr_accounting_coa_id
94931 , p_flexfield_segment_code => l_adr_flexfield_segment_code
94932 , p_flex_value_set_id => l_adr_flex_value_set_id
94933 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
94934 , p_adr_type_code => 'S'
94935 , p_component_type => l_component_type
94936 , p_component_code => l_component_code
94937 , p_component_type_code => l_component_type_code
94938 , p_component_appl_id => l_component_appl_id
94939 , p_amb_context_code => l_amb_context_code
94940 , p_entity_code => 'TRANSACTIONS'
94941 , p_event_class_code => 'CATEGORY_RECLASS'
94942 , p_side => 'NA'
94943 );
94944
94945 END IF;
94946
94947 l_segment := AcctDerRule_169(
94948 p_application_id => p_application_id
94949 , p_ae_header_id => l_ae_header_id
94950 , p_source_5 => p_source_5
94951 , p_source_31 => p_source_31
94952 , x_transaction_coa_id => l_adr_transaction_coa_id
94953 , x_accounting_coa_id => l_adr_accounting_coa_id
94954 , x_flexfield_segment_code => l_adr_flexfield_segment_code
94955 , x_flex_value_set_id => l_adr_flex_value_set_id
94956 , x_value_type_code => l_adr_value_type_code
94957 , x_value_combination_id => l_adr_value_combination_id
94958 , x_value_segment_code => l_adr_value_segment_code
94959 , p_side => 'NA'
94960 , p_override_seg_flag => 'Y'
94961 );
94962
94963 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
94964
94965 xla_ae_lines_pkg.set_segment(
94966 p_to_segment_code => 'GL_BALANCING'
94967 , p_segment_value => l_segment
94968 , p_from_segment_code => l_adr_value_segment_code
94969 , p_from_combination_id => l_adr_value_combination_id
94970 , p_value_type_code => l_adr_value_type_code
94971 , p_transaction_coa_id => l_adr_transaction_coa_id
94972 , p_accounting_coa_id => l_adr_accounting_coa_id
94973 , p_flexfield_segment_code => l_adr_flexfield_segment_code
94974 , p_flex_value_set_id => l_adr_flex_value_set_id
94975 , p_adr_code => 'FA_EXPENSE_ACCT'
94976 , p_adr_type_code => 'S'
94977 , p_component_type => l_component_type
94978 , p_component_code => l_component_code
94979 , p_component_type_code => l_component_type_code
94980 , p_component_appl_id => l_component_appl_id
94981 , p_amb_context_code => l_amb_context_code
94982 , p_entity_code => 'TRANSACTIONS'
94983 , p_event_class_code => 'CATEGORY_RECLASS'
94984 , p_side => 'NA'
94985 );
94986
94987 END IF;
94988
94989 --
94990 --
94991 END IF;
94992
94993 --
94994 -- Update the line information that should be overwritten
94995 --
94996 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
94997 p_header_num => 1);
94998 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
94999
95000 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
95001
95002 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
95003 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
95004 END IF;
95005
95006 --
95007 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
95008 --
95009 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
95010 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
95011 ELSE
95012 ---------------------------------------------------------------------------------------------------
95013 -- 4262811a Switch Sign
95014 ---------------------------------------------------------------------------------------------------
95015 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
95016 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
95017 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
95018 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
95022 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
95019 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
95020 -- 5132302
95021 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
95023
95024 END IF;
95025
95026 -- 4955764
95027 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
95028 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
95029
95030
95031 XLA_AE_LINES_PKG.ValidateCurrentLine;
95032 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
95033
95034 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
95035 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
95036 ,p_balance_type_code => l_balance_type_code);
95037
95038 END IF;
95039
95040 -----------------------------------------------------------------------------------------
95041 -- 4262811 Multiperiod Accounting
95042 -----------------------------------------------------------------------------------------
95043 -- No MPA option is assigned.
95044
95045
95046 END IF;
95047 END IF;
95048 --
95049
95050 --
95051 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
95052 trace
95053 (p_msg => 'END of AcctLineType_296'
95054 ,p_level => C_LEVEL_PROCEDURE
95055 ,p_module => l_log_module);
95056 END IF;
95057 --
95058 EXCEPTION
95059 WHEN xla_exceptions_pkg.application_exception THEN
95060 RAISE;
95061 WHEN OTHERS THEN
95062 xla_exceptions_pkg.raise_message
95063 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_296');
95064 END AcctLineType_296;
95065 --
95066
95067 ---------------------------------------
95068 --
95069 -- PRIVATE FUNCTION
95070 -- AcctLineType_297
95071 --
95072 ---------------------------------------
95073 PROCEDURE AcctLineType_297 (
95074 p_application_id IN NUMBER
95075 ,p_event_id IN NUMBER
95076 ,p_calculate_acctd_flag IN VARCHAR2
95077 ,p_calculate_g_l_flag IN VARCHAR2
95078 ,p_actual_flag IN OUT VARCHAR2
95079 ,p_balance_type_code OUT VARCHAR2
95080 ,p_gain_or_loss_ref OUT VARCHAR2
95081
95082 --Period Close Date
95083 , p_source_1 IN DATE
95084 --Bonus Depreciation Expense Account
95085 , p_source_4 IN VARCHAR2
95086 --Generated Code Combination Identifier
95087 , p_source_5 IN NUMBER
95088 --Expense Account Code Combination Identifier
95089 , p_source_31 IN NUMBER
95090 --Adjustment Type
95091 , p_source_48 IN VARCHAR2
95092 --Transaction Header Identifier
95093 , p_source_49 IN NUMBER
95094 --Adjustment Line Identifier
95095 , p_source_50 IN NUMBER
95096 --Distribution Type Code
95097 , p_source_51 IN VARCHAR2
95098 --Entered Amount
95099 , p_source_52 IN NUMBER
95100 --Currency Code
95101 , p_source_53 IN VARCHAR2
95102 --Source Destination Code
95103 , p_source_55 IN VARCHAR2
95104 )
95105 IS
95106
95107 l_component_type VARCHAR2(80);
95108 l_component_code VARCHAR2(30);
95109 l_component_type_code VARCHAR2(1);
95110 l_component_appl_id INTEGER;
95111 l_amb_context_code VARCHAR2(30);
95112 l_entity_code VARCHAR2(30);
95113 l_event_class_code VARCHAR2(30);
95114 l_ae_header_id NUMBER;
95115 l_event_type_code VARCHAR2(30);
95116 l_line_definition_code VARCHAR2(30);
95117 l_line_definition_owner_code VARCHAR2(1);
95118 --
95119 -- adr variables
95120 l_segment VARCHAR2(30);
95121 l_ccid NUMBER;
95122 l_adr_transaction_coa_id NUMBER;
95123 l_adr_accounting_coa_id NUMBER;
95124 l_adr_flexfield_segment_code VARCHAR2(30);
95125 l_adr_flex_value_set_id NUMBER;
95126 l_adr_value_type_code VARCHAR2(30);
95127 l_adr_value_combination_id NUMBER;
95128 l_adr_value_segment_code VARCHAR2(30);
95129
95130 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
95131 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
95132 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
95133 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
95134
95135 -- 4262811 Variables ------------------------------------------------------------------------------------------
95136 l_entered_amt_idx NUMBER;
95137 l_accted_amt_idx NUMBER;
95138 l_acc_rev_flag VARCHAR2(1);
95139 l_accrual_line_num NUMBER;
95140 l_tmp_amt NUMBER;
95141 l_acc_rev_natural_side_code VARCHAR2(1);
95142
95143 l_num_entries NUMBER;
95144 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
95145 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
95146 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
95147 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
95148 l_recog_line_1 NUMBER;
95149 l_recog_line_2 NUMBER;
95150
95151 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
95155 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
95152 l_bflow_applied_to_amt NUMBER; -- 5132302
95153 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
95154
95156
95157 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
95158 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
95159
95160 ---------------------------------------------------------------------------------------------------------------
95161
95162
95163 --
95164 -- bulk performance
95165 --
95166 l_balance_type_code VARCHAR2(1);
95167 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
95168 l_log_module VARCHAR2(240);
95169
95170 --
95171 -- Upgrade strategy
95172 --
95173 l_actual_upg_option VARCHAR2(1);
95174 l_enc_upg_option VARCHAR2(1);
95175
95176 --
95177 BEGIN
95178 --
95179 IF g_log_enabled THEN
95180 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_297';
95181 END IF;
95182 --
95183 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
95184
95185 trace
95186 (p_msg => 'BEGIN of AcctLineType_297'
95187 ,p_level => C_LEVEL_PROCEDURE
95188 ,p_module => l_log_module);
95189
95190 END IF;
95191 --
95192 l_component_type := 'AMB_JLT';
95193 l_component_code := 'FA_RECLASS_SOURCE_BONUS_EXP';
95194 l_component_type_code := 'S';
95195 l_component_appl_id := 140;
95196 l_amb_context_code := 'DEFAULT';
95197 l_entity_code := 'TRANSACTIONS';
95198 l_event_class_code := 'CATEGORY_RECLASS';
95199 l_event_type_code := 'CATEGORY_RECLASS_ALL';
95200 l_line_definition_owner_code := 'S';
95201 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
95202 --
95203 l_balance_type_code := 'A';
95204 l_segment := NULL;
95205 l_ccid := NULL;
95206 l_adr_transaction_coa_id := NULL;
95207 l_adr_accounting_coa_id := NULL;
95208 l_adr_flexfield_segment_code := NULL;
95209 l_adr_flex_value_set_id := NULL;
95210 l_adr_value_type_code := NULL;
95211 l_adr_value_combination_id := NULL;
95212 l_adr_value_segment_code := NULL;
95213
95214 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
95215 l_bflow_class_code := ''; -- 4219869 Business Flow
95216 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
95217 l_budgetary_control_flag := 'N';
95218
95219 l_bflow_applied_to_amt_idx := NULL; -- 5132302
95220 l_bflow_applied_to_amt := NULL; -- 5132302
95221 l_entered_amt_idx := NULL; -- 4262811
95222 l_accted_amt_idx := NULL; -- 4262811
95223 l_acc_rev_flag := NULL; -- 4262811
95224 l_accrual_line_num := NULL; -- 4262811
95225 l_tmp_amt := NULL; -- 4262811
95226 --
95227
95228 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
95229 l_balance_type_code <> 'B' THEN
95230 IF NVL(p_source_48,'
95231 ') = 'BONUS EXPENSE' AND
95232 NVL(p_source_55,'
95233 ') = 'SOURCE'
95234 THEN
95235
95236 --
95237 XLA_AE_LINES_PKG.SetNewLine;
95238
95239 p_balance_type_code := l_balance_type_code;
95240 -- set the flag so later we will know whether the gain loss line needs to be created
95241
95242 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
95243 p_actual_flag :='A';
95244 END IF;
95245
95246 --
95247 -- bulk performance
95248 --
95249 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
95250 p_header_num => 0); -- 4262811
95251 --
95252 -- set accounting line options
95253 --
95254 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
95255 p_natural_side_code => 'C'
95256 , p_gain_or_loss_flag => 'N'
95257 , p_gl_transfer_mode_code => 'S'
95258 , p_acct_entry_type_code => 'A'
95259 , p_switch_side_flag => 'Y'
95260 , p_merge_duplicate_code => 'N'
95261 );
95262 --
95263 l_acc_rev_natural_side_code := 'D'; -- 4262811
95264 --
95265 --
95266 -- set accounting line type info
95267 --
95268 xla_ae_lines_pkg.SetAcctLineType
95269 (p_component_type => l_component_type
95270 ,p_event_type_code => l_event_type_code
95271 ,p_line_definition_owner_code => l_line_definition_owner_code
95272 ,p_line_definition_code => l_line_definition_code
95273 ,p_accounting_line_code => l_component_code
95274 ,p_accounting_line_type_code => l_component_type_code
95275 ,p_accounting_line_appl_id => l_component_appl_id
95276 ,p_amb_context_code => l_amb_context_code
95277 ,p_entity_code => l_entity_code
95278 ,p_event_class_code => l_event_class_code);
95279 --
95280 -- set accounting class
95281 --
95282 xla_ae_lines_pkg.SetAcctClass(
95283 p_accounting_class_code => 'EXPENSE'
95284 , p_ae_header_id => l_ae_header_id
95288 -- set rounding class
95285 );
95286
95287 --
95289 --
95290 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
95291 'EXPENSE';
95292
95293 --
95294 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
95295 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
95296 --
95297 -- bulk performance
95298 --
95299 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
95300
95301 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
95302 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
95303
95304 -- 4955764
95305 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
95306 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
95307
95308 -- 4458381 Public Sector Enh
95309
95310 --
95311 -- set accounting attributes for the line type
95312 --
95313 l_entered_amt_idx := 4;
95314 l_accted_amt_idx := 6;
95315 l_bflow_applied_to_amt_idx := NULL; -- 5132302
95316 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
95317 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
95318 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
95319 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
95320 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
95321 l_rec_acct_attrs.array_char_value(3) := p_source_51;
95322 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
95323 l_rec_acct_attrs.array_num_value(4) := p_source_52;
95324 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
95325 l_rec_acct_attrs.array_char_value(5) := p_source_53;
95326 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
95327 l_rec_acct_attrs.array_num_value(6) := p_source_52;
95328
95329 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
95330 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
95331
95332 ---------------------------------------------------------------------------------------------------------------
95333 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
95334 ---------------------------------------------------------------------------------------------------------------
95335 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
95336
95337 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
95338 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
95339
95340 IF xla_accounting_cache_pkg.GetValueChar
95341 (p_source_code => 'LEDGER_CATEGORY_CODE'
95342 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
95343 AND l_bflow_method_code = 'PRIOR_ENTRY'
95344 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
95345 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
95346 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
95347 )
95348 THEN
95349 xla_ae_lines_pkg.BflowUpgEntry
95350 (p_business_method_code => l_bflow_method_code
95351 ,p_business_class_code => l_bflow_class_code
95352 ,p_balance_type => l_balance_type_code);
95353 ELSE
95354 NULL;
95355 -- No business flow processing for business flow method of NONE.
95356 END IF;
95357
95358 --
95359 -- call analytical criteria
95360 --
95361
95362 --
95363 -- call description
95364 --
95365
95366 xla_ae_lines_pkg.SetLineDescription(
95367 p_ae_header_id => l_ae_header_id
95368 ,p_description => Description_63 (
95369 p_application_id => p_application_id
95370 , p_ae_header_id => l_ae_header_id
95371 , p_source_1 => p_source_1
95372 )
95373 );
95374
95375
95376 --
95377 -- call ADRs
95378 -- Bug 4922099
95379 --
95380 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
95381 (NVL(l_actual_upg_option, 'N') = 'O') OR
95382 (NVL(l_enc_upg_option, 'N') = 'O')
95383 )
95384 THEN
95385 NULL;
95386 --
95387 --
95388
95389 l_ccid := AcctDerRule_176(
95390 p_application_id => p_application_id
95391 , p_ae_header_id => l_ae_header_id
95392 , p_source_5 => p_source_5
95393 , p_source_31 => p_source_31
95394 , x_transaction_coa_id => l_adr_transaction_coa_id
95395 , x_accounting_coa_id => l_adr_accounting_coa_id
95396 , x_value_type_code => l_adr_value_type_code
95397 , p_side => 'NA'
95398 );
95399
95400 xla_ae_lines_pkg.set_ccid(
95401 p_code_combination_id => l_ccid
95402 , p_value_type_code => l_adr_value_type_code
95403 , p_transaction_coa_id => l_adr_transaction_coa_id
95404 , p_accounting_coa_id => l_adr_accounting_coa_id
95408 , p_component_code => l_component_code
95405 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
95406 , p_adr_type_code => 'S'
95407 , p_component_type => l_component_type
95409 , p_component_type_code => l_component_type_code
95410 , p_component_appl_id => l_component_appl_id
95411 , p_amb_context_code => l_amb_context_code
95412 , p_side => 'NA'
95413 );
95414
95415
95416 l_segment := AcctDerRule_144(
95417 p_application_id => p_application_id
95418 , p_ae_header_id => l_ae_header_id
95419 , p_source_4 => p_source_4
95420 , p_source_5 => p_source_5
95421 , x_transaction_coa_id => l_adr_transaction_coa_id
95422 , x_accounting_coa_id => l_adr_accounting_coa_id
95423 , x_flexfield_segment_code => l_adr_flexfield_segment_code
95424 , x_flex_value_set_id => l_adr_flex_value_set_id
95425 , x_value_type_code => l_adr_value_type_code
95426 , x_value_combination_id => l_adr_value_combination_id
95427 , x_value_segment_code => l_adr_value_segment_code
95428 , p_side => 'NA'
95429 , p_override_seg_flag => 'Y'
95430 );
95431
95432 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
95433
95434 xla_ae_lines_pkg.set_segment(
95435 p_to_segment_code => 'GL_ACCOUNT'
95436 , p_segment_value => l_segment
95437 , p_from_segment_code => l_adr_value_segment_code
95438 , p_from_combination_id => l_adr_value_combination_id
95439 , p_value_type_code => l_adr_value_type_code
95440 , p_transaction_coa_id => l_adr_transaction_coa_id
95441 , p_accounting_coa_id => l_adr_accounting_coa_id
95442 , p_flexfield_segment_code => l_adr_flexfield_segment_code
95443 , p_flex_value_set_id => l_adr_flex_value_set_id
95444 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
95445 , p_adr_type_code => 'S'
95446 , p_component_type => l_component_type
95447 , p_component_code => l_component_code
95448 , p_component_type_code => l_component_type_code
95449 , p_component_appl_id => l_component_appl_id
95450 , p_amb_context_code => l_amb_context_code
95451 , p_entity_code => 'TRANSACTIONS'
95452 , p_event_class_code => 'CATEGORY_RECLASS'
95453 , p_side => 'NA'
95454 );
95455
95456 END IF;
95457
95458 --
95459 --
95460 END IF;
95461 --
95462 -- Bug 4922099
95463 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
95464 (NVL(l_enc_upg_option, 'N') = 'O')
95465 ) AND
95466 (l_bflow_method_code = 'PRIOR_ENTRY')
95467 )
95468 THEN
95469 IF
95470 --
95471 1 = 2
95472 --
95473 THEN
95474 xla_accounting_err_pkg.build_message
95475 (p_appli_s_name => 'XLA'
95476 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
95477 ,p_token_1 => 'LINE_NUMBER'
95478 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
95479 ,p_token_2 => 'LINE_TYPE_NAME'
95480 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
95481 l_component_type
95482 ,l_component_code
95483 ,l_component_type_code
95484 ,l_component_appl_id
95485 ,l_amb_context_code
95486 ,l_entity_code
95487 ,l_event_class_code
95488 )
95489 ,p_token_3 => 'OWNER'
95490 ,p_value_3 => xla_lookups_pkg.get_meaning(
95491 p_lookup_type => 'XLA_OWNER_TYPE'
95492 ,p_lookup_code => l_component_type_code
95493 )
95494 ,p_token_4 => 'PRODUCT_NAME'
95495 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
95496 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
95497 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
95498 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
95499 ,p_ae_header_id => NULL
95500 );
95504 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
95501
95502 IF (C_LEVEL_ERROR>= g_log_level) THEN
95503 trace
95505 ,p_level => C_LEVEL_ERROR
95506 ,p_module => l_log_module);
95507 END IF;
95508 END IF;
95509 END IF;
95510 --
95511 --
95512 ------------------------------------------------------------------------------------------------
95513 -- 4219869 Business Flow
95514 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
95515 -- Prior Entry. Currently, the following code is always generated.
95516 ------------------------------------------------------------------------------------------------
95517 XLA_AE_LINES_PKG.ValidateCurrentLine;
95518
95519 ------------------------------------------------------------------------------------
95520 -- 4219869 Business Flow
95521 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
95522 ------------------------------------------------------------------------------------
95523 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
95524
95525 ----------------------------------------------------------------------------------
95526 -- 4219869 Business Flow
95527 -- Update journal entry status -- Need to generate this within IF <condition>
95528 ----------------------------------------------------------------------------------
95529 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
95530 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
95531 ,p_balance_type_code => l_balance_type_code
95532 );
95533
95534 -------------------------------------------------------------------------------------------
95535 -- 4262811 - Generate the Accrual Reversal lines
95536 -------------------------------------------------------------------------------------------
95537 BEGIN
95538 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
95539 (g_array_event(p_event_id).array_value_num('header_index'));
95540 IF l_acc_rev_flag IS NULL THEN
95541 l_acc_rev_flag := 'N';
95542 END IF;
95543 EXCEPTION
95544 WHEN OTHERS THEN
95545 l_acc_rev_flag := 'N';
95546 END;
95547 --
95548 IF (l_acc_rev_flag = 'Y') THEN
95549
95550 -- 4645092 ------------------------------------------------------------------------------
95551 -- To allow MPA report to determine if it should generate report process
95552 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
95553 ------------------------------------------------------------------------------------------
95554
95555 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
95556 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
95557 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
95558 -- call ADRs
95559 -- Bug 4922099
95560 --
95561 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
95562 (NVL(l_actual_upg_option, 'N') = 'O') OR
95563 (NVL(l_enc_upg_option, 'N') = 'O')
95564 )
95565 THEN
95566 NULL;
95567 --
95568 --
95569
95570 l_ccid := AcctDerRule_176(
95571 p_application_id => p_application_id
95572 , p_ae_header_id => l_ae_header_id
95573 , p_source_5 => p_source_5
95574 , p_source_31 => p_source_31
95575 , x_transaction_coa_id => l_adr_transaction_coa_id
95576 , x_accounting_coa_id => l_adr_accounting_coa_id
95577 , x_value_type_code => l_adr_value_type_code
95578 , p_side => 'NA'
95579 );
95580
95581 xla_ae_lines_pkg.set_ccid(
95582 p_code_combination_id => l_ccid
95583 , p_value_type_code => l_adr_value_type_code
95584 , p_transaction_coa_id => l_adr_transaction_coa_id
95585 , p_accounting_coa_id => l_adr_accounting_coa_id
95586 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
95587 , p_adr_type_code => 'S'
95588 , p_component_type => l_component_type
95589 , p_component_code => l_component_code
95590 , p_component_type_code => l_component_type_code
95591 , p_component_appl_id => l_component_appl_id
95592 , p_amb_context_code => l_amb_context_code
95593 , p_side => 'NA'
95594 );
95595
95596
95597 l_segment := AcctDerRule_144(
95598 p_application_id => p_application_id
95599 , p_ae_header_id => l_ae_header_id
95600 , p_source_4 => p_source_4
95601 , p_source_5 => p_source_5
95602 , x_transaction_coa_id => l_adr_transaction_coa_id
95603 , x_accounting_coa_id => l_adr_accounting_coa_id
95604 , x_flexfield_segment_code => l_adr_flexfield_segment_code
95605 , x_flex_value_set_id => l_adr_flex_value_set_id
95606 , x_value_type_code => l_adr_value_type_code
95607 , x_value_combination_id => l_adr_value_combination_id
95608 , x_value_segment_code => l_adr_value_segment_code
95609 , p_side => 'NA'
95610 , p_override_seg_flag => 'Y'
95611 );
95612
95613 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
95614
95615 xla_ae_lines_pkg.set_segment(
95619 , p_from_combination_id => l_adr_value_combination_id
95616 p_to_segment_code => 'GL_ACCOUNT'
95617 , p_segment_value => l_segment
95618 , p_from_segment_code => l_adr_value_segment_code
95620 , p_value_type_code => l_adr_value_type_code
95621 , p_transaction_coa_id => l_adr_transaction_coa_id
95622 , p_accounting_coa_id => l_adr_accounting_coa_id
95623 , p_flexfield_segment_code => l_adr_flexfield_segment_code
95624 , p_flex_value_set_id => l_adr_flex_value_set_id
95625 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
95626 , p_adr_type_code => 'S'
95627 , p_component_type => l_component_type
95628 , p_component_code => l_component_code
95629 , p_component_type_code => l_component_type_code
95630 , p_component_appl_id => l_component_appl_id
95631 , p_amb_context_code => l_amb_context_code
95632 , p_entity_code => 'TRANSACTIONS'
95633 , p_event_class_code => 'CATEGORY_RECLASS'
95634 , p_side => 'NA'
95635 );
95636
95637 END IF;
95638
95639 --
95640 --
95641 END IF;
95642
95643 --
95644 -- Update the line information that should be overwritten
95645 --
95646 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
95647 p_header_num => 1);
95648 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
95649
95650 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
95651
95652 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
95653 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
95654 END IF;
95655
95656 --
95657 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
95658 --
95659 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
95660 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
95661 ELSE
95662 ---------------------------------------------------------------------------------------------------
95663 -- 4262811a Switch Sign
95664 ---------------------------------------------------------------------------------------------------
95665 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
95666 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
95667 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
95668 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
95669 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
95670 -- 5132302
95671 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
95672 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
95673
95674 END IF;
95675
95676 -- 4955764
95677 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
95678 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
95679
95680
95681 XLA_AE_LINES_PKG.ValidateCurrentLine;
95682 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
95683
95684 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
95685 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
95686 ,p_balance_type_code => l_balance_type_code);
95687
95688 END IF;
95689
95690 -----------------------------------------------------------------------------------------
95691 -- 4262811 Multiperiod Accounting
95692 -----------------------------------------------------------------------------------------
95693 -- No MPA option is assigned.
95694
95695
95696 END IF;
95697 END IF;
95698 --
95699
95700 --
95701 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
95702 trace
95703 (p_msg => 'END of AcctLineType_297'
95704 ,p_level => C_LEVEL_PROCEDURE
95705 ,p_module => l_log_module);
95706 END IF;
95707 --
95708 EXCEPTION
95709 WHEN xla_exceptions_pkg.application_exception THEN
95710 RAISE;
95711 WHEN OTHERS THEN
95712 xla_exceptions_pkg.raise_message
95713 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_297');
95714 END AcctLineType_297;
95715 --
95716
95717 ---------------------------------------
95718 --
95719 -- PRIVATE FUNCTION
95720 -- AcctLineType_298
95721 --
95722 ---------------------------------------
95723 PROCEDURE AcctLineType_298 (
95724 p_application_id IN NUMBER
95725 ,p_event_id IN NUMBER
95726 ,p_calculate_acctd_flag IN VARCHAR2
95727 ,p_calculate_g_l_flag IN VARCHAR2
95728 ,p_actual_flag IN OUT VARCHAR2
95729 ,p_balance_type_code OUT VARCHAR2
95730 ,p_gain_or_loss_ref OUT VARCHAR2
95731
95732 --Period Close Date
95733 , p_source_1 IN DATE
95737 , p_source_6 IN VARCHAR2
95734 --Generated Code Combination Identifier
95735 , p_source_5 IN NUMBER
95736 --Bonus Reserve Account
95738 --Generated Offset Code Combination Identifier
95739 , p_source_19 IN NUMBER
95740 --Expense Account Code Combination Identifier
95741 , p_source_31 IN NUMBER
95742 --Default Code Combination Identifier
95743 , p_source_32 IN NUMBER
95744 --Adjustment Type
95745 , p_source_48 IN VARCHAR2
95746 --Transaction Header Identifier
95747 , p_source_49 IN NUMBER
95748 --Adjustment Line Identifier
95749 , p_source_50 IN NUMBER
95750 --Distribution Type Code
95751 , p_source_51 IN VARCHAR2
95752 --Entered Amount
95753 , p_source_52 IN NUMBER
95754 --Currency Code
95755 , p_source_53 IN VARCHAR2
95756 --Source Destination Code
95757 , p_source_55 IN VARCHAR2
95758 )
95759 IS
95760
95761 l_component_type VARCHAR2(80);
95762 l_component_code VARCHAR2(30);
95763 l_component_type_code VARCHAR2(1);
95764 l_component_appl_id INTEGER;
95765 l_amb_context_code VARCHAR2(30);
95766 l_entity_code VARCHAR2(30);
95767 l_event_class_code VARCHAR2(30);
95768 l_ae_header_id NUMBER;
95769 l_event_type_code VARCHAR2(30);
95770 l_line_definition_code VARCHAR2(30);
95771 l_line_definition_owner_code VARCHAR2(1);
95772 --
95773 -- adr variables
95774 l_segment VARCHAR2(30);
95775 l_ccid NUMBER;
95776 l_adr_transaction_coa_id NUMBER;
95777 l_adr_accounting_coa_id NUMBER;
95778 l_adr_flexfield_segment_code VARCHAR2(30);
95779 l_adr_flex_value_set_id NUMBER;
95780 l_adr_value_type_code VARCHAR2(30);
95781 l_adr_value_combination_id NUMBER;
95782 l_adr_value_segment_code VARCHAR2(30);
95783
95784 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
95785 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
95786 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
95787 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
95788
95789 -- 4262811 Variables ------------------------------------------------------------------------------------------
95790 l_entered_amt_idx NUMBER;
95791 l_accted_amt_idx NUMBER;
95792 l_acc_rev_flag VARCHAR2(1);
95793 l_accrual_line_num NUMBER;
95794 l_tmp_amt NUMBER;
95795 l_acc_rev_natural_side_code VARCHAR2(1);
95796
95797 l_num_entries NUMBER;
95798 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
95799 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
95800 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
95801 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
95802 l_recog_line_1 NUMBER;
95803 l_recog_line_2 NUMBER;
95804
95805 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
95806 l_bflow_applied_to_amt NUMBER; -- 5132302
95807 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
95808
95809 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
95810
95811 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
95812 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
95813
95814 ---------------------------------------------------------------------------------------------------------------
95815
95816
95817 --
95818 -- bulk performance
95819 --
95820 l_balance_type_code VARCHAR2(1);
95821 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
95822 l_log_module VARCHAR2(240);
95823
95824 --
95825 -- Upgrade strategy
95826 --
95827 l_actual_upg_option VARCHAR2(1);
95828 l_enc_upg_option VARCHAR2(1);
95829
95830 --
95831 BEGIN
95832 --
95833 IF g_log_enabled THEN
95834 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_298';
95835 END IF;
95836 --
95837 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
95838
95839 trace
95840 (p_msg => 'BEGIN of AcctLineType_298'
95841 ,p_level => C_LEVEL_PROCEDURE
95842 ,p_module => l_log_module);
95843
95844 END IF;
95845 --
95846 l_component_type := 'AMB_JLT';
95847 l_component_code := 'FA_RECLASS_SOURCE_BONUS_RESERV';
95848 l_component_type_code := 'S';
95849 l_component_appl_id := 140;
95850 l_amb_context_code := 'DEFAULT';
95851 l_entity_code := 'TRANSACTIONS';
95852 l_event_class_code := 'CATEGORY_RECLASS';
95853 l_event_type_code := 'CATEGORY_RECLASS_ALL';
95854 l_line_definition_owner_code := 'S';
95855 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
95856 --
95857 l_balance_type_code := 'A';
95858 l_segment := NULL;
95859 l_ccid := NULL;
95860 l_adr_transaction_coa_id := NULL;
95861 l_adr_accounting_coa_id := NULL;
95862 l_adr_flexfield_segment_code := NULL;
95863 l_adr_flex_value_set_id := NULL;
95867
95864 l_adr_value_type_code := NULL;
95865 l_adr_value_combination_id := NULL;
95866 l_adr_value_segment_code := NULL;
95868 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
95869 l_bflow_class_code := ''; -- 4219869 Business Flow
95870 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
95871 l_budgetary_control_flag := 'N';
95872
95873 l_bflow_applied_to_amt_idx := NULL; -- 5132302
95874 l_bflow_applied_to_amt := NULL; -- 5132302
95875 l_entered_amt_idx := NULL; -- 4262811
95876 l_accted_amt_idx := NULL; -- 4262811
95877 l_acc_rev_flag := NULL; -- 4262811
95878 l_accrual_line_num := NULL; -- 4262811
95879 l_tmp_amt := NULL; -- 4262811
95880 --
95881
95882 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
95883 l_balance_type_code <> 'B' THEN
95884 IF (NVL(p_source_48,'
95885 ') = 'BONUS EXPENSE' OR
95886 NVL(p_source_48,'
95887 ') = 'BONUS RESERVE') AND
95888 NVL(p_source_55,'
95889 ') = 'SOURCE'
95890 THEN
95891
95892 --
95893 XLA_AE_LINES_PKG.SetNewLine;
95894
95895 p_balance_type_code := l_balance_type_code;
95896 -- set the flag so later we will know whether the gain loss line needs to be created
95897
95898 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
95899 p_actual_flag :='A';
95900 END IF;
95901
95902 --
95903 -- bulk performance
95904 --
95905 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
95906 p_header_num => 0); -- 4262811
95907 --
95908 -- set accounting line options
95909 --
95910 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
95911 p_natural_side_code => 'D'
95912 , p_gain_or_loss_flag => 'N'
95913 , p_gl_transfer_mode_code => 'S'
95914 , p_acct_entry_type_code => 'A'
95915 , p_switch_side_flag => 'Y'
95916 , p_merge_duplicate_code => 'N'
95917 );
95918 --
95919 l_acc_rev_natural_side_code := 'C'; -- 4262811
95920 --
95921 --
95922 -- set accounting line type info
95923 --
95924 xla_ae_lines_pkg.SetAcctLineType
95925 (p_component_type => l_component_type
95926 ,p_event_type_code => l_event_type_code
95927 ,p_line_definition_owner_code => l_line_definition_owner_code
95928 ,p_line_definition_code => l_line_definition_code
95929 ,p_accounting_line_code => l_component_code
95930 ,p_accounting_line_type_code => l_component_type_code
95931 ,p_accounting_line_appl_id => l_component_appl_id
95932 ,p_amb_context_code => l_amb_context_code
95933 ,p_entity_code => l_entity_code
95934 ,p_event_class_code => l_event_class_code);
95935 --
95936 -- set accounting class
95937 --
95938 xla_ae_lines_pkg.SetAcctClass(
95939 p_accounting_class_code => 'ASSET'
95940 , p_ae_header_id => l_ae_header_id
95941 );
95942
95943 --
95944 -- set rounding class
95945 --
95946 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
95947 'ASSET';
95948
95949 --
95950 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
95951 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
95952 --
95953 -- bulk performance
95954 --
95955 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
95956
95957 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
95958 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
95959
95960 -- 4955764
95961 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
95962 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
95963
95964 -- 4458381 Public Sector Enh
95965
95966 --
95967 -- set accounting attributes for the line type
95968 --
95969 l_entered_amt_idx := 4;
95970 l_accted_amt_idx := 6;
95971 l_bflow_applied_to_amt_idx := NULL; -- 5132302
95972 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
95973 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
95974 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
95975 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
95976 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
95977 l_rec_acct_attrs.array_char_value(3) := p_source_51;
95978 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
95979 l_rec_acct_attrs.array_num_value(4) := p_source_52;
95980 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
95981 l_rec_acct_attrs.array_char_value(5) := p_source_53;
95982 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
95983 l_rec_acct_attrs.array_num_value(6) := p_source_52;
95984
95985 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
95989 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
95986 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
95987
95988 ---------------------------------------------------------------------------------------------------------------
95990 ---------------------------------------------------------------------------------------------------------------
95991 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
95992
95993 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
95994 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
95995
95996 IF xla_accounting_cache_pkg.GetValueChar
95997 (p_source_code => 'LEDGER_CATEGORY_CODE'
95998 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
95999 AND l_bflow_method_code = 'PRIOR_ENTRY'
96000 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
96001 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
96002 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
96003 )
96004 THEN
96005 xla_ae_lines_pkg.BflowUpgEntry
96006 (p_business_method_code => l_bflow_method_code
96007 ,p_business_class_code => l_bflow_class_code
96008 ,p_balance_type => l_balance_type_code);
96009 ELSE
96010 NULL;
96011 -- No business flow processing for business flow method of NONE.
96012 END IF;
96013
96014 --
96015 -- call analytical criteria
96016 --
96017
96018 --
96019 -- call description
96020 --
96021
96022 xla_ae_lines_pkg.SetLineDescription(
96023 p_ae_header_id => l_ae_header_id
96024 ,p_description => Description_64 (
96025 p_application_id => p_application_id
96026 , p_ae_header_id => l_ae_header_id
96027 , p_source_1 => p_source_1
96028 )
96029 );
96030
96031
96032 --
96033 -- call ADRs
96034 -- Bug 4922099
96035 --
96036 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
96037 (NVL(l_actual_upg_option, 'N') = 'O') OR
96038 (NVL(l_enc_upg_option, 'N') = 'O')
96039 )
96040 THEN
96041 NULL;
96042 --
96043 --
96044
96045 l_ccid := AcctDerRule_175(
96046 p_application_id => p_application_id
96047 , p_ae_header_id => l_ae_header_id
96048 , p_source_5 => p_source_5
96049 , p_source_19 => p_source_19
96050 , p_source_32 => p_source_32
96051 , x_transaction_coa_id => l_adr_transaction_coa_id
96052 , x_accounting_coa_id => l_adr_accounting_coa_id
96053 , x_value_type_code => l_adr_value_type_code
96054 , p_side => 'NA'
96055 );
96056
96057 xla_ae_lines_pkg.set_ccid(
96058 p_code_combination_id => l_ccid
96059 , p_value_type_code => l_adr_value_type_code
96060 , p_transaction_coa_id => l_adr_transaction_coa_id
96061 , p_accounting_coa_id => l_adr_accounting_coa_id
96062 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
96063 , p_adr_type_code => 'S'
96064 , p_component_type => l_component_type
96065 , p_component_code => l_component_code
96066 , p_component_type_code => l_component_type_code
96067 , p_component_appl_id => l_component_appl_id
96068 , p_amb_context_code => l_amb_context_code
96069 , p_side => 'NA'
96070 );
96071
96072
96073 l_segment := AcctDerRule_145(
96074 p_application_id => p_application_id
96075 , p_ae_header_id => l_ae_header_id
96076 , p_source_5 => p_source_5
96077 , p_source_6 => p_source_6
96078 , x_transaction_coa_id => l_adr_transaction_coa_id
96079 , x_accounting_coa_id => l_adr_accounting_coa_id
96080 , x_flexfield_segment_code => l_adr_flexfield_segment_code
96081 , x_flex_value_set_id => l_adr_flex_value_set_id
96082 , x_value_type_code => l_adr_value_type_code
96083 , x_value_combination_id => l_adr_value_combination_id
96084 , x_value_segment_code => l_adr_value_segment_code
96085 , p_side => 'NA'
96086 , p_override_seg_flag => 'Y'
96087 );
96088
96089 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
96090
96091 xla_ae_lines_pkg.set_segment(
96092 p_to_segment_code => 'GL_ACCOUNT'
96093 , p_segment_value => l_segment
96094 , p_from_segment_code => l_adr_value_segment_code
96095 , p_from_combination_id => l_adr_value_combination_id
96096 , p_value_type_code => l_adr_value_type_code
96097 , p_transaction_coa_id => l_adr_transaction_coa_id
96098 , p_accounting_coa_id => l_adr_accounting_coa_id
96099 , p_flexfield_segment_code => l_adr_flexfield_segment_code
96100 , p_flex_value_set_id => l_adr_flex_value_set_id
96101 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
96102 , p_adr_type_code => 'S'
96106 , p_component_appl_id => l_component_appl_id
96103 , p_component_type => l_component_type
96104 , p_component_code => l_component_code
96105 , p_component_type_code => l_component_type_code
96107 , p_amb_context_code => l_amb_context_code
96108 , p_entity_code => 'TRANSACTIONS'
96109 , p_event_class_code => 'CATEGORY_RECLASS'
96110 , p_side => 'NA'
96111 );
96112
96113 END IF;
96114
96115 l_segment := AcctDerRule_169(
96116 p_application_id => p_application_id
96117 , p_ae_header_id => l_ae_header_id
96118 , p_source_5 => p_source_5
96119 , p_source_31 => p_source_31
96120 , x_transaction_coa_id => l_adr_transaction_coa_id
96121 , x_accounting_coa_id => l_adr_accounting_coa_id
96122 , x_flexfield_segment_code => l_adr_flexfield_segment_code
96123 , x_flex_value_set_id => l_adr_flex_value_set_id
96124 , x_value_type_code => l_adr_value_type_code
96125 , x_value_combination_id => l_adr_value_combination_id
96126 , x_value_segment_code => l_adr_value_segment_code
96127 , p_side => 'NA'
96128 , p_override_seg_flag => 'Y'
96129 );
96130
96131 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
96132
96133 xla_ae_lines_pkg.set_segment(
96134 p_to_segment_code => 'GL_BALANCING'
96135 , p_segment_value => l_segment
96136 , p_from_segment_code => l_adr_value_segment_code
96137 , p_from_combination_id => l_adr_value_combination_id
96138 , p_value_type_code => l_adr_value_type_code
96139 , p_transaction_coa_id => l_adr_transaction_coa_id
96140 , p_accounting_coa_id => l_adr_accounting_coa_id
96141 , p_flexfield_segment_code => l_adr_flexfield_segment_code
96142 , p_flex_value_set_id => l_adr_flex_value_set_id
96143 , p_adr_code => 'FA_EXPENSE_ACCT'
96144 , p_adr_type_code => 'S'
96145 , p_component_type => l_component_type
96146 , p_component_code => l_component_code
96147 , p_component_type_code => l_component_type_code
96148 , p_component_appl_id => l_component_appl_id
96149 , p_amb_context_code => l_amb_context_code
96150 , p_entity_code => 'TRANSACTIONS'
96151 , p_event_class_code => 'CATEGORY_RECLASS'
96152 , p_side => 'NA'
96153 );
96154
96155 END IF;
96156
96157 --
96158 --
96159 END IF;
96160 --
96161 -- Bug 4922099
96162 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
96163 (NVL(l_enc_upg_option, 'N') = 'O')
96164 ) AND
96165 (l_bflow_method_code = 'PRIOR_ENTRY')
96166 )
96167 THEN
96168 IF
96169 --
96170 1 = 2
96171 --
96172 THEN
96173 xla_accounting_err_pkg.build_message
96174 (p_appli_s_name => 'XLA'
96175 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
96176 ,p_token_1 => 'LINE_NUMBER'
96177 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
96178 ,p_token_2 => 'LINE_TYPE_NAME'
96179 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
96180 l_component_type
96181 ,l_component_code
96182 ,l_component_type_code
96183 ,l_component_appl_id
96184 ,l_amb_context_code
96185 ,l_entity_code
96186 ,l_event_class_code
96187 )
96188 ,p_token_3 => 'OWNER'
96189 ,p_value_3 => xla_lookups_pkg.get_meaning(
96190 p_lookup_type => 'XLA_OWNER_TYPE'
96191 ,p_lookup_code => l_component_type_code
96192 )
96193 ,p_token_4 => 'PRODUCT_NAME'
96194 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
96195 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
96196 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
96197 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
96198 ,p_ae_header_id => NULL
96199 );
96200
96201 IF (C_LEVEL_ERROR>= g_log_level) THEN
96202 trace
96206 END IF;
96203 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
96204 ,p_level => C_LEVEL_ERROR
96205 ,p_module => l_log_module);
96207 END IF;
96208 END IF;
96209 --
96210 --
96211 ------------------------------------------------------------------------------------------------
96212 -- 4219869 Business Flow
96213 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
96214 -- Prior Entry. Currently, the following code is always generated.
96215 ------------------------------------------------------------------------------------------------
96216 XLA_AE_LINES_PKG.ValidateCurrentLine;
96217
96218 ------------------------------------------------------------------------------------
96219 -- 4219869 Business Flow
96220 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
96221 ------------------------------------------------------------------------------------
96222 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
96223
96224 ----------------------------------------------------------------------------------
96225 -- 4219869 Business Flow
96226 -- Update journal entry status -- Need to generate this within IF <condition>
96227 ----------------------------------------------------------------------------------
96228 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
96229 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
96230 ,p_balance_type_code => l_balance_type_code
96231 );
96232
96233 -------------------------------------------------------------------------------------------
96234 -- 4262811 - Generate the Accrual Reversal lines
96235 -------------------------------------------------------------------------------------------
96236 BEGIN
96237 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
96238 (g_array_event(p_event_id).array_value_num('header_index'));
96239 IF l_acc_rev_flag IS NULL THEN
96240 l_acc_rev_flag := 'N';
96241 END IF;
96242 EXCEPTION
96243 WHEN OTHERS THEN
96244 l_acc_rev_flag := 'N';
96245 END;
96246 --
96247 IF (l_acc_rev_flag = 'Y') THEN
96248
96249 -- 4645092 ------------------------------------------------------------------------------
96250 -- To allow MPA report to determine if it should generate report process
96251 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
96252 ------------------------------------------------------------------------------------------
96253
96254 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
96255 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
96256 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
96257 -- call ADRs
96258 -- Bug 4922099
96259 --
96260 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
96261 (NVL(l_actual_upg_option, 'N') = 'O') OR
96262 (NVL(l_enc_upg_option, 'N') = 'O')
96263 )
96264 THEN
96265 NULL;
96266 --
96267 --
96268
96269 l_ccid := AcctDerRule_175(
96270 p_application_id => p_application_id
96271 , p_ae_header_id => l_ae_header_id
96272 , p_source_5 => p_source_5
96273 , p_source_19 => p_source_19
96274 , p_source_32 => p_source_32
96275 , x_transaction_coa_id => l_adr_transaction_coa_id
96276 , x_accounting_coa_id => l_adr_accounting_coa_id
96277 , x_value_type_code => l_adr_value_type_code
96278 , p_side => 'NA'
96279 );
96280
96281 xla_ae_lines_pkg.set_ccid(
96282 p_code_combination_id => l_ccid
96283 , p_value_type_code => l_adr_value_type_code
96284 , p_transaction_coa_id => l_adr_transaction_coa_id
96285 , p_accounting_coa_id => l_adr_accounting_coa_id
96286 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
96287 , p_adr_type_code => 'S'
96288 , p_component_type => l_component_type
96289 , p_component_code => l_component_code
96290 , p_component_type_code => l_component_type_code
96291 , p_component_appl_id => l_component_appl_id
96292 , p_amb_context_code => l_amb_context_code
96293 , p_side => 'NA'
96294 );
96295
96296
96297 l_segment := AcctDerRule_145(
96298 p_application_id => p_application_id
96299 , p_ae_header_id => l_ae_header_id
96300 , p_source_5 => p_source_5
96301 , p_source_6 => p_source_6
96302 , x_transaction_coa_id => l_adr_transaction_coa_id
96303 , x_accounting_coa_id => l_adr_accounting_coa_id
96304 , x_flexfield_segment_code => l_adr_flexfield_segment_code
96305 , x_flex_value_set_id => l_adr_flex_value_set_id
96306 , x_value_type_code => l_adr_value_type_code
96307 , x_value_combination_id => l_adr_value_combination_id
96308 , x_value_segment_code => l_adr_value_segment_code
96309 , p_side => 'NA'
96310 , p_override_seg_flag => 'Y'
96311 );
96312
96313 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
96314
96315 xla_ae_lines_pkg.set_segment(
96319 , p_from_combination_id => l_adr_value_combination_id
96316 p_to_segment_code => 'GL_ACCOUNT'
96317 , p_segment_value => l_segment
96318 , p_from_segment_code => l_adr_value_segment_code
96320 , p_value_type_code => l_adr_value_type_code
96321 , p_transaction_coa_id => l_adr_transaction_coa_id
96322 , p_accounting_coa_id => l_adr_accounting_coa_id
96323 , p_flexfield_segment_code => l_adr_flexfield_segment_code
96324 , p_flex_value_set_id => l_adr_flex_value_set_id
96325 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
96326 , p_adr_type_code => 'S'
96327 , p_component_type => l_component_type
96328 , p_component_code => l_component_code
96329 , p_component_type_code => l_component_type_code
96330 , p_component_appl_id => l_component_appl_id
96331 , p_amb_context_code => l_amb_context_code
96332 , p_entity_code => 'TRANSACTIONS'
96333 , p_event_class_code => 'CATEGORY_RECLASS'
96334 , p_side => 'NA'
96335 );
96336
96337 END IF;
96338
96339 l_segment := AcctDerRule_169(
96340 p_application_id => p_application_id
96341 , p_ae_header_id => l_ae_header_id
96342 , p_source_5 => p_source_5
96343 , p_source_31 => p_source_31
96344 , x_transaction_coa_id => l_adr_transaction_coa_id
96345 , x_accounting_coa_id => l_adr_accounting_coa_id
96346 , x_flexfield_segment_code => l_adr_flexfield_segment_code
96347 , x_flex_value_set_id => l_adr_flex_value_set_id
96348 , x_value_type_code => l_adr_value_type_code
96349 , x_value_combination_id => l_adr_value_combination_id
96350 , x_value_segment_code => l_adr_value_segment_code
96351 , p_side => 'NA'
96352 , p_override_seg_flag => 'Y'
96353 );
96354
96355 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
96356
96357 xla_ae_lines_pkg.set_segment(
96358 p_to_segment_code => 'GL_BALANCING'
96359 , p_segment_value => l_segment
96360 , p_from_segment_code => l_adr_value_segment_code
96361 , p_from_combination_id => l_adr_value_combination_id
96362 , p_value_type_code => l_adr_value_type_code
96363 , p_transaction_coa_id => l_adr_transaction_coa_id
96364 , p_accounting_coa_id => l_adr_accounting_coa_id
96365 , p_flexfield_segment_code => l_adr_flexfield_segment_code
96366 , p_flex_value_set_id => l_adr_flex_value_set_id
96367 , p_adr_code => 'FA_EXPENSE_ACCT'
96368 , p_adr_type_code => 'S'
96369 , p_component_type => l_component_type
96370 , p_component_code => l_component_code
96371 , p_component_type_code => l_component_type_code
96372 , p_component_appl_id => l_component_appl_id
96373 , p_amb_context_code => l_amb_context_code
96374 , p_entity_code => 'TRANSACTIONS'
96375 , p_event_class_code => 'CATEGORY_RECLASS'
96376 , p_side => 'NA'
96377 );
96378
96379 END IF;
96380
96381 --
96382 --
96383 END IF;
96384
96385 --
96386 -- Update the line information that should be overwritten
96387 --
96388 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
96389 p_header_num => 1);
96390 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
96391
96392 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
96393
96394 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
96395 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
96396 END IF;
96397
96398 --
96399 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
96400 --
96401 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
96402 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
96403 ELSE
96404 ---------------------------------------------------------------------------------------------------
96405 -- 4262811a Switch Sign
96406 ---------------------------------------------------------------------------------------------------
96407 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
96408 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
96409 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
96410 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
96411 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
96412 -- 5132302
96413 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
96414 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
96415
96416 END IF;
96417
96421
96418 -- 4955764
96419 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
96420 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
96422
96423 XLA_AE_LINES_PKG.ValidateCurrentLine;
96424 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
96425
96426 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
96427 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
96428 ,p_balance_type_code => l_balance_type_code);
96429
96430 END IF;
96431
96432 -----------------------------------------------------------------------------------------
96433 -- 4262811 Multiperiod Accounting
96434 -----------------------------------------------------------------------------------------
96435 -- No MPA option is assigned.
96436
96437
96438 END IF;
96439 END IF;
96440 --
96441
96442 --
96443 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
96444 trace
96445 (p_msg => 'END of AcctLineType_298'
96446 ,p_level => C_LEVEL_PROCEDURE
96447 ,p_module => l_log_module);
96448 END IF;
96449 --
96450 EXCEPTION
96451 WHEN xla_exceptions_pkg.application_exception THEN
96452 RAISE;
96453 WHEN OTHERS THEN
96454 xla_exceptions_pkg.raise_message
96455 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_298');
96456 END AcctLineType_298;
96457 --
96458
96459 ---------------------------------------
96460 --
96461 -- PRIVATE FUNCTION
96462 -- AcctLineType_299
96463 --
96464 ---------------------------------------
96465 PROCEDURE AcctLineType_299 (
96466 p_application_id IN NUMBER
96467 ,p_event_id IN NUMBER
96468 ,p_calculate_acctd_flag IN VARCHAR2
96469 ,p_calculate_g_l_flag IN VARCHAR2
96470 ,p_actual_flag IN OUT VARCHAR2
96471 ,p_balance_type_code OUT VARCHAR2
96472 ,p_gain_or_loss_ref OUT VARCHAR2
96473
96474 --Period Close Date
96475 , p_source_1 IN DATE
96476 --Generated Code Combination Identifier
96477 , p_source_5 IN NUMBER
96478 --Asset Cost Account
96479 , p_source_11 IN VARCHAR2
96480 --Expense Account Code Combination Identifier
96481 , p_source_31 IN NUMBER
96482 --Default Code Combination Identifier
96483 , p_source_32 IN NUMBER
96484 --Adjustment Type
96485 , p_source_48 IN VARCHAR2
96486 --Transaction Header Identifier
96487 , p_source_49 IN NUMBER
96488 --Adjustment Line Identifier
96489 , p_source_50 IN NUMBER
96490 --Distribution Type Code
96491 , p_source_51 IN VARCHAR2
96492 --Entered Amount
96493 , p_source_52 IN NUMBER
96494 --Currency Code
96495 , p_source_53 IN VARCHAR2
96496 --Source Destination Code
96497 , p_source_55 IN VARCHAR2
96498 )
96499 IS
96500
96501 l_component_type VARCHAR2(80);
96502 l_component_code VARCHAR2(30);
96503 l_component_type_code VARCHAR2(1);
96504 l_component_appl_id INTEGER;
96505 l_amb_context_code VARCHAR2(30);
96506 l_entity_code VARCHAR2(30);
96507 l_event_class_code VARCHAR2(30);
96508 l_ae_header_id NUMBER;
96509 l_event_type_code VARCHAR2(30);
96510 l_line_definition_code VARCHAR2(30);
96511 l_line_definition_owner_code VARCHAR2(1);
96512 --
96513 -- adr variables
96514 l_segment VARCHAR2(30);
96515 l_ccid NUMBER;
96516 l_adr_transaction_coa_id NUMBER;
96517 l_adr_accounting_coa_id NUMBER;
96518 l_adr_flexfield_segment_code VARCHAR2(30);
96519 l_adr_flex_value_set_id NUMBER;
96520 l_adr_value_type_code VARCHAR2(30);
96521 l_adr_value_combination_id NUMBER;
96522 l_adr_value_segment_code VARCHAR2(30);
96523
96524 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
96525 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
96526 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
96527 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
96528
96529 -- 4262811 Variables ------------------------------------------------------------------------------------------
96530 l_entered_amt_idx NUMBER;
96531 l_accted_amt_idx NUMBER;
96532 l_acc_rev_flag VARCHAR2(1);
96533 l_accrual_line_num NUMBER;
96534 l_tmp_amt NUMBER;
96535 l_acc_rev_natural_side_code VARCHAR2(1);
96536
96537 l_num_entries NUMBER;
96538 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
96539 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
96540 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
96541 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
96542 l_recog_line_1 NUMBER;
96543 l_recog_line_2 NUMBER;
96544
96545 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
96546 l_bflow_applied_to_amt NUMBER; -- 5132302
96547 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
96548
96552 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
96549 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
96550
96551 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
96553
96554 ---------------------------------------------------------------------------------------------------------------
96555
96556
96557 --
96558 -- bulk performance
96559 --
96560 l_balance_type_code VARCHAR2(1);
96561 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
96562 l_log_module VARCHAR2(240);
96563
96564 --
96565 -- Upgrade strategy
96566 --
96567 l_actual_upg_option VARCHAR2(1);
96568 l_enc_upg_option VARCHAR2(1);
96569
96570 --
96571 BEGIN
96572 --
96573 IF g_log_enabled THEN
96574 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_299';
96575 END IF;
96576 --
96577 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
96578
96579 trace
96580 (p_msg => 'BEGIN of AcctLineType_299'
96581 ,p_level => C_LEVEL_PROCEDURE
96582 ,p_module => l_log_module);
96583
96584 END IF;
96585 --
96586 l_component_type := 'AMB_JLT';
96587 l_component_code := 'FA_RECLASS_SOURCE_COST';
96588 l_component_type_code := 'S';
96589 l_component_appl_id := 140;
96590 l_amb_context_code := 'DEFAULT';
96591 l_entity_code := 'TRANSACTIONS';
96592 l_event_class_code := 'CATEGORY_RECLASS';
96593 l_event_type_code := 'CATEGORY_RECLASS_ALL';
96594 l_line_definition_owner_code := 'S';
96595 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
96596 --
96597 l_balance_type_code := 'A';
96598 l_segment := NULL;
96599 l_ccid := NULL;
96600 l_adr_transaction_coa_id := NULL;
96601 l_adr_accounting_coa_id := NULL;
96602 l_adr_flexfield_segment_code := NULL;
96603 l_adr_flex_value_set_id := NULL;
96604 l_adr_value_type_code := NULL;
96605 l_adr_value_combination_id := NULL;
96606 l_adr_value_segment_code := NULL;
96607
96608 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
96609 l_bflow_class_code := ''; -- 4219869 Business Flow
96610 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
96611 l_budgetary_control_flag := 'N';
96612
96613 l_bflow_applied_to_amt_idx := NULL; -- 5132302
96614 l_bflow_applied_to_amt := NULL; -- 5132302
96615 l_entered_amt_idx := NULL; -- 4262811
96616 l_accted_amt_idx := NULL; -- 4262811
96617 l_acc_rev_flag := NULL; -- 4262811
96618 l_accrual_line_num := NULL; -- 4262811
96619 l_tmp_amt := NULL; -- 4262811
96620 --
96621
96622 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
96623 l_balance_type_code <> 'B' THEN
96624 IF NVL(p_source_48,'
96625 ') = 'COST' AND
96626 NVL(p_source_55,'
96627 ') = 'SOURCE'
96628 THEN
96629
96630 --
96631 XLA_AE_LINES_PKG.SetNewLine;
96632
96633 p_balance_type_code := l_balance_type_code;
96634 -- set the flag so later we will know whether the gain loss line needs to be created
96635
96636 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
96637 p_actual_flag :='A';
96638 END IF;
96639
96640 --
96641 -- bulk performance
96642 --
96643 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
96644 p_header_num => 0); -- 4262811
96645 --
96646 -- set accounting line options
96647 --
96648 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
96649 p_natural_side_code => 'C'
96650 , p_gain_or_loss_flag => 'N'
96651 , p_gl_transfer_mode_code => 'S'
96652 , p_acct_entry_type_code => 'A'
96653 , p_switch_side_flag => 'Y'
96654 , p_merge_duplicate_code => 'N'
96655 );
96656 --
96657 l_acc_rev_natural_side_code := 'D'; -- 4262811
96658 --
96659 --
96660 -- set accounting line type info
96661 --
96662 xla_ae_lines_pkg.SetAcctLineType
96663 (p_component_type => l_component_type
96664 ,p_event_type_code => l_event_type_code
96665 ,p_line_definition_owner_code => l_line_definition_owner_code
96666 ,p_line_definition_code => l_line_definition_code
96667 ,p_accounting_line_code => l_component_code
96668 ,p_accounting_line_type_code => l_component_type_code
96669 ,p_accounting_line_appl_id => l_component_appl_id
96670 ,p_amb_context_code => l_amb_context_code
96671 ,p_entity_code => l_entity_code
96672 ,p_event_class_code => l_event_class_code);
96673 --
96674 -- set accounting class
96675 --
96676 xla_ae_lines_pkg.SetAcctClass(
96677 p_accounting_class_code => 'ASSET'
96678 , p_ae_header_id => l_ae_header_id
96679 );
96680
96681 --
96682 -- set rounding class
96683 --
96687 --
96684 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
96685 'ASSET';
96686
96688 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
96689 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
96690 --
96691 -- bulk performance
96692 --
96693 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
96694
96695 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
96696 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
96697
96698 -- 4955764
96699 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
96700 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
96701
96702 -- 4458381 Public Sector Enh
96703
96704 --
96705 -- set accounting attributes for the line type
96706 --
96707 l_entered_amt_idx := 4;
96708 l_accted_amt_idx := 6;
96709 l_bflow_applied_to_amt_idx := NULL; -- 5132302
96710 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
96711 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
96712 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
96713 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
96714 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
96715 l_rec_acct_attrs.array_char_value(3) := p_source_51;
96716 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
96717 l_rec_acct_attrs.array_num_value(4) := p_source_52;
96718 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
96719 l_rec_acct_attrs.array_char_value(5) := p_source_53;
96720 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
96721 l_rec_acct_attrs.array_num_value(6) := p_source_52;
96722
96723 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
96724 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
96725
96726 ---------------------------------------------------------------------------------------------------------------
96727 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
96728 ---------------------------------------------------------------------------------------------------------------
96729 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
96730
96731 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
96732 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
96733
96734 IF xla_accounting_cache_pkg.GetValueChar
96735 (p_source_code => 'LEDGER_CATEGORY_CODE'
96736 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
96737 AND l_bflow_method_code = 'PRIOR_ENTRY'
96738 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
96739 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
96740 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
96741 )
96742 THEN
96743 xla_ae_lines_pkg.BflowUpgEntry
96744 (p_business_method_code => l_bflow_method_code
96745 ,p_business_class_code => l_bflow_class_code
96746 ,p_balance_type => l_balance_type_code);
96747 ELSE
96748 NULL;
96749 -- No business flow processing for business flow method of NONE.
96750 END IF;
96751
96752 --
96753 -- call analytical criteria
96754 --
96755
96756 --
96757 -- call description
96758 --
96759
96760 xla_ae_lines_pkg.SetLineDescription(
96761 p_ae_header_id => l_ae_header_id
96762 ,p_description => Description_65 (
96763 p_application_id => p_application_id
96764 , p_ae_header_id => l_ae_header_id
96765 , p_source_1 => p_source_1
96766 )
96767 );
96768
96769
96770 --
96771 -- call ADRs
96772 -- Bug 4922099
96773 --
96774 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
96775 (NVL(l_actual_upg_option, 'N') = 'O') OR
96776 (NVL(l_enc_upg_option, 'N') = 'O')
96777 )
96778 THEN
96779 NULL;
96780 --
96781 --
96782
96783 l_ccid := AcctDerRule_174(
96784 p_application_id => p_application_id
96785 , p_ae_header_id => l_ae_header_id
96786 , p_source_5 => p_source_5
96787 , p_source_32 => p_source_32
96788 , x_transaction_coa_id => l_adr_transaction_coa_id
96789 , x_accounting_coa_id => l_adr_accounting_coa_id
96790 , x_value_type_code => l_adr_value_type_code
96791 , p_side => 'NA'
96792 );
96793
96794 xla_ae_lines_pkg.set_ccid(
96795 p_code_combination_id => l_ccid
96796 , p_value_type_code => l_adr_value_type_code
96797 , p_transaction_coa_id => l_adr_transaction_coa_id
96798 , p_accounting_coa_id => l_adr_accounting_coa_id
96799 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
96800 , p_adr_type_code => 'S'
96801 , p_component_type => l_component_type
96802 , p_component_code => l_component_code
96806 , p_side => 'NA'
96803 , p_component_type_code => l_component_type_code
96804 , p_component_appl_id => l_component_appl_id
96805 , p_amb_context_code => l_amb_context_code
96807 );
96808
96809
96810 l_segment := AcctDerRule_149(
96811 p_application_id => p_application_id
96812 , p_ae_header_id => l_ae_header_id
96813 , p_source_5 => p_source_5
96814 , p_source_11 => p_source_11
96815 , x_transaction_coa_id => l_adr_transaction_coa_id
96816 , x_accounting_coa_id => l_adr_accounting_coa_id
96817 , x_flexfield_segment_code => l_adr_flexfield_segment_code
96818 , x_flex_value_set_id => l_adr_flex_value_set_id
96819 , x_value_type_code => l_adr_value_type_code
96820 , x_value_combination_id => l_adr_value_combination_id
96821 , x_value_segment_code => l_adr_value_segment_code
96822 , p_side => 'NA'
96823 , p_override_seg_flag => 'Y'
96824 );
96825
96826 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
96827
96828 xla_ae_lines_pkg.set_segment(
96829 p_to_segment_code => 'GL_ACCOUNT'
96830 , p_segment_value => l_segment
96831 , p_from_segment_code => l_adr_value_segment_code
96832 , p_from_combination_id => l_adr_value_combination_id
96833 , p_value_type_code => l_adr_value_type_code
96834 , p_transaction_coa_id => l_adr_transaction_coa_id
96835 , p_accounting_coa_id => l_adr_accounting_coa_id
96836 , p_flexfield_segment_code => l_adr_flexfield_segment_code
96837 , p_flex_value_set_id => l_adr_flex_value_set_id
96838 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
96839 , p_adr_type_code => 'S'
96840 , p_component_type => l_component_type
96841 , p_component_code => l_component_code
96842 , p_component_type_code => l_component_type_code
96843 , p_component_appl_id => l_component_appl_id
96844 , p_amb_context_code => l_amb_context_code
96845 , p_entity_code => 'TRANSACTIONS'
96846 , p_event_class_code => 'CATEGORY_RECLASS'
96847 , p_side => 'NA'
96848 );
96849
96850 END IF;
96851
96852 l_segment := AcctDerRule_169(
96853 p_application_id => p_application_id
96854 , p_ae_header_id => l_ae_header_id
96855 , p_source_5 => p_source_5
96856 , p_source_31 => p_source_31
96857 , x_transaction_coa_id => l_adr_transaction_coa_id
96858 , x_accounting_coa_id => l_adr_accounting_coa_id
96859 , x_flexfield_segment_code => l_adr_flexfield_segment_code
96860 , x_flex_value_set_id => l_adr_flex_value_set_id
96861 , x_value_type_code => l_adr_value_type_code
96862 , x_value_combination_id => l_adr_value_combination_id
96863 , x_value_segment_code => l_adr_value_segment_code
96864 , p_side => 'NA'
96865 , p_override_seg_flag => 'Y'
96866 );
96867
96868 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
96869
96870 xla_ae_lines_pkg.set_segment(
96871 p_to_segment_code => 'GL_BALANCING'
96872 , p_segment_value => l_segment
96873 , p_from_segment_code => l_adr_value_segment_code
96874 , p_from_combination_id => l_adr_value_combination_id
96875 , p_value_type_code => l_adr_value_type_code
96876 , p_transaction_coa_id => l_adr_transaction_coa_id
96877 , p_accounting_coa_id => l_adr_accounting_coa_id
96878 , p_flexfield_segment_code => l_adr_flexfield_segment_code
96879 , p_flex_value_set_id => l_adr_flex_value_set_id
96880 , p_adr_code => 'FA_EXPENSE_ACCT'
96881 , p_adr_type_code => 'S'
96882 , p_component_type => l_component_type
96883 , p_component_code => l_component_code
96884 , p_component_type_code => l_component_type_code
96885 , p_component_appl_id => l_component_appl_id
96886 , p_amb_context_code => l_amb_context_code
96887 , p_entity_code => 'TRANSACTIONS'
96888 , p_event_class_code => 'CATEGORY_RECLASS'
96889 , p_side => 'NA'
96890 );
96891
96892 END IF;
96893
96894 --
96895 --
96896 END IF;
96897 --
96898 -- Bug 4922099
96899 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
96900 (NVL(l_enc_upg_option, 'N') = 'O')
96901 ) AND
96902 (l_bflow_method_code = 'PRIOR_ENTRY')
96903 )
96904 THEN
96905 IF
96906 --
96907 1 = 2
96908 --
96909 THEN
96910 xla_accounting_err_pkg.build_message
96911 (p_appli_s_name => 'XLA'
96912 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
96913 ,p_token_1 => 'LINE_NUMBER'
96914 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
96915 ,p_token_2 => 'LINE_TYPE_NAME'
96919 ,l_component_type_code
96916 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
96917 l_component_type
96918 ,l_component_code
96920 ,l_component_appl_id
96921 ,l_amb_context_code
96922 ,l_entity_code
96923 ,l_event_class_code
96924 )
96925 ,p_token_3 => 'OWNER'
96926 ,p_value_3 => xla_lookups_pkg.get_meaning(
96927 p_lookup_type => 'XLA_OWNER_TYPE'
96928 ,p_lookup_code => l_component_type_code
96929 )
96930 ,p_token_4 => 'PRODUCT_NAME'
96931 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
96932 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
96933 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
96934 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
96935 ,p_ae_header_id => NULL
96936 );
96937
96938 IF (C_LEVEL_ERROR>= g_log_level) THEN
96939 trace
96940 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
96941 ,p_level => C_LEVEL_ERROR
96942 ,p_module => l_log_module);
96943 END IF;
96944 END IF;
96945 END IF;
96946 --
96947 --
96948 ------------------------------------------------------------------------------------------------
96949 -- 4219869 Business Flow
96950 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
96951 -- Prior Entry. Currently, the following code is always generated.
96952 ------------------------------------------------------------------------------------------------
96953 XLA_AE_LINES_PKG.ValidateCurrentLine;
96954
96955 ------------------------------------------------------------------------------------
96956 -- 4219869 Business Flow
96957 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
96958 ------------------------------------------------------------------------------------
96959 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
96960
96961 ----------------------------------------------------------------------------------
96962 -- 4219869 Business Flow
96963 -- Update journal entry status -- Need to generate this within IF <condition>
96964 ----------------------------------------------------------------------------------
96965 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
96966 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
96967 ,p_balance_type_code => l_balance_type_code
96968 );
96969
96970 -------------------------------------------------------------------------------------------
96971 -- 4262811 - Generate the Accrual Reversal lines
96972 -------------------------------------------------------------------------------------------
96973 BEGIN
96974 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
96975 (g_array_event(p_event_id).array_value_num('header_index'));
96976 IF l_acc_rev_flag IS NULL THEN
96977 l_acc_rev_flag := 'N';
96978 END IF;
96979 EXCEPTION
96980 WHEN OTHERS THEN
96981 l_acc_rev_flag := 'N';
96982 END;
96983 --
96984 IF (l_acc_rev_flag = 'Y') THEN
96985
96986 -- 4645092 ------------------------------------------------------------------------------
96987 -- To allow MPA report to determine if it should generate report process
96988 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
96989 ------------------------------------------------------------------------------------------
96990
96991 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
96992 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
96993 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
96994 -- call ADRs
96995 -- Bug 4922099
96996 --
96997 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
96998 (NVL(l_actual_upg_option, 'N') = 'O') OR
96999 (NVL(l_enc_upg_option, 'N') = 'O')
97000 )
97001 THEN
97002 NULL;
97003 --
97004 --
97005
97006 l_ccid := AcctDerRule_174(
97007 p_application_id => p_application_id
97008 , p_ae_header_id => l_ae_header_id
97009 , p_source_5 => p_source_5
97010 , p_source_32 => p_source_32
97011 , x_transaction_coa_id => l_adr_transaction_coa_id
97015 );
97012 , x_accounting_coa_id => l_adr_accounting_coa_id
97013 , x_value_type_code => l_adr_value_type_code
97014 , p_side => 'NA'
97016
97017 xla_ae_lines_pkg.set_ccid(
97018 p_code_combination_id => l_ccid
97019 , p_value_type_code => l_adr_value_type_code
97020 , p_transaction_coa_id => l_adr_transaction_coa_id
97021 , p_accounting_coa_id => l_adr_accounting_coa_id
97022 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
97023 , p_adr_type_code => 'S'
97024 , p_component_type => l_component_type
97025 , p_component_code => l_component_code
97026 , p_component_type_code => l_component_type_code
97027 , p_component_appl_id => l_component_appl_id
97028 , p_amb_context_code => l_amb_context_code
97029 , p_side => 'NA'
97030 );
97031
97032
97033 l_segment := AcctDerRule_149(
97034 p_application_id => p_application_id
97035 , p_ae_header_id => l_ae_header_id
97036 , p_source_5 => p_source_5
97037 , p_source_11 => p_source_11
97038 , x_transaction_coa_id => l_adr_transaction_coa_id
97039 , x_accounting_coa_id => l_adr_accounting_coa_id
97040 , x_flexfield_segment_code => l_adr_flexfield_segment_code
97041 , x_flex_value_set_id => l_adr_flex_value_set_id
97042 , x_value_type_code => l_adr_value_type_code
97043 , x_value_combination_id => l_adr_value_combination_id
97044 , x_value_segment_code => l_adr_value_segment_code
97045 , p_side => 'NA'
97046 , p_override_seg_flag => 'Y'
97047 );
97048
97049 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
97050
97051 xla_ae_lines_pkg.set_segment(
97052 p_to_segment_code => 'GL_ACCOUNT'
97053 , p_segment_value => l_segment
97054 , p_from_segment_code => l_adr_value_segment_code
97055 , p_from_combination_id => l_adr_value_combination_id
97056 , p_value_type_code => l_adr_value_type_code
97057 , p_transaction_coa_id => l_adr_transaction_coa_id
97058 , p_accounting_coa_id => l_adr_accounting_coa_id
97059 , p_flexfield_segment_code => l_adr_flexfield_segment_code
97060 , p_flex_value_set_id => l_adr_flex_value_set_id
97061 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
97062 , p_adr_type_code => 'S'
97063 , p_component_type => l_component_type
97064 , p_component_code => l_component_code
97065 , p_component_type_code => l_component_type_code
97066 , p_component_appl_id => l_component_appl_id
97067 , p_amb_context_code => l_amb_context_code
97068 , p_entity_code => 'TRANSACTIONS'
97069 , p_event_class_code => 'CATEGORY_RECLASS'
97070 , p_side => 'NA'
97071 );
97072
97073 END IF;
97074
97075 l_segment := AcctDerRule_169(
97076 p_application_id => p_application_id
97077 , p_ae_header_id => l_ae_header_id
97078 , p_source_5 => p_source_5
97079 , p_source_31 => p_source_31
97080 , x_transaction_coa_id => l_adr_transaction_coa_id
97081 , x_accounting_coa_id => l_adr_accounting_coa_id
97082 , x_flexfield_segment_code => l_adr_flexfield_segment_code
97083 , x_flex_value_set_id => l_adr_flex_value_set_id
97084 , x_value_type_code => l_adr_value_type_code
97085 , x_value_combination_id => l_adr_value_combination_id
97086 , x_value_segment_code => l_adr_value_segment_code
97087 , p_side => 'NA'
97088 , p_override_seg_flag => 'Y'
97089 );
97090
97091 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
97092
97093 xla_ae_lines_pkg.set_segment(
97094 p_to_segment_code => 'GL_BALANCING'
97095 , p_segment_value => l_segment
97096 , p_from_segment_code => l_adr_value_segment_code
97097 , p_from_combination_id => l_adr_value_combination_id
97098 , p_value_type_code => l_adr_value_type_code
97099 , p_transaction_coa_id => l_adr_transaction_coa_id
97100 , p_accounting_coa_id => l_adr_accounting_coa_id
97101 , p_flexfield_segment_code => l_adr_flexfield_segment_code
97102 , p_flex_value_set_id => l_adr_flex_value_set_id
97103 , p_adr_code => 'FA_EXPENSE_ACCT'
97104 , p_adr_type_code => 'S'
97105 , p_component_type => l_component_type
97106 , p_component_code => l_component_code
97107 , p_component_type_code => l_component_type_code
97108 , p_component_appl_id => l_component_appl_id
97109 , p_amb_context_code => l_amb_context_code
97110 , p_entity_code => 'TRANSACTIONS'
97111 , p_event_class_code => 'CATEGORY_RECLASS'
97112 , p_side => 'NA'
97113 );
97114
97115 END IF;
97116
97117 --
97118 --
97119 END IF;
97120
97121 --
97125 p_header_num => 1);
97122 -- Update the line information that should be overwritten
97123 --
97124 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
97126 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
97127
97128 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
97129
97130 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
97131 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
97132 END IF;
97133
97134 --
97135 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
97136 --
97137 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
97138 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
97139 ELSE
97140 ---------------------------------------------------------------------------------------------------
97141 -- 4262811a Switch Sign
97142 ---------------------------------------------------------------------------------------------------
97143 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
97144 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
97145 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
97146 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
97147 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
97148 -- 5132302
97149 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
97150 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
97151
97152 END IF;
97153
97154 -- 4955764
97155 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
97156 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
97157
97158
97159 XLA_AE_LINES_PKG.ValidateCurrentLine;
97160 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
97161
97162 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
97163 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
97164 ,p_balance_type_code => l_balance_type_code);
97165
97166 END IF;
97167
97168 -----------------------------------------------------------------------------------------
97169 -- 4262811 Multiperiod Accounting
97170 -----------------------------------------------------------------------------------------
97171 -- No MPA option is assigned.
97172
97173
97174 END IF;
97175 END IF;
97176 --
97177
97178 --
97179 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
97180 trace
97181 (p_msg => 'END of AcctLineType_299'
97182 ,p_level => C_LEVEL_PROCEDURE
97183 ,p_module => l_log_module);
97184 END IF;
97185 --
97186 EXCEPTION
97187 WHEN xla_exceptions_pkg.application_exception THEN
97188 RAISE;
97189 WHEN OTHERS THEN
97190 xla_exceptions_pkg.raise_message
97191 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_299');
97192 END AcctLineType_299;
97193 --
97194
97195 ---------------------------------------
97196 --
97197 -- PRIVATE FUNCTION
97198 -- AcctLineType_300
97199 --
97200 ---------------------------------------
97201 PROCEDURE AcctLineType_300 (
97202 p_application_id IN NUMBER
97203 ,p_event_id IN NUMBER
97204 ,p_calculate_acctd_flag IN VARCHAR2
97205 ,p_calculate_g_l_flag IN VARCHAR2
97206 ,p_actual_flag IN OUT VARCHAR2
97207 ,p_balance_type_code OUT VARCHAR2
97208 ,p_gain_or_loss_ref OUT VARCHAR2
97209
97210 --Period Close Date
97211 , p_source_1 IN DATE
97212 --Generated Code Combination Identifier
97213 , p_source_5 IN NUMBER
97214 --Expense Account Code Combination Identifier
97215 , p_source_31 IN NUMBER
97216 --Adjustment Type
97217 , p_source_48 IN VARCHAR2
97218 --Transaction Header Identifier
97219 , p_source_49 IN NUMBER
97220 --Adjustment Line Identifier
97221 , p_source_50 IN NUMBER
97222 --Distribution Type Code
97223 , p_source_51 IN VARCHAR2
97224 --Entered Amount
97225 , p_source_52 IN NUMBER
97226 --Currency Code
97227 , p_source_53 IN VARCHAR2
97228 --Source Destination Code
97229 , p_source_55 IN VARCHAR2
97230 )
97231 IS
97232
97233 l_component_type VARCHAR2(80);
97234 l_component_code VARCHAR2(30);
97235 l_component_type_code VARCHAR2(1);
97236 l_component_appl_id INTEGER;
97237 l_amb_context_code VARCHAR2(30);
97238 l_entity_code VARCHAR2(30);
97239 l_event_class_code VARCHAR2(30);
97240 l_ae_header_id NUMBER;
97241 l_event_type_code VARCHAR2(30);
97242 l_line_definition_code VARCHAR2(30);
97243 l_line_definition_owner_code VARCHAR2(1);
97244 --
97245 -- adr variables
97249 l_adr_accounting_coa_id NUMBER;
97246 l_segment VARCHAR2(30);
97247 l_ccid NUMBER;
97248 l_adr_transaction_coa_id NUMBER;
97250 l_adr_flexfield_segment_code VARCHAR2(30);
97251 l_adr_flex_value_set_id NUMBER;
97252 l_adr_value_type_code VARCHAR2(30);
97253 l_adr_value_combination_id NUMBER;
97254 l_adr_value_segment_code VARCHAR2(30);
97255
97256 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
97257 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
97258 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
97259 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
97260
97261 -- 4262811 Variables ------------------------------------------------------------------------------------------
97262 l_entered_amt_idx NUMBER;
97263 l_accted_amt_idx NUMBER;
97264 l_acc_rev_flag VARCHAR2(1);
97265 l_accrual_line_num NUMBER;
97266 l_tmp_amt NUMBER;
97267 l_acc_rev_natural_side_code VARCHAR2(1);
97268
97269 l_num_entries NUMBER;
97270 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
97271 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
97272 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
97273 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
97274 l_recog_line_1 NUMBER;
97275 l_recog_line_2 NUMBER;
97276
97277 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
97278 l_bflow_applied_to_amt NUMBER; -- 5132302
97279 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
97280
97281 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
97282
97283 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
97284 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
97285
97286 ---------------------------------------------------------------------------------------------------------------
97287
97288
97289 --
97290 -- bulk performance
97291 --
97292 l_balance_type_code VARCHAR2(1);
97293 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
97294 l_log_module VARCHAR2(240);
97295
97296 --
97297 -- Upgrade strategy
97298 --
97299 l_actual_upg_option VARCHAR2(1);
97300 l_enc_upg_option VARCHAR2(1);
97301
97302 --
97303 BEGIN
97304 --
97305 IF g_log_enabled THEN
97306 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_300';
97307 END IF;
97308 --
97309 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
97310
97311 trace
97312 (p_msg => 'BEGIN of AcctLineType_300'
97313 ,p_level => C_LEVEL_PROCEDURE
97314 ,p_module => l_log_module);
97315
97316 END IF;
97317 --
97318 l_component_type := 'AMB_JLT';
97319 l_component_code := 'FA_RECLASS_SOURCE_DEPRN_EXP';
97320 l_component_type_code := 'S';
97321 l_component_appl_id := 140;
97322 l_amb_context_code := 'DEFAULT';
97323 l_entity_code := 'TRANSACTIONS';
97324 l_event_class_code := 'CATEGORY_RECLASS';
97325 l_event_type_code := 'CATEGORY_RECLASS_ALL';
97326 l_line_definition_owner_code := 'S';
97327 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
97328 --
97329 l_balance_type_code := 'A';
97330 l_segment := NULL;
97331 l_ccid := NULL;
97332 l_adr_transaction_coa_id := NULL;
97333 l_adr_accounting_coa_id := NULL;
97334 l_adr_flexfield_segment_code := NULL;
97335 l_adr_flex_value_set_id := NULL;
97336 l_adr_value_type_code := NULL;
97337 l_adr_value_combination_id := NULL;
97338 l_adr_value_segment_code := NULL;
97339
97340 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
97341 l_bflow_class_code := ''; -- 4219869 Business Flow
97342 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
97343 l_budgetary_control_flag := 'N';
97344
97345 l_bflow_applied_to_amt_idx := NULL; -- 5132302
97346 l_bflow_applied_to_amt := NULL; -- 5132302
97347 l_entered_amt_idx := NULL; -- 4262811
97348 l_accted_amt_idx := NULL; -- 4262811
97349 l_acc_rev_flag := NULL; -- 4262811
97350 l_accrual_line_num := NULL; -- 4262811
97351 l_tmp_amt := NULL; -- 4262811
97352 --
97353
97354 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
97355 l_balance_type_code <> 'B' THEN
97356 IF NVL(p_source_48,'
97357 ') = 'EXPENSE' AND
97358 NVL(p_source_55,'
97359 ') = 'SOURCE'
97360 THEN
97361
97362 --
97363 XLA_AE_LINES_PKG.SetNewLine;
97364
97365 p_balance_type_code := l_balance_type_code;
97366 -- set the flag so later we will know whether the gain loss line needs to be created
97367
97368 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
97369 p_actual_flag :='A';
97370 END IF;
97371
97372 --
97373 -- bulk performance
97374 --
97375 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
97379 --
97376 p_header_num => 0); -- 4262811
97377 --
97378 -- set accounting line options
97380 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
97381 p_natural_side_code => 'C'
97382 , p_gain_or_loss_flag => 'N'
97383 , p_gl_transfer_mode_code => 'S'
97384 , p_acct_entry_type_code => 'A'
97385 , p_switch_side_flag => 'Y'
97386 , p_merge_duplicate_code => 'N'
97387 );
97388 --
97389 l_acc_rev_natural_side_code := 'D'; -- 4262811
97390 --
97391 --
97392 -- set accounting line type info
97393 --
97394 xla_ae_lines_pkg.SetAcctLineType
97395 (p_component_type => l_component_type
97396 ,p_event_type_code => l_event_type_code
97397 ,p_line_definition_owner_code => l_line_definition_owner_code
97398 ,p_line_definition_code => l_line_definition_code
97399 ,p_accounting_line_code => l_component_code
97400 ,p_accounting_line_type_code => l_component_type_code
97401 ,p_accounting_line_appl_id => l_component_appl_id
97402 ,p_amb_context_code => l_amb_context_code
97403 ,p_entity_code => l_entity_code
97404 ,p_event_class_code => l_event_class_code);
97405 --
97406 -- set accounting class
97407 --
97408 xla_ae_lines_pkg.SetAcctClass(
97409 p_accounting_class_code => 'EXPENSE'
97410 , p_ae_header_id => l_ae_header_id
97411 );
97412
97413 --
97414 -- set rounding class
97415 --
97416 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
97417 'EXPENSE';
97418
97419 --
97420 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
97421 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
97422 --
97423 -- bulk performance
97424 --
97425 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
97426
97427 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
97428 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
97429
97430 -- 4955764
97431 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
97432 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
97433
97434 -- 4458381 Public Sector Enh
97435
97436 --
97437 -- set accounting attributes for the line type
97438 --
97439 l_entered_amt_idx := 4;
97440 l_accted_amt_idx := 6;
97441 l_bflow_applied_to_amt_idx := NULL; -- 5132302
97442 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
97443 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
97444 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
97445 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
97446 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
97447 l_rec_acct_attrs.array_char_value(3) := p_source_51;
97448 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
97449 l_rec_acct_attrs.array_num_value(4) := p_source_52;
97450 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
97451 l_rec_acct_attrs.array_char_value(5) := p_source_53;
97452 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
97453 l_rec_acct_attrs.array_num_value(6) := p_source_52;
97454
97455 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
97456 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
97457
97458 ---------------------------------------------------------------------------------------------------------------
97459 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
97460 ---------------------------------------------------------------------------------------------------------------
97461 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
97462
97463 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
97464 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
97465
97466 IF xla_accounting_cache_pkg.GetValueChar
97467 (p_source_code => 'LEDGER_CATEGORY_CODE'
97468 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
97469 AND l_bflow_method_code = 'PRIOR_ENTRY'
97470 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
97471 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
97472 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
97473 )
97474 THEN
97475 xla_ae_lines_pkg.BflowUpgEntry
97476 (p_business_method_code => l_bflow_method_code
97477 ,p_business_class_code => l_bflow_class_code
97478 ,p_balance_type => l_balance_type_code);
97479 ELSE
97480 NULL;
97481 -- No business flow processing for business flow method of NONE.
97482 END IF;
97483
97484 --
97485 -- call analytical criteria
97486 --
97487
97488 --
97492 xla_ae_lines_pkg.SetLineDescription(
97489 -- call description
97490 --
97491
97493 p_ae_header_id => l_ae_header_id
97494 ,p_description => Description_66 (
97495 p_application_id => p_application_id
97496 , p_ae_header_id => l_ae_header_id
97497 , p_source_1 => p_source_1
97498 )
97499 );
97500
97501
97502 --
97503 -- call ADRs
97504 -- Bug 4922099
97505 --
97506 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
97507 (NVL(l_actual_upg_option, 'N') = 'O') OR
97508 (NVL(l_enc_upg_option, 'N') = 'O')
97509 )
97510 THEN
97511 NULL;
97512 --
97513 --
97514
97515 l_ccid := AcctDerRule_176(
97516 p_application_id => p_application_id
97517 , p_ae_header_id => l_ae_header_id
97518 , p_source_5 => p_source_5
97519 , p_source_31 => p_source_31
97520 , x_transaction_coa_id => l_adr_transaction_coa_id
97521 , x_accounting_coa_id => l_adr_accounting_coa_id
97522 , x_value_type_code => l_adr_value_type_code
97523 , p_side => 'NA'
97524 );
97525
97526 xla_ae_lines_pkg.set_ccid(
97527 p_code_combination_id => l_ccid
97528 , p_value_type_code => l_adr_value_type_code
97529 , p_transaction_coa_id => l_adr_transaction_coa_id
97530 , p_accounting_coa_id => l_adr_accounting_coa_id
97531 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
97532 , p_adr_type_code => 'S'
97533 , p_component_type => l_component_type
97534 , p_component_code => l_component_code
97535 , p_component_type_code => l_component_type_code
97536 , p_component_appl_id => l_component_appl_id
97537 , p_amb_context_code => l_amb_context_code
97538 , p_side => 'NA'
97539 );
97540
97541
97542 --
97543 --
97544 END IF;
97545 --
97546 -- Bug 4922099
97547 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
97548 (NVL(l_enc_upg_option, 'N') = 'O')
97549 ) AND
97550 (l_bflow_method_code = 'PRIOR_ENTRY')
97551 )
97552 THEN
97553 IF
97554 --
97555 1 = 2
97556 --
97557 THEN
97558 xla_accounting_err_pkg.build_message
97559 (p_appli_s_name => 'XLA'
97560 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
97561 ,p_token_1 => 'LINE_NUMBER'
97562 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
97563 ,p_token_2 => 'LINE_TYPE_NAME'
97564 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
97565 l_component_type
97566 ,l_component_code
97567 ,l_component_type_code
97568 ,l_component_appl_id
97569 ,l_amb_context_code
97570 ,l_entity_code
97571 ,l_event_class_code
97572 )
97573 ,p_token_3 => 'OWNER'
97574 ,p_value_3 => xla_lookups_pkg.get_meaning(
97575 p_lookup_type => 'XLA_OWNER_TYPE'
97576 ,p_lookup_code => l_component_type_code
97577 )
97578 ,p_token_4 => 'PRODUCT_NAME'
97579 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
97580 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
97581 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
97582 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
97583 ,p_ae_header_id => NULL
97584 );
97585
97586 IF (C_LEVEL_ERROR>= g_log_level) THEN
97587 trace
97588 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
97589 ,p_level => C_LEVEL_ERROR
97590 ,p_module => l_log_module);
97591 END IF;
97592 END IF;
97593 END IF;
97594 --
97595 --
97596 ------------------------------------------------------------------------------------------------
97597 -- 4219869 Business Flow
97598 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
97599 -- Prior Entry. Currently, the following code is always generated.
97603 ------------------------------------------------------------------------------------
97600 ------------------------------------------------------------------------------------------------
97601 XLA_AE_LINES_PKG.ValidateCurrentLine;
97602
97604 -- 4219869 Business Flow
97605 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
97606 ------------------------------------------------------------------------------------
97607 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
97608
97609 ----------------------------------------------------------------------------------
97610 -- 4219869 Business Flow
97611 -- Update journal entry status -- Need to generate this within IF <condition>
97612 ----------------------------------------------------------------------------------
97613 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
97614 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
97615 ,p_balance_type_code => l_balance_type_code
97616 );
97617
97618 -------------------------------------------------------------------------------------------
97619 -- 4262811 - Generate the Accrual Reversal lines
97620 -------------------------------------------------------------------------------------------
97621 BEGIN
97622 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
97623 (g_array_event(p_event_id).array_value_num('header_index'));
97624 IF l_acc_rev_flag IS NULL THEN
97625 l_acc_rev_flag := 'N';
97626 END IF;
97627 EXCEPTION
97628 WHEN OTHERS THEN
97629 l_acc_rev_flag := 'N';
97630 END;
97631 --
97632 IF (l_acc_rev_flag = 'Y') THEN
97633
97634 -- 4645092 ------------------------------------------------------------------------------
97635 -- To allow MPA report to determine if it should generate report process
97636 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
97637 ------------------------------------------------------------------------------------------
97638
97639 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
97640 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
97641 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
97642 -- call ADRs
97643 -- Bug 4922099
97644 --
97645 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
97646 (NVL(l_actual_upg_option, 'N') = 'O') OR
97647 (NVL(l_enc_upg_option, 'N') = 'O')
97648 )
97649 THEN
97650 NULL;
97651 --
97652 --
97653
97654 l_ccid := AcctDerRule_176(
97655 p_application_id => p_application_id
97656 , p_ae_header_id => l_ae_header_id
97657 , p_source_5 => p_source_5
97658 , p_source_31 => p_source_31
97659 , x_transaction_coa_id => l_adr_transaction_coa_id
97660 , x_accounting_coa_id => l_adr_accounting_coa_id
97661 , x_value_type_code => l_adr_value_type_code
97662 , p_side => 'NA'
97663 );
97664
97665 xla_ae_lines_pkg.set_ccid(
97666 p_code_combination_id => l_ccid
97667 , p_value_type_code => l_adr_value_type_code
97668 , p_transaction_coa_id => l_adr_transaction_coa_id
97669 , p_accounting_coa_id => l_adr_accounting_coa_id
97670 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
97671 , p_adr_type_code => 'S'
97672 , p_component_type => l_component_type
97673 , p_component_code => l_component_code
97674 , p_component_type_code => l_component_type_code
97675 , p_component_appl_id => l_component_appl_id
97676 , p_amb_context_code => l_amb_context_code
97677 , p_side => 'NA'
97678 );
97679
97680
97681 --
97682 --
97683 END IF;
97684
97685 --
97686 -- Update the line information that should be overwritten
97687 --
97688 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
97689 p_header_num => 1);
97690 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
97691
97692 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
97693
97694 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
97695 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
97696 END IF;
97697
97698 --
97699 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
97700 --
97701 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
97702 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
97703 ELSE
97704 ---------------------------------------------------------------------------------------------------
97705 -- 4262811a Switch Sign
97706 ---------------------------------------------------------------------------------------------------
97707 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
97711 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
97708 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
97709 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
97710 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
97712 -- 5132302
97713 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
97714 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
97715
97716 END IF;
97717
97718 -- 4955764
97719 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
97720 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
97721
97722
97723 XLA_AE_LINES_PKG.ValidateCurrentLine;
97724 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
97725
97726 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
97727 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
97728 ,p_balance_type_code => l_balance_type_code);
97729
97730 END IF;
97731
97732 -----------------------------------------------------------------------------------------
97733 -- 4262811 Multiperiod Accounting
97734 -----------------------------------------------------------------------------------------
97735 -- No MPA option is assigned.
97736
97737
97738 END IF;
97739 END IF;
97740 --
97741
97742 --
97743 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
97744 trace
97745 (p_msg => 'END of AcctLineType_300'
97746 ,p_level => C_LEVEL_PROCEDURE
97747 ,p_module => l_log_module);
97748 END IF;
97749 --
97750 EXCEPTION
97751 WHEN xla_exceptions_pkg.application_exception THEN
97752 RAISE;
97753 WHEN OTHERS THEN
97754 xla_exceptions_pkg.raise_message
97755 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_300');
97756 END AcctLineType_300;
97757 --
97758
97759 ---------------------------------------
97760 --
97761 -- PRIVATE FUNCTION
97762 -- AcctLineType_301
97763 --
97764 ---------------------------------------
97765 PROCEDURE AcctLineType_301 (
97766 p_application_id IN NUMBER
97767 ,p_event_id IN NUMBER
97768 ,p_calculate_acctd_flag IN VARCHAR2
97769 ,p_calculate_g_l_flag IN VARCHAR2
97770 ,p_actual_flag IN OUT VARCHAR2
97771 ,p_balance_type_code OUT VARCHAR2
97772 ,p_gain_or_loss_ref OUT VARCHAR2
97773
97774 --Period Close Date
97775 , p_source_1 IN DATE
97776 --Generated Code Combination Identifier
97777 , p_source_5 IN NUMBER
97778 --Depreciation Reserve Account
97779 , p_source_12 IN VARCHAR2
97780 --Generated Offset Code Combination Identifier
97781 , p_source_19 IN NUMBER
97782 --Expense Account Code Combination Identifier
97783 , p_source_31 IN NUMBER
97784 --Default Code Combination Identifier
97785 , p_source_32 IN NUMBER
97786 --Adjustment Type
97787 , p_source_48 IN VARCHAR2
97788 --Transaction Header Identifier
97789 , p_source_49 IN NUMBER
97790 --Adjustment Line Identifier
97791 , p_source_50 IN NUMBER
97792 --Distribution Type Code
97793 , p_source_51 IN VARCHAR2
97794 --Entered Amount
97795 , p_source_52 IN NUMBER
97796 --Currency Code
97797 , p_source_53 IN VARCHAR2
97798 --Source Destination Code
97799 , p_source_55 IN VARCHAR2
97800 )
97801 IS
97802
97803 l_component_type VARCHAR2(80);
97804 l_component_code VARCHAR2(30);
97805 l_component_type_code VARCHAR2(1);
97806 l_component_appl_id INTEGER;
97807 l_amb_context_code VARCHAR2(30);
97808 l_entity_code VARCHAR2(30);
97809 l_event_class_code VARCHAR2(30);
97810 l_ae_header_id NUMBER;
97811 l_event_type_code VARCHAR2(30);
97812 l_line_definition_code VARCHAR2(30);
97813 l_line_definition_owner_code VARCHAR2(1);
97814 --
97815 -- adr variables
97816 l_segment VARCHAR2(30);
97817 l_ccid NUMBER;
97818 l_adr_transaction_coa_id NUMBER;
97819 l_adr_accounting_coa_id NUMBER;
97820 l_adr_flexfield_segment_code VARCHAR2(30);
97821 l_adr_flex_value_set_id NUMBER;
97822 l_adr_value_type_code VARCHAR2(30);
97823 l_adr_value_combination_id NUMBER;
97824 l_adr_value_segment_code VARCHAR2(30);
97825
97826 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
97827 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
97828 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
97829 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
97830
97831 -- 4262811 Variables ------------------------------------------------------------------------------------------
97832 l_entered_amt_idx NUMBER;
97833 l_accted_amt_idx NUMBER;
97834 l_acc_rev_flag VARCHAR2(1);
97835 l_accrual_line_num NUMBER;
97836 l_tmp_amt NUMBER;
97837 l_acc_rev_natural_side_code VARCHAR2(1);
97838
97842 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
97839 l_num_entries NUMBER;
97840 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
97841 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
97843 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
97844 l_recog_line_1 NUMBER;
97845 l_recog_line_2 NUMBER;
97846
97847 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
97848 l_bflow_applied_to_amt NUMBER; -- 5132302
97849 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
97850
97851 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
97852
97853 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
97854 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
97855
97856 ---------------------------------------------------------------------------------------------------------------
97857
97858
97859 --
97860 -- bulk performance
97861 --
97862 l_balance_type_code VARCHAR2(1);
97863 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
97864 l_log_module VARCHAR2(240);
97865
97866 --
97867 -- Upgrade strategy
97868 --
97869 l_actual_upg_option VARCHAR2(1);
97870 l_enc_upg_option VARCHAR2(1);
97871
97872 --
97873 BEGIN
97874 --
97875 IF g_log_enabled THEN
97876 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_301';
97877 END IF;
97878 --
97879 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
97880
97881 trace
97882 (p_msg => 'BEGIN of AcctLineType_301'
97883 ,p_level => C_LEVEL_PROCEDURE
97884 ,p_module => l_log_module);
97885
97886 END IF;
97887 --
97888 l_component_type := 'AMB_JLT';
97889 l_component_code := 'FA_RECLASS_SOURCE_DEPRN_RESERV';
97890 l_component_type_code := 'S';
97891 l_component_appl_id := 140;
97892 l_amb_context_code := 'DEFAULT';
97893 l_entity_code := 'TRANSACTIONS';
97894 l_event_class_code := 'CATEGORY_RECLASS';
97895 l_event_type_code := 'CATEGORY_RECLASS_ALL';
97896 l_line_definition_owner_code := 'S';
97897 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
97898 --
97899 l_balance_type_code := 'A';
97900 l_segment := NULL;
97901 l_ccid := NULL;
97902 l_adr_transaction_coa_id := NULL;
97903 l_adr_accounting_coa_id := NULL;
97904 l_adr_flexfield_segment_code := NULL;
97905 l_adr_flex_value_set_id := NULL;
97906 l_adr_value_type_code := NULL;
97907 l_adr_value_combination_id := NULL;
97908 l_adr_value_segment_code := NULL;
97909
97910 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
97911 l_bflow_class_code := ''; -- 4219869 Business Flow
97912 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
97913 l_budgetary_control_flag := 'N';
97914
97915 l_bflow_applied_to_amt_idx := NULL; -- 5132302
97916 l_bflow_applied_to_amt := NULL; -- 5132302
97917 l_entered_amt_idx := NULL; -- 4262811
97918 l_accted_amt_idx := NULL; -- 4262811
97919 l_acc_rev_flag := NULL; -- 4262811
97920 l_accrual_line_num := NULL; -- 4262811
97921 l_tmp_amt := NULL; -- 4262811
97922 --
97923
97924 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
97925 l_balance_type_code <> 'B' THEN
97926 IF (NVL(p_source_48,'
97927 ') = 'EXPENSE' OR
97928 NVL(p_source_48,'
97929 ') = 'RESERVE') AND
97930 NVL(p_source_55,'
97931 ') = 'SOURCE'
97932 THEN
97933
97934 --
97935 XLA_AE_LINES_PKG.SetNewLine;
97936
97937 p_balance_type_code := l_balance_type_code;
97938 -- set the flag so later we will know whether the gain loss line needs to be created
97939
97940 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
97941 p_actual_flag :='A';
97942 END IF;
97943
97944 --
97945 -- bulk performance
97946 --
97947 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
97948 p_header_num => 0); -- 4262811
97949 --
97950 -- set accounting line options
97951 --
97952 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
97953 p_natural_side_code => 'D'
97954 , p_gain_or_loss_flag => 'N'
97955 , p_gl_transfer_mode_code => 'S'
97956 , p_acct_entry_type_code => 'A'
97957 , p_switch_side_flag => 'Y'
97958 , p_merge_duplicate_code => 'N'
97959 );
97960 --
97961 l_acc_rev_natural_side_code := 'C'; -- 4262811
97962 --
97963 --
97964 -- set accounting line type info
97965 --
97966 xla_ae_lines_pkg.SetAcctLineType
97967 (p_component_type => l_component_type
97968 ,p_event_type_code => l_event_type_code
97969 ,p_line_definition_owner_code => l_line_definition_owner_code
97970 ,p_line_definition_code => l_line_definition_code
97971 ,p_accounting_line_code => l_component_code
97975 ,p_entity_code => l_entity_code
97972 ,p_accounting_line_type_code => l_component_type_code
97973 ,p_accounting_line_appl_id => l_component_appl_id
97974 ,p_amb_context_code => l_amb_context_code
97976 ,p_event_class_code => l_event_class_code);
97977 --
97978 -- set accounting class
97979 --
97980 xla_ae_lines_pkg.SetAcctClass(
97981 p_accounting_class_code => 'ASSET'
97982 , p_ae_header_id => l_ae_header_id
97983 );
97984
97985 --
97986 -- set rounding class
97987 --
97988 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
97989 'ASSET';
97990
97991 --
97992 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
97993 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
97994 --
97995 -- bulk performance
97996 --
97997 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
97998
97999 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
98000 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
98001
98002 -- 4955764
98003 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
98004 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
98005
98006 -- 4458381 Public Sector Enh
98007
98008 --
98009 -- set accounting attributes for the line type
98010 --
98011 l_entered_amt_idx := 4;
98012 l_accted_amt_idx := 6;
98013 l_bflow_applied_to_amt_idx := NULL; -- 5132302
98014 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
98015 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
98016 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
98017 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
98018 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
98019 l_rec_acct_attrs.array_char_value(3) := p_source_51;
98020 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
98021 l_rec_acct_attrs.array_num_value(4) := p_source_52;
98022 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
98023 l_rec_acct_attrs.array_char_value(5) := p_source_53;
98024 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
98025 l_rec_acct_attrs.array_num_value(6) := p_source_52;
98026
98027 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
98028 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
98029
98030 ---------------------------------------------------------------------------------------------------------------
98031 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
98032 ---------------------------------------------------------------------------------------------------------------
98033 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
98034
98035 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
98036 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
98037
98038 IF xla_accounting_cache_pkg.GetValueChar
98039 (p_source_code => 'LEDGER_CATEGORY_CODE'
98040 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
98041 AND l_bflow_method_code = 'PRIOR_ENTRY'
98042 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
98043 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
98044 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
98045 )
98046 THEN
98047 xla_ae_lines_pkg.BflowUpgEntry
98048 (p_business_method_code => l_bflow_method_code
98049 ,p_business_class_code => l_bflow_class_code
98050 ,p_balance_type => l_balance_type_code);
98051 ELSE
98052 NULL;
98053 -- No business flow processing for business flow method of NONE.
98054 END IF;
98055
98056 --
98057 -- call analytical criteria
98058 --
98059
98060 --
98061 -- call description
98062 --
98063
98064 xla_ae_lines_pkg.SetLineDescription(
98065 p_ae_header_id => l_ae_header_id
98066 ,p_description => Description_67 (
98067 p_application_id => p_application_id
98068 , p_ae_header_id => l_ae_header_id
98069 , p_source_1 => p_source_1
98070 )
98071 );
98072
98073
98074 --
98075 -- call ADRs
98076 -- Bug 4922099
98077 --
98078 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
98079 (NVL(l_actual_upg_option, 'N') = 'O') OR
98080 (NVL(l_enc_upg_option, 'N') = 'O')
98081 )
98082 THEN
98083 NULL;
98084 --
98085 --
98086
98087 l_ccid := AcctDerRule_175(
98088 p_application_id => p_application_id
98089 , p_ae_header_id => l_ae_header_id
98090 , p_source_5 => p_source_5
98091 , p_source_19 => p_source_19
98092 , p_source_32 => p_source_32
98093 , x_transaction_coa_id => l_adr_transaction_coa_id
98097 );
98094 , x_accounting_coa_id => l_adr_accounting_coa_id
98095 , x_value_type_code => l_adr_value_type_code
98096 , p_side => 'NA'
98098
98099 xla_ae_lines_pkg.set_ccid(
98100 p_code_combination_id => l_ccid
98101 , p_value_type_code => l_adr_value_type_code
98102 , p_transaction_coa_id => l_adr_transaction_coa_id
98103 , p_accounting_coa_id => l_adr_accounting_coa_id
98104 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
98105 , p_adr_type_code => 'S'
98106 , p_component_type => l_component_type
98107 , p_component_code => l_component_code
98108 , p_component_type_code => l_component_type_code
98109 , p_component_appl_id => l_component_appl_id
98110 , p_amb_context_code => l_amb_context_code
98111 , p_side => 'NA'
98112 );
98113
98114
98115 l_segment := AcctDerRule_150(
98116 p_application_id => p_application_id
98117 , p_ae_header_id => l_ae_header_id
98118 , p_source_5 => p_source_5
98119 , p_source_12 => p_source_12
98120 , x_transaction_coa_id => l_adr_transaction_coa_id
98121 , x_accounting_coa_id => l_adr_accounting_coa_id
98122 , x_flexfield_segment_code => l_adr_flexfield_segment_code
98123 , x_flex_value_set_id => l_adr_flex_value_set_id
98124 , x_value_type_code => l_adr_value_type_code
98125 , x_value_combination_id => l_adr_value_combination_id
98126 , x_value_segment_code => l_adr_value_segment_code
98127 , p_side => 'NA'
98128 , p_override_seg_flag => 'Y'
98129 );
98130
98131 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
98132
98133 xla_ae_lines_pkg.set_segment(
98134 p_to_segment_code => 'GL_ACCOUNT'
98135 , p_segment_value => l_segment
98136 , p_from_segment_code => l_adr_value_segment_code
98137 , p_from_combination_id => l_adr_value_combination_id
98138 , p_value_type_code => l_adr_value_type_code
98139 , p_transaction_coa_id => l_adr_transaction_coa_id
98140 , p_accounting_coa_id => l_adr_accounting_coa_id
98141 , p_flexfield_segment_code => l_adr_flexfield_segment_code
98142 , p_flex_value_set_id => l_adr_flex_value_set_id
98143 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
98144 , p_adr_type_code => 'S'
98145 , p_component_type => l_component_type
98146 , p_component_code => l_component_code
98147 , p_component_type_code => l_component_type_code
98148 , p_component_appl_id => l_component_appl_id
98149 , p_amb_context_code => l_amb_context_code
98150 , p_entity_code => 'TRANSACTIONS'
98151 , p_event_class_code => 'CATEGORY_RECLASS'
98152 , p_side => 'NA'
98153 );
98154
98155 END IF;
98156
98157 l_segment := AcctDerRule_169(
98158 p_application_id => p_application_id
98159 , p_ae_header_id => l_ae_header_id
98160 , p_source_5 => p_source_5
98161 , p_source_31 => p_source_31
98162 , x_transaction_coa_id => l_adr_transaction_coa_id
98163 , x_accounting_coa_id => l_adr_accounting_coa_id
98164 , x_flexfield_segment_code => l_adr_flexfield_segment_code
98165 , x_flex_value_set_id => l_adr_flex_value_set_id
98166 , x_value_type_code => l_adr_value_type_code
98167 , x_value_combination_id => l_adr_value_combination_id
98168 , x_value_segment_code => l_adr_value_segment_code
98169 , p_side => 'NA'
98170 , p_override_seg_flag => 'Y'
98171 );
98172
98173 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
98174
98175 xla_ae_lines_pkg.set_segment(
98176 p_to_segment_code => 'GL_BALANCING'
98177 , p_segment_value => l_segment
98178 , p_from_segment_code => l_adr_value_segment_code
98179 , p_from_combination_id => l_adr_value_combination_id
98180 , p_value_type_code => l_adr_value_type_code
98181 , p_transaction_coa_id => l_adr_transaction_coa_id
98182 , p_accounting_coa_id => l_adr_accounting_coa_id
98183 , p_flexfield_segment_code => l_adr_flexfield_segment_code
98184 , p_flex_value_set_id => l_adr_flex_value_set_id
98185 , p_adr_code => 'FA_EXPENSE_ACCT'
98186 , p_adr_type_code => 'S'
98187 , p_component_type => l_component_type
98188 , p_component_code => l_component_code
98189 , p_component_type_code => l_component_type_code
98190 , p_component_appl_id => l_component_appl_id
98191 , p_amb_context_code => l_amb_context_code
98192 , p_entity_code => 'TRANSACTIONS'
98193 , p_event_class_code => 'CATEGORY_RECLASS'
98194 , p_side => 'NA'
98195 );
98196
98197 END IF;
98198
98199 --
98200 --
98201 END IF;
98202 --
98203 -- Bug 4922099
98207 (l_bflow_method_code = 'PRIOR_ENTRY')
98204 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
98205 (NVL(l_enc_upg_option, 'N') = 'O')
98206 ) AND
98208 )
98209 THEN
98210 IF
98211 --
98212 1 = 2
98213 --
98214 THEN
98215 xla_accounting_err_pkg.build_message
98216 (p_appli_s_name => 'XLA'
98217 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
98218 ,p_token_1 => 'LINE_NUMBER'
98219 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
98220 ,p_token_2 => 'LINE_TYPE_NAME'
98221 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
98222 l_component_type
98223 ,l_component_code
98224 ,l_component_type_code
98225 ,l_component_appl_id
98226 ,l_amb_context_code
98227 ,l_entity_code
98228 ,l_event_class_code
98229 )
98230 ,p_token_3 => 'OWNER'
98231 ,p_value_3 => xla_lookups_pkg.get_meaning(
98232 p_lookup_type => 'XLA_OWNER_TYPE'
98233 ,p_lookup_code => l_component_type_code
98234 )
98235 ,p_token_4 => 'PRODUCT_NAME'
98236 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
98237 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
98238 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
98239 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
98240 ,p_ae_header_id => NULL
98241 );
98242
98243 IF (C_LEVEL_ERROR>= g_log_level) THEN
98244 trace
98245 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
98246 ,p_level => C_LEVEL_ERROR
98247 ,p_module => l_log_module);
98248 END IF;
98249 END IF;
98250 END IF;
98251 --
98252 --
98253 ------------------------------------------------------------------------------------------------
98254 -- 4219869 Business Flow
98255 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
98256 -- Prior Entry. Currently, the following code is always generated.
98257 ------------------------------------------------------------------------------------------------
98258 XLA_AE_LINES_PKG.ValidateCurrentLine;
98259
98260 ------------------------------------------------------------------------------------
98261 -- 4219869 Business Flow
98262 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
98263 ------------------------------------------------------------------------------------
98264 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
98265
98266 ----------------------------------------------------------------------------------
98267 -- 4219869 Business Flow
98268 -- Update journal entry status -- Need to generate this within IF <condition>
98269 ----------------------------------------------------------------------------------
98270 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
98271 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
98272 ,p_balance_type_code => l_balance_type_code
98273 );
98274
98275 -------------------------------------------------------------------------------------------
98276 -- 4262811 - Generate the Accrual Reversal lines
98277 -------------------------------------------------------------------------------------------
98278 BEGIN
98279 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
98280 (g_array_event(p_event_id).array_value_num('header_index'));
98281 IF l_acc_rev_flag IS NULL THEN
98282 l_acc_rev_flag := 'N';
98283 END IF;
98284 EXCEPTION
98285 WHEN OTHERS THEN
98286 l_acc_rev_flag := 'N';
98287 END;
98288 --
98289 IF (l_acc_rev_flag = 'Y') THEN
98290
98291 -- 4645092 ------------------------------------------------------------------------------
98292 -- To allow MPA report to determine if it should generate report process
98293 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
98294 ------------------------------------------------------------------------------------------
98295
98299 -- call ADRs
98296 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
98297 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
98298 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
98300 -- Bug 4922099
98301 --
98302 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
98303 (NVL(l_actual_upg_option, 'N') = 'O') OR
98304 (NVL(l_enc_upg_option, 'N') = 'O')
98305 )
98306 THEN
98307 NULL;
98308 --
98309 --
98310
98311 l_ccid := AcctDerRule_175(
98312 p_application_id => p_application_id
98313 , p_ae_header_id => l_ae_header_id
98314 , p_source_5 => p_source_5
98315 , p_source_19 => p_source_19
98316 , p_source_32 => p_source_32
98317 , x_transaction_coa_id => l_adr_transaction_coa_id
98318 , x_accounting_coa_id => l_adr_accounting_coa_id
98319 , x_value_type_code => l_adr_value_type_code
98320 , p_side => 'NA'
98321 );
98322
98323 xla_ae_lines_pkg.set_ccid(
98324 p_code_combination_id => l_ccid
98325 , p_value_type_code => l_adr_value_type_code
98326 , p_transaction_coa_id => l_adr_transaction_coa_id
98327 , p_accounting_coa_id => l_adr_accounting_coa_id
98328 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
98329 , p_adr_type_code => 'S'
98330 , p_component_type => l_component_type
98331 , p_component_code => l_component_code
98332 , p_component_type_code => l_component_type_code
98333 , p_component_appl_id => l_component_appl_id
98334 , p_amb_context_code => l_amb_context_code
98335 , p_side => 'NA'
98336 );
98337
98338
98339 l_segment := AcctDerRule_150(
98340 p_application_id => p_application_id
98341 , p_ae_header_id => l_ae_header_id
98342 , p_source_5 => p_source_5
98343 , p_source_12 => p_source_12
98344 , x_transaction_coa_id => l_adr_transaction_coa_id
98345 , x_accounting_coa_id => l_adr_accounting_coa_id
98346 , x_flexfield_segment_code => l_adr_flexfield_segment_code
98347 , x_flex_value_set_id => l_adr_flex_value_set_id
98348 , x_value_type_code => l_adr_value_type_code
98349 , x_value_combination_id => l_adr_value_combination_id
98350 , x_value_segment_code => l_adr_value_segment_code
98351 , p_side => 'NA'
98352 , p_override_seg_flag => 'Y'
98353 );
98354
98355 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
98356
98357 xla_ae_lines_pkg.set_segment(
98358 p_to_segment_code => 'GL_ACCOUNT'
98359 , p_segment_value => l_segment
98360 , p_from_segment_code => l_adr_value_segment_code
98361 , p_from_combination_id => l_adr_value_combination_id
98362 , p_value_type_code => l_adr_value_type_code
98363 , p_transaction_coa_id => l_adr_transaction_coa_id
98364 , p_accounting_coa_id => l_adr_accounting_coa_id
98365 , p_flexfield_segment_code => l_adr_flexfield_segment_code
98366 , p_flex_value_set_id => l_adr_flex_value_set_id
98367 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
98368 , p_adr_type_code => 'S'
98369 , p_component_type => l_component_type
98370 , p_component_code => l_component_code
98371 , p_component_type_code => l_component_type_code
98372 , p_component_appl_id => l_component_appl_id
98373 , p_amb_context_code => l_amb_context_code
98374 , p_entity_code => 'TRANSACTIONS'
98375 , p_event_class_code => 'CATEGORY_RECLASS'
98376 , p_side => 'NA'
98377 );
98378
98379 END IF;
98380
98381 l_segment := AcctDerRule_169(
98382 p_application_id => p_application_id
98383 , p_ae_header_id => l_ae_header_id
98384 , p_source_5 => p_source_5
98385 , p_source_31 => p_source_31
98386 , x_transaction_coa_id => l_adr_transaction_coa_id
98387 , x_accounting_coa_id => l_adr_accounting_coa_id
98388 , x_flexfield_segment_code => l_adr_flexfield_segment_code
98389 , x_flex_value_set_id => l_adr_flex_value_set_id
98390 , x_value_type_code => l_adr_value_type_code
98391 , x_value_combination_id => l_adr_value_combination_id
98392 , x_value_segment_code => l_adr_value_segment_code
98393 , p_side => 'NA'
98394 , p_override_seg_flag => 'Y'
98395 );
98396
98397 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
98398
98399 xla_ae_lines_pkg.set_segment(
98400 p_to_segment_code => 'GL_BALANCING'
98401 , p_segment_value => l_segment
98402 , p_from_segment_code => l_adr_value_segment_code
98403 , p_from_combination_id => l_adr_value_combination_id
98404 , p_value_type_code => l_adr_value_type_code
98405 , p_transaction_coa_id => l_adr_transaction_coa_id
98406 , p_accounting_coa_id => l_adr_accounting_coa_id
98407 , p_flexfield_segment_code => l_adr_flexfield_segment_code
98408 , p_flex_value_set_id => l_adr_flex_value_set_id
98412 , p_component_code => l_component_code
98409 , p_adr_code => 'FA_EXPENSE_ACCT'
98410 , p_adr_type_code => 'S'
98411 , p_component_type => l_component_type
98413 , p_component_type_code => l_component_type_code
98414 , p_component_appl_id => l_component_appl_id
98415 , p_amb_context_code => l_amb_context_code
98416 , p_entity_code => 'TRANSACTIONS'
98417 , p_event_class_code => 'CATEGORY_RECLASS'
98418 , p_side => 'NA'
98419 );
98420
98421 END IF;
98422
98423 --
98424 --
98425 END IF;
98426
98427 --
98428 -- Update the line information that should be overwritten
98429 --
98430 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
98431 p_header_num => 1);
98432 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
98433
98434 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
98435
98436 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
98437 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
98438 END IF;
98439
98440 --
98441 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
98442 --
98443 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
98444 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
98445 ELSE
98446 ---------------------------------------------------------------------------------------------------
98447 -- 4262811a Switch Sign
98448 ---------------------------------------------------------------------------------------------------
98449 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
98450 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
98451 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
98452 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
98453 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
98454 -- 5132302
98455 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
98456 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
98457
98458 END IF;
98459
98460 -- 4955764
98461 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
98462 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
98463
98464
98465 XLA_AE_LINES_PKG.ValidateCurrentLine;
98466 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
98467
98468 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
98469 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
98470 ,p_balance_type_code => l_balance_type_code);
98471
98472 END IF;
98473
98474 -----------------------------------------------------------------------------------------
98475 -- 4262811 Multiperiod Accounting
98476 -----------------------------------------------------------------------------------------
98477 -- No MPA option is assigned.
98478
98479
98480 END IF;
98481 END IF;
98482 --
98483
98484 --
98485 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
98486 trace
98487 (p_msg => 'END of AcctLineType_301'
98488 ,p_level => C_LEVEL_PROCEDURE
98489 ,p_module => l_log_module);
98490 END IF;
98491 --
98492 EXCEPTION
98493 WHEN xla_exceptions_pkg.application_exception THEN
98494 RAISE;
98495 WHEN OTHERS THEN
98496 xla_exceptions_pkg.raise_message
98497 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_301');
98498 END AcctLineType_301;
98499 --
98500
98501 ---------------------------------------
98502 --
98503 -- PRIVATE FUNCTION
98504 -- AcctLineType_302
98505 --
98506 ---------------------------------------
98507 PROCEDURE AcctLineType_302 (
98508 p_application_id IN NUMBER
98509 ,p_event_id IN NUMBER
98510 ,p_calculate_acctd_flag IN VARCHAR2
98511 ,p_calculate_g_l_flag IN VARCHAR2
98512 ,p_actual_flag IN OUT VARCHAR2
98513 ,p_balance_type_code OUT VARCHAR2
98514 ,p_gain_or_loss_ref OUT VARCHAR2
98515
98516 --Period Close Date
98517 , p_source_1 IN DATE
98518 --Generated Code Combination Identifier
98519 , p_source_5 IN NUMBER
98520 --Revaluation Reserve Account
98521 , p_source_13 IN VARCHAR2
98522 --Generated Offset Code Combination Identifier
98523 , p_source_19 IN NUMBER
98524 --Expense Account Code Combination Identifier
98525 , p_source_31 IN NUMBER
98526 --Default Code Combination Identifier
98527 , p_source_32 IN NUMBER
98528 --Adjustment Type
98529 , p_source_48 IN VARCHAR2
98530 --Transaction Header Identifier
98534 --Distribution Type Code
98531 , p_source_49 IN NUMBER
98532 --Adjustment Line Identifier
98533 , p_source_50 IN NUMBER
98535 , p_source_51 IN VARCHAR2
98536 --Entered Amount
98537 , p_source_52 IN NUMBER
98538 --Currency Code
98539 , p_source_53 IN VARCHAR2
98540 --Source Destination Code
98541 , p_source_55 IN VARCHAR2
98542 )
98543 IS
98544
98545 l_component_type VARCHAR2(80);
98546 l_component_code VARCHAR2(30);
98547 l_component_type_code VARCHAR2(1);
98548 l_component_appl_id INTEGER;
98549 l_amb_context_code VARCHAR2(30);
98550 l_entity_code VARCHAR2(30);
98551 l_event_class_code VARCHAR2(30);
98552 l_ae_header_id NUMBER;
98553 l_event_type_code VARCHAR2(30);
98554 l_line_definition_code VARCHAR2(30);
98555 l_line_definition_owner_code VARCHAR2(1);
98556 --
98557 -- adr variables
98558 l_segment VARCHAR2(30);
98559 l_ccid NUMBER;
98560 l_adr_transaction_coa_id NUMBER;
98561 l_adr_accounting_coa_id NUMBER;
98562 l_adr_flexfield_segment_code VARCHAR2(30);
98563 l_adr_flex_value_set_id NUMBER;
98564 l_adr_value_type_code VARCHAR2(30);
98565 l_adr_value_combination_id NUMBER;
98566 l_adr_value_segment_code VARCHAR2(30);
98567
98568 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
98569 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
98570 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
98571 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
98572
98573 -- 4262811 Variables ------------------------------------------------------------------------------------------
98574 l_entered_amt_idx NUMBER;
98575 l_accted_amt_idx NUMBER;
98576 l_acc_rev_flag VARCHAR2(1);
98577 l_accrual_line_num NUMBER;
98578 l_tmp_amt NUMBER;
98579 l_acc_rev_natural_side_code VARCHAR2(1);
98580
98581 l_num_entries NUMBER;
98582 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
98583 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
98584 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
98585 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
98586 l_recog_line_1 NUMBER;
98587 l_recog_line_2 NUMBER;
98588
98589 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
98590 l_bflow_applied_to_amt NUMBER; -- 5132302
98591 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
98592
98593 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
98594
98595 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
98596 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
98597
98598 ---------------------------------------------------------------------------------------------------------------
98599
98600
98601 --
98602 -- bulk performance
98603 --
98604 l_balance_type_code VARCHAR2(1);
98605 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
98606 l_log_module VARCHAR2(240);
98607
98608 --
98609 -- Upgrade strategy
98610 --
98611 l_actual_upg_option VARCHAR2(1);
98612 l_enc_upg_option VARCHAR2(1);
98613
98614 --
98615 BEGIN
98616 --
98617 IF g_log_enabled THEN
98618 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_302';
98619 END IF;
98620 --
98621 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
98622
98623 trace
98624 (p_msg => 'BEGIN of AcctLineType_302'
98625 ,p_level => C_LEVEL_PROCEDURE
98626 ,p_module => l_log_module);
98627
98628 END IF;
98629 --
98630 l_component_type := 'AMB_JLT';
98631 l_component_code := 'FA_RECLASS_SOURCE_REVAL_RESERV';
98632 l_component_type_code := 'S';
98633 l_component_appl_id := 140;
98634 l_amb_context_code := 'DEFAULT';
98635 l_entity_code := 'TRANSACTIONS';
98636 l_event_class_code := 'CATEGORY_RECLASS';
98637 l_event_type_code := 'CATEGORY_RECLASS_ALL';
98638 l_line_definition_owner_code := 'S';
98639 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CATEGO4';
98640 --
98641 l_balance_type_code := 'A';
98642 l_segment := NULL;
98643 l_ccid := NULL;
98644 l_adr_transaction_coa_id := NULL;
98645 l_adr_accounting_coa_id := NULL;
98646 l_adr_flexfield_segment_code := NULL;
98647 l_adr_flex_value_set_id := NULL;
98648 l_adr_value_type_code := NULL;
98649 l_adr_value_combination_id := NULL;
98650 l_adr_value_segment_code := NULL;
98651
98652 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
98653 l_bflow_class_code := ''; -- 4219869 Business Flow
98654 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
98655 l_budgetary_control_flag := 'N';
98656
98657 l_bflow_applied_to_amt_idx := NULL; -- 5132302
98658 l_bflow_applied_to_amt := NULL; -- 5132302
98662 l_accrual_line_num := NULL; -- 4262811
98659 l_entered_amt_idx := NULL; -- 4262811
98660 l_accted_amt_idx := NULL; -- 4262811
98661 l_acc_rev_flag := NULL; -- 4262811
98663 l_tmp_amt := NULL; -- 4262811
98664 --
98665
98666 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
98667 l_balance_type_code <> 'B' THEN
98668 IF NVL(p_source_48,'
98669 ') = 'REVAL RESERVE' AND
98670 NVL(p_source_55,'
98671 ') = 'SOURCE'
98672 THEN
98673
98674 --
98675 XLA_AE_LINES_PKG.SetNewLine;
98676
98677 p_balance_type_code := l_balance_type_code;
98678 -- set the flag so later we will know whether the gain loss line needs to be created
98679
98680 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
98681 p_actual_flag :='A';
98682 END IF;
98683
98684 --
98685 -- bulk performance
98686 --
98687 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
98688 p_header_num => 0); -- 4262811
98689 --
98690 -- set accounting line options
98691 --
98692 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
98693 p_natural_side_code => 'D'
98694 , p_gain_or_loss_flag => 'N'
98695 , p_gl_transfer_mode_code => 'S'
98696 , p_acct_entry_type_code => 'A'
98697 , p_switch_side_flag => 'Y'
98698 , p_merge_duplicate_code => 'N'
98699 );
98700 --
98701 l_acc_rev_natural_side_code := 'C'; -- 4262811
98702 --
98703 --
98704 -- set accounting line type info
98705 --
98706 xla_ae_lines_pkg.SetAcctLineType
98707 (p_component_type => l_component_type
98708 ,p_event_type_code => l_event_type_code
98709 ,p_line_definition_owner_code => l_line_definition_owner_code
98710 ,p_line_definition_code => l_line_definition_code
98711 ,p_accounting_line_code => l_component_code
98712 ,p_accounting_line_type_code => l_component_type_code
98713 ,p_accounting_line_appl_id => l_component_appl_id
98714 ,p_amb_context_code => l_amb_context_code
98715 ,p_entity_code => l_entity_code
98716 ,p_event_class_code => l_event_class_code);
98717 --
98718 -- set accounting class
98719 --
98720 xla_ae_lines_pkg.SetAcctClass(
98721 p_accounting_class_code => 'ASSET'
98722 , p_ae_header_id => l_ae_header_id
98723 );
98724
98725 --
98726 -- set rounding class
98727 --
98728 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
98729 'ASSET';
98730
98731 --
98732 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
98733 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
98734 --
98735 -- bulk performance
98736 --
98737 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
98738
98739 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
98740 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
98741
98742 -- 4955764
98743 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
98744 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
98745
98746 -- 4458381 Public Sector Enh
98747
98748 --
98749 -- set accounting attributes for the line type
98750 --
98751 l_entered_amt_idx := 4;
98752 l_accted_amt_idx := 6;
98753 l_bflow_applied_to_amt_idx := NULL; -- 5132302
98754 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
98755 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
98756 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
98757 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
98758 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
98759 l_rec_acct_attrs.array_char_value(3) := p_source_51;
98760 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
98761 l_rec_acct_attrs.array_num_value(4) := p_source_52;
98762 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
98763 l_rec_acct_attrs.array_char_value(5) := p_source_53;
98764 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
98765 l_rec_acct_attrs.array_num_value(6) := p_source_52;
98766
98767 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
98768 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
98769
98770 ---------------------------------------------------------------------------------------------------------------
98771 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
98772 ---------------------------------------------------------------------------------------------------------------
98773 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
98774
98778 IF xla_accounting_cache_pkg.GetValueChar
98775 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
98776 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
98777
98779 (p_source_code => 'LEDGER_CATEGORY_CODE'
98780 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
98781 AND l_bflow_method_code = 'PRIOR_ENTRY'
98782 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
98783 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
98784 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
98785 )
98786 THEN
98787 xla_ae_lines_pkg.BflowUpgEntry
98788 (p_business_method_code => l_bflow_method_code
98789 ,p_business_class_code => l_bflow_class_code
98790 ,p_balance_type => l_balance_type_code);
98791 ELSE
98792 NULL;
98793 -- No business flow processing for business flow method of NONE.
98794 END IF;
98795
98796 --
98797 -- call analytical criteria
98798 --
98799
98800 --
98801 -- call description
98802 --
98803
98804 xla_ae_lines_pkg.SetLineDescription(
98805 p_ae_header_id => l_ae_header_id
98806 ,p_description => Description_68 (
98807 p_application_id => p_application_id
98808 , p_ae_header_id => l_ae_header_id
98809 , p_source_1 => p_source_1
98810 )
98811 );
98812
98813
98814 --
98815 -- call ADRs
98816 -- Bug 4922099
98817 --
98818 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
98819 (NVL(l_actual_upg_option, 'N') = 'O') OR
98820 (NVL(l_enc_upg_option, 'N') = 'O')
98821 )
98822 THEN
98823 NULL;
98824 --
98825 --
98826
98827 l_ccid := AcctDerRule_175(
98828 p_application_id => p_application_id
98829 , p_ae_header_id => l_ae_header_id
98830 , p_source_5 => p_source_5
98831 , p_source_19 => p_source_19
98832 , p_source_32 => p_source_32
98833 , x_transaction_coa_id => l_adr_transaction_coa_id
98834 , x_accounting_coa_id => l_adr_accounting_coa_id
98835 , x_value_type_code => l_adr_value_type_code
98836 , p_side => 'NA'
98837 );
98838
98839 xla_ae_lines_pkg.set_ccid(
98840 p_code_combination_id => l_ccid
98841 , p_value_type_code => l_adr_value_type_code
98842 , p_transaction_coa_id => l_adr_transaction_coa_id
98843 , p_accounting_coa_id => l_adr_accounting_coa_id
98844 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
98845 , p_adr_type_code => 'S'
98846 , p_component_type => l_component_type
98847 , p_component_code => l_component_code
98848 , p_component_type_code => l_component_type_code
98849 , p_component_appl_id => l_component_appl_id
98850 , p_amb_context_code => l_amb_context_code
98851 , p_side => 'NA'
98852 );
98853
98854
98855 l_segment := AcctDerRule_151(
98856 p_application_id => p_application_id
98857 , p_ae_header_id => l_ae_header_id
98858 , p_source_5 => p_source_5
98859 , p_source_13 => p_source_13
98860 , x_transaction_coa_id => l_adr_transaction_coa_id
98861 , x_accounting_coa_id => l_adr_accounting_coa_id
98862 , x_flexfield_segment_code => l_adr_flexfield_segment_code
98863 , x_flex_value_set_id => l_adr_flex_value_set_id
98864 , x_value_type_code => l_adr_value_type_code
98865 , x_value_combination_id => l_adr_value_combination_id
98866 , x_value_segment_code => l_adr_value_segment_code
98867 , p_side => 'NA'
98868 , p_override_seg_flag => 'Y'
98869 );
98870
98871 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
98872
98873 xla_ae_lines_pkg.set_segment(
98874 p_to_segment_code => 'GL_ACCOUNT'
98875 , p_segment_value => l_segment
98876 , p_from_segment_code => l_adr_value_segment_code
98877 , p_from_combination_id => l_adr_value_combination_id
98878 , p_value_type_code => l_adr_value_type_code
98879 , p_transaction_coa_id => l_adr_transaction_coa_id
98880 , p_accounting_coa_id => l_adr_accounting_coa_id
98881 , p_flexfield_segment_code => l_adr_flexfield_segment_code
98882 , p_flex_value_set_id => l_adr_flex_value_set_id
98883 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
98884 , p_adr_type_code => 'S'
98885 , p_component_type => l_component_type
98886 , p_component_code => l_component_code
98887 , p_component_type_code => l_component_type_code
98888 , p_component_appl_id => l_component_appl_id
98889 , p_amb_context_code => l_amb_context_code
98890 , p_entity_code => 'TRANSACTIONS'
98891 , p_event_class_code => 'CATEGORY_RECLASS'
98892 , p_side => 'NA'
98893 );
98894
98895 END IF;
98896
98897 l_segment := AcctDerRule_169(
98898 p_application_id => p_application_id
98902 , x_transaction_coa_id => l_adr_transaction_coa_id
98899 , p_ae_header_id => l_ae_header_id
98900 , p_source_5 => p_source_5
98901 , p_source_31 => p_source_31
98903 , x_accounting_coa_id => l_adr_accounting_coa_id
98904 , x_flexfield_segment_code => l_adr_flexfield_segment_code
98905 , x_flex_value_set_id => l_adr_flex_value_set_id
98906 , x_value_type_code => l_adr_value_type_code
98907 , x_value_combination_id => l_adr_value_combination_id
98908 , x_value_segment_code => l_adr_value_segment_code
98909 , p_side => 'NA'
98910 , p_override_seg_flag => 'Y'
98911 );
98912
98913 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
98914
98915 xla_ae_lines_pkg.set_segment(
98916 p_to_segment_code => 'GL_BALANCING'
98917 , p_segment_value => l_segment
98918 , p_from_segment_code => l_adr_value_segment_code
98919 , p_from_combination_id => l_adr_value_combination_id
98920 , p_value_type_code => l_adr_value_type_code
98921 , p_transaction_coa_id => l_adr_transaction_coa_id
98922 , p_accounting_coa_id => l_adr_accounting_coa_id
98923 , p_flexfield_segment_code => l_adr_flexfield_segment_code
98924 , p_flex_value_set_id => l_adr_flex_value_set_id
98925 , p_adr_code => 'FA_EXPENSE_ACCT'
98926 , p_adr_type_code => 'S'
98927 , p_component_type => l_component_type
98928 , p_component_code => l_component_code
98929 , p_component_type_code => l_component_type_code
98930 , p_component_appl_id => l_component_appl_id
98931 , p_amb_context_code => l_amb_context_code
98932 , p_entity_code => 'TRANSACTIONS'
98933 , p_event_class_code => 'CATEGORY_RECLASS'
98934 , p_side => 'NA'
98935 );
98936
98937 END IF;
98938
98939 --
98940 --
98941 END IF;
98942 --
98943 -- Bug 4922099
98944 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
98945 (NVL(l_enc_upg_option, 'N') = 'O')
98946 ) AND
98947 (l_bflow_method_code = 'PRIOR_ENTRY')
98948 )
98949 THEN
98950 IF
98951 --
98952 1 = 2
98953 --
98954 THEN
98955 xla_accounting_err_pkg.build_message
98956 (p_appli_s_name => 'XLA'
98957 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
98958 ,p_token_1 => 'LINE_NUMBER'
98959 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
98960 ,p_token_2 => 'LINE_TYPE_NAME'
98961 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
98962 l_component_type
98963 ,l_component_code
98964 ,l_component_type_code
98965 ,l_component_appl_id
98966 ,l_amb_context_code
98967 ,l_entity_code
98968 ,l_event_class_code
98969 )
98970 ,p_token_3 => 'OWNER'
98971 ,p_value_3 => xla_lookups_pkg.get_meaning(
98972 p_lookup_type => 'XLA_OWNER_TYPE'
98973 ,p_lookup_code => l_component_type_code
98974 )
98975 ,p_token_4 => 'PRODUCT_NAME'
98976 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
98977 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
98978 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
98979 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
98980 ,p_ae_header_id => NULL
98981 );
98982
98983 IF (C_LEVEL_ERROR>= g_log_level) THEN
98984 trace
98985 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
98986 ,p_level => C_LEVEL_ERROR
98987 ,p_module => l_log_module);
98988 END IF;
98989 END IF;
98990 END IF;
98991 --
98992 --
98993 ------------------------------------------------------------------------------------------------
98994 -- 4219869 Business Flow
98995 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
98996 -- Prior Entry. Currently, the following code is always generated.
99000 ------------------------------------------------------------------------------------
98997 ------------------------------------------------------------------------------------------------
98998 XLA_AE_LINES_PKG.ValidateCurrentLine;
98999
99001 -- 4219869 Business Flow
99002 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
99003 ------------------------------------------------------------------------------------
99004 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
99005
99006 ----------------------------------------------------------------------------------
99007 -- 4219869 Business Flow
99008 -- Update journal entry status -- Need to generate this within IF <condition>
99009 ----------------------------------------------------------------------------------
99010 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
99011 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
99012 ,p_balance_type_code => l_balance_type_code
99013 );
99014
99015 -------------------------------------------------------------------------------------------
99016 -- 4262811 - Generate the Accrual Reversal lines
99017 -------------------------------------------------------------------------------------------
99018 BEGIN
99019 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
99020 (g_array_event(p_event_id).array_value_num('header_index'));
99021 IF l_acc_rev_flag IS NULL THEN
99022 l_acc_rev_flag := 'N';
99023 END IF;
99024 EXCEPTION
99025 WHEN OTHERS THEN
99026 l_acc_rev_flag := 'N';
99027 END;
99028 --
99029 IF (l_acc_rev_flag = 'Y') THEN
99030
99031 -- 4645092 ------------------------------------------------------------------------------
99032 -- To allow MPA report to determine if it should generate report process
99033 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
99034 ------------------------------------------------------------------------------------------
99035
99036 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
99037 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
99038 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
99039 -- call ADRs
99040 -- Bug 4922099
99041 --
99042 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
99043 (NVL(l_actual_upg_option, 'N') = 'O') OR
99044 (NVL(l_enc_upg_option, 'N') = 'O')
99045 )
99046 THEN
99047 NULL;
99048 --
99049 --
99050
99051 l_ccid := AcctDerRule_175(
99052 p_application_id => p_application_id
99053 , p_ae_header_id => l_ae_header_id
99054 , p_source_5 => p_source_5
99055 , p_source_19 => p_source_19
99056 , p_source_32 => p_source_32
99057 , x_transaction_coa_id => l_adr_transaction_coa_id
99058 , x_accounting_coa_id => l_adr_accounting_coa_id
99059 , x_value_type_code => l_adr_value_type_code
99060 , p_side => 'NA'
99061 );
99062
99063 xla_ae_lines_pkg.set_ccid(
99064 p_code_combination_id => l_ccid
99065 , p_value_type_code => l_adr_value_type_code
99066 , p_transaction_coa_id => l_adr_transaction_coa_id
99067 , p_accounting_coa_id => l_adr_accounting_coa_id
99068 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
99069 , p_adr_type_code => 'S'
99070 , p_component_type => l_component_type
99071 , p_component_code => l_component_code
99072 , p_component_type_code => l_component_type_code
99073 , p_component_appl_id => l_component_appl_id
99074 , p_amb_context_code => l_amb_context_code
99075 , p_side => 'NA'
99076 );
99077
99078
99079 l_segment := AcctDerRule_151(
99080 p_application_id => p_application_id
99081 , p_ae_header_id => l_ae_header_id
99082 , p_source_5 => p_source_5
99083 , p_source_13 => p_source_13
99084 , x_transaction_coa_id => l_adr_transaction_coa_id
99085 , x_accounting_coa_id => l_adr_accounting_coa_id
99086 , x_flexfield_segment_code => l_adr_flexfield_segment_code
99087 , x_flex_value_set_id => l_adr_flex_value_set_id
99088 , x_value_type_code => l_adr_value_type_code
99089 , x_value_combination_id => l_adr_value_combination_id
99090 , x_value_segment_code => l_adr_value_segment_code
99091 , p_side => 'NA'
99092 , p_override_seg_flag => 'Y'
99093 );
99094
99095 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
99096
99097 xla_ae_lines_pkg.set_segment(
99098 p_to_segment_code => 'GL_ACCOUNT'
99099 , p_segment_value => l_segment
99100 , p_from_segment_code => l_adr_value_segment_code
99101 , p_from_combination_id => l_adr_value_combination_id
99102 , p_value_type_code => l_adr_value_type_code
99103 , p_transaction_coa_id => l_adr_transaction_coa_id
99104 , p_accounting_coa_id => l_adr_accounting_coa_id
99105 , p_flexfield_segment_code => l_adr_flexfield_segment_code
99106 , p_flex_value_set_id => l_adr_flex_value_set_id
99110 , p_component_code => l_component_code
99107 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
99108 , p_adr_type_code => 'S'
99109 , p_component_type => l_component_type
99111 , p_component_type_code => l_component_type_code
99112 , p_component_appl_id => l_component_appl_id
99113 , p_amb_context_code => l_amb_context_code
99114 , p_entity_code => 'TRANSACTIONS'
99115 , p_event_class_code => 'CATEGORY_RECLASS'
99116 , p_side => 'NA'
99117 );
99118
99119 END IF;
99120
99121 l_segment := AcctDerRule_169(
99122 p_application_id => p_application_id
99123 , p_ae_header_id => l_ae_header_id
99124 , p_source_5 => p_source_5
99125 , p_source_31 => p_source_31
99126 , x_transaction_coa_id => l_adr_transaction_coa_id
99127 , x_accounting_coa_id => l_adr_accounting_coa_id
99128 , x_flexfield_segment_code => l_adr_flexfield_segment_code
99129 , x_flex_value_set_id => l_adr_flex_value_set_id
99130 , x_value_type_code => l_adr_value_type_code
99131 , x_value_combination_id => l_adr_value_combination_id
99132 , x_value_segment_code => l_adr_value_segment_code
99133 , p_side => 'NA'
99134 , p_override_seg_flag => 'Y'
99135 );
99136
99137 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
99138
99139 xla_ae_lines_pkg.set_segment(
99140 p_to_segment_code => 'GL_BALANCING'
99141 , p_segment_value => l_segment
99142 , p_from_segment_code => l_adr_value_segment_code
99143 , p_from_combination_id => l_adr_value_combination_id
99144 , p_value_type_code => l_adr_value_type_code
99145 , p_transaction_coa_id => l_adr_transaction_coa_id
99146 , p_accounting_coa_id => l_adr_accounting_coa_id
99147 , p_flexfield_segment_code => l_adr_flexfield_segment_code
99148 , p_flex_value_set_id => l_adr_flex_value_set_id
99149 , p_adr_code => 'FA_EXPENSE_ACCT'
99150 , p_adr_type_code => 'S'
99151 , p_component_type => l_component_type
99152 , p_component_code => l_component_code
99153 , p_component_type_code => l_component_type_code
99154 , p_component_appl_id => l_component_appl_id
99155 , p_amb_context_code => l_amb_context_code
99156 , p_entity_code => 'TRANSACTIONS'
99157 , p_event_class_code => 'CATEGORY_RECLASS'
99158 , p_side => 'NA'
99159 );
99160
99161 END IF;
99162
99163 --
99164 --
99165 END IF;
99166
99167 --
99168 -- Update the line information that should be overwritten
99169 --
99170 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
99171 p_header_num => 1);
99172 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
99173
99174 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
99175
99176 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
99177 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
99178 END IF;
99179
99180 --
99181 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
99182 --
99183 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
99184 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
99185 ELSE
99186 ---------------------------------------------------------------------------------------------------
99187 -- 4262811a Switch Sign
99188 ---------------------------------------------------------------------------------------------------
99189 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
99190 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
99191 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
99192 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
99193 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
99194 -- 5132302
99195 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
99196 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
99197
99198 END IF;
99199
99200 -- 4955764
99201 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
99202 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
99203
99204
99205 XLA_AE_LINES_PKG.ValidateCurrentLine;
99206 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
99207
99208 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
99209 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
99213
99210 ,p_balance_type_code => l_balance_type_code);
99211
99212 END IF;
99214 -----------------------------------------------------------------------------------------
99215 -- 4262811 Multiperiod Accounting
99216 -----------------------------------------------------------------------------------------
99217 -- No MPA option is assigned.
99218
99219
99220 END IF;
99221 END IF;
99222 --
99223
99224 --
99225 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
99226 trace
99227 (p_msg => 'END of AcctLineType_302'
99228 ,p_level => C_LEVEL_PROCEDURE
99229 ,p_module => l_log_module);
99230 END IF;
99231 --
99232 EXCEPTION
99233 WHEN xla_exceptions_pkg.application_exception THEN
99234 RAISE;
99235 WHEN OTHERS THEN
99236 xla_exceptions_pkg.raise_message
99237 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_302');
99238 END AcctLineType_302;
99239 --
99240
99241 ---------------------------------------
99242 --
99243 -- PRIVATE FUNCTION
99244 -- AcctLineType_303
99245 --
99246 ---------------------------------------
99247 PROCEDURE AcctLineType_303 (
99248 p_application_id IN NUMBER
99249 ,p_event_id IN NUMBER
99250 ,p_calculate_acctd_flag IN VARCHAR2
99251 ,p_calculate_g_l_flag IN VARCHAR2
99252 ,p_actual_flag IN OUT VARCHAR2
99253 ,p_balance_type_code OUT VARCHAR2
99254 ,p_gain_or_loss_ref OUT VARCHAR2
99255
99256 --Period Close Date
99257 , p_source_1 IN DATE
99258 --Generated Code Combination Identifier
99259 , p_source_5 IN NUMBER
99260 --Intercompany Payables Account
99261 , p_source_21 IN VARCHAR2
99262 --Expense Account Code Combination Identifier
99263 , p_source_31 IN NUMBER
99264 --Default Code Combination Identifier
99265 , p_source_32 IN NUMBER
99266 --Adjustment Type
99267 , p_source_48 IN VARCHAR2
99268 --Transaction Header Identifier
99269 , p_source_49 IN NUMBER
99270 --Adjustment Line Identifier
99271 , p_source_50 IN NUMBER
99272 --Distribution Type Code
99273 , p_source_51 IN VARCHAR2
99274 --Entered Amount
99275 , p_source_52 IN NUMBER
99276 --Currency Code
99277 , p_source_53 IN VARCHAR2
99278 )
99279 IS
99280
99281 l_component_type VARCHAR2(80);
99282 l_component_code VARCHAR2(30);
99283 l_component_type_code VARCHAR2(1);
99284 l_component_appl_id INTEGER;
99285 l_amb_context_code VARCHAR2(30);
99286 l_entity_code VARCHAR2(30);
99287 l_event_class_code VARCHAR2(30);
99288 l_ae_header_id NUMBER;
99289 l_event_type_code VARCHAR2(30);
99290 l_line_definition_code VARCHAR2(30);
99291 l_line_definition_owner_code VARCHAR2(1);
99292 --
99293 -- adr variables
99294 l_segment VARCHAR2(30);
99295 l_ccid NUMBER;
99296 l_adr_transaction_coa_id NUMBER;
99297 l_adr_accounting_coa_id NUMBER;
99298 l_adr_flexfield_segment_code VARCHAR2(30);
99299 l_adr_flex_value_set_id NUMBER;
99300 l_adr_value_type_code VARCHAR2(30);
99301 l_adr_value_combination_id NUMBER;
99302 l_adr_value_segment_code VARCHAR2(30);
99303
99304 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
99305 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
99306 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
99307 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
99308
99309 -- 4262811 Variables ------------------------------------------------------------------------------------------
99310 l_entered_amt_idx NUMBER;
99311 l_accted_amt_idx NUMBER;
99312 l_acc_rev_flag VARCHAR2(1);
99313 l_accrual_line_num NUMBER;
99314 l_tmp_amt NUMBER;
99315 l_acc_rev_natural_side_code VARCHAR2(1);
99316
99317 l_num_entries NUMBER;
99318 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
99319 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
99320 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
99321 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
99322 l_recog_line_1 NUMBER;
99323 l_recog_line_2 NUMBER;
99324
99325 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
99326 l_bflow_applied_to_amt NUMBER; -- 5132302
99327 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
99328
99329 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
99330
99331 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
99332 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
99333
99334 ---------------------------------------------------------------------------------------------------------------
99335
99336
99337 --
99338 -- bulk performance
99339 --
99340 l_balance_type_code VARCHAR2(1);
99341 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
99345 -- Upgrade strategy
99342 l_log_module VARCHAR2(240);
99343
99344 --
99346 --
99347 l_actual_upg_option VARCHAR2(1);
99348 l_enc_upg_option VARCHAR2(1);
99349
99350 --
99351 BEGIN
99352 --
99353 IF g_log_enabled THEN
99354 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_303';
99355 END IF;
99356 --
99357 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
99358
99359 trace
99360 (p_msg => 'BEGIN of AcctLineType_303'
99361 ,p_level => C_LEVEL_PROCEDURE
99362 ,p_module => l_log_module);
99363
99364 END IF;
99365 --
99366 l_component_type := 'AMB_JLT';
99367 l_component_code := 'FA_RES_IC_PAY';
99368 l_component_type_code := 'S';
99369 l_component_appl_id := 140;
99370 l_amb_context_code := 'DEFAULT';
99371 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
99372 l_event_class_code := 'RESERVE_TRANSFERS';
99373 l_event_type_code := 'RESERVE_TRANSFERS_ALL';
99374 l_line_definition_owner_code := 'S';
99375 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RESER18';
99376 --
99377 l_balance_type_code := 'A';
99378 l_segment := NULL;
99379 l_ccid := NULL;
99380 l_adr_transaction_coa_id := NULL;
99381 l_adr_accounting_coa_id := NULL;
99382 l_adr_flexfield_segment_code := NULL;
99383 l_adr_flex_value_set_id := NULL;
99384 l_adr_value_type_code := NULL;
99385 l_adr_value_combination_id := NULL;
99386 l_adr_value_segment_code := NULL;
99387
99388 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
99389 l_bflow_class_code := ''; -- 4219869 Business Flow
99390 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
99391 l_budgetary_control_flag := 'N';
99392
99393 l_bflow_applied_to_amt_idx := NULL; -- 5132302
99394 l_bflow_applied_to_amt := NULL; -- 5132302
99395 l_entered_amt_idx := NULL; -- 4262811
99396 l_accted_amt_idx := NULL; -- 4262811
99397 l_acc_rev_flag := NULL; -- 4262811
99398 l_accrual_line_num := NULL; -- 4262811
99399 l_tmp_amt := NULL; -- 4262811
99400 --
99401
99402 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
99403 l_balance_type_code <> 'B' THEN
99404 IF NVL(p_source_48,'
99405 ') = 'INTERCO AP'
99406 THEN
99407
99408 --
99409 XLA_AE_LINES_PKG.SetNewLine;
99410
99411 p_balance_type_code := l_balance_type_code;
99412 -- set the flag so later we will know whether the gain loss line needs to be created
99413
99414 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
99415 p_actual_flag :='A';
99416 END IF;
99417
99418 --
99419 -- bulk performance
99420 --
99421 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
99422 p_header_num => 0); -- 4262811
99423 --
99424 -- set accounting line options
99425 --
99426 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
99427 p_natural_side_code => 'D'
99428 , p_gain_or_loss_flag => 'N'
99429 , p_gl_transfer_mode_code => 'S'
99430 , p_acct_entry_type_code => 'A'
99431 , p_switch_side_flag => 'Y'
99432 , p_merge_duplicate_code => 'N'
99433 );
99434 --
99435 l_acc_rev_natural_side_code := 'C'; -- 4262811
99436 --
99437 --
99438 -- set accounting line type info
99439 --
99440 xla_ae_lines_pkg.SetAcctLineType
99441 (p_component_type => l_component_type
99442 ,p_event_type_code => l_event_type_code
99443 ,p_line_definition_owner_code => l_line_definition_owner_code
99444 ,p_line_definition_code => l_line_definition_code
99445 ,p_accounting_line_code => l_component_code
99446 ,p_accounting_line_type_code => l_component_type_code
99447 ,p_accounting_line_appl_id => l_component_appl_id
99448 ,p_amb_context_code => l_amb_context_code
99449 ,p_entity_code => l_entity_code
99450 ,p_event_class_code => l_event_class_code);
99451 --
99452 -- set accounting class
99453 --
99454 xla_ae_lines_pkg.SetAcctClass(
99455 p_accounting_class_code => 'LIABILITY'
99456 , p_ae_header_id => l_ae_header_id
99457 );
99458
99459 --
99460 -- set rounding class
99461 --
99462 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
99463 'LIABILITY';
99464
99465 --
99466 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
99467 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
99468 --
99469 -- bulk performance
99470 --
99471 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
99472
99473 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
99474 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
99475
99476 -- 4955764
99480 -- 4458381 Public Sector Enh
99477 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
99478 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
99479
99481
99482 --
99483 -- set accounting attributes for the line type
99484 --
99485 l_entered_amt_idx := 4;
99486 l_accted_amt_idx := 6;
99487 l_bflow_applied_to_amt_idx := NULL; -- 5132302
99488 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
99489 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
99490 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
99491 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
99492 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
99493 l_rec_acct_attrs.array_char_value(3) := p_source_51;
99494 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
99495 l_rec_acct_attrs.array_num_value(4) := p_source_52;
99496 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
99497 l_rec_acct_attrs.array_char_value(5) := p_source_53;
99498 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
99499 l_rec_acct_attrs.array_num_value(6) := p_source_52;
99500
99501 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
99502 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
99503
99504 ---------------------------------------------------------------------------------------------------------------
99505 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
99506 ---------------------------------------------------------------------------------------------------------------
99507 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
99508
99509 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
99510 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
99511
99512 IF xla_accounting_cache_pkg.GetValueChar
99513 (p_source_code => 'LEDGER_CATEGORY_CODE'
99514 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
99515 AND l_bflow_method_code = 'PRIOR_ENTRY'
99516 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
99517 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
99518 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
99519 )
99520 THEN
99521 xla_ae_lines_pkg.BflowUpgEntry
99522 (p_business_method_code => l_bflow_method_code
99523 ,p_business_class_code => l_bflow_class_code
99524 ,p_balance_type => l_balance_type_code);
99525 ELSE
99526 NULL;
99527 -- No business flow processing for business flow method of NONE.
99528 END IF;
99529
99530 --
99531 -- call analytical criteria
99532 --
99533
99534 --
99535 -- call description
99536 --
99537
99538 xla_ae_lines_pkg.SetLineDescription(
99539 p_ae_header_id => l_ae_header_id
99540 ,p_description => Description_71 (
99541 p_application_id => p_application_id
99542 , p_ae_header_id => l_ae_header_id
99543 , p_source_1 => p_source_1
99544 )
99545 );
99546
99547
99548 --
99549 -- call ADRs
99550 -- Bug 4922099
99551 --
99552 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
99553 (NVL(l_actual_upg_option, 'N') = 'O') OR
99554 (NVL(l_enc_upg_option, 'N') = 'O')
99555 )
99556 THEN
99557 NULL;
99558 --
99559 --
99560
99561 l_ccid := AcctDerRule_174(
99562 p_application_id => p_application_id
99563 , p_ae_header_id => l_ae_header_id
99564 , p_source_5 => p_source_5
99565 , p_source_32 => p_source_32
99566 , x_transaction_coa_id => l_adr_transaction_coa_id
99567 , x_accounting_coa_id => l_adr_accounting_coa_id
99568 , x_value_type_code => l_adr_value_type_code
99569 , p_side => 'NA'
99570 );
99571
99572 xla_ae_lines_pkg.set_ccid(
99573 p_code_combination_id => l_ccid
99574 , p_value_type_code => l_adr_value_type_code
99575 , p_transaction_coa_id => l_adr_transaction_coa_id
99576 , p_accounting_coa_id => l_adr_accounting_coa_id
99577 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
99578 , p_adr_type_code => 'S'
99579 , p_component_type => l_component_type
99580 , p_component_code => l_component_code
99581 , p_component_type_code => l_component_type_code
99582 , p_component_appl_id => l_component_appl_id
99583 , p_amb_context_code => l_amb_context_code
99584 , p_side => 'NA'
99585 );
99586
99587
99588 l_segment := AcctDerRule_169(
99589 p_application_id => p_application_id
99590 , p_ae_header_id => l_ae_header_id
99591 , p_source_5 => p_source_5
99592 , p_source_31 => p_source_31
99593 , x_transaction_coa_id => l_adr_transaction_coa_id
99594 , x_accounting_coa_id => l_adr_accounting_coa_id
99598 , x_value_combination_id => l_adr_value_combination_id
99595 , x_flexfield_segment_code => l_adr_flexfield_segment_code
99596 , x_flex_value_set_id => l_adr_flex_value_set_id
99597 , x_value_type_code => l_adr_value_type_code
99599 , x_value_segment_code => l_adr_value_segment_code
99600 , p_side => 'NA'
99601 , p_override_seg_flag => 'Y'
99602 );
99603
99604 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
99605
99606 xla_ae_lines_pkg.set_segment(
99607 p_to_segment_code => 'GL_BALANCING'
99608 , p_segment_value => l_segment
99609 , p_from_segment_code => l_adr_value_segment_code
99610 , p_from_combination_id => l_adr_value_combination_id
99611 , p_value_type_code => l_adr_value_type_code
99612 , p_transaction_coa_id => l_adr_transaction_coa_id
99613 , p_accounting_coa_id => l_adr_accounting_coa_id
99614 , p_flexfield_segment_code => l_adr_flexfield_segment_code
99615 , p_flex_value_set_id => l_adr_flex_value_set_id
99616 , p_adr_code => 'FA_EXPENSE_ACCT'
99617 , p_adr_type_code => 'S'
99618 , p_component_type => l_component_type
99619 , p_component_code => l_component_code
99620 , p_component_type_code => l_component_type_code
99621 , p_component_appl_id => l_component_appl_id
99622 , p_amb_context_code => l_amb_context_code
99623 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
99624 , p_event_class_code => 'RESERVE_TRANSFERS'
99625 , p_side => 'NA'
99626 );
99627
99628 END IF;
99629
99630 l_segment := AcctDerRule_158(
99631 p_application_id => p_application_id
99632 , p_ae_header_id => l_ae_header_id
99633 , p_source_5 => p_source_5
99634 , p_source_21 => p_source_21
99635 , x_transaction_coa_id => l_adr_transaction_coa_id
99636 , x_accounting_coa_id => l_adr_accounting_coa_id
99637 , x_flexfield_segment_code => l_adr_flexfield_segment_code
99638 , x_flex_value_set_id => l_adr_flex_value_set_id
99639 , x_value_type_code => l_adr_value_type_code
99640 , x_value_combination_id => l_adr_value_combination_id
99641 , x_value_segment_code => l_adr_value_segment_code
99642 , p_side => 'NA'
99643 , p_override_seg_flag => 'Y'
99644 );
99645
99646 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
99647
99648 xla_ae_lines_pkg.set_segment(
99649 p_to_segment_code => 'GL_ACCOUNT'
99650 , p_segment_value => l_segment
99651 , p_from_segment_code => l_adr_value_segment_code
99652 , p_from_combination_id => l_adr_value_combination_id
99653 , p_value_type_code => l_adr_value_type_code
99654 , p_transaction_coa_id => l_adr_transaction_coa_id
99655 , p_accounting_coa_id => l_adr_accounting_coa_id
99656 , p_flexfield_segment_code => l_adr_flexfield_segment_code
99657 , p_flex_value_set_id => l_adr_flex_value_set_id
99658 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
99659 , p_adr_type_code => 'S'
99660 , p_component_type => l_component_type
99661 , p_component_code => l_component_code
99662 , p_component_type_code => l_component_type_code
99663 , p_component_appl_id => l_component_appl_id
99664 , p_amb_context_code => l_amb_context_code
99665 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
99666 , p_event_class_code => 'RESERVE_TRANSFERS'
99667 , p_side => 'NA'
99668 );
99669
99670 END IF;
99671
99672 --
99673 --
99674 END IF;
99675 --
99676 -- Bug 4922099
99677 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
99678 (NVL(l_enc_upg_option, 'N') = 'O')
99679 ) AND
99680 (l_bflow_method_code = 'PRIOR_ENTRY')
99681 )
99682 THEN
99683 IF
99684 --
99685 1 = 2
99686 --
99687 THEN
99688 xla_accounting_err_pkg.build_message
99689 (p_appli_s_name => 'XLA'
99690 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
99691 ,p_token_1 => 'LINE_NUMBER'
99692 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
99693 ,p_token_2 => 'LINE_TYPE_NAME'
99694 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
99695 l_component_type
99696 ,l_component_code
99697 ,l_component_type_code
99698 ,l_component_appl_id
99699 ,l_amb_context_code
99703 ,p_token_3 => 'OWNER'
99700 ,l_entity_code
99701 ,l_event_class_code
99702 )
99704 ,p_value_3 => xla_lookups_pkg.get_meaning(
99705 p_lookup_type => 'XLA_OWNER_TYPE'
99706 ,p_lookup_code => l_component_type_code
99707 )
99708 ,p_token_4 => 'PRODUCT_NAME'
99709 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
99710 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
99711 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
99712 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
99713 ,p_ae_header_id => NULL
99714 );
99715
99716 IF (C_LEVEL_ERROR>= g_log_level) THEN
99717 trace
99718 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
99719 ,p_level => C_LEVEL_ERROR
99720 ,p_module => l_log_module);
99721 END IF;
99722 END IF;
99723 END IF;
99724 --
99725 --
99726 ------------------------------------------------------------------------------------------------
99727 -- 4219869 Business Flow
99728 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
99729 -- Prior Entry. Currently, the following code is always generated.
99730 ------------------------------------------------------------------------------------------------
99731 XLA_AE_LINES_PKG.ValidateCurrentLine;
99732
99733 ------------------------------------------------------------------------------------
99734 -- 4219869 Business Flow
99735 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
99736 ------------------------------------------------------------------------------------
99737 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
99738
99739 ----------------------------------------------------------------------------------
99740 -- 4219869 Business Flow
99741 -- Update journal entry status -- Need to generate this within IF <condition>
99742 ----------------------------------------------------------------------------------
99743 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
99744 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
99745 ,p_balance_type_code => l_balance_type_code
99746 );
99747
99748 -------------------------------------------------------------------------------------------
99749 -- 4262811 - Generate the Accrual Reversal lines
99750 -------------------------------------------------------------------------------------------
99751 BEGIN
99752 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
99753 (g_array_event(p_event_id).array_value_num('header_index'));
99754 IF l_acc_rev_flag IS NULL THEN
99755 l_acc_rev_flag := 'N';
99756 END IF;
99757 EXCEPTION
99758 WHEN OTHERS THEN
99759 l_acc_rev_flag := 'N';
99760 END;
99761 --
99762 IF (l_acc_rev_flag = 'Y') THEN
99763
99764 -- 4645092 ------------------------------------------------------------------------------
99765 -- To allow MPA report to determine if it should generate report process
99766 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
99767 ------------------------------------------------------------------------------------------
99768
99769 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
99770 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
99771 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
99772 -- call ADRs
99773 -- Bug 4922099
99774 --
99775 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
99776 (NVL(l_actual_upg_option, 'N') = 'O') OR
99777 (NVL(l_enc_upg_option, 'N') = 'O')
99778 )
99779 THEN
99780 NULL;
99781 --
99782 --
99783
99784 l_ccid := AcctDerRule_174(
99785 p_application_id => p_application_id
99786 , p_ae_header_id => l_ae_header_id
99787 , p_source_5 => p_source_5
99788 , p_source_32 => p_source_32
99789 , x_transaction_coa_id => l_adr_transaction_coa_id
99790 , x_accounting_coa_id => l_adr_accounting_coa_id
99791 , x_value_type_code => l_adr_value_type_code
99792 , p_side => 'NA'
99793 );
99794
99795 xla_ae_lines_pkg.set_ccid(
99796 p_code_combination_id => l_ccid
99797 , p_value_type_code => l_adr_value_type_code
99798 , p_transaction_coa_id => l_adr_transaction_coa_id
99799 , p_accounting_coa_id => l_adr_accounting_coa_id
99803 , p_component_code => l_component_code
99800 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
99801 , p_adr_type_code => 'S'
99802 , p_component_type => l_component_type
99804 , p_component_type_code => l_component_type_code
99805 , p_component_appl_id => l_component_appl_id
99806 , p_amb_context_code => l_amb_context_code
99807 , p_side => 'NA'
99808 );
99809
99810
99811 l_segment := AcctDerRule_169(
99812 p_application_id => p_application_id
99813 , p_ae_header_id => l_ae_header_id
99814 , p_source_5 => p_source_5
99815 , p_source_31 => p_source_31
99816 , x_transaction_coa_id => l_adr_transaction_coa_id
99817 , x_accounting_coa_id => l_adr_accounting_coa_id
99818 , x_flexfield_segment_code => l_adr_flexfield_segment_code
99819 , x_flex_value_set_id => l_adr_flex_value_set_id
99820 , x_value_type_code => l_adr_value_type_code
99821 , x_value_combination_id => l_adr_value_combination_id
99822 , x_value_segment_code => l_adr_value_segment_code
99823 , p_side => 'NA'
99824 , p_override_seg_flag => 'Y'
99825 );
99826
99827 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
99828
99829 xla_ae_lines_pkg.set_segment(
99830 p_to_segment_code => 'GL_BALANCING'
99831 , p_segment_value => l_segment
99832 , p_from_segment_code => l_adr_value_segment_code
99833 , p_from_combination_id => l_adr_value_combination_id
99834 , p_value_type_code => l_adr_value_type_code
99835 , p_transaction_coa_id => l_adr_transaction_coa_id
99836 , p_accounting_coa_id => l_adr_accounting_coa_id
99837 , p_flexfield_segment_code => l_adr_flexfield_segment_code
99838 , p_flex_value_set_id => l_adr_flex_value_set_id
99839 , p_adr_code => 'FA_EXPENSE_ACCT'
99840 , p_adr_type_code => 'S'
99841 , p_component_type => l_component_type
99842 , p_component_code => l_component_code
99843 , p_component_type_code => l_component_type_code
99844 , p_component_appl_id => l_component_appl_id
99845 , p_amb_context_code => l_amb_context_code
99846 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
99847 , p_event_class_code => 'RESERVE_TRANSFERS'
99848 , p_side => 'NA'
99849 );
99850
99851 END IF;
99852
99853 l_segment := AcctDerRule_158(
99854 p_application_id => p_application_id
99855 , p_ae_header_id => l_ae_header_id
99856 , p_source_5 => p_source_5
99857 , p_source_21 => p_source_21
99858 , x_transaction_coa_id => l_adr_transaction_coa_id
99859 , x_accounting_coa_id => l_adr_accounting_coa_id
99860 , x_flexfield_segment_code => l_adr_flexfield_segment_code
99861 , x_flex_value_set_id => l_adr_flex_value_set_id
99862 , x_value_type_code => l_adr_value_type_code
99863 , x_value_combination_id => l_adr_value_combination_id
99864 , x_value_segment_code => l_adr_value_segment_code
99865 , p_side => 'NA'
99866 , p_override_seg_flag => 'Y'
99867 );
99868
99869 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
99870
99871 xla_ae_lines_pkg.set_segment(
99872 p_to_segment_code => 'GL_ACCOUNT'
99873 , p_segment_value => l_segment
99874 , p_from_segment_code => l_adr_value_segment_code
99875 , p_from_combination_id => l_adr_value_combination_id
99876 , p_value_type_code => l_adr_value_type_code
99877 , p_transaction_coa_id => l_adr_transaction_coa_id
99878 , p_accounting_coa_id => l_adr_accounting_coa_id
99879 , p_flexfield_segment_code => l_adr_flexfield_segment_code
99880 , p_flex_value_set_id => l_adr_flex_value_set_id
99881 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
99882 , p_adr_type_code => 'S'
99883 , p_component_type => l_component_type
99884 , p_component_code => l_component_code
99885 , p_component_type_code => l_component_type_code
99886 , p_component_appl_id => l_component_appl_id
99887 , p_amb_context_code => l_amb_context_code
99888 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
99889 , p_event_class_code => 'RESERVE_TRANSFERS'
99890 , p_side => 'NA'
99891 );
99892
99893 END IF;
99894
99895 --
99896 --
99897 END IF;
99898
99899 --
99900 -- Update the line information that should be overwritten
99901 --
99902 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
99903 p_header_num => 1);
99904 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
99905
99906 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
99907
99908 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
99912 --
99909 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
99910 END IF;
99911
99913 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
99914 --
99915 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
99916 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
99917 ELSE
99918 ---------------------------------------------------------------------------------------------------
99919 -- 4262811a Switch Sign
99920 ---------------------------------------------------------------------------------------------------
99921 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
99922 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
99923 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
99924 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
99925 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
99926 -- 5132302
99927 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
99928 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
99929
99930 END IF;
99931
99932 -- 4955764
99933 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
99934 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
99935
99936
99937 XLA_AE_LINES_PKG.ValidateCurrentLine;
99938 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
99939
99940 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
99941 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
99942 ,p_balance_type_code => l_balance_type_code);
99943
99944 END IF;
99945
99946 -----------------------------------------------------------------------------------------
99947 -- 4262811 Multiperiod Accounting
99948 -----------------------------------------------------------------------------------------
99949 -- No MPA option is assigned.
99950
99951
99952 END IF;
99953 END IF;
99954 --
99955
99956 --
99957 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
99958 trace
99959 (p_msg => 'END of AcctLineType_303'
99960 ,p_level => C_LEVEL_PROCEDURE
99961 ,p_module => l_log_module);
99962 END IF;
99963 --
99964 EXCEPTION
99965 WHEN xla_exceptions_pkg.application_exception THEN
99966 RAISE;
99967 WHEN OTHERS THEN
99968 xla_exceptions_pkg.raise_message
99969 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_303');
99970 END AcctLineType_303;
99971 --
99972
99973 ---------------------------------------
99974 --
99975 -- PRIVATE FUNCTION
99976 -- AcctLineType_304
99977 --
99978 ---------------------------------------
99979 PROCEDURE AcctLineType_304 (
99980 p_application_id IN NUMBER
99981 ,p_event_id IN NUMBER
99982 ,p_calculate_acctd_flag IN VARCHAR2
99983 ,p_calculate_g_l_flag IN VARCHAR2
99984 ,p_actual_flag IN OUT VARCHAR2
99985 ,p_balance_type_code OUT VARCHAR2
99986 ,p_gain_or_loss_ref OUT VARCHAR2
99987
99988 --Period Close Date
99989 , p_source_1 IN DATE
99990 --Generated Code Combination Identifier
99991 , p_source_5 IN NUMBER
99992 --Intercompany Receivables Account
99993 , p_source_22 IN VARCHAR2
99994 --Expense Account Code Combination Identifier
99995 , p_source_31 IN NUMBER
99996 --Default Code Combination Identifier
99997 , p_source_32 IN NUMBER
99998 --Adjustment Type
99999 , p_source_48 IN VARCHAR2
100000 --Transaction Header Identifier
100001 , p_source_49 IN NUMBER
100002 --Adjustment Line Identifier
100003 , p_source_50 IN NUMBER
100004 --Distribution Type Code
100005 , p_source_51 IN VARCHAR2
100006 --Entered Amount
100007 , p_source_52 IN NUMBER
100008 --Currency Code
100009 , p_source_53 IN VARCHAR2
100010 )
100011 IS
100012
100013 l_component_type VARCHAR2(80);
100014 l_component_code VARCHAR2(30);
100015 l_component_type_code VARCHAR2(1);
100016 l_component_appl_id INTEGER;
100017 l_amb_context_code VARCHAR2(30);
100018 l_entity_code VARCHAR2(30);
100019 l_event_class_code VARCHAR2(30);
100020 l_ae_header_id NUMBER;
100021 l_event_type_code VARCHAR2(30);
100022 l_line_definition_code VARCHAR2(30);
100023 l_line_definition_owner_code VARCHAR2(1);
100024 --
100025 -- adr variables
100026 l_segment VARCHAR2(30);
100027 l_ccid NUMBER;
100028 l_adr_transaction_coa_id NUMBER;
100029 l_adr_accounting_coa_id NUMBER;
100030 l_adr_flexfield_segment_code VARCHAR2(30);
100031 l_adr_flex_value_set_id NUMBER;
100032 l_adr_value_type_code VARCHAR2(30);
100033 l_adr_value_combination_id NUMBER;
100034 l_adr_value_segment_code VARCHAR2(30);
100035
100039 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
100036 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
100037 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
100038 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
100040
100041 -- 4262811 Variables ------------------------------------------------------------------------------------------
100042 l_entered_amt_idx NUMBER;
100043 l_accted_amt_idx NUMBER;
100044 l_acc_rev_flag VARCHAR2(1);
100045 l_accrual_line_num NUMBER;
100046 l_tmp_amt NUMBER;
100047 l_acc_rev_natural_side_code VARCHAR2(1);
100048
100049 l_num_entries NUMBER;
100050 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
100051 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
100052 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
100053 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
100054 l_recog_line_1 NUMBER;
100055 l_recog_line_2 NUMBER;
100056
100057 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
100058 l_bflow_applied_to_amt NUMBER; -- 5132302
100059 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
100060
100061 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
100062
100063 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
100064 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
100065
100066 ---------------------------------------------------------------------------------------------------------------
100067
100068
100069 --
100070 -- bulk performance
100071 --
100072 l_balance_type_code VARCHAR2(1);
100073 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
100074 l_log_module VARCHAR2(240);
100075
100076 --
100077 -- Upgrade strategy
100078 --
100079 l_actual_upg_option VARCHAR2(1);
100080 l_enc_upg_option VARCHAR2(1);
100081
100082 --
100083 BEGIN
100084 --
100085 IF g_log_enabled THEN
100086 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_304';
100087 END IF;
100088 --
100089 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
100090
100091 trace
100092 (p_msg => 'BEGIN of AcctLineType_304'
100093 ,p_level => C_LEVEL_PROCEDURE
100094 ,p_module => l_log_module);
100095
100096 END IF;
100097 --
100098 l_component_type := 'AMB_JLT';
100099 l_component_code := 'FA_RES_IC_REC`';
100100 l_component_type_code := 'S';
100101 l_component_appl_id := 140;
100102 l_amb_context_code := 'DEFAULT';
100103 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
100104 l_event_class_code := 'RESERVE_TRANSFERS';
100105 l_event_type_code := 'RESERVE_TRANSFERS_ALL';
100106 l_line_definition_owner_code := 'S';
100107 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RESER18';
100108 --
100109 l_balance_type_code := 'A';
100110 l_segment := NULL;
100111 l_ccid := NULL;
100112 l_adr_transaction_coa_id := NULL;
100113 l_adr_accounting_coa_id := NULL;
100114 l_adr_flexfield_segment_code := NULL;
100115 l_adr_flex_value_set_id := NULL;
100116 l_adr_value_type_code := NULL;
100117 l_adr_value_combination_id := NULL;
100118 l_adr_value_segment_code := NULL;
100119
100120 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
100121 l_bflow_class_code := ''; -- 4219869 Business Flow
100122 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
100123 l_budgetary_control_flag := 'N';
100124
100125 l_bflow_applied_to_amt_idx := NULL; -- 5132302
100126 l_bflow_applied_to_amt := NULL; -- 5132302
100127 l_entered_amt_idx := NULL; -- 4262811
100128 l_accted_amt_idx := NULL; -- 4262811
100129 l_acc_rev_flag := NULL; -- 4262811
100130 l_accrual_line_num := NULL; -- 4262811
100131 l_tmp_amt := NULL; -- 4262811
100132 --
100133
100134 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
100135 l_balance_type_code <> 'B' THEN
100136 IF NVL(p_source_48,'
100137 ') = 'INTERCO AR'
100138 THEN
100139
100140 --
100141 XLA_AE_LINES_PKG.SetNewLine;
100142
100143 p_balance_type_code := l_balance_type_code;
100144 -- set the flag so later we will know whether the gain loss line needs to be created
100145
100146 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
100147 p_actual_flag :='A';
100148 END IF;
100149
100150 --
100151 -- bulk performance
100152 --
100153 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
100154 p_header_num => 0); -- 4262811
100155 --
100156 -- set accounting line options
100157 --
100158 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
100159 p_natural_side_code => 'D'
100160 , p_gain_or_loss_flag => 'N'
100161 , p_gl_transfer_mode_code => 'S'
100162 , p_acct_entry_type_code => 'A'
100166 --
100163 , p_switch_side_flag => 'Y'
100164 , p_merge_duplicate_code => 'N'
100165 );
100167 l_acc_rev_natural_side_code := 'C'; -- 4262811
100168 --
100169 --
100170 -- set accounting line type info
100171 --
100172 xla_ae_lines_pkg.SetAcctLineType
100173 (p_component_type => l_component_type
100174 ,p_event_type_code => l_event_type_code
100175 ,p_line_definition_owner_code => l_line_definition_owner_code
100176 ,p_line_definition_code => l_line_definition_code
100177 ,p_accounting_line_code => l_component_code
100178 ,p_accounting_line_type_code => l_component_type_code
100179 ,p_accounting_line_appl_id => l_component_appl_id
100180 ,p_amb_context_code => l_amb_context_code
100181 ,p_entity_code => l_entity_code
100182 ,p_event_class_code => l_event_class_code);
100183 --
100184 -- set accounting class
100185 --
100186 xla_ae_lines_pkg.SetAcctClass(
100187 p_accounting_class_code => 'ASSET'
100188 , p_ae_header_id => l_ae_header_id
100189 );
100190
100191 --
100192 -- set rounding class
100193 --
100194 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
100195 'ASSET';
100196
100197 --
100198 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
100199 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
100200 --
100201 -- bulk performance
100202 --
100203 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
100204
100205 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
100206 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
100207
100208 -- 4955764
100209 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
100210 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
100211
100212 -- 4458381 Public Sector Enh
100213
100214 --
100215 -- set accounting attributes for the line type
100216 --
100217 l_entered_amt_idx := 4;
100218 l_accted_amt_idx := 6;
100219 l_bflow_applied_to_amt_idx := NULL; -- 5132302
100220 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
100221 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
100222 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
100223 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
100224 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
100225 l_rec_acct_attrs.array_char_value(3) := p_source_51;
100226 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
100227 l_rec_acct_attrs.array_num_value(4) := p_source_52;
100228 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
100229 l_rec_acct_attrs.array_char_value(5) := p_source_53;
100230 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
100231 l_rec_acct_attrs.array_num_value(6) := p_source_52;
100232
100233 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
100234 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
100235
100236 ---------------------------------------------------------------------------------------------------------------
100237 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
100238 ---------------------------------------------------------------------------------------------------------------
100239 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
100240
100241 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
100242 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
100243
100244 IF xla_accounting_cache_pkg.GetValueChar
100245 (p_source_code => 'LEDGER_CATEGORY_CODE'
100246 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
100247 AND l_bflow_method_code = 'PRIOR_ENTRY'
100248 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
100249 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
100250 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
100251 )
100252 THEN
100253 xla_ae_lines_pkg.BflowUpgEntry
100254 (p_business_method_code => l_bflow_method_code
100255 ,p_business_class_code => l_bflow_class_code
100256 ,p_balance_type => l_balance_type_code);
100257 ELSE
100258 NULL;
100259 -- No business flow processing for business flow method of NONE.
100260 END IF;
100261
100262 --
100263 -- call analytical criteria
100264 --
100265
100266 --
100267 -- call description
100268 --
100269
100270 xla_ae_lines_pkg.SetLineDescription(
100271 p_ae_header_id => l_ae_header_id
100272 ,p_description => Description_72 (
100273 p_application_id => p_application_id
100274 , p_ae_header_id => l_ae_header_id
100275 , p_source_1 => p_source_1
100276 )
100277 );
100278
100279
100283 --
100280 --
100281 -- call ADRs
100282 -- Bug 4922099
100284 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
100285 (NVL(l_actual_upg_option, 'N') = 'O') OR
100286 (NVL(l_enc_upg_option, 'N') = 'O')
100287 )
100288 THEN
100289 NULL;
100290 --
100291 --
100292
100293 l_ccid := AcctDerRule_174(
100294 p_application_id => p_application_id
100295 , p_ae_header_id => l_ae_header_id
100296 , p_source_5 => p_source_5
100297 , p_source_32 => p_source_32
100298 , x_transaction_coa_id => l_adr_transaction_coa_id
100299 , x_accounting_coa_id => l_adr_accounting_coa_id
100300 , x_value_type_code => l_adr_value_type_code
100301 , p_side => 'NA'
100302 );
100303
100304 xla_ae_lines_pkg.set_ccid(
100305 p_code_combination_id => l_ccid
100306 , p_value_type_code => l_adr_value_type_code
100307 , p_transaction_coa_id => l_adr_transaction_coa_id
100308 , p_accounting_coa_id => l_adr_accounting_coa_id
100309 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
100310 , p_adr_type_code => 'S'
100311 , p_component_type => l_component_type
100312 , p_component_code => l_component_code
100313 , p_component_type_code => l_component_type_code
100314 , p_component_appl_id => l_component_appl_id
100315 , p_amb_context_code => l_amb_context_code
100316 , p_side => 'NA'
100317 );
100318
100319
100320 l_segment := AcctDerRule_169(
100321 p_application_id => p_application_id
100322 , p_ae_header_id => l_ae_header_id
100323 , p_source_5 => p_source_5
100324 , p_source_31 => p_source_31
100325 , x_transaction_coa_id => l_adr_transaction_coa_id
100326 , x_accounting_coa_id => l_adr_accounting_coa_id
100327 , x_flexfield_segment_code => l_adr_flexfield_segment_code
100328 , x_flex_value_set_id => l_adr_flex_value_set_id
100329 , x_value_type_code => l_adr_value_type_code
100330 , x_value_combination_id => l_adr_value_combination_id
100331 , x_value_segment_code => l_adr_value_segment_code
100332 , p_side => 'NA'
100333 , p_override_seg_flag => 'Y'
100334 );
100335
100336 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
100337
100338 xla_ae_lines_pkg.set_segment(
100339 p_to_segment_code => 'GL_BALANCING'
100340 , p_segment_value => l_segment
100341 , p_from_segment_code => l_adr_value_segment_code
100342 , p_from_combination_id => l_adr_value_combination_id
100343 , p_value_type_code => l_adr_value_type_code
100344 , p_transaction_coa_id => l_adr_transaction_coa_id
100345 , p_accounting_coa_id => l_adr_accounting_coa_id
100346 , p_flexfield_segment_code => l_adr_flexfield_segment_code
100347 , p_flex_value_set_id => l_adr_flex_value_set_id
100348 , p_adr_code => 'FA_EXPENSE_ACCT'
100349 , p_adr_type_code => 'S'
100350 , p_component_type => l_component_type
100351 , p_component_code => l_component_code
100352 , p_component_type_code => l_component_type_code
100353 , p_component_appl_id => l_component_appl_id
100354 , p_amb_context_code => l_amb_context_code
100355 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
100356 , p_event_class_code => 'RESERVE_TRANSFERS'
100357 , p_side => 'NA'
100358 );
100359
100360 END IF;
100361
100362 l_segment := AcctDerRule_159(
100363 p_application_id => p_application_id
100364 , p_ae_header_id => l_ae_header_id
100365 , p_source_5 => p_source_5
100366 , p_source_22 => p_source_22
100367 , x_transaction_coa_id => l_adr_transaction_coa_id
100368 , x_accounting_coa_id => l_adr_accounting_coa_id
100369 , x_flexfield_segment_code => l_adr_flexfield_segment_code
100370 , x_flex_value_set_id => l_adr_flex_value_set_id
100371 , x_value_type_code => l_adr_value_type_code
100372 , x_value_combination_id => l_adr_value_combination_id
100373 , x_value_segment_code => l_adr_value_segment_code
100374 , p_side => 'NA'
100375 , p_override_seg_flag => 'Y'
100376 );
100377
100378 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
100379
100380 xla_ae_lines_pkg.set_segment(
100381 p_to_segment_code => 'GL_ACCOUNT'
100382 , p_segment_value => l_segment
100383 , p_from_segment_code => l_adr_value_segment_code
100384 , p_from_combination_id => l_adr_value_combination_id
100385 , p_value_type_code => l_adr_value_type_code
100386 , p_transaction_coa_id => l_adr_transaction_coa_id
100387 , p_accounting_coa_id => l_adr_accounting_coa_id
100388 , p_flexfield_segment_code => l_adr_flexfield_segment_code
100389 , p_flex_value_set_id => l_adr_flex_value_set_id
100390 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
100391 , p_adr_type_code => 'S'
100395 , p_component_appl_id => l_component_appl_id
100392 , p_component_type => l_component_type
100393 , p_component_code => l_component_code
100394 , p_component_type_code => l_component_type_code
100396 , p_amb_context_code => l_amb_context_code
100397 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
100398 , p_event_class_code => 'RESERVE_TRANSFERS'
100399 , p_side => 'NA'
100400 );
100401
100402 END IF;
100403
100404 --
100405 --
100406 END IF;
100407 --
100408 -- Bug 4922099
100409 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
100410 (NVL(l_enc_upg_option, 'N') = 'O')
100411 ) AND
100412 (l_bflow_method_code = 'PRIOR_ENTRY')
100413 )
100414 THEN
100415 IF
100416 --
100417 1 = 2
100418 --
100419 THEN
100420 xla_accounting_err_pkg.build_message
100421 (p_appli_s_name => 'XLA'
100422 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
100423 ,p_token_1 => 'LINE_NUMBER'
100424 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
100425 ,p_token_2 => 'LINE_TYPE_NAME'
100426 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
100427 l_component_type
100428 ,l_component_code
100429 ,l_component_type_code
100430 ,l_component_appl_id
100431 ,l_amb_context_code
100432 ,l_entity_code
100433 ,l_event_class_code
100434 )
100435 ,p_token_3 => 'OWNER'
100436 ,p_value_3 => xla_lookups_pkg.get_meaning(
100437 p_lookup_type => 'XLA_OWNER_TYPE'
100438 ,p_lookup_code => l_component_type_code
100439 )
100440 ,p_token_4 => 'PRODUCT_NAME'
100441 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
100442 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
100443 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
100444 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
100445 ,p_ae_header_id => NULL
100446 );
100447
100448 IF (C_LEVEL_ERROR>= g_log_level) THEN
100449 trace
100450 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
100451 ,p_level => C_LEVEL_ERROR
100452 ,p_module => l_log_module);
100453 END IF;
100454 END IF;
100455 END IF;
100456 --
100457 --
100458 ------------------------------------------------------------------------------------------------
100459 -- 4219869 Business Flow
100460 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
100461 -- Prior Entry. Currently, the following code is always generated.
100462 ------------------------------------------------------------------------------------------------
100463 XLA_AE_LINES_PKG.ValidateCurrentLine;
100464
100465 ------------------------------------------------------------------------------------
100466 -- 4219869 Business Flow
100467 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
100468 ------------------------------------------------------------------------------------
100469 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
100470
100471 ----------------------------------------------------------------------------------
100472 -- 4219869 Business Flow
100473 -- Update journal entry status -- Need to generate this within IF <condition>
100474 ----------------------------------------------------------------------------------
100475 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
100476 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
100477 ,p_balance_type_code => l_balance_type_code
100478 );
100479
100480 -------------------------------------------------------------------------------------------
100481 -- 4262811 - Generate the Accrual Reversal lines
100482 -------------------------------------------------------------------------------------------
100483 BEGIN
100484 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
100485 (g_array_event(p_event_id).array_value_num('header_index'));
100486 IF l_acc_rev_flag IS NULL THEN
100487 l_acc_rev_flag := 'N';
100488 END IF;
100489 EXCEPTION
100493 --
100490 WHEN OTHERS THEN
100491 l_acc_rev_flag := 'N';
100492 END;
100494 IF (l_acc_rev_flag = 'Y') THEN
100495
100496 -- 4645092 ------------------------------------------------------------------------------
100497 -- To allow MPA report to determine if it should generate report process
100498 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
100499 ------------------------------------------------------------------------------------------
100500
100501 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
100502 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
100503 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
100504 -- call ADRs
100505 -- Bug 4922099
100506 --
100507 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
100508 (NVL(l_actual_upg_option, 'N') = 'O') OR
100509 (NVL(l_enc_upg_option, 'N') = 'O')
100510 )
100511 THEN
100512 NULL;
100513 --
100514 --
100515
100516 l_ccid := AcctDerRule_174(
100517 p_application_id => p_application_id
100518 , p_ae_header_id => l_ae_header_id
100519 , p_source_5 => p_source_5
100520 , p_source_32 => p_source_32
100521 , x_transaction_coa_id => l_adr_transaction_coa_id
100522 , x_accounting_coa_id => l_adr_accounting_coa_id
100523 , x_value_type_code => l_adr_value_type_code
100524 , p_side => 'NA'
100525 );
100526
100527 xla_ae_lines_pkg.set_ccid(
100528 p_code_combination_id => l_ccid
100529 , p_value_type_code => l_adr_value_type_code
100530 , p_transaction_coa_id => l_adr_transaction_coa_id
100531 , p_accounting_coa_id => l_adr_accounting_coa_id
100532 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
100533 , p_adr_type_code => 'S'
100534 , p_component_type => l_component_type
100535 , p_component_code => l_component_code
100536 , p_component_type_code => l_component_type_code
100537 , p_component_appl_id => l_component_appl_id
100538 , p_amb_context_code => l_amb_context_code
100539 , p_side => 'NA'
100540 );
100541
100542
100543 l_segment := AcctDerRule_169(
100544 p_application_id => p_application_id
100545 , p_ae_header_id => l_ae_header_id
100546 , p_source_5 => p_source_5
100547 , p_source_31 => p_source_31
100548 , x_transaction_coa_id => l_adr_transaction_coa_id
100549 , x_accounting_coa_id => l_adr_accounting_coa_id
100550 , x_flexfield_segment_code => l_adr_flexfield_segment_code
100551 , x_flex_value_set_id => l_adr_flex_value_set_id
100552 , x_value_type_code => l_adr_value_type_code
100553 , x_value_combination_id => l_adr_value_combination_id
100554 , x_value_segment_code => l_adr_value_segment_code
100555 , p_side => 'NA'
100556 , p_override_seg_flag => 'Y'
100557 );
100558
100559 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
100560
100561 xla_ae_lines_pkg.set_segment(
100562 p_to_segment_code => 'GL_BALANCING'
100563 , p_segment_value => l_segment
100564 , p_from_segment_code => l_adr_value_segment_code
100565 , p_from_combination_id => l_adr_value_combination_id
100566 , p_value_type_code => l_adr_value_type_code
100567 , p_transaction_coa_id => l_adr_transaction_coa_id
100568 , p_accounting_coa_id => l_adr_accounting_coa_id
100569 , p_flexfield_segment_code => l_adr_flexfield_segment_code
100570 , p_flex_value_set_id => l_adr_flex_value_set_id
100571 , p_adr_code => 'FA_EXPENSE_ACCT'
100572 , p_adr_type_code => 'S'
100573 , p_component_type => l_component_type
100574 , p_component_code => l_component_code
100575 , p_component_type_code => l_component_type_code
100576 , p_component_appl_id => l_component_appl_id
100577 , p_amb_context_code => l_amb_context_code
100578 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
100579 , p_event_class_code => 'RESERVE_TRANSFERS'
100580 , p_side => 'NA'
100581 );
100582
100583 END IF;
100584
100585 l_segment := AcctDerRule_159(
100586 p_application_id => p_application_id
100587 , p_ae_header_id => l_ae_header_id
100588 , p_source_5 => p_source_5
100589 , p_source_22 => p_source_22
100590 , x_transaction_coa_id => l_adr_transaction_coa_id
100591 , x_accounting_coa_id => l_adr_accounting_coa_id
100592 , x_flexfield_segment_code => l_adr_flexfield_segment_code
100593 , x_flex_value_set_id => l_adr_flex_value_set_id
100594 , x_value_type_code => l_adr_value_type_code
100595 , x_value_combination_id => l_adr_value_combination_id
100596 , x_value_segment_code => l_adr_value_segment_code
100597 , p_side => 'NA'
100598 , p_override_seg_flag => 'Y'
100599 );
100600
100601 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
100602
100603 xla_ae_lines_pkg.set_segment(
100604 p_to_segment_code => 'GL_ACCOUNT'
100605 , p_segment_value => l_segment
100609 , p_transaction_coa_id => l_adr_transaction_coa_id
100606 , p_from_segment_code => l_adr_value_segment_code
100607 , p_from_combination_id => l_adr_value_combination_id
100608 , p_value_type_code => l_adr_value_type_code
100610 , p_accounting_coa_id => l_adr_accounting_coa_id
100611 , p_flexfield_segment_code => l_adr_flexfield_segment_code
100612 , p_flex_value_set_id => l_adr_flex_value_set_id
100613 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
100614 , p_adr_type_code => 'S'
100615 , p_component_type => l_component_type
100616 , p_component_code => l_component_code
100617 , p_component_type_code => l_component_type_code
100618 , p_component_appl_id => l_component_appl_id
100619 , p_amb_context_code => l_amb_context_code
100620 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
100621 , p_event_class_code => 'RESERVE_TRANSFERS'
100622 , p_side => 'NA'
100623 );
100624
100625 END IF;
100626
100627 --
100628 --
100629 END IF;
100630
100631 --
100632 -- Update the line information that should be overwritten
100633 --
100634 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
100635 p_header_num => 1);
100636 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
100637
100638 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
100639
100640 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
100641 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
100642 END IF;
100643
100644 --
100645 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
100646 --
100647 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
100648 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
100649 ELSE
100650 ---------------------------------------------------------------------------------------------------
100651 -- 4262811a Switch Sign
100652 ---------------------------------------------------------------------------------------------------
100653 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
100654 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
100655 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
100656 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
100657 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
100658 -- 5132302
100659 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
100660 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
100661
100662 END IF;
100663
100664 -- 4955764
100665 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
100666 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
100667
100668
100669 XLA_AE_LINES_PKG.ValidateCurrentLine;
100670 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
100671
100672 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
100673 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
100674 ,p_balance_type_code => l_balance_type_code);
100675
100676 END IF;
100677
100678 -----------------------------------------------------------------------------------------
100679 -- 4262811 Multiperiod Accounting
100680 -----------------------------------------------------------------------------------------
100681 -- No MPA option is assigned.
100682
100683
100684 END IF;
100685 END IF;
100686 --
100687
100688 --
100689 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
100690 trace
100691 (p_msg => 'END of AcctLineType_304'
100692 ,p_level => C_LEVEL_PROCEDURE
100693 ,p_module => l_log_module);
100694 END IF;
100695 --
100696 EXCEPTION
100697 WHEN xla_exceptions_pkg.application_exception THEN
100698 RAISE;
100699 WHEN OTHERS THEN
100700 xla_exceptions_pkg.raise_message
100701 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_304');
100702 END AcctLineType_304;
100703 --
100704
100705 ---------------------------------------
100706 --
100707 -- PRIVATE FUNCTION
100708 -- AcctLineType_305
100709 --
100710 ---------------------------------------
100711 PROCEDURE AcctLineType_305 (
100712 p_application_id IN NUMBER
100713 ,p_event_id IN NUMBER
100714 ,p_calculate_acctd_flag IN VARCHAR2
100715 ,p_calculate_g_l_flag IN VARCHAR2
100716 ,p_actual_flag IN OUT VARCHAR2
100717 ,p_balance_type_code OUT VARCHAR2
100718 ,p_gain_or_loss_ref OUT VARCHAR2
100719
100720 --Period Close Date
100721 , p_source_1 IN DATE
100722 --Generated Code Combination Identifier
100723 , p_source_5 IN NUMBER
100727 , p_source_19 IN NUMBER
100724 --Depreciation Reserve Account
100725 , p_source_12 IN VARCHAR2
100726 --Generated Offset Code Combination Identifier
100728 --Expense Account Code Combination Identifier
100729 , p_source_31 IN NUMBER
100730 --Default Code Combination Identifier
100731 , p_source_32 IN NUMBER
100732 --Adjustment Type
100733 , p_source_48 IN VARCHAR2
100734 --Transaction Header Identifier
100735 , p_source_49 IN NUMBER
100736 --Adjustment Line Identifier
100737 , p_source_50 IN NUMBER
100738 --Distribution Type Code
100739 , p_source_51 IN VARCHAR2
100740 --Entered Amount
100741 , p_source_52 IN NUMBER
100742 --Currency Code
100743 , p_source_53 IN VARCHAR2
100744 --Source Destination Code
100745 , p_source_55 IN VARCHAR2
100746 )
100747 IS
100748
100749 l_component_type VARCHAR2(80);
100750 l_component_code VARCHAR2(30);
100751 l_component_type_code VARCHAR2(1);
100752 l_component_appl_id INTEGER;
100753 l_amb_context_code VARCHAR2(30);
100754 l_entity_code VARCHAR2(30);
100755 l_event_class_code VARCHAR2(30);
100756 l_ae_header_id NUMBER;
100757 l_event_type_code VARCHAR2(30);
100758 l_line_definition_code VARCHAR2(30);
100759 l_line_definition_owner_code VARCHAR2(1);
100760 --
100761 -- adr variables
100762 l_segment VARCHAR2(30);
100763 l_ccid NUMBER;
100764 l_adr_transaction_coa_id NUMBER;
100765 l_adr_accounting_coa_id NUMBER;
100766 l_adr_flexfield_segment_code VARCHAR2(30);
100767 l_adr_flex_value_set_id NUMBER;
100768 l_adr_value_type_code VARCHAR2(30);
100769 l_adr_value_combination_id NUMBER;
100770 l_adr_value_segment_code VARCHAR2(30);
100771
100772 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
100773 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
100774 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
100775 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
100776
100777 -- 4262811 Variables ------------------------------------------------------------------------------------------
100778 l_entered_amt_idx NUMBER;
100779 l_accted_amt_idx NUMBER;
100780 l_acc_rev_flag VARCHAR2(1);
100781 l_accrual_line_num NUMBER;
100782 l_tmp_amt NUMBER;
100783 l_acc_rev_natural_side_code VARCHAR2(1);
100784
100785 l_num_entries NUMBER;
100786 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
100787 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
100788 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
100789 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
100790 l_recog_line_1 NUMBER;
100791 l_recog_line_2 NUMBER;
100792
100793 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
100794 l_bflow_applied_to_amt NUMBER; -- 5132302
100795 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
100796
100797 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
100798
100799 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
100800 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
100801
100802 ---------------------------------------------------------------------------------------------------------------
100803
100804
100805 --
100806 -- bulk performance
100807 --
100808 l_balance_type_code VARCHAR2(1);
100809 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
100810 l_log_module VARCHAR2(240);
100811
100812 --
100813 -- Upgrade strategy
100814 --
100815 l_actual_upg_option VARCHAR2(1);
100816 l_enc_upg_option VARCHAR2(1);
100817
100818 --
100819 BEGIN
100820 --
100821 IF g_log_enabled THEN
100822 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_305';
100823 END IF;
100824 --
100825 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
100826
100827 trace
100828 (p_msg => 'BEGIN of AcctLineType_305'
100829 ,p_level => C_LEVEL_PROCEDURE
100830 ,p_module => l_log_module);
100831
100832 END IF;
100833 --
100834 l_component_type := 'AMB_JLT';
100835 l_component_code := 'FA_RES_TRF_DEST_RES';
100836 l_component_type_code := 'S';
100837 l_component_appl_id := 140;
100838 l_amb_context_code := 'DEFAULT';
100839 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
100840 l_event_class_code := 'RESERVE_TRANSFERS';
100841 l_event_type_code := 'RESERVE_TRANSFERS_ALL';
100842 l_line_definition_owner_code := 'S';
100843 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RESER18';
100844 --
100845 l_balance_type_code := 'A';
100846 l_segment := NULL;
100847 l_ccid := NULL;
100848 l_adr_transaction_coa_id := NULL;
100849 l_adr_accounting_coa_id := NULL;
100850 l_adr_flexfield_segment_code := NULL;
100851 l_adr_flex_value_set_id := NULL;
100855
100852 l_adr_value_type_code := NULL;
100853 l_adr_value_combination_id := NULL;
100854 l_adr_value_segment_code := NULL;
100856 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
100857 l_bflow_class_code := ''; -- 4219869 Business Flow
100858 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
100859 l_budgetary_control_flag := 'N';
100860
100861 l_bflow_applied_to_amt_idx := NULL; -- 5132302
100862 l_bflow_applied_to_amt := NULL; -- 5132302
100863 l_entered_amt_idx := NULL; -- 4262811
100864 l_accted_amt_idx := NULL; -- 4262811
100865 l_acc_rev_flag := NULL; -- 4262811
100866 l_accrual_line_num := NULL; -- 4262811
100867 l_tmp_amt := NULL; -- 4262811
100868 --
100869
100870 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
100871 l_balance_type_code <> 'B' THEN
100872 IF NVL(p_source_48,'
100873 ') = 'RESERVE' AND
100874 NVL(p_source_55,'
100875 ') = 'DEST'
100876 THEN
100877
100878 --
100879 XLA_AE_LINES_PKG.SetNewLine;
100880
100881 p_balance_type_code := l_balance_type_code;
100882 -- set the flag so later we will know whether the gain loss line needs to be created
100883
100884 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
100885 p_actual_flag :='A';
100886 END IF;
100887
100888 --
100889 -- bulk performance
100890 --
100891 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
100892 p_header_num => 0); -- 4262811
100893 --
100894 -- set accounting line options
100895 --
100896 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
100897 p_natural_side_code => 'D'
100898 , p_gain_or_loss_flag => 'N'
100899 , p_gl_transfer_mode_code => 'S'
100900 , p_acct_entry_type_code => 'A'
100901 , p_switch_side_flag => 'Y'
100902 , p_merge_duplicate_code => 'N'
100903 );
100904 --
100905 l_acc_rev_natural_side_code := 'C'; -- 4262811
100906 --
100907 --
100908 -- set accounting line type info
100909 --
100910 xla_ae_lines_pkg.SetAcctLineType
100911 (p_component_type => l_component_type
100912 ,p_event_type_code => l_event_type_code
100913 ,p_line_definition_owner_code => l_line_definition_owner_code
100914 ,p_line_definition_code => l_line_definition_code
100915 ,p_accounting_line_code => l_component_code
100916 ,p_accounting_line_type_code => l_component_type_code
100917 ,p_accounting_line_appl_id => l_component_appl_id
100918 ,p_amb_context_code => l_amb_context_code
100919 ,p_entity_code => l_entity_code
100920 ,p_event_class_code => l_event_class_code);
100921 --
100922 -- set accounting class
100923 --
100924 xla_ae_lines_pkg.SetAcctClass(
100925 p_accounting_class_code => 'ASSET'
100926 , p_ae_header_id => l_ae_header_id
100927 );
100928
100929 --
100930 -- set rounding class
100931 --
100932 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
100933 'ASSET';
100934
100935 --
100936 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
100937 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
100938 --
100939 -- bulk performance
100940 --
100941 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
100942
100943 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
100944 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
100945
100946 -- 4955764
100947 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
100948 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
100949
100950 -- 4458381 Public Sector Enh
100951
100952 --
100953 -- set accounting attributes for the line type
100954 --
100955 l_entered_amt_idx := 4;
100956 l_accted_amt_idx := 6;
100957 l_bflow_applied_to_amt_idx := NULL; -- 5132302
100958 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
100959 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
100960 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
100961 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
100962 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
100963 l_rec_acct_attrs.array_char_value(3) := p_source_51;
100964 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
100965 l_rec_acct_attrs.array_num_value(4) := p_source_52;
100966 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
100967 l_rec_acct_attrs.array_char_value(5) := p_source_53;
100968 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
100969 l_rec_acct_attrs.array_num_value(6) := p_source_52;
100970
100971 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
100975 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
100972 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
100973
100974 ---------------------------------------------------------------------------------------------------------------
100976 ---------------------------------------------------------------------------------------------------------------
100977 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
100978
100979 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
100980 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
100981
100982 IF xla_accounting_cache_pkg.GetValueChar
100983 (p_source_code => 'LEDGER_CATEGORY_CODE'
100984 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
100985 AND l_bflow_method_code = 'PRIOR_ENTRY'
100986 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
100987 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
100988 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
100989 )
100990 THEN
100991 xla_ae_lines_pkg.BflowUpgEntry
100992 (p_business_method_code => l_bflow_method_code
100993 ,p_business_class_code => l_bflow_class_code
100994 ,p_balance_type => l_balance_type_code);
100995 ELSE
100996 NULL;
100997 -- No business flow processing for business flow method of NONE.
100998 END IF;
100999
101000 --
101001 -- call analytical criteria
101002 --
101003
101004 --
101005 -- call description
101006 --
101007
101008 xla_ae_lines_pkg.SetLineDescription(
101009 p_ae_header_id => l_ae_header_id
101010 ,p_description => Description_73 (
101011 p_application_id => p_application_id
101012 , p_ae_header_id => l_ae_header_id
101013 , p_source_1 => p_source_1
101014 )
101015 );
101016
101017
101018 --
101019 -- call ADRs
101020 -- Bug 4922099
101021 --
101022 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
101023 (NVL(l_actual_upg_option, 'N') = 'O') OR
101024 (NVL(l_enc_upg_option, 'N') = 'O')
101025 )
101026 THEN
101027 NULL;
101028 --
101029 --
101030
101031 l_ccid := AcctDerRule_175(
101032 p_application_id => p_application_id
101033 , p_ae_header_id => l_ae_header_id
101034 , p_source_5 => p_source_5
101035 , p_source_19 => p_source_19
101036 , p_source_32 => p_source_32
101037 , x_transaction_coa_id => l_adr_transaction_coa_id
101038 , x_accounting_coa_id => l_adr_accounting_coa_id
101039 , x_value_type_code => l_adr_value_type_code
101040 , p_side => 'NA'
101041 );
101042
101043 xla_ae_lines_pkg.set_ccid(
101044 p_code_combination_id => l_ccid
101045 , p_value_type_code => l_adr_value_type_code
101046 , p_transaction_coa_id => l_adr_transaction_coa_id
101047 , p_accounting_coa_id => l_adr_accounting_coa_id
101048 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
101049 , p_adr_type_code => 'S'
101050 , p_component_type => l_component_type
101051 , p_component_code => l_component_code
101052 , p_component_type_code => l_component_type_code
101053 , p_component_appl_id => l_component_appl_id
101054 , p_amb_context_code => l_amb_context_code
101055 , p_side => 'NA'
101056 );
101057
101058
101059 l_segment := AcctDerRule_150(
101060 p_application_id => p_application_id
101061 , p_ae_header_id => l_ae_header_id
101062 , p_source_5 => p_source_5
101063 , p_source_12 => p_source_12
101064 , x_transaction_coa_id => l_adr_transaction_coa_id
101065 , x_accounting_coa_id => l_adr_accounting_coa_id
101066 , x_flexfield_segment_code => l_adr_flexfield_segment_code
101067 , x_flex_value_set_id => l_adr_flex_value_set_id
101068 , x_value_type_code => l_adr_value_type_code
101069 , x_value_combination_id => l_adr_value_combination_id
101070 , x_value_segment_code => l_adr_value_segment_code
101071 , p_side => 'NA'
101072 , p_override_seg_flag => 'Y'
101073 );
101074
101075 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
101076
101077 xla_ae_lines_pkg.set_segment(
101078 p_to_segment_code => 'GL_ACCOUNT'
101079 , p_segment_value => l_segment
101080 , p_from_segment_code => l_adr_value_segment_code
101081 , p_from_combination_id => l_adr_value_combination_id
101082 , p_value_type_code => l_adr_value_type_code
101083 , p_transaction_coa_id => l_adr_transaction_coa_id
101084 , p_accounting_coa_id => l_adr_accounting_coa_id
101085 , p_flexfield_segment_code => l_adr_flexfield_segment_code
101086 , p_flex_value_set_id => l_adr_flex_value_set_id
101087 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
101088 , p_adr_type_code => 'S'
101089 , p_component_type => l_component_type
101090 , p_component_code => l_component_code
101094 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
101091 , p_component_type_code => l_component_type_code
101092 , p_component_appl_id => l_component_appl_id
101093 , p_amb_context_code => l_amb_context_code
101095 , p_event_class_code => 'RESERVE_TRANSFERS'
101096 , p_side => 'NA'
101097 );
101098
101099 END IF;
101100
101101 l_segment := AcctDerRule_169(
101102 p_application_id => p_application_id
101103 , p_ae_header_id => l_ae_header_id
101104 , p_source_5 => p_source_5
101105 , p_source_31 => p_source_31
101106 , x_transaction_coa_id => l_adr_transaction_coa_id
101107 , x_accounting_coa_id => l_adr_accounting_coa_id
101108 , x_flexfield_segment_code => l_adr_flexfield_segment_code
101109 , x_flex_value_set_id => l_adr_flex_value_set_id
101110 , x_value_type_code => l_adr_value_type_code
101111 , x_value_combination_id => l_adr_value_combination_id
101112 , x_value_segment_code => l_adr_value_segment_code
101113 , p_side => 'NA'
101114 , p_override_seg_flag => 'Y'
101115 );
101116
101117 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
101118
101119 xla_ae_lines_pkg.set_segment(
101120 p_to_segment_code => 'GL_BALANCING'
101121 , p_segment_value => l_segment
101122 , p_from_segment_code => l_adr_value_segment_code
101123 , p_from_combination_id => l_adr_value_combination_id
101124 , p_value_type_code => l_adr_value_type_code
101125 , p_transaction_coa_id => l_adr_transaction_coa_id
101126 , p_accounting_coa_id => l_adr_accounting_coa_id
101127 , p_flexfield_segment_code => l_adr_flexfield_segment_code
101128 , p_flex_value_set_id => l_adr_flex_value_set_id
101129 , p_adr_code => 'FA_EXPENSE_ACCT'
101130 , p_adr_type_code => 'S'
101131 , p_component_type => l_component_type
101132 , p_component_code => l_component_code
101133 , p_component_type_code => l_component_type_code
101134 , p_component_appl_id => l_component_appl_id
101135 , p_amb_context_code => l_amb_context_code
101136 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
101137 , p_event_class_code => 'RESERVE_TRANSFERS'
101138 , p_side => 'NA'
101139 );
101140
101141 END IF;
101142
101143 --
101144 --
101145 END IF;
101146 --
101147 -- Bug 4922099
101148 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
101149 (NVL(l_enc_upg_option, 'N') = 'O')
101150 ) AND
101151 (l_bflow_method_code = 'PRIOR_ENTRY')
101152 )
101153 THEN
101154 IF
101155 --
101156 1 = 2
101157 --
101158 THEN
101159 xla_accounting_err_pkg.build_message
101160 (p_appli_s_name => 'XLA'
101161 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
101162 ,p_token_1 => 'LINE_NUMBER'
101163 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
101164 ,p_token_2 => 'LINE_TYPE_NAME'
101165 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
101166 l_component_type
101167 ,l_component_code
101168 ,l_component_type_code
101169 ,l_component_appl_id
101170 ,l_amb_context_code
101171 ,l_entity_code
101172 ,l_event_class_code
101173 )
101174 ,p_token_3 => 'OWNER'
101175 ,p_value_3 => xla_lookups_pkg.get_meaning(
101176 p_lookup_type => 'XLA_OWNER_TYPE'
101177 ,p_lookup_code => l_component_type_code
101178 )
101179 ,p_token_4 => 'PRODUCT_NAME'
101180 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
101181 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
101182 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
101183 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
101184 ,p_ae_header_id => NULL
101185 );
101186
101187 IF (C_LEVEL_ERROR>= g_log_level) THEN
101188 trace
101192 END IF;
101189 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
101190 ,p_level => C_LEVEL_ERROR
101191 ,p_module => l_log_module);
101193 END IF;
101194 END IF;
101195 --
101196 --
101197 ------------------------------------------------------------------------------------------------
101198 -- 4219869 Business Flow
101199 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
101200 -- Prior Entry. Currently, the following code is always generated.
101201 ------------------------------------------------------------------------------------------------
101202 XLA_AE_LINES_PKG.ValidateCurrentLine;
101203
101204 ------------------------------------------------------------------------------------
101205 -- 4219869 Business Flow
101206 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
101207 ------------------------------------------------------------------------------------
101208 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
101209
101210 ----------------------------------------------------------------------------------
101211 -- 4219869 Business Flow
101212 -- Update journal entry status -- Need to generate this within IF <condition>
101213 ----------------------------------------------------------------------------------
101214 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
101215 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
101216 ,p_balance_type_code => l_balance_type_code
101217 );
101218
101219 -------------------------------------------------------------------------------------------
101220 -- 4262811 - Generate the Accrual Reversal lines
101221 -------------------------------------------------------------------------------------------
101222 BEGIN
101223 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
101224 (g_array_event(p_event_id).array_value_num('header_index'));
101225 IF l_acc_rev_flag IS NULL THEN
101226 l_acc_rev_flag := 'N';
101227 END IF;
101228 EXCEPTION
101229 WHEN OTHERS THEN
101230 l_acc_rev_flag := 'N';
101231 END;
101232 --
101233 IF (l_acc_rev_flag = 'Y') THEN
101234
101235 -- 4645092 ------------------------------------------------------------------------------
101236 -- To allow MPA report to determine if it should generate report process
101237 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
101238 ------------------------------------------------------------------------------------------
101239
101240 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
101241 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
101242 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
101243 -- call ADRs
101244 -- Bug 4922099
101245 --
101246 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
101247 (NVL(l_actual_upg_option, 'N') = 'O') OR
101248 (NVL(l_enc_upg_option, 'N') = 'O')
101249 )
101250 THEN
101251 NULL;
101252 --
101253 --
101254
101255 l_ccid := AcctDerRule_175(
101256 p_application_id => p_application_id
101257 , p_ae_header_id => l_ae_header_id
101258 , p_source_5 => p_source_5
101259 , p_source_19 => p_source_19
101260 , p_source_32 => p_source_32
101261 , x_transaction_coa_id => l_adr_transaction_coa_id
101262 , x_accounting_coa_id => l_adr_accounting_coa_id
101263 , x_value_type_code => l_adr_value_type_code
101264 , p_side => 'NA'
101265 );
101266
101267 xla_ae_lines_pkg.set_ccid(
101268 p_code_combination_id => l_ccid
101269 , p_value_type_code => l_adr_value_type_code
101270 , p_transaction_coa_id => l_adr_transaction_coa_id
101271 , p_accounting_coa_id => l_adr_accounting_coa_id
101272 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
101273 , p_adr_type_code => 'S'
101274 , p_component_type => l_component_type
101275 , p_component_code => l_component_code
101276 , p_component_type_code => l_component_type_code
101277 , p_component_appl_id => l_component_appl_id
101278 , p_amb_context_code => l_amb_context_code
101279 , p_side => 'NA'
101280 );
101281
101282
101283 l_segment := AcctDerRule_150(
101284 p_application_id => p_application_id
101285 , p_ae_header_id => l_ae_header_id
101286 , p_source_5 => p_source_5
101287 , p_source_12 => p_source_12
101288 , x_transaction_coa_id => l_adr_transaction_coa_id
101289 , x_accounting_coa_id => l_adr_accounting_coa_id
101290 , x_flexfield_segment_code => l_adr_flexfield_segment_code
101291 , x_flex_value_set_id => l_adr_flex_value_set_id
101292 , x_value_type_code => l_adr_value_type_code
101293 , x_value_combination_id => l_adr_value_combination_id
101294 , x_value_segment_code => l_adr_value_segment_code
101295 , p_side => 'NA'
101296 , p_override_seg_flag => 'Y'
101297 );
101298
101299 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
101300
101301 xla_ae_lines_pkg.set_segment(
101305 , p_from_combination_id => l_adr_value_combination_id
101302 p_to_segment_code => 'GL_ACCOUNT'
101303 , p_segment_value => l_segment
101304 , p_from_segment_code => l_adr_value_segment_code
101306 , p_value_type_code => l_adr_value_type_code
101307 , p_transaction_coa_id => l_adr_transaction_coa_id
101308 , p_accounting_coa_id => l_adr_accounting_coa_id
101309 , p_flexfield_segment_code => l_adr_flexfield_segment_code
101310 , p_flex_value_set_id => l_adr_flex_value_set_id
101311 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
101312 , p_adr_type_code => 'S'
101313 , p_component_type => l_component_type
101314 , p_component_code => l_component_code
101315 , p_component_type_code => l_component_type_code
101316 , p_component_appl_id => l_component_appl_id
101317 , p_amb_context_code => l_amb_context_code
101318 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
101319 , p_event_class_code => 'RESERVE_TRANSFERS'
101320 , p_side => 'NA'
101321 );
101322
101323 END IF;
101324
101325 l_segment := AcctDerRule_169(
101326 p_application_id => p_application_id
101327 , p_ae_header_id => l_ae_header_id
101328 , p_source_5 => p_source_5
101329 , p_source_31 => p_source_31
101330 , x_transaction_coa_id => l_adr_transaction_coa_id
101331 , x_accounting_coa_id => l_adr_accounting_coa_id
101332 , x_flexfield_segment_code => l_adr_flexfield_segment_code
101333 , x_flex_value_set_id => l_adr_flex_value_set_id
101334 , x_value_type_code => l_adr_value_type_code
101335 , x_value_combination_id => l_adr_value_combination_id
101336 , x_value_segment_code => l_adr_value_segment_code
101337 , p_side => 'NA'
101338 , p_override_seg_flag => 'Y'
101339 );
101340
101341 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
101342
101343 xla_ae_lines_pkg.set_segment(
101344 p_to_segment_code => 'GL_BALANCING'
101345 , p_segment_value => l_segment
101346 , p_from_segment_code => l_adr_value_segment_code
101347 , p_from_combination_id => l_adr_value_combination_id
101348 , p_value_type_code => l_adr_value_type_code
101349 , p_transaction_coa_id => l_adr_transaction_coa_id
101350 , p_accounting_coa_id => l_adr_accounting_coa_id
101351 , p_flexfield_segment_code => l_adr_flexfield_segment_code
101352 , p_flex_value_set_id => l_adr_flex_value_set_id
101353 , p_adr_code => 'FA_EXPENSE_ACCT'
101354 , p_adr_type_code => 'S'
101355 , p_component_type => l_component_type
101356 , p_component_code => l_component_code
101357 , p_component_type_code => l_component_type_code
101358 , p_component_appl_id => l_component_appl_id
101359 , p_amb_context_code => l_amb_context_code
101360 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
101361 , p_event_class_code => 'RESERVE_TRANSFERS'
101362 , p_side => 'NA'
101363 );
101364
101365 END IF;
101366
101367 --
101368 --
101369 END IF;
101370
101371 --
101372 -- Update the line information that should be overwritten
101373 --
101374 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
101375 p_header_num => 1);
101376 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
101377
101378 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
101379
101380 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
101381 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
101382 END IF;
101383
101384 --
101385 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
101386 --
101387 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
101388 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
101389 ELSE
101390 ---------------------------------------------------------------------------------------------------
101391 -- 4262811a Switch Sign
101392 ---------------------------------------------------------------------------------------------------
101393 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
101394 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
101395 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
101396 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
101397 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
101398 -- 5132302
101399 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
101400 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
101404 -- 4955764
101401
101402 END IF;
101403
101405 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
101406 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
101407
101408
101409 XLA_AE_LINES_PKG.ValidateCurrentLine;
101410 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
101411
101412 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
101413 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
101414 ,p_balance_type_code => l_balance_type_code);
101415
101416 END IF;
101417
101418 -----------------------------------------------------------------------------------------
101419 -- 4262811 Multiperiod Accounting
101420 -----------------------------------------------------------------------------------------
101421 -- No MPA option is assigned.
101422
101423
101424 END IF;
101425 END IF;
101426 --
101427
101428 --
101429 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
101430 trace
101431 (p_msg => 'END of AcctLineType_305'
101432 ,p_level => C_LEVEL_PROCEDURE
101433 ,p_module => l_log_module);
101434 END IF;
101435 --
101436 EXCEPTION
101437 WHEN xla_exceptions_pkg.application_exception THEN
101438 RAISE;
101439 WHEN OTHERS THEN
101440 xla_exceptions_pkg.raise_message
101441 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_305');
101442 END AcctLineType_305;
101443 --
101444
101445 ---------------------------------------
101446 --
101447 -- PRIVATE FUNCTION
101448 -- AcctLineType_306
101449 --
101450 ---------------------------------------
101451 PROCEDURE AcctLineType_306 (
101452 p_application_id IN NUMBER
101453 ,p_event_id IN NUMBER
101454 ,p_calculate_acctd_flag IN VARCHAR2
101455 ,p_calculate_g_l_flag IN VARCHAR2
101456 ,p_actual_flag IN OUT VARCHAR2
101457 ,p_balance_type_code OUT VARCHAR2
101458 ,p_gain_or_loss_ref OUT VARCHAR2
101459
101460 --Period Close Date
101461 , p_source_1 IN DATE
101462 --Generated Code Combination Identifier
101463 , p_source_5 IN NUMBER
101464 --Depreciation Reserve Account
101465 , p_source_12 IN VARCHAR2
101466 --Generated Offset Code Combination Identifier
101467 , p_source_19 IN NUMBER
101468 --Expense Account Code Combination Identifier
101469 , p_source_31 IN NUMBER
101470 --Default Code Combination Identifier
101471 , p_source_32 IN NUMBER
101472 --Adjustment Type
101473 , p_source_48 IN VARCHAR2
101474 --Transaction Header Identifier
101475 , p_source_49 IN NUMBER
101476 --Adjustment Line Identifier
101477 , p_source_50 IN NUMBER
101478 --Distribution Type Code
101479 , p_source_51 IN VARCHAR2
101480 --Entered Amount
101481 , p_source_52 IN NUMBER
101482 --Currency Code
101483 , p_source_53 IN VARCHAR2
101484 --Source Destination Code
101485 , p_source_55 IN VARCHAR2
101486 )
101487 IS
101488
101489 l_component_type VARCHAR2(80);
101490 l_component_code VARCHAR2(30);
101491 l_component_type_code VARCHAR2(1);
101492 l_component_appl_id INTEGER;
101493 l_amb_context_code VARCHAR2(30);
101494 l_entity_code VARCHAR2(30);
101495 l_event_class_code VARCHAR2(30);
101496 l_ae_header_id NUMBER;
101497 l_event_type_code VARCHAR2(30);
101498 l_line_definition_code VARCHAR2(30);
101499 l_line_definition_owner_code VARCHAR2(1);
101500 --
101501 -- adr variables
101502 l_segment VARCHAR2(30);
101503 l_ccid NUMBER;
101504 l_adr_transaction_coa_id NUMBER;
101505 l_adr_accounting_coa_id NUMBER;
101506 l_adr_flexfield_segment_code VARCHAR2(30);
101507 l_adr_flex_value_set_id NUMBER;
101508 l_adr_value_type_code VARCHAR2(30);
101509 l_adr_value_combination_id NUMBER;
101510 l_adr_value_segment_code VARCHAR2(30);
101511
101512 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
101513 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
101514 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
101515 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
101516
101517 -- 4262811 Variables ------------------------------------------------------------------------------------------
101518 l_entered_amt_idx NUMBER;
101519 l_accted_amt_idx NUMBER;
101520 l_acc_rev_flag VARCHAR2(1);
101521 l_accrual_line_num NUMBER;
101522 l_tmp_amt NUMBER;
101523 l_acc_rev_natural_side_code VARCHAR2(1);
101524
101525 l_num_entries NUMBER;
101526 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
101527 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
101528 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
101529 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
101530 l_recog_line_1 NUMBER;
101531 l_recog_line_2 NUMBER;
101532
101533 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
101534 l_bflow_applied_to_amt NUMBER; -- 5132302
101538
101535 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
101536
101537 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
101539 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
101540 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
101541
101542 ---------------------------------------------------------------------------------------------------------------
101543
101544
101545 --
101546 -- bulk performance
101547 --
101548 l_balance_type_code VARCHAR2(1);
101549 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
101550 l_log_module VARCHAR2(240);
101551
101552 --
101553 -- Upgrade strategy
101554 --
101555 l_actual_upg_option VARCHAR2(1);
101556 l_enc_upg_option VARCHAR2(1);
101557
101558 --
101559 BEGIN
101560 --
101561 IF g_log_enabled THEN
101562 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_306';
101563 END IF;
101564 --
101565 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
101566
101567 trace
101568 (p_msg => 'BEGIN of AcctLineType_306'
101569 ,p_level => C_LEVEL_PROCEDURE
101570 ,p_module => l_log_module);
101571
101572 END IF;
101573 --
101574 l_component_type := 'AMB_JLT';
101575 l_component_code := 'FA_RES_TRF_SOURCE_RES';
101576 l_component_type_code := 'S';
101577 l_component_appl_id := 140;
101578 l_amb_context_code := 'DEFAULT';
101579 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
101580 l_event_class_code := 'RESERVE_TRANSFERS';
101581 l_event_type_code := 'RESERVE_TRANSFERS_ALL';
101582 l_line_definition_owner_code := 'S';
101583 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RESER18';
101584 --
101585 l_balance_type_code := 'A';
101586 l_segment := NULL;
101587 l_ccid := NULL;
101588 l_adr_transaction_coa_id := NULL;
101589 l_adr_accounting_coa_id := NULL;
101590 l_adr_flexfield_segment_code := NULL;
101591 l_adr_flex_value_set_id := NULL;
101592 l_adr_value_type_code := NULL;
101593 l_adr_value_combination_id := NULL;
101594 l_adr_value_segment_code := NULL;
101595
101596 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
101597 l_bflow_class_code := ''; -- 4219869 Business Flow
101598 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
101599 l_budgetary_control_flag := 'N';
101600
101601 l_bflow_applied_to_amt_idx := NULL; -- 5132302
101602 l_bflow_applied_to_amt := NULL; -- 5132302
101603 l_entered_amt_idx := NULL; -- 4262811
101604 l_accted_amt_idx := NULL; -- 4262811
101605 l_acc_rev_flag := NULL; -- 4262811
101606 l_accrual_line_num := NULL; -- 4262811
101607 l_tmp_amt := NULL; -- 4262811
101608 --
101609
101610 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
101611 l_balance_type_code <> 'B' THEN
101612 IF NVL(p_source_48,'
101613 ') = 'RESERVE' AND
101614 NVL(p_source_55,'
101615 ') = 'SOURCE'
101616 THEN
101617
101618 --
101619 XLA_AE_LINES_PKG.SetNewLine;
101620
101621 p_balance_type_code := l_balance_type_code;
101622 -- set the flag so later we will know whether the gain loss line needs to be created
101623
101624 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
101625 p_actual_flag :='A';
101626 END IF;
101627
101628 --
101629 -- bulk performance
101630 --
101631 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
101632 p_header_num => 0); -- 4262811
101633 --
101634 -- set accounting line options
101635 --
101636 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
101637 p_natural_side_code => 'D'
101638 , p_gain_or_loss_flag => 'N'
101639 , p_gl_transfer_mode_code => 'S'
101640 , p_acct_entry_type_code => 'A'
101641 , p_switch_side_flag => 'Y'
101642 , p_merge_duplicate_code => 'N'
101643 );
101644 --
101645 l_acc_rev_natural_side_code := 'C'; -- 4262811
101646 --
101647 --
101648 -- set accounting line type info
101649 --
101650 xla_ae_lines_pkg.SetAcctLineType
101651 (p_component_type => l_component_type
101652 ,p_event_type_code => l_event_type_code
101653 ,p_line_definition_owner_code => l_line_definition_owner_code
101654 ,p_line_definition_code => l_line_definition_code
101655 ,p_accounting_line_code => l_component_code
101656 ,p_accounting_line_type_code => l_component_type_code
101657 ,p_accounting_line_appl_id => l_component_appl_id
101658 ,p_amb_context_code => l_amb_context_code
101659 ,p_entity_code => l_entity_code
101660 ,p_event_class_code => l_event_class_code);
101661 --
101662 -- set accounting class
101663 --
101664 xla_ae_lines_pkg.SetAcctClass(
101665 p_accounting_class_code => 'ASSET'
101666 , p_ae_header_id => l_ae_header_id
101667 );
101668
101669 --
101670 -- set rounding class
101671 --
101675 --
101672 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
101673 'ASSET';
101674
101676 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
101677 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
101678 --
101679 -- bulk performance
101680 --
101681 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
101682
101683 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
101684 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
101685
101686 -- 4955764
101687 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
101688 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
101689
101690 -- 4458381 Public Sector Enh
101691
101692 --
101693 -- set accounting attributes for the line type
101694 --
101695 l_entered_amt_idx := 4;
101696 l_accted_amt_idx := 6;
101697 l_bflow_applied_to_amt_idx := NULL; -- 5132302
101698 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
101699 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
101700 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
101701 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
101702 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
101703 l_rec_acct_attrs.array_char_value(3) := p_source_51;
101704 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
101705 l_rec_acct_attrs.array_num_value(4) := p_source_52;
101706 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
101707 l_rec_acct_attrs.array_char_value(5) := p_source_53;
101708 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
101709 l_rec_acct_attrs.array_num_value(6) := p_source_52;
101710
101711 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
101712 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
101713
101714 ---------------------------------------------------------------------------------------------------------------
101715 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
101716 ---------------------------------------------------------------------------------------------------------------
101717 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
101718
101719 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
101720 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
101721
101722 IF xla_accounting_cache_pkg.GetValueChar
101723 (p_source_code => 'LEDGER_CATEGORY_CODE'
101724 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
101725 AND l_bflow_method_code = 'PRIOR_ENTRY'
101726 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
101727 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
101728 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
101729 )
101730 THEN
101731 xla_ae_lines_pkg.BflowUpgEntry
101732 (p_business_method_code => l_bflow_method_code
101733 ,p_business_class_code => l_bflow_class_code
101734 ,p_balance_type => l_balance_type_code);
101735 ELSE
101736 NULL;
101737 -- No business flow processing for business flow method of NONE.
101738 END IF;
101739
101740 --
101741 -- call analytical criteria
101742 --
101743
101744 --
101745 -- call description
101746 --
101747
101748 xla_ae_lines_pkg.SetLineDescription(
101749 p_ae_header_id => l_ae_header_id
101750 ,p_description => Description_73 (
101751 p_application_id => p_application_id
101752 , p_ae_header_id => l_ae_header_id
101753 , p_source_1 => p_source_1
101754 )
101755 );
101756
101757
101758 --
101759 -- call ADRs
101760 -- Bug 4922099
101761 --
101762 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
101763 (NVL(l_actual_upg_option, 'N') = 'O') OR
101764 (NVL(l_enc_upg_option, 'N') = 'O')
101765 )
101766 THEN
101767 NULL;
101768 --
101769 --
101770
101771 l_ccid := AcctDerRule_175(
101772 p_application_id => p_application_id
101773 , p_ae_header_id => l_ae_header_id
101774 , p_source_5 => p_source_5
101775 , p_source_19 => p_source_19
101776 , p_source_32 => p_source_32
101777 , x_transaction_coa_id => l_adr_transaction_coa_id
101778 , x_accounting_coa_id => l_adr_accounting_coa_id
101779 , x_value_type_code => l_adr_value_type_code
101780 , p_side => 'NA'
101781 );
101782
101783 xla_ae_lines_pkg.set_ccid(
101784 p_code_combination_id => l_ccid
101785 , p_value_type_code => l_adr_value_type_code
101786 , p_transaction_coa_id => l_adr_transaction_coa_id
101787 , p_accounting_coa_id => l_adr_accounting_coa_id
101788 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
101792 , p_component_type_code => l_component_type_code
101789 , p_adr_type_code => 'S'
101790 , p_component_type => l_component_type
101791 , p_component_code => l_component_code
101793 , p_component_appl_id => l_component_appl_id
101794 , p_amb_context_code => l_amb_context_code
101795 , p_side => 'NA'
101796 );
101797
101798
101799 l_segment := AcctDerRule_150(
101800 p_application_id => p_application_id
101801 , p_ae_header_id => l_ae_header_id
101802 , p_source_5 => p_source_5
101803 , p_source_12 => p_source_12
101804 , x_transaction_coa_id => l_adr_transaction_coa_id
101805 , x_accounting_coa_id => l_adr_accounting_coa_id
101806 , x_flexfield_segment_code => l_adr_flexfield_segment_code
101807 , x_flex_value_set_id => l_adr_flex_value_set_id
101808 , x_value_type_code => l_adr_value_type_code
101809 , x_value_combination_id => l_adr_value_combination_id
101810 , x_value_segment_code => l_adr_value_segment_code
101811 , p_side => 'NA'
101812 , p_override_seg_flag => 'Y'
101813 );
101814
101815 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
101816
101817 xla_ae_lines_pkg.set_segment(
101818 p_to_segment_code => 'GL_ACCOUNT'
101819 , p_segment_value => l_segment
101820 , p_from_segment_code => l_adr_value_segment_code
101821 , p_from_combination_id => l_adr_value_combination_id
101822 , p_value_type_code => l_adr_value_type_code
101823 , p_transaction_coa_id => l_adr_transaction_coa_id
101824 , p_accounting_coa_id => l_adr_accounting_coa_id
101825 , p_flexfield_segment_code => l_adr_flexfield_segment_code
101826 , p_flex_value_set_id => l_adr_flex_value_set_id
101827 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
101828 , p_adr_type_code => 'S'
101829 , p_component_type => l_component_type
101830 , p_component_code => l_component_code
101831 , p_component_type_code => l_component_type_code
101832 , p_component_appl_id => l_component_appl_id
101833 , p_amb_context_code => l_amb_context_code
101834 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
101835 , p_event_class_code => 'RESERVE_TRANSFERS'
101836 , p_side => 'NA'
101837 );
101838
101839 END IF;
101840
101841 l_segment := AcctDerRule_169(
101842 p_application_id => p_application_id
101843 , p_ae_header_id => l_ae_header_id
101844 , p_source_5 => p_source_5
101845 , p_source_31 => p_source_31
101846 , x_transaction_coa_id => l_adr_transaction_coa_id
101847 , x_accounting_coa_id => l_adr_accounting_coa_id
101848 , x_flexfield_segment_code => l_adr_flexfield_segment_code
101849 , x_flex_value_set_id => l_adr_flex_value_set_id
101850 , x_value_type_code => l_adr_value_type_code
101851 , x_value_combination_id => l_adr_value_combination_id
101852 , x_value_segment_code => l_adr_value_segment_code
101853 , p_side => 'NA'
101854 , p_override_seg_flag => 'Y'
101855 );
101856
101857 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
101858
101859 xla_ae_lines_pkg.set_segment(
101860 p_to_segment_code => 'GL_BALANCING'
101861 , p_segment_value => l_segment
101862 , p_from_segment_code => l_adr_value_segment_code
101863 , p_from_combination_id => l_adr_value_combination_id
101864 , p_value_type_code => l_adr_value_type_code
101865 , p_transaction_coa_id => l_adr_transaction_coa_id
101866 , p_accounting_coa_id => l_adr_accounting_coa_id
101867 , p_flexfield_segment_code => l_adr_flexfield_segment_code
101868 , p_flex_value_set_id => l_adr_flex_value_set_id
101869 , p_adr_code => 'FA_EXPENSE_ACCT'
101870 , p_adr_type_code => 'S'
101871 , p_component_type => l_component_type
101872 , p_component_code => l_component_code
101873 , p_component_type_code => l_component_type_code
101874 , p_component_appl_id => l_component_appl_id
101875 , p_amb_context_code => l_amb_context_code
101876 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
101877 , p_event_class_code => 'RESERVE_TRANSFERS'
101878 , p_side => 'NA'
101879 );
101880
101881 END IF;
101882
101883 --
101884 --
101885 END IF;
101886 --
101887 -- Bug 4922099
101888 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
101889 (NVL(l_enc_upg_option, 'N') = 'O')
101890 ) AND
101891 (l_bflow_method_code = 'PRIOR_ENTRY')
101892 )
101893 THEN
101894 IF
101895 --
101896 1 = 2
101897 --
101898 THEN
101899 xla_accounting_err_pkg.build_message
101900 (p_appli_s_name => 'XLA'
101901 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
101902 ,p_token_1 => 'LINE_NUMBER'
101906 l_component_type
101903 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
101904 ,p_token_2 => 'LINE_TYPE_NAME'
101905 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
101907 ,l_component_code
101908 ,l_component_type_code
101909 ,l_component_appl_id
101910 ,l_amb_context_code
101911 ,l_entity_code
101912 ,l_event_class_code
101913 )
101914 ,p_token_3 => 'OWNER'
101915 ,p_value_3 => xla_lookups_pkg.get_meaning(
101916 p_lookup_type => 'XLA_OWNER_TYPE'
101917 ,p_lookup_code => l_component_type_code
101918 )
101919 ,p_token_4 => 'PRODUCT_NAME'
101920 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
101921 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
101922 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
101923 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
101924 ,p_ae_header_id => NULL
101925 );
101926
101927 IF (C_LEVEL_ERROR>= g_log_level) THEN
101928 trace
101929 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
101930 ,p_level => C_LEVEL_ERROR
101931 ,p_module => l_log_module);
101932 END IF;
101933 END IF;
101934 END IF;
101935 --
101936 --
101937 ------------------------------------------------------------------------------------------------
101938 -- 4219869 Business Flow
101939 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
101940 -- Prior Entry. Currently, the following code is always generated.
101941 ------------------------------------------------------------------------------------------------
101942 XLA_AE_LINES_PKG.ValidateCurrentLine;
101943
101944 ------------------------------------------------------------------------------------
101945 -- 4219869 Business Flow
101946 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
101947 ------------------------------------------------------------------------------------
101948 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
101949
101950 ----------------------------------------------------------------------------------
101951 -- 4219869 Business Flow
101952 -- Update journal entry status -- Need to generate this within IF <condition>
101953 ----------------------------------------------------------------------------------
101954 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
101955 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
101956 ,p_balance_type_code => l_balance_type_code
101957 );
101958
101959 -------------------------------------------------------------------------------------------
101960 -- 4262811 - Generate the Accrual Reversal lines
101961 -------------------------------------------------------------------------------------------
101962 BEGIN
101963 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
101964 (g_array_event(p_event_id).array_value_num('header_index'));
101965 IF l_acc_rev_flag IS NULL THEN
101966 l_acc_rev_flag := 'N';
101967 END IF;
101968 EXCEPTION
101969 WHEN OTHERS THEN
101970 l_acc_rev_flag := 'N';
101971 END;
101972 --
101973 IF (l_acc_rev_flag = 'Y') THEN
101974
101975 -- 4645092 ------------------------------------------------------------------------------
101976 -- To allow MPA report to determine if it should generate report process
101977 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
101978 ------------------------------------------------------------------------------------------
101979
101980 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
101981 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
101982 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
101983 -- call ADRs
101984 -- Bug 4922099
101985 --
101986 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
101987 (NVL(l_actual_upg_option, 'N') = 'O') OR
101988 (NVL(l_enc_upg_option, 'N') = 'O')
101989 )
101990 THEN
101991 NULL;
101992 --
101993 --
101994
101995 l_ccid := AcctDerRule_175(
101996 p_application_id => p_application_id
102000 , p_source_32 => p_source_32
101997 , p_ae_header_id => l_ae_header_id
101998 , p_source_5 => p_source_5
101999 , p_source_19 => p_source_19
102001 , x_transaction_coa_id => l_adr_transaction_coa_id
102002 , x_accounting_coa_id => l_adr_accounting_coa_id
102003 , x_value_type_code => l_adr_value_type_code
102004 , p_side => 'NA'
102005 );
102006
102007 xla_ae_lines_pkg.set_ccid(
102008 p_code_combination_id => l_ccid
102009 , p_value_type_code => l_adr_value_type_code
102010 , p_transaction_coa_id => l_adr_transaction_coa_id
102011 , p_accounting_coa_id => l_adr_accounting_coa_id
102012 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
102013 , p_adr_type_code => 'S'
102014 , p_component_type => l_component_type
102015 , p_component_code => l_component_code
102016 , p_component_type_code => l_component_type_code
102017 , p_component_appl_id => l_component_appl_id
102018 , p_amb_context_code => l_amb_context_code
102019 , p_side => 'NA'
102020 );
102021
102022
102023 l_segment := AcctDerRule_150(
102024 p_application_id => p_application_id
102025 , p_ae_header_id => l_ae_header_id
102026 , p_source_5 => p_source_5
102027 , p_source_12 => p_source_12
102028 , x_transaction_coa_id => l_adr_transaction_coa_id
102029 , x_accounting_coa_id => l_adr_accounting_coa_id
102030 , x_flexfield_segment_code => l_adr_flexfield_segment_code
102031 , x_flex_value_set_id => l_adr_flex_value_set_id
102032 , x_value_type_code => l_adr_value_type_code
102033 , x_value_combination_id => l_adr_value_combination_id
102034 , x_value_segment_code => l_adr_value_segment_code
102035 , p_side => 'NA'
102036 , p_override_seg_flag => 'Y'
102037 );
102038
102039 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
102040
102041 xla_ae_lines_pkg.set_segment(
102042 p_to_segment_code => 'GL_ACCOUNT'
102043 , p_segment_value => l_segment
102044 , p_from_segment_code => l_adr_value_segment_code
102045 , p_from_combination_id => l_adr_value_combination_id
102046 , p_value_type_code => l_adr_value_type_code
102047 , p_transaction_coa_id => l_adr_transaction_coa_id
102048 , p_accounting_coa_id => l_adr_accounting_coa_id
102049 , p_flexfield_segment_code => l_adr_flexfield_segment_code
102050 , p_flex_value_set_id => l_adr_flex_value_set_id
102051 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
102052 , p_adr_type_code => 'S'
102053 , p_component_type => l_component_type
102054 , p_component_code => l_component_code
102055 , p_component_type_code => l_component_type_code
102056 , p_component_appl_id => l_component_appl_id
102057 , p_amb_context_code => l_amb_context_code
102058 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
102059 , p_event_class_code => 'RESERVE_TRANSFERS'
102060 , p_side => 'NA'
102061 );
102062
102063 END IF;
102064
102065 l_segment := AcctDerRule_169(
102066 p_application_id => p_application_id
102067 , p_ae_header_id => l_ae_header_id
102068 , p_source_5 => p_source_5
102069 , p_source_31 => p_source_31
102070 , x_transaction_coa_id => l_adr_transaction_coa_id
102071 , x_accounting_coa_id => l_adr_accounting_coa_id
102072 , x_flexfield_segment_code => l_adr_flexfield_segment_code
102073 , x_flex_value_set_id => l_adr_flex_value_set_id
102074 , x_value_type_code => l_adr_value_type_code
102075 , x_value_combination_id => l_adr_value_combination_id
102076 , x_value_segment_code => l_adr_value_segment_code
102077 , p_side => 'NA'
102078 , p_override_seg_flag => 'Y'
102079 );
102080
102081 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
102082
102083 xla_ae_lines_pkg.set_segment(
102084 p_to_segment_code => 'GL_BALANCING'
102085 , p_segment_value => l_segment
102086 , p_from_segment_code => l_adr_value_segment_code
102087 , p_from_combination_id => l_adr_value_combination_id
102088 , p_value_type_code => l_adr_value_type_code
102089 , p_transaction_coa_id => l_adr_transaction_coa_id
102090 , p_accounting_coa_id => l_adr_accounting_coa_id
102091 , p_flexfield_segment_code => l_adr_flexfield_segment_code
102092 , p_flex_value_set_id => l_adr_flex_value_set_id
102093 , p_adr_code => 'FA_EXPENSE_ACCT'
102094 , p_adr_type_code => 'S'
102095 , p_component_type => l_component_type
102096 , p_component_code => l_component_code
102097 , p_component_type_code => l_component_type_code
102098 , p_component_appl_id => l_component_appl_id
102099 , p_amb_context_code => l_amb_context_code
102100 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
102101 , p_event_class_code => 'RESERVE_TRANSFERS'
102102 , p_side => 'NA'
102106
102103 );
102104
102105 END IF;
102107 --
102108 --
102109 END IF;
102110
102111 --
102112 -- Update the line information that should be overwritten
102113 --
102114 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
102115 p_header_num => 1);
102116 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
102117
102118 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
102119
102120 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
102121 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
102122 END IF;
102123
102124 --
102125 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
102126 --
102127 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
102128 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
102129 ELSE
102130 ---------------------------------------------------------------------------------------------------
102131 -- 4262811a Switch Sign
102132 ---------------------------------------------------------------------------------------------------
102133 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
102134 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
102135 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
102136 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
102137 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
102138 -- 5132302
102139 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
102140 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
102141
102142 END IF;
102143
102144 -- 4955764
102145 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
102146 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
102147
102148
102149 XLA_AE_LINES_PKG.ValidateCurrentLine;
102150 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
102151
102152 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
102153 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
102154 ,p_balance_type_code => l_balance_type_code);
102155
102156 END IF;
102157
102158 -----------------------------------------------------------------------------------------
102159 -- 4262811 Multiperiod Accounting
102160 -----------------------------------------------------------------------------------------
102161 -- No MPA option is assigned.
102162
102163
102164 END IF;
102165 END IF;
102166 --
102167
102168 --
102169 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
102170 trace
102171 (p_msg => 'END of AcctLineType_306'
102172 ,p_level => C_LEVEL_PROCEDURE
102173 ,p_module => l_log_module);
102174 END IF;
102175 --
102176 EXCEPTION
102177 WHEN xla_exceptions_pkg.application_exception THEN
102178 RAISE;
102179 WHEN OTHERS THEN
102180 xla_exceptions_pkg.raise_message
102181 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_306');
102182 END AcctLineType_306;
102183 --
102184
102185 ---------------------------------------
102186 --
102187 -- PRIVATE FUNCTION
102188 -- AcctLineType_307
102189 --
102190 ---------------------------------------
102191 PROCEDURE AcctLineType_307 (
102192 p_application_id IN NUMBER
102193 ,p_event_id IN NUMBER
102194 ,p_calculate_acctd_flag IN VARCHAR2
102195 ,p_calculate_g_l_flag IN VARCHAR2
102196 ,p_actual_flag IN OUT VARCHAR2
102197 ,p_balance_type_code OUT VARCHAR2
102198 ,p_gain_or_loss_ref OUT VARCHAR2
102199
102200 --Period Close Date
102201 , p_source_1 IN DATE
102202 --Bonus Depreciation Expense Account
102203 , p_source_4 IN VARCHAR2
102204 --Generated Code Combination Identifier
102205 , p_source_5 IN NUMBER
102206 --Expense Account Code Combination Identifier
102207 , p_source_31 IN NUMBER
102208 --Adjustment Type
102209 , p_source_48 IN VARCHAR2
102210 --Transaction Header Identifier
102211 , p_source_49 IN NUMBER
102212 --Adjustment Line Identifier
102213 , p_source_50 IN NUMBER
102214 --Distribution Type Code
102215 , p_source_51 IN VARCHAR2
102216 --Entered Amount
102217 , p_source_52 IN NUMBER
102218 --Currency Code
102219 , p_source_53 IN VARCHAR2
102220 )
102221 IS
102222
102223 l_component_type VARCHAR2(80);
102224 l_component_code VARCHAR2(30);
102225 l_component_type_code VARCHAR2(1);
102226 l_component_appl_id INTEGER;
102227 l_amb_context_code VARCHAR2(30);
102228 l_entity_code VARCHAR2(30);
102229 l_event_class_code VARCHAR2(30);
102230 l_ae_header_id NUMBER;
102231 l_event_type_code VARCHAR2(30);
102235 -- adr variables
102232 l_line_definition_code VARCHAR2(30);
102233 l_line_definition_owner_code VARCHAR2(1);
102234 --
102236 l_segment VARCHAR2(30);
102237 l_ccid NUMBER;
102238 l_adr_transaction_coa_id NUMBER;
102239 l_adr_accounting_coa_id NUMBER;
102240 l_adr_flexfield_segment_code VARCHAR2(30);
102241 l_adr_flex_value_set_id NUMBER;
102242 l_adr_value_type_code VARCHAR2(30);
102243 l_adr_value_combination_id NUMBER;
102244 l_adr_value_segment_code VARCHAR2(30);
102245
102246 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
102247 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
102248 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
102249 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
102250
102251 -- 4262811 Variables ------------------------------------------------------------------------------------------
102252 l_entered_amt_idx NUMBER;
102253 l_accted_amt_idx NUMBER;
102254 l_acc_rev_flag VARCHAR2(1);
102255 l_accrual_line_num NUMBER;
102256 l_tmp_amt NUMBER;
102257 l_acc_rev_natural_side_code VARCHAR2(1);
102258
102259 l_num_entries NUMBER;
102260 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
102261 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
102262 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
102263 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
102264 l_recog_line_1 NUMBER;
102265 l_recog_line_2 NUMBER;
102266
102267 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
102268 l_bflow_applied_to_amt NUMBER; -- 5132302
102269 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
102270
102271 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
102272
102273 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
102274 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
102275
102276 ---------------------------------------------------------------------------------------------------------------
102277
102278
102279 --
102280 -- bulk performance
102281 --
102282 l_balance_type_code VARCHAR2(1);
102283 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
102284 l_log_module VARCHAR2(240);
102285
102286 --
102287 -- Upgrade strategy
102288 --
102289 l_actual_upg_option VARCHAR2(1);
102290 l_enc_upg_option VARCHAR2(1);
102291
102292 --
102293 BEGIN
102294 --
102295 IF g_log_enabled THEN
102296 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_307';
102297 END IF;
102298 --
102299 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
102300
102301 trace
102302 (p_msg => 'BEGIN of AcctLineType_307'
102303 ,p_level => C_LEVEL_PROCEDURE
102304 ,p_module => l_log_module);
102305
102306 END IF;
102307 --
102308 l_component_type := 'AMB_JLT';
102309 l_component_code := 'FA_RETIREMENT_BONUS_DEPRN_EXP';
102310 l_component_type_code := 'S';
102311 l_component_appl_id := 140;
102312 l_amb_context_code := 'DEFAULT';
102313 l_entity_code := 'TRANSACTIONS';
102314 l_event_class_code := 'RETIREMENTS';
102315 l_event_type_code := 'RETIREMENTS';
102316 l_line_definition_owner_code := 'S';
102317 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
102318 --
102319 l_balance_type_code := 'A';
102320 l_segment := NULL;
102321 l_ccid := NULL;
102322 l_adr_transaction_coa_id := NULL;
102323 l_adr_accounting_coa_id := NULL;
102324 l_adr_flexfield_segment_code := NULL;
102325 l_adr_flex_value_set_id := NULL;
102326 l_adr_value_type_code := NULL;
102327 l_adr_value_combination_id := NULL;
102328 l_adr_value_segment_code := NULL;
102329
102330 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
102331 l_bflow_class_code := ''; -- 4219869 Business Flow
102332 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
102333 l_budgetary_control_flag := 'N';
102334
102335 l_bflow_applied_to_amt_idx := NULL; -- 5132302
102336 l_bflow_applied_to_amt := NULL; -- 5132302
102337 l_entered_amt_idx := NULL; -- 4262811
102338 l_accted_amt_idx := NULL; -- 4262811
102339 l_acc_rev_flag := NULL; -- 4262811
102340 l_accrual_line_num := NULL; -- 4262811
102341 l_tmp_amt := NULL; -- 4262811
102342 --
102343
102344 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
102345 l_balance_type_code <> 'B' THEN
102346 IF NVL(p_source_48,'
102347 ') = 'BONUS EXPENSE'
102348 THEN
102349
102350 --
102351 XLA_AE_LINES_PKG.SetNewLine;
102352
102353 p_balance_type_code := l_balance_type_code;
102354 -- set the flag so later we will know whether the gain loss line needs to be created
102355
102356 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
102357 p_actual_flag :='A';
102358 END IF;
102359
102363 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
102360 --
102361 -- bulk performance
102362 --
102364 p_header_num => 0); -- 4262811
102365 --
102366 -- set accounting line options
102367 --
102368 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
102369 p_natural_side_code => 'C'
102370 , p_gain_or_loss_flag => 'N'
102371 , p_gl_transfer_mode_code => 'S'
102372 , p_acct_entry_type_code => 'A'
102373 , p_switch_side_flag => 'Y'
102374 , p_merge_duplicate_code => 'N'
102375 );
102376 --
102377 l_acc_rev_natural_side_code := 'D'; -- 4262811
102378 --
102379 --
102380 -- set accounting line type info
102381 --
102382 xla_ae_lines_pkg.SetAcctLineType
102383 (p_component_type => l_component_type
102384 ,p_event_type_code => l_event_type_code
102385 ,p_line_definition_owner_code => l_line_definition_owner_code
102386 ,p_line_definition_code => l_line_definition_code
102387 ,p_accounting_line_code => l_component_code
102388 ,p_accounting_line_type_code => l_component_type_code
102389 ,p_accounting_line_appl_id => l_component_appl_id
102390 ,p_amb_context_code => l_amb_context_code
102391 ,p_entity_code => l_entity_code
102392 ,p_event_class_code => l_event_class_code);
102393 --
102394 -- set accounting class
102395 --
102396 xla_ae_lines_pkg.SetAcctClass(
102397 p_accounting_class_code => 'EXPENSE'
102398 , p_ae_header_id => l_ae_header_id
102399 );
102400
102401 --
102402 -- set rounding class
102403 --
102404 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
102405 'EXPENSE';
102406
102407 --
102408 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
102409 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
102410 --
102411 -- bulk performance
102412 --
102413 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
102414
102415 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
102416 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
102417
102418 -- 4955764
102419 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
102420 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
102421
102422 -- 4458381 Public Sector Enh
102423
102424 --
102425 -- set accounting attributes for the line type
102426 --
102427 l_entered_amt_idx := 4;
102428 l_accted_amt_idx := 6;
102429 l_bflow_applied_to_amt_idx := NULL; -- 5132302
102430 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
102431 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
102432 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
102433 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
102434 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
102435 l_rec_acct_attrs.array_char_value(3) := p_source_51;
102436 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
102437 l_rec_acct_attrs.array_num_value(4) := p_source_52;
102438 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
102439 l_rec_acct_attrs.array_char_value(5) := p_source_53;
102440 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
102441 l_rec_acct_attrs.array_num_value(6) := p_source_52;
102442
102443 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
102444 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
102445
102446 ---------------------------------------------------------------------------------------------------------------
102447 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
102448 ---------------------------------------------------------------------------------------------------------------
102449 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
102450
102451 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
102452 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
102453
102454 IF xla_accounting_cache_pkg.GetValueChar
102455 (p_source_code => 'LEDGER_CATEGORY_CODE'
102456 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
102457 AND l_bflow_method_code = 'PRIOR_ENTRY'
102458 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
102459 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
102460 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
102461 )
102462 THEN
102463 xla_ae_lines_pkg.BflowUpgEntry
102464 (p_business_method_code => l_bflow_method_code
102465 ,p_business_class_code => l_bflow_class_code
102466 ,p_balance_type => l_balance_type_code);
102467 ELSE
102468 NULL;
102469 -- No business flow processing for business flow method of NONE.
102470 END IF;
102474 --
102471
102472 --
102473 -- call analytical criteria
102475
102476 --
102477 -- call description
102478 --
102479
102480 xla_ae_lines_pkg.SetLineDescription(
102481 p_ae_header_id => l_ae_header_id
102482 ,p_description => Description_75 (
102483 p_application_id => p_application_id
102484 , p_ae_header_id => l_ae_header_id
102485 , p_source_1 => p_source_1
102486 )
102487 );
102488
102489
102490 --
102491 -- call ADRs
102492 -- Bug 4922099
102493 --
102494 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
102495 (NVL(l_actual_upg_option, 'N') = 'O') OR
102496 (NVL(l_enc_upg_option, 'N') = 'O')
102497 )
102498 THEN
102499 NULL;
102500 --
102501 --
102502
102503 l_ccid := AcctDerRule_176(
102504 p_application_id => p_application_id
102505 , p_ae_header_id => l_ae_header_id
102506 , p_source_5 => p_source_5
102507 , p_source_31 => p_source_31
102508 , x_transaction_coa_id => l_adr_transaction_coa_id
102509 , x_accounting_coa_id => l_adr_accounting_coa_id
102510 , x_value_type_code => l_adr_value_type_code
102511 , p_side => 'NA'
102512 );
102513
102514 xla_ae_lines_pkg.set_ccid(
102515 p_code_combination_id => l_ccid
102516 , p_value_type_code => l_adr_value_type_code
102517 , p_transaction_coa_id => l_adr_transaction_coa_id
102518 , p_accounting_coa_id => l_adr_accounting_coa_id
102519 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
102520 , p_adr_type_code => 'S'
102521 , p_component_type => l_component_type
102522 , p_component_code => l_component_code
102523 , p_component_type_code => l_component_type_code
102524 , p_component_appl_id => l_component_appl_id
102525 , p_amb_context_code => l_amb_context_code
102526 , p_side => 'NA'
102527 );
102528
102529
102530 l_segment := AcctDerRule_144(
102531 p_application_id => p_application_id
102532 , p_ae_header_id => l_ae_header_id
102533 , p_source_4 => p_source_4
102534 , p_source_5 => p_source_5
102535 , x_transaction_coa_id => l_adr_transaction_coa_id
102536 , x_accounting_coa_id => l_adr_accounting_coa_id
102537 , x_flexfield_segment_code => l_adr_flexfield_segment_code
102538 , x_flex_value_set_id => l_adr_flex_value_set_id
102539 , x_value_type_code => l_adr_value_type_code
102540 , x_value_combination_id => l_adr_value_combination_id
102541 , x_value_segment_code => l_adr_value_segment_code
102542 , p_side => 'NA'
102543 , p_override_seg_flag => 'Y'
102544 );
102545
102546 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
102547
102548 xla_ae_lines_pkg.set_segment(
102549 p_to_segment_code => 'GL_ACCOUNT'
102550 , p_segment_value => l_segment
102551 , p_from_segment_code => l_adr_value_segment_code
102552 , p_from_combination_id => l_adr_value_combination_id
102553 , p_value_type_code => l_adr_value_type_code
102554 , p_transaction_coa_id => l_adr_transaction_coa_id
102555 , p_accounting_coa_id => l_adr_accounting_coa_id
102556 , p_flexfield_segment_code => l_adr_flexfield_segment_code
102557 , p_flex_value_set_id => l_adr_flex_value_set_id
102558 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
102559 , p_adr_type_code => 'S'
102560 , p_component_type => l_component_type
102561 , p_component_code => l_component_code
102562 , p_component_type_code => l_component_type_code
102563 , p_component_appl_id => l_component_appl_id
102564 , p_amb_context_code => l_amb_context_code
102565 , p_entity_code => 'TRANSACTIONS'
102566 , p_event_class_code => 'RETIREMENTS'
102567 , p_side => 'NA'
102568 );
102569
102570 END IF;
102571
102572 --
102573 --
102574 END IF;
102575 --
102576 -- Bug 4922099
102577 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
102578 (NVL(l_enc_upg_option, 'N') = 'O')
102579 ) AND
102580 (l_bflow_method_code = 'PRIOR_ENTRY')
102581 )
102582 THEN
102583 IF
102584 --
102585 1 = 2
102586 --
102587 THEN
102588 xla_accounting_err_pkg.build_message
102589 (p_appli_s_name => 'XLA'
102590 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
102591 ,p_token_1 => 'LINE_NUMBER'
102592 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
102593 ,p_token_2 => 'LINE_TYPE_NAME'
102594 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
102595 l_component_type
102599 ,l_amb_context_code
102596 ,l_component_code
102597 ,l_component_type_code
102598 ,l_component_appl_id
102600 ,l_entity_code
102601 ,l_event_class_code
102602 )
102603 ,p_token_3 => 'OWNER'
102604 ,p_value_3 => xla_lookups_pkg.get_meaning(
102605 p_lookup_type => 'XLA_OWNER_TYPE'
102606 ,p_lookup_code => l_component_type_code
102607 )
102608 ,p_token_4 => 'PRODUCT_NAME'
102609 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
102610 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
102611 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
102612 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
102613 ,p_ae_header_id => NULL
102614 );
102615
102616 IF (C_LEVEL_ERROR>= g_log_level) THEN
102617 trace
102618 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
102619 ,p_level => C_LEVEL_ERROR
102620 ,p_module => l_log_module);
102621 END IF;
102622 END IF;
102623 END IF;
102624 --
102625 --
102626 ------------------------------------------------------------------------------------------------
102627 -- 4219869 Business Flow
102628 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
102629 -- Prior Entry. Currently, the following code is always generated.
102630 ------------------------------------------------------------------------------------------------
102631 XLA_AE_LINES_PKG.ValidateCurrentLine;
102632
102633 ------------------------------------------------------------------------------------
102634 -- 4219869 Business Flow
102635 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
102636 ------------------------------------------------------------------------------------
102637 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
102638
102639 ----------------------------------------------------------------------------------
102640 -- 4219869 Business Flow
102641 -- Update journal entry status -- Need to generate this within IF <condition>
102642 ----------------------------------------------------------------------------------
102643 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
102644 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
102645 ,p_balance_type_code => l_balance_type_code
102646 );
102647
102648 -------------------------------------------------------------------------------------------
102649 -- 4262811 - Generate the Accrual Reversal lines
102650 -------------------------------------------------------------------------------------------
102651 BEGIN
102652 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
102653 (g_array_event(p_event_id).array_value_num('header_index'));
102654 IF l_acc_rev_flag IS NULL THEN
102655 l_acc_rev_flag := 'N';
102656 END IF;
102657 EXCEPTION
102658 WHEN OTHERS THEN
102659 l_acc_rev_flag := 'N';
102660 END;
102661 --
102662 IF (l_acc_rev_flag = 'Y') THEN
102663
102664 -- 4645092 ------------------------------------------------------------------------------
102665 -- To allow MPA report to determine if it should generate report process
102666 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
102667 ------------------------------------------------------------------------------------------
102668
102669 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
102670 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
102671 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
102672 -- call ADRs
102673 -- Bug 4922099
102674 --
102675 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
102676 (NVL(l_actual_upg_option, 'N') = 'O') OR
102677 (NVL(l_enc_upg_option, 'N') = 'O')
102678 )
102679 THEN
102680 NULL;
102681 --
102682 --
102683
102684 l_ccid := AcctDerRule_176(
102685 p_application_id => p_application_id
102686 , p_ae_header_id => l_ae_header_id
102687 , p_source_5 => p_source_5
102688 , p_source_31 => p_source_31
102689 , x_transaction_coa_id => l_adr_transaction_coa_id
102690 , x_accounting_coa_id => l_adr_accounting_coa_id
102691 , x_value_type_code => l_adr_value_type_code
102692 , p_side => 'NA'
102693 );
102694
102695 xla_ae_lines_pkg.set_ccid(
102699 , p_accounting_coa_id => l_adr_accounting_coa_id
102696 p_code_combination_id => l_ccid
102697 , p_value_type_code => l_adr_value_type_code
102698 , p_transaction_coa_id => l_adr_transaction_coa_id
102700 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
102701 , p_adr_type_code => 'S'
102702 , p_component_type => l_component_type
102703 , p_component_code => l_component_code
102704 , p_component_type_code => l_component_type_code
102705 , p_component_appl_id => l_component_appl_id
102706 , p_amb_context_code => l_amb_context_code
102707 , p_side => 'NA'
102708 );
102709
102710
102711 l_segment := AcctDerRule_144(
102712 p_application_id => p_application_id
102713 , p_ae_header_id => l_ae_header_id
102714 , p_source_4 => p_source_4
102715 , p_source_5 => p_source_5
102716 , x_transaction_coa_id => l_adr_transaction_coa_id
102717 , x_accounting_coa_id => l_adr_accounting_coa_id
102718 , x_flexfield_segment_code => l_adr_flexfield_segment_code
102719 , x_flex_value_set_id => l_adr_flex_value_set_id
102720 , x_value_type_code => l_adr_value_type_code
102721 , x_value_combination_id => l_adr_value_combination_id
102722 , x_value_segment_code => l_adr_value_segment_code
102723 , p_side => 'NA'
102724 , p_override_seg_flag => 'Y'
102725 );
102726
102727 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
102728
102729 xla_ae_lines_pkg.set_segment(
102730 p_to_segment_code => 'GL_ACCOUNT'
102731 , p_segment_value => l_segment
102732 , p_from_segment_code => l_adr_value_segment_code
102733 , p_from_combination_id => l_adr_value_combination_id
102734 , p_value_type_code => l_adr_value_type_code
102735 , p_transaction_coa_id => l_adr_transaction_coa_id
102736 , p_accounting_coa_id => l_adr_accounting_coa_id
102737 , p_flexfield_segment_code => l_adr_flexfield_segment_code
102738 , p_flex_value_set_id => l_adr_flex_value_set_id
102739 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
102740 , p_adr_type_code => 'S'
102741 , p_component_type => l_component_type
102742 , p_component_code => l_component_code
102743 , p_component_type_code => l_component_type_code
102744 , p_component_appl_id => l_component_appl_id
102745 , p_amb_context_code => l_amb_context_code
102746 , p_entity_code => 'TRANSACTIONS'
102747 , p_event_class_code => 'RETIREMENTS'
102748 , p_side => 'NA'
102749 );
102750
102751 END IF;
102752
102753 --
102754 --
102755 END IF;
102756
102757 --
102758 -- Update the line information that should be overwritten
102759 --
102760 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
102761 p_header_num => 1);
102762 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
102763
102764 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
102765
102766 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
102767 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
102768 END IF;
102769
102770 --
102771 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
102772 --
102773 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
102774 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
102775 ELSE
102776 ---------------------------------------------------------------------------------------------------
102777 -- 4262811a Switch Sign
102778 ---------------------------------------------------------------------------------------------------
102779 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
102780 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
102781 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
102782 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
102783 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
102784 -- 5132302
102785 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
102786 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
102787
102788 END IF;
102789
102790 -- 4955764
102791 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
102792 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
102793
102794
102795 XLA_AE_LINES_PKG.ValidateCurrentLine;
102796 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
102797
102798 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
102799 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
102803
102800 ,p_balance_type_code => l_balance_type_code);
102801
102802 END IF;
102804 -----------------------------------------------------------------------------------------
102805 -- 4262811 Multiperiod Accounting
102806 -----------------------------------------------------------------------------------------
102807 -- No MPA option is assigned.
102808
102809
102810 END IF;
102811 END IF;
102812 --
102813
102814 --
102815 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
102816 trace
102817 (p_msg => 'END of AcctLineType_307'
102818 ,p_level => C_LEVEL_PROCEDURE
102819 ,p_module => l_log_module);
102820 END IF;
102821 --
102822 EXCEPTION
102823 WHEN xla_exceptions_pkg.application_exception THEN
102824 RAISE;
102825 WHEN OTHERS THEN
102826 xla_exceptions_pkg.raise_message
102827 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_307');
102828 END AcctLineType_307;
102829 --
102830
102831 ---------------------------------------
102832 --
102833 -- PRIVATE FUNCTION
102834 -- AcctLineType_308
102835 --
102836 ---------------------------------------
102837 PROCEDURE AcctLineType_308 (
102838 p_application_id IN NUMBER
102839 ,p_event_id IN NUMBER
102840 ,p_calculate_acctd_flag IN VARCHAR2
102841 ,p_calculate_g_l_flag IN VARCHAR2
102842 ,p_actual_flag IN OUT VARCHAR2
102843 ,p_balance_type_code OUT VARCHAR2
102844 ,p_gain_or_loss_ref OUT VARCHAR2
102845
102846 --Period Close Date
102847 , p_source_1 IN DATE
102848 --Bonus Depreciation Expense Account
102849 , p_source_4 IN VARCHAR2
102850 --Generated Code Combination Identifier
102851 , p_source_5 IN NUMBER
102852 --Expense Account Code Combination Identifier
102853 , p_source_31 IN NUMBER
102854 --Adjustment Type
102855 , p_source_48 IN VARCHAR2
102856 --Transaction Header Identifier
102857 , p_source_49 IN NUMBER
102858 --Adjustment Line Identifier
102859 , p_source_50 IN NUMBER
102860 --Distribution Type Code
102861 , p_source_51 IN VARCHAR2
102862 --Entered Amount
102863 , p_source_52 IN NUMBER
102864 --Currency Code
102865 , p_source_53 IN VARCHAR2
102866 )
102867 IS
102868
102869 l_component_type VARCHAR2(80);
102870 l_component_code VARCHAR2(30);
102871 l_component_type_code VARCHAR2(1);
102872 l_component_appl_id INTEGER;
102873 l_amb_context_code VARCHAR2(30);
102874 l_entity_code VARCHAR2(30);
102875 l_event_class_code VARCHAR2(30);
102876 l_ae_header_id NUMBER;
102877 l_event_type_code VARCHAR2(30);
102878 l_line_definition_code VARCHAR2(30);
102879 l_line_definition_owner_code VARCHAR2(1);
102880 --
102881 -- adr variables
102882 l_segment VARCHAR2(30);
102883 l_ccid NUMBER;
102884 l_adr_transaction_coa_id NUMBER;
102885 l_adr_accounting_coa_id NUMBER;
102886 l_adr_flexfield_segment_code VARCHAR2(30);
102887 l_adr_flex_value_set_id NUMBER;
102888 l_adr_value_type_code VARCHAR2(30);
102889 l_adr_value_combination_id NUMBER;
102890 l_adr_value_segment_code VARCHAR2(30);
102891
102892 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
102893 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
102894 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
102895 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
102896
102897 -- 4262811 Variables ------------------------------------------------------------------------------------------
102898 l_entered_amt_idx NUMBER;
102899 l_accted_amt_idx NUMBER;
102900 l_acc_rev_flag VARCHAR2(1);
102901 l_accrual_line_num NUMBER;
102902 l_tmp_amt NUMBER;
102903 l_acc_rev_natural_side_code VARCHAR2(1);
102904
102905 l_num_entries NUMBER;
102906 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
102907 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
102908 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
102909 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
102910 l_recog_line_1 NUMBER;
102911 l_recog_line_2 NUMBER;
102912
102913 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
102914 l_bflow_applied_to_amt NUMBER; -- 5132302
102915 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
102916
102917 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
102918
102919 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
102920 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
102921
102922 ---------------------------------------------------------------------------------------------------------------
102923
102924
102925 --
102926 -- bulk performance
102927 --
102928 l_balance_type_code VARCHAR2(1);
102929 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
102930 l_log_module VARCHAR2(240);
102931
102932 --
102933 -- Upgrade strategy
102934 --
102938 --
102935 l_actual_upg_option VARCHAR2(1);
102936 l_enc_upg_option VARCHAR2(1);
102937
102939 BEGIN
102940 --
102941 IF g_log_enabled THEN
102942 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_308';
102943 END IF;
102944 --
102945 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
102946
102947 trace
102948 (p_msg => 'BEGIN of AcctLineType_308'
102949 ,p_level => C_LEVEL_PROCEDURE
102950 ,p_module => l_log_module);
102951
102952 END IF;
102953 --
102954 l_component_type := 'AMB_JLT';
102955 l_component_code := 'FA_RETIREMENT_BONUS_DEPRN_EXP';
102956 l_component_type_code := 'S';
102957 l_component_appl_id := 140;
102958 l_amb_context_code := 'DEFAULT';
102959 l_entity_code := 'TRANSACTIONS';
102960 l_event_class_code := 'RETIREMENTS';
102961 l_event_type_code := 'REINSTATEMENTS';
102962 l_line_definition_owner_code := 'S';
102963 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
102964 --
102965 l_balance_type_code := 'A';
102966 l_segment := NULL;
102967 l_ccid := NULL;
102968 l_adr_transaction_coa_id := NULL;
102969 l_adr_accounting_coa_id := NULL;
102970 l_adr_flexfield_segment_code := NULL;
102971 l_adr_flex_value_set_id := NULL;
102972 l_adr_value_type_code := NULL;
102973 l_adr_value_combination_id := NULL;
102974 l_adr_value_segment_code := NULL;
102975
102976 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
102977 l_bflow_class_code := ''; -- 4219869 Business Flow
102978 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
102979 l_budgetary_control_flag := 'N';
102980
102981 l_bflow_applied_to_amt_idx := NULL; -- 5132302
102982 l_bflow_applied_to_amt := NULL; -- 5132302
102983 l_entered_amt_idx := NULL; -- 4262811
102984 l_accted_amt_idx := NULL; -- 4262811
102985 l_acc_rev_flag := NULL; -- 4262811
102986 l_accrual_line_num := NULL; -- 4262811
102987 l_tmp_amt := NULL; -- 4262811
102988 --
102989
102990 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
102991 l_balance_type_code <> 'B' THEN
102992 IF NVL(p_source_48,'
102993 ') = 'BONUS EXPENSE'
102994 THEN
102995
102996 --
102997 XLA_AE_LINES_PKG.SetNewLine;
102998
102999 p_balance_type_code := l_balance_type_code;
103000 -- set the flag so later we will know whether the gain loss line needs to be created
103001
103002 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
103003 p_actual_flag :='A';
103004 END IF;
103005
103006 --
103007 -- bulk performance
103008 --
103009 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
103010 p_header_num => 0); -- 4262811
103011 --
103012 -- set accounting line options
103013 --
103014 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
103015 p_natural_side_code => 'C'
103016 , p_gain_or_loss_flag => 'N'
103017 , p_gl_transfer_mode_code => 'S'
103018 , p_acct_entry_type_code => 'A'
103019 , p_switch_side_flag => 'Y'
103020 , p_merge_duplicate_code => 'N'
103021 );
103022 --
103023 l_acc_rev_natural_side_code := 'D'; -- 4262811
103024 --
103025 --
103026 -- set accounting line type info
103027 --
103028 xla_ae_lines_pkg.SetAcctLineType
103029 (p_component_type => l_component_type
103030 ,p_event_type_code => l_event_type_code
103031 ,p_line_definition_owner_code => l_line_definition_owner_code
103032 ,p_line_definition_code => l_line_definition_code
103033 ,p_accounting_line_code => l_component_code
103034 ,p_accounting_line_type_code => l_component_type_code
103035 ,p_accounting_line_appl_id => l_component_appl_id
103036 ,p_amb_context_code => l_amb_context_code
103037 ,p_entity_code => l_entity_code
103038 ,p_event_class_code => l_event_class_code);
103039 --
103040 -- set accounting class
103041 --
103042 xla_ae_lines_pkg.SetAcctClass(
103043 p_accounting_class_code => 'EXPENSE'
103044 , p_ae_header_id => l_ae_header_id
103045 );
103046
103047 --
103048 -- set rounding class
103049 --
103050 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
103051 'EXPENSE';
103052
103053 --
103054 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
103055 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
103056 --
103057 -- bulk performance
103058 --
103059 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
103060
103061 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
103062 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
103063
103064 -- 4955764
103065 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
103069
103066 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
103067
103068 -- 4458381 Public Sector Enh
103070 --
103071 -- set accounting attributes for the line type
103072 --
103073 l_entered_amt_idx := 4;
103074 l_accted_amt_idx := 6;
103075 l_bflow_applied_to_amt_idx := NULL; -- 5132302
103076 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
103077 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
103078 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
103079 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
103080 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
103081 l_rec_acct_attrs.array_char_value(3) := p_source_51;
103082 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
103083 l_rec_acct_attrs.array_num_value(4) := p_source_52;
103084 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
103085 l_rec_acct_attrs.array_char_value(5) := p_source_53;
103086 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
103087 l_rec_acct_attrs.array_num_value(6) := p_source_52;
103088
103089 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
103090 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
103091
103092 ---------------------------------------------------------------------------------------------------------------
103093 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
103094 ---------------------------------------------------------------------------------------------------------------
103095 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
103096
103097 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
103098 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
103099
103100 IF xla_accounting_cache_pkg.GetValueChar
103101 (p_source_code => 'LEDGER_CATEGORY_CODE'
103102 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
103103 AND l_bflow_method_code = 'PRIOR_ENTRY'
103104 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
103105 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
103106 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
103107 )
103108 THEN
103109 xla_ae_lines_pkg.BflowUpgEntry
103110 (p_business_method_code => l_bflow_method_code
103111 ,p_business_class_code => l_bflow_class_code
103112 ,p_balance_type => l_balance_type_code);
103113 ELSE
103114 NULL;
103115 -- No business flow processing for business flow method of NONE.
103116 END IF;
103117
103118 --
103119 -- call analytical criteria
103120 --
103121
103122 --
103123 -- call description
103124 --
103125
103126 xla_ae_lines_pkg.SetLineDescription(
103127 p_ae_header_id => l_ae_header_id
103128 ,p_description => Description_75 (
103129 p_application_id => p_application_id
103130 , p_ae_header_id => l_ae_header_id
103131 , p_source_1 => p_source_1
103132 )
103133 );
103134
103135
103136 --
103137 -- call ADRs
103138 -- Bug 4922099
103139 --
103140 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
103141 (NVL(l_actual_upg_option, 'N') = 'O') OR
103142 (NVL(l_enc_upg_option, 'N') = 'O')
103143 )
103144 THEN
103145 NULL;
103146 --
103147 --
103148
103149 l_ccid := AcctDerRule_176(
103150 p_application_id => p_application_id
103151 , p_ae_header_id => l_ae_header_id
103152 , p_source_5 => p_source_5
103153 , p_source_31 => p_source_31
103154 , x_transaction_coa_id => l_adr_transaction_coa_id
103155 , x_accounting_coa_id => l_adr_accounting_coa_id
103156 , x_value_type_code => l_adr_value_type_code
103157 , p_side => 'NA'
103158 );
103159
103160 xla_ae_lines_pkg.set_ccid(
103161 p_code_combination_id => l_ccid
103162 , p_value_type_code => l_adr_value_type_code
103163 , p_transaction_coa_id => l_adr_transaction_coa_id
103164 , p_accounting_coa_id => l_adr_accounting_coa_id
103165 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
103166 , p_adr_type_code => 'S'
103167 , p_component_type => l_component_type
103168 , p_component_code => l_component_code
103169 , p_component_type_code => l_component_type_code
103170 , p_component_appl_id => l_component_appl_id
103171 , p_amb_context_code => l_amb_context_code
103172 , p_side => 'NA'
103173 );
103174
103175
103176 l_segment := AcctDerRule_144(
103177 p_application_id => p_application_id
103178 , p_ae_header_id => l_ae_header_id
103179 , p_source_4 => p_source_4
103180 , p_source_5 => p_source_5
103181 , x_transaction_coa_id => l_adr_transaction_coa_id
103182 , x_accounting_coa_id => l_adr_accounting_coa_id
103186 , x_value_combination_id => l_adr_value_combination_id
103183 , x_flexfield_segment_code => l_adr_flexfield_segment_code
103184 , x_flex_value_set_id => l_adr_flex_value_set_id
103185 , x_value_type_code => l_adr_value_type_code
103187 , x_value_segment_code => l_adr_value_segment_code
103188 , p_side => 'NA'
103189 , p_override_seg_flag => 'Y'
103190 );
103191
103192 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
103193
103194 xla_ae_lines_pkg.set_segment(
103195 p_to_segment_code => 'GL_ACCOUNT'
103196 , p_segment_value => l_segment
103197 , p_from_segment_code => l_adr_value_segment_code
103198 , p_from_combination_id => l_adr_value_combination_id
103199 , p_value_type_code => l_adr_value_type_code
103200 , p_transaction_coa_id => l_adr_transaction_coa_id
103201 , p_accounting_coa_id => l_adr_accounting_coa_id
103202 , p_flexfield_segment_code => l_adr_flexfield_segment_code
103203 , p_flex_value_set_id => l_adr_flex_value_set_id
103204 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
103205 , p_adr_type_code => 'S'
103206 , p_component_type => l_component_type
103207 , p_component_code => l_component_code
103208 , p_component_type_code => l_component_type_code
103209 , p_component_appl_id => l_component_appl_id
103210 , p_amb_context_code => l_amb_context_code
103211 , p_entity_code => 'TRANSACTIONS'
103212 , p_event_class_code => 'RETIREMENTS'
103213 , p_side => 'NA'
103214 );
103215
103216 END IF;
103217
103218 --
103219 --
103220 END IF;
103221 --
103222 -- Bug 4922099
103223 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
103224 (NVL(l_enc_upg_option, 'N') = 'O')
103225 ) AND
103226 (l_bflow_method_code = 'PRIOR_ENTRY')
103227 )
103228 THEN
103229 IF
103230 --
103231 1 = 2
103232 --
103233 THEN
103234 xla_accounting_err_pkg.build_message
103235 (p_appli_s_name => 'XLA'
103236 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
103237 ,p_token_1 => 'LINE_NUMBER'
103238 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
103239 ,p_token_2 => 'LINE_TYPE_NAME'
103240 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
103241 l_component_type
103242 ,l_component_code
103243 ,l_component_type_code
103244 ,l_component_appl_id
103245 ,l_amb_context_code
103246 ,l_entity_code
103247 ,l_event_class_code
103248 )
103249 ,p_token_3 => 'OWNER'
103250 ,p_value_3 => xla_lookups_pkg.get_meaning(
103251 p_lookup_type => 'XLA_OWNER_TYPE'
103252 ,p_lookup_code => l_component_type_code
103253 )
103254 ,p_token_4 => 'PRODUCT_NAME'
103255 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
103256 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
103257 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
103258 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
103259 ,p_ae_header_id => NULL
103260 );
103261
103262 IF (C_LEVEL_ERROR>= g_log_level) THEN
103263 trace
103264 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
103265 ,p_level => C_LEVEL_ERROR
103266 ,p_module => l_log_module);
103267 END IF;
103268 END IF;
103269 END IF;
103270 --
103271 --
103272 ------------------------------------------------------------------------------------------------
103273 -- 4219869 Business Flow
103274 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
103275 -- Prior Entry. Currently, the following code is always generated.
103276 ------------------------------------------------------------------------------------------------
103277 XLA_AE_LINES_PKG.ValidateCurrentLine;
103278
103279 ------------------------------------------------------------------------------------
103280 -- 4219869 Business Flow
103284
103281 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
103282 ------------------------------------------------------------------------------------
103283 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
103285 ----------------------------------------------------------------------------------
103286 -- 4219869 Business Flow
103287 -- Update journal entry status -- Need to generate this within IF <condition>
103288 ----------------------------------------------------------------------------------
103289 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
103290 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
103291 ,p_balance_type_code => l_balance_type_code
103292 );
103293
103294 -------------------------------------------------------------------------------------------
103295 -- 4262811 - Generate the Accrual Reversal lines
103296 -------------------------------------------------------------------------------------------
103297 BEGIN
103298 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
103299 (g_array_event(p_event_id).array_value_num('header_index'));
103300 IF l_acc_rev_flag IS NULL THEN
103301 l_acc_rev_flag := 'N';
103302 END IF;
103303 EXCEPTION
103304 WHEN OTHERS THEN
103305 l_acc_rev_flag := 'N';
103306 END;
103307 --
103308 IF (l_acc_rev_flag = 'Y') THEN
103309
103310 -- 4645092 ------------------------------------------------------------------------------
103311 -- To allow MPA report to determine if it should generate report process
103312 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
103313 ------------------------------------------------------------------------------------------
103314
103315 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
103316 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
103317 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
103318 -- call ADRs
103319 -- Bug 4922099
103320 --
103321 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
103322 (NVL(l_actual_upg_option, 'N') = 'O') OR
103323 (NVL(l_enc_upg_option, 'N') = 'O')
103324 )
103325 THEN
103326 NULL;
103327 --
103328 --
103329
103330 l_ccid := AcctDerRule_176(
103331 p_application_id => p_application_id
103332 , p_ae_header_id => l_ae_header_id
103333 , p_source_5 => p_source_5
103334 , p_source_31 => p_source_31
103335 , x_transaction_coa_id => l_adr_transaction_coa_id
103336 , x_accounting_coa_id => l_adr_accounting_coa_id
103337 , x_value_type_code => l_adr_value_type_code
103338 , p_side => 'NA'
103339 );
103340
103341 xla_ae_lines_pkg.set_ccid(
103342 p_code_combination_id => l_ccid
103343 , p_value_type_code => l_adr_value_type_code
103344 , p_transaction_coa_id => l_adr_transaction_coa_id
103345 , p_accounting_coa_id => l_adr_accounting_coa_id
103346 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
103347 , p_adr_type_code => 'S'
103348 , p_component_type => l_component_type
103349 , p_component_code => l_component_code
103350 , p_component_type_code => l_component_type_code
103351 , p_component_appl_id => l_component_appl_id
103352 , p_amb_context_code => l_amb_context_code
103353 , p_side => 'NA'
103354 );
103355
103356
103357 l_segment := AcctDerRule_144(
103358 p_application_id => p_application_id
103359 , p_ae_header_id => l_ae_header_id
103360 , p_source_4 => p_source_4
103361 , p_source_5 => p_source_5
103362 , x_transaction_coa_id => l_adr_transaction_coa_id
103363 , x_accounting_coa_id => l_adr_accounting_coa_id
103364 , x_flexfield_segment_code => l_adr_flexfield_segment_code
103365 , x_flex_value_set_id => l_adr_flex_value_set_id
103366 , x_value_type_code => l_adr_value_type_code
103367 , x_value_combination_id => l_adr_value_combination_id
103368 , x_value_segment_code => l_adr_value_segment_code
103369 , p_side => 'NA'
103370 , p_override_seg_flag => 'Y'
103371 );
103372
103373 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
103374
103375 xla_ae_lines_pkg.set_segment(
103376 p_to_segment_code => 'GL_ACCOUNT'
103377 , p_segment_value => l_segment
103378 , p_from_segment_code => l_adr_value_segment_code
103379 , p_from_combination_id => l_adr_value_combination_id
103380 , p_value_type_code => l_adr_value_type_code
103381 , p_transaction_coa_id => l_adr_transaction_coa_id
103382 , p_accounting_coa_id => l_adr_accounting_coa_id
103383 , p_flexfield_segment_code => l_adr_flexfield_segment_code
103384 , p_flex_value_set_id => l_adr_flex_value_set_id
103385 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
103386 , p_adr_type_code => 'S'
103387 , p_component_type => l_component_type
103388 , p_component_code => l_component_code
103389 , p_component_type_code => l_component_type_code
103390 , p_component_appl_id => l_component_appl_id
103391 , p_amb_context_code => l_amb_context_code
103395 );
103392 , p_entity_code => 'TRANSACTIONS'
103393 , p_event_class_code => 'RETIREMENTS'
103394 , p_side => 'NA'
103396
103397 END IF;
103398
103399 --
103400 --
103401 END IF;
103402
103403 --
103404 -- Update the line information that should be overwritten
103405 --
103406 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
103407 p_header_num => 1);
103408 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
103409
103410 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
103411
103412 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
103413 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
103414 END IF;
103415
103416 --
103417 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
103418 --
103419 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
103420 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
103421 ELSE
103422 ---------------------------------------------------------------------------------------------------
103423 -- 4262811a Switch Sign
103424 ---------------------------------------------------------------------------------------------------
103425 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
103426 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
103427 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
103428 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
103429 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
103430 -- 5132302
103431 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
103432 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
103433
103434 END IF;
103435
103436 -- 4955764
103437 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
103438 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
103439
103440
103441 XLA_AE_LINES_PKG.ValidateCurrentLine;
103442 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
103443
103444 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
103445 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
103446 ,p_balance_type_code => l_balance_type_code);
103447
103448 END IF;
103449
103450 -----------------------------------------------------------------------------------------
103451 -- 4262811 Multiperiod Accounting
103452 -----------------------------------------------------------------------------------------
103453 -- No MPA option is assigned.
103454
103455
103456 END IF;
103457 END IF;
103458 --
103459
103460 --
103461 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
103462 trace
103463 (p_msg => 'END of AcctLineType_308'
103464 ,p_level => C_LEVEL_PROCEDURE
103465 ,p_module => l_log_module);
103466 END IF;
103467 --
103468 EXCEPTION
103469 WHEN xla_exceptions_pkg.application_exception THEN
103470 RAISE;
103471 WHEN OTHERS THEN
103472 xla_exceptions_pkg.raise_message
103473 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_308');
103474 END AcctLineType_308;
103475 --
103476
103477 ---------------------------------------
103478 --
103479 -- PRIVATE FUNCTION
103480 -- AcctLineType_309
103481 --
103482 ---------------------------------------
103483 PROCEDURE AcctLineType_309 (
103484 p_application_id IN NUMBER
103485 ,p_event_id IN NUMBER
103486 ,p_calculate_acctd_flag IN VARCHAR2
103487 ,p_calculate_g_l_flag IN VARCHAR2
103488 ,p_actual_flag IN OUT VARCHAR2
103489 ,p_balance_type_code OUT VARCHAR2
103490 ,p_gain_or_loss_ref OUT VARCHAR2
103491
103492 --Period Close Date
103493 , p_source_1 IN DATE
103494 --Generated Code Combination Identifier
103495 , p_source_5 IN NUMBER
103496 --Bonus Reserve Account
103497 , p_source_6 IN VARCHAR2
103498 --Generated Offset Code Combination Identifier
103499 , p_source_19 IN NUMBER
103500 --Expense Account Code Combination Identifier
103501 , p_source_31 IN NUMBER
103502 --Default Code Combination Identifier
103503 , p_source_32 IN NUMBER
103504 --Adjustment Type
103505 , p_source_48 IN VARCHAR2
103506 --Transaction Header Identifier
103507 , p_source_49 IN NUMBER
103508 --Adjustment Line Identifier
103509 , p_source_50 IN NUMBER
103510 --Distribution Type Code
103511 , p_source_51 IN VARCHAR2
103512 --Entered Amount
103513 , p_source_52 IN NUMBER
103514 --Currency Code
103515 , p_source_53 IN VARCHAR2
103516 )
103517 IS
103518
103519 l_component_type VARCHAR2(80);
103523 l_amb_context_code VARCHAR2(30);
103520 l_component_code VARCHAR2(30);
103521 l_component_type_code VARCHAR2(1);
103522 l_component_appl_id INTEGER;
103524 l_entity_code VARCHAR2(30);
103525 l_event_class_code VARCHAR2(30);
103526 l_ae_header_id NUMBER;
103527 l_event_type_code VARCHAR2(30);
103528 l_line_definition_code VARCHAR2(30);
103529 l_line_definition_owner_code VARCHAR2(1);
103530 --
103531 -- adr variables
103532 l_segment VARCHAR2(30);
103533 l_ccid NUMBER;
103534 l_adr_transaction_coa_id NUMBER;
103535 l_adr_accounting_coa_id NUMBER;
103536 l_adr_flexfield_segment_code VARCHAR2(30);
103537 l_adr_flex_value_set_id NUMBER;
103538 l_adr_value_type_code VARCHAR2(30);
103539 l_adr_value_combination_id NUMBER;
103540 l_adr_value_segment_code VARCHAR2(30);
103541
103542 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
103543 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
103544 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
103545 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
103546
103547 -- 4262811 Variables ------------------------------------------------------------------------------------------
103548 l_entered_amt_idx NUMBER;
103549 l_accted_amt_idx NUMBER;
103550 l_acc_rev_flag VARCHAR2(1);
103551 l_accrual_line_num NUMBER;
103552 l_tmp_amt NUMBER;
103553 l_acc_rev_natural_side_code VARCHAR2(1);
103554
103555 l_num_entries NUMBER;
103556 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
103557 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
103558 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
103559 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
103560 l_recog_line_1 NUMBER;
103561 l_recog_line_2 NUMBER;
103562
103563 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
103564 l_bflow_applied_to_amt NUMBER; -- 5132302
103565 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
103566
103567 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
103568
103569 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
103570 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
103571
103572 ---------------------------------------------------------------------------------------------------------------
103573
103574
103575 --
103576 -- bulk performance
103577 --
103578 l_balance_type_code VARCHAR2(1);
103579 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
103580 l_log_module VARCHAR2(240);
103581
103582 --
103583 -- Upgrade strategy
103584 --
103585 l_actual_upg_option VARCHAR2(1);
103586 l_enc_upg_option VARCHAR2(1);
103587
103588 --
103589 BEGIN
103590 --
103591 IF g_log_enabled THEN
103592 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_309';
103593 END IF;
103594 --
103595 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
103596
103597 trace
103598 (p_msg => 'BEGIN of AcctLineType_309'
103599 ,p_level => C_LEVEL_PROCEDURE
103600 ,p_module => l_log_module);
103601
103602 END IF;
103603 --
103604 l_component_type := 'AMB_JLT';
103605 l_component_code := 'FA_RETIREMENT_BONUS_DEPRN_RES';
103606 l_component_type_code := 'S';
103607 l_component_appl_id := 140;
103608 l_amb_context_code := 'DEFAULT';
103609 l_entity_code := 'TRANSACTIONS';
103610 l_event_class_code := 'RETIREMENTS';
103611 l_event_type_code := 'REINSTATEMENTS';
103612 l_line_definition_owner_code := 'S';
103613 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
103614 --
103615 l_balance_type_code := 'A';
103616 l_segment := NULL;
103617 l_ccid := NULL;
103618 l_adr_transaction_coa_id := NULL;
103619 l_adr_accounting_coa_id := NULL;
103620 l_adr_flexfield_segment_code := NULL;
103621 l_adr_flex_value_set_id := NULL;
103622 l_adr_value_type_code := NULL;
103623 l_adr_value_combination_id := NULL;
103624 l_adr_value_segment_code := NULL;
103625
103626 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
103627 l_bflow_class_code := ''; -- 4219869 Business Flow
103628 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
103629 l_budgetary_control_flag := 'N';
103630
103631 l_bflow_applied_to_amt_idx := NULL; -- 5132302
103632 l_bflow_applied_to_amt := NULL; -- 5132302
103633 l_entered_amt_idx := NULL; -- 4262811
103634 l_accted_amt_idx := NULL; -- 4262811
103635 l_acc_rev_flag := NULL; -- 4262811
103636 l_accrual_line_num := NULL; -- 4262811
103637 l_tmp_amt := NULL; -- 4262811
103638 --
103639
103640 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
103641 l_balance_type_code <> 'B' THEN
103642 IF NVL(p_source_48,'
103646 --
103643 ') = 'BONUS EXPENSE'
103644 THEN
103645
103647 XLA_AE_LINES_PKG.SetNewLine;
103648
103649 p_balance_type_code := l_balance_type_code;
103650 -- set the flag so later we will know whether the gain loss line needs to be created
103651
103652 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
103653 p_actual_flag :='A';
103654 END IF;
103655
103656 --
103657 -- bulk performance
103658 --
103659 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
103660 p_header_num => 0); -- 4262811
103661 --
103662 -- set accounting line options
103663 --
103664 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
103665 p_natural_side_code => 'D'
103666 , p_gain_or_loss_flag => 'N'
103667 , p_gl_transfer_mode_code => 'S'
103668 , p_acct_entry_type_code => 'A'
103669 , p_switch_side_flag => 'Y'
103670 , p_merge_duplicate_code => 'N'
103671 );
103672 --
103673 l_acc_rev_natural_side_code := 'C'; -- 4262811
103674 --
103675 --
103676 -- set accounting line type info
103677 --
103678 xla_ae_lines_pkg.SetAcctLineType
103679 (p_component_type => l_component_type
103680 ,p_event_type_code => l_event_type_code
103681 ,p_line_definition_owner_code => l_line_definition_owner_code
103682 ,p_line_definition_code => l_line_definition_code
103683 ,p_accounting_line_code => l_component_code
103684 ,p_accounting_line_type_code => l_component_type_code
103685 ,p_accounting_line_appl_id => l_component_appl_id
103686 ,p_amb_context_code => l_amb_context_code
103687 ,p_entity_code => l_entity_code
103688 ,p_event_class_code => l_event_class_code);
103689 --
103690 -- set accounting class
103691 --
103692 xla_ae_lines_pkg.SetAcctClass(
103693 p_accounting_class_code => 'ASSET'
103694 , p_ae_header_id => l_ae_header_id
103695 );
103696
103697 --
103698 -- set rounding class
103699 --
103700 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
103701 'ASSET';
103702
103703 --
103704 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
103705 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
103706 --
103707 -- bulk performance
103708 --
103709 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
103710
103711 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
103712 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
103713
103714 -- 4955764
103715 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
103716 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
103717
103718 -- 4458381 Public Sector Enh
103719
103720 --
103721 -- set accounting attributes for the line type
103722 --
103723 l_entered_amt_idx := 4;
103724 l_accted_amt_idx := 6;
103725 l_bflow_applied_to_amt_idx := NULL; -- 5132302
103726 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
103727 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
103728 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
103729 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
103730 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
103731 l_rec_acct_attrs.array_char_value(3) := p_source_51;
103732 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
103733 l_rec_acct_attrs.array_num_value(4) := p_source_52;
103734 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
103735 l_rec_acct_attrs.array_char_value(5) := p_source_53;
103736 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
103737 l_rec_acct_attrs.array_num_value(6) := p_source_52;
103738
103739 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
103740 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
103741
103742 ---------------------------------------------------------------------------------------------------------------
103743 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
103744 ---------------------------------------------------------------------------------------------------------------
103745 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
103746
103747 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
103748 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
103749
103750 IF xla_accounting_cache_pkg.GetValueChar
103751 (p_source_code => 'LEDGER_CATEGORY_CODE'
103752 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
103753 AND l_bflow_method_code = 'PRIOR_ENTRY'
103754 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
103758 THEN
103755 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
103756 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
103757 )
103759 xla_ae_lines_pkg.BflowUpgEntry
103760 (p_business_method_code => l_bflow_method_code
103761 ,p_business_class_code => l_bflow_class_code
103762 ,p_balance_type => l_balance_type_code);
103763 ELSE
103764 NULL;
103765 -- No business flow processing for business flow method of NONE.
103766 END IF;
103767
103768 --
103769 -- call analytical criteria
103770 --
103771
103772 --
103773 -- call description
103774 --
103775
103776 xla_ae_lines_pkg.SetLineDescription(
103777 p_ae_header_id => l_ae_header_id
103778 ,p_description => Description_76 (
103779 p_application_id => p_application_id
103780 , p_ae_header_id => l_ae_header_id
103781 , p_source_1 => p_source_1
103782 )
103783 );
103784
103785
103786 --
103787 -- call ADRs
103788 -- Bug 4922099
103789 --
103790 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
103791 (NVL(l_actual_upg_option, 'N') = 'O') OR
103792 (NVL(l_enc_upg_option, 'N') = 'O')
103793 )
103794 THEN
103795 NULL;
103796 --
103797 --
103798
103799 l_ccid := AcctDerRule_175(
103800 p_application_id => p_application_id
103801 , p_ae_header_id => l_ae_header_id
103802 , p_source_5 => p_source_5
103803 , p_source_19 => p_source_19
103804 , p_source_32 => p_source_32
103805 , x_transaction_coa_id => l_adr_transaction_coa_id
103806 , x_accounting_coa_id => l_adr_accounting_coa_id
103807 , x_value_type_code => l_adr_value_type_code
103808 , p_side => 'NA'
103809 );
103810
103811 xla_ae_lines_pkg.set_ccid(
103812 p_code_combination_id => l_ccid
103813 , p_value_type_code => l_adr_value_type_code
103814 , p_transaction_coa_id => l_adr_transaction_coa_id
103815 , p_accounting_coa_id => l_adr_accounting_coa_id
103816 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
103817 , p_adr_type_code => 'S'
103818 , p_component_type => l_component_type
103819 , p_component_code => l_component_code
103820 , p_component_type_code => l_component_type_code
103821 , p_component_appl_id => l_component_appl_id
103822 , p_amb_context_code => l_amb_context_code
103823 , p_side => 'NA'
103824 );
103825
103826
103827 l_segment := AcctDerRule_145(
103828 p_application_id => p_application_id
103829 , p_ae_header_id => l_ae_header_id
103830 , p_source_5 => p_source_5
103831 , p_source_6 => p_source_6
103832 , x_transaction_coa_id => l_adr_transaction_coa_id
103833 , x_accounting_coa_id => l_adr_accounting_coa_id
103834 , x_flexfield_segment_code => l_adr_flexfield_segment_code
103835 , x_flex_value_set_id => l_adr_flex_value_set_id
103836 , x_value_type_code => l_adr_value_type_code
103837 , x_value_combination_id => l_adr_value_combination_id
103838 , x_value_segment_code => l_adr_value_segment_code
103839 , p_side => 'NA'
103840 , p_override_seg_flag => 'Y'
103841 );
103842
103843 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
103844
103845 xla_ae_lines_pkg.set_segment(
103846 p_to_segment_code => 'GL_ACCOUNT'
103847 , p_segment_value => l_segment
103848 , p_from_segment_code => l_adr_value_segment_code
103849 , p_from_combination_id => l_adr_value_combination_id
103850 , p_value_type_code => l_adr_value_type_code
103851 , p_transaction_coa_id => l_adr_transaction_coa_id
103852 , p_accounting_coa_id => l_adr_accounting_coa_id
103853 , p_flexfield_segment_code => l_adr_flexfield_segment_code
103854 , p_flex_value_set_id => l_adr_flex_value_set_id
103855 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
103856 , p_adr_type_code => 'S'
103857 , p_component_type => l_component_type
103858 , p_component_code => l_component_code
103859 , p_component_type_code => l_component_type_code
103860 , p_component_appl_id => l_component_appl_id
103861 , p_amb_context_code => l_amb_context_code
103862 , p_entity_code => 'TRANSACTIONS'
103863 , p_event_class_code => 'RETIREMENTS'
103864 , p_side => 'NA'
103865 );
103866
103867 END IF;
103868
103869 l_segment := AcctDerRule_169(
103870 p_application_id => p_application_id
103871 , p_ae_header_id => l_ae_header_id
103872 , p_source_5 => p_source_5
103873 , p_source_31 => p_source_31
103874 , x_transaction_coa_id => l_adr_transaction_coa_id
103875 , x_accounting_coa_id => l_adr_accounting_coa_id
103876 , x_flexfield_segment_code => l_adr_flexfield_segment_code
103877 , x_flex_value_set_id => l_adr_flex_value_set_id
103878 , x_value_type_code => l_adr_value_type_code
103879 , x_value_combination_id => l_adr_value_combination_id
103880 , x_value_segment_code => l_adr_value_segment_code
103884
103881 , p_side => 'NA'
103882 , p_override_seg_flag => 'Y'
103883 );
103885 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
103886
103887 xla_ae_lines_pkg.set_segment(
103888 p_to_segment_code => 'GL_BALANCING'
103889 , p_segment_value => l_segment
103890 , p_from_segment_code => l_adr_value_segment_code
103891 , p_from_combination_id => l_adr_value_combination_id
103892 , p_value_type_code => l_adr_value_type_code
103893 , p_transaction_coa_id => l_adr_transaction_coa_id
103894 , p_accounting_coa_id => l_adr_accounting_coa_id
103895 , p_flexfield_segment_code => l_adr_flexfield_segment_code
103896 , p_flex_value_set_id => l_adr_flex_value_set_id
103897 , p_adr_code => 'FA_EXPENSE_ACCT'
103898 , p_adr_type_code => 'S'
103899 , p_component_type => l_component_type
103900 , p_component_code => l_component_code
103901 , p_component_type_code => l_component_type_code
103902 , p_component_appl_id => l_component_appl_id
103903 , p_amb_context_code => l_amb_context_code
103904 , p_entity_code => 'TRANSACTIONS'
103905 , p_event_class_code => 'RETIREMENTS'
103906 , p_side => 'NA'
103907 );
103908
103909 END IF;
103910
103911 --
103912 --
103913 END IF;
103914 --
103915 -- Bug 4922099
103916 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
103917 (NVL(l_enc_upg_option, 'N') = 'O')
103918 ) AND
103919 (l_bflow_method_code = 'PRIOR_ENTRY')
103920 )
103921 THEN
103922 IF
103923 --
103924 1 = 2
103925 --
103926 THEN
103927 xla_accounting_err_pkg.build_message
103928 (p_appli_s_name => 'XLA'
103929 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
103930 ,p_token_1 => 'LINE_NUMBER'
103931 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
103932 ,p_token_2 => 'LINE_TYPE_NAME'
103933 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
103934 l_component_type
103935 ,l_component_code
103936 ,l_component_type_code
103937 ,l_component_appl_id
103938 ,l_amb_context_code
103939 ,l_entity_code
103940 ,l_event_class_code
103941 )
103942 ,p_token_3 => 'OWNER'
103943 ,p_value_3 => xla_lookups_pkg.get_meaning(
103944 p_lookup_type => 'XLA_OWNER_TYPE'
103945 ,p_lookup_code => l_component_type_code
103946 )
103947 ,p_token_4 => 'PRODUCT_NAME'
103948 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
103949 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
103950 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
103951 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
103952 ,p_ae_header_id => NULL
103953 );
103954
103955 IF (C_LEVEL_ERROR>= g_log_level) THEN
103956 trace
103957 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
103958 ,p_level => C_LEVEL_ERROR
103959 ,p_module => l_log_module);
103960 END IF;
103961 END IF;
103962 END IF;
103963 --
103964 --
103965 ------------------------------------------------------------------------------------------------
103966 -- 4219869 Business Flow
103967 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
103968 -- Prior Entry. Currently, the following code is always generated.
103969 ------------------------------------------------------------------------------------------------
103970 XLA_AE_LINES_PKG.ValidateCurrentLine;
103971
103972 ------------------------------------------------------------------------------------
103973 -- 4219869 Business Flow
103974 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
103975 ------------------------------------------------------------------------------------
103976 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
103977
103978 ----------------------------------------------------------------------------------
103979 -- 4219869 Business Flow
103983 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
103980 -- Update journal entry status -- Need to generate this within IF <condition>
103981 ----------------------------------------------------------------------------------
103982 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
103984 ,p_balance_type_code => l_balance_type_code
103985 );
103986
103987 -------------------------------------------------------------------------------------------
103988 -- 4262811 - Generate the Accrual Reversal lines
103989 -------------------------------------------------------------------------------------------
103990 BEGIN
103991 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
103992 (g_array_event(p_event_id).array_value_num('header_index'));
103993 IF l_acc_rev_flag IS NULL THEN
103994 l_acc_rev_flag := 'N';
103995 END IF;
103996 EXCEPTION
103997 WHEN OTHERS THEN
103998 l_acc_rev_flag := 'N';
103999 END;
104000 --
104001 IF (l_acc_rev_flag = 'Y') THEN
104002
104003 -- 4645092 ------------------------------------------------------------------------------
104004 -- To allow MPA report to determine if it should generate report process
104005 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
104006 ------------------------------------------------------------------------------------------
104007
104008 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
104009 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
104010 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
104011 -- call ADRs
104012 -- Bug 4922099
104013 --
104014 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
104015 (NVL(l_actual_upg_option, 'N') = 'O') OR
104016 (NVL(l_enc_upg_option, 'N') = 'O')
104017 )
104018 THEN
104019 NULL;
104020 --
104021 --
104022
104023 l_ccid := AcctDerRule_175(
104024 p_application_id => p_application_id
104025 , p_ae_header_id => l_ae_header_id
104026 , p_source_5 => p_source_5
104027 , p_source_19 => p_source_19
104028 , p_source_32 => p_source_32
104029 , x_transaction_coa_id => l_adr_transaction_coa_id
104030 , x_accounting_coa_id => l_adr_accounting_coa_id
104031 , x_value_type_code => l_adr_value_type_code
104032 , p_side => 'NA'
104033 );
104034
104035 xla_ae_lines_pkg.set_ccid(
104036 p_code_combination_id => l_ccid
104037 , p_value_type_code => l_adr_value_type_code
104038 , p_transaction_coa_id => l_adr_transaction_coa_id
104039 , p_accounting_coa_id => l_adr_accounting_coa_id
104040 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
104041 , p_adr_type_code => 'S'
104042 , p_component_type => l_component_type
104043 , p_component_code => l_component_code
104044 , p_component_type_code => l_component_type_code
104045 , p_component_appl_id => l_component_appl_id
104046 , p_amb_context_code => l_amb_context_code
104047 , p_side => 'NA'
104048 );
104049
104050
104051 l_segment := AcctDerRule_145(
104052 p_application_id => p_application_id
104053 , p_ae_header_id => l_ae_header_id
104054 , p_source_5 => p_source_5
104055 , p_source_6 => p_source_6
104056 , x_transaction_coa_id => l_adr_transaction_coa_id
104057 , x_accounting_coa_id => l_adr_accounting_coa_id
104058 , x_flexfield_segment_code => l_adr_flexfield_segment_code
104059 , x_flex_value_set_id => l_adr_flex_value_set_id
104060 , x_value_type_code => l_adr_value_type_code
104061 , x_value_combination_id => l_adr_value_combination_id
104062 , x_value_segment_code => l_adr_value_segment_code
104063 , p_side => 'NA'
104064 , p_override_seg_flag => 'Y'
104065 );
104066
104067 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
104068
104069 xla_ae_lines_pkg.set_segment(
104070 p_to_segment_code => 'GL_ACCOUNT'
104071 , p_segment_value => l_segment
104072 , p_from_segment_code => l_adr_value_segment_code
104073 , p_from_combination_id => l_adr_value_combination_id
104074 , p_value_type_code => l_adr_value_type_code
104075 , p_transaction_coa_id => l_adr_transaction_coa_id
104076 , p_accounting_coa_id => l_adr_accounting_coa_id
104077 , p_flexfield_segment_code => l_adr_flexfield_segment_code
104078 , p_flex_value_set_id => l_adr_flex_value_set_id
104079 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
104080 , p_adr_type_code => 'S'
104081 , p_component_type => l_component_type
104082 , p_component_code => l_component_code
104083 , p_component_type_code => l_component_type_code
104084 , p_component_appl_id => l_component_appl_id
104085 , p_amb_context_code => l_amb_context_code
104086 , p_entity_code => 'TRANSACTIONS'
104087 , p_event_class_code => 'RETIREMENTS'
104088 , p_side => 'NA'
104089 );
104090
104091 END IF;
104092
104096 , p_source_5 => p_source_5
104093 l_segment := AcctDerRule_169(
104094 p_application_id => p_application_id
104095 , p_ae_header_id => l_ae_header_id
104097 , p_source_31 => p_source_31
104098 , x_transaction_coa_id => l_adr_transaction_coa_id
104099 , x_accounting_coa_id => l_adr_accounting_coa_id
104100 , x_flexfield_segment_code => l_adr_flexfield_segment_code
104101 , x_flex_value_set_id => l_adr_flex_value_set_id
104102 , x_value_type_code => l_adr_value_type_code
104103 , x_value_combination_id => l_adr_value_combination_id
104104 , x_value_segment_code => l_adr_value_segment_code
104105 , p_side => 'NA'
104106 , p_override_seg_flag => 'Y'
104107 );
104108
104109 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
104110
104111 xla_ae_lines_pkg.set_segment(
104112 p_to_segment_code => 'GL_BALANCING'
104113 , p_segment_value => l_segment
104114 , p_from_segment_code => l_adr_value_segment_code
104115 , p_from_combination_id => l_adr_value_combination_id
104116 , p_value_type_code => l_adr_value_type_code
104117 , p_transaction_coa_id => l_adr_transaction_coa_id
104118 , p_accounting_coa_id => l_adr_accounting_coa_id
104119 , p_flexfield_segment_code => l_adr_flexfield_segment_code
104120 , p_flex_value_set_id => l_adr_flex_value_set_id
104121 , p_adr_code => 'FA_EXPENSE_ACCT'
104122 , p_adr_type_code => 'S'
104123 , p_component_type => l_component_type
104124 , p_component_code => l_component_code
104125 , p_component_type_code => l_component_type_code
104126 , p_component_appl_id => l_component_appl_id
104127 , p_amb_context_code => l_amb_context_code
104128 , p_entity_code => 'TRANSACTIONS'
104129 , p_event_class_code => 'RETIREMENTS'
104130 , p_side => 'NA'
104131 );
104132
104133 END IF;
104134
104135 --
104136 --
104137 END IF;
104138
104139 --
104140 -- Update the line information that should be overwritten
104141 --
104142 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
104143 p_header_num => 1);
104144 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
104145
104146 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
104147
104148 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
104149 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
104150 END IF;
104151
104152 --
104153 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
104154 --
104155 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
104156 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
104157 ELSE
104158 ---------------------------------------------------------------------------------------------------
104159 -- 4262811a Switch Sign
104160 ---------------------------------------------------------------------------------------------------
104161 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
104162 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
104163 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
104164 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
104165 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
104166 -- 5132302
104167 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
104168 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
104169
104170 END IF;
104171
104172 -- 4955764
104173 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
104174 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
104175
104176
104177 XLA_AE_LINES_PKG.ValidateCurrentLine;
104178 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
104179
104180 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
104181 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
104182 ,p_balance_type_code => l_balance_type_code);
104183
104184 END IF;
104185
104186 -----------------------------------------------------------------------------------------
104187 -- 4262811 Multiperiod Accounting
104188 -----------------------------------------------------------------------------------------
104189 -- No MPA option is assigned.
104190
104191
104192 END IF;
104193 END IF;
104194 --
104195
104196 --
104197 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
104198 trace
104199 (p_msg => 'END of AcctLineType_309'
104200 ,p_level => C_LEVEL_PROCEDURE
104204 EXCEPTION
104201 ,p_module => l_log_module);
104202 END IF;
104203 --
104205 WHEN xla_exceptions_pkg.application_exception THEN
104206 RAISE;
104207 WHEN OTHERS THEN
104208 xla_exceptions_pkg.raise_message
104209 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_309');
104210 END AcctLineType_309;
104211 --
104212
104213 ---------------------------------------
104214 --
104215 -- PRIVATE FUNCTION
104216 -- AcctLineType_310
104217 --
104218 ---------------------------------------
104219 PROCEDURE AcctLineType_310 (
104220 p_application_id IN NUMBER
104221 ,p_event_id IN NUMBER
104222 ,p_calculate_acctd_flag IN VARCHAR2
104223 ,p_calculate_g_l_flag IN VARCHAR2
104224 ,p_actual_flag IN OUT VARCHAR2
104225 ,p_balance_type_code OUT VARCHAR2
104226 ,p_gain_or_loss_ref OUT VARCHAR2
104227
104228 --Period Close Date
104229 , p_source_1 IN DATE
104230 --Generated Code Combination Identifier
104231 , p_source_5 IN NUMBER
104232 --Bonus Reserve Account
104233 , p_source_6 IN VARCHAR2
104234 --Generated Offset Code Combination Identifier
104235 , p_source_19 IN NUMBER
104236 --Expense Account Code Combination Identifier
104237 , p_source_31 IN NUMBER
104238 --Default Code Combination Identifier
104239 , p_source_32 IN NUMBER
104240 --Adjustment Type
104241 , p_source_48 IN VARCHAR2
104242 --Transaction Header Identifier
104243 , p_source_49 IN NUMBER
104244 --Adjustment Line Identifier
104245 , p_source_50 IN NUMBER
104246 --Distribution Type Code
104247 , p_source_51 IN VARCHAR2
104248 --Entered Amount
104249 , p_source_52 IN NUMBER
104250 --Currency Code
104251 , p_source_53 IN VARCHAR2
104252 )
104253 IS
104254
104255 l_component_type VARCHAR2(80);
104256 l_component_code VARCHAR2(30);
104257 l_component_type_code VARCHAR2(1);
104258 l_component_appl_id INTEGER;
104259 l_amb_context_code VARCHAR2(30);
104260 l_entity_code VARCHAR2(30);
104261 l_event_class_code VARCHAR2(30);
104262 l_ae_header_id NUMBER;
104263 l_event_type_code VARCHAR2(30);
104264 l_line_definition_code VARCHAR2(30);
104265 l_line_definition_owner_code VARCHAR2(1);
104266 --
104267 -- adr variables
104268 l_segment VARCHAR2(30);
104269 l_ccid NUMBER;
104270 l_adr_transaction_coa_id NUMBER;
104271 l_adr_accounting_coa_id NUMBER;
104272 l_adr_flexfield_segment_code VARCHAR2(30);
104273 l_adr_flex_value_set_id NUMBER;
104274 l_adr_value_type_code VARCHAR2(30);
104275 l_adr_value_combination_id NUMBER;
104276 l_adr_value_segment_code VARCHAR2(30);
104277
104278 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
104279 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
104280 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
104281 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
104282
104283 -- 4262811 Variables ------------------------------------------------------------------------------------------
104284 l_entered_amt_idx NUMBER;
104285 l_accted_amt_idx NUMBER;
104286 l_acc_rev_flag VARCHAR2(1);
104287 l_accrual_line_num NUMBER;
104288 l_tmp_amt NUMBER;
104289 l_acc_rev_natural_side_code VARCHAR2(1);
104290
104291 l_num_entries NUMBER;
104292 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
104293 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
104294 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
104295 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
104296 l_recog_line_1 NUMBER;
104297 l_recog_line_2 NUMBER;
104298
104299 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
104300 l_bflow_applied_to_amt NUMBER; -- 5132302
104301 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
104302
104303 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
104304
104305 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
104306 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
104307
104308 ---------------------------------------------------------------------------------------------------------------
104309
104310
104311 --
104312 -- bulk performance
104313 --
104314 l_balance_type_code VARCHAR2(1);
104315 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
104316 l_log_module VARCHAR2(240);
104317
104318 --
104319 -- Upgrade strategy
104320 --
104321 l_actual_upg_option VARCHAR2(1);
104322 l_enc_upg_option VARCHAR2(1);
104323
104324 --
104325 BEGIN
104326 --
104327 IF g_log_enabled THEN
104328 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_310';
104329 END IF;
104330 --
104331 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
104332
104333 trace
104334 (p_msg => 'BEGIN of AcctLineType_310'
104335 ,p_level => C_LEVEL_PROCEDURE
104339 --
104336 ,p_module => l_log_module);
104337
104338 END IF;
104340 l_component_type := 'AMB_JLT';
104341 l_component_code := 'FA_RETIREMENT_BONUS_DEPRN_RES';
104342 l_component_type_code := 'S';
104343 l_component_appl_id := 140;
104344 l_amb_context_code := 'DEFAULT';
104345 l_entity_code := 'TRANSACTIONS';
104346 l_event_class_code := 'RETIREMENTS';
104347 l_event_type_code := 'RETIREMENTS';
104348 l_line_definition_owner_code := 'S';
104349 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
104350 --
104351 l_balance_type_code := 'A';
104352 l_segment := NULL;
104353 l_ccid := NULL;
104354 l_adr_transaction_coa_id := NULL;
104355 l_adr_accounting_coa_id := NULL;
104356 l_adr_flexfield_segment_code := NULL;
104357 l_adr_flex_value_set_id := NULL;
104358 l_adr_value_type_code := NULL;
104359 l_adr_value_combination_id := NULL;
104360 l_adr_value_segment_code := NULL;
104361
104362 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
104363 l_bflow_class_code := ''; -- 4219869 Business Flow
104364 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
104365 l_budgetary_control_flag := 'N';
104366
104367 l_bflow_applied_to_amt_idx := NULL; -- 5132302
104368 l_bflow_applied_to_amt := NULL; -- 5132302
104369 l_entered_amt_idx := NULL; -- 4262811
104370 l_accted_amt_idx := NULL; -- 4262811
104371 l_acc_rev_flag := NULL; -- 4262811
104372 l_accrual_line_num := NULL; -- 4262811
104373 l_tmp_amt := NULL; -- 4262811
104374 --
104375
104376 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
104377 l_balance_type_code <> 'B' THEN
104378 IF NVL(p_source_48,'
104379 ') = 'BONUS EXPENSE'
104380 THEN
104381
104382 --
104383 XLA_AE_LINES_PKG.SetNewLine;
104384
104385 p_balance_type_code := l_balance_type_code;
104386 -- set the flag so later we will know whether the gain loss line needs to be created
104387
104388 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
104389 p_actual_flag :='A';
104390 END IF;
104391
104392 --
104393 -- bulk performance
104394 --
104395 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
104396 p_header_num => 0); -- 4262811
104397 --
104398 -- set accounting line options
104399 --
104400 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
104401 p_natural_side_code => 'D'
104402 , p_gain_or_loss_flag => 'N'
104403 , p_gl_transfer_mode_code => 'S'
104404 , p_acct_entry_type_code => 'A'
104405 , p_switch_side_flag => 'Y'
104406 , p_merge_duplicate_code => 'N'
104407 );
104408 --
104409 l_acc_rev_natural_side_code := 'C'; -- 4262811
104410 --
104411 --
104412 -- set accounting line type info
104413 --
104414 xla_ae_lines_pkg.SetAcctLineType
104415 (p_component_type => l_component_type
104416 ,p_event_type_code => l_event_type_code
104417 ,p_line_definition_owner_code => l_line_definition_owner_code
104418 ,p_line_definition_code => l_line_definition_code
104419 ,p_accounting_line_code => l_component_code
104420 ,p_accounting_line_type_code => l_component_type_code
104421 ,p_accounting_line_appl_id => l_component_appl_id
104422 ,p_amb_context_code => l_amb_context_code
104423 ,p_entity_code => l_entity_code
104424 ,p_event_class_code => l_event_class_code);
104425 --
104426 -- set accounting class
104427 --
104428 xla_ae_lines_pkg.SetAcctClass(
104429 p_accounting_class_code => 'ASSET'
104430 , p_ae_header_id => l_ae_header_id
104431 );
104432
104433 --
104434 -- set rounding class
104435 --
104436 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
104437 'ASSET';
104438
104439 --
104440 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
104441 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
104442 --
104443 -- bulk performance
104444 --
104445 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
104446
104447 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
104448 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
104449
104450 -- 4955764
104451 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
104452 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
104453
104454 -- 4458381 Public Sector Enh
104455
104456 --
104457 -- set accounting attributes for the line type
104458 --
104459 l_entered_amt_idx := 4;
104460 l_accted_amt_idx := 6;
104461 l_bflow_applied_to_amt_idx := NULL; -- 5132302
104462 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
104463 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
104467 l_rec_acct_attrs.array_char_value(3) := p_source_51;
104464 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
104465 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
104466 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
104468 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
104469 l_rec_acct_attrs.array_num_value(4) := p_source_52;
104470 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
104471 l_rec_acct_attrs.array_char_value(5) := p_source_53;
104472 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
104473 l_rec_acct_attrs.array_num_value(6) := p_source_52;
104474
104475 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
104476 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
104477
104478 ---------------------------------------------------------------------------------------------------------------
104479 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
104480 ---------------------------------------------------------------------------------------------------------------
104481 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
104482
104483 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
104484 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
104485
104486 IF xla_accounting_cache_pkg.GetValueChar
104487 (p_source_code => 'LEDGER_CATEGORY_CODE'
104488 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
104489 AND l_bflow_method_code = 'PRIOR_ENTRY'
104490 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
104491 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
104492 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
104493 )
104494 THEN
104495 xla_ae_lines_pkg.BflowUpgEntry
104496 (p_business_method_code => l_bflow_method_code
104497 ,p_business_class_code => l_bflow_class_code
104498 ,p_balance_type => l_balance_type_code);
104499 ELSE
104500 NULL;
104501 -- No business flow processing for business flow method of NONE.
104502 END IF;
104503
104504 --
104505 -- call analytical criteria
104506 --
104507
104508 --
104509 -- call description
104510 --
104511
104512 xla_ae_lines_pkg.SetLineDescription(
104513 p_ae_header_id => l_ae_header_id
104514 ,p_description => Description_76 (
104515 p_application_id => p_application_id
104516 , p_ae_header_id => l_ae_header_id
104517 , p_source_1 => p_source_1
104518 )
104519 );
104520
104521
104522 --
104523 -- call ADRs
104524 -- Bug 4922099
104525 --
104526 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
104527 (NVL(l_actual_upg_option, 'N') = 'O') OR
104528 (NVL(l_enc_upg_option, 'N') = 'O')
104529 )
104530 THEN
104531 NULL;
104532 --
104533 --
104534
104535 l_ccid := AcctDerRule_175(
104536 p_application_id => p_application_id
104537 , p_ae_header_id => l_ae_header_id
104538 , p_source_5 => p_source_5
104539 , p_source_19 => p_source_19
104540 , p_source_32 => p_source_32
104541 , x_transaction_coa_id => l_adr_transaction_coa_id
104542 , x_accounting_coa_id => l_adr_accounting_coa_id
104543 , x_value_type_code => l_adr_value_type_code
104544 , p_side => 'NA'
104545 );
104546
104547 xla_ae_lines_pkg.set_ccid(
104548 p_code_combination_id => l_ccid
104549 , p_value_type_code => l_adr_value_type_code
104550 , p_transaction_coa_id => l_adr_transaction_coa_id
104551 , p_accounting_coa_id => l_adr_accounting_coa_id
104552 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
104553 , p_adr_type_code => 'S'
104554 , p_component_type => l_component_type
104555 , p_component_code => l_component_code
104556 , p_component_type_code => l_component_type_code
104557 , p_component_appl_id => l_component_appl_id
104558 , p_amb_context_code => l_amb_context_code
104559 , p_side => 'NA'
104560 );
104561
104562
104563 l_segment := AcctDerRule_145(
104564 p_application_id => p_application_id
104565 , p_ae_header_id => l_ae_header_id
104566 , p_source_5 => p_source_5
104567 , p_source_6 => p_source_6
104568 , x_transaction_coa_id => l_adr_transaction_coa_id
104569 , x_accounting_coa_id => l_adr_accounting_coa_id
104570 , x_flexfield_segment_code => l_adr_flexfield_segment_code
104571 , x_flex_value_set_id => l_adr_flex_value_set_id
104572 , x_value_type_code => l_adr_value_type_code
104573 , x_value_combination_id => l_adr_value_combination_id
104574 , x_value_segment_code => l_adr_value_segment_code
104575 , p_side => 'NA'
104576 , p_override_seg_flag => 'Y'
104577 );
104578
104579 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
104580
104581 xla_ae_lines_pkg.set_segment(
104585 , p_from_combination_id => l_adr_value_combination_id
104582 p_to_segment_code => 'GL_ACCOUNT'
104583 , p_segment_value => l_segment
104584 , p_from_segment_code => l_adr_value_segment_code
104586 , p_value_type_code => l_adr_value_type_code
104587 , p_transaction_coa_id => l_adr_transaction_coa_id
104588 , p_accounting_coa_id => l_adr_accounting_coa_id
104589 , p_flexfield_segment_code => l_adr_flexfield_segment_code
104590 , p_flex_value_set_id => l_adr_flex_value_set_id
104591 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
104592 , p_adr_type_code => 'S'
104593 , p_component_type => l_component_type
104594 , p_component_code => l_component_code
104595 , p_component_type_code => l_component_type_code
104596 , p_component_appl_id => l_component_appl_id
104597 , p_amb_context_code => l_amb_context_code
104598 , p_entity_code => 'TRANSACTIONS'
104599 , p_event_class_code => 'RETIREMENTS'
104600 , p_side => 'NA'
104601 );
104602
104603 END IF;
104604
104605 l_segment := AcctDerRule_169(
104606 p_application_id => p_application_id
104607 , p_ae_header_id => l_ae_header_id
104608 , p_source_5 => p_source_5
104609 , p_source_31 => p_source_31
104610 , x_transaction_coa_id => l_adr_transaction_coa_id
104611 , x_accounting_coa_id => l_adr_accounting_coa_id
104612 , x_flexfield_segment_code => l_adr_flexfield_segment_code
104613 , x_flex_value_set_id => l_adr_flex_value_set_id
104614 , x_value_type_code => l_adr_value_type_code
104615 , x_value_combination_id => l_adr_value_combination_id
104616 , x_value_segment_code => l_adr_value_segment_code
104617 , p_side => 'NA'
104618 , p_override_seg_flag => 'Y'
104619 );
104620
104621 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
104622
104623 xla_ae_lines_pkg.set_segment(
104624 p_to_segment_code => 'GL_BALANCING'
104625 , p_segment_value => l_segment
104626 , p_from_segment_code => l_adr_value_segment_code
104627 , p_from_combination_id => l_adr_value_combination_id
104628 , p_value_type_code => l_adr_value_type_code
104629 , p_transaction_coa_id => l_adr_transaction_coa_id
104630 , p_accounting_coa_id => l_adr_accounting_coa_id
104631 , p_flexfield_segment_code => l_adr_flexfield_segment_code
104632 , p_flex_value_set_id => l_adr_flex_value_set_id
104633 , p_adr_code => 'FA_EXPENSE_ACCT'
104634 , p_adr_type_code => 'S'
104635 , p_component_type => l_component_type
104636 , p_component_code => l_component_code
104637 , p_component_type_code => l_component_type_code
104638 , p_component_appl_id => l_component_appl_id
104639 , p_amb_context_code => l_amb_context_code
104640 , p_entity_code => 'TRANSACTIONS'
104641 , p_event_class_code => 'RETIREMENTS'
104642 , p_side => 'NA'
104643 );
104644
104645 END IF;
104646
104647 --
104648 --
104649 END IF;
104650 --
104651 -- Bug 4922099
104652 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
104653 (NVL(l_enc_upg_option, 'N') = 'O')
104654 ) AND
104655 (l_bflow_method_code = 'PRIOR_ENTRY')
104656 )
104657 THEN
104658 IF
104659 --
104660 1 = 2
104661 --
104662 THEN
104663 xla_accounting_err_pkg.build_message
104664 (p_appli_s_name => 'XLA'
104665 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
104666 ,p_token_1 => 'LINE_NUMBER'
104667 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
104668 ,p_token_2 => 'LINE_TYPE_NAME'
104669 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
104670 l_component_type
104671 ,l_component_code
104672 ,l_component_type_code
104673 ,l_component_appl_id
104674 ,l_amb_context_code
104675 ,l_entity_code
104676 ,l_event_class_code
104677 )
104678 ,p_token_3 => 'OWNER'
104679 ,p_value_3 => xla_lookups_pkg.get_meaning(
104680 p_lookup_type => 'XLA_OWNER_TYPE'
104681 ,p_lookup_code => l_component_type_code
104685 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
104682 )
104683 ,p_token_4 => 'PRODUCT_NAME'
104684 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
104686 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
104687 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
104688 ,p_ae_header_id => NULL
104689 );
104690
104691 IF (C_LEVEL_ERROR>= g_log_level) THEN
104692 trace
104693 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
104694 ,p_level => C_LEVEL_ERROR
104695 ,p_module => l_log_module);
104696 END IF;
104697 END IF;
104698 END IF;
104699 --
104700 --
104701 ------------------------------------------------------------------------------------------------
104702 -- 4219869 Business Flow
104703 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
104704 -- Prior Entry. Currently, the following code is always generated.
104705 ------------------------------------------------------------------------------------------------
104706 XLA_AE_LINES_PKG.ValidateCurrentLine;
104707
104708 ------------------------------------------------------------------------------------
104709 -- 4219869 Business Flow
104710 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
104711 ------------------------------------------------------------------------------------
104712 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
104713
104714 ----------------------------------------------------------------------------------
104715 -- 4219869 Business Flow
104716 -- Update journal entry status -- Need to generate this within IF <condition>
104717 ----------------------------------------------------------------------------------
104718 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
104719 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
104720 ,p_balance_type_code => l_balance_type_code
104721 );
104722
104723 -------------------------------------------------------------------------------------------
104724 -- 4262811 - Generate the Accrual Reversal lines
104725 -------------------------------------------------------------------------------------------
104726 BEGIN
104727 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
104728 (g_array_event(p_event_id).array_value_num('header_index'));
104729 IF l_acc_rev_flag IS NULL THEN
104730 l_acc_rev_flag := 'N';
104731 END IF;
104732 EXCEPTION
104733 WHEN OTHERS THEN
104734 l_acc_rev_flag := 'N';
104735 END;
104736 --
104737 IF (l_acc_rev_flag = 'Y') THEN
104738
104739 -- 4645092 ------------------------------------------------------------------------------
104740 -- To allow MPA report to determine if it should generate report process
104741 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
104742 ------------------------------------------------------------------------------------------
104743
104744 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
104745 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
104746 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
104747 -- call ADRs
104748 -- Bug 4922099
104749 --
104750 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
104751 (NVL(l_actual_upg_option, 'N') = 'O') OR
104752 (NVL(l_enc_upg_option, 'N') = 'O')
104753 )
104754 THEN
104755 NULL;
104756 --
104757 --
104758
104759 l_ccid := AcctDerRule_175(
104760 p_application_id => p_application_id
104761 , p_ae_header_id => l_ae_header_id
104762 , p_source_5 => p_source_5
104763 , p_source_19 => p_source_19
104764 , p_source_32 => p_source_32
104765 , x_transaction_coa_id => l_adr_transaction_coa_id
104766 , x_accounting_coa_id => l_adr_accounting_coa_id
104767 , x_value_type_code => l_adr_value_type_code
104768 , p_side => 'NA'
104769 );
104770
104771 xla_ae_lines_pkg.set_ccid(
104772 p_code_combination_id => l_ccid
104773 , p_value_type_code => l_adr_value_type_code
104774 , p_transaction_coa_id => l_adr_transaction_coa_id
104775 , p_accounting_coa_id => l_adr_accounting_coa_id
104776 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
104777 , p_adr_type_code => 'S'
104778 , p_component_type => l_component_type
104779 , p_component_code => l_component_code
104780 , p_component_type_code => l_component_type_code
104781 , p_component_appl_id => l_component_appl_id
104782 , p_amb_context_code => l_amb_context_code
104783 , p_side => 'NA'
104784 );
104785
104786
104787 l_segment := AcctDerRule_145(
104788 p_application_id => p_application_id
104792 , x_transaction_coa_id => l_adr_transaction_coa_id
104789 , p_ae_header_id => l_ae_header_id
104790 , p_source_5 => p_source_5
104791 , p_source_6 => p_source_6
104793 , x_accounting_coa_id => l_adr_accounting_coa_id
104794 , x_flexfield_segment_code => l_adr_flexfield_segment_code
104795 , x_flex_value_set_id => l_adr_flex_value_set_id
104796 , x_value_type_code => l_adr_value_type_code
104797 , x_value_combination_id => l_adr_value_combination_id
104798 , x_value_segment_code => l_adr_value_segment_code
104799 , p_side => 'NA'
104800 , p_override_seg_flag => 'Y'
104801 );
104802
104803 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
104804
104805 xla_ae_lines_pkg.set_segment(
104806 p_to_segment_code => 'GL_ACCOUNT'
104807 , p_segment_value => l_segment
104808 , p_from_segment_code => l_adr_value_segment_code
104809 , p_from_combination_id => l_adr_value_combination_id
104810 , p_value_type_code => l_adr_value_type_code
104811 , p_transaction_coa_id => l_adr_transaction_coa_id
104812 , p_accounting_coa_id => l_adr_accounting_coa_id
104813 , p_flexfield_segment_code => l_adr_flexfield_segment_code
104814 , p_flex_value_set_id => l_adr_flex_value_set_id
104815 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
104816 , p_adr_type_code => 'S'
104817 , p_component_type => l_component_type
104818 , p_component_code => l_component_code
104819 , p_component_type_code => l_component_type_code
104820 , p_component_appl_id => l_component_appl_id
104821 , p_amb_context_code => l_amb_context_code
104822 , p_entity_code => 'TRANSACTIONS'
104823 , p_event_class_code => 'RETIREMENTS'
104824 , p_side => 'NA'
104825 );
104826
104827 END IF;
104828
104829 l_segment := AcctDerRule_169(
104830 p_application_id => p_application_id
104831 , p_ae_header_id => l_ae_header_id
104832 , p_source_5 => p_source_5
104833 , p_source_31 => p_source_31
104834 , x_transaction_coa_id => l_adr_transaction_coa_id
104835 , x_accounting_coa_id => l_adr_accounting_coa_id
104836 , x_flexfield_segment_code => l_adr_flexfield_segment_code
104837 , x_flex_value_set_id => l_adr_flex_value_set_id
104838 , x_value_type_code => l_adr_value_type_code
104839 , x_value_combination_id => l_adr_value_combination_id
104840 , x_value_segment_code => l_adr_value_segment_code
104841 , p_side => 'NA'
104842 , p_override_seg_flag => 'Y'
104843 );
104844
104845 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
104846
104847 xla_ae_lines_pkg.set_segment(
104848 p_to_segment_code => 'GL_BALANCING'
104849 , p_segment_value => l_segment
104850 , p_from_segment_code => l_adr_value_segment_code
104851 , p_from_combination_id => l_adr_value_combination_id
104852 , p_value_type_code => l_adr_value_type_code
104853 , p_transaction_coa_id => l_adr_transaction_coa_id
104854 , p_accounting_coa_id => l_adr_accounting_coa_id
104855 , p_flexfield_segment_code => l_adr_flexfield_segment_code
104856 , p_flex_value_set_id => l_adr_flex_value_set_id
104857 , p_adr_code => 'FA_EXPENSE_ACCT'
104858 , p_adr_type_code => 'S'
104859 , p_component_type => l_component_type
104860 , p_component_code => l_component_code
104861 , p_component_type_code => l_component_type_code
104862 , p_component_appl_id => l_component_appl_id
104863 , p_amb_context_code => l_amb_context_code
104864 , p_entity_code => 'TRANSACTIONS'
104865 , p_event_class_code => 'RETIREMENTS'
104866 , p_side => 'NA'
104867 );
104868
104869 END IF;
104870
104871 --
104872 --
104873 END IF;
104874
104875 --
104876 -- Update the line information that should be overwritten
104877 --
104878 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
104879 p_header_num => 1);
104880 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
104881
104882 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
104883
104884 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
104885 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
104886 END IF;
104887
104888 --
104889 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
104890 --
104891 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
104892 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
104893 ELSE
104894 ---------------------------------------------------------------------------------------------------
104895 -- 4262811a Switch Sign
104899 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
104896 ---------------------------------------------------------------------------------------------------
104897 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
104898 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
104900 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
104901 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
104902 -- 5132302
104903 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
104904 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
104905
104906 END IF;
104907
104908 -- 4955764
104909 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
104910 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
104911
104912
104913 XLA_AE_LINES_PKG.ValidateCurrentLine;
104914 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
104915
104916 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
104917 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
104918 ,p_balance_type_code => l_balance_type_code);
104919
104920 END IF;
104921
104922 -----------------------------------------------------------------------------------------
104923 -- 4262811 Multiperiod Accounting
104924 -----------------------------------------------------------------------------------------
104925 -- No MPA option is assigned.
104926
104927
104928 END IF;
104929 END IF;
104930 --
104931
104932 --
104933 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
104934 trace
104935 (p_msg => 'END of AcctLineType_310'
104936 ,p_level => C_LEVEL_PROCEDURE
104937 ,p_module => l_log_module);
104938 END IF;
104939 --
104940 EXCEPTION
104941 WHEN xla_exceptions_pkg.application_exception THEN
104942 RAISE;
104943 WHEN OTHERS THEN
104944 xla_exceptions_pkg.raise_message
104945 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_310');
104946 END AcctLineType_310;
104947 --
104948
104949 ---------------------------------------
104950 --
104951 -- PRIVATE FUNCTION
104952 -- AcctLineType_311
104953 --
104954 ---------------------------------------
104955 PROCEDURE AcctLineType_311 (
104956 p_application_id IN NUMBER
104957 ,p_event_id IN NUMBER
104958 ,p_calculate_acctd_flag IN VARCHAR2
104959 ,p_calculate_g_l_flag IN VARCHAR2
104960 ,p_actual_flag IN OUT VARCHAR2
104961 ,p_balance_type_code OUT VARCHAR2
104962 ,p_gain_or_loss_ref OUT VARCHAR2
104963
104964 --Period Close Date
104965 , p_source_1 IN DATE
104966 --Generated Code Combination Identifier
104967 , p_source_5 IN NUMBER
104968 --Asset Cost Account
104969 , p_source_11 IN VARCHAR2
104970 --Expense Account Code Combination Identifier
104971 , p_source_31 IN NUMBER
104972 --Default Code Combination Identifier
104973 , p_source_32 IN NUMBER
104974 --Adjustment Type
104975 , p_source_48 IN VARCHAR2
104976 --Transaction Header Identifier
104977 , p_source_49 IN NUMBER
104978 --Adjustment Line Identifier
104979 , p_source_50 IN NUMBER
104980 --Distribution Type Code
104981 , p_source_51 IN VARCHAR2
104982 --Entered Amount
104983 , p_source_52 IN NUMBER
104984 --Currency Code
104985 , p_source_53 IN VARCHAR2
104986 )
104987 IS
104988
104989 l_component_type VARCHAR2(80);
104990 l_component_code VARCHAR2(30);
104991 l_component_type_code VARCHAR2(1);
104992 l_component_appl_id INTEGER;
104993 l_amb_context_code VARCHAR2(30);
104994 l_entity_code VARCHAR2(30);
104995 l_event_class_code VARCHAR2(30);
104996 l_ae_header_id NUMBER;
104997 l_event_type_code VARCHAR2(30);
104998 l_line_definition_code VARCHAR2(30);
104999 l_line_definition_owner_code VARCHAR2(1);
105000 --
105001 -- adr variables
105002 l_segment VARCHAR2(30);
105003 l_ccid NUMBER;
105004 l_adr_transaction_coa_id NUMBER;
105005 l_adr_accounting_coa_id NUMBER;
105006 l_adr_flexfield_segment_code VARCHAR2(30);
105007 l_adr_flex_value_set_id NUMBER;
105008 l_adr_value_type_code VARCHAR2(30);
105009 l_adr_value_combination_id NUMBER;
105010 l_adr_value_segment_code VARCHAR2(30);
105011
105012 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
105013 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
105014 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
105015 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
105016
105017 -- 4262811 Variables ------------------------------------------------------------------------------------------
105018 l_entered_amt_idx NUMBER;
105019 l_accted_amt_idx NUMBER;
105020 l_acc_rev_flag VARCHAR2(1);
105021 l_accrual_line_num NUMBER;
105022 l_tmp_amt NUMBER;
105023 l_acc_rev_natural_side_code VARCHAR2(1);
105024
105025 l_num_entries NUMBER;
105029 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
105026 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
105027 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
105028 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
105030 l_recog_line_1 NUMBER;
105031 l_recog_line_2 NUMBER;
105032
105033 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
105034 l_bflow_applied_to_amt NUMBER; -- 5132302
105035 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
105036
105037 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
105038
105039 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
105040 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
105041
105042 ---------------------------------------------------------------------------------------------------------------
105043
105044
105045 --
105046 -- bulk performance
105047 --
105048 l_balance_type_code VARCHAR2(1);
105049 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
105050 l_log_module VARCHAR2(240);
105051
105052 --
105053 -- Upgrade strategy
105054 --
105055 l_actual_upg_option VARCHAR2(1);
105056 l_enc_upg_option VARCHAR2(1);
105057
105058 --
105059 BEGIN
105060 --
105061 IF g_log_enabled THEN
105062 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_311';
105063 END IF;
105064 --
105065 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
105066
105067 trace
105068 (p_msg => 'BEGIN of AcctLineType_311'
105069 ,p_level => C_LEVEL_PROCEDURE
105070 ,p_module => l_log_module);
105071
105072 END IF;
105073 --
105074 l_component_type := 'AMB_JLT';
105075 l_component_code := 'FA_RETIREMENT_COST';
105076 l_component_type_code := 'S';
105077 l_component_appl_id := 140;
105078 l_amb_context_code := 'DEFAULT';
105079 l_entity_code := 'TRANSACTIONS';
105080 l_event_class_code := 'RETIREMENTS';
105081 l_event_type_code := 'RETIREMENTS';
105082 l_line_definition_owner_code := 'S';
105083 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
105084 --
105085 l_balance_type_code := 'A';
105086 l_segment := NULL;
105087 l_ccid := NULL;
105088 l_adr_transaction_coa_id := NULL;
105089 l_adr_accounting_coa_id := NULL;
105090 l_adr_flexfield_segment_code := NULL;
105091 l_adr_flex_value_set_id := NULL;
105092 l_adr_value_type_code := NULL;
105093 l_adr_value_combination_id := NULL;
105094 l_adr_value_segment_code := NULL;
105095
105096 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
105097 l_bflow_class_code := ''; -- 4219869 Business Flow
105098 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
105099 l_budgetary_control_flag := 'N';
105100
105101 l_bflow_applied_to_amt_idx := NULL; -- 5132302
105102 l_bflow_applied_to_amt := NULL; -- 5132302
105103 l_entered_amt_idx := NULL; -- 4262811
105104 l_accted_amt_idx := NULL; -- 4262811
105105 l_acc_rev_flag := NULL; -- 4262811
105106 l_accrual_line_num := NULL; -- 4262811
105107 l_tmp_amt := NULL; -- 4262811
105108 --
105109
105110 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
105111 l_balance_type_code <> 'B' THEN
105112 IF NVL(p_source_48,'
105113 ') = 'COST'
105114 THEN
105115
105116 --
105117 XLA_AE_LINES_PKG.SetNewLine;
105118
105119 p_balance_type_code := l_balance_type_code;
105120 -- set the flag so later we will know whether the gain loss line needs to be created
105121
105122 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
105123 p_actual_flag :='A';
105124 END IF;
105125
105126 --
105127 -- bulk performance
105128 --
105129 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
105130 p_header_num => 0); -- 4262811
105131 --
105132 -- set accounting line options
105133 --
105134 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
105135 p_natural_side_code => 'C'
105136 , p_gain_or_loss_flag => 'N'
105137 , p_gl_transfer_mode_code => 'S'
105138 , p_acct_entry_type_code => 'A'
105139 , p_switch_side_flag => 'Y'
105140 , p_merge_duplicate_code => 'N'
105141 );
105142 --
105143 l_acc_rev_natural_side_code := 'D'; -- 4262811
105144 --
105145 --
105146 -- set accounting line type info
105147 --
105148 xla_ae_lines_pkg.SetAcctLineType
105149 (p_component_type => l_component_type
105150 ,p_event_type_code => l_event_type_code
105151 ,p_line_definition_owner_code => l_line_definition_owner_code
105152 ,p_line_definition_code => l_line_definition_code
105153 ,p_accounting_line_code => l_component_code
105154 ,p_accounting_line_type_code => l_component_type_code
105155 ,p_accounting_line_appl_id => l_component_appl_id
105159 --
105156 ,p_amb_context_code => l_amb_context_code
105157 ,p_entity_code => l_entity_code
105158 ,p_event_class_code => l_event_class_code);
105160 -- set accounting class
105161 --
105162 xla_ae_lines_pkg.SetAcctClass(
105163 p_accounting_class_code => 'ASSET'
105164 , p_ae_header_id => l_ae_header_id
105165 );
105166
105167 --
105168 -- set rounding class
105169 --
105170 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
105171 'ASSET';
105172
105173 --
105174 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
105175 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
105176 --
105177 -- bulk performance
105178 --
105179 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
105180
105181 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
105182 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
105183
105184 -- 4955764
105185 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
105186 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
105187
105188 -- 4458381 Public Sector Enh
105189
105190 --
105191 -- set accounting attributes for the line type
105192 --
105193 l_entered_amt_idx := 4;
105194 l_accted_amt_idx := 6;
105195 l_bflow_applied_to_amt_idx := NULL; -- 5132302
105196 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
105197 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
105198 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
105199 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
105200 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
105201 l_rec_acct_attrs.array_char_value(3) := p_source_51;
105202 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
105203 l_rec_acct_attrs.array_num_value(4) := p_source_52;
105204 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
105205 l_rec_acct_attrs.array_char_value(5) := p_source_53;
105206 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
105207 l_rec_acct_attrs.array_num_value(6) := p_source_52;
105208
105209 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
105210 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
105211
105212 ---------------------------------------------------------------------------------------------------------------
105213 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
105214 ---------------------------------------------------------------------------------------------------------------
105215 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
105216
105217 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
105218 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
105219
105220 IF xla_accounting_cache_pkg.GetValueChar
105221 (p_source_code => 'LEDGER_CATEGORY_CODE'
105222 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
105223 AND l_bflow_method_code = 'PRIOR_ENTRY'
105224 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
105225 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
105226 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
105227 )
105228 THEN
105229 xla_ae_lines_pkg.BflowUpgEntry
105230 (p_business_method_code => l_bflow_method_code
105231 ,p_business_class_code => l_bflow_class_code
105232 ,p_balance_type => l_balance_type_code);
105233 ELSE
105234 NULL;
105235 -- No business flow processing for business flow method of NONE.
105236 END IF;
105237
105238 --
105239 -- call analytical criteria
105240 --
105241
105242 --
105243 -- call description
105244 --
105245
105246 xla_ae_lines_pkg.SetLineDescription(
105247 p_ae_header_id => l_ae_header_id
105248 ,p_description => Description_77 (
105249 p_application_id => p_application_id
105250 , p_ae_header_id => l_ae_header_id
105251 , p_source_1 => p_source_1
105252 )
105253 );
105254
105255
105256 --
105257 -- call ADRs
105258 -- Bug 4922099
105259 --
105260 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
105261 (NVL(l_actual_upg_option, 'N') = 'O') OR
105262 (NVL(l_enc_upg_option, 'N') = 'O')
105263 )
105264 THEN
105265 NULL;
105266 --
105267 --
105268
105269 l_ccid := AcctDerRule_174(
105270 p_application_id => p_application_id
105271 , p_ae_header_id => l_ae_header_id
105272 , p_source_5 => p_source_5
105273 , p_source_32 => p_source_32
105274 , x_transaction_coa_id => l_adr_transaction_coa_id
105275 , x_accounting_coa_id => l_adr_accounting_coa_id
105276 , x_value_type_code => l_adr_value_type_code
105280 xla_ae_lines_pkg.set_ccid(
105277 , p_side => 'NA'
105278 );
105279
105281 p_code_combination_id => l_ccid
105282 , p_value_type_code => l_adr_value_type_code
105283 , p_transaction_coa_id => l_adr_transaction_coa_id
105284 , p_accounting_coa_id => l_adr_accounting_coa_id
105285 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
105286 , p_adr_type_code => 'S'
105287 , p_component_type => l_component_type
105288 , p_component_code => l_component_code
105289 , p_component_type_code => l_component_type_code
105290 , p_component_appl_id => l_component_appl_id
105291 , p_amb_context_code => l_amb_context_code
105292 , p_side => 'NA'
105293 );
105294
105295
105296 l_segment := AcctDerRule_149(
105297 p_application_id => p_application_id
105298 , p_ae_header_id => l_ae_header_id
105299 , p_source_5 => p_source_5
105300 , p_source_11 => p_source_11
105301 , x_transaction_coa_id => l_adr_transaction_coa_id
105302 , x_accounting_coa_id => l_adr_accounting_coa_id
105303 , x_flexfield_segment_code => l_adr_flexfield_segment_code
105304 , x_flex_value_set_id => l_adr_flex_value_set_id
105305 , x_value_type_code => l_adr_value_type_code
105306 , x_value_combination_id => l_adr_value_combination_id
105307 , x_value_segment_code => l_adr_value_segment_code
105308 , p_side => 'NA'
105309 , p_override_seg_flag => 'Y'
105310 );
105311
105312 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
105313
105314 xla_ae_lines_pkg.set_segment(
105315 p_to_segment_code => 'GL_ACCOUNT'
105316 , p_segment_value => l_segment
105317 , p_from_segment_code => l_adr_value_segment_code
105318 , p_from_combination_id => l_adr_value_combination_id
105319 , p_value_type_code => l_adr_value_type_code
105320 , p_transaction_coa_id => l_adr_transaction_coa_id
105321 , p_accounting_coa_id => l_adr_accounting_coa_id
105322 , p_flexfield_segment_code => l_adr_flexfield_segment_code
105323 , p_flex_value_set_id => l_adr_flex_value_set_id
105324 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
105325 , p_adr_type_code => 'S'
105326 , p_component_type => l_component_type
105327 , p_component_code => l_component_code
105328 , p_component_type_code => l_component_type_code
105329 , p_component_appl_id => l_component_appl_id
105330 , p_amb_context_code => l_amb_context_code
105331 , p_entity_code => 'TRANSACTIONS'
105332 , p_event_class_code => 'RETIREMENTS'
105333 , p_side => 'NA'
105334 );
105335
105336 END IF;
105337
105338 l_segment := AcctDerRule_169(
105339 p_application_id => p_application_id
105340 , p_ae_header_id => l_ae_header_id
105341 , p_source_5 => p_source_5
105342 , p_source_31 => p_source_31
105343 , x_transaction_coa_id => l_adr_transaction_coa_id
105344 , x_accounting_coa_id => l_adr_accounting_coa_id
105345 , x_flexfield_segment_code => l_adr_flexfield_segment_code
105346 , x_flex_value_set_id => l_adr_flex_value_set_id
105347 , x_value_type_code => l_adr_value_type_code
105348 , x_value_combination_id => l_adr_value_combination_id
105349 , x_value_segment_code => l_adr_value_segment_code
105350 , p_side => 'NA'
105351 , p_override_seg_flag => 'Y'
105352 );
105353
105354 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
105355
105356 xla_ae_lines_pkg.set_segment(
105357 p_to_segment_code => 'GL_BALANCING'
105358 , p_segment_value => l_segment
105359 , p_from_segment_code => l_adr_value_segment_code
105360 , p_from_combination_id => l_adr_value_combination_id
105361 , p_value_type_code => l_adr_value_type_code
105362 , p_transaction_coa_id => l_adr_transaction_coa_id
105363 , p_accounting_coa_id => l_adr_accounting_coa_id
105364 , p_flexfield_segment_code => l_adr_flexfield_segment_code
105365 , p_flex_value_set_id => l_adr_flex_value_set_id
105366 , p_adr_code => 'FA_EXPENSE_ACCT'
105367 , p_adr_type_code => 'S'
105368 , p_component_type => l_component_type
105369 , p_component_code => l_component_code
105370 , p_component_type_code => l_component_type_code
105371 , p_component_appl_id => l_component_appl_id
105372 , p_amb_context_code => l_amb_context_code
105373 , p_entity_code => 'TRANSACTIONS'
105374 , p_event_class_code => 'RETIREMENTS'
105375 , p_side => 'NA'
105376 );
105377
105378 END IF;
105379
105380 --
105381 --
105382 END IF;
105383 --
105384 -- Bug 4922099
105385 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
105386 (NVL(l_enc_upg_option, 'N') = 'O')
105387 ) AND
105388 (l_bflow_method_code = 'PRIOR_ENTRY')
105392 --
105389 )
105390 THEN
105391 IF
105393 1 = 2
105394 --
105395 THEN
105396 xla_accounting_err_pkg.build_message
105397 (p_appli_s_name => 'XLA'
105398 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
105399 ,p_token_1 => 'LINE_NUMBER'
105400 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
105401 ,p_token_2 => 'LINE_TYPE_NAME'
105402 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
105403 l_component_type
105404 ,l_component_code
105405 ,l_component_type_code
105406 ,l_component_appl_id
105407 ,l_amb_context_code
105408 ,l_entity_code
105409 ,l_event_class_code
105410 )
105411 ,p_token_3 => 'OWNER'
105412 ,p_value_3 => xla_lookups_pkg.get_meaning(
105413 p_lookup_type => 'XLA_OWNER_TYPE'
105414 ,p_lookup_code => l_component_type_code
105415 )
105416 ,p_token_4 => 'PRODUCT_NAME'
105417 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
105418 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
105419 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
105420 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
105421 ,p_ae_header_id => NULL
105422 );
105423
105424 IF (C_LEVEL_ERROR>= g_log_level) THEN
105425 trace
105426 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
105427 ,p_level => C_LEVEL_ERROR
105428 ,p_module => l_log_module);
105429 END IF;
105430 END IF;
105431 END IF;
105432 --
105433 --
105434 ------------------------------------------------------------------------------------------------
105435 -- 4219869 Business Flow
105436 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
105437 -- Prior Entry. Currently, the following code is always generated.
105438 ------------------------------------------------------------------------------------------------
105439 XLA_AE_LINES_PKG.ValidateCurrentLine;
105440
105441 ------------------------------------------------------------------------------------
105442 -- 4219869 Business Flow
105443 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
105444 ------------------------------------------------------------------------------------
105445 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
105446
105447 ----------------------------------------------------------------------------------
105448 -- 4219869 Business Flow
105449 -- Update journal entry status -- Need to generate this within IF <condition>
105450 ----------------------------------------------------------------------------------
105451 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
105452 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
105453 ,p_balance_type_code => l_balance_type_code
105454 );
105455
105456 -------------------------------------------------------------------------------------------
105457 -- 4262811 - Generate the Accrual Reversal lines
105458 -------------------------------------------------------------------------------------------
105459 BEGIN
105460 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
105461 (g_array_event(p_event_id).array_value_num('header_index'));
105462 IF l_acc_rev_flag IS NULL THEN
105463 l_acc_rev_flag := 'N';
105464 END IF;
105465 EXCEPTION
105466 WHEN OTHERS THEN
105467 l_acc_rev_flag := 'N';
105468 END;
105469 --
105470 IF (l_acc_rev_flag = 'Y') THEN
105471
105472 -- 4645092 ------------------------------------------------------------------------------
105473 -- To allow MPA report to determine if it should generate report process
105474 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
105475 ------------------------------------------------------------------------------------------
105476
105477 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
105478 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
105479 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
105480 -- call ADRs
105484 (NVL(l_actual_upg_option, 'N') = 'O') OR
105481 -- Bug 4922099
105482 --
105483 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
105485 (NVL(l_enc_upg_option, 'N') = 'O')
105486 )
105487 THEN
105488 NULL;
105489 --
105490 --
105491
105492 l_ccid := AcctDerRule_174(
105493 p_application_id => p_application_id
105494 , p_ae_header_id => l_ae_header_id
105495 , p_source_5 => p_source_5
105496 , p_source_32 => p_source_32
105497 , x_transaction_coa_id => l_adr_transaction_coa_id
105498 , x_accounting_coa_id => l_adr_accounting_coa_id
105499 , x_value_type_code => l_adr_value_type_code
105500 , p_side => 'NA'
105501 );
105502
105503 xla_ae_lines_pkg.set_ccid(
105504 p_code_combination_id => l_ccid
105505 , p_value_type_code => l_adr_value_type_code
105506 , p_transaction_coa_id => l_adr_transaction_coa_id
105507 , p_accounting_coa_id => l_adr_accounting_coa_id
105508 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
105509 , p_adr_type_code => 'S'
105510 , p_component_type => l_component_type
105511 , p_component_code => l_component_code
105512 , p_component_type_code => l_component_type_code
105513 , p_component_appl_id => l_component_appl_id
105514 , p_amb_context_code => l_amb_context_code
105515 , p_side => 'NA'
105516 );
105517
105518
105519 l_segment := AcctDerRule_149(
105520 p_application_id => p_application_id
105521 , p_ae_header_id => l_ae_header_id
105522 , p_source_5 => p_source_5
105523 , p_source_11 => p_source_11
105524 , x_transaction_coa_id => l_adr_transaction_coa_id
105525 , x_accounting_coa_id => l_adr_accounting_coa_id
105526 , x_flexfield_segment_code => l_adr_flexfield_segment_code
105527 , x_flex_value_set_id => l_adr_flex_value_set_id
105528 , x_value_type_code => l_adr_value_type_code
105529 , x_value_combination_id => l_adr_value_combination_id
105530 , x_value_segment_code => l_adr_value_segment_code
105531 , p_side => 'NA'
105532 , p_override_seg_flag => 'Y'
105533 );
105534
105535 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
105536
105537 xla_ae_lines_pkg.set_segment(
105538 p_to_segment_code => 'GL_ACCOUNT'
105539 , p_segment_value => l_segment
105540 , p_from_segment_code => l_adr_value_segment_code
105541 , p_from_combination_id => l_adr_value_combination_id
105542 , p_value_type_code => l_adr_value_type_code
105543 , p_transaction_coa_id => l_adr_transaction_coa_id
105544 , p_accounting_coa_id => l_adr_accounting_coa_id
105545 , p_flexfield_segment_code => l_adr_flexfield_segment_code
105546 , p_flex_value_set_id => l_adr_flex_value_set_id
105547 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
105548 , p_adr_type_code => 'S'
105549 , p_component_type => l_component_type
105550 , p_component_code => l_component_code
105551 , p_component_type_code => l_component_type_code
105552 , p_component_appl_id => l_component_appl_id
105553 , p_amb_context_code => l_amb_context_code
105554 , p_entity_code => 'TRANSACTIONS'
105555 , p_event_class_code => 'RETIREMENTS'
105556 , p_side => 'NA'
105557 );
105558
105559 END IF;
105560
105561 l_segment := AcctDerRule_169(
105562 p_application_id => p_application_id
105563 , p_ae_header_id => l_ae_header_id
105564 , p_source_5 => p_source_5
105565 , p_source_31 => p_source_31
105566 , x_transaction_coa_id => l_adr_transaction_coa_id
105567 , x_accounting_coa_id => l_adr_accounting_coa_id
105568 , x_flexfield_segment_code => l_adr_flexfield_segment_code
105569 , x_flex_value_set_id => l_adr_flex_value_set_id
105570 , x_value_type_code => l_adr_value_type_code
105571 , x_value_combination_id => l_adr_value_combination_id
105572 , x_value_segment_code => l_adr_value_segment_code
105573 , p_side => 'NA'
105574 , p_override_seg_flag => 'Y'
105575 );
105576
105577 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
105578
105579 xla_ae_lines_pkg.set_segment(
105580 p_to_segment_code => 'GL_BALANCING'
105581 , p_segment_value => l_segment
105582 , p_from_segment_code => l_adr_value_segment_code
105583 , p_from_combination_id => l_adr_value_combination_id
105584 , p_value_type_code => l_adr_value_type_code
105585 , p_transaction_coa_id => l_adr_transaction_coa_id
105586 , p_accounting_coa_id => l_adr_accounting_coa_id
105587 , p_flexfield_segment_code => l_adr_flexfield_segment_code
105588 , p_flex_value_set_id => l_adr_flex_value_set_id
105589 , p_adr_code => 'FA_EXPENSE_ACCT'
105590 , p_adr_type_code => 'S'
105591 , p_component_type => l_component_type
105592 , p_component_code => l_component_code
105593 , p_component_type_code => l_component_type_code
105597 , p_event_class_code => 'RETIREMENTS'
105594 , p_component_appl_id => l_component_appl_id
105595 , p_amb_context_code => l_amb_context_code
105596 , p_entity_code => 'TRANSACTIONS'
105598 , p_side => 'NA'
105599 );
105600
105601 END IF;
105602
105603 --
105604 --
105605 END IF;
105606
105607 --
105608 -- Update the line information that should be overwritten
105609 --
105610 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
105611 p_header_num => 1);
105612 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
105613
105614 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
105615
105616 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
105617 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
105618 END IF;
105619
105620 --
105621 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
105622 --
105623 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
105624 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
105625 ELSE
105626 ---------------------------------------------------------------------------------------------------
105627 -- 4262811a Switch Sign
105628 ---------------------------------------------------------------------------------------------------
105629 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
105630 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
105631 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
105632 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
105633 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
105634 -- 5132302
105635 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
105636 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
105637
105638 END IF;
105639
105640 -- 4955764
105641 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
105642 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
105643
105644
105645 XLA_AE_LINES_PKG.ValidateCurrentLine;
105646 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
105647
105648 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
105649 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
105650 ,p_balance_type_code => l_balance_type_code);
105651
105652 END IF;
105653
105654 -----------------------------------------------------------------------------------------
105655 -- 4262811 Multiperiod Accounting
105656 -----------------------------------------------------------------------------------------
105657 -- No MPA option is assigned.
105658
105659
105660 END IF;
105661 END IF;
105662 --
105663
105664 --
105665 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
105666 trace
105667 (p_msg => 'END of AcctLineType_311'
105668 ,p_level => C_LEVEL_PROCEDURE
105669 ,p_module => l_log_module);
105670 END IF;
105671 --
105672 EXCEPTION
105673 WHEN xla_exceptions_pkg.application_exception THEN
105674 RAISE;
105675 WHEN OTHERS THEN
105676 xla_exceptions_pkg.raise_message
105677 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_311');
105678 END AcctLineType_311;
105679 --
105680
105681 ---------------------------------------
105682 --
105683 -- PRIVATE FUNCTION
105684 -- AcctLineType_312
105685 --
105686 ---------------------------------------
105687 PROCEDURE AcctLineType_312 (
105688 p_application_id IN NUMBER
105689 ,p_event_id IN NUMBER
105690 ,p_calculate_acctd_flag IN VARCHAR2
105691 ,p_calculate_g_l_flag IN VARCHAR2
105692 ,p_actual_flag IN OUT VARCHAR2
105693 ,p_balance_type_code OUT VARCHAR2
105694 ,p_gain_or_loss_ref OUT VARCHAR2
105695
105696 --Period Close Date
105697 , p_source_1 IN DATE
105698 --Generated Code Combination Identifier
105699 , p_source_5 IN NUMBER
105700 --Asset Cost Account
105701 , p_source_11 IN VARCHAR2
105702 --Expense Account Code Combination Identifier
105703 , p_source_31 IN NUMBER
105704 --Default Code Combination Identifier
105705 , p_source_32 IN NUMBER
105706 --Adjustment Type
105707 , p_source_48 IN VARCHAR2
105708 --Transaction Header Identifier
105709 , p_source_49 IN NUMBER
105710 --Adjustment Line Identifier
105711 , p_source_50 IN NUMBER
105712 --Distribution Type Code
105713 , p_source_51 IN VARCHAR2
105714 --Entered Amount
105715 , p_source_52 IN NUMBER
105716 --Currency Code
105717 , p_source_53 IN VARCHAR2
105718 )
105719 IS
105720
105724 l_component_appl_id INTEGER;
105721 l_component_type VARCHAR2(80);
105722 l_component_code VARCHAR2(30);
105723 l_component_type_code VARCHAR2(1);
105725 l_amb_context_code VARCHAR2(30);
105726 l_entity_code VARCHAR2(30);
105727 l_event_class_code VARCHAR2(30);
105728 l_ae_header_id NUMBER;
105729 l_event_type_code VARCHAR2(30);
105730 l_line_definition_code VARCHAR2(30);
105731 l_line_definition_owner_code VARCHAR2(1);
105732 --
105733 -- adr variables
105734 l_segment VARCHAR2(30);
105735 l_ccid NUMBER;
105736 l_adr_transaction_coa_id NUMBER;
105737 l_adr_accounting_coa_id NUMBER;
105738 l_adr_flexfield_segment_code VARCHAR2(30);
105739 l_adr_flex_value_set_id NUMBER;
105740 l_adr_value_type_code VARCHAR2(30);
105741 l_adr_value_combination_id NUMBER;
105742 l_adr_value_segment_code VARCHAR2(30);
105743
105744 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
105745 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
105746 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
105747 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
105748
105749 -- 4262811 Variables ------------------------------------------------------------------------------------------
105750 l_entered_amt_idx NUMBER;
105751 l_accted_amt_idx NUMBER;
105752 l_acc_rev_flag VARCHAR2(1);
105753 l_accrual_line_num NUMBER;
105754 l_tmp_amt NUMBER;
105755 l_acc_rev_natural_side_code VARCHAR2(1);
105756
105757 l_num_entries NUMBER;
105758 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
105759 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
105760 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
105761 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
105762 l_recog_line_1 NUMBER;
105763 l_recog_line_2 NUMBER;
105764
105765 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
105766 l_bflow_applied_to_amt NUMBER; -- 5132302
105767 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
105768
105769 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
105770
105771 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
105772 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
105773
105774 ---------------------------------------------------------------------------------------------------------------
105775
105776
105777 --
105778 -- bulk performance
105779 --
105780 l_balance_type_code VARCHAR2(1);
105781 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
105782 l_log_module VARCHAR2(240);
105783
105784 --
105785 -- Upgrade strategy
105786 --
105787 l_actual_upg_option VARCHAR2(1);
105788 l_enc_upg_option VARCHAR2(1);
105789
105790 --
105791 BEGIN
105792 --
105793 IF g_log_enabled THEN
105794 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_312';
105795 END IF;
105796 --
105797 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
105798
105799 trace
105800 (p_msg => 'BEGIN of AcctLineType_312'
105801 ,p_level => C_LEVEL_PROCEDURE
105802 ,p_module => l_log_module);
105803
105804 END IF;
105805 --
105806 l_component_type := 'AMB_JLT';
105807 l_component_code := 'FA_RETIREMENT_COST';
105808 l_component_type_code := 'S';
105809 l_component_appl_id := 140;
105810 l_amb_context_code := 'DEFAULT';
105811 l_entity_code := 'TRANSACTIONS';
105812 l_event_class_code := 'RETIREMENTS';
105813 l_event_type_code := 'REINSTATEMENTS';
105814 l_line_definition_owner_code := 'S';
105815 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
105816 --
105817 l_balance_type_code := 'A';
105818 l_segment := NULL;
105819 l_ccid := NULL;
105820 l_adr_transaction_coa_id := NULL;
105821 l_adr_accounting_coa_id := NULL;
105822 l_adr_flexfield_segment_code := NULL;
105823 l_adr_flex_value_set_id := NULL;
105824 l_adr_value_type_code := NULL;
105825 l_adr_value_combination_id := NULL;
105826 l_adr_value_segment_code := NULL;
105827
105828 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
105829 l_bflow_class_code := ''; -- 4219869 Business Flow
105830 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
105831 l_budgetary_control_flag := 'N';
105832
105833 l_bflow_applied_to_amt_idx := NULL; -- 5132302
105834 l_bflow_applied_to_amt := NULL; -- 5132302
105835 l_entered_amt_idx := NULL; -- 4262811
105836 l_accted_amt_idx := NULL; -- 4262811
105837 l_acc_rev_flag := NULL; -- 4262811
105838 l_accrual_line_num := NULL; -- 4262811
105839 l_tmp_amt := NULL; -- 4262811
105840 --
105841
105842 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
105843 l_balance_type_code <> 'B' THEN
105847
105844 IF NVL(p_source_48,'
105845 ') = 'COST'
105846 THEN
105848 --
105849 XLA_AE_LINES_PKG.SetNewLine;
105850
105851 p_balance_type_code := l_balance_type_code;
105852 -- set the flag so later we will know whether the gain loss line needs to be created
105853
105854 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
105855 p_actual_flag :='A';
105856 END IF;
105857
105858 --
105859 -- bulk performance
105860 --
105861 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
105862 p_header_num => 0); -- 4262811
105863 --
105864 -- set accounting line options
105865 --
105866 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
105867 p_natural_side_code => 'C'
105868 , p_gain_or_loss_flag => 'N'
105869 , p_gl_transfer_mode_code => 'S'
105870 , p_acct_entry_type_code => 'A'
105871 , p_switch_side_flag => 'Y'
105872 , p_merge_duplicate_code => 'N'
105873 );
105874 --
105875 l_acc_rev_natural_side_code := 'D'; -- 4262811
105876 --
105877 --
105878 -- set accounting line type info
105879 --
105880 xla_ae_lines_pkg.SetAcctLineType
105881 (p_component_type => l_component_type
105882 ,p_event_type_code => l_event_type_code
105883 ,p_line_definition_owner_code => l_line_definition_owner_code
105884 ,p_line_definition_code => l_line_definition_code
105885 ,p_accounting_line_code => l_component_code
105886 ,p_accounting_line_type_code => l_component_type_code
105887 ,p_accounting_line_appl_id => l_component_appl_id
105888 ,p_amb_context_code => l_amb_context_code
105889 ,p_entity_code => l_entity_code
105890 ,p_event_class_code => l_event_class_code);
105891 --
105892 -- set accounting class
105893 --
105894 xla_ae_lines_pkg.SetAcctClass(
105895 p_accounting_class_code => 'ASSET'
105896 , p_ae_header_id => l_ae_header_id
105897 );
105898
105899 --
105900 -- set rounding class
105901 --
105902 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
105903 'ASSET';
105904
105905 --
105906 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
105907 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
105908 --
105909 -- bulk performance
105910 --
105911 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
105912
105913 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
105914 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
105915
105916 -- 4955764
105917 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
105918 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
105919
105920 -- 4458381 Public Sector Enh
105921
105922 --
105923 -- set accounting attributes for the line type
105924 --
105925 l_entered_amt_idx := 4;
105926 l_accted_amt_idx := 6;
105927 l_bflow_applied_to_amt_idx := NULL; -- 5132302
105928 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
105929 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
105930 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
105931 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
105932 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
105933 l_rec_acct_attrs.array_char_value(3) := p_source_51;
105934 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
105935 l_rec_acct_attrs.array_num_value(4) := p_source_52;
105936 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
105937 l_rec_acct_attrs.array_char_value(5) := p_source_53;
105938 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
105939 l_rec_acct_attrs.array_num_value(6) := p_source_52;
105940
105941 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
105942 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
105943
105944 ---------------------------------------------------------------------------------------------------------------
105945 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
105946 ---------------------------------------------------------------------------------------------------------------
105947 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
105948
105949 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
105950 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
105951
105952 IF xla_accounting_cache_pkg.GetValueChar
105953 (p_source_code => 'LEDGER_CATEGORY_CODE'
105954 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
105955 AND l_bflow_method_code = 'PRIOR_ENTRY'
105956 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
105960 THEN
105957 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
105958 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
105959 )
105961 xla_ae_lines_pkg.BflowUpgEntry
105962 (p_business_method_code => l_bflow_method_code
105963 ,p_business_class_code => l_bflow_class_code
105964 ,p_balance_type => l_balance_type_code);
105965 ELSE
105966 NULL;
105967 -- No business flow processing for business flow method of NONE.
105968 END IF;
105969
105970 --
105971 -- call analytical criteria
105972 --
105973
105974 --
105975 -- call description
105976 --
105977
105978 xla_ae_lines_pkg.SetLineDescription(
105979 p_ae_header_id => l_ae_header_id
105980 ,p_description => Description_77 (
105981 p_application_id => p_application_id
105982 , p_ae_header_id => l_ae_header_id
105983 , p_source_1 => p_source_1
105984 )
105985 );
105986
105987
105988 --
105989 -- call ADRs
105990 -- Bug 4922099
105991 --
105992 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
105993 (NVL(l_actual_upg_option, 'N') = 'O') OR
105994 (NVL(l_enc_upg_option, 'N') = 'O')
105995 )
105996 THEN
105997 NULL;
105998 --
105999 --
106000
106001 l_ccid := AcctDerRule_174(
106002 p_application_id => p_application_id
106003 , p_ae_header_id => l_ae_header_id
106004 , p_source_5 => p_source_5
106005 , p_source_32 => p_source_32
106006 , x_transaction_coa_id => l_adr_transaction_coa_id
106007 , x_accounting_coa_id => l_adr_accounting_coa_id
106008 , x_value_type_code => l_adr_value_type_code
106009 , p_side => 'NA'
106010 );
106011
106012 xla_ae_lines_pkg.set_ccid(
106013 p_code_combination_id => l_ccid
106014 , p_value_type_code => l_adr_value_type_code
106015 , p_transaction_coa_id => l_adr_transaction_coa_id
106016 , p_accounting_coa_id => l_adr_accounting_coa_id
106017 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
106018 , p_adr_type_code => 'S'
106019 , p_component_type => l_component_type
106020 , p_component_code => l_component_code
106021 , p_component_type_code => l_component_type_code
106022 , p_component_appl_id => l_component_appl_id
106023 , p_amb_context_code => l_amb_context_code
106024 , p_side => 'NA'
106025 );
106026
106027
106028 l_segment := AcctDerRule_149(
106029 p_application_id => p_application_id
106030 , p_ae_header_id => l_ae_header_id
106031 , p_source_5 => p_source_5
106032 , p_source_11 => p_source_11
106033 , x_transaction_coa_id => l_adr_transaction_coa_id
106034 , x_accounting_coa_id => l_adr_accounting_coa_id
106035 , x_flexfield_segment_code => l_adr_flexfield_segment_code
106036 , x_flex_value_set_id => l_adr_flex_value_set_id
106037 , x_value_type_code => l_adr_value_type_code
106038 , x_value_combination_id => l_adr_value_combination_id
106039 , x_value_segment_code => l_adr_value_segment_code
106040 , p_side => 'NA'
106041 , p_override_seg_flag => 'Y'
106042 );
106043
106044 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
106045
106046 xla_ae_lines_pkg.set_segment(
106047 p_to_segment_code => 'GL_ACCOUNT'
106048 , p_segment_value => l_segment
106049 , p_from_segment_code => l_adr_value_segment_code
106050 , p_from_combination_id => l_adr_value_combination_id
106051 , p_value_type_code => l_adr_value_type_code
106052 , p_transaction_coa_id => l_adr_transaction_coa_id
106053 , p_accounting_coa_id => l_adr_accounting_coa_id
106054 , p_flexfield_segment_code => l_adr_flexfield_segment_code
106055 , p_flex_value_set_id => l_adr_flex_value_set_id
106056 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
106057 , p_adr_type_code => 'S'
106058 , p_component_type => l_component_type
106059 , p_component_code => l_component_code
106060 , p_component_type_code => l_component_type_code
106061 , p_component_appl_id => l_component_appl_id
106062 , p_amb_context_code => l_amb_context_code
106063 , p_entity_code => 'TRANSACTIONS'
106064 , p_event_class_code => 'RETIREMENTS'
106065 , p_side => 'NA'
106066 );
106067
106068 END IF;
106069
106070 l_segment := AcctDerRule_169(
106071 p_application_id => p_application_id
106072 , p_ae_header_id => l_ae_header_id
106073 , p_source_5 => p_source_5
106074 , p_source_31 => p_source_31
106075 , x_transaction_coa_id => l_adr_transaction_coa_id
106076 , x_accounting_coa_id => l_adr_accounting_coa_id
106077 , x_flexfield_segment_code => l_adr_flexfield_segment_code
106078 , x_flex_value_set_id => l_adr_flex_value_set_id
106079 , x_value_type_code => l_adr_value_type_code
106080 , x_value_combination_id => l_adr_value_combination_id
106081 , x_value_segment_code => l_adr_value_segment_code
106082 , p_side => 'NA'
106086 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
106083 , p_override_seg_flag => 'Y'
106084 );
106085
106087
106088 xla_ae_lines_pkg.set_segment(
106089 p_to_segment_code => 'GL_BALANCING'
106090 , p_segment_value => l_segment
106091 , p_from_segment_code => l_adr_value_segment_code
106092 , p_from_combination_id => l_adr_value_combination_id
106093 , p_value_type_code => l_adr_value_type_code
106094 , p_transaction_coa_id => l_adr_transaction_coa_id
106095 , p_accounting_coa_id => l_adr_accounting_coa_id
106096 , p_flexfield_segment_code => l_adr_flexfield_segment_code
106097 , p_flex_value_set_id => l_adr_flex_value_set_id
106098 , p_adr_code => 'FA_EXPENSE_ACCT'
106099 , p_adr_type_code => 'S'
106100 , p_component_type => l_component_type
106101 , p_component_code => l_component_code
106102 , p_component_type_code => l_component_type_code
106103 , p_component_appl_id => l_component_appl_id
106104 , p_amb_context_code => l_amb_context_code
106105 , p_entity_code => 'TRANSACTIONS'
106106 , p_event_class_code => 'RETIREMENTS'
106107 , p_side => 'NA'
106108 );
106109
106110 END IF;
106111
106112 --
106113 --
106114 END IF;
106115 --
106116 -- Bug 4922099
106117 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
106118 (NVL(l_enc_upg_option, 'N') = 'O')
106119 ) AND
106120 (l_bflow_method_code = 'PRIOR_ENTRY')
106121 )
106122 THEN
106123 IF
106124 --
106125 1 = 2
106126 --
106127 THEN
106128 xla_accounting_err_pkg.build_message
106129 (p_appli_s_name => 'XLA'
106130 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
106131 ,p_token_1 => 'LINE_NUMBER'
106132 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
106133 ,p_token_2 => 'LINE_TYPE_NAME'
106134 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
106135 l_component_type
106136 ,l_component_code
106137 ,l_component_type_code
106138 ,l_component_appl_id
106139 ,l_amb_context_code
106140 ,l_entity_code
106141 ,l_event_class_code
106142 )
106143 ,p_token_3 => 'OWNER'
106144 ,p_value_3 => xla_lookups_pkg.get_meaning(
106145 p_lookup_type => 'XLA_OWNER_TYPE'
106146 ,p_lookup_code => l_component_type_code
106147 )
106148 ,p_token_4 => 'PRODUCT_NAME'
106149 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
106150 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
106151 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
106152 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
106153 ,p_ae_header_id => NULL
106154 );
106155
106156 IF (C_LEVEL_ERROR>= g_log_level) THEN
106157 trace
106158 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
106159 ,p_level => C_LEVEL_ERROR
106160 ,p_module => l_log_module);
106161 END IF;
106162 END IF;
106163 END IF;
106164 --
106165 --
106166 ------------------------------------------------------------------------------------------------
106167 -- 4219869 Business Flow
106168 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
106169 -- Prior Entry. Currently, the following code is always generated.
106170 ------------------------------------------------------------------------------------------------
106171 XLA_AE_LINES_PKG.ValidateCurrentLine;
106172
106173 ------------------------------------------------------------------------------------
106174 -- 4219869 Business Flow
106175 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
106176 ------------------------------------------------------------------------------------
106177 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
106178
106179 ----------------------------------------------------------------------------------
106180 -- 4219869 Business Flow
106184 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
106181 -- Update journal entry status -- Need to generate this within IF <condition>
106182 ----------------------------------------------------------------------------------
106183 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
106185 ,p_balance_type_code => l_balance_type_code
106186 );
106187
106188 -------------------------------------------------------------------------------------------
106189 -- 4262811 - Generate the Accrual Reversal lines
106190 -------------------------------------------------------------------------------------------
106191 BEGIN
106192 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
106193 (g_array_event(p_event_id).array_value_num('header_index'));
106194 IF l_acc_rev_flag IS NULL THEN
106195 l_acc_rev_flag := 'N';
106196 END IF;
106197 EXCEPTION
106198 WHEN OTHERS THEN
106199 l_acc_rev_flag := 'N';
106200 END;
106201 --
106202 IF (l_acc_rev_flag = 'Y') THEN
106203
106204 -- 4645092 ------------------------------------------------------------------------------
106205 -- To allow MPA report to determine if it should generate report process
106206 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
106207 ------------------------------------------------------------------------------------------
106208
106209 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
106210 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
106211 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
106212 -- call ADRs
106213 -- Bug 4922099
106214 --
106215 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
106216 (NVL(l_actual_upg_option, 'N') = 'O') OR
106217 (NVL(l_enc_upg_option, 'N') = 'O')
106218 )
106219 THEN
106220 NULL;
106221 --
106222 --
106223
106224 l_ccid := AcctDerRule_174(
106225 p_application_id => p_application_id
106226 , p_ae_header_id => l_ae_header_id
106227 , p_source_5 => p_source_5
106228 , p_source_32 => p_source_32
106229 , x_transaction_coa_id => l_adr_transaction_coa_id
106230 , x_accounting_coa_id => l_adr_accounting_coa_id
106231 , x_value_type_code => l_adr_value_type_code
106232 , p_side => 'NA'
106233 );
106234
106235 xla_ae_lines_pkg.set_ccid(
106236 p_code_combination_id => l_ccid
106237 , p_value_type_code => l_adr_value_type_code
106238 , p_transaction_coa_id => l_adr_transaction_coa_id
106239 , p_accounting_coa_id => l_adr_accounting_coa_id
106240 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
106241 , p_adr_type_code => 'S'
106242 , p_component_type => l_component_type
106243 , p_component_code => l_component_code
106244 , p_component_type_code => l_component_type_code
106245 , p_component_appl_id => l_component_appl_id
106246 , p_amb_context_code => l_amb_context_code
106247 , p_side => 'NA'
106248 );
106249
106250
106251 l_segment := AcctDerRule_149(
106252 p_application_id => p_application_id
106253 , p_ae_header_id => l_ae_header_id
106254 , p_source_5 => p_source_5
106255 , p_source_11 => p_source_11
106256 , x_transaction_coa_id => l_adr_transaction_coa_id
106257 , x_accounting_coa_id => l_adr_accounting_coa_id
106258 , x_flexfield_segment_code => l_adr_flexfield_segment_code
106259 , x_flex_value_set_id => l_adr_flex_value_set_id
106260 , x_value_type_code => l_adr_value_type_code
106261 , x_value_combination_id => l_adr_value_combination_id
106262 , x_value_segment_code => l_adr_value_segment_code
106263 , p_side => 'NA'
106264 , p_override_seg_flag => 'Y'
106265 );
106266
106267 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
106268
106269 xla_ae_lines_pkg.set_segment(
106270 p_to_segment_code => 'GL_ACCOUNT'
106271 , p_segment_value => l_segment
106272 , p_from_segment_code => l_adr_value_segment_code
106273 , p_from_combination_id => l_adr_value_combination_id
106274 , p_value_type_code => l_adr_value_type_code
106275 , p_transaction_coa_id => l_adr_transaction_coa_id
106276 , p_accounting_coa_id => l_adr_accounting_coa_id
106277 , p_flexfield_segment_code => l_adr_flexfield_segment_code
106278 , p_flex_value_set_id => l_adr_flex_value_set_id
106279 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
106280 , p_adr_type_code => 'S'
106281 , p_component_type => l_component_type
106282 , p_component_code => l_component_code
106283 , p_component_type_code => l_component_type_code
106284 , p_component_appl_id => l_component_appl_id
106285 , p_amb_context_code => l_amb_context_code
106286 , p_entity_code => 'TRANSACTIONS'
106287 , p_event_class_code => 'RETIREMENTS'
106288 , p_side => 'NA'
106289 );
106290
106291 END IF;
106292
106293 l_segment := AcctDerRule_169(
106297 , p_source_31 => p_source_31
106294 p_application_id => p_application_id
106295 , p_ae_header_id => l_ae_header_id
106296 , p_source_5 => p_source_5
106298 , x_transaction_coa_id => l_adr_transaction_coa_id
106299 , x_accounting_coa_id => l_adr_accounting_coa_id
106300 , x_flexfield_segment_code => l_adr_flexfield_segment_code
106301 , x_flex_value_set_id => l_adr_flex_value_set_id
106302 , x_value_type_code => l_adr_value_type_code
106303 , x_value_combination_id => l_adr_value_combination_id
106304 , x_value_segment_code => l_adr_value_segment_code
106305 , p_side => 'NA'
106306 , p_override_seg_flag => 'Y'
106307 );
106308
106309 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
106310
106311 xla_ae_lines_pkg.set_segment(
106312 p_to_segment_code => 'GL_BALANCING'
106313 , p_segment_value => l_segment
106314 , p_from_segment_code => l_adr_value_segment_code
106315 , p_from_combination_id => l_adr_value_combination_id
106316 , p_value_type_code => l_adr_value_type_code
106317 , p_transaction_coa_id => l_adr_transaction_coa_id
106318 , p_accounting_coa_id => l_adr_accounting_coa_id
106319 , p_flexfield_segment_code => l_adr_flexfield_segment_code
106320 , p_flex_value_set_id => l_adr_flex_value_set_id
106321 , p_adr_code => 'FA_EXPENSE_ACCT'
106322 , p_adr_type_code => 'S'
106323 , p_component_type => l_component_type
106324 , p_component_code => l_component_code
106325 , p_component_type_code => l_component_type_code
106326 , p_component_appl_id => l_component_appl_id
106327 , p_amb_context_code => l_amb_context_code
106328 , p_entity_code => 'TRANSACTIONS'
106329 , p_event_class_code => 'RETIREMENTS'
106330 , p_side => 'NA'
106331 );
106332
106333 END IF;
106334
106335 --
106336 --
106337 END IF;
106338
106339 --
106340 -- Update the line information that should be overwritten
106341 --
106342 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
106343 p_header_num => 1);
106344 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
106345
106346 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
106347
106348 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
106349 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
106350 END IF;
106351
106352 --
106353 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
106354 --
106355 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
106356 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
106357 ELSE
106358 ---------------------------------------------------------------------------------------------------
106359 -- 4262811a Switch Sign
106360 ---------------------------------------------------------------------------------------------------
106361 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
106362 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
106363 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
106364 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
106365 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
106366 -- 5132302
106367 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
106368 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
106369
106370 END IF;
106371
106372 -- 4955764
106373 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
106374 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
106375
106376
106377 XLA_AE_LINES_PKG.ValidateCurrentLine;
106378 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
106379
106380 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
106381 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
106382 ,p_balance_type_code => l_balance_type_code);
106383
106384 END IF;
106385
106386 -----------------------------------------------------------------------------------------
106387 -- 4262811 Multiperiod Accounting
106388 -----------------------------------------------------------------------------------------
106389 -- No MPA option is assigned.
106390
106391
106392 END IF;
106393 END IF;
106394 --
106395
106396 --
106397 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
106398 trace
106399 (p_msg => 'END of AcctLineType_312'
106400 ,p_level => C_LEVEL_PROCEDURE
106401 ,p_module => l_log_module);
106402 END IF;
106406 RAISE;
106403 --
106404 EXCEPTION
106405 WHEN xla_exceptions_pkg.application_exception THEN
106407 WHEN OTHERS THEN
106408 xla_exceptions_pkg.raise_message
106409 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_312');
106410 END AcctLineType_312;
106411 --
106412
106413 ---------------------------------------
106414 --
106415 -- PRIVATE FUNCTION
106416 -- AcctLineType_313
106417 --
106418 ---------------------------------------
106419 PROCEDURE AcctLineType_313 (
106420 p_application_id IN NUMBER
106421 ,p_event_id IN NUMBER
106422 ,p_calculate_acctd_flag IN VARCHAR2
106423 ,p_calculate_g_l_flag IN VARCHAR2
106424 ,p_actual_flag IN OUT VARCHAR2
106425 ,p_balance_type_code OUT VARCHAR2
106426 ,p_gain_or_loss_ref OUT VARCHAR2
106427
106428 --Period Close Date
106429 , p_source_1 IN DATE
106430 --Generated Code Combination Identifier
106431 , p_source_5 IN NUMBER
106432 --Expense Account Code Combination Identifier
106433 , p_source_31 IN NUMBER
106434 --Adjustment Type
106435 , p_source_48 IN VARCHAR2
106436 --Transaction Header Identifier
106437 , p_source_49 IN NUMBER
106438 --Adjustment Line Identifier
106439 , p_source_50 IN NUMBER
106440 --Distribution Type Code
106441 , p_source_51 IN VARCHAR2
106442 --Entered Amount
106443 , p_source_52 IN NUMBER
106444 --Currency Code
106445 , p_source_53 IN VARCHAR2
106446 )
106447 IS
106448
106449 l_component_type VARCHAR2(80);
106450 l_component_code VARCHAR2(30);
106451 l_component_type_code VARCHAR2(1);
106452 l_component_appl_id INTEGER;
106453 l_amb_context_code VARCHAR2(30);
106454 l_entity_code VARCHAR2(30);
106455 l_event_class_code VARCHAR2(30);
106456 l_ae_header_id NUMBER;
106457 l_event_type_code VARCHAR2(30);
106458 l_line_definition_code VARCHAR2(30);
106459 l_line_definition_owner_code VARCHAR2(1);
106460 --
106461 -- adr variables
106462 l_segment VARCHAR2(30);
106463 l_ccid NUMBER;
106464 l_adr_transaction_coa_id NUMBER;
106465 l_adr_accounting_coa_id NUMBER;
106466 l_adr_flexfield_segment_code VARCHAR2(30);
106467 l_adr_flex_value_set_id NUMBER;
106468 l_adr_value_type_code VARCHAR2(30);
106469 l_adr_value_combination_id NUMBER;
106470 l_adr_value_segment_code VARCHAR2(30);
106471
106472 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
106473 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
106474 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
106475 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
106476
106477 -- 4262811 Variables ------------------------------------------------------------------------------------------
106478 l_entered_amt_idx NUMBER;
106479 l_accted_amt_idx NUMBER;
106480 l_acc_rev_flag VARCHAR2(1);
106481 l_accrual_line_num NUMBER;
106482 l_tmp_amt NUMBER;
106483 l_acc_rev_natural_side_code VARCHAR2(1);
106484
106485 l_num_entries NUMBER;
106486 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
106487 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
106488 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
106489 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
106490 l_recog_line_1 NUMBER;
106491 l_recog_line_2 NUMBER;
106492
106493 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
106494 l_bflow_applied_to_amt NUMBER; -- 5132302
106495 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
106496
106497 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
106498
106499 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
106500 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
106501
106502 ---------------------------------------------------------------------------------------------------------------
106503
106504
106505 --
106506 -- bulk performance
106507 --
106508 l_balance_type_code VARCHAR2(1);
106509 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
106510 l_log_module VARCHAR2(240);
106511
106512 --
106513 -- Upgrade strategy
106514 --
106515 l_actual_upg_option VARCHAR2(1);
106516 l_enc_upg_option VARCHAR2(1);
106517
106518 --
106519 BEGIN
106520 --
106521 IF g_log_enabled THEN
106522 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_313';
106523 END IF;
106524 --
106525 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
106526
106527 trace
106528 (p_msg => 'BEGIN of AcctLineType_313'
106529 ,p_level => C_LEVEL_PROCEDURE
106530 ,p_module => l_log_module);
106531
106532 END IF;
106533 --
106534 l_component_type := 'AMB_JLT';
106535 l_component_code := 'FA_RETIREMENT_DEPRN_EXP';
106536 l_component_type_code := 'S';
106537 l_component_appl_id := 140;
106538 l_amb_context_code := 'DEFAULT';
106542 l_line_definition_owner_code := 'S';
106539 l_entity_code := 'TRANSACTIONS';
106540 l_event_class_code := 'RETIREMENTS';
106541 l_event_type_code := 'REINSTATEMENTS';
106543 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
106544 --
106545 l_balance_type_code := 'A';
106546 l_segment := NULL;
106547 l_ccid := NULL;
106548 l_adr_transaction_coa_id := NULL;
106549 l_adr_accounting_coa_id := NULL;
106550 l_adr_flexfield_segment_code := NULL;
106551 l_adr_flex_value_set_id := NULL;
106552 l_adr_value_type_code := NULL;
106553 l_adr_value_combination_id := NULL;
106554 l_adr_value_segment_code := NULL;
106555
106556 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
106557 l_bflow_class_code := ''; -- 4219869 Business Flow
106558 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
106559 l_budgetary_control_flag := 'N';
106560
106561 l_bflow_applied_to_amt_idx := NULL; -- 5132302
106562 l_bflow_applied_to_amt := NULL; -- 5132302
106563 l_entered_amt_idx := NULL; -- 4262811
106564 l_accted_amt_idx := NULL; -- 4262811
106565 l_acc_rev_flag := NULL; -- 4262811
106566 l_accrual_line_num := NULL; -- 4262811
106567 l_tmp_amt := NULL; -- 4262811
106568 --
106569
106570 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
106571 l_balance_type_code <> 'B' THEN
106572 IF NVL(p_source_48,'
106573 ') = 'EXPENSE'
106574 THEN
106575
106576 --
106577 XLA_AE_LINES_PKG.SetNewLine;
106578
106579 p_balance_type_code := l_balance_type_code;
106580 -- set the flag so later we will know whether the gain loss line needs to be created
106581
106582 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
106583 p_actual_flag :='A';
106584 END IF;
106585
106586 --
106587 -- bulk performance
106588 --
106589 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
106590 p_header_num => 0); -- 4262811
106591 --
106592 -- set accounting line options
106593 --
106594 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
106595 p_natural_side_code => 'C'
106596 , p_gain_or_loss_flag => 'N'
106597 , p_gl_transfer_mode_code => 'S'
106598 , p_acct_entry_type_code => 'A'
106599 , p_switch_side_flag => 'Y'
106600 , p_merge_duplicate_code => 'N'
106601 );
106602 --
106603 l_acc_rev_natural_side_code := 'D'; -- 4262811
106604 --
106605 --
106606 -- set accounting line type info
106607 --
106608 xla_ae_lines_pkg.SetAcctLineType
106609 (p_component_type => l_component_type
106610 ,p_event_type_code => l_event_type_code
106611 ,p_line_definition_owner_code => l_line_definition_owner_code
106612 ,p_line_definition_code => l_line_definition_code
106613 ,p_accounting_line_code => l_component_code
106614 ,p_accounting_line_type_code => l_component_type_code
106615 ,p_accounting_line_appl_id => l_component_appl_id
106616 ,p_amb_context_code => l_amb_context_code
106617 ,p_entity_code => l_entity_code
106618 ,p_event_class_code => l_event_class_code);
106619 --
106620 -- set accounting class
106621 --
106622 xla_ae_lines_pkg.SetAcctClass(
106623 p_accounting_class_code => 'EXPENSE'
106624 , p_ae_header_id => l_ae_header_id
106625 );
106626
106627 --
106628 -- set rounding class
106629 --
106630 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
106631 'EXPENSE';
106632
106633 --
106634 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
106635 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
106636 --
106637 -- bulk performance
106638 --
106639 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
106640
106641 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
106642 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
106643
106644 -- 4955764
106645 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
106646 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
106647
106648 -- 4458381 Public Sector Enh
106649
106650 --
106651 -- set accounting attributes for the line type
106652 --
106653 l_entered_amt_idx := 4;
106654 l_accted_amt_idx := 6;
106655 l_bflow_applied_to_amt_idx := NULL; -- 5132302
106656 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
106657 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
106658 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
106659 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
106660 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
106661 l_rec_acct_attrs.array_char_value(3) := p_source_51;
106662 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
106663 l_rec_acct_attrs.array_num_value(4) := p_source_52;
106667 l_rec_acct_attrs.array_num_value(6) := p_source_52;
106664 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
106665 l_rec_acct_attrs.array_char_value(5) := p_source_53;
106666 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
106668
106669 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
106670 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
106671
106672 ---------------------------------------------------------------------------------------------------------------
106673 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
106674 ---------------------------------------------------------------------------------------------------------------
106675 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
106676
106677 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
106678 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
106679
106680 IF xla_accounting_cache_pkg.GetValueChar
106681 (p_source_code => 'LEDGER_CATEGORY_CODE'
106682 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
106683 AND l_bflow_method_code = 'PRIOR_ENTRY'
106684 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
106685 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
106686 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
106687 )
106688 THEN
106689 xla_ae_lines_pkg.BflowUpgEntry
106690 (p_business_method_code => l_bflow_method_code
106691 ,p_business_class_code => l_bflow_class_code
106692 ,p_balance_type => l_balance_type_code);
106693 ELSE
106694 NULL;
106695 -- No business flow processing for business flow method of NONE.
106696 END IF;
106697
106698 --
106699 -- call analytical criteria
106700 --
106701
106702 --
106703 -- call description
106704 --
106705
106706 xla_ae_lines_pkg.SetLineDescription(
106707 p_ae_header_id => l_ae_header_id
106708 ,p_description => Description_79 (
106709 p_application_id => p_application_id
106710 , p_ae_header_id => l_ae_header_id
106711 , p_source_1 => p_source_1
106712 )
106713 );
106714
106715
106716 --
106717 -- call ADRs
106718 -- Bug 4922099
106719 --
106720 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
106721 (NVL(l_actual_upg_option, 'N') = 'O') OR
106722 (NVL(l_enc_upg_option, 'N') = 'O')
106723 )
106724 THEN
106725 NULL;
106726 --
106727 --
106728
106729 l_ccid := AcctDerRule_176(
106730 p_application_id => p_application_id
106731 , p_ae_header_id => l_ae_header_id
106732 , p_source_5 => p_source_5
106733 , p_source_31 => p_source_31
106734 , x_transaction_coa_id => l_adr_transaction_coa_id
106735 , x_accounting_coa_id => l_adr_accounting_coa_id
106736 , x_value_type_code => l_adr_value_type_code
106737 , p_side => 'NA'
106738 );
106739
106740 xla_ae_lines_pkg.set_ccid(
106741 p_code_combination_id => l_ccid
106742 , p_value_type_code => l_adr_value_type_code
106743 , p_transaction_coa_id => l_adr_transaction_coa_id
106744 , p_accounting_coa_id => l_adr_accounting_coa_id
106745 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
106746 , p_adr_type_code => 'S'
106747 , p_component_type => l_component_type
106748 , p_component_code => l_component_code
106749 , p_component_type_code => l_component_type_code
106750 , p_component_appl_id => l_component_appl_id
106751 , p_amb_context_code => l_amb_context_code
106752 , p_side => 'NA'
106753 );
106754
106755
106756 --
106757 --
106758 END IF;
106759 --
106760 -- Bug 4922099
106761 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
106762 (NVL(l_enc_upg_option, 'N') = 'O')
106763 ) AND
106764 (l_bflow_method_code = 'PRIOR_ENTRY')
106765 )
106766 THEN
106767 IF
106768 --
106769 1 = 2
106770 --
106771 THEN
106772 xla_accounting_err_pkg.build_message
106773 (p_appli_s_name => 'XLA'
106774 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
106775 ,p_token_1 => 'LINE_NUMBER'
106776 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
106777 ,p_token_2 => 'LINE_TYPE_NAME'
106778 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
106779 l_component_type
106780 ,l_component_code
106781 ,l_component_type_code
106782 ,l_component_appl_id
106786 )
106783 ,l_amb_context_code
106784 ,l_entity_code
106785 ,l_event_class_code
106787 ,p_token_3 => 'OWNER'
106788 ,p_value_3 => xla_lookups_pkg.get_meaning(
106789 p_lookup_type => 'XLA_OWNER_TYPE'
106790 ,p_lookup_code => l_component_type_code
106791 )
106792 ,p_token_4 => 'PRODUCT_NAME'
106793 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
106794 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
106795 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
106796 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
106797 ,p_ae_header_id => NULL
106798 );
106799
106800 IF (C_LEVEL_ERROR>= g_log_level) THEN
106801 trace
106802 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
106803 ,p_level => C_LEVEL_ERROR
106804 ,p_module => l_log_module);
106805 END IF;
106806 END IF;
106807 END IF;
106808 --
106809 --
106810 ------------------------------------------------------------------------------------------------
106811 -- 4219869 Business Flow
106812 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
106813 -- Prior Entry. Currently, the following code is always generated.
106814 ------------------------------------------------------------------------------------------------
106815 XLA_AE_LINES_PKG.ValidateCurrentLine;
106816
106817 ------------------------------------------------------------------------------------
106818 -- 4219869 Business Flow
106819 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
106820 ------------------------------------------------------------------------------------
106821 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
106822
106823 ----------------------------------------------------------------------------------
106824 -- 4219869 Business Flow
106825 -- Update journal entry status -- Need to generate this within IF <condition>
106826 ----------------------------------------------------------------------------------
106827 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
106828 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
106829 ,p_balance_type_code => l_balance_type_code
106830 );
106831
106832 -------------------------------------------------------------------------------------------
106833 -- 4262811 - Generate the Accrual Reversal lines
106834 -------------------------------------------------------------------------------------------
106835 BEGIN
106836 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
106837 (g_array_event(p_event_id).array_value_num('header_index'));
106838 IF l_acc_rev_flag IS NULL THEN
106839 l_acc_rev_flag := 'N';
106840 END IF;
106841 EXCEPTION
106842 WHEN OTHERS THEN
106843 l_acc_rev_flag := 'N';
106844 END;
106845 --
106846 IF (l_acc_rev_flag = 'Y') THEN
106847
106848 -- 4645092 ------------------------------------------------------------------------------
106849 -- To allow MPA report to determine if it should generate report process
106850 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
106851 ------------------------------------------------------------------------------------------
106852
106853 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
106854 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
106855 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
106856 -- call ADRs
106857 -- Bug 4922099
106858 --
106859 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
106860 (NVL(l_actual_upg_option, 'N') = 'O') OR
106861 (NVL(l_enc_upg_option, 'N') = 'O')
106862 )
106863 THEN
106864 NULL;
106865 --
106866 --
106867
106868 l_ccid := AcctDerRule_176(
106869 p_application_id => p_application_id
106870 , p_ae_header_id => l_ae_header_id
106871 , p_source_5 => p_source_5
106872 , p_source_31 => p_source_31
106873 , x_transaction_coa_id => l_adr_transaction_coa_id
106874 , x_accounting_coa_id => l_adr_accounting_coa_id
106875 , x_value_type_code => l_adr_value_type_code
106876 , p_side => 'NA'
106877 );
106878
106879 xla_ae_lines_pkg.set_ccid(
106880 p_code_combination_id => l_ccid
106881 , p_value_type_code => l_adr_value_type_code
106882 , p_transaction_coa_id => l_adr_transaction_coa_id
106886 , p_component_type => l_component_type
106883 , p_accounting_coa_id => l_adr_accounting_coa_id
106884 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
106885 , p_adr_type_code => 'S'
106887 , p_component_code => l_component_code
106888 , p_component_type_code => l_component_type_code
106889 , p_component_appl_id => l_component_appl_id
106890 , p_amb_context_code => l_amb_context_code
106891 , p_side => 'NA'
106892 );
106893
106894
106895 --
106896 --
106897 END IF;
106898
106899 --
106900 -- Update the line information that should be overwritten
106901 --
106902 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
106903 p_header_num => 1);
106904 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
106905
106906 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
106907
106908 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
106909 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
106910 END IF;
106911
106912 --
106913 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
106914 --
106915 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
106916 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
106917 ELSE
106918 ---------------------------------------------------------------------------------------------------
106919 -- 4262811a Switch Sign
106920 ---------------------------------------------------------------------------------------------------
106921 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
106922 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
106923 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
106924 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
106925 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
106926 -- 5132302
106927 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
106928 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
106929
106930 END IF;
106931
106932 -- 4955764
106933 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
106934 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
106935
106936
106937 XLA_AE_LINES_PKG.ValidateCurrentLine;
106938 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
106939
106940 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
106941 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
106942 ,p_balance_type_code => l_balance_type_code);
106943
106944 END IF;
106945
106946 -----------------------------------------------------------------------------------------
106947 -- 4262811 Multiperiod Accounting
106948 -----------------------------------------------------------------------------------------
106949 -- No MPA option is assigned.
106950
106951
106952 END IF;
106953 END IF;
106954 --
106955
106956 --
106957 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
106958 trace
106959 (p_msg => 'END of AcctLineType_313'
106960 ,p_level => C_LEVEL_PROCEDURE
106961 ,p_module => l_log_module);
106962 END IF;
106963 --
106964 EXCEPTION
106965 WHEN xla_exceptions_pkg.application_exception THEN
106966 RAISE;
106967 WHEN OTHERS THEN
106968 xla_exceptions_pkg.raise_message
106969 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_313');
106970 END AcctLineType_313;
106971 --
106972
106973 ---------------------------------------
106974 --
106975 -- PRIVATE FUNCTION
106976 -- AcctLineType_314
106977 --
106978 ---------------------------------------
106979 PROCEDURE AcctLineType_314 (
106980 p_application_id IN NUMBER
106981 ,p_event_id IN NUMBER
106982 ,p_calculate_acctd_flag IN VARCHAR2
106983 ,p_calculate_g_l_flag IN VARCHAR2
106984 ,p_actual_flag IN OUT VARCHAR2
106985 ,p_balance_type_code OUT VARCHAR2
106986 ,p_gain_or_loss_ref OUT VARCHAR2
106987
106988 --Period Close Date
106989 , p_source_1 IN DATE
106990 --Generated Code Combination Identifier
106991 , p_source_5 IN NUMBER
106992 --Expense Account Code Combination Identifier
106993 , p_source_31 IN NUMBER
106994 --Adjustment Type
106995 , p_source_48 IN VARCHAR2
106996 --Transaction Header Identifier
106997 , p_source_49 IN NUMBER
106998 --Adjustment Line Identifier
106999 , p_source_50 IN NUMBER
107000 --Distribution Type Code
107001 , p_source_51 IN VARCHAR2
107002 --Entered Amount
107003 , p_source_52 IN NUMBER
107004 --Currency Code
107005 , p_source_53 IN VARCHAR2
107009 l_component_type VARCHAR2(80);
107006 )
107007 IS
107008
107010 l_component_code VARCHAR2(30);
107011 l_component_type_code VARCHAR2(1);
107012 l_component_appl_id INTEGER;
107013 l_amb_context_code VARCHAR2(30);
107014 l_entity_code VARCHAR2(30);
107015 l_event_class_code VARCHAR2(30);
107016 l_ae_header_id NUMBER;
107017 l_event_type_code VARCHAR2(30);
107018 l_line_definition_code VARCHAR2(30);
107019 l_line_definition_owner_code VARCHAR2(1);
107020 --
107021 -- adr variables
107022 l_segment VARCHAR2(30);
107023 l_ccid NUMBER;
107024 l_adr_transaction_coa_id NUMBER;
107025 l_adr_accounting_coa_id NUMBER;
107026 l_adr_flexfield_segment_code VARCHAR2(30);
107027 l_adr_flex_value_set_id NUMBER;
107028 l_adr_value_type_code VARCHAR2(30);
107029 l_adr_value_combination_id NUMBER;
107030 l_adr_value_segment_code VARCHAR2(30);
107031
107032 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
107033 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
107034 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
107035 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
107036
107037 -- 4262811 Variables ------------------------------------------------------------------------------------------
107038 l_entered_amt_idx NUMBER;
107039 l_accted_amt_idx NUMBER;
107040 l_acc_rev_flag VARCHAR2(1);
107041 l_accrual_line_num NUMBER;
107042 l_tmp_amt NUMBER;
107043 l_acc_rev_natural_side_code VARCHAR2(1);
107044
107045 l_num_entries NUMBER;
107046 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
107047 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
107048 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
107049 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
107050 l_recog_line_1 NUMBER;
107051 l_recog_line_2 NUMBER;
107052
107053 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
107054 l_bflow_applied_to_amt NUMBER; -- 5132302
107055 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
107056
107057 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
107058
107059 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
107060 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
107061
107062 ---------------------------------------------------------------------------------------------------------------
107063
107064
107065 --
107066 -- bulk performance
107067 --
107068 l_balance_type_code VARCHAR2(1);
107069 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
107070 l_log_module VARCHAR2(240);
107071
107072 --
107073 -- Upgrade strategy
107074 --
107075 l_actual_upg_option VARCHAR2(1);
107076 l_enc_upg_option VARCHAR2(1);
107077
107078 --
107079 BEGIN
107080 --
107081 IF g_log_enabled THEN
107082 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_314';
107083 END IF;
107084 --
107085 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
107086
107087 trace
107088 (p_msg => 'BEGIN of AcctLineType_314'
107089 ,p_level => C_LEVEL_PROCEDURE
107090 ,p_module => l_log_module);
107091
107092 END IF;
107093 --
107094 l_component_type := 'AMB_JLT';
107095 l_component_code := 'FA_RETIREMENT_DEPRN_EXP';
107096 l_component_type_code := 'S';
107097 l_component_appl_id := 140;
107098 l_amb_context_code := 'DEFAULT';
107099 l_entity_code := 'TRANSACTIONS';
107100 l_event_class_code := 'RETIREMENTS';
107101 l_event_type_code := 'RETIREMENTS';
107102 l_line_definition_owner_code := 'S';
107103 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
107104 --
107105 l_balance_type_code := 'A';
107106 l_segment := NULL;
107107 l_ccid := NULL;
107108 l_adr_transaction_coa_id := NULL;
107109 l_adr_accounting_coa_id := NULL;
107110 l_adr_flexfield_segment_code := NULL;
107111 l_adr_flex_value_set_id := NULL;
107112 l_adr_value_type_code := NULL;
107113 l_adr_value_combination_id := NULL;
107114 l_adr_value_segment_code := NULL;
107115
107116 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
107117 l_bflow_class_code := ''; -- 4219869 Business Flow
107118 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
107119 l_budgetary_control_flag := 'N';
107120
107121 l_bflow_applied_to_amt_idx := NULL; -- 5132302
107122 l_bflow_applied_to_amt := NULL; -- 5132302
107123 l_entered_amt_idx := NULL; -- 4262811
107124 l_accted_amt_idx := NULL; -- 4262811
107125 l_acc_rev_flag := NULL; -- 4262811
107126 l_accrual_line_num := NULL; -- 4262811
107127 l_tmp_amt := NULL; -- 4262811
107128 --
107129
107130 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
107131 l_balance_type_code <> 'B' THEN
107132 IF NVL(p_source_48,'
107133 ') = 'EXPENSE'
107134 THEN
107135
107136 --
107140 -- set the flag so later we will know whether the gain loss line needs to be created
107137 XLA_AE_LINES_PKG.SetNewLine;
107138
107139 p_balance_type_code := l_balance_type_code;
107141
107142 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
107143 p_actual_flag :='A';
107144 END IF;
107145
107146 --
107147 -- bulk performance
107148 --
107149 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
107150 p_header_num => 0); -- 4262811
107151 --
107152 -- set accounting line options
107153 --
107154 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
107155 p_natural_side_code => 'C'
107156 , p_gain_or_loss_flag => 'N'
107157 , p_gl_transfer_mode_code => 'S'
107158 , p_acct_entry_type_code => 'A'
107159 , p_switch_side_flag => 'Y'
107160 , p_merge_duplicate_code => 'N'
107161 );
107162 --
107163 l_acc_rev_natural_side_code := 'D'; -- 4262811
107164 --
107165 --
107166 -- set accounting line type info
107167 --
107168 xla_ae_lines_pkg.SetAcctLineType
107169 (p_component_type => l_component_type
107170 ,p_event_type_code => l_event_type_code
107171 ,p_line_definition_owner_code => l_line_definition_owner_code
107172 ,p_line_definition_code => l_line_definition_code
107173 ,p_accounting_line_code => l_component_code
107174 ,p_accounting_line_type_code => l_component_type_code
107175 ,p_accounting_line_appl_id => l_component_appl_id
107176 ,p_amb_context_code => l_amb_context_code
107177 ,p_entity_code => l_entity_code
107178 ,p_event_class_code => l_event_class_code);
107179 --
107180 -- set accounting class
107181 --
107182 xla_ae_lines_pkg.SetAcctClass(
107183 p_accounting_class_code => 'EXPENSE'
107184 , p_ae_header_id => l_ae_header_id
107185 );
107186
107187 --
107188 -- set rounding class
107189 --
107190 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
107191 'EXPENSE';
107192
107193 --
107194 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
107195 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
107196 --
107197 -- bulk performance
107198 --
107199 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
107200
107201 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
107202 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
107203
107204 -- 4955764
107205 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
107206 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
107207
107208 -- 4458381 Public Sector Enh
107209
107210 --
107211 -- set accounting attributes for the line type
107212 --
107213 l_entered_amt_idx := 4;
107214 l_accted_amt_idx := 6;
107215 l_bflow_applied_to_amt_idx := NULL; -- 5132302
107216 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
107217 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
107218 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
107219 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
107220 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
107221 l_rec_acct_attrs.array_char_value(3) := p_source_51;
107222 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
107223 l_rec_acct_attrs.array_num_value(4) := p_source_52;
107224 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
107225 l_rec_acct_attrs.array_char_value(5) := p_source_53;
107226 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
107227 l_rec_acct_attrs.array_num_value(6) := p_source_52;
107228
107229 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
107230 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
107231
107232 ---------------------------------------------------------------------------------------------------------------
107233 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
107234 ---------------------------------------------------------------------------------------------------------------
107235 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
107236
107237 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
107238 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
107239
107240 IF xla_accounting_cache_pkg.GetValueChar
107241 (p_source_code => 'LEDGER_CATEGORY_CODE'
107242 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
107243 AND l_bflow_method_code = 'PRIOR_ENTRY'
107244 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
107245 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
107246 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
107247 )
107248 THEN
107249 xla_ae_lines_pkg.BflowUpgEntry
107253 ELSE
107250 (p_business_method_code => l_bflow_method_code
107251 ,p_business_class_code => l_bflow_class_code
107252 ,p_balance_type => l_balance_type_code);
107254 NULL;
107255 -- No business flow processing for business flow method of NONE.
107256 END IF;
107257
107258 --
107259 -- call analytical criteria
107260 --
107261
107262 --
107263 -- call description
107264 --
107265
107266 xla_ae_lines_pkg.SetLineDescription(
107267 p_ae_header_id => l_ae_header_id
107268 ,p_description => Description_79 (
107269 p_application_id => p_application_id
107270 , p_ae_header_id => l_ae_header_id
107271 , p_source_1 => p_source_1
107272 )
107273 );
107274
107275
107276 --
107277 -- call ADRs
107278 -- Bug 4922099
107279 --
107280 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
107281 (NVL(l_actual_upg_option, 'N') = 'O') OR
107282 (NVL(l_enc_upg_option, 'N') = 'O')
107283 )
107284 THEN
107285 NULL;
107286 --
107287 --
107288
107289 l_ccid := AcctDerRule_176(
107290 p_application_id => p_application_id
107291 , p_ae_header_id => l_ae_header_id
107292 , p_source_5 => p_source_5
107293 , p_source_31 => p_source_31
107294 , x_transaction_coa_id => l_adr_transaction_coa_id
107295 , x_accounting_coa_id => l_adr_accounting_coa_id
107296 , x_value_type_code => l_adr_value_type_code
107297 , p_side => 'NA'
107298 );
107299
107300 xla_ae_lines_pkg.set_ccid(
107301 p_code_combination_id => l_ccid
107302 , p_value_type_code => l_adr_value_type_code
107303 , p_transaction_coa_id => l_adr_transaction_coa_id
107304 , p_accounting_coa_id => l_adr_accounting_coa_id
107305 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
107306 , p_adr_type_code => 'S'
107307 , p_component_type => l_component_type
107308 , p_component_code => l_component_code
107309 , p_component_type_code => l_component_type_code
107310 , p_component_appl_id => l_component_appl_id
107311 , p_amb_context_code => l_amb_context_code
107312 , p_side => 'NA'
107313 );
107314
107315
107316 --
107317 --
107318 END IF;
107319 --
107320 -- Bug 4922099
107321 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
107322 (NVL(l_enc_upg_option, 'N') = 'O')
107323 ) AND
107324 (l_bflow_method_code = 'PRIOR_ENTRY')
107325 )
107326 THEN
107327 IF
107328 --
107329 1 = 2
107330 --
107331 THEN
107332 xla_accounting_err_pkg.build_message
107333 (p_appli_s_name => 'XLA'
107334 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
107335 ,p_token_1 => 'LINE_NUMBER'
107336 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
107337 ,p_token_2 => 'LINE_TYPE_NAME'
107338 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
107339 l_component_type
107340 ,l_component_code
107341 ,l_component_type_code
107342 ,l_component_appl_id
107343 ,l_amb_context_code
107344 ,l_entity_code
107345 ,l_event_class_code
107346 )
107347 ,p_token_3 => 'OWNER'
107348 ,p_value_3 => xla_lookups_pkg.get_meaning(
107349 p_lookup_type => 'XLA_OWNER_TYPE'
107350 ,p_lookup_code => l_component_type_code
107351 )
107352 ,p_token_4 => 'PRODUCT_NAME'
107353 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
107354 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
107355 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
107356 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
107357 ,p_ae_header_id => NULL
107358 );
107359
107360 IF (C_LEVEL_ERROR>= g_log_level) THEN
107361 trace
107362 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
107363 ,p_level => C_LEVEL_ERROR
107367 END IF;
107364 ,p_module => l_log_module);
107365 END IF;
107366 END IF;
107368 --
107369 --
107370 ------------------------------------------------------------------------------------------------
107371 -- 4219869 Business Flow
107372 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
107373 -- Prior Entry. Currently, the following code is always generated.
107374 ------------------------------------------------------------------------------------------------
107375 XLA_AE_LINES_PKG.ValidateCurrentLine;
107376
107377 ------------------------------------------------------------------------------------
107378 -- 4219869 Business Flow
107379 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
107380 ------------------------------------------------------------------------------------
107381 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
107382
107383 ----------------------------------------------------------------------------------
107384 -- 4219869 Business Flow
107385 -- Update journal entry status -- Need to generate this within IF <condition>
107386 ----------------------------------------------------------------------------------
107387 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
107388 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
107389 ,p_balance_type_code => l_balance_type_code
107390 );
107391
107392 -------------------------------------------------------------------------------------------
107393 -- 4262811 - Generate the Accrual Reversal lines
107394 -------------------------------------------------------------------------------------------
107395 BEGIN
107396 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
107397 (g_array_event(p_event_id).array_value_num('header_index'));
107398 IF l_acc_rev_flag IS NULL THEN
107399 l_acc_rev_flag := 'N';
107400 END IF;
107401 EXCEPTION
107402 WHEN OTHERS THEN
107403 l_acc_rev_flag := 'N';
107404 END;
107405 --
107406 IF (l_acc_rev_flag = 'Y') THEN
107407
107408 -- 4645092 ------------------------------------------------------------------------------
107409 -- To allow MPA report to determine if it should generate report process
107410 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
107411 ------------------------------------------------------------------------------------------
107412
107413 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
107414 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
107415 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
107416 -- call ADRs
107417 -- Bug 4922099
107418 --
107419 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
107420 (NVL(l_actual_upg_option, 'N') = 'O') OR
107421 (NVL(l_enc_upg_option, 'N') = 'O')
107422 )
107423 THEN
107424 NULL;
107425 --
107426 --
107427
107428 l_ccid := AcctDerRule_176(
107429 p_application_id => p_application_id
107430 , p_ae_header_id => l_ae_header_id
107431 , p_source_5 => p_source_5
107432 , p_source_31 => p_source_31
107433 , x_transaction_coa_id => l_adr_transaction_coa_id
107434 , x_accounting_coa_id => l_adr_accounting_coa_id
107435 , x_value_type_code => l_adr_value_type_code
107436 , p_side => 'NA'
107437 );
107438
107439 xla_ae_lines_pkg.set_ccid(
107440 p_code_combination_id => l_ccid
107441 , p_value_type_code => l_adr_value_type_code
107442 , p_transaction_coa_id => l_adr_transaction_coa_id
107443 , p_accounting_coa_id => l_adr_accounting_coa_id
107444 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
107445 , p_adr_type_code => 'S'
107446 , p_component_type => l_component_type
107447 , p_component_code => l_component_code
107448 , p_component_type_code => l_component_type_code
107449 , p_component_appl_id => l_component_appl_id
107450 , p_amb_context_code => l_amb_context_code
107451 , p_side => 'NA'
107452 );
107453
107454
107455 --
107456 --
107457 END IF;
107458
107459 --
107460 -- Update the line information that should be overwritten
107461 --
107462 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
107463 p_header_num => 1);
107464 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
107465
107466 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
107467
107468 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
107469 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
107470 END IF;
107471
107472 --
107473 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
107474 --
107475 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
107476 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
107480 ---------------------------------------------------------------------------------------------------
107477 ELSE
107478 ---------------------------------------------------------------------------------------------------
107479 -- 4262811a Switch Sign
107481 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
107482 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
107483 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
107484 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
107485 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
107486 -- 5132302
107487 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
107488 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
107489
107490 END IF;
107491
107492 -- 4955764
107493 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
107494 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
107495
107496
107497 XLA_AE_LINES_PKG.ValidateCurrentLine;
107498 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
107499
107500 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
107501 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
107502 ,p_balance_type_code => l_balance_type_code);
107503
107504 END IF;
107505
107506 -----------------------------------------------------------------------------------------
107507 -- 4262811 Multiperiod Accounting
107508 -----------------------------------------------------------------------------------------
107509 -- No MPA option is assigned.
107510
107511
107512 END IF;
107513 END IF;
107514 --
107515
107516 --
107517 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
107518 trace
107519 (p_msg => 'END of AcctLineType_314'
107520 ,p_level => C_LEVEL_PROCEDURE
107521 ,p_module => l_log_module);
107522 END IF;
107523 --
107524 EXCEPTION
107525 WHEN xla_exceptions_pkg.application_exception THEN
107526 RAISE;
107527 WHEN OTHERS THEN
107528 xla_exceptions_pkg.raise_message
107529 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_314');
107530 END AcctLineType_314;
107531 --
107532
107533 ---------------------------------------
107534 --
107535 -- PRIVATE FUNCTION
107536 -- AcctLineType_315
107537 --
107538 ---------------------------------------
107539 PROCEDURE AcctLineType_315 (
107540 p_application_id IN NUMBER
107541 ,p_event_id IN NUMBER
107542 ,p_calculate_acctd_flag IN VARCHAR2
107543 ,p_calculate_g_l_flag IN VARCHAR2
107544 ,p_actual_flag IN OUT VARCHAR2
107545 ,p_balance_type_code OUT VARCHAR2
107546 ,p_gain_or_loss_ref OUT VARCHAR2
107547
107548 --Period Close Date
107549 , p_source_1 IN DATE
107550 --Generated Code Combination Identifier
107551 , p_source_5 IN NUMBER
107552 --Depreciation Reserve Account
107553 , p_source_12 IN VARCHAR2
107554 --Generated Offset Code Combination Identifier
107555 , p_source_19 IN NUMBER
107556 --Expense Account Code Combination Identifier
107557 , p_source_31 IN NUMBER
107558 --Default Code Combination Identifier
107559 , p_source_32 IN NUMBER
107560 --Adjustment Type
107561 , p_source_48 IN VARCHAR2
107562 --Transaction Header Identifier
107563 , p_source_49 IN NUMBER
107564 --Adjustment Line Identifier
107565 , p_source_50 IN NUMBER
107566 --Distribution Type Code
107567 , p_source_51 IN VARCHAR2
107568 --Entered Amount
107569 , p_source_52 IN NUMBER
107570 --Currency Code
107571 , p_source_53 IN VARCHAR2
107572 )
107573 IS
107574
107575 l_component_type VARCHAR2(80);
107576 l_component_code VARCHAR2(30);
107577 l_component_type_code VARCHAR2(1);
107578 l_component_appl_id INTEGER;
107579 l_amb_context_code VARCHAR2(30);
107580 l_entity_code VARCHAR2(30);
107581 l_event_class_code VARCHAR2(30);
107582 l_ae_header_id NUMBER;
107583 l_event_type_code VARCHAR2(30);
107584 l_line_definition_code VARCHAR2(30);
107585 l_line_definition_owner_code VARCHAR2(1);
107586 --
107587 -- adr variables
107588 l_segment VARCHAR2(30);
107589 l_ccid NUMBER;
107590 l_adr_transaction_coa_id NUMBER;
107591 l_adr_accounting_coa_id NUMBER;
107592 l_adr_flexfield_segment_code VARCHAR2(30);
107593 l_adr_flex_value_set_id NUMBER;
107594 l_adr_value_type_code VARCHAR2(30);
107595 l_adr_value_combination_id NUMBER;
107596 l_adr_value_segment_code VARCHAR2(30);
107597
107598 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
107599 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
107600 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
107601 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
107602
107606 l_acc_rev_flag VARCHAR2(1);
107603 -- 4262811 Variables ------------------------------------------------------------------------------------------
107604 l_entered_amt_idx NUMBER;
107605 l_accted_amt_idx NUMBER;
107607 l_accrual_line_num NUMBER;
107608 l_tmp_amt NUMBER;
107609 l_acc_rev_natural_side_code VARCHAR2(1);
107610
107611 l_num_entries NUMBER;
107612 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
107613 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
107614 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
107615 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
107616 l_recog_line_1 NUMBER;
107617 l_recog_line_2 NUMBER;
107618
107619 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
107620 l_bflow_applied_to_amt NUMBER; -- 5132302
107621 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
107622
107623 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
107624
107625 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
107626 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
107627
107628 ---------------------------------------------------------------------------------------------------------------
107629
107630
107631 --
107632 -- bulk performance
107633 --
107634 l_balance_type_code VARCHAR2(1);
107635 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
107636 l_log_module VARCHAR2(240);
107637
107638 --
107639 -- Upgrade strategy
107640 --
107641 l_actual_upg_option VARCHAR2(1);
107642 l_enc_upg_option VARCHAR2(1);
107643
107644 --
107645 BEGIN
107646 --
107647 IF g_log_enabled THEN
107648 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_315';
107649 END IF;
107650 --
107651 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
107652
107653 trace
107654 (p_msg => 'BEGIN of AcctLineType_315'
107655 ,p_level => C_LEVEL_PROCEDURE
107656 ,p_module => l_log_module);
107657
107658 END IF;
107659 --
107660 l_component_type := 'AMB_JLT';
107661 l_component_code := 'FA_RETIREMENT_DEPRN_RESERVE';
107662 l_component_type_code := 'S';
107663 l_component_appl_id := 140;
107664 l_amb_context_code := 'DEFAULT';
107665 l_entity_code := 'TRANSACTIONS';
107666 l_event_class_code := 'RETIREMENTS';
107667 l_event_type_code := 'RETIREMENTS';
107668 l_line_definition_owner_code := 'S';
107669 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
107670 --
107671 l_balance_type_code := 'A';
107672 l_segment := NULL;
107673 l_ccid := NULL;
107674 l_adr_transaction_coa_id := NULL;
107675 l_adr_accounting_coa_id := NULL;
107676 l_adr_flexfield_segment_code := NULL;
107677 l_adr_flex_value_set_id := NULL;
107678 l_adr_value_type_code := NULL;
107679 l_adr_value_combination_id := NULL;
107680 l_adr_value_segment_code := NULL;
107681
107682 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
107683 l_bflow_class_code := ''; -- 4219869 Business Flow
107684 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
107685 l_budgetary_control_flag := 'N';
107686
107687 l_bflow_applied_to_amt_idx := NULL; -- 5132302
107688 l_bflow_applied_to_amt := NULL; -- 5132302
107689 l_entered_amt_idx := NULL; -- 4262811
107690 l_accted_amt_idx := NULL; -- 4262811
107691 l_acc_rev_flag := NULL; -- 4262811
107692 l_accrual_line_num := NULL; -- 4262811
107693 l_tmp_amt := NULL; -- 4262811
107694 --
107695
107696 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
107697 l_balance_type_code <> 'B' THEN
107698 IF NVL(p_source_48,'
107699 ') = 'EXPENSE'
107700 THEN
107701
107702 --
107703 XLA_AE_LINES_PKG.SetNewLine;
107704
107705 p_balance_type_code := l_balance_type_code;
107706 -- set the flag so later we will know whether the gain loss line needs to be created
107707
107708 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
107709 p_actual_flag :='A';
107710 END IF;
107711
107712 --
107713 -- bulk performance
107714 --
107715 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
107716 p_header_num => 0); -- 4262811
107717 --
107718 -- set accounting line options
107719 --
107720 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
107721 p_natural_side_code => 'D'
107722 , p_gain_or_loss_flag => 'N'
107723 , p_gl_transfer_mode_code => 'S'
107724 , p_acct_entry_type_code => 'A'
107725 , p_switch_side_flag => 'Y'
107726 , p_merge_duplicate_code => 'N'
107727 );
107728 --
107729 l_acc_rev_natural_side_code := 'C'; -- 4262811
107730 --
107731 --
107732 -- set accounting line type info
107733 --
107734 xla_ae_lines_pkg.SetAcctLineType
107735 (p_component_type => l_component_type
107739 ,p_accounting_line_code => l_component_code
107736 ,p_event_type_code => l_event_type_code
107737 ,p_line_definition_owner_code => l_line_definition_owner_code
107738 ,p_line_definition_code => l_line_definition_code
107740 ,p_accounting_line_type_code => l_component_type_code
107741 ,p_accounting_line_appl_id => l_component_appl_id
107742 ,p_amb_context_code => l_amb_context_code
107743 ,p_entity_code => l_entity_code
107744 ,p_event_class_code => l_event_class_code);
107745 --
107746 -- set accounting class
107747 --
107748 xla_ae_lines_pkg.SetAcctClass(
107749 p_accounting_class_code => 'ASSET'
107750 , p_ae_header_id => l_ae_header_id
107751 );
107752
107753 --
107754 -- set rounding class
107755 --
107756 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
107757 'ASSET';
107758
107759 --
107760 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
107761 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
107762 --
107763 -- bulk performance
107764 --
107765 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
107766
107767 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
107768 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
107769
107770 -- 4955764
107771 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
107772 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
107773
107774 -- 4458381 Public Sector Enh
107775
107776 --
107777 -- set accounting attributes for the line type
107778 --
107779 l_entered_amt_idx := 4;
107780 l_accted_amt_idx := 6;
107781 l_bflow_applied_to_amt_idx := NULL; -- 5132302
107782 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
107783 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
107784 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
107785 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
107786 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
107787 l_rec_acct_attrs.array_char_value(3) := p_source_51;
107788 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
107789 l_rec_acct_attrs.array_num_value(4) := p_source_52;
107790 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
107791 l_rec_acct_attrs.array_char_value(5) := p_source_53;
107792 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
107793 l_rec_acct_attrs.array_num_value(6) := p_source_52;
107794
107795 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
107796 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
107797
107798 ---------------------------------------------------------------------------------------------------------------
107799 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
107800 ---------------------------------------------------------------------------------------------------------------
107801 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
107802
107803 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
107804 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
107805
107806 IF xla_accounting_cache_pkg.GetValueChar
107807 (p_source_code => 'LEDGER_CATEGORY_CODE'
107808 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
107809 AND l_bflow_method_code = 'PRIOR_ENTRY'
107810 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
107811 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
107812 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
107813 )
107814 THEN
107815 xla_ae_lines_pkg.BflowUpgEntry
107816 (p_business_method_code => l_bflow_method_code
107817 ,p_business_class_code => l_bflow_class_code
107818 ,p_balance_type => l_balance_type_code);
107819 ELSE
107820 NULL;
107821 -- No business flow processing for business flow method of NONE.
107822 END IF;
107823
107824 --
107825 -- call analytical criteria
107826 --
107827
107828 --
107829 -- call description
107830 --
107831
107832 xla_ae_lines_pkg.SetLineDescription(
107833 p_ae_header_id => l_ae_header_id
107834 ,p_description => Description_82 (
107835 p_application_id => p_application_id
107836 , p_ae_header_id => l_ae_header_id
107837 , p_source_1 => p_source_1
107838 )
107839 );
107840
107841
107842 --
107843 -- call ADRs
107844 -- Bug 4922099
107845 --
107846 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
107847 (NVL(l_actual_upg_option, 'N') = 'O') OR
107848 (NVL(l_enc_upg_option, 'N') = 'O')
107849 )
107850 THEN
107851 NULL;
107852 --
107853 --
107854
107855 l_ccid := AcctDerRule_175(
107856 p_application_id => p_application_id
107860 , p_source_32 => p_source_32
107857 , p_ae_header_id => l_ae_header_id
107858 , p_source_5 => p_source_5
107859 , p_source_19 => p_source_19
107861 , x_transaction_coa_id => l_adr_transaction_coa_id
107862 , x_accounting_coa_id => l_adr_accounting_coa_id
107863 , x_value_type_code => l_adr_value_type_code
107864 , p_side => 'NA'
107865 );
107866
107867 xla_ae_lines_pkg.set_ccid(
107868 p_code_combination_id => l_ccid
107869 , p_value_type_code => l_adr_value_type_code
107870 , p_transaction_coa_id => l_adr_transaction_coa_id
107871 , p_accounting_coa_id => l_adr_accounting_coa_id
107872 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
107873 , p_adr_type_code => 'S'
107874 , p_component_type => l_component_type
107875 , p_component_code => l_component_code
107876 , p_component_type_code => l_component_type_code
107877 , p_component_appl_id => l_component_appl_id
107878 , p_amb_context_code => l_amb_context_code
107879 , p_side => 'NA'
107880 );
107881
107882
107883 l_segment := AcctDerRule_150(
107884 p_application_id => p_application_id
107885 , p_ae_header_id => l_ae_header_id
107886 , p_source_5 => p_source_5
107887 , p_source_12 => p_source_12
107888 , x_transaction_coa_id => l_adr_transaction_coa_id
107889 , x_accounting_coa_id => l_adr_accounting_coa_id
107890 , x_flexfield_segment_code => l_adr_flexfield_segment_code
107891 , x_flex_value_set_id => l_adr_flex_value_set_id
107892 , x_value_type_code => l_adr_value_type_code
107893 , x_value_combination_id => l_adr_value_combination_id
107894 , x_value_segment_code => l_adr_value_segment_code
107895 , p_side => 'NA'
107896 , p_override_seg_flag => 'Y'
107897 );
107898
107899 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
107900
107901 xla_ae_lines_pkg.set_segment(
107902 p_to_segment_code => 'GL_ACCOUNT'
107903 , p_segment_value => l_segment
107904 , p_from_segment_code => l_adr_value_segment_code
107905 , p_from_combination_id => l_adr_value_combination_id
107906 , p_value_type_code => l_adr_value_type_code
107907 , p_transaction_coa_id => l_adr_transaction_coa_id
107908 , p_accounting_coa_id => l_adr_accounting_coa_id
107909 , p_flexfield_segment_code => l_adr_flexfield_segment_code
107910 , p_flex_value_set_id => l_adr_flex_value_set_id
107911 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
107912 , p_adr_type_code => 'S'
107913 , p_component_type => l_component_type
107914 , p_component_code => l_component_code
107915 , p_component_type_code => l_component_type_code
107916 , p_component_appl_id => l_component_appl_id
107917 , p_amb_context_code => l_amb_context_code
107918 , p_entity_code => 'TRANSACTIONS'
107919 , p_event_class_code => 'RETIREMENTS'
107920 , p_side => 'NA'
107921 );
107922
107923 END IF;
107924
107925 l_segment := AcctDerRule_169(
107926 p_application_id => p_application_id
107927 , p_ae_header_id => l_ae_header_id
107928 , p_source_5 => p_source_5
107929 , p_source_31 => p_source_31
107930 , x_transaction_coa_id => l_adr_transaction_coa_id
107931 , x_accounting_coa_id => l_adr_accounting_coa_id
107932 , x_flexfield_segment_code => l_adr_flexfield_segment_code
107933 , x_flex_value_set_id => l_adr_flex_value_set_id
107934 , x_value_type_code => l_adr_value_type_code
107935 , x_value_combination_id => l_adr_value_combination_id
107936 , x_value_segment_code => l_adr_value_segment_code
107937 , p_side => 'NA'
107938 , p_override_seg_flag => 'Y'
107939 );
107940
107941 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
107942
107943 xla_ae_lines_pkg.set_segment(
107944 p_to_segment_code => 'GL_BALANCING'
107945 , p_segment_value => l_segment
107946 , p_from_segment_code => l_adr_value_segment_code
107947 , p_from_combination_id => l_adr_value_combination_id
107948 , p_value_type_code => l_adr_value_type_code
107949 , p_transaction_coa_id => l_adr_transaction_coa_id
107950 , p_accounting_coa_id => l_adr_accounting_coa_id
107951 , p_flexfield_segment_code => l_adr_flexfield_segment_code
107952 , p_flex_value_set_id => l_adr_flex_value_set_id
107953 , p_adr_code => 'FA_EXPENSE_ACCT'
107954 , p_adr_type_code => 'S'
107955 , p_component_type => l_component_type
107956 , p_component_code => l_component_code
107957 , p_component_type_code => l_component_type_code
107958 , p_component_appl_id => l_component_appl_id
107959 , p_amb_context_code => l_amb_context_code
107960 , p_entity_code => 'TRANSACTIONS'
107961 , p_event_class_code => 'RETIREMENTS'
107962 , p_side => 'NA'
107963 );
107967 --
107964
107965 END IF;
107966
107968 --
107969 END IF;
107970 --
107971 -- Bug 4922099
107972 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
107973 (NVL(l_enc_upg_option, 'N') = 'O')
107974 ) AND
107975 (l_bflow_method_code = 'PRIOR_ENTRY')
107976 )
107977 THEN
107978 IF
107979 --
107980 1 = 2
107981 --
107982 THEN
107983 xla_accounting_err_pkg.build_message
107984 (p_appli_s_name => 'XLA'
107985 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
107986 ,p_token_1 => 'LINE_NUMBER'
107987 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
107988 ,p_token_2 => 'LINE_TYPE_NAME'
107989 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
107990 l_component_type
107991 ,l_component_code
107992 ,l_component_type_code
107993 ,l_component_appl_id
107994 ,l_amb_context_code
107995 ,l_entity_code
107996 ,l_event_class_code
107997 )
107998 ,p_token_3 => 'OWNER'
107999 ,p_value_3 => xla_lookups_pkg.get_meaning(
108000 p_lookup_type => 'XLA_OWNER_TYPE'
108001 ,p_lookup_code => l_component_type_code
108002 )
108003 ,p_token_4 => 'PRODUCT_NAME'
108004 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
108005 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
108006 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
108007 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
108008 ,p_ae_header_id => NULL
108009 );
108010
108011 IF (C_LEVEL_ERROR>= g_log_level) THEN
108012 trace
108013 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
108014 ,p_level => C_LEVEL_ERROR
108015 ,p_module => l_log_module);
108016 END IF;
108017 END IF;
108018 END IF;
108019 --
108020 --
108021 ------------------------------------------------------------------------------------------------
108022 -- 4219869 Business Flow
108023 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
108024 -- Prior Entry. Currently, the following code is always generated.
108025 ------------------------------------------------------------------------------------------------
108026 XLA_AE_LINES_PKG.ValidateCurrentLine;
108027
108028 ------------------------------------------------------------------------------------
108029 -- 4219869 Business Flow
108030 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
108031 ------------------------------------------------------------------------------------
108032 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
108033
108034 ----------------------------------------------------------------------------------
108035 -- 4219869 Business Flow
108036 -- Update journal entry status -- Need to generate this within IF <condition>
108037 ----------------------------------------------------------------------------------
108038 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
108039 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
108040 ,p_balance_type_code => l_balance_type_code
108041 );
108042
108043 -------------------------------------------------------------------------------------------
108044 -- 4262811 - Generate the Accrual Reversal lines
108045 -------------------------------------------------------------------------------------------
108046 BEGIN
108047 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
108048 (g_array_event(p_event_id).array_value_num('header_index'));
108049 IF l_acc_rev_flag IS NULL THEN
108050 l_acc_rev_flag := 'N';
108051 END IF;
108052 EXCEPTION
108053 WHEN OTHERS THEN
108054 l_acc_rev_flag := 'N';
108055 END;
108056 --
108057 IF (l_acc_rev_flag = 'Y') THEN
108058
108059 -- 4645092 ------------------------------------------------------------------------------
108060 -- To allow MPA report to determine if it should generate report process
108061 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
108065 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
108062 ------------------------------------------------------------------------------------------
108063
108064 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
108066 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
108067 -- call ADRs
108068 -- Bug 4922099
108069 --
108070 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
108071 (NVL(l_actual_upg_option, 'N') = 'O') OR
108072 (NVL(l_enc_upg_option, 'N') = 'O')
108073 )
108074 THEN
108075 NULL;
108076 --
108077 --
108078
108079 l_ccid := AcctDerRule_175(
108080 p_application_id => p_application_id
108081 , p_ae_header_id => l_ae_header_id
108082 , p_source_5 => p_source_5
108083 , p_source_19 => p_source_19
108084 , p_source_32 => p_source_32
108085 , x_transaction_coa_id => l_adr_transaction_coa_id
108086 , x_accounting_coa_id => l_adr_accounting_coa_id
108087 , x_value_type_code => l_adr_value_type_code
108088 , p_side => 'NA'
108089 );
108090
108091 xla_ae_lines_pkg.set_ccid(
108092 p_code_combination_id => l_ccid
108093 , p_value_type_code => l_adr_value_type_code
108094 , p_transaction_coa_id => l_adr_transaction_coa_id
108095 , p_accounting_coa_id => l_adr_accounting_coa_id
108096 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
108097 , p_adr_type_code => 'S'
108098 , p_component_type => l_component_type
108099 , p_component_code => l_component_code
108100 , p_component_type_code => l_component_type_code
108101 , p_component_appl_id => l_component_appl_id
108102 , p_amb_context_code => l_amb_context_code
108103 , p_side => 'NA'
108104 );
108105
108106
108107 l_segment := AcctDerRule_150(
108108 p_application_id => p_application_id
108109 , p_ae_header_id => l_ae_header_id
108110 , p_source_5 => p_source_5
108111 , p_source_12 => p_source_12
108112 , x_transaction_coa_id => l_adr_transaction_coa_id
108113 , x_accounting_coa_id => l_adr_accounting_coa_id
108114 , x_flexfield_segment_code => l_adr_flexfield_segment_code
108115 , x_flex_value_set_id => l_adr_flex_value_set_id
108116 , x_value_type_code => l_adr_value_type_code
108117 , x_value_combination_id => l_adr_value_combination_id
108118 , x_value_segment_code => l_adr_value_segment_code
108119 , p_side => 'NA'
108120 , p_override_seg_flag => 'Y'
108121 );
108122
108123 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
108124
108125 xla_ae_lines_pkg.set_segment(
108126 p_to_segment_code => 'GL_ACCOUNT'
108127 , p_segment_value => l_segment
108128 , p_from_segment_code => l_adr_value_segment_code
108129 , p_from_combination_id => l_adr_value_combination_id
108130 , p_value_type_code => l_adr_value_type_code
108131 , p_transaction_coa_id => l_adr_transaction_coa_id
108132 , p_accounting_coa_id => l_adr_accounting_coa_id
108133 , p_flexfield_segment_code => l_adr_flexfield_segment_code
108134 , p_flex_value_set_id => l_adr_flex_value_set_id
108135 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
108136 , p_adr_type_code => 'S'
108137 , p_component_type => l_component_type
108138 , p_component_code => l_component_code
108139 , p_component_type_code => l_component_type_code
108140 , p_component_appl_id => l_component_appl_id
108141 , p_amb_context_code => l_amb_context_code
108142 , p_entity_code => 'TRANSACTIONS'
108143 , p_event_class_code => 'RETIREMENTS'
108144 , p_side => 'NA'
108145 );
108146
108147 END IF;
108148
108149 l_segment := AcctDerRule_169(
108150 p_application_id => p_application_id
108151 , p_ae_header_id => l_ae_header_id
108152 , p_source_5 => p_source_5
108153 , p_source_31 => p_source_31
108154 , x_transaction_coa_id => l_adr_transaction_coa_id
108155 , x_accounting_coa_id => l_adr_accounting_coa_id
108156 , x_flexfield_segment_code => l_adr_flexfield_segment_code
108157 , x_flex_value_set_id => l_adr_flex_value_set_id
108158 , x_value_type_code => l_adr_value_type_code
108159 , x_value_combination_id => l_adr_value_combination_id
108160 , x_value_segment_code => l_adr_value_segment_code
108161 , p_side => 'NA'
108162 , p_override_seg_flag => 'Y'
108163 );
108164
108165 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
108166
108167 xla_ae_lines_pkg.set_segment(
108168 p_to_segment_code => 'GL_BALANCING'
108169 , p_segment_value => l_segment
108170 , p_from_segment_code => l_adr_value_segment_code
108171 , p_from_combination_id => l_adr_value_combination_id
108172 , p_value_type_code => l_adr_value_type_code
108173 , p_transaction_coa_id => l_adr_transaction_coa_id
108177 , p_adr_code => 'FA_EXPENSE_ACCT'
108174 , p_accounting_coa_id => l_adr_accounting_coa_id
108175 , p_flexfield_segment_code => l_adr_flexfield_segment_code
108176 , p_flex_value_set_id => l_adr_flex_value_set_id
108178 , p_adr_type_code => 'S'
108179 , p_component_type => l_component_type
108180 , p_component_code => l_component_code
108181 , p_component_type_code => l_component_type_code
108182 , p_component_appl_id => l_component_appl_id
108183 , p_amb_context_code => l_amb_context_code
108184 , p_entity_code => 'TRANSACTIONS'
108185 , p_event_class_code => 'RETIREMENTS'
108186 , p_side => 'NA'
108187 );
108188
108189 END IF;
108190
108191 --
108192 --
108193 END IF;
108194
108195 --
108196 -- Update the line information that should be overwritten
108197 --
108198 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
108199 p_header_num => 1);
108200 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
108201
108202 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
108203
108204 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
108205 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
108206 END IF;
108207
108208 --
108209 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
108210 --
108211 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
108212 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
108213 ELSE
108214 ---------------------------------------------------------------------------------------------------
108215 -- 4262811a Switch Sign
108216 ---------------------------------------------------------------------------------------------------
108217 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
108218 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
108219 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
108220 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
108221 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
108222 -- 5132302
108223 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
108224 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
108225
108226 END IF;
108227
108228 -- 4955764
108229 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
108230 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
108231
108232
108233 XLA_AE_LINES_PKG.ValidateCurrentLine;
108234 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
108235
108236 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
108237 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
108238 ,p_balance_type_code => l_balance_type_code);
108239
108240 END IF;
108241
108242 -----------------------------------------------------------------------------------------
108243 -- 4262811 Multiperiod Accounting
108244 -----------------------------------------------------------------------------------------
108245 -- No MPA option is assigned.
108246
108247
108248 END IF;
108249 END IF;
108250 --
108251
108252 --
108253 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
108254 trace
108255 (p_msg => 'END of AcctLineType_315'
108256 ,p_level => C_LEVEL_PROCEDURE
108257 ,p_module => l_log_module);
108258 END IF;
108259 --
108260 EXCEPTION
108261 WHEN xla_exceptions_pkg.application_exception THEN
108262 RAISE;
108263 WHEN OTHERS THEN
108264 xla_exceptions_pkg.raise_message
108265 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_315');
108266 END AcctLineType_315;
108267 --
108268
108269 ---------------------------------------
108270 --
108271 -- PRIVATE FUNCTION
108272 -- AcctLineType_316
108273 --
108274 ---------------------------------------
108275 PROCEDURE AcctLineType_316 (
108276 p_application_id IN NUMBER
108277 ,p_event_id IN NUMBER
108278 ,p_calculate_acctd_flag IN VARCHAR2
108279 ,p_calculate_g_l_flag IN VARCHAR2
108280 ,p_actual_flag IN OUT VARCHAR2
108281 ,p_balance_type_code OUT VARCHAR2
108282 ,p_gain_or_loss_ref OUT VARCHAR2
108283
108284 --Period Close Date
108285 , p_source_1 IN DATE
108286 --Generated Code Combination Identifier
108287 , p_source_5 IN NUMBER
108288 --Depreciation Reserve Account
108289 , p_source_12 IN VARCHAR2
108290 --Generated Offset Code Combination Identifier
108291 , p_source_19 IN NUMBER
108292 --Expense Account Code Combination Identifier
108293 , p_source_31 IN NUMBER
108294 --Default Code Combination Identifier
108295 , p_source_32 IN NUMBER
108296 --Adjustment Type
108300 --Adjustment Line Identifier
108297 , p_source_48 IN VARCHAR2
108298 --Transaction Header Identifier
108299 , p_source_49 IN NUMBER
108301 , p_source_50 IN NUMBER
108302 --Distribution Type Code
108303 , p_source_51 IN VARCHAR2
108304 --Entered Amount
108305 , p_source_52 IN NUMBER
108306 --Currency Code
108307 , p_source_53 IN VARCHAR2
108308 )
108309 IS
108310
108311 l_component_type VARCHAR2(80);
108312 l_component_code VARCHAR2(30);
108313 l_component_type_code VARCHAR2(1);
108314 l_component_appl_id INTEGER;
108315 l_amb_context_code VARCHAR2(30);
108316 l_entity_code VARCHAR2(30);
108317 l_event_class_code VARCHAR2(30);
108318 l_ae_header_id NUMBER;
108319 l_event_type_code VARCHAR2(30);
108320 l_line_definition_code VARCHAR2(30);
108321 l_line_definition_owner_code VARCHAR2(1);
108322 --
108323 -- adr variables
108324 l_segment VARCHAR2(30);
108325 l_ccid NUMBER;
108326 l_adr_transaction_coa_id NUMBER;
108327 l_adr_accounting_coa_id NUMBER;
108328 l_adr_flexfield_segment_code VARCHAR2(30);
108329 l_adr_flex_value_set_id NUMBER;
108330 l_adr_value_type_code VARCHAR2(30);
108331 l_adr_value_combination_id NUMBER;
108332 l_adr_value_segment_code VARCHAR2(30);
108333
108334 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
108335 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
108336 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
108337 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
108338
108339 -- 4262811 Variables ------------------------------------------------------------------------------------------
108340 l_entered_amt_idx NUMBER;
108341 l_accted_amt_idx NUMBER;
108342 l_acc_rev_flag VARCHAR2(1);
108343 l_accrual_line_num NUMBER;
108344 l_tmp_amt NUMBER;
108345 l_acc_rev_natural_side_code VARCHAR2(1);
108346
108347 l_num_entries NUMBER;
108348 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
108349 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
108350 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
108351 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
108352 l_recog_line_1 NUMBER;
108353 l_recog_line_2 NUMBER;
108354
108355 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
108356 l_bflow_applied_to_amt NUMBER; -- 5132302
108357 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
108358
108359 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
108360
108361 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
108362 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
108363
108364 ---------------------------------------------------------------------------------------------------------------
108365
108366
108367 --
108368 -- bulk performance
108369 --
108370 l_balance_type_code VARCHAR2(1);
108371 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
108372 l_log_module VARCHAR2(240);
108373
108374 --
108375 -- Upgrade strategy
108376 --
108377 l_actual_upg_option VARCHAR2(1);
108378 l_enc_upg_option VARCHAR2(1);
108379
108380 --
108381 BEGIN
108382 --
108383 IF g_log_enabled THEN
108384 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_316';
108385 END IF;
108386 --
108387 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
108388
108389 trace
108390 (p_msg => 'BEGIN of AcctLineType_316'
108391 ,p_level => C_LEVEL_PROCEDURE
108392 ,p_module => l_log_module);
108393
108394 END IF;
108395 --
108396 l_component_type := 'AMB_JLT';
108397 l_component_code := 'FA_RETIREMENT_DEPRN_RESERVE';
108398 l_component_type_code := 'S';
108399 l_component_appl_id := 140;
108400 l_amb_context_code := 'DEFAULT';
108401 l_entity_code := 'TRANSACTIONS';
108402 l_event_class_code := 'RETIREMENTS';
108403 l_event_type_code := 'REINSTATEMENTS';
108404 l_line_definition_owner_code := 'S';
108405 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
108406 --
108407 l_balance_type_code := 'A';
108408 l_segment := NULL;
108409 l_ccid := NULL;
108410 l_adr_transaction_coa_id := NULL;
108411 l_adr_accounting_coa_id := NULL;
108412 l_adr_flexfield_segment_code := NULL;
108413 l_adr_flex_value_set_id := NULL;
108414 l_adr_value_type_code := NULL;
108415 l_adr_value_combination_id := NULL;
108416 l_adr_value_segment_code := NULL;
108417
108418 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
108419 l_bflow_class_code := ''; -- 4219869 Business Flow
108420 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
108421 l_budgetary_control_flag := 'N';
108422
108423 l_bflow_applied_to_amt_idx := NULL; -- 5132302
108424 l_bflow_applied_to_amt := NULL; -- 5132302
108425 l_entered_amt_idx := NULL; -- 4262811
108429 l_tmp_amt := NULL; -- 4262811
108426 l_accted_amt_idx := NULL; -- 4262811
108427 l_acc_rev_flag := NULL; -- 4262811
108428 l_accrual_line_num := NULL; -- 4262811
108430 --
108431
108432 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
108433 l_balance_type_code <> 'B' THEN
108434 IF NVL(p_source_48,'
108435 ') = 'EXPENSE'
108436 THEN
108437
108438 --
108439 XLA_AE_LINES_PKG.SetNewLine;
108440
108441 p_balance_type_code := l_balance_type_code;
108442 -- set the flag so later we will know whether the gain loss line needs to be created
108443
108444 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
108445 p_actual_flag :='A';
108446 END IF;
108447
108448 --
108449 -- bulk performance
108450 --
108451 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
108452 p_header_num => 0); -- 4262811
108453 --
108454 -- set accounting line options
108455 --
108456 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
108457 p_natural_side_code => 'D'
108458 , p_gain_or_loss_flag => 'N'
108459 , p_gl_transfer_mode_code => 'S'
108460 , p_acct_entry_type_code => 'A'
108461 , p_switch_side_flag => 'Y'
108462 , p_merge_duplicate_code => 'N'
108463 );
108464 --
108465 l_acc_rev_natural_side_code := 'C'; -- 4262811
108466 --
108467 --
108468 -- set accounting line type info
108469 --
108470 xla_ae_lines_pkg.SetAcctLineType
108471 (p_component_type => l_component_type
108472 ,p_event_type_code => l_event_type_code
108473 ,p_line_definition_owner_code => l_line_definition_owner_code
108474 ,p_line_definition_code => l_line_definition_code
108475 ,p_accounting_line_code => l_component_code
108476 ,p_accounting_line_type_code => l_component_type_code
108477 ,p_accounting_line_appl_id => l_component_appl_id
108478 ,p_amb_context_code => l_amb_context_code
108479 ,p_entity_code => l_entity_code
108480 ,p_event_class_code => l_event_class_code);
108481 --
108482 -- set accounting class
108483 --
108484 xla_ae_lines_pkg.SetAcctClass(
108485 p_accounting_class_code => 'ASSET'
108486 , p_ae_header_id => l_ae_header_id
108487 );
108488
108489 --
108490 -- set rounding class
108491 --
108492 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
108493 'ASSET';
108494
108495 --
108496 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
108497 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
108498 --
108499 -- bulk performance
108500 --
108501 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
108502
108503 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
108504 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
108505
108506 -- 4955764
108507 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
108508 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
108509
108510 -- 4458381 Public Sector Enh
108511
108512 --
108513 -- set accounting attributes for the line type
108514 --
108515 l_entered_amt_idx := 4;
108516 l_accted_amt_idx := 6;
108517 l_bflow_applied_to_amt_idx := NULL; -- 5132302
108518 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
108519 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
108520 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
108521 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
108522 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
108523 l_rec_acct_attrs.array_char_value(3) := p_source_51;
108524 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
108525 l_rec_acct_attrs.array_num_value(4) := p_source_52;
108526 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
108527 l_rec_acct_attrs.array_char_value(5) := p_source_53;
108528 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
108529 l_rec_acct_attrs.array_num_value(6) := p_source_52;
108530
108531 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
108532 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
108533
108534 ---------------------------------------------------------------------------------------------------------------
108535 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
108536 ---------------------------------------------------------------------------------------------------------------
108537 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
108538
108539 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
108543 (p_source_code => 'LEDGER_CATEGORY_CODE'
108540 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
108541
108542 IF xla_accounting_cache_pkg.GetValueChar
108544 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
108545 AND l_bflow_method_code = 'PRIOR_ENTRY'
108546 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
108547 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
108548 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
108549 )
108550 THEN
108551 xla_ae_lines_pkg.BflowUpgEntry
108552 (p_business_method_code => l_bflow_method_code
108553 ,p_business_class_code => l_bflow_class_code
108554 ,p_balance_type => l_balance_type_code);
108555 ELSE
108556 NULL;
108557 -- No business flow processing for business flow method of NONE.
108558 END IF;
108559
108560 --
108561 -- call analytical criteria
108562 --
108563
108564 --
108565 -- call description
108566 --
108567
108568 xla_ae_lines_pkg.SetLineDescription(
108569 p_ae_header_id => l_ae_header_id
108570 ,p_description => Description_82 (
108571 p_application_id => p_application_id
108572 , p_ae_header_id => l_ae_header_id
108573 , p_source_1 => p_source_1
108574 )
108575 );
108576
108577
108578 --
108579 -- call ADRs
108580 -- Bug 4922099
108581 --
108582 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
108583 (NVL(l_actual_upg_option, 'N') = 'O') OR
108584 (NVL(l_enc_upg_option, 'N') = 'O')
108585 )
108586 THEN
108587 NULL;
108588 --
108589 --
108590
108591 l_ccid := AcctDerRule_175(
108592 p_application_id => p_application_id
108593 , p_ae_header_id => l_ae_header_id
108594 , p_source_5 => p_source_5
108595 , p_source_19 => p_source_19
108596 , p_source_32 => p_source_32
108597 , x_transaction_coa_id => l_adr_transaction_coa_id
108598 , x_accounting_coa_id => l_adr_accounting_coa_id
108599 , x_value_type_code => l_adr_value_type_code
108600 , p_side => 'NA'
108601 );
108602
108603 xla_ae_lines_pkg.set_ccid(
108604 p_code_combination_id => l_ccid
108605 , p_value_type_code => l_adr_value_type_code
108606 , p_transaction_coa_id => l_adr_transaction_coa_id
108607 , p_accounting_coa_id => l_adr_accounting_coa_id
108608 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
108609 , p_adr_type_code => 'S'
108610 , p_component_type => l_component_type
108611 , p_component_code => l_component_code
108612 , p_component_type_code => l_component_type_code
108613 , p_component_appl_id => l_component_appl_id
108614 , p_amb_context_code => l_amb_context_code
108615 , p_side => 'NA'
108616 );
108617
108618
108619 l_segment := AcctDerRule_150(
108620 p_application_id => p_application_id
108621 , p_ae_header_id => l_ae_header_id
108622 , p_source_5 => p_source_5
108623 , p_source_12 => p_source_12
108624 , x_transaction_coa_id => l_adr_transaction_coa_id
108625 , x_accounting_coa_id => l_adr_accounting_coa_id
108626 , x_flexfield_segment_code => l_adr_flexfield_segment_code
108627 , x_flex_value_set_id => l_adr_flex_value_set_id
108628 , x_value_type_code => l_adr_value_type_code
108629 , x_value_combination_id => l_adr_value_combination_id
108630 , x_value_segment_code => l_adr_value_segment_code
108631 , p_side => 'NA'
108632 , p_override_seg_flag => 'Y'
108633 );
108634
108635 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
108636
108637 xla_ae_lines_pkg.set_segment(
108638 p_to_segment_code => 'GL_ACCOUNT'
108639 , p_segment_value => l_segment
108640 , p_from_segment_code => l_adr_value_segment_code
108641 , p_from_combination_id => l_adr_value_combination_id
108642 , p_value_type_code => l_adr_value_type_code
108643 , p_transaction_coa_id => l_adr_transaction_coa_id
108644 , p_accounting_coa_id => l_adr_accounting_coa_id
108645 , p_flexfield_segment_code => l_adr_flexfield_segment_code
108646 , p_flex_value_set_id => l_adr_flex_value_set_id
108647 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
108648 , p_adr_type_code => 'S'
108649 , p_component_type => l_component_type
108650 , p_component_code => l_component_code
108651 , p_component_type_code => l_component_type_code
108652 , p_component_appl_id => l_component_appl_id
108653 , p_amb_context_code => l_amb_context_code
108654 , p_entity_code => 'TRANSACTIONS'
108655 , p_event_class_code => 'RETIREMENTS'
108656 , p_side => 'NA'
108657 );
108658
108659 END IF;
108660
108661 l_segment := AcctDerRule_169(
108662 p_application_id => p_application_id
108666 , x_transaction_coa_id => l_adr_transaction_coa_id
108663 , p_ae_header_id => l_ae_header_id
108664 , p_source_5 => p_source_5
108665 , p_source_31 => p_source_31
108667 , x_accounting_coa_id => l_adr_accounting_coa_id
108668 , x_flexfield_segment_code => l_adr_flexfield_segment_code
108669 , x_flex_value_set_id => l_adr_flex_value_set_id
108670 , x_value_type_code => l_adr_value_type_code
108671 , x_value_combination_id => l_adr_value_combination_id
108672 , x_value_segment_code => l_adr_value_segment_code
108673 , p_side => 'NA'
108674 , p_override_seg_flag => 'Y'
108675 );
108676
108677 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
108678
108679 xla_ae_lines_pkg.set_segment(
108680 p_to_segment_code => 'GL_BALANCING'
108681 , p_segment_value => l_segment
108682 , p_from_segment_code => l_adr_value_segment_code
108683 , p_from_combination_id => l_adr_value_combination_id
108684 , p_value_type_code => l_adr_value_type_code
108685 , p_transaction_coa_id => l_adr_transaction_coa_id
108686 , p_accounting_coa_id => l_adr_accounting_coa_id
108687 , p_flexfield_segment_code => l_adr_flexfield_segment_code
108688 , p_flex_value_set_id => l_adr_flex_value_set_id
108689 , p_adr_code => 'FA_EXPENSE_ACCT'
108690 , p_adr_type_code => 'S'
108691 , p_component_type => l_component_type
108692 , p_component_code => l_component_code
108693 , p_component_type_code => l_component_type_code
108694 , p_component_appl_id => l_component_appl_id
108695 , p_amb_context_code => l_amb_context_code
108696 , p_entity_code => 'TRANSACTIONS'
108697 , p_event_class_code => 'RETIREMENTS'
108698 , p_side => 'NA'
108699 );
108700
108701 END IF;
108702
108703 --
108704 --
108705 END IF;
108706 --
108707 -- Bug 4922099
108708 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
108709 (NVL(l_enc_upg_option, 'N') = 'O')
108710 ) AND
108711 (l_bflow_method_code = 'PRIOR_ENTRY')
108712 )
108713 THEN
108714 IF
108715 --
108716 1 = 2
108717 --
108718 THEN
108719 xla_accounting_err_pkg.build_message
108720 (p_appli_s_name => 'XLA'
108721 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
108722 ,p_token_1 => 'LINE_NUMBER'
108723 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
108724 ,p_token_2 => 'LINE_TYPE_NAME'
108725 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
108726 l_component_type
108727 ,l_component_code
108728 ,l_component_type_code
108729 ,l_component_appl_id
108730 ,l_amb_context_code
108731 ,l_entity_code
108732 ,l_event_class_code
108733 )
108734 ,p_token_3 => 'OWNER'
108735 ,p_value_3 => xla_lookups_pkg.get_meaning(
108736 p_lookup_type => 'XLA_OWNER_TYPE'
108737 ,p_lookup_code => l_component_type_code
108738 )
108739 ,p_token_4 => 'PRODUCT_NAME'
108740 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
108741 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
108742 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
108743 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
108744 ,p_ae_header_id => NULL
108745 );
108746
108747 IF (C_LEVEL_ERROR>= g_log_level) THEN
108748 trace
108749 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
108750 ,p_level => C_LEVEL_ERROR
108751 ,p_module => l_log_module);
108752 END IF;
108753 END IF;
108754 END IF;
108755 --
108756 --
108757 ------------------------------------------------------------------------------------------------
108758 -- 4219869 Business Flow
108759 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
108763
108760 -- Prior Entry. Currently, the following code is always generated.
108761 ------------------------------------------------------------------------------------------------
108762 XLA_AE_LINES_PKG.ValidateCurrentLine;
108764 ------------------------------------------------------------------------------------
108765 -- 4219869 Business Flow
108766 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
108767 ------------------------------------------------------------------------------------
108768 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
108769
108770 ----------------------------------------------------------------------------------
108771 -- 4219869 Business Flow
108772 -- Update journal entry status -- Need to generate this within IF <condition>
108773 ----------------------------------------------------------------------------------
108774 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
108775 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
108776 ,p_balance_type_code => l_balance_type_code
108777 );
108778
108779 -------------------------------------------------------------------------------------------
108780 -- 4262811 - Generate the Accrual Reversal lines
108781 -------------------------------------------------------------------------------------------
108782 BEGIN
108783 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
108784 (g_array_event(p_event_id).array_value_num('header_index'));
108785 IF l_acc_rev_flag IS NULL THEN
108786 l_acc_rev_flag := 'N';
108787 END IF;
108788 EXCEPTION
108789 WHEN OTHERS THEN
108790 l_acc_rev_flag := 'N';
108791 END;
108792 --
108793 IF (l_acc_rev_flag = 'Y') THEN
108794
108795 -- 4645092 ------------------------------------------------------------------------------
108796 -- To allow MPA report to determine if it should generate report process
108797 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
108798 ------------------------------------------------------------------------------------------
108799
108800 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
108801 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
108802 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
108803 -- call ADRs
108804 -- Bug 4922099
108805 --
108806 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
108807 (NVL(l_actual_upg_option, 'N') = 'O') OR
108808 (NVL(l_enc_upg_option, 'N') = 'O')
108809 )
108810 THEN
108811 NULL;
108812 --
108813 --
108814
108815 l_ccid := AcctDerRule_175(
108816 p_application_id => p_application_id
108817 , p_ae_header_id => l_ae_header_id
108818 , p_source_5 => p_source_5
108819 , p_source_19 => p_source_19
108820 , p_source_32 => p_source_32
108821 , x_transaction_coa_id => l_adr_transaction_coa_id
108822 , x_accounting_coa_id => l_adr_accounting_coa_id
108823 , x_value_type_code => l_adr_value_type_code
108824 , p_side => 'NA'
108825 );
108826
108827 xla_ae_lines_pkg.set_ccid(
108828 p_code_combination_id => l_ccid
108829 , p_value_type_code => l_adr_value_type_code
108830 , p_transaction_coa_id => l_adr_transaction_coa_id
108831 , p_accounting_coa_id => l_adr_accounting_coa_id
108832 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
108833 , p_adr_type_code => 'S'
108834 , p_component_type => l_component_type
108835 , p_component_code => l_component_code
108836 , p_component_type_code => l_component_type_code
108837 , p_component_appl_id => l_component_appl_id
108838 , p_amb_context_code => l_amb_context_code
108839 , p_side => 'NA'
108840 );
108841
108842
108843 l_segment := AcctDerRule_150(
108844 p_application_id => p_application_id
108845 , p_ae_header_id => l_ae_header_id
108846 , p_source_5 => p_source_5
108847 , p_source_12 => p_source_12
108848 , x_transaction_coa_id => l_adr_transaction_coa_id
108849 , x_accounting_coa_id => l_adr_accounting_coa_id
108850 , x_flexfield_segment_code => l_adr_flexfield_segment_code
108851 , x_flex_value_set_id => l_adr_flex_value_set_id
108852 , x_value_type_code => l_adr_value_type_code
108853 , x_value_combination_id => l_adr_value_combination_id
108854 , x_value_segment_code => l_adr_value_segment_code
108855 , p_side => 'NA'
108856 , p_override_seg_flag => 'Y'
108857 );
108858
108859 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
108860
108861 xla_ae_lines_pkg.set_segment(
108862 p_to_segment_code => 'GL_ACCOUNT'
108863 , p_segment_value => l_segment
108864 , p_from_segment_code => l_adr_value_segment_code
108865 , p_from_combination_id => l_adr_value_combination_id
108866 , p_value_type_code => l_adr_value_type_code
108867 , p_transaction_coa_id => l_adr_transaction_coa_id
108868 , p_accounting_coa_id => l_adr_accounting_coa_id
108869 , p_flexfield_segment_code => l_adr_flexfield_segment_code
108870 , p_flex_value_set_id => l_adr_flex_value_set_id
108874 , p_component_code => l_component_code
108871 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
108872 , p_adr_type_code => 'S'
108873 , p_component_type => l_component_type
108875 , p_component_type_code => l_component_type_code
108876 , p_component_appl_id => l_component_appl_id
108877 , p_amb_context_code => l_amb_context_code
108878 , p_entity_code => 'TRANSACTIONS'
108879 , p_event_class_code => 'RETIREMENTS'
108880 , p_side => 'NA'
108881 );
108882
108883 END IF;
108884
108885 l_segment := AcctDerRule_169(
108886 p_application_id => p_application_id
108887 , p_ae_header_id => l_ae_header_id
108888 , p_source_5 => p_source_5
108889 , p_source_31 => p_source_31
108890 , x_transaction_coa_id => l_adr_transaction_coa_id
108891 , x_accounting_coa_id => l_adr_accounting_coa_id
108892 , x_flexfield_segment_code => l_adr_flexfield_segment_code
108893 , x_flex_value_set_id => l_adr_flex_value_set_id
108894 , x_value_type_code => l_adr_value_type_code
108895 , x_value_combination_id => l_adr_value_combination_id
108896 , x_value_segment_code => l_adr_value_segment_code
108897 , p_side => 'NA'
108898 , p_override_seg_flag => 'Y'
108899 );
108900
108901 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
108902
108903 xla_ae_lines_pkg.set_segment(
108904 p_to_segment_code => 'GL_BALANCING'
108905 , p_segment_value => l_segment
108906 , p_from_segment_code => l_adr_value_segment_code
108907 , p_from_combination_id => l_adr_value_combination_id
108908 , p_value_type_code => l_adr_value_type_code
108909 , p_transaction_coa_id => l_adr_transaction_coa_id
108910 , p_accounting_coa_id => l_adr_accounting_coa_id
108911 , p_flexfield_segment_code => l_adr_flexfield_segment_code
108912 , p_flex_value_set_id => l_adr_flex_value_set_id
108913 , p_adr_code => 'FA_EXPENSE_ACCT'
108914 , p_adr_type_code => 'S'
108915 , p_component_type => l_component_type
108916 , p_component_code => l_component_code
108917 , p_component_type_code => l_component_type_code
108918 , p_component_appl_id => l_component_appl_id
108919 , p_amb_context_code => l_amb_context_code
108920 , p_entity_code => 'TRANSACTIONS'
108921 , p_event_class_code => 'RETIREMENTS'
108922 , p_side => 'NA'
108923 );
108924
108925 END IF;
108926
108927 --
108928 --
108929 END IF;
108930
108931 --
108932 -- Update the line information that should be overwritten
108933 --
108934 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
108935 p_header_num => 1);
108936 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
108937
108938 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
108939
108940 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
108941 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
108942 END IF;
108943
108944 --
108945 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
108946 --
108947 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
108948 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
108949 ELSE
108950 ---------------------------------------------------------------------------------------------------
108951 -- 4262811a Switch Sign
108952 ---------------------------------------------------------------------------------------------------
108953 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
108954 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
108955 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
108956 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
108957 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
108958 -- 5132302
108959 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
108960 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
108961
108962 END IF;
108963
108964 -- 4955764
108965 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
108966 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
108967
108968
108969 XLA_AE_LINES_PKG.ValidateCurrentLine;
108970 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
108971
108972 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
108973 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
108974 ,p_balance_type_code => l_balance_type_code);
108975
108979 -- 4262811 Multiperiod Accounting
108976 END IF;
108977
108978 -----------------------------------------------------------------------------------------
108980 -----------------------------------------------------------------------------------------
108981 -- No MPA option is assigned.
108982
108983
108984 END IF;
108985 END IF;
108986 --
108987
108988 --
108989 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
108990 trace
108991 (p_msg => 'END of AcctLineType_316'
108992 ,p_level => C_LEVEL_PROCEDURE
108993 ,p_module => l_log_module);
108994 END IF;
108995 --
108996 EXCEPTION
108997 WHEN xla_exceptions_pkg.application_exception THEN
108998 RAISE;
108999 WHEN OTHERS THEN
109000 xla_exceptions_pkg.raise_message
109001 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_316');
109002 END AcctLineType_316;
109003 --
109004
109005 ---------------------------------------
109006 --
109007 -- PRIVATE FUNCTION
109008 -- AcctLineType_317
109009 --
109010 ---------------------------------------
109011 PROCEDURE AcctLineType_317 (
109012 p_application_id IN NUMBER
109013 ,p_event_id IN NUMBER
109014 ,p_calculate_acctd_flag IN VARCHAR2
109015 ,p_calculate_g_l_flag IN VARCHAR2
109016 ,p_actual_flag IN OUT VARCHAR2
109017 ,p_balance_type_code OUT VARCHAR2
109018 ,p_gain_or_loss_ref OUT VARCHAR2
109019
109020 --Period Close Date
109021 , p_source_1 IN DATE
109022 --Generated Code Combination Identifier
109023 , p_source_5 IN NUMBER
109024 --Expense Account Code Combination Identifier
109025 , p_source_31 IN NUMBER
109026 --Adjustment Type
109027 , p_source_48 IN VARCHAR2
109028 --Transaction Header Identifier
109029 , p_source_49 IN NUMBER
109030 --Adjustment Line Identifier
109031 , p_source_50 IN NUMBER
109032 --Distribution Type Code
109033 , p_source_51 IN VARCHAR2
109034 --Entered Amount
109035 , p_source_52 IN NUMBER
109036 --Currency Code
109037 , p_source_53 IN VARCHAR2
109038 )
109039 IS
109040
109041 l_component_type VARCHAR2(80);
109042 l_component_code VARCHAR2(30);
109043 l_component_type_code VARCHAR2(1);
109044 l_component_appl_id INTEGER;
109045 l_amb_context_code VARCHAR2(30);
109046 l_entity_code VARCHAR2(30);
109047 l_event_class_code VARCHAR2(30);
109048 l_ae_header_id NUMBER;
109049 l_event_type_code VARCHAR2(30);
109050 l_line_definition_code VARCHAR2(30);
109051 l_line_definition_owner_code VARCHAR2(1);
109052 --
109053 -- adr variables
109054 l_segment VARCHAR2(30);
109055 l_ccid NUMBER;
109056 l_adr_transaction_coa_id NUMBER;
109057 l_adr_accounting_coa_id NUMBER;
109058 l_adr_flexfield_segment_code VARCHAR2(30);
109059 l_adr_flex_value_set_id NUMBER;
109060 l_adr_value_type_code VARCHAR2(30);
109061 l_adr_value_combination_id NUMBER;
109062 l_adr_value_segment_code VARCHAR2(30);
109063
109064 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
109065 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
109066 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
109067 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
109068
109069 -- 4262811 Variables ------------------------------------------------------------------------------------------
109070 l_entered_amt_idx NUMBER;
109071 l_accted_amt_idx NUMBER;
109072 l_acc_rev_flag VARCHAR2(1);
109073 l_accrual_line_num NUMBER;
109074 l_tmp_amt NUMBER;
109075 l_acc_rev_natural_side_code VARCHAR2(1);
109076
109077 l_num_entries NUMBER;
109078 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
109079 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
109080 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
109081 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
109082 l_recog_line_1 NUMBER;
109083 l_recog_line_2 NUMBER;
109084
109085 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
109086 l_bflow_applied_to_amt NUMBER; -- 5132302
109087 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
109088
109089 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
109090
109091 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
109092 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
109093
109094 ---------------------------------------------------------------------------------------------------------------
109095
109096
109097 --
109098 -- bulk performance
109099 --
109100 l_balance_type_code VARCHAR2(1);
109101 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
109102 l_log_module VARCHAR2(240);
109103
109104 --
109105 -- Upgrade strategy
109106 --
109107 l_actual_upg_option VARCHAR2(1);
109108 l_enc_upg_option VARCHAR2(1);
109109
109110 --
109111 BEGIN
109112 --
109113 IF g_log_enabled THEN
109117 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
109114 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_317';
109115 END IF;
109116 --
109118
109119 trace
109120 (p_msg => 'BEGIN of AcctLineType_317'
109121 ,p_level => C_LEVEL_PROCEDURE
109122 ,p_module => l_log_module);
109123
109124 END IF;
109125 --
109126 l_component_type := 'AMB_JLT';
109127 l_component_code := 'FA_RETIREMENT_EXP_BAL';
109128 l_component_type_code := 'S';
109129 l_component_appl_id := 140;
109130 l_amb_context_code := 'DEFAULT';
109131 l_entity_code := 'TRANSACTIONS';
109132 l_event_class_code := 'RETIREMENTS';
109133 l_event_type_code := 'REINSTATEMENTS';
109134 l_line_definition_owner_code := 'S';
109135 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
109136 --
109137 l_balance_type_code := 'A';
109138 l_segment := NULL;
109139 l_ccid := NULL;
109140 l_adr_transaction_coa_id := NULL;
109141 l_adr_accounting_coa_id := NULL;
109142 l_adr_flexfield_segment_code := NULL;
109143 l_adr_flex_value_set_id := NULL;
109144 l_adr_value_type_code := NULL;
109145 l_adr_value_combination_id := NULL;
109146 l_adr_value_segment_code := NULL;
109147
109148 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
109149 l_bflow_class_code := ''; -- 4219869 Business Flow
109150 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
109151 l_budgetary_control_flag := 'N';
109152
109153 l_bflow_applied_to_amt_idx := NULL; -- 5132302
109154 l_bflow_applied_to_amt := NULL; -- 5132302
109155 l_entered_amt_idx := NULL; -- 4262811
109156 l_accted_amt_idx := NULL; -- 4262811
109157 l_acc_rev_flag := NULL; -- 4262811
109158 l_accrual_line_num := NULL; -- 4262811
109159 l_tmp_amt := NULL; -- 4262811
109160 --
109161
109162 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
109163 l_balance_type_code <> 'B' THEN
109164 IF NVL(p_source_48,'
109165 ') = 'BONUS EXPENSE'
109166 THEN
109167
109168 --
109169 XLA_AE_LINES_PKG.SetNewLine;
109170
109171 p_balance_type_code := l_balance_type_code;
109172 -- set the flag so later we will know whether the gain loss line needs to be created
109173
109174 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
109175 p_actual_flag :='A';
109176 END IF;
109177
109178 --
109179 -- bulk performance
109180 --
109181 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
109182 p_header_num => 0); -- 4262811
109183 --
109184 -- set accounting line options
109185 --
109186 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
109187 p_natural_side_code => 'D'
109188 , p_gain_or_loss_flag => 'N'
109189 , p_gl_transfer_mode_code => 'S'
109190 , p_acct_entry_type_code => 'A'
109191 , p_switch_side_flag => 'Y'
109192 , p_merge_duplicate_code => 'N'
109193 );
109194 --
109195 l_acc_rev_natural_side_code := 'C'; -- 4262811
109196 --
109197 --
109198 -- set accounting line type info
109199 --
109200 xla_ae_lines_pkg.SetAcctLineType
109201 (p_component_type => l_component_type
109202 ,p_event_type_code => l_event_type_code
109203 ,p_line_definition_owner_code => l_line_definition_owner_code
109204 ,p_line_definition_code => l_line_definition_code
109205 ,p_accounting_line_code => l_component_code
109206 ,p_accounting_line_type_code => l_component_type_code
109207 ,p_accounting_line_appl_id => l_component_appl_id
109208 ,p_amb_context_code => l_amb_context_code
109209 ,p_entity_code => l_entity_code
109210 ,p_event_class_code => l_event_class_code);
109211 --
109212 -- set accounting class
109213 --
109214 xla_ae_lines_pkg.SetAcctClass(
109215 p_accounting_class_code => 'EXPENSE'
109216 , p_ae_header_id => l_ae_header_id
109217 );
109218
109219 --
109220 -- set rounding class
109221 --
109222 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
109223 'EXPENSE';
109224
109225 --
109226 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
109227 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
109228 --
109229 -- bulk performance
109230 --
109231 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
109232
109233 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
109234 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
109235
109236 -- 4955764
109237 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
109238 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
109239
109240 -- 4458381 Public Sector Enh
109241
109245 l_entered_amt_idx := 4;
109242 --
109243 -- set accounting attributes for the line type
109244 --
109246 l_accted_amt_idx := 6;
109247 l_bflow_applied_to_amt_idx := NULL; -- 5132302
109248 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
109249 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
109250 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
109251 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
109252 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
109253 l_rec_acct_attrs.array_char_value(3) := p_source_51;
109254 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
109255 l_rec_acct_attrs.array_num_value(4) := p_source_52;
109256 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
109257 l_rec_acct_attrs.array_char_value(5) := p_source_53;
109258 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
109259 l_rec_acct_attrs.array_num_value(6) := p_source_52;
109260
109261 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
109262 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
109263
109264 ---------------------------------------------------------------------------------------------------------------
109265 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
109266 ---------------------------------------------------------------------------------------------------------------
109267 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
109268
109269 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
109270 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
109271
109272 IF xla_accounting_cache_pkg.GetValueChar
109273 (p_source_code => 'LEDGER_CATEGORY_CODE'
109274 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
109275 AND l_bflow_method_code = 'PRIOR_ENTRY'
109276 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
109277 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
109278 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
109279 )
109280 THEN
109281 xla_ae_lines_pkg.BflowUpgEntry
109282 (p_business_method_code => l_bflow_method_code
109283 ,p_business_class_code => l_bflow_class_code
109284 ,p_balance_type => l_balance_type_code);
109285 ELSE
109286 NULL;
109287 -- No business flow processing for business flow method of NONE.
109288 END IF;
109289
109290 --
109291 -- call analytical criteria
109292 --
109293
109294 --
109295 -- call description
109296 --
109297
109298 xla_ae_lines_pkg.SetLineDescription(
109299 p_ae_header_id => l_ae_header_id
109300 ,p_description => Description_79 (
109301 p_application_id => p_application_id
109302 , p_ae_header_id => l_ae_header_id
109303 , p_source_1 => p_source_1
109304 )
109305 );
109306
109307
109308 --
109309 -- call ADRs
109310 -- Bug 4922099
109311 --
109312 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
109313 (NVL(l_actual_upg_option, 'N') = 'O') OR
109314 (NVL(l_enc_upg_option, 'N') = 'O')
109315 )
109316 THEN
109317 NULL;
109318 --
109319 --
109320
109321 l_ccid := AcctDerRule_176(
109322 p_application_id => p_application_id
109323 , p_ae_header_id => l_ae_header_id
109324 , p_source_5 => p_source_5
109325 , p_source_31 => p_source_31
109326 , x_transaction_coa_id => l_adr_transaction_coa_id
109327 , x_accounting_coa_id => l_adr_accounting_coa_id
109328 , x_value_type_code => l_adr_value_type_code
109329 , p_side => 'NA'
109330 );
109331
109332 xla_ae_lines_pkg.set_ccid(
109333 p_code_combination_id => l_ccid
109334 , p_value_type_code => l_adr_value_type_code
109335 , p_transaction_coa_id => l_adr_transaction_coa_id
109336 , p_accounting_coa_id => l_adr_accounting_coa_id
109337 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
109338 , p_adr_type_code => 'S'
109339 , p_component_type => l_component_type
109340 , p_component_code => l_component_code
109341 , p_component_type_code => l_component_type_code
109342 , p_component_appl_id => l_component_appl_id
109343 , p_amb_context_code => l_amb_context_code
109344 , p_side => 'NA'
109345 );
109346
109347
109348 --
109349 --
109350 END IF;
109351 --
109352 -- Bug 4922099
109353 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
109354 (NVL(l_enc_upg_option, 'N') = 'O')
109355 ) AND
109356 (l_bflow_method_code = 'PRIOR_ENTRY')
109357 )
109358 THEN
109359 IF
109360 --
109361 1 = 2
109362 --
109363 THEN
109364 xla_accounting_err_pkg.build_message
109365 (p_appli_s_name => 'XLA'
109366 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
109370 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
109367 ,p_token_1 => 'LINE_NUMBER'
109368 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
109369 ,p_token_2 => 'LINE_TYPE_NAME'
109371 l_component_type
109372 ,l_component_code
109373 ,l_component_type_code
109374 ,l_component_appl_id
109375 ,l_amb_context_code
109376 ,l_entity_code
109377 ,l_event_class_code
109378 )
109379 ,p_token_3 => 'OWNER'
109380 ,p_value_3 => xla_lookups_pkg.get_meaning(
109381 p_lookup_type => 'XLA_OWNER_TYPE'
109382 ,p_lookup_code => l_component_type_code
109383 )
109384 ,p_token_4 => 'PRODUCT_NAME'
109385 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
109386 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
109387 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
109388 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
109389 ,p_ae_header_id => NULL
109390 );
109391
109392 IF (C_LEVEL_ERROR>= g_log_level) THEN
109393 trace
109394 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
109395 ,p_level => C_LEVEL_ERROR
109396 ,p_module => l_log_module);
109397 END IF;
109398 END IF;
109399 END IF;
109400 --
109401 --
109402 ------------------------------------------------------------------------------------------------
109403 -- 4219869 Business Flow
109404 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
109405 -- Prior Entry. Currently, the following code is always generated.
109406 ------------------------------------------------------------------------------------------------
109407 XLA_AE_LINES_PKG.ValidateCurrentLine;
109408
109409 ------------------------------------------------------------------------------------
109410 -- 4219869 Business Flow
109411 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
109412 ------------------------------------------------------------------------------------
109413 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
109414
109415 ----------------------------------------------------------------------------------
109416 -- 4219869 Business Flow
109417 -- Update journal entry status -- Need to generate this within IF <condition>
109418 ----------------------------------------------------------------------------------
109419 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
109420 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
109421 ,p_balance_type_code => l_balance_type_code
109422 );
109423
109424 -------------------------------------------------------------------------------------------
109425 -- 4262811 - Generate the Accrual Reversal lines
109426 -------------------------------------------------------------------------------------------
109427 BEGIN
109428 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
109429 (g_array_event(p_event_id).array_value_num('header_index'));
109430 IF l_acc_rev_flag IS NULL THEN
109431 l_acc_rev_flag := 'N';
109432 END IF;
109433 EXCEPTION
109434 WHEN OTHERS THEN
109435 l_acc_rev_flag := 'N';
109436 END;
109437 --
109438 IF (l_acc_rev_flag = 'Y') THEN
109439
109440 -- 4645092 ------------------------------------------------------------------------------
109441 -- To allow MPA report to determine if it should generate report process
109442 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
109443 ------------------------------------------------------------------------------------------
109444
109445 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
109446 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
109447 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
109448 -- call ADRs
109449 -- Bug 4922099
109450 --
109451 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
109452 (NVL(l_actual_upg_option, 'N') = 'O') OR
109453 (NVL(l_enc_upg_option, 'N') = 'O')
109454 )
109455 THEN
109456 NULL;
109457 --
109458 --
109459
109460 l_ccid := AcctDerRule_176(
109461 p_application_id => p_application_id
109465 , x_transaction_coa_id => l_adr_transaction_coa_id
109462 , p_ae_header_id => l_ae_header_id
109463 , p_source_5 => p_source_5
109464 , p_source_31 => p_source_31
109466 , x_accounting_coa_id => l_adr_accounting_coa_id
109467 , x_value_type_code => l_adr_value_type_code
109468 , p_side => 'NA'
109469 );
109470
109471 xla_ae_lines_pkg.set_ccid(
109472 p_code_combination_id => l_ccid
109473 , p_value_type_code => l_adr_value_type_code
109474 , p_transaction_coa_id => l_adr_transaction_coa_id
109475 , p_accounting_coa_id => l_adr_accounting_coa_id
109476 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
109477 , p_adr_type_code => 'S'
109478 , p_component_type => l_component_type
109479 , p_component_code => l_component_code
109480 , p_component_type_code => l_component_type_code
109481 , p_component_appl_id => l_component_appl_id
109482 , p_amb_context_code => l_amb_context_code
109483 , p_side => 'NA'
109484 );
109485
109486
109487 --
109488 --
109489 END IF;
109490
109491 --
109492 -- Update the line information that should be overwritten
109493 --
109494 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
109495 p_header_num => 1);
109496 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
109497
109498 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
109499
109500 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
109501 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
109502 END IF;
109503
109504 --
109505 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
109506 --
109507 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
109508 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
109509 ELSE
109510 ---------------------------------------------------------------------------------------------------
109511 -- 4262811a Switch Sign
109512 ---------------------------------------------------------------------------------------------------
109513 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
109514 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
109515 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
109516 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
109517 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
109518 -- 5132302
109519 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
109520 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
109521
109522 END IF;
109523
109524 -- 4955764
109525 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
109526 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
109527
109528
109529 XLA_AE_LINES_PKG.ValidateCurrentLine;
109530 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
109531
109532 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
109533 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
109534 ,p_balance_type_code => l_balance_type_code);
109535
109536 END IF;
109537
109538 -----------------------------------------------------------------------------------------
109539 -- 4262811 Multiperiod Accounting
109540 -----------------------------------------------------------------------------------------
109541 -- No MPA option is assigned.
109542
109543
109544 END IF;
109545 END IF;
109546 --
109547
109548 --
109549 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
109550 trace
109551 (p_msg => 'END of AcctLineType_317'
109552 ,p_level => C_LEVEL_PROCEDURE
109553 ,p_module => l_log_module);
109554 END IF;
109555 --
109556 EXCEPTION
109557 WHEN xla_exceptions_pkg.application_exception THEN
109558 RAISE;
109559 WHEN OTHERS THEN
109560 xla_exceptions_pkg.raise_message
109561 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_317');
109562 END AcctLineType_317;
109563 --
109564
109565 ---------------------------------------
109566 --
109567 -- PRIVATE FUNCTION
109568 -- AcctLineType_318
109569 --
109570 ---------------------------------------
109571 PROCEDURE AcctLineType_318 (
109572 p_application_id IN NUMBER
109573 ,p_event_id IN NUMBER
109574 ,p_calculate_acctd_flag IN VARCHAR2
109575 ,p_calculate_g_l_flag IN VARCHAR2
109576 ,p_actual_flag IN OUT VARCHAR2
109577 ,p_balance_type_code OUT VARCHAR2
109578 ,p_gain_or_loss_ref OUT VARCHAR2
109579
109580 --Period Close Date
109581 , p_source_1 IN DATE
109585 , p_source_12 IN VARCHAR2
109582 --Generated Code Combination Identifier
109583 , p_source_5 IN NUMBER
109584 --Depreciation Reserve Account
109586 --Generated Offset Code Combination Identifier
109587 , p_source_19 IN NUMBER
109588 --Expense Account Code Combination Identifier
109589 , p_source_31 IN NUMBER
109590 --Default Code Combination Identifier
109591 , p_source_32 IN NUMBER
109592 --Adjustment Type
109593 , p_source_48 IN VARCHAR2
109594 --Transaction Header Identifier
109595 , p_source_49 IN NUMBER
109596 --Adjustment Line Identifier
109597 , p_source_50 IN NUMBER
109598 --Distribution Type Code
109599 , p_source_51 IN VARCHAR2
109600 --Entered Amount
109601 , p_source_52 IN NUMBER
109602 --Currency Code
109603 , p_source_53 IN VARCHAR2
109604 )
109605 IS
109606
109607 l_component_type VARCHAR2(80);
109608 l_component_code VARCHAR2(30);
109609 l_component_type_code VARCHAR2(1);
109610 l_component_appl_id INTEGER;
109611 l_amb_context_code VARCHAR2(30);
109612 l_entity_code VARCHAR2(30);
109613 l_event_class_code VARCHAR2(30);
109614 l_ae_header_id NUMBER;
109615 l_event_type_code VARCHAR2(30);
109616 l_line_definition_code VARCHAR2(30);
109617 l_line_definition_owner_code VARCHAR2(1);
109618 --
109619 -- adr variables
109620 l_segment VARCHAR2(30);
109621 l_ccid NUMBER;
109622 l_adr_transaction_coa_id NUMBER;
109623 l_adr_accounting_coa_id NUMBER;
109624 l_adr_flexfield_segment_code VARCHAR2(30);
109625 l_adr_flex_value_set_id NUMBER;
109626 l_adr_value_type_code VARCHAR2(30);
109627 l_adr_value_combination_id NUMBER;
109628 l_adr_value_segment_code VARCHAR2(30);
109629
109630 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
109631 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
109632 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
109633 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
109634
109635 -- 4262811 Variables ------------------------------------------------------------------------------------------
109636 l_entered_amt_idx NUMBER;
109637 l_accted_amt_idx NUMBER;
109638 l_acc_rev_flag VARCHAR2(1);
109639 l_accrual_line_num NUMBER;
109640 l_tmp_amt NUMBER;
109641 l_acc_rev_natural_side_code VARCHAR2(1);
109642
109643 l_num_entries NUMBER;
109644 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
109645 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
109646 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
109647 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
109648 l_recog_line_1 NUMBER;
109649 l_recog_line_2 NUMBER;
109650
109651 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
109652 l_bflow_applied_to_amt NUMBER; -- 5132302
109653 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
109654
109655 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
109656
109657 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
109658 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
109659
109660 ---------------------------------------------------------------------------------------------------------------
109661
109662
109663 --
109664 -- bulk performance
109665 --
109666 l_balance_type_code VARCHAR2(1);
109667 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
109668 l_log_module VARCHAR2(240);
109669
109670 --
109671 -- Upgrade strategy
109672 --
109673 l_actual_upg_option VARCHAR2(1);
109674 l_enc_upg_option VARCHAR2(1);
109675
109676 --
109677 BEGIN
109678 --
109679 IF g_log_enabled THEN
109680 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_318';
109681 END IF;
109682 --
109683 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
109684
109685 trace
109686 (p_msg => 'BEGIN of AcctLineType_318'
109687 ,p_level => C_LEVEL_PROCEDURE
109688 ,p_module => l_log_module);
109689
109690 END IF;
109691 --
109692 l_component_type := 'AMB_JLT';
109693 l_component_code := 'FA_RETIREMENT_RESERVE';
109694 l_component_type_code := 'S';
109695 l_component_appl_id := 140;
109696 l_amb_context_code := 'DEFAULT';
109697 l_entity_code := 'TRANSACTIONS';
109698 l_event_class_code := 'RETIREMENTS';
109699 l_event_type_code := 'RETIREMENTS';
109700 l_line_definition_owner_code := 'S';
109701 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
109702 --
109703 l_balance_type_code := 'A';
109704 l_segment := NULL;
109705 l_ccid := NULL;
109706 l_adr_transaction_coa_id := NULL;
109707 l_adr_accounting_coa_id := NULL;
109708 l_adr_flexfield_segment_code := NULL;
109709 l_adr_flex_value_set_id := NULL;
109710 l_adr_value_type_code := NULL;
109711 l_adr_value_combination_id := NULL;
109715 l_bflow_class_code := ''; -- 4219869 Business Flow
109712 l_adr_value_segment_code := NULL;
109713
109714 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
109716 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
109717 l_budgetary_control_flag := 'N';
109718
109719 l_bflow_applied_to_amt_idx := NULL; -- 5132302
109720 l_bflow_applied_to_amt := NULL; -- 5132302
109721 l_entered_amt_idx := NULL; -- 4262811
109722 l_accted_amt_idx := NULL; -- 4262811
109723 l_acc_rev_flag := NULL; -- 4262811
109724 l_accrual_line_num := NULL; -- 4262811
109725 l_tmp_amt := NULL; -- 4262811
109726 --
109727
109728 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
109729 l_balance_type_code <> 'B' THEN
109730 IF NVL(p_source_48,'
109731 ') = 'RESERVE'
109732 THEN
109733
109734 --
109735 XLA_AE_LINES_PKG.SetNewLine;
109736
109737 p_balance_type_code := l_balance_type_code;
109738 -- set the flag so later we will know whether the gain loss line needs to be created
109739
109740 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
109741 p_actual_flag :='A';
109742 END IF;
109743
109744 --
109745 -- bulk performance
109746 --
109747 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
109748 p_header_num => 0); -- 4262811
109749 --
109750 -- set accounting line options
109751 --
109752 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
109753 p_natural_side_code => 'D'
109754 , p_gain_or_loss_flag => 'N'
109755 , p_gl_transfer_mode_code => 'S'
109756 , p_acct_entry_type_code => 'A'
109757 , p_switch_side_flag => 'Y'
109758 , p_merge_duplicate_code => 'N'
109759 );
109760 --
109761 l_acc_rev_natural_side_code := 'C'; -- 4262811
109762 --
109763 --
109764 -- set accounting line type info
109765 --
109766 xla_ae_lines_pkg.SetAcctLineType
109767 (p_component_type => l_component_type
109768 ,p_event_type_code => l_event_type_code
109769 ,p_line_definition_owner_code => l_line_definition_owner_code
109770 ,p_line_definition_code => l_line_definition_code
109771 ,p_accounting_line_code => l_component_code
109772 ,p_accounting_line_type_code => l_component_type_code
109773 ,p_accounting_line_appl_id => l_component_appl_id
109774 ,p_amb_context_code => l_amb_context_code
109775 ,p_entity_code => l_entity_code
109776 ,p_event_class_code => l_event_class_code);
109777 --
109778 -- set accounting class
109779 --
109780 xla_ae_lines_pkg.SetAcctClass(
109781 p_accounting_class_code => 'ASSET'
109782 , p_ae_header_id => l_ae_header_id
109783 );
109784
109785 --
109786 -- set rounding class
109787 --
109788 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
109789 'ASSET';
109790
109791 --
109792 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
109793 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
109794 --
109795 -- bulk performance
109796 --
109797 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
109798
109799 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
109800 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
109801
109802 -- 4955764
109803 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
109804 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
109805
109806 -- 4458381 Public Sector Enh
109807
109808 --
109809 -- set accounting attributes for the line type
109810 --
109811 l_entered_amt_idx := 4;
109812 l_accted_amt_idx := 6;
109813 l_bflow_applied_to_amt_idx := NULL; -- 5132302
109814 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
109815 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
109816 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
109817 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
109818 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
109819 l_rec_acct_attrs.array_char_value(3) := p_source_51;
109820 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
109821 l_rec_acct_attrs.array_num_value(4) := p_source_52;
109822 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
109823 l_rec_acct_attrs.array_char_value(5) := p_source_53;
109824 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
109825 l_rec_acct_attrs.array_num_value(6) := p_source_52;
109826
109827 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
109828 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
109829
109830 ---------------------------------------------------------------------------------------------------------------
109834
109831 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
109832 ---------------------------------------------------------------------------------------------------------------
109833 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
109835 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
109836 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
109837
109838 IF xla_accounting_cache_pkg.GetValueChar
109839 (p_source_code => 'LEDGER_CATEGORY_CODE'
109840 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
109841 AND l_bflow_method_code = 'PRIOR_ENTRY'
109842 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
109843 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
109844 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
109845 )
109846 THEN
109847 xla_ae_lines_pkg.BflowUpgEntry
109848 (p_business_method_code => l_bflow_method_code
109849 ,p_business_class_code => l_bflow_class_code
109850 ,p_balance_type => l_balance_type_code);
109851 ELSE
109852 NULL;
109853 -- No business flow processing for business flow method of NONE.
109854 END IF;
109855
109856 --
109857 -- call analytical criteria
109858 --
109859
109860 --
109861 -- call description
109862 --
109863
109864 xla_ae_lines_pkg.SetLineDescription(
109865 p_ae_header_id => l_ae_header_id
109866 ,p_description => Description_82 (
109867 p_application_id => p_application_id
109868 , p_ae_header_id => l_ae_header_id
109869 , p_source_1 => p_source_1
109870 )
109871 );
109872
109873
109874 --
109875 -- call ADRs
109876 -- Bug 4922099
109877 --
109878 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
109879 (NVL(l_actual_upg_option, 'N') = 'O') OR
109880 (NVL(l_enc_upg_option, 'N') = 'O')
109881 )
109882 THEN
109883 NULL;
109884 --
109885 --
109886
109887 l_ccid := AcctDerRule_175(
109888 p_application_id => p_application_id
109889 , p_ae_header_id => l_ae_header_id
109890 , p_source_5 => p_source_5
109891 , p_source_19 => p_source_19
109892 , p_source_32 => p_source_32
109893 , x_transaction_coa_id => l_adr_transaction_coa_id
109894 , x_accounting_coa_id => l_adr_accounting_coa_id
109895 , x_value_type_code => l_adr_value_type_code
109896 , p_side => 'NA'
109897 );
109898
109899 xla_ae_lines_pkg.set_ccid(
109900 p_code_combination_id => l_ccid
109901 , p_value_type_code => l_adr_value_type_code
109902 , p_transaction_coa_id => l_adr_transaction_coa_id
109903 , p_accounting_coa_id => l_adr_accounting_coa_id
109904 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
109905 , p_adr_type_code => 'S'
109906 , p_component_type => l_component_type
109907 , p_component_code => l_component_code
109908 , p_component_type_code => l_component_type_code
109909 , p_component_appl_id => l_component_appl_id
109910 , p_amb_context_code => l_amb_context_code
109911 , p_side => 'NA'
109912 );
109913
109914
109915 l_segment := AcctDerRule_150(
109916 p_application_id => p_application_id
109917 , p_ae_header_id => l_ae_header_id
109918 , p_source_5 => p_source_5
109919 , p_source_12 => p_source_12
109920 , x_transaction_coa_id => l_adr_transaction_coa_id
109921 , x_accounting_coa_id => l_adr_accounting_coa_id
109922 , x_flexfield_segment_code => l_adr_flexfield_segment_code
109923 , x_flex_value_set_id => l_adr_flex_value_set_id
109924 , x_value_type_code => l_adr_value_type_code
109925 , x_value_combination_id => l_adr_value_combination_id
109926 , x_value_segment_code => l_adr_value_segment_code
109927 , p_side => 'NA'
109928 , p_override_seg_flag => 'Y'
109929 );
109930
109931 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
109932
109933 xla_ae_lines_pkg.set_segment(
109934 p_to_segment_code => 'GL_ACCOUNT'
109935 , p_segment_value => l_segment
109936 , p_from_segment_code => l_adr_value_segment_code
109937 , p_from_combination_id => l_adr_value_combination_id
109938 , p_value_type_code => l_adr_value_type_code
109939 , p_transaction_coa_id => l_adr_transaction_coa_id
109940 , p_accounting_coa_id => l_adr_accounting_coa_id
109941 , p_flexfield_segment_code => l_adr_flexfield_segment_code
109942 , p_flex_value_set_id => l_adr_flex_value_set_id
109943 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
109944 , p_adr_type_code => 'S'
109945 , p_component_type => l_component_type
109946 , p_component_code => l_component_code
109947 , p_component_type_code => l_component_type_code
109948 , p_component_appl_id => l_component_appl_id
109952 , p_side => 'NA'
109949 , p_amb_context_code => l_amb_context_code
109950 , p_entity_code => 'TRANSACTIONS'
109951 , p_event_class_code => 'RETIREMENTS'
109953 );
109954
109955 END IF;
109956
109957 l_segment := AcctDerRule_169(
109958 p_application_id => p_application_id
109959 , p_ae_header_id => l_ae_header_id
109960 , p_source_5 => p_source_5
109961 , p_source_31 => p_source_31
109962 , x_transaction_coa_id => l_adr_transaction_coa_id
109963 , x_accounting_coa_id => l_adr_accounting_coa_id
109964 , x_flexfield_segment_code => l_adr_flexfield_segment_code
109965 , x_flex_value_set_id => l_adr_flex_value_set_id
109966 , x_value_type_code => l_adr_value_type_code
109967 , x_value_combination_id => l_adr_value_combination_id
109968 , x_value_segment_code => l_adr_value_segment_code
109969 , p_side => 'NA'
109970 , p_override_seg_flag => 'Y'
109971 );
109972
109973 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
109974
109975 xla_ae_lines_pkg.set_segment(
109976 p_to_segment_code => 'GL_BALANCING'
109977 , p_segment_value => l_segment
109978 , p_from_segment_code => l_adr_value_segment_code
109979 , p_from_combination_id => l_adr_value_combination_id
109980 , p_value_type_code => l_adr_value_type_code
109981 , p_transaction_coa_id => l_adr_transaction_coa_id
109982 , p_accounting_coa_id => l_adr_accounting_coa_id
109983 , p_flexfield_segment_code => l_adr_flexfield_segment_code
109984 , p_flex_value_set_id => l_adr_flex_value_set_id
109985 , p_adr_code => 'FA_EXPENSE_ACCT'
109986 , p_adr_type_code => 'S'
109987 , p_component_type => l_component_type
109988 , p_component_code => l_component_code
109989 , p_component_type_code => l_component_type_code
109990 , p_component_appl_id => l_component_appl_id
109991 , p_amb_context_code => l_amb_context_code
109992 , p_entity_code => 'TRANSACTIONS'
109993 , p_event_class_code => 'RETIREMENTS'
109994 , p_side => 'NA'
109995 );
109996
109997 END IF;
109998
109999 --
110000 --
110001 END IF;
110002 --
110003 -- Bug 4922099
110004 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
110005 (NVL(l_enc_upg_option, 'N') = 'O')
110006 ) AND
110007 (l_bflow_method_code = 'PRIOR_ENTRY')
110008 )
110009 THEN
110010 IF
110011 --
110012 1 = 2
110013 --
110014 THEN
110015 xla_accounting_err_pkg.build_message
110016 (p_appli_s_name => 'XLA'
110017 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
110018 ,p_token_1 => 'LINE_NUMBER'
110019 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
110020 ,p_token_2 => 'LINE_TYPE_NAME'
110021 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
110022 l_component_type
110023 ,l_component_code
110024 ,l_component_type_code
110025 ,l_component_appl_id
110026 ,l_amb_context_code
110027 ,l_entity_code
110028 ,l_event_class_code
110029 )
110030 ,p_token_3 => 'OWNER'
110031 ,p_value_3 => xla_lookups_pkg.get_meaning(
110032 p_lookup_type => 'XLA_OWNER_TYPE'
110033 ,p_lookup_code => l_component_type_code
110034 )
110035 ,p_token_4 => 'PRODUCT_NAME'
110036 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
110037 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
110038 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
110039 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
110040 ,p_ae_header_id => NULL
110041 );
110042
110043 IF (C_LEVEL_ERROR>= g_log_level) THEN
110044 trace
110045 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
110046 ,p_level => C_LEVEL_ERROR
110047 ,p_module => l_log_module);
110048 END IF;
110049 END IF;
110050 END IF;
110054 -- 4219869 Business Flow
110051 --
110052 --
110053 ------------------------------------------------------------------------------------------------
110055 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
110056 -- Prior Entry. Currently, the following code is always generated.
110057 ------------------------------------------------------------------------------------------------
110058 XLA_AE_LINES_PKG.ValidateCurrentLine;
110059
110060 ------------------------------------------------------------------------------------
110061 -- 4219869 Business Flow
110062 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
110063 ------------------------------------------------------------------------------------
110064 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
110065
110066 ----------------------------------------------------------------------------------
110067 -- 4219869 Business Flow
110068 -- Update journal entry status -- Need to generate this within IF <condition>
110069 ----------------------------------------------------------------------------------
110070 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
110071 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
110072 ,p_balance_type_code => l_balance_type_code
110073 );
110074
110075 -------------------------------------------------------------------------------------------
110076 -- 4262811 - Generate the Accrual Reversal lines
110077 -------------------------------------------------------------------------------------------
110078 BEGIN
110079 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
110080 (g_array_event(p_event_id).array_value_num('header_index'));
110081 IF l_acc_rev_flag IS NULL THEN
110082 l_acc_rev_flag := 'N';
110083 END IF;
110084 EXCEPTION
110085 WHEN OTHERS THEN
110086 l_acc_rev_flag := 'N';
110087 END;
110088 --
110089 IF (l_acc_rev_flag = 'Y') THEN
110090
110091 -- 4645092 ------------------------------------------------------------------------------
110092 -- To allow MPA report to determine if it should generate report process
110093 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
110094 ------------------------------------------------------------------------------------------
110095
110096 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
110097 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
110098 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
110099 -- call ADRs
110100 -- Bug 4922099
110101 --
110102 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
110103 (NVL(l_actual_upg_option, 'N') = 'O') OR
110104 (NVL(l_enc_upg_option, 'N') = 'O')
110105 )
110106 THEN
110107 NULL;
110108 --
110109 --
110110
110111 l_ccid := AcctDerRule_175(
110112 p_application_id => p_application_id
110113 , p_ae_header_id => l_ae_header_id
110114 , p_source_5 => p_source_5
110115 , p_source_19 => p_source_19
110116 , p_source_32 => p_source_32
110117 , x_transaction_coa_id => l_adr_transaction_coa_id
110118 , x_accounting_coa_id => l_adr_accounting_coa_id
110119 , x_value_type_code => l_adr_value_type_code
110120 , p_side => 'NA'
110121 );
110122
110123 xla_ae_lines_pkg.set_ccid(
110124 p_code_combination_id => l_ccid
110125 , p_value_type_code => l_adr_value_type_code
110126 , p_transaction_coa_id => l_adr_transaction_coa_id
110127 , p_accounting_coa_id => l_adr_accounting_coa_id
110128 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
110129 , p_adr_type_code => 'S'
110130 , p_component_type => l_component_type
110131 , p_component_code => l_component_code
110132 , p_component_type_code => l_component_type_code
110133 , p_component_appl_id => l_component_appl_id
110134 , p_amb_context_code => l_amb_context_code
110135 , p_side => 'NA'
110136 );
110137
110138
110139 l_segment := AcctDerRule_150(
110140 p_application_id => p_application_id
110141 , p_ae_header_id => l_ae_header_id
110142 , p_source_5 => p_source_5
110143 , p_source_12 => p_source_12
110144 , x_transaction_coa_id => l_adr_transaction_coa_id
110145 , x_accounting_coa_id => l_adr_accounting_coa_id
110146 , x_flexfield_segment_code => l_adr_flexfield_segment_code
110147 , x_flex_value_set_id => l_adr_flex_value_set_id
110148 , x_value_type_code => l_adr_value_type_code
110149 , x_value_combination_id => l_adr_value_combination_id
110150 , x_value_segment_code => l_adr_value_segment_code
110151 , p_side => 'NA'
110152 , p_override_seg_flag => 'Y'
110153 );
110154
110155 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
110156
110157 xla_ae_lines_pkg.set_segment(
110158 p_to_segment_code => 'GL_ACCOUNT'
110159 , p_segment_value => l_segment
110160 , p_from_segment_code => l_adr_value_segment_code
110161 , p_from_combination_id => l_adr_value_combination_id
110165 , p_flexfield_segment_code => l_adr_flexfield_segment_code
110162 , p_value_type_code => l_adr_value_type_code
110163 , p_transaction_coa_id => l_adr_transaction_coa_id
110164 , p_accounting_coa_id => l_adr_accounting_coa_id
110166 , p_flex_value_set_id => l_adr_flex_value_set_id
110167 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
110168 , p_adr_type_code => 'S'
110169 , p_component_type => l_component_type
110170 , p_component_code => l_component_code
110171 , p_component_type_code => l_component_type_code
110172 , p_component_appl_id => l_component_appl_id
110173 , p_amb_context_code => l_amb_context_code
110174 , p_entity_code => 'TRANSACTIONS'
110175 , p_event_class_code => 'RETIREMENTS'
110176 , p_side => 'NA'
110177 );
110178
110179 END IF;
110180
110181 l_segment := AcctDerRule_169(
110182 p_application_id => p_application_id
110183 , p_ae_header_id => l_ae_header_id
110184 , p_source_5 => p_source_5
110185 , p_source_31 => p_source_31
110186 , x_transaction_coa_id => l_adr_transaction_coa_id
110187 , x_accounting_coa_id => l_adr_accounting_coa_id
110188 , x_flexfield_segment_code => l_adr_flexfield_segment_code
110189 , x_flex_value_set_id => l_adr_flex_value_set_id
110190 , x_value_type_code => l_adr_value_type_code
110191 , x_value_combination_id => l_adr_value_combination_id
110192 , x_value_segment_code => l_adr_value_segment_code
110193 , p_side => 'NA'
110194 , p_override_seg_flag => 'Y'
110195 );
110196
110197 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
110198
110199 xla_ae_lines_pkg.set_segment(
110200 p_to_segment_code => 'GL_BALANCING'
110201 , p_segment_value => l_segment
110202 , p_from_segment_code => l_adr_value_segment_code
110203 , p_from_combination_id => l_adr_value_combination_id
110204 , p_value_type_code => l_adr_value_type_code
110205 , p_transaction_coa_id => l_adr_transaction_coa_id
110206 , p_accounting_coa_id => l_adr_accounting_coa_id
110207 , p_flexfield_segment_code => l_adr_flexfield_segment_code
110208 , p_flex_value_set_id => l_adr_flex_value_set_id
110209 , p_adr_code => 'FA_EXPENSE_ACCT'
110210 , p_adr_type_code => 'S'
110211 , p_component_type => l_component_type
110212 , p_component_code => l_component_code
110213 , p_component_type_code => l_component_type_code
110214 , p_component_appl_id => l_component_appl_id
110215 , p_amb_context_code => l_amb_context_code
110216 , p_entity_code => 'TRANSACTIONS'
110217 , p_event_class_code => 'RETIREMENTS'
110218 , p_side => 'NA'
110219 );
110220
110221 END IF;
110222
110223 --
110224 --
110225 END IF;
110226
110227 --
110228 -- Update the line information that should be overwritten
110229 --
110230 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
110231 p_header_num => 1);
110232 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
110233
110234 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
110235
110236 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
110237 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
110238 END IF;
110239
110240 --
110241 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
110242 --
110243 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
110244 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
110245 ELSE
110246 ---------------------------------------------------------------------------------------------------
110247 -- 4262811a Switch Sign
110248 ---------------------------------------------------------------------------------------------------
110249 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
110250 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
110251 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
110252 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
110253 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
110254 -- 5132302
110255 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
110256 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
110257
110258 END IF;
110259
110260 -- 4955764
110261 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
110262 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
110263
110264
110268 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
110265 XLA_AE_LINES_PKG.ValidateCurrentLine;
110266 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
110267
110269 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
110270 ,p_balance_type_code => l_balance_type_code);
110271
110272 END IF;
110273
110274 -----------------------------------------------------------------------------------------
110275 -- 4262811 Multiperiod Accounting
110276 -----------------------------------------------------------------------------------------
110277 -- No MPA option is assigned.
110278
110279
110280 END IF;
110281 END IF;
110282 --
110283
110284 --
110285 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
110286 trace
110287 (p_msg => 'END of AcctLineType_318'
110288 ,p_level => C_LEVEL_PROCEDURE
110289 ,p_module => l_log_module);
110290 END IF;
110291 --
110292 EXCEPTION
110293 WHEN xla_exceptions_pkg.application_exception THEN
110294 RAISE;
110295 WHEN OTHERS THEN
110296 xla_exceptions_pkg.raise_message
110297 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_318');
110298 END AcctLineType_318;
110299 --
110300
110301 ---------------------------------------
110302 --
110303 -- PRIVATE FUNCTION
110304 -- AcctLineType_319
110305 --
110306 ---------------------------------------
110307 PROCEDURE AcctLineType_319 (
110308 p_application_id IN NUMBER
110309 ,p_event_id IN NUMBER
110310 ,p_calculate_acctd_flag IN VARCHAR2
110311 ,p_calculate_g_l_flag IN VARCHAR2
110312 ,p_actual_flag IN OUT VARCHAR2
110313 ,p_balance_type_code OUT VARCHAR2
110314 ,p_gain_or_loss_ref OUT VARCHAR2
110315
110316 --Period Close Date
110317 , p_source_1 IN DATE
110318 --Generated Code Combination Identifier
110319 , p_source_5 IN NUMBER
110320 --Depreciation Reserve Account
110321 , p_source_12 IN VARCHAR2
110322 --Generated Offset Code Combination Identifier
110323 , p_source_19 IN NUMBER
110324 --Expense Account Code Combination Identifier
110325 , p_source_31 IN NUMBER
110326 --Default Code Combination Identifier
110327 , p_source_32 IN NUMBER
110328 --Adjustment Type
110329 , p_source_48 IN VARCHAR2
110330 --Transaction Header Identifier
110331 , p_source_49 IN NUMBER
110332 --Adjustment Line Identifier
110333 , p_source_50 IN NUMBER
110334 --Distribution Type Code
110335 , p_source_51 IN VARCHAR2
110336 --Entered Amount
110337 , p_source_52 IN NUMBER
110338 --Currency Code
110339 , p_source_53 IN VARCHAR2
110340 )
110341 IS
110342
110343 l_component_type VARCHAR2(80);
110344 l_component_code VARCHAR2(30);
110345 l_component_type_code VARCHAR2(1);
110346 l_component_appl_id INTEGER;
110347 l_amb_context_code VARCHAR2(30);
110348 l_entity_code VARCHAR2(30);
110349 l_event_class_code VARCHAR2(30);
110350 l_ae_header_id NUMBER;
110351 l_event_type_code VARCHAR2(30);
110352 l_line_definition_code VARCHAR2(30);
110353 l_line_definition_owner_code VARCHAR2(1);
110354 --
110355 -- adr variables
110356 l_segment VARCHAR2(30);
110357 l_ccid NUMBER;
110358 l_adr_transaction_coa_id NUMBER;
110359 l_adr_accounting_coa_id NUMBER;
110360 l_adr_flexfield_segment_code VARCHAR2(30);
110361 l_adr_flex_value_set_id NUMBER;
110362 l_adr_value_type_code VARCHAR2(30);
110363 l_adr_value_combination_id NUMBER;
110364 l_adr_value_segment_code VARCHAR2(30);
110365
110366 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
110367 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
110368 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
110369 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
110370
110371 -- 4262811 Variables ------------------------------------------------------------------------------------------
110372 l_entered_amt_idx NUMBER;
110373 l_accted_amt_idx NUMBER;
110374 l_acc_rev_flag VARCHAR2(1);
110375 l_accrual_line_num NUMBER;
110376 l_tmp_amt NUMBER;
110377 l_acc_rev_natural_side_code VARCHAR2(1);
110378
110379 l_num_entries NUMBER;
110380 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
110381 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
110382 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
110383 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
110384 l_recog_line_1 NUMBER;
110385 l_recog_line_2 NUMBER;
110386
110387 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
110388 l_bflow_applied_to_amt NUMBER; -- 5132302
110389 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
110390
110391 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
110392
110393 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
110397
110394 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
110395
110396 ---------------------------------------------------------------------------------------------------------------
110398
110399 --
110400 -- bulk performance
110401 --
110402 l_balance_type_code VARCHAR2(1);
110403 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
110404 l_log_module VARCHAR2(240);
110405
110406 --
110407 -- Upgrade strategy
110408 --
110409 l_actual_upg_option VARCHAR2(1);
110410 l_enc_upg_option VARCHAR2(1);
110411
110412 --
110413 BEGIN
110414 --
110415 IF g_log_enabled THEN
110416 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_319';
110417 END IF;
110418 --
110419 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
110420
110421 trace
110422 (p_msg => 'BEGIN of AcctLineType_319'
110423 ,p_level => C_LEVEL_PROCEDURE
110424 ,p_module => l_log_module);
110425
110426 END IF;
110427 --
110428 l_component_type := 'AMB_JLT';
110429 l_component_code := 'FA_RETIREMENT_RESERVE';
110430 l_component_type_code := 'S';
110431 l_component_appl_id := 140;
110432 l_amb_context_code := 'DEFAULT';
110433 l_entity_code := 'TRANSACTIONS';
110434 l_event_class_code := 'RETIREMENTS';
110435 l_event_type_code := 'REINSTATEMENTS';
110436 l_line_definition_owner_code := 'S';
110437 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
110438 --
110439 l_balance_type_code := 'A';
110440 l_segment := NULL;
110441 l_ccid := NULL;
110442 l_adr_transaction_coa_id := NULL;
110443 l_adr_accounting_coa_id := NULL;
110444 l_adr_flexfield_segment_code := NULL;
110445 l_adr_flex_value_set_id := NULL;
110446 l_adr_value_type_code := NULL;
110447 l_adr_value_combination_id := NULL;
110448 l_adr_value_segment_code := NULL;
110449
110450 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
110451 l_bflow_class_code := ''; -- 4219869 Business Flow
110452 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
110453 l_budgetary_control_flag := 'N';
110454
110455 l_bflow_applied_to_amt_idx := NULL; -- 5132302
110456 l_bflow_applied_to_amt := NULL; -- 5132302
110457 l_entered_amt_idx := NULL; -- 4262811
110458 l_accted_amt_idx := NULL; -- 4262811
110459 l_acc_rev_flag := NULL; -- 4262811
110460 l_accrual_line_num := NULL; -- 4262811
110461 l_tmp_amt := NULL; -- 4262811
110462 --
110463
110464 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
110465 l_balance_type_code <> 'B' THEN
110466 IF NVL(p_source_48,'
110467 ') = 'RESERVE'
110468 THEN
110469
110470 --
110471 XLA_AE_LINES_PKG.SetNewLine;
110472
110473 p_balance_type_code := l_balance_type_code;
110474 -- set the flag so later we will know whether the gain loss line needs to be created
110475
110476 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
110477 p_actual_flag :='A';
110478 END IF;
110479
110480 --
110481 -- bulk performance
110482 --
110483 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
110484 p_header_num => 0); -- 4262811
110485 --
110486 -- set accounting line options
110487 --
110488 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
110489 p_natural_side_code => 'D'
110490 , p_gain_or_loss_flag => 'N'
110491 , p_gl_transfer_mode_code => 'S'
110492 , p_acct_entry_type_code => 'A'
110493 , p_switch_side_flag => 'Y'
110494 , p_merge_duplicate_code => 'N'
110495 );
110496 --
110497 l_acc_rev_natural_side_code := 'C'; -- 4262811
110498 --
110499 --
110500 -- set accounting line type info
110501 --
110502 xla_ae_lines_pkg.SetAcctLineType
110503 (p_component_type => l_component_type
110504 ,p_event_type_code => l_event_type_code
110505 ,p_line_definition_owner_code => l_line_definition_owner_code
110506 ,p_line_definition_code => l_line_definition_code
110507 ,p_accounting_line_code => l_component_code
110508 ,p_accounting_line_type_code => l_component_type_code
110509 ,p_accounting_line_appl_id => l_component_appl_id
110510 ,p_amb_context_code => l_amb_context_code
110511 ,p_entity_code => l_entity_code
110512 ,p_event_class_code => l_event_class_code);
110513 --
110514 -- set accounting class
110515 --
110516 xla_ae_lines_pkg.SetAcctClass(
110517 p_accounting_class_code => 'ASSET'
110518 , p_ae_header_id => l_ae_header_id
110519 );
110520
110521 --
110522 -- set rounding class
110523 --
110524 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
110525 'ASSET';
110526
110527 --
110528 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
110532 --
110529 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
110530 --
110531 -- bulk performance
110533 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
110534
110535 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
110536 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
110537
110538 -- 4955764
110539 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
110540 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
110541
110542 -- 4458381 Public Sector Enh
110543
110544 --
110545 -- set accounting attributes for the line type
110546 --
110547 l_entered_amt_idx := 4;
110548 l_accted_amt_idx := 6;
110549 l_bflow_applied_to_amt_idx := NULL; -- 5132302
110550 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
110551 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
110552 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
110553 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
110554 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
110555 l_rec_acct_attrs.array_char_value(3) := p_source_51;
110556 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
110557 l_rec_acct_attrs.array_num_value(4) := p_source_52;
110558 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
110559 l_rec_acct_attrs.array_char_value(5) := p_source_53;
110560 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
110561 l_rec_acct_attrs.array_num_value(6) := p_source_52;
110562
110563 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
110564 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
110565
110566 ---------------------------------------------------------------------------------------------------------------
110567 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
110568 ---------------------------------------------------------------------------------------------------------------
110569 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
110570
110571 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
110572 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
110573
110574 IF xla_accounting_cache_pkg.GetValueChar
110575 (p_source_code => 'LEDGER_CATEGORY_CODE'
110576 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
110577 AND l_bflow_method_code = 'PRIOR_ENTRY'
110578 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
110579 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
110580 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
110581 )
110582 THEN
110583 xla_ae_lines_pkg.BflowUpgEntry
110584 (p_business_method_code => l_bflow_method_code
110585 ,p_business_class_code => l_bflow_class_code
110586 ,p_balance_type => l_balance_type_code);
110587 ELSE
110588 NULL;
110589 -- No business flow processing for business flow method of NONE.
110590 END IF;
110591
110592 --
110593 -- call analytical criteria
110594 --
110595
110596 --
110597 -- call description
110598 --
110599
110600 xla_ae_lines_pkg.SetLineDescription(
110601 p_ae_header_id => l_ae_header_id
110602 ,p_description => Description_82 (
110603 p_application_id => p_application_id
110604 , p_ae_header_id => l_ae_header_id
110605 , p_source_1 => p_source_1
110606 )
110607 );
110608
110609
110610 --
110611 -- call ADRs
110612 -- Bug 4922099
110613 --
110614 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
110615 (NVL(l_actual_upg_option, 'N') = 'O') OR
110616 (NVL(l_enc_upg_option, 'N') = 'O')
110617 )
110618 THEN
110619 NULL;
110620 --
110621 --
110622
110623 l_ccid := AcctDerRule_175(
110624 p_application_id => p_application_id
110625 , p_ae_header_id => l_ae_header_id
110626 , p_source_5 => p_source_5
110627 , p_source_19 => p_source_19
110628 , p_source_32 => p_source_32
110629 , x_transaction_coa_id => l_adr_transaction_coa_id
110630 , x_accounting_coa_id => l_adr_accounting_coa_id
110631 , x_value_type_code => l_adr_value_type_code
110632 , p_side => 'NA'
110633 );
110634
110635 xla_ae_lines_pkg.set_ccid(
110636 p_code_combination_id => l_ccid
110637 , p_value_type_code => l_adr_value_type_code
110638 , p_transaction_coa_id => l_adr_transaction_coa_id
110639 , p_accounting_coa_id => l_adr_accounting_coa_id
110640 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
110641 , p_adr_type_code => 'S'
110642 , p_component_type => l_component_type
110643 , p_component_code => l_component_code
110644 , p_component_type_code => l_component_type_code
110645 , p_component_appl_id => l_component_appl_id
110646 , p_amb_context_code => l_amb_context_code
110647 , p_side => 'NA'
110651 l_segment := AcctDerRule_150(
110648 );
110649
110650
110652 p_application_id => p_application_id
110653 , p_ae_header_id => l_ae_header_id
110654 , p_source_5 => p_source_5
110655 , p_source_12 => p_source_12
110656 , x_transaction_coa_id => l_adr_transaction_coa_id
110657 , x_accounting_coa_id => l_adr_accounting_coa_id
110658 , x_flexfield_segment_code => l_adr_flexfield_segment_code
110659 , x_flex_value_set_id => l_adr_flex_value_set_id
110660 , x_value_type_code => l_adr_value_type_code
110661 , x_value_combination_id => l_adr_value_combination_id
110662 , x_value_segment_code => l_adr_value_segment_code
110663 , p_side => 'NA'
110664 , p_override_seg_flag => 'Y'
110665 );
110666
110667 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
110668
110669 xla_ae_lines_pkg.set_segment(
110670 p_to_segment_code => 'GL_ACCOUNT'
110671 , p_segment_value => l_segment
110672 , p_from_segment_code => l_adr_value_segment_code
110673 , p_from_combination_id => l_adr_value_combination_id
110674 , p_value_type_code => l_adr_value_type_code
110675 , p_transaction_coa_id => l_adr_transaction_coa_id
110676 , p_accounting_coa_id => l_adr_accounting_coa_id
110677 , p_flexfield_segment_code => l_adr_flexfield_segment_code
110678 , p_flex_value_set_id => l_adr_flex_value_set_id
110679 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
110680 , p_adr_type_code => 'S'
110681 , p_component_type => l_component_type
110682 , p_component_code => l_component_code
110683 , p_component_type_code => l_component_type_code
110684 , p_component_appl_id => l_component_appl_id
110685 , p_amb_context_code => l_amb_context_code
110686 , p_entity_code => 'TRANSACTIONS'
110687 , p_event_class_code => 'RETIREMENTS'
110688 , p_side => 'NA'
110689 );
110690
110691 END IF;
110692
110693 l_segment := AcctDerRule_169(
110694 p_application_id => p_application_id
110695 , p_ae_header_id => l_ae_header_id
110696 , p_source_5 => p_source_5
110697 , p_source_31 => p_source_31
110698 , x_transaction_coa_id => l_adr_transaction_coa_id
110699 , x_accounting_coa_id => l_adr_accounting_coa_id
110700 , x_flexfield_segment_code => l_adr_flexfield_segment_code
110701 , x_flex_value_set_id => l_adr_flex_value_set_id
110702 , x_value_type_code => l_adr_value_type_code
110703 , x_value_combination_id => l_adr_value_combination_id
110704 , x_value_segment_code => l_adr_value_segment_code
110705 , p_side => 'NA'
110706 , p_override_seg_flag => 'Y'
110707 );
110708
110709 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
110710
110711 xla_ae_lines_pkg.set_segment(
110712 p_to_segment_code => 'GL_BALANCING'
110713 , p_segment_value => l_segment
110714 , p_from_segment_code => l_adr_value_segment_code
110715 , p_from_combination_id => l_adr_value_combination_id
110716 , p_value_type_code => l_adr_value_type_code
110717 , p_transaction_coa_id => l_adr_transaction_coa_id
110718 , p_accounting_coa_id => l_adr_accounting_coa_id
110719 , p_flexfield_segment_code => l_adr_flexfield_segment_code
110720 , p_flex_value_set_id => l_adr_flex_value_set_id
110721 , p_adr_code => 'FA_EXPENSE_ACCT'
110722 , p_adr_type_code => 'S'
110723 , p_component_type => l_component_type
110724 , p_component_code => l_component_code
110725 , p_component_type_code => l_component_type_code
110726 , p_component_appl_id => l_component_appl_id
110727 , p_amb_context_code => l_amb_context_code
110728 , p_entity_code => 'TRANSACTIONS'
110729 , p_event_class_code => 'RETIREMENTS'
110730 , p_side => 'NA'
110731 );
110732
110733 END IF;
110734
110735 --
110736 --
110737 END IF;
110738 --
110739 -- Bug 4922099
110740 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
110741 (NVL(l_enc_upg_option, 'N') = 'O')
110742 ) AND
110743 (l_bflow_method_code = 'PRIOR_ENTRY')
110744 )
110745 THEN
110746 IF
110747 --
110748 1 = 2
110749 --
110750 THEN
110751 xla_accounting_err_pkg.build_message
110752 (p_appli_s_name => 'XLA'
110753 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
110754 ,p_token_1 => 'LINE_NUMBER'
110755 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
110756 ,p_token_2 => 'LINE_TYPE_NAME'
110757 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
110758 l_component_type
110762 ,l_amb_context_code
110759 ,l_component_code
110760 ,l_component_type_code
110761 ,l_component_appl_id
110763 ,l_entity_code
110764 ,l_event_class_code
110765 )
110766 ,p_token_3 => 'OWNER'
110767 ,p_value_3 => xla_lookups_pkg.get_meaning(
110768 p_lookup_type => 'XLA_OWNER_TYPE'
110769 ,p_lookup_code => l_component_type_code
110770 )
110771 ,p_token_4 => 'PRODUCT_NAME'
110772 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
110773 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
110774 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
110775 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
110776 ,p_ae_header_id => NULL
110777 );
110778
110779 IF (C_LEVEL_ERROR>= g_log_level) THEN
110780 trace
110781 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
110782 ,p_level => C_LEVEL_ERROR
110783 ,p_module => l_log_module);
110784 END IF;
110785 END IF;
110786 END IF;
110787 --
110788 --
110789 ------------------------------------------------------------------------------------------------
110790 -- 4219869 Business Flow
110791 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
110792 -- Prior Entry. Currently, the following code is always generated.
110793 ------------------------------------------------------------------------------------------------
110794 XLA_AE_LINES_PKG.ValidateCurrentLine;
110795
110796 ------------------------------------------------------------------------------------
110797 -- 4219869 Business Flow
110798 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
110799 ------------------------------------------------------------------------------------
110800 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
110801
110802 ----------------------------------------------------------------------------------
110803 -- 4219869 Business Flow
110804 -- Update journal entry status -- Need to generate this within IF <condition>
110805 ----------------------------------------------------------------------------------
110806 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
110807 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
110808 ,p_balance_type_code => l_balance_type_code
110809 );
110810
110811 -------------------------------------------------------------------------------------------
110812 -- 4262811 - Generate the Accrual Reversal lines
110813 -------------------------------------------------------------------------------------------
110814 BEGIN
110815 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
110816 (g_array_event(p_event_id).array_value_num('header_index'));
110817 IF l_acc_rev_flag IS NULL THEN
110818 l_acc_rev_flag := 'N';
110819 END IF;
110820 EXCEPTION
110821 WHEN OTHERS THEN
110822 l_acc_rev_flag := 'N';
110823 END;
110824 --
110825 IF (l_acc_rev_flag = 'Y') THEN
110826
110827 -- 4645092 ------------------------------------------------------------------------------
110828 -- To allow MPA report to determine if it should generate report process
110829 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
110830 ------------------------------------------------------------------------------------------
110831
110832 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
110833 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
110834 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
110835 -- call ADRs
110836 -- Bug 4922099
110837 --
110838 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
110839 (NVL(l_actual_upg_option, 'N') = 'O') OR
110840 (NVL(l_enc_upg_option, 'N') = 'O')
110841 )
110842 THEN
110843 NULL;
110844 --
110845 --
110846
110847 l_ccid := AcctDerRule_175(
110848 p_application_id => p_application_id
110849 , p_ae_header_id => l_ae_header_id
110850 , p_source_5 => p_source_5
110851 , p_source_19 => p_source_19
110852 , p_source_32 => p_source_32
110853 , x_transaction_coa_id => l_adr_transaction_coa_id
110854 , x_accounting_coa_id => l_adr_accounting_coa_id
110858
110855 , x_value_type_code => l_adr_value_type_code
110856 , p_side => 'NA'
110857 );
110859 xla_ae_lines_pkg.set_ccid(
110860 p_code_combination_id => l_ccid
110861 , p_value_type_code => l_adr_value_type_code
110862 , p_transaction_coa_id => l_adr_transaction_coa_id
110863 , p_accounting_coa_id => l_adr_accounting_coa_id
110864 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
110865 , p_adr_type_code => 'S'
110866 , p_component_type => l_component_type
110867 , p_component_code => l_component_code
110868 , p_component_type_code => l_component_type_code
110869 , p_component_appl_id => l_component_appl_id
110870 , p_amb_context_code => l_amb_context_code
110871 , p_side => 'NA'
110872 );
110873
110874
110875 l_segment := AcctDerRule_150(
110876 p_application_id => p_application_id
110877 , p_ae_header_id => l_ae_header_id
110878 , p_source_5 => p_source_5
110879 , p_source_12 => p_source_12
110880 , x_transaction_coa_id => l_adr_transaction_coa_id
110881 , x_accounting_coa_id => l_adr_accounting_coa_id
110882 , x_flexfield_segment_code => l_adr_flexfield_segment_code
110883 , x_flex_value_set_id => l_adr_flex_value_set_id
110884 , x_value_type_code => l_adr_value_type_code
110885 , x_value_combination_id => l_adr_value_combination_id
110886 , x_value_segment_code => l_adr_value_segment_code
110887 , p_side => 'NA'
110888 , p_override_seg_flag => 'Y'
110889 );
110890
110891 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
110892
110893 xla_ae_lines_pkg.set_segment(
110894 p_to_segment_code => 'GL_ACCOUNT'
110895 , p_segment_value => l_segment
110896 , p_from_segment_code => l_adr_value_segment_code
110897 , p_from_combination_id => l_adr_value_combination_id
110898 , p_value_type_code => l_adr_value_type_code
110899 , p_transaction_coa_id => l_adr_transaction_coa_id
110900 , p_accounting_coa_id => l_adr_accounting_coa_id
110901 , p_flexfield_segment_code => l_adr_flexfield_segment_code
110902 , p_flex_value_set_id => l_adr_flex_value_set_id
110903 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
110904 , p_adr_type_code => 'S'
110905 , p_component_type => l_component_type
110906 , p_component_code => l_component_code
110907 , p_component_type_code => l_component_type_code
110908 , p_component_appl_id => l_component_appl_id
110909 , p_amb_context_code => l_amb_context_code
110910 , p_entity_code => 'TRANSACTIONS'
110911 , p_event_class_code => 'RETIREMENTS'
110912 , p_side => 'NA'
110913 );
110914
110915 END IF;
110916
110917 l_segment := AcctDerRule_169(
110918 p_application_id => p_application_id
110919 , p_ae_header_id => l_ae_header_id
110920 , p_source_5 => p_source_5
110921 , p_source_31 => p_source_31
110922 , x_transaction_coa_id => l_adr_transaction_coa_id
110923 , x_accounting_coa_id => l_adr_accounting_coa_id
110924 , x_flexfield_segment_code => l_adr_flexfield_segment_code
110925 , x_flex_value_set_id => l_adr_flex_value_set_id
110926 , x_value_type_code => l_adr_value_type_code
110927 , x_value_combination_id => l_adr_value_combination_id
110928 , x_value_segment_code => l_adr_value_segment_code
110929 , p_side => 'NA'
110930 , p_override_seg_flag => 'Y'
110931 );
110932
110933 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
110934
110935 xla_ae_lines_pkg.set_segment(
110936 p_to_segment_code => 'GL_BALANCING'
110937 , p_segment_value => l_segment
110938 , p_from_segment_code => l_adr_value_segment_code
110939 , p_from_combination_id => l_adr_value_combination_id
110940 , p_value_type_code => l_adr_value_type_code
110941 , p_transaction_coa_id => l_adr_transaction_coa_id
110942 , p_accounting_coa_id => l_adr_accounting_coa_id
110943 , p_flexfield_segment_code => l_adr_flexfield_segment_code
110944 , p_flex_value_set_id => l_adr_flex_value_set_id
110945 , p_adr_code => 'FA_EXPENSE_ACCT'
110946 , p_adr_type_code => 'S'
110947 , p_component_type => l_component_type
110948 , p_component_code => l_component_code
110949 , p_component_type_code => l_component_type_code
110950 , p_component_appl_id => l_component_appl_id
110951 , p_amb_context_code => l_amb_context_code
110952 , p_entity_code => 'TRANSACTIONS'
110953 , p_event_class_code => 'RETIREMENTS'
110954 , p_side => 'NA'
110955 );
110956
110957 END IF;
110958
110959 --
110960 --
110961 END IF;
110962
110963 --
110964 -- Update the line information that should be overwritten
110965 --
110969
110966 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
110967 p_header_num => 1);
110968 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
110970 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
110971
110972 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
110973 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
110974 END IF;
110975
110976 --
110977 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
110978 --
110979 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
110980 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
110981 ELSE
110982 ---------------------------------------------------------------------------------------------------
110983 -- 4262811a Switch Sign
110984 ---------------------------------------------------------------------------------------------------
110985 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
110986 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
110987 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
110988 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
110989 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
110990 -- 5132302
110991 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
110992 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
110993
110994 END IF;
110995
110996 -- 4955764
110997 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
110998 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
110999
111000
111001 XLA_AE_LINES_PKG.ValidateCurrentLine;
111002 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
111003
111004 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
111005 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
111006 ,p_balance_type_code => l_balance_type_code);
111007
111008 END IF;
111009
111010 -----------------------------------------------------------------------------------------
111011 -- 4262811 Multiperiod Accounting
111012 -----------------------------------------------------------------------------------------
111013 -- No MPA option is assigned.
111014
111015
111016 END IF;
111017 END IF;
111018 --
111019
111020 --
111021 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
111022 trace
111023 (p_msg => 'END of AcctLineType_319'
111024 ,p_level => C_LEVEL_PROCEDURE
111025 ,p_module => l_log_module);
111026 END IF;
111027 --
111028 EXCEPTION
111029 WHEN xla_exceptions_pkg.application_exception THEN
111030 RAISE;
111031 WHEN OTHERS THEN
111032 xla_exceptions_pkg.raise_message
111033 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_319');
111034 END AcctLineType_319;
111035 --
111036
111037 ---------------------------------------
111038 --
111039 -- PRIVATE FUNCTION
111040 -- AcctLineType_320
111041 --
111042 ---------------------------------------
111043 PROCEDURE AcctLineType_320 (
111044 p_application_id IN NUMBER
111045 ,p_event_id IN NUMBER
111046 ,p_calculate_acctd_flag IN VARCHAR2
111047 ,p_calculate_g_l_flag IN VARCHAR2
111048 ,p_actual_flag IN OUT VARCHAR2
111049 ,p_balance_type_code OUT VARCHAR2
111050 ,p_gain_or_loss_ref OUT VARCHAR2
111051
111052 --Period Close Date
111053 , p_source_1 IN DATE
111054 --Generated Code Combination Identifier
111055 , p_source_5 IN NUMBER
111056 --Depreciation Reserve Account
111057 , p_source_12 IN VARCHAR2
111058 --Generated Offset Code Combination Identifier
111059 , p_source_19 IN NUMBER
111060 --Expense Account Code Combination Identifier
111061 , p_source_31 IN NUMBER
111062 --Default Code Combination Identifier
111063 , p_source_32 IN NUMBER
111064 --Adjustment Type
111065 , p_source_48 IN VARCHAR2
111066 --Transaction Header Identifier
111067 , p_source_49 IN NUMBER
111068 --Adjustment Line Identifier
111069 , p_source_50 IN NUMBER
111070 --Distribution Type Code
111071 , p_source_51 IN VARCHAR2
111072 --Entered Amount
111073 , p_source_52 IN NUMBER
111074 --Currency Code
111075 , p_source_53 IN VARCHAR2
111076 )
111077 IS
111078
111079 l_component_type VARCHAR2(80);
111080 l_component_code VARCHAR2(30);
111081 l_component_type_code VARCHAR2(1);
111082 l_component_appl_id INTEGER;
111083 l_amb_context_code VARCHAR2(30);
111084 l_entity_code VARCHAR2(30);
111085 l_event_class_code VARCHAR2(30);
111086 l_ae_header_id NUMBER;
111087 l_event_type_code VARCHAR2(30);
111088 l_line_definition_code VARCHAR2(30);
111089 l_line_definition_owner_code VARCHAR2(1);
111090 --
111094 l_adr_transaction_coa_id NUMBER;
111091 -- adr variables
111092 l_segment VARCHAR2(30);
111093 l_ccid NUMBER;
111095 l_adr_accounting_coa_id NUMBER;
111096 l_adr_flexfield_segment_code VARCHAR2(30);
111097 l_adr_flex_value_set_id NUMBER;
111098 l_adr_value_type_code VARCHAR2(30);
111099 l_adr_value_combination_id NUMBER;
111100 l_adr_value_segment_code VARCHAR2(30);
111101
111102 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
111103 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
111104 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
111105 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
111106
111107 -- 4262811 Variables ------------------------------------------------------------------------------------------
111108 l_entered_amt_idx NUMBER;
111109 l_accted_amt_idx NUMBER;
111110 l_acc_rev_flag VARCHAR2(1);
111111 l_accrual_line_num NUMBER;
111112 l_tmp_amt NUMBER;
111113 l_acc_rev_natural_side_code VARCHAR2(1);
111114
111115 l_num_entries NUMBER;
111116 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
111117 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
111118 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
111119 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
111120 l_recog_line_1 NUMBER;
111121 l_recog_line_2 NUMBER;
111122
111123 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
111124 l_bflow_applied_to_amt NUMBER; -- 5132302
111125 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
111126
111127 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
111128
111129 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
111130 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
111131
111132 ---------------------------------------------------------------------------------------------------------------
111133
111134
111135 --
111136 -- bulk performance
111137 --
111138 l_balance_type_code VARCHAR2(1);
111139 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
111140 l_log_module VARCHAR2(240);
111141
111142 --
111143 -- Upgrade strategy
111144 --
111145 l_actual_upg_option VARCHAR2(1);
111146 l_enc_upg_option VARCHAR2(1);
111147
111148 --
111149 BEGIN
111150 --
111151 IF g_log_enabled THEN
111152 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_320';
111153 END IF;
111154 --
111155 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
111156
111157 trace
111158 (p_msg => 'BEGIN of AcctLineType_320'
111159 ,p_level => C_LEVEL_PROCEDURE
111160 ,p_module => l_log_module);
111161
111162 END IF;
111163 --
111164 l_component_type := 'AMB_JLT';
111165 l_component_code := 'FA_RETIREMENT_RESERVE_BAL';
111166 l_component_type_code := 'S';
111167 l_component_appl_id := 140;
111168 l_amb_context_code := 'DEFAULT';
111169 l_entity_code := 'TRANSACTIONS';
111170 l_event_class_code := 'RETIREMENTS';
111171 l_event_type_code := 'REINSTATEMENTS';
111172 l_line_definition_owner_code := 'S';
111173 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
111174 --
111175 l_balance_type_code := 'A';
111176 l_segment := NULL;
111177 l_ccid := NULL;
111178 l_adr_transaction_coa_id := NULL;
111179 l_adr_accounting_coa_id := NULL;
111180 l_adr_flexfield_segment_code := NULL;
111181 l_adr_flex_value_set_id := NULL;
111182 l_adr_value_type_code := NULL;
111183 l_adr_value_combination_id := NULL;
111184 l_adr_value_segment_code := NULL;
111185
111186 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
111187 l_bflow_class_code := ''; -- 4219869 Business Flow
111188 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
111189 l_budgetary_control_flag := 'N';
111190
111191 l_bflow_applied_to_amt_idx := NULL; -- 5132302
111192 l_bflow_applied_to_amt := NULL; -- 5132302
111193 l_entered_amt_idx := NULL; -- 4262811
111194 l_accted_amt_idx := NULL; -- 4262811
111195 l_acc_rev_flag := NULL; -- 4262811
111196 l_accrual_line_num := NULL; -- 4262811
111197 l_tmp_amt := NULL; -- 4262811
111198 --
111199
111200 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
111201 l_balance_type_code <> 'B' THEN
111202 IF NVL(p_source_48,'
111203 ') = 'BONUS EXPENSE'
111204 THEN
111205
111206 --
111207 XLA_AE_LINES_PKG.SetNewLine;
111208
111209 p_balance_type_code := l_balance_type_code;
111210 -- set the flag so later we will know whether the gain loss line needs to be created
111211
111212 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
111213 p_actual_flag :='A';
111214 END IF;
111215
111216 --
111217 -- bulk performance
111218 --
111219 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
111223 --
111220 p_header_num => 0); -- 4262811
111221 --
111222 -- set accounting line options
111224 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
111225 p_natural_side_code => 'C'
111226 , p_gain_or_loss_flag => 'N'
111227 , p_gl_transfer_mode_code => 'S'
111228 , p_acct_entry_type_code => 'A'
111229 , p_switch_side_flag => 'Y'
111230 , p_merge_duplicate_code => 'N'
111231 );
111232 --
111233 l_acc_rev_natural_side_code := 'D'; -- 4262811
111234 --
111235 --
111236 -- set accounting line type info
111237 --
111238 xla_ae_lines_pkg.SetAcctLineType
111239 (p_component_type => l_component_type
111240 ,p_event_type_code => l_event_type_code
111241 ,p_line_definition_owner_code => l_line_definition_owner_code
111242 ,p_line_definition_code => l_line_definition_code
111243 ,p_accounting_line_code => l_component_code
111244 ,p_accounting_line_type_code => l_component_type_code
111245 ,p_accounting_line_appl_id => l_component_appl_id
111246 ,p_amb_context_code => l_amb_context_code
111247 ,p_entity_code => l_entity_code
111248 ,p_event_class_code => l_event_class_code);
111249 --
111250 -- set accounting class
111251 --
111252 xla_ae_lines_pkg.SetAcctClass(
111253 p_accounting_class_code => 'ASSET'
111254 , p_ae_header_id => l_ae_header_id
111255 );
111256
111257 --
111258 -- set rounding class
111259 --
111260 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
111261 'ASSET';
111262
111263 --
111264 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
111265 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
111266 --
111267 -- bulk performance
111268 --
111269 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
111270
111271 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
111272 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
111273
111274 -- 4955764
111275 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
111276 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
111277
111278 -- 4458381 Public Sector Enh
111279
111280 --
111281 -- set accounting attributes for the line type
111282 --
111283 l_entered_amt_idx := 4;
111284 l_accted_amt_idx := 6;
111285 l_bflow_applied_to_amt_idx := NULL; -- 5132302
111286 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
111287 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
111288 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
111289 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
111290 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
111291 l_rec_acct_attrs.array_char_value(3) := p_source_51;
111292 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
111293 l_rec_acct_attrs.array_num_value(4) := p_source_52;
111294 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
111295 l_rec_acct_attrs.array_char_value(5) := p_source_53;
111296 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
111297 l_rec_acct_attrs.array_num_value(6) := p_source_52;
111298
111299 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
111300 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
111301
111302 ---------------------------------------------------------------------------------------------------------------
111303 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
111304 ---------------------------------------------------------------------------------------------------------------
111305 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
111306
111307 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
111308 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
111309
111310 IF xla_accounting_cache_pkg.GetValueChar
111311 (p_source_code => 'LEDGER_CATEGORY_CODE'
111312 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
111313 AND l_bflow_method_code = 'PRIOR_ENTRY'
111314 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
111315 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
111316 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
111317 )
111318 THEN
111319 xla_ae_lines_pkg.BflowUpgEntry
111320 (p_business_method_code => l_bflow_method_code
111321 ,p_business_class_code => l_bflow_class_code
111322 ,p_balance_type => l_balance_type_code);
111323 ELSE
111324 NULL;
111325 -- No business flow processing for business flow method of NONE.
111326 END IF;
111327
111328 --
111329 -- call analytical criteria
111330 --
111331
111332 --
111336 xla_ae_lines_pkg.SetLineDescription(
111333 -- call description
111334 --
111335
111337 p_ae_header_id => l_ae_header_id
111338 ,p_description => Description_82 (
111339 p_application_id => p_application_id
111340 , p_ae_header_id => l_ae_header_id
111341 , p_source_1 => p_source_1
111342 )
111343 );
111344
111345
111346 --
111347 -- call ADRs
111348 -- Bug 4922099
111349 --
111350 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
111351 (NVL(l_actual_upg_option, 'N') = 'O') OR
111352 (NVL(l_enc_upg_option, 'N') = 'O')
111353 )
111354 THEN
111355 NULL;
111356 --
111357 --
111358
111359 l_ccid := AcctDerRule_175(
111360 p_application_id => p_application_id
111361 , p_ae_header_id => l_ae_header_id
111362 , p_source_5 => p_source_5
111363 , p_source_19 => p_source_19
111364 , p_source_32 => p_source_32
111365 , x_transaction_coa_id => l_adr_transaction_coa_id
111366 , x_accounting_coa_id => l_adr_accounting_coa_id
111367 , x_value_type_code => l_adr_value_type_code
111368 , p_side => 'NA'
111369 );
111370
111371 xla_ae_lines_pkg.set_ccid(
111372 p_code_combination_id => l_ccid
111373 , p_value_type_code => l_adr_value_type_code
111374 , p_transaction_coa_id => l_adr_transaction_coa_id
111375 , p_accounting_coa_id => l_adr_accounting_coa_id
111376 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
111377 , p_adr_type_code => 'S'
111378 , p_component_type => l_component_type
111379 , p_component_code => l_component_code
111380 , p_component_type_code => l_component_type_code
111381 , p_component_appl_id => l_component_appl_id
111382 , p_amb_context_code => l_amb_context_code
111383 , p_side => 'NA'
111384 );
111385
111386
111387 l_segment := AcctDerRule_150(
111388 p_application_id => p_application_id
111389 , p_ae_header_id => l_ae_header_id
111390 , p_source_5 => p_source_5
111391 , p_source_12 => p_source_12
111392 , x_transaction_coa_id => l_adr_transaction_coa_id
111393 , x_accounting_coa_id => l_adr_accounting_coa_id
111394 , x_flexfield_segment_code => l_adr_flexfield_segment_code
111395 , x_flex_value_set_id => l_adr_flex_value_set_id
111396 , x_value_type_code => l_adr_value_type_code
111397 , x_value_combination_id => l_adr_value_combination_id
111398 , x_value_segment_code => l_adr_value_segment_code
111399 , p_side => 'NA'
111400 , p_override_seg_flag => 'Y'
111401 );
111402
111403 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
111404
111405 xla_ae_lines_pkg.set_segment(
111406 p_to_segment_code => 'GL_ACCOUNT'
111407 , p_segment_value => l_segment
111408 , p_from_segment_code => l_adr_value_segment_code
111409 , p_from_combination_id => l_adr_value_combination_id
111410 , p_value_type_code => l_adr_value_type_code
111411 , p_transaction_coa_id => l_adr_transaction_coa_id
111412 , p_accounting_coa_id => l_adr_accounting_coa_id
111413 , p_flexfield_segment_code => l_adr_flexfield_segment_code
111414 , p_flex_value_set_id => l_adr_flex_value_set_id
111415 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
111416 , p_adr_type_code => 'S'
111417 , p_component_type => l_component_type
111418 , p_component_code => l_component_code
111419 , p_component_type_code => l_component_type_code
111420 , p_component_appl_id => l_component_appl_id
111421 , p_amb_context_code => l_amb_context_code
111422 , p_entity_code => 'TRANSACTIONS'
111423 , p_event_class_code => 'RETIREMENTS'
111424 , p_side => 'NA'
111425 );
111426
111427 END IF;
111428
111429 l_segment := AcctDerRule_169(
111430 p_application_id => p_application_id
111431 , p_ae_header_id => l_ae_header_id
111432 , p_source_5 => p_source_5
111433 , p_source_31 => p_source_31
111434 , x_transaction_coa_id => l_adr_transaction_coa_id
111435 , x_accounting_coa_id => l_adr_accounting_coa_id
111436 , x_flexfield_segment_code => l_adr_flexfield_segment_code
111437 , x_flex_value_set_id => l_adr_flex_value_set_id
111438 , x_value_type_code => l_adr_value_type_code
111439 , x_value_combination_id => l_adr_value_combination_id
111440 , x_value_segment_code => l_adr_value_segment_code
111441 , p_side => 'NA'
111442 , p_override_seg_flag => 'Y'
111443 );
111444
111445 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
111446
111447 xla_ae_lines_pkg.set_segment(
111448 p_to_segment_code => 'GL_BALANCING'
111449 , p_segment_value => l_segment
111450 , p_from_segment_code => l_adr_value_segment_code
111451 , p_from_combination_id => l_adr_value_combination_id
111455 , p_flexfield_segment_code => l_adr_flexfield_segment_code
111452 , p_value_type_code => l_adr_value_type_code
111453 , p_transaction_coa_id => l_adr_transaction_coa_id
111454 , p_accounting_coa_id => l_adr_accounting_coa_id
111456 , p_flex_value_set_id => l_adr_flex_value_set_id
111457 , p_adr_code => 'FA_EXPENSE_ACCT'
111458 , p_adr_type_code => 'S'
111459 , p_component_type => l_component_type
111460 , p_component_code => l_component_code
111461 , p_component_type_code => l_component_type_code
111462 , p_component_appl_id => l_component_appl_id
111463 , p_amb_context_code => l_amb_context_code
111464 , p_entity_code => 'TRANSACTIONS'
111465 , p_event_class_code => 'RETIREMENTS'
111466 , p_side => 'NA'
111467 );
111468
111469 END IF;
111470
111471 --
111472 --
111473 END IF;
111474 --
111475 -- Bug 4922099
111476 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
111477 (NVL(l_enc_upg_option, 'N') = 'O')
111478 ) AND
111479 (l_bflow_method_code = 'PRIOR_ENTRY')
111480 )
111481 THEN
111482 IF
111483 --
111484 1 = 2
111485 --
111486 THEN
111487 xla_accounting_err_pkg.build_message
111488 (p_appli_s_name => 'XLA'
111489 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
111490 ,p_token_1 => 'LINE_NUMBER'
111491 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
111492 ,p_token_2 => 'LINE_TYPE_NAME'
111493 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
111494 l_component_type
111495 ,l_component_code
111496 ,l_component_type_code
111497 ,l_component_appl_id
111498 ,l_amb_context_code
111499 ,l_entity_code
111500 ,l_event_class_code
111501 )
111502 ,p_token_3 => 'OWNER'
111503 ,p_value_3 => xla_lookups_pkg.get_meaning(
111504 p_lookup_type => 'XLA_OWNER_TYPE'
111505 ,p_lookup_code => l_component_type_code
111506 )
111507 ,p_token_4 => 'PRODUCT_NAME'
111508 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
111509 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
111510 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
111511 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
111512 ,p_ae_header_id => NULL
111513 );
111514
111515 IF (C_LEVEL_ERROR>= g_log_level) THEN
111516 trace
111517 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
111518 ,p_level => C_LEVEL_ERROR
111519 ,p_module => l_log_module);
111520 END IF;
111521 END IF;
111522 END IF;
111523 --
111524 --
111525 ------------------------------------------------------------------------------------------------
111526 -- 4219869 Business Flow
111527 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
111528 -- Prior Entry. Currently, the following code is always generated.
111529 ------------------------------------------------------------------------------------------------
111530 XLA_AE_LINES_PKG.ValidateCurrentLine;
111531
111532 ------------------------------------------------------------------------------------
111533 -- 4219869 Business Flow
111534 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
111535 ------------------------------------------------------------------------------------
111536 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
111537
111538 ----------------------------------------------------------------------------------
111539 -- 4219869 Business Flow
111540 -- Update journal entry status -- Need to generate this within IF <condition>
111541 ----------------------------------------------------------------------------------
111542 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
111543 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
111544 ,p_balance_type_code => l_balance_type_code
111545 );
111546
111550 BEGIN
111547 -------------------------------------------------------------------------------------------
111548 -- 4262811 - Generate the Accrual Reversal lines
111549 -------------------------------------------------------------------------------------------
111551 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
111552 (g_array_event(p_event_id).array_value_num('header_index'));
111553 IF l_acc_rev_flag IS NULL THEN
111554 l_acc_rev_flag := 'N';
111555 END IF;
111556 EXCEPTION
111557 WHEN OTHERS THEN
111558 l_acc_rev_flag := 'N';
111559 END;
111560 --
111561 IF (l_acc_rev_flag = 'Y') THEN
111562
111563 -- 4645092 ------------------------------------------------------------------------------
111564 -- To allow MPA report to determine if it should generate report process
111565 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
111566 ------------------------------------------------------------------------------------------
111567
111568 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
111569 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
111570 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
111571 -- call ADRs
111572 -- Bug 4922099
111573 --
111574 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
111575 (NVL(l_actual_upg_option, 'N') = 'O') OR
111576 (NVL(l_enc_upg_option, 'N') = 'O')
111577 )
111578 THEN
111579 NULL;
111580 --
111581 --
111582
111583 l_ccid := AcctDerRule_175(
111584 p_application_id => p_application_id
111585 , p_ae_header_id => l_ae_header_id
111586 , p_source_5 => p_source_5
111587 , p_source_19 => p_source_19
111588 , p_source_32 => p_source_32
111589 , x_transaction_coa_id => l_adr_transaction_coa_id
111590 , x_accounting_coa_id => l_adr_accounting_coa_id
111591 , x_value_type_code => l_adr_value_type_code
111592 , p_side => 'NA'
111593 );
111594
111595 xla_ae_lines_pkg.set_ccid(
111596 p_code_combination_id => l_ccid
111597 , p_value_type_code => l_adr_value_type_code
111598 , p_transaction_coa_id => l_adr_transaction_coa_id
111599 , p_accounting_coa_id => l_adr_accounting_coa_id
111600 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
111601 , p_adr_type_code => 'S'
111602 , p_component_type => l_component_type
111603 , p_component_code => l_component_code
111604 , p_component_type_code => l_component_type_code
111605 , p_component_appl_id => l_component_appl_id
111606 , p_amb_context_code => l_amb_context_code
111607 , p_side => 'NA'
111608 );
111609
111610
111611 l_segment := AcctDerRule_150(
111612 p_application_id => p_application_id
111613 , p_ae_header_id => l_ae_header_id
111614 , p_source_5 => p_source_5
111615 , p_source_12 => p_source_12
111616 , x_transaction_coa_id => l_adr_transaction_coa_id
111617 , x_accounting_coa_id => l_adr_accounting_coa_id
111618 , x_flexfield_segment_code => l_adr_flexfield_segment_code
111619 , x_flex_value_set_id => l_adr_flex_value_set_id
111620 , x_value_type_code => l_adr_value_type_code
111621 , x_value_combination_id => l_adr_value_combination_id
111622 , x_value_segment_code => l_adr_value_segment_code
111623 , p_side => 'NA'
111624 , p_override_seg_flag => 'Y'
111625 );
111626
111627 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
111628
111629 xla_ae_lines_pkg.set_segment(
111630 p_to_segment_code => 'GL_ACCOUNT'
111631 , p_segment_value => l_segment
111632 , p_from_segment_code => l_adr_value_segment_code
111633 , p_from_combination_id => l_adr_value_combination_id
111634 , p_value_type_code => l_adr_value_type_code
111635 , p_transaction_coa_id => l_adr_transaction_coa_id
111636 , p_accounting_coa_id => l_adr_accounting_coa_id
111637 , p_flexfield_segment_code => l_adr_flexfield_segment_code
111638 , p_flex_value_set_id => l_adr_flex_value_set_id
111639 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
111640 , p_adr_type_code => 'S'
111641 , p_component_type => l_component_type
111642 , p_component_code => l_component_code
111643 , p_component_type_code => l_component_type_code
111644 , p_component_appl_id => l_component_appl_id
111645 , p_amb_context_code => l_amb_context_code
111646 , p_entity_code => 'TRANSACTIONS'
111647 , p_event_class_code => 'RETIREMENTS'
111648 , p_side => 'NA'
111649 );
111650
111651 END IF;
111652
111653 l_segment := AcctDerRule_169(
111654 p_application_id => p_application_id
111655 , p_ae_header_id => l_ae_header_id
111656 , p_source_5 => p_source_5
111657 , p_source_31 => p_source_31
111658 , x_transaction_coa_id => l_adr_transaction_coa_id
111659 , x_accounting_coa_id => l_adr_accounting_coa_id
111660 , x_flexfield_segment_code => l_adr_flexfield_segment_code
111661 , x_flex_value_set_id => l_adr_flex_value_set_id
111665 , p_side => 'NA'
111662 , x_value_type_code => l_adr_value_type_code
111663 , x_value_combination_id => l_adr_value_combination_id
111664 , x_value_segment_code => l_adr_value_segment_code
111666 , p_override_seg_flag => 'Y'
111667 );
111668
111669 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
111670
111671 xla_ae_lines_pkg.set_segment(
111672 p_to_segment_code => 'GL_BALANCING'
111673 , p_segment_value => l_segment
111674 , p_from_segment_code => l_adr_value_segment_code
111675 , p_from_combination_id => l_adr_value_combination_id
111676 , p_value_type_code => l_adr_value_type_code
111677 , p_transaction_coa_id => l_adr_transaction_coa_id
111678 , p_accounting_coa_id => l_adr_accounting_coa_id
111679 , p_flexfield_segment_code => l_adr_flexfield_segment_code
111680 , p_flex_value_set_id => l_adr_flex_value_set_id
111681 , p_adr_code => 'FA_EXPENSE_ACCT'
111682 , p_adr_type_code => 'S'
111683 , p_component_type => l_component_type
111684 , p_component_code => l_component_code
111685 , p_component_type_code => l_component_type_code
111686 , p_component_appl_id => l_component_appl_id
111687 , p_amb_context_code => l_amb_context_code
111688 , p_entity_code => 'TRANSACTIONS'
111689 , p_event_class_code => 'RETIREMENTS'
111690 , p_side => 'NA'
111691 );
111692
111693 END IF;
111694
111695 --
111696 --
111697 END IF;
111698
111699 --
111700 -- Update the line information that should be overwritten
111701 --
111702 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
111703 p_header_num => 1);
111704 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
111705
111706 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
111707
111708 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
111709 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
111710 END IF;
111711
111712 --
111713 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
111714 --
111715 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
111716 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
111717 ELSE
111718 ---------------------------------------------------------------------------------------------------
111719 -- 4262811a Switch Sign
111720 ---------------------------------------------------------------------------------------------------
111721 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
111722 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
111723 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
111724 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
111725 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
111726 -- 5132302
111727 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
111728 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
111729
111730 END IF;
111731
111732 -- 4955764
111733 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
111734 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
111735
111736
111737 XLA_AE_LINES_PKG.ValidateCurrentLine;
111738 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
111739
111740 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
111741 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
111742 ,p_balance_type_code => l_balance_type_code);
111743
111744 END IF;
111745
111746 -----------------------------------------------------------------------------------------
111747 -- 4262811 Multiperiod Accounting
111748 -----------------------------------------------------------------------------------------
111749 -- No MPA option is assigned.
111750
111751
111752 END IF;
111753 END IF;
111754 --
111755
111756 --
111757 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
111758 trace
111759 (p_msg => 'END of AcctLineType_320'
111760 ,p_level => C_LEVEL_PROCEDURE
111761 ,p_module => l_log_module);
111762 END IF;
111763 --
111764 EXCEPTION
111765 WHEN xla_exceptions_pkg.application_exception THEN
111766 RAISE;
111767 WHEN OTHERS THEN
111768 xla_exceptions_pkg.raise_message
111769 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_320');
111770 END AcctLineType_320;
111771 --
111772
111773 ---------------------------------------
111774 --
111775 -- PRIVATE FUNCTION
111776 -- AcctLineType_321
111777 --
111778 ---------------------------------------
111782 ,p_calculate_acctd_flag IN VARCHAR2
111779 PROCEDURE AcctLineType_321 (
111780 p_application_id IN NUMBER
111781 ,p_event_id IN NUMBER
111783 ,p_calculate_g_l_flag IN VARCHAR2
111784 ,p_actual_flag IN OUT VARCHAR2
111785 ,p_balance_type_code OUT VARCHAR2
111786 ,p_gain_or_loss_ref OUT VARCHAR2
111787
111788 --Period Close Date
111789 , p_source_1 IN DATE
111790 --Generated Code Combination Identifier
111791 , p_source_5 IN NUMBER
111792 --Cost Of Removal Clearing Account
111793 , p_source_14 IN VARCHAR2
111794 --Expense Account Code Combination Identifier
111795 , p_source_31 IN NUMBER
111796 --Default Code Combination Identifier
111797 , p_source_32 IN NUMBER
111798 --Adjustment Type
111799 , p_source_48 IN VARCHAR2
111800 --Transaction Header Identifier
111801 , p_source_49 IN NUMBER
111802 --Adjustment Line Identifier
111803 , p_source_50 IN NUMBER
111804 --Distribution Type Code
111805 , p_source_51 IN VARCHAR2
111806 --Entered Amount
111807 , p_source_52 IN NUMBER
111808 --Currency Code
111809 , p_source_53 IN VARCHAR2
111810 )
111811 IS
111812
111813 l_component_type VARCHAR2(80);
111814 l_component_code VARCHAR2(30);
111815 l_component_type_code VARCHAR2(1);
111816 l_component_appl_id INTEGER;
111817 l_amb_context_code VARCHAR2(30);
111818 l_entity_code VARCHAR2(30);
111819 l_event_class_code VARCHAR2(30);
111820 l_ae_header_id NUMBER;
111821 l_event_type_code VARCHAR2(30);
111822 l_line_definition_code VARCHAR2(30);
111823 l_line_definition_owner_code VARCHAR2(1);
111824 --
111825 -- adr variables
111826 l_segment VARCHAR2(30);
111827 l_ccid NUMBER;
111828 l_adr_transaction_coa_id NUMBER;
111829 l_adr_accounting_coa_id NUMBER;
111830 l_adr_flexfield_segment_code VARCHAR2(30);
111831 l_adr_flex_value_set_id NUMBER;
111832 l_adr_value_type_code VARCHAR2(30);
111833 l_adr_value_combination_id NUMBER;
111834 l_adr_value_segment_code VARCHAR2(30);
111835
111836 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
111837 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
111838 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
111839 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
111840
111841 -- 4262811 Variables ------------------------------------------------------------------------------------------
111842 l_entered_amt_idx NUMBER;
111843 l_accted_amt_idx NUMBER;
111844 l_acc_rev_flag VARCHAR2(1);
111845 l_accrual_line_num NUMBER;
111846 l_tmp_amt NUMBER;
111847 l_acc_rev_natural_side_code VARCHAR2(1);
111848
111849 l_num_entries NUMBER;
111850 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
111851 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
111852 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
111853 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
111854 l_recog_line_1 NUMBER;
111855 l_recog_line_2 NUMBER;
111856
111857 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
111858 l_bflow_applied_to_amt NUMBER; -- 5132302
111859 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
111860
111861 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
111862
111863 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
111864 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
111865
111866 ---------------------------------------------------------------------------------------------------------------
111867
111868
111869 --
111870 -- bulk performance
111871 --
111872 l_balance_type_code VARCHAR2(1);
111873 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
111874 l_log_module VARCHAR2(240);
111875
111876 --
111877 -- Upgrade strategy
111878 --
111879 l_actual_upg_option VARCHAR2(1);
111880 l_enc_upg_option VARCHAR2(1);
111881
111882 --
111883 BEGIN
111884 --
111885 IF g_log_enabled THEN
111886 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_321';
111887 END IF;
111888 --
111889 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
111890
111891 trace
111892 (p_msg => 'BEGIN of AcctLineType_321'
111893 ,p_level => C_LEVEL_PROCEDURE
111894 ,p_module => l_log_module);
111895
111896 END IF;
111897 --
111898 l_component_type := 'AMB_JLT';
111899 l_component_code := 'FA_RET_ADJ_COST_REM_CLR';
111900 l_component_type_code := 'S';
111901 l_component_appl_id := 140;
111902 l_amb_context_code := 'DEFAULT';
111903 l_entity_code := 'TRANSACTIONS';
111904 l_event_class_code := 'RETIREMENT_ADJUSTMENTS';
111905 l_event_type_code := 'RETIREMENT_ADJUSTMENTS_ALL';
111906 l_line_definition_owner_code := 'S';
111907 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR20';
111908 --
111909 l_balance_type_code := 'A';
111913 l_adr_accounting_coa_id := NULL;
111910 l_segment := NULL;
111911 l_ccid := NULL;
111912 l_adr_transaction_coa_id := NULL;
111914 l_adr_flexfield_segment_code := NULL;
111915 l_adr_flex_value_set_id := NULL;
111916 l_adr_value_type_code := NULL;
111917 l_adr_value_combination_id := NULL;
111918 l_adr_value_segment_code := NULL;
111919
111920 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
111921 l_bflow_class_code := ''; -- 4219869 Business Flow
111922 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
111923 l_budgetary_control_flag := 'N';
111924
111925 l_bflow_applied_to_amt_idx := NULL; -- 5132302
111926 l_bflow_applied_to_amt := NULL; -- 5132302
111927 l_entered_amt_idx := NULL; -- 4262811
111928 l_accted_amt_idx := NULL; -- 4262811
111929 l_acc_rev_flag := NULL; -- 4262811
111930 l_accrual_line_num := NULL; -- 4262811
111931 l_tmp_amt := NULL; -- 4262811
111932 --
111933
111934 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
111935 l_balance_type_code <> 'B' THEN
111936 IF NVL(p_source_48,'
111937 ') = 'REMOVALCOST'
111938 THEN
111939
111940 --
111941 XLA_AE_LINES_PKG.SetNewLine;
111942
111943 p_balance_type_code := l_balance_type_code;
111944 -- set the flag so later we will know whether the gain loss line needs to be created
111945
111946 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
111947 p_actual_flag :='A';
111948 END IF;
111949
111950 --
111951 -- bulk performance
111952 --
111953 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
111954 p_header_num => 0); -- 4262811
111955 --
111956 -- set accounting line options
111957 --
111958 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
111959 p_natural_side_code => 'C'
111960 , p_gain_or_loss_flag => 'N'
111961 , p_gl_transfer_mode_code => 'S'
111962 , p_acct_entry_type_code => 'A'
111963 , p_switch_side_flag => 'Y'
111964 , p_merge_duplicate_code => 'N'
111965 );
111966 --
111967 l_acc_rev_natural_side_code := 'D'; -- 4262811
111968 --
111969 --
111970 -- set accounting line type info
111971 --
111972 xla_ae_lines_pkg.SetAcctLineType
111973 (p_component_type => l_component_type
111974 ,p_event_type_code => l_event_type_code
111975 ,p_line_definition_owner_code => l_line_definition_owner_code
111976 ,p_line_definition_code => l_line_definition_code
111977 ,p_accounting_line_code => l_component_code
111978 ,p_accounting_line_type_code => l_component_type_code
111979 ,p_accounting_line_appl_id => l_component_appl_id
111980 ,p_amb_context_code => l_amb_context_code
111981 ,p_entity_code => l_entity_code
111982 ,p_event_class_code => l_event_class_code);
111983 --
111984 -- set accounting class
111985 --
111986 xla_ae_lines_pkg.SetAcctClass(
111987 p_accounting_class_code => 'ASSET'
111988 , p_ae_header_id => l_ae_header_id
111989 );
111990
111991 --
111992 -- set rounding class
111993 --
111994 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
111995 'ASSET';
111996
111997 --
111998 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
111999 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
112000 --
112001 -- bulk performance
112002 --
112003 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
112004
112005 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
112006 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
112007
112008 -- 4955764
112009 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
112010 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
112011
112012 -- 4458381 Public Sector Enh
112013
112014 --
112015 -- set accounting attributes for the line type
112016 --
112017 l_entered_amt_idx := 4;
112018 l_accted_amt_idx := 6;
112019 l_bflow_applied_to_amt_idx := NULL; -- 5132302
112020 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
112021 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
112022 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
112023 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
112024 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
112025 l_rec_acct_attrs.array_char_value(3) := p_source_51;
112026 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
112027 l_rec_acct_attrs.array_num_value(4) := p_source_52;
112028 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
112029 l_rec_acct_attrs.array_char_value(5) := p_source_53;
112030 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
112034 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
112031 l_rec_acct_attrs.array_num_value(6) := p_source_52;
112032
112033 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
112035
112036 ---------------------------------------------------------------------------------------------------------------
112037 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
112038 ---------------------------------------------------------------------------------------------------------------
112039 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
112040
112041 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
112042 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
112043
112044 IF xla_accounting_cache_pkg.GetValueChar
112045 (p_source_code => 'LEDGER_CATEGORY_CODE'
112046 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
112047 AND l_bflow_method_code = 'PRIOR_ENTRY'
112048 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
112049 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
112050 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
112051 )
112052 THEN
112053 xla_ae_lines_pkg.BflowUpgEntry
112054 (p_business_method_code => l_bflow_method_code
112055 ,p_business_class_code => l_bflow_class_code
112056 ,p_balance_type => l_balance_type_code);
112057 ELSE
112058 NULL;
112059 -- No business flow processing for business flow method of NONE.
112060 END IF;
112061
112062 --
112063 -- call analytical criteria
112064 --
112065
112066 --
112067 -- call description
112068 --
112069
112070 xla_ae_lines_pkg.SetLineDescription(
112071 p_ae_header_id => l_ae_header_id
112072 ,p_description => Description_85 (
112073 p_application_id => p_application_id
112074 , p_ae_header_id => l_ae_header_id
112075 , p_source_1 => p_source_1
112076 )
112077 );
112078
112079
112080 --
112081 -- call ADRs
112082 -- Bug 4922099
112083 --
112084 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
112085 (NVL(l_actual_upg_option, 'N') = 'O') OR
112086 (NVL(l_enc_upg_option, 'N') = 'O')
112087 )
112088 THEN
112089 NULL;
112090 --
112091 --
112092
112093 l_ccid := AcctDerRule_174(
112094 p_application_id => p_application_id
112095 , p_ae_header_id => l_ae_header_id
112096 , p_source_5 => p_source_5
112097 , p_source_32 => p_source_32
112098 , x_transaction_coa_id => l_adr_transaction_coa_id
112099 , x_accounting_coa_id => l_adr_accounting_coa_id
112100 , x_value_type_code => l_adr_value_type_code
112101 , p_side => 'NA'
112102 );
112103
112104 xla_ae_lines_pkg.set_ccid(
112105 p_code_combination_id => l_ccid
112106 , p_value_type_code => l_adr_value_type_code
112107 , p_transaction_coa_id => l_adr_transaction_coa_id
112108 , p_accounting_coa_id => l_adr_accounting_coa_id
112109 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
112110 , p_adr_type_code => 'S'
112111 , p_component_type => l_component_type
112112 , p_component_code => l_component_code
112113 , p_component_type_code => l_component_type_code
112114 , p_component_appl_id => l_component_appl_id
112115 , p_amb_context_code => l_amb_context_code
112116 , p_side => 'NA'
112117 );
112118
112119
112120 l_segment := AcctDerRule_152(
112121 p_application_id => p_application_id
112122 , p_ae_header_id => l_ae_header_id
112123 , p_source_5 => p_source_5
112124 , p_source_14 => p_source_14
112125 , x_transaction_coa_id => l_adr_transaction_coa_id
112126 , x_accounting_coa_id => l_adr_accounting_coa_id
112127 , x_flexfield_segment_code => l_adr_flexfield_segment_code
112128 , x_flex_value_set_id => l_adr_flex_value_set_id
112129 , x_value_type_code => l_adr_value_type_code
112130 , x_value_combination_id => l_adr_value_combination_id
112131 , x_value_segment_code => l_adr_value_segment_code
112132 , p_side => 'NA'
112133 , p_override_seg_flag => 'Y'
112134 );
112135
112136 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
112137
112138 xla_ae_lines_pkg.set_segment(
112139 p_to_segment_code => 'GL_ACCOUNT'
112140 , p_segment_value => l_segment
112141 , p_from_segment_code => l_adr_value_segment_code
112142 , p_from_combination_id => l_adr_value_combination_id
112143 , p_value_type_code => l_adr_value_type_code
112144 , p_transaction_coa_id => l_adr_transaction_coa_id
112145 , p_accounting_coa_id => l_adr_accounting_coa_id
112146 , p_flexfield_segment_code => l_adr_flexfield_segment_code
112147 , p_flex_value_set_id => l_adr_flex_value_set_id
112148 , p_adr_code => 'FA_COST_OF_REMOVAL_CLR_SEGMENT'
112152 , p_component_type_code => l_component_type_code
112149 , p_adr_type_code => 'S'
112150 , p_component_type => l_component_type
112151 , p_component_code => l_component_code
112153 , p_component_appl_id => l_component_appl_id
112154 , p_amb_context_code => l_amb_context_code
112155 , p_entity_code => 'TRANSACTIONS'
112156 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
112157 , p_side => 'NA'
112158 );
112159
112160 END IF;
112161
112162 l_segment := AcctDerRule_169(
112163 p_application_id => p_application_id
112164 , p_ae_header_id => l_ae_header_id
112165 , p_source_5 => p_source_5
112166 , p_source_31 => p_source_31
112167 , x_transaction_coa_id => l_adr_transaction_coa_id
112168 , x_accounting_coa_id => l_adr_accounting_coa_id
112169 , x_flexfield_segment_code => l_adr_flexfield_segment_code
112170 , x_flex_value_set_id => l_adr_flex_value_set_id
112171 , x_value_type_code => l_adr_value_type_code
112172 , x_value_combination_id => l_adr_value_combination_id
112173 , x_value_segment_code => l_adr_value_segment_code
112174 , p_side => 'NA'
112175 , p_override_seg_flag => 'Y'
112176 );
112177
112178 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
112179
112180 xla_ae_lines_pkg.set_segment(
112181 p_to_segment_code => 'GL_BALANCING'
112182 , p_segment_value => l_segment
112183 , p_from_segment_code => l_adr_value_segment_code
112184 , p_from_combination_id => l_adr_value_combination_id
112185 , p_value_type_code => l_adr_value_type_code
112186 , p_transaction_coa_id => l_adr_transaction_coa_id
112187 , p_accounting_coa_id => l_adr_accounting_coa_id
112188 , p_flexfield_segment_code => l_adr_flexfield_segment_code
112189 , p_flex_value_set_id => l_adr_flex_value_set_id
112190 , p_adr_code => 'FA_EXPENSE_ACCT'
112191 , p_adr_type_code => 'S'
112192 , p_component_type => l_component_type
112193 , p_component_code => l_component_code
112194 , p_component_type_code => l_component_type_code
112195 , p_component_appl_id => l_component_appl_id
112196 , p_amb_context_code => l_amb_context_code
112197 , p_entity_code => 'TRANSACTIONS'
112198 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
112199 , p_side => 'NA'
112200 );
112201
112202 END IF;
112203
112204 --
112205 --
112206 END IF;
112207 --
112208 -- Bug 4922099
112209 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
112210 (NVL(l_enc_upg_option, 'N') = 'O')
112211 ) AND
112212 (l_bflow_method_code = 'PRIOR_ENTRY')
112213 )
112214 THEN
112215 IF
112216 --
112217 1 = 2
112218 --
112219 THEN
112220 xla_accounting_err_pkg.build_message
112221 (p_appli_s_name => 'XLA'
112222 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
112223 ,p_token_1 => 'LINE_NUMBER'
112224 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
112225 ,p_token_2 => 'LINE_TYPE_NAME'
112226 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
112227 l_component_type
112228 ,l_component_code
112229 ,l_component_type_code
112230 ,l_component_appl_id
112231 ,l_amb_context_code
112232 ,l_entity_code
112233 ,l_event_class_code
112234 )
112235 ,p_token_3 => 'OWNER'
112236 ,p_value_3 => xla_lookups_pkg.get_meaning(
112237 p_lookup_type => 'XLA_OWNER_TYPE'
112238 ,p_lookup_code => l_component_type_code
112239 )
112240 ,p_token_4 => 'PRODUCT_NAME'
112241 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
112242 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
112243 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
112244 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
112245 ,p_ae_header_id => NULL
112246 );
112247
112251 ,p_level => C_LEVEL_ERROR
112248 IF (C_LEVEL_ERROR>= g_log_level) THEN
112249 trace
112250 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
112252 ,p_module => l_log_module);
112253 END IF;
112254 END IF;
112255 END IF;
112256 --
112257 --
112258 ------------------------------------------------------------------------------------------------
112259 -- 4219869 Business Flow
112260 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
112261 -- Prior Entry. Currently, the following code is always generated.
112262 ------------------------------------------------------------------------------------------------
112263 XLA_AE_LINES_PKG.ValidateCurrentLine;
112264
112265 ------------------------------------------------------------------------------------
112266 -- 4219869 Business Flow
112267 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
112268 ------------------------------------------------------------------------------------
112269 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
112270
112271 ----------------------------------------------------------------------------------
112272 -- 4219869 Business Flow
112273 -- Update journal entry status -- Need to generate this within IF <condition>
112274 ----------------------------------------------------------------------------------
112275 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
112276 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
112277 ,p_balance_type_code => l_balance_type_code
112278 );
112279
112280 -------------------------------------------------------------------------------------------
112281 -- 4262811 - Generate the Accrual Reversal lines
112282 -------------------------------------------------------------------------------------------
112283 BEGIN
112284 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
112285 (g_array_event(p_event_id).array_value_num('header_index'));
112286 IF l_acc_rev_flag IS NULL THEN
112287 l_acc_rev_flag := 'N';
112288 END IF;
112289 EXCEPTION
112290 WHEN OTHERS THEN
112291 l_acc_rev_flag := 'N';
112292 END;
112293 --
112294 IF (l_acc_rev_flag = 'Y') THEN
112295
112296 -- 4645092 ------------------------------------------------------------------------------
112297 -- To allow MPA report to determine if it should generate report process
112298 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
112299 ------------------------------------------------------------------------------------------
112300
112301 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
112302 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
112303 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
112304 -- call ADRs
112305 -- Bug 4922099
112306 --
112307 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
112308 (NVL(l_actual_upg_option, 'N') = 'O') OR
112309 (NVL(l_enc_upg_option, 'N') = 'O')
112310 )
112311 THEN
112312 NULL;
112313 --
112314 --
112315
112316 l_ccid := AcctDerRule_174(
112317 p_application_id => p_application_id
112318 , p_ae_header_id => l_ae_header_id
112319 , p_source_5 => p_source_5
112320 , p_source_32 => p_source_32
112321 , x_transaction_coa_id => l_adr_transaction_coa_id
112322 , x_accounting_coa_id => l_adr_accounting_coa_id
112323 , x_value_type_code => l_adr_value_type_code
112324 , p_side => 'NA'
112325 );
112326
112327 xla_ae_lines_pkg.set_ccid(
112328 p_code_combination_id => l_ccid
112329 , p_value_type_code => l_adr_value_type_code
112330 , p_transaction_coa_id => l_adr_transaction_coa_id
112331 , p_accounting_coa_id => l_adr_accounting_coa_id
112332 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
112333 , p_adr_type_code => 'S'
112334 , p_component_type => l_component_type
112335 , p_component_code => l_component_code
112336 , p_component_type_code => l_component_type_code
112337 , p_component_appl_id => l_component_appl_id
112338 , p_amb_context_code => l_amb_context_code
112339 , p_side => 'NA'
112340 );
112341
112342
112343 l_segment := AcctDerRule_152(
112344 p_application_id => p_application_id
112345 , p_ae_header_id => l_ae_header_id
112346 , p_source_5 => p_source_5
112347 , p_source_14 => p_source_14
112348 , x_transaction_coa_id => l_adr_transaction_coa_id
112349 , x_accounting_coa_id => l_adr_accounting_coa_id
112350 , x_flexfield_segment_code => l_adr_flexfield_segment_code
112351 , x_flex_value_set_id => l_adr_flex_value_set_id
112352 , x_value_type_code => l_adr_value_type_code
112353 , x_value_combination_id => l_adr_value_combination_id
112354 , x_value_segment_code => l_adr_value_segment_code
112355 , p_side => 'NA'
112356 , p_override_seg_flag => 'Y'
112357 );
112358
112359 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
112360
112364 , p_from_segment_code => l_adr_value_segment_code
112361 xla_ae_lines_pkg.set_segment(
112362 p_to_segment_code => 'GL_ACCOUNT'
112363 , p_segment_value => l_segment
112365 , p_from_combination_id => l_adr_value_combination_id
112366 , p_value_type_code => l_adr_value_type_code
112367 , p_transaction_coa_id => l_adr_transaction_coa_id
112368 , p_accounting_coa_id => l_adr_accounting_coa_id
112369 , p_flexfield_segment_code => l_adr_flexfield_segment_code
112370 , p_flex_value_set_id => l_adr_flex_value_set_id
112371 , p_adr_code => 'FA_COST_OF_REMOVAL_CLR_SEGMENT'
112372 , p_adr_type_code => 'S'
112373 , p_component_type => l_component_type
112374 , p_component_code => l_component_code
112375 , p_component_type_code => l_component_type_code
112376 , p_component_appl_id => l_component_appl_id
112377 , p_amb_context_code => l_amb_context_code
112378 , p_entity_code => 'TRANSACTIONS'
112379 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
112380 , p_side => 'NA'
112381 );
112382
112383 END IF;
112384
112385 l_segment := AcctDerRule_169(
112386 p_application_id => p_application_id
112387 , p_ae_header_id => l_ae_header_id
112388 , p_source_5 => p_source_5
112389 , p_source_31 => p_source_31
112390 , x_transaction_coa_id => l_adr_transaction_coa_id
112391 , x_accounting_coa_id => l_adr_accounting_coa_id
112392 , x_flexfield_segment_code => l_adr_flexfield_segment_code
112393 , x_flex_value_set_id => l_adr_flex_value_set_id
112394 , x_value_type_code => l_adr_value_type_code
112395 , x_value_combination_id => l_adr_value_combination_id
112396 , x_value_segment_code => l_adr_value_segment_code
112397 , p_side => 'NA'
112398 , p_override_seg_flag => 'Y'
112399 );
112400
112401 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
112402
112403 xla_ae_lines_pkg.set_segment(
112404 p_to_segment_code => 'GL_BALANCING'
112405 , p_segment_value => l_segment
112406 , p_from_segment_code => l_adr_value_segment_code
112407 , p_from_combination_id => l_adr_value_combination_id
112408 , p_value_type_code => l_adr_value_type_code
112409 , p_transaction_coa_id => l_adr_transaction_coa_id
112410 , p_accounting_coa_id => l_adr_accounting_coa_id
112411 , p_flexfield_segment_code => l_adr_flexfield_segment_code
112412 , p_flex_value_set_id => l_adr_flex_value_set_id
112413 , p_adr_code => 'FA_EXPENSE_ACCT'
112414 , p_adr_type_code => 'S'
112415 , p_component_type => l_component_type
112416 , p_component_code => l_component_code
112417 , p_component_type_code => l_component_type_code
112418 , p_component_appl_id => l_component_appl_id
112419 , p_amb_context_code => l_amb_context_code
112420 , p_entity_code => 'TRANSACTIONS'
112421 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
112422 , p_side => 'NA'
112423 );
112424
112425 END IF;
112426
112427 --
112428 --
112429 END IF;
112430
112431 --
112432 -- Update the line information that should be overwritten
112433 --
112434 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
112435 p_header_num => 1);
112436 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
112437
112438 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
112439
112440 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
112441 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
112442 END IF;
112443
112444 --
112445 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
112446 --
112447 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
112448 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
112449 ELSE
112450 ---------------------------------------------------------------------------------------------------
112451 -- 4262811a Switch Sign
112452 ---------------------------------------------------------------------------------------------------
112453 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
112454 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
112455 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
112456 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
112457 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
112458 -- 5132302
112459 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
112460 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
112461
112465 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
112462 END IF;
112463
112464 -- 4955764
112466 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
112467
112468
112469 XLA_AE_LINES_PKG.ValidateCurrentLine;
112470 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
112471
112472 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
112473 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
112474 ,p_balance_type_code => l_balance_type_code);
112475
112476 END IF;
112477
112478 -----------------------------------------------------------------------------------------
112479 -- 4262811 Multiperiod Accounting
112480 -----------------------------------------------------------------------------------------
112481 -- No MPA option is assigned.
112482
112483
112484 END IF;
112485 END IF;
112486 --
112487
112488 --
112489 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
112490 trace
112491 (p_msg => 'END of AcctLineType_321'
112492 ,p_level => C_LEVEL_PROCEDURE
112493 ,p_module => l_log_module);
112494 END IF;
112495 --
112496 EXCEPTION
112497 WHEN xla_exceptions_pkg.application_exception THEN
112498 RAISE;
112499 WHEN OTHERS THEN
112500 xla_exceptions_pkg.raise_message
112501 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_321');
112502 END AcctLineType_321;
112503 --
112504
112505 ---------------------------------------
112506 --
112507 -- PRIVATE FUNCTION
112508 -- AcctLineType_322
112509 --
112510 ---------------------------------------
112511 PROCEDURE AcctLineType_322 (
112512 p_application_id IN NUMBER
112513 ,p_event_id IN NUMBER
112514 ,p_calculate_acctd_flag IN VARCHAR2
112515 ,p_calculate_g_l_flag IN VARCHAR2
112516 ,p_actual_flag IN OUT VARCHAR2
112517 ,p_balance_type_code OUT VARCHAR2
112518 ,p_gain_or_loss_ref OUT VARCHAR2
112519
112520 --Period Close Date
112521 , p_source_1 IN DATE
112522 --Generated Code Combination Identifier
112523 , p_source_5 IN NUMBER
112524 --Proceeds Of Sale Clearing Account
112525 , p_source_25 IN VARCHAR2
112526 --Expense Account Code Combination Identifier
112527 , p_source_31 IN NUMBER
112528 --Default Code Combination Identifier
112529 , p_source_32 IN NUMBER
112530 --Adjustment Type
112531 , p_source_48 IN VARCHAR2
112532 --Transaction Header Identifier
112533 , p_source_49 IN NUMBER
112534 --Adjustment Line Identifier
112535 , p_source_50 IN NUMBER
112536 --Distribution Type Code
112537 , p_source_51 IN VARCHAR2
112538 --Entered Amount
112539 , p_source_52 IN NUMBER
112540 --Currency Code
112541 , p_source_53 IN VARCHAR2
112542 )
112543 IS
112544
112545 l_component_type VARCHAR2(80);
112546 l_component_code VARCHAR2(30);
112547 l_component_type_code VARCHAR2(1);
112548 l_component_appl_id INTEGER;
112549 l_amb_context_code VARCHAR2(30);
112550 l_entity_code VARCHAR2(30);
112551 l_event_class_code VARCHAR2(30);
112552 l_ae_header_id NUMBER;
112553 l_event_type_code VARCHAR2(30);
112554 l_line_definition_code VARCHAR2(30);
112555 l_line_definition_owner_code VARCHAR2(1);
112556 --
112557 -- adr variables
112558 l_segment VARCHAR2(30);
112559 l_ccid NUMBER;
112560 l_adr_transaction_coa_id NUMBER;
112561 l_adr_accounting_coa_id NUMBER;
112562 l_adr_flexfield_segment_code VARCHAR2(30);
112563 l_adr_flex_value_set_id NUMBER;
112564 l_adr_value_type_code VARCHAR2(30);
112565 l_adr_value_combination_id NUMBER;
112566 l_adr_value_segment_code VARCHAR2(30);
112567
112568 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
112569 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
112570 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
112571 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
112572
112573 -- 4262811 Variables ------------------------------------------------------------------------------------------
112574 l_entered_amt_idx NUMBER;
112575 l_accted_amt_idx NUMBER;
112576 l_acc_rev_flag VARCHAR2(1);
112577 l_accrual_line_num NUMBER;
112578 l_tmp_amt NUMBER;
112579 l_acc_rev_natural_side_code VARCHAR2(1);
112580
112581 l_num_entries NUMBER;
112582 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
112583 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
112584 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
112585 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
112586 l_recog_line_1 NUMBER;
112587 l_recog_line_2 NUMBER;
112588
112589 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
112590 l_bflow_applied_to_amt NUMBER; -- 5132302
112591 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
112592
112596 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
112593 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
112594
112595 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
112597
112598 ---------------------------------------------------------------------------------------------------------------
112599
112600
112601 --
112602 -- bulk performance
112603 --
112604 l_balance_type_code VARCHAR2(1);
112605 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
112606 l_log_module VARCHAR2(240);
112607
112608 --
112609 -- Upgrade strategy
112610 --
112611 l_actual_upg_option VARCHAR2(1);
112612 l_enc_upg_option VARCHAR2(1);
112613
112614 --
112615 BEGIN
112616 --
112617 IF g_log_enabled THEN
112618 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_322';
112619 END IF;
112620 --
112621 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
112622
112623 trace
112624 (p_msg => 'BEGIN of AcctLineType_322'
112625 ,p_level => C_LEVEL_PROCEDURE
112626 ,p_module => l_log_module);
112627
112628 END IF;
112629 --
112630 l_component_type := 'AMB_JLT';
112631 l_component_code := 'FA_RET_ADJ_PROC_SALE_CLR';
112632 l_component_type_code := 'S';
112633 l_component_appl_id := 140;
112634 l_amb_context_code := 'DEFAULT';
112635 l_entity_code := 'TRANSACTIONS';
112636 l_event_class_code := 'RETIREMENT_ADJUSTMENTS';
112637 l_event_type_code := 'RETIREMENT_ADJUSTMENTS_ALL';
112638 l_line_definition_owner_code := 'S';
112639 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR20';
112640 --
112641 l_balance_type_code := 'A';
112642 l_segment := NULL;
112643 l_ccid := NULL;
112644 l_adr_transaction_coa_id := NULL;
112645 l_adr_accounting_coa_id := NULL;
112646 l_adr_flexfield_segment_code := NULL;
112647 l_adr_flex_value_set_id := NULL;
112648 l_adr_value_type_code := NULL;
112649 l_adr_value_combination_id := NULL;
112650 l_adr_value_segment_code := NULL;
112651
112652 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
112653 l_bflow_class_code := ''; -- 4219869 Business Flow
112654 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
112655 l_budgetary_control_flag := 'N';
112656
112657 l_bflow_applied_to_amt_idx := NULL; -- 5132302
112658 l_bflow_applied_to_amt := NULL; -- 5132302
112659 l_entered_amt_idx := NULL; -- 4262811
112660 l_accted_amt_idx := NULL; -- 4262811
112661 l_acc_rev_flag := NULL; -- 4262811
112662 l_accrual_line_num := NULL; -- 4262811
112663 l_tmp_amt := NULL; -- 4262811
112664 --
112665
112666 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
112667 l_balance_type_code <> 'B' THEN
112668 IF NVL(p_source_48,'
112669 ') = 'PROCEEDS'
112670 THEN
112671
112672 --
112673 XLA_AE_LINES_PKG.SetNewLine;
112674
112675 p_balance_type_code := l_balance_type_code;
112676 -- set the flag so later we will know whether the gain loss line needs to be created
112677
112678 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
112679 p_actual_flag :='A';
112680 END IF;
112681
112682 --
112683 -- bulk performance
112684 --
112685 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
112686 p_header_num => 0); -- 4262811
112687 --
112688 -- set accounting line options
112689 --
112690 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
112691 p_natural_side_code => 'D'
112692 , p_gain_or_loss_flag => 'N'
112693 , p_gl_transfer_mode_code => 'S'
112694 , p_acct_entry_type_code => 'A'
112695 , p_switch_side_flag => 'Y'
112696 , p_merge_duplicate_code => 'N'
112697 );
112698 --
112699 l_acc_rev_natural_side_code := 'C'; -- 4262811
112700 --
112701 --
112702 -- set accounting line type info
112703 --
112704 xla_ae_lines_pkg.SetAcctLineType
112705 (p_component_type => l_component_type
112706 ,p_event_type_code => l_event_type_code
112707 ,p_line_definition_owner_code => l_line_definition_owner_code
112708 ,p_line_definition_code => l_line_definition_code
112709 ,p_accounting_line_code => l_component_code
112710 ,p_accounting_line_type_code => l_component_type_code
112711 ,p_accounting_line_appl_id => l_component_appl_id
112712 ,p_amb_context_code => l_amb_context_code
112713 ,p_entity_code => l_entity_code
112714 ,p_event_class_code => l_event_class_code);
112715 --
112716 -- set accounting class
112717 --
112718 xla_ae_lines_pkg.SetAcctClass(
112719 p_accounting_class_code => 'ASSET'
112720 , p_ae_header_id => l_ae_header_id
112721 );
112722
112723 --
112724 -- set rounding class
112725 --
112726 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
112730 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
112727 'ASSET';
112728
112729 --
112731 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
112732 --
112733 -- bulk performance
112734 --
112735 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
112736
112737 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
112738 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
112739
112740 -- 4955764
112741 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
112742 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
112743
112744 -- 4458381 Public Sector Enh
112745
112746 --
112747 -- set accounting attributes for the line type
112748 --
112749 l_entered_amt_idx := 4;
112750 l_accted_amt_idx := 6;
112751 l_bflow_applied_to_amt_idx := NULL; -- 5132302
112752 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
112753 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
112754 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
112755 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
112756 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
112757 l_rec_acct_attrs.array_char_value(3) := p_source_51;
112758 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
112759 l_rec_acct_attrs.array_num_value(4) := p_source_52;
112760 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
112761 l_rec_acct_attrs.array_char_value(5) := p_source_53;
112762 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
112763 l_rec_acct_attrs.array_num_value(6) := p_source_52;
112764
112765 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
112766 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
112767
112768 ---------------------------------------------------------------------------------------------------------------
112769 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
112770 ---------------------------------------------------------------------------------------------------------------
112771 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
112772
112773 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
112774 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
112775
112776 IF xla_accounting_cache_pkg.GetValueChar
112777 (p_source_code => 'LEDGER_CATEGORY_CODE'
112778 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
112779 AND l_bflow_method_code = 'PRIOR_ENTRY'
112780 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
112781 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
112782 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
112783 )
112784 THEN
112785 xla_ae_lines_pkg.BflowUpgEntry
112786 (p_business_method_code => l_bflow_method_code
112787 ,p_business_class_code => l_bflow_class_code
112788 ,p_balance_type => l_balance_type_code);
112789 ELSE
112790 NULL;
112791 -- No business flow processing for business flow method of NONE.
112792 END IF;
112793
112794 --
112795 -- call analytical criteria
112796 --
112797
112798 --
112799 -- call description
112800 --
112801
112802 xla_ae_lines_pkg.SetLineDescription(
112803 p_ae_header_id => l_ae_header_id
112804 ,p_description => Description_88 (
112805 p_application_id => p_application_id
112806 , p_ae_header_id => l_ae_header_id
112807 , p_source_1 => p_source_1
112808 )
112809 );
112810
112811
112812 --
112813 -- call ADRs
112814 -- Bug 4922099
112815 --
112816 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
112817 (NVL(l_actual_upg_option, 'N') = 'O') OR
112818 (NVL(l_enc_upg_option, 'N') = 'O')
112819 )
112820 THEN
112821 NULL;
112822 --
112823 --
112824
112825 l_ccid := AcctDerRule_174(
112826 p_application_id => p_application_id
112827 , p_ae_header_id => l_ae_header_id
112828 , p_source_5 => p_source_5
112829 , p_source_32 => p_source_32
112830 , x_transaction_coa_id => l_adr_transaction_coa_id
112831 , x_accounting_coa_id => l_adr_accounting_coa_id
112832 , x_value_type_code => l_adr_value_type_code
112833 , p_side => 'NA'
112834 );
112835
112836 xla_ae_lines_pkg.set_ccid(
112837 p_code_combination_id => l_ccid
112838 , p_value_type_code => l_adr_value_type_code
112839 , p_transaction_coa_id => l_adr_transaction_coa_id
112840 , p_accounting_coa_id => l_adr_accounting_coa_id
112841 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
112842 , p_adr_type_code => 'S'
112843 , p_component_type => l_component_type
112844 , p_component_code => l_component_code
112845 , p_component_type_code => l_component_type_code
112849 );
112846 , p_component_appl_id => l_component_appl_id
112847 , p_amb_context_code => l_amb_context_code
112848 , p_side => 'NA'
112850
112851
112852 l_segment := AcctDerRule_169(
112853 p_application_id => p_application_id
112854 , p_ae_header_id => l_ae_header_id
112855 , p_source_5 => p_source_5
112856 , p_source_31 => p_source_31
112857 , x_transaction_coa_id => l_adr_transaction_coa_id
112858 , x_accounting_coa_id => l_adr_accounting_coa_id
112859 , x_flexfield_segment_code => l_adr_flexfield_segment_code
112860 , x_flex_value_set_id => l_adr_flex_value_set_id
112861 , x_value_type_code => l_adr_value_type_code
112862 , x_value_combination_id => l_adr_value_combination_id
112863 , x_value_segment_code => l_adr_value_segment_code
112864 , p_side => 'NA'
112865 , p_override_seg_flag => 'Y'
112866 );
112867
112868 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
112869
112870 xla_ae_lines_pkg.set_segment(
112871 p_to_segment_code => 'GL_BALANCING'
112872 , p_segment_value => l_segment
112873 , p_from_segment_code => l_adr_value_segment_code
112874 , p_from_combination_id => l_adr_value_combination_id
112875 , p_value_type_code => l_adr_value_type_code
112876 , p_transaction_coa_id => l_adr_transaction_coa_id
112877 , p_accounting_coa_id => l_adr_accounting_coa_id
112878 , p_flexfield_segment_code => l_adr_flexfield_segment_code
112879 , p_flex_value_set_id => l_adr_flex_value_set_id
112880 , p_adr_code => 'FA_EXPENSE_ACCT'
112881 , p_adr_type_code => 'S'
112882 , p_component_type => l_component_type
112883 , p_component_code => l_component_code
112884 , p_component_type_code => l_component_type_code
112885 , p_component_appl_id => l_component_appl_id
112886 , p_amb_context_code => l_amb_context_code
112887 , p_entity_code => 'TRANSACTIONS'
112888 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
112889 , p_side => 'NA'
112890 );
112891
112892 END IF;
112893
112894 l_segment := AcctDerRule_162(
112895 p_application_id => p_application_id
112896 , p_ae_header_id => l_ae_header_id
112897 , p_source_5 => p_source_5
112898 , p_source_25 => p_source_25
112899 , x_transaction_coa_id => l_adr_transaction_coa_id
112900 , x_accounting_coa_id => l_adr_accounting_coa_id
112901 , x_flexfield_segment_code => l_adr_flexfield_segment_code
112902 , x_flex_value_set_id => l_adr_flex_value_set_id
112903 , x_value_type_code => l_adr_value_type_code
112904 , x_value_combination_id => l_adr_value_combination_id
112905 , x_value_segment_code => l_adr_value_segment_code
112906 , p_side => 'NA'
112907 , p_override_seg_flag => 'Y'
112908 );
112909
112910 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
112911
112912 xla_ae_lines_pkg.set_segment(
112913 p_to_segment_code => 'GL_ACCOUNT'
112914 , p_segment_value => l_segment
112915 , p_from_segment_code => l_adr_value_segment_code
112916 , p_from_combination_id => l_adr_value_combination_id
112917 , p_value_type_code => l_adr_value_type_code
112918 , p_transaction_coa_id => l_adr_transaction_coa_id
112919 , p_accounting_coa_id => l_adr_accounting_coa_id
112920 , p_flexfield_segment_code => l_adr_flexfield_segment_code
112921 , p_flex_value_set_id => l_adr_flex_value_set_id
112922 , p_adr_code => 'FA_PROC_OF_SALE_CLR_SEGMENT'
112923 , p_adr_type_code => 'S'
112924 , p_component_type => l_component_type
112925 , p_component_code => l_component_code
112926 , p_component_type_code => l_component_type_code
112927 , p_component_appl_id => l_component_appl_id
112928 , p_amb_context_code => l_amb_context_code
112929 , p_entity_code => 'TRANSACTIONS'
112930 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
112931 , p_side => 'NA'
112932 );
112933
112934 END IF;
112935
112936 --
112937 --
112938 END IF;
112939 --
112940 -- Bug 4922099
112941 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
112942 (NVL(l_enc_upg_option, 'N') = 'O')
112943 ) AND
112944 (l_bflow_method_code = 'PRIOR_ENTRY')
112945 )
112946 THEN
112947 IF
112948 --
112949 1 = 2
112950 --
112951 THEN
112952 xla_accounting_err_pkg.build_message
112953 (p_appli_s_name => 'XLA'
112954 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
112955 ,p_token_1 => 'LINE_NUMBER'
112956 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
112957 ,p_token_2 => 'LINE_TYPE_NAME'
112961 ,l_component_type_code
112958 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
112959 l_component_type
112960 ,l_component_code
112962 ,l_component_appl_id
112963 ,l_amb_context_code
112964 ,l_entity_code
112965 ,l_event_class_code
112966 )
112967 ,p_token_3 => 'OWNER'
112968 ,p_value_3 => xla_lookups_pkg.get_meaning(
112969 p_lookup_type => 'XLA_OWNER_TYPE'
112970 ,p_lookup_code => l_component_type_code
112971 )
112972 ,p_token_4 => 'PRODUCT_NAME'
112973 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
112974 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
112975 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
112976 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
112977 ,p_ae_header_id => NULL
112978 );
112979
112980 IF (C_LEVEL_ERROR>= g_log_level) THEN
112981 trace
112982 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
112983 ,p_level => C_LEVEL_ERROR
112984 ,p_module => l_log_module);
112985 END IF;
112986 END IF;
112987 END IF;
112988 --
112989 --
112990 ------------------------------------------------------------------------------------------------
112991 -- 4219869 Business Flow
112992 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
112993 -- Prior Entry. Currently, the following code is always generated.
112994 ------------------------------------------------------------------------------------------------
112995 XLA_AE_LINES_PKG.ValidateCurrentLine;
112996
112997 ------------------------------------------------------------------------------------
112998 -- 4219869 Business Flow
112999 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
113000 ------------------------------------------------------------------------------------
113001 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
113002
113003 ----------------------------------------------------------------------------------
113004 -- 4219869 Business Flow
113005 -- Update journal entry status -- Need to generate this within IF <condition>
113006 ----------------------------------------------------------------------------------
113007 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
113008 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
113009 ,p_balance_type_code => l_balance_type_code
113010 );
113011
113012 -------------------------------------------------------------------------------------------
113013 -- 4262811 - Generate the Accrual Reversal lines
113014 -------------------------------------------------------------------------------------------
113015 BEGIN
113016 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
113017 (g_array_event(p_event_id).array_value_num('header_index'));
113018 IF l_acc_rev_flag IS NULL THEN
113019 l_acc_rev_flag := 'N';
113020 END IF;
113021 EXCEPTION
113022 WHEN OTHERS THEN
113023 l_acc_rev_flag := 'N';
113024 END;
113025 --
113026 IF (l_acc_rev_flag = 'Y') THEN
113027
113028 -- 4645092 ------------------------------------------------------------------------------
113029 -- To allow MPA report to determine if it should generate report process
113030 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
113031 ------------------------------------------------------------------------------------------
113032
113033 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
113034 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
113035 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
113036 -- call ADRs
113037 -- Bug 4922099
113038 --
113039 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
113040 (NVL(l_actual_upg_option, 'N') = 'O') OR
113041 (NVL(l_enc_upg_option, 'N') = 'O')
113042 )
113043 THEN
113044 NULL;
113045 --
113046 --
113047
113048 l_ccid := AcctDerRule_174(
113049 p_application_id => p_application_id
113050 , p_ae_header_id => l_ae_header_id
113051 , p_source_5 => p_source_5
113052 , p_source_32 => p_source_32
113053 , x_transaction_coa_id => l_adr_transaction_coa_id
113057 );
113054 , x_accounting_coa_id => l_adr_accounting_coa_id
113055 , x_value_type_code => l_adr_value_type_code
113056 , p_side => 'NA'
113058
113059 xla_ae_lines_pkg.set_ccid(
113060 p_code_combination_id => l_ccid
113061 , p_value_type_code => l_adr_value_type_code
113062 , p_transaction_coa_id => l_adr_transaction_coa_id
113063 , p_accounting_coa_id => l_adr_accounting_coa_id
113064 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
113065 , p_adr_type_code => 'S'
113066 , p_component_type => l_component_type
113067 , p_component_code => l_component_code
113068 , p_component_type_code => l_component_type_code
113069 , p_component_appl_id => l_component_appl_id
113070 , p_amb_context_code => l_amb_context_code
113071 , p_side => 'NA'
113072 );
113073
113074
113075 l_segment := AcctDerRule_169(
113076 p_application_id => p_application_id
113077 , p_ae_header_id => l_ae_header_id
113078 , p_source_5 => p_source_5
113079 , p_source_31 => p_source_31
113080 , x_transaction_coa_id => l_adr_transaction_coa_id
113081 , x_accounting_coa_id => l_adr_accounting_coa_id
113082 , x_flexfield_segment_code => l_adr_flexfield_segment_code
113083 , x_flex_value_set_id => l_adr_flex_value_set_id
113084 , x_value_type_code => l_adr_value_type_code
113085 , x_value_combination_id => l_adr_value_combination_id
113086 , x_value_segment_code => l_adr_value_segment_code
113087 , p_side => 'NA'
113088 , p_override_seg_flag => 'Y'
113089 );
113090
113091 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
113092
113093 xla_ae_lines_pkg.set_segment(
113094 p_to_segment_code => 'GL_BALANCING'
113095 , p_segment_value => l_segment
113096 , p_from_segment_code => l_adr_value_segment_code
113097 , p_from_combination_id => l_adr_value_combination_id
113098 , p_value_type_code => l_adr_value_type_code
113099 , p_transaction_coa_id => l_adr_transaction_coa_id
113100 , p_accounting_coa_id => l_adr_accounting_coa_id
113101 , p_flexfield_segment_code => l_adr_flexfield_segment_code
113102 , p_flex_value_set_id => l_adr_flex_value_set_id
113103 , p_adr_code => 'FA_EXPENSE_ACCT'
113104 , p_adr_type_code => 'S'
113105 , p_component_type => l_component_type
113106 , p_component_code => l_component_code
113107 , p_component_type_code => l_component_type_code
113108 , p_component_appl_id => l_component_appl_id
113109 , p_amb_context_code => l_amb_context_code
113110 , p_entity_code => 'TRANSACTIONS'
113111 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
113112 , p_side => 'NA'
113113 );
113114
113115 END IF;
113116
113117 l_segment := AcctDerRule_162(
113118 p_application_id => p_application_id
113119 , p_ae_header_id => l_ae_header_id
113120 , p_source_5 => p_source_5
113121 , p_source_25 => p_source_25
113122 , x_transaction_coa_id => l_adr_transaction_coa_id
113123 , x_accounting_coa_id => l_adr_accounting_coa_id
113124 , x_flexfield_segment_code => l_adr_flexfield_segment_code
113125 , x_flex_value_set_id => l_adr_flex_value_set_id
113126 , x_value_type_code => l_adr_value_type_code
113127 , x_value_combination_id => l_adr_value_combination_id
113128 , x_value_segment_code => l_adr_value_segment_code
113129 , p_side => 'NA'
113130 , p_override_seg_flag => 'Y'
113131 );
113132
113133 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
113134
113135 xla_ae_lines_pkg.set_segment(
113136 p_to_segment_code => 'GL_ACCOUNT'
113137 , p_segment_value => l_segment
113138 , p_from_segment_code => l_adr_value_segment_code
113139 , p_from_combination_id => l_adr_value_combination_id
113140 , p_value_type_code => l_adr_value_type_code
113141 , p_transaction_coa_id => l_adr_transaction_coa_id
113142 , p_accounting_coa_id => l_adr_accounting_coa_id
113143 , p_flexfield_segment_code => l_adr_flexfield_segment_code
113144 , p_flex_value_set_id => l_adr_flex_value_set_id
113145 , p_adr_code => 'FA_PROC_OF_SALE_CLR_SEGMENT'
113146 , p_adr_type_code => 'S'
113147 , p_component_type => l_component_type
113148 , p_component_code => l_component_code
113149 , p_component_type_code => l_component_type_code
113150 , p_component_appl_id => l_component_appl_id
113151 , p_amb_context_code => l_amb_context_code
113152 , p_entity_code => 'TRANSACTIONS'
113153 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
113154 , p_side => 'NA'
113155 );
113156
113157 END IF;
113158
113159 --
113160 --
113161 END IF;
113162
113163 --
113167 p_header_num => 1);
113164 -- Update the line information that should be overwritten
113165 --
113166 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
113168 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
113169
113170 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
113171
113172 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
113173 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
113174 END IF;
113175
113176 --
113177 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
113178 --
113179 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
113180 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
113181 ELSE
113182 ---------------------------------------------------------------------------------------------------
113183 -- 4262811a Switch Sign
113184 ---------------------------------------------------------------------------------------------------
113185 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
113186 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
113187 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
113188 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
113189 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
113190 -- 5132302
113191 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
113192 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
113193
113194 END IF;
113195
113196 -- 4955764
113197 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
113198 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
113199
113200
113201 XLA_AE_LINES_PKG.ValidateCurrentLine;
113202 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
113203
113204 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
113205 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
113206 ,p_balance_type_code => l_balance_type_code);
113207
113208 END IF;
113209
113210 -----------------------------------------------------------------------------------------
113211 -- 4262811 Multiperiod Accounting
113212 -----------------------------------------------------------------------------------------
113213 -- No MPA option is assigned.
113214
113215
113216 END IF;
113217 END IF;
113218 --
113219
113220 --
113221 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
113222 trace
113223 (p_msg => 'END of AcctLineType_322'
113224 ,p_level => C_LEVEL_PROCEDURE
113225 ,p_module => l_log_module);
113226 END IF;
113227 --
113228 EXCEPTION
113229 WHEN xla_exceptions_pkg.application_exception THEN
113230 RAISE;
113231 WHEN OTHERS THEN
113232 xla_exceptions_pkg.raise_message
113233 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_322');
113234 END AcctLineType_322;
113235 --
113236
113237 ---------------------------------------
113238 --
113239 -- PRIVATE FUNCTION
113240 -- AcctLineType_323
113241 --
113242 ---------------------------------------
113243 PROCEDURE AcctLineType_323 (
113244 p_application_id IN NUMBER
113245 ,p_event_id IN NUMBER
113246 ,p_calculate_acctd_flag IN VARCHAR2
113247 ,p_calculate_g_l_flag IN VARCHAR2
113248 ,p_actual_flag IN OUT VARCHAR2
113249 ,p_balance_type_code OUT VARCHAR2
113250 ,p_gain_or_loss_ref OUT VARCHAR2
113251
113252 --Period Close Date
113253 , p_source_1 IN DATE
113254 --Generated Code Combination Identifier
113255 , p_source_5 IN NUMBER
113256 --Depreciation Reserve Account
113257 , p_source_12 IN VARCHAR2
113258 --Generated Offset Code Combination Identifier
113259 , p_source_19 IN NUMBER
113260 --Expense Account Code Combination Identifier
113261 , p_source_31 IN NUMBER
113262 --Default Code Combination Identifier
113263 , p_source_32 IN NUMBER
113264 --Adjustment Type
113265 , p_source_48 IN VARCHAR2
113266 --Transaction Header Identifier
113267 , p_source_49 IN NUMBER
113268 --Adjustment Line Identifier
113269 , p_source_50 IN NUMBER
113270 --Distribution Type Code
113271 , p_source_51 IN VARCHAR2
113272 --Entered Amount
113273 , p_source_52 IN NUMBER
113274 --Currency Code
113275 , p_source_53 IN VARCHAR2
113276 )
113277 IS
113278
113279 l_component_type VARCHAR2(80);
113280 l_component_code VARCHAR2(30);
113281 l_component_type_code VARCHAR2(1);
113282 l_component_appl_id INTEGER;
113283 l_amb_context_code VARCHAR2(30);
113284 l_entity_code VARCHAR2(30);
113285 l_event_class_code VARCHAR2(30);
113286 l_ae_header_id NUMBER;
113290 --
113287 l_event_type_code VARCHAR2(30);
113288 l_line_definition_code VARCHAR2(30);
113289 l_line_definition_owner_code VARCHAR2(1);
113291 -- adr variables
113292 l_segment VARCHAR2(30);
113293 l_ccid NUMBER;
113294 l_adr_transaction_coa_id NUMBER;
113295 l_adr_accounting_coa_id NUMBER;
113296 l_adr_flexfield_segment_code VARCHAR2(30);
113297 l_adr_flex_value_set_id NUMBER;
113298 l_adr_value_type_code VARCHAR2(30);
113299 l_adr_value_combination_id NUMBER;
113300 l_adr_value_segment_code VARCHAR2(30);
113301
113302 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
113303 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
113304 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
113305 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
113306
113307 -- 4262811 Variables ------------------------------------------------------------------------------------------
113308 l_entered_amt_idx NUMBER;
113309 l_accted_amt_idx NUMBER;
113310 l_acc_rev_flag VARCHAR2(1);
113311 l_accrual_line_num NUMBER;
113312 l_tmp_amt NUMBER;
113313 l_acc_rev_natural_side_code VARCHAR2(1);
113314
113315 l_num_entries NUMBER;
113316 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
113317 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
113318 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
113319 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
113320 l_recog_line_1 NUMBER;
113321 l_recog_line_2 NUMBER;
113322
113323 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
113324 l_bflow_applied_to_amt NUMBER; -- 5132302
113325 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
113326
113327 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
113328
113329 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
113330 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
113331
113332 ---------------------------------------------------------------------------------------------------------------
113333
113334
113335 --
113336 -- bulk performance
113337 --
113338 l_balance_type_code VARCHAR2(1);
113339 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
113340 l_log_module VARCHAR2(240);
113341
113342 --
113343 -- Upgrade strategy
113344 --
113345 l_actual_upg_option VARCHAR2(1);
113346 l_enc_upg_option VARCHAR2(1);
113347
113348 --
113349 BEGIN
113350 --
113351 IF g_log_enabled THEN
113352 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_323';
113353 END IF;
113354 --
113355 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
113356
113357 trace
113358 (p_msg => 'BEGIN of AcctLineType_323'
113359 ,p_level => C_LEVEL_PROCEDURE
113360 ,p_module => l_log_module);
113361
113362 END IF;
113363 --
113364 l_component_type := 'AMB_JLT';
113365 l_component_code := 'FA_RET_ADJ_RES';
113366 l_component_type_code := 'S';
113367 l_component_appl_id := 140;
113368 l_amb_context_code := 'DEFAULT';
113369 l_entity_code := 'TRANSACTIONS';
113370 l_event_class_code := 'RETIREMENT_ADJUSTMENTS';
113371 l_event_type_code := 'RETIREMENT_ADJUSTMENTS_ALL';
113372 l_line_definition_owner_code := 'S';
113373 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR20';
113374 --
113375 l_balance_type_code := 'A';
113376 l_segment := NULL;
113377 l_ccid := NULL;
113378 l_adr_transaction_coa_id := NULL;
113379 l_adr_accounting_coa_id := NULL;
113380 l_adr_flexfield_segment_code := NULL;
113381 l_adr_flex_value_set_id := NULL;
113382 l_adr_value_type_code := NULL;
113383 l_adr_value_combination_id := NULL;
113384 l_adr_value_segment_code := NULL;
113385
113386 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
113387 l_bflow_class_code := ''; -- 4219869 Business Flow
113388 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
113389 l_budgetary_control_flag := 'N';
113390
113391 l_bflow_applied_to_amt_idx := NULL; -- 5132302
113392 l_bflow_applied_to_amt := NULL; -- 5132302
113393 l_entered_amt_idx := NULL; -- 4262811
113394 l_accted_amt_idx := NULL; -- 4262811
113395 l_acc_rev_flag := NULL; -- 4262811
113396 l_accrual_line_num := NULL; -- 4262811
113397 l_tmp_amt := NULL; -- 4262811
113398 --
113399
113400 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
113401 l_balance_type_code <> 'B' THEN
113402 IF NVL(p_source_48,'
113403 ') = 'RESERVE'
113404 THEN
113405
113406 --
113407 XLA_AE_LINES_PKG.SetNewLine;
113408
113409 p_balance_type_code := l_balance_type_code;
113410 -- set the flag so later we will know whether the gain loss line needs to be created
113411
113412 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
113413 p_actual_flag :='A';
113414 END IF;
113415
113416 --
113420 p_header_num => 0); -- 4262811
113417 -- bulk performance
113418 --
113419 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
113421 --
113422 -- set accounting line options
113423 --
113424 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
113425 p_natural_side_code => 'C'
113426 , p_gain_or_loss_flag => 'N'
113427 , p_gl_transfer_mode_code => 'S'
113428 , p_acct_entry_type_code => 'A'
113429 , p_switch_side_flag => 'Y'
113430 , p_merge_duplicate_code => 'N'
113431 );
113432 --
113433 l_acc_rev_natural_side_code := 'D'; -- 4262811
113434 --
113435 --
113436 -- set accounting line type info
113437 --
113438 xla_ae_lines_pkg.SetAcctLineType
113439 (p_component_type => l_component_type
113440 ,p_event_type_code => l_event_type_code
113441 ,p_line_definition_owner_code => l_line_definition_owner_code
113442 ,p_line_definition_code => l_line_definition_code
113443 ,p_accounting_line_code => l_component_code
113444 ,p_accounting_line_type_code => l_component_type_code
113445 ,p_accounting_line_appl_id => l_component_appl_id
113446 ,p_amb_context_code => l_amb_context_code
113447 ,p_entity_code => l_entity_code
113448 ,p_event_class_code => l_event_class_code);
113449 --
113450 -- set accounting class
113451 --
113452 xla_ae_lines_pkg.SetAcctClass(
113453 p_accounting_class_code => 'ASSET'
113454 , p_ae_header_id => l_ae_header_id
113455 );
113456
113457 --
113458 -- set rounding class
113459 --
113460 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
113461 'ASSET';
113462
113463 --
113464 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
113465 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
113466 --
113467 -- bulk performance
113468 --
113469 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
113470
113471 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
113472 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
113473
113474 -- 4955764
113475 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
113476 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
113477
113478 -- 4458381 Public Sector Enh
113479
113480 --
113481 -- set accounting attributes for the line type
113482 --
113483 l_entered_amt_idx := 4;
113484 l_accted_amt_idx := 6;
113485 l_bflow_applied_to_amt_idx := NULL; -- 5132302
113486 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
113487 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
113488 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
113489 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
113490 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
113491 l_rec_acct_attrs.array_char_value(3) := p_source_51;
113492 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
113493 l_rec_acct_attrs.array_num_value(4) := p_source_52;
113494 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
113495 l_rec_acct_attrs.array_char_value(5) := p_source_53;
113496 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
113497 l_rec_acct_attrs.array_num_value(6) := p_source_52;
113498
113499 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
113500 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
113501
113502 ---------------------------------------------------------------------------------------------------------------
113503 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
113504 ---------------------------------------------------------------------------------------------------------------
113505 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
113506
113507 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
113508 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
113509
113510 IF xla_accounting_cache_pkg.GetValueChar
113511 (p_source_code => 'LEDGER_CATEGORY_CODE'
113512 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
113513 AND l_bflow_method_code = 'PRIOR_ENTRY'
113514 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
113515 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
113516 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
113517 )
113518 THEN
113519 xla_ae_lines_pkg.BflowUpgEntry
113520 (p_business_method_code => l_bflow_method_code
113521 ,p_business_class_code => l_bflow_class_code
113522 ,p_balance_type => l_balance_type_code);
113523 ELSE
113524 NULL;
113525 -- No business flow processing for business flow method of NONE.
113526 END IF;
113527
113531
113528 --
113529 -- call analytical criteria
113530 --
113532 --
113533 -- call description
113534 --
113535
113536 xla_ae_lines_pkg.SetLineDescription(
113537 p_ae_header_id => l_ae_header_id
113538 ,p_description => Description_86 (
113539 p_application_id => p_application_id
113540 , p_ae_header_id => l_ae_header_id
113541 , p_source_1 => p_source_1
113542 )
113543 );
113544
113545
113546 --
113547 -- call ADRs
113548 -- Bug 4922099
113549 --
113550 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
113551 (NVL(l_actual_upg_option, 'N') = 'O') OR
113552 (NVL(l_enc_upg_option, 'N') = 'O')
113553 )
113554 THEN
113555 NULL;
113556 --
113557 --
113558
113559 l_ccid := AcctDerRule_175(
113560 p_application_id => p_application_id
113561 , p_ae_header_id => l_ae_header_id
113562 , p_source_5 => p_source_5
113563 , p_source_19 => p_source_19
113564 , p_source_32 => p_source_32
113565 , x_transaction_coa_id => l_adr_transaction_coa_id
113566 , x_accounting_coa_id => l_adr_accounting_coa_id
113567 , x_value_type_code => l_adr_value_type_code
113568 , p_side => 'NA'
113569 );
113570
113571 xla_ae_lines_pkg.set_ccid(
113572 p_code_combination_id => l_ccid
113573 , p_value_type_code => l_adr_value_type_code
113574 , p_transaction_coa_id => l_adr_transaction_coa_id
113575 , p_accounting_coa_id => l_adr_accounting_coa_id
113576 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
113577 , p_adr_type_code => 'S'
113578 , p_component_type => l_component_type
113579 , p_component_code => l_component_code
113580 , p_component_type_code => l_component_type_code
113581 , p_component_appl_id => l_component_appl_id
113582 , p_amb_context_code => l_amb_context_code
113583 , p_side => 'NA'
113584 );
113585
113586
113587 l_segment := AcctDerRule_150(
113588 p_application_id => p_application_id
113589 , p_ae_header_id => l_ae_header_id
113590 , p_source_5 => p_source_5
113591 , p_source_12 => p_source_12
113592 , x_transaction_coa_id => l_adr_transaction_coa_id
113593 , x_accounting_coa_id => l_adr_accounting_coa_id
113594 , x_flexfield_segment_code => l_adr_flexfield_segment_code
113595 , x_flex_value_set_id => l_adr_flex_value_set_id
113596 , x_value_type_code => l_adr_value_type_code
113597 , x_value_combination_id => l_adr_value_combination_id
113598 , x_value_segment_code => l_adr_value_segment_code
113599 , p_side => 'NA'
113600 , p_override_seg_flag => 'Y'
113601 );
113602
113603 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
113604
113605 xla_ae_lines_pkg.set_segment(
113606 p_to_segment_code => 'GL_ACCOUNT'
113607 , p_segment_value => l_segment
113608 , p_from_segment_code => l_adr_value_segment_code
113609 , p_from_combination_id => l_adr_value_combination_id
113610 , p_value_type_code => l_adr_value_type_code
113611 , p_transaction_coa_id => l_adr_transaction_coa_id
113612 , p_accounting_coa_id => l_adr_accounting_coa_id
113613 , p_flexfield_segment_code => l_adr_flexfield_segment_code
113614 , p_flex_value_set_id => l_adr_flex_value_set_id
113615 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
113616 , p_adr_type_code => 'S'
113617 , p_component_type => l_component_type
113618 , p_component_code => l_component_code
113619 , p_component_type_code => l_component_type_code
113620 , p_component_appl_id => l_component_appl_id
113621 , p_amb_context_code => l_amb_context_code
113622 , p_entity_code => 'TRANSACTIONS'
113623 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
113624 , p_side => 'NA'
113625 );
113626
113627 END IF;
113628
113629 l_segment := AcctDerRule_169(
113630 p_application_id => p_application_id
113631 , p_ae_header_id => l_ae_header_id
113632 , p_source_5 => p_source_5
113633 , p_source_31 => p_source_31
113634 , x_transaction_coa_id => l_adr_transaction_coa_id
113635 , x_accounting_coa_id => l_adr_accounting_coa_id
113636 , x_flexfield_segment_code => l_adr_flexfield_segment_code
113637 , x_flex_value_set_id => l_adr_flex_value_set_id
113638 , x_value_type_code => l_adr_value_type_code
113639 , x_value_combination_id => l_adr_value_combination_id
113640 , x_value_segment_code => l_adr_value_segment_code
113641 , p_side => 'NA'
113642 , p_override_seg_flag => 'Y'
113643 );
113644
113645 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
113646
113647 xla_ae_lines_pkg.set_segment(
113648 p_to_segment_code => 'GL_BALANCING'
113649 , p_segment_value => l_segment
113653 , p_transaction_coa_id => l_adr_transaction_coa_id
113650 , p_from_segment_code => l_adr_value_segment_code
113651 , p_from_combination_id => l_adr_value_combination_id
113652 , p_value_type_code => l_adr_value_type_code
113654 , p_accounting_coa_id => l_adr_accounting_coa_id
113655 , p_flexfield_segment_code => l_adr_flexfield_segment_code
113656 , p_flex_value_set_id => l_adr_flex_value_set_id
113657 , p_adr_code => 'FA_EXPENSE_ACCT'
113658 , p_adr_type_code => 'S'
113659 , p_component_type => l_component_type
113660 , p_component_code => l_component_code
113661 , p_component_type_code => l_component_type_code
113662 , p_component_appl_id => l_component_appl_id
113663 , p_amb_context_code => l_amb_context_code
113664 , p_entity_code => 'TRANSACTIONS'
113665 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
113666 , p_side => 'NA'
113667 );
113668
113669 END IF;
113670
113671 --
113672 --
113673 END IF;
113674 --
113675 -- Bug 4922099
113676 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
113677 (NVL(l_enc_upg_option, 'N') = 'O')
113678 ) AND
113679 (l_bflow_method_code = 'PRIOR_ENTRY')
113680 )
113681 THEN
113682 IF
113683 --
113684 1 = 2
113685 --
113686 THEN
113687 xla_accounting_err_pkg.build_message
113688 (p_appli_s_name => 'XLA'
113689 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
113690 ,p_token_1 => 'LINE_NUMBER'
113691 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
113692 ,p_token_2 => 'LINE_TYPE_NAME'
113693 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
113694 l_component_type
113695 ,l_component_code
113696 ,l_component_type_code
113697 ,l_component_appl_id
113698 ,l_amb_context_code
113699 ,l_entity_code
113700 ,l_event_class_code
113701 )
113702 ,p_token_3 => 'OWNER'
113703 ,p_value_3 => xla_lookups_pkg.get_meaning(
113704 p_lookup_type => 'XLA_OWNER_TYPE'
113705 ,p_lookup_code => l_component_type_code
113706 )
113707 ,p_token_4 => 'PRODUCT_NAME'
113708 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
113709 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
113710 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
113711 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
113712 ,p_ae_header_id => NULL
113713 );
113714
113715 IF (C_LEVEL_ERROR>= g_log_level) THEN
113716 trace
113717 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
113718 ,p_level => C_LEVEL_ERROR
113719 ,p_module => l_log_module);
113720 END IF;
113721 END IF;
113722 END IF;
113723 --
113724 --
113725 ------------------------------------------------------------------------------------------------
113726 -- 4219869 Business Flow
113727 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
113728 -- Prior Entry. Currently, the following code is always generated.
113729 ------------------------------------------------------------------------------------------------
113730 XLA_AE_LINES_PKG.ValidateCurrentLine;
113731
113732 ------------------------------------------------------------------------------------
113733 -- 4219869 Business Flow
113734 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
113735 ------------------------------------------------------------------------------------
113736 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
113737
113738 ----------------------------------------------------------------------------------
113739 -- 4219869 Business Flow
113740 -- Update journal entry status -- Need to generate this within IF <condition>
113741 ----------------------------------------------------------------------------------
113742 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
113743 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
113747 -------------------------------------------------------------------------------------------
113744 ,p_balance_type_code => l_balance_type_code
113745 );
113746
113748 -- 4262811 - Generate the Accrual Reversal lines
113749 -------------------------------------------------------------------------------------------
113750 BEGIN
113751 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
113752 (g_array_event(p_event_id).array_value_num('header_index'));
113753 IF l_acc_rev_flag IS NULL THEN
113754 l_acc_rev_flag := 'N';
113755 END IF;
113756 EXCEPTION
113757 WHEN OTHERS THEN
113758 l_acc_rev_flag := 'N';
113759 END;
113760 --
113761 IF (l_acc_rev_flag = 'Y') THEN
113762
113763 -- 4645092 ------------------------------------------------------------------------------
113764 -- To allow MPA report to determine if it should generate report process
113765 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
113766 ------------------------------------------------------------------------------------------
113767
113768 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
113769 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
113770 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
113771 -- call ADRs
113772 -- Bug 4922099
113773 --
113774 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
113775 (NVL(l_actual_upg_option, 'N') = 'O') OR
113776 (NVL(l_enc_upg_option, 'N') = 'O')
113777 )
113778 THEN
113779 NULL;
113780 --
113781 --
113782
113783 l_ccid := AcctDerRule_175(
113784 p_application_id => p_application_id
113785 , p_ae_header_id => l_ae_header_id
113786 , p_source_5 => p_source_5
113787 , p_source_19 => p_source_19
113788 , p_source_32 => p_source_32
113789 , x_transaction_coa_id => l_adr_transaction_coa_id
113790 , x_accounting_coa_id => l_adr_accounting_coa_id
113791 , x_value_type_code => l_adr_value_type_code
113792 , p_side => 'NA'
113793 );
113794
113795 xla_ae_lines_pkg.set_ccid(
113796 p_code_combination_id => l_ccid
113797 , p_value_type_code => l_adr_value_type_code
113798 , p_transaction_coa_id => l_adr_transaction_coa_id
113799 , p_accounting_coa_id => l_adr_accounting_coa_id
113800 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
113801 , p_adr_type_code => 'S'
113802 , p_component_type => l_component_type
113803 , p_component_code => l_component_code
113804 , p_component_type_code => l_component_type_code
113805 , p_component_appl_id => l_component_appl_id
113806 , p_amb_context_code => l_amb_context_code
113807 , p_side => 'NA'
113808 );
113809
113810
113811 l_segment := AcctDerRule_150(
113812 p_application_id => p_application_id
113813 , p_ae_header_id => l_ae_header_id
113814 , p_source_5 => p_source_5
113815 , p_source_12 => p_source_12
113816 , x_transaction_coa_id => l_adr_transaction_coa_id
113817 , x_accounting_coa_id => l_adr_accounting_coa_id
113818 , x_flexfield_segment_code => l_adr_flexfield_segment_code
113819 , x_flex_value_set_id => l_adr_flex_value_set_id
113820 , x_value_type_code => l_adr_value_type_code
113821 , x_value_combination_id => l_adr_value_combination_id
113822 , x_value_segment_code => l_adr_value_segment_code
113823 , p_side => 'NA'
113824 , p_override_seg_flag => 'Y'
113825 );
113826
113827 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
113828
113829 xla_ae_lines_pkg.set_segment(
113830 p_to_segment_code => 'GL_ACCOUNT'
113831 , p_segment_value => l_segment
113832 , p_from_segment_code => l_adr_value_segment_code
113833 , p_from_combination_id => l_adr_value_combination_id
113834 , p_value_type_code => l_adr_value_type_code
113835 , p_transaction_coa_id => l_adr_transaction_coa_id
113836 , p_accounting_coa_id => l_adr_accounting_coa_id
113837 , p_flexfield_segment_code => l_adr_flexfield_segment_code
113838 , p_flex_value_set_id => l_adr_flex_value_set_id
113839 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
113840 , p_adr_type_code => 'S'
113841 , p_component_type => l_component_type
113842 , p_component_code => l_component_code
113843 , p_component_type_code => l_component_type_code
113844 , p_component_appl_id => l_component_appl_id
113845 , p_amb_context_code => l_amb_context_code
113846 , p_entity_code => 'TRANSACTIONS'
113847 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
113848 , p_side => 'NA'
113849 );
113850
113851 END IF;
113852
113853 l_segment := AcctDerRule_169(
113854 p_application_id => p_application_id
113855 , p_ae_header_id => l_ae_header_id
113856 , p_source_5 => p_source_5
113857 , p_source_31 => p_source_31
113858 , x_transaction_coa_id => l_adr_transaction_coa_id
113859 , x_accounting_coa_id => l_adr_accounting_coa_id
113863 , x_value_combination_id => l_adr_value_combination_id
113860 , x_flexfield_segment_code => l_adr_flexfield_segment_code
113861 , x_flex_value_set_id => l_adr_flex_value_set_id
113862 , x_value_type_code => l_adr_value_type_code
113864 , x_value_segment_code => l_adr_value_segment_code
113865 , p_side => 'NA'
113866 , p_override_seg_flag => 'Y'
113867 );
113868
113869 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
113870
113871 xla_ae_lines_pkg.set_segment(
113872 p_to_segment_code => 'GL_BALANCING'
113873 , p_segment_value => l_segment
113874 , p_from_segment_code => l_adr_value_segment_code
113875 , p_from_combination_id => l_adr_value_combination_id
113876 , p_value_type_code => l_adr_value_type_code
113877 , p_transaction_coa_id => l_adr_transaction_coa_id
113878 , p_accounting_coa_id => l_adr_accounting_coa_id
113879 , p_flexfield_segment_code => l_adr_flexfield_segment_code
113880 , p_flex_value_set_id => l_adr_flex_value_set_id
113881 , p_adr_code => 'FA_EXPENSE_ACCT'
113882 , p_adr_type_code => 'S'
113883 , p_component_type => l_component_type
113884 , p_component_code => l_component_code
113885 , p_component_type_code => l_component_type_code
113886 , p_component_appl_id => l_component_appl_id
113887 , p_amb_context_code => l_amb_context_code
113888 , p_entity_code => 'TRANSACTIONS'
113889 , p_event_class_code => 'RETIREMENT_ADJUSTMENTS'
113890 , p_side => 'NA'
113891 );
113892
113893 END IF;
113894
113895 --
113896 --
113897 END IF;
113898
113899 --
113900 -- Update the line information that should be overwritten
113901 --
113902 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
113903 p_header_num => 1);
113904 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
113905
113906 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
113907
113908 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
113909 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
113910 END IF;
113911
113912 --
113913 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
113914 --
113915 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
113916 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
113917 ELSE
113918 ---------------------------------------------------------------------------------------------------
113919 -- 4262811a Switch Sign
113920 ---------------------------------------------------------------------------------------------------
113921 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
113922 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
113923 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
113924 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
113925 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
113926 -- 5132302
113927 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
113928 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
113929
113930 END IF;
113931
113932 -- 4955764
113933 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
113934 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
113935
113936
113937 XLA_AE_LINES_PKG.ValidateCurrentLine;
113938 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
113939
113940 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
113941 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
113942 ,p_balance_type_code => l_balance_type_code);
113943
113944 END IF;
113945
113946 -----------------------------------------------------------------------------------------
113947 -- 4262811 Multiperiod Accounting
113948 -----------------------------------------------------------------------------------------
113949 -- No MPA option is assigned.
113950
113951
113952 END IF;
113953 END IF;
113954 --
113955
113956 --
113957 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
113958 trace
113959 (p_msg => 'END of AcctLineType_323'
113960 ,p_level => C_LEVEL_PROCEDURE
113961 ,p_module => l_log_module);
113962 END IF;
113963 --
113964 EXCEPTION
113965 WHEN xla_exceptions_pkg.application_exception THEN
113966 RAISE;
113967 WHEN OTHERS THEN
113968 xla_exceptions_pkg.raise_message
113969 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_323');
113970 END AcctLineType_323;
113971 --
113972
113976 -- AcctLineType_324
113973 ---------------------------------------
113974 --
113975 -- PRIVATE FUNCTION
113977 --
113978 ---------------------------------------
113979 PROCEDURE AcctLineType_324 (
113980 p_application_id IN NUMBER
113981 ,p_event_id IN NUMBER
113982 ,p_calculate_acctd_flag IN VARCHAR2
113983 ,p_calculate_g_l_flag IN VARCHAR2
113984 ,p_actual_flag IN OUT VARCHAR2
113985 ,p_balance_type_code OUT VARCHAR2
113986 ,p_gain_or_loss_ref OUT VARCHAR2
113987
113988 --Period Close Date
113989 , p_source_1 IN DATE
113990 --Generated Code Combination Identifier
113991 , p_source_5 IN NUMBER
113992 --Revaluation Reserve Account
113993 , p_source_13 IN VARCHAR2
113994 --Generated Offset Code Combination Identifier
113995 , p_source_19 IN NUMBER
113996 --Expense Account Code Combination Identifier
113997 , p_source_31 IN NUMBER
113998 --Default Code Combination Identifier
113999 , p_source_32 IN NUMBER
114000 --Adjustment Type
114001 , p_source_48 IN VARCHAR2
114002 --Transaction Header Identifier
114003 , p_source_49 IN NUMBER
114004 --Adjustment Line Identifier
114005 , p_source_50 IN NUMBER
114006 --Distribution Type Code
114007 , p_source_51 IN VARCHAR2
114008 --Entered Amount
114009 , p_source_52 IN NUMBER
114010 --Currency Code
114011 , p_source_53 IN VARCHAR2
114012 )
114013 IS
114014
114015 l_component_type VARCHAR2(80);
114016 l_component_code VARCHAR2(30);
114017 l_component_type_code VARCHAR2(1);
114018 l_component_appl_id INTEGER;
114019 l_amb_context_code VARCHAR2(30);
114020 l_entity_code VARCHAR2(30);
114021 l_event_class_code VARCHAR2(30);
114022 l_ae_header_id NUMBER;
114023 l_event_type_code VARCHAR2(30);
114024 l_line_definition_code VARCHAR2(30);
114025 l_line_definition_owner_code VARCHAR2(1);
114026 --
114027 -- adr variables
114028 l_segment VARCHAR2(30);
114029 l_ccid NUMBER;
114030 l_adr_transaction_coa_id NUMBER;
114031 l_adr_accounting_coa_id NUMBER;
114032 l_adr_flexfield_segment_code VARCHAR2(30);
114033 l_adr_flex_value_set_id NUMBER;
114034 l_adr_value_type_code VARCHAR2(30);
114035 l_adr_value_combination_id NUMBER;
114036 l_adr_value_segment_code VARCHAR2(30);
114037
114038 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
114039 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
114040 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
114041 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
114042
114043 -- 4262811 Variables ------------------------------------------------------------------------------------------
114044 l_entered_amt_idx NUMBER;
114045 l_accted_amt_idx NUMBER;
114046 l_acc_rev_flag VARCHAR2(1);
114047 l_accrual_line_num NUMBER;
114048 l_tmp_amt NUMBER;
114049 l_acc_rev_natural_side_code VARCHAR2(1);
114050
114051 l_num_entries NUMBER;
114052 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
114053 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
114054 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
114055 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
114056 l_recog_line_1 NUMBER;
114057 l_recog_line_2 NUMBER;
114058
114059 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
114060 l_bflow_applied_to_amt NUMBER; -- 5132302
114061 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
114062
114063 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
114064
114065 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
114066 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
114067
114068 ---------------------------------------------------------------------------------------------------------------
114069
114070
114071 --
114072 -- bulk performance
114073 --
114074 l_balance_type_code VARCHAR2(1);
114075 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
114076 l_log_module VARCHAR2(240);
114077
114078 --
114079 -- Upgrade strategy
114080 --
114081 l_actual_upg_option VARCHAR2(1);
114082 l_enc_upg_option VARCHAR2(1);
114083
114084 --
114085 BEGIN
114086 --
114087 IF g_log_enabled THEN
114088 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_324';
114089 END IF;
114090 --
114091 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
114092
114093 trace
114094 (p_msg => 'BEGIN of AcctLineType_324'
114095 ,p_level => C_LEVEL_PROCEDURE
114096 ,p_module => l_log_module);
114097
114098 END IF;
114099 --
114100 l_component_type := 'AMB_JLT';
114101 l_component_code := 'FA_RET_REVAL_RESERVE';
114102 l_component_type_code := 'S';
114103 l_component_appl_id := 140;
114104 l_amb_context_code := 'DEFAULT';
114105 l_entity_code := 'TRANSACTIONS';
114109 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
114106 l_event_class_code := 'RETIREMENTS';
114107 l_event_type_code := 'RETIREMENTS';
114108 l_line_definition_owner_code := 'S';
114110 --
114111 l_balance_type_code := 'A';
114112 l_segment := NULL;
114113 l_ccid := NULL;
114114 l_adr_transaction_coa_id := NULL;
114115 l_adr_accounting_coa_id := NULL;
114116 l_adr_flexfield_segment_code := NULL;
114117 l_adr_flex_value_set_id := NULL;
114118 l_adr_value_type_code := NULL;
114119 l_adr_value_combination_id := NULL;
114120 l_adr_value_segment_code := NULL;
114121
114122 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
114123 l_bflow_class_code := ''; -- 4219869 Business Flow
114124 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
114125 l_budgetary_control_flag := 'N';
114126
114127 l_bflow_applied_to_amt_idx := NULL; -- 5132302
114128 l_bflow_applied_to_amt := NULL; -- 5132302
114129 l_entered_amt_idx := NULL; -- 4262811
114130 l_accted_amt_idx := NULL; -- 4262811
114131 l_acc_rev_flag := NULL; -- 4262811
114132 l_accrual_line_num := NULL; -- 4262811
114133 l_tmp_amt := NULL; -- 4262811
114134 --
114135
114136 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
114137 l_balance_type_code <> 'B' THEN
114138 IF NVL(p_source_48,'
114139 ') = 'REVAL RESERVE'
114140 THEN
114141
114142 --
114143 XLA_AE_LINES_PKG.SetNewLine;
114144
114145 p_balance_type_code := l_balance_type_code;
114146 -- set the flag so later we will know whether the gain loss line needs to be created
114147
114148 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
114149 p_actual_flag :='A';
114150 END IF;
114151
114152 --
114153 -- bulk performance
114154 --
114155 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
114156 p_header_num => 0); -- 4262811
114157 --
114158 -- set accounting line options
114159 --
114160 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
114161 p_natural_side_code => 'D'
114162 , p_gain_or_loss_flag => 'N'
114163 , p_gl_transfer_mode_code => 'S'
114164 , p_acct_entry_type_code => 'A'
114165 , p_switch_side_flag => 'Y'
114166 , p_merge_duplicate_code => 'N'
114167 );
114168 --
114169 l_acc_rev_natural_side_code := 'C'; -- 4262811
114170 --
114171 --
114172 -- set accounting line type info
114173 --
114174 xla_ae_lines_pkg.SetAcctLineType
114175 (p_component_type => l_component_type
114176 ,p_event_type_code => l_event_type_code
114177 ,p_line_definition_owner_code => l_line_definition_owner_code
114178 ,p_line_definition_code => l_line_definition_code
114179 ,p_accounting_line_code => l_component_code
114180 ,p_accounting_line_type_code => l_component_type_code
114181 ,p_accounting_line_appl_id => l_component_appl_id
114182 ,p_amb_context_code => l_amb_context_code
114183 ,p_entity_code => l_entity_code
114184 ,p_event_class_code => l_event_class_code);
114185 --
114186 -- set accounting class
114187 --
114188 xla_ae_lines_pkg.SetAcctClass(
114189 p_accounting_class_code => 'ASSET'
114190 , p_ae_header_id => l_ae_header_id
114191 );
114192
114193 --
114194 -- set rounding class
114195 --
114196 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
114197 'ASSET';
114198
114199 --
114200 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
114201 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
114202 --
114203 -- bulk performance
114204 --
114205 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
114206
114207 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
114208 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
114209
114210 -- 4955764
114211 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
114212 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
114213
114214 -- 4458381 Public Sector Enh
114215
114216 --
114217 -- set accounting attributes for the line type
114218 --
114219 l_entered_amt_idx := 4;
114220 l_accted_amt_idx := 6;
114221 l_bflow_applied_to_amt_idx := NULL; -- 5132302
114222 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
114223 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
114224 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
114225 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
114226 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
114227 l_rec_acct_attrs.array_char_value(3) := p_source_51;
114231 l_rec_acct_attrs.array_char_value(5) := p_source_53;
114228 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
114229 l_rec_acct_attrs.array_num_value(4) := p_source_52;
114230 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
114232 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
114233 l_rec_acct_attrs.array_num_value(6) := p_source_52;
114234
114235 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
114236 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
114237
114238 ---------------------------------------------------------------------------------------------------------------
114239 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
114240 ---------------------------------------------------------------------------------------------------------------
114241 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
114242
114243 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
114244 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
114245
114246 IF xla_accounting_cache_pkg.GetValueChar
114247 (p_source_code => 'LEDGER_CATEGORY_CODE'
114248 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
114249 AND l_bflow_method_code = 'PRIOR_ENTRY'
114250 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
114251 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
114252 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
114253 )
114254 THEN
114255 xla_ae_lines_pkg.BflowUpgEntry
114256 (p_business_method_code => l_bflow_method_code
114257 ,p_business_class_code => l_bflow_class_code
114258 ,p_balance_type => l_balance_type_code);
114259 ELSE
114260 NULL;
114261 -- No business flow processing for business flow method of NONE.
114262 END IF;
114263
114264 --
114265 -- call analytical criteria
114266 --
114267
114268 --
114269 -- call description
114270 --
114271
114272 xla_ae_lines_pkg.SetLineDescription(
114273 p_ae_header_id => l_ae_header_id
114274 ,p_description => Description_83 (
114275 p_application_id => p_application_id
114276 , p_ae_header_id => l_ae_header_id
114277 , p_source_1 => p_source_1
114278 )
114279 );
114280
114281
114282 --
114283 -- call ADRs
114284 -- Bug 4922099
114285 --
114286 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
114287 (NVL(l_actual_upg_option, 'N') = 'O') OR
114288 (NVL(l_enc_upg_option, 'N') = 'O')
114289 )
114290 THEN
114291 NULL;
114292 --
114293 --
114294
114295 l_ccid := AcctDerRule_175(
114296 p_application_id => p_application_id
114297 , p_ae_header_id => l_ae_header_id
114298 , p_source_5 => p_source_5
114299 , p_source_19 => p_source_19
114300 , p_source_32 => p_source_32
114301 , x_transaction_coa_id => l_adr_transaction_coa_id
114302 , x_accounting_coa_id => l_adr_accounting_coa_id
114303 , x_value_type_code => l_adr_value_type_code
114304 , p_side => 'NA'
114305 );
114306
114307 xla_ae_lines_pkg.set_ccid(
114308 p_code_combination_id => l_ccid
114309 , p_value_type_code => l_adr_value_type_code
114310 , p_transaction_coa_id => l_adr_transaction_coa_id
114311 , p_accounting_coa_id => l_adr_accounting_coa_id
114312 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
114313 , p_adr_type_code => 'S'
114314 , p_component_type => l_component_type
114315 , p_component_code => l_component_code
114316 , p_component_type_code => l_component_type_code
114317 , p_component_appl_id => l_component_appl_id
114318 , p_amb_context_code => l_amb_context_code
114319 , p_side => 'NA'
114320 );
114321
114322
114323 l_segment := AcctDerRule_151(
114324 p_application_id => p_application_id
114325 , p_ae_header_id => l_ae_header_id
114326 , p_source_5 => p_source_5
114327 , p_source_13 => p_source_13
114328 , x_transaction_coa_id => l_adr_transaction_coa_id
114329 , x_accounting_coa_id => l_adr_accounting_coa_id
114330 , x_flexfield_segment_code => l_adr_flexfield_segment_code
114331 , x_flex_value_set_id => l_adr_flex_value_set_id
114332 , x_value_type_code => l_adr_value_type_code
114333 , x_value_combination_id => l_adr_value_combination_id
114334 , x_value_segment_code => l_adr_value_segment_code
114335 , p_side => 'NA'
114336 , p_override_seg_flag => 'Y'
114337 );
114338
114339 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
114340
114341 xla_ae_lines_pkg.set_segment(
114342 p_to_segment_code => 'GL_ACCOUNT'
114343 , p_segment_value => l_segment
114344 , p_from_segment_code => l_adr_value_segment_code
114345 , p_from_combination_id => l_adr_value_combination_id
114349 , p_flexfield_segment_code => l_adr_flexfield_segment_code
114346 , p_value_type_code => l_adr_value_type_code
114347 , p_transaction_coa_id => l_adr_transaction_coa_id
114348 , p_accounting_coa_id => l_adr_accounting_coa_id
114350 , p_flex_value_set_id => l_adr_flex_value_set_id
114351 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
114352 , p_adr_type_code => 'S'
114353 , p_component_type => l_component_type
114354 , p_component_code => l_component_code
114355 , p_component_type_code => l_component_type_code
114356 , p_component_appl_id => l_component_appl_id
114357 , p_amb_context_code => l_amb_context_code
114358 , p_entity_code => 'TRANSACTIONS'
114359 , p_event_class_code => 'RETIREMENTS'
114360 , p_side => 'NA'
114361 );
114362
114363 END IF;
114364
114365 l_segment := AcctDerRule_169(
114366 p_application_id => p_application_id
114367 , p_ae_header_id => l_ae_header_id
114368 , p_source_5 => p_source_5
114369 , p_source_31 => p_source_31
114370 , x_transaction_coa_id => l_adr_transaction_coa_id
114371 , x_accounting_coa_id => l_adr_accounting_coa_id
114372 , x_flexfield_segment_code => l_adr_flexfield_segment_code
114373 , x_flex_value_set_id => l_adr_flex_value_set_id
114374 , x_value_type_code => l_adr_value_type_code
114375 , x_value_combination_id => l_adr_value_combination_id
114376 , x_value_segment_code => l_adr_value_segment_code
114377 , p_side => 'NA'
114378 , p_override_seg_flag => 'Y'
114379 );
114380
114381 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
114382
114383 xla_ae_lines_pkg.set_segment(
114384 p_to_segment_code => 'GL_BALANCING'
114385 , p_segment_value => l_segment
114386 , p_from_segment_code => l_adr_value_segment_code
114387 , p_from_combination_id => l_adr_value_combination_id
114388 , p_value_type_code => l_adr_value_type_code
114389 , p_transaction_coa_id => l_adr_transaction_coa_id
114390 , p_accounting_coa_id => l_adr_accounting_coa_id
114391 , p_flexfield_segment_code => l_adr_flexfield_segment_code
114392 , p_flex_value_set_id => l_adr_flex_value_set_id
114393 , p_adr_code => 'FA_EXPENSE_ACCT'
114394 , p_adr_type_code => 'S'
114395 , p_component_type => l_component_type
114396 , p_component_code => l_component_code
114397 , p_component_type_code => l_component_type_code
114398 , p_component_appl_id => l_component_appl_id
114399 , p_amb_context_code => l_amb_context_code
114400 , p_entity_code => 'TRANSACTIONS'
114401 , p_event_class_code => 'RETIREMENTS'
114402 , p_side => 'NA'
114403 );
114404
114405 END IF;
114406
114407 --
114408 --
114409 END IF;
114410 --
114411 -- Bug 4922099
114412 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
114413 (NVL(l_enc_upg_option, 'N') = 'O')
114414 ) AND
114415 (l_bflow_method_code = 'PRIOR_ENTRY')
114416 )
114417 THEN
114418 IF
114419 --
114420 1 = 2
114421 --
114422 THEN
114423 xla_accounting_err_pkg.build_message
114424 (p_appli_s_name => 'XLA'
114425 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
114426 ,p_token_1 => 'LINE_NUMBER'
114427 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
114428 ,p_token_2 => 'LINE_TYPE_NAME'
114429 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
114430 l_component_type
114431 ,l_component_code
114432 ,l_component_type_code
114433 ,l_component_appl_id
114434 ,l_amb_context_code
114435 ,l_entity_code
114436 ,l_event_class_code
114437 )
114438 ,p_token_3 => 'OWNER'
114439 ,p_value_3 => xla_lookups_pkg.get_meaning(
114440 p_lookup_type => 'XLA_OWNER_TYPE'
114441 ,p_lookup_code => l_component_type_code
114442 )
114443 ,p_token_4 => 'PRODUCT_NAME'
114444 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
114445 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
114449 );
114446 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
114447 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
114448 ,p_ae_header_id => NULL
114450
114451 IF (C_LEVEL_ERROR>= g_log_level) THEN
114452 trace
114453 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
114454 ,p_level => C_LEVEL_ERROR
114455 ,p_module => l_log_module);
114456 END IF;
114457 END IF;
114458 END IF;
114459 --
114460 --
114461 ------------------------------------------------------------------------------------------------
114462 -- 4219869 Business Flow
114463 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
114464 -- Prior Entry. Currently, the following code is always generated.
114465 ------------------------------------------------------------------------------------------------
114466 XLA_AE_LINES_PKG.ValidateCurrentLine;
114467
114468 ------------------------------------------------------------------------------------
114469 -- 4219869 Business Flow
114470 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
114471 ------------------------------------------------------------------------------------
114472 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
114473
114474 ----------------------------------------------------------------------------------
114475 -- 4219869 Business Flow
114476 -- Update journal entry status -- Need to generate this within IF <condition>
114477 ----------------------------------------------------------------------------------
114478 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
114479 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
114480 ,p_balance_type_code => l_balance_type_code
114481 );
114482
114483 -------------------------------------------------------------------------------------------
114484 -- 4262811 - Generate the Accrual Reversal lines
114485 -------------------------------------------------------------------------------------------
114486 BEGIN
114487 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
114488 (g_array_event(p_event_id).array_value_num('header_index'));
114489 IF l_acc_rev_flag IS NULL THEN
114490 l_acc_rev_flag := 'N';
114491 END IF;
114492 EXCEPTION
114493 WHEN OTHERS THEN
114494 l_acc_rev_flag := 'N';
114495 END;
114496 --
114497 IF (l_acc_rev_flag = 'Y') THEN
114498
114499 -- 4645092 ------------------------------------------------------------------------------
114500 -- To allow MPA report to determine if it should generate report process
114501 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
114502 ------------------------------------------------------------------------------------------
114503
114504 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
114505 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
114506 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
114507 -- call ADRs
114508 -- Bug 4922099
114509 --
114510 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
114511 (NVL(l_actual_upg_option, 'N') = 'O') OR
114512 (NVL(l_enc_upg_option, 'N') = 'O')
114513 )
114514 THEN
114515 NULL;
114516 --
114517 --
114518
114519 l_ccid := AcctDerRule_175(
114520 p_application_id => p_application_id
114521 , p_ae_header_id => l_ae_header_id
114522 , p_source_5 => p_source_5
114523 , p_source_19 => p_source_19
114524 , p_source_32 => p_source_32
114525 , x_transaction_coa_id => l_adr_transaction_coa_id
114526 , x_accounting_coa_id => l_adr_accounting_coa_id
114527 , x_value_type_code => l_adr_value_type_code
114528 , p_side => 'NA'
114529 );
114530
114531 xla_ae_lines_pkg.set_ccid(
114532 p_code_combination_id => l_ccid
114533 , p_value_type_code => l_adr_value_type_code
114534 , p_transaction_coa_id => l_adr_transaction_coa_id
114535 , p_accounting_coa_id => l_adr_accounting_coa_id
114536 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
114537 , p_adr_type_code => 'S'
114538 , p_component_type => l_component_type
114539 , p_component_code => l_component_code
114540 , p_component_type_code => l_component_type_code
114541 , p_component_appl_id => l_component_appl_id
114542 , p_amb_context_code => l_amb_context_code
114543 , p_side => 'NA'
114544 );
114545
114546
114547 l_segment := AcctDerRule_151(
114548 p_application_id => p_application_id
114549 , p_ae_header_id => l_ae_header_id
114550 , p_source_5 => p_source_5
114551 , p_source_13 => p_source_13
114552 , x_transaction_coa_id => l_adr_transaction_coa_id
114553 , x_accounting_coa_id => l_adr_accounting_coa_id
114554 , x_flexfield_segment_code => l_adr_flexfield_segment_code
114555 , x_flex_value_set_id => l_adr_flex_value_set_id
114559 , p_side => 'NA'
114556 , x_value_type_code => l_adr_value_type_code
114557 , x_value_combination_id => l_adr_value_combination_id
114558 , x_value_segment_code => l_adr_value_segment_code
114560 , p_override_seg_flag => 'Y'
114561 );
114562
114563 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
114564
114565 xla_ae_lines_pkg.set_segment(
114566 p_to_segment_code => 'GL_ACCOUNT'
114567 , p_segment_value => l_segment
114568 , p_from_segment_code => l_adr_value_segment_code
114569 , p_from_combination_id => l_adr_value_combination_id
114570 , p_value_type_code => l_adr_value_type_code
114571 , p_transaction_coa_id => l_adr_transaction_coa_id
114572 , p_accounting_coa_id => l_adr_accounting_coa_id
114573 , p_flexfield_segment_code => l_adr_flexfield_segment_code
114574 , p_flex_value_set_id => l_adr_flex_value_set_id
114575 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
114576 , p_adr_type_code => 'S'
114577 , p_component_type => l_component_type
114578 , p_component_code => l_component_code
114579 , p_component_type_code => l_component_type_code
114580 , p_component_appl_id => l_component_appl_id
114581 , p_amb_context_code => l_amb_context_code
114582 , p_entity_code => 'TRANSACTIONS'
114583 , p_event_class_code => 'RETIREMENTS'
114584 , p_side => 'NA'
114585 );
114586
114587 END IF;
114588
114589 l_segment := AcctDerRule_169(
114590 p_application_id => p_application_id
114591 , p_ae_header_id => l_ae_header_id
114592 , p_source_5 => p_source_5
114593 , p_source_31 => p_source_31
114594 , x_transaction_coa_id => l_adr_transaction_coa_id
114595 , x_accounting_coa_id => l_adr_accounting_coa_id
114596 , x_flexfield_segment_code => l_adr_flexfield_segment_code
114597 , x_flex_value_set_id => l_adr_flex_value_set_id
114598 , x_value_type_code => l_adr_value_type_code
114599 , x_value_combination_id => l_adr_value_combination_id
114600 , x_value_segment_code => l_adr_value_segment_code
114601 , p_side => 'NA'
114602 , p_override_seg_flag => 'Y'
114603 );
114604
114605 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
114606
114607 xla_ae_lines_pkg.set_segment(
114608 p_to_segment_code => 'GL_BALANCING'
114609 , p_segment_value => l_segment
114610 , p_from_segment_code => l_adr_value_segment_code
114611 , p_from_combination_id => l_adr_value_combination_id
114612 , p_value_type_code => l_adr_value_type_code
114613 , p_transaction_coa_id => l_adr_transaction_coa_id
114614 , p_accounting_coa_id => l_adr_accounting_coa_id
114615 , p_flexfield_segment_code => l_adr_flexfield_segment_code
114616 , p_flex_value_set_id => l_adr_flex_value_set_id
114617 , p_adr_code => 'FA_EXPENSE_ACCT'
114618 , p_adr_type_code => 'S'
114619 , p_component_type => l_component_type
114620 , p_component_code => l_component_code
114621 , p_component_type_code => l_component_type_code
114622 , p_component_appl_id => l_component_appl_id
114623 , p_amb_context_code => l_amb_context_code
114624 , p_entity_code => 'TRANSACTIONS'
114625 , p_event_class_code => 'RETIREMENTS'
114626 , p_side => 'NA'
114627 );
114628
114629 END IF;
114630
114631 --
114632 --
114633 END IF;
114634
114635 --
114636 -- Update the line information that should be overwritten
114637 --
114638 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
114639 p_header_num => 1);
114640 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
114641
114642 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
114643
114644 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
114645 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
114646 END IF;
114647
114648 --
114649 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
114650 --
114651 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
114652 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
114653 ELSE
114654 ---------------------------------------------------------------------------------------------------
114655 -- 4262811a Switch Sign
114656 ---------------------------------------------------------------------------------------------------
114657 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
114658 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
114659 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
114663 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
114660 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
114661 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
114662 -- 5132302
114664 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
114665
114666 END IF;
114667
114668 -- 4955764
114669 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
114670 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
114671
114672
114673 XLA_AE_LINES_PKG.ValidateCurrentLine;
114674 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
114675
114676 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
114677 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
114678 ,p_balance_type_code => l_balance_type_code);
114679
114680 END IF;
114681
114682 -----------------------------------------------------------------------------------------
114683 -- 4262811 Multiperiod Accounting
114684 -----------------------------------------------------------------------------------------
114685 -- No MPA option is assigned.
114686
114687
114688 END IF;
114689 END IF;
114690 --
114691
114692 --
114693 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
114694 trace
114695 (p_msg => 'END of AcctLineType_324'
114696 ,p_level => C_LEVEL_PROCEDURE
114697 ,p_module => l_log_module);
114698 END IF;
114699 --
114700 EXCEPTION
114701 WHEN xla_exceptions_pkg.application_exception THEN
114702 RAISE;
114703 WHEN OTHERS THEN
114704 xla_exceptions_pkg.raise_message
114705 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_324');
114706 END AcctLineType_324;
114707 --
114708
114709 ---------------------------------------
114710 --
114711 -- PRIVATE FUNCTION
114712 -- AcctLineType_325
114713 --
114714 ---------------------------------------
114715 PROCEDURE AcctLineType_325 (
114716 p_application_id IN NUMBER
114717 ,p_event_id IN NUMBER
114718 ,p_calculate_acctd_flag IN VARCHAR2
114719 ,p_calculate_g_l_flag IN VARCHAR2
114720 ,p_actual_flag IN OUT VARCHAR2
114721 ,p_balance_type_code OUT VARCHAR2
114722 ,p_gain_or_loss_ref OUT VARCHAR2
114723
114724 --Period Close Date
114725 , p_source_1 IN DATE
114726 --Generated Code Combination Identifier
114727 , p_source_5 IN NUMBER
114728 --Revaluation Reserve Account
114729 , p_source_13 IN VARCHAR2
114730 --Generated Offset Code Combination Identifier
114731 , p_source_19 IN NUMBER
114732 --Expense Account Code Combination Identifier
114733 , p_source_31 IN NUMBER
114734 --Default Code Combination Identifier
114735 , p_source_32 IN NUMBER
114736 --Adjustment Type
114737 , p_source_48 IN VARCHAR2
114738 --Transaction Header Identifier
114739 , p_source_49 IN NUMBER
114740 --Adjustment Line Identifier
114741 , p_source_50 IN NUMBER
114742 --Distribution Type Code
114743 , p_source_51 IN VARCHAR2
114744 --Entered Amount
114745 , p_source_52 IN NUMBER
114746 --Currency Code
114747 , p_source_53 IN VARCHAR2
114748 )
114749 IS
114750
114751 l_component_type VARCHAR2(80);
114752 l_component_code VARCHAR2(30);
114753 l_component_type_code VARCHAR2(1);
114754 l_component_appl_id INTEGER;
114755 l_amb_context_code VARCHAR2(30);
114756 l_entity_code VARCHAR2(30);
114757 l_event_class_code VARCHAR2(30);
114758 l_ae_header_id NUMBER;
114759 l_event_type_code VARCHAR2(30);
114760 l_line_definition_code VARCHAR2(30);
114761 l_line_definition_owner_code VARCHAR2(1);
114762 --
114763 -- adr variables
114764 l_segment VARCHAR2(30);
114765 l_ccid NUMBER;
114766 l_adr_transaction_coa_id NUMBER;
114767 l_adr_accounting_coa_id NUMBER;
114768 l_adr_flexfield_segment_code VARCHAR2(30);
114769 l_adr_flex_value_set_id NUMBER;
114770 l_adr_value_type_code VARCHAR2(30);
114771 l_adr_value_combination_id NUMBER;
114772 l_adr_value_segment_code VARCHAR2(30);
114773
114774 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
114775 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
114776 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
114777 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
114778
114779 -- 4262811 Variables ------------------------------------------------------------------------------------------
114780 l_entered_amt_idx NUMBER;
114781 l_accted_amt_idx NUMBER;
114782 l_acc_rev_flag VARCHAR2(1);
114783 l_accrual_line_num NUMBER;
114784 l_tmp_amt NUMBER;
114785 l_acc_rev_natural_side_code VARCHAR2(1);
114786
114787 l_num_entries NUMBER;
114788 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
114789 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
114793 l_recog_line_2 NUMBER;
114790 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
114791 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
114792 l_recog_line_1 NUMBER;
114794
114795 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
114796 l_bflow_applied_to_amt NUMBER; -- 5132302
114797 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
114798
114799 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
114800
114801 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
114802 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
114803
114804 ---------------------------------------------------------------------------------------------------------------
114805
114806
114807 --
114808 -- bulk performance
114809 --
114810 l_balance_type_code VARCHAR2(1);
114811 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
114812 l_log_module VARCHAR2(240);
114813
114814 --
114815 -- Upgrade strategy
114816 --
114817 l_actual_upg_option VARCHAR2(1);
114818 l_enc_upg_option VARCHAR2(1);
114819
114820 --
114821 BEGIN
114822 --
114823 IF g_log_enabled THEN
114824 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_325';
114825 END IF;
114826 --
114827 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
114828
114829 trace
114830 (p_msg => 'BEGIN of AcctLineType_325'
114831 ,p_level => C_LEVEL_PROCEDURE
114832 ,p_module => l_log_module);
114833
114834 END IF;
114835 --
114836 l_component_type := 'AMB_JLT';
114837 l_component_code := 'FA_RET_REVAL_RESERVE';
114838 l_component_type_code := 'S';
114839 l_component_appl_id := 140;
114840 l_amb_context_code := 'DEFAULT';
114841 l_entity_code := 'TRANSACTIONS';
114842 l_event_class_code := 'RETIREMENTS';
114843 l_event_type_code := 'REINSTATEMENTS';
114844 l_line_definition_owner_code := 'S';
114845 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
114846 --
114847 l_balance_type_code := 'A';
114848 l_segment := NULL;
114849 l_ccid := NULL;
114850 l_adr_transaction_coa_id := NULL;
114851 l_adr_accounting_coa_id := NULL;
114852 l_adr_flexfield_segment_code := NULL;
114853 l_adr_flex_value_set_id := NULL;
114854 l_adr_value_type_code := NULL;
114855 l_adr_value_combination_id := NULL;
114856 l_adr_value_segment_code := NULL;
114857
114858 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
114859 l_bflow_class_code := ''; -- 4219869 Business Flow
114860 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
114861 l_budgetary_control_flag := 'N';
114862
114863 l_bflow_applied_to_amt_idx := NULL; -- 5132302
114864 l_bflow_applied_to_amt := NULL; -- 5132302
114865 l_entered_amt_idx := NULL; -- 4262811
114866 l_accted_amt_idx := NULL; -- 4262811
114867 l_acc_rev_flag := NULL; -- 4262811
114868 l_accrual_line_num := NULL; -- 4262811
114869 l_tmp_amt := NULL; -- 4262811
114870 --
114871
114872 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
114873 l_balance_type_code <> 'B' THEN
114874 IF NVL(p_source_48,'
114875 ') = 'REVAL RESERVE'
114876 THEN
114877
114878 --
114879 XLA_AE_LINES_PKG.SetNewLine;
114880
114881 p_balance_type_code := l_balance_type_code;
114882 -- set the flag so later we will know whether the gain loss line needs to be created
114883
114884 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
114885 p_actual_flag :='A';
114886 END IF;
114887
114888 --
114889 -- bulk performance
114890 --
114891 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
114892 p_header_num => 0); -- 4262811
114893 --
114894 -- set accounting line options
114895 --
114896 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
114897 p_natural_side_code => 'D'
114898 , p_gain_or_loss_flag => 'N'
114899 , p_gl_transfer_mode_code => 'S'
114900 , p_acct_entry_type_code => 'A'
114901 , p_switch_side_flag => 'Y'
114902 , p_merge_duplicate_code => 'N'
114903 );
114904 --
114905 l_acc_rev_natural_side_code := 'C'; -- 4262811
114906 --
114907 --
114908 -- set accounting line type info
114909 --
114910 xla_ae_lines_pkg.SetAcctLineType
114911 (p_component_type => l_component_type
114912 ,p_event_type_code => l_event_type_code
114913 ,p_line_definition_owner_code => l_line_definition_owner_code
114914 ,p_line_definition_code => l_line_definition_code
114915 ,p_accounting_line_code => l_component_code
114916 ,p_accounting_line_type_code => l_component_type_code
114917 ,p_accounting_line_appl_id => l_component_appl_id
114918 ,p_amb_context_code => l_amb_context_code
114919 ,p_entity_code => l_entity_code
114920 ,p_event_class_code => l_event_class_code);
114921 --
114925 p_accounting_class_code => 'ASSET'
114922 -- set accounting class
114923 --
114924 xla_ae_lines_pkg.SetAcctClass(
114926 , p_ae_header_id => l_ae_header_id
114927 );
114928
114929 --
114930 -- set rounding class
114931 --
114932 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
114933 'ASSET';
114934
114935 --
114936 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
114937 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
114938 --
114939 -- bulk performance
114940 --
114941 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
114942
114943 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
114944 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
114945
114946 -- 4955764
114947 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
114948 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
114949
114950 -- 4458381 Public Sector Enh
114951
114952 --
114953 -- set accounting attributes for the line type
114954 --
114955 l_entered_amt_idx := 4;
114956 l_accted_amt_idx := 6;
114957 l_bflow_applied_to_amt_idx := NULL; -- 5132302
114958 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
114959 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
114960 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
114961 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
114962 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
114963 l_rec_acct_attrs.array_char_value(3) := p_source_51;
114964 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
114965 l_rec_acct_attrs.array_num_value(4) := p_source_52;
114966 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
114967 l_rec_acct_attrs.array_char_value(5) := p_source_53;
114968 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
114969 l_rec_acct_attrs.array_num_value(6) := p_source_52;
114970
114971 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
114972 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
114973
114974 ---------------------------------------------------------------------------------------------------------------
114975 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
114976 ---------------------------------------------------------------------------------------------------------------
114977 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
114978
114979 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
114980 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
114981
114982 IF xla_accounting_cache_pkg.GetValueChar
114983 (p_source_code => 'LEDGER_CATEGORY_CODE'
114984 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
114985 AND l_bflow_method_code = 'PRIOR_ENTRY'
114986 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
114987 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
114988 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
114989 )
114990 THEN
114991 xla_ae_lines_pkg.BflowUpgEntry
114992 (p_business_method_code => l_bflow_method_code
114993 ,p_business_class_code => l_bflow_class_code
114994 ,p_balance_type => l_balance_type_code);
114995 ELSE
114996 NULL;
114997 -- No business flow processing for business flow method of NONE.
114998 END IF;
114999
115000 --
115001 -- call analytical criteria
115002 --
115003
115004 --
115005 -- call description
115006 --
115007
115008 xla_ae_lines_pkg.SetLineDescription(
115009 p_ae_header_id => l_ae_header_id
115010 ,p_description => Description_83 (
115011 p_application_id => p_application_id
115012 , p_ae_header_id => l_ae_header_id
115013 , p_source_1 => p_source_1
115014 )
115015 );
115016
115017
115018 --
115019 -- call ADRs
115020 -- Bug 4922099
115021 --
115022 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
115023 (NVL(l_actual_upg_option, 'N') = 'O') OR
115024 (NVL(l_enc_upg_option, 'N') = 'O')
115025 )
115026 THEN
115027 NULL;
115028 --
115029 --
115030
115031 l_ccid := AcctDerRule_175(
115032 p_application_id => p_application_id
115033 , p_ae_header_id => l_ae_header_id
115034 , p_source_5 => p_source_5
115035 , p_source_19 => p_source_19
115036 , p_source_32 => p_source_32
115037 , x_transaction_coa_id => l_adr_transaction_coa_id
115038 , x_accounting_coa_id => l_adr_accounting_coa_id
115039 , x_value_type_code => l_adr_value_type_code
115040 , p_side => 'NA'
115041 );
115042
115043 xla_ae_lines_pkg.set_ccid(
115044 p_code_combination_id => l_ccid
115048 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
115045 , p_value_type_code => l_adr_value_type_code
115046 , p_transaction_coa_id => l_adr_transaction_coa_id
115047 , p_accounting_coa_id => l_adr_accounting_coa_id
115049 , p_adr_type_code => 'S'
115050 , p_component_type => l_component_type
115051 , p_component_code => l_component_code
115052 , p_component_type_code => l_component_type_code
115053 , p_component_appl_id => l_component_appl_id
115054 , p_amb_context_code => l_amb_context_code
115055 , p_side => 'NA'
115056 );
115057
115058
115059 l_segment := AcctDerRule_151(
115060 p_application_id => p_application_id
115061 , p_ae_header_id => l_ae_header_id
115062 , p_source_5 => p_source_5
115063 , p_source_13 => p_source_13
115064 , x_transaction_coa_id => l_adr_transaction_coa_id
115065 , x_accounting_coa_id => l_adr_accounting_coa_id
115066 , x_flexfield_segment_code => l_adr_flexfield_segment_code
115067 , x_flex_value_set_id => l_adr_flex_value_set_id
115068 , x_value_type_code => l_adr_value_type_code
115069 , x_value_combination_id => l_adr_value_combination_id
115070 , x_value_segment_code => l_adr_value_segment_code
115071 , p_side => 'NA'
115072 , p_override_seg_flag => 'Y'
115073 );
115074
115075 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
115076
115077 xla_ae_lines_pkg.set_segment(
115078 p_to_segment_code => 'GL_ACCOUNT'
115079 , p_segment_value => l_segment
115080 , p_from_segment_code => l_adr_value_segment_code
115081 , p_from_combination_id => l_adr_value_combination_id
115082 , p_value_type_code => l_adr_value_type_code
115083 , p_transaction_coa_id => l_adr_transaction_coa_id
115084 , p_accounting_coa_id => l_adr_accounting_coa_id
115085 , p_flexfield_segment_code => l_adr_flexfield_segment_code
115086 , p_flex_value_set_id => l_adr_flex_value_set_id
115087 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
115088 , p_adr_type_code => 'S'
115089 , p_component_type => l_component_type
115090 , p_component_code => l_component_code
115091 , p_component_type_code => l_component_type_code
115092 , p_component_appl_id => l_component_appl_id
115093 , p_amb_context_code => l_amb_context_code
115094 , p_entity_code => 'TRANSACTIONS'
115095 , p_event_class_code => 'RETIREMENTS'
115096 , p_side => 'NA'
115097 );
115098
115099 END IF;
115100
115101 l_segment := AcctDerRule_169(
115102 p_application_id => p_application_id
115103 , p_ae_header_id => l_ae_header_id
115104 , p_source_5 => p_source_5
115105 , p_source_31 => p_source_31
115106 , x_transaction_coa_id => l_adr_transaction_coa_id
115107 , x_accounting_coa_id => l_adr_accounting_coa_id
115108 , x_flexfield_segment_code => l_adr_flexfield_segment_code
115109 , x_flex_value_set_id => l_adr_flex_value_set_id
115110 , x_value_type_code => l_adr_value_type_code
115111 , x_value_combination_id => l_adr_value_combination_id
115112 , x_value_segment_code => l_adr_value_segment_code
115113 , p_side => 'NA'
115114 , p_override_seg_flag => 'Y'
115115 );
115116
115117 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
115118
115119 xla_ae_lines_pkg.set_segment(
115120 p_to_segment_code => 'GL_BALANCING'
115121 , p_segment_value => l_segment
115122 , p_from_segment_code => l_adr_value_segment_code
115123 , p_from_combination_id => l_adr_value_combination_id
115124 , p_value_type_code => l_adr_value_type_code
115125 , p_transaction_coa_id => l_adr_transaction_coa_id
115126 , p_accounting_coa_id => l_adr_accounting_coa_id
115127 , p_flexfield_segment_code => l_adr_flexfield_segment_code
115128 , p_flex_value_set_id => l_adr_flex_value_set_id
115129 , p_adr_code => 'FA_EXPENSE_ACCT'
115130 , p_adr_type_code => 'S'
115131 , p_component_type => l_component_type
115132 , p_component_code => l_component_code
115133 , p_component_type_code => l_component_type_code
115134 , p_component_appl_id => l_component_appl_id
115135 , p_amb_context_code => l_amb_context_code
115136 , p_entity_code => 'TRANSACTIONS'
115137 , p_event_class_code => 'RETIREMENTS'
115138 , p_side => 'NA'
115139 );
115140
115141 END IF;
115142
115143 --
115144 --
115145 END IF;
115146 --
115147 -- Bug 4922099
115148 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
115149 (NVL(l_enc_upg_option, 'N') = 'O')
115150 ) AND
115151 (l_bflow_method_code = 'PRIOR_ENTRY')
115152 )
115153 THEN
115154 IF
115155 --
115156 1 = 2
115157 --
115158 THEN
115159 xla_accounting_err_pkg.build_message
115163 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
115160 (p_appli_s_name => 'XLA'
115161 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
115162 ,p_token_1 => 'LINE_NUMBER'
115164 ,p_token_2 => 'LINE_TYPE_NAME'
115165 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
115166 l_component_type
115167 ,l_component_code
115168 ,l_component_type_code
115169 ,l_component_appl_id
115170 ,l_amb_context_code
115171 ,l_entity_code
115172 ,l_event_class_code
115173 )
115174 ,p_token_3 => 'OWNER'
115175 ,p_value_3 => xla_lookups_pkg.get_meaning(
115176 p_lookup_type => 'XLA_OWNER_TYPE'
115177 ,p_lookup_code => l_component_type_code
115178 )
115179 ,p_token_4 => 'PRODUCT_NAME'
115180 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
115181 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
115182 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
115183 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
115184 ,p_ae_header_id => NULL
115185 );
115186
115187 IF (C_LEVEL_ERROR>= g_log_level) THEN
115188 trace
115189 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
115190 ,p_level => C_LEVEL_ERROR
115191 ,p_module => l_log_module);
115192 END IF;
115193 END IF;
115194 END IF;
115195 --
115196 --
115197 ------------------------------------------------------------------------------------------------
115198 -- 4219869 Business Flow
115199 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
115200 -- Prior Entry. Currently, the following code is always generated.
115201 ------------------------------------------------------------------------------------------------
115202 XLA_AE_LINES_PKG.ValidateCurrentLine;
115203
115204 ------------------------------------------------------------------------------------
115205 -- 4219869 Business Flow
115206 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
115207 ------------------------------------------------------------------------------------
115208 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
115209
115210 ----------------------------------------------------------------------------------
115211 -- 4219869 Business Flow
115212 -- Update journal entry status -- Need to generate this within IF <condition>
115213 ----------------------------------------------------------------------------------
115214 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
115215 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
115216 ,p_balance_type_code => l_balance_type_code
115217 );
115218
115219 -------------------------------------------------------------------------------------------
115220 -- 4262811 - Generate the Accrual Reversal lines
115221 -------------------------------------------------------------------------------------------
115222 BEGIN
115223 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
115224 (g_array_event(p_event_id).array_value_num('header_index'));
115225 IF l_acc_rev_flag IS NULL THEN
115226 l_acc_rev_flag := 'N';
115227 END IF;
115228 EXCEPTION
115229 WHEN OTHERS THEN
115230 l_acc_rev_flag := 'N';
115231 END;
115232 --
115233 IF (l_acc_rev_flag = 'Y') THEN
115234
115235 -- 4645092 ------------------------------------------------------------------------------
115236 -- To allow MPA report to determine if it should generate report process
115237 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
115238 ------------------------------------------------------------------------------------------
115239
115240 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
115241 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
115242 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
115243 -- call ADRs
115244 -- Bug 4922099
115245 --
115246 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
115247 (NVL(l_actual_upg_option, 'N') = 'O') OR
115251 NULL;
115248 (NVL(l_enc_upg_option, 'N') = 'O')
115249 )
115250 THEN
115252 --
115253 --
115254
115255 l_ccid := AcctDerRule_175(
115256 p_application_id => p_application_id
115257 , p_ae_header_id => l_ae_header_id
115258 , p_source_5 => p_source_5
115259 , p_source_19 => p_source_19
115260 , p_source_32 => p_source_32
115261 , x_transaction_coa_id => l_adr_transaction_coa_id
115262 , x_accounting_coa_id => l_adr_accounting_coa_id
115263 , x_value_type_code => l_adr_value_type_code
115264 , p_side => 'NA'
115265 );
115266
115267 xla_ae_lines_pkg.set_ccid(
115268 p_code_combination_id => l_ccid
115269 , p_value_type_code => l_adr_value_type_code
115270 , p_transaction_coa_id => l_adr_transaction_coa_id
115271 , p_accounting_coa_id => l_adr_accounting_coa_id
115272 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
115273 , p_adr_type_code => 'S'
115274 , p_component_type => l_component_type
115275 , p_component_code => l_component_code
115276 , p_component_type_code => l_component_type_code
115277 , p_component_appl_id => l_component_appl_id
115278 , p_amb_context_code => l_amb_context_code
115279 , p_side => 'NA'
115280 );
115281
115282
115283 l_segment := AcctDerRule_151(
115284 p_application_id => p_application_id
115285 , p_ae_header_id => l_ae_header_id
115286 , p_source_5 => p_source_5
115287 , p_source_13 => p_source_13
115288 , x_transaction_coa_id => l_adr_transaction_coa_id
115289 , x_accounting_coa_id => l_adr_accounting_coa_id
115290 , x_flexfield_segment_code => l_adr_flexfield_segment_code
115291 , x_flex_value_set_id => l_adr_flex_value_set_id
115292 , x_value_type_code => l_adr_value_type_code
115293 , x_value_combination_id => l_adr_value_combination_id
115294 , x_value_segment_code => l_adr_value_segment_code
115295 , p_side => 'NA'
115296 , p_override_seg_flag => 'Y'
115297 );
115298
115299 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
115300
115301 xla_ae_lines_pkg.set_segment(
115302 p_to_segment_code => 'GL_ACCOUNT'
115303 , p_segment_value => l_segment
115304 , p_from_segment_code => l_adr_value_segment_code
115305 , p_from_combination_id => l_adr_value_combination_id
115306 , p_value_type_code => l_adr_value_type_code
115307 , p_transaction_coa_id => l_adr_transaction_coa_id
115308 , p_accounting_coa_id => l_adr_accounting_coa_id
115309 , p_flexfield_segment_code => l_adr_flexfield_segment_code
115310 , p_flex_value_set_id => l_adr_flex_value_set_id
115311 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
115312 , p_adr_type_code => 'S'
115313 , p_component_type => l_component_type
115314 , p_component_code => l_component_code
115315 , p_component_type_code => l_component_type_code
115316 , p_component_appl_id => l_component_appl_id
115317 , p_amb_context_code => l_amb_context_code
115318 , p_entity_code => 'TRANSACTIONS'
115319 , p_event_class_code => 'RETIREMENTS'
115320 , p_side => 'NA'
115321 );
115322
115323 END IF;
115324
115325 l_segment := AcctDerRule_169(
115326 p_application_id => p_application_id
115327 , p_ae_header_id => l_ae_header_id
115328 , p_source_5 => p_source_5
115329 , p_source_31 => p_source_31
115330 , x_transaction_coa_id => l_adr_transaction_coa_id
115331 , x_accounting_coa_id => l_adr_accounting_coa_id
115332 , x_flexfield_segment_code => l_adr_flexfield_segment_code
115333 , x_flex_value_set_id => l_adr_flex_value_set_id
115334 , x_value_type_code => l_adr_value_type_code
115335 , x_value_combination_id => l_adr_value_combination_id
115336 , x_value_segment_code => l_adr_value_segment_code
115337 , p_side => 'NA'
115338 , p_override_seg_flag => 'Y'
115339 );
115340
115341 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
115342
115343 xla_ae_lines_pkg.set_segment(
115344 p_to_segment_code => 'GL_BALANCING'
115345 , p_segment_value => l_segment
115346 , p_from_segment_code => l_adr_value_segment_code
115347 , p_from_combination_id => l_adr_value_combination_id
115348 , p_value_type_code => l_adr_value_type_code
115349 , p_transaction_coa_id => l_adr_transaction_coa_id
115350 , p_accounting_coa_id => l_adr_accounting_coa_id
115351 , p_flexfield_segment_code => l_adr_flexfield_segment_code
115352 , p_flex_value_set_id => l_adr_flex_value_set_id
115353 , p_adr_code => 'FA_EXPENSE_ACCT'
115354 , p_adr_type_code => 'S'
115355 , p_component_type => l_component_type
115356 , p_component_code => l_component_code
115357 , p_component_type_code => l_component_type_code
115361 , p_event_class_code => 'RETIREMENTS'
115358 , p_component_appl_id => l_component_appl_id
115359 , p_amb_context_code => l_amb_context_code
115360 , p_entity_code => 'TRANSACTIONS'
115362 , p_side => 'NA'
115363 );
115364
115365 END IF;
115366
115367 --
115368 --
115369 END IF;
115370
115371 --
115372 -- Update the line information that should be overwritten
115373 --
115374 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
115375 p_header_num => 1);
115376 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
115377
115378 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
115379
115380 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
115381 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
115382 END IF;
115383
115384 --
115385 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
115386 --
115387 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
115388 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
115389 ELSE
115390 ---------------------------------------------------------------------------------------------------
115391 -- 4262811a Switch Sign
115392 ---------------------------------------------------------------------------------------------------
115393 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
115394 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
115395 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
115396 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
115397 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
115398 -- 5132302
115399 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
115400 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
115401
115402 END IF;
115403
115404 -- 4955764
115405 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
115406 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
115407
115408
115409 XLA_AE_LINES_PKG.ValidateCurrentLine;
115410 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
115411
115412 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
115413 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
115414 ,p_balance_type_code => l_balance_type_code);
115415
115416 END IF;
115417
115418 -----------------------------------------------------------------------------------------
115419 -- 4262811 Multiperiod Accounting
115420 -----------------------------------------------------------------------------------------
115421 -- No MPA option is assigned.
115422
115423
115424 END IF;
115425 END IF;
115426 --
115427
115428 --
115429 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
115430 trace
115431 (p_msg => 'END of AcctLineType_325'
115432 ,p_level => C_LEVEL_PROCEDURE
115433 ,p_module => l_log_module);
115434 END IF;
115435 --
115436 EXCEPTION
115437 WHEN xla_exceptions_pkg.application_exception THEN
115438 RAISE;
115439 WHEN OTHERS THEN
115440 xla_exceptions_pkg.raise_message
115441 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_325');
115442 END AcctLineType_325;
115443 --
115444
115445 ---------------------------------------
115446 --
115447 -- PRIVATE FUNCTION
115448 -- AcctLineType_326
115449 --
115450 ---------------------------------------
115451 PROCEDURE AcctLineType_326 (
115452 p_application_id IN NUMBER
115453 ,p_event_id IN NUMBER
115454 ,p_calculate_acctd_flag IN VARCHAR2
115455 ,p_calculate_g_l_flag IN VARCHAR2
115456 ,p_actual_flag IN OUT VARCHAR2
115457 ,p_balance_type_code OUT VARCHAR2
115458 ,p_gain_or_loss_ref OUT VARCHAR2
115459
115460 --Period Close Date
115461 , p_source_1 IN DATE
115462 --Generated Code Combination Identifier
115463 , p_source_5 IN NUMBER
115464 --Revaluation Reserve Retired Gain Account
115465 , p_source_29 IN VARCHAR2
115466 --Expense Account Code Combination Identifier
115467 , p_source_31 IN NUMBER
115468 --Default Code Combination Identifier
115469 , p_source_32 IN NUMBER
115470 --Adjustment Type
115471 , p_source_48 IN VARCHAR2
115472 --Transaction Header Identifier
115473 , p_source_49 IN NUMBER
115474 --Adjustment Line Identifier
115475 , p_source_50 IN NUMBER
115476 --Distribution Type Code
115477 , p_source_51 IN VARCHAR2
115478 --Entered Amount
115479 , p_source_52 IN NUMBER
115480 --Currency Code
115481 , p_source_53 IN VARCHAR2
115482 --Gain Loss Amount
115483 , p_source_54 IN NUMBER
115484 )
115485 IS
115486
115490 l_component_appl_id INTEGER;
115487 l_component_type VARCHAR2(80);
115488 l_component_code VARCHAR2(30);
115489 l_component_type_code VARCHAR2(1);
115491 l_amb_context_code VARCHAR2(30);
115492 l_entity_code VARCHAR2(30);
115493 l_event_class_code VARCHAR2(30);
115494 l_ae_header_id NUMBER;
115495 l_event_type_code VARCHAR2(30);
115496 l_line_definition_code VARCHAR2(30);
115497 l_line_definition_owner_code VARCHAR2(1);
115498 --
115499 -- adr variables
115500 l_segment VARCHAR2(30);
115501 l_ccid NUMBER;
115502 l_adr_transaction_coa_id NUMBER;
115503 l_adr_accounting_coa_id NUMBER;
115504 l_adr_flexfield_segment_code VARCHAR2(30);
115505 l_adr_flex_value_set_id NUMBER;
115506 l_adr_value_type_code VARCHAR2(30);
115507 l_adr_value_combination_id NUMBER;
115508 l_adr_value_segment_code VARCHAR2(30);
115509
115510 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
115511 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
115512 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
115513 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
115514
115515 -- 4262811 Variables ------------------------------------------------------------------------------------------
115516 l_entered_amt_idx NUMBER;
115517 l_accted_amt_idx NUMBER;
115518 l_acc_rev_flag VARCHAR2(1);
115519 l_accrual_line_num NUMBER;
115520 l_tmp_amt NUMBER;
115521 l_acc_rev_natural_side_code VARCHAR2(1);
115522
115523 l_num_entries NUMBER;
115524 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
115525 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
115526 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
115527 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
115528 l_recog_line_1 NUMBER;
115529 l_recog_line_2 NUMBER;
115530
115531 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
115532 l_bflow_applied_to_amt NUMBER; -- 5132302
115533 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
115534
115535 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
115536
115537 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
115538 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
115539
115540 ---------------------------------------------------------------------------------------------------------------
115541
115542
115543 --
115544 -- bulk performance
115545 --
115546 l_balance_type_code VARCHAR2(1);
115547 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
115548 l_log_module VARCHAR2(240);
115549
115550 --
115551 -- Upgrade strategy
115552 --
115553 l_actual_upg_option VARCHAR2(1);
115554 l_enc_upg_option VARCHAR2(1);
115555
115556 --
115557 BEGIN
115558 --
115559 IF g_log_enabled THEN
115560 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_326';
115561 END IF;
115562 --
115563 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
115564
115565 trace
115566 (p_msg => 'BEGIN of AcctLineType_326'
115567 ,p_level => C_LEVEL_PROCEDURE
115568 ,p_module => l_log_module);
115569
115570 END IF;
115571 --
115572 l_component_type := 'AMB_JLT';
115573 l_component_code := 'FA_RET_REVAL_RESERVE_GAIN';
115574 l_component_type_code := 'S';
115575 l_component_appl_id := 140;
115576 l_amb_context_code := 'DEFAULT';
115577 l_entity_code := 'TRANSACTIONS';
115578 l_event_class_code := 'RETIREMENTS';
115579 l_event_type_code := 'REINSTATEMENTS';
115580 l_line_definition_owner_code := 'S';
115581 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
115582 --
115583 l_balance_type_code := 'A';
115584 l_segment := NULL;
115585 l_ccid := NULL;
115586 l_adr_transaction_coa_id := NULL;
115587 l_adr_accounting_coa_id := NULL;
115588 l_adr_flexfield_segment_code := NULL;
115589 l_adr_flex_value_set_id := NULL;
115590 l_adr_value_type_code := NULL;
115591 l_adr_value_combination_id := NULL;
115592 l_adr_value_segment_code := NULL;
115593
115594 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
115595 l_bflow_class_code := ''; -- 4219869 Business Flow
115596 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
115597 l_budgetary_control_flag := 'N';
115598
115599 l_bflow_applied_to_amt_idx := NULL; -- 5132302
115600 l_bflow_applied_to_amt := NULL; -- 5132302
115601 l_entered_amt_idx := NULL; -- 4262811
115602 l_accted_amt_idx := NULL; -- 4262811
115603 l_acc_rev_flag := NULL; -- 4262811
115604 l_accrual_line_num := NULL; -- 4262811
115605 l_tmp_amt := NULL; -- 4262811
115606 --
115607
115608 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
115609 l_balance_type_code <> 'B' THEN
115610 IF NVL(p_source_48,'
115614
115611 ') = 'REVAL RSV RET' AND
115612 p_source_54 >= 0
115613 THEN
115615 --
115616 XLA_AE_LINES_PKG.SetNewLine;
115617
115618 p_balance_type_code := l_balance_type_code;
115619 -- set the flag so later we will know whether the gain loss line needs to be created
115620
115621 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
115622 p_actual_flag :='A';
115623 END IF;
115624
115625 --
115626 -- bulk performance
115627 --
115628 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
115629 p_header_num => 0); -- 4262811
115630 --
115631 -- set accounting line options
115632 --
115633 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
115634 p_natural_side_code => 'C'
115635 , p_gain_or_loss_flag => 'N'
115636 , p_gl_transfer_mode_code => 'S'
115637 , p_acct_entry_type_code => 'A'
115638 , p_switch_side_flag => 'Y'
115639 , p_merge_duplicate_code => 'N'
115640 );
115641 --
115642 l_acc_rev_natural_side_code := 'D'; -- 4262811
115643 --
115644 --
115645 -- set accounting line type info
115646 --
115647 xla_ae_lines_pkg.SetAcctLineType
115648 (p_component_type => l_component_type
115649 ,p_event_type_code => l_event_type_code
115650 ,p_line_definition_owner_code => l_line_definition_owner_code
115651 ,p_line_definition_code => l_line_definition_code
115652 ,p_accounting_line_code => l_component_code
115653 ,p_accounting_line_type_code => l_component_type_code
115654 ,p_accounting_line_appl_id => l_component_appl_id
115655 ,p_amb_context_code => l_amb_context_code
115656 ,p_entity_code => l_entity_code
115657 ,p_event_class_code => l_event_class_code);
115658 --
115659 -- set accounting class
115660 --
115661 xla_ae_lines_pkg.SetAcctClass(
115662 p_accounting_class_code => 'ASSET'
115663 , p_ae_header_id => l_ae_header_id
115664 );
115665
115666 --
115667 -- set rounding class
115668 --
115669 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
115670 'ASSET';
115671
115672 --
115673 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
115674 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
115675 --
115676 -- bulk performance
115677 --
115678 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
115679
115680 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
115681 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
115682
115683 -- 4955764
115684 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
115685 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
115686
115687 -- 4458381 Public Sector Enh
115688
115689 --
115690 -- set accounting attributes for the line type
115691 --
115692 l_entered_amt_idx := 4;
115693 l_accted_amt_idx := 6;
115694 l_bflow_applied_to_amt_idx := NULL; -- 5132302
115695 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
115696 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
115697 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
115698 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
115699 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
115700 l_rec_acct_attrs.array_char_value(3) := p_source_51;
115701 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
115702 l_rec_acct_attrs.array_num_value(4) := p_source_52;
115703 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
115704 l_rec_acct_attrs.array_char_value(5) := p_source_53;
115705 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
115706 l_rec_acct_attrs.array_num_value(6) := p_source_52;
115707
115708 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
115709 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
115710
115711 ---------------------------------------------------------------------------------------------------------------
115712 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
115713 ---------------------------------------------------------------------------------------------------------------
115714 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
115715
115716 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
115717 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
115718
115719 IF xla_accounting_cache_pkg.GetValueChar
115720 (p_source_code => 'LEDGER_CATEGORY_CODE'
115721 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
115722 AND l_bflow_method_code = 'PRIOR_ENTRY'
115723 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
115724 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
115728 xla_ae_lines_pkg.BflowUpgEntry
115725 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
115726 )
115727 THEN
115729 (p_business_method_code => l_bflow_method_code
115730 ,p_business_class_code => l_bflow_class_code
115731 ,p_balance_type => l_balance_type_code);
115732 ELSE
115733 NULL;
115734 -- No business flow processing for business flow method of NONE.
115735 END IF;
115736
115737 --
115738 -- call analytical criteria
115739 --
115740
115741 --
115742 -- call description
115743 --
115744
115745 xla_ae_lines_pkg.SetLineDescription(
115746 p_ae_header_id => l_ae_header_id
115747 ,p_description => Description_83 (
115748 p_application_id => p_application_id
115749 , p_ae_header_id => l_ae_header_id
115750 , p_source_1 => p_source_1
115751 )
115752 );
115753
115754
115755 --
115756 -- call ADRs
115757 -- Bug 4922099
115758 --
115759 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
115760 (NVL(l_actual_upg_option, 'N') = 'O') OR
115761 (NVL(l_enc_upg_option, 'N') = 'O')
115762 )
115763 THEN
115764 NULL;
115765 --
115766 --
115767
115768 l_ccid := AcctDerRule_174(
115769 p_application_id => p_application_id
115770 , p_ae_header_id => l_ae_header_id
115771 , p_source_5 => p_source_5
115772 , p_source_32 => p_source_32
115773 , x_transaction_coa_id => l_adr_transaction_coa_id
115774 , x_accounting_coa_id => l_adr_accounting_coa_id
115775 , x_value_type_code => l_adr_value_type_code
115776 , p_side => 'NA'
115777 );
115778
115779 xla_ae_lines_pkg.set_ccid(
115780 p_code_combination_id => l_ccid
115781 , p_value_type_code => l_adr_value_type_code
115782 , p_transaction_coa_id => l_adr_transaction_coa_id
115783 , p_accounting_coa_id => l_adr_accounting_coa_id
115784 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
115785 , p_adr_type_code => 'S'
115786 , p_component_type => l_component_type
115787 , p_component_code => l_component_code
115788 , p_component_type_code => l_component_type_code
115789 , p_component_appl_id => l_component_appl_id
115790 , p_amb_context_code => l_amb_context_code
115791 , p_side => 'NA'
115792 );
115793
115794
115795 l_segment := AcctDerRule_169(
115796 p_application_id => p_application_id
115797 , p_ae_header_id => l_ae_header_id
115798 , p_source_5 => p_source_5
115799 , p_source_31 => p_source_31
115800 , x_transaction_coa_id => l_adr_transaction_coa_id
115801 , x_accounting_coa_id => l_adr_accounting_coa_id
115802 , x_flexfield_segment_code => l_adr_flexfield_segment_code
115803 , x_flex_value_set_id => l_adr_flex_value_set_id
115804 , x_value_type_code => l_adr_value_type_code
115805 , x_value_combination_id => l_adr_value_combination_id
115806 , x_value_segment_code => l_adr_value_segment_code
115807 , p_side => 'NA'
115808 , p_override_seg_flag => 'Y'
115809 );
115810
115811 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
115812
115813 xla_ae_lines_pkg.set_segment(
115814 p_to_segment_code => 'GL_BALANCING'
115815 , p_segment_value => l_segment
115816 , p_from_segment_code => l_adr_value_segment_code
115817 , p_from_combination_id => l_adr_value_combination_id
115818 , p_value_type_code => l_adr_value_type_code
115819 , p_transaction_coa_id => l_adr_transaction_coa_id
115820 , p_accounting_coa_id => l_adr_accounting_coa_id
115821 , p_flexfield_segment_code => l_adr_flexfield_segment_code
115822 , p_flex_value_set_id => l_adr_flex_value_set_id
115823 , p_adr_code => 'FA_EXPENSE_ACCT'
115824 , p_adr_type_code => 'S'
115825 , p_component_type => l_component_type
115826 , p_component_code => l_component_code
115827 , p_component_type_code => l_component_type_code
115828 , p_component_appl_id => l_component_appl_id
115829 , p_amb_context_code => l_amb_context_code
115830 , p_entity_code => 'TRANSACTIONS'
115831 , p_event_class_code => 'RETIREMENTS'
115832 , p_side => 'NA'
115833 );
115834
115835 END IF;
115836
115837 l_segment := AcctDerRule_166(
115838 p_application_id => p_application_id
115839 , p_ae_header_id => l_ae_header_id
115840 , p_source_5 => p_source_5
115841 , p_source_29 => p_source_29
115842 , x_transaction_coa_id => l_adr_transaction_coa_id
115843 , x_accounting_coa_id => l_adr_accounting_coa_id
115844 , x_flexfield_segment_code => l_adr_flexfield_segment_code
115845 , x_flex_value_set_id => l_adr_flex_value_set_id
115846 , x_value_type_code => l_adr_value_type_code
115847 , x_value_combination_id => l_adr_value_combination_id
115848 , x_value_segment_code => l_adr_value_segment_code
115852
115849 , p_side => 'NA'
115850 , p_override_seg_flag => 'Y'
115851 );
115853 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
115854
115855 xla_ae_lines_pkg.set_segment(
115856 p_to_segment_code => 'GL_ACCOUNT'
115857 , p_segment_value => l_segment
115858 , p_from_segment_code => l_adr_value_segment_code
115859 , p_from_combination_id => l_adr_value_combination_id
115860 , p_value_type_code => l_adr_value_type_code
115861 , p_transaction_coa_id => l_adr_transaction_coa_id
115862 , p_accounting_coa_id => l_adr_accounting_coa_id
115863 , p_flexfield_segment_code => l_adr_flexfield_segment_code
115864 , p_flex_value_set_id => l_adr_flex_value_set_id
115865 , p_adr_code => 'FA_REVAL_RES_RET_GAIN_SEGMENT'
115866 , p_adr_type_code => 'S'
115867 , p_component_type => l_component_type
115868 , p_component_code => l_component_code
115869 , p_component_type_code => l_component_type_code
115870 , p_component_appl_id => l_component_appl_id
115871 , p_amb_context_code => l_amb_context_code
115872 , p_entity_code => 'TRANSACTIONS'
115873 , p_event_class_code => 'RETIREMENTS'
115874 , p_side => 'NA'
115875 );
115876
115877 END IF;
115878
115879 --
115880 --
115881 END IF;
115882 --
115883 -- Bug 4922099
115884 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
115885 (NVL(l_enc_upg_option, 'N') = 'O')
115886 ) AND
115887 (l_bflow_method_code = 'PRIOR_ENTRY')
115888 )
115889 THEN
115890 IF
115891 --
115892 1 = 2
115893 --
115894 THEN
115895 xla_accounting_err_pkg.build_message
115896 (p_appli_s_name => 'XLA'
115897 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
115898 ,p_token_1 => 'LINE_NUMBER'
115899 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
115900 ,p_token_2 => 'LINE_TYPE_NAME'
115901 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
115902 l_component_type
115903 ,l_component_code
115904 ,l_component_type_code
115905 ,l_component_appl_id
115906 ,l_amb_context_code
115907 ,l_entity_code
115908 ,l_event_class_code
115909 )
115910 ,p_token_3 => 'OWNER'
115911 ,p_value_3 => xla_lookups_pkg.get_meaning(
115912 p_lookup_type => 'XLA_OWNER_TYPE'
115913 ,p_lookup_code => l_component_type_code
115914 )
115915 ,p_token_4 => 'PRODUCT_NAME'
115916 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
115917 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
115918 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
115919 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
115920 ,p_ae_header_id => NULL
115921 );
115922
115923 IF (C_LEVEL_ERROR>= g_log_level) THEN
115924 trace
115925 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
115926 ,p_level => C_LEVEL_ERROR
115927 ,p_module => l_log_module);
115928 END IF;
115929 END IF;
115930 END IF;
115931 --
115932 --
115933 ------------------------------------------------------------------------------------------------
115934 -- 4219869 Business Flow
115935 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
115936 -- Prior Entry. Currently, the following code is always generated.
115937 ------------------------------------------------------------------------------------------------
115938 XLA_AE_LINES_PKG.ValidateCurrentLine;
115939
115940 ------------------------------------------------------------------------------------
115941 -- 4219869 Business Flow
115942 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
115943 ------------------------------------------------------------------------------------
115944 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
115945
115946 ----------------------------------------------------------------------------------
115950 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
115947 -- 4219869 Business Flow
115948 -- Update journal entry status -- Need to generate this within IF <condition>
115949 ----------------------------------------------------------------------------------
115951 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
115952 ,p_balance_type_code => l_balance_type_code
115953 );
115954
115955 -------------------------------------------------------------------------------------------
115956 -- 4262811 - Generate the Accrual Reversal lines
115957 -------------------------------------------------------------------------------------------
115958 BEGIN
115959 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
115960 (g_array_event(p_event_id).array_value_num('header_index'));
115961 IF l_acc_rev_flag IS NULL THEN
115962 l_acc_rev_flag := 'N';
115963 END IF;
115964 EXCEPTION
115965 WHEN OTHERS THEN
115966 l_acc_rev_flag := 'N';
115967 END;
115968 --
115969 IF (l_acc_rev_flag = 'Y') THEN
115970
115971 -- 4645092 ------------------------------------------------------------------------------
115972 -- To allow MPA report to determine if it should generate report process
115973 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
115974 ------------------------------------------------------------------------------------------
115975
115976 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
115977 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
115978 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
115979 -- call ADRs
115980 -- Bug 4922099
115981 --
115982 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
115983 (NVL(l_actual_upg_option, 'N') = 'O') OR
115984 (NVL(l_enc_upg_option, 'N') = 'O')
115985 )
115986 THEN
115987 NULL;
115988 --
115989 --
115990
115991 l_ccid := AcctDerRule_174(
115992 p_application_id => p_application_id
115993 , p_ae_header_id => l_ae_header_id
115994 , p_source_5 => p_source_5
115995 , p_source_32 => p_source_32
115996 , x_transaction_coa_id => l_adr_transaction_coa_id
115997 , x_accounting_coa_id => l_adr_accounting_coa_id
115998 , x_value_type_code => l_adr_value_type_code
115999 , p_side => 'NA'
116000 );
116001
116002 xla_ae_lines_pkg.set_ccid(
116003 p_code_combination_id => l_ccid
116004 , p_value_type_code => l_adr_value_type_code
116005 , p_transaction_coa_id => l_adr_transaction_coa_id
116006 , p_accounting_coa_id => l_adr_accounting_coa_id
116007 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
116008 , p_adr_type_code => 'S'
116009 , p_component_type => l_component_type
116010 , p_component_code => l_component_code
116011 , p_component_type_code => l_component_type_code
116012 , p_component_appl_id => l_component_appl_id
116013 , p_amb_context_code => l_amb_context_code
116014 , p_side => 'NA'
116015 );
116016
116017
116018 l_segment := AcctDerRule_169(
116019 p_application_id => p_application_id
116020 , p_ae_header_id => l_ae_header_id
116021 , p_source_5 => p_source_5
116022 , p_source_31 => p_source_31
116023 , x_transaction_coa_id => l_adr_transaction_coa_id
116024 , x_accounting_coa_id => l_adr_accounting_coa_id
116025 , x_flexfield_segment_code => l_adr_flexfield_segment_code
116026 , x_flex_value_set_id => l_adr_flex_value_set_id
116027 , x_value_type_code => l_adr_value_type_code
116028 , x_value_combination_id => l_adr_value_combination_id
116029 , x_value_segment_code => l_adr_value_segment_code
116030 , p_side => 'NA'
116031 , p_override_seg_flag => 'Y'
116032 );
116033
116034 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
116035
116036 xla_ae_lines_pkg.set_segment(
116037 p_to_segment_code => 'GL_BALANCING'
116038 , p_segment_value => l_segment
116039 , p_from_segment_code => l_adr_value_segment_code
116040 , p_from_combination_id => l_adr_value_combination_id
116041 , p_value_type_code => l_adr_value_type_code
116042 , p_transaction_coa_id => l_adr_transaction_coa_id
116043 , p_accounting_coa_id => l_adr_accounting_coa_id
116044 , p_flexfield_segment_code => l_adr_flexfield_segment_code
116045 , p_flex_value_set_id => l_adr_flex_value_set_id
116046 , p_adr_code => 'FA_EXPENSE_ACCT'
116047 , p_adr_type_code => 'S'
116048 , p_component_type => l_component_type
116049 , p_component_code => l_component_code
116050 , p_component_type_code => l_component_type_code
116051 , p_component_appl_id => l_component_appl_id
116052 , p_amb_context_code => l_amb_context_code
116053 , p_entity_code => 'TRANSACTIONS'
116054 , p_event_class_code => 'RETIREMENTS'
116055 , p_side => 'NA'
116056 );
116057
116058 END IF;
116059
116060 l_segment := AcctDerRule_166(
116061 p_application_id => p_application_id
116065 , x_transaction_coa_id => l_adr_transaction_coa_id
116062 , p_ae_header_id => l_ae_header_id
116063 , p_source_5 => p_source_5
116064 , p_source_29 => p_source_29
116066 , x_accounting_coa_id => l_adr_accounting_coa_id
116067 , x_flexfield_segment_code => l_adr_flexfield_segment_code
116068 , x_flex_value_set_id => l_adr_flex_value_set_id
116069 , x_value_type_code => l_adr_value_type_code
116070 , x_value_combination_id => l_adr_value_combination_id
116071 , x_value_segment_code => l_adr_value_segment_code
116072 , p_side => 'NA'
116073 , p_override_seg_flag => 'Y'
116074 );
116075
116076 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
116077
116078 xla_ae_lines_pkg.set_segment(
116079 p_to_segment_code => 'GL_ACCOUNT'
116080 , p_segment_value => l_segment
116081 , p_from_segment_code => l_adr_value_segment_code
116082 , p_from_combination_id => l_adr_value_combination_id
116083 , p_value_type_code => l_adr_value_type_code
116084 , p_transaction_coa_id => l_adr_transaction_coa_id
116085 , p_accounting_coa_id => l_adr_accounting_coa_id
116086 , p_flexfield_segment_code => l_adr_flexfield_segment_code
116087 , p_flex_value_set_id => l_adr_flex_value_set_id
116088 , p_adr_code => 'FA_REVAL_RES_RET_GAIN_SEGMENT'
116089 , p_adr_type_code => 'S'
116090 , p_component_type => l_component_type
116091 , p_component_code => l_component_code
116092 , p_component_type_code => l_component_type_code
116093 , p_component_appl_id => l_component_appl_id
116094 , p_amb_context_code => l_amb_context_code
116095 , p_entity_code => 'TRANSACTIONS'
116096 , p_event_class_code => 'RETIREMENTS'
116097 , p_side => 'NA'
116098 );
116099
116100 END IF;
116101
116102 --
116103 --
116104 END IF;
116105
116106 --
116107 -- Update the line information that should be overwritten
116108 --
116109 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
116110 p_header_num => 1);
116111 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
116112
116113 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
116114
116115 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
116116 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
116117 END IF;
116118
116119 --
116120 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
116121 --
116122 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
116123 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
116124 ELSE
116125 ---------------------------------------------------------------------------------------------------
116126 -- 4262811a Switch Sign
116127 ---------------------------------------------------------------------------------------------------
116128 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
116129 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
116130 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
116131 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
116132 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
116133 -- 5132302
116134 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
116135 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
116136
116137 END IF;
116138
116139 -- 4955764
116140 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
116141 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
116142
116143
116144 XLA_AE_LINES_PKG.ValidateCurrentLine;
116145 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
116146
116147 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
116148 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
116149 ,p_balance_type_code => l_balance_type_code);
116150
116151 END IF;
116152
116153 -----------------------------------------------------------------------------------------
116154 -- 4262811 Multiperiod Accounting
116155 -----------------------------------------------------------------------------------------
116156 -- No MPA option is assigned.
116157
116158
116159 END IF;
116160 END IF;
116161 --
116162
116163 --
116164 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
116165 trace
116166 (p_msg => 'END of AcctLineType_326'
116167 ,p_level => C_LEVEL_PROCEDURE
116168 ,p_module => l_log_module);
116169 END IF;
116170 --
116171 EXCEPTION
116175 xla_exceptions_pkg.raise_message
116172 WHEN xla_exceptions_pkg.application_exception THEN
116173 RAISE;
116174 WHEN OTHERS THEN
116176 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_326');
116177 END AcctLineType_326;
116178 --
116179
116180 ---------------------------------------
116181 --
116182 -- PRIVATE FUNCTION
116183 -- AcctLineType_327
116184 --
116185 ---------------------------------------
116186 PROCEDURE AcctLineType_327 (
116187 p_application_id IN NUMBER
116188 ,p_event_id IN NUMBER
116189 ,p_calculate_acctd_flag IN VARCHAR2
116190 ,p_calculate_g_l_flag IN VARCHAR2
116191 ,p_actual_flag IN OUT VARCHAR2
116192 ,p_balance_type_code OUT VARCHAR2
116193 ,p_gain_or_loss_ref OUT VARCHAR2
116194
116195 --Period Close Date
116196 , p_source_1 IN DATE
116197 --Generated Code Combination Identifier
116198 , p_source_5 IN NUMBER
116199 --Revaluation Reserve Retired Gain Account
116200 , p_source_29 IN VARCHAR2
116201 --Expense Account Code Combination Identifier
116202 , p_source_31 IN NUMBER
116203 --Default Code Combination Identifier
116204 , p_source_32 IN NUMBER
116205 --Adjustment Type
116206 , p_source_48 IN VARCHAR2
116207 --Transaction Header Identifier
116208 , p_source_49 IN NUMBER
116209 --Adjustment Line Identifier
116210 , p_source_50 IN NUMBER
116211 --Distribution Type Code
116212 , p_source_51 IN VARCHAR2
116213 --Entered Amount
116214 , p_source_52 IN NUMBER
116215 --Currency Code
116216 , p_source_53 IN VARCHAR2
116217 --Gain Loss Amount
116218 , p_source_54 IN NUMBER
116219 )
116220 IS
116221
116222 l_component_type VARCHAR2(80);
116223 l_component_code VARCHAR2(30);
116224 l_component_type_code VARCHAR2(1);
116225 l_component_appl_id INTEGER;
116226 l_amb_context_code VARCHAR2(30);
116227 l_entity_code VARCHAR2(30);
116228 l_event_class_code VARCHAR2(30);
116229 l_ae_header_id NUMBER;
116230 l_event_type_code VARCHAR2(30);
116231 l_line_definition_code VARCHAR2(30);
116232 l_line_definition_owner_code VARCHAR2(1);
116233 --
116234 -- adr variables
116235 l_segment VARCHAR2(30);
116236 l_ccid NUMBER;
116237 l_adr_transaction_coa_id NUMBER;
116238 l_adr_accounting_coa_id NUMBER;
116239 l_adr_flexfield_segment_code VARCHAR2(30);
116240 l_adr_flex_value_set_id NUMBER;
116241 l_adr_value_type_code VARCHAR2(30);
116242 l_adr_value_combination_id NUMBER;
116243 l_adr_value_segment_code VARCHAR2(30);
116244
116245 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
116246 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
116247 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
116248 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
116249
116250 -- 4262811 Variables ------------------------------------------------------------------------------------------
116251 l_entered_amt_idx NUMBER;
116252 l_accted_amt_idx NUMBER;
116253 l_acc_rev_flag VARCHAR2(1);
116254 l_accrual_line_num NUMBER;
116255 l_tmp_amt NUMBER;
116256 l_acc_rev_natural_side_code VARCHAR2(1);
116257
116258 l_num_entries NUMBER;
116259 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
116260 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
116261 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
116262 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
116263 l_recog_line_1 NUMBER;
116264 l_recog_line_2 NUMBER;
116265
116266 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
116267 l_bflow_applied_to_amt NUMBER; -- 5132302
116268 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
116269
116270 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
116271
116272 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
116273 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
116274
116275 ---------------------------------------------------------------------------------------------------------------
116276
116277
116278 --
116279 -- bulk performance
116280 --
116281 l_balance_type_code VARCHAR2(1);
116282 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
116283 l_log_module VARCHAR2(240);
116284
116285 --
116286 -- Upgrade strategy
116287 --
116288 l_actual_upg_option VARCHAR2(1);
116289 l_enc_upg_option VARCHAR2(1);
116290
116291 --
116292 BEGIN
116293 --
116294 IF g_log_enabled THEN
116295 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_327';
116296 END IF;
116297 --
116298 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
116299
116300 trace
116301 (p_msg => 'BEGIN of AcctLineType_327'
116302 ,p_level => C_LEVEL_PROCEDURE
116303 ,p_module => l_log_module);
116304
116305 END IF;
116306 --
116307 l_component_type := 'AMB_JLT';
116311 l_amb_context_code := 'DEFAULT';
116308 l_component_code := 'FA_RET_REVAL_RESERVE_GAIN';
116309 l_component_type_code := 'S';
116310 l_component_appl_id := 140;
116312 l_entity_code := 'TRANSACTIONS';
116313 l_event_class_code := 'RETIREMENTS';
116314 l_event_type_code := 'RETIREMENTS';
116315 l_line_definition_owner_code := 'S';
116316 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
116317 --
116318 l_balance_type_code := 'A';
116319 l_segment := NULL;
116320 l_ccid := NULL;
116321 l_adr_transaction_coa_id := NULL;
116322 l_adr_accounting_coa_id := NULL;
116323 l_adr_flexfield_segment_code := NULL;
116324 l_adr_flex_value_set_id := NULL;
116325 l_adr_value_type_code := NULL;
116326 l_adr_value_combination_id := NULL;
116327 l_adr_value_segment_code := NULL;
116328
116329 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
116330 l_bflow_class_code := ''; -- 4219869 Business Flow
116331 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
116332 l_budgetary_control_flag := 'N';
116333
116334 l_bflow_applied_to_amt_idx := NULL; -- 5132302
116335 l_bflow_applied_to_amt := NULL; -- 5132302
116336 l_entered_amt_idx := NULL; -- 4262811
116337 l_accted_amt_idx := NULL; -- 4262811
116338 l_acc_rev_flag := NULL; -- 4262811
116339 l_accrual_line_num := NULL; -- 4262811
116340 l_tmp_amt := NULL; -- 4262811
116341 --
116342
116343 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
116344 l_balance_type_code <> 'B' THEN
116345 IF NVL(p_source_48,'
116346 ') = 'REVAL RSV RET' AND
116347 p_source_54 >= 0
116348 THEN
116349
116350 --
116351 XLA_AE_LINES_PKG.SetNewLine;
116352
116353 p_balance_type_code := l_balance_type_code;
116354 -- set the flag so later we will know whether the gain loss line needs to be created
116355
116356 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
116357 p_actual_flag :='A';
116358 END IF;
116359
116360 --
116361 -- bulk performance
116362 --
116363 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
116364 p_header_num => 0); -- 4262811
116365 --
116366 -- set accounting line options
116367 --
116368 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
116369 p_natural_side_code => 'C'
116370 , p_gain_or_loss_flag => 'N'
116371 , p_gl_transfer_mode_code => 'S'
116372 , p_acct_entry_type_code => 'A'
116373 , p_switch_side_flag => 'Y'
116374 , p_merge_duplicate_code => 'N'
116375 );
116376 --
116377 l_acc_rev_natural_side_code := 'D'; -- 4262811
116378 --
116379 --
116380 -- set accounting line type info
116381 --
116382 xla_ae_lines_pkg.SetAcctLineType
116383 (p_component_type => l_component_type
116384 ,p_event_type_code => l_event_type_code
116385 ,p_line_definition_owner_code => l_line_definition_owner_code
116386 ,p_line_definition_code => l_line_definition_code
116387 ,p_accounting_line_code => l_component_code
116388 ,p_accounting_line_type_code => l_component_type_code
116389 ,p_accounting_line_appl_id => l_component_appl_id
116390 ,p_amb_context_code => l_amb_context_code
116391 ,p_entity_code => l_entity_code
116392 ,p_event_class_code => l_event_class_code);
116393 --
116394 -- set accounting class
116395 --
116396 xla_ae_lines_pkg.SetAcctClass(
116397 p_accounting_class_code => 'ASSET'
116398 , p_ae_header_id => l_ae_header_id
116399 );
116400
116401 --
116402 -- set rounding class
116403 --
116404 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
116405 'ASSET';
116406
116407 --
116408 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
116409 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
116410 --
116411 -- bulk performance
116412 --
116413 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
116414
116415 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
116416 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
116417
116418 -- 4955764
116419 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
116420 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
116421
116422 -- 4458381 Public Sector Enh
116423
116424 --
116425 -- set accounting attributes for the line type
116426 --
116427 l_entered_amt_idx := 4;
116428 l_accted_amt_idx := 6;
116429 l_bflow_applied_to_amt_idx := NULL; -- 5132302
116430 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
116431 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
116435 l_rec_acct_attrs.array_char_value(3) := p_source_51;
116432 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
116433 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
116434 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
116436 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
116437 l_rec_acct_attrs.array_num_value(4) := p_source_52;
116438 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
116439 l_rec_acct_attrs.array_char_value(5) := p_source_53;
116440 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
116441 l_rec_acct_attrs.array_num_value(6) := p_source_52;
116442
116443 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
116444 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
116445
116446 ---------------------------------------------------------------------------------------------------------------
116447 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
116448 ---------------------------------------------------------------------------------------------------------------
116449 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
116450
116451 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
116452 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
116453
116454 IF xla_accounting_cache_pkg.GetValueChar
116455 (p_source_code => 'LEDGER_CATEGORY_CODE'
116456 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
116457 AND l_bflow_method_code = 'PRIOR_ENTRY'
116458 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
116459 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
116460 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
116461 )
116462 THEN
116463 xla_ae_lines_pkg.BflowUpgEntry
116464 (p_business_method_code => l_bflow_method_code
116465 ,p_business_class_code => l_bflow_class_code
116466 ,p_balance_type => l_balance_type_code);
116467 ELSE
116468 NULL;
116469 -- No business flow processing for business flow method of NONE.
116470 END IF;
116471
116472 --
116473 -- call analytical criteria
116474 --
116475
116476 --
116477 -- call description
116478 --
116479
116480 xla_ae_lines_pkg.SetLineDescription(
116481 p_ae_header_id => l_ae_header_id
116482 ,p_description => Description_89 (
116483 p_application_id => p_application_id
116484 , p_ae_header_id => l_ae_header_id
116485 , p_source_1 => p_source_1
116486 )
116487 );
116488
116489
116490 --
116491 -- call ADRs
116492 -- Bug 4922099
116493 --
116494 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
116495 (NVL(l_actual_upg_option, 'N') = 'O') OR
116496 (NVL(l_enc_upg_option, 'N') = 'O')
116497 )
116498 THEN
116499 NULL;
116500 --
116501 --
116502
116503 l_ccid := AcctDerRule_174(
116504 p_application_id => p_application_id
116505 , p_ae_header_id => l_ae_header_id
116506 , p_source_5 => p_source_5
116507 , p_source_32 => p_source_32
116508 , x_transaction_coa_id => l_adr_transaction_coa_id
116509 , x_accounting_coa_id => l_adr_accounting_coa_id
116510 , x_value_type_code => l_adr_value_type_code
116511 , p_side => 'NA'
116512 );
116513
116514 xla_ae_lines_pkg.set_ccid(
116515 p_code_combination_id => l_ccid
116516 , p_value_type_code => l_adr_value_type_code
116517 , p_transaction_coa_id => l_adr_transaction_coa_id
116518 , p_accounting_coa_id => l_adr_accounting_coa_id
116519 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
116520 , p_adr_type_code => 'S'
116521 , p_component_type => l_component_type
116522 , p_component_code => l_component_code
116523 , p_component_type_code => l_component_type_code
116524 , p_component_appl_id => l_component_appl_id
116525 , p_amb_context_code => l_amb_context_code
116526 , p_side => 'NA'
116527 );
116528
116529
116530 l_segment := AcctDerRule_169(
116531 p_application_id => p_application_id
116532 , p_ae_header_id => l_ae_header_id
116533 , p_source_5 => p_source_5
116534 , p_source_31 => p_source_31
116535 , x_transaction_coa_id => l_adr_transaction_coa_id
116536 , x_accounting_coa_id => l_adr_accounting_coa_id
116537 , x_flexfield_segment_code => l_adr_flexfield_segment_code
116538 , x_flex_value_set_id => l_adr_flex_value_set_id
116539 , x_value_type_code => l_adr_value_type_code
116540 , x_value_combination_id => l_adr_value_combination_id
116541 , x_value_segment_code => l_adr_value_segment_code
116542 , p_side => 'NA'
116543 , p_override_seg_flag => 'Y'
116544 );
116545
116546 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
116547
116548 xla_ae_lines_pkg.set_segment(
116549 p_to_segment_code => 'GL_BALANCING'
116553 , p_value_type_code => l_adr_value_type_code
116550 , p_segment_value => l_segment
116551 , p_from_segment_code => l_adr_value_segment_code
116552 , p_from_combination_id => l_adr_value_combination_id
116554 , p_transaction_coa_id => l_adr_transaction_coa_id
116555 , p_accounting_coa_id => l_adr_accounting_coa_id
116556 , p_flexfield_segment_code => l_adr_flexfield_segment_code
116557 , p_flex_value_set_id => l_adr_flex_value_set_id
116558 , p_adr_code => 'FA_EXPENSE_ACCT'
116559 , p_adr_type_code => 'S'
116560 , p_component_type => l_component_type
116561 , p_component_code => l_component_code
116562 , p_component_type_code => l_component_type_code
116563 , p_component_appl_id => l_component_appl_id
116564 , p_amb_context_code => l_amb_context_code
116565 , p_entity_code => 'TRANSACTIONS'
116566 , p_event_class_code => 'RETIREMENTS'
116567 , p_side => 'NA'
116568 );
116569
116570 END IF;
116571
116572 l_segment := AcctDerRule_166(
116573 p_application_id => p_application_id
116574 , p_ae_header_id => l_ae_header_id
116575 , p_source_5 => p_source_5
116576 , p_source_29 => p_source_29
116577 , x_transaction_coa_id => l_adr_transaction_coa_id
116578 , x_accounting_coa_id => l_adr_accounting_coa_id
116579 , x_flexfield_segment_code => l_adr_flexfield_segment_code
116580 , x_flex_value_set_id => l_adr_flex_value_set_id
116581 , x_value_type_code => l_adr_value_type_code
116582 , x_value_combination_id => l_adr_value_combination_id
116583 , x_value_segment_code => l_adr_value_segment_code
116584 , p_side => 'NA'
116585 , p_override_seg_flag => 'Y'
116586 );
116587
116588 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
116589
116590 xla_ae_lines_pkg.set_segment(
116591 p_to_segment_code => 'GL_ACCOUNT'
116592 , p_segment_value => l_segment
116593 , p_from_segment_code => l_adr_value_segment_code
116594 , p_from_combination_id => l_adr_value_combination_id
116595 , p_value_type_code => l_adr_value_type_code
116596 , p_transaction_coa_id => l_adr_transaction_coa_id
116597 , p_accounting_coa_id => l_adr_accounting_coa_id
116598 , p_flexfield_segment_code => l_adr_flexfield_segment_code
116599 , p_flex_value_set_id => l_adr_flex_value_set_id
116600 , p_adr_code => 'FA_REVAL_RES_RET_GAIN_SEGMENT'
116601 , p_adr_type_code => 'S'
116602 , p_component_type => l_component_type
116603 , p_component_code => l_component_code
116604 , p_component_type_code => l_component_type_code
116605 , p_component_appl_id => l_component_appl_id
116606 , p_amb_context_code => l_amb_context_code
116607 , p_entity_code => 'TRANSACTIONS'
116608 , p_event_class_code => 'RETIREMENTS'
116609 , p_side => 'NA'
116610 );
116611
116612 END IF;
116613
116614 --
116615 --
116616 END IF;
116617 --
116618 -- Bug 4922099
116619 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
116620 (NVL(l_enc_upg_option, 'N') = 'O')
116621 ) AND
116622 (l_bflow_method_code = 'PRIOR_ENTRY')
116623 )
116624 THEN
116625 IF
116626 --
116627 1 = 2
116628 --
116629 THEN
116630 xla_accounting_err_pkg.build_message
116631 (p_appli_s_name => 'XLA'
116632 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
116633 ,p_token_1 => 'LINE_NUMBER'
116634 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
116635 ,p_token_2 => 'LINE_TYPE_NAME'
116636 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
116637 l_component_type
116638 ,l_component_code
116639 ,l_component_type_code
116640 ,l_component_appl_id
116641 ,l_amb_context_code
116642 ,l_entity_code
116643 ,l_event_class_code
116644 )
116645 ,p_token_3 => 'OWNER'
116646 ,p_value_3 => xla_lookups_pkg.get_meaning(
116647 p_lookup_type => 'XLA_OWNER_TYPE'
116648 ,p_lookup_code => l_component_type_code
116649 )
116650 ,p_token_4 => 'PRODUCT_NAME'
116654 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
116651 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
116652 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
116653 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
116655 ,p_ae_header_id => NULL
116656 );
116657
116658 IF (C_LEVEL_ERROR>= g_log_level) THEN
116659 trace
116660 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
116661 ,p_level => C_LEVEL_ERROR
116662 ,p_module => l_log_module);
116663 END IF;
116664 END IF;
116665 END IF;
116666 --
116667 --
116668 ------------------------------------------------------------------------------------------------
116669 -- 4219869 Business Flow
116670 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
116671 -- Prior Entry. Currently, the following code is always generated.
116672 ------------------------------------------------------------------------------------------------
116673 XLA_AE_LINES_PKG.ValidateCurrentLine;
116674
116675 ------------------------------------------------------------------------------------
116676 -- 4219869 Business Flow
116677 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
116678 ------------------------------------------------------------------------------------
116679 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
116680
116681 ----------------------------------------------------------------------------------
116682 -- 4219869 Business Flow
116683 -- Update journal entry status -- Need to generate this within IF <condition>
116684 ----------------------------------------------------------------------------------
116685 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
116686 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
116687 ,p_balance_type_code => l_balance_type_code
116688 );
116689
116690 -------------------------------------------------------------------------------------------
116691 -- 4262811 - Generate the Accrual Reversal lines
116692 -------------------------------------------------------------------------------------------
116693 BEGIN
116694 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
116695 (g_array_event(p_event_id).array_value_num('header_index'));
116696 IF l_acc_rev_flag IS NULL THEN
116697 l_acc_rev_flag := 'N';
116698 END IF;
116699 EXCEPTION
116700 WHEN OTHERS THEN
116701 l_acc_rev_flag := 'N';
116702 END;
116703 --
116704 IF (l_acc_rev_flag = 'Y') THEN
116705
116706 -- 4645092 ------------------------------------------------------------------------------
116707 -- To allow MPA report to determine if it should generate report process
116708 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
116709 ------------------------------------------------------------------------------------------
116710
116711 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
116712 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
116713 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
116714 -- call ADRs
116715 -- Bug 4922099
116716 --
116717 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
116718 (NVL(l_actual_upg_option, 'N') = 'O') OR
116719 (NVL(l_enc_upg_option, 'N') = 'O')
116720 )
116721 THEN
116722 NULL;
116723 --
116724 --
116725
116726 l_ccid := AcctDerRule_174(
116727 p_application_id => p_application_id
116728 , p_ae_header_id => l_ae_header_id
116729 , p_source_5 => p_source_5
116730 , p_source_32 => p_source_32
116731 , x_transaction_coa_id => l_adr_transaction_coa_id
116732 , x_accounting_coa_id => l_adr_accounting_coa_id
116733 , x_value_type_code => l_adr_value_type_code
116734 , p_side => 'NA'
116735 );
116736
116737 xla_ae_lines_pkg.set_ccid(
116738 p_code_combination_id => l_ccid
116739 , p_value_type_code => l_adr_value_type_code
116740 , p_transaction_coa_id => l_adr_transaction_coa_id
116741 , p_accounting_coa_id => l_adr_accounting_coa_id
116742 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
116743 , p_adr_type_code => 'S'
116744 , p_component_type => l_component_type
116745 , p_component_code => l_component_code
116746 , p_component_type_code => l_component_type_code
116747 , p_component_appl_id => l_component_appl_id
116748 , p_amb_context_code => l_amb_context_code
116749 , p_side => 'NA'
116750 );
116751
116752
116753 l_segment := AcctDerRule_169(
116754 p_application_id => p_application_id
116755 , p_ae_header_id => l_ae_header_id
116756 , p_source_5 => p_source_5
116757 , p_source_31 => p_source_31
116758 , x_transaction_coa_id => l_adr_transaction_coa_id
116759 , x_accounting_coa_id => l_adr_accounting_coa_id
116763 , x_value_combination_id => l_adr_value_combination_id
116760 , x_flexfield_segment_code => l_adr_flexfield_segment_code
116761 , x_flex_value_set_id => l_adr_flex_value_set_id
116762 , x_value_type_code => l_adr_value_type_code
116764 , x_value_segment_code => l_adr_value_segment_code
116765 , p_side => 'NA'
116766 , p_override_seg_flag => 'Y'
116767 );
116768
116769 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
116770
116771 xla_ae_lines_pkg.set_segment(
116772 p_to_segment_code => 'GL_BALANCING'
116773 , p_segment_value => l_segment
116774 , p_from_segment_code => l_adr_value_segment_code
116775 , p_from_combination_id => l_adr_value_combination_id
116776 , p_value_type_code => l_adr_value_type_code
116777 , p_transaction_coa_id => l_adr_transaction_coa_id
116778 , p_accounting_coa_id => l_adr_accounting_coa_id
116779 , p_flexfield_segment_code => l_adr_flexfield_segment_code
116780 , p_flex_value_set_id => l_adr_flex_value_set_id
116781 , p_adr_code => 'FA_EXPENSE_ACCT'
116782 , p_adr_type_code => 'S'
116783 , p_component_type => l_component_type
116784 , p_component_code => l_component_code
116785 , p_component_type_code => l_component_type_code
116786 , p_component_appl_id => l_component_appl_id
116787 , p_amb_context_code => l_amb_context_code
116788 , p_entity_code => 'TRANSACTIONS'
116789 , p_event_class_code => 'RETIREMENTS'
116790 , p_side => 'NA'
116791 );
116792
116793 END IF;
116794
116795 l_segment := AcctDerRule_166(
116796 p_application_id => p_application_id
116797 , p_ae_header_id => l_ae_header_id
116798 , p_source_5 => p_source_5
116799 , p_source_29 => p_source_29
116800 , x_transaction_coa_id => l_adr_transaction_coa_id
116801 , x_accounting_coa_id => l_adr_accounting_coa_id
116802 , x_flexfield_segment_code => l_adr_flexfield_segment_code
116803 , x_flex_value_set_id => l_adr_flex_value_set_id
116804 , x_value_type_code => l_adr_value_type_code
116805 , x_value_combination_id => l_adr_value_combination_id
116806 , x_value_segment_code => l_adr_value_segment_code
116807 , p_side => 'NA'
116808 , p_override_seg_flag => 'Y'
116809 );
116810
116811 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
116812
116813 xla_ae_lines_pkg.set_segment(
116814 p_to_segment_code => 'GL_ACCOUNT'
116815 , p_segment_value => l_segment
116816 , p_from_segment_code => l_adr_value_segment_code
116817 , p_from_combination_id => l_adr_value_combination_id
116818 , p_value_type_code => l_adr_value_type_code
116819 , p_transaction_coa_id => l_adr_transaction_coa_id
116820 , p_accounting_coa_id => l_adr_accounting_coa_id
116821 , p_flexfield_segment_code => l_adr_flexfield_segment_code
116822 , p_flex_value_set_id => l_adr_flex_value_set_id
116823 , p_adr_code => 'FA_REVAL_RES_RET_GAIN_SEGMENT'
116824 , p_adr_type_code => 'S'
116825 , p_component_type => l_component_type
116826 , p_component_code => l_component_code
116827 , p_component_type_code => l_component_type_code
116828 , p_component_appl_id => l_component_appl_id
116829 , p_amb_context_code => l_amb_context_code
116830 , p_entity_code => 'TRANSACTIONS'
116831 , p_event_class_code => 'RETIREMENTS'
116832 , p_side => 'NA'
116833 );
116834
116835 END IF;
116836
116837 --
116838 --
116839 END IF;
116840
116841 --
116842 -- Update the line information that should be overwritten
116843 --
116844 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
116845 p_header_num => 1);
116846 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
116847
116848 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
116849
116850 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
116851 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
116852 END IF;
116853
116854 --
116855 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
116856 --
116857 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
116858 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
116859 ELSE
116860 ---------------------------------------------------------------------------------------------------
116861 -- 4262811a Switch Sign
116862 ---------------------------------------------------------------------------------------------------
116863 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
116867 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
116864 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
116865 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
116866 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
116868 -- 5132302
116869 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
116870 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
116871
116872 END IF;
116873
116874 -- 4955764
116875 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
116876 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
116877
116878
116879 XLA_AE_LINES_PKG.ValidateCurrentLine;
116880 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
116881
116882 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
116883 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
116884 ,p_balance_type_code => l_balance_type_code);
116885
116886 END IF;
116887
116888 -----------------------------------------------------------------------------------------
116889 -- 4262811 Multiperiod Accounting
116890 -----------------------------------------------------------------------------------------
116891 -- No MPA option is assigned.
116892
116893
116894 END IF;
116895 END IF;
116896 --
116897
116898 --
116899 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
116900 trace
116901 (p_msg => 'END of AcctLineType_327'
116902 ,p_level => C_LEVEL_PROCEDURE
116903 ,p_module => l_log_module);
116904 END IF;
116905 --
116906 EXCEPTION
116907 WHEN xla_exceptions_pkg.application_exception THEN
116908 RAISE;
116909 WHEN OTHERS THEN
116910 xla_exceptions_pkg.raise_message
116911 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_327');
116912 END AcctLineType_327;
116913 --
116914
116915 ---------------------------------------
116916 --
116917 -- PRIVATE FUNCTION
116918 -- AcctLineType_328
116919 --
116920 ---------------------------------------
116921 PROCEDURE AcctLineType_328 (
116922 p_application_id IN NUMBER
116923 ,p_event_id IN NUMBER
116924 ,p_calculate_acctd_flag IN VARCHAR2
116925 ,p_calculate_g_l_flag IN VARCHAR2
116926 ,p_actual_flag IN OUT VARCHAR2
116927 ,p_balance_type_code OUT VARCHAR2
116928 ,p_gain_or_loss_ref OUT VARCHAR2
116929
116930 --Period Close Date
116931 , p_source_1 IN DATE
116932 --Generated Code Combination Identifier
116933 , p_source_5 IN NUMBER
116934 --Revaluation Reserve Retired Loss Account
116935 , p_source_30 IN VARCHAR2
116936 --Expense Account Code Combination Identifier
116937 , p_source_31 IN NUMBER
116938 --Default Code Combination Identifier
116939 , p_source_32 IN NUMBER
116940 --Adjustment Type
116941 , p_source_48 IN VARCHAR2
116942 --Transaction Header Identifier
116943 , p_source_49 IN NUMBER
116944 --Adjustment Line Identifier
116945 , p_source_50 IN NUMBER
116946 --Distribution Type Code
116947 , p_source_51 IN VARCHAR2
116948 --Entered Amount
116949 , p_source_52 IN NUMBER
116950 --Currency Code
116951 , p_source_53 IN VARCHAR2
116952 --Gain Loss Amount
116953 , p_source_54 IN NUMBER
116954 )
116955 IS
116956
116957 l_component_type VARCHAR2(80);
116958 l_component_code VARCHAR2(30);
116959 l_component_type_code VARCHAR2(1);
116960 l_component_appl_id INTEGER;
116961 l_amb_context_code VARCHAR2(30);
116962 l_entity_code VARCHAR2(30);
116963 l_event_class_code VARCHAR2(30);
116964 l_ae_header_id NUMBER;
116965 l_event_type_code VARCHAR2(30);
116966 l_line_definition_code VARCHAR2(30);
116967 l_line_definition_owner_code VARCHAR2(1);
116968 --
116969 -- adr variables
116970 l_segment VARCHAR2(30);
116971 l_ccid NUMBER;
116972 l_adr_transaction_coa_id NUMBER;
116973 l_adr_accounting_coa_id NUMBER;
116974 l_adr_flexfield_segment_code VARCHAR2(30);
116975 l_adr_flex_value_set_id NUMBER;
116976 l_adr_value_type_code VARCHAR2(30);
116977 l_adr_value_combination_id NUMBER;
116978 l_adr_value_segment_code VARCHAR2(30);
116979
116980 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
116981 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
116982 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
116983 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
116984
116985 -- 4262811 Variables ------------------------------------------------------------------------------------------
116986 l_entered_amt_idx NUMBER;
116987 l_accted_amt_idx NUMBER;
116988 l_acc_rev_flag VARCHAR2(1);
116989 l_accrual_line_num NUMBER;
116990 l_tmp_amt NUMBER;
116991 l_acc_rev_natural_side_code VARCHAR2(1);
116992
116996 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
116993 l_num_entries NUMBER;
116994 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
116995 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
116997 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
116998 l_recog_line_1 NUMBER;
116999 l_recog_line_2 NUMBER;
117000
117001 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
117002 l_bflow_applied_to_amt NUMBER; -- 5132302
117003 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
117004
117005 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
117006
117007 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
117008 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
117009
117010 ---------------------------------------------------------------------------------------------------------------
117011
117012
117013 --
117014 -- bulk performance
117015 --
117016 l_balance_type_code VARCHAR2(1);
117017 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
117018 l_log_module VARCHAR2(240);
117019
117020 --
117021 -- Upgrade strategy
117022 --
117023 l_actual_upg_option VARCHAR2(1);
117024 l_enc_upg_option VARCHAR2(1);
117025
117026 --
117027 BEGIN
117028 --
117029 IF g_log_enabled THEN
117030 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_328';
117031 END IF;
117032 --
117033 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
117034
117035 trace
117036 (p_msg => 'BEGIN of AcctLineType_328'
117037 ,p_level => C_LEVEL_PROCEDURE
117038 ,p_module => l_log_module);
117039
117040 END IF;
117041 --
117042 l_component_type := 'AMB_JLT';
117043 l_component_code := 'FA_RET_REVAL_RESERVE_LOSS';
117044 l_component_type_code := 'S';
117045 l_component_appl_id := 140;
117046 l_amb_context_code := 'DEFAULT';
117047 l_entity_code := 'TRANSACTIONS';
117048 l_event_class_code := 'RETIREMENTS';
117049 l_event_type_code := 'RETIREMENTS';
117050 l_line_definition_owner_code := 'S';
117051 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_RETIR19';
117052 --
117053 l_balance_type_code := 'A';
117054 l_segment := NULL;
117055 l_ccid := NULL;
117056 l_adr_transaction_coa_id := NULL;
117057 l_adr_accounting_coa_id := NULL;
117058 l_adr_flexfield_segment_code := NULL;
117059 l_adr_flex_value_set_id := NULL;
117060 l_adr_value_type_code := NULL;
117061 l_adr_value_combination_id := NULL;
117062 l_adr_value_segment_code := NULL;
117063
117064 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
117065 l_bflow_class_code := ''; -- 4219869 Business Flow
117066 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
117067 l_budgetary_control_flag := 'N';
117068
117069 l_bflow_applied_to_amt_idx := NULL; -- 5132302
117070 l_bflow_applied_to_amt := NULL; -- 5132302
117071 l_entered_amt_idx := NULL; -- 4262811
117072 l_accted_amt_idx := NULL; -- 4262811
117073 l_acc_rev_flag := NULL; -- 4262811
117074 l_accrual_line_num := NULL; -- 4262811
117075 l_tmp_amt := NULL; -- 4262811
117076 --
117077
117078 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
117079 l_balance_type_code <> 'B' THEN
117080 IF NVL(p_source_48,'
117081 ') = 'REVAL RSV RET' AND
117082 p_source_54 < 0
117083 THEN
117084
117085 --
117086 XLA_AE_LINES_PKG.SetNewLine;
117087
117088 p_balance_type_code := l_balance_type_code;
117089 -- set the flag so later we will know whether the gain loss line needs to be created
117090
117091 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
117092 p_actual_flag :='A';
117093 END IF;
117094
117095 --
117096 -- bulk performance
117097 --
117098 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
117099 p_header_num => 0); -- 4262811
117100 --
117101 -- set accounting line options
117102 --
117103 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
117104 p_natural_side_code => 'C'
117105 , p_gain_or_loss_flag => 'N'
117106 , p_gl_transfer_mode_code => 'S'
117107 , p_acct_entry_type_code => 'A'
117108 , p_switch_side_flag => 'Y'
117109 , p_merge_duplicate_code => 'N'
117110 );
117111 --
117112 l_acc_rev_natural_side_code := 'D'; -- 4262811
117113 --
117114 --
117115 -- set accounting line type info
117116 --
117117 xla_ae_lines_pkg.SetAcctLineType
117118 (p_component_type => l_component_type
117119 ,p_event_type_code => l_event_type_code
117120 ,p_line_definition_owner_code => l_line_definition_owner_code
117121 ,p_line_definition_code => l_line_definition_code
117122 ,p_accounting_line_code => l_component_code
117123 ,p_accounting_line_type_code => l_component_type_code
117127 ,p_event_class_code => l_event_class_code);
117124 ,p_accounting_line_appl_id => l_component_appl_id
117125 ,p_amb_context_code => l_amb_context_code
117126 ,p_entity_code => l_entity_code
117128 --
117129 -- set accounting class
117130 --
117131 xla_ae_lines_pkg.SetAcctClass(
117132 p_accounting_class_code => 'ASSET'
117133 , p_ae_header_id => l_ae_header_id
117134 );
117135
117136 --
117137 -- set rounding class
117138 --
117139 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
117140 'ASSET';
117141
117142 --
117143 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
117144 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
117145 --
117146 -- bulk performance
117147 --
117148 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
117149
117150 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
117151 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
117152
117153 -- 4955764
117154 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
117155 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
117156
117157 -- 4458381 Public Sector Enh
117158
117159 --
117160 -- set accounting attributes for the line type
117161 --
117162 l_entered_amt_idx := 4;
117163 l_accted_amt_idx := 6;
117164 l_bflow_applied_to_amt_idx := NULL; -- 5132302
117165 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
117166 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
117167 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
117168 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
117169 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
117170 l_rec_acct_attrs.array_char_value(3) := p_source_51;
117171 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
117172 l_rec_acct_attrs.array_num_value(4) := p_source_52;
117173 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
117174 l_rec_acct_attrs.array_char_value(5) := p_source_53;
117175 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
117176 l_rec_acct_attrs.array_num_value(6) := p_source_52;
117177
117178 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
117179 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
117180
117181 ---------------------------------------------------------------------------------------------------------------
117182 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
117183 ---------------------------------------------------------------------------------------------------------------
117184 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
117185
117186 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
117187 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
117188
117189 IF xla_accounting_cache_pkg.GetValueChar
117190 (p_source_code => 'LEDGER_CATEGORY_CODE'
117191 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
117192 AND l_bflow_method_code = 'PRIOR_ENTRY'
117193 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
117194 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
117195 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
117196 )
117197 THEN
117198 xla_ae_lines_pkg.BflowUpgEntry
117199 (p_business_method_code => l_bflow_method_code
117200 ,p_business_class_code => l_bflow_class_code
117201 ,p_balance_type => l_balance_type_code);
117202 ELSE
117203 NULL;
117204 -- No business flow processing for business flow method of NONE.
117205 END IF;
117206
117207 --
117208 -- call analytical criteria
117209 --
117210
117211 --
117212 -- call description
117213 --
117214
117215 xla_ae_lines_pkg.SetLineDescription(
117216 p_ae_header_id => l_ae_header_id
117217 ,p_description => Description_89 (
117218 p_application_id => p_application_id
117219 , p_ae_header_id => l_ae_header_id
117220 , p_source_1 => p_source_1
117221 )
117222 );
117223
117224
117225 --
117226 -- call ADRs
117227 -- Bug 4922099
117228 --
117229 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
117230 (NVL(l_actual_upg_option, 'N') = 'O') OR
117231 (NVL(l_enc_upg_option, 'N') = 'O')
117232 )
117233 THEN
117234 NULL;
117235 --
117236 --
117237
117238 l_ccid := AcctDerRule_174(
117239 p_application_id => p_application_id
117240 , p_ae_header_id => l_ae_header_id
117241 , p_source_5 => p_source_5
117242 , p_source_32 => p_source_32
117243 , x_transaction_coa_id => l_adr_transaction_coa_id
117244 , x_accounting_coa_id => l_adr_accounting_coa_id
117245 , x_value_type_code => l_adr_value_type_code
117249 xla_ae_lines_pkg.set_ccid(
117246 , p_side => 'NA'
117247 );
117248
117250 p_code_combination_id => l_ccid
117251 , p_value_type_code => l_adr_value_type_code
117252 , p_transaction_coa_id => l_adr_transaction_coa_id
117253 , p_accounting_coa_id => l_adr_accounting_coa_id
117254 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
117255 , p_adr_type_code => 'S'
117256 , p_component_type => l_component_type
117257 , p_component_code => l_component_code
117258 , p_component_type_code => l_component_type_code
117259 , p_component_appl_id => l_component_appl_id
117260 , p_amb_context_code => l_amb_context_code
117261 , p_side => 'NA'
117262 );
117263
117264
117265 l_segment := AcctDerRule_169(
117266 p_application_id => p_application_id
117267 , p_ae_header_id => l_ae_header_id
117268 , p_source_5 => p_source_5
117269 , p_source_31 => p_source_31
117270 , x_transaction_coa_id => l_adr_transaction_coa_id
117271 , x_accounting_coa_id => l_adr_accounting_coa_id
117272 , x_flexfield_segment_code => l_adr_flexfield_segment_code
117273 , x_flex_value_set_id => l_adr_flex_value_set_id
117274 , x_value_type_code => l_adr_value_type_code
117275 , x_value_combination_id => l_adr_value_combination_id
117276 , x_value_segment_code => l_adr_value_segment_code
117277 , p_side => 'NA'
117278 , p_override_seg_flag => 'Y'
117279 );
117280
117281 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
117282
117283 xla_ae_lines_pkg.set_segment(
117284 p_to_segment_code => 'GL_BALANCING'
117285 , p_segment_value => l_segment
117286 , p_from_segment_code => l_adr_value_segment_code
117287 , p_from_combination_id => l_adr_value_combination_id
117288 , p_value_type_code => l_adr_value_type_code
117289 , p_transaction_coa_id => l_adr_transaction_coa_id
117290 , p_accounting_coa_id => l_adr_accounting_coa_id
117291 , p_flexfield_segment_code => l_adr_flexfield_segment_code
117292 , p_flex_value_set_id => l_adr_flex_value_set_id
117293 , p_adr_code => 'FA_EXPENSE_ACCT'
117294 , p_adr_type_code => 'S'
117295 , p_component_type => l_component_type
117296 , p_component_code => l_component_code
117297 , p_component_type_code => l_component_type_code
117298 , p_component_appl_id => l_component_appl_id
117299 , p_amb_context_code => l_amb_context_code
117300 , p_entity_code => 'TRANSACTIONS'
117301 , p_event_class_code => 'RETIREMENTS'
117302 , p_side => 'NA'
117303 );
117304
117305 END IF;
117306
117307 l_segment := AcctDerRule_167(
117308 p_application_id => p_application_id
117309 , p_ae_header_id => l_ae_header_id
117310 , p_source_5 => p_source_5
117311 , p_source_30 => p_source_30
117312 , x_transaction_coa_id => l_adr_transaction_coa_id
117313 , x_accounting_coa_id => l_adr_accounting_coa_id
117314 , x_flexfield_segment_code => l_adr_flexfield_segment_code
117315 , x_flex_value_set_id => l_adr_flex_value_set_id
117316 , x_value_type_code => l_adr_value_type_code
117317 , x_value_combination_id => l_adr_value_combination_id
117318 , x_value_segment_code => l_adr_value_segment_code
117319 , p_side => 'NA'
117320 , p_override_seg_flag => 'Y'
117321 );
117322
117323 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
117324
117325 xla_ae_lines_pkg.set_segment(
117326 p_to_segment_code => 'GL_ACCOUNT'
117327 , p_segment_value => l_segment
117328 , p_from_segment_code => l_adr_value_segment_code
117329 , p_from_combination_id => l_adr_value_combination_id
117330 , p_value_type_code => l_adr_value_type_code
117331 , p_transaction_coa_id => l_adr_transaction_coa_id
117332 , p_accounting_coa_id => l_adr_accounting_coa_id
117333 , p_flexfield_segment_code => l_adr_flexfield_segment_code
117334 , p_flex_value_set_id => l_adr_flex_value_set_id
117335 , p_adr_code => 'FA_REVAL_RES_RET_LOSS_SEGMENT'
117336 , p_adr_type_code => 'S'
117337 , p_component_type => l_component_type
117338 , p_component_code => l_component_code
117339 , p_component_type_code => l_component_type_code
117340 , p_component_appl_id => l_component_appl_id
117341 , p_amb_context_code => l_amb_context_code
117342 , p_entity_code => 'TRANSACTIONS'
117343 , p_event_class_code => 'RETIREMENTS'
117344 , p_side => 'NA'
117345 );
117346
117347 END IF;
117348
117349 --
117350 --
117351 END IF;
117352 --
117353 -- Bug 4922099
117354 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
117355 (NVL(l_enc_upg_option, 'N') = 'O')
117356 ) AND
117357 (l_bflow_method_code = 'PRIOR_ENTRY')
117358 )
117359 THEN
117360 IF
117364 THEN
117361 --
117362 1 = 2
117363 --
117365 xla_accounting_err_pkg.build_message
117366 (p_appli_s_name => 'XLA'
117367 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
117368 ,p_token_1 => 'LINE_NUMBER'
117369 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
117370 ,p_token_2 => 'LINE_TYPE_NAME'
117371 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
117372 l_component_type
117373 ,l_component_code
117374 ,l_component_type_code
117375 ,l_component_appl_id
117376 ,l_amb_context_code
117377 ,l_entity_code
117378 ,l_event_class_code
117379 )
117380 ,p_token_3 => 'OWNER'
117381 ,p_value_3 => xla_lookups_pkg.get_meaning(
117382 p_lookup_type => 'XLA_OWNER_TYPE'
117383 ,p_lookup_code => l_component_type_code
117384 )
117385 ,p_token_4 => 'PRODUCT_NAME'
117386 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
117387 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
117388 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
117389 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
117390 ,p_ae_header_id => NULL
117391 );
117392
117393 IF (C_LEVEL_ERROR>= g_log_level) THEN
117394 trace
117395 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
117396 ,p_level => C_LEVEL_ERROR
117397 ,p_module => l_log_module);
117398 END IF;
117399 END IF;
117400 END IF;
117401 --
117402 --
117403 ------------------------------------------------------------------------------------------------
117404 -- 4219869 Business Flow
117405 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
117406 -- Prior Entry. Currently, the following code is always generated.
117407 ------------------------------------------------------------------------------------------------
117408 XLA_AE_LINES_PKG.ValidateCurrentLine;
117409
117410 ------------------------------------------------------------------------------------
117411 -- 4219869 Business Flow
117412 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
117413 ------------------------------------------------------------------------------------
117414 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
117415
117416 ----------------------------------------------------------------------------------
117417 -- 4219869 Business Flow
117418 -- Update journal entry status -- Need to generate this within IF <condition>
117419 ----------------------------------------------------------------------------------
117420 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
117421 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
117422 ,p_balance_type_code => l_balance_type_code
117423 );
117424
117425 -------------------------------------------------------------------------------------------
117426 -- 4262811 - Generate the Accrual Reversal lines
117427 -------------------------------------------------------------------------------------------
117428 BEGIN
117429 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
117430 (g_array_event(p_event_id).array_value_num('header_index'));
117431 IF l_acc_rev_flag IS NULL THEN
117432 l_acc_rev_flag := 'N';
117433 END IF;
117434 EXCEPTION
117435 WHEN OTHERS THEN
117436 l_acc_rev_flag := 'N';
117437 END;
117438 --
117439 IF (l_acc_rev_flag = 'Y') THEN
117440
117441 -- 4645092 ------------------------------------------------------------------------------
117442 -- To allow MPA report to determine if it should generate report process
117443 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
117444 ------------------------------------------------------------------------------------------
117445
117446 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
117447 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
117448 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
117449 -- call ADRs
117450 -- Bug 4922099
117451 --
117455 )
117452 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
117453 (NVL(l_actual_upg_option, 'N') = 'O') OR
117454 (NVL(l_enc_upg_option, 'N') = 'O')
117456 THEN
117457 NULL;
117458 --
117459 --
117460
117461 l_ccid := AcctDerRule_174(
117462 p_application_id => p_application_id
117463 , p_ae_header_id => l_ae_header_id
117464 , p_source_5 => p_source_5
117465 , p_source_32 => p_source_32
117466 , x_transaction_coa_id => l_adr_transaction_coa_id
117467 , x_accounting_coa_id => l_adr_accounting_coa_id
117468 , x_value_type_code => l_adr_value_type_code
117469 , p_side => 'NA'
117470 );
117471
117472 xla_ae_lines_pkg.set_ccid(
117473 p_code_combination_id => l_ccid
117474 , p_value_type_code => l_adr_value_type_code
117475 , p_transaction_coa_id => l_adr_transaction_coa_id
117476 , p_accounting_coa_id => l_adr_accounting_coa_id
117477 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
117478 , p_adr_type_code => 'S'
117479 , p_component_type => l_component_type
117480 , p_component_code => l_component_code
117481 , p_component_type_code => l_component_type_code
117482 , p_component_appl_id => l_component_appl_id
117483 , p_amb_context_code => l_amb_context_code
117484 , p_side => 'NA'
117485 );
117486
117487
117488 l_segment := AcctDerRule_169(
117489 p_application_id => p_application_id
117490 , p_ae_header_id => l_ae_header_id
117491 , p_source_5 => p_source_5
117492 , p_source_31 => p_source_31
117493 , x_transaction_coa_id => l_adr_transaction_coa_id
117494 , x_accounting_coa_id => l_adr_accounting_coa_id
117495 , x_flexfield_segment_code => l_adr_flexfield_segment_code
117496 , x_flex_value_set_id => l_adr_flex_value_set_id
117497 , x_value_type_code => l_adr_value_type_code
117498 , x_value_combination_id => l_adr_value_combination_id
117499 , x_value_segment_code => l_adr_value_segment_code
117500 , p_side => 'NA'
117501 , p_override_seg_flag => 'Y'
117502 );
117503
117504 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
117505
117506 xla_ae_lines_pkg.set_segment(
117507 p_to_segment_code => 'GL_BALANCING'
117508 , p_segment_value => l_segment
117509 , p_from_segment_code => l_adr_value_segment_code
117510 , p_from_combination_id => l_adr_value_combination_id
117511 , p_value_type_code => l_adr_value_type_code
117512 , p_transaction_coa_id => l_adr_transaction_coa_id
117513 , p_accounting_coa_id => l_adr_accounting_coa_id
117514 , p_flexfield_segment_code => l_adr_flexfield_segment_code
117515 , p_flex_value_set_id => l_adr_flex_value_set_id
117516 , p_adr_code => 'FA_EXPENSE_ACCT'
117517 , p_adr_type_code => 'S'
117518 , p_component_type => l_component_type
117519 , p_component_code => l_component_code
117520 , p_component_type_code => l_component_type_code
117521 , p_component_appl_id => l_component_appl_id
117522 , p_amb_context_code => l_amb_context_code
117523 , p_entity_code => 'TRANSACTIONS'
117524 , p_event_class_code => 'RETIREMENTS'
117525 , p_side => 'NA'
117526 );
117527
117528 END IF;
117529
117530 l_segment := AcctDerRule_167(
117531 p_application_id => p_application_id
117532 , p_ae_header_id => l_ae_header_id
117533 , p_source_5 => p_source_5
117534 , p_source_30 => p_source_30
117535 , x_transaction_coa_id => l_adr_transaction_coa_id
117536 , x_accounting_coa_id => l_adr_accounting_coa_id
117537 , x_flexfield_segment_code => l_adr_flexfield_segment_code
117538 , x_flex_value_set_id => l_adr_flex_value_set_id
117539 , x_value_type_code => l_adr_value_type_code
117540 , x_value_combination_id => l_adr_value_combination_id
117541 , x_value_segment_code => l_adr_value_segment_code
117542 , p_side => 'NA'
117543 , p_override_seg_flag => 'Y'
117544 );
117545
117546 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
117547
117548 xla_ae_lines_pkg.set_segment(
117549 p_to_segment_code => 'GL_ACCOUNT'
117550 , p_segment_value => l_segment
117551 , p_from_segment_code => l_adr_value_segment_code
117552 , p_from_combination_id => l_adr_value_combination_id
117553 , p_value_type_code => l_adr_value_type_code
117554 , p_transaction_coa_id => l_adr_transaction_coa_id
117555 , p_accounting_coa_id => l_adr_accounting_coa_id
117556 , p_flexfield_segment_code => l_adr_flexfield_segment_code
117557 , p_flex_value_set_id => l_adr_flex_value_set_id
117558 , p_adr_code => 'FA_REVAL_RES_RET_LOSS_SEGMENT'
117559 , p_adr_type_code => 'S'
117560 , p_component_type => l_component_type
117564 , p_amb_context_code => l_amb_context_code
117561 , p_component_code => l_component_code
117562 , p_component_type_code => l_component_type_code
117563 , p_component_appl_id => l_component_appl_id
117565 , p_entity_code => 'TRANSACTIONS'
117566 , p_event_class_code => 'RETIREMENTS'
117567 , p_side => 'NA'
117568 );
117569
117570 END IF;
117571
117572 --
117573 --
117574 END IF;
117575
117576 --
117577 -- Update the line information that should be overwritten
117578 --
117579 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
117580 p_header_num => 1);
117581 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
117582
117583 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
117584
117585 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
117586 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
117587 END IF;
117588
117589 --
117590 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
117591 --
117592 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
117593 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
117594 ELSE
117595 ---------------------------------------------------------------------------------------------------
117596 -- 4262811a Switch Sign
117597 ---------------------------------------------------------------------------------------------------
117598 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
117599 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
117600 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
117601 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
117602 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
117603 -- 5132302
117604 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
117605 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
117606
117607 END IF;
117608
117609 -- 4955764
117610 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
117611 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
117612
117613
117614 XLA_AE_LINES_PKG.ValidateCurrentLine;
117615 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
117616
117617 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
117618 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
117619 ,p_balance_type_code => l_balance_type_code);
117620
117621 END IF;
117622
117623 -----------------------------------------------------------------------------------------
117624 -- 4262811 Multiperiod Accounting
117625 -----------------------------------------------------------------------------------------
117626 -- No MPA option is assigned.
117627
117628
117629 END IF;
117630 END IF;
117631 --
117632
117633 --
117634 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
117635 trace
117636 (p_msg => 'END of AcctLineType_328'
117637 ,p_level => C_LEVEL_PROCEDURE
117638 ,p_module => l_log_module);
117639 END IF;
117640 --
117641 EXCEPTION
117642 WHEN xla_exceptions_pkg.application_exception THEN
117643 RAISE;
117644 WHEN OTHERS THEN
117645 xla_exceptions_pkg.raise_message
117646 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_328');
117647 END AcctLineType_328;
117648 --
117649
117650 ---------------------------------------
117651 --
117652 -- PRIVATE FUNCTION
117653 -- AcctLineType_329
117654 --
117655 ---------------------------------------
117656 PROCEDURE AcctLineType_329 (
117657 p_application_id IN NUMBER
117658 ,p_event_id IN NUMBER
117659 ,p_calculate_acctd_flag IN VARCHAR2
117660 ,p_calculate_g_l_flag IN VARCHAR2
117661 ,p_actual_flag IN OUT VARCHAR2
117662 ,p_balance_type_code OUT VARCHAR2
117663 ,p_gain_or_loss_ref OUT VARCHAR2
117664
117665 --Period Close Date
117666 , p_source_1 IN DATE
117667 --Generated Code Combination Identifier
117668 , p_source_5 IN NUMBER
117669 --Revaluation Reserve Retired Loss Account
117670 , p_source_30 IN VARCHAR2
117671 --Expense Account Code Combination Identifier
117672 , p_source_31 IN NUMBER
117673 --Default Code Combination Identifier
117674 , p_source_32 IN NUMBER
117675 --Adjustment Type
117676 , p_source_48 IN VARCHAR2
117677 --Transaction Header Identifier
117678 , p_source_49 IN NUMBER
117679 --Adjustment Line Identifier
117680 , p_source_50 IN NUMBER
117681 --Distribution Type Code
117682 , p_source_51 IN VARCHAR2
117683 --Entered Amount
117684 , p_source_52 IN NUMBER
117685 --Currency Code
117686 , p_source_53 IN VARCHAR2
117690 IS
117687 --Gain Loss Amount
117688 , p_source_54 IN NUMBER
117689 )
117691
117692 l_component_type VARCHAR2(80);
117693 l_component_code VARCHAR2(30);
117694 l_component_type_code VARCHAR2(1);
117695 l_component_appl_id INTEGER;
117696 l_amb_context_code VARCHAR2(30);
117697 l_entity_code VARCHAR2(30);
117698 l_event_class_code VARCHAR2(30);
117699 l_ae_header_id NUMBER;
117700 l_event_type_code VARCHAR2(30);
117701 l_line_definition_code VARCHAR2(30);
117702 l_line_definition_owner_code VARCHAR2(1);
117703 --
117704 -- adr variables
117705 l_segment VARCHAR2(30);
117706 l_ccid NUMBER;
117707 l_adr_transaction_coa_id NUMBER;
117708 l_adr_accounting_coa_id NUMBER;
117709 l_adr_flexfield_segment_code VARCHAR2(30);
117710 l_adr_flex_value_set_id NUMBER;
117711 l_adr_value_type_code VARCHAR2(30);
117712 l_adr_value_combination_id NUMBER;
117713 l_adr_value_segment_code VARCHAR2(30);
117714
117715 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
117716 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
117717 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
117718 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
117719
117720 -- 4262811 Variables ------------------------------------------------------------------------------------------
117721 l_entered_amt_idx NUMBER;
117722 l_accted_amt_idx NUMBER;
117723 l_acc_rev_flag VARCHAR2(1);
117724 l_accrual_line_num NUMBER;
117725 l_tmp_amt NUMBER;
117726 l_acc_rev_natural_side_code VARCHAR2(1);
117727
117728 l_num_entries NUMBER;
117729 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
117730 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
117731 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
117732 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
117733 l_recog_line_1 NUMBER;
117734 l_recog_line_2 NUMBER;
117735
117736 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
117737 l_bflow_applied_to_amt NUMBER; -- 5132302
117738 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
117739
117740 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
117741
117742 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
117743 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
117744
117745 ---------------------------------------------------------------------------------------------------------------
117746
117747
117748 --
117749 -- bulk performance
117750 --
117751 l_balance_type_code VARCHAR2(1);
117752 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
117753 l_log_module VARCHAR2(240);
117754
117755 --
117756 -- Upgrade strategy
117757 --
117758 l_actual_upg_option VARCHAR2(1);
117759 l_enc_upg_option VARCHAR2(1);
117760
117761 --
117762 BEGIN
117763 --
117764 IF g_log_enabled THEN
117765 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_329';
117766 END IF;
117767 --
117768 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
117769
117770 trace
117771 (p_msg => 'BEGIN of AcctLineType_329'
117772 ,p_level => C_LEVEL_PROCEDURE
117773 ,p_module => l_log_module);
117774
117775 END IF;
117776 --
117777 l_component_type := 'AMB_JLT';
117778 l_component_code := 'FA_RET_REVAL_RESERVE_LOSS';
117779 l_component_type_code := 'S';
117780 l_component_appl_id := 140;
117781 l_amb_context_code := 'DEFAULT';
117782 l_entity_code := 'TRANSACTIONS';
117783 l_event_class_code := 'RETIREMENTS';
117784 l_event_type_code := 'REINSTATEMENTS';
117785 l_line_definition_owner_code := 'S';
117786 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REINS17';
117787 --
117788 l_balance_type_code := 'A';
117789 l_segment := NULL;
117790 l_ccid := NULL;
117791 l_adr_transaction_coa_id := NULL;
117792 l_adr_accounting_coa_id := NULL;
117793 l_adr_flexfield_segment_code := NULL;
117794 l_adr_flex_value_set_id := NULL;
117795 l_adr_value_type_code := NULL;
117796 l_adr_value_combination_id := NULL;
117797 l_adr_value_segment_code := NULL;
117798
117799 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
117800 l_bflow_class_code := ''; -- 4219869 Business Flow
117801 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
117802 l_budgetary_control_flag := 'N';
117803
117804 l_bflow_applied_to_amt_idx := NULL; -- 5132302
117805 l_bflow_applied_to_amt := NULL; -- 5132302
117806 l_entered_amt_idx := NULL; -- 4262811
117807 l_accted_amt_idx := NULL; -- 4262811
117808 l_acc_rev_flag := NULL; -- 4262811
117809 l_accrual_line_num := NULL; -- 4262811
117810 l_tmp_amt := NULL; -- 4262811
117811 --
117812
117813 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
117814 l_balance_type_code <> 'B' THEN
117818 THEN
117815 IF NVL(p_source_48,'
117816 ') = 'REVAL RSV RET' AND
117817 p_source_54 < 0
117819
117820 --
117821 XLA_AE_LINES_PKG.SetNewLine;
117822
117823 p_balance_type_code := l_balance_type_code;
117824 -- set the flag so later we will know whether the gain loss line needs to be created
117825
117826 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
117827 p_actual_flag :='A';
117828 END IF;
117829
117830 --
117831 -- bulk performance
117832 --
117833 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
117834 p_header_num => 0); -- 4262811
117835 --
117836 -- set accounting line options
117837 --
117838 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
117839 p_natural_side_code => 'C'
117840 , p_gain_or_loss_flag => 'N'
117841 , p_gl_transfer_mode_code => 'S'
117842 , p_acct_entry_type_code => 'A'
117843 , p_switch_side_flag => 'Y'
117844 , p_merge_duplicate_code => 'N'
117845 );
117846 --
117847 l_acc_rev_natural_side_code := 'D'; -- 4262811
117848 --
117849 --
117850 -- set accounting line type info
117851 --
117852 xla_ae_lines_pkg.SetAcctLineType
117853 (p_component_type => l_component_type
117854 ,p_event_type_code => l_event_type_code
117855 ,p_line_definition_owner_code => l_line_definition_owner_code
117856 ,p_line_definition_code => l_line_definition_code
117857 ,p_accounting_line_code => l_component_code
117858 ,p_accounting_line_type_code => l_component_type_code
117859 ,p_accounting_line_appl_id => l_component_appl_id
117860 ,p_amb_context_code => l_amb_context_code
117861 ,p_entity_code => l_entity_code
117862 ,p_event_class_code => l_event_class_code);
117863 --
117864 -- set accounting class
117865 --
117866 xla_ae_lines_pkg.SetAcctClass(
117867 p_accounting_class_code => 'ASSET'
117868 , p_ae_header_id => l_ae_header_id
117869 );
117870
117871 --
117872 -- set rounding class
117873 --
117874 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
117875 'ASSET';
117876
117877 --
117878 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
117879 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
117880 --
117881 -- bulk performance
117882 --
117883 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
117884
117885 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
117886 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
117887
117888 -- 4955764
117889 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
117890 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
117891
117892 -- 4458381 Public Sector Enh
117893
117894 --
117895 -- set accounting attributes for the line type
117896 --
117897 l_entered_amt_idx := 4;
117898 l_accted_amt_idx := 6;
117899 l_bflow_applied_to_amt_idx := NULL; -- 5132302
117900 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
117901 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
117902 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
117903 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
117904 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
117905 l_rec_acct_attrs.array_char_value(3) := p_source_51;
117906 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
117907 l_rec_acct_attrs.array_num_value(4) := p_source_52;
117908 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
117909 l_rec_acct_attrs.array_char_value(5) := p_source_53;
117910 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
117911 l_rec_acct_attrs.array_num_value(6) := p_source_52;
117912
117913 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
117914 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
117915
117916 ---------------------------------------------------------------------------------------------------------------
117917 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
117918 ---------------------------------------------------------------------------------------------------------------
117919 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
117920
117921 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
117922 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
117923
117924 IF xla_accounting_cache_pkg.GetValueChar
117925 (p_source_code => 'LEDGER_CATEGORY_CODE'
117926 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
117927 AND l_bflow_method_code = 'PRIOR_ENTRY'
117928 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
117932 THEN
117929 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
117930 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
117931 )
117933 xla_ae_lines_pkg.BflowUpgEntry
117934 (p_business_method_code => l_bflow_method_code
117935 ,p_business_class_code => l_bflow_class_code
117936 ,p_balance_type => l_balance_type_code);
117937 ELSE
117938 NULL;
117939 -- No business flow processing for business flow method of NONE.
117940 END IF;
117941
117942 --
117943 -- call analytical criteria
117944 --
117945
117946 --
117947 -- call description
117948 --
117949
117950 xla_ae_lines_pkg.SetLineDescription(
117951 p_ae_header_id => l_ae_header_id
117952 ,p_description => Description_89 (
117953 p_application_id => p_application_id
117954 , p_ae_header_id => l_ae_header_id
117955 , p_source_1 => p_source_1
117956 )
117957 );
117958
117959
117960 --
117961 -- call ADRs
117962 -- Bug 4922099
117963 --
117964 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
117965 (NVL(l_actual_upg_option, 'N') = 'O') OR
117966 (NVL(l_enc_upg_option, 'N') = 'O')
117967 )
117968 THEN
117969 NULL;
117970 --
117971 --
117972
117973 l_ccid := AcctDerRule_174(
117974 p_application_id => p_application_id
117975 , p_ae_header_id => l_ae_header_id
117976 , p_source_5 => p_source_5
117977 , p_source_32 => p_source_32
117978 , x_transaction_coa_id => l_adr_transaction_coa_id
117979 , x_accounting_coa_id => l_adr_accounting_coa_id
117980 , x_value_type_code => l_adr_value_type_code
117981 , p_side => 'NA'
117982 );
117983
117984 xla_ae_lines_pkg.set_ccid(
117985 p_code_combination_id => l_ccid
117986 , p_value_type_code => l_adr_value_type_code
117987 , p_transaction_coa_id => l_adr_transaction_coa_id
117988 , p_accounting_coa_id => l_adr_accounting_coa_id
117989 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
117990 , p_adr_type_code => 'S'
117991 , p_component_type => l_component_type
117992 , p_component_code => l_component_code
117993 , p_component_type_code => l_component_type_code
117994 , p_component_appl_id => l_component_appl_id
117995 , p_amb_context_code => l_amb_context_code
117996 , p_side => 'NA'
117997 );
117998
117999
118000 l_segment := AcctDerRule_169(
118001 p_application_id => p_application_id
118002 , p_ae_header_id => l_ae_header_id
118003 , p_source_5 => p_source_5
118004 , p_source_31 => p_source_31
118005 , x_transaction_coa_id => l_adr_transaction_coa_id
118006 , x_accounting_coa_id => l_adr_accounting_coa_id
118007 , x_flexfield_segment_code => l_adr_flexfield_segment_code
118008 , x_flex_value_set_id => l_adr_flex_value_set_id
118009 , x_value_type_code => l_adr_value_type_code
118010 , x_value_combination_id => l_adr_value_combination_id
118011 , x_value_segment_code => l_adr_value_segment_code
118012 , p_side => 'NA'
118013 , p_override_seg_flag => 'Y'
118014 );
118015
118016 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
118017
118018 xla_ae_lines_pkg.set_segment(
118019 p_to_segment_code => 'GL_BALANCING'
118020 , p_segment_value => l_segment
118021 , p_from_segment_code => l_adr_value_segment_code
118022 , p_from_combination_id => l_adr_value_combination_id
118023 , p_value_type_code => l_adr_value_type_code
118024 , p_transaction_coa_id => l_adr_transaction_coa_id
118025 , p_accounting_coa_id => l_adr_accounting_coa_id
118026 , p_flexfield_segment_code => l_adr_flexfield_segment_code
118027 , p_flex_value_set_id => l_adr_flex_value_set_id
118028 , p_adr_code => 'FA_EXPENSE_ACCT'
118029 , p_adr_type_code => 'S'
118030 , p_component_type => l_component_type
118031 , p_component_code => l_component_code
118032 , p_component_type_code => l_component_type_code
118033 , p_component_appl_id => l_component_appl_id
118034 , p_amb_context_code => l_amb_context_code
118035 , p_entity_code => 'TRANSACTIONS'
118036 , p_event_class_code => 'RETIREMENTS'
118037 , p_side => 'NA'
118038 );
118039
118040 END IF;
118041
118042 l_segment := AcctDerRule_167(
118043 p_application_id => p_application_id
118044 , p_ae_header_id => l_ae_header_id
118045 , p_source_5 => p_source_5
118046 , p_source_30 => p_source_30
118047 , x_transaction_coa_id => l_adr_transaction_coa_id
118048 , x_accounting_coa_id => l_adr_accounting_coa_id
118049 , x_flexfield_segment_code => l_adr_flexfield_segment_code
118050 , x_flex_value_set_id => l_adr_flex_value_set_id
118051 , x_value_type_code => l_adr_value_type_code
118055 , p_override_seg_flag => 'Y'
118052 , x_value_combination_id => l_adr_value_combination_id
118053 , x_value_segment_code => l_adr_value_segment_code
118054 , p_side => 'NA'
118056 );
118057
118058 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
118059
118060 xla_ae_lines_pkg.set_segment(
118061 p_to_segment_code => 'GL_ACCOUNT'
118062 , p_segment_value => l_segment
118063 , p_from_segment_code => l_adr_value_segment_code
118064 , p_from_combination_id => l_adr_value_combination_id
118065 , p_value_type_code => l_adr_value_type_code
118066 , p_transaction_coa_id => l_adr_transaction_coa_id
118067 , p_accounting_coa_id => l_adr_accounting_coa_id
118068 , p_flexfield_segment_code => l_adr_flexfield_segment_code
118069 , p_flex_value_set_id => l_adr_flex_value_set_id
118070 , p_adr_code => 'FA_REVAL_RES_RET_LOSS_SEGMENT'
118071 , p_adr_type_code => 'S'
118072 , p_component_type => l_component_type
118073 , p_component_code => l_component_code
118074 , p_component_type_code => l_component_type_code
118075 , p_component_appl_id => l_component_appl_id
118076 , p_amb_context_code => l_amb_context_code
118077 , p_entity_code => 'TRANSACTIONS'
118078 , p_event_class_code => 'RETIREMENTS'
118079 , p_side => 'NA'
118080 );
118081
118082 END IF;
118083
118084 --
118085 --
118086 END IF;
118087 --
118088 -- Bug 4922099
118089 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
118090 (NVL(l_enc_upg_option, 'N') = 'O')
118091 ) AND
118092 (l_bflow_method_code = 'PRIOR_ENTRY')
118093 )
118094 THEN
118095 IF
118096 --
118097 1 = 2
118098 --
118099 THEN
118100 xla_accounting_err_pkg.build_message
118101 (p_appli_s_name => 'XLA'
118102 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
118103 ,p_token_1 => 'LINE_NUMBER'
118104 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
118105 ,p_token_2 => 'LINE_TYPE_NAME'
118106 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
118107 l_component_type
118108 ,l_component_code
118109 ,l_component_type_code
118110 ,l_component_appl_id
118111 ,l_amb_context_code
118112 ,l_entity_code
118113 ,l_event_class_code
118114 )
118115 ,p_token_3 => 'OWNER'
118116 ,p_value_3 => xla_lookups_pkg.get_meaning(
118117 p_lookup_type => 'XLA_OWNER_TYPE'
118118 ,p_lookup_code => l_component_type_code
118119 )
118120 ,p_token_4 => 'PRODUCT_NAME'
118121 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
118122 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
118123 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
118124 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
118125 ,p_ae_header_id => NULL
118126 );
118127
118128 IF (C_LEVEL_ERROR>= g_log_level) THEN
118129 trace
118130 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
118131 ,p_level => C_LEVEL_ERROR
118132 ,p_module => l_log_module);
118133 END IF;
118134 END IF;
118135 END IF;
118136 --
118137 --
118138 ------------------------------------------------------------------------------------------------
118139 -- 4219869 Business Flow
118140 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
118141 -- Prior Entry. Currently, the following code is always generated.
118142 ------------------------------------------------------------------------------------------------
118143 XLA_AE_LINES_PKG.ValidateCurrentLine;
118144
118145 ------------------------------------------------------------------------------------
118146 -- 4219869 Business Flow
118147 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
118151 ----------------------------------------------------------------------------------
118148 ------------------------------------------------------------------------------------
118149 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
118150
118152 -- 4219869 Business Flow
118153 -- Update journal entry status -- Need to generate this within IF <condition>
118154 ----------------------------------------------------------------------------------
118155 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
118156 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
118157 ,p_balance_type_code => l_balance_type_code
118158 );
118159
118160 -------------------------------------------------------------------------------------------
118161 -- 4262811 - Generate the Accrual Reversal lines
118162 -------------------------------------------------------------------------------------------
118163 BEGIN
118164 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
118165 (g_array_event(p_event_id).array_value_num('header_index'));
118166 IF l_acc_rev_flag IS NULL THEN
118167 l_acc_rev_flag := 'N';
118168 END IF;
118169 EXCEPTION
118170 WHEN OTHERS THEN
118171 l_acc_rev_flag := 'N';
118172 END;
118173 --
118174 IF (l_acc_rev_flag = 'Y') THEN
118175
118176 -- 4645092 ------------------------------------------------------------------------------
118177 -- To allow MPA report to determine if it should generate report process
118178 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
118179 ------------------------------------------------------------------------------------------
118180
118181 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
118182 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
118183 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
118184 -- call ADRs
118185 -- Bug 4922099
118186 --
118187 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
118188 (NVL(l_actual_upg_option, 'N') = 'O') OR
118189 (NVL(l_enc_upg_option, 'N') = 'O')
118190 )
118191 THEN
118192 NULL;
118193 --
118194 --
118195
118196 l_ccid := AcctDerRule_174(
118197 p_application_id => p_application_id
118198 , p_ae_header_id => l_ae_header_id
118199 , p_source_5 => p_source_5
118200 , p_source_32 => p_source_32
118201 , x_transaction_coa_id => l_adr_transaction_coa_id
118202 , x_accounting_coa_id => l_adr_accounting_coa_id
118203 , x_value_type_code => l_adr_value_type_code
118204 , p_side => 'NA'
118205 );
118206
118207 xla_ae_lines_pkg.set_ccid(
118208 p_code_combination_id => l_ccid
118209 , p_value_type_code => l_adr_value_type_code
118210 , p_transaction_coa_id => l_adr_transaction_coa_id
118211 , p_accounting_coa_id => l_adr_accounting_coa_id
118212 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
118213 , p_adr_type_code => 'S'
118214 , p_component_type => l_component_type
118215 , p_component_code => l_component_code
118216 , p_component_type_code => l_component_type_code
118217 , p_component_appl_id => l_component_appl_id
118218 , p_amb_context_code => l_amb_context_code
118219 , p_side => 'NA'
118220 );
118221
118222
118223 l_segment := AcctDerRule_169(
118224 p_application_id => p_application_id
118225 , p_ae_header_id => l_ae_header_id
118226 , p_source_5 => p_source_5
118227 , p_source_31 => p_source_31
118228 , x_transaction_coa_id => l_adr_transaction_coa_id
118229 , x_accounting_coa_id => l_adr_accounting_coa_id
118230 , x_flexfield_segment_code => l_adr_flexfield_segment_code
118231 , x_flex_value_set_id => l_adr_flex_value_set_id
118232 , x_value_type_code => l_adr_value_type_code
118233 , x_value_combination_id => l_adr_value_combination_id
118234 , x_value_segment_code => l_adr_value_segment_code
118235 , p_side => 'NA'
118236 , p_override_seg_flag => 'Y'
118237 );
118238
118239 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
118240
118241 xla_ae_lines_pkg.set_segment(
118242 p_to_segment_code => 'GL_BALANCING'
118243 , p_segment_value => l_segment
118244 , p_from_segment_code => l_adr_value_segment_code
118245 , p_from_combination_id => l_adr_value_combination_id
118246 , p_value_type_code => l_adr_value_type_code
118247 , p_transaction_coa_id => l_adr_transaction_coa_id
118248 , p_accounting_coa_id => l_adr_accounting_coa_id
118249 , p_flexfield_segment_code => l_adr_flexfield_segment_code
118250 , p_flex_value_set_id => l_adr_flex_value_set_id
118251 , p_adr_code => 'FA_EXPENSE_ACCT'
118252 , p_adr_type_code => 'S'
118253 , p_component_type => l_component_type
118254 , p_component_code => l_component_code
118255 , p_component_type_code => l_component_type_code
118256 , p_component_appl_id => l_component_appl_id
118257 , p_amb_context_code => l_amb_context_code
118258 , p_entity_code => 'TRANSACTIONS'
118259 , p_event_class_code => 'RETIREMENTS'
118263 END IF;
118260 , p_side => 'NA'
118261 );
118262
118264
118265 l_segment := AcctDerRule_167(
118266 p_application_id => p_application_id
118267 , p_ae_header_id => l_ae_header_id
118268 , p_source_5 => p_source_5
118269 , p_source_30 => p_source_30
118270 , x_transaction_coa_id => l_adr_transaction_coa_id
118271 , x_accounting_coa_id => l_adr_accounting_coa_id
118272 , x_flexfield_segment_code => l_adr_flexfield_segment_code
118273 , x_flex_value_set_id => l_adr_flex_value_set_id
118274 , x_value_type_code => l_adr_value_type_code
118275 , x_value_combination_id => l_adr_value_combination_id
118276 , x_value_segment_code => l_adr_value_segment_code
118277 , p_side => 'NA'
118278 , p_override_seg_flag => 'Y'
118279 );
118280
118281 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
118282
118283 xla_ae_lines_pkg.set_segment(
118284 p_to_segment_code => 'GL_ACCOUNT'
118285 , p_segment_value => l_segment
118286 , p_from_segment_code => l_adr_value_segment_code
118287 , p_from_combination_id => l_adr_value_combination_id
118288 , p_value_type_code => l_adr_value_type_code
118289 , p_transaction_coa_id => l_adr_transaction_coa_id
118290 , p_accounting_coa_id => l_adr_accounting_coa_id
118291 , p_flexfield_segment_code => l_adr_flexfield_segment_code
118292 , p_flex_value_set_id => l_adr_flex_value_set_id
118293 , p_adr_code => 'FA_REVAL_RES_RET_LOSS_SEGMENT'
118294 , p_adr_type_code => 'S'
118295 , p_component_type => l_component_type
118296 , p_component_code => l_component_code
118297 , p_component_type_code => l_component_type_code
118298 , p_component_appl_id => l_component_appl_id
118299 , p_amb_context_code => l_amb_context_code
118300 , p_entity_code => 'TRANSACTIONS'
118301 , p_event_class_code => 'RETIREMENTS'
118302 , p_side => 'NA'
118303 );
118304
118305 END IF;
118306
118307 --
118308 --
118309 END IF;
118310
118311 --
118312 -- Update the line information that should be overwritten
118313 --
118314 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
118315 p_header_num => 1);
118316 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
118317
118318 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
118319
118320 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
118321 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
118322 END IF;
118323
118324 --
118325 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
118326 --
118327 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
118328 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
118329 ELSE
118330 ---------------------------------------------------------------------------------------------------
118331 -- 4262811a Switch Sign
118332 ---------------------------------------------------------------------------------------------------
118333 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
118334 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
118335 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
118336 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
118337 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
118338 -- 5132302
118339 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
118340 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
118341
118342 END IF;
118343
118344 -- 4955764
118345 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
118346 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
118347
118348
118349 XLA_AE_LINES_PKG.ValidateCurrentLine;
118350 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
118351
118352 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
118353 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
118354 ,p_balance_type_code => l_balance_type_code);
118355
118356 END IF;
118357
118358 -----------------------------------------------------------------------------------------
118359 -- 4262811 Multiperiod Accounting
118360 -----------------------------------------------------------------------------------------
118361 -- No MPA option is assigned.
118362
118363
118364 END IF;
118365 END IF;
118366 --
118367
118368 --
118369 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
118370 trace
118374 END IF;
118371 (p_msg => 'END of AcctLineType_329'
118372 ,p_level => C_LEVEL_PROCEDURE
118373 ,p_module => l_log_module);
118375 --
118376 EXCEPTION
118377 WHEN xla_exceptions_pkg.application_exception THEN
118378 RAISE;
118379 WHEN OTHERS THEN
118380 xla_exceptions_pkg.raise_message
118381 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_329');
118382 END AcctLineType_329;
118383 --
118384
118385 ---------------------------------------
118386 --
118387 -- PRIVATE FUNCTION
118388 -- AcctLineType_330
118389 --
118390 ---------------------------------------
118391 PROCEDURE AcctLineType_330 (
118392 p_application_id IN NUMBER
118393 ,p_event_id IN NUMBER
118394 ,p_calculate_acctd_flag IN VARCHAR2
118395 ,p_calculate_g_l_flag IN VARCHAR2
118396 ,p_actual_flag IN OUT VARCHAR2
118397 ,p_balance_type_code OUT VARCHAR2
118398 ,p_gain_or_loss_ref OUT VARCHAR2
118399
118400 --Period Close Date
118401 , p_source_1 IN DATE
118402 --Generated Code Combination Identifier
118403 , p_source_5 IN NUMBER
118404 --Bonus Reserve Account
118405 , p_source_6 IN VARCHAR2
118406 --Generated Offset Code Combination Identifier
118407 , p_source_19 IN NUMBER
118408 --Expense Account Code Combination Identifier
118409 , p_source_31 IN NUMBER
118410 --Default Code Combination Identifier
118411 , p_source_32 IN NUMBER
118412 --Adjustment Type
118413 , p_source_48 IN VARCHAR2
118414 --Transaction Header Identifier
118415 , p_source_49 IN NUMBER
118416 --Adjustment Line Identifier
118417 , p_source_50 IN NUMBER
118418 --Distribution Type Code
118419 , p_source_51 IN VARCHAR2
118420 --Entered Amount
118421 , p_source_52 IN NUMBER
118422 --Currency Code
118423 , p_source_53 IN VARCHAR2
118424 )
118425 IS
118426
118427 l_component_type VARCHAR2(80);
118428 l_component_code VARCHAR2(30);
118429 l_component_type_code VARCHAR2(1);
118430 l_component_appl_id INTEGER;
118431 l_amb_context_code VARCHAR2(30);
118432 l_entity_code VARCHAR2(30);
118433 l_event_class_code VARCHAR2(30);
118434 l_ae_header_id NUMBER;
118435 l_event_type_code VARCHAR2(30);
118436 l_line_definition_code VARCHAR2(30);
118437 l_line_definition_owner_code VARCHAR2(1);
118438 --
118439 -- adr variables
118440 l_segment VARCHAR2(30);
118441 l_ccid NUMBER;
118442 l_adr_transaction_coa_id NUMBER;
118443 l_adr_accounting_coa_id NUMBER;
118444 l_adr_flexfield_segment_code VARCHAR2(30);
118445 l_adr_flex_value_set_id NUMBER;
118446 l_adr_value_type_code VARCHAR2(30);
118447 l_adr_value_combination_id NUMBER;
118448 l_adr_value_segment_code VARCHAR2(30);
118449
118450 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
118451 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
118452 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
118453 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
118454
118455 -- 4262811 Variables ------------------------------------------------------------------------------------------
118456 l_entered_amt_idx NUMBER;
118457 l_accted_amt_idx NUMBER;
118458 l_acc_rev_flag VARCHAR2(1);
118459 l_accrual_line_num NUMBER;
118460 l_tmp_amt NUMBER;
118461 l_acc_rev_natural_side_code VARCHAR2(1);
118462
118463 l_num_entries NUMBER;
118464 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
118465 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
118466 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
118467 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
118468 l_recog_line_1 NUMBER;
118469 l_recog_line_2 NUMBER;
118470
118471 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
118472 l_bflow_applied_to_amt NUMBER; -- 5132302
118473 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
118474
118475 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
118476
118477 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
118478 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
118479
118480 ---------------------------------------------------------------------------------------------------------------
118481
118482
118483 --
118484 -- bulk performance
118485 --
118486 l_balance_type_code VARCHAR2(1);
118487 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
118488 l_log_module VARCHAR2(240);
118489
118490 --
118491 -- Upgrade strategy
118492 --
118493 l_actual_upg_option VARCHAR2(1);
118494 l_enc_upg_option VARCHAR2(1);
118495
118496 --
118497 BEGIN
118498 --
118499 IF g_log_enabled THEN
118500 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_330';
118501 END IF;
118502 --
118503 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
118504
118505 trace
118506 (p_msg => 'BEGIN of AcctLineType_330'
118510 END IF;
118507 ,p_level => C_LEVEL_PROCEDURE
118508 ,p_module => l_log_module);
118509
118511 --
118512 l_component_type := 'AMB_JLT';
118513 l_component_code := 'FA_REVAL_BONUS_DEPRN_RESERVE';
118514 l_component_type_code := 'S';
118515 l_component_appl_id := 140;
118516 l_amb_context_code := 'DEFAULT';
118517 l_entity_code := 'TRANSACTIONS';
118518 l_event_class_code := 'REVALUATION';
118519 l_event_type_code := 'REVALUATION_ALL';
118520 l_line_definition_owner_code := 'S';
118521 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVAL21';
118522 --
118523 l_balance_type_code := 'A';
118524 l_segment := NULL;
118525 l_ccid := NULL;
118526 l_adr_transaction_coa_id := NULL;
118527 l_adr_accounting_coa_id := NULL;
118528 l_adr_flexfield_segment_code := NULL;
118529 l_adr_flex_value_set_id := NULL;
118530 l_adr_value_type_code := NULL;
118531 l_adr_value_combination_id := NULL;
118532 l_adr_value_segment_code := NULL;
118533
118534 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
118535 l_bflow_class_code := ''; -- 4219869 Business Flow
118536 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
118537 l_budgetary_control_flag := 'N';
118538
118539 l_bflow_applied_to_amt_idx := NULL; -- 5132302
118540 l_bflow_applied_to_amt := NULL; -- 5132302
118541 l_entered_amt_idx := NULL; -- 4262811
118542 l_accted_amt_idx := NULL; -- 4262811
118543 l_acc_rev_flag := NULL; -- 4262811
118544 l_accrual_line_num := NULL; -- 4262811
118545 l_tmp_amt := NULL; -- 4262811
118546 --
118547
118548 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
118549 l_balance_type_code <> 'B' THEN
118550 IF NVL(p_source_48,'
118551 ') = 'BONUS RESERVE'
118552 THEN
118553
118554 --
118555 XLA_AE_LINES_PKG.SetNewLine;
118556
118557 p_balance_type_code := l_balance_type_code;
118558 -- set the flag so later we will know whether the gain loss line needs to be created
118559
118560 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
118561 p_actual_flag :='A';
118562 END IF;
118563
118564 --
118565 -- bulk performance
118566 --
118567 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
118568 p_header_num => 0); -- 4262811
118569 --
118570 -- set accounting line options
118571 --
118572 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
118573 p_natural_side_code => 'C'
118574 , p_gain_or_loss_flag => 'N'
118575 , p_gl_transfer_mode_code => 'S'
118576 , p_acct_entry_type_code => 'A'
118577 , p_switch_side_flag => 'Y'
118578 , p_merge_duplicate_code => 'N'
118579 );
118580 --
118581 l_acc_rev_natural_side_code := 'D'; -- 4262811
118582 --
118583 --
118584 -- set accounting line type info
118585 --
118586 xla_ae_lines_pkg.SetAcctLineType
118587 (p_component_type => l_component_type
118588 ,p_event_type_code => l_event_type_code
118589 ,p_line_definition_owner_code => l_line_definition_owner_code
118590 ,p_line_definition_code => l_line_definition_code
118591 ,p_accounting_line_code => l_component_code
118592 ,p_accounting_line_type_code => l_component_type_code
118593 ,p_accounting_line_appl_id => l_component_appl_id
118594 ,p_amb_context_code => l_amb_context_code
118595 ,p_entity_code => l_entity_code
118596 ,p_event_class_code => l_event_class_code);
118597 --
118598 -- set accounting class
118599 --
118600 xla_ae_lines_pkg.SetAcctClass(
118601 p_accounting_class_code => 'ASSET'
118602 , p_ae_header_id => l_ae_header_id
118603 );
118604
118605 --
118606 -- set rounding class
118607 --
118608 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
118609 'ASSET';
118610
118611 --
118612 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
118613 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
118614 --
118615 -- bulk performance
118616 --
118617 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
118618
118619 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
118620 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
118621
118622 -- 4955764
118623 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
118624 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
118625
118626 -- 4458381 Public Sector Enh
118627
118628 --
118629 -- set accounting attributes for the line type
118630 --
118631 l_entered_amt_idx := 4;
118632 l_accted_amt_idx := 6;
118633 l_bflow_applied_to_amt_idx := NULL; -- 5132302
118637 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
118634 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
118635 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
118636 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
118638 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
118639 l_rec_acct_attrs.array_char_value(3) := p_source_51;
118640 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
118641 l_rec_acct_attrs.array_num_value(4) := p_source_52;
118642 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
118643 l_rec_acct_attrs.array_char_value(5) := p_source_53;
118644 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
118645 l_rec_acct_attrs.array_num_value(6) := p_source_52;
118646
118647 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
118648 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
118649
118650 ---------------------------------------------------------------------------------------------------------------
118651 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
118652 ---------------------------------------------------------------------------------------------------------------
118653 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
118654
118655 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
118656 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
118657
118658 IF xla_accounting_cache_pkg.GetValueChar
118659 (p_source_code => 'LEDGER_CATEGORY_CODE'
118660 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
118661 AND l_bflow_method_code = 'PRIOR_ENTRY'
118662 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
118663 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
118664 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
118665 )
118666 THEN
118667 xla_ae_lines_pkg.BflowUpgEntry
118668 (p_business_method_code => l_bflow_method_code
118669 ,p_business_class_code => l_bflow_class_code
118670 ,p_balance_type => l_balance_type_code);
118671 ELSE
118672 NULL;
118673 -- No business flow processing for business flow method of NONE.
118674 END IF;
118675
118676 --
118677 -- call analytical criteria
118678 --
118679
118680 --
118681 -- call description
118682 --
118683
118684 xla_ae_lines_pkg.SetLineDescription(
118685 p_ae_header_id => l_ae_header_id
118686 ,p_description => Description_92 (
118687 p_application_id => p_application_id
118688 , p_ae_header_id => l_ae_header_id
118689 , p_source_1 => p_source_1
118690 )
118691 );
118692
118693
118694 --
118695 -- call ADRs
118696 -- Bug 4922099
118697 --
118698 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
118699 (NVL(l_actual_upg_option, 'N') = 'O') OR
118700 (NVL(l_enc_upg_option, 'N') = 'O')
118701 )
118702 THEN
118703 NULL;
118704 --
118705 --
118706
118707 l_ccid := AcctDerRule_175(
118708 p_application_id => p_application_id
118709 , p_ae_header_id => l_ae_header_id
118710 , p_source_5 => p_source_5
118711 , p_source_19 => p_source_19
118712 , p_source_32 => p_source_32
118713 , x_transaction_coa_id => l_adr_transaction_coa_id
118714 , x_accounting_coa_id => l_adr_accounting_coa_id
118715 , x_value_type_code => l_adr_value_type_code
118716 , p_side => 'NA'
118717 );
118718
118719 xla_ae_lines_pkg.set_ccid(
118720 p_code_combination_id => l_ccid
118721 , p_value_type_code => l_adr_value_type_code
118722 , p_transaction_coa_id => l_adr_transaction_coa_id
118723 , p_accounting_coa_id => l_adr_accounting_coa_id
118724 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
118725 , p_adr_type_code => 'S'
118726 , p_component_type => l_component_type
118727 , p_component_code => l_component_code
118728 , p_component_type_code => l_component_type_code
118729 , p_component_appl_id => l_component_appl_id
118730 , p_amb_context_code => l_amb_context_code
118731 , p_side => 'NA'
118732 );
118733
118734
118735 l_segment := AcctDerRule_145(
118736 p_application_id => p_application_id
118737 , p_ae_header_id => l_ae_header_id
118738 , p_source_5 => p_source_5
118739 , p_source_6 => p_source_6
118740 , x_transaction_coa_id => l_adr_transaction_coa_id
118741 , x_accounting_coa_id => l_adr_accounting_coa_id
118742 , x_flexfield_segment_code => l_adr_flexfield_segment_code
118743 , x_flex_value_set_id => l_adr_flex_value_set_id
118744 , x_value_type_code => l_adr_value_type_code
118745 , x_value_combination_id => l_adr_value_combination_id
118746 , x_value_segment_code => l_adr_value_segment_code
118747 , p_side => 'NA'
118748 , p_override_seg_flag => 'Y'
118752
118749 );
118750
118751 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
118753 xla_ae_lines_pkg.set_segment(
118754 p_to_segment_code => 'GL_ACCOUNT'
118755 , p_segment_value => l_segment
118756 , p_from_segment_code => l_adr_value_segment_code
118757 , p_from_combination_id => l_adr_value_combination_id
118758 , p_value_type_code => l_adr_value_type_code
118759 , p_transaction_coa_id => l_adr_transaction_coa_id
118760 , p_accounting_coa_id => l_adr_accounting_coa_id
118761 , p_flexfield_segment_code => l_adr_flexfield_segment_code
118762 , p_flex_value_set_id => l_adr_flex_value_set_id
118763 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
118764 , p_adr_type_code => 'S'
118765 , p_component_type => l_component_type
118766 , p_component_code => l_component_code
118767 , p_component_type_code => l_component_type_code
118768 , p_component_appl_id => l_component_appl_id
118769 , p_amb_context_code => l_amb_context_code
118770 , p_entity_code => 'TRANSACTIONS'
118771 , p_event_class_code => 'REVALUATION'
118772 , p_side => 'NA'
118773 );
118774
118775 END IF;
118776
118777 l_segment := AcctDerRule_169(
118778 p_application_id => p_application_id
118779 , p_ae_header_id => l_ae_header_id
118780 , p_source_5 => p_source_5
118781 , p_source_31 => p_source_31
118782 , x_transaction_coa_id => l_adr_transaction_coa_id
118783 , x_accounting_coa_id => l_adr_accounting_coa_id
118784 , x_flexfield_segment_code => l_adr_flexfield_segment_code
118785 , x_flex_value_set_id => l_adr_flex_value_set_id
118786 , x_value_type_code => l_adr_value_type_code
118787 , x_value_combination_id => l_adr_value_combination_id
118788 , x_value_segment_code => l_adr_value_segment_code
118789 , p_side => 'NA'
118790 , p_override_seg_flag => 'Y'
118791 );
118792
118793 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
118794
118795 xla_ae_lines_pkg.set_segment(
118796 p_to_segment_code => 'GL_BALANCING'
118797 , p_segment_value => l_segment
118798 , p_from_segment_code => l_adr_value_segment_code
118799 , p_from_combination_id => l_adr_value_combination_id
118800 , p_value_type_code => l_adr_value_type_code
118801 , p_transaction_coa_id => l_adr_transaction_coa_id
118802 , p_accounting_coa_id => l_adr_accounting_coa_id
118803 , p_flexfield_segment_code => l_adr_flexfield_segment_code
118804 , p_flex_value_set_id => l_adr_flex_value_set_id
118805 , p_adr_code => 'FA_EXPENSE_ACCT'
118806 , p_adr_type_code => 'S'
118807 , p_component_type => l_component_type
118808 , p_component_code => l_component_code
118809 , p_component_type_code => l_component_type_code
118810 , p_component_appl_id => l_component_appl_id
118811 , p_amb_context_code => l_amb_context_code
118812 , p_entity_code => 'TRANSACTIONS'
118813 , p_event_class_code => 'REVALUATION'
118814 , p_side => 'NA'
118815 );
118816
118817 END IF;
118818
118819 --
118820 --
118821 END IF;
118822 --
118823 -- Bug 4922099
118824 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
118825 (NVL(l_enc_upg_option, 'N') = 'O')
118826 ) AND
118827 (l_bflow_method_code = 'PRIOR_ENTRY')
118828 )
118829 THEN
118830 IF
118831 --
118832 1 = 2
118833 --
118834 THEN
118835 xla_accounting_err_pkg.build_message
118836 (p_appli_s_name => 'XLA'
118837 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
118838 ,p_token_1 => 'LINE_NUMBER'
118839 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
118840 ,p_token_2 => 'LINE_TYPE_NAME'
118841 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
118842 l_component_type
118843 ,l_component_code
118844 ,l_component_type_code
118845 ,l_component_appl_id
118846 ,l_amb_context_code
118847 ,l_entity_code
118848 ,l_event_class_code
118849 )
118850 ,p_token_3 => 'OWNER'
118851 ,p_value_3 => xla_lookups_pkg.get_meaning(
118852 p_lookup_type => 'XLA_OWNER_TYPE'
118853 ,p_lookup_code => l_component_type_code
118857 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
118854 )
118855 ,p_token_4 => 'PRODUCT_NAME'
118856 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
118858 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
118859 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
118860 ,p_ae_header_id => NULL
118861 );
118862
118863 IF (C_LEVEL_ERROR>= g_log_level) THEN
118864 trace
118865 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
118866 ,p_level => C_LEVEL_ERROR
118867 ,p_module => l_log_module);
118868 END IF;
118869 END IF;
118870 END IF;
118871 --
118872 --
118873 ------------------------------------------------------------------------------------------------
118874 -- 4219869 Business Flow
118875 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
118876 -- Prior Entry. Currently, the following code is always generated.
118877 ------------------------------------------------------------------------------------------------
118878 XLA_AE_LINES_PKG.ValidateCurrentLine;
118879
118880 ------------------------------------------------------------------------------------
118881 -- 4219869 Business Flow
118882 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
118883 ------------------------------------------------------------------------------------
118884 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
118885
118886 ----------------------------------------------------------------------------------
118887 -- 4219869 Business Flow
118888 -- Update journal entry status -- Need to generate this within IF <condition>
118889 ----------------------------------------------------------------------------------
118890 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
118891 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
118892 ,p_balance_type_code => l_balance_type_code
118893 );
118894
118895 -------------------------------------------------------------------------------------------
118896 -- 4262811 - Generate the Accrual Reversal lines
118897 -------------------------------------------------------------------------------------------
118898 BEGIN
118899 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
118900 (g_array_event(p_event_id).array_value_num('header_index'));
118901 IF l_acc_rev_flag IS NULL THEN
118902 l_acc_rev_flag := 'N';
118903 END IF;
118904 EXCEPTION
118905 WHEN OTHERS THEN
118906 l_acc_rev_flag := 'N';
118907 END;
118908 --
118909 IF (l_acc_rev_flag = 'Y') THEN
118910
118911 -- 4645092 ------------------------------------------------------------------------------
118912 -- To allow MPA report to determine if it should generate report process
118913 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
118914 ------------------------------------------------------------------------------------------
118915
118916 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
118917 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
118918 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
118919 -- call ADRs
118920 -- Bug 4922099
118921 --
118922 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
118923 (NVL(l_actual_upg_option, 'N') = 'O') OR
118924 (NVL(l_enc_upg_option, 'N') = 'O')
118925 )
118926 THEN
118927 NULL;
118928 --
118929 --
118930
118931 l_ccid := AcctDerRule_175(
118932 p_application_id => p_application_id
118933 , p_ae_header_id => l_ae_header_id
118934 , p_source_5 => p_source_5
118935 , p_source_19 => p_source_19
118936 , p_source_32 => p_source_32
118937 , x_transaction_coa_id => l_adr_transaction_coa_id
118938 , x_accounting_coa_id => l_adr_accounting_coa_id
118939 , x_value_type_code => l_adr_value_type_code
118940 , p_side => 'NA'
118941 );
118942
118943 xla_ae_lines_pkg.set_ccid(
118944 p_code_combination_id => l_ccid
118945 , p_value_type_code => l_adr_value_type_code
118946 , p_transaction_coa_id => l_adr_transaction_coa_id
118947 , p_accounting_coa_id => l_adr_accounting_coa_id
118948 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
118949 , p_adr_type_code => 'S'
118950 , p_component_type => l_component_type
118951 , p_component_code => l_component_code
118952 , p_component_type_code => l_component_type_code
118953 , p_component_appl_id => l_component_appl_id
118954 , p_amb_context_code => l_amb_context_code
118955 , p_side => 'NA'
118956 );
118957
118958
118959 l_segment := AcctDerRule_145(
118960 p_application_id => p_application_id
118964 , x_transaction_coa_id => l_adr_transaction_coa_id
118961 , p_ae_header_id => l_ae_header_id
118962 , p_source_5 => p_source_5
118963 , p_source_6 => p_source_6
118965 , x_accounting_coa_id => l_adr_accounting_coa_id
118966 , x_flexfield_segment_code => l_adr_flexfield_segment_code
118967 , x_flex_value_set_id => l_adr_flex_value_set_id
118968 , x_value_type_code => l_adr_value_type_code
118969 , x_value_combination_id => l_adr_value_combination_id
118970 , x_value_segment_code => l_adr_value_segment_code
118971 , p_side => 'NA'
118972 , p_override_seg_flag => 'Y'
118973 );
118974
118975 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
118976
118977 xla_ae_lines_pkg.set_segment(
118978 p_to_segment_code => 'GL_ACCOUNT'
118979 , p_segment_value => l_segment
118980 , p_from_segment_code => l_adr_value_segment_code
118981 , p_from_combination_id => l_adr_value_combination_id
118982 , p_value_type_code => l_adr_value_type_code
118983 , p_transaction_coa_id => l_adr_transaction_coa_id
118984 , p_accounting_coa_id => l_adr_accounting_coa_id
118985 , p_flexfield_segment_code => l_adr_flexfield_segment_code
118986 , p_flex_value_set_id => l_adr_flex_value_set_id
118987 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
118988 , p_adr_type_code => 'S'
118989 , p_component_type => l_component_type
118990 , p_component_code => l_component_code
118991 , p_component_type_code => l_component_type_code
118992 , p_component_appl_id => l_component_appl_id
118993 , p_amb_context_code => l_amb_context_code
118994 , p_entity_code => 'TRANSACTIONS'
118995 , p_event_class_code => 'REVALUATION'
118996 , p_side => 'NA'
118997 );
118998
118999 END IF;
119000
119001 l_segment := AcctDerRule_169(
119002 p_application_id => p_application_id
119003 , p_ae_header_id => l_ae_header_id
119004 , p_source_5 => p_source_5
119005 , p_source_31 => p_source_31
119006 , x_transaction_coa_id => l_adr_transaction_coa_id
119007 , x_accounting_coa_id => l_adr_accounting_coa_id
119008 , x_flexfield_segment_code => l_adr_flexfield_segment_code
119009 , x_flex_value_set_id => l_adr_flex_value_set_id
119010 , x_value_type_code => l_adr_value_type_code
119011 , x_value_combination_id => l_adr_value_combination_id
119012 , x_value_segment_code => l_adr_value_segment_code
119013 , p_side => 'NA'
119014 , p_override_seg_flag => 'Y'
119015 );
119016
119017 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
119018
119019 xla_ae_lines_pkg.set_segment(
119020 p_to_segment_code => 'GL_BALANCING'
119021 , p_segment_value => l_segment
119022 , p_from_segment_code => l_adr_value_segment_code
119023 , p_from_combination_id => l_adr_value_combination_id
119024 , p_value_type_code => l_adr_value_type_code
119025 , p_transaction_coa_id => l_adr_transaction_coa_id
119026 , p_accounting_coa_id => l_adr_accounting_coa_id
119027 , p_flexfield_segment_code => l_adr_flexfield_segment_code
119028 , p_flex_value_set_id => l_adr_flex_value_set_id
119029 , p_adr_code => 'FA_EXPENSE_ACCT'
119030 , p_adr_type_code => 'S'
119031 , p_component_type => l_component_type
119032 , p_component_code => l_component_code
119033 , p_component_type_code => l_component_type_code
119034 , p_component_appl_id => l_component_appl_id
119035 , p_amb_context_code => l_amb_context_code
119036 , p_entity_code => 'TRANSACTIONS'
119037 , p_event_class_code => 'REVALUATION'
119038 , p_side => 'NA'
119039 );
119040
119041 END IF;
119042
119043 --
119044 --
119045 END IF;
119046
119047 --
119048 -- Update the line information that should be overwritten
119049 --
119050 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
119051 p_header_num => 1);
119052 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
119053
119054 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
119055
119056 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
119057 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
119058 END IF;
119059
119060 --
119061 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
119062 --
119063 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
119064 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
119065 ELSE
119066 ---------------------------------------------------------------------------------------------------
119067 -- 4262811a Switch Sign
119071 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
119068 ---------------------------------------------------------------------------------------------------
119069 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
119070 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
119072 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
119073 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
119074 -- 5132302
119075 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
119076 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
119077
119078 END IF;
119079
119080 -- 4955764
119081 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
119082 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
119083
119084
119085 XLA_AE_LINES_PKG.ValidateCurrentLine;
119086 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
119087
119088 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
119089 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
119090 ,p_balance_type_code => l_balance_type_code);
119091
119092 END IF;
119093
119094 -----------------------------------------------------------------------------------------
119095 -- 4262811 Multiperiod Accounting
119096 -----------------------------------------------------------------------------------------
119097 -- No MPA option is assigned.
119098
119099
119100 END IF;
119101 END IF;
119102 --
119103
119104 --
119105 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
119106 trace
119107 (p_msg => 'END of AcctLineType_330'
119108 ,p_level => C_LEVEL_PROCEDURE
119109 ,p_module => l_log_module);
119110 END IF;
119111 --
119112 EXCEPTION
119113 WHEN xla_exceptions_pkg.application_exception THEN
119114 RAISE;
119115 WHEN OTHERS THEN
119116 xla_exceptions_pkg.raise_message
119117 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_330');
119118 END AcctLineType_330;
119119 --
119120
119121 ---------------------------------------
119122 --
119123 -- PRIVATE FUNCTION
119124 -- AcctLineType_331
119125 --
119126 ---------------------------------------
119127 PROCEDURE AcctLineType_331 (
119128 p_application_id IN NUMBER
119129 ,p_event_id IN NUMBER
119130 ,p_calculate_acctd_flag IN VARCHAR2
119131 ,p_calculate_g_l_flag IN VARCHAR2
119132 ,p_actual_flag IN OUT VARCHAR2
119133 ,p_balance_type_code OUT VARCHAR2
119134 ,p_gain_or_loss_ref OUT VARCHAR2
119135
119136 --Period Close Date
119137 , p_source_1 IN DATE
119138 --Bonus Depreciation Expense Account
119139 , p_source_4 IN VARCHAR2
119140 --Generated Code Combination Identifier
119141 , p_source_5 IN NUMBER
119142 --Expense Account Code Combination Identifier
119143 , p_source_31 IN NUMBER
119144 --Adjustment Type
119145 , p_source_48 IN VARCHAR2
119146 --Transaction Header Identifier
119147 , p_source_49 IN NUMBER
119148 --Adjustment Line Identifier
119149 , p_source_50 IN NUMBER
119150 --Distribution Type Code
119151 , p_source_51 IN VARCHAR2
119152 --Entered Amount
119153 , p_source_52 IN NUMBER
119154 --Currency Code
119155 , p_source_53 IN VARCHAR2
119156 )
119157 IS
119158
119159 l_component_type VARCHAR2(80);
119160 l_component_code VARCHAR2(30);
119161 l_component_type_code VARCHAR2(1);
119162 l_component_appl_id INTEGER;
119163 l_amb_context_code VARCHAR2(30);
119164 l_entity_code VARCHAR2(30);
119165 l_event_class_code VARCHAR2(30);
119166 l_ae_header_id NUMBER;
119167 l_event_type_code VARCHAR2(30);
119168 l_line_definition_code VARCHAR2(30);
119169 l_line_definition_owner_code VARCHAR2(1);
119170 --
119171 -- adr variables
119172 l_segment VARCHAR2(30);
119173 l_ccid NUMBER;
119174 l_adr_transaction_coa_id NUMBER;
119175 l_adr_accounting_coa_id NUMBER;
119176 l_adr_flexfield_segment_code VARCHAR2(30);
119177 l_adr_flex_value_set_id NUMBER;
119178 l_adr_value_type_code VARCHAR2(30);
119179 l_adr_value_combination_id NUMBER;
119180 l_adr_value_segment_code VARCHAR2(30);
119181
119182 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
119183 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
119184 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
119185 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
119186
119187 -- 4262811 Variables ------------------------------------------------------------------------------------------
119188 l_entered_amt_idx NUMBER;
119189 l_accted_amt_idx NUMBER;
119190 l_acc_rev_flag VARCHAR2(1);
119191 l_accrual_line_num NUMBER;
119192 l_tmp_amt NUMBER;
119193 l_acc_rev_natural_side_code VARCHAR2(1);
119194
119198 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
119195 l_num_entries NUMBER;
119196 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
119197 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
119199 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
119200 l_recog_line_1 NUMBER;
119201 l_recog_line_2 NUMBER;
119202
119203 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
119204 l_bflow_applied_to_amt NUMBER; -- 5132302
119205 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
119206
119207 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
119208
119209 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
119210 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
119211
119212 ---------------------------------------------------------------------------------------------------------------
119213
119214
119215 --
119216 -- bulk performance
119217 --
119218 l_balance_type_code VARCHAR2(1);
119219 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
119220 l_log_module VARCHAR2(240);
119221
119222 --
119223 -- Upgrade strategy
119224 --
119225 l_actual_upg_option VARCHAR2(1);
119226 l_enc_upg_option VARCHAR2(1);
119227
119228 --
119229 BEGIN
119230 --
119231 IF g_log_enabled THEN
119232 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_331';
119233 END IF;
119234 --
119235 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
119236
119237 trace
119238 (p_msg => 'BEGIN of AcctLineType_331'
119239 ,p_level => C_LEVEL_PROCEDURE
119240 ,p_module => l_log_module);
119241
119242 END IF;
119243 --
119244 l_component_type := 'AMB_JLT';
119245 l_component_code := 'FA_REVAL_BONUS_EXPENSE';
119246 l_component_type_code := 'S';
119247 l_component_appl_id := 140;
119248 l_amb_context_code := 'DEFAULT';
119249 l_entity_code := 'TRANSACTIONS';
119250 l_event_class_code := 'REVALUATION';
119251 l_event_type_code := 'REVALUATION_ALL';
119252 l_line_definition_owner_code := 'S';
119253 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVAL21';
119254 --
119255 l_balance_type_code := 'A';
119256 l_segment := NULL;
119257 l_ccid := NULL;
119258 l_adr_transaction_coa_id := NULL;
119259 l_adr_accounting_coa_id := NULL;
119260 l_adr_flexfield_segment_code := NULL;
119261 l_adr_flex_value_set_id := NULL;
119262 l_adr_value_type_code := NULL;
119263 l_adr_value_combination_id := NULL;
119264 l_adr_value_segment_code := NULL;
119265
119266 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
119267 l_bflow_class_code := ''; -- 4219869 Business Flow
119268 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
119269 l_budgetary_control_flag := 'N';
119270
119271 l_bflow_applied_to_amt_idx := NULL; -- 5132302
119272 l_bflow_applied_to_amt := NULL; -- 5132302
119273 l_entered_amt_idx := NULL; -- 4262811
119274 l_accted_amt_idx := NULL; -- 4262811
119275 l_acc_rev_flag := NULL; -- 4262811
119276 l_accrual_line_num := NULL; -- 4262811
119277 l_tmp_amt := NULL; -- 4262811
119278 --
119279
119280 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
119281 l_balance_type_code <> 'B' THEN
119282 IF NVL(p_source_48,'
119283 ') = 'BONUS EXPENSE'
119284 THEN
119285
119286 --
119287 XLA_AE_LINES_PKG.SetNewLine;
119288
119289 p_balance_type_code := l_balance_type_code;
119290 -- set the flag so later we will know whether the gain loss line needs to be created
119291
119292 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
119293 p_actual_flag :='A';
119294 END IF;
119295
119296 --
119297 -- bulk performance
119298 --
119299 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
119300 p_header_num => 0); -- 4262811
119301 --
119302 -- set accounting line options
119303 --
119304 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
119305 p_natural_side_code => 'D'
119306 , p_gain_or_loss_flag => 'N'
119307 , p_gl_transfer_mode_code => 'S'
119308 , p_acct_entry_type_code => 'A'
119309 , p_switch_side_flag => 'Y'
119310 , p_merge_duplicate_code => 'N'
119311 );
119312 --
119313 l_acc_rev_natural_side_code := 'C'; -- 4262811
119314 --
119315 --
119316 -- set accounting line type info
119317 --
119318 xla_ae_lines_pkg.SetAcctLineType
119319 (p_component_type => l_component_type
119320 ,p_event_type_code => l_event_type_code
119321 ,p_line_definition_owner_code => l_line_definition_owner_code
119322 ,p_line_definition_code => l_line_definition_code
119323 ,p_accounting_line_code => l_component_code
119324 ,p_accounting_line_type_code => l_component_type_code
119328 ,p_event_class_code => l_event_class_code);
119325 ,p_accounting_line_appl_id => l_component_appl_id
119326 ,p_amb_context_code => l_amb_context_code
119327 ,p_entity_code => l_entity_code
119329 --
119330 -- set accounting class
119331 --
119332 xla_ae_lines_pkg.SetAcctClass(
119333 p_accounting_class_code => 'EXPENSE'
119334 , p_ae_header_id => l_ae_header_id
119335 );
119336
119337 --
119338 -- set rounding class
119339 --
119340 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
119341 'EXPENSE';
119342
119343 --
119344 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
119345 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
119346 --
119347 -- bulk performance
119348 --
119349 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
119350
119351 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
119352 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
119353
119354 -- 4955764
119355 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
119356 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
119357
119358 -- 4458381 Public Sector Enh
119359
119360 --
119361 -- set accounting attributes for the line type
119362 --
119363 l_entered_amt_idx := 4;
119364 l_accted_amt_idx := 6;
119365 l_bflow_applied_to_amt_idx := NULL; -- 5132302
119366 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
119367 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
119368 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
119369 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
119370 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
119371 l_rec_acct_attrs.array_char_value(3) := p_source_51;
119372 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
119373 l_rec_acct_attrs.array_num_value(4) := p_source_52;
119374 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
119375 l_rec_acct_attrs.array_char_value(5) := p_source_53;
119376 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
119377 l_rec_acct_attrs.array_num_value(6) := p_source_52;
119378
119379 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
119380 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
119381
119382 ---------------------------------------------------------------------------------------------------------------
119383 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
119384 ---------------------------------------------------------------------------------------------------------------
119385 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
119386
119387 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
119388 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
119389
119390 IF xla_accounting_cache_pkg.GetValueChar
119391 (p_source_code => 'LEDGER_CATEGORY_CODE'
119392 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
119393 AND l_bflow_method_code = 'PRIOR_ENTRY'
119394 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
119395 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
119396 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
119397 )
119398 THEN
119399 xla_ae_lines_pkg.BflowUpgEntry
119400 (p_business_method_code => l_bflow_method_code
119401 ,p_business_class_code => l_bflow_class_code
119402 ,p_balance_type => l_balance_type_code);
119403 ELSE
119404 NULL;
119405 -- No business flow processing for business flow method of NONE.
119406 END IF;
119407
119408 --
119409 -- call analytical criteria
119410 --
119411
119412 --
119413 -- call description
119414 --
119415
119416 xla_ae_lines_pkg.SetLineDescription(
119417 p_ae_header_id => l_ae_header_id
119418 ,p_description => Description_91 (
119419 p_application_id => p_application_id
119420 , p_ae_header_id => l_ae_header_id
119421 , p_source_1 => p_source_1
119422 )
119423 );
119424
119425
119426 --
119427 -- call ADRs
119428 -- Bug 4922099
119429 --
119430 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
119431 (NVL(l_actual_upg_option, 'N') = 'O') OR
119432 (NVL(l_enc_upg_option, 'N') = 'O')
119433 )
119434 THEN
119435 NULL;
119436 --
119437 --
119438
119439 l_ccid := AcctDerRule_176(
119440 p_application_id => p_application_id
119441 , p_ae_header_id => l_ae_header_id
119442 , p_source_5 => p_source_5
119443 , p_source_31 => p_source_31
119444 , x_transaction_coa_id => l_adr_transaction_coa_id
119445 , x_accounting_coa_id => l_adr_accounting_coa_id
119446 , x_value_type_code => l_adr_value_type_code
119450 xla_ae_lines_pkg.set_ccid(
119447 , p_side => 'NA'
119448 );
119449
119451 p_code_combination_id => l_ccid
119452 , p_value_type_code => l_adr_value_type_code
119453 , p_transaction_coa_id => l_adr_transaction_coa_id
119454 , p_accounting_coa_id => l_adr_accounting_coa_id
119455 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
119456 , p_adr_type_code => 'S'
119457 , p_component_type => l_component_type
119458 , p_component_code => l_component_code
119459 , p_component_type_code => l_component_type_code
119460 , p_component_appl_id => l_component_appl_id
119461 , p_amb_context_code => l_amb_context_code
119462 , p_side => 'NA'
119463 );
119464
119465
119466 l_segment := AcctDerRule_144(
119467 p_application_id => p_application_id
119468 , p_ae_header_id => l_ae_header_id
119469 , p_source_4 => p_source_4
119470 , p_source_5 => p_source_5
119471 , x_transaction_coa_id => l_adr_transaction_coa_id
119472 , x_accounting_coa_id => l_adr_accounting_coa_id
119473 , x_flexfield_segment_code => l_adr_flexfield_segment_code
119474 , x_flex_value_set_id => l_adr_flex_value_set_id
119475 , x_value_type_code => l_adr_value_type_code
119476 , x_value_combination_id => l_adr_value_combination_id
119477 , x_value_segment_code => l_adr_value_segment_code
119478 , p_side => 'NA'
119479 , p_override_seg_flag => 'Y'
119480 );
119481
119482 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
119483
119484 xla_ae_lines_pkg.set_segment(
119485 p_to_segment_code => 'GL_ACCOUNT'
119486 , p_segment_value => l_segment
119487 , p_from_segment_code => l_adr_value_segment_code
119488 , p_from_combination_id => l_adr_value_combination_id
119489 , p_value_type_code => l_adr_value_type_code
119490 , p_transaction_coa_id => l_adr_transaction_coa_id
119491 , p_accounting_coa_id => l_adr_accounting_coa_id
119492 , p_flexfield_segment_code => l_adr_flexfield_segment_code
119493 , p_flex_value_set_id => l_adr_flex_value_set_id
119494 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
119495 , p_adr_type_code => 'S'
119496 , p_component_type => l_component_type
119497 , p_component_code => l_component_code
119498 , p_component_type_code => l_component_type_code
119499 , p_component_appl_id => l_component_appl_id
119500 , p_amb_context_code => l_amb_context_code
119501 , p_entity_code => 'TRANSACTIONS'
119502 , p_event_class_code => 'REVALUATION'
119503 , p_side => 'NA'
119504 );
119505
119506 END IF;
119507
119508 --
119509 --
119510 END IF;
119511 --
119512 -- Bug 4922099
119513 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
119514 (NVL(l_enc_upg_option, 'N') = 'O')
119515 ) AND
119516 (l_bflow_method_code = 'PRIOR_ENTRY')
119517 )
119518 THEN
119519 IF
119520 --
119521 1 = 2
119522 --
119523 THEN
119524 xla_accounting_err_pkg.build_message
119525 (p_appli_s_name => 'XLA'
119526 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
119527 ,p_token_1 => 'LINE_NUMBER'
119528 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
119529 ,p_token_2 => 'LINE_TYPE_NAME'
119530 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
119531 l_component_type
119532 ,l_component_code
119533 ,l_component_type_code
119534 ,l_component_appl_id
119535 ,l_amb_context_code
119536 ,l_entity_code
119537 ,l_event_class_code
119538 )
119539 ,p_token_3 => 'OWNER'
119540 ,p_value_3 => xla_lookups_pkg.get_meaning(
119541 p_lookup_type => 'XLA_OWNER_TYPE'
119542 ,p_lookup_code => l_component_type_code
119543 )
119544 ,p_token_4 => 'PRODUCT_NAME'
119545 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
119546 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
119550 );
119547 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
119548 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
119549 ,p_ae_header_id => NULL
119551
119552 IF (C_LEVEL_ERROR>= g_log_level) THEN
119553 trace
119554 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
119555 ,p_level => C_LEVEL_ERROR
119556 ,p_module => l_log_module);
119557 END IF;
119558 END IF;
119559 END IF;
119560 --
119561 --
119562 ------------------------------------------------------------------------------------------------
119563 -- 4219869 Business Flow
119564 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
119565 -- Prior Entry. Currently, the following code is always generated.
119566 ------------------------------------------------------------------------------------------------
119567 XLA_AE_LINES_PKG.ValidateCurrentLine;
119568
119569 ------------------------------------------------------------------------------------
119570 -- 4219869 Business Flow
119571 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
119572 ------------------------------------------------------------------------------------
119573 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
119574
119575 ----------------------------------------------------------------------------------
119576 -- 4219869 Business Flow
119577 -- Update journal entry status -- Need to generate this within IF <condition>
119578 ----------------------------------------------------------------------------------
119579 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
119580 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
119581 ,p_balance_type_code => l_balance_type_code
119582 );
119583
119584 -------------------------------------------------------------------------------------------
119585 -- 4262811 - Generate the Accrual Reversal lines
119586 -------------------------------------------------------------------------------------------
119587 BEGIN
119588 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
119589 (g_array_event(p_event_id).array_value_num('header_index'));
119590 IF l_acc_rev_flag IS NULL THEN
119591 l_acc_rev_flag := 'N';
119592 END IF;
119593 EXCEPTION
119594 WHEN OTHERS THEN
119595 l_acc_rev_flag := 'N';
119596 END;
119597 --
119598 IF (l_acc_rev_flag = 'Y') THEN
119599
119600 -- 4645092 ------------------------------------------------------------------------------
119601 -- To allow MPA report to determine if it should generate report process
119602 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
119603 ------------------------------------------------------------------------------------------
119604
119605 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
119606 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
119607 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
119608 -- call ADRs
119609 -- Bug 4922099
119610 --
119611 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
119612 (NVL(l_actual_upg_option, 'N') = 'O') OR
119613 (NVL(l_enc_upg_option, 'N') = 'O')
119614 )
119615 THEN
119616 NULL;
119617 --
119618 --
119619
119620 l_ccid := AcctDerRule_176(
119621 p_application_id => p_application_id
119622 , p_ae_header_id => l_ae_header_id
119623 , p_source_5 => p_source_5
119624 , p_source_31 => p_source_31
119625 , x_transaction_coa_id => l_adr_transaction_coa_id
119626 , x_accounting_coa_id => l_adr_accounting_coa_id
119627 , x_value_type_code => l_adr_value_type_code
119628 , p_side => 'NA'
119629 );
119630
119631 xla_ae_lines_pkg.set_ccid(
119632 p_code_combination_id => l_ccid
119633 , p_value_type_code => l_adr_value_type_code
119634 , p_transaction_coa_id => l_adr_transaction_coa_id
119635 , p_accounting_coa_id => l_adr_accounting_coa_id
119636 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
119637 , p_adr_type_code => 'S'
119638 , p_component_type => l_component_type
119639 , p_component_code => l_component_code
119640 , p_component_type_code => l_component_type_code
119641 , p_component_appl_id => l_component_appl_id
119642 , p_amb_context_code => l_amb_context_code
119643 , p_side => 'NA'
119644 );
119645
119646
119647 l_segment := AcctDerRule_144(
119648 p_application_id => p_application_id
119649 , p_ae_header_id => l_ae_header_id
119650 , p_source_4 => p_source_4
119651 , p_source_5 => p_source_5
119652 , x_transaction_coa_id => l_adr_transaction_coa_id
119653 , x_accounting_coa_id => l_adr_accounting_coa_id
119654 , x_flexfield_segment_code => l_adr_flexfield_segment_code
119655 , x_flex_value_set_id => l_adr_flex_value_set_id
119656 , x_value_type_code => l_adr_value_type_code
119660 , p_override_seg_flag => 'Y'
119657 , x_value_combination_id => l_adr_value_combination_id
119658 , x_value_segment_code => l_adr_value_segment_code
119659 , p_side => 'NA'
119661 );
119662
119663 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
119664
119665 xla_ae_lines_pkg.set_segment(
119666 p_to_segment_code => 'GL_ACCOUNT'
119667 , p_segment_value => l_segment
119668 , p_from_segment_code => l_adr_value_segment_code
119669 , p_from_combination_id => l_adr_value_combination_id
119670 , p_value_type_code => l_adr_value_type_code
119671 , p_transaction_coa_id => l_adr_transaction_coa_id
119672 , p_accounting_coa_id => l_adr_accounting_coa_id
119673 , p_flexfield_segment_code => l_adr_flexfield_segment_code
119674 , p_flex_value_set_id => l_adr_flex_value_set_id
119675 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
119676 , p_adr_type_code => 'S'
119677 , p_component_type => l_component_type
119678 , p_component_code => l_component_code
119679 , p_component_type_code => l_component_type_code
119680 , p_component_appl_id => l_component_appl_id
119681 , p_amb_context_code => l_amb_context_code
119682 , p_entity_code => 'TRANSACTIONS'
119683 , p_event_class_code => 'REVALUATION'
119684 , p_side => 'NA'
119685 );
119686
119687 END IF;
119688
119689 --
119690 --
119691 END IF;
119692
119693 --
119694 -- Update the line information that should be overwritten
119695 --
119696 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
119697 p_header_num => 1);
119698 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
119699
119700 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
119701
119702 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
119703 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
119704 END IF;
119705
119706 --
119707 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
119708 --
119709 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
119710 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
119711 ELSE
119712 ---------------------------------------------------------------------------------------------------
119713 -- 4262811a Switch Sign
119714 ---------------------------------------------------------------------------------------------------
119715 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
119716 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
119717 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
119718 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
119719 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
119720 -- 5132302
119721 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
119722 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
119723
119724 END IF;
119725
119726 -- 4955764
119727 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
119728 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
119729
119730
119731 XLA_AE_LINES_PKG.ValidateCurrentLine;
119732 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
119733
119734 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
119735 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
119736 ,p_balance_type_code => l_balance_type_code);
119737
119738 END IF;
119739
119740 -----------------------------------------------------------------------------------------
119741 -- 4262811 Multiperiod Accounting
119742 -----------------------------------------------------------------------------------------
119743 -- No MPA option is assigned.
119744
119745
119746 END IF;
119747 END IF;
119748 --
119749
119750 --
119751 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
119752 trace
119753 (p_msg => 'END of AcctLineType_331'
119754 ,p_level => C_LEVEL_PROCEDURE
119755 ,p_module => l_log_module);
119756 END IF;
119757 --
119758 EXCEPTION
119759 WHEN xla_exceptions_pkg.application_exception THEN
119760 RAISE;
119761 WHEN OTHERS THEN
119762 xla_exceptions_pkg.raise_message
119763 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_331');
119764 END AcctLineType_331;
119765 --
119766
119767 ---------------------------------------
119768 --
119769 -- PRIVATE FUNCTION
119770 -- AcctLineType_332
119771 --
119775 ,p_event_id IN NUMBER
119772 ---------------------------------------
119773 PROCEDURE AcctLineType_332 (
119774 p_application_id IN NUMBER
119776 ,p_calculate_acctd_flag IN VARCHAR2
119777 ,p_calculate_g_l_flag IN VARCHAR2
119778 ,p_actual_flag IN OUT VARCHAR2
119779 ,p_balance_type_code OUT VARCHAR2
119780 ,p_gain_or_loss_ref OUT VARCHAR2
119781
119782 --Period Close Date
119783 , p_source_1 IN DATE
119784 --Generated Code Combination Identifier
119785 , p_source_5 IN NUMBER
119786 --Asset Cost Account
119787 , p_source_11 IN VARCHAR2
119788 --Expense Account Code Combination Identifier
119789 , p_source_31 IN NUMBER
119790 --Default Code Combination Identifier
119791 , p_source_32 IN NUMBER
119792 --Adjustment Type
119793 , p_source_48 IN VARCHAR2
119794 --Transaction Header Identifier
119795 , p_source_49 IN NUMBER
119796 --Adjustment Line Identifier
119797 , p_source_50 IN NUMBER
119798 --Distribution Type Code
119799 , p_source_51 IN VARCHAR2
119800 --Entered Amount
119801 , p_source_52 IN NUMBER
119802 --Currency Code
119803 , p_source_53 IN VARCHAR2
119804 )
119805 IS
119806
119807 l_component_type VARCHAR2(80);
119808 l_component_code VARCHAR2(30);
119809 l_component_type_code VARCHAR2(1);
119810 l_component_appl_id INTEGER;
119811 l_amb_context_code VARCHAR2(30);
119812 l_entity_code VARCHAR2(30);
119813 l_event_class_code VARCHAR2(30);
119814 l_ae_header_id NUMBER;
119815 l_event_type_code VARCHAR2(30);
119816 l_line_definition_code VARCHAR2(30);
119817 l_line_definition_owner_code VARCHAR2(1);
119818 --
119819 -- adr variables
119820 l_segment VARCHAR2(30);
119821 l_ccid NUMBER;
119822 l_adr_transaction_coa_id NUMBER;
119823 l_adr_accounting_coa_id NUMBER;
119824 l_adr_flexfield_segment_code VARCHAR2(30);
119825 l_adr_flex_value_set_id NUMBER;
119826 l_adr_value_type_code VARCHAR2(30);
119827 l_adr_value_combination_id NUMBER;
119828 l_adr_value_segment_code VARCHAR2(30);
119829
119830 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
119831 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
119832 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
119833 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
119834
119835 -- 4262811 Variables ------------------------------------------------------------------------------------------
119836 l_entered_amt_idx NUMBER;
119837 l_accted_amt_idx NUMBER;
119838 l_acc_rev_flag VARCHAR2(1);
119839 l_accrual_line_num NUMBER;
119840 l_tmp_amt NUMBER;
119841 l_acc_rev_natural_side_code VARCHAR2(1);
119842
119843 l_num_entries NUMBER;
119844 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
119845 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
119846 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
119847 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
119848 l_recog_line_1 NUMBER;
119849 l_recog_line_2 NUMBER;
119850
119851 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
119852 l_bflow_applied_to_amt NUMBER; -- 5132302
119853 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
119854
119855 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
119856
119857 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
119858 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
119859
119860 ---------------------------------------------------------------------------------------------------------------
119861
119862
119863 --
119864 -- bulk performance
119865 --
119866 l_balance_type_code VARCHAR2(1);
119867 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
119868 l_log_module VARCHAR2(240);
119869
119870 --
119871 -- Upgrade strategy
119872 --
119873 l_actual_upg_option VARCHAR2(1);
119874 l_enc_upg_option VARCHAR2(1);
119875
119876 --
119877 BEGIN
119878 --
119879 IF g_log_enabled THEN
119880 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_332';
119881 END IF;
119882 --
119883 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
119884
119885 trace
119886 (p_msg => 'BEGIN of AcctLineType_332'
119887 ,p_level => C_LEVEL_PROCEDURE
119888 ,p_module => l_log_module);
119889
119890 END IF;
119891 --
119892 l_component_type := 'AMB_JLT';
119893 l_component_code := 'FA_REVAL_COST';
119894 l_component_type_code := 'S';
119895 l_component_appl_id := 140;
119896 l_amb_context_code := 'DEFAULT';
119897 l_entity_code := 'TRANSACTIONS';
119898 l_event_class_code := 'REVALUATION';
119899 l_event_type_code := 'REVALUATION_ALL';
119900 l_line_definition_owner_code := 'S';
119901 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVAL21';
119902 --
119903 l_balance_type_code := 'A';
119904 l_segment := NULL;
119908 l_adr_flexfield_segment_code := NULL;
119905 l_ccid := NULL;
119906 l_adr_transaction_coa_id := NULL;
119907 l_adr_accounting_coa_id := NULL;
119909 l_adr_flex_value_set_id := NULL;
119910 l_adr_value_type_code := NULL;
119911 l_adr_value_combination_id := NULL;
119912 l_adr_value_segment_code := NULL;
119913
119914 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
119915 l_bflow_class_code := ''; -- 4219869 Business Flow
119916 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
119917 l_budgetary_control_flag := 'N';
119918
119919 l_bflow_applied_to_amt_idx := NULL; -- 5132302
119920 l_bflow_applied_to_amt := NULL; -- 5132302
119921 l_entered_amt_idx := NULL; -- 4262811
119922 l_accted_amt_idx := NULL; -- 4262811
119923 l_acc_rev_flag := NULL; -- 4262811
119924 l_accrual_line_num := NULL; -- 4262811
119925 l_tmp_amt := NULL; -- 4262811
119926 --
119927
119928 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
119929 l_balance_type_code <> 'B' THEN
119930 IF NVL(p_source_48,'
119931 ') = 'COST'
119932 THEN
119933
119934 --
119935 XLA_AE_LINES_PKG.SetNewLine;
119936
119937 p_balance_type_code := l_balance_type_code;
119938 -- set the flag so later we will know whether the gain loss line needs to be created
119939
119940 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
119941 p_actual_flag :='A';
119942 END IF;
119943
119944 --
119945 -- bulk performance
119946 --
119947 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
119948 p_header_num => 0); -- 4262811
119949 --
119950 -- set accounting line options
119951 --
119952 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
119953 p_natural_side_code => 'D'
119954 , p_gain_or_loss_flag => 'N'
119955 , p_gl_transfer_mode_code => 'S'
119956 , p_acct_entry_type_code => 'A'
119957 , p_switch_side_flag => 'Y'
119958 , p_merge_duplicate_code => 'N'
119959 );
119960 --
119961 l_acc_rev_natural_side_code := 'C'; -- 4262811
119962 --
119963 --
119964 -- set accounting line type info
119965 --
119966 xla_ae_lines_pkg.SetAcctLineType
119967 (p_component_type => l_component_type
119968 ,p_event_type_code => l_event_type_code
119969 ,p_line_definition_owner_code => l_line_definition_owner_code
119970 ,p_line_definition_code => l_line_definition_code
119971 ,p_accounting_line_code => l_component_code
119972 ,p_accounting_line_type_code => l_component_type_code
119973 ,p_accounting_line_appl_id => l_component_appl_id
119974 ,p_amb_context_code => l_amb_context_code
119975 ,p_entity_code => l_entity_code
119976 ,p_event_class_code => l_event_class_code);
119977 --
119978 -- set accounting class
119979 --
119980 xla_ae_lines_pkg.SetAcctClass(
119981 p_accounting_class_code => 'ASSET'
119982 , p_ae_header_id => l_ae_header_id
119983 );
119984
119985 --
119986 -- set rounding class
119987 --
119988 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
119989 'ASSET';
119990
119991 --
119992 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
119993 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
119994 --
119995 -- bulk performance
119996 --
119997 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
119998
119999 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
120000 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
120001
120002 -- 4955764
120003 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
120004 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
120005
120006 -- 4458381 Public Sector Enh
120007
120008 --
120009 -- set accounting attributes for the line type
120010 --
120011 l_entered_amt_idx := 4;
120012 l_accted_amt_idx := 6;
120013 l_bflow_applied_to_amt_idx := NULL; -- 5132302
120014 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
120015 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
120016 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
120017 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
120018 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
120019 l_rec_acct_attrs.array_char_value(3) := p_source_51;
120020 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
120021 l_rec_acct_attrs.array_num_value(4) := p_source_52;
120022 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
120023 l_rec_acct_attrs.array_char_value(5) := p_source_53;
120024 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
120025 l_rec_acct_attrs.array_num_value(6) := p_source_52;
120026
120027 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
120031 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
120028 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
120029
120030 ---------------------------------------------------------------------------------------------------------------
120032 ---------------------------------------------------------------------------------------------------------------
120033 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
120034
120035 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
120036 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
120037
120038 IF xla_accounting_cache_pkg.GetValueChar
120039 (p_source_code => 'LEDGER_CATEGORY_CODE'
120040 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
120041 AND l_bflow_method_code = 'PRIOR_ENTRY'
120042 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
120043 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
120044 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
120045 )
120046 THEN
120047 xla_ae_lines_pkg.BflowUpgEntry
120048 (p_business_method_code => l_bflow_method_code
120049 ,p_business_class_code => l_bflow_class_code
120050 ,p_balance_type => l_balance_type_code);
120051 ELSE
120052 NULL;
120053 -- No business flow processing for business flow method of NONE.
120054 END IF;
120055
120056 --
120057 -- call analytical criteria
120058 --
120059
120060 --
120061 -- call description
120062 --
120063
120064 xla_ae_lines_pkg.SetLineDescription(
120065 p_ae_header_id => l_ae_header_id
120066 ,p_description => Description_93 (
120067 p_application_id => p_application_id
120068 , p_ae_header_id => l_ae_header_id
120069 , p_source_1 => p_source_1
120070 )
120071 );
120072
120073
120074 --
120075 -- call ADRs
120076 -- Bug 4922099
120077 --
120078 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
120079 (NVL(l_actual_upg_option, 'N') = 'O') OR
120080 (NVL(l_enc_upg_option, 'N') = 'O')
120081 )
120082 THEN
120083 NULL;
120084 --
120085 --
120086
120087 l_ccid := AcctDerRule_174(
120088 p_application_id => p_application_id
120089 , p_ae_header_id => l_ae_header_id
120090 , p_source_5 => p_source_5
120091 , p_source_32 => p_source_32
120092 , x_transaction_coa_id => l_adr_transaction_coa_id
120093 , x_accounting_coa_id => l_adr_accounting_coa_id
120094 , x_value_type_code => l_adr_value_type_code
120095 , p_side => 'NA'
120096 );
120097
120098 xla_ae_lines_pkg.set_ccid(
120099 p_code_combination_id => l_ccid
120100 , p_value_type_code => l_adr_value_type_code
120101 , p_transaction_coa_id => l_adr_transaction_coa_id
120102 , p_accounting_coa_id => l_adr_accounting_coa_id
120103 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
120104 , p_adr_type_code => 'S'
120105 , p_component_type => l_component_type
120106 , p_component_code => l_component_code
120107 , p_component_type_code => l_component_type_code
120108 , p_component_appl_id => l_component_appl_id
120109 , p_amb_context_code => l_amb_context_code
120110 , p_side => 'NA'
120111 );
120112
120113
120114 l_segment := AcctDerRule_149(
120115 p_application_id => p_application_id
120116 , p_ae_header_id => l_ae_header_id
120117 , p_source_5 => p_source_5
120118 , p_source_11 => p_source_11
120119 , x_transaction_coa_id => l_adr_transaction_coa_id
120120 , x_accounting_coa_id => l_adr_accounting_coa_id
120121 , x_flexfield_segment_code => l_adr_flexfield_segment_code
120122 , x_flex_value_set_id => l_adr_flex_value_set_id
120123 , x_value_type_code => l_adr_value_type_code
120124 , x_value_combination_id => l_adr_value_combination_id
120125 , x_value_segment_code => l_adr_value_segment_code
120126 , p_side => 'NA'
120127 , p_override_seg_flag => 'Y'
120128 );
120129
120130 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
120131
120132 xla_ae_lines_pkg.set_segment(
120133 p_to_segment_code => 'GL_ACCOUNT'
120134 , p_segment_value => l_segment
120135 , p_from_segment_code => l_adr_value_segment_code
120136 , p_from_combination_id => l_adr_value_combination_id
120137 , p_value_type_code => l_adr_value_type_code
120138 , p_transaction_coa_id => l_adr_transaction_coa_id
120139 , p_accounting_coa_id => l_adr_accounting_coa_id
120140 , p_flexfield_segment_code => l_adr_flexfield_segment_code
120141 , p_flex_value_set_id => l_adr_flex_value_set_id
120142 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
120143 , p_adr_type_code => 'S'
120144 , p_component_type => l_component_type
120148 , p_amb_context_code => l_amb_context_code
120145 , p_component_code => l_component_code
120146 , p_component_type_code => l_component_type_code
120147 , p_component_appl_id => l_component_appl_id
120149 , p_entity_code => 'TRANSACTIONS'
120150 , p_event_class_code => 'REVALUATION'
120151 , p_side => 'NA'
120152 );
120153
120154 END IF;
120155
120156 l_segment := AcctDerRule_169(
120157 p_application_id => p_application_id
120158 , p_ae_header_id => l_ae_header_id
120159 , p_source_5 => p_source_5
120160 , p_source_31 => p_source_31
120161 , x_transaction_coa_id => l_adr_transaction_coa_id
120162 , x_accounting_coa_id => l_adr_accounting_coa_id
120163 , x_flexfield_segment_code => l_adr_flexfield_segment_code
120164 , x_flex_value_set_id => l_adr_flex_value_set_id
120165 , x_value_type_code => l_adr_value_type_code
120166 , x_value_combination_id => l_adr_value_combination_id
120167 , x_value_segment_code => l_adr_value_segment_code
120168 , p_side => 'NA'
120169 , p_override_seg_flag => 'Y'
120170 );
120171
120172 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
120173
120174 xla_ae_lines_pkg.set_segment(
120175 p_to_segment_code => 'GL_BALANCING'
120176 , p_segment_value => l_segment
120177 , p_from_segment_code => l_adr_value_segment_code
120178 , p_from_combination_id => l_adr_value_combination_id
120179 , p_value_type_code => l_adr_value_type_code
120180 , p_transaction_coa_id => l_adr_transaction_coa_id
120181 , p_accounting_coa_id => l_adr_accounting_coa_id
120182 , p_flexfield_segment_code => l_adr_flexfield_segment_code
120183 , p_flex_value_set_id => l_adr_flex_value_set_id
120184 , p_adr_code => 'FA_EXPENSE_ACCT'
120185 , p_adr_type_code => 'S'
120186 , p_component_type => l_component_type
120187 , p_component_code => l_component_code
120188 , p_component_type_code => l_component_type_code
120189 , p_component_appl_id => l_component_appl_id
120190 , p_amb_context_code => l_amb_context_code
120191 , p_entity_code => 'TRANSACTIONS'
120192 , p_event_class_code => 'REVALUATION'
120193 , p_side => 'NA'
120194 );
120195
120196 END IF;
120197
120198 --
120199 --
120200 END IF;
120201 --
120202 -- Bug 4922099
120203 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
120204 (NVL(l_enc_upg_option, 'N') = 'O')
120205 ) AND
120206 (l_bflow_method_code = 'PRIOR_ENTRY')
120207 )
120208 THEN
120209 IF
120210 --
120211 1 = 2
120212 --
120213 THEN
120214 xla_accounting_err_pkg.build_message
120215 (p_appli_s_name => 'XLA'
120216 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
120217 ,p_token_1 => 'LINE_NUMBER'
120218 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
120219 ,p_token_2 => 'LINE_TYPE_NAME'
120220 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
120221 l_component_type
120222 ,l_component_code
120223 ,l_component_type_code
120224 ,l_component_appl_id
120225 ,l_amb_context_code
120226 ,l_entity_code
120227 ,l_event_class_code
120228 )
120229 ,p_token_3 => 'OWNER'
120230 ,p_value_3 => xla_lookups_pkg.get_meaning(
120231 p_lookup_type => 'XLA_OWNER_TYPE'
120232 ,p_lookup_code => l_component_type_code
120233 )
120234 ,p_token_4 => 'PRODUCT_NAME'
120235 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
120236 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
120237 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
120238 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
120239 ,p_ae_header_id => NULL
120240 );
120241
120242 IF (C_LEVEL_ERROR>= g_log_level) THEN
120246 ,p_module => l_log_module);
120243 trace
120244 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
120245 ,p_level => C_LEVEL_ERROR
120247 END IF;
120248 END IF;
120249 END IF;
120250 --
120251 --
120252 ------------------------------------------------------------------------------------------------
120253 -- 4219869 Business Flow
120254 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
120255 -- Prior Entry. Currently, the following code is always generated.
120256 ------------------------------------------------------------------------------------------------
120257 XLA_AE_LINES_PKG.ValidateCurrentLine;
120258
120259 ------------------------------------------------------------------------------------
120260 -- 4219869 Business Flow
120261 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
120262 ------------------------------------------------------------------------------------
120263 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
120264
120265 ----------------------------------------------------------------------------------
120266 -- 4219869 Business Flow
120267 -- Update journal entry status -- Need to generate this within IF <condition>
120268 ----------------------------------------------------------------------------------
120269 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
120270 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
120271 ,p_balance_type_code => l_balance_type_code
120272 );
120273
120274 -------------------------------------------------------------------------------------------
120275 -- 4262811 - Generate the Accrual Reversal lines
120276 -------------------------------------------------------------------------------------------
120277 BEGIN
120278 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
120279 (g_array_event(p_event_id).array_value_num('header_index'));
120280 IF l_acc_rev_flag IS NULL THEN
120281 l_acc_rev_flag := 'N';
120282 END IF;
120283 EXCEPTION
120284 WHEN OTHERS THEN
120285 l_acc_rev_flag := 'N';
120286 END;
120287 --
120288 IF (l_acc_rev_flag = 'Y') THEN
120289
120290 -- 4645092 ------------------------------------------------------------------------------
120291 -- To allow MPA report to determine if it should generate report process
120292 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
120293 ------------------------------------------------------------------------------------------
120294
120295 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
120296 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
120297 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
120298 -- call ADRs
120299 -- Bug 4922099
120300 --
120301 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
120302 (NVL(l_actual_upg_option, 'N') = 'O') OR
120303 (NVL(l_enc_upg_option, 'N') = 'O')
120304 )
120305 THEN
120306 NULL;
120307 --
120308 --
120309
120310 l_ccid := AcctDerRule_174(
120311 p_application_id => p_application_id
120312 , p_ae_header_id => l_ae_header_id
120313 , p_source_5 => p_source_5
120314 , p_source_32 => p_source_32
120315 , x_transaction_coa_id => l_adr_transaction_coa_id
120316 , x_accounting_coa_id => l_adr_accounting_coa_id
120317 , x_value_type_code => l_adr_value_type_code
120318 , p_side => 'NA'
120319 );
120320
120321 xla_ae_lines_pkg.set_ccid(
120322 p_code_combination_id => l_ccid
120323 , p_value_type_code => l_adr_value_type_code
120324 , p_transaction_coa_id => l_adr_transaction_coa_id
120325 , p_accounting_coa_id => l_adr_accounting_coa_id
120326 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
120327 , p_adr_type_code => 'S'
120328 , p_component_type => l_component_type
120329 , p_component_code => l_component_code
120330 , p_component_type_code => l_component_type_code
120331 , p_component_appl_id => l_component_appl_id
120332 , p_amb_context_code => l_amb_context_code
120333 , p_side => 'NA'
120334 );
120335
120336
120337 l_segment := AcctDerRule_149(
120338 p_application_id => p_application_id
120339 , p_ae_header_id => l_ae_header_id
120340 , p_source_5 => p_source_5
120341 , p_source_11 => p_source_11
120342 , x_transaction_coa_id => l_adr_transaction_coa_id
120343 , x_accounting_coa_id => l_adr_accounting_coa_id
120344 , x_flexfield_segment_code => l_adr_flexfield_segment_code
120345 , x_flex_value_set_id => l_adr_flex_value_set_id
120346 , x_value_type_code => l_adr_value_type_code
120347 , x_value_combination_id => l_adr_value_combination_id
120348 , x_value_segment_code => l_adr_value_segment_code
120349 , p_side => 'NA'
120350 , p_override_seg_flag => 'Y'
120351 );
120352
120353 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
120354
120358 , p_from_segment_code => l_adr_value_segment_code
120355 xla_ae_lines_pkg.set_segment(
120356 p_to_segment_code => 'GL_ACCOUNT'
120357 , p_segment_value => l_segment
120359 , p_from_combination_id => l_adr_value_combination_id
120360 , p_value_type_code => l_adr_value_type_code
120361 , p_transaction_coa_id => l_adr_transaction_coa_id
120362 , p_accounting_coa_id => l_adr_accounting_coa_id
120363 , p_flexfield_segment_code => l_adr_flexfield_segment_code
120364 , p_flex_value_set_id => l_adr_flex_value_set_id
120365 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
120366 , p_adr_type_code => 'S'
120367 , p_component_type => l_component_type
120368 , p_component_code => l_component_code
120369 , p_component_type_code => l_component_type_code
120370 , p_component_appl_id => l_component_appl_id
120371 , p_amb_context_code => l_amb_context_code
120372 , p_entity_code => 'TRANSACTIONS'
120373 , p_event_class_code => 'REVALUATION'
120374 , p_side => 'NA'
120375 );
120376
120377 END IF;
120378
120379 l_segment := AcctDerRule_169(
120380 p_application_id => p_application_id
120381 , p_ae_header_id => l_ae_header_id
120382 , p_source_5 => p_source_5
120383 , p_source_31 => p_source_31
120384 , x_transaction_coa_id => l_adr_transaction_coa_id
120385 , x_accounting_coa_id => l_adr_accounting_coa_id
120386 , x_flexfield_segment_code => l_adr_flexfield_segment_code
120387 , x_flex_value_set_id => l_adr_flex_value_set_id
120388 , x_value_type_code => l_adr_value_type_code
120389 , x_value_combination_id => l_adr_value_combination_id
120390 , x_value_segment_code => l_adr_value_segment_code
120391 , p_side => 'NA'
120392 , p_override_seg_flag => 'Y'
120393 );
120394
120395 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
120396
120397 xla_ae_lines_pkg.set_segment(
120398 p_to_segment_code => 'GL_BALANCING'
120399 , p_segment_value => l_segment
120400 , p_from_segment_code => l_adr_value_segment_code
120401 , p_from_combination_id => l_adr_value_combination_id
120402 , p_value_type_code => l_adr_value_type_code
120403 , p_transaction_coa_id => l_adr_transaction_coa_id
120404 , p_accounting_coa_id => l_adr_accounting_coa_id
120405 , p_flexfield_segment_code => l_adr_flexfield_segment_code
120406 , p_flex_value_set_id => l_adr_flex_value_set_id
120407 , p_adr_code => 'FA_EXPENSE_ACCT'
120408 , p_adr_type_code => 'S'
120409 , p_component_type => l_component_type
120410 , p_component_code => l_component_code
120411 , p_component_type_code => l_component_type_code
120412 , p_component_appl_id => l_component_appl_id
120413 , p_amb_context_code => l_amb_context_code
120414 , p_entity_code => 'TRANSACTIONS'
120415 , p_event_class_code => 'REVALUATION'
120416 , p_side => 'NA'
120417 );
120418
120419 END IF;
120420
120421 --
120422 --
120423 END IF;
120424
120425 --
120426 -- Update the line information that should be overwritten
120427 --
120428 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
120429 p_header_num => 1);
120430 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
120431
120432 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
120433
120434 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
120435 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
120436 END IF;
120437
120438 --
120439 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
120440 --
120441 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
120442 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
120443 ELSE
120444 ---------------------------------------------------------------------------------------------------
120445 -- 4262811a Switch Sign
120446 ---------------------------------------------------------------------------------------------------
120447 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
120448 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
120449 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
120450 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
120451 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
120452 -- 5132302
120453 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
120454 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
120455
120456 END IF;
120457
120458 -- 4955764
120462
120459 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
120460 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
120461
120463 XLA_AE_LINES_PKG.ValidateCurrentLine;
120464 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
120465
120466 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
120467 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
120468 ,p_balance_type_code => l_balance_type_code);
120469
120470 END IF;
120471
120472 -----------------------------------------------------------------------------------------
120473 -- 4262811 Multiperiod Accounting
120474 -----------------------------------------------------------------------------------------
120475 -- No MPA option is assigned.
120476
120477
120478 END IF;
120479 END IF;
120480 --
120481
120482 --
120483 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
120484 trace
120485 (p_msg => 'END of AcctLineType_332'
120486 ,p_level => C_LEVEL_PROCEDURE
120487 ,p_module => l_log_module);
120488 END IF;
120489 --
120490 EXCEPTION
120491 WHEN xla_exceptions_pkg.application_exception THEN
120492 RAISE;
120493 WHEN OTHERS THEN
120494 xla_exceptions_pkg.raise_message
120495 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_332');
120496 END AcctLineType_332;
120497 --
120498
120499 ---------------------------------------
120500 --
120501 -- PRIVATE FUNCTION
120502 -- AcctLineType_333
120503 --
120504 ---------------------------------------
120505 PROCEDURE AcctLineType_333 (
120506 p_application_id IN NUMBER
120507 ,p_event_id IN NUMBER
120508 ,p_calculate_acctd_flag IN VARCHAR2
120509 ,p_calculate_g_l_flag IN VARCHAR2
120510 ,p_actual_flag IN OUT VARCHAR2
120511 ,p_balance_type_code OUT VARCHAR2
120512 ,p_gain_or_loss_ref OUT VARCHAR2
120513
120514 --Period Close Date
120515 , p_source_1 IN DATE
120516 --Generated Code Combination Identifier
120517 , p_source_5 IN NUMBER
120518 --Depreciation Reserve Account
120519 , p_source_12 IN VARCHAR2
120520 --Generated Offset Code Combination Identifier
120521 , p_source_19 IN NUMBER
120522 --Expense Account Code Combination Identifier
120523 , p_source_31 IN NUMBER
120524 --Default Code Combination Identifier
120525 , p_source_32 IN NUMBER
120526 --Adjustment Type
120527 , p_source_48 IN VARCHAR2
120528 --Transaction Header Identifier
120529 , p_source_49 IN NUMBER
120530 --Adjustment Line Identifier
120531 , p_source_50 IN NUMBER
120532 --Distribution Type Code
120533 , p_source_51 IN VARCHAR2
120534 --Entered Amount
120535 , p_source_52 IN NUMBER
120536 --Currency Code
120537 , p_source_53 IN VARCHAR2
120538 )
120539 IS
120540
120541 l_component_type VARCHAR2(80);
120542 l_component_code VARCHAR2(30);
120543 l_component_type_code VARCHAR2(1);
120544 l_component_appl_id INTEGER;
120545 l_amb_context_code VARCHAR2(30);
120546 l_entity_code VARCHAR2(30);
120547 l_event_class_code VARCHAR2(30);
120548 l_ae_header_id NUMBER;
120549 l_event_type_code VARCHAR2(30);
120550 l_line_definition_code VARCHAR2(30);
120551 l_line_definition_owner_code VARCHAR2(1);
120552 --
120553 -- adr variables
120554 l_segment VARCHAR2(30);
120555 l_ccid NUMBER;
120556 l_adr_transaction_coa_id NUMBER;
120557 l_adr_accounting_coa_id NUMBER;
120558 l_adr_flexfield_segment_code VARCHAR2(30);
120559 l_adr_flex_value_set_id NUMBER;
120560 l_adr_value_type_code VARCHAR2(30);
120561 l_adr_value_combination_id NUMBER;
120562 l_adr_value_segment_code VARCHAR2(30);
120563
120564 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
120565 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
120566 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
120567 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
120568
120569 -- 4262811 Variables ------------------------------------------------------------------------------------------
120570 l_entered_amt_idx NUMBER;
120571 l_accted_amt_idx NUMBER;
120572 l_acc_rev_flag VARCHAR2(1);
120573 l_accrual_line_num NUMBER;
120574 l_tmp_amt NUMBER;
120575 l_acc_rev_natural_side_code VARCHAR2(1);
120576
120577 l_num_entries NUMBER;
120578 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
120579 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
120580 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
120581 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
120582 l_recog_line_1 NUMBER;
120583 l_recog_line_2 NUMBER;
120584
120585 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
120586 l_bflow_applied_to_amt NUMBER; -- 5132302
120587 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
120588
120589 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
120590
120594 ---------------------------------------------------------------------------------------------------------------
120591 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
120592 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
120593
120595
120596
120597 --
120598 -- bulk performance
120599 --
120600 l_balance_type_code VARCHAR2(1);
120601 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
120602 l_log_module VARCHAR2(240);
120603
120604 --
120605 -- Upgrade strategy
120606 --
120607 l_actual_upg_option VARCHAR2(1);
120608 l_enc_upg_option VARCHAR2(1);
120609
120610 --
120611 BEGIN
120612 --
120613 IF g_log_enabled THEN
120614 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_333';
120615 END IF;
120616 --
120617 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
120618
120619 trace
120620 (p_msg => 'BEGIN of AcctLineType_333'
120621 ,p_level => C_LEVEL_PROCEDURE
120622 ,p_module => l_log_module);
120623
120624 END IF;
120625 --
120626 l_component_type := 'AMB_JLT';
120627 l_component_code := 'FA_REVAL_DEPRN_RESERVE';
120628 l_component_type_code := 'S';
120629 l_component_appl_id := 140;
120630 l_amb_context_code := 'DEFAULT';
120631 l_entity_code := 'TRANSACTIONS';
120632 l_event_class_code := 'REVALUATION';
120633 l_event_type_code := 'REVALUATION_ALL';
120634 l_line_definition_owner_code := 'S';
120635 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVAL21';
120636 --
120637 l_balance_type_code := 'A';
120638 l_segment := NULL;
120639 l_ccid := NULL;
120640 l_adr_transaction_coa_id := NULL;
120641 l_adr_accounting_coa_id := NULL;
120642 l_adr_flexfield_segment_code := NULL;
120643 l_adr_flex_value_set_id := NULL;
120644 l_adr_value_type_code := NULL;
120645 l_adr_value_combination_id := NULL;
120646 l_adr_value_segment_code := NULL;
120647
120648 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
120649 l_bflow_class_code := ''; -- 4219869 Business Flow
120650 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
120651 l_budgetary_control_flag := 'N';
120652
120653 l_bflow_applied_to_amt_idx := NULL; -- 5132302
120654 l_bflow_applied_to_amt := NULL; -- 5132302
120655 l_entered_amt_idx := NULL; -- 4262811
120656 l_accted_amt_idx := NULL; -- 4262811
120657 l_acc_rev_flag := NULL; -- 4262811
120658 l_accrual_line_num := NULL; -- 4262811
120659 l_tmp_amt := NULL; -- 4262811
120660 --
120661
120662 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
120663 l_balance_type_code <> 'B' THEN
120664 IF NVL(p_source_48,'
120665 ') = 'RESERVE'
120666 THEN
120667
120668 --
120669 XLA_AE_LINES_PKG.SetNewLine;
120670
120671 p_balance_type_code := l_balance_type_code;
120672 -- set the flag so later we will know whether the gain loss line needs to be created
120673
120674 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
120675 p_actual_flag :='A';
120676 END IF;
120677
120678 --
120679 -- bulk performance
120680 --
120681 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
120682 p_header_num => 0); -- 4262811
120683 --
120684 -- set accounting line options
120685 --
120686 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
120687 p_natural_side_code => 'C'
120688 , p_gain_or_loss_flag => 'N'
120689 , p_gl_transfer_mode_code => 'S'
120690 , p_acct_entry_type_code => 'A'
120691 , p_switch_side_flag => 'Y'
120692 , p_merge_duplicate_code => 'N'
120693 );
120694 --
120695 l_acc_rev_natural_side_code := 'D'; -- 4262811
120696 --
120697 --
120698 -- set accounting line type info
120699 --
120700 xla_ae_lines_pkg.SetAcctLineType
120701 (p_component_type => l_component_type
120702 ,p_event_type_code => l_event_type_code
120703 ,p_line_definition_owner_code => l_line_definition_owner_code
120704 ,p_line_definition_code => l_line_definition_code
120705 ,p_accounting_line_code => l_component_code
120706 ,p_accounting_line_type_code => l_component_type_code
120707 ,p_accounting_line_appl_id => l_component_appl_id
120708 ,p_amb_context_code => l_amb_context_code
120709 ,p_entity_code => l_entity_code
120710 ,p_event_class_code => l_event_class_code);
120711 --
120712 -- set accounting class
120713 --
120714 xla_ae_lines_pkg.SetAcctClass(
120715 p_accounting_class_code => 'ASSET'
120716 , p_ae_header_id => l_ae_header_id
120717 );
120718
120719 --
120720 -- set rounding class
120721 --
120722 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
120723 'ASSET';
120724
120725 --
120729 -- bulk performance
120726 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
120727 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
120728 --
120730 --
120731 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
120732
120733 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
120734 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
120735
120736 -- 4955764
120737 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
120738 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
120739
120740 -- 4458381 Public Sector Enh
120741
120742 --
120743 -- set accounting attributes for the line type
120744 --
120745 l_entered_amt_idx := 4;
120746 l_accted_amt_idx := 6;
120747 l_bflow_applied_to_amt_idx := NULL; -- 5132302
120748 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
120749 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
120750 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
120751 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
120752 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
120753 l_rec_acct_attrs.array_char_value(3) := p_source_51;
120754 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
120755 l_rec_acct_attrs.array_num_value(4) := p_source_52;
120756 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
120757 l_rec_acct_attrs.array_char_value(5) := p_source_53;
120758 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
120759 l_rec_acct_attrs.array_num_value(6) := p_source_52;
120760
120761 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
120762 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
120763
120764 ---------------------------------------------------------------------------------------------------------------
120765 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
120766 ---------------------------------------------------------------------------------------------------------------
120767 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
120768
120769 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
120770 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
120771
120772 IF xla_accounting_cache_pkg.GetValueChar
120773 (p_source_code => 'LEDGER_CATEGORY_CODE'
120774 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
120775 AND l_bflow_method_code = 'PRIOR_ENTRY'
120776 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
120777 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
120778 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
120779 )
120780 THEN
120781 xla_ae_lines_pkg.BflowUpgEntry
120782 (p_business_method_code => l_bflow_method_code
120783 ,p_business_class_code => l_bflow_class_code
120784 ,p_balance_type => l_balance_type_code);
120785 ELSE
120786 NULL;
120787 -- No business flow processing for business flow method of NONE.
120788 END IF;
120789
120790 --
120791 -- call analytical criteria
120792 --
120793
120794 --
120795 -- call description
120796 --
120797
120798 xla_ae_lines_pkg.SetLineDescription(
120799 p_ae_header_id => l_ae_header_id
120800 ,p_description => Description_94 (
120801 p_application_id => p_application_id
120802 , p_ae_header_id => l_ae_header_id
120803 , p_source_1 => p_source_1
120804 )
120805 );
120806
120807
120808 --
120809 -- call ADRs
120810 -- Bug 4922099
120811 --
120812 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
120813 (NVL(l_actual_upg_option, 'N') = 'O') OR
120814 (NVL(l_enc_upg_option, 'N') = 'O')
120815 )
120816 THEN
120817 NULL;
120818 --
120819 --
120820
120821 l_ccid := AcctDerRule_175(
120822 p_application_id => p_application_id
120823 , p_ae_header_id => l_ae_header_id
120824 , p_source_5 => p_source_5
120825 , p_source_19 => p_source_19
120826 , p_source_32 => p_source_32
120827 , x_transaction_coa_id => l_adr_transaction_coa_id
120828 , x_accounting_coa_id => l_adr_accounting_coa_id
120829 , x_value_type_code => l_adr_value_type_code
120830 , p_side => 'NA'
120831 );
120832
120833 xla_ae_lines_pkg.set_ccid(
120834 p_code_combination_id => l_ccid
120835 , p_value_type_code => l_adr_value_type_code
120836 , p_transaction_coa_id => l_adr_transaction_coa_id
120837 , p_accounting_coa_id => l_adr_accounting_coa_id
120838 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
120839 , p_adr_type_code => 'S'
120840 , p_component_type => l_component_type
120841 , p_component_code => l_component_code
120845 , p_side => 'NA'
120842 , p_component_type_code => l_component_type_code
120843 , p_component_appl_id => l_component_appl_id
120844 , p_amb_context_code => l_amb_context_code
120846 );
120847
120848
120849 l_segment := AcctDerRule_150(
120850 p_application_id => p_application_id
120851 , p_ae_header_id => l_ae_header_id
120852 , p_source_5 => p_source_5
120853 , p_source_12 => p_source_12
120854 , x_transaction_coa_id => l_adr_transaction_coa_id
120855 , x_accounting_coa_id => l_adr_accounting_coa_id
120856 , x_flexfield_segment_code => l_adr_flexfield_segment_code
120857 , x_flex_value_set_id => l_adr_flex_value_set_id
120858 , x_value_type_code => l_adr_value_type_code
120859 , x_value_combination_id => l_adr_value_combination_id
120860 , x_value_segment_code => l_adr_value_segment_code
120861 , p_side => 'NA'
120862 , p_override_seg_flag => 'Y'
120863 );
120864
120865 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
120866
120867 xla_ae_lines_pkg.set_segment(
120868 p_to_segment_code => 'GL_ACCOUNT'
120869 , p_segment_value => l_segment
120870 , p_from_segment_code => l_adr_value_segment_code
120871 , p_from_combination_id => l_adr_value_combination_id
120872 , p_value_type_code => l_adr_value_type_code
120873 , p_transaction_coa_id => l_adr_transaction_coa_id
120874 , p_accounting_coa_id => l_adr_accounting_coa_id
120875 , p_flexfield_segment_code => l_adr_flexfield_segment_code
120876 , p_flex_value_set_id => l_adr_flex_value_set_id
120877 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
120878 , p_adr_type_code => 'S'
120879 , p_component_type => l_component_type
120880 , p_component_code => l_component_code
120881 , p_component_type_code => l_component_type_code
120882 , p_component_appl_id => l_component_appl_id
120883 , p_amb_context_code => l_amb_context_code
120884 , p_entity_code => 'TRANSACTIONS'
120885 , p_event_class_code => 'REVALUATION'
120886 , p_side => 'NA'
120887 );
120888
120889 END IF;
120890
120891 l_segment := AcctDerRule_169(
120892 p_application_id => p_application_id
120893 , p_ae_header_id => l_ae_header_id
120894 , p_source_5 => p_source_5
120895 , p_source_31 => p_source_31
120896 , x_transaction_coa_id => l_adr_transaction_coa_id
120897 , x_accounting_coa_id => l_adr_accounting_coa_id
120898 , x_flexfield_segment_code => l_adr_flexfield_segment_code
120899 , x_flex_value_set_id => l_adr_flex_value_set_id
120900 , x_value_type_code => l_adr_value_type_code
120901 , x_value_combination_id => l_adr_value_combination_id
120902 , x_value_segment_code => l_adr_value_segment_code
120903 , p_side => 'NA'
120904 , p_override_seg_flag => 'Y'
120905 );
120906
120907 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
120908
120909 xla_ae_lines_pkg.set_segment(
120910 p_to_segment_code => 'GL_BALANCING'
120911 , p_segment_value => l_segment
120912 , p_from_segment_code => l_adr_value_segment_code
120913 , p_from_combination_id => l_adr_value_combination_id
120914 , p_value_type_code => l_adr_value_type_code
120915 , p_transaction_coa_id => l_adr_transaction_coa_id
120916 , p_accounting_coa_id => l_adr_accounting_coa_id
120917 , p_flexfield_segment_code => l_adr_flexfield_segment_code
120918 , p_flex_value_set_id => l_adr_flex_value_set_id
120919 , p_adr_code => 'FA_EXPENSE_ACCT'
120920 , p_adr_type_code => 'S'
120921 , p_component_type => l_component_type
120922 , p_component_code => l_component_code
120923 , p_component_type_code => l_component_type_code
120924 , p_component_appl_id => l_component_appl_id
120925 , p_amb_context_code => l_amb_context_code
120926 , p_entity_code => 'TRANSACTIONS'
120927 , p_event_class_code => 'REVALUATION'
120928 , p_side => 'NA'
120929 );
120930
120931 END IF;
120932
120933 --
120934 --
120935 END IF;
120936 --
120937 -- Bug 4922099
120938 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
120939 (NVL(l_enc_upg_option, 'N') = 'O')
120940 ) AND
120941 (l_bflow_method_code = 'PRIOR_ENTRY')
120942 )
120943 THEN
120944 IF
120945 --
120946 1 = 2
120947 --
120948 THEN
120949 xla_accounting_err_pkg.build_message
120950 (p_appli_s_name => 'XLA'
120951 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
120952 ,p_token_1 => 'LINE_NUMBER'
120953 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
120957 ,l_component_code
120954 ,p_token_2 => 'LINE_TYPE_NAME'
120955 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
120956 l_component_type
120958 ,l_component_type_code
120959 ,l_component_appl_id
120960 ,l_amb_context_code
120961 ,l_entity_code
120962 ,l_event_class_code
120963 )
120964 ,p_token_3 => 'OWNER'
120965 ,p_value_3 => xla_lookups_pkg.get_meaning(
120966 p_lookup_type => 'XLA_OWNER_TYPE'
120967 ,p_lookup_code => l_component_type_code
120968 )
120969 ,p_token_4 => 'PRODUCT_NAME'
120970 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
120971 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
120972 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
120973 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
120974 ,p_ae_header_id => NULL
120975 );
120976
120977 IF (C_LEVEL_ERROR>= g_log_level) THEN
120978 trace
120979 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
120980 ,p_level => C_LEVEL_ERROR
120981 ,p_module => l_log_module);
120982 END IF;
120983 END IF;
120984 END IF;
120985 --
120986 --
120987 ------------------------------------------------------------------------------------------------
120988 -- 4219869 Business Flow
120989 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
120990 -- Prior Entry. Currently, the following code is always generated.
120991 ------------------------------------------------------------------------------------------------
120992 XLA_AE_LINES_PKG.ValidateCurrentLine;
120993
120994 ------------------------------------------------------------------------------------
120995 -- 4219869 Business Flow
120996 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
120997 ------------------------------------------------------------------------------------
120998 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
120999
121000 ----------------------------------------------------------------------------------
121001 -- 4219869 Business Flow
121002 -- Update journal entry status -- Need to generate this within IF <condition>
121003 ----------------------------------------------------------------------------------
121004 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
121005 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
121006 ,p_balance_type_code => l_balance_type_code
121007 );
121008
121009 -------------------------------------------------------------------------------------------
121010 -- 4262811 - Generate the Accrual Reversal lines
121011 -------------------------------------------------------------------------------------------
121012 BEGIN
121013 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
121014 (g_array_event(p_event_id).array_value_num('header_index'));
121015 IF l_acc_rev_flag IS NULL THEN
121016 l_acc_rev_flag := 'N';
121017 END IF;
121018 EXCEPTION
121019 WHEN OTHERS THEN
121020 l_acc_rev_flag := 'N';
121021 END;
121022 --
121023 IF (l_acc_rev_flag = 'Y') THEN
121024
121025 -- 4645092 ------------------------------------------------------------------------------
121026 -- To allow MPA report to determine if it should generate report process
121027 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
121028 ------------------------------------------------------------------------------------------
121029
121030 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
121031 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
121032 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
121033 -- call ADRs
121034 -- Bug 4922099
121035 --
121036 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
121037 (NVL(l_actual_upg_option, 'N') = 'O') OR
121038 (NVL(l_enc_upg_option, 'N') = 'O')
121039 )
121040 THEN
121041 NULL;
121042 --
121043 --
121044
121045 l_ccid := AcctDerRule_175(
121046 p_application_id => p_application_id
121047 , p_ae_header_id => l_ae_header_id
121048 , p_source_5 => p_source_5
121049 , p_source_19 => p_source_19
121050 , p_source_32 => p_source_32
121054 , p_side => 'NA'
121051 , x_transaction_coa_id => l_adr_transaction_coa_id
121052 , x_accounting_coa_id => l_adr_accounting_coa_id
121053 , x_value_type_code => l_adr_value_type_code
121055 );
121056
121057 xla_ae_lines_pkg.set_ccid(
121058 p_code_combination_id => l_ccid
121059 , p_value_type_code => l_adr_value_type_code
121060 , p_transaction_coa_id => l_adr_transaction_coa_id
121061 , p_accounting_coa_id => l_adr_accounting_coa_id
121062 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
121063 , p_adr_type_code => 'S'
121064 , p_component_type => l_component_type
121065 , p_component_code => l_component_code
121066 , p_component_type_code => l_component_type_code
121067 , p_component_appl_id => l_component_appl_id
121068 , p_amb_context_code => l_amb_context_code
121069 , p_side => 'NA'
121070 );
121071
121072
121073 l_segment := AcctDerRule_150(
121074 p_application_id => p_application_id
121075 , p_ae_header_id => l_ae_header_id
121076 , p_source_5 => p_source_5
121077 , p_source_12 => p_source_12
121078 , x_transaction_coa_id => l_adr_transaction_coa_id
121079 , x_accounting_coa_id => l_adr_accounting_coa_id
121080 , x_flexfield_segment_code => l_adr_flexfield_segment_code
121081 , x_flex_value_set_id => l_adr_flex_value_set_id
121082 , x_value_type_code => l_adr_value_type_code
121083 , x_value_combination_id => l_adr_value_combination_id
121084 , x_value_segment_code => l_adr_value_segment_code
121085 , p_side => 'NA'
121086 , p_override_seg_flag => 'Y'
121087 );
121088
121089 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
121090
121091 xla_ae_lines_pkg.set_segment(
121092 p_to_segment_code => 'GL_ACCOUNT'
121093 , p_segment_value => l_segment
121094 , p_from_segment_code => l_adr_value_segment_code
121095 , p_from_combination_id => l_adr_value_combination_id
121096 , p_value_type_code => l_adr_value_type_code
121097 , p_transaction_coa_id => l_adr_transaction_coa_id
121098 , p_accounting_coa_id => l_adr_accounting_coa_id
121099 , p_flexfield_segment_code => l_adr_flexfield_segment_code
121100 , p_flex_value_set_id => l_adr_flex_value_set_id
121101 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
121102 , p_adr_type_code => 'S'
121103 , p_component_type => l_component_type
121104 , p_component_code => l_component_code
121105 , p_component_type_code => l_component_type_code
121106 , p_component_appl_id => l_component_appl_id
121107 , p_amb_context_code => l_amb_context_code
121108 , p_entity_code => 'TRANSACTIONS'
121109 , p_event_class_code => 'REVALUATION'
121110 , p_side => 'NA'
121111 );
121112
121113 END IF;
121114
121115 l_segment := AcctDerRule_169(
121116 p_application_id => p_application_id
121117 , p_ae_header_id => l_ae_header_id
121118 , p_source_5 => p_source_5
121119 , p_source_31 => p_source_31
121120 , x_transaction_coa_id => l_adr_transaction_coa_id
121121 , x_accounting_coa_id => l_adr_accounting_coa_id
121122 , x_flexfield_segment_code => l_adr_flexfield_segment_code
121123 , x_flex_value_set_id => l_adr_flex_value_set_id
121124 , x_value_type_code => l_adr_value_type_code
121125 , x_value_combination_id => l_adr_value_combination_id
121126 , x_value_segment_code => l_adr_value_segment_code
121127 , p_side => 'NA'
121128 , p_override_seg_flag => 'Y'
121129 );
121130
121131 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
121132
121133 xla_ae_lines_pkg.set_segment(
121134 p_to_segment_code => 'GL_BALANCING'
121135 , p_segment_value => l_segment
121136 , p_from_segment_code => l_adr_value_segment_code
121137 , p_from_combination_id => l_adr_value_combination_id
121138 , p_value_type_code => l_adr_value_type_code
121139 , p_transaction_coa_id => l_adr_transaction_coa_id
121140 , p_accounting_coa_id => l_adr_accounting_coa_id
121141 , p_flexfield_segment_code => l_adr_flexfield_segment_code
121142 , p_flex_value_set_id => l_adr_flex_value_set_id
121143 , p_adr_code => 'FA_EXPENSE_ACCT'
121144 , p_adr_type_code => 'S'
121145 , p_component_type => l_component_type
121146 , p_component_code => l_component_code
121147 , p_component_type_code => l_component_type_code
121148 , p_component_appl_id => l_component_appl_id
121149 , p_amb_context_code => l_amb_context_code
121150 , p_entity_code => 'TRANSACTIONS'
121151 , p_event_class_code => 'REVALUATION'
121152 , p_side => 'NA'
121153 );
121154
121155 END IF;
121156
121157 --
121158 --
121159 END IF;
121160
121161 --
121165 p_header_num => 1);
121162 -- Update the line information that should be overwritten
121163 --
121164 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
121166 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
121167
121168 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
121169
121170 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
121171 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
121172 END IF;
121173
121174 --
121175 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
121176 --
121177 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
121178 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
121179 ELSE
121180 ---------------------------------------------------------------------------------------------------
121181 -- 4262811a Switch Sign
121182 ---------------------------------------------------------------------------------------------------
121183 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
121184 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
121185 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
121186 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
121187 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
121188 -- 5132302
121189 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
121190 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
121191
121192 END IF;
121193
121194 -- 4955764
121195 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
121196 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
121197
121198
121199 XLA_AE_LINES_PKG.ValidateCurrentLine;
121200 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
121201
121202 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
121203 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
121204 ,p_balance_type_code => l_balance_type_code);
121205
121206 END IF;
121207
121208 -----------------------------------------------------------------------------------------
121209 -- 4262811 Multiperiod Accounting
121210 -----------------------------------------------------------------------------------------
121211 -- No MPA option is assigned.
121212
121213
121214 END IF;
121215 END IF;
121216 --
121217
121218 --
121219 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
121220 trace
121221 (p_msg => 'END of AcctLineType_333'
121222 ,p_level => C_LEVEL_PROCEDURE
121223 ,p_module => l_log_module);
121224 END IF;
121225 --
121226 EXCEPTION
121227 WHEN xla_exceptions_pkg.application_exception THEN
121228 RAISE;
121229 WHEN OTHERS THEN
121230 xla_exceptions_pkg.raise_message
121231 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_333');
121232 END AcctLineType_333;
121233 --
121234
121235 ---------------------------------------
121236 --
121237 -- PRIVATE FUNCTION
121238 -- AcctLineType_334
121239 --
121240 ---------------------------------------
121241 PROCEDURE AcctLineType_334 (
121242 p_application_id IN NUMBER
121243 ,p_event_id IN NUMBER
121244 ,p_calculate_acctd_flag IN VARCHAR2
121245 ,p_calculate_g_l_flag IN VARCHAR2
121246 ,p_actual_flag IN OUT VARCHAR2
121247 ,p_balance_type_code OUT VARCHAR2
121248 ,p_gain_or_loss_ref OUT VARCHAR2
121249
121250 --Period Close Date
121251 , p_source_1 IN DATE
121252 --Generated Code Combination Identifier
121253 , p_source_5 IN NUMBER
121254 --Expense Account Code Combination Identifier
121255 , p_source_31 IN NUMBER
121256 --Adjustment Type
121257 , p_source_48 IN VARCHAR2
121258 --Transaction Header Identifier
121259 , p_source_49 IN NUMBER
121260 --Adjustment Line Identifier
121261 , p_source_50 IN NUMBER
121262 --Distribution Type Code
121263 , p_source_51 IN VARCHAR2
121264 --Entered Amount
121265 , p_source_52 IN NUMBER
121266 --Currency Code
121267 , p_source_53 IN VARCHAR2
121268 )
121269 IS
121270
121271 l_component_type VARCHAR2(80);
121272 l_component_code VARCHAR2(30);
121273 l_component_type_code VARCHAR2(1);
121274 l_component_appl_id INTEGER;
121275 l_amb_context_code VARCHAR2(30);
121276 l_entity_code VARCHAR2(30);
121277 l_event_class_code VARCHAR2(30);
121278 l_ae_header_id NUMBER;
121279 l_event_type_code VARCHAR2(30);
121280 l_line_definition_code VARCHAR2(30);
121281 l_line_definition_owner_code VARCHAR2(1);
121282 --
121283 -- adr variables
121284 l_segment VARCHAR2(30);
121288 l_adr_flexfield_segment_code VARCHAR2(30);
121285 l_ccid NUMBER;
121286 l_adr_transaction_coa_id NUMBER;
121287 l_adr_accounting_coa_id NUMBER;
121289 l_adr_flex_value_set_id NUMBER;
121290 l_adr_value_type_code VARCHAR2(30);
121291 l_adr_value_combination_id NUMBER;
121292 l_adr_value_segment_code VARCHAR2(30);
121293
121294 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
121295 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
121296 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
121297 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
121298
121299 -- 4262811 Variables ------------------------------------------------------------------------------------------
121300 l_entered_amt_idx NUMBER;
121301 l_accted_amt_idx NUMBER;
121302 l_acc_rev_flag VARCHAR2(1);
121303 l_accrual_line_num NUMBER;
121304 l_tmp_amt NUMBER;
121305 l_acc_rev_natural_side_code VARCHAR2(1);
121306
121307 l_num_entries NUMBER;
121308 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
121309 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
121310 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
121311 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
121312 l_recog_line_1 NUMBER;
121313 l_recog_line_2 NUMBER;
121314
121315 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
121316 l_bflow_applied_to_amt NUMBER; -- 5132302
121317 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
121318
121319 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
121320
121321 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
121322 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
121323
121324 ---------------------------------------------------------------------------------------------------------------
121325
121326
121327 --
121328 -- bulk performance
121329 --
121330 l_balance_type_code VARCHAR2(1);
121331 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
121332 l_log_module VARCHAR2(240);
121333
121334 --
121335 -- Upgrade strategy
121336 --
121337 l_actual_upg_option VARCHAR2(1);
121338 l_enc_upg_option VARCHAR2(1);
121339
121340 --
121341 BEGIN
121342 --
121343 IF g_log_enabled THEN
121344 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_334';
121345 END IF;
121346 --
121347 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
121348
121349 trace
121350 (p_msg => 'BEGIN of AcctLineType_334'
121351 ,p_level => C_LEVEL_PROCEDURE
121352 ,p_module => l_log_module);
121353
121354 END IF;
121355 --
121356 l_component_type := 'AMB_JLT';
121357 l_component_code := 'FA_REVAL_EXPENSE';
121358 l_component_type_code := 'S';
121359 l_component_appl_id := 140;
121360 l_amb_context_code := 'DEFAULT';
121361 l_entity_code := 'TRANSACTIONS';
121362 l_event_class_code := 'REVALUATION';
121363 l_event_type_code := 'REVALUATION_ALL';
121364 l_line_definition_owner_code := 'S';
121365 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVAL21';
121366 --
121367 l_balance_type_code := 'A';
121368 l_segment := NULL;
121369 l_ccid := NULL;
121370 l_adr_transaction_coa_id := NULL;
121371 l_adr_accounting_coa_id := NULL;
121372 l_adr_flexfield_segment_code := NULL;
121373 l_adr_flex_value_set_id := NULL;
121374 l_adr_value_type_code := NULL;
121375 l_adr_value_combination_id := NULL;
121376 l_adr_value_segment_code := NULL;
121377
121378 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
121379 l_bflow_class_code := ''; -- 4219869 Business Flow
121380 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
121381 l_budgetary_control_flag := 'N';
121382
121383 l_bflow_applied_to_amt_idx := NULL; -- 5132302
121384 l_bflow_applied_to_amt := NULL; -- 5132302
121385 l_entered_amt_idx := NULL; -- 4262811
121386 l_accted_amt_idx := NULL; -- 4262811
121387 l_acc_rev_flag := NULL; -- 4262811
121388 l_accrual_line_num := NULL; -- 4262811
121389 l_tmp_amt := NULL; -- 4262811
121390 --
121391
121392 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
121393 l_balance_type_code <> 'B' THEN
121394 IF NVL(p_source_48,'
121395 ') = 'EXPENSE'
121396 THEN
121397
121398 --
121399 XLA_AE_LINES_PKG.SetNewLine;
121400
121401 p_balance_type_code := l_balance_type_code;
121402 -- set the flag so later we will know whether the gain loss line needs to be created
121403
121404 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
121405 p_actual_flag :='A';
121406 END IF;
121407
121408 --
121409 -- bulk performance
121410 --
121411 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
121415 --
121412 p_header_num => 0); -- 4262811
121413 --
121414 -- set accounting line options
121416 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
121417 p_natural_side_code => 'D'
121418 , p_gain_or_loss_flag => 'N'
121419 , p_gl_transfer_mode_code => 'S'
121420 , p_acct_entry_type_code => 'A'
121421 , p_switch_side_flag => 'Y'
121422 , p_merge_duplicate_code => 'N'
121423 );
121424 --
121425 l_acc_rev_natural_side_code := 'C'; -- 4262811
121426 --
121427 --
121428 -- set accounting line type info
121429 --
121430 xla_ae_lines_pkg.SetAcctLineType
121431 (p_component_type => l_component_type
121432 ,p_event_type_code => l_event_type_code
121433 ,p_line_definition_owner_code => l_line_definition_owner_code
121434 ,p_line_definition_code => l_line_definition_code
121435 ,p_accounting_line_code => l_component_code
121436 ,p_accounting_line_type_code => l_component_type_code
121437 ,p_accounting_line_appl_id => l_component_appl_id
121438 ,p_amb_context_code => l_amb_context_code
121439 ,p_entity_code => l_entity_code
121440 ,p_event_class_code => l_event_class_code);
121441 --
121442 -- set accounting class
121443 --
121444 xla_ae_lines_pkg.SetAcctClass(
121445 p_accounting_class_code => 'EXPENSE'
121446 , p_ae_header_id => l_ae_header_id
121447 );
121448
121449 --
121450 -- set rounding class
121451 --
121452 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
121453 'EXPENSE';
121454
121455 --
121456 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
121457 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
121458 --
121459 -- bulk performance
121460 --
121461 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
121462
121463 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
121464 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
121465
121466 -- 4955764
121467 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
121468 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
121469
121470 -- 4458381 Public Sector Enh
121471
121472 --
121473 -- set accounting attributes for the line type
121474 --
121475 l_entered_amt_idx := 4;
121476 l_accted_amt_idx := 6;
121477 l_bflow_applied_to_amt_idx := NULL; -- 5132302
121478 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
121479 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
121480 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
121481 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
121482 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
121483 l_rec_acct_attrs.array_char_value(3) := p_source_51;
121484 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
121485 l_rec_acct_attrs.array_num_value(4) := p_source_52;
121486 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
121487 l_rec_acct_attrs.array_char_value(5) := p_source_53;
121488 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
121489 l_rec_acct_attrs.array_num_value(6) := p_source_52;
121490
121491 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
121492 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
121493
121494 ---------------------------------------------------------------------------------------------------------------
121495 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
121496 ---------------------------------------------------------------------------------------------------------------
121497 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
121498
121499 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
121500 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
121501
121502 IF xla_accounting_cache_pkg.GetValueChar
121503 (p_source_code => 'LEDGER_CATEGORY_CODE'
121504 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
121505 AND l_bflow_method_code = 'PRIOR_ENTRY'
121506 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
121507 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
121508 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
121509 )
121510 THEN
121511 xla_ae_lines_pkg.BflowUpgEntry
121512 (p_business_method_code => l_bflow_method_code
121513 ,p_business_class_code => l_bflow_class_code
121514 ,p_balance_type => l_balance_type_code);
121515 ELSE
121516 NULL;
121517 -- No business flow processing for business flow method of NONE.
121518 END IF;
121519
121520 --
121521 -- call analytical criteria
121522 --
121523
121524 --
121525 -- call description
121526 --
121527
121531 p_application_id => p_application_id
121528 xla_ae_lines_pkg.SetLineDescription(
121529 p_ae_header_id => l_ae_header_id
121530 ,p_description => Description_95 (
121532 , p_ae_header_id => l_ae_header_id
121533 , p_source_1 => p_source_1
121534 )
121535 );
121536
121537
121538 --
121539 -- call ADRs
121540 -- Bug 4922099
121541 --
121542 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
121543 (NVL(l_actual_upg_option, 'N') = 'O') OR
121544 (NVL(l_enc_upg_option, 'N') = 'O')
121545 )
121546 THEN
121547 NULL;
121548 --
121549 --
121550
121551 l_ccid := AcctDerRule_176(
121552 p_application_id => p_application_id
121553 , p_ae_header_id => l_ae_header_id
121554 , p_source_5 => p_source_5
121555 , p_source_31 => p_source_31
121556 , x_transaction_coa_id => l_adr_transaction_coa_id
121557 , x_accounting_coa_id => l_adr_accounting_coa_id
121558 , x_value_type_code => l_adr_value_type_code
121559 , p_side => 'NA'
121560 );
121561
121562 xla_ae_lines_pkg.set_ccid(
121563 p_code_combination_id => l_ccid
121564 , p_value_type_code => l_adr_value_type_code
121565 , p_transaction_coa_id => l_adr_transaction_coa_id
121566 , p_accounting_coa_id => l_adr_accounting_coa_id
121567 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
121568 , p_adr_type_code => 'S'
121569 , p_component_type => l_component_type
121570 , p_component_code => l_component_code
121571 , p_component_type_code => l_component_type_code
121572 , p_component_appl_id => l_component_appl_id
121573 , p_amb_context_code => l_amb_context_code
121574 , p_side => 'NA'
121575 );
121576
121577
121578 --
121579 --
121580 END IF;
121581 --
121582 -- Bug 4922099
121583 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
121584 (NVL(l_enc_upg_option, 'N') = 'O')
121585 ) AND
121586 (l_bflow_method_code = 'PRIOR_ENTRY')
121587 )
121588 THEN
121589 IF
121590 --
121591 1 = 2
121592 --
121593 THEN
121594 xla_accounting_err_pkg.build_message
121595 (p_appli_s_name => 'XLA'
121596 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
121597 ,p_token_1 => 'LINE_NUMBER'
121598 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
121599 ,p_token_2 => 'LINE_TYPE_NAME'
121600 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
121601 l_component_type
121602 ,l_component_code
121603 ,l_component_type_code
121604 ,l_component_appl_id
121605 ,l_amb_context_code
121606 ,l_entity_code
121607 ,l_event_class_code
121608 )
121609 ,p_token_3 => 'OWNER'
121610 ,p_value_3 => xla_lookups_pkg.get_meaning(
121611 p_lookup_type => 'XLA_OWNER_TYPE'
121612 ,p_lookup_code => l_component_type_code
121613 )
121614 ,p_token_4 => 'PRODUCT_NAME'
121615 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
121616 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
121617 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
121618 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
121619 ,p_ae_header_id => NULL
121620 );
121621
121622 IF (C_LEVEL_ERROR>= g_log_level) THEN
121623 trace
121624 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
121625 ,p_level => C_LEVEL_ERROR
121626 ,p_module => l_log_module);
121627 END IF;
121628 END IF;
121629 END IF;
121630 --
121631 --
121632 ------------------------------------------------------------------------------------------------
121633 -- 4219869 Business Flow
121634 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
121635 -- Prior Entry. Currently, the following code is always generated.
121636 ------------------------------------------------------------------------------------------------
121637 XLA_AE_LINES_PKG.ValidateCurrentLine;
121641 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
121638
121639 ------------------------------------------------------------------------------------
121640 -- 4219869 Business Flow
121642 ------------------------------------------------------------------------------------
121643 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
121644
121645 ----------------------------------------------------------------------------------
121646 -- 4219869 Business Flow
121647 -- Update journal entry status -- Need to generate this within IF <condition>
121648 ----------------------------------------------------------------------------------
121649 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
121650 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
121651 ,p_balance_type_code => l_balance_type_code
121652 );
121653
121654 -------------------------------------------------------------------------------------------
121655 -- 4262811 - Generate the Accrual Reversal lines
121656 -------------------------------------------------------------------------------------------
121657 BEGIN
121658 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
121659 (g_array_event(p_event_id).array_value_num('header_index'));
121660 IF l_acc_rev_flag IS NULL THEN
121661 l_acc_rev_flag := 'N';
121662 END IF;
121663 EXCEPTION
121664 WHEN OTHERS THEN
121665 l_acc_rev_flag := 'N';
121666 END;
121667 --
121668 IF (l_acc_rev_flag = 'Y') THEN
121669
121670 -- 4645092 ------------------------------------------------------------------------------
121671 -- To allow MPA report to determine if it should generate report process
121672 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
121673 ------------------------------------------------------------------------------------------
121674
121675 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
121676 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
121677 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
121678 -- call ADRs
121679 -- Bug 4922099
121680 --
121681 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
121682 (NVL(l_actual_upg_option, 'N') = 'O') OR
121683 (NVL(l_enc_upg_option, 'N') = 'O')
121684 )
121685 THEN
121686 NULL;
121687 --
121688 --
121689
121690 l_ccid := AcctDerRule_176(
121691 p_application_id => p_application_id
121692 , p_ae_header_id => l_ae_header_id
121693 , p_source_5 => p_source_5
121694 , p_source_31 => p_source_31
121695 , x_transaction_coa_id => l_adr_transaction_coa_id
121696 , x_accounting_coa_id => l_adr_accounting_coa_id
121697 , x_value_type_code => l_adr_value_type_code
121698 , p_side => 'NA'
121699 );
121700
121701 xla_ae_lines_pkg.set_ccid(
121702 p_code_combination_id => l_ccid
121703 , p_value_type_code => l_adr_value_type_code
121704 , p_transaction_coa_id => l_adr_transaction_coa_id
121705 , p_accounting_coa_id => l_adr_accounting_coa_id
121706 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
121707 , p_adr_type_code => 'S'
121708 , p_component_type => l_component_type
121709 , p_component_code => l_component_code
121710 , p_component_type_code => l_component_type_code
121711 , p_component_appl_id => l_component_appl_id
121712 , p_amb_context_code => l_amb_context_code
121713 , p_side => 'NA'
121714 );
121715
121716
121717 --
121718 --
121719 END IF;
121720
121721 --
121722 -- Update the line information that should be overwritten
121723 --
121724 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
121725 p_header_num => 1);
121726 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
121727
121728 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
121729
121730 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
121731 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
121732 END IF;
121733
121734 --
121735 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
121736 --
121737 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
121738 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
121739 ELSE
121740 ---------------------------------------------------------------------------------------------------
121741 -- 4262811a Switch Sign
121742 ---------------------------------------------------------------------------------------------------
121743 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
121744 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
121745 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
121746 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
121750 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
121747 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
121748 -- 5132302
121749 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
121751
121752 END IF;
121753
121754 -- 4955764
121755 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
121756 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
121757
121758
121759 XLA_AE_LINES_PKG.ValidateCurrentLine;
121760 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
121761
121762 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
121763 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
121764 ,p_balance_type_code => l_balance_type_code);
121765
121766 END IF;
121767
121768 -----------------------------------------------------------------------------------------
121769 -- 4262811 Multiperiod Accounting
121770 -----------------------------------------------------------------------------------------
121771 -- No MPA option is assigned.
121772
121773
121774 END IF;
121775 END IF;
121776 --
121777
121778 --
121779 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
121780 trace
121781 (p_msg => 'END of AcctLineType_334'
121782 ,p_level => C_LEVEL_PROCEDURE
121783 ,p_module => l_log_module);
121784 END IF;
121785 --
121786 EXCEPTION
121787 WHEN xla_exceptions_pkg.application_exception THEN
121788 RAISE;
121789 WHEN OTHERS THEN
121790 xla_exceptions_pkg.raise_message
121791 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_334');
121792 END AcctLineType_334;
121793 --
121794
121795 ---------------------------------------
121796 --
121797 -- PRIVATE FUNCTION
121798 -- AcctLineType_335
121799 --
121800 ---------------------------------------
121801 PROCEDURE AcctLineType_335 (
121802 p_application_id IN NUMBER
121803 ,p_event_id IN NUMBER
121804 ,p_calculate_acctd_flag IN VARCHAR2
121805 ,p_calculate_g_l_flag IN VARCHAR2
121806 ,p_actual_flag IN OUT VARCHAR2
121807 ,p_balance_type_code OUT VARCHAR2
121808 ,p_gain_or_loss_ref OUT VARCHAR2
121809
121810 --Period Close Date
121811 , p_source_1 IN DATE
121812 --Generated Code Combination Identifier
121813 , p_source_5 IN NUMBER
121814 --Expense Account Code Combination Identifier
121815 , p_source_31 IN NUMBER
121816 --Adjustment Type
121817 , p_source_48 IN VARCHAR2
121818 --Transaction Header Identifier
121819 , p_source_49 IN NUMBER
121820 --Adjustment Line Identifier
121821 , p_source_50 IN NUMBER
121822 --Distribution Type Code
121823 , p_source_51 IN VARCHAR2
121824 --Entered Amount
121825 , p_source_52 IN NUMBER
121826 --Currency Code
121827 , p_source_53 IN VARCHAR2
121828 )
121829 IS
121830
121831 l_component_type VARCHAR2(80);
121832 l_component_code VARCHAR2(30);
121833 l_component_type_code VARCHAR2(1);
121834 l_component_appl_id INTEGER;
121835 l_amb_context_code VARCHAR2(30);
121836 l_entity_code VARCHAR2(30);
121837 l_event_class_code VARCHAR2(30);
121838 l_ae_header_id NUMBER;
121839 l_event_type_code VARCHAR2(30);
121840 l_line_definition_code VARCHAR2(30);
121841 l_line_definition_owner_code VARCHAR2(1);
121842 --
121843 -- adr variables
121844 l_segment VARCHAR2(30);
121845 l_ccid NUMBER;
121846 l_adr_transaction_coa_id NUMBER;
121847 l_adr_accounting_coa_id NUMBER;
121848 l_adr_flexfield_segment_code VARCHAR2(30);
121849 l_adr_flex_value_set_id NUMBER;
121850 l_adr_value_type_code VARCHAR2(30);
121851 l_adr_value_combination_id NUMBER;
121852 l_adr_value_segment_code VARCHAR2(30);
121853
121854 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
121855 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
121856 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
121857 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
121858
121859 -- 4262811 Variables ------------------------------------------------------------------------------------------
121860 l_entered_amt_idx NUMBER;
121861 l_accted_amt_idx NUMBER;
121862 l_acc_rev_flag VARCHAR2(1);
121863 l_accrual_line_num NUMBER;
121864 l_tmp_amt NUMBER;
121865 l_acc_rev_natural_side_code VARCHAR2(1);
121866
121867 l_num_entries NUMBER;
121868 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
121869 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
121870 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
121871 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
121872 l_recog_line_1 NUMBER;
121873 l_recog_line_2 NUMBER;
121874
121875 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
121879 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
121876 l_bflow_applied_to_amt NUMBER; -- 5132302
121877 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
121878
121880
121881 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
121882 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
121883
121884 ---------------------------------------------------------------------------------------------------------------
121885
121886
121887 --
121888 -- bulk performance
121889 --
121890 l_balance_type_code VARCHAR2(1);
121891 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
121892 l_log_module VARCHAR2(240);
121893
121894 --
121895 -- Upgrade strategy
121896 --
121897 l_actual_upg_option VARCHAR2(1);
121898 l_enc_upg_option VARCHAR2(1);
121899
121900 --
121901 BEGIN
121902 --
121903 IF g_log_enabled THEN
121904 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_335';
121905 END IF;
121906 --
121907 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
121908
121909 trace
121910 (p_msg => 'BEGIN of AcctLineType_335'
121911 ,p_level => C_LEVEL_PROCEDURE
121912 ,p_module => l_log_module);
121913
121914 END IF;
121915 --
121916 l_component_type := 'AMB_JLT';
121917 l_component_code := 'FA_REVAL_EXP_BAL';
121918 l_component_type_code := 'S';
121919 l_component_appl_id := 140;
121920 l_amb_context_code := 'DEFAULT';
121921 l_entity_code := 'TRANSACTIONS';
121922 l_event_class_code := 'REVALUATION';
121923 l_event_type_code := 'REVALUATION_ALL';
121924 l_line_definition_owner_code := 'S';
121925 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVAL21';
121926 --
121927 l_balance_type_code := 'A';
121928 l_segment := NULL;
121929 l_ccid := NULL;
121930 l_adr_transaction_coa_id := NULL;
121931 l_adr_accounting_coa_id := NULL;
121932 l_adr_flexfield_segment_code := NULL;
121933 l_adr_flex_value_set_id := NULL;
121934 l_adr_value_type_code := NULL;
121935 l_adr_value_combination_id := NULL;
121936 l_adr_value_segment_code := NULL;
121937
121938 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
121939 l_bflow_class_code := ''; -- 4219869 Business Flow
121940 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
121941 l_budgetary_control_flag := 'N';
121942
121943 l_bflow_applied_to_amt_idx := NULL; -- 5132302
121944 l_bflow_applied_to_amt := NULL; -- 5132302
121945 l_entered_amt_idx := NULL; -- 4262811
121946 l_accted_amt_idx := NULL; -- 4262811
121947 l_acc_rev_flag := NULL; -- 4262811
121948 l_accrual_line_num := NULL; -- 4262811
121949 l_tmp_amt := NULL; -- 4262811
121950 --
121951
121952 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
121953 l_balance_type_code <> 'B' THEN
121954 IF NVL(p_source_48,'
121955 ') = 'BONUS EXPENSE'
121956 THEN
121957
121958 --
121959 XLA_AE_LINES_PKG.SetNewLine;
121960
121961 p_balance_type_code := l_balance_type_code;
121962 -- set the flag so later we will know whether the gain loss line needs to be created
121963
121964 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
121965 p_actual_flag :='A';
121966 END IF;
121967
121968 --
121969 -- bulk performance
121970 --
121971 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
121972 p_header_num => 0); -- 4262811
121973 --
121974 -- set accounting line options
121975 --
121976 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
121977 p_natural_side_code => 'C'
121978 , p_gain_or_loss_flag => 'N'
121979 , p_gl_transfer_mode_code => 'S'
121980 , p_acct_entry_type_code => 'A'
121981 , p_switch_side_flag => 'Y'
121982 , p_merge_duplicate_code => 'N'
121983 );
121984 --
121985 l_acc_rev_natural_side_code := 'D'; -- 4262811
121986 --
121987 --
121988 -- set accounting line type info
121989 --
121990 xla_ae_lines_pkg.SetAcctLineType
121991 (p_component_type => l_component_type
121992 ,p_event_type_code => l_event_type_code
121993 ,p_line_definition_owner_code => l_line_definition_owner_code
121994 ,p_line_definition_code => l_line_definition_code
121995 ,p_accounting_line_code => l_component_code
121996 ,p_accounting_line_type_code => l_component_type_code
121997 ,p_accounting_line_appl_id => l_component_appl_id
121998 ,p_amb_context_code => l_amb_context_code
121999 ,p_entity_code => l_entity_code
122000 ,p_event_class_code => l_event_class_code);
122001 --
122002 -- set accounting class
122003 --
122004 xla_ae_lines_pkg.SetAcctClass(
122005 p_accounting_class_code => 'EXPENSE'
122006 , p_ae_header_id => l_ae_header_id
122007 );
122011 --
122008
122009 --
122010 -- set rounding class
122012 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
122013 'EXPENSE';
122014
122015 --
122016 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
122017 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
122018 --
122019 -- bulk performance
122020 --
122021 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
122022
122023 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
122024 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
122025
122026 -- 4955764
122027 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
122028 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
122029
122030 -- 4458381 Public Sector Enh
122031
122032 --
122033 -- set accounting attributes for the line type
122034 --
122035 l_entered_amt_idx := 4;
122036 l_accted_amt_idx := 6;
122037 l_bflow_applied_to_amt_idx := NULL; -- 5132302
122038 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
122039 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
122040 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
122041 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
122042 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
122043 l_rec_acct_attrs.array_char_value(3) := p_source_51;
122044 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
122045 l_rec_acct_attrs.array_num_value(4) := p_source_52;
122046 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
122047 l_rec_acct_attrs.array_char_value(5) := p_source_53;
122048 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
122049 l_rec_acct_attrs.array_num_value(6) := p_source_52;
122050
122051 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
122052 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
122053
122054 ---------------------------------------------------------------------------------------------------------------
122055 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
122056 ---------------------------------------------------------------------------------------------------------------
122057 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
122058
122059 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
122060 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
122061
122062 IF xla_accounting_cache_pkg.GetValueChar
122063 (p_source_code => 'LEDGER_CATEGORY_CODE'
122064 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
122065 AND l_bflow_method_code = 'PRIOR_ENTRY'
122066 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
122067 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
122068 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
122069 )
122070 THEN
122071 xla_ae_lines_pkg.BflowUpgEntry
122072 (p_business_method_code => l_bflow_method_code
122073 ,p_business_class_code => l_bflow_class_code
122074 ,p_balance_type => l_balance_type_code);
122075 ELSE
122076 NULL;
122077 -- No business flow processing for business flow method of NONE.
122078 END IF;
122079
122080 --
122081 -- call analytical criteria
122082 --
122083
122084 --
122085 -- call description
122086 --
122087
122088 xla_ae_lines_pkg.SetLineDescription(
122089 p_ae_header_id => l_ae_header_id
122090 ,p_description => Description_95 (
122091 p_application_id => p_application_id
122092 , p_ae_header_id => l_ae_header_id
122093 , p_source_1 => p_source_1
122094 )
122095 );
122096
122097
122098 --
122099 -- call ADRs
122100 -- Bug 4922099
122101 --
122102 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
122103 (NVL(l_actual_upg_option, 'N') = 'O') OR
122104 (NVL(l_enc_upg_option, 'N') = 'O')
122105 )
122106 THEN
122107 NULL;
122108 --
122109 --
122110
122111 l_ccid := AcctDerRule_176(
122112 p_application_id => p_application_id
122113 , p_ae_header_id => l_ae_header_id
122114 , p_source_5 => p_source_5
122115 , p_source_31 => p_source_31
122116 , x_transaction_coa_id => l_adr_transaction_coa_id
122117 , x_accounting_coa_id => l_adr_accounting_coa_id
122118 , x_value_type_code => l_adr_value_type_code
122119 , p_side => 'NA'
122120 );
122121
122122 xla_ae_lines_pkg.set_ccid(
122123 p_code_combination_id => l_ccid
122124 , p_value_type_code => l_adr_value_type_code
122125 , p_transaction_coa_id => l_adr_transaction_coa_id
122126 , p_accounting_coa_id => l_adr_accounting_coa_id
122127 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
122128 , p_adr_type_code => 'S'
122129 , p_component_type => l_component_type
122133 , p_amb_context_code => l_amb_context_code
122130 , p_component_code => l_component_code
122131 , p_component_type_code => l_component_type_code
122132 , p_component_appl_id => l_component_appl_id
122134 , p_side => 'NA'
122135 );
122136
122137
122138 --
122139 --
122140 END IF;
122141 --
122142 -- Bug 4922099
122143 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
122144 (NVL(l_enc_upg_option, 'N') = 'O')
122145 ) AND
122146 (l_bflow_method_code = 'PRIOR_ENTRY')
122147 )
122148 THEN
122149 IF
122150 --
122151 1 = 2
122152 --
122153 THEN
122154 xla_accounting_err_pkg.build_message
122155 (p_appli_s_name => 'XLA'
122156 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
122157 ,p_token_1 => 'LINE_NUMBER'
122158 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
122159 ,p_token_2 => 'LINE_TYPE_NAME'
122160 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
122161 l_component_type
122162 ,l_component_code
122163 ,l_component_type_code
122164 ,l_component_appl_id
122165 ,l_amb_context_code
122166 ,l_entity_code
122167 ,l_event_class_code
122168 )
122169 ,p_token_3 => 'OWNER'
122170 ,p_value_3 => xla_lookups_pkg.get_meaning(
122171 p_lookup_type => 'XLA_OWNER_TYPE'
122172 ,p_lookup_code => l_component_type_code
122173 )
122174 ,p_token_4 => 'PRODUCT_NAME'
122175 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
122176 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
122177 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
122178 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
122179 ,p_ae_header_id => NULL
122180 );
122181
122182 IF (C_LEVEL_ERROR>= g_log_level) THEN
122183 trace
122184 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
122185 ,p_level => C_LEVEL_ERROR
122186 ,p_module => l_log_module);
122187 END IF;
122188 END IF;
122189 END IF;
122190 --
122191 --
122192 ------------------------------------------------------------------------------------------------
122193 -- 4219869 Business Flow
122194 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
122195 -- Prior Entry. Currently, the following code is always generated.
122196 ------------------------------------------------------------------------------------------------
122197 XLA_AE_LINES_PKG.ValidateCurrentLine;
122198
122199 ------------------------------------------------------------------------------------
122200 -- 4219869 Business Flow
122201 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
122202 ------------------------------------------------------------------------------------
122203 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
122204
122205 ----------------------------------------------------------------------------------
122206 -- 4219869 Business Flow
122207 -- Update journal entry status -- Need to generate this within IF <condition>
122208 ----------------------------------------------------------------------------------
122209 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
122210 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
122211 ,p_balance_type_code => l_balance_type_code
122212 );
122213
122214 -------------------------------------------------------------------------------------------
122215 -- 4262811 - Generate the Accrual Reversal lines
122216 -------------------------------------------------------------------------------------------
122217 BEGIN
122218 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
122219 (g_array_event(p_event_id).array_value_num('header_index'));
122220 IF l_acc_rev_flag IS NULL THEN
122221 l_acc_rev_flag := 'N';
122222 END IF;
122223 EXCEPTION
122224 WHEN OTHERS THEN
122225 l_acc_rev_flag := 'N';
122226 END;
122227 --
122231 -- To allow MPA report to determine if it should generate report process
122228 IF (l_acc_rev_flag = 'Y') THEN
122229
122230 -- 4645092 ------------------------------------------------------------------------------
122232 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
122233 ------------------------------------------------------------------------------------------
122234
122235 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
122236 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
122237 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
122238 -- call ADRs
122239 -- Bug 4922099
122240 --
122241 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
122242 (NVL(l_actual_upg_option, 'N') = 'O') OR
122243 (NVL(l_enc_upg_option, 'N') = 'O')
122244 )
122245 THEN
122246 NULL;
122247 --
122248 --
122249
122250 l_ccid := AcctDerRule_176(
122251 p_application_id => p_application_id
122252 , p_ae_header_id => l_ae_header_id
122253 , p_source_5 => p_source_5
122254 , p_source_31 => p_source_31
122255 , x_transaction_coa_id => l_adr_transaction_coa_id
122256 , x_accounting_coa_id => l_adr_accounting_coa_id
122257 , x_value_type_code => l_adr_value_type_code
122258 , p_side => 'NA'
122259 );
122260
122261 xla_ae_lines_pkg.set_ccid(
122262 p_code_combination_id => l_ccid
122263 , p_value_type_code => l_adr_value_type_code
122264 , p_transaction_coa_id => l_adr_transaction_coa_id
122265 , p_accounting_coa_id => l_adr_accounting_coa_id
122266 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
122267 , p_adr_type_code => 'S'
122268 , p_component_type => l_component_type
122269 , p_component_code => l_component_code
122270 , p_component_type_code => l_component_type_code
122271 , p_component_appl_id => l_component_appl_id
122272 , p_amb_context_code => l_amb_context_code
122273 , p_side => 'NA'
122274 );
122275
122276
122277 --
122278 --
122279 END IF;
122280
122281 --
122282 -- Update the line information that should be overwritten
122283 --
122284 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
122285 p_header_num => 1);
122286 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
122287
122288 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
122289
122290 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
122291 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
122292 END IF;
122293
122294 --
122295 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
122296 --
122297 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
122298 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
122299 ELSE
122300 ---------------------------------------------------------------------------------------------------
122301 -- 4262811a Switch Sign
122302 ---------------------------------------------------------------------------------------------------
122303 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
122304 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
122305 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
122306 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
122307 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
122308 -- 5132302
122309 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
122310 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
122311
122312 END IF;
122313
122314 -- 4955764
122315 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
122316 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
122317
122318
122319 XLA_AE_LINES_PKG.ValidateCurrentLine;
122320 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
122321
122322 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
122323 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
122324 ,p_balance_type_code => l_balance_type_code);
122325
122326 END IF;
122327
122328 -----------------------------------------------------------------------------------------
122329 -- 4262811 Multiperiod Accounting
122330 -----------------------------------------------------------------------------------------
122331 -- No MPA option is assigned.
122332
122333
122334 END IF;
122335 END IF;
122336 --
122337
122338 --
122339 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
122340 trace
122341 (p_msg => 'END of AcctLineType_335'
122342 ,p_level => C_LEVEL_PROCEDURE
122346 EXCEPTION
122343 ,p_module => l_log_module);
122344 END IF;
122345 --
122347 WHEN xla_exceptions_pkg.application_exception THEN
122348 RAISE;
122349 WHEN OTHERS THEN
122350 xla_exceptions_pkg.raise_message
122351 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_335');
122352 END AcctLineType_335;
122353 --
122354
122355 ---------------------------------------
122356 --
122357 -- PRIVATE FUNCTION
122358 -- AcctLineType_336
122359 --
122360 ---------------------------------------
122361 PROCEDURE AcctLineType_336 (
122362 p_application_id IN NUMBER
122363 ,p_event_id IN NUMBER
122364 ,p_calculate_acctd_flag IN VARCHAR2
122365 ,p_calculate_g_l_flag IN VARCHAR2
122366 ,p_actual_flag IN OUT VARCHAR2
122367 ,p_balance_type_code OUT VARCHAR2
122368 ,p_gain_or_loss_ref OUT VARCHAR2
122369
122370 --Period Close Date
122371 , p_source_1 IN DATE
122372 --Generated Code Combination Identifier
122373 , p_source_5 IN NUMBER
122374 --Revaluation Reserve Account
122375 , p_source_13 IN VARCHAR2
122376 --Generated Offset Code Combination Identifier
122377 , p_source_19 IN NUMBER
122378 --Expense Account Code Combination Identifier
122379 , p_source_31 IN NUMBER
122380 --Default Code Combination Identifier
122381 , p_source_32 IN NUMBER
122382 --Adjustment Type
122383 , p_source_48 IN VARCHAR2
122384 --Transaction Header Identifier
122385 , p_source_49 IN NUMBER
122386 --Adjustment Line Identifier
122387 , p_source_50 IN NUMBER
122388 --Distribution Type Code
122389 , p_source_51 IN VARCHAR2
122390 --Entered Amount
122391 , p_source_52 IN NUMBER
122392 --Currency Code
122393 , p_source_53 IN VARCHAR2
122394 )
122395 IS
122396
122397 l_component_type VARCHAR2(80);
122398 l_component_code VARCHAR2(30);
122399 l_component_type_code VARCHAR2(1);
122400 l_component_appl_id INTEGER;
122401 l_amb_context_code VARCHAR2(30);
122402 l_entity_code VARCHAR2(30);
122403 l_event_class_code VARCHAR2(30);
122404 l_ae_header_id NUMBER;
122405 l_event_type_code VARCHAR2(30);
122406 l_line_definition_code VARCHAR2(30);
122407 l_line_definition_owner_code VARCHAR2(1);
122408 --
122409 -- adr variables
122410 l_segment VARCHAR2(30);
122411 l_ccid NUMBER;
122412 l_adr_transaction_coa_id NUMBER;
122413 l_adr_accounting_coa_id NUMBER;
122414 l_adr_flexfield_segment_code VARCHAR2(30);
122415 l_adr_flex_value_set_id NUMBER;
122416 l_adr_value_type_code VARCHAR2(30);
122417 l_adr_value_combination_id NUMBER;
122418 l_adr_value_segment_code VARCHAR2(30);
122419
122420 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
122421 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
122422 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
122423 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
122424
122425 -- 4262811 Variables ------------------------------------------------------------------------------------------
122426 l_entered_amt_idx NUMBER;
122427 l_accted_amt_idx NUMBER;
122428 l_acc_rev_flag VARCHAR2(1);
122429 l_accrual_line_num NUMBER;
122430 l_tmp_amt NUMBER;
122431 l_acc_rev_natural_side_code VARCHAR2(1);
122432
122433 l_num_entries NUMBER;
122434 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
122435 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
122436 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
122437 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
122438 l_recog_line_1 NUMBER;
122439 l_recog_line_2 NUMBER;
122440
122441 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
122442 l_bflow_applied_to_amt NUMBER; -- 5132302
122443 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
122444
122445 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
122446
122447 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
122448 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
122449
122450 ---------------------------------------------------------------------------------------------------------------
122451
122452
122453 --
122454 -- bulk performance
122455 --
122456 l_balance_type_code VARCHAR2(1);
122457 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
122458 l_log_module VARCHAR2(240);
122459
122460 --
122461 -- Upgrade strategy
122462 --
122463 l_actual_upg_option VARCHAR2(1);
122464 l_enc_upg_option VARCHAR2(1);
122465
122466 --
122467 BEGIN
122468 --
122469 IF g_log_enabled THEN
122470 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_336';
122471 END IF;
122472 --
122473 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
122474
122475 trace
122476 (p_msg => 'BEGIN of AcctLineType_336'
122477 ,p_level => C_LEVEL_PROCEDURE
122481 --
122478 ,p_module => l_log_module);
122479
122480 END IF;
122482 l_component_type := 'AMB_JLT';
122483 l_component_code := 'FA_REVAL_RESERVE';
122484 l_component_type_code := 'S';
122485 l_component_appl_id := 140;
122486 l_amb_context_code := 'DEFAULT';
122487 l_entity_code := 'TRANSACTIONS';
122488 l_event_class_code := 'REVALUATION';
122489 l_event_type_code := 'REVALUATION_ALL';
122490 l_line_definition_owner_code := 'S';
122491 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVAL21';
122492 --
122493 l_balance_type_code := 'A';
122494 l_segment := NULL;
122495 l_ccid := NULL;
122496 l_adr_transaction_coa_id := NULL;
122497 l_adr_accounting_coa_id := NULL;
122498 l_adr_flexfield_segment_code := NULL;
122499 l_adr_flex_value_set_id := NULL;
122500 l_adr_value_type_code := NULL;
122501 l_adr_value_combination_id := NULL;
122502 l_adr_value_segment_code := NULL;
122503
122504 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
122505 l_bflow_class_code := ''; -- 4219869 Business Flow
122506 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
122507 l_budgetary_control_flag := 'N';
122508
122509 l_bflow_applied_to_amt_idx := NULL; -- 5132302
122510 l_bflow_applied_to_amt := NULL; -- 5132302
122511 l_entered_amt_idx := NULL; -- 4262811
122512 l_accted_amt_idx := NULL; -- 4262811
122513 l_acc_rev_flag := NULL; -- 4262811
122514 l_accrual_line_num := NULL; -- 4262811
122515 l_tmp_amt := NULL; -- 4262811
122516 --
122517
122518 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
122519 l_balance_type_code <> 'B' THEN
122520 IF NVL(p_source_48,'
122521 ') = 'REVAL RESERVE'
122522 THEN
122523
122524 --
122525 XLA_AE_LINES_PKG.SetNewLine;
122526
122527 p_balance_type_code := l_balance_type_code;
122528 -- set the flag so later we will know whether the gain loss line needs to be created
122529
122530 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
122531 p_actual_flag :='A';
122532 END IF;
122533
122534 --
122535 -- bulk performance
122536 --
122537 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
122538 p_header_num => 0); -- 4262811
122539 --
122540 -- set accounting line options
122541 --
122542 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
122543 p_natural_side_code => 'C'
122544 , p_gain_or_loss_flag => 'N'
122545 , p_gl_transfer_mode_code => 'S'
122546 , p_acct_entry_type_code => 'A'
122547 , p_switch_side_flag => 'Y'
122548 , p_merge_duplicate_code => 'N'
122549 );
122550 --
122551 l_acc_rev_natural_side_code := 'D'; -- 4262811
122552 --
122553 --
122554 -- set accounting line type info
122555 --
122556 xla_ae_lines_pkg.SetAcctLineType
122557 (p_component_type => l_component_type
122558 ,p_event_type_code => l_event_type_code
122559 ,p_line_definition_owner_code => l_line_definition_owner_code
122560 ,p_line_definition_code => l_line_definition_code
122561 ,p_accounting_line_code => l_component_code
122562 ,p_accounting_line_type_code => l_component_type_code
122563 ,p_accounting_line_appl_id => l_component_appl_id
122564 ,p_amb_context_code => l_amb_context_code
122565 ,p_entity_code => l_entity_code
122566 ,p_event_class_code => l_event_class_code);
122567 --
122568 -- set accounting class
122569 --
122570 xla_ae_lines_pkg.SetAcctClass(
122571 p_accounting_class_code => 'ASSET'
122572 , p_ae_header_id => l_ae_header_id
122573 );
122574
122575 --
122576 -- set rounding class
122577 --
122578 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
122579 'ASSET';
122580
122581 --
122582 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
122583 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
122584 --
122585 -- bulk performance
122586 --
122587 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
122588
122589 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
122590 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
122591
122592 -- 4955764
122593 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
122594 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
122595
122596 -- 4458381 Public Sector Enh
122597
122598 --
122599 -- set accounting attributes for the line type
122600 --
122601 l_entered_amt_idx := 4;
122602 l_accted_amt_idx := 6;
122603 l_bflow_applied_to_amt_idx := NULL; -- 5132302
122604 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
122608 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
122605 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
122606 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
122607 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
122609 l_rec_acct_attrs.array_char_value(3) := p_source_51;
122610 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
122611 l_rec_acct_attrs.array_num_value(4) := p_source_52;
122612 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
122613 l_rec_acct_attrs.array_char_value(5) := p_source_53;
122614 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
122615 l_rec_acct_attrs.array_num_value(6) := p_source_52;
122616
122617 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
122618 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
122619
122620 ---------------------------------------------------------------------------------------------------------------
122621 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
122622 ---------------------------------------------------------------------------------------------------------------
122623 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
122624
122625 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
122626 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
122627
122628 IF xla_accounting_cache_pkg.GetValueChar
122629 (p_source_code => 'LEDGER_CATEGORY_CODE'
122630 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
122631 AND l_bflow_method_code = 'PRIOR_ENTRY'
122632 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
122633 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
122634 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
122635 )
122636 THEN
122637 xla_ae_lines_pkg.BflowUpgEntry
122638 (p_business_method_code => l_bflow_method_code
122639 ,p_business_class_code => l_bflow_class_code
122640 ,p_balance_type => l_balance_type_code);
122641 ELSE
122642 NULL;
122643 -- No business flow processing for business flow method of NONE.
122644 END IF;
122645
122646 --
122647 -- call analytical criteria
122648 --
122649
122650 --
122651 -- call description
122652 --
122653
122654 xla_ae_lines_pkg.SetLineDescription(
122655 p_ae_header_id => l_ae_header_id
122656 ,p_description => Description_96 (
122657 p_application_id => p_application_id
122658 , p_ae_header_id => l_ae_header_id
122659 , p_source_1 => p_source_1
122660 )
122661 );
122662
122663
122664 --
122665 -- call ADRs
122666 -- Bug 4922099
122667 --
122668 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
122669 (NVL(l_actual_upg_option, 'N') = 'O') OR
122670 (NVL(l_enc_upg_option, 'N') = 'O')
122671 )
122672 THEN
122673 NULL;
122674 --
122675 --
122676
122677 l_ccid := AcctDerRule_175(
122678 p_application_id => p_application_id
122679 , p_ae_header_id => l_ae_header_id
122680 , p_source_5 => p_source_5
122681 , p_source_19 => p_source_19
122682 , p_source_32 => p_source_32
122683 , x_transaction_coa_id => l_adr_transaction_coa_id
122684 , x_accounting_coa_id => l_adr_accounting_coa_id
122685 , x_value_type_code => l_adr_value_type_code
122686 , p_side => 'NA'
122687 );
122688
122689 xla_ae_lines_pkg.set_ccid(
122690 p_code_combination_id => l_ccid
122691 , p_value_type_code => l_adr_value_type_code
122692 , p_transaction_coa_id => l_adr_transaction_coa_id
122693 , p_accounting_coa_id => l_adr_accounting_coa_id
122694 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
122695 , p_adr_type_code => 'S'
122696 , p_component_type => l_component_type
122697 , p_component_code => l_component_code
122698 , p_component_type_code => l_component_type_code
122699 , p_component_appl_id => l_component_appl_id
122700 , p_amb_context_code => l_amb_context_code
122701 , p_side => 'NA'
122702 );
122703
122704
122705 l_segment := AcctDerRule_151(
122706 p_application_id => p_application_id
122707 , p_ae_header_id => l_ae_header_id
122708 , p_source_5 => p_source_5
122709 , p_source_13 => p_source_13
122710 , x_transaction_coa_id => l_adr_transaction_coa_id
122711 , x_accounting_coa_id => l_adr_accounting_coa_id
122712 , x_flexfield_segment_code => l_adr_flexfield_segment_code
122713 , x_flex_value_set_id => l_adr_flex_value_set_id
122714 , x_value_type_code => l_adr_value_type_code
122715 , x_value_combination_id => l_adr_value_combination_id
122716 , x_value_segment_code => l_adr_value_segment_code
122717 , p_side => 'NA'
122718 , p_override_seg_flag => 'Y'
122719 );
122720
122721 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
122722
122723 xla_ae_lines_pkg.set_segment(
122727 , p_from_combination_id => l_adr_value_combination_id
122724 p_to_segment_code => 'GL_ACCOUNT'
122725 , p_segment_value => l_segment
122726 , p_from_segment_code => l_adr_value_segment_code
122728 , p_value_type_code => l_adr_value_type_code
122729 , p_transaction_coa_id => l_adr_transaction_coa_id
122730 , p_accounting_coa_id => l_adr_accounting_coa_id
122731 , p_flexfield_segment_code => l_adr_flexfield_segment_code
122732 , p_flex_value_set_id => l_adr_flex_value_set_id
122733 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
122734 , p_adr_type_code => 'S'
122735 , p_component_type => l_component_type
122736 , p_component_code => l_component_code
122737 , p_component_type_code => l_component_type_code
122738 , p_component_appl_id => l_component_appl_id
122739 , p_amb_context_code => l_amb_context_code
122740 , p_entity_code => 'TRANSACTIONS'
122741 , p_event_class_code => 'REVALUATION'
122742 , p_side => 'NA'
122743 );
122744
122745 END IF;
122746
122747 l_segment := AcctDerRule_169(
122748 p_application_id => p_application_id
122749 , p_ae_header_id => l_ae_header_id
122750 , p_source_5 => p_source_5
122751 , p_source_31 => p_source_31
122752 , x_transaction_coa_id => l_adr_transaction_coa_id
122753 , x_accounting_coa_id => l_adr_accounting_coa_id
122754 , x_flexfield_segment_code => l_adr_flexfield_segment_code
122755 , x_flex_value_set_id => l_adr_flex_value_set_id
122756 , x_value_type_code => l_adr_value_type_code
122757 , x_value_combination_id => l_adr_value_combination_id
122758 , x_value_segment_code => l_adr_value_segment_code
122759 , p_side => 'NA'
122760 , p_override_seg_flag => 'Y'
122761 );
122762
122763 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
122764
122765 xla_ae_lines_pkg.set_segment(
122766 p_to_segment_code => 'GL_BALANCING'
122767 , p_segment_value => l_segment
122768 , p_from_segment_code => l_adr_value_segment_code
122769 , p_from_combination_id => l_adr_value_combination_id
122770 , p_value_type_code => l_adr_value_type_code
122771 , p_transaction_coa_id => l_adr_transaction_coa_id
122772 , p_accounting_coa_id => l_adr_accounting_coa_id
122773 , p_flexfield_segment_code => l_adr_flexfield_segment_code
122774 , p_flex_value_set_id => l_adr_flex_value_set_id
122775 , p_adr_code => 'FA_EXPENSE_ACCT'
122776 , p_adr_type_code => 'S'
122777 , p_component_type => l_component_type
122778 , p_component_code => l_component_code
122779 , p_component_type_code => l_component_type_code
122780 , p_component_appl_id => l_component_appl_id
122781 , p_amb_context_code => l_amb_context_code
122782 , p_entity_code => 'TRANSACTIONS'
122783 , p_event_class_code => 'REVALUATION'
122784 , p_side => 'NA'
122785 );
122786
122787 END IF;
122788
122789 --
122790 --
122791 END IF;
122792 --
122793 -- Bug 4922099
122794 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
122795 (NVL(l_enc_upg_option, 'N') = 'O')
122796 ) AND
122797 (l_bflow_method_code = 'PRIOR_ENTRY')
122798 )
122799 THEN
122800 IF
122801 --
122802 1 = 2
122803 --
122804 THEN
122805 xla_accounting_err_pkg.build_message
122806 (p_appli_s_name => 'XLA'
122807 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
122808 ,p_token_1 => 'LINE_NUMBER'
122809 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
122810 ,p_token_2 => 'LINE_TYPE_NAME'
122811 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
122812 l_component_type
122813 ,l_component_code
122814 ,l_component_type_code
122815 ,l_component_appl_id
122816 ,l_amb_context_code
122817 ,l_entity_code
122818 ,l_event_class_code
122819 )
122820 ,p_token_3 => 'OWNER'
122821 ,p_value_3 => xla_lookups_pkg.get_meaning(
122822 p_lookup_type => 'XLA_OWNER_TYPE'
122823 ,p_lookup_code => l_component_type_code
122827 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
122824 )
122825 ,p_token_4 => 'PRODUCT_NAME'
122826 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
122828 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
122829 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
122830 ,p_ae_header_id => NULL
122831 );
122832
122833 IF (C_LEVEL_ERROR>= g_log_level) THEN
122834 trace
122835 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
122836 ,p_level => C_LEVEL_ERROR
122837 ,p_module => l_log_module);
122838 END IF;
122839 END IF;
122840 END IF;
122841 --
122842 --
122843 ------------------------------------------------------------------------------------------------
122844 -- 4219869 Business Flow
122845 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
122846 -- Prior Entry. Currently, the following code is always generated.
122847 ------------------------------------------------------------------------------------------------
122848 XLA_AE_LINES_PKG.ValidateCurrentLine;
122849
122850 ------------------------------------------------------------------------------------
122851 -- 4219869 Business Flow
122852 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
122853 ------------------------------------------------------------------------------------
122854 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
122855
122856 ----------------------------------------------------------------------------------
122857 -- 4219869 Business Flow
122858 -- Update journal entry status -- Need to generate this within IF <condition>
122859 ----------------------------------------------------------------------------------
122860 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
122861 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
122862 ,p_balance_type_code => l_balance_type_code
122863 );
122864
122865 -------------------------------------------------------------------------------------------
122866 -- 4262811 - Generate the Accrual Reversal lines
122867 -------------------------------------------------------------------------------------------
122868 BEGIN
122869 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
122870 (g_array_event(p_event_id).array_value_num('header_index'));
122871 IF l_acc_rev_flag IS NULL THEN
122872 l_acc_rev_flag := 'N';
122873 END IF;
122874 EXCEPTION
122875 WHEN OTHERS THEN
122876 l_acc_rev_flag := 'N';
122877 END;
122878 --
122879 IF (l_acc_rev_flag = 'Y') THEN
122880
122881 -- 4645092 ------------------------------------------------------------------------------
122882 -- To allow MPA report to determine if it should generate report process
122883 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
122884 ------------------------------------------------------------------------------------------
122885
122886 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
122887 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
122888 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
122889 -- call ADRs
122890 -- Bug 4922099
122891 --
122892 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
122893 (NVL(l_actual_upg_option, 'N') = 'O') OR
122894 (NVL(l_enc_upg_option, 'N') = 'O')
122895 )
122896 THEN
122897 NULL;
122898 --
122899 --
122900
122901 l_ccid := AcctDerRule_175(
122902 p_application_id => p_application_id
122903 , p_ae_header_id => l_ae_header_id
122904 , p_source_5 => p_source_5
122905 , p_source_19 => p_source_19
122906 , p_source_32 => p_source_32
122907 , x_transaction_coa_id => l_adr_transaction_coa_id
122908 , x_accounting_coa_id => l_adr_accounting_coa_id
122909 , x_value_type_code => l_adr_value_type_code
122910 , p_side => 'NA'
122911 );
122912
122913 xla_ae_lines_pkg.set_ccid(
122914 p_code_combination_id => l_ccid
122915 , p_value_type_code => l_adr_value_type_code
122916 , p_transaction_coa_id => l_adr_transaction_coa_id
122917 , p_accounting_coa_id => l_adr_accounting_coa_id
122918 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
122919 , p_adr_type_code => 'S'
122920 , p_component_type => l_component_type
122921 , p_component_code => l_component_code
122922 , p_component_type_code => l_component_type_code
122923 , p_component_appl_id => l_component_appl_id
122924 , p_amb_context_code => l_amb_context_code
122925 , p_side => 'NA'
122926 );
122927
122928
122929 l_segment := AcctDerRule_151(
122930 p_application_id => p_application_id
122934 , x_transaction_coa_id => l_adr_transaction_coa_id
122931 , p_ae_header_id => l_ae_header_id
122932 , p_source_5 => p_source_5
122933 , p_source_13 => p_source_13
122935 , x_accounting_coa_id => l_adr_accounting_coa_id
122936 , x_flexfield_segment_code => l_adr_flexfield_segment_code
122937 , x_flex_value_set_id => l_adr_flex_value_set_id
122938 , x_value_type_code => l_adr_value_type_code
122939 , x_value_combination_id => l_adr_value_combination_id
122940 , x_value_segment_code => l_adr_value_segment_code
122941 , p_side => 'NA'
122942 , p_override_seg_flag => 'Y'
122943 );
122944
122945 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
122946
122947 xla_ae_lines_pkg.set_segment(
122948 p_to_segment_code => 'GL_ACCOUNT'
122949 , p_segment_value => l_segment
122950 , p_from_segment_code => l_adr_value_segment_code
122951 , p_from_combination_id => l_adr_value_combination_id
122952 , p_value_type_code => l_adr_value_type_code
122953 , p_transaction_coa_id => l_adr_transaction_coa_id
122954 , p_accounting_coa_id => l_adr_accounting_coa_id
122955 , p_flexfield_segment_code => l_adr_flexfield_segment_code
122956 , p_flex_value_set_id => l_adr_flex_value_set_id
122957 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
122958 , p_adr_type_code => 'S'
122959 , p_component_type => l_component_type
122960 , p_component_code => l_component_code
122961 , p_component_type_code => l_component_type_code
122962 , p_component_appl_id => l_component_appl_id
122963 , p_amb_context_code => l_amb_context_code
122964 , p_entity_code => 'TRANSACTIONS'
122965 , p_event_class_code => 'REVALUATION'
122966 , p_side => 'NA'
122967 );
122968
122969 END IF;
122970
122971 l_segment := AcctDerRule_169(
122972 p_application_id => p_application_id
122973 , p_ae_header_id => l_ae_header_id
122974 , p_source_5 => p_source_5
122975 , p_source_31 => p_source_31
122976 , x_transaction_coa_id => l_adr_transaction_coa_id
122977 , x_accounting_coa_id => l_adr_accounting_coa_id
122978 , x_flexfield_segment_code => l_adr_flexfield_segment_code
122979 , x_flex_value_set_id => l_adr_flex_value_set_id
122980 , x_value_type_code => l_adr_value_type_code
122981 , x_value_combination_id => l_adr_value_combination_id
122982 , x_value_segment_code => l_adr_value_segment_code
122983 , p_side => 'NA'
122984 , p_override_seg_flag => 'Y'
122985 );
122986
122987 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
122988
122989 xla_ae_lines_pkg.set_segment(
122990 p_to_segment_code => 'GL_BALANCING'
122991 , p_segment_value => l_segment
122992 , p_from_segment_code => l_adr_value_segment_code
122993 , p_from_combination_id => l_adr_value_combination_id
122994 , p_value_type_code => l_adr_value_type_code
122995 , p_transaction_coa_id => l_adr_transaction_coa_id
122996 , p_accounting_coa_id => l_adr_accounting_coa_id
122997 , p_flexfield_segment_code => l_adr_flexfield_segment_code
122998 , p_flex_value_set_id => l_adr_flex_value_set_id
122999 , p_adr_code => 'FA_EXPENSE_ACCT'
123000 , p_adr_type_code => 'S'
123001 , p_component_type => l_component_type
123002 , p_component_code => l_component_code
123003 , p_component_type_code => l_component_type_code
123004 , p_component_appl_id => l_component_appl_id
123005 , p_amb_context_code => l_amb_context_code
123006 , p_entity_code => 'TRANSACTIONS'
123007 , p_event_class_code => 'REVALUATION'
123008 , p_side => 'NA'
123009 );
123010
123011 END IF;
123012
123013 --
123014 --
123015 END IF;
123016
123017 --
123018 -- Update the line information that should be overwritten
123019 --
123020 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
123021 p_header_num => 1);
123022 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
123023
123024 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
123025
123026 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
123027 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
123028 END IF;
123029
123030 --
123031 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
123032 --
123033 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
123034 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
123035 ELSE
123036 ---------------------------------------------------------------------------------------------------
123037 -- 4262811a Switch Sign
123041 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
123038 ---------------------------------------------------------------------------------------------------
123039 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
123040 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
123042 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
123043 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
123044 -- 5132302
123045 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
123046 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
123047
123048 END IF;
123049
123050 -- 4955764
123051 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
123052 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
123053
123054
123055 XLA_AE_LINES_PKG.ValidateCurrentLine;
123056 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
123057
123058 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
123059 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
123060 ,p_balance_type_code => l_balance_type_code);
123061
123062 END IF;
123063
123064 -----------------------------------------------------------------------------------------
123065 -- 4262811 Multiperiod Accounting
123066 -----------------------------------------------------------------------------------------
123067 -- No MPA option is assigned.
123068
123069
123070 END IF;
123071 END IF;
123072 --
123073
123074 --
123075 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
123076 trace
123077 (p_msg => 'END of AcctLineType_336'
123078 ,p_level => C_LEVEL_PROCEDURE
123079 ,p_module => l_log_module);
123080 END IF;
123081 --
123082 EXCEPTION
123083 WHEN xla_exceptions_pkg.application_exception THEN
123084 RAISE;
123085 WHEN OTHERS THEN
123086 xla_exceptions_pkg.raise_message
123087 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_336');
123088 END AcctLineType_336;
123089 --
123090
123091 ---------------------------------------
123092 --
123093 -- PRIVATE FUNCTION
123094 -- AcctLineType_337
123095 --
123096 ---------------------------------------
123097 PROCEDURE AcctLineType_337 (
123098 p_application_id IN NUMBER
123099 ,p_event_id IN NUMBER
123100 ,p_calculate_acctd_flag IN VARCHAR2
123101 ,p_calculate_g_l_flag IN VARCHAR2
123102 ,p_actual_flag IN OUT VARCHAR2
123103 ,p_balance_type_code OUT VARCHAR2
123104 ,p_gain_or_loss_ref OUT VARCHAR2
123105
123106 --Period Close Date
123107 , p_source_1 IN DATE
123108 --Generated Code Combination Identifier
123109 , p_source_5 IN NUMBER
123110 --Depreciation Reserve Account
123111 , p_source_12 IN VARCHAR2
123112 --Generated Offset Code Combination Identifier
123113 , p_source_19 IN NUMBER
123114 --Expense Account Code Combination Identifier
123115 , p_source_31 IN NUMBER
123116 --Default Code Combination Identifier
123117 , p_source_32 IN NUMBER
123118 --Adjustment Type
123119 , p_source_48 IN VARCHAR2
123120 --Transaction Header Identifier
123121 , p_source_49 IN NUMBER
123122 --Adjustment Line Identifier
123123 , p_source_50 IN NUMBER
123124 --Distribution Type Code
123125 , p_source_51 IN VARCHAR2
123126 --Entered Amount
123127 , p_source_52 IN NUMBER
123128 --Currency Code
123129 , p_source_53 IN VARCHAR2
123130 )
123131 IS
123132
123133 l_component_type VARCHAR2(80);
123134 l_component_code VARCHAR2(30);
123135 l_component_type_code VARCHAR2(1);
123136 l_component_appl_id INTEGER;
123137 l_amb_context_code VARCHAR2(30);
123138 l_entity_code VARCHAR2(30);
123139 l_event_class_code VARCHAR2(30);
123140 l_ae_header_id NUMBER;
123141 l_event_type_code VARCHAR2(30);
123142 l_line_definition_code VARCHAR2(30);
123143 l_line_definition_owner_code VARCHAR2(1);
123144 --
123145 -- adr variables
123146 l_segment VARCHAR2(30);
123147 l_ccid NUMBER;
123148 l_adr_transaction_coa_id NUMBER;
123149 l_adr_accounting_coa_id NUMBER;
123150 l_adr_flexfield_segment_code VARCHAR2(30);
123151 l_adr_flex_value_set_id NUMBER;
123152 l_adr_value_type_code VARCHAR2(30);
123153 l_adr_value_combination_id NUMBER;
123154 l_adr_value_segment_code VARCHAR2(30);
123155
123156 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
123157 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
123158 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
123159 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
123160
123161 -- 4262811 Variables ------------------------------------------------------------------------------------------
123162 l_entered_amt_idx NUMBER;
123163 l_accted_amt_idx NUMBER;
123164 l_acc_rev_flag VARCHAR2(1);
123165 l_accrual_line_num NUMBER;
123166 l_tmp_amt NUMBER;
123170 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
123167 l_acc_rev_natural_side_code VARCHAR2(1);
123168
123169 l_num_entries NUMBER;
123171 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
123172 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
123173 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
123174 l_recog_line_1 NUMBER;
123175 l_recog_line_2 NUMBER;
123176
123177 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
123178 l_bflow_applied_to_amt NUMBER; -- 5132302
123179 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
123180
123181 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
123182
123183 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
123184 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
123185
123186 ---------------------------------------------------------------------------------------------------------------
123187
123188
123189 --
123190 -- bulk performance
123191 --
123192 l_balance_type_code VARCHAR2(1);
123193 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
123194 l_log_module VARCHAR2(240);
123195
123196 --
123197 -- Upgrade strategy
123198 --
123199 l_actual_upg_option VARCHAR2(1);
123200 l_enc_upg_option VARCHAR2(1);
123201
123202 --
123203 BEGIN
123204 --
123205 IF g_log_enabled THEN
123206 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_337';
123207 END IF;
123208 --
123209 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
123210
123211 trace
123212 (p_msg => 'BEGIN of AcctLineType_337'
123213 ,p_level => C_LEVEL_PROCEDURE
123214 ,p_module => l_log_module);
123215
123216 END IF;
123217 --
123218 l_component_type := 'AMB_JLT';
123219 l_component_code := 'FA_REVAL_RESERVE_BAL';
123220 l_component_type_code := 'S';
123221 l_component_appl_id := 140;
123222 l_amb_context_code := 'DEFAULT';
123223 l_entity_code := 'TRANSACTIONS';
123224 l_event_class_code := 'REVALUATION';
123225 l_event_type_code := 'REVALUATION_ALL';
123226 l_line_definition_owner_code := 'S';
123227 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVAL21';
123228 --
123229 l_balance_type_code := 'A';
123230 l_segment := NULL;
123231 l_ccid := NULL;
123232 l_adr_transaction_coa_id := NULL;
123233 l_adr_accounting_coa_id := NULL;
123234 l_adr_flexfield_segment_code := NULL;
123235 l_adr_flex_value_set_id := NULL;
123236 l_adr_value_type_code := NULL;
123237 l_adr_value_combination_id := NULL;
123238 l_adr_value_segment_code := NULL;
123239
123240 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
123241 l_bflow_class_code := ''; -- 4219869 Business Flow
123242 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
123243 l_budgetary_control_flag := 'N';
123244
123245 l_bflow_applied_to_amt_idx := NULL; -- 5132302
123246 l_bflow_applied_to_amt := NULL; -- 5132302
123247 l_entered_amt_idx := NULL; -- 4262811
123248 l_accted_amt_idx := NULL; -- 4262811
123249 l_acc_rev_flag := NULL; -- 4262811
123250 l_accrual_line_num := NULL; -- 4262811
123251 l_tmp_amt := NULL; -- 4262811
123252 --
123253
123254 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
123255 l_balance_type_code <> 'B' THEN
123256 IF NVL(p_source_48,'
123257 ') = 'BONUS RESERVE'
123258 THEN
123259
123260 --
123261 XLA_AE_LINES_PKG.SetNewLine;
123262
123263 p_balance_type_code := l_balance_type_code;
123264 -- set the flag so later we will know whether the gain loss line needs to be created
123265
123266 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
123267 p_actual_flag :='A';
123268 END IF;
123269
123270 --
123271 -- bulk performance
123272 --
123273 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
123274 p_header_num => 0); -- 4262811
123275 --
123276 -- set accounting line options
123277 --
123278 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
123279 p_natural_side_code => 'D'
123280 , p_gain_or_loss_flag => 'N'
123281 , p_gl_transfer_mode_code => 'S'
123282 , p_acct_entry_type_code => 'A'
123283 , p_switch_side_flag => 'Y'
123284 , p_merge_duplicate_code => 'N'
123285 );
123286 --
123287 l_acc_rev_natural_side_code := 'C'; -- 4262811
123288 --
123289 --
123290 -- set accounting line type info
123291 --
123292 xla_ae_lines_pkg.SetAcctLineType
123293 (p_component_type => l_component_type
123294 ,p_event_type_code => l_event_type_code
123295 ,p_line_definition_owner_code => l_line_definition_owner_code
123296 ,p_line_definition_code => l_line_definition_code
123297 ,p_accounting_line_code => l_component_code
123301 ,p_entity_code => l_entity_code
123298 ,p_accounting_line_type_code => l_component_type_code
123299 ,p_accounting_line_appl_id => l_component_appl_id
123300 ,p_amb_context_code => l_amb_context_code
123302 ,p_event_class_code => l_event_class_code);
123303 --
123304 -- set accounting class
123305 --
123306 xla_ae_lines_pkg.SetAcctClass(
123307 p_accounting_class_code => 'ASSET'
123308 , p_ae_header_id => l_ae_header_id
123309 );
123310
123311 --
123312 -- set rounding class
123313 --
123314 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
123315 'ASSET';
123316
123317 --
123318 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
123319 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
123320 --
123321 -- bulk performance
123322 --
123323 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
123324
123325 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
123326 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
123327
123328 -- 4955764
123329 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
123330 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
123331
123332 -- 4458381 Public Sector Enh
123333
123334 --
123335 -- set accounting attributes for the line type
123336 --
123337 l_entered_amt_idx := 4;
123338 l_accted_amt_idx := 6;
123339 l_bflow_applied_to_amt_idx := NULL; -- 5132302
123340 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
123341 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
123342 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
123343 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
123344 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
123345 l_rec_acct_attrs.array_char_value(3) := p_source_51;
123346 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
123347 l_rec_acct_attrs.array_num_value(4) := p_source_52;
123348 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
123349 l_rec_acct_attrs.array_char_value(5) := p_source_53;
123350 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
123351 l_rec_acct_attrs.array_num_value(6) := p_source_52;
123352
123353 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
123354 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
123355
123356 ---------------------------------------------------------------------------------------------------------------
123357 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
123358 ---------------------------------------------------------------------------------------------------------------
123359 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
123360
123361 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
123362 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
123363
123364 IF xla_accounting_cache_pkg.GetValueChar
123365 (p_source_code => 'LEDGER_CATEGORY_CODE'
123366 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
123367 AND l_bflow_method_code = 'PRIOR_ENTRY'
123368 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
123369 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
123370 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
123371 )
123372 THEN
123373 xla_ae_lines_pkg.BflowUpgEntry
123374 (p_business_method_code => l_bflow_method_code
123375 ,p_business_class_code => l_bflow_class_code
123376 ,p_balance_type => l_balance_type_code);
123377 ELSE
123378 NULL;
123379 -- No business flow processing for business flow method of NONE.
123380 END IF;
123381
123382 --
123383 -- call analytical criteria
123384 --
123385
123386 --
123387 -- call description
123388 --
123389
123390 xla_ae_lines_pkg.SetLineDescription(
123391 p_ae_header_id => l_ae_header_id
123392 ,p_description => Description_94 (
123393 p_application_id => p_application_id
123394 , p_ae_header_id => l_ae_header_id
123395 , p_source_1 => p_source_1
123396 )
123397 );
123398
123399
123400 --
123401 -- call ADRs
123402 -- Bug 4922099
123403 --
123404 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
123405 (NVL(l_actual_upg_option, 'N') = 'O') OR
123406 (NVL(l_enc_upg_option, 'N') = 'O')
123407 )
123408 THEN
123409 NULL;
123410 --
123411 --
123412
123413 l_ccid := AcctDerRule_175(
123414 p_application_id => p_application_id
123415 , p_ae_header_id => l_ae_header_id
123416 , p_source_5 => p_source_5
123417 , p_source_19 => p_source_19
123418 , p_source_32 => p_source_32
123419 , x_transaction_coa_id => l_adr_transaction_coa_id
123423 );
123420 , x_accounting_coa_id => l_adr_accounting_coa_id
123421 , x_value_type_code => l_adr_value_type_code
123422 , p_side => 'NA'
123424
123425 xla_ae_lines_pkg.set_ccid(
123426 p_code_combination_id => l_ccid
123427 , p_value_type_code => l_adr_value_type_code
123428 , p_transaction_coa_id => l_adr_transaction_coa_id
123429 , p_accounting_coa_id => l_adr_accounting_coa_id
123430 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
123431 , p_adr_type_code => 'S'
123432 , p_component_type => l_component_type
123433 , p_component_code => l_component_code
123434 , p_component_type_code => l_component_type_code
123435 , p_component_appl_id => l_component_appl_id
123436 , p_amb_context_code => l_amb_context_code
123437 , p_side => 'NA'
123438 );
123439
123440
123441 l_segment := AcctDerRule_150(
123442 p_application_id => p_application_id
123443 , p_ae_header_id => l_ae_header_id
123444 , p_source_5 => p_source_5
123445 , p_source_12 => p_source_12
123446 , x_transaction_coa_id => l_adr_transaction_coa_id
123447 , x_accounting_coa_id => l_adr_accounting_coa_id
123448 , x_flexfield_segment_code => l_adr_flexfield_segment_code
123449 , x_flex_value_set_id => l_adr_flex_value_set_id
123450 , x_value_type_code => l_adr_value_type_code
123451 , x_value_combination_id => l_adr_value_combination_id
123452 , x_value_segment_code => l_adr_value_segment_code
123453 , p_side => 'NA'
123454 , p_override_seg_flag => 'Y'
123455 );
123456
123457 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
123458
123459 xla_ae_lines_pkg.set_segment(
123460 p_to_segment_code => 'GL_ACCOUNT'
123461 , p_segment_value => l_segment
123462 , p_from_segment_code => l_adr_value_segment_code
123463 , p_from_combination_id => l_adr_value_combination_id
123464 , p_value_type_code => l_adr_value_type_code
123465 , p_transaction_coa_id => l_adr_transaction_coa_id
123466 , p_accounting_coa_id => l_adr_accounting_coa_id
123467 , p_flexfield_segment_code => l_adr_flexfield_segment_code
123468 , p_flex_value_set_id => l_adr_flex_value_set_id
123469 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
123470 , p_adr_type_code => 'S'
123471 , p_component_type => l_component_type
123472 , p_component_code => l_component_code
123473 , p_component_type_code => l_component_type_code
123474 , p_component_appl_id => l_component_appl_id
123475 , p_amb_context_code => l_amb_context_code
123476 , p_entity_code => 'TRANSACTIONS'
123477 , p_event_class_code => 'REVALUATION'
123478 , p_side => 'NA'
123479 );
123480
123481 END IF;
123482
123483 l_segment := AcctDerRule_169(
123484 p_application_id => p_application_id
123485 , p_ae_header_id => l_ae_header_id
123486 , p_source_5 => p_source_5
123487 , p_source_31 => p_source_31
123488 , x_transaction_coa_id => l_adr_transaction_coa_id
123489 , x_accounting_coa_id => l_adr_accounting_coa_id
123490 , x_flexfield_segment_code => l_adr_flexfield_segment_code
123491 , x_flex_value_set_id => l_adr_flex_value_set_id
123492 , x_value_type_code => l_adr_value_type_code
123493 , x_value_combination_id => l_adr_value_combination_id
123494 , x_value_segment_code => l_adr_value_segment_code
123495 , p_side => 'NA'
123496 , p_override_seg_flag => 'Y'
123497 );
123498
123499 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
123500
123501 xla_ae_lines_pkg.set_segment(
123502 p_to_segment_code => 'GL_BALANCING'
123503 , p_segment_value => l_segment
123504 , p_from_segment_code => l_adr_value_segment_code
123505 , p_from_combination_id => l_adr_value_combination_id
123506 , p_value_type_code => l_adr_value_type_code
123507 , p_transaction_coa_id => l_adr_transaction_coa_id
123508 , p_accounting_coa_id => l_adr_accounting_coa_id
123509 , p_flexfield_segment_code => l_adr_flexfield_segment_code
123510 , p_flex_value_set_id => l_adr_flex_value_set_id
123511 , p_adr_code => 'FA_EXPENSE_ACCT'
123512 , p_adr_type_code => 'S'
123513 , p_component_type => l_component_type
123514 , p_component_code => l_component_code
123515 , p_component_type_code => l_component_type_code
123516 , p_component_appl_id => l_component_appl_id
123517 , p_amb_context_code => l_amb_context_code
123518 , p_entity_code => 'TRANSACTIONS'
123519 , p_event_class_code => 'REVALUATION'
123520 , p_side => 'NA'
123521 );
123522
123523 END IF;
123524
123525 --
123526 --
123527 END IF;
123528 --
123529 -- Bug 4922099
123530 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
123534 )
123531 (NVL(l_enc_upg_option, 'N') = 'O')
123532 ) AND
123533 (l_bflow_method_code = 'PRIOR_ENTRY')
123535 THEN
123536 IF
123537 --
123538 1 = 2
123539 --
123540 THEN
123541 xla_accounting_err_pkg.build_message
123542 (p_appli_s_name => 'XLA'
123543 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
123544 ,p_token_1 => 'LINE_NUMBER'
123545 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
123546 ,p_token_2 => 'LINE_TYPE_NAME'
123547 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
123548 l_component_type
123549 ,l_component_code
123550 ,l_component_type_code
123551 ,l_component_appl_id
123552 ,l_amb_context_code
123553 ,l_entity_code
123554 ,l_event_class_code
123555 )
123556 ,p_token_3 => 'OWNER'
123557 ,p_value_3 => xla_lookups_pkg.get_meaning(
123558 p_lookup_type => 'XLA_OWNER_TYPE'
123559 ,p_lookup_code => l_component_type_code
123560 )
123561 ,p_token_4 => 'PRODUCT_NAME'
123562 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
123563 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
123564 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
123565 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
123566 ,p_ae_header_id => NULL
123567 );
123568
123569 IF (C_LEVEL_ERROR>= g_log_level) THEN
123570 trace
123571 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
123572 ,p_level => C_LEVEL_ERROR
123573 ,p_module => l_log_module);
123574 END IF;
123575 END IF;
123576 END IF;
123577 --
123578 --
123579 ------------------------------------------------------------------------------------------------
123580 -- 4219869 Business Flow
123581 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
123582 -- Prior Entry. Currently, the following code is always generated.
123583 ------------------------------------------------------------------------------------------------
123584 XLA_AE_LINES_PKG.ValidateCurrentLine;
123585
123586 ------------------------------------------------------------------------------------
123587 -- 4219869 Business Flow
123588 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
123589 ------------------------------------------------------------------------------------
123590 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
123591
123592 ----------------------------------------------------------------------------------
123593 -- 4219869 Business Flow
123594 -- Update journal entry status -- Need to generate this within IF <condition>
123595 ----------------------------------------------------------------------------------
123596 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
123597 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
123598 ,p_balance_type_code => l_balance_type_code
123599 );
123600
123601 -------------------------------------------------------------------------------------------
123602 -- 4262811 - Generate the Accrual Reversal lines
123603 -------------------------------------------------------------------------------------------
123604 BEGIN
123605 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
123606 (g_array_event(p_event_id).array_value_num('header_index'));
123607 IF l_acc_rev_flag IS NULL THEN
123608 l_acc_rev_flag := 'N';
123609 END IF;
123610 EXCEPTION
123611 WHEN OTHERS THEN
123612 l_acc_rev_flag := 'N';
123613 END;
123614 --
123615 IF (l_acc_rev_flag = 'Y') THEN
123616
123617 -- 4645092 ------------------------------------------------------------------------------
123618 -- To allow MPA report to determine if it should generate report process
123619 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
123620 ------------------------------------------------------------------------------------------
123621
123622 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
123623 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
123627 --
123624 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
123625 -- call ADRs
123626 -- Bug 4922099
123628 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
123629 (NVL(l_actual_upg_option, 'N') = 'O') OR
123630 (NVL(l_enc_upg_option, 'N') = 'O')
123631 )
123632 THEN
123633 NULL;
123634 --
123635 --
123636
123637 l_ccid := AcctDerRule_175(
123638 p_application_id => p_application_id
123639 , p_ae_header_id => l_ae_header_id
123640 , p_source_5 => p_source_5
123641 , p_source_19 => p_source_19
123642 , p_source_32 => p_source_32
123643 , x_transaction_coa_id => l_adr_transaction_coa_id
123644 , x_accounting_coa_id => l_adr_accounting_coa_id
123645 , x_value_type_code => l_adr_value_type_code
123646 , p_side => 'NA'
123647 );
123648
123649 xla_ae_lines_pkg.set_ccid(
123650 p_code_combination_id => l_ccid
123651 , p_value_type_code => l_adr_value_type_code
123652 , p_transaction_coa_id => l_adr_transaction_coa_id
123653 , p_accounting_coa_id => l_adr_accounting_coa_id
123654 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
123655 , p_adr_type_code => 'S'
123656 , p_component_type => l_component_type
123657 , p_component_code => l_component_code
123658 , p_component_type_code => l_component_type_code
123659 , p_component_appl_id => l_component_appl_id
123660 , p_amb_context_code => l_amb_context_code
123661 , p_side => 'NA'
123662 );
123663
123664
123665 l_segment := AcctDerRule_150(
123666 p_application_id => p_application_id
123667 , p_ae_header_id => l_ae_header_id
123668 , p_source_5 => p_source_5
123669 , p_source_12 => p_source_12
123670 , x_transaction_coa_id => l_adr_transaction_coa_id
123671 , x_accounting_coa_id => l_adr_accounting_coa_id
123672 , x_flexfield_segment_code => l_adr_flexfield_segment_code
123673 , x_flex_value_set_id => l_adr_flex_value_set_id
123674 , x_value_type_code => l_adr_value_type_code
123675 , x_value_combination_id => l_adr_value_combination_id
123676 , x_value_segment_code => l_adr_value_segment_code
123677 , p_side => 'NA'
123678 , p_override_seg_flag => 'Y'
123679 );
123680
123681 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
123682
123683 xla_ae_lines_pkg.set_segment(
123684 p_to_segment_code => 'GL_ACCOUNT'
123685 , p_segment_value => l_segment
123686 , p_from_segment_code => l_adr_value_segment_code
123687 , p_from_combination_id => l_adr_value_combination_id
123688 , p_value_type_code => l_adr_value_type_code
123689 , p_transaction_coa_id => l_adr_transaction_coa_id
123690 , p_accounting_coa_id => l_adr_accounting_coa_id
123691 , p_flexfield_segment_code => l_adr_flexfield_segment_code
123692 , p_flex_value_set_id => l_adr_flex_value_set_id
123693 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
123694 , p_adr_type_code => 'S'
123695 , p_component_type => l_component_type
123696 , p_component_code => l_component_code
123697 , p_component_type_code => l_component_type_code
123698 , p_component_appl_id => l_component_appl_id
123699 , p_amb_context_code => l_amb_context_code
123700 , p_entity_code => 'TRANSACTIONS'
123701 , p_event_class_code => 'REVALUATION'
123702 , p_side => 'NA'
123703 );
123704
123705 END IF;
123706
123707 l_segment := AcctDerRule_169(
123708 p_application_id => p_application_id
123709 , p_ae_header_id => l_ae_header_id
123710 , p_source_5 => p_source_5
123711 , p_source_31 => p_source_31
123712 , x_transaction_coa_id => l_adr_transaction_coa_id
123713 , x_accounting_coa_id => l_adr_accounting_coa_id
123714 , x_flexfield_segment_code => l_adr_flexfield_segment_code
123715 , x_flex_value_set_id => l_adr_flex_value_set_id
123716 , x_value_type_code => l_adr_value_type_code
123717 , x_value_combination_id => l_adr_value_combination_id
123718 , x_value_segment_code => l_adr_value_segment_code
123719 , p_side => 'NA'
123720 , p_override_seg_flag => 'Y'
123721 );
123722
123723 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
123724
123725 xla_ae_lines_pkg.set_segment(
123726 p_to_segment_code => 'GL_BALANCING'
123727 , p_segment_value => l_segment
123728 , p_from_segment_code => l_adr_value_segment_code
123729 , p_from_combination_id => l_adr_value_combination_id
123730 , p_value_type_code => l_adr_value_type_code
123731 , p_transaction_coa_id => l_adr_transaction_coa_id
123732 , p_accounting_coa_id => l_adr_accounting_coa_id
123733 , p_flexfield_segment_code => l_adr_flexfield_segment_code
123734 , p_flex_value_set_id => l_adr_flex_value_set_id
123735 , p_adr_code => 'FA_EXPENSE_ACCT'
123736 , p_adr_type_code => 'S'
123740 , p_component_appl_id => l_component_appl_id
123737 , p_component_type => l_component_type
123738 , p_component_code => l_component_code
123739 , p_component_type_code => l_component_type_code
123741 , p_amb_context_code => l_amb_context_code
123742 , p_entity_code => 'TRANSACTIONS'
123743 , p_event_class_code => 'REVALUATION'
123744 , p_side => 'NA'
123745 );
123746
123747 END IF;
123748
123749 --
123750 --
123751 END IF;
123752
123753 --
123754 -- Update the line information that should be overwritten
123755 --
123756 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
123757 p_header_num => 1);
123758 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
123759
123760 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
123761
123762 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
123763 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
123764 END IF;
123765
123766 --
123767 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
123768 --
123769 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
123770 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
123771 ELSE
123772 ---------------------------------------------------------------------------------------------------
123773 -- 4262811a Switch Sign
123774 ---------------------------------------------------------------------------------------------------
123775 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
123776 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
123777 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
123778 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
123779 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
123780 -- 5132302
123781 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
123782 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
123783
123784 END IF;
123785
123786 -- 4955764
123787 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
123788 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
123789
123790
123791 XLA_AE_LINES_PKG.ValidateCurrentLine;
123792 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
123793
123794 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
123795 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
123796 ,p_balance_type_code => l_balance_type_code);
123797
123798 END IF;
123799
123800 -----------------------------------------------------------------------------------------
123801 -- 4262811 Multiperiod Accounting
123802 -----------------------------------------------------------------------------------------
123803 -- No MPA option is assigned.
123804
123805
123806 END IF;
123807 END IF;
123808 --
123809
123810 --
123811 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
123812 trace
123813 (p_msg => 'END of AcctLineType_337'
123814 ,p_level => C_LEVEL_PROCEDURE
123815 ,p_module => l_log_module);
123816 END IF;
123817 --
123818 EXCEPTION
123819 WHEN xla_exceptions_pkg.application_exception THEN
123820 RAISE;
123821 WHEN OTHERS THEN
123822 xla_exceptions_pkg.raise_message
123823 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_337');
123824 END AcctLineType_337;
123825 --
123826
123827 ---------------------------------------
123828 --
123829 -- PRIVATE FUNCTION
123830 -- AcctLineType_338
123831 --
123832 ---------------------------------------
123833 PROCEDURE AcctLineType_338 (
123834 p_application_id IN NUMBER
123835 ,p_event_id IN NUMBER
123836 ,p_calculate_acctd_flag IN VARCHAR2
123837 ,p_calculate_g_l_flag IN VARCHAR2
123838 ,p_actual_flag IN OUT VARCHAR2
123839 ,p_balance_type_code OUT VARCHAR2
123840 ,p_gain_or_loss_ref OUT VARCHAR2
123841
123842 --Period Close Date
123843 , p_source_1 IN DATE
123844 --Generated Code Combination Identifier
123845 , p_source_5 IN NUMBER
123846 --CIP Cost Account
123847 , p_source_9 IN VARCHAR2
123848 --Expense Account Code Combination Identifier
123849 , p_source_31 IN NUMBER
123850 --Default Code Combination Identifier
123851 , p_source_32 IN NUMBER
123852 --Adjustment Type
123853 , p_source_48 IN VARCHAR2
123854 --Transaction Header Identifier
123855 , p_source_49 IN NUMBER
123856 --Adjustment Line Identifier
123857 , p_source_50 IN NUMBER
123858 --Distribution Type Code
123859 , p_source_51 IN VARCHAR2
123860 --Entered Amount
123864 )
123861 , p_source_52 IN NUMBER
123862 --Currency Code
123863 , p_source_53 IN VARCHAR2
123865 IS
123866
123867 l_component_type VARCHAR2(80);
123868 l_component_code VARCHAR2(30);
123869 l_component_type_code VARCHAR2(1);
123870 l_component_appl_id INTEGER;
123871 l_amb_context_code VARCHAR2(30);
123872 l_entity_code VARCHAR2(30);
123873 l_event_class_code VARCHAR2(30);
123874 l_ae_header_id NUMBER;
123875 l_event_type_code VARCHAR2(30);
123876 l_line_definition_code VARCHAR2(30);
123877 l_line_definition_owner_code VARCHAR2(1);
123878 --
123879 -- adr variables
123880 l_segment VARCHAR2(30);
123881 l_ccid NUMBER;
123882 l_adr_transaction_coa_id NUMBER;
123883 l_adr_accounting_coa_id NUMBER;
123884 l_adr_flexfield_segment_code VARCHAR2(30);
123885 l_adr_flex_value_set_id NUMBER;
123886 l_adr_value_type_code VARCHAR2(30);
123887 l_adr_value_combination_id NUMBER;
123888 l_adr_value_segment_code VARCHAR2(30);
123889
123890 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
123891 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
123892 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
123893 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
123894
123895 -- 4262811 Variables ------------------------------------------------------------------------------------------
123896 l_entered_amt_idx NUMBER;
123897 l_accted_amt_idx NUMBER;
123898 l_acc_rev_flag VARCHAR2(1);
123899 l_accrual_line_num NUMBER;
123900 l_tmp_amt NUMBER;
123901 l_acc_rev_natural_side_code VARCHAR2(1);
123902
123903 l_num_entries NUMBER;
123904 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
123905 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
123906 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
123907 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
123908 l_recog_line_1 NUMBER;
123909 l_recog_line_2 NUMBER;
123910
123911 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
123912 l_bflow_applied_to_amt NUMBER; -- 5132302
123913 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
123914
123915 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
123916
123917 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
123918 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
123919
123920 ---------------------------------------------------------------------------------------------------------------
123921
123922
123923 --
123924 -- bulk performance
123925 --
123926 l_balance_type_code VARCHAR2(1);
123927 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
123928 l_log_module VARCHAR2(240);
123929
123930 --
123931 -- Upgrade strategy
123932 --
123933 l_actual_upg_option VARCHAR2(1);
123934 l_enc_upg_option VARCHAR2(1);
123935
123936 --
123937 BEGIN
123938 --
123939 IF g_log_enabled THEN
123940 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_338';
123941 END IF;
123942 --
123943 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
123944
123945 trace
123946 (p_msg => 'BEGIN of AcctLineType_338'
123947 ,p_level => C_LEVEL_PROCEDURE
123948 ,p_module => l_log_module);
123949
123950 END IF;
123951 --
123952 l_component_type := 'AMB_JLT';
123953 l_component_code := 'FA_REV_ASSET_CIP_COST';
123954 l_component_type_code := 'S';
123955 l_component_appl_id := 140;
123956 l_amb_context_code := 'DEFAULT';
123957 l_entity_code := 'TRANSACTIONS';
123958 l_event_class_code := 'CAPITALIZATION';
123959 l_event_type_code := 'REVERSE_CAPITALIZATION';
123960 l_line_definition_owner_code := 'S';
123961 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVER22';
123962 --
123963 l_balance_type_code := 'A';
123964 l_segment := NULL;
123965 l_ccid := NULL;
123966 l_adr_transaction_coa_id := NULL;
123967 l_adr_accounting_coa_id := NULL;
123968 l_adr_flexfield_segment_code := NULL;
123969 l_adr_flex_value_set_id := NULL;
123970 l_adr_value_type_code := NULL;
123971 l_adr_value_combination_id := NULL;
123972 l_adr_value_segment_code := NULL;
123973
123974 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
123975 l_bflow_class_code := ''; -- 4219869 Business Flow
123976 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
123977 l_budgetary_control_flag := 'N';
123978
123979 l_bflow_applied_to_amt_idx := NULL; -- 5132302
123980 l_bflow_applied_to_amt := NULL; -- 5132302
123981 l_entered_amt_idx := NULL; -- 4262811
123982 l_accted_amt_idx := NULL; -- 4262811
123983 l_acc_rev_flag := NULL; -- 4262811
123984 l_accrual_line_num := NULL; -- 4262811
123985 l_tmp_amt := NULL; -- 4262811
123986 --
123987
123991 ') = 'CIP COST'
123988 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
123989 l_balance_type_code <> 'B' THEN
123990 IF NVL(p_source_48,'
123992 THEN
123993
123994 --
123995 XLA_AE_LINES_PKG.SetNewLine;
123996
123997 p_balance_type_code := l_balance_type_code;
123998 -- set the flag so later we will know whether the gain loss line needs to be created
123999
124000 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
124001 p_actual_flag :='A';
124002 END IF;
124003
124004 --
124005 -- bulk performance
124006 --
124007 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
124008 p_header_num => 0); -- 4262811
124009 --
124010 -- set accounting line options
124011 --
124012 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
124013 p_natural_side_code => 'C'
124014 , p_gain_or_loss_flag => 'N'
124015 , p_gl_transfer_mode_code => 'S'
124016 , p_acct_entry_type_code => 'A'
124017 , p_switch_side_flag => 'Y'
124018 , p_merge_duplicate_code => 'N'
124019 );
124020 --
124021 l_acc_rev_natural_side_code := 'D'; -- 4262811
124022 --
124023 --
124024 -- set accounting line type info
124025 --
124026 xla_ae_lines_pkg.SetAcctLineType
124027 (p_component_type => l_component_type
124028 ,p_event_type_code => l_event_type_code
124029 ,p_line_definition_owner_code => l_line_definition_owner_code
124030 ,p_line_definition_code => l_line_definition_code
124031 ,p_accounting_line_code => l_component_code
124032 ,p_accounting_line_type_code => l_component_type_code
124033 ,p_accounting_line_appl_id => l_component_appl_id
124034 ,p_amb_context_code => l_amb_context_code
124035 ,p_entity_code => l_entity_code
124036 ,p_event_class_code => l_event_class_code);
124037 --
124038 -- set accounting class
124039 --
124040 xla_ae_lines_pkg.SetAcctClass(
124041 p_accounting_class_code => 'ASSET'
124042 , p_ae_header_id => l_ae_header_id
124043 );
124044
124045 --
124046 -- set rounding class
124047 --
124048 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
124049 'ASSET';
124050
124051 --
124052 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
124053 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
124054 --
124055 -- bulk performance
124056 --
124057 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
124058
124059 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
124060 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
124061
124062 -- 4955764
124063 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
124064 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
124065
124066 -- 4458381 Public Sector Enh
124067
124068 --
124069 -- set accounting attributes for the line type
124070 --
124071 l_entered_amt_idx := 4;
124072 l_accted_amt_idx := 6;
124073 l_bflow_applied_to_amt_idx := NULL; -- 5132302
124074 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
124075 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
124076 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
124077 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
124078 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
124079 l_rec_acct_attrs.array_char_value(3) := p_source_51;
124080 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
124081 l_rec_acct_attrs.array_num_value(4) := p_source_52;
124082 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
124083 l_rec_acct_attrs.array_char_value(5) := p_source_53;
124084 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
124085 l_rec_acct_attrs.array_num_value(6) := p_source_52;
124086
124087 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
124088 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
124089
124090 ---------------------------------------------------------------------------------------------------------------
124091 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
124092 ---------------------------------------------------------------------------------------------------------------
124093 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
124094
124095 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
124096 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
124097
124098 IF xla_accounting_cache_pkg.GetValueChar
124099 (p_source_code => 'LEDGER_CATEGORY_CODE'
124103 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
124100 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
124101 AND l_bflow_method_code = 'PRIOR_ENTRY'
124102 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
124104 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
124105 )
124106 THEN
124107 xla_ae_lines_pkg.BflowUpgEntry
124108 (p_business_method_code => l_bflow_method_code
124109 ,p_business_class_code => l_bflow_class_code
124110 ,p_balance_type => l_balance_type_code);
124111 ELSE
124112 NULL;
124113 -- No business flow processing for business flow method of NONE.
124114 END IF;
124115
124116 --
124117 -- call analytical criteria
124118 --
124119
124120 --
124121 -- call description
124122 --
124123
124124 xla_ae_lines_pkg.SetLineDescription(
124125 p_ae_header_id => l_ae_header_id
124126 ,p_description => Description_99 (
124127 p_application_id => p_application_id
124128 , p_ae_header_id => l_ae_header_id
124129 , p_source_1 => p_source_1
124130 )
124131 );
124132
124133
124134 --
124135 -- call ADRs
124136 -- Bug 4922099
124137 --
124138 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
124139 (NVL(l_actual_upg_option, 'N') = 'O') OR
124140 (NVL(l_enc_upg_option, 'N') = 'O')
124141 )
124142 THEN
124143 NULL;
124144 --
124145 --
124146
124147 l_ccid := AcctDerRule_174(
124148 p_application_id => p_application_id
124149 , p_ae_header_id => l_ae_header_id
124150 , p_source_5 => p_source_5
124151 , p_source_32 => p_source_32
124152 , x_transaction_coa_id => l_adr_transaction_coa_id
124153 , x_accounting_coa_id => l_adr_accounting_coa_id
124154 , x_value_type_code => l_adr_value_type_code
124155 , p_side => 'NA'
124156 );
124157
124158 xla_ae_lines_pkg.set_ccid(
124159 p_code_combination_id => l_ccid
124160 , p_value_type_code => l_adr_value_type_code
124161 , p_transaction_coa_id => l_adr_transaction_coa_id
124162 , p_accounting_coa_id => l_adr_accounting_coa_id
124163 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
124164 , p_adr_type_code => 'S'
124165 , p_component_type => l_component_type
124166 , p_component_code => l_component_code
124167 , p_component_type_code => l_component_type_code
124168 , p_component_appl_id => l_component_appl_id
124169 , p_amb_context_code => l_amb_context_code
124170 , p_side => 'NA'
124171 );
124172
124173
124174 l_segment := AcctDerRule_147(
124175 p_application_id => p_application_id
124176 , p_ae_header_id => l_ae_header_id
124177 , p_source_5 => p_source_5
124178 , p_source_9 => p_source_9
124179 , x_transaction_coa_id => l_adr_transaction_coa_id
124180 , x_accounting_coa_id => l_adr_accounting_coa_id
124181 , x_flexfield_segment_code => l_adr_flexfield_segment_code
124182 , x_flex_value_set_id => l_adr_flex_value_set_id
124183 , x_value_type_code => l_adr_value_type_code
124184 , x_value_combination_id => l_adr_value_combination_id
124185 , x_value_segment_code => l_adr_value_segment_code
124186 , p_side => 'NA'
124187 , p_override_seg_flag => 'Y'
124188 );
124189
124190 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
124191
124192 xla_ae_lines_pkg.set_segment(
124193 p_to_segment_code => 'GL_ACCOUNT'
124194 , p_segment_value => l_segment
124195 , p_from_segment_code => l_adr_value_segment_code
124196 , p_from_combination_id => l_adr_value_combination_id
124197 , p_value_type_code => l_adr_value_type_code
124198 , p_transaction_coa_id => l_adr_transaction_coa_id
124199 , p_accounting_coa_id => l_adr_accounting_coa_id
124200 , p_flexfield_segment_code => l_adr_flexfield_segment_code
124201 , p_flex_value_set_id => l_adr_flex_value_set_id
124202 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
124203 , p_adr_type_code => 'S'
124204 , p_component_type => l_component_type
124205 , p_component_code => l_component_code
124206 , p_component_type_code => l_component_type_code
124207 , p_component_appl_id => l_component_appl_id
124208 , p_amb_context_code => l_amb_context_code
124209 , p_entity_code => 'TRANSACTIONS'
124210 , p_event_class_code => 'CAPITALIZATION'
124211 , p_side => 'NA'
124212 );
124213
124214 END IF;
124215
124216 l_segment := AcctDerRule_169(
124217 p_application_id => p_application_id
124218 , p_ae_header_id => l_ae_header_id
124219 , p_source_5 => p_source_5
124220 , p_source_31 => p_source_31
124221 , x_transaction_coa_id => l_adr_transaction_coa_id
124222 , x_accounting_coa_id => l_adr_accounting_coa_id
124223 , x_flexfield_segment_code => l_adr_flexfield_segment_code
124227 , x_value_segment_code => l_adr_value_segment_code
124224 , x_flex_value_set_id => l_adr_flex_value_set_id
124225 , x_value_type_code => l_adr_value_type_code
124226 , x_value_combination_id => l_adr_value_combination_id
124228 , p_side => 'NA'
124229 , p_override_seg_flag => 'Y'
124230 );
124231
124232 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
124233
124234 xla_ae_lines_pkg.set_segment(
124235 p_to_segment_code => 'GL_BALANCING'
124236 , p_segment_value => l_segment
124237 , p_from_segment_code => l_adr_value_segment_code
124238 , p_from_combination_id => l_adr_value_combination_id
124239 , p_value_type_code => l_adr_value_type_code
124240 , p_transaction_coa_id => l_adr_transaction_coa_id
124241 , p_accounting_coa_id => l_adr_accounting_coa_id
124242 , p_flexfield_segment_code => l_adr_flexfield_segment_code
124243 , p_flex_value_set_id => l_adr_flex_value_set_id
124244 , p_adr_code => 'FA_EXPENSE_ACCT'
124245 , p_adr_type_code => 'S'
124246 , p_component_type => l_component_type
124247 , p_component_code => l_component_code
124248 , p_component_type_code => l_component_type_code
124249 , p_component_appl_id => l_component_appl_id
124250 , p_amb_context_code => l_amb_context_code
124251 , p_entity_code => 'TRANSACTIONS'
124252 , p_event_class_code => 'CAPITALIZATION'
124253 , p_side => 'NA'
124254 );
124255
124256 END IF;
124257
124258 --
124259 --
124260 END IF;
124261 --
124262 -- Bug 4922099
124263 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
124264 (NVL(l_enc_upg_option, 'N') = 'O')
124265 ) AND
124266 (l_bflow_method_code = 'PRIOR_ENTRY')
124267 )
124268 THEN
124269 IF
124270 --
124271 1 = 2
124272 --
124273 THEN
124274 xla_accounting_err_pkg.build_message
124275 (p_appli_s_name => 'XLA'
124276 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
124277 ,p_token_1 => 'LINE_NUMBER'
124278 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
124279 ,p_token_2 => 'LINE_TYPE_NAME'
124280 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
124281 l_component_type
124282 ,l_component_code
124283 ,l_component_type_code
124284 ,l_component_appl_id
124285 ,l_amb_context_code
124286 ,l_entity_code
124287 ,l_event_class_code
124288 )
124289 ,p_token_3 => 'OWNER'
124290 ,p_value_3 => xla_lookups_pkg.get_meaning(
124291 p_lookup_type => 'XLA_OWNER_TYPE'
124292 ,p_lookup_code => l_component_type_code
124293 )
124294 ,p_token_4 => 'PRODUCT_NAME'
124295 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
124296 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
124297 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
124298 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
124299 ,p_ae_header_id => NULL
124300 );
124301
124302 IF (C_LEVEL_ERROR>= g_log_level) THEN
124303 trace
124304 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
124305 ,p_level => C_LEVEL_ERROR
124306 ,p_module => l_log_module);
124307 END IF;
124308 END IF;
124309 END IF;
124310 --
124311 --
124312 ------------------------------------------------------------------------------------------------
124313 -- 4219869 Business Flow
124314 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
124315 -- Prior Entry. Currently, the following code is always generated.
124316 ------------------------------------------------------------------------------------------------
124317 XLA_AE_LINES_PKG.ValidateCurrentLine;
124318
124319 ------------------------------------------------------------------------------------
124320 -- 4219869 Business Flow
124321 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
124325 ----------------------------------------------------------------------------------
124322 ------------------------------------------------------------------------------------
124323 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
124324
124326 -- 4219869 Business Flow
124327 -- Update journal entry status -- Need to generate this within IF <condition>
124328 ----------------------------------------------------------------------------------
124329 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
124330 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
124331 ,p_balance_type_code => l_balance_type_code
124332 );
124333
124334 -------------------------------------------------------------------------------------------
124335 -- 4262811 - Generate the Accrual Reversal lines
124336 -------------------------------------------------------------------------------------------
124337 BEGIN
124338 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
124339 (g_array_event(p_event_id).array_value_num('header_index'));
124340 IF l_acc_rev_flag IS NULL THEN
124341 l_acc_rev_flag := 'N';
124342 END IF;
124343 EXCEPTION
124344 WHEN OTHERS THEN
124345 l_acc_rev_flag := 'N';
124346 END;
124347 --
124348 IF (l_acc_rev_flag = 'Y') THEN
124349
124350 -- 4645092 ------------------------------------------------------------------------------
124351 -- To allow MPA report to determine if it should generate report process
124352 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
124353 ------------------------------------------------------------------------------------------
124354
124355 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
124356 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
124357 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
124358 -- call ADRs
124359 -- Bug 4922099
124360 --
124361 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
124362 (NVL(l_actual_upg_option, 'N') = 'O') OR
124363 (NVL(l_enc_upg_option, 'N') = 'O')
124364 )
124365 THEN
124366 NULL;
124367 --
124368 --
124369
124370 l_ccid := AcctDerRule_174(
124371 p_application_id => p_application_id
124372 , p_ae_header_id => l_ae_header_id
124373 , p_source_5 => p_source_5
124374 , p_source_32 => p_source_32
124375 , x_transaction_coa_id => l_adr_transaction_coa_id
124376 , x_accounting_coa_id => l_adr_accounting_coa_id
124377 , x_value_type_code => l_adr_value_type_code
124378 , p_side => 'NA'
124379 );
124380
124381 xla_ae_lines_pkg.set_ccid(
124382 p_code_combination_id => l_ccid
124383 , p_value_type_code => l_adr_value_type_code
124384 , p_transaction_coa_id => l_adr_transaction_coa_id
124385 , p_accounting_coa_id => l_adr_accounting_coa_id
124386 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
124387 , p_adr_type_code => 'S'
124388 , p_component_type => l_component_type
124389 , p_component_code => l_component_code
124390 , p_component_type_code => l_component_type_code
124391 , p_component_appl_id => l_component_appl_id
124392 , p_amb_context_code => l_amb_context_code
124393 , p_side => 'NA'
124394 );
124395
124396
124397 l_segment := AcctDerRule_147(
124398 p_application_id => p_application_id
124399 , p_ae_header_id => l_ae_header_id
124400 , p_source_5 => p_source_5
124401 , p_source_9 => p_source_9
124402 , x_transaction_coa_id => l_adr_transaction_coa_id
124403 , x_accounting_coa_id => l_adr_accounting_coa_id
124404 , x_flexfield_segment_code => l_adr_flexfield_segment_code
124405 , x_flex_value_set_id => l_adr_flex_value_set_id
124406 , x_value_type_code => l_adr_value_type_code
124407 , x_value_combination_id => l_adr_value_combination_id
124408 , x_value_segment_code => l_adr_value_segment_code
124409 , p_side => 'NA'
124410 , p_override_seg_flag => 'Y'
124411 );
124412
124413 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
124414
124415 xla_ae_lines_pkg.set_segment(
124416 p_to_segment_code => 'GL_ACCOUNT'
124417 , p_segment_value => l_segment
124418 , p_from_segment_code => l_adr_value_segment_code
124419 , p_from_combination_id => l_adr_value_combination_id
124420 , p_value_type_code => l_adr_value_type_code
124421 , p_transaction_coa_id => l_adr_transaction_coa_id
124422 , p_accounting_coa_id => l_adr_accounting_coa_id
124423 , p_flexfield_segment_code => l_adr_flexfield_segment_code
124424 , p_flex_value_set_id => l_adr_flex_value_set_id
124425 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
124426 , p_adr_type_code => 'S'
124427 , p_component_type => l_component_type
124428 , p_component_code => l_component_code
124429 , p_component_type_code => l_component_type_code
124430 , p_component_appl_id => l_component_appl_id
124431 , p_amb_context_code => l_amb_context_code
124435 );
124432 , p_entity_code => 'TRANSACTIONS'
124433 , p_event_class_code => 'CAPITALIZATION'
124434 , p_side => 'NA'
124436
124437 END IF;
124438
124439 l_segment := AcctDerRule_169(
124440 p_application_id => p_application_id
124441 , p_ae_header_id => l_ae_header_id
124442 , p_source_5 => p_source_5
124443 , p_source_31 => p_source_31
124444 , x_transaction_coa_id => l_adr_transaction_coa_id
124445 , x_accounting_coa_id => l_adr_accounting_coa_id
124446 , x_flexfield_segment_code => l_adr_flexfield_segment_code
124447 , x_flex_value_set_id => l_adr_flex_value_set_id
124448 , x_value_type_code => l_adr_value_type_code
124449 , x_value_combination_id => l_adr_value_combination_id
124450 , x_value_segment_code => l_adr_value_segment_code
124451 , p_side => 'NA'
124452 , p_override_seg_flag => 'Y'
124453 );
124454
124455 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
124456
124457 xla_ae_lines_pkg.set_segment(
124458 p_to_segment_code => 'GL_BALANCING'
124459 , p_segment_value => l_segment
124460 , p_from_segment_code => l_adr_value_segment_code
124461 , p_from_combination_id => l_adr_value_combination_id
124462 , p_value_type_code => l_adr_value_type_code
124463 , p_transaction_coa_id => l_adr_transaction_coa_id
124464 , p_accounting_coa_id => l_adr_accounting_coa_id
124465 , p_flexfield_segment_code => l_adr_flexfield_segment_code
124466 , p_flex_value_set_id => l_adr_flex_value_set_id
124467 , p_adr_code => 'FA_EXPENSE_ACCT'
124468 , p_adr_type_code => 'S'
124469 , p_component_type => l_component_type
124470 , p_component_code => l_component_code
124471 , p_component_type_code => l_component_type_code
124472 , p_component_appl_id => l_component_appl_id
124473 , p_amb_context_code => l_amb_context_code
124474 , p_entity_code => 'TRANSACTIONS'
124475 , p_event_class_code => 'CAPITALIZATION'
124476 , p_side => 'NA'
124477 );
124478
124479 END IF;
124480
124481 --
124482 --
124483 END IF;
124484
124485 --
124486 -- Update the line information that should be overwritten
124487 --
124488 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
124489 p_header_num => 1);
124490 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
124491
124492 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
124493
124494 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
124495 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
124496 END IF;
124497
124498 --
124499 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
124500 --
124501 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
124502 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
124503 ELSE
124504 ---------------------------------------------------------------------------------------------------
124505 -- 4262811a Switch Sign
124506 ---------------------------------------------------------------------------------------------------
124507 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
124508 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
124509 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
124510 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
124511 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
124512 -- 5132302
124513 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
124514 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
124515
124516 END IF;
124517
124518 -- 4955764
124519 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
124520 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
124521
124522
124523 XLA_AE_LINES_PKG.ValidateCurrentLine;
124524 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
124525
124526 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
124527 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
124528 ,p_balance_type_code => l_balance_type_code);
124529
124530 END IF;
124531
124532 -----------------------------------------------------------------------------------------
124533 -- 4262811 Multiperiod Accounting
124534 -----------------------------------------------------------------------------------------
124535 -- No MPA option is assigned.
124536
124537
124538 END IF;
124539 END IF;
124540 --
124544 trace
124541
124542 --
124543 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
124545 (p_msg => 'END of AcctLineType_338'
124546 ,p_level => C_LEVEL_PROCEDURE
124547 ,p_module => l_log_module);
124548 END IF;
124549 --
124550 EXCEPTION
124551 WHEN xla_exceptions_pkg.application_exception THEN
124552 RAISE;
124553 WHEN OTHERS THEN
124554 xla_exceptions_pkg.raise_message
124555 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_338');
124556 END AcctLineType_338;
124557 --
124558
124559 ---------------------------------------
124560 --
124561 -- PRIVATE FUNCTION
124562 -- AcctLineType_339
124563 --
124564 ---------------------------------------
124565 PROCEDURE AcctLineType_339 (
124566 p_application_id IN NUMBER
124567 ,p_event_id IN NUMBER
124568 ,p_calculate_acctd_flag IN VARCHAR2
124569 ,p_calculate_g_l_flag IN VARCHAR2
124570 ,p_actual_flag IN OUT VARCHAR2
124571 ,p_balance_type_code OUT VARCHAR2
124572 ,p_gain_or_loss_ref OUT VARCHAR2
124573
124574 --Period Close Date
124575 , p_source_1 IN DATE
124576 --Generated Code Combination Identifier
124577 , p_source_5 IN NUMBER
124578 --Asset Cost Account
124579 , p_source_11 IN VARCHAR2
124580 --Expense Account Code Combination Identifier
124581 , p_source_31 IN NUMBER
124582 --Default Code Combination Identifier
124583 , p_source_32 IN NUMBER
124584 --Adjustment Type
124585 , p_source_48 IN VARCHAR2
124586 --Transaction Header Identifier
124587 , p_source_49 IN NUMBER
124588 --Adjustment Line Identifier
124589 , p_source_50 IN NUMBER
124590 --Distribution Type Code
124591 , p_source_51 IN VARCHAR2
124592 --Entered Amount
124593 , p_source_52 IN NUMBER
124594 --Currency Code
124595 , p_source_53 IN VARCHAR2
124596 )
124597 IS
124598
124599 l_component_type VARCHAR2(80);
124600 l_component_code VARCHAR2(30);
124601 l_component_type_code VARCHAR2(1);
124602 l_component_appl_id INTEGER;
124603 l_amb_context_code VARCHAR2(30);
124604 l_entity_code VARCHAR2(30);
124605 l_event_class_code VARCHAR2(30);
124606 l_ae_header_id NUMBER;
124607 l_event_type_code VARCHAR2(30);
124608 l_line_definition_code VARCHAR2(30);
124609 l_line_definition_owner_code VARCHAR2(1);
124610 --
124611 -- adr variables
124612 l_segment VARCHAR2(30);
124613 l_ccid NUMBER;
124614 l_adr_transaction_coa_id NUMBER;
124615 l_adr_accounting_coa_id NUMBER;
124616 l_adr_flexfield_segment_code VARCHAR2(30);
124617 l_adr_flex_value_set_id NUMBER;
124618 l_adr_value_type_code VARCHAR2(30);
124619 l_adr_value_combination_id NUMBER;
124620 l_adr_value_segment_code VARCHAR2(30);
124621
124622 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
124623 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
124624 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
124625 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
124626
124627 -- 4262811 Variables ------------------------------------------------------------------------------------------
124628 l_entered_amt_idx NUMBER;
124629 l_accted_amt_idx NUMBER;
124630 l_acc_rev_flag VARCHAR2(1);
124631 l_accrual_line_num NUMBER;
124632 l_tmp_amt NUMBER;
124633 l_acc_rev_natural_side_code VARCHAR2(1);
124634
124635 l_num_entries NUMBER;
124636 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
124637 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
124638 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
124639 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
124640 l_recog_line_1 NUMBER;
124641 l_recog_line_2 NUMBER;
124642
124643 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
124644 l_bflow_applied_to_amt NUMBER; -- 5132302
124645 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
124646
124647 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
124648
124649 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
124650 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
124651
124652 ---------------------------------------------------------------------------------------------------------------
124653
124654
124655 --
124656 -- bulk performance
124657 --
124658 l_balance_type_code VARCHAR2(1);
124659 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
124660 l_log_module VARCHAR2(240);
124661
124662 --
124663 -- Upgrade strategy
124664 --
124665 l_actual_upg_option VARCHAR2(1);
124666 l_enc_upg_option VARCHAR2(1);
124667
124668 --
124669 BEGIN
124670 --
124671 IF g_log_enabled THEN
124672 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_339';
124673 END IF;
124674 --
124675 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
124676
124680 ,p_module => l_log_module);
124677 trace
124678 (p_msg => 'BEGIN of AcctLineType_339'
124679 ,p_level => C_LEVEL_PROCEDURE
124681
124682 END IF;
124683 --
124684 l_component_type := 'AMB_JLT';
124685 l_component_code := 'FA_REV_ASSET_COST';
124686 l_component_type_code := 'S';
124687 l_component_appl_id := 140;
124688 l_amb_context_code := 'DEFAULT';
124689 l_entity_code := 'TRANSACTIONS';
124690 l_event_class_code := 'CAPITALIZATION';
124691 l_event_type_code := 'REVERSE_CAPITALIZATION';
124692 l_line_definition_owner_code := 'S';
124693 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVER22';
124694 --
124695 l_balance_type_code := 'A';
124696 l_segment := NULL;
124697 l_ccid := NULL;
124698 l_adr_transaction_coa_id := NULL;
124699 l_adr_accounting_coa_id := NULL;
124700 l_adr_flexfield_segment_code := NULL;
124701 l_adr_flex_value_set_id := NULL;
124702 l_adr_value_type_code := NULL;
124703 l_adr_value_combination_id := NULL;
124704 l_adr_value_segment_code := NULL;
124705
124706 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
124707 l_bflow_class_code := ''; -- 4219869 Business Flow
124708 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
124709 l_budgetary_control_flag := 'N';
124710
124711 l_bflow_applied_to_amt_idx := NULL; -- 5132302
124712 l_bflow_applied_to_amt := NULL; -- 5132302
124713 l_entered_amt_idx := NULL; -- 4262811
124714 l_accted_amt_idx := NULL; -- 4262811
124715 l_acc_rev_flag := NULL; -- 4262811
124716 l_accrual_line_num := NULL; -- 4262811
124717 l_tmp_amt := NULL; -- 4262811
124718 --
124719
124720 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
124721 l_balance_type_code <> 'B' THEN
124722 IF NVL(p_source_48,'
124723 ') = 'COST'
124724 THEN
124725
124726 --
124727 XLA_AE_LINES_PKG.SetNewLine;
124728
124729 p_balance_type_code := l_balance_type_code;
124730 -- set the flag so later we will know whether the gain loss line needs to be created
124731
124732 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
124733 p_actual_flag :='A';
124734 END IF;
124735
124736 --
124737 -- bulk performance
124738 --
124739 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
124740 p_header_num => 0); -- 4262811
124741 --
124742 -- set accounting line options
124743 --
124744 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
124745 p_natural_side_code => 'D'
124746 , p_gain_or_loss_flag => 'N'
124747 , p_gl_transfer_mode_code => 'S'
124748 , p_acct_entry_type_code => 'A'
124749 , p_switch_side_flag => 'Y'
124750 , p_merge_duplicate_code => 'N'
124751 );
124752 --
124753 l_acc_rev_natural_side_code := 'C'; -- 4262811
124754 --
124755 --
124756 -- set accounting line type info
124757 --
124758 xla_ae_lines_pkg.SetAcctLineType
124759 (p_component_type => l_component_type
124760 ,p_event_type_code => l_event_type_code
124761 ,p_line_definition_owner_code => l_line_definition_owner_code
124762 ,p_line_definition_code => l_line_definition_code
124763 ,p_accounting_line_code => l_component_code
124764 ,p_accounting_line_type_code => l_component_type_code
124765 ,p_accounting_line_appl_id => l_component_appl_id
124766 ,p_amb_context_code => l_amb_context_code
124767 ,p_entity_code => l_entity_code
124768 ,p_event_class_code => l_event_class_code);
124769 --
124770 -- set accounting class
124771 --
124772 xla_ae_lines_pkg.SetAcctClass(
124773 p_accounting_class_code => 'ASSET'
124774 , p_ae_header_id => l_ae_header_id
124775 );
124776
124777 --
124778 -- set rounding class
124779 --
124780 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
124781 'ASSET';
124782
124783 --
124784 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
124785 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
124786 --
124787 -- bulk performance
124788 --
124789 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
124790
124791 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
124792 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
124793
124794 -- 4955764
124795 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
124796 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
124797
124798 -- 4458381 Public Sector Enh
124799
124800 --
124801 -- set accounting attributes for the line type
124802 --
124803 l_entered_amt_idx := 4;
124804 l_accted_amt_idx := 6;
124805 l_bflow_applied_to_amt_idx := NULL; -- 5132302
124809 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
124806 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
124807 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
124808 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
124810 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
124811 l_rec_acct_attrs.array_char_value(3) := p_source_51;
124812 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
124813 l_rec_acct_attrs.array_num_value(4) := p_source_52;
124814 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
124815 l_rec_acct_attrs.array_char_value(5) := p_source_53;
124816 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
124817 l_rec_acct_attrs.array_num_value(6) := p_source_52;
124818
124819 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
124820 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
124821
124822 ---------------------------------------------------------------------------------------------------------------
124823 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
124824 ---------------------------------------------------------------------------------------------------------------
124825 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
124826
124827 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
124828 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
124829
124830 IF xla_accounting_cache_pkg.GetValueChar
124831 (p_source_code => 'LEDGER_CATEGORY_CODE'
124832 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
124833 AND l_bflow_method_code = 'PRIOR_ENTRY'
124834 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
124835 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
124836 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
124837 )
124838 THEN
124839 xla_ae_lines_pkg.BflowUpgEntry
124840 (p_business_method_code => l_bflow_method_code
124841 ,p_business_class_code => l_bflow_class_code
124842 ,p_balance_type => l_balance_type_code);
124843 ELSE
124844 NULL;
124845 -- No business flow processing for business flow method of NONE.
124846 END IF;
124847
124848 --
124849 -- call analytical criteria
124850 --
124851
124852 --
124853 -- call description
124854 --
124855
124856 xla_ae_lines_pkg.SetLineDescription(
124857 p_ae_header_id => l_ae_header_id
124858 ,p_description => Description_100 (
124859 p_application_id => p_application_id
124860 , p_ae_header_id => l_ae_header_id
124861 , p_source_1 => p_source_1
124862 )
124863 );
124864
124865
124866 --
124867 -- call ADRs
124868 -- Bug 4922099
124869 --
124870 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
124871 (NVL(l_actual_upg_option, 'N') = 'O') OR
124872 (NVL(l_enc_upg_option, 'N') = 'O')
124873 )
124874 THEN
124875 NULL;
124876 --
124877 --
124878
124879 l_ccid := AcctDerRule_174(
124880 p_application_id => p_application_id
124881 , p_ae_header_id => l_ae_header_id
124882 , p_source_5 => p_source_5
124883 , p_source_32 => p_source_32
124884 , x_transaction_coa_id => l_adr_transaction_coa_id
124885 , x_accounting_coa_id => l_adr_accounting_coa_id
124886 , x_value_type_code => l_adr_value_type_code
124887 , p_side => 'NA'
124888 );
124889
124890 xla_ae_lines_pkg.set_ccid(
124891 p_code_combination_id => l_ccid
124892 , p_value_type_code => l_adr_value_type_code
124893 , p_transaction_coa_id => l_adr_transaction_coa_id
124894 , p_accounting_coa_id => l_adr_accounting_coa_id
124895 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
124896 , p_adr_type_code => 'S'
124897 , p_component_type => l_component_type
124898 , p_component_code => l_component_code
124899 , p_component_type_code => l_component_type_code
124900 , p_component_appl_id => l_component_appl_id
124901 , p_amb_context_code => l_amb_context_code
124902 , p_side => 'NA'
124903 );
124904
124905
124906 l_segment := AcctDerRule_149(
124907 p_application_id => p_application_id
124908 , p_ae_header_id => l_ae_header_id
124909 , p_source_5 => p_source_5
124910 , p_source_11 => p_source_11
124911 , x_transaction_coa_id => l_adr_transaction_coa_id
124912 , x_accounting_coa_id => l_adr_accounting_coa_id
124913 , x_flexfield_segment_code => l_adr_flexfield_segment_code
124914 , x_flex_value_set_id => l_adr_flex_value_set_id
124915 , x_value_type_code => l_adr_value_type_code
124916 , x_value_combination_id => l_adr_value_combination_id
124917 , x_value_segment_code => l_adr_value_segment_code
124918 , p_side => 'NA'
124919 , p_override_seg_flag => 'Y'
124920 );
124921
124922 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
124923
124927 , p_from_segment_code => l_adr_value_segment_code
124924 xla_ae_lines_pkg.set_segment(
124925 p_to_segment_code => 'GL_ACCOUNT'
124926 , p_segment_value => l_segment
124928 , p_from_combination_id => l_adr_value_combination_id
124929 , p_value_type_code => l_adr_value_type_code
124930 , p_transaction_coa_id => l_adr_transaction_coa_id
124931 , p_accounting_coa_id => l_adr_accounting_coa_id
124932 , p_flexfield_segment_code => l_adr_flexfield_segment_code
124933 , p_flex_value_set_id => l_adr_flex_value_set_id
124934 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
124935 , p_adr_type_code => 'S'
124936 , p_component_type => l_component_type
124937 , p_component_code => l_component_code
124938 , p_component_type_code => l_component_type_code
124939 , p_component_appl_id => l_component_appl_id
124940 , p_amb_context_code => l_amb_context_code
124941 , p_entity_code => 'TRANSACTIONS'
124942 , p_event_class_code => 'CAPITALIZATION'
124943 , p_side => 'NA'
124944 );
124945
124946 END IF;
124947
124948 l_segment := AcctDerRule_169(
124949 p_application_id => p_application_id
124950 , p_ae_header_id => l_ae_header_id
124951 , p_source_5 => p_source_5
124952 , p_source_31 => p_source_31
124953 , x_transaction_coa_id => l_adr_transaction_coa_id
124954 , x_accounting_coa_id => l_adr_accounting_coa_id
124955 , x_flexfield_segment_code => l_adr_flexfield_segment_code
124956 , x_flex_value_set_id => l_adr_flex_value_set_id
124957 , x_value_type_code => l_adr_value_type_code
124958 , x_value_combination_id => l_adr_value_combination_id
124959 , x_value_segment_code => l_adr_value_segment_code
124960 , p_side => 'NA'
124961 , p_override_seg_flag => 'Y'
124962 );
124963
124964 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
124965
124966 xla_ae_lines_pkg.set_segment(
124967 p_to_segment_code => 'GL_BALANCING'
124968 , p_segment_value => l_segment
124969 , p_from_segment_code => l_adr_value_segment_code
124970 , p_from_combination_id => l_adr_value_combination_id
124971 , p_value_type_code => l_adr_value_type_code
124972 , p_transaction_coa_id => l_adr_transaction_coa_id
124973 , p_accounting_coa_id => l_adr_accounting_coa_id
124974 , p_flexfield_segment_code => l_adr_flexfield_segment_code
124975 , p_flex_value_set_id => l_adr_flex_value_set_id
124976 , p_adr_code => 'FA_EXPENSE_ACCT'
124977 , p_adr_type_code => 'S'
124978 , p_component_type => l_component_type
124979 , p_component_code => l_component_code
124980 , p_component_type_code => l_component_type_code
124981 , p_component_appl_id => l_component_appl_id
124982 , p_amb_context_code => l_amb_context_code
124983 , p_entity_code => 'TRANSACTIONS'
124984 , p_event_class_code => 'CAPITALIZATION'
124985 , p_side => 'NA'
124986 );
124987
124988 END IF;
124989
124990 --
124991 --
124992 END IF;
124993 --
124994 -- Bug 4922099
124995 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
124996 (NVL(l_enc_upg_option, 'N') = 'O')
124997 ) AND
124998 (l_bflow_method_code = 'PRIOR_ENTRY')
124999 )
125000 THEN
125001 IF
125002 --
125003 1 = 2
125004 --
125005 THEN
125006 xla_accounting_err_pkg.build_message
125007 (p_appli_s_name => 'XLA'
125008 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
125009 ,p_token_1 => 'LINE_NUMBER'
125010 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
125011 ,p_token_2 => 'LINE_TYPE_NAME'
125012 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
125013 l_component_type
125014 ,l_component_code
125015 ,l_component_type_code
125016 ,l_component_appl_id
125017 ,l_amb_context_code
125018 ,l_entity_code
125019 ,l_event_class_code
125020 )
125021 ,p_token_3 => 'OWNER'
125022 ,p_value_3 => xla_lookups_pkg.get_meaning(
125023 p_lookup_type => 'XLA_OWNER_TYPE'
125024 ,p_lookup_code => l_component_type_code
125028 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
125025 )
125026 ,p_token_4 => 'PRODUCT_NAME'
125027 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
125029 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
125030 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
125031 ,p_ae_header_id => NULL
125032 );
125033
125034 IF (C_LEVEL_ERROR>= g_log_level) THEN
125035 trace
125036 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
125037 ,p_level => C_LEVEL_ERROR
125038 ,p_module => l_log_module);
125039 END IF;
125040 END IF;
125041 END IF;
125042 --
125043 --
125044 ------------------------------------------------------------------------------------------------
125045 -- 4219869 Business Flow
125046 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
125047 -- Prior Entry. Currently, the following code is always generated.
125048 ------------------------------------------------------------------------------------------------
125049 XLA_AE_LINES_PKG.ValidateCurrentLine;
125050
125051 ------------------------------------------------------------------------------------
125052 -- 4219869 Business Flow
125053 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
125054 ------------------------------------------------------------------------------------
125055 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
125056
125057 ----------------------------------------------------------------------------------
125058 -- 4219869 Business Flow
125059 -- Update journal entry status -- Need to generate this within IF <condition>
125060 ----------------------------------------------------------------------------------
125061 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
125062 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
125063 ,p_balance_type_code => l_balance_type_code
125064 );
125065
125066 -------------------------------------------------------------------------------------------
125067 -- 4262811 - Generate the Accrual Reversal lines
125068 -------------------------------------------------------------------------------------------
125069 BEGIN
125070 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
125071 (g_array_event(p_event_id).array_value_num('header_index'));
125072 IF l_acc_rev_flag IS NULL THEN
125073 l_acc_rev_flag := 'N';
125074 END IF;
125075 EXCEPTION
125076 WHEN OTHERS THEN
125077 l_acc_rev_flag := 'N';
125078 END;
125079 --
125080 IF (l_acc_rev_flag = 'Y') THEN
125081
125082 -- 4645092 ------------------------------------------------------------------------------
125083 -- To allow MPA report to determine if it should generate report process
125084 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
125085 ------------------------------------------------------------------------------------------
125086
125087 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
125088 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
125089 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
125090 -- call ADRs
125091 -- Bug 4922099
125092 --
125093 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
125094 (NVL(l_actual_upg_option, 'N') = 'O') OR
125095 (NVL(l_enc_upg_option, 'N') = 'O')
125096 )
125097 THEN
125098 NULL;
125099 --
125100 --
125101
125102 l_ccid := AcctDerRule_174(
125103 p_application_id => p_application_id
125104 , p_ae_header_id => l_ae_header_id
125105 , p_source_5 => p_source_5
125106 , p_source_32 => p_source_32
125107 , x_transaction_coa_id => l_adr_transaction_coa_id
125108 , x_accounting_coa_id => l_adr_accounting_coa_id
125109 , x_value_type_code => l_adr_value_type_code
125110 , p_side => 'NA'
125111 );
125112
125113 xla_ae_lines_pkg.set_ccid(
125114 p_code_combination_id => l_ccid
125115 , p_value_type_code => l_adr_value_type_code
125116 , p_transaction_coa_id => l_adr_transaction_coa_id
125117 , p_accounting_coa_id => l_adr_accounting_coa_id
125118 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
125119 , p_adr_type_code => 'S'
125120 , p_component_type => l_component_type
125121 , p_component_code => l_component_code
125122 , p_component_type_code => l_component_type_code
125123 , p_component_appl_id => l_component_appl_id
125124 , p_amb_context_code => l_amb_context_code
125125 , p_side => 'NA'
125126 );
125127
125128
125129 l_segment := AcctDerRule_149(
125130 p_application_id => p_application_id
125131 , p_ae_header_id => l_ae_header_id
125135 , x_accounting_coa_id => l_adr_accounting_coa_id
125132 , p_source_5 => p_source_5
125133 , p_source_11 => p_source_11
125134 , x_transaction_coa_id => l_adr_transaction_coa_id
125136 , x_flexfield_segment_code => l_adr_flexfield_segment_code
125137 , x_flex_value_set_id => l_adr_flex_value_set_id
125138 , x_value_type_code => l_adr_value_type_code
125139 , x_value_combination_id => l_adr_value_combination_id
125140 , x_value_segment_code => l_adr_value_segment_code
125141 , p_side => 'NA'
125142 , p_override_seg_flag => 'Y'
125143 );
125144
125145 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
125146
125147 xla_ae_lines_pkg.set_segment(
125148 p_to_segment_code => 'GL_ACCOUNT'
125149 , p_segment_value => l_segment
125150 , p_from_segment_code => l_adr_value_segment_code
125151 , p_from_combination_id => l_adr_value_combination_id
125152 , p_value_type_code => l_adr_value_type_code
125153 , p_transaction_coa_id => l_adr_transaction_coa_id
125154 , p_accounting_coa_id => l_adr_accounting_coa_id
125155 , p_flexfield_segment_code => l_adr_flexfield_segment_code
125156 , p_flex_value_set_id => l_adr_flex_value_set_id
125157 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
125158 , p_adr_type_code => 'S'
125159 , p_component_type => l_component_type
125160 , p_component_code => l_component_code
125161 , p_component_type_code => l_component_type_code
125162 , p_component_appl_id => l_component_appl_id
125163 , p_amb_context_code => l_amb_context_code
125164 , p_entity_code => 'TRANSACTIONS'
125165 , p_event_class_code => 'CAPITALIZATION'
125166 , p_side => 'NA'
125167 );
125168
125169 END IF;
125170
125171 l_segment := AcctDerRule_169(
125172 p_application_id => p_application_id
125173 , p_ae_header_id => l_ae_header_id
125174 , p_source_5 => p_source_5
125175 , p_source_31 => p_source_31
125176 , x_transaction_coa_id => l_adr_transaction_coa_id
125177 , x_accounting_coa_id => l_adr_accounting_coa_id
125178 , x_flexfield_segment_code => l_adr_flexfield_segment_code
125179 , x_flex_value_set_id => l_adr_flex_value_set_id
125180 , x_value_type_code => l_adr_value_type_code
125181 , x_value_combination_id => l_adr_value_combination_id
125182 , x_value_segment_code => l_adr_value_segment_code
125183 , p_side => 'NA'
125184 , p_override_seg_flag => 'Y'
125185 );
125186
125187 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
125188
125189 xla_ae_lines_pkg.set_segment(
125190 p_to_segment_code => 'GL_BALANCING'
125191 , p_segment_value => l_segment
125192 , p_from_segment_code => l_adr_value_segment_code
125193 , p_from_combination_id => l_adr_value_combination_id
125194 , p_value_type_code => l_adr_value_type_code
125195 , p_transaction_coa_id => l_adr_transaction_coa_id
125196 , p_accounting_coa_id => l_adr_accounting_coa_id
125197 , p_flexfield_segment_code => l_adr_flexfield_segment_code
125198 , p_flex_value_set_id => l_adr_flex_value_set_id
125199 , p_adr_code => 'FA_EXPENSE_ACCT'
125200 , p_adr_type_code => 'S'
125201 , p_component_type => l_component_type
125202 , p_component_code => l_component_code
125203 , p_component_type_code => l_component_type_code
125204 , p_component_appl_id => l_component_appl_id
125205 , p_amb_context_code => l_amb_context_code
125206 , p_entity_code => 'TRANSACTIONS'
125207 , p_event_class_code => 'CAPITALIZATION'
125208 , p_side => 'NA'
125209 );
125210
125211 END IF;
125212
125213 --
125214 --
125215 END IF;
125216
125217 --
125218 -- Update the line information that should be overwritten
125219 --
125220 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
125221 p_header_num => 1);
125222 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
125223
125224 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
125225
125226 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
125227 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
125228 END IF;
125229
125230 --
125231 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
125232 --
125233 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
125234 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
125235 ELSE
125236 ---------------------------------------------------------------------------------------------------
125237 -- 4262811a Switch Sign
125241 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
125238 ---------------------------------------------------------------------------------------------------
125239 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
125240 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
125242 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
125243 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
125244 -- 5132302
125245 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
125246 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
125247
125248 END IF;
125249
125250 -- 4955764
125251 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
125252 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
125253
125254
125255 XLA_AE_LINES_PKG.ValidateCurrentLine;
125256 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
125257
125258 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
125259 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
125260 ,p_balance_type_code => l_balance_type_code);
125261
125262 END IF;
125263
125264 -----------------------------------------------------------------------------------------
125265 -- 4262811 Multiperiod Accounting
125266 -----------------------------------------------------------------------------------------
125267 -- No MPA option is assigned.
125268
125269
125270 END IF;
125271 END IF;
125272 --
125273
125274 --
125275 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
125276 trace
125277 (p_msg => 'END of AcctLineType_339'
125278 ,p_level => C_LEVEL_PROCEDURE
125279 ,p_module => l_log_module);
125280 END IF;
125281 --
125282 EXCEPTION
125283 WHEN xla_exceptions_pkg.application_exception THEN
125284 RAISE;
125285 WHEN OTHERS THEN
125286 xla_exceptions_pkg.raise_message
125287 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_339');
125288 END AcctLineType_339;
125289 --
125290
125291 ---------------------------------------
125292 --
125293 -- PRIVATE FUNCTION
125294 -- AcctLineType_340
125295 --
125296 ---------------------------------------
125297 PROCEDURE AcctLineType_340 (
125298 p_application_id IN NUMBER
125299 ,p_event_id IN NUMBER
125300 ,p_calculate_acctd_flag IN VARCHAR2
125301 ,p_calculate_g_l_flag IN VARCHAR2
125302 ,p_actual_flag IN OUT VARCHAR2
125303 ,p_balance_type_code OUT VARCHAR2
125304 ,p_gain_or_loss_ref OUT VARCHAR2
125305
125306 --Period Close Date
125307 , p_source_1 IN DATE
125308 --Generated Code Combination Identifier
125309 , p_source_5 IN NUMBER
125310 --Expense Account Code Combination Identifier
125311 , p_source_31 IN NUMBER
125312 --Adjustment Type
125313 , p_source_48 IN VARCHAR2
125314 --Transaction Header Identifier
125315 , p_source_49 IN NUMBER
125316 --Adjustment Line Identifier
125317 , p_source_50 IN NUMBER
125318 --Distribution Type Code
125319 , p_source_51 IN VARCHAR2
125320 --Entered Amount
125321 , p_source_52 IN NUMBER
125322 --Currency Code
125323 , p_source_53 IN VARCHAR2
125324 )
125325 IS
125326
125327 l_component_type VARCHAR2(80);
125328 l_component_code VARCHAR2(30);
125329 l_component_type_code VARCHAR2(1);
125330 l_component_appl_id INTEGER;
125331 l_amb_context_code VARCHAR2(30);
125332 l_entity_code VARCHAR2(30);
125333 l_event_class_code VARCHAR2(30);
125334 l_ae_header_id NUMBER;
125335 l_event_type_code VARCHAR2(30);
125336 l_line_definition_code VARCHAR2(30);
125337 l_line_definition_owner_code VARCHAR2(1);
125338 --
125339 -- adr variables
125340 l_segment VARCHAR2(30);
125341 l_ccid NUMBER;
125342 l_adr_transaction_coa_id NUMBER;
125343 l_adr_accounting_coa_id NUMBER;
125344 l_adr_flexfield_segment_code VARCHAR2(30);
125345 l_adr_flex_value_set_id NUMBER;
125346 l_adr_value_type_code VARCHAR2(30);
125347 l_adr_value_combination_id NUMBER;
125348 l_adr_value_segment_code VARCHAR2(30);
125349
125350 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
125351 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
125352 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
125353 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
125354
125355 -- 4262811 Variables ------------------------------------------------------------------------------------------
125356 l_entered_amt_idx NUMBER;
125357 l_accted_amt_idx NUMBER;
125358 l_acc_rev_flag VARCHAR2(1);
125359 l_accrual_line_num NUMBER;
125360 l_tmp_amt NUMBER;
125361 l_acc_rev_natural_side_code VARCHAR2(1);
125362
125363 l_num_entries NUMBER;
125364 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
125365 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
125369 l_recog_line_2 NUMBER;
125366 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
125367 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
125368 l_recog_line_1 NUMBER;
125370
125371 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
125372 l_bflow_applied_to_amt NUMBER; -- 5132302
125373 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
125374
125375 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
125376
125377 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
125378 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
125379
125380 ---------------------------------------------------------------------------------------------------------------
125381
125382
125383 --
125384 -- bulk performance
125385 --
125386 l_balance_type_code VARCHAR2(1);
125387 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
125388 l_log_module VARCHAR2(240);
125389
125390 --
125391 -- Upgrade strategy
125392 --
125393 l_actual_upg_option VARCHAR2(1);
125394 l_enc_upg_option VARCHAR2(1);
125395
125396 --
125397 BEGIN
125398 --
125399 IF g_log_enabled THEN
125400 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_340';
125401 END IF;
125402 --
125403 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
125404
125405 trace
125406 (p_msg => 'BEGIN of AcctLineType_340'
125407 ,p_level => C_LEVEL_PROCEDURE
125408 ,p_module => l_log_module);
125409
125410 END IF;
125411 --
125412 l_component_type := 'AMB_JLT';
125413 l_component_code := 'FA_REV_ASSET_EXP';
125414 l_component_type_code := 'S';
125415 l_component_appl_id := 140;
125416 l_amb_context_code := 'DEFAULT';
125417 l_entity_code := 'TRANSACTIONS';
125418 l_event_class_code := 'CAPITALIZATION';
125419 l_event_type_code := 'REVERSE_CAPITALIZATION';
125420 l_line_definition_owner_code := 'S';
125421 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVER22';
125422 --
125423 l_balance_type_code := 'A';
125424 l_segment := NULL;
125425 l_ccid := NULL;
125426 l_adr_transaction_coa_id := NULL;
125427 l_adr_accounting_coa_id := NULL;
125428 l_adr_flexfield_segment_code := NULL;
125429 l_adr_flex_value_set_id := NULL;
125430 l_adr_value_type_code := NULL;
125431 l_adr_value_combination_id := NULL;
125432 l_adr_value_segment_code := NULL;
125433
125434 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
125435 l_bflow_class_code := ''; -- 4219869 Business Flow
125436 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
125437 l_budgetary_control_flag := 'N';
125438
125439 l_bflow_applied_to_amt_idx := NULL; -- 5132302
125440 l_bflow_applied_to_amt := NULL; -- 5132302
125441 l_entered_amt_idx := NULL; -- 4262811
125442 l_accted_amt_idx := NULL; -- 4262811
125443 l_acc_rev_flag := NULL; -- 4262811
125444 l_accrual_line_num := NULL; -- 4262811
125445 l_tmp_amt := NULL; -- 4262811
125446 --
125447
125448 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
125449 l_balance_type_code <> 'B' THEN
125450 IF NVL(p_source_48,'
125451 ') = 'EXPENSE'
125452 THEN
125453
125454 --
125455 XLA_AE_LINES_PKG.SetNewLine;
125456
125457 p_balance_type_code := l_balance_type_code;
125458 -- set the flag so later we will know whether the gain loss line needs to be created
125459
125460 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
125461 p_actual_flag :='A';
125462 END IF;
125463
125464 --
125465 -- bulk performance
125466 --
125467 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
125468 p_header_num => 0); -- 4262811
125469 --
125470 -- set accounting line options
125471 --
125472 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
125473 p_natural_side_code => 'D'
125474 , p_gain_or_loss_flag => 'N'
125475 , p_gl_transfer_mode_code => 'S'
125476 , p_acct_entry_type_code => 'A'
125477 , p_switch_side_flag => 'Y'
125478 , p_merge_duplicate_code => 'N'
125479 );
125480 --
125481 l_acc_rev_natural_side_code := 'C'; -- 4262811
125482 --
125483 --
125484 -- set accounting line type info
125485 --
125486 xla_ae_lines_pkg.SetAcctLineType
125487 (p_component_type => l_component_type
125488 ,p_event_type_code => l_event_type_code
125489 ,p_line_definition_owner_code => l_line_definition_owner_code
125490 ,p_line_definition_code => l_line_definition_code
125491 ,p_accounting_line_code => l_component_code
125492 ,p_accounting_line_type_code => l_component_type_code
125493 ,p_accounting_line_appl_id => l_component_appl_id
125494 ,p_amb_context_code => l_amb_context_code
125495 ,p_entity_code => l_entity_code
125499 --
125496 ,p_event_class_code => l_event_class_code);
125497 --
125498 -- set accounting class
125500 xla_ae_lines_pkg.SetAcctClass(
125501 p_accounting_class_code => 'EXPENSE'
125502 , p_ae_header_id => l_ae_header_id
125503 );
125504
125505 --
125506 -- set rounding class
125507 --
125508 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
125509 'EXPENSE';
125510
125511 --
125512 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
125513 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
125514 --
125515 -- bulk performance
125516 --
125517 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
125518
125519 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
125520 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
125521
125522 -- 4955764
125523 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
125524 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
125525
125526 -- 4458381 Public Sector Enh
125527
125528 --
125529 -- set accounting attributes for the line type
125530 --
125531 l_entered_amt_idx := 4;
125532 l_accted_amt_idx := 6;
125533 l_bflow_applied_to_amt_idx := NULL; -- 5132302
125534 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
125535 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
125536 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
125537 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
125538 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
125539 l_rec_acct_attrs.array_char_value(3) := p_source_51;
125540 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
125541 l_rec_acct_attrs.array_num_value(4) := p_source_52;
125542 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
125543 l_rec_acct_attrs.array_char_value(5) := p_source_53;
125544 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
125545 l_rec_acct_attrs.array_num_value(6) := p_source_52;
125546
125547 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
125548 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
125549
125550 ---------------------------------------------------------------------------------------------------------------
125551 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
125552 ---------------------------------------------------------------------------------------------------------------
125553 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
125554
125555 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
125556 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
125557
125558 IF xla_accounting_cache_pkg.GetValueChar
125559 (p_source_code => 'LEDGER_CATEGORY_CODE'
125560 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
125561 AND l_bflow_method_code = 'PRIOR_ENTRY'
125562 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
125563 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
125564 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
125565 )
125566 THEN
125567 xla_ae_lines_pkg.BflowUpgEntry
125568 (p_business_method_code => l_bflow_method_code
125569 ,p_business_class_code => l_bflow_class_code
125570 ,p_balance_type => l_balance_type_code);
125571 ELSE
125572 NULL;
125573 -- No business flow processing for business flow method of NONE.
125574 END IF;
125575
125576 --
125577 -- call analytical criteria
125578 --
125579
125580 --
125581 -- call description
125582 --
125583
125584 xla_ae_lines_pkg.SetLineDescription(
125585 p_ae_header_id => l_ae_header_id
125586 ,p_description => Description_101 (
125587 p_application_id => p_application_id
125588 , p_ae_header_id => l_ae_header_id
125589 , p_source_1 => p_source_1
125590 )
125591 );
125592
125593
125594 --
125595 -- call ADRs
125596 -- Bug 4922099
125597 --
125598 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
125599 (NVL(l_actual_upg_option, 'N') = 'O') OR
125600 (NVL(l_enc_upg_option, 'N') = 'O')
125601 )
125602 THEN
125603 NULL;
125604 --
125605 --
125606
125607 l_ccid := AcctDerRule_176(
125608 p_application_id => p_application_id
125609 , p_ae_header_id => l_ae_header_id
125610 , p_source_5 => p_source_5
125611 , p_source_31 => p_source_31
125612 , x_transaction_coa_id => l_adr_transaction_coa_id
125613 , x_accounting_coa_id => l_adr_accounting_coa_id
125614 , x_value_type_code => l_adr_value_type_code
125615 , p_side => 'NA'
125616 );
125617
125621 , p_transaction_coa_id => l_adr_transaction_coa_id
125618 xla_ae_lines_pkg.set_ccid(
125619 p_code_combination_id => l_ccid
125620 , p_value_type_code => l_adr_value_type_code
125622 , p_accounting_coa_id => l_adr_accounting_coa_id
125623 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
125624 , p_adr_type_code => 'S'
125625 , p_component_type => l_component_type
125626 , p_component_code => l_component_code
125627 , p_component_type_code => l_component_type_code
125628 , p_component_appl_id => l_component_appl_id
125629 , p_amb_context_code => l_amb_context_code
125630 , p_side => 'NA'
125631 );
125632
125633
125634 --
125635 --
125636 END IF;
125637 --
125638 -- Bug 4922099
125639 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
125640 (NVL(l_enc_upg_option, 'N') = 'O')
125641 ) AND
125642 (l_bflow_method_code = 'PRIOR_ENTRY')
125643 )
125644 THEN
125645 IF
125646 --
125647 1 = 2
125648 --
125649 THEN
125650 xla_accounting_err_pkg.build_message
125651 (p_appli_s_name => 'XLA'
125652 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
125653 ,p_token_1 => 'LINE_NUMBER'
125654 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
125655 ,p_token_2 => 'LINE_TYPE_NAME'
125656 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
125657 l_component_type
125658 ,l_component_code
125659 ,l_component_type_code
125660 ,l_component_appl_id
125661 ,l_amb_context_code
125662 ,l_entity_code
125663 ,l_event_class_code
125664 )
125665 ,p_token_3 => 'OWNER'
125666 ,p_value_3 => xla_lookups_pkg.get_meaning(
125667 p_lookup_type => 'XLA_OWNER_TYPE'
125668 ,p_lookup_code => l_component_type_code
125669 )
125670 ,p_token_4 => 'PRODUCT_NAME'
125671 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
125672 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
125673 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
125674 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
125675 ,p_ae_header_id => NULL
125676 );
125677
125678 IF (C_LEVEL_ERROR>= g_log_level) THEN
125679 trace
125680 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
125681 ,p_level => C_LEVEL_ERROR
125682 ,p_module => l_log_module);
125683 END IF;
125684 END IF;
125685 END IF;
125686 --
125687 --
125688 ------------------------------------------------------------------------------------------------
125689 -- 4219869 Business Flow
125690 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
125691 -- Prior Entry. Currently, the following code is always generated.
125692 ------------------------------------------------------------------------------------------------
125693 XLA_AE_LINES_PKG.ValidateCurrentLine;
125694
125695 ------------------------------------------------------------------------------------
125696 -- 4219869 Business Flow
125697 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
125698 ------------------------------------------------------------------------------------
125699 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
125700
125701 ----------------------------------------------------------------------------------
125702 -- 4219869 Business Flow
125703 -- Update journal entry status -- Need to generate this within IF <condition>
125704 ----------------------------------------------------------------------------------
125705 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
125706 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
125707 ,p_balance_type_code => l_balance_type_code
125708 );
125709
125710 -------------------------------------------------------------------------------------------
125711 -- 4262811 - Generate the Accrual Reversal lines
125715 (g_array_event(p_event_id).array_value_num('header_index'));
125712 -------------------------------------------------------------------------------------------
125713 BEGIN
125714 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
125716 IF l_acc_rev_flag IS NULL THEN
125717 l_acc_rev_flag := 'N';
125718 END IF;
125719 EXCEPTION
125720 WHEN OTHERS THEN
125721 l_acc_rev_flag := 'N';
125722 END;
125723 --
125724 IF (l_acc_rev_flag = 'Y') THEN
125725
125726 -- 4645092 ------------------------------------------------------------------------------
125727 -- To allow MPA report to determine if it should generate report process
125728 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
125729 ------------------------------------------------------------------------------------------
125730
125731 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
125732 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
125733 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
125734 -- call ADRs
125735 -- Bug 4922099
125736 --
125737 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
125738 (NVL(l_actual_upg_option, 'N') = 'O') OR
125739 (NVL(l_enc_upg_option, 'N') = 'O')
125740 )
125741 THEN
125742 NULL;
125743 --
125744 --
125745
125746 l_ccid := AcctDerRule_176(
125747 p_application_id => p_application_id
125748 , p_ae_header_id => l_ae_header_id
125749 , p_source_5 => p_source_5
125750 , p_source_31 => p_source_31
125751 , x_transaction_coa_id => l_adr_transaction_coa_id
125752 , x_accounting_coa_id => l_adr_accounting_coa_id
125753 , x_value_type_code => l_adr_value_type_code
125754 , p_side => 'NA'
125755 );
125756
125757 xla_ae_lines_pkg.set_ccid(
125758 p_code_combination_id => l_ccid
125759 , p_value_type_code => l_adr_value_type_code
125760 , p_transaction_coa_id => l_adr_transaction_coa_id
125761 , p_accounting_coa_id => l_adr_accounting_coa_id
125762 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
125763 , p_adr_type_code => 'S'
125764 , p_component_type => l_component_type
125765 , p_component_code => l_component_code
125766 , p_component_type_code => l_component_type_code
125767 , p_component_appl_id => l_component_appl_id
125768 , p_amb_context_code => l_amb_context_code
125769 , p_side => 'NA'
125770 );
125771
125772
125773 --
125774 --
125775 END IF;
125776
125777 --
125778 -- Update the line information that should be overwritten
125779 --
125780 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
125781 p_header_num => 1);
125782 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
125783
125784 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
125785
125786 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
125787 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
125788 END IF;
125789
125790 --
125791 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
125792 --
125793 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
125794 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
125795 ELSE
125796 ---------------------------------------------------------------------------------------------------
125797 -- 4262811a Switch Sign
125798 ---------------------------------------------------------------------------------------------------
125799 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
125800 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
125801 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
125802 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
125803 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
125804 -- 5132302
125805 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
125806 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
125807
125808 END IF;
125809
125810 -- 4955764
125811 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
125812 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
125813
125814
125815 XLA_AE_LINES_PKG.ValidateCurrentLine;
125816 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
125817
125818 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
125819 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
125820 ,p_balance_type_code => l_balance_type_code);
125821
125822 END IF;
125823
125824 -----------------------------------------------------------------------------------------
125828
125825 -- 4262811 Multiperiod Accounting
125826 -----------------------------------------------------------------------------------------
125827 -- No MPA option is assigned.
125829
125830 END IF;
125831 END IF;
125832 --
125833
125834 --
125835 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
125836 trace
125837 (p_msg => 'END of AcctLineType_340'
125838 ,p_level => C_LEVEL_PROCEDURE
125839 ,p_module => l_log_module);
125840 END IF;
125841 --
125842 EXCEPTION
125843 WHEN xla_exceptions_pkg.application_exception THEN
125844 RAISE;
125845 WHEN OTHERS THEN
125846 xla_exceptions_pkg.raise_message
125847 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_340');
125848 END AcctLineType_340;
125849 --
125850
125851 ---------------------------------------
125852 --
125853 -- PRIVATE FUNCTION
125854 -- AcctLineType_341
125855 --
125856 ---------------------------------------
125857 PROCEDURE AcctLineType_341 (
125858 p_application_id IN NUMBER
125859 ,p_event_id IN NUMBER
125860 ,p_calculate_acctd_flag IN VARCHAR2
125861 ,p_calculate_g_l_flag IN VARCHAR2
125862 ,p_actual_flag IN OUT VARCHAR2
125863 ,p_balance_type_code OUT VARCHAR2
125864 ,p_gain_or_loss_ref OUT VARCHAR2
125865
125866 --Period Close Date
125867 , p_source_1 IN DATE
125868 --Bonus Depreciation Expense Account
125869 , p_source_4 IN VARCHAR2
125870 --Generated Code Combination Identifier
125871 , p_source_5 IN NUMBER
125872 --Expense Account Code Combination Identifier
125873 , p_source_31 IN NUMBER
125874 --Adjustment Type
125875 , p_source_48 IN VARCHAR2
125876 --Transaction Header Identifier
125877 , p_source_49 IN NUMBER
125878 --Adjustment Line Identifier
125879 , p_source_50 IN NUMBER
125880 --Distribution Type Code
125881 , p_source_51 IN VARCHAR2
125882 --Entered Amount
125883 , p_source_52 IN NUMBER
125884 --Currency Code
125885 , p_source_53 IN VARCHAR2
125886 )
125887 IS
125888
125889 l_component_type VARCHAR2(80);
125890 l_component_code VARCHAR2(30);
125891 l_component_type_code VARCHAR2(1);
125892 l_component_appl_id INTEGER;
125893 l_amb_context_code VARCHAR2(30);
125894 l_entity_code VARCHAR2(30);
125895 l_event_class_code VARCHAR2(30);
125896 l_ae_header_id NUMBER;
125897 l_event_type_code VARCHAR2(30);
125898 l_line_definition_code VARCHAR2(30);
125899 l_line_definition_owner_code VARCHAR2(1);
125900 --
125901 -- adr variables
125902 l_segment VARCHAR2(30);
125903 l_ccid NUMBER;
125904 l_adr_transaction_coa_id NUMBER;
125905 l_adr_accounting_coa_id NUMBER;
125906 l_adr_flexfield_segment_code VARCHAR2(30);
125907 l_adr_flex_value_set_id NUMBER;
125908 l_adr_value_type_code VARCHAR2(30);
125909 l_adr_value_combination_id NUMBER;
125910 l_adr_value_segment_code VARCHAR2(30);
125911
125912 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
125913 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
125914 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
125915 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
125916
125917 -- 4262811 Variables ------------------------------------------------------------------------------------------
125918 l_entered_amt_idx NUMBER;
125919 l_accted_amt_idx NUMBER;
125920 l_acc_rev_flag VARCHAR2(1);
125921 l_accrual_line_num NUMBER;
125922 l_tmp_amt NUMBER;
125923 l_acc_rev_natural_side_code VARCHAR2(1);
125924
125925 l_num_entries NUMBER;
125926 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
125927 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
125928 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
125929 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
125930 l_recog_line_1 NUMBER;
125931 l_recog_line_2 NUMBER;
125932
125933 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
125934 l_bflow_applied_to_amt NUMBER; -- 5132302
125935 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
125936
125937 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
125938
125939 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
125940 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
125941
125942 ---------------------------------------------------------------------------------------------------------------
125943
125944
125945 --
125946 -- bulk performance
125947 --
125948 l_balance_type_code VARCHAR2(1);
125949 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
125950 l_log_module VARCHAR2(240);
125951
125952 --
125953 -- Upgrade strategy
125954 --
125955 l_actual_upg_option VARCHAR2(1);
125956 l_enc_upg_option VARCHAR2(1);
125957
125958 --
125959 BEGIN
125960 --
125961 IF g_log_enabled THEN
125962 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_341';
125966
125963 END IF;
125964 --
125965 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
125967 trace
125968 (p_msg => 'BEGIN of AcctLineType_341'
125969 ,p_level => C_LEVEL_PROCEDURE
125970 ,p_module => l_log_module);
125971
125972 END IF;
125973 --
125974 l_component_type := 'AMB_JLT';
125975 l_component_code := 'FA_REV_BONUS_EXP';
125976 l_component_type_code := 'S';
125977 l_component_appl_id := 140;
125978 l_amb_context_code := 'DEFAULT';
125979 l_entity_code := 'TRANSACTIONS';
125980 l_event_class_code := 'CAPITALIZATION';
125981 l_event_type_code := 'REVERSE_CAPITALIZATION';
125982 l_line_definition_owner_code := 'S';
125983 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVER22';
125984 --
125985 l_balance_type_code := 'A';
125986 l_segment := NULL;
125987 l_ccid := NULL;
125988 l_adr_transaction_coa_id := NULL;
125989 l_adr_accounting_coa_id := NULL;
125990 l_adr_flexfield_segment_code := NULL;
125991 l_adr_flex_value_set_id := NULL;
125992 l_adr_value_type_code := NULL;
125993 l_adr_value_combination_id := NULL;
125994 l_adr_value_segment_code := NULL;
125995
125996 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
125997 l_bflow_class_code := ''; -- 4219869 Business Flow
125998 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
125999 l_budgetary_control_flag := 'N';
126000
126001 l_bflow_applied_to_amt_idx := NULL; -- 5132302
126002 l_bflow_applied_to_amt := NULL; -- 5132302
126003 l_entered_amt_idx := NULL; -- 4262811
126004 l_accted_amt_idx := NULL; -- 4262811
126005 l_acc_rev_flag := NULL; -- 4262811
126006 l_accrual_line_num := NULL; -- 4262811
126007 l_tmp_amt := NULL; -- 4262811
126008 --
126009
126010 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
126011 l_balance_type_code <> 'B' THEN
126012 IF NVL(p_source_48,'
126013 ') = 'BONUS EXPENSE'
126014 THEN
126015
126016 --
126017 XLA_AE_LINES_PKG.SetNewLine;
126018
126019 p_balance_type_code := l_balance_type_code;
126020 -- set the flag so later we will know whether the gain loss line needs to be created
126021
126022 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
126023 p_actual_flag :='A';
126024 END IF;
126025
126026 --
126027 -- bulk performance
126028 --
126029 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
126030 p_header_num => 0); -- 4262811
126031 --
126032 -- set accounting line options
126033 --
126034 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
126035 p_natural_side_code => 'D'
126036 , p_gain_or_loss_flag => 'N'
126037 , p_gl_transfer_mode_code => 'S'
126038 , p_acct_entry_type_code => 'A'
126039 , p_switch_side_flag => 'Y'
126040 , p_merge_duplicate_code => 'N'
126041 );
126042 --
126043 l_acc_rev_natural_side_code := 'C'; -- 4262811
126044 --
126045 --
126046 -- set accounting line type info
126047 --
126048 xla_ae_lines_pkg.SetAcctLineType
126049 (p_component_type => l_component_type
126050 ,p_event_type_code => l_event_type_code
126051 ,p_line_definition_owner_code => l_line_definition_owner_code
126052 ,p_line_definition_code => l_line_definition_code
126053 ,p_accounting_line_code => l_component_code
126054 ,p_accounting_line_type_code => l_component_type_code
126055 ,p_accounting_line_appl_id => l_component_appl_id
126056 ,p_amb_context_code => l_amb_context_code
126057 ,p_entity_code => l_entity_code
126058 ,p_event_class_code => l_event_class_code);
126059 --
126060 -- set accounting class
126061 --
126062 xla_ae_lines_pkg.SetAcctClass(
126063 p_accounting_class_code => 'EXPENSE'
126064 , p_ae_header_id => l_ae_header_id
126065 );
126066
126067 --
126068 -- set rounding class
126069 --
126070 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
126071 'EXPENSE';
126072
126073 --
126074 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
126075 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
126076 --
126077 -- bulk performance
126078 --
126079 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
126080
126081 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
126082 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
126083
126084 -- 4955764
126085 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
126086 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
126087
126088 -- 4458381 Public Sector Enh
126089
126090 --
126091 -- set accounting attributes for the line type
126092 --
126096 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
126093 l_entered_amt_idx := 4;
126094 l_accted_amt_idx := 6;
126095 l_bflow_applied_to_amt_idx := NULL; -- 5132302
126097 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
126098 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
126099 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
126100 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
126101 l_rec_acct_attrs.array_char_value(3) := p_source_51;
126102 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
126103 l_rec_acct_attrs.array_num_value(4) := p_source_52;
126104 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
126105 l_rec_acct_attrs.array_char_value(5) := p_source_53;
126106 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
126107 l_rec_acct_attrs.array_num_value(6) := p_source_52;
126108
126109 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
126110 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
126111
126112 ---------------------------------------------------------------------------------------------------------------
126113 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
126114 ---------------------------------------------------------------------------------------------------------------
126115 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
126116
126117 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
126118 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
126119
126120 IF xla_accounting_cache_pkg.GetValueChar
126121 (p_source_code => 'LEDGER_CATEGORY_CODE'
126122 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
126123 AND l_bflow_method_code = 'PRIOR_ENTRY'
126124 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
126125 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
126126 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
126127 )
126128 THEN
126129 xla_ae_lines_pkg.BflowUpgEntry
126130 (p_business_method_code => l_bflow_method_code
126131 ,p_business_class_code => l_bflow_class_code
126132 ,p_balance_type => l_balance_type_code);
126133 ELSE
126134 NULL;
126135 -- No business flow processing for business flow method of NONE.
126136 END IF;
126137
126138 --
126139 -- call analytical criteria
126140 --
126141
126142 --
126143 -- call description
126144 --
126145
126146 xla_ae_lines_pkg.SetLineDescription(
126147 p_ae_header_id => l_ae_header_id
126148 ,p_description => Description_97 (
126149 p_application_id => p_application_id
126150 , p_ae_header_id => l_ae_header_id
126151 , p_source_1 => p_source_1
126152 )
126153 );
126154
126155
126156 --
126157 -- call ADRs
126158 -- Bug 4922099
126159 --
126160 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
126161 (NVL(l_actual_upg_option, 'N') = 'O') OR
126162 (NVL(l_enc_upg_option, 'N') = 'O')
126163 )
126164 THEN
126165 NULL;
126166 --
126167 --
126168
126169 l_ccid := AcctDerRule_176(
126170 p_application_id => p_application_id
126171 , p_ae_header_id => l_ae_header_id
126172 , p_source_5 => p_source_5
126173 , p_source_31 => p_source_31
126174 , x_transaction_coa_id => l_adr_transaction_coa_id
126175 , x_accounting_coa_id => l_adr_accounting_coa_id
126176 , x_value_type_code => l_adr_value_type_code
126177 , p_side => 'NA'
126178 );
126179
126180 xla_ae_lines_pkg.set_ccid(
126181 p_code_combination_id => l_ccid
126182 , p_value_type_code => l_adr_value_type_code
126183 , p_transaction_coa_id => l_adr_transaction_coa_id
126184 , p_accounting_coa_id => l_adr_accounting_coa_id
126185 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
126186 , p_adr_type_code => 'S'
126187 , p_component_type => l_component_type
126188 , p_component_code => l_component_code
126189 , p_component_type_code => l_component_type_code
126190 , p_component_appl_id => l_component_appl_id
126191 , p_amb_context_code => l_amb_context_code
126192 , p_side => 'NA'
126193 );
126194
126195
126196 l_segment := AcctDerRule_144(
126197 p_application_id => p_application_id
126198 , p_ae_header_id => l_ae_header_id
126199 , p_source_4 => p_source_4
126200 , p_source_5 => p_source_5
126201 , x_transaction_coa_id => l_adr_transaction_coa_id
126202 , x_accounting_coa_id => l_adr_accounting_coa_id
126203 , x_flexfield_segment_code => l_adr_flexfield_segment_code
126204 , x_flex_value_set_id => l_adr_flex_value_set_id
126205 , x_value_type_code => l_adr_value_type_code
126206 , x_value_combination_id => l_adr_value_combination_id
126210 );
126207 , x_value_segment_code => l_adr_value_segment_code
126208 , p_side => 'NA'
126209 , p_override_seg_flag => 'Y'
126211
126212 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
126213
126214 xla_ae_lines_pkg.set_segment(
126215 p_to_segment_code => 'GL_ACCOUNT'
126216 , p_segment_value => l_segment
126217 , p_from_segment_code => l_adr_value_segment_code
126218 , p_from_combination_id => l_adr_value_combination_id
126219 , p_value_type_code => l_adr_value_type_code
126220 , p_transaction_coa_id => l_adr_transaction_coa_id
126221 , p_accounting_coa_id => l_adr_accounting_coa_id
126222 , p_flexfield_segment_code => l_adr_flexfield_segment_code
126223 , p_flex_value_set_id => l_adr_flex_value_set_id
126224 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
126225 , p_adr_type_code => 'S'
126226 , p_component_type => l_component_type
126227 , p_component_code => l_component_code
126228 , p_component_type_code => l_component_type_code
126229 , p_component_appl_id => l_component_appl_id
126230 , p_amb_context_code => l_amb_context_code
126231 , p_entity_code => 'TRANSACTIONS'
126232 , p_event_class_code => 'CAPITALIZATION'
126233 , p_side => 'NA'
126234 );
126235
126236 END IF;
126237
126238 --
126239 --
126240 END IF;
126241 --
126242 -- Bug 4922099
126243 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
126244 (NVL(l_enc_upg_option, 'N') = 'O')
126245 ) AND
126246 (l_bflow_method_code = 'PRIOR_ENTRY')
126247 )
126248 THEN
126249 IF
126250 --
126251 1 = 2
126252 --
126253 THEN
126254 xla_accounting_err_pkg.build_message
126255 (p_appli_s_name => 'XLA'
126256 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
126257 ,p_token_1 => 'LINE_NUMBER'
126258 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
126259 ,p_token_2 => 'LINE_TYPE_NAME'
126260 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
126261 l_component_type
126262 ,l_component_code
126263 ,l_component_type_code
126264 ,l_component_appl_id
126265 ,l_amb_context_code
126266 ,l_entity_code
126267 ,l_event_class_code
126268 )
126269 ,p_token_3 => 'OWNER'
126270 ,p_value_3 => xla_lookups_pkg.get_meaning(
126271 p_lookup_type => 'XLA_OWNER_TYPE'
126272 ,p_lookup_code => l_component_type_code
126273 )
126274 ,p_token_4 => 'PRODUCT_NAME'
126275 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
126276 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
126277 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
126278 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
126279 ,p_ae_header_id => NULL
126280 );
126281
126282 IF (C_LEVEL_ERROR>= g_log_level) THEN
126283 trace
126284 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
126285 ,p_level => C_LEVEL_ERROR
126286 ,p_module => l_log_module);
126287 END IF;
126288 END IF;
126289 END IF;
126290 --
126291 --
126292 ------------------------------------------------------------------------------------------------
126293 -- 4219869 Business Flow
126294 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
126295 -- Prior Entry. Currently, the following code is always generated.
126296 ------------------------------------------------------------------------------------------------
126297 XLA_AE_LINES_PKG.ValidateCurrentLine;
126298
126299 ------------------------------------------------------------------------------------
126300 -- 4219869 Business Flow
126301 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
126302 ------------------------------------------------------------------------------------
126303 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
126304
126308 ----------------------------------------------------------------------------------
126305 ----------------------------------------------------------------------------------
126306 -- 4219869 Business Flow
126307 -- Update journal entry status -- Need to generate this within IF <condition>
126309 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
126310 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
126311 ,p_balance_type_code => l_balance_type_code
126312 );
126313
126314 -------------------------------------------------------------------------------------------
126315 -- 4262811 - Generate the Accrual Reversal lines
126316 -------------------------------------------------------------------------------------------
126317 BEGIN
126318 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
126319 (g_array_event(p_event_id).array_value_num('header_index'));
126320 IF l_acc_rev_flag IS NULL THEN
126321 l_acc_rev_flag := 'N';
126322 END IF;
126323 EXCEPTION
126324 WHEN OTHERS THEN
126325 l_acc_rev_flag := 'N';
126326 END;
126327 --
126328 IF (l_acc_rev_flag = 'Y') THEN
126329
126330 -- 4645092 ------------------------------------------------------------------------------
126331 -- To allow MPA report to determine if it should generate report process
126332 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
126333 ------------------------------------------------------------------------------------------
126334
126335 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
126336 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
126337 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
126338 -- call ADRs
126339 -- Bug 4922099
126340 --
126341 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
126342 (NVL(l_actual_upg_option, 'N') = 'O') OR
126343 (NVL(l_enc_upg_option, 'N') = 'O')
126344 )
126345 THEN
126346 NULL;
126347 --
126348 --
126349
126350 l_ccid := AcctDerRule_176(
126351 p_application_id => p_application_id
126352 , p_ae_header_id => l_ae_header_id
126353 , p_source_5 => p_source_5
126354 , p_source_31 => p_source_31
126355 , x_transaction_coa_id => l_adr_transaction_coa_id
126356 , x_accounting_coa_id => l_adr_accounting_coa_id
126357 , x_value_type_code => l_adr_value_type_code
126358 , p_side => 'NA'
126359 );
126360
126361 xla_ae_lines_pkg.set_ccid(
126362 p_code_combination_id => l_ccid
126363 , p_value_type_code => l_adr_value_type_code
126364 , p_transaction_coa_id => l_adr_transaction_coa_id
126365 , p_accounting_coa_id => l_adr_accounting_coa_id
126366 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
126367 , p_adr_type_code => 'S'
126368 , p_component_type => l_component_type
126369 , p_component_code => l_component_code
126370 , p_component_type_code => l_component_type_code
126371 , p_component_appl_id => l_component_appl_id
126372 , p_amb_context_code => l_amb_context_code
126373 , p_side => 'NA'
126374 );
126375
126376
126377 l_segment := AcctDerRule_144(
126378 p_application_id => p_application_id
126379 , p_ae_header_id => l_ae_header_id
126380 , p_source_4 => p_source_4
126381 , p_source_5 => p_source_5
126382 , x_transaction_coa_id => l_adr_transaction_coa_id
126383 , x_accounting_coa_id => l_adr_accounting_coa_id
126384 , x_flexfield_segment_code => l_adr_flexfield_segment_code
126385 , x_flex_value_set_id => l_adr_flex_value_set_id
126386 , x_value_type_code => l_adr_value_type_code
126387 , x_value_combination_id => l_adr_value_combination_id
126388 , x_value_segment_code => l_adr_value_segment_code
126389 , p_side => 'NA'
126390 , p_override_seg_flag => 'Y'
126391 );
126392
126393 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
126394
126395 xla_ae_lines_pkg.set_segment(
126396 p_to_segment_code => 'GL_ACCOUNT'
126397 , p_segment_value => l_segment
126398 , p_from_segment_code => l_adr_value_segment_code
126399 , p_from_combination_id => l_adr_value_combination_id
126400 , p_value_type_code => l_adr_value_type_code
126401 , p_transaction_coa_id => l_adr_transaction_coa_id
126402 , p_accounting_coa_id => l_adr_accounting_coa_id
126403 , p_flexfield_segment_code => l_adr_flexfield_segment_code
126404 , p_flex_value_set_id => l_adr_flex_value_set_id
126405 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
126406 , p_adr_type_code => 'S'
126407 , p_component_type => l_component_type
126408 , p_component_code => l_component_code
126409 , p_component_type_code => l_component_type_code
126410 , p_component_appl_id => l_component_appl_id
126411 , p_amb_context_code => l_amb_context_code
126412 , p_entity_code => 'TRANSACTIONS'
126413 , p_event_class_code => 'CAPITALIZATION'
126414 , p_side => 'NA'
126415 );
126416
126417 END IF;
126418
126419 --
126423 --
126420 --
126421 END IF;
126422
126424 -- Update the line information that should be overwritten
126425 --
126426 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
126427 p_header_num => 1);
126428 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
126429
126430 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
126431
126432 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
126433 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
126434 END IF;
126435
126436 --
126437 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
126438 --
126439 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
126440 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
126441 ELSE
126442 ---------------------------------------------------------------------------------------------------
126443 -- 4262811a Switch Sign
126444 ---------------------------------------------------------------------------------------------------
126445 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
126446 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
126447 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
126448 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
126449 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
126450 -- 5132302
126451 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
126452 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
126453
126454 END IF;
126455
126456 -- 4955764
126457 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
126458 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
126459
126460
126461 XLA_AE_LINES_PKG.ValidateCurrentLine;
126462 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
126463
126464 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
126465 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
126466 ,p_balance_type_code => l_balance_type_code);
126467
126468 END IF;
126469
126470 -----------------------------------------------------------------------------------------
126471 -- 4262811 Multiperiod Accounting
126472 -----------------------------------------------------------------------------------------
126473 -- No MPA option is assigned.
126474
126475
126476 END IF;
126477 END IF;
126478 --
126479
126480 --
126481 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
126482 trace
126483 (p_msg => 'END of AcctLineType_341'
126484 ,p_level => C_LEVEL_PROCEDURE
126485 ,p_module => l_log_module);
126486 END IF;
126487 --
126488 EXCEPTION
126489 WHEN xla_exceptions_pkg.application_exception THEN
126490 RAISE;
126491 WHEN OTHERS THEN
126492 xla_exceptions_pkg.raise_message
126493 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_341');
126494 END AcctLineType_341;
126495 --
126496
126497 ---------------------------------------
126498 --
126499 -- PRIVATE FUNCTION
126500 -- AcctLineType_342
126501 --
126502 ---------------------------------------
126503 PROCEDURE AcctLineType_342 (
126504 p_application_id IN NUMBER
126505 ,p_event_id IN NUMBER
126506 ,p_calculate_acctd_flag IN VARCHAR2
126507 ,p_calculate_g_l_flag IN VARCHAR2
126508 ,p_actual_flag IN OUT VARCHAR2
126509 ,p_balance_type_code OUT VARCHAR2
126510 ,p_gain_or_loss_ref OUT VARCHAR2
126511
126512 --Period Close Date
126513 , p_source_1 IN DATE
126514 --Generated Code Combination Identifier
126515 , p_source_5 IN NUMBER
126516 --Bonus Reserve Account
126517 , p_source_6 IN VARCHAR2
126518 --Generated Offset Code Combination Identifier
126519 , p_source_19 IN NUMBER
126520 --Expense Account Code Combination Identifier
126521 , p_source_31 IN NUMBER
126522 --Default Code Combination Identifier
126523 , p_source_32 IN NUMBER
126524 --Adjustment Type
126525 , p_source_48 IN VARCHAR2
126526 --Transaction Header Identifier
126527 , p_source_49 IN NUMBER
126528 --Adjustment Line Identifier
126529 , p_source_50 IN NUMBER
126530 --Distribution Type Code
126531 , p_source_51 IN VARCHAR2
126532 --Entered Amount
126533 , p_source_52 IN NUMBER
126534 --Currency Code
126535 , p_source_53 IN VARCHAR2
126536 )
126537 IS
126538
126539 l_component_type VARCHAR2(80);
126540 l_component_code VARCHAR2(30);
126541 l_component_type_code VARCHAR2(1);
126542 l_component_appl_id INTEGER;
126543 l_amb_context_code VARCHAR2(30);
126544 l_entity_code VARCHAR2(30);
126548 l_line_definition_code VARCHAR2(30);
126545 l_event_class_code VARCHAR2(30);
126546 l_ae_header_id NUMBER;
126547 l_event_type_code VARCHAR2(30);
126549 l_line_definition_owner_code VARCHAR2(1);
126550 --
126551 -- adr variables
126552 l_segment VARCHAR2(30);
126553 l_ccid NUMBER;
126554 l_adr_transaction_coa_id NUMBER;
126555 l_adr_accounting_coa_id NUMBER;
126556 l_adr_flexfield_segment_code VARCHAR2(30);
126557 l_adr_flex_value_set_id NUMBER;
126558 l_adr_value_type_code VARCHAR2(30);
126559 l_adr_value_combination_id NUMBER;
126560 l_adr_value_segment_code VARCHAR2(30);
126561
126562 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
126563 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
126564 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
126565 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
126566
126567 -- 4262811 Variables ------------------------------------------------------------------------------------------
126568 l_entered_amt_idx NUMBER;
126569 l_accted_amt_idx NUMBER;
126570 l_acc_rev_flag VARCHAR2(1);
126571 l_accrual_line_num NUMBER;
126572 l_tmp_amt NUMBER;
126573 l_acc_rev_natural_side_code VARCHAR2(1);
126574
126575 l_num_entries NUMBER;
126576 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
126577 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
126578 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
126579 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
126580 l_recog_line_1 NUMBER;
126581 l_recog_line_2 NUMBER;
126582
126583 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
126584 l_bflow_applied_to_amt NUMBER; -- 5132302
126585 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
126586
126587 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
126588
126589 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
126590 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
126591
126592 ---------------------------------------------------------------------------------------------------------------
126593
126594
126595 --
126596 -- bulk performance
126597 --
126598 l_balance_type_code VARCHAR2(1);
126599 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
126600 l_log_module VARCHAR2(240);
126601
126602 --
126603 -- Upgrade strategy
126604 --
126605 l_actual_upg_option VARCHAR2(1);
126606 l_enc_upg_option VARCHAR2(1);
126607
126608 --
126609 BEGIN
126610 --
126611 IF g_log_enabled THEN
126612 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_342';
126613 END IF;
126614 --
126615 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
126616
126617 trace
126618 (p_msg => 'BEGIN of AcctLineType_342'
126619 ,p_level => C_LEVEL_PROCEDURE
126620 ,p_module => l_log_module);
126621
126622 END IF;
126623 --
126624 l_component_type := 'AMB_JLT';
126625 l_component_code := 'FA_REV_BONUS_RESERVE';
126626 l_component_type_code := 'S';
126627 l_component_appl_id := 140;
126628 l_amb_context_code := 'DEFAULT';
126629 l_entity_code := 'TRANSACTIONS';
126630 l_event_class_code := 'CAPITALIZATION';
126631 l_event_type_code := 'REVERSE_CAPITALIZATION';
126632 l_line_definition_owner_code := 'S';
126633 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVER22';
126634 --
126635 l_balance_type_code := 'A';
126636 l_segment := NULL;
126637 l_ccid := NULL;
126638 l_adr_transaction_coa_id := NULL;
126639 l_adr_accounting_coa_id := NULL;
126640 l_adr_flexfield_segment_code := NULL;
126641 l_adr_flex_value_set_id := NULL;
126642 l_adr_value_type_code := NULL;
126643 l_adr_value_combination_id := NULL;
126644 l_adr_value_segment_code := NULL;
126645
126646 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
126647 l_bflow_class_code := ''; -- 4219869 Business Flow
126648 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
126649 l_budgetary_control_flag := 'N';
126650
126651 l_bflow_applied_to_amt_idx := NULL; -- 5132302
126652 l_bflow_applied_to_amt := NULL; -- 5132302
126653 l_entered_amt_idx := NULL; -- 4262811
126654 l_accted_amt_idx := NULL; -- 4262811
126655 l_acc_rev_flag := NULL; -- 4262811
126656 l_accrual_line_num := NULL; -- 4262811
126657 l_tmp_amt := NULL; -- 4262811
126658 --
126659
126660 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
126661 l_balance_type_code <> 'B' THEN
126662 IF NVL(p_source_48,'
126663 ') = 'BONUS EXPENSE'
126664 THEN
126665
126666 --
126667 XLA_AE_LINES_PKG.SetNewLine;
126668
126669 p_balance_type_code := l_balance_type_code;
126673 p_actual_flag :='A';
126670 -- set the flag so later we will know whether the gain loss line needs to be created
126671
126672 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
126674 END IF;
126675
126676 --
126677 -- bulk performance
126678 --
126679 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
126680 p_header_num => 0); -- 4262811
126681 --
126682 -- set accounting line options
126683 --
126684 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
126685 p_natural_side_code => 'C'
126686 , p_gain_or_loss_flag => 'N'
126687 , p_gl_transfer_mode_code => 'S'
126688 , p_acct_entry_type_code => 'A'
126689 , p_switch_side_flag => 'Y'
126690 , p_merge_duplicate_code => 'N'
126691 );
126692 --
126693 l_acc_rev_natural_side_code := 'D'; -- 4262811
126694 --
126695 --
126696 -- set accounting line type info
126697 --
126698 xla_ae_lines_pkg.SetAcctLineType
126699 (p_component_type => l_component_type
126700 ,p_event_type_code => l_event_type_code
126701 ,p_line_definition_owner_code => l_line_definition_owner_code
126702 ,p_line_definition_code => l_line_definition_code
126703 ,p_accounting_line_code => l_component_code
126704 ,p_accounting_line_type_code => l_component_type_code
126705 ,p_accounting_line_appl_id => l_component_appl_id
126706 ,p_amb_context_code => l_amb_context_code
126707 ,p_entity_code => l_entity_code
126708 ,p_event_class_code => l_event_class_code);
126709 --
126710 -- set accounting class
126711 --
126712 xla_ae_lines_pkg.SetAcctClass(
126713 p_accounting_class_code => 'ASSET'
126714 , p_ae_header_id => l_ae_header_id
126715 );
126716
126717 --
126718 -- set rounding class
126719 --
126720 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
126721 'ASSET';
126722
126723 --
126724 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
126725 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
126726 --
126727 -- bulk performance
126728 --
126729 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
126730
126731 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
126732 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
126733
126734 -- 4955764
126735 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
126736 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
126737
126738 -- 4458381 Public Sector Enh
126739
126740 --
126741 -- set accounting attributes for the line type
126742 --
126743 l_entered_amt_idx := 4;
126744 l_accted_amt_idx := 6;
126745 l_bflow_applied_to_amt_idx := NULL; -- 5132302
126746 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
126747 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
126748 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
126749 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
126750 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
126751 l_rec_acct_attrs.array_char_value(3) := p_source_51;
126752 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
126753 l_rec_acct_attrs.array_num_value(4) := p_source_52;
126754 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
126755 l_rec_acct_attrs.array_char_value(5) := p_source_53;
126756 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
126757 l_rec_acct_attrs.array_num_value(6) := p_source_52;
126758
126759 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
126760 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
126761
126762 ---------------------------------------------------------------------------------------------------------------
126763 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
126764 ---------------------------------------------------------------------------------------------------------------
126765 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
126766
126767 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
126768 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
126769
126770 IF xla_accounting_cache_pkg.GetValueChar
126771 (p_source_code => 'LEDGER_CATEGORY_CODE'
126772 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
126773 AND l_bflow_method_code = 'PRIOR_ENTRY'
126774 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
126775 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
126776 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
126777 )
126778 THEN
126779 xla_ae_lines_pkg.BflowUpgEntry
126783 ELSE
126780 (p_business_method_code => l_bflow_method_code
126781 ,p_business_class_code => l_bflow_class_code
126782 ,p_balance_type => l_balance_type_code);
126784 NULL;
126785 -- No business flow processing for business flow method of NONE.
126786 END IF;
126787
126788 --
126789 -- call analytical criteria
126790 --
126791
126792 --
126793 -- call description
126794 --
126795
126796 xla_ae_lines_pkg.SetLineDescription(
126797 p_ae_header_id => l_ae_header_id
126798 ,p_description => Description_98 (
126799 p_application_id => p_application_id
126800 , p_ae_header_id => l_ae_header_id
126801 , p_source_1 => p_source_1
126802 )
126803 );
126804
126805
126806 --
126807 -- call ADRs
126808 -- Bug 4922099
126809 --
126810 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
126811 (NVL(l_actual_upg_option, 'N') = 'O') OR
126812 (NVL(l_enc_upg_option, 'N') = 'O')
126813 )
126814 THEN
126815 NULL;
126816 --
126817 --
126818
126819 l_ccid := AcctDerRule_175(
126820 p_application_id => p_application_id
126821 , p_ae_header_id => l_ae_header_id
126822 , p_source_5 => p_source_5
126823 , p_source_19 => p_source_19
126824 , p_source_32 => p_source_32
126825 , x_transaction_coa_id => l_adr_transaction_coa_id
126826 , x_accounting_coa_id => l_adr_accounting_coa_id
126827 , x_value_type_code => l_adr_value_type_code
126828 , p_side => 'NA'
126829 );
126830
126831 xla_ae_lines_pkg.set_ccid(
126832 p_code_combination_id => l_ccid
126833 , p_value_type_code => l_adr_value_type_code
126834 , p_transaction_coa_id => l_adr_transaction_coa_id
126835 , p_accounting_coa_id => l_adr_accounting_coa_id
126836 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
126837 , p_adr_type_code => 'S'
126838 , p_component_type => l_component_type
126839 , p_component_code => l_component_code
126840 , p_component_type_code => l_component_type_code
126841 , p_component_appl_id => l_component_appl_id
126842 , p_amb_context_code => l_amb_context_code
126843 , p_side => 'NA'
126844 );
126845
126846
126847 l_segment := AcctDerRule_145(
126848 p_application_id => p_application_id
126849 , p_ae_header_id => l_ae_header_id
126850 , p_source_5 => p_source_5
126851 , p_source_6 => p_source_6
126852 , x_transaction_coa_id => l_adr_transaction_coa_id
126853 , x_accounting_coa_id => l_adr_accounting_coa_id
126854 , x_flexfield_segment_code => l_adr_flexfield_segment_code
126855 , x_flex_value_set_id => l_adr_flex_value_set_id
126856 , x_value_type_code => l_adr_value_type_code
126857 , x_value_combination_id => l_adr_value_combination_id
126858 , x_value_segment_code => l_adr_value_segment_code
126859 , p_side => 'NA'
126860 , p_override_seg_flag => 'Y'
126861 );
126862
126863 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
126864
126865 xla_ae_lines_pkg.set_segment(
126866 p_to_segment_code => 'GL_ACCOUNT'
126867 , p_segment_value => l_segment
126868 , p_from_segment_code => l_adr_value_segment_code
126869 , p_from_combination_id => l_adr_value_combination_id
126870 , p_value_type_code => l_adr_value_type_code
126871 , p_transaction_coa_id => l_adr_transaction_coa_id
126872 , p_accounting_coa_id => l_adr_accounting_coa_id
126873 , p_flexfield_segment_code => l_adr_flexfield_segment_code
126874 , p_flex_value_set_id => l_adr_flex_value_set_id
126875 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
126876 , p_adr_type_code => 'S'
126877 , p_component_type => l_component_type
126878 , p_component_code => l_component_code
126879 , p_component_type_code => l_component_type_code
126880 , p_component_appl_id => l_component_appl_id
126881 , p_amb_context_code => l_amb_context_code
126882 , p_entity_code => 'TRANSACTIONS'
126883 , p_event_class_code => 'CAPITALIZATION'
126884 , p_side => 'NA'
126885 );
126886
126887 END IF;
126888
126889 l_segment := AcctDerRule_169(
126890 p_application_id => p_application_id
126891 , p_ae_header_id => l_ae_header_id
126892 , p_source_5 => p_source_5
126893 , p_source_31 => p_source_31
126894 , x_transaction_coa_id => l_adr_transaction_coa_id
126895 , x_accounting_coa_id => l_adr_accounting_coa_id
126896 , x_flexfield_segment_code => l_adr_flexfield_segment_code
126897 , x_flex_value_set_id => l_adr_flex_value_set_id
126898 , x_value_type_code => l_adr_value_type_code
126899 , x_value_combination_id => l_adr_value_combination_id
126900 , x_value_segment_code => l_adr_value_segment_code
126901 , p_side => 'NA'
126902 , p_override_seg_flag => 'Y'
126903 );
126904
126905 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
126906
126910 , p_from_segment_code => l_adr_value_segment_code
126907 xla_ae_lines_pkg.set_segment(
126908 p_to_segment_code => 'GL_BALANCING'
126909 , p_segment_value => l_segment
126911 , p_from_combination_id => l_adr_value_combination_id
126912 , p_value_type_code => l_adr_value_type_code
126913 , p_transaction_coa_id => l_adr_transaction_coa_id
126914 , p_accounting_coa_id => l_adr_accounting_coa_id
126915 , p_flexfield_segment_code => l_adr_flexfield_segment_code
126916 , p_flex_value_set_id => l_adr_flex_value_set_id
126917 , p_adr_code => 'FA_EXPENSE_ACCT'
126918 , p_adr_type_code => 'S'
126919 , p_component_type => l_component_type
126920 , p_component_code => l_component_code
126921 , p_component_type_code => l_component_type_code
126922 , p_component_appl_id => l_component_appl_id
126923 , p_amb_context_code => l_amb_context_code
126924 , p_entity_code => 'TRANSACTIONS'
126925 , p_event_class_code => 'CAPITALIZATION'
126926 , p_side => 'NA'
126927 );
126928
126929 END IF;
126930
126931 --
126932 --
126933 END IF;
126934 --
126935 -- Bug 4922099
126936 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
126937 (NVL(l_enc_upg_option, 'N') = 'O')
126938 ) AND
126939 (l_bflow_method_code = 'PRIOR_ENTRY')
126940 )
126941 THEN
126942 IF
126943 --
126944 1 = 2
126945 --
126946 THEN
126947 xla_accounting_err_pkg.build_message
126948 (p_appli_s_name => 'XLA'
126949 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
126950 ,p_token_1 => 'LINE_NUMBER'
126951 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
126952 ,p_token_2 => 'LINE_TYPE_NAME'
126953 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
126954 l_component_type
126955 ,l_component_code
126956 ,l_component_type_code
126957 ,l_component_appl_id
126958 ,l_amb_context_code
126959 ,l_entity_code
126960 ,l_event_class_code
126961 )
126962 ,p_token_3 => 'OWNER'
126963 ,p_value_3 => xla_lookups_pkg.get_meaning(
126964 p_lookup_type => 'XLA_OWNER_TYPE'
126965 ,p_lookup_code => l_component_type_code
126966 )
126967 ,p_token_4 => 'PRODUCT_NAME'
126968 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
126969 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
126970 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
126971 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
126972 ,p_ae_header_id => NULL
126973 );
126974
126975 IF (C_LEVEL_ERROR>= g_log_level) THEN
126976 trace
126977 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
126978 ,p_level => C_LEVEL_ERROR
126979 ,p_module => l_log_module);
126980 END IF;
126981 END IF;
126982 END IF;
126983 --
126984 --
126985 ------------------------------------------------------------------------------------------------
126986 -- 4219869 Business Flow
126987 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
126988 -- Prior Entry. Currently, the following code is always generated.
126989 ------------------------------------------------------------------------------------------------
126990 XLA_AE_LINES_PKG.ValidateCurrentLine;
126991
126992 ------------------------------------------------------------------------------------
126993 -- 4219869 Business Flow
126994 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
126995 ------------------------------------------------------------------------------------
126996 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
126997
126998 ----------------------------------------------------------------------------------
126999 -- 4219869 Business Flow
127000 -- Update journal entry status -- Need to generate this within IF <condition>
127001 ----------------------------------------------------------------------------------
127002 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
127006
127003 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
127004 ,p_balance_type_code => l_balance_type_code
127005 );
127007 -------------------------------------------------------------------------------------------
127008 -- 4262811 - Generate the Accrual Reversal lines
127009 -------------------------------------------------------------------------------------------
127010 BEGIN
127011 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
127012 (g_array_event(p_event_id).array_value_num('header_index'));
127013 IF l_acc_rev_flag IS NULL THEN
127014 l_acc_rev_flag := 'N';
127015 END IF;
127016 EXCEPTION
127017 WHEN OTHERS THEN
127018 l_acc_rev_flag := 'N';
127019 END;
127020 --
127021 IF (l_acc_rev_flag = 'Y') THEN
127022
127023 -- 4645092 ------------------------------------------------------------------------------
127024 -- To allow MPA report to determine if it should generate report process
127025 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
127026 ------------------------------------------------------------------------------------------
127027
127028 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
127029 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
127030 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
127031 -- call ADRs
127032 -- Bug 4922099
127033 --
127034 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
127035 (NVL(l_actual_upg_option, 'N') = 'O') OR
127036 (NVL(l_enc_upg_option, 'N') = 'O')
127037 )
127038 THEN
127039 NULL;
127040 --
127041 --
127042
127043 l_ccid := AcctDerRule_175(
127044 p_application_id => p_application_id
127045 , p_ae_header_id => l_ae_header_id
127046 , p_source_5 => p_source_5
127047 , p_source_19 => p_source_19
127048 , p_source_32 => p_source_32
127049 , x_transaction_coa_id => l_adr_transaction_coa_id
127050 , x_accounting_coa_id => l_adr_accounting_coa_id
127051 , x_value_type_code => l_adr_value_type_code
127052 , p_side => 'NA'
127053 );
127054
127055 xla_ae_lines_pkg.set_ccid(
127056 p_code_combination_id => l_ccid
127057 , p_value_type_code => l_adr_value_type_code
127058 , p_transaction_coa_id => l_adr_transaction_coa_id
127059 , p_accounting_coa_id => l_adr_accounting_coa_id
127060 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
127061 , p_adr_type_code => 'S'
127062 , p_component_type => l_component_type
127063 , p_component_code => l_component_code
127064 , p_component_type_code => l_component_type_code
127065 , p_component_appl_id => l_component_appl_id
127066 , p_amb_context_code => l_amb_context_code
127067 , p_side => 'NA'
127068 );
127069
127070
127071 l_segment := AcctDerRule_145(
127072 p_application_id => p_application_id
127073 , p_ae_header_id => l_ae_header_id
127074 , p_source_5 => p_source_5
127075 , p_source_6 => p_source_6
127076 , x_transaction_coa_id => l_adr_transaction_coa_id
127077 , x_accounting_coa_id => l_adr_accounting_coa_id
127078 , x_flexfield_segment_code => l_adr_flexfield_segment_code
127079 , x_flex_value_set_id => l_adr_flex_value_set_id
127080 , x_value_type_code => l_adr_value_type_code
127081 , x_value_combination_id => l_adr_value_combination_id
127082 , x_value_segment_code => l_adr_value_segment_code
127083 , p_side => 'NA'
127084 , p_override_seg_flag => 'Y'
127085 );
127086
127087 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
127088
127089 xla_ae_lines_pkg.set_segment(
127090 p_to_segment_code => 'GL_ACCOUNT'
127091 , p_segment_value => l_segment
127092 , p_from_segment_code => l_adr_value_segment_code
127093 , p_from_combination_id => l_adr_value_combination_id
127094 , p_value_type_code => l_adr_value_type_code
127095 , p_transaction_coa_id => l_adr_transaction_coa_id
127096 , p_accounting_coa_id => l_adr_accounting_coa_id
127097 , p_flexfield_segment_code => l_adr_flexfield_segment_code
127098 , p_flex_value_set_id => l_adr_flex_value_set_id
127099 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
127100 , p_adr_type_code => 'S'
127101 , p_component_type => l_component_type
127102 , p_component_code => l_component_code
127103 , p_component_type_code => l_component_type_code
127104 , p_component_appl_id => l_component_appl_id
127105 , p_amb_context_code => l_amb_context_code
127106 , p_entity_code => 'TRANSACTIONS'
127107 , p_event_class_code => 'CAPITALIZATION'
127108 , p_side => 'NA'
127109 );
127110
127111 END IF;
127112
127113 l_segment := AcctDerRule_169(
127114 p_application_id => p_application_id
127115 , p_ae_header_id => l_ae_header_id
127116 , p_source_5 => p_source_5
127117 , p_source_31 => p_source_31
127121 , x_flex_value_set_id => l_adr_flex_value_set_id
127118 , x_transaction_coa_id => l_adr_transaction_coa_id
127119 , x_accounting_coa_id => l_adr_accounting_coa_id
127120 , x_flexfield_segment_code => l_adr_flexfield_segment_code
127122 , x_value_type_code => l_adr_value_type_code
127123 , x_value_combination_id => l_adr_value_combination_id
127124 , x_value_segment_code => l_adr_value_segment_code
127125 , p_side => 'NA'
127126 , p_override_seg_flag => 'Y'
127127 );
127128
127129 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
127130
127131 xla_ae_lines_pkg.set_segment(
127132 p_to_segment_code => 'GL_BALANCING'
127133 , p_segment_value => l_segment
127134 , p_from_segment_code => l_adr_value_segment_code
127135 , p_from_combination_id => l_adr_value_combination_id
127136 , p_value_type_code => l_adr_value_type_code
127137 , p_transaction_coa_id => l_adr_transaction_coa_id
127138 , p_accounting_coa_id => l_adr_accounting_coa_id
127139 , p_flexfield_segment_code => l_adr_flexfield_segment_code
127140 , p_flex_value_set_id => l_adr_flex_value_set_id
127141 , p_adr_code => 'FA_EXPENSE_ACCT'
127142 , p_adr_type_code => 'S'
127143 , p_component_type => l_component_type
127144 , p_component_code => l_component_code
127145 , p_component_type_code => l_component_type_code
127146 , p_component_appl_id => l_component_appl_id
127147 , p_amb_context_code => l_amb_context_code
127148 , p_entity_code => 'TRANSACTIONS'
127149 , p_event_class_code => 'CAPITALIZATION'
127150 , p_side => 'NA'
127151 );
127152
127153 END IF;
127154
127155 --
127156 --
127157 END IF;
127158
127159 --
127160 -- Update the line information that should be overwritten
127161 --
127162 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
127163 p_header_num => 1);
127164 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
127165
127166 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
127167
127168 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
127169 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
127170 END IF;
127171
127172 --
127173 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
127174 --
127175 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
127176 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
127177 ELSE
127178 ---------------------------------------------------------------------------------------------------
127179 -- 4262811a Switch Sign
127180 ---------------------------------------------------------------------------------------------------
127181 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
127182 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
127183 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
127184 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
127185 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
127186 -- 5132302
127187 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
127188 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
127189
127190 END IF;
127191
127192 -- 4955764
127193 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
127194 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
127195
127196
127197 XLA_AE_LINES_PKG.ValidateCurrentLine;
127198 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
127199
127200 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
127201 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
127202 ,p_balance_type_code => l_balance_type_code);
127203
127204 END IF;
127205
127206 -----------------------------------------------------------------------------------------
127207 -- 4262811 Multiperiod Accounting
127208 -----------------------------------------------------------------------------------------
127209 -- No MPA option is assigned.
127210
127211
127212 END IF;
127213 END IF;
127214 --
127215
127216 --
127217 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
127218 trace
127219 (p_msg => 'END of AcctLineType_342'
127220 ,p_level => C_LEVEL_PROCEDURE
127221 ,p_module => l_log_module);
127222 END IF;
127223 --
127224 EXCEPTION
127225 WHEN xla_exceptions_pkg.application_exception THEN
127226 RAISE;
127227 WHEN OTHERS THEN
127231 --
127228 xla_exceptions_pkg.raise_message
127229 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_342');
127230 END AcctLineType_342;
127232
127233 ---------------------------------------
127234 --
127235 -- PRIVATE FUNCTION
127236 -- AcctLineType_343
127237 --
127238 ---------------------------------------
127239 PROCEDURE AcctLineType_343 (
127240 p_application_id IN NUMBER
127241 ,p_event_id IN NUMBER
127242 ,p_calculate_acctd_flag IN VARCHAR2
127243 ,p_calculate_g_l_flag IN VARCHAR2
127244 ,p_actual_flag IN OUT VARCHAR2
127245 ,p_balance_type_code OUT VARCHAR2
127246 ,p_gain_or_loss_ref OUT VARCHAR2
127247
127248 --Period Close Date
127249 , p_source_1 IN DATE
127250 --Generated Code Combination Identifier
127251 , p_source_5 IN NUMBER
127252 --Expense Account Code Combination Identifier
127253 , p_source_31 IN NUMBER
127254 --Adjustment Type
127255 , p_source_48 IN VARCHAR2
127256 --Transaction Header Identifier
127257 , p_source_49 IN NUMBER
127258 --Adjustment Line Identifier
127259 , p_source_50 IN NUMBER
127260 --Distribution Type Code
127261 , p_source_51 IN VARCHAR2
127262 --Entered Amount
127263 , p_source_52 IN NUMBER
127264 --Currency Code
127265 , p_source_53 IN VARCHAR2
127266 )
127267 IS
127268
127269 l_component_type VARCHAR2(80);
127270 l_component_code VARCHAR2(30);
127271 l_component_type_code VARCHAR2(1);
127272 l_component_appl_id INTEGER;
127273 l_amb_context_code VARCHAR2(30);
127274 l_entity_code VARCHAR2(30);
127275 l_event_class_code VARCHAR2(30);
127276 l_ae_header_id NUMBER;
127277 l_event_type_code VARCHAR2(30);
127278 l_line_definition_code VARCHAR2(30);
127279 l_line_definition_owner_code VARCHAR2(1);
127280 --
127281 -- adr variables
127282 l_segment VARCHAR2(30);
127283 l_ccid NUMBER;
127284 l_adr_transaction_coa_id NUMBER;
127285 l_adr_accounting_coa_id NUMBER;
127286 l_adr_flexfield_segment_code VARCHAR2(30);
127287 l_adr_flex_value_set_id NUMBER;
127288 l_adr_value_type_code VARCHAR2(30);
127289 l_adr_value_combination_id NUMBER;
127290 l_adr_value_segment_code VARCHAR2(30);
127291
127292 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
127293 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
127294 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
127295 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
127296
127297 -- 4262811 Variables ------------------------------------------------------------------------------------------
127298 l_entered_amt_idx NUMBER;
127299 l_accted_amt_idx NUMBER;
127300 l_acc_rev_flag VARCHAR2(1);
127301 l_accrual_line_num NUMBER;
127302 l_tmp_amt NUMBER;
127303 l_acc_rev_natural_side_code VARCHAR2(1);
127304
127305 l_num_entries NUMBER;
127306 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
127307 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
127308 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
127309 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
127310 l_recog_line_1 NUMBER;
127311 l_recog_line_2 NUMBER;
127312
127313 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
127314 l_bflow_applied_to_amt NUMBER; -- 5132302
127315 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
127316
127317 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
127318
127319 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
127320 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
127321
127322 ---------------------------------------------------------------------------------------------------------------
127323
127324
127325 --
127326 -- bulk performance
127327 --
127328 l_balance_type_code VARCHAR2(1);
127329 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
127330 l_log_module VARCHAR2(240);
127331
127332 --
127333 -- Upgrade strategy
127334 --
127335 l_actual_upg_option VARCHAR2(1);
127336 l_enc_upg_option VARCHAR2(1);
127337
127338 --
127339 BEGIN
127340 --
127341 IF g_log_enabled THEN
127342 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_343';
127343 END IF;
127344 --
127345 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
127346
127347 trace
127348 (p_msg => 'BEGIN of AcctLineType_343'
127349 ,p_level => C_LEVEL_PROCEDURE
127350 ,p_module => l_log_module);
127351
127352 END IF;
127353 --
127354 l_component_type := 'AMB_JLT';
127355 l_component_code := 'FA_REV_EXP_BAL';
127356 l_component_type_code := 'S';
127357 l_component_appl_id := 140;
127358 l_amb_context_code := 'DEFAULT';
127359 l_entity_code := 'TRANSACTIONS';
127360 l_event_class_code := 'CAPITALIZATION';
127364 --
127361 l_event_type_code := 'REVERSE_CAPITALIZATION';
127362 l_line_definition_owner_code := 'S';
127363 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVER22';
127365 l_balance_type_code := 'A';
127366 l_segment := NULL;
127367 l_ccid := NULL;
127368 l_adr_transaction_coa_id := NULL;
127369 l_adr_accounting_coa_id := NULL;
127370 l_adr_flexfield_segment_code := NULL;
127371 l_adr_flex_value_set_id := NULL;
127372 l_adr_value_type_code := NULL;
127373 l_adr_value_combination_id := NULL;
127374 l_adr_value_segment_code := NULL;
127375
127376 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
127377 l_bflow_class_code := ''; -- 4219869 Business Flow
127378 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
127379 l_budgetary_control_flag := 'N';
127380
127381 l_bflow_applied_to_amt_idx := NULL; -- 5132302
127382 l_bflow_applied_to_amt := NULL; -- 5132302
127383 l_entered_amt_idx := NULL; -- 4262811
127384 l_accted_amt_idx := NULL; -- 4262811
127385 l_acc_rev_flag := NULL; -- 4262811
127386 l_accrual_line_num := NULL; -- 4262811
127387 l_tmp_amt := NULL; -- 4262811
127388 --
127389
127390 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
127391 l_balance_type_code <> 'B' THEN
127392 IF NVL(p_source_48,'
127393 ') = 'BONUS EXPENSE'
127394 THEN
127395
127396 --
127397 XLA_AE_LINES_PKG.SetNewLine;
127398
127399 p_balance_type_code := l_balance_type_code;
127400 -- set the flag so later we will know whether the gain loss line needs to be created
127401
127402 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
127403 p_actual_flag :='A';
127404 END IF;
127405
127406 --
127407 -- bulk performance
127408 --
127409 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
127410 p_header_num => 0); -- 4262811
127411 --
127412 -- set accounting line options
127413 --
127414 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
127415 p_natural_side_code => 'C'
127416 , p_gain_or_loss_flag => 'N'
127417 , p_gl_transfer_mode_code => 'S'
127418 , p_acct_entry_type_code => 'A'
127419 , p_switch_side_flag => 'Y'
127420 , p_merge_duplicate_code => 'N'
127421 );
127422 --
127423 l_acc_rev_natural_side_code := 'D'; -- 4262811
127424 --
127425 --
127426 -- set accounting line type info
127427 --
127428 xla_ae_lines_pkg.SetAcctLineType
127429 (p_component_type => l_component_type
127430 ,p_event_type_code => l_event_type_code
127431 ,p_line_definition_owner_code => l_line_definition_owner_code
127432 ,p_line_definition_code => l_line_definition_code
127433 ,p_accounting_line_code => l_component_code
127434 ,p_accounting_line_type_code => l_component_type_code
127435 ,p_accounting_line_appl_id => l_component_appl_id
127436 ,p_amb_context_code => l_amb_context_code
127437 ,p_entity_code => l_entity_code
127438 ,p_event_class_code => l_event_class_code);
127439 --
127440 -- set accounting class
127441 --
127442 xla_ae_lines_pkg.SetAcctClass(
127443 p_accounting_class_code => 'EXPENSE'
127444 , p_ae_header_id => l_ae_header_id
127445 );
127446
127447 --
127448 -- set rounding class
127449 --
127450 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
127451 'EXPENSE';
127452
127453 --
127454 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
127455 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
127456 --
127457 -- bulk performance
127458 --
127459 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
127460
127461 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
127462 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
127463
127464 -- 4955764
127465 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
127466 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
127467
127468 -- 4458381 Public Sector Enh
127469
127470 --
127471 -- set accounting attributes for the line type
127472 --
127473 l_entered_amt_idx := 4;
127474 l_accted_amt_idx := 6;
127475 l_bflow_applied_to_amt_idx := NULL; -- 5132302
127476 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
127477 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
127478 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
127479 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
127480 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
127481 l_rec_acct_attrs.array_char_value(3) := p_source_51;
127482 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
127483 l_rec_acct_attrs.array_num_value(4) := p_source_52;
127484 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
127488
127485 l_rec_acct_attrs.array_char_value(5) := p_source_53;
127486 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
127487 l_rec_acct_attrs.array_num_value(6) := p_source_52;
127489 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
127490 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
127491
127492 ---------------------------------------------------------------------------------------------------------------
127493 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
127494 ---------------------------------------------------------------------------------------------------------------
127495 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
127496
127497 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
127498 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
127499
127500 IF xla_accounting_cache_pkg.GetValueChar
127501 (p_source_code => 'LEDGER_CATEGORY_CODE'
127502 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
127503 AND l_bflow_method_code = 'PRIOR_ENTRY'
127504 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
127505 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
127506 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
127507 )
127508 THEN
127509 xla_ae_lines_pkg.BflowUpgEntry
127510 (p_business_method_code => l_bflow_method_code
127511 ,p_business_class_code => l_bflow_class_code
127512 ,p_balance_type => l_balance_type_code);
127513 ELSE
127514 NULL;
127515 -- No business flow processing for business flow method of NONE.
127516 END IF;
127517
127518 --
127519 -- call analytical criteria
127520 --
127521
127522 --
127523 -- call description
127524 --
127525
127526 xla_ae_lines_pkg.SetLineDescription(
127527 p_ae_header_id => l_ae_header_id
127528 ,p_description => Description_101 (
127529 p_application_id => p_application_id
127530 , p_ae_header_id => l_ae_header_id
127531 , p_source_1 => p_source_1
127532 )
127533 );
127534
127535
127536 --
127537 -- call ADRs
127538 -- Bug 4922099
127539 --
127540 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
127541 (NVL(l_actual_upg_option, 'N') = 'O') OR
127542 (NVL(l_enc_upg_option, 'N') = 'O')
127543 )
127544 THEN
127545 NULL;
127546 --
127547 --
127548
127549 l_ccid := AcctDerRule_176(
127550 p_application_id => p_application_id
127551 , p_ae_header_id => l_ae_header_id
127552 , p_source_5 => p_source_5
127553 , p_source_31 => p_source_31
127554 , x_transaction_coa_id => l_adr_transaction_coa_id
127555 , x_accounting_coa_id => l_adr_accounting_coa_id
127556 , x_value_type_code => l_adr_value_type_code
127557 , p_side => 'NA'
127558 );
127559
127560 xla_ae_lines_pkg.set_ccid(
127561 p_code_combination_id => l_ccid
127562 , p_value_type_code => l_adr_value_type_code
127563 , p_transaction_coa_id => l_adr_transaction_coa_id
127564 , p_accounting_coa_id => l_adr_accounting_coa_id
127565 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
127566 , p_adr_type_code => 'S'
127567 , p_component_type => l_component_type
127568 , p_component_code => l_component_code
127569 , p_component_type_code => l_component_type_code
127570 , p_component_appl_id => l_component_appl_id
127571 , p_amb_context_code => l_amb_context_code
127572 , p_side => 'NA'
127573 );
127574
127575
127576 --
127577 --
127578 END IF;
127579 --
127580 -- Bug 4922099
127581 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
127582 (NVL(l_enc_upg_option, 'N') = 'O')
127583 ) AND
127584 (l_bflow_method_code = 'PRIOR_ENTRY')
127585 )
127586 THEN
127587 IF
127588 --
127589 1 = 2
127590 --
127591 THEN
127592 xla_accounting_err_pkg.build_message
127593 (p_appli_s_name => 'XLA'
127594 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
127595 ,p_token_1 => 'LINE_NUMBER'
127596 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
127597 ,p_token_2 => 'LINE_TYPE_NAME'
127598 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
127599 l_component_type
127600 ,l_component_code
127601 ,l_component_type_code
127602 ,l_component_appl_id
127603 ,l_amb_context_code
127607 ,p_token_3 => 'OWNER'
127604 ,l_entity_code
127605 ,l_event_class_code
127606 )
127608 ,p_value_3 => xla_lookups_pkg.get_meaning(
127609 p_lookup_type => 'XLA_OWNER_TYPE'
127610 ,p_lookup_code => l_component_type_code
127611 )
127612 ,p_token_4 => 'PRODUCT_NAME'
127613 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
127614 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
127615 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
127616 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
127617 ,p_ae_header_id => NULL
127618 );
127619
127620 IF (C_LEVEL_ERROR>= g_log_level) THEN
127621 trace
127622 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
127623 ,p_level => C_LEVEL_ERROR
127624 ,p_module => l_log_module);
127625 END IF;
127626 END IF;
127627 END IF;
127628 --
127629 --
127630 ------------------------------------------------------------------------------------------------
127631 -- 4219869 Business Flow
127632 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
127633 -- Prior Entry. Currently, the following code is always generated.
127634 ------------------------------------------------------------------------------------------------
127635 XLA_AE_LINES_PKG.ValidateCurrentLine;
127636
127637 ------------------------------------------------------------------------------------
127638 -- 4219869 Business Flow
127639 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
127640 ------------------------------------------------------------------------------------
127641 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
127642
127643 ----------------------------------------------------------------------------------
127644 -- 4219869 Business Flow
127645 -- Update journal entry status -- Need to generate this within IF <condition>
127646 ----------------------------------------------------------------------------------
127647 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
127648 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
127649 ,p_balance_type_code => l_balance_type_code
127650 );
127651
127652 -------------------------------------------------------------------------------------------
127653 -- 4262811 - Generate the Accrual Reversal lines
127654 -------------------------------------------------------------------------------------------
127655 BEGIN
127656 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
127657 (g_array_event(p_event_id).array_value_num('header_index'));
127658 IF l_acc_rev_flag IS NULL THEN
127659 l_acc_rev_flag := 'N';
127660 END IF;
127661 EXCEPTION
127662 WHEN OTHERS THEN
127663 l_acc_rev_flag := 'N';
127664 END;
127665 --
127666 IF (l_acc_rev_flag = 'Y') THEN
127667
127668 -- 4645092 ------------------------------------------------------------------------------
127669 -- To allow MPA report to determine if it should generate report process
127670 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
127671 ------------------------------------------------------------------------------------------
127672
127673 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
127674 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
127675 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
127676 -- call ADRs
127677 -- Bug 4922099
127678 --
127679 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
127680 (NVL(l_actual_upg_option, 'N') = 'O') OR
127681 (NVL(l_enc_upg_option, 'N') = 'O')
127682 )
127683 THEN
127684 NULL;
127685 --
127686 --
127687
127688 l_ccid := AcctDerRule_176(
127689 p_application_id => p_application_id
127690 , p_ae_header_id => l_ae_header_id
127691 , p_source_5 => p_source_5
127692 , p_source_31 => p_source_31
127693 , x_transaction_coa_id => l_adr_transaction_coa_id
127694 , x_accounting_coa_id => l_adr_accounting_coa_id
127695 , x_value_type_code => l_adr_value_type_code
127696 , p_side => 'NA'
127697 );
127698
127699 xla_ae_lines_pkg.set_ccid(
127700 p_code_combination_id => l_ccid
127701 , p_value_type_code => l_adr_value_type_code
127702 , p_transaction_coa_id => l_adr_transaction_coa_id
127703 , p_accounting_coa_id => l_adr_accounting_coa_id
127704 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
127708 , p_component_type_code => l_component_type_code
127705 , p_adr_type_code => 'S'
127706 , p_component_type => l_component_type
127707 , p_component_code => l_component_code
127709 , p_component_appl_id => l_component_appl_id
127710 , p_amb_context_code => l_amb_context_code
127711 , p_side => 'NA'
127712 );
127713
127714
127715 --
127716 --
127717 END IF;
127718
127719 --
127720 -- Update the line information that should be overwritten
127721 --
127722 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
127723 p_header_num => 1);
127724 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
127725
127726 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
127727
127728 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
127729 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
127730 END IF;
127731
127732 --
127733 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
127734 --
127735 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
127736 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
127737 ELSE
127738 ---------------------------------------------------------------------------------------------------
127739 -- 4262811a Switch Sign
127740 ---------------------------------------------------------------------------------------------------
127741 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
127742 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
127743 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
127744 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
127745 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
127746 -- 5132302
127747 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
127748 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
127749
127750 END IF;
127751
127752 -- 4955764
127753 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
127754 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
127755
127756
127757 XLA_AE_LINES_PKG.ValidateCurrentLine;
127758 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
127759
127760 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
127761 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
127762 ,p_balance_type_code => l_balance_type_code);
127763
127764 END IF;
127765
127766 -----------------------------------------------------------------------------------------
127767 -- 4262811 Multiperiod Accounting
127768 -----------------------------------------------------------------------------------------
127769 -- No MPA option is assigned.
127770
127771
127772 END IF;
127773 END IF;
127774 --
127775
127776 --
127777 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
127778 trace
127779 (p_msg => 'END of AcctLineType_343'
127780 ,p_level => C_LEVEL_PROCEDURE
127781 ,p_module => l_log_module);
127782 END IF;
127783 --
127784 EXCEPTION
127785 WHEN xla_exceptions_pkg.application_exception THEN
127786 RAISE;
127787 WHEN OTHERS THEN
127788 xla_exceptions_pkg.raise_message
127789 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_343');
127790 END AcctLineType_343;
127791 --
127792
127793 ---------------------------------------
127794 --
127795 -- PRIVATE FUNCTION
127796 -- AcctLineType_344
127797 --
127798 ---------------------------------------
127799 PROCEDURE AcctLineType_344 (
127800 p_application_id IN NUMBER
127801 ,p_event_id IN NUMBER
127802 ,p_calculate_acctd_flag IN VARCHAR2
127803 ,p_calculate_g_l_flag IN VARCHAR2
127804 ,p_actual_flag IN OUT VARCHAR2
127805 ,p_balance_type_code OUT VARCHAR2
127806 ,p_gain_or_loss_ref OUT VARCHAR2
127807
127808 --Period Close Date
127809 , p_source_1 IN DATE
127810 --Generated Code Combination Identifier
127811 , p_source_5 IN NUMBER
127812 --Depreciation Reserve Account
127813 , p_source_12 IN VARCHAR2
127814 --Generated Offset Code Combination Identifier
127815 , p_source_19 IN NUMBER
127816 --Expense Account Code Combination Identifier
127817 , p_source_31 IN NUMBER
127818 --Default Code Combination Identifier
127819 , p_source_32 IN NUMBER
127820 --Adjustment Type
127821 , p_source_48 IN VARCHAR2
127822 --Transaction Header Identifier
127823 , p_source_49 IN NUMBER
127824 --Adjustment Line Identifier
127825 , p_source_50 IN NUMBER
127826 --Distribution Type Code
127830 --Currency Code
127827 , p_source_51 IN VARCHAR2
127828 --Entered Amount
127829 , p_source_52 IN NUMBER
127831 , p_source_53 IN VARCHAR2
127832 )
127833 IS
127834
127835 l_component_type VARCHAR2(80);
127836 l_component_code VARCHAR2(30);
127837 l_component_type_code VARCHAR2(1);
127838 l_component_appl_id INTEGER;
127839 l_amb_context_code VARCHAR2(30);
127840 l_entity_code VARCHAR2(30);
127841 l_event_class_code VARCHAR2(30);
127842 l_ae_header_id NUMBER;
127843 l_event_type_code VARCHAR2(30);
127844 l_line_definition_code VARCHAR2(30);
127845 l_line_definition_owner_code VARCHAR2(1);
127846 --
127847 -- adr variables
127848 l_segment VARCHAR2(30);
127849 l_ccid NUMBER;
127850 l_adr_transaction_coa_id NUMBER;
127851 l_adr_accounting_coa_id NUMBER;
127852 l_adr_flexfield_segment_code VARCHAR2(30);
127853 l_adr_flex_value_set_id NUMBER;
127854 l_adr_value_type_code VARCHAR2(30);
127855 l_adr_value_combination_id NUMBER;
127856 l_adr_value_segment_code VARCHAR2(30);
127857
127858 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
127859 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
127860 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
127861 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
127862
127863 -- 4262811 Variables ------------------------------------------------------------------------------------------
127864 l_entered_amt_idx NUMBER;
127865 l_accted_amt_idx NUMBER;
127866 l_acc_rev_flag VARCHAR2(1);
127867 l_accrual_line_num NUMBER;
127868 l_tmp_amt NUMBER;
127869 l_acc_rev_natural_side_code VARCHAR2(1);
127870
127871 l_num_entries NUMBER;
127872 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
127873 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
127874 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
127875 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
127876 l_recog_line_1 NUMBER;
127877 l_recog_line_2 NUMBER;
127878
127879 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
127880 l_bflow_applied_to_amt NUMBER; -- 5132302
127881 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
127882
127883 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
127884
127885 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
127886 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
127887
127888 ---------------------------------------------------------------------------------------------------------------
127889
127890
127891 --
127892 -- bulk performance
127893 --
127894 l_balance_type_code VARCHAR2(1);
127895 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
127896 l_log_module VARCHAR2(240);
127897
127898 --
127899 -- Upgrade strategy
127900 --
127901 l_actual_upg_option VARCHAR2(1);
127902 l_enc_upg_option VARCHAR2(1);
127903
127904 --
127905 BEGIN
127906 --
127907 IF g_log_enabled THEN
127908 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_344';
127909 END IF;
127910 --
127911 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
127912
127913 trace
127914 (p_msg => 'BEGIN of AcctLineType_344'
127915 ,p_level => C_LEVEL_PROCEDURE
127916 ,p_module => l_log_module);
127917
127918 END IF;
127919 --
127920 l_component_type := 'AMB_JLT';
127921 l_component_code := 'FA_REV_RESERVE';
127922 l_component_type_code := 'S';
127923 l_component_appl_id := 140;
127924 l_amb_context_code := 'DEFAULT';
127925 l_entity_code := 'TRANSACTIONS';
127926 l_event_class_code := 'CAPITALIZATION';
127927 l_event_type_code := 'REVERSE_CAPITALIZATION';
127928 l_line_definition_owner_code := 'S';
127929 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVER22';
127930 --
127931 l_balance_type_code := 'A';
127932 l_segment := NULL;
127933 l_ccid := NULL;
127934 l_adr_transaction_coa_id := NULL;
127935 l_adr_accounting_coa_id := NULL;
127936 l_adr_flexfield_segment_code := NULL;
127937 l_adr_flex_value_set_id := NULL;
127938 l_adr_value_type_code := NULL;
127939 l_adr_value_combination_id := NULL;
127940 l_adr_value_segment_code := NULL;
127941
127942 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
127943 l_bflow_class_code := ''; -- 4219869 Business Flow
127944 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
127945 l_budgetary_control_flag := 'N';
127946
127947 l_bflow_applied_to_amt_idx := NULL; -- 5132302
127948 l_bflow_applied_to_amt := NULL; -- 5132302
127949 l_entered_amt_idx := NULL; -- 4262811
127950 l_accted_amt_idx := NULL; -- 4262811
127951 l_acc_rev_flag := NULL; -- 4262811
127952 l_accrual_line_num := NULL; -- 4262811
127953 l_tmp_amt := NULL; -- 4262811
127957 l_balance_type_code <> 'B' THEN
127954 --
127955
127956 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
127958 IF NVL(p_source_48,'
127959 ') = 'EXPENSE'
127960 THEN
127961
127962 --
127963 XLA_AE_LINES_PKG.SetNewLine;
127964
127965 p_balance_type_code := l_balance_type_code;
127966 -- set the flag so later we will know whether the gain loss line needs to be created
127967
127968 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
127969 p_actual_flag :='A';
127970 END IF;
127971
127972 --
127973 -- bulk performance
127974 --
127975 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
127976 p_header_num => 0); -- 4262811
127977 --
127978 -- set accounting line options
127979 --
127980 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
127981 p_natural_side_code => 'C'
127982 , p_gain_or_loss_flag => 'N'
127983 , p_gl_transfer_mode_code => 'S'
127984 , p_acct_entry_type_code => 'A'
127985 , p_switch_side_flag => 'Y'
127986 , p_merge_duplicate_code => 'N'
127987 );
127988 --
127989 l_acc_rev_natural_side_code := 'D'; -- 4262811
127990 --
127991 --
127992 -- set accounting line type info
127993 --
127994 xla_ae_lines_pkg.SetAcctLineType
127995 (p_component_type => l_component_type
127996 ,p_event_type_code => l_event_type_code
127997 ,p_line_definition_owner_code => l_line_definition_owner_code
127998 ,p_line_definition_code => l_line_definition_code
127999 ,p_accounting_line_code => l_component_code
128000 ,p_accounting_line_type_code => l_component_type_code
128001 ,p_accounting_line_appl_id => l_component_appl_id
128002 ,p_amb_context_code => l_amb_context_code
128003 ,p_entity_code => l_entity_code
128004 ,p_event_class_code => l_event_class_code);
128005 --
128006 -- set accounting class
128007 --
128008 xla_ae_lines_pkg.SetAcctClass(
128009 p_accounting_class_code => 'ASSET'
128010 , p_ae_header_id => l_ae_header_id
128011 );
128012
128013 --
128014 -- set rounding class
128015 --
128016 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
128017 'ASSET';
128018
128019 --
128020 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
128021 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
128022 --
128023 -- bulk performance
128024 --
128025 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
128026
128027 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
128028 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
128029
128030 -- 4955764
128031 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
128032 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
128033
128034 -- 4458381 Public Sector Enh
128035
128036 --
128037 -- set accounting attributes for the line type
128038 --
128039 l_entered_amt_idx := 4;
128040 l_accted_amt_idx := 6;
128041 l_bflow_applied_to_amt_idx := NULL; -- 5132302
128042 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
128043 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
128044 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
128045 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
128046 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
128047 l_rec_acct_attrs.array_char_value(3) := p_source_51;
128048 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
128049 l_rec_acct_attrs.array_num_value(4) := p_source_52;
128050 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
128051 l_rec_acct_attrs.array_char_value(5) := p_source_53;
128052 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
128053 l_rec_acct_attrs.array_num_value(6) := p_source_52;
128054
128055 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
128056 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
128057
128058 ---------------------------------------------------------------------------------------------------------------
128059 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
128060 ---------------------------------------------------------------------------------------------------------------
128061 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
128062
128063 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
128064 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
128065
128066 IF xla_accounting_cache_pkg.GetValueChar
128067 (p_source_code => 'LEDGER_CATEGORY_CODE'
128068 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
128069 AND l_bflow_method_code = 'PRIOR_ENTRY'
128073 )
128070 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
128071 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
128072 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
128074 THEN
128075 xla_ae_lines_pkg.BflowUpgEntry
128076 (p_business_method_code => l_bflow_method_code
128077 ,p_business_class_code => l_bflow_class_code
128078 ,p_balance_type => l_balance_type_code);
128079 ELSE
128080 NULL;
128081 -- No business flow processing for business flow method of NONE.
128082 END IF;
128083
128084 --
128085 -- call analytical criteria
128086 --
128087
128088 --
128089 -- call description
128090 --
128091
128092 xla_ae_lines_pkg.SetLineDescription(
128093 p_ae_header_id => l_ae_header_id
128094 ,p_description => Description_102 (
128095 p_application_id => p_application_id
128096 , p_ae_header_id => l_ae_header_id
128097 , p_source_1 => p_source_1
128098 )
128099 );
128100
128101
128102 --
128103 -- call ADRs
128104 -- Bug 4922099
128105 --
128106 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
128107 (NVL(l_actual_upg_option, 'N') = 'O') OR
128108 (NVL(l_enc_upg_option, 'N') = 'O')
128109 )
128110 THEN
128111 NULL;
128112 --
128113 --
128114
128115 l_ccid := AcctDerRule_175(
128116 p_application_id => p_application_id
128117 , p_ae_header_id => l_ae_header_id
128118 , p_source_5 => p_source_5
128119 , p_source_19 => p_source_19
128120 , p_source_32 => p_source_32
128121 , x_transaction_coa_id => l_adr_transaction_coa_id
128122 , x_accounting_coa_id => l_adr_accounting_coa_id
128123 , x_value_type_code => l_adr_value_type_code
128124 , p_side => 'NA'
128125 );
128126
128127 xla_ae_lines_pkg.set_ccid(
128128 p_code_combination_id => l_ccid
128129 , p_value_type_code => l_adr_value_type_code
128130 , p_transaction_coa_id => l_adr_transaction_coa_id
128131 , p_accounting_coa_id => l_adr_accounting_coa_id
128132 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
128133 , p_adr_type_code => 'S'
128134 , p_component_type => l_component_type
128135 , p_component_code => l_component_code
128136 , p_component_type_code => l_component_type_code
128137 , p_component_appl_id => l_component_appl_id
128138 , p_amb_context_code => l_amb_context_code
128139 , p_side => 'NA'
128140 );
128141
128142
128143 l_segment := AcctDerRule_150(
128144 p_application_id => p_application_id
128145 , p_ae_header_id => l_ae_header_id
128146 , p_source_5 => p_source_5
128147 , p_source_12 => p_source_12
128148 , x_transaction_coa_id => l_adr_transaction_coa_id
128149 , x_accounting_coa_id => l_adr_accounting_coa_id
128150 , x_flexfield_segment_code => l_adr_flexfield_segment_code
128151 , x_flex_value_set_id => l_adr_flex_value_set_id
128152 , x_value_type_code => l_adr_value_type_code
128153 , x_value_combination_id => l_adr_value_combination_id
128154 , x_value_segment_code => l_adr_value_segment_code
128155 , p_side => 'NA'
128156 , p_override_seg_flag => 'Y'
128157 );
128158
128159 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
128160
128161 xla_ae_lines_pkg.set_segment(
128162 p_to_segment_code => 'GL_ACCOUNT'
128163 , p_segment_value => l_segment
128164 , p_from_segment_code => l_adr_value_segment_code
128165 , p_from_combination_id => l_adr_value_combination_id
128166 , p_value_type_code => l_adr_value_type_code
128167 , p_transaction_coa_id => l_adr_transaction_coa_id
128168 , p_accounting_coa_id => l_adr_accounting_coa_id
128169 , p_flexfield_segment_code => l_adr_flexfield_segment_code
128170 , p_flex_value_set_id => l_adr_flex_value_set_id
128171 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
128172 , p_adr_type_code => 'S'
128173 , p_component_type => l_component_type
128174 , p_component_code => l_component_code
128175 , p_component_type_code => l_component_type_code
128176 , p_component_appl_id => l_component_appl_id
128177 , p_amb_context_code => l_amb_context_code
128178 , p_entity_code => 'TRANSACTIONS'
128179 , p_event_class_code => 'CAPITALIZATION'
128180 , p_side => 'NA'
128181 );
128182
128183 END IF;
128184
128185 l_segment := AcctDerRule_169(
128186 p_application_id => p_application_id
128187 , p_ae_header_id => l_ae_header_id
128188 , p_source_5 => p_source_5
128189 , p_source_31 => p_source_31
128190 , x_transaction_coa_id => l_adr_transaction_coa_id
128191 , x_accounting_coa_id => l_adr_accounting_coa_id
128192 , x_flexfield_segment_code => l_adr_flexfield_segment_code
128193 , x_flex_value_set_id => l_adr_flex_value_set_id
128197 , p_side => 'NA'
128194 , x_value_type_code => l_adr_value_type_code
128195 , x_value_combination_id => l_adr_value_combination_id
128196 , x_value_segment_code => l_adr_value_segment_code
128198 , p_override_seg_flag => 'Y'
128199 );
128200
128201 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
128202
128203 xla_ae_lines_pkg.set_segment(
128204 p_to_segment_code => 'GL_BALANCING'
128205 , p_segment_value => l_segment
128206 , p_from_segment_code => l_adr_value_segment_code
128207 , p_from_combination_id => l_adr_value_combination_id
128208 , p_value_type_code => l_adr_value_type_code
128209 , p_transaction_coa_id => l_adr_transaction_coa_id
128210 , p_accounting_coa_id => l_adr_accounting_coa_id
128211 , p_flexfield_segment_code => l_adr_flexfield_segment_code
128212 , p_flex_value_set_id => l_adr_flex_value_set_id
128213 , p_adr_code => 'FA_EXPENSE_ACCT'
128214 , p_adr_type_code => 'S'
128215 , p_component_type => l_component_type
128216 , p_component_code => l_component_code
128217 , p_component_type_code => l_component_type_code
128218 , p_component_appl_id => l_component_appl_id
128219 , p_amb_context_code => l_amb_context_code
128220 , p_entity_code => 'TRANSACTIONS'
128221 , p_event_class_code => 'CAPITALIZATION'
128222 , p_side => 'NA'
128223 );
128224
128225 END IF;
128226
128227 --
128228 --
128229 END IF;
128230 --
128231 -- Bug 4922099
128232 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
128233 (NVL(l_enc_upg_option, 'N') = 'O')
128234 ) AND
128235 (l_bflow_method_code = 'PRIOR_ENTRY')
128236 )
128237 THEN
128238 IF
128239 --
128240 1 = 2
128241 --
128242 THEN
128243 xla_accounting_err_pkg.build_message
128244 (p_appli_s_name => 'XLA'
128245 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
128246 ,p_token_1 => 'LINE_NUMBER'
128247 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
128248 ,p_token_2 => 'LINE_TYPE_NAME'
128249 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
128250 l_component_type
128251 ,l_component_code
128252 ,l_component_type_code
128253 ,l_component_appl_id
128254 ,l_amb_context_code
128255 ,l_entity_code
128256 ,l_event_class_code
128257 )
128258 ,p_token_3 => 'OWNER'
128259 ,p_value_3 => xla_lookups_pkg.get_meaning(
128260 p_lookup_type => 'XLA_OWNER_TYPE'
128261 ,p_lookup_code => l_component_type_code
128262 )
128263 ,p_token_4 => 'PRODUCT_NAME'
128264 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
128265 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
128266 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
128267 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
128268 ,p_ae_header_id => NULL
128269 );
128270
128271 IF (C_LEVEL_ERROR>= g_log_level) THEN
128272 trace
128273 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
128274 ,p_level => C_LEVEL_ERROR
128275 ,p_module => l_log_module);
128276 END IF;
128277 END IF;
128278 END IF;
128279 --
128280 --
128281 ------------------------------------------------------------------------------------------------
128282 -- 4219869 Business Flow
128283 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
128284 -- Prior Entry. Currently, the following code is always generated.
128285 ------------------------------------------------------------------------------------------------
128286 XLA_AE_LINES_PKG.ValidateCurrentLine;
128287
128288 ------------------------------------------------------------------------------------
128289 -- 4219869 Business Flow
128290 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
128294 ----------------------------------------------------------------------------------
128291 ------------------------------------------------------------------------------------
128292 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
128293
128295 -- 4219869 Business Flow
128296 -- Update journal entry status -- Need to generate this within IF <condition>
128297 ----------------------------------------------------------------------------------
128298 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
128299 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
128300 ,p_balance_type_code => l_balance_type_code
128301 );
128302
128303 -------------------------------------------------------------------------------------------
128304 -- 4262811 - Generate the Accrual Reversal lines
128305 -------------------------------------------------------------------------------------------
128306 BEGIN
128307 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
128308 (g_array_event(p_event_id).array_value_num('header_index'));
128309 IF l_acc_rev_flag IS NULL THEN
128310 l_acc_rev_flag := 'N';
128311 END IF;
128312 EXCEPTION
128313 WHEN OTHERS THEN
128314 l_acc_rev_flag := 'N';
128315 END;
128316 --
128317 IF (l_acc_rev_flag = 'Y') THEN
128318
128319 -- 4645092 ------------------------------------------------------------------------------
128320 -- To allow MPA report to determine if it should generate report process
128321 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
128322 ------------------------------------------------------------------------------------------
128323
128324 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
128325 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
128326 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
128327 -- call ADRs
128328 -- Bug 4922099
128329 --
128330 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
128331 (NVL(l_actual_upg_option, 'N') = 'O') OR
128332 (NVL(l_enc_upg_option, 'N') = 'O')
128333 )
128334 THEN
128335 NULL;
128336 --
128337 --
128338
128339 l_ccid := AcctDerRule_175(
128340 p_application_id => p_application_id
128341 , p_ae_header_id => l_ae_header_id
128342 , p_source_5 => p_source_5
128343 , p_source_19 => p_source_19
128344 , p_source_32 => p_source_32
128345 , x_transaction_coa_id => l_adr_transaction_coa_id
128346 , x_accounting_coa_id => l_adr_accounting_coa_id
128347 , x_value_type_code => l_adr_value_type_code
128348 , p_side => 'NA'
128349 );
128350
128351 xla_ae_lines_pkg.set_ccid(
128352 p_code_combination_id => l_ccid
128353 , p_value_type_code => l_adr_value_type_code
128354 , p_transaction_coa_id => l_adr_transaction_coa_id
128355 , p_accounting_coa_id => l_adr_accounting_coa_id
128356 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
128357 , p_adr_type_code => 'S'
128358 , p_component_type => l_component_type
128359 , p_component_code => l_component_code
128360 , p_component_type_code => l_component_type_code
128361 , p_component_appl_id => l_component_appl_id
128362 , p_amb_context_code => l_amb_context_code
128363 , p_side => 'NA'
128364 );
128365
128366
128367 l_segment := AcctDerRule_150(
128368 p_application_id => p_application_id
128369 , p_ae_header_id => l_ae_header_id
128370 , p_source_5 => p_source_5
128371 , p_source_12 => p_source_12
128372 , x_transaction_coa_id => l_adr_transaction_coa_id
128373 , x_accounting_coa_id => l_adr_accounting_coa_id
128374 , x_flexfield_segment_code => l_adr_flexfield_segment_code
128375 , x_flex_value_set_id => l_adr_flex_value_set_id
128376 , x_value_type_code => l_adr_value_type_code
128377 , x_value_combination_id => l_adr_value_combination_id
128378 , x_value_segment_code => l_adr_value_segment_code
128379 , p_side => 'NA'
128380 , p_override_seg_flag => 'Y'
128381 );
128382
128383 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
128384
128385 xla_ae_lines_pkg.set_segment(
128386 p_to_segment_code => 'GL_ACCOUNT'
128387 , p_segment_value => l_segment
128388 , p_from_segment_code => l_adr_value_segment_code
128389 , p_from_combination_id => l_adr_value_combination_id
128390 , p_value_type_code => l_adr_value_type_code
128391 , p_transaction_coa_id => l_adr_transaction_coa_id
128392 , p_accounting_coa_id => l_adr_accounting_coa_id
128393 , p_flexfield_segment_code => l_adr_flexfield_segment_code
128394 , p_flex_value_set_id => l_adr_flex_value_set_id
128395 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
128396 , p_adr_type_code => 'S'
128397 , p_component_type => l_component_type
128398 , p_component_code => l_component_code
128399 , p_component_type_code => l_component_type_code
128400 , p_component_appl_id => l_component_appl_id
128404 , p_side => 'NA'
128401 , p_amb_context_code => l_amb_context_code
128402 , p_entity_code => 'TRANSACTIONS'
128403 , p_event_class_code => 'CAPITALIZATION'
128405 );
128406
128407 END IF;
128408
128409 l_segment := AcctDerRule_169(
128410 p_application_id => p_application_id
128411 , p_ae_header_id => l_ae_header_id
128412 , p_source_5 => p_source_5
128413 , p_source_31 => p_source_31
128414 , x_transaction_coa_id => l_adr_transaction_coa_id
128415 , x_accounting_coa_id => l_adr_accounting_coa_id
128416 , x_flexfield_segment_code => l_adr_flexfield_segment_code
128417 , x_flex_value_set_id => l_adr_flex_value_set_id
128418 , x_value_type_code => l_adr_value_type_code
128419 , x_value_combination_id => l_adr_value_combination_id
128420 , x_value_segment_code => l_adr_value_segment_code
128421 , p_side => 'NA'
128422 , p_override_seg_flag => 'Y'
128423 );
128424
128425 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
128426
128427 xla_ae_lines_pkg.set_segment(
128428 p_to_segment_code => 'GL_BALANCING'
128429 , p_segment_value => l_segment
128430 , p_from_segment_code => l_adr_value_segment_code
128431 , p_from_combination_id => l_adr_value_combination_id
128432 , p_value_type_code => l_adr_value_type_code
128433 , p_transaction_coa_id => l_adr_transaction_coa_id
128434 , p_accounting_coa_id => l_adr_accounting_coa_id
128435 , p_flexfield_segment_code => l_adr_flexfield_segment_code
128436 , p_flex_value_set_id => l_adr_flex_value_set_id
128437 , p_adr_code => 'FA_EXPENSE_ACCT'
128438 , p_adr_type_code => 'S'
128439 , p_component_type => l_component_type
128440 , p_component_code => l_component_code
128441 , p_component_type_code => l_component_type_code
128442 , p_component_appl_id => l_component_appl_id
128443 , p_amb_context_code => l_amb_context_code
128444 , p_entity_code => 'TRANSACTIONS'
128445 , p_event_class_code => 'CAPITALIZATION'
128446 , p_side => 'NA'
128447 );
128448
128449 END IF;
128450
128451 --
128452 --
128453 END IF;
128454
128455 --
128456 -- Update the line information that should be overwritten
128457 --
128458 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
128459 p_header_num => 1);
128460 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
128461
128462 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
128463
128464 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
128465 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
128466 END IF;
128467
128468 --
128469 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
128470 --
128471 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
128472 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
128473 ELSE
128474 ---------------------------------------------------------------------------------------------------
128475 -- 4262811a Switch Sign
128476 ---------------------------------------------------------------------------------------------------
128477 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
128478 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
128479 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
128480 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
128481 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
128482 -- 5132302
128483 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
128484 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
128485
128486 END IF;
128487
128488 -- 4955764
128489 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
128490 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
128491
128492
128493 XLA_AE_LINES_PKG.ValidateCurrentLine;
128494 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
128495
128496 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
128497 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
128498 ,p_balance_type_code => l_balance_type_code);
128499
128500 END IF;
128501
128502 -----------------------------------------------------------------------------------------
128503 -- 4262811 Multiperiod Accounting
128504 -----------------------------------------------------------------------------------------
128505 -- No MPA option is assigned.
128506
128507
128508 END IF;
128509 END IF;
128513 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
128510 --
128511
128512 --
128514 trace
128515 (p_msg => 'END of AcctLineType_344'
128516 ,p_level => C_LEVEL_PROCEDURE
128517 ,p_module => l_log_module);
128518 END IF;
128519 --
128520 EXCEPTION
128521 WHEN xla_exceptions_pkg.application_exception THEN
128522 RAISE;
128523 WHEN OTHERS THEN
128524 xla_exceptions_pkg.raise_message
128525 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_344');
128526 END AcctLineType_344;
128527 --
128528
128529 ---------------------------------------
128530 --
128531 -- PRIVATE FUNCTION
128532 -- AcctLineType_345
128533 --
128534 ---------------------------------------
128535 PROCEDURE AcctLineType_345 (
128536 p_application_id IN NUMBER
128537 ,p_event_id IN NUMBER
128538 ,p_calculate_acctd_flag IN VARCHAR2
128539 ,p_calculate_g_l_flag IN VARCHAR2
128540 ,p_actual_flag IN OUT VARCHAR2
128541 ,p_balance_type_code OUT VARCHAR2
128542 ,p_gain_or_loss_ref OUT VARCHAR2
128543
128544 --Period Close Date
128545 , p_source_1 IN DATE
128546 --Generated Code Combination Identifier
128547 , p_source_5 IN NUMBER
128548 --Depreciation Reserve Account
128549 , p_source_12 IN VARCHAR2
128550 --Generated Offset Code Combination Identifier
128551 , p_source_19 IN NUMBER
128552 --Expense Account Code Combination Identifier
128553 , p_source_31 IN NUMBER
128554 --Default Code Combination Identifier
128555 , p_source_32 IN NUMBER
128556 --Adjustment Type
128557 , p_source_48 IN VARCHAR2
128558 --Transaction Header Identifier
128559 , p_source_49 IN NUMBER
128560 --Adjustment Line Identifier
128561 , p_source_50 IN NUMBER
128562 --Distribution Type Code
128563 , p_source_51 IN VARCHAR2
128564 --Entered Amount
128565 , p_source_52 IN NUMBER
128566 --Currency Code
128567 , p_source_53 IN VARCHAR2
128568 )
128569 IS
128570
128571 l_component_type VARCHAR2(80);
128572 l_component_code VARCHAR2(30);
128573 l_component_type_code VARCHAR2(1);
128574 l_component_appl_id INTEGER;
128575 l_amb_context_code VARCHAR2(30);
128576 l_entity_code VARCHAR2(30);
128577 l_event_class_code VARCHAR2(30);
128578 l_ae_header_id NUMBER;
128579 l_event_type_code VARCHAR2(30);
128580 l_line_definition_code VARCHAR2(30);
128581 l_line_definition_owner_code VARCHAR2(1);
128582 --
128583 -- adr variables
128584 l_segment VARCHAR2(30);
128585 l_ccid NUMBER;
128586 l_adr_transaction_coa_id NUMBER;
128587 l_adr_accounting_coa_id NUMBER;
128588 l_adr_flexfield_segment_code VARCHAR2(30);
128589 l_adr_flex_value_set_id NUMBER;
128590 l_adr_value_type_code VARCHAR2(30);
128591 l_adr_value_combination_id NUMBER;
128592 l_adr_value_segment_code VARCHAR2(30);
128593
128594 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
128595 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
128596 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
128597 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
128598
128599 -- 4262811 Variables ------------------------------------------------------------------------------------------
128600 l_entered_amt_idx NUMBER;
128601 l_accted_amt_idx NUMBER;
128602 l_acc_rev_flag VARCHAR2(1);
128603 l_accrual_line_num NUMBER;
128604 l_tmp_amt NUMBER;
128605 l_acc_rev_natural_side_code VARCHAR2(1);
128606
128607 l_num_entries NUMBER;
128608 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
128609 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
128610 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
128611 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
128612 l_recog_line_1 NUMBER;
128613 l_recog_line_2 NUMBER;
128614
128615 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
128616 l_bflow_applied_to_amt NUMBER; -- 5132302
128617 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
128618
128619 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
128620
128621 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
128622 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
128623
128624 ---------------------------------------------------------------------------------------------------------------
128625
128626
128627 --
128628 -- bulk performance
128629 --
128630 l_balance_type_code VARCHAR2(1);
128631 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
128632 l_log_module VARCHAR2(240);
128633
128634 --
128635 -- Upgrade strategy
128636 --
128637 l_actual_upg_option VARCHAR2(1);
128638 l_enc_upg_option VARCHAR2(1);
128639
128640 --
128641 BEGIN
128642 --
128643 IF g_log_enabled THEN
128644 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_345';
128645 END IF;
128646 --
128647 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
128648
128652 ,p_module => l_log_module);
128649 trace
128650 (p_msg => 'BEGIN of AcctLineType_345'
128651 ,p_level => C_LEVEL_PROCEDURE
128653
128654 END IF;
128655 --
128656 l_component_type := 'AMB_JLT';
128657 l_component_code := 'FA_REV_RESERVE_BAL';
128658 l_component_type_code := 'S';
128659 l_component_appl_id := 140;
128660 l_amb_context_code := 'DEFAULT';
128661 l_entity_code := 'TRANSACTIONS';
128662 l_event_class_code := 'CAPITALIZATION';
128663 l_event_type_code := 'REVERSE_CAPITALIZATION';
128664 l_line_definition_owner_code := 'S';
128665 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_REVER22';
128666 --
128667 l_balance_type_code := 'A';
128668 l_segment := NULL;
128669 l_ccid := NULL;
128670 l_adr_transaction_coa_id := NULL;
128671 l_adr_accounting_coa_id := NULL;
128672 l_adr_flexfield_segment_code := NULL;
128673 l_adr_flex_value_set_id := NULL;
128674 l_adr_value_type_code := NULL;
128675 l_adr_value_combination_id := NULL;
128676 l_adr_value_segment_code := NULL;
128677
128678 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
128679 l_bflow_class_code := ''; -- 4219869 Business Flow
128680 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
128681 l_budgetary_control_flag := 'N';
128682
128683 l_bflow_applied_to_amt_idx := NULL; -- 5132302
128684 l_bflow_applied_to_amt := NULL; -- 5132302
128685 l_entered_amt_idx := NULL; -- 4262811
128686 l_accted_amt_idx := NULL; -- 4262811
128687 l_acc_rev_flag := NULL; -- 4262811
128688 l_accrual_line_num := NULL; -- 4262811
128689 l_tmp_amt := NULL; -- 4262811
128690 --
128691
128692 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
128693 l_balance_type_code <> 'B' THEN
128694 IF NVL(p_source_48,'
128695 ') = 'BONUS EXPENSE'
128696 THEN
128697
128698 --
128699 XLA_AE_LINES_PKG.SetNewLine;
128700
128701 p_balance_type_code := l_balance_type_code;
128702 -- set the flag so later we will know whether the gain loss line needs to be created
128703
128704 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
128705 p_actual_flag :='A';
128706 END IF;
128707
128708 --
128709 -- bulk performance
128710 --
128711 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
128712 p_header_num => 0); -- 4262811
128713 --
128714 -- set accounting line options
128715 --
128716 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
128717 p_natural_side_code => 'D'
128718 , p_gain_or_loss_flag => 'N'
128719 , p_gl_transfer_mode_code => 'S'
128720 , p_acct_entry_type_code => 'A'
128721 , p_switch_side_flag => 'Y'
128722 , p_merge_duplicate_code => 'N'
128723 );
128724 --
128725 l_acc_rev_natural_side_code := 'C'; -- 4262811
128726 --
128727 --
128728 -- set accounting line type info
128729 --
128730 xla_ae_lines_pkg.SetAcctLineType
128731 (p_component_type => l_component_type
128732 ,p_event_type_code => l_event_type_code
128733 ,p_line_definition_owner_code => l_line_definition_owner_code
128734 ,p_line_definition_code => l_line_definition_code
128735 ,p_accounting_line_code => l_component_code
128736 ,p_accounting_line_type_code => l_component_type_code
128737 ,p_accounting_line_appl_id => l_component_appl_id
128738 ,p_amb_context_code => l_amb_context_code
128739 ,p_entity_code => l_entity_code
128740 ,p_event_class_code => l_event_class_code);
128741 --
128742 -- set accounting class
128743 --
128744 xla_ae_lines_pkg.SetAcctClass(
128745 p_accounting_class_code => 'ASSET'
128746 , p_ae_header_id => l_ae_header_id
128747 );
128748
128749 --
128750 -- set rounding class
128751 --
128752 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
128753 'ASSET';
128754
128755 --
128756 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
128757 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
128758 --
128759 -- bulk performance
128760 --
128761 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
128762
128763 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
128764 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
128765
128766 -- 4955764
128767 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
128768 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
128769
128770 -- 4458381 Public Sector Enh
128771
128772 --
128773 -- set accounting attributes for the line type
128774 --
128775 l_entered_amt_idx := 4;
128776 l_accted_amt_idx := 6;
128780 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
128777 l_bflow_applied_to_amt_idx := NULL; -- 5132302
128778 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
128779 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
128781 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
128782 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
128783 l_rec_acct_attrs.array_char_value(3) := p_source_51;
128784 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
128785 l_rec_acct_attrs.array_num_value(4) := p_source_52;
128786 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
128787 l_rec_acct_attrs.array_char_value(5) := p_source_53;
128788 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
128789 l_rec_acct_attrs.array_num_value(6) := p_source_52;
128790
128791 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
128792 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
128793
128794 ---------------------------------------------------------------------------------------------------------------
128795 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
128796 ---------------------------------------------------------------------------------------------------------------
128797 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
128798
128799 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
128800 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
128801
128802 IF xla_accounting_cache_pkg.GetValueChar
128803 (p_source_code => 'LEDGER_CATEGORY_CODE'
128804 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
128805 AND l_bflow_method_code = 'PRIOR_ENTRY'
128806 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
128807 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
128808 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
128809 )
128810 THEN
128811 xla_ae_lines_pkg.BflowUpgEntry
128812 (p_business_method_code => l_bflow_method_code
128813 ,p_business_class_code => l_bflow_class_code
128814 ,p_balance_type => l_balance_type_code);
128815 ELSE
128816 NULL;
128817 -- No business flow processing for business flow method of NONE.
128818 END IF;
128819
128820 --
128821 -- call analytical criteria
128822 --
128823
128824 --
128825 -- call description
128826 --
128827
128828 xla_ae_lines_pkg.SetLineDescription(
128829 p_ae_header_id => l_ae_header_id
128830 ,p_description => Description_102 (
128831 p_application_id => p_application_id
128832 , p_ae_header_id => l_ae_header_id
128833 , p_source_1 => p_source_1
128834 )
128835 );
128836
128837
128838 --
128839 -- call ADRs
128840 -- Bug 4922099
128841 --
128842 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
128843 (NVL(l_actual_upg_option, 'N') = 'O') OR
128844 (NVL(l_enc_upg_option, 'N') = 'O')
128845 )
128846 THEN
128847 NULL;
128848 --
128849 --
128850
128851 l_ccid := AcctDerRule_175(
128852 p_application_id => p_application_id
128853 , p_ae_header_id => l_ae_header_id
128854 , p_source_5 => p_source_5
128855 , p_source_19 => p_source_19
128856 , p_source_32 => p_source_32
128857 , x_transaction_coa_id => l_adr_transaction_coa_id
128858 , x_accounting_coa_id => l_adr_accounting_coa_id
128859 , x_value_type_code => l_adr_value_type_code
128860 , p_side => 'NA'
128861 );
128862
128863 xla_ae_lines_pkg.set_ccid(
128864 p_code_combination_id => l_ccid
128865 , p_value_type_code => l_adr_value_type_code
128866 , p_transaction_coa_id => l_adr_transaction_coa_id
128867 , p_accounting_coa_id => l_adr_accounting_coa_id
128868 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
128869 , p_adr_type_code => 'S'
128870 , p_component_type => l_component_type
128871 , p_component_code => l_component_code
128872 , p_component_type_code => l_component_type_code
128873 , p_component_appl_id => l_component_appl_id
128874 , p_amb_context_code => l_amb_context_code
128875 , p_side => 'NA'
128876 );
128877
128878
128879 l_segment := AcctDerRule_150(
128880 p_application_id => p_application_id
128881 , p_ae_header_id => l_ae_header_id
128882 , p_source_5 => p_source_5
128883 , p_source_12 => p_source_12
128884 , x_transaction_coa_id => l_adr_transaction_coa_id
128885 , x_accounting_coa_id => l_adr_accounting_coa_id
128886 , x_flexfield_segment_code => l_adr_flexfield_segment_code
128887 , x_flex_value_set_id => l_adr_flex_value_set_id
128888 , x_value_type_code => l_adr_value_type_code
128889 , x_value_combination_id => l_adr_value_combination_id
128890 , x_value_segment_code => l_adr_value_segment_code
128891 , p_side => 'NA'
128895 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
128892 , p_override_seg_flag => 'Y'
128893 );
128894
128896
128897 xla_ae_lines_pkg.set_segment(
128898 p_to_segment_code => 'GL_ACCOUNT'
128899 , p_segment_value => l_segment
128900 , p_from_segment_code => l_adr_value_segment_code
128901 , p_from_combination_id => l_adr_value_combination_id
128902 , p_value_type_code => l_adr_value_type_code
128903 , p_transaction_coa_id => l_adr_transaction_coa_id
128904 , p_accounting_coa_id => l_adr_accounting_coa_id
128905 , p_flexfield_segment_code => l_adr_flexfield_segment_code
128906 , p_flex_value_set_id => l_adr_flex_value_set_id
128907 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
128908 , p_adr_type_code => 'S'
128909 , p_component_type => l_component_type
128910 , p_component_code => l_component_code
128911 , p_component_type_code => l_component_type_code
128912 , p_component_appl_id => l_component_appl_id
128913 , p_amb_context_code => l_amb_context_code
128914 , p_entity_code => 'TRANSACTIONS'
128915 , p_event_class_code => 'CAPITALIZATION'
128916 , p_side => 'NA'
128917 );
128918
128919 END IF;
128920
128921 l_segment := AcctDerRule_169(
128922 p_application_id => p_application_id
128923 , p_ae_header_id => l_ae_header_id
128924 , p_source_5 => p_source_5
128925 , p_source_31 => p_source_31
128926 , x_transaction_coa_id => l_adr_transaction_coa_id
128927 , x_accounting_coa_id => l_adr_accounting_coa_id
128928 , x_flexfield_segment_code => l_adr_flexfield_segment_code
128929 , x_flex_value_set_id => l_adr_flex_value_set_id
128930 , x_value_type_code => l_adr_value_type_code
128931 , x_value_combination_id => l_adr_value_combination_id
128932 , x_value_segment_code => l_adr_value_segment_code
128933 , p_side => 'NA'
128934 , p_override_seg_flag => 'Y'
128935 );
128936
128937 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
128938
128939 xla_ae_lines_pkg.set_segment(
128940 p_to_segment_code => 'GL_BALANCING'
128941 , p_segment_value => l_segment
128942 , p_from_segment_code => l_adr_value_segment_code
128943 , p_from_combination_id => l_adr_value_combination_id
128944 , p_value_type_code => l_adr_value_type_code
128945 , p_transaction_coa_id => l_adr_transaction_coa_id
128946 , p_accounting_coa_id => l_adr_accounting_coa_id
128947 , p_flexfield_segment_code => l_adr_flexfield_segment_code
128948 , p_flex_value_set_id => l_adr_flex_value_set_id
128949 , p_adr_code => 'FA_EXPENSE_ACCT'
128950 , p_adr_type_code => 'S'
128951 , p_component_type => l_component_type
128952 , p_component_code => l_component_code
128953 , p_component_type_code => l_component_type_code
128954 , p_component_appl_id => l_component_appl_id
128955 , p_amb_context_code => l_amb_context_code
128956 , p_entity_code => 'TRANSACTIONS'
128957 , p_event_class_code => 'CAPITALIZATION'
128958 , p_side => 'NA'
128959 );
128960
128961 END IF;
128962
128963 --
128964 --
128965 END IF;
128966 --
128967 -- Bug 4922099
128968 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
128969 (NVL(l_enc_upg_option, 'N') = 'O')
128970 ) AND
128971 (l_bflow_method_code = 'PRIOR_ENTRY')
128972 )
128973 THEN
128974 IF
128975 --
128976 1 = 2
128977 --
128978 THEN
128979 xla_accounting_err_pkg.build_message
128980 (p_appli_s_name => 'XLA'
128981 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
128982 ,p_token_1 => 'LINE_NUMBER'
128983 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
128984 ,p_token_2 => 'LINE_TYPE_NAME'
128985 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
128986 l_component_type
128987 ,l_component_code
128988 ,l_component_type_code
128989 ,l_component_appl_id
128990 ,l_amb_context_code
128991 ,l_entity_code
128992 ,l_event_class_code
128993 )
128994 ,p_token_3 => 'OWNER'
128995 ,p_value_3 => xla_lookups_pkg.get_meaning(
128999 ,p_token_4 => 'PRODUCT_NAME'
128996 p_lookup_type => 'XLA_OWNER_TYPE'
128997 ,p_lookup_code => l_component_type_code
128998 )
129000 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
129001 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
129002 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
129003 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
129004 ,p_ae_header_id => NULL
129005 );
129006
129007 IF (C_LEVEL_ERROR>= g_log_level) THEN
129008 trace
129009 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
129010 ,p_level => C_LEVEL_ERROR
129011 ,p_module => l_log_module);
129012 END IF;
129013 END IF;
129014 END IF;
129015 --
129016 --
129017 ------------------------------------------------------------------------------------------------
129018 -- 4219869 Business Flow
129019 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
129020 -- Prior Entry. Currently, the following code is always generated.
129021 ------------------------------------------------------------------------------------------------
129022 XLA_AE_LINES_PKG.ValidateCurrentLine;
129023
129024 ------------------------------------------------------------------------------------
129025 -- 4219869 Business Flow
129026 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
129027 ------------------------------------------------------------------------------------
129028 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
129029
129030 ----------------------------------------------------------------------------------
129031 -- 4219869 Business Flow
129032 -- Update journal entry status -- Need to generate this within IF <condition>
129033 ----------------------------------------------------------------------------------
129034 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
129035 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
129036 ,p_balance_type_code => l_balance_type_code
129037 );
129038
129039 -------------------------------------------------------------------------------------------
129040 -- 4262811 - Generate the Accrual Reversal lines
129041 -------------------------------------------------------------------------------------------
129042 BEGIN
129043 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
129044 (g_array_event(p_event_id).array_value_num('header_index'));
129045 IF l_acc_rev_flag IS NULL THEN
129046 l_acc_rev_flag := 'N';
129047 END IF;
129048 EXCEPTION
129049 WHEN OTHERS THEN
129050 l_acc_rev_flag := 'N';
129051 END;
129052 --
129053 IF (l_acc_rev_flag = 'Y') THEN
129054
129055 -- 4645092 ------------------------------------------------------------------------------
129056 -- To allow MPA report to determine if it should generate report process
129057 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
129058 ------------------------------------------------------------------------------------------
129059
129060 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
129061 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
129062 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
129063 -- call ADRs
129064 -- Bug 4922099
129065 --
129066 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
129067 (NVL(l_actual_upg_option, 'N') = 'O') OR
129068 (NVL(l_enc_upg_option, 'N') = 'O')
129069 )
129070 THEN
129071 NULL;
129072 --
129073 --
129074
129075 l_ccid := AcctDerRule_175(
129076 p_application_id => p_application_id
129077 , p_ae_header_id => l_ae_header_id
129078 , p_source_5 => p_source_5
129079 , p_source_19 => p_source_19
129080 , p_source_32 => p_source_32
129081 , x_transaction_coa_id => l_adr_transaction_coa_id
129082 , x_accounting_coa_id => l_adr_accounting_coa_id
129083 , x_value_type_code => l_adr_value_type_code
129084 , p_side => 'NA'
129085 );
129086
129087 xla_ae_lines_pkg.set_ccid(
129088 p_code_combination_id => l_ccid
129089 , p_value_type_code => l_adr_value_type_code
129090 , p_transaction_coa_id => l_adr_transaction_coa_id
129091 , p_accounting_coa_id => l_adr_accounting_coa_id
129092 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
129093 , p_adr_type_code => 'S'
129094 , p_component_type => l_component_type
129095 , p_component_code => l_component_code
129096 , p_component_type_code => l_component_type_code
129097 , p_component_appl_id => l_component_appl_id
129098 , p_amb_context_code => l_amb_context_code
129099 , p_side => 'NA'
129100 );
129101
129102
129106 , p_source_5 => p_source_5
129103 l_segment := AcctDerRule_150(
129104 p_application_id => p_application_id
129105 , p_ae_header_id => l_ae_header_id
129107 , p_source_12 => p_source_12
129108 , x_transaction_coa_id => l_adr_transaction_coa_id
129109 , x_accounting_coa_id => l_adr_accounting_coa_id
129110 , x_flexfield_segment_code => l_adr_flexfield_segment_code
129111 , x_flex_value_set_id => l_adr_flex_value_set_id
129112 , x_value_type_code => l_adr_value_type_code
129113 , x_value_combination_id => l_adr_value_combination_id
129114 , x_value_segment_code => l_adr_value_segment_code
129115 , p_side => 'NA'
129116 , p_override_seg_flag => 'Y'
129117 );
129118
129119 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
129120
129121 xla_ae_lines_pkg.set_segment(
129122 p_to_segment_code => 'GL_ACCOUNT'
129123 , p_segment_value => l_segment
129124 , p_from_segment_code => l_adr_value_segment_code
129125 , p_from_combination_id => l_adr_value_combination_id
129126 , p_value_type_code => l_adr_value_type_code
129127 , p_transaction_coa_id => l_adr_transaction_coa_id
129128 , p_accounting_coa_id => l_adr_accounting_coa_id
129129 , p_flexfield_segment_code => l_adr_flexfield_segment_code
129130 , p_flex_value_set_id => l_adr_flex_value_set_id
129131 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
129132 , p_adr_type_code => 'S'
129133 , p_component_type => l_component_type
129134 , p_component_code => l_component_code
129135 , p_component_type_code => l_component_type_code
129136 , p_component_appl_id => l_component_appl_id
129137 , p_amb_context_code => l_amb_context_code
129138 , p_entity_code => 'TRANSACTIONS'
129139 , p_event_class_code => 'CAPITALIZATION'
129140 , p_side => 'NA'
129141 );
129142
129143 END IF;
129144
129145 l_segment := AcctDerRule_169(
129146 p_application_id => p_application_id
129147 , p_ae_header_id => l_ae_header_id
129148 , p_source_5 => p_source_5
129149 , p_source_31 => p_source_31
129150 , x_transaction_coa_id => l_adr_transaction_coa_id
129151 , x_accounting_coa_id => l_adr_accounting_coa_id
129152 , x_flexfield_segment_code => l_adr_flexfield_segment_code
129153 , x_flex_value_set_id => l_adr_flex_value_set_id
129154 , x_value_type_code => l_adr_value_type_code
129155 , x_value_combination_id => l_adr_value_combination_id
129156 , x_value_segment_code => l_adr_value_segment_code
129157 , p_side => 'NA'
129158 , p_override_seg_flag => 'Y'
129159 );
129160
129161 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
129162
129163 xla_ae_lines_pkg.set_segment(
129164 p_to_segment_code => 'GL_BALANCING'
129165 , p_segment_value => l_segment
129166 , p_from_segment_code => l_adr_value_segment_code
129167 , p_from_combination_id => l_adr_value_combination_id
129168 , p_value_type_code => l_adr_value_type_code
129169 , p_transaction_coa_id => l_adr_transaction_coa_id
129170 , p_accounting_coa_id => l_adr_accounting_coa_id
129171 , p_flexfield_segment_code => l_adr_flexfield_segment_code
129172 , p_flex_value_set_id => l_adr_flex_value_set_id
129173 , p_adr_code => 'FA_EXPENSE_ACCT'
129174 , p_adr_type_code => 'S'
129175 , p_component_type => l_component_type
129176 , p_component_code => l_component_code
129177 , p_component_type_code => l_component_type_code
129178 , p_component_appl_id => l_component_appl_id
129179 , p_amb_context_code => l_amb_context_code
129180 , p_entity_code => 'TRANSACTIONS'
129181 , p_event_class_code => 'CAPITALIZATION'
129182 , p_side => 'NA'
129183 );
129184
129185 END IF;
129186
129187 --
129188 --
129189 END IF;
129190
129191 --
129192 -- Update the line information that should be overwritten
129193 --
129194 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
129195 p_header_num => 1);
129196 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
129197
129198 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
129199
129200 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
129201 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
129202 END IF;
129203
129204 --
129205 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
129206 --
129207 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
129208 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
129209 ELSE
129210 ---------------------------------------------------------------------------------------------------
129211 -- 4262811a Switch Sign
129215 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
129212 ---------------------------------------------------------------------------------------------------
129213 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
129214 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
129216 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
129217 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
129218 -- 5132302
129219 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
129220 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
129221
129222 END IF;
129223
129224 -- 4955764
129225 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
129226 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
129227
129228
129229 XLA_AE_LINES_PKG.ValidateCurrentLine;
129230 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
129231
129232 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
129233 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
129234 ,p_balance_type_code => l_balance_type_code);
129235
129236 END IF;
129237
129238 -----------------------------------------------------------------------------------------
129239 -- 4262811 Multiperiod Accounting
129240 -----------------------------------------------------------------------------------------
129241 -- No MPA option is assigned.
129242
129243
129244 END IF;
129245 END IF;
129246 --
129247
129248 --
129249 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
129250 trace
129251 (p_msg => 'END of AcctLineType_345'
129252 ,p_level => C_LEVEL_PROCEDURE
129253 ,p_module => l_log_module);
129254 END IF;
129255 --
129256 EXCEPTION
129257 WHEN xla_exceptions_pkg.application_exception THEN
129258 RAISE;
129259 WHEN OTHERS THEN
129260 xla_exceptions_pkg.raise_message
129261 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_345');
129262 END AcctLineType_345;
129263 --
129264
129265 ---------------------------------------
129266 --
129267 -- PRIVATE FUNCTION
129268 -- AcctLineType_346
129269 --
129270 ---------------------------------------
129271 PROCEDURE AcctLineType_346 (
129272 p_application_id IN NUMBER
129273 ,p_event_id IN NUMBER
129274 ,p_calculate_acctd_flag IN VARCHAR2
129275 ,p_calculate_g_l_flag IN VARCHAR2
129276 ,p_actual_flag IN OUT VARCHAR2
129277 ,p_balance_type_code OUT VARCHAR2
129278 ,p_gain_or_loss_ref OUT VARCHAR2
129279
129280 --Period Close Date
129281 , p_source_1 IN DATE
129282 --Generated Code Combination Identifier
129283 , p_source_5 IN NUMBER
129284 --Intercompany Payables Account
129285 , p_source_21 IN VARCHAR2
129286 --Expense Account Code Combination Identifier
129287 , p_source_31 IN NUMBER
129288 --Default Code Combination Identifier
129289 , p_source_32 IN NUMBER
129290 --Adjustment Type
129291 , p_source_48 IN VARCHAR2
129292 --Transaction Header Identifier
129293 , p_source_49 IN NUMBER
129294 --Adjustment Line Identifier
129295 , p_source_50 IN NUMBER
129296 --Distribution Type Code
129297 , p_source_51 IN VARCHAR2
129298 --Entered Amount
129299 , p_source_52 IN NUMBER
129300 --Currency Code
129301 , p_source_53 IN VARCHAR2
129302 )
129303 IS
129304
129305 l_component_type VARCHAR2(80);
129306 l_component_code VARCHAR2(30);
129307 l_component_type_code VARCHAR2(1);
129308 l_component_appl_id INTEGER;
129309 l_amb_context_code VARCHAR2(30);
129310 l_entity_code VARCHAR2(30);
129311 l_event_class_code VARCHAR2(30);
129312 l_ae_header_id NUMBER;
129313 l_event_type_code VARCHAR2(30);
129314 l_line_definition_code VARCHAR2(30);
129315 l_line_definition_owner_code VARCHAR2(1);
129316 --
129317 -- adr variables
129318 l_segment VARCHAR2(30);
129319 l_ccid NUMBER;
129320 l_adr_transaction_coa_id NUMBER;
129321 l_adr_accounting_coa_id NUMBER;
129322 l_adr_flexfield_segment_code VARCHAR2(30);
129323 l_adr_flex_value_set_id NUMBER;
129324 l_adr_value_type_code VARCHAR2(30);
129325 l_adr_value_combination_id NUMBER;
129326 l_adr_value_segment_code VARCHAR2(30);
129327
129328 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
129329 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
129330 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
129331 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
129332
129333 -- 4262811 Variables ------------------------------------------------------------------------------------------
129334 l_entered_amt_idx NUMBER;
129335 l_accted_amt_idx NUMBER;
129336 l_acc_rev_flag VARCHAR2(1);
129337 l_accrual_line_num NUMBER;
129338 l_tmp_amt NUMBER;
129342 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
129339 l_acc_rev_natural_side_code VARCHAR2(1);
129340
129341 l_num_entries NUMBER;
129343 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
129344 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
129345 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
129346 l_recog_line_1 NUMBER;
129347 l_recog_line_2 NUMBER;
129348
129349 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
129350 l_bflow_applied_to_amt NUMBER; -- 5132302
129351 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
129352
129353 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
129354
129355 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
129356 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
129357
129358 ---------------------------------------------------------------------------------------------------------------
129359
129360
129361 --
129362 -- bulk performance
129363 --
129364 l_balance_type_code VARCHAR2(1);
129365 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
129366 l_log_module VARCHAR2(240);
129367
129368 --
129369 -- Upgrade strategy
129370 --
129371 l_actual_upg_option VARCHAR2(1);
129372 l_enc_upg_option VARCHAR2(1);
129373
129374 --
129375 BEGIN
129376 --
129377 IF g_log_enabled THEN
129378 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_346';
129379 END IF;
129380 --
129381 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
129382
129383 trace
129384 (p_msg => 'BEGIN of AcctLineType_346'
129385 ,p_level => C_LEVEL_PROCEDURE
129386 ,p_module => l_log_module);
129387
129388 END IF;
129389 --
129390 l_component_type := 'AMB_JLT';
129391 l_component_code := 'FA_SLT_CIP_IC_PAY';
129392 l_component_type_code := 'S';
129393 l_component_appl_id := 140;
129394 l_amb_context_code := 'DEFAULT';
129395 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
129396 l_event_class_code := 'CIP_SOURCE_LINE_TRANSFERS';
129397 l_event_type_code := 'CIP_SOURCE_LINE_TRANSFERS_ALL';
129398 l_line_definition_owner_code := 'S';
129399 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_S11';
129400 --
129401 l_balance_type_code := 'A';
129402 l_segment := NULL;
129403 l_ccid := NULL;
129404 l_adr_transaction_coa_id := NULL;
129405 l_adr_accounting_coa_id := NULL;
129406 l_adr_flexfield_segment_code := NULL;
129407 l_adr_flex_value_set_id := NULL;
129408 l_adr_value_type_code := NULL;
129409 l_adr_value_combination_id := NULL;
129410 l_adr_value_segment_code := NULL;
129411
129412 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
129413 l_bflow_class_code := ''; -- 4219869 Business Flow
129414 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
129415 l_budgetary_control_flag := 'N';
129416
129417 l_bflow_applied_to_amt_idx := NULL; -- 5132302
129418 l_bflow_applied_to_amt := NULL; -- 5132302
129419 l_entered_amt_idx := NULL; -- 4262811
129420 l_accted_amt_idx := NULL; -- 4262811
129421 l_acc_rev_flag := NULL; -- 4262811
129422 l_accrual_line_num := NULL; -- 4262811
129423 l_tmp_amt := NULL; -- 4262811
129424 --
129425
129426 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
129427 l_balance_type_code <> 'B' THEN
129428 IF NVL(p_source_48,'
129429 ') = 'INTERCO AP'
129430 THEN
129431
129432 --
129433 XLA_AE_LINES_PKG.SetNewLine;
129434
129435 p_balance_type_code := l_balance_type_code;
129436 -- set the flag so later we will know whether the gain loss line needs to be created
129437
129438 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
129439 p_actual_flag :='A';
129440 END IF;
129441
129442 --
129443 -- bulk performance
129444 --
129445 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
129446 p_header_num => 0); -- 4262811
129447 --
129448 -- set accounting line options
129449 --
129450 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
129451 p_natural_side_code => 'C'
129452 , p_gain_or_loss_flag => 'N'
129453 , p_gl_transfer_mode_code => 'S'
129454 , p_acct_entry_type_code => 'A'
129455 , p_switch_side_flag => 'Y'
129456 , p_merge_duplicate_code => 'N'
129457 );
129458 --
129459 l_acc_rev_natural_side_code := 'D'; -- 4262811
129460 --
129461 --
129462 -- set accounting line type info
129463 --
129464 xla_ae_lines_pkg.SetAcctLineType
129465 (p_component_type => l_component_type
129466 ,p_event_type_code => l_event_type_code
129467 ,p_line_definition_owner_code => l_line_definition_owner_code
129468 ,p_line_definition_code => l_line_definition_code
129472 ,p_amb_context_code => l_amb_context_code
129469 ,p_accounting_line_code => l_component_code
129470 ,p_accounting_line_type_code => l_component_type_code
129471 ,p_accounting_line_appl_id => l_component_appl_id
129473 ,p_entity_code => l_entity_code
129474 ,p_event_class_code => l_event_class_code);
129475 --
129476 -- set accounting class
129477 --
129478 xla_ae_lines_pkg.SetAcctClass(
129479 p_accounting_class_code => 'LIABILITY'
129480 , p_ae_header_id => l_ae_header_id
129481 );
129482
129483 --
129484 -- set rounding class
129485 --
129486 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
129487 'LIABILITY';
129488
129489 --
129490 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
129491 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
129492 --
129493 -- bulk performance
129494 --
129495 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
129496
129497 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
129498 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
129499
129500 -- 4955764
129501 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
129502 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
129503
129504 -- 4458381 Public Sector Enh
129505
129506 --
129507 -- set accounting attributes for the line type
129508 --
129509 l_entered_amt_idx := 4;
129510 l_accted_amt_idx := 6;
129511 l_bflow_applied_to_amt_idx := NULL; -- 5132302
129512 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
129513 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
129514 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
129515 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
129516 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
129517 l_rec_acct_attrs.array_char_value(3) := p_source_51;
129518 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
129519 l_rec_acct_attrs.array_num_value(4) := p_source_52;
129520 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
129521 l_rec_acct_attrs.array_char_value(5) := p_source_53;
129522 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
129523 l_rec_acct_attrs.array_num_value(6) := p_source_52;
129524
129525 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
129526 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
129527
129528 ---------------------------------------------------------------------------------------------------------------
129529 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
129530 ---------------------------------------------------------------------------------------------------------------
129531 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
129532
129533 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
129534 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
129535
129536 IF xla_accounting_cache_pkg.GetValueChar
129537 (p_source_code => 'LEDGER_CATEGORY_CODE'
129538 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
129539 AND l_bflow_method_code = 'PRIOR_ENTRY'
129540 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
129541 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
129542 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
129543 )
129544 THEN
129545 xla_ae_lines_pkg.BflowUpgEntry
129546 (p_business_method_code => l_bflow_method_code
129547 ,p_business_class_code => l_bflow_class_code
129548 ,p_balance_type => l_balance_type_code);
129549 ELSE
129550 NULL;
129551 -- No business flow processing for business flow method of NONE.
129552 END IF;
129553
129554 --
129555 -- call analytical criteria
129556 --
129557
129558 --
129559 -- call description
129560 --
129561
129562 xla_ae_lines_pkg.SetLineDescription(
129563 p_ae_header_id => l_ae_header_id
129564 ,p_description => Description_107 (
129565 p_application_id => p_application_id
129566 , p_ae_header_id => l_ae_header_id
129567 , p_source_1 => p_source_1
129568 )
129569 );
129570
129571
129572 --
129573 -- call ADRs
129574 -- Bug 4922099
129575 --
129576 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
129577 (NVL(l_actual_upg_option, 'N') = 'O') OR
129578 (NVL(l_enc_upg_option, 'N') = 'O')
129579 )
129580 THEN
129581 NULL;
129582 --
129583 --
129584
129585 l_ccid := AcctDerRule_174(
129586 p_application_id => p_application_id
129587 , p_ae_header_id => l_ae_header_id
129588 , p_source_5 => p_source_5
129592 , x_value_type_code => l_adr_value_type_code
129589 , p_source_32 => p_source_32
129590 , x_transaction_coa_id => l_adr_transaction_coa_id
129591 , x_accounting_coa_id => l_adr_accounting_coa_id
129593 , p_side => 'NA'
129594 );
129595
129596 xla_ae_lines_pkg.set_ccid(
129597 p_code_combination_id => l_ccid
129598 , p_value_type_code => l_adr_value_type_code
129599 , p_transaction_coa_id => l_adr_transaction_coa_id
129600 , p_accounting_coa_id => l_adr_accounting_coa_id
129601 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
129602 , p_adr_type_code => 'S'
129603 , p_component_type => l_component_type
129604 , p_component_code => l_component_code
129605 , p_component_type_code => l_component_type_code
129606 , p_component_appl_id => l_component_appl_id
129607 , p_amb_context_code => l_amb_context_code
129608 , p_side => 'NA'
129609 );
129610
129611
129612 l_segment := AcctDerRule_169(
129613 p_application_id => p_application_id
129614 , p_ae_header_id => l_ae_header_id
129615 , p_source_5 => p_source_5
129616 , p_source_31 => p_source_31
129617 , x_transaction_coa_id => l_adr_transaction_coa_id
129618 , x_accounting_coa_id => l_adr_accounting_coa_id
129619 , x_flexfield_segment_code => l_adr_flexfield_segment_code
129620 , x_flex_value_set_id => l_adr_flex_value_set_id
129621 , x_value_type_code => l_adr_value_type_code
129622 , x_value_combination_id => l_adr_value_combination_id
129623 , x_value_segment_code => l_adr_value_segment_code
129624 , p_side => 'NA'
129625 , p_override_seg_flag => 'Y'
129626 );
129627
129628 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
129629
129630 xla_ae_lines_pkg.set_segment(
129631 p_to_segment_code => 'GL_BALANCING'
129632 , p_segment_value => l_segment
129633 , p_from_segment_code => l_adr_value_segment_code
129634 , p_from_combination_id => l_adr_value_combination_id
129635 , p_value_type_code => l_adr_value_type_code
129636 , p_transaction_coa_id => l_adr_transaction_coa_id
129637 , p_accounting_coa_id => l_adr_accounting_coa_id
129638 , p_flexfield_segment_code => l_adr_flexfield_segment_code
129639 , p_flex_value_set_id => l_adr_flex_value_set_id
129640 , p_adr_code => 'FA_EXPENSE_ACCT'
129641 , p_adr_type_code => 'S'
129642 , p_component_type => l_component_type
129643 , p_component_code => l_component_code
129644 , p_component_type_code => l_component_type_code
129645 , p_component_appl_id => l_component_appl_id
129646 , p_amb_context_code => l_amb_context_code
129647 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
129648 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
129649 , p_side => 'NA'
129650 );
129651
129652 END IF;
129653
129654 l_segment := AcctDerRule_158(
129655 p_application_id => p_application_id
129656 , p_ae_header_id => l_ae_header_id
129657 , p_source_5 => p_source_5
129658 , p_source_21 => p_source_21
129659 , x_transaction_coa_id => l_adr_transaction_coa_id
129660 , x_accounting_coa_id => l_adr_accounting_coa_id
129661 , x_flexfield_segment_code => l_adr_flexfield_segment_code
129662 , x_flex_value_set_id => l_adr_flex_value_set_id
129663 , x_value_type_code => l_adr_value_type_code
129664 , x_value_combination_id => l_adr_value_combination_id
129665 , x_value_segment_code => l_adr_value_segment_code
129666 , p_side => 'NA'
129667 , p_override_seg_flag => 'Y'
129668 );
129669
129670 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
129671
129672 xla_ae_lines_pkg.set_segment(
129673 p_to_segment_code => 'GL_ACCOUNT'
129674 , p_segment_value => l_segment
129675 , p_from_segment_code => l_adr_value_segment_code
129676 , p_from_combination_id => l_adr_value_combination_id
129677 , p_value_type_code => l_adr_value_type_code
129678 , p_transaction_coa_id => l_adr_transaction_coa_id
129679 , p_accounting_coa_id => l_adr_accounting_coa_id
129680 , p_flexfield_segment_code => l_adr_flexfield_segment_code
129681 , p_flex_value_set_id => l_adr_flex_value_set_id
129682 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
129683 , p_adr_type_code => 'S'
129684 , p_component_type => l_component_type
129685 , p_component_code => l_component_code
129686 , p_component_type_code => l_component_type_code
129687 , p_component_appl_id => l_component_appl_id
129688 , p_amb_context_code => l_amb_context_code
129689 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
129690 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
129691 , p_side => 'NA'
129692 );
129693
129694 END IF;
129695
129696 --
129697 --
129698 END IF;
129699 --
129700 -- Bug 4922099
129704 (l_bflow_method_code = 'PRIOR_ENTRY')
129701 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
129702 (NVL(l_enc_upg_option, 'N') = 'O')
129703 ) AND
129705 )
129706 THEN
129707 IF
129708 --
129709 1 = 2
129710 --
129711 THEN
129712 xla_accounting_err_pkg.build_message
129713 (p_appli_s_name => 'XLA'
129714 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
129715 ,p_token_1 => 'LINE_NUMBER'
129716 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
129717 ,p_token_2 => 'LINE_TYPE_NAME'
129718 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
129719 l_component_type
129720 ,l_component_code
129721 ,l_component_type_code
129722 ,l_component_appl_id
129723 ,l_amb_context_code
129724 ,l_entity_code
129725 ,l_event_class_code
129726 )
129727 ,p_token_3 => 'OWNER'
129728 ,p_value_3 => xla_lookups_pkg.get_meaning(
129729 p_lookup_type => 'XLA_OWNER_TYPE'
129730 ,p_lookup_code => l_component_type_code
129731 )
129732 ,p_token_4 => 'PRODUCT_NAME'
129733 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
129734 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
129735 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
129736 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
129737 ,p_ae_header_id => NULL
129738 );
129739
129740 IF (C_LEVEL_ERROR>= g_log_level) THEN
129741 trace
129742 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
129743 ,p_level => C_LEVEL_ERROR
129744 ,p_module => l_log_module);
129745 END IF;
129746 END IF;
129747 END IF;
129748 --
129749 --
129750 ------------------------------------------------------------------------------------------------
129751 -- 4219869 Business Flow
129752 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
129753 -- Prior Entry. Currently, the following code is always generated.
129754 ------------------------------------------------------------------------------------------------
129755 XLA_AE_LINES_PKG.ValidateCurrentLine;
129756
129757 ------------------------------------------------------------------------------------
129758 -- 4219869 Business Flow
129759 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
129760 ------------------------------------------------------------------------------------
129761 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
129762
129763 ----------------------------------------------------------------------------------
129764 -- 4219869 Business Flow
129765 -- Update journal entry status -- Need to generate this within IF <condition>
129766 ----------------------------------------------------------------------------------
129767 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
129768 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
129769 ,p_balance_type_code => l_balance_type_code
129770 );
129771
129772 -------------------------------------------------------------------------------------------
129773 -- 4262811 - Generate the Accrual Reversal lines
129774 -------------------------------------------------------------------------------------------
129775 BEGIN
129776 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
129777 (g_array_event(p_event_id).array_value_num('header_index'));
129778 IF l_acc_rev_flag IS NULL THEN
129779 l_acc_rev_flag := 'N';
129780 END IF;
129781 EXCEPTION
129782 WHEN OTHERS THEN
129783 l_acc_rev_flag := 'N';
129784 END;
129785 --
129786 IF (l_acc_rev_flag = 'Y') THEN
129787
129788 -- 4645092 ------------------------------------------------------------------------------
129789 -- To allow MPA report to determine if it should generate report process
129790 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
129791 ------------------------------------------------------------------------------------------
129792
129793 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
129794 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
129798 --
129795 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
129796 -- call ADRs
129797 -- Bug 4922099
129799 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
129800 (NVL(l_actual_upg_option, 'N') = 'O') OR
129801 (NVL(l_enc_upg_option, 'N') = 'O')
129802 )
129803 THEN
129804 NULL;
129805 --
129806 --
129807
129808 l_ccid := AcctDerRule_174(
129809 p_application_id => p_application_id
129810 , p_ae_header_id => l_ae_header_id
129811 , p_source_5 => p_source_5
129812 , p_source_32 => p_source_32
129813 , x_transaction_coa_id => l_adr_transaction_coa_id
129814 , x_accounting_coa_id => l_adr_accounting_coa_id
129815 , x_value_type_code => l_adr_value_type_code
129816 , p_side => 'NA'
129817 );
129818
129819 xla_ae_lines_pkg.set_ccid(
129820 p_code_combination_id => l_ccid
129821 , p_value_type_code => l_adr_value_type_code
129822 , p_transaction_coa_id => l_adr_transaction_coa_id
129823 , p_accounting_coa_id => l_adr_accounting_coa_id
129824 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
129825 , p_adr_type_code => 'S'
129826 , p_component_type => l_component_type
129827 , p_component_code => l_component_code
129828 , p_component_type_code => l_component_type_code
129829 , p_component_appl_id => l_component_appl_id
129830 , p_amb_context_code => l_amb_context_code
129831 , p_side => 'NA'
129832 );
129833
129834
129835 l_segment := AcctDerRule_169(
129836 p_application_id => p_application_id
129837 , p_ae_header_id => l_ae_header_id
129838 , p_source_5 => p_source_5
129839 , p_source_31 => p_source_31
129840 , x_transaction_coa_id => l_adr_transaction_coa_id
129841 , x_accounting_coa_id => l_adr_accounting_coa_id
129842 , x_flexfield_segment_code => l_adr_flexfield_segment_code
129843 , x_flex_value_set_id => l_adr_flex_value_set_id
129844 , x_value_type_code => l_adr_value_type_code
129845 , x_value_combination_id => l_adr_value_combination_id
129846 , x_value_segment_code => l_adr_value_segment_code
129847 , p_side => 'NA'
129848 , p_override_seg_flag => 'Y'
129849 );
129850
129851 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
129852
129853 xla_ae_lines_pkg.set_segment(
129854 p_to_segment_code => 'GL_BALANCING'
129855 , p_segment_value => l_segment
129856 , p_from_segment_code => l_adr_value_segment_code
129857 , p_from_combination_id => l_adr_value_combination_id
129858 , p_value_type_code => l_adr_value_type_code
129859 , p_transaction_coa_id => l_adr_transaction_coa_id
129860 , p_accounting_coa_id => l_adr_accounting_coa_id
129861 , p_flexfield_segment_code => l_adr_flexfield_segment_code
129862 , p_flex_value_set_id => l_adr_flex_value_set_id
129863 , p_adr_code => 'FA_EXPENSE_ACCT'
129864 , p_adr_type_code => 'S'
129865 , p_component_type => l_component_type
129866 , p_component_code => l_component_code
129867 , p_component_type_code => l_component_type_code
129868 , p_component_appl_id => l_component_appl_id
129869 , p_amb_context_code => l_amb_context_code
129870 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
129871 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
129872 , p_side => 'NA'
129873 );
129874
129875 END IF;
129876
129877 l_segment := AcctDerRule_158(
129878 p_application_id => p_application_id
129879 , p_ae_header_id => l_ae_header_id
129880 , p_source_5 => p_source_5
129881 , p_source_21 => p_source_21
129882 , x_transaction_coa_id => l_adr_transaction_coa_id
129883 , x_accounting_coa_id => l_adr_accounting_coa_id
129884 , x_flexfield_segment_code => l_adr_flexfield_segment_code
129885 , x_flex_value_set_id => l_adr_flex_value_set_id
129886 , x_value_type_code => l_adr_value_type_code
129887 , x_value_combination_id => l_adr_value_combination_id
129888 , x_value_segment_code => l_adr_value_segment_code
129889 , p_side => 'NA'
129890 , p_override_seg_flag => 'Y'
129891 );
129892
129893 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
129894
129895 xla_ae_lines_pkg.set_segment(
129896 p_to_segment_code => 'GL_ACCOUNT'
129897 , p_segment_value => l_segment
129898 , p_from_segment_code => l_adr_value_segment_code
129899 , p_from_combination_id => l_adr_value_combination_id
129900 , p_value_type_code => l_adr_value_type_code
129901 , p_transaction_coa_id => l_adr_transaction_coa_id
129902 , p_accounting_coa_id => l_adr_accounting_coa_id
129903 , p_flexfield_segment_code => l_adr_flexfield_segment_code
129904 , p_flex_value_set_id => l_adr_flex_value_set_id
129905 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
129909 , p_component_type_code => l_component_type_code
129906 , p_adr_type_code => 'S'
129907 , p_component_type => l_component_type
129908 , p_component_code => l_component_code
129910 , p_component_appl_id => l_component_appl_id
129911 , p_amb_context_code => l_amb_context_code
129912 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
129913 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
129914 , p_side => 'NA'
129915 );
129916
129917 END IF;
129918
129919 --
129920 --
129921 END IF;
129922
129923 --
129924 -- Update the line information that should be overwritten
129925 --
129926 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
129927 p_header_num => 1);
129928 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
129929
129930 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
129931
129932 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
129933 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
129934 END IF;
129935
129936 --
129937 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
129938 --
129939 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
129940 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
129941 ELSE
129942 ---------------------------------------------------------------------------------------------------
129943 -- 4262811a Switch Sign
129944 ---------------------------------------------------------------------------------------------------
129945 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
129946 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
129947 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
129948 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
129949 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
129950 -- 5132302
129951 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
129952 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
129953
129954 END IF;
129955
129956 -- 4955764
129957 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
129958 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
129959
129960
129961 XLA_AE_LINES_PKG.ValidateCurrentLine;
129962 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
129963
129964 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
129965 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
129966 ,p_balance_type_code => l_balance_type_code);
129967
129968 END IF;
129969
129970 -----------------------------------------------------------------------------------------
129971 -- 4262811 Multiperiod Accounting
129972 -----------------------------------------------------------------------------------------
129973 -- No MPA option is assigned.
129974
129975
129976 END IF;
129977 END IF;
129978 --
129979
129980 --
129981 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
129982 trace
129983 (p_msg => 'END of AcctLineType_346'
129984 ,p_level => C_LEVEL_PROCEDURE
129985 ,p_module => l_log_module);
129986 END IF;
129987 --
129988 EXCEPTION
129989 WHEN xla_exceptions_pkg.application_exception THEN
129990 RAISE;
129991 WHEN OTHERS THEN
129992 xla_exceptions_pkg.raise_message
129993 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_346');
129994 END AcctLineType_346;
129995 --
129996
129997 ---------------------------------------
129998 --
129999 -- PRIVATE FUNCTION
130000 -- AcctLineType_347
130001 --
130002 ---------------------------------------
130003 PROCEDURE AcctLineType_347 (
130004 p_application_id IN NUMBER
130005 ,p_event_id IN NUMBER
130006 ,p_calculate_acctd_flag IN VARCHAR2
130007 ,p_calculate_g_l_flag IN VARCHAR2
130008 ,p_actual_flag IN OUT VARCHAR2
130009 ,p_balance_type_code OUT VARCHAR2
130010 ,p_gain_or_loss_ref OUT VARCHAR2
130011
130012 --Period Close Date
130013 , p_source_1 IN DATE
130014 --Generated Code Combination Identifier
130015 , p_source_5 IN NUMBER
130016 --Intercompany Receivables Account
130017 , p_source_22 IN VARCHAR2
130018 --Expense Account Code Combination Identifier
130019 , p_source_31 IN NUMBER
130020 --Default Code Combination Identifier
130021 , p_source_32 IN NUMBER
130022 --Adjustment Type
130023 , p_source_48 IN VARCHAR2
130024 --Transaction Header Identifier
130025 , p_source_49 IN NUMBER
130026 --Adjustment Line Identifier
130030 --Entered Amount
130027 , p_source_50 IN NUMBER
130028 --Distribution Type Code
130029 , p_source_51 IN VARCHAR2
130031 , p_source_52 IN NUMBER
130032 --Currency Code
130033 , p_source_53 IN VARCHAR2
130034 )
130035 IS
130036
130037 l_component_type VARCHAR2(80);
130038 l_component_code VARCHAR2(30);
130039 l_component_type_code VARCHAR2(1);
130040 l_component_appl_id INTEGER;
130041 l_amb_context_code VARCHAR2(30);
130042 l_entity_code VARCHAR2(30);
130043 l_event_class_code VARCHAR2(30);
130044 l_ae_header_id NUMBER;
130045 l_event_type_code VARCHAR2(30);
130046 l_line_definition_code VARCHAR2(30);
130047 l_line_definition_owner_code VARCHAR2(1);
130048 --
130049 -- adr variables
130050 l_segment VARCHAR2(30);
130051 l_ccid NUMBER;
130052 l_adr_transaction_coa_id NUMBER;
130053 l_adr_accounting_coa_id NUMBER;
130054 l_adr_flexfield_segment_code VARCHAR2(30);
130055 l_adr_flex_value_set_id NUMBER;
130056 l_adr_value_type_code VARCHAR2(30);
130057 l_adr_value_combination_id NUMBER;
130058 l_adr_value_segment_code VARCHAR2(30);
130059
130060 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
130061 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
130062 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
130063 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
130064
130065 -- 4262811 Variables ------------------------------------------------------------------------------------------
130066 l_entered_amt_idx NUMBER;
130067 l_accted_amt_idx NUMBER;
130068 l_acc_rev_flag VARCHAR2(1);
130069 l_accrual_line_num NUMBER;
130070 l_tmp_amt NUMBER;
130071 l_acc_rev_natural_side_code VARCHAR2(1);
130072
130073 l_num_entries NUMBER;
130074 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
130075 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
130076 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
130077 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
130078 l_recog_line_1 NUMBER;
130079 l_recog_line_2 NUMBER;
130080
130081 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
130082 l_bflow_applied_to_amt NUMBER; -- 5132302
130083 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
130084
130085 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
130086
130087 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
130088 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
130089
130090 ---------------------------------------------------------------------------------------------------------------
130091
130092
130093 --
130094 -- bulk performance
130095 --
130096 l_balance_type_code VARCHAR2(1);
130097 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
130098 l_log_module VARCHAR2(240);
130099
130100 --
130101 -- Upgrade strategy
130102 --
130103 l_actual_upg_option VARCHAR2(1);
130104 l_enc_upg_option VARCHAR2(1);
130105
130106 --
130107 BEGIN
130108 --
130109 IF g_log_enabled THEN
130110 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_347';
130111 END IF;
130112 --
130113 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
130114
130115 trace
130116 (p_msg => 'BEGIN of AcctLineType_347'
130117 ,p_level => C_LEVEL_PROCEDURE
130118 ,p_module => l_log_module);
130119
130120 END IF;
130121 --
130122 l_component_type := 'AMB_JLT';
130123 l_component_code := 'FA_SLT_CIP_IC_REC';
130124 l_component_type_code := 'S';
130125 l_component_appl_id := 140;
130126 l_amb_context_code := 'DEFAULT';
130127 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
130128 l_event_class_code := 'CIP_SOURCE_LINE_TRANSFERS';
130129 l_event_type_code := 'CIP_SOURCE_LINE_TRANSFERS_ALL';
130130 l_line_definition_owner_code := 'S';
130131 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_S11';
130132 --
130133 l_balance_type_code := 'A';
130134 l_segment := NULL;
130135 l_ccid := NULL;
130136 l_adr_transaction_coa_id := NULL;
130137 l_adr_accounting_coa_id := NULL;
130138 l_adr_flexfield_segment_code := NULL;
130139 l_adr_flex_value_set_id := NULL;
130140 l_adr_value_type_code := NULL;
130141 l_adr_value_combination_id := NULL;
130142 l_adr_value_segment_code := NULL;
130143
130144 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
130145 l_bflow_class_code := ''; -- 4219869 Business Flow
130146 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
130147 l_budgetary_control_flag := 'N';
130148
130149 l_bflow_applied_to_amt_idx := NULL; -- 5132302
130150 l_bflow_applied_to_amt := NULL; -- 5132302
130151 l_entered_amt_idx := NULL; -- 4262811
130152 l_accted_amt_idx := NULL; -- 4262811
130156 --
130153 l_acc_rev_flag := NULL; -- 4262811
130154 l_accrual_line_num := NULL; -- 4262811
130155 l_tmp_amt := NULL; -- 4262811
130157
130158 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
130159 l_balance_type_code <> 'B' THEN
130160 IF NVL(p_source_48,'
130161 ') = 'INTERCO AR'
130162 THEN
130163
130164 --
130165 XLA_AE_LINES_PKG.SetNewLine;
130166
130167 p_balance_type_code := l_balance_type_code;
130168 -- set the flag so later we will know whether the gain loss line needs to be created
130169
130170 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
130171 p_actual_flag :='A';
130172 END IF;
130173
130174 --
130175 -- bulk performance
130176 --
130177 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
130178 p_header_num => 0); -- 4262811
130179 --
130180 -- set accounting line options
130181 --
130182 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
130183 p_natural_side_code => 'D'
130184 , p_gain_or_loss_flag => 'N'
130185 , p_gl_transfer_mode_code => 'S'
130186 , p_acct_entry_type_code => 'A'
130187 , p_switch_side_flag => 'Y'
130188 , p_merge_duplicate_code => 'N'
130189 );
130190 --
130191 l_acc_rev_natural_side_code := 'C'; -- 4262811
130192 --
130193 --
130194 -- set accounting line type info
130195 --
130196 xla_ae_lines_pkg.SetAcctLineType
130197 (p_component_type => l_component_type
130198 ,p_event_type_code => l_event_type_code
130199 ,p_line_definition_owner_code => l_line_definition_owner_code
130200 ,p_line_definition_code => l_line_definition_code
130201 ,p_accounting_line_code => l_component_code
130202 ,p_accounting_line_type_code => l_component_type_code
130203 ,p_accounting_line_appl_id => l_component_appl_id
130204 ,p_amb_context_code => l_amb_context_code
130205 ,p_entity_code => l_entity_code
130206 ,p_event_class_code => l_event_class_code);
130207 --
130208 -- set accounting class
130209 --
130210 xla_ae_lines_pkg.SetAcctClass(
130211 p_accounting_class_code => 'ASSET'
130212 , p_ae_header_id => l_ae_header_id
130213 );
130214
130215 --
130216 -- set rounding class
130217 --
130218 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
130219 'ASSET';
130220
130221 --
130222 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
130223 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
130224 --
130225 -- bulk performance
130226 --
130227 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
130228
130229 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
130230 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
130231
130232 -- 4955764
130233 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
130234 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
130235
130236 -- 4458381 Public Sector Enh
130237
130238 --
130239 -- set accounting attributes for the line type
130240 --
130241 l_entered_amt_idx := 4;
130242 l_accted_amt_idx := 6;
130243 l_bflow_applied_to_amt_idx := NULL; -- 5132302
130244 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
130245 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
130246 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
130247 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
130248 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
130249 l_rec_acct_attrs.array_char_value(3) := p_source_51;
130250 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
130251 l_rec_acct_attrs.array_num_value(4) := p_source_52;
130252 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
130253 l_rec_acct_attrs.array_char_value(5) := p_source_53;
130254 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
130255 l_rec_acct_attrs.array_num_value(6) := p_source_52;
130256
130257 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
130258 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
130259
130260 ---------------------------------------------------------------------------------------------------------------
130261 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
130262 ---------------------------------------------------------------------------------------------------------------
130263 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
130264
130265 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
130266 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
130267
130268 IF xla_accounting_cache_pkg.GetValueChar
130269 (p_source_code => 'LEDGER_CATEGORY_CODE'
130273 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
130270 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
130271 AND l_bflow_method_code = 'PRIOR_ENTRY'
130272 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
130274 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
130275 )
130276 THEN
130277 xla_ae_lines_pkg.BflowUpgEntry
130278 (p_business_method_code => l_bflow_method_code
130279 ,p_business_class_code => l_bflow_class_code
130280 ,p_balance_type => l_balance_type_code);
130281 ELSE
130282 NULL;
130283 -- No business flow processing for business flow method of NONE.
130284 END IF;
130285
130286 --
130287 -- call analytical criteria
130288 --
130289
130290 --
130291 -- call description
130292 --
130293
130294 xla_ae_lines_pkg.SetLineDescription(
130295 p_ae_header_id => l_ae_header_id
130296 ,p_description => Description_108 (
130297 p_application_id => p_application_id
130298 , p_ae_header_id => l_ae_header_id
130299 , p_source_1 => p_source_1
130300 )
130301 );
130302
130303
130304 --
130305 -- call ADRs
130306 -- Bug 4922099
130307 --
130308 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
130309 (NVL(l_actual_upg_option, 'N') = 'O') OR
130310 (NVL(l_enc_upg_option, 'N') = 'O')
130311 )
130312 THEN
130313 NULL;
130314 --
130315 --
130316
130317 l_ccid := AcctDerRule_174(
130318 p_application_id => p_application_id
130319 , p_ae_header_id => l_ae_header_id
130320 , p_source_5 => p_source_5
130321 , p_source_32 => p_source_32
130322 , x_transaction_coa_id => l_adr_transaction_coa_id
130323 , x_accounting_coa_id => l_adr_accounting_coa_id
130324 , x_value_type_code => l_adr_value_type_code
130325 , p_side => 'NA'
130326 );
130327
130328 xla_ae_lines_pkg.set_ccid(
130329 p_code_combination_id => l_ccid
130330 , p_value_type_code => l_adr_value_type_code
130331 , p_transaction_coa_id => l_adr_transaction_coa_id
130332 , p_accounting_coa_id => l_adr_accounting_coa_id
130333 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
130334 , p_adr_type_code => 'S'
130335 , p_component_type => l_component_type
130336 , p_component_code => l_component_code
130337 , p_component_type_code => l_component_type_code
130338 , p_component_appl_id => l_component_appl_id
130339 , p_amb_context_code => l_amb_context_code
130340 , p_side => 'NA'
130341 );
130342
130343
130344 l_segment := AcctDerRule_169(
130345 p_application_id => p_application_id
130346 , p_ae_header_id => l_ae_header_id
130347 , p_source_5 => p_source_5
130348 , p_source_31 => p_source_31
130349 , x_transaction_coa_id => l_adr_transaction_coa_id
130350 , x_accounting_coa_id => l_adr_accounting_coa_id
130351 , x_flexfield_segment_code => l_adr_flexfield_segment_code
130352 , x_flex_value_set_id => l_adr_flex_value_set_id
130353 , x_value_type_code => l_adr_value_type_code
130354 , x_value_combination_id => l_adr_value_combination_id
130355 , x_value_segment_code => l_adr_value_segment_code
130356 , p_side => 'NA'
130357 , p_override_seg_flag => 'Y'
130358 );
130359
130360 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
130361
130362 xla_ae_lines_pkg.set_segment(
130363 p_to_segment_code => 'GL_BALANCING'
130364 , p_segment_value => l_segment
130365 , p_from_segment_code => l_adr_value_segment_code
130366 , p_from_combination_id => l_adr_value_combination_id
130367 , p_value_type_code => l_adr_value_type_code
130368 , p_transaction_coa_id => l_adr_transaction_coa_id
130369 , p_accounting_coa_id => l_adr_accounting_coa_id
130370 , p_flexfield_segment_code => l_adr_flexfield_segment_code
130371 , p_flex_value_set_id => l_adr_flex_value_set_id
130372 , p_adr_code => 'FA_EXPENSE_ACCT'
130373 , p_adr_type_code => 'S'
130374 , p_component_type => l_component_type
130375 , p_component_code => l_component_code
130376 , p_component_type_code => l_component_type_code
130377 , p_component_appl_id => l_component_appl_id
130378 , p_amb_context_code => l_amb_context_code
130379 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
130380 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
130381 , p_side => 'NA'
130382 );
130383
130384 END IF;
130385
130386 l_segment := AcctDerRule_159(
130387 p_application_id => p_application_id
130388 , p_ae_header_id => l_ae_header_id
130389 , p_source_5 => p_source_5
130390 , p_source_22 => p_source_22
130391 , x_transaction_coa_id => l_adr_transaction_coa_id
130392 , x_accounting_coa_id => l_adr_accounting_coa_id
130393 , x_flexfield_segment_code => l_adr_flexfield_segment_code
130397 , x_value_segment_code => l_adr_value_segment_code
130394 , x_flex_value_set_id => l_adr_flex_value_set_id
130395 , x_value_type_code => l_adr_value_type_code
130396 , x_value_combination_id => l_adr_value_combination_id
130398 , p_side => 'NA'
130399 , p_override_seg_flag => 'Y'
130400 );
130401
130402 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
130403
130404 xla_ae_lines_pkg.set_segment(
130405 p_to_segment_code => 'GL_ACCOUNT'
130406 , p_segment_value => l_segment
130407 , p_from_segment_code => l_adr_value_segment_code
130408 , p_from_combination_id => l_adr_value_combination_id
130409 , p_value_type_code => l_adr_value_type_code
130410 , p_transaction_coa_id => l_adr_transaction_coa_id
130411 , p_accounting_coa_id => l_adr_accounting_coa_id
130412 , p_flexfield_segment_code => l_adr_flexfield_segment_code
130413 , p_flex_value_set_id => l_adr_flex_value_set_id
130414 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
130415 , p_adr_type_code => 'S'
130416 , p_component_type => l_component_type
130417 , p_component_code => l_component_code
130418 , p_component_type_code => l_component_type_code
130419 , p_component_appl_id => l_component_appl_id
130420 , p_amb_context_code => l_amb_context_code
130421 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
130422 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
130423 , p_side => 'NA'
130424 );
130425
130426 END IF;
130427
130428 --
130429 --
130430 END IF;
130431 --
130432 -- Bug 4922099
130433 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
130434 (NVL(l_enc_upg_option, 'N') = 'O')
130435 ) AND
130436 (l_bflow_method_code = 'PRIOR_ENTRY')
130437 )
130438 THEN
130439 IF
130440 --
130441 1 = 2
130442 --
130443 THEN
130444 xla_accounting_err_pkg.build_message
130445 (p_appli_s_name => 'XLA'
130446 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
130447 ,p_token_1 => 'LINE_NUMBER'
130448 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
130449 ,p_token_2 => 'LINE_TYPE_NAME'
130450 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
130451 l_component_type
130452 ,l_component_code
130453 ,l_component_type_code
130454 ,l_component_appl_id
130455 ,l_amb_context_code
130456 ,l_entity_code
130457 ,l_event_class_code
130458 )
130459 ,p_token_3 => 'OWNER'
130460 ,p_value_3 => xla_lookups_pkg.get_meaning(
130461 p_lookup_type => 'XLA_OWNER_TYPE'
130462 ,p_lookup_code => l_component_type_code
130463 )
130464 ,p_token_4 => 'PRODUCT_NAME'
130465 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
130466 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
130467 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
130468 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
130469 ,p_ae_header_id => NULL
130470 );
130471
130472 IF (C_LEVEL_ERROR>= g_log_level) THEN
130473 trace
130474 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
130475 ,p_level => C_LEVEL_ERROR
130476 ,p_module => l_log_module);
130477 END IF;
130478 END IF;
130479 END IF;
130480 --
130481 --
130482 ------------------------------------------------------------------------------------------------
130483 -- 4219869 Business Flow
130484 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
130485 -- Prior Entry. Currently, the following code is always generated.
130486 ------------------------------------------------------------------------------------------------
130487 XLA_AE_LINES_PKG.ValidateCurrentLine;
130488
130489 ------------------------------------------------------------------------------------
130490 -- 4219869 Business Flow
130494
130491 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
130492 ------------------------------------------------------------------------------------
130493 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
130495 ----------------------------------------------------------------------------------
130496 -- 4219869 Business Flow
130497 -- Update journal entry status -- Need to generate this within IF <condition>
130498 ----------------------------------------------------------------------------------
130499 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
130500 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
130501 ,p_balance_type_code => l_balance_type_code
130502 );
130503
130504 -------------------------------------------------------------------------------------------
130505 -- 4262811 - Generate the Accrual Reversal lines
130506 -------------------------------------------------------------------------------------------
130507 BEGIN
130508 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
130509 (g_array_event(p_event_id).array_value_num('header_index'));
130510 IF l_acc_rev_flag IS NULL THEN
130511 l_acc_rev_flag := 'N';
130512 END IF;
130513 EXCEPTION
130514 WHEN OTHERS THEN
130515 l_acc_rev_flag := 'N';
130516 END;
130517 --
130518 IF (l_acc_rev_flag = 'Y') THEN
130519
130520 -- 4645092 ------------------------------------------------------------------------------
130521 -- To allow MPA report to determine if it should generate report process
130522 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
130523 ------------------------------------------------------------------------------------------
130524
130525 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
130526 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
130527 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
130528 -- call ADRs
130529 -- Bug 4922099
130530 --
130531 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
130532 (NVL(l_actual_upg_option, 'N') = 'O') OR
130533 (NVL(l_enc_upg_option, 'N') = 'O')
130534 )
130535 THEN
130536 NULL;
130537 --
130538 --
130539
130540 l_ccid := AcctDerRule_174(
130541 p_application_id => p_application_id
130542 , p_ae_header_id => l_ae_header_id
130543 , p_source_5 => p_source_5
130544 , p_source_32 => p_source_32
130545 , x_transaction_coa_id => l_adr_transaction_coa_id
130546 , x_accounting_coa_id => l_adr_accounting_coa_id
130547 , x_value_type_code => l_adr_value_type_code
130548 , p_side => 'NA'
130549 );
130550
130551 xla_ae_lines_pkg.set_ccid(
130552 p_code_combination_id => l_ccid
130553 , p_value_type_code => l_adr_value_type_code
130554 , p_transaction_coa_id => l_adr_transaction_coa_id
130555 , p_accounting_coa_id => l_adr_accounting_coa_id
130556 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
130557 , p_adr_type_code => 'S'
130558 , p_component_type => l_component_type
130559 , p_component_code => l_component_code
130560 , p_component_type_code => l_component_type_code
130561 , p_component_appl_id => l_component_appl_id
130562 , p_amb_context_code => l_amb_context_code
130563 , p_side => 'NA'
130564 );
130565
130566
130567 l_segment := AcctDerRule_169(
130568 p_application_id => p_application_id
130569 , p_ae_header_id => l_ae_header_id
130570 , p_source_5 => p_source_5
130571 , p_source_31 => p_source_31
130572 , x_transaction_coa_id => l_adr_transaction_coa_id
130573 , x_accounting_coa_id => l_adr_accounting_coa_id
130574 , x_flexfield_segment_code => l_adr_flexfield_segment_code
130575 , x_flex_value_set_id => l_adr_flex_value_set_id
130576 , x_value_type_code => l_adr_value_type_code
130577 , x_value_combination_id => l_adr_value_combination_id
130578 , x_value_segment_code => l_adr_value_segment_code
130579 , p_side => 'NA'
130580 , p_override_seg_flag => 'Y'
130581 );
130582
130583 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
130584
130585 xla_ae_lines_pkg.set_segment(
130586 p_to_segment_code => 'GL_BALANCING'
130587 , p_segment_value => l_segment
130588 , p_from_segment_code => l_adr_value_segment_code
130589 , p_from_combination_id => l_adr_value_combination_id
130590 , p_value_type_code => l_adr_value_type_code
130591 , p_transaction_coa_id => l_adr_transaction_coa_id
130592 , p_accounting_coa_id => l_adr_accounting_coa_id
130593 , p_flexfield_segment_code => l_adr_flexfield_segment_code
130594 , p_flex_value_set_id => l_adr_flex_value_set_id
130595 , p_adr_code => 'FA_EXPENSE_ACCT'
130596 , p_adr_type_code => 'S'
130597 , p_component_type => l_component_type
130598 , p_component_code => l_component_code
130599 , p_component_type_code => l_component_type_code
130603 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
130600 , p_component_appl_id => l_component_appl_id
130601 , p_amb_context_code => l_amb_context_code
130602 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
130604 , p_side => 'NA'
130605 );
130606
130607 END IF;
130608
130609 l_segment := AcctDerRule_159(
130610 p_application_id => p_application_id
130611 , p_ae_header_id => l_ae_header_id
130612 , p_source_5 => p_source_5
130613 , p_source_22 => p_source_22
130614 , x_transaction_coa_id => l_adr_transaction_coa_id
130615 , x_accounting_coa_id => l_adr_accounting_coa_id
130616 , x_flexfield_segment_code => l_adr_flexfield_segment_code
130617 , x_flex_value_set_id => l_adr_flex_value_set_id
130618 , x_value_type_code => l_adr_value_type_code
130619 , x_value_combination_id => l_adr_value_combination_id
130620 , x_value_segment_code => l_adr_value_segment_code
130621 , p_side => 'NA'
130622 , p_override_seg_flag => 'Y'
130623 );
130624
130625 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
130626
130627 xla_ae_lines_pkg.set_segment(
130628 p_to_segment_code => 'GL_ACCOUNT'
130629 , p_segment_value => l_segment
130630 , p_from_segment_code => l_adr_value_segment_code
130631 , p_from_combination_id => l_adr_value_combination_id
130632 , p_value_type_code => l_adr_value_type_code
130633 , p_transaction_coa_id => l_adr_transaction_coa_id
130634 , p_accounting_coa_id => l_adr_accounting_coa_id
130635 , p_flexfield_segment_code => l_adr_flexfield_segment_code
130636 , p_flex_value_set_id => l_adr_flex_value_set_id
130637 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
130638 , p_adr_type_code => 'S'
130639 , p_component_type => l_component_type
130640 , p_component_code => l_component_code
130641 , p_component_type_code => l_component_type_code
130642 , p_component_appl_id => l_component_appl_id
130643 , p_amb_context_code => l_amb_context_code
130644 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
130645 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
130646 , p_side => 'NA'
130647 );
130648
130649 END IF;
130650
130651 --
130652 --
130653 END IF;
130654
130655 --
130656 -- Update the line information that should be overwritten
130657 --
130658 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
130659 p_header_num => 1);
130660 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
130661
130662 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
130663
130664 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
130665 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
130666 END IF;
130667
130668 --
130669 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
130670 --
130671 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
130672 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
130673 ELSE
130674 ---------------------------------------------------------------------------------------------------
130675 -- 4262811a Switch Sign
130676 ---------------------------------------------------------------------------------------------------
130677 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
130678 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
130679 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
130680 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
130681 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
130682 -- 5132302
130683 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
130684 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
130685
130686 END IF;
130687
130688 -- 4955764
130689 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
130690 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
130691
130692
130693 XLA_AE_LINES_PKG.ValidateCurrentLine;
130694 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
130695
130696 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
130697 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
130698 ,p_balance_type_code => l_balance_type_code);
130699
130700 END IF;
130701
130702 -----------------------------------------------------------------------------------------
130703 -- 4262811 Multiperiod Accounting
130707
130704 -----------------------------------------------------------------------------------------
130705 -- No MPA option is assigned.
130706
130708 END IF;
130709 END IF;
130710 --
130711
130712 --
130713 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
130714 trace
130715 (p_msg => 'END of AcctLineType_347'
130716 ,p_level => C_LEVEL_PROCEDURE
130717 ,p_module => l_log_module);
130718 END IF;
130719 --
130720 EXCEPTION
130721 WHEN xla_exceptions_pkg.application_exception THEN
130722 RAISE;
130723 WHEN OTHERS THEN
130724 xla_exceptions_pkg.raise_message
130725 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_347');
130726 END AcctLineType_347;
130727 --
130728
130729 ---------------------------------------
130730 --
130731 -- PRIVATE FUNCTION
130732 -- AcctLineType_348
130733 --
130734 ---------------------------------------
130735 PROCEDURE AcctLineType_348 (
130736 p_application_id IN NUMBER
130737 ,p_event_id IN NUMBER
130738 ,p_calculate_acctd_flag IN VARCHAR2
130739 ,p_calculate_g_l_flag IN VARCHAR2
130740 ,p_actual_flag IN OUT VARCHAR2
130741 ,p_balance_type_code OUT VARCHAR2
130742 ,p_gain_or_loss_ref OUT VARCHAR2
130743
130744 --Period Close Date
130745 , p_source_1 IN DATE
130746 --Bonus Depreciation Expense Account
130747 , p_source_4 IN VARCHAR2
130748 --Generated Code Combination Identifier
130749 , p_source_5 IN NUMBER
130750 --Expense Account Code Combination Identifier
130751 , p_source_31 IN NUMBER
130752 --Adjustment Type
130753 , p_source_48 IN VARCHAR2
130754 --Transaction Header Identifier
130755 , p_source_49 IN NUMBER
130756 --Adjustment Line Identifier
130757 , p_source_50 IN NUMBER
130758 --Distribution Type Code
130759 , p_source_51 IN VARCHAR2
130760 --Entered Amount
130761 , p_source_52 IN NUMBER
130762 --Currency Code
130763 , p_source_53 IN VARCHAR2
130764 --Source Destination Code
130765 , p_source_55 IN VARCHAR2
130766 )
130767 IS
130768
130769 l_component_type VARCHAR2(80);
130770 l_component_code VARCHAR2(30);
130771 l_component_type_code VARCHAR2(1);
130772 l_component_appl_id INTEGER;
130773 l_amb_context_code VARCHAR2(30);
130774 l_entity_code VARCHAR2(30);
130775 l_event_class_code VARCHAR2(30);
130776 l_ae_header_id NUMBER;
130777 l_event_type_code VARCHAR2(30);
130778 l_line_definition_code VARCHAR2(30);
130779 l_line_definition_owner_code VARCHAR2(1);
130780 --
130781 -- adr variables
130782 l_segment VARCHAR2(30);
130783 l_ccid NUMBER;
130784 l_adr_transaction_coa_id NUMBER;
130785 l_adr_accounting_coa_id NUMBER;
130786 l_adr_flexfield_segment_code VARCHAR2(30);
130787 l_adr_flex_value_set_id NUMBER;
130788 l_adr_value_type_code VARCHAR2(30);
130789 l_adr_value_combination_id NUMBER;
130790 l_adr_value_segment_code VARCHAR2(30);
130791
130792 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
130793 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
130794 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
130795 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
130796
130797 -- 4262811 Variables ------------------------------------------------------------------------------------------
130798 l_entered_amt_idx NUMBER;
130799 l_accted_amt_idx NUMBER;
130800 l_acc_rev_flag VARCHAR2(1);
130801 l_accrual_line_num NUMBER;
130802 l_tmp_amt NUMBER;
130803 l_acc_rev_natural_side_code VARCHAR2(1);
130804
130805 l_num_entries NUMBER;
130806 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
130807 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
130808 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
130809 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
130810 l_recog_line_1 NUMBER;
130811 l_recog_line_2 NUMBER;
130812
130813 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
130814 l_bflow_applied_to_amt NUMBER; -- 5132302
130815 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
130816
130817 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
130818
130819 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
130820 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
130821
130822 ---------------------------------------------------------------------------------------------------------------
130823
130824
130825 --
130826 -- bulk performance
130827 --
130828 l_balance_type_code VARCHAR2(1);
130829 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
130830 l_log_module VARCHAR2(240);
130831
130832 --
130833 -- Upgrade strategy
130834 --
130835 l_actual_upg_option VARCHAR2(1);
130836 l_enc_upg_option VARCHAR2(1);
130837
130838 --
130839 BEGIN
130840 --
130841 IF g_log_enabled THEN
130842 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_348';
130843 END IF;
130844 --
130848 (p_msg => 'BEGIN of AcctLineType_348'
130845 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
130846
130847 trace
130849 ,p_level => C_LEVEL_PROCEDURE
130850 ,p_module => l_log_module);
130851
130852 END IF;
130853 --
130854 l_component_type := 'AMB_JLT';
130855 l_component_code := 'FA_SLT_DEST_BONUS_EXP';
130856 l_component_type_code := 'S';
130857 l_component_appl_id := 140;
130858 l_amb_context_code := 'DEFAULT';
130859 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
130860 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
130861 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
130862 l_line_definition_owner_code := 'S';
130863 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
130864 --
130865 l_balance_type_code := 'A';
130866 l_segment := NULL;
130867 l_ccid := NULL;
130868 l_adr_transaction_coa_id := NULL;
130869 l_adr_accounting_coa_id := NULL;
130870 l_adr_flexfield_segment_code := NULL;
130871 l_adr_flex_value_set_id := NULL;
130872 l_adr_value_type_code := NULL;
130873 l_adr_value_combination_id := NULL;
130874 l_adr_value_segment_code := NULL;
130875
130876 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
130877 l_bflow_class_code := ''; -- 4219869 Business Flow
130878 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
130879 l_budgetary_control_flag := 'N';
130880
130881 l_bflow_applied_to_amt_idx := NULL; -- 5132302
130882 l_bflow_applied_to_amt := NULL; -- 5132302
130883 l_entered_amt_idx := NULL; -- 4262811
130884 l_accted_amt_idx := NULL; -- 4262811
130885 l_acc_rev_flag := NULL; -- 4262811
130886 l_accrual_line_num := NULL; -- 4262811
130887 l_tmp_amt := NULL; -- 4262811
130888 --
130889
130890 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
130891 l_balance_type_code <> 'B' THEN
130892 IF NVL(p_source_48,'
130893 ') = 'BONUS EXPENSE' AND
130894 NVL(p_source_55,'
130895 ') = 'DEST'
130896 THEN
130897
130898 --
130899 XLA_AE_LINES_PKG.SetNewLine;
130900
130901 p_balance_type_code := l_balance_type_code;
130902 -- set the flag so later we will know whether the gain loss line needs to be created
130903
130904 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
130905 p_actual_flag :='A';
130906 END IF;
130907
130908 --
130909 -- bulk performance
130910 --
130911 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
130912 p_header_num => 0); -- 4262811
130913 --
130914 -- set accounting line options
130915 --
130916 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
130917 p_natural_side_code => 'D'
130918 , p_gain_or_loss_flag => 'N'
130919 , p_gl_transfer_mode_code => 'S'
130920 , p_acct_entry_type_code => 'A'
130921 , p_switch_side_flag => 'Y'
130922 , p_merge_duplicate_code => 'N'
130923 );
130924 --
130925 l_acc_rev_natural_side_code := 'C'; -- 4262811
130926 --
130927 --
130928 -- set accounting line type info
130929 --
130930 xla_ae_lines_pkg.SetAcctLineType
130931 (p_component_type => l_component_type
130932 ,p_event_type_code => l_event_type_code
130933 ,p_line_definition_owner_code => l_line_definition_owner_code
130934 ,p_line_definition_code => l_line_definition_code
130935 ,p_accounting_line_code => l_component_code
130936 ,p_accounting_line_type_code => l_component_type_code
130937 ,p_accounting_line_appl_id => l_component_appl_id
130938 ,p_amb_context_code => l_amb_context_code
130939 ,p_entity_code => l_entity_code
130940 ,p_event_class_code => l_event_class_code);
130941 --
130942 -- set accounting class
130943 --
130944 xla_ae_lines_pkg.SetAcctClass(
130945 p_accounting_class_code => 'EXPENSE'
130946 , p_ae_header_id => l_ae_header_id
130947 );
130948
130949 --
130950 -- set rounding class
130951 --
130952 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
130953 'EXPENSE';
130954
130955 --
130956 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
130957 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
130958 --
130959 -- bulk performance
130960 --
130961 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
130962
130963 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
130964 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
130965
130966 -- 4955764
130967 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
130968 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
130969
130970 -- 4458381 Public Sector Enh
130971
130972 --
130973 -- set accounting attributes for the line type
130977 l_bflow_applied_to_amt_idx := NULL; -- 5132302
130974 --
130975 l_entered_amt_idx := 4;
130976 l_accted_amt_idx := 6;
130978 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
130979 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
130980 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
130981 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
130982 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
130983 l_rec_acct_attrs.array_char_value(3) := p_source_51;
130984 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
130985 l_rec_acct_attrs.array_num_value(4) := p_source_52;
130986 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
130987 l_rec_acct_attrs.array_char_value(5) := p_source_53;
130988 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
130989 l_rec_acct_attrs.array_num_value(6) := p_source_52;
130990
130991 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
130992 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
130993
130994 ---------------------------------------------------------------------------------------------------------------
130995 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
130996 ---------------------------------------------------------------------------------------------------------------
130997 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
130998
130999 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
131000 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
131001
131002 IF xla_accounting_cache_pkg.GetValueChar
131003 (p_source_code => 'LEDGER_CATEGORY_CODE'
131004 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
131005 AND l_bflow_method_code = 'PRIOR_ENTRY'
131006 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
131007 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
131008 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
131009 )
131010 THEN
131011 xla_ae_lines_pkg.BflowUpgEntry
131012 (p_business_method_code => l_bflow_method_code
131013 ,p_business_class_code => l_bflow_class_code
131014 ,p_balance_type => l_balance_type_code);
131015 ELSE
131016 NULL;
131017 -- No business flow processing for business flow method of NONE.
131018 END IF;
131019
131020 --
131021 -- call analytical criteria
131022 --
131023
131024 --
131025 -- call description
131026 --
131027
131028 xla_ae_lines_pkg.SetLineDescription(
131029 p_ae_header_id => l_ae_header_id
131030 ,p_description => Description_103 (
131031 p_application_id => p_application_id
131032 , p_ae_header_id => l_ae_header_id
131033 , p_source_1 => p_source_1
131034 )
131035 );
131036
131037
131038 --
131039 -- call ADRs
131040 -- Bug 4922099
131041 --
131042 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
131043 (NVL(l_actual_upg_option, 'N') = 'O') OR
131044 (NVL(l_enc_upg_option, 'N') = 'O')
131045 )
131046 THEN
131047 NULL;
131048 --
131049 --
131050
131051 l_ccid := AcctDerRule_176(
131052 p_application_id => p_application_id
131053 , p_ae_header_id => l_ae_header_id
131054 , p_source_5 => p_source_5
131055 , p_source_31 => p_source_31
131056 , x_transaction_coa_id => l_adr_transaction_coa_id
131057 , x_accounting_coa_id => l_adr_accounting_coa_id
131058 , x_value_type_code => l_adr_value_type_code
131059 , p_side => 'NA'
131060 );
131061
131062 xla_ae_lines_pkg.set_ccid(
131063 p_code_combination_id => l_ccid
131064 , p_value_type_code => l_adr_value_type_code
131065 , p_transaction_coa_id => l_adr_transaction_coa_id
131066 , p_accounting_coa_id => l_adr_accounting_coa_id
131067 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
131068 , p_adr_type_code => 'S'
131069 , p_component_type => l_component_type
131070 , p_component_code => l_component_code
131071 , p_component_type_code => l_component_type_code
131072 , p_component_appl_id => l_component_appl_id
131073 , p_amb_context_code => l_amb_context_code
131074 , p_side => 'NA'
131075 );
131076
131077
131078 l_segment := AcctDerRule_144(
131079 p_application_id => p_application_id
131080 , p_ae_header_id => l_ae_header_id
131081 , p_source_4 => p_source_4
131082 , p_source_5 => p_source_5
131083 , x_transaction_coa_id => l_adr_transaction_coa_id
131084 , x_accounting_coa_id => l_adr_accounting_coa_id
131085 , x_flexfield_segment_code => l_adr_flexfield_segment_code
131086 , x_flex_value_set_id => l_adr_flex_value_set_id
131087 , x_value_type_code => l_adr_value_type_code
131088 , x_value_combination_id => l_adr_value_combination_id
131089 , x_value_segment_code => l_adr_value_segment_code
131093
131090 , p_side => 'NA'
131091 , p_override_seg_flag => 'Y'
131092 );
131094 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
131095
131096 xla_ae_lines_pkg.set_segment(
131097 p_to_segment_code => 'GL_ACCOUNT'
131098 , p_segment_value => l_segment
131099 , p_from_segment_code => l_adr_value_segment_code
131100 , p_from_combination_id => l_adr_value_combination_id
131101 , p_value_type_code => l_adr_value_type_code
131102 , p_transaction_coa_id => l_adr_transaction_coa_id
131103 , p_accounting_coa_id => l_adr_accounting_coa_id
131104 , p_flexfield_segment_code => l_adr_flexfield_segment_code
131105 , p_flex_value_set_id => l_adr_flex_value_set_id
131106 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
131107 , p_adr_type_code => 'S'
131108 , p_component_type => l_component_type
131109 , p_component_code => l_component_code
131110 , p_component_type_code => l_component_type_code
131111 , p_component_appl_id => l_component_appl_id
131112 , p_amb_context_code => l_amb_context_code
131113 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
131114 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
131115 , p_side => 'NA'
131116 );
131117
131118 END IF;
131119
131120 --
131121 --
131122 END IF;
131123 --
131124 -- Bug 4922099
131125 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
131126 (NVL(l_enc_upg_option, 'N') = 'O')
131127 ) AND
131128 (l_bflow_method_code = 'PRIOR_ENTRY')
131129 )
131130 THEN
131131 IF
131132 --
131133 1 = 2
131134 --
131135 THEN
131136 xla_accounting_err_pkg.build_message
131137 (p_appli_s_name => 'XLA'
131138 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
131139 ,p_token_1 => 'LINE_NUMBER'
131140 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
131141 ,p_token_2 => 'LINE_TYPE_NAME'
131142 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
131143 l_component_type
131144 ,l_component_code
131145 ,l_component_type_code
131146 ,l_component_appl_id
131147 ,l_amb_context_code
131148 ,l_entity_code
131149 ,l_event_class_code
131150 )
131151 ,p_token_3 => 'OWNER'
131152 ,p_value_3 => xla_lookups_pkg.get_meaning(
131153 p_lookup_type => 'XLA_OWNER_TYPE'
131154 ,p_lookup_code => l_component_type_code
131155 )
131156 ,p_token_4 => 'PRODUCT_NAME'
131157 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
131158 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
131159 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
131160 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
131161 ,p_ae_header_id => NULL
131162 );
131163
131164 IF (C_LEVEL_ERROR>= g_log_level) THEN
131165 trace
131166 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
131167 ,p_level => C_LEVEL_ERROR
131168 ,p_module => l_log_module);
131169 END IF;
131170 END IF;
131171 END IF;
131172 --
131173 --
131174 ------------------------------------------------------------------------------------------------
131175 -- 4219869 Business Flow
131176 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
131177 -- Prior Entry. Currently, the following code is always generated.
131178 ------------------------------------------------------------------------------------------------
131179 XLA_AE_LINES_PKG.ValidateCurrentLine;
131180
131181 ------------------------------------------------------------------------------------
131182 -- 4219869 Business Flow
131183 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
131184 ------------------------------------------------------------------------------------
131185 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
131186
131190 ----------------------------------------------------------------------------------
131187 ----------------------------------------------------------------------------------
131188 -- 4219869 Business Flow
131189 -- Update journal entry status -- Need to generate this within IF <condition>
131191 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
131192 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
131193 ,p_balance_type_code => l_balance_type_code
131194 );
131195
131196 -------------------------------------------------------------------------------------------
131197 -- 4262811 - Generate the Accrual Reversal lines
131198 -------------------------------------------------------------------------------------------
131199 BEGIN
131200 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
131201 (g_array_event(p_event_id).array_value_num('header_index'));
131202 IF l_acc_rev_flag IS NULL THEN
131203 l_acc_rev_flag := 'N';
131204 END IF;
131205 EXCEPTION
131206 WHEN OTHERS THEN
131207 l_acc_rev_flag := 'N';
131208 END;
131209 --
131210 IF (l_acc_rev_flag = 'Y') THEN
131211
131212 -- 4645092 ------------------------------------------------------------------------------
131213 -- To allow MPA report to determine if it should generate report process
131214 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
131215 ------------------------------------------------------------------------------------------
131216
131217 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
131218 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
131219 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
131220 -- call ADRs
131221 -- Bug 4922099
131222 --
131223 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
131224 (NVL(l_actual_upg_option, 'N') = 'O') OR
131225 (NVL(l_enc_upg_option, 'N') = 'O')
131226 )
131227 THEN
131228 NULL;
131229 --
131230 --
131231
131232 l_ccid := AcctDerRule_176(
131233 p_application_id => p_application_id
131234 , p_ae_header_id => l_ae_header_id
131235 , p_source_5 => p_source_5
131236 , p_source_31 => p_source_31
131237 , x_transaction_coa_id => l_adr_transaction_coa_id
131238 , x_accounting_coa_id => l_adr_accounting_coa_id
131239 , x_value_type_code => l_adr_value_type_code
131240 , p_side => 'NA'
131241 );
131242
131243 xla_ae_lines_pkg.set_ccid(
131244 p_code_combination_id => l_ccid
131245 , p_value_type_code => l_adr_value_type_code
131246 , p_transaction_coa_id => l_adr_transaction_coa_id
131247 , p_accounting_coa_id => l_adr_accounting_coa_id
131248 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
131249 , p_adr_type_code => 'S'
131250 , p_component_type => l_component_type
131251 , p_component_code => l_component_code
131252 , p_component_type_code => l_component_type_code
131253 , p_component_appl_id => l_component_appl_id
131254 , p_amb_context_code => l_amb_context_code
131255 , p_side => 'NA'
131256 );
131257
131258
131259 l_segment := AcctDerRule_144(
131260 p_application_id => p_application_id
131261 , p_ae_header_id => l_ae_header_id
131262 , p_source_4 => p_source_4
131263 , p_source_5 => p_source_5
131264 , x_transaction_coa_id => l_adr_transaction_coa_id
131265 , x_accounting_coa_id => l_adr_accounting_coa_id
131266 , x_flexfield_segment_code => l_adr_flexfield_segment_code
131267 , x_flex_value_set_id => l_adr_flex_value_set_id
131268 , x_value_type_code => l_adr_value_type_code
131269 , x_value_combination_id => l_adr_value_combination_id
131270 , x_value_segment_code => l_adr_value_segment_code
131271 , p_side => 'NA'
131272 , p_override_seg_flag => 'Y'
131273 );
131274
131275 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
131276
131277 xla_ae_lines_pkg.set_segment(
131278 p_to_segment_code => 'GL_ACCOUNT'
131279 , p_segment_value => l_segment
131280 , p_from_segment_code => l_adr_value_segment_code
131281 , p_from_combination_id => l_adr_value_combination_id
131282 , p_value_type_code => l_adr_value_type_code
131283 , p_transaction_coa_id => l_adr_transaction_coa_id
131284 , p_accounting_coa_id => l_adr_accounting_coa_id
131285 , p_flexfield_segment_code => l_adr_flexfield_segment_code
131286 , p_flex_value_set_id => l_adr_flex_value_set_id
131287 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
131288 , p_adr_type_code => 'S'
131289 , p_component_type => l_component_type
131290 , p_component_code => l_component_code
131291 , p_component_type_code => l_component_type_code
131292 , p_component_appl_id => l_component_appl_id
131293 , p_amb_context_code => l_amb_context_code
131294 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
131295 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
131299 END IF;
131296 , p_side => 'NA'
131297 );
131298
131300
131301 --
131302 --
131303 END IF;
131304
131305 --
131306 -- Update the line information that should be overwritten
131307 --
131308 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
131309 p_header_num => 1);
131310 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
131311
131312 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
131313
131314 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
131315 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
131316 END IF;
131317
131318 --
131319 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
131320 --
131321 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
131322 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
131323 ELSE
131324 ---------------------------------------------------------------------------------------------------
131325 -- 4262811a Switch Sign
131326 ---------------------------------------------------------------------------------------------------
131327 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
131328 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
131329 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
131330 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
131331 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
131332 -- 5132302
131333 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
131334 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
131335
131336 END IF;
131337
131338 -- 4955764
131339 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
131340 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
131341
131342
131343 XLA_AE_LINES_PKG.ValidateCurrentLine;
131344 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
131345
131346 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
131347 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
131348 ,p_balance_type_code => l_balance_type_code);
131349
131350 END IF;
131351
131352 -----------------------------------------------------------------------------------------
131353 -- 4262811 Multiperiod Accounting
131354 -----------------------------------------------------------------------------------------
131355 -- No MPA option is assigned.
131356
131357
131358 END IF;
131359 END IF;
131360 --
131361
131362 --
131363 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
131364 trace
131365 (p_msg => 'END of AcctLineType_348'
131366 ,p_level => C_LEVEL_PROCEDURE
131367 ,p_module => l_log_module);
131368 END IF;
131369 --
131370 EXCEPTION
131371 WHEN xla_exceptions_pkg.application_exception THEN
131372 RAISE;
131373 WHEN OTHERS THEN
131374 xla_exceptions_pkg.raise_message
131375 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_348');
131376 END AcctLineType_348;
131377 --
131378
131379 ---------------------------------------
131380 --
131381 -- PRIVATE FUNCTION
131382 -- AcctLineType_349
131383 --
131384 ---------------------------------------
131385 PROCEDURE AcctLineType_349 (
131386 p_application_id IN NUMBER
131387 ,p_event_id IN NUMBER
131388 ,p_calculate_acctd_flag IN VARCHAR2
131389 ,p_calculate_g_l_flag IN VARCHAR2
131390 ,p_actual_flag IN OUT VARCHAR2
131391 ,p_balance_type_code OUT VARCHAR2
131392 ,p_gain_or_loss_ref OUT VARCHAR2
131393
131394 --Period Close Date
131395 , p_source_1 IN DATE
131396 --Generated Code Combination Identifier
131397 , p_source_5 IN NUMBER
131398 --Bonus Reserve Account
131399 , p_source_6 IN VARCHAR2
131400 --Generated Offset Code Combination Identifier
131401 , p_source_19 IN NUMBER
131402 --Expense Account Code Combination Identifier
131403 , p_source_31 IN NUMBER
131404 --Default Code Combination Identifier
131405 , p_source_32 IN NUMBER
131406 --Adjustment Type
131407 , p_source_48 IN VARCHAR2
131408 --Transaction Header Identifier
131409 , p_source_49 IN NUMBER
131410 --Adjustment Line Identifier
131411 , p_source_50 IN NUMBER
131412 --Distribution Type Code
131413 , p_source_51 IN VARCHAR2
131414 --Entered Amount
131415 , p_source_52 IN NUMBER
131416 --Currency Code
131417 , p_source_53 IN VARCHAR2
131418 --Source Destination Code
131419 , p_source_55 IN VARCHAR2
131420 )
131421 IS
131422
131423 l_component_type VARCHAR2(80);
131424 l_component_code VARCHAR2(30);
131425 l_component_type_code VARCHAR2(1);
131429 l_event_class_code VARCHAR2(30);
131426 l_component_appl_id INTEGER;
131427 l_amb_context_code VARCHAR2(30);
131428 l_entity_code VARCHAR2(30);
131430 l_ae_header_id NUMBER;
131431 l_event_type_code VARCHAR2(30);
131432 l_line_definition_code VARCHAR2(30);
131433 l_line_definition_owner_code VARCHAR2(1);
131434 --
131435 -- adr variables
131436 l_segment VARCHAR2(30);
131437 l_ccid NUMBER;
131438 l_adr_transaction_coa_id NUMBER;
131439 l_adr_accounting_coa_id NUMBER;
131440 l_adr_flexfield_segment_code VARCHAR2(30);
131441 l_adr_flex_value_set_id NUMBER;
131442 l_adr_value_type_code VARCHAR2(30);
131443 l_adr_value_combination_id NUMBER;
131444 l_adr_value_segment_code VARCHAR2(30);
131445
131446 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
131447 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
131448 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
131449 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
131450
131451 -- 4262811 Variables ------------------------------------------------------------------------------------------
131452 l_entered_amt_idx NUMBER;
131453 l_accted_amt_idx NUMBER;
131454 l_acc_rev_flag VARCHAR2(1);
131455 l_accrual_line_num NUMBER;
131456 l_tmp_amt NUMBER;
131457 l_acc_rev_natural_side_code VARCHAR2(1);
131458
131459 l_num_entries NUMBER;
131460 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
131461 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
131462 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
131463 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
131464 l_recog_line_1 NUMBER;
131465 l_recog_line_2 NUMBER;
131466
131467 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
131468 l_bflow_applied_to_amt NUMBER; -- 5132302
131469 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
131470
131471 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
131472
131473 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
131474 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
131475
131476 ---------------------------------------------------------------------------------------------------------------
131477
131478
131479 --
131480 -- bulk performance
131481 --
131482 l_balance_type_code VARCHAR2(1);
131483 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
131484 l_log_module VARCHAR2(240);
131485
131486 --
131487 -- Upgrade strategy
131488 --
131489 l_actual_upg_option VARCHAR2(1);
131490 l_enc_upg_option VARCHAR2(1);
131491
131492 --
131493 BEGIN
131494 --
131495 IF g_log_enabled THEN
131496 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_349';
131497 END IF;
131498 --
131499 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
131500
131501 trace
131502 (p_msg => 'BEGIN of AcctLineType_349'
131503 ,p_level => C_LEVEL_PROCEDURE
131504 ,p_module => l_log_module);
131505
131506 END IF;
131507 --
131508 l_component_type := 'AMB_JLT';
131509 l_component_code := 'FA_SLT_DEST_BONUS_RESERVE';
131510 l_component_type_code := 'S';
131511 l_component_appl_id := 140;
131512 l_amb_context_code := 'DEFAULT';
131513 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
131514 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
131515 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
131516 l_line_definition_owner_code := 'S';
131517 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
131518 --
131519 l_balance_type_code := 'A';
131520 l_segment := NULL;
131521 l_ccid := NULL;
131522 l_adr_transaction_coa_id := NULL;
131523 l_adr_accounting_coa_id := NULL;
131524 l_adr_flexfield_segment_code := NULL;
131525 l_adr_flex_value_set_id := NULL;
131526 l_adr_value_type_code := NULL;
131527 l_adr_value_combination_id := NULL;
131528 l_adr_value_segment_code := NULL;
131529
131530 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
131531 l_bflow_class_code := ''; -- 4219869 Business Flow
131532 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
131533 l_budgetary_control_flag := 'N';
131534
131535 l_bflow_applied_to_amt_idx := NULL; -- 5132302
131536 l_bflow_applied_to_amt := NULL; -- 5132302
131537 l_entered_amt_idx := NULL; -- 4262811
131538 l_accted_amt_idx := NULL; -- 4262811
131539 l_acc_rev_flag := NULL; -- 4262811
131540 l_accrual_line_num := NULL; -- 4262811
131541 l_tmp_amt := NULL; -- 4262811
131542 --
131543
131544 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
131545 l_balance_type_code <> 'B' THEN
131546 IF (NVL(p_source_48,'
131547 ') = 'BONUS EXPENSE' OR
131548 NVL(p_source_48,'
131549 ') = 'BONUS RESERVE') AND
131550 NVL(p_source_55,'
131551 ') = 'DEST'
131555 XLA_AE_LINES_PKG.SetNewLine;
131552 THEN
131553
131554 --
131556
131557 p_balance_type_code := l_balance_type_code;
131558 -- set the flag so later we will know whether the gain loss line needs to be created
131559
131560 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
131561 p_actual_flag :='A';
131562 END IF;
131563
131564 --
131565 -- bulk performance
131566 --
131567 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
131568 p_header_num => 0); -- 4262811
131569 --
131570 -- set accounting line options
131571 --
131572 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
131573 p_natural_side_code => 'C'
131574 , p_gain_or_loss_flag => 'N'
131575 , p_gl_transfer_mode_code => 'S'
131576 , p_acct_entry_type_code => 'A'
131577 , p_switch_side_flag => 'Y'
131578 , p_merge_duplicate_code => 'N'
131579 );
131580 --
131581 l_acc_rev_natural_side_code := 'D'; -- 4262811
131582 --
131583 --
131584 -- set accounting line type info
131585 --
131586 xla_ae_lines_pkg.SetAcctLineType
131587 (p_component_type => l_component_type
131588 ,p_event_type_code => l_event_type_code
131589 ,p_line_definition_owner_code => l_line_definition_owner_code
131590 ,p_line_definition_code => l_line_definition_code
131591 ,p_accounting_line_code => l_component_code
131592 ,p_accounting_line_type_code => l_component_type_code
131593 ,p_accounting_line_appl_id => l_component_appl_id
131594 ,p_amb_context_code => l_amb_context_code
131595 ,p_entity_code => l_entity_code
131596 ,p_event_class_code => l_event_class_code);
131597 --
131598 -- set accounting class
131599 --
131600 xla_ae_lines_pkg.SetAcctClass(
131601 p_accounting_class_code => 'ASSET'
131602 , p_ae_header_id => l_ae_header_id
131603 );
131604
131605 --
131606 -- set rounding class
131607 --
131608 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
131609 'ASSET';
131610
131611 --
131612 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
131613 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
131614 --
131615 -- bulk performance
131616 --
131617 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
131618
131619 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
131620 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
131621
131622 -- 4955764
131623 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
131624 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
131625
131626 -- 4458381 Public Sector Enh
131627
131628 --
131629 -- set accounting attributes for the line type
131630 --
131631 l_entered_amt_idx := 4;
131632 l_accted_amt_idx := 6;
131633 l_bflow_applied_to_amt_idx := NULL; -- 5132302
131634 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
131635 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
131636 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
131637 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
131638 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
131639 l_rec_acct_attrs.array_char_value(3) := p_source_51;
131640 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
131641 l_rec_acct_attrs.array_num_value(4) := p_source_52;
131642 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
131643 l_rec_acct_attrs.array_char_value(5) := p_source_53;
131644 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
131645 l_rec_acct_attrs.array_num_value(6) := p_source_52;
131646
131647 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
131648 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
131649
131650 ---------------------------------------------------------------------------------------------------------------
131651 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
131652 ---------------------------------------------------------------------------------------------------------------
131653 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
131654
131655 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
131656 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
131657
131658 IF xla_accounting_cache_pkg.GetValueChar
131659 (p_source_code => 'LEDGER_CATEGORY_CODE'
131660 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
131661 AND l_bflow_method_code = 'PRIOR_ENTRY'
131662 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
131663 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
131664 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
131665 )
131669 ,p_business_class_code => l_bflow_class_code
131666 THEN
131667 xla_ae_lines_pkg.BflowUpgEntry
131668 (p_business_method_code => l_bflow_method_code
131670 ,p_balance_type => l_balance_type_code);
131671 ELSE
131672 NULL;
131673 -- No business flow processing for business flow method of NONE.
131674 END IF;
131675
131676 --
131677 -- call analytical criteria
131678 --
131679
131680 --
131681 -- call description
131682 --
131683
131684 xla_ae_lines_pkg.SetLineDescription(
131685 p_ae_header_id => l_ae_header_id
131686 ,p_description => Description_104 (
131687 p_application_id => p_application_id
131688 , p_ae_header_id => l_ae_header_id
131689 , p_source_1 => p_source_1
131690 )
131691 );
131692
131693
131694 --
131695 -- call ADRs
131696 -- Bug 4922099
131697 --
131698 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
131699 (NVL(l_actual_upg_option, 'N') = 'O') OR
131700 (NVL(l_enc_upg_option, 'N') = 'O')
131701 )
131702 THEN
131703 NULL;
131704 --
131705 --
131706
131707 l_ccid := AcctDerRule_175(
131708 p_application_id => p_application_id
131709 , p_ae_header_id => l_ae_header_id
131710 , p_source_5 => p_source_5
131711 , p_source_19 => p_source_19
131712 , p_source_32 => p_source_32
131713 , x_transaction_coa_id => l_adr_transaction_coa_id
131714 , x_accounting_coa_id => l_adr_accounting_coa_id
131715 , x_value_type_code => l_adr_value_type_code
131716 , p_side => 'NA'
131717 );
131718
131719 xla_ae_lines_pkg.set_ccid(
131720 p_code_combination_id => l_ccid
131721 , p_value_type_code => l_adr_value_type_code
131722 , p_transaction_coa_id => l_adr_transaction_coa_id
131723 , p_accounting_coa_id => l_adr_accounting_coa_id
131724 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
131725 , p_adr_type_code => 'S'
131726 , p_component_type => l_component_type
131727 , p_component_code => l_component_code
131728 , p_component_type_code => l_component_type_code
131729 , p_component_appl_id => l_component_appl_id
131730 , p_amb_context_code => l_amb_context_code
131731 , p_side => 'NA'
131732 );
131733
131734
131735 l_segment := AcctDerRule_145(
131736 p_application_id => p_application_id
131737 , p_ae_header_id => l_ae_header_id
131738 , p_source_5 => p_source_5
131739 , p_source_6 => p_source_6
131740 , x_transaction_coa_id => l_adr_transaction_coa_id
131741 , x_accounting_coa_id => l_adr_accounting_coa_id
131742 , x_flexfield_segment_code => l_adr_flexfield_segment_code
131743 , x_flex_value_set_id => l_adr_flex_value_set_id
131744 , x_value_type_code => l_adr_value_type_code
131745 , x_value_combination_id => l_adr_value_combination_id
131746 , x_value_segment_code => l_adr_value_segment_code
131747 , p_side => 'NA'
131748 , p_override_seg_flag => 'Y'
131749 );
131750
131751 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
131752
131753 xla_ae_lines_pkg.set_segment(
131754 p_to_segment_code => 'GL_ACCOUNT'
131755 , p_segment_value => l_segment
131756 , p_from_segment_code => l_adr_value_segment_code
131757 , p_from_combination_id => l_adr_value_combination_id
131758 , p_value_type_code => l_adr_value_type_code
131759 , p_transaction_coa_id => l_adr_transaction_coa_id
131760 , p_accounting_coa_id => l_adr_accounting_coa_id
131761 , p_flexfield_segment_code => l_adr_flexfield_segment_code
131762 , p_flex_value_set_id => l_adr_flex_value_set_id
131763 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
131764 , p_adr_type_code => 'S'
131765 , p_component_type => l_component_type
131766 , p_component_code => l_component_code
131767 , p_component_type_code => l_component_type_code
131768 , p_component_appl_id => l_component_appl_id
131769 , p_amb_context_code => l_amb_context_code
131770 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
131771 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
131772 , p_side => 'NA'
131773 );
131774
131775 END IF;
131776
131777 l_segment := AcctDerRule_169(
131778 p_application_id => p_application_id
131779 , p_ae_header_id => l_ae_header_id
131780 , p_source_5 => p_source_5
131781 , p_source_31 => p_source_31
131782 , x_transaction_coa_id => l_adr_transaction_coa_id
131783 , x_accounting_coa_id => l_adr_accounting_coa_id
131784 , x_flexfield_segment_code => l_adr_flexfield_segment_code
131785 , x_flex_value_set_id => l_adr_flex_value_set_id
131786 , x_value_type_code => l_adr_value_type_code
131787 , x_value_combination_id => l_adr_value_combination_id
131788 , x_value_segment_code => l_adr_value_segment_code
131792
131789 , p_side => 'NA'
131790 , p_override_seg_flag => 'Y'
131791 );
131793 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
131794
131795 xla_ae_lines_pkg.set_segment(
131796 p_to_segment_code => 'GL_BALANCING'
131797 , p_segment_value => l_segment
131798 , p_from_segment_code => l_adr_value_segment_code
131799 , p_from_combination_id => l_adr_value_combination_id
131800 , p_value_type_code => l_adr_value_type_code
131801 , p_transaction_coa_id => l_adr_transaction_coa_id
131802 , p_accounting_coa_id => l_adr_accounting_coa_id
131803 , p_flexfield_segment_code => l_adr_flexfield_segment_code
131804 , p_flex_value_set_id => l_adr_flex_value_set_id
131805 , p_adr_code => 'FA_EXPENSE_ACCT'
131806 , p_adr_type_code => 'S'
131807 , p_component_type => l_component_type
131808 , p_component_code => l_component_code
131809 , p_component_type_code => l_component_type_code
131810 , p_component_appl_id => l_component_appl_id
131811 , p_amb_context_code => l_amb_context_code
131812 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
131813 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
131814 , p_side => 'NA'
131815 );
131816
131817 END IF;
131818
131819 --
131820 --
131821 END IF;
131822 --
131823 -- Bug 4922099
131824 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
131825 (NVL(l_enc_upg_option, 'N') = 'O')
131826 ) AND
131827 (l_bflow_method_code = 'PRIOR_ENTRY')
131828 )
131829 THEN
131830 IF
131831 --
131832 1 = 2
131833 --
131834 THEN
131835 xla_accounting_err_pkg.build_message
131836 (p_appli_s_name => 'XLA'
131837 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
131838 ,p_token_1 => 'LINE_NUMBER'
131839 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
131840 ,p_token_2 => 'LINE_TYPE_NAME'
131841 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
131842 l_component_type
131843 ,l_component_code
131844 ,l_component_type_code
131845 ,l_component_appl_id
131846 ,l_amb_context_code
131847 ,l_entity_code
131848 ,l_event_class_code
131849 )
131850 ,p_token_3 => 'OWNER'
131851 ,p_value_3 => xla_lookups_pkg.get_meaning(
131852 p_lookup_type => 'XLA_OWNER_TYPE'
131853 ,p_lookup_code => l_component_type_code
131854 )
131855 ,p_token_4 => 'PRODUCT_NAME'
131856 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
131857 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
131858 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
131859 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
131860 ,p_ae_header_id => NULL
131861 );
131862
131863 IF (C_LEVEL_ERROR>= g_log_level) THEN
131864 trace
131865 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
131866 ,p_level => C_LEVEL_ERROR
131867 ,p_module => l_log_module);
131868 END IF;
131869 END IF;
131870 END IF;
131871 --
131872 --
131873 ------------------------------------------------------------------------------------------------
131874 -- 4219869 Business Flow
131875 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
131876 -- Prior Entry. Currently, the following code is always generated.
131877 ------------------------------------------------------------------------------------------------
131878 XLA_AE_LINES_PKG.ValidateCurrentLine;
131879
131880 ------------------------------------------------------------------------------------
131881 -- 4219869 Business Flow
131882 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
131883 ------------------------------------------------------------------------------------
131884 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
131885
131889 ----------------------------------------------------------------------------------
131886 ----------------------------------------------------------------------------------
131887 -- 4219869 Business Flow
131888 -- Update journal entry status -- Need to generate this within IF <condition>
131890 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
131891 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
131892 ,p_balance_type_code => l_balance_type_code
131893 );
131894
131895 -------------------------------------------------------------------------------------------
131896 -- 4262811 - Generate the Accrual Reversal lines
131897 -------------------------------------------------------------------------------------------
131898 BEGIN
131899 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
131900 (g_array_event(p_event_id).array_value_num('header_index'));
131901 IF l_acc_rev_flag IS NULL THEN
131902 l_acc_rev_flag := 'N';
131903 END IF;
131904 EXCEPTION
131905 WHEN OTHERS THEN
131906 l_acc_rev_flag := 'N';
131907 END;
131908 --
131909 IF (l_acc_rev_flag = 'Y') THEN
131910
131911 -- 4645092 ------------------------------------------------------------------------------
131912 -- To allow MPA report to determine if it should generate report process
131913 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
131914 ------------------------------------------------------------------------------------------
131915
131916 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
131917 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
131918 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
131919 -- call ADRs
131920 -- Bug 4922099
131921 --
131922 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
131923 (NVL(l_actual_upg_option, 'N') = 'O') OR
131924 (NVL(l_enc_upg_option, 'N') = 'O')
131925 )
131926 THEN
131927 NULL;
131928 --
131929 --
131930
131931 l_ccid := AcctDerRule_175(
131932 p_application_id => p_application_id
131933 , p_ae_header_id => l_ae_header_id
131934 , p_source_5 => p_source_5
131935 , p_source_19 => p_source_19
131936 , p_source_32 => p_source_32
131937 , x_transaction_coa_id => l_adr_transaction_coa_id
131938 , x_accounting_coa_id => l_adr_accounting_coa_id
131939 , x_value_type_code => l_adr_value_type_code
131940 , p_side => 'NA'
131941 );
131942
131943 xla_ae_lines_pkg.set_ccid(
131944 p_code_combination_id => l_ccid
131945 , p_value_type_code => l_adr_value_type_code
131946 , p_transaction_coa_id => l_adr_transaction_coa_id
131947 , p_accounting_coa_id => l_adr_accounting_coa_id
131948 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
131949 , p_adr_type_code => 'S'
131950 , p_component_type => l_component_type
131951 , p_component_code => l_component_code
131952 , p_component_type_code => l_component_type_code
131953 , p_component_appl_id => l_component_appl_id
131954 , p_amb_context_code => l_amb_context_code
131955 , p_side => 'NA'
131956 );
131957
131958
131959 l_segment := AcctDerRule_145(
131960 p_application_id => p_application_id
131961 , p_ae_header_id => l_ae_header_id
131962 , p_source_5 => p_source_5
131963 , p_source_6 => p_source_6
131964 , x_transaction_coa_id => l_adr_transaction_coa_id
131965 , x_accounting_coa_id => l_adr_accounting_coa_id
131966 , x_flexfield_segment_code => l_adr_flexfield_segment_code
131967 , x_flex_value_set_id => l_adr_flex_value_set_id
131968 , x_value_type_code => l_adr_value_type_code
131969 , x_value_combination_id => l_adr_value_combination_id
131970 , x_value_segment_code => l_adr_value_segment_code
131971 , p_side => 'NA'
131972 , p_override_seg_flag => 'Y'
131973 );
131974
131975 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
131976
131977 xla_ae_lines_pkg.set_segment(
131978 p_to_segment_code => 'GL_ACCOUNT'
131979 , p_segment_value => l_segment
131980 , p_from_segment_code => l_adr_value_segment_code
131981 , p_from_combination_id => l_adr_value_combination_id
131982 , p_value_type_code => l_adr_value_type_code
131983 , p_transaction_coa_id => l_adr_transaction_coa_id
131984 , p_accounting_coa_id => l_adr_accounting_coa_id
131985 , p_flexfield_segment_code => l_adr_flexfield_segment_code
131986 , p_flex_value_set_id => l_adr_flex_value_set_id
131987 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
131988 , p_adr_type_code => 'S'
131989 , p_component_type => l_component_type
131990 , p_component_code => l_component_code
131991 , p_component_type_code => l_component_type_code
131992 , p_component_appl_id => l_component_appl_id
131993 , p_amb_context_code => l_amb_context_code
131994 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
131995 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
131996 , p_side => 'NA'
131997 );
131998
132002 p_application_id => p_application_id
131999 END IF;
132000
132001 l_segment := AcctDerRule_169(
132003 , p_ae_header_id => l_ae_header_id
132004 , p_source_5 => p_source_5
132005 , p_source_31 => p_source_31
132006 , x_transaction_coa_id => l_adr_transaction_coa_id
132007 , x_accounting_coa_id => l_adr_accounting_coa_id
132008 , x_flexfield_segment_code => l_adr_flexfield_segment_code
132009 , x_flex_value_set_id => l_adr_flex_value_set_id
132010 , x_value_type_code => l_adr_value_type_code
132011 , x_value_combination_id => l_adr_value_combination_id
132012 , x_value_segment_code => l_adr_value_segment_code
132013 , p_side => 'NA'
132014 , p_override_seg_flag => 'Y'
132015 );
132016
132017 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
132018
132019 xla_ae_lines_pkg.set_segment(
132020 p_to_segment_code => 'GL_BALANCING'
132021 , p_segment_value => l_segment
132022 , p_from_segment_code => l_adr_value_segment_code
132023 , p_from_combination_id => l_adr_value_combination_id
132024 , p_value_type_code => l_adr_value_type_code
132025 , p_transaction_coa_id => l_adr_transaction_coa_id
132026 , p_accounting_coa_id => l_adr_accounting_coa_id
132027 , p_flexfield_segment_code => l_adr_flexfield_segment_code
132028 , p_flex_value_set_id => l_adr_flex_value_set_id
132029 , p_adr_code => 'FA_EXPENSE_ACCT'
132030 , p_adr_type_code => 'S'
132031 , p_component_type => l_component_type
132032 , p_component_code => l_component_code
132033 , p_component_type_code => l_component_type_code
132034 , p_component_appl_id => l_component_appl_id
132035 , p_amb_context_code => l_amb_context_code
132036 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
132037 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
132038 , p_side => 'NA'
132039 );
132040
132041 END IF;
132042
132043 --
132044 --
132045 END IF;
132046
132047 --
132048 -- Update the line information that should be overwritten
132049 --
132050 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
132051 p_header_num => 1);
132052 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
132053
132054 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
132055
132056 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
132057 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
132058 END IF;
132059
132060 --
132061 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
132062 --
132063 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
132064 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
132065 ELSE
132066 ---------------------------------------------------------------------------------------------------
132067 -- 4262811a Switch Sign
132068 ---------------------------------------------------------------------------------------------------
132069 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
132070 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
132071 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
132072 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
132073 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
132074 -- 5132302
132075 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
132076 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
132077
132078 END IF;
132079
132080 -- 4955764
132081 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
132082 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
132083
132084
132085 XLA_AE_LINES_PKG.ValidateCurrentLine;
132086 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
132087
132088 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
132089 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
132090 ,p_balance_type_code => l_balance_type_code);
132091
132092 END IF;
132093
132094 -----------------------------------------------------------------------------------------
132095 -- 4262811 Multiperiod Accounting
132096 -----------------------------------------------------------------------------------------
132097 -- No MPA option is assigned.
132098
132099
132100 END IF;
132101 END IF;
132102 --
132103
132104 --
132105 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
132106 trace
132107 (p_msg => 'END of AcctLineType_349'
132111 --
132108 ,p_level => C_LEVEL_PROCEDURE
132109 ,p_module => l_log_module);
132110 END IF;
132112 EXCEPTION
132113 WHEN xla_exceptions_pkg.application_exception THEN
132114 RAISE;
132115 WHEN OTHERS THEN
132116 xla_exceptions_pkg.raise_message
132117 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_349');
132118 END AcctLineType_349;
132119 --
132120
132121 ---------------------------------------
132122 --
132123 -- PRIVATE FUNCTION
132124 -- AcctLineType_350
132125 --
132126 ---------------------------------------
132127 PROCEDURE AcctLineType_350 (
132128 p_application_id IN NUMBER
132129 ,p_event_id IN NUMBER
132130 ,p_calculate_acctd_flag IN VARCHAR2
132131 ,p_calculate_g_l_flag IN VARCHAR2
132132 ,p_actual_flag IN OUT VARCHAR2
132133 ,p_balance_type_code OUT VARCHAR2
132134 ,p_gain_or_loss_ref OUT VARCHAR2
132135
132136 --Period Close Date
132137 , p_source_1 IN DATE
132138 --Generated Code Combination Identifier
132139 , p_source_5 IN NUMBER
132140 --CIP Cost Account
132141 , p_source_9 IN VARCHAR2
132142 --Expense Account Code Combination Identifier
132143 , p_source_31 IN NUMBER
132144 --Default Code Combination Identifier
132145 , p_source_32 IN NUMBER
132146 --Adjustment Type
132147 , p_source_48 IN VARCHAR2
132148 --Transaction Header Identifier
132149 , p_source_49 IN NUMBER
132150 --Adjustment Line Identifier
132151 , p_source_50 IN NUMBER
132152 --Distribution Type Code
132153 , p_source_51 IN VARCHAR2
132154 --Entered Amount
132155 , p_source_52 IN NUMBER
132156 --Currency Code
132157 , p_source_53 IN VARCHAR2
132158 --Source Destination Code
132159 , p_source_55 IN VARCHAR2
132160 )
132161 IS
132162
132163 l_component_type VARCHAR2(80);
132164 l_component_code VARCHAR2(30);
132165 l_component_type_code VARCHAR2(1);
132166 l_component_appl_id INTEGER;
132167 l_amb_context_code VARCHAR2(30);
132168 l_entity_code VARCHAR2(30);
132169 l_event_class_code VARCHAR2(30);
132170 l_ae_header_id NUMBER;
132171 l_event_type_code VARCHAR2(30);
132172 l_line_definition_code VARCHAR2(30);
132173 l_line_definition_owner_code VARCHAR2(1);
132174 --
132175 -- adr variables
132176 l_segment VARCHAR2(30);
132177 l_ccid NUMBER;
132178 l_adr_transaction_coa_id NUMBER;
132179 l_adr_accounting_coa_id NUMBER;
132180 l_adr_flexfield_segment_code VARCHAR2(30);
132181 l_adr_flex_value_set_id NUMBER;
132182 l_adr_value_type_code VARCHAR2(30);
132183 l_adr_value_combination_id NUMBER;
132184 l_adr_value_segment_code VARCHAR2(30);
132185
132186 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
132187 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
132188 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
132189 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
132190
132191 -- 4262811 Variables ------------------------------------------------------------------------------------------
132192 l_entered_amt_idx NUMBER;
132193 l_accted_amt_idx NUMBER;
132194 l_acc_rev_flag VARCHAR2(1);
132195 l_accrual_line_num NUMBER;
132196 l_tmp_amt NUMBER;
132197 l_acc_rev_natural_side_code VARCHAR2(1);
132198
132199 l_num_entries NUMBER;
132200 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
132201 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
132202 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
132203 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
132204 l_recog_line_1 NUMBER;
132205 l_recog_line_2 NUMBER;
132206
132207 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
132208 l_bflow_applied_to_amt NUMBER; -- 5132302
132209 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
132210
132211 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
132212
132213 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
132214 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
132215
132216 ---------------------------------------------------------------------------------------------------------------
132217
132218
132219 --
132220 -- bulk performance
132221 --
132222 l_balance_type_code VARCHAR2(1);
132223 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
132224 l_log_module VARCHAR2(240);
132225
132226 --
132227 -- Upgrade strategy
132228 --
132229 l_actual_upg_option VARCHAR2(1);
132230 l_enc_upg_option VARCHAR2(1);
132231
132232 --
132233 BEGIN
132234 --
132235 IF g_log_enabled THEN
132236 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_350';
132237 END IF;
132238 --
132239 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
132240
132241 trace
132242 (p_msg => 'BEGIN of AcctLineType_350'
132243 ,p_level => C_LEVEL_PROCEDURE
132247 --
132244 ,p_module => l_log_module);
132245
132246 END IF;
132248 l_component_type := 'AMB_JLT';
132249 l_component_code := 'FA_SLT_DEST_CIP_COST';
132250 l_component_type_code := 'S';
132251 l_component_appl_id := 140;
132252 l_amb_context_code := 'DEFAULT';
132253 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
132254 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
132255 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
132256 l_line_definition_owner_code := 'S';
132257 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
132258 --
132259 l_balance_type_code := 'A';
132260 l_segment := NULL;
132261 l_ccid := NULL;
132262 l_adr_transaction_coa_id := NULL;
132263 l_adr_accounting_coa_id := NULL;
132264 l_adr_flexfield_segment_code := NULL;
132265 l_adr_flex_value_set_id := NULL;
132266 l_adr_value_type_code := NULL;
132267 l_adr_value_combination_id := NULL;
132268 l_adr_value_segment_code := NULL;
132269
132270 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
132271 l_bflow_class_code := ''; -- 4219869 Business Flow
132272 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
132273 l_budgetary_control_flag := 'N';
132274
132275 l_bflow_applied_to_amt_idx := NULL; -- 5132302
132276 l_bflow_applied_to_amt := NULL; -- 5132302
132277 l_entered_amt_idx := NULL; -- 4262811
132278 l_accted_amt_idx := NULL; -- 4262811
132279 l_acc_rev_flag := NULL; -- 4262811
132280 l_accrual_line_num := NULL; -- 4262811
132281 l_tmp_amt := NULL; -- 4262811
132282 --
132283
132284 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
132285 l_balance_type_code <> 'B' THEN
132286 IF NVL(p_source_48,'
132287 ') = 'CIP COST' AND
132288 NVL(p_source_55,'
132289 ') = 'DEST'
132290 THEN
132291
132292 --
132293 XLA_AE_LINES_PKG.SetNewLine;
132294
132295 p_balance_type_code := l_balance_type_code;
132296 -- set the flag so later we will know whether the gain loss line needs to be created
132297
132298 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
132299 p_actual_flag :='A';
132300 END IF;
132301
132302 --
132303 -- bulk performance
132304 --
132305 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
132306 p_header_num => 0); -- 4262811
132307 --
132308 -- set accounting line options
132309 --
132310 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
132311 p_natural_side_code => 'D'
132312 , p_gain_or_loss_flag => 'N'
132313 , p_gl_transfer_mode_code => 'S'
132314 , p_acct_entry_type_code => 'A'
132315 , p_switch_side_flag => 'Y'
132316 , p_merge_duplicate_code => 'N'
132317 );
132318 --
132319 l_acc_rev_natural_side_code := 'C'; -- 4262811
132320 --
132321 --
132322 -- set accounting line type info
132323 --
132324 xla_ae_lines_pkg.SetAcctLineType
132325 (p_component_type => l_component_type
132326 ,p_event_type_code => l_event_type_code
132327 ,p_line_definition_owner_code => l_line_definition_owner_code
132328 ,p_line_definition_code => l_line_definition_code
132329 ,p_accounting_line_code => l_component_code
132330 ,p_accounting_line_type_code => l_component_type_code
132331 ,p_accounting_line_appl_id => l_component_appl_id
132332 ,p_amb_context_code => l_amb_context_code
132333 ,p_entity_code => l_entity_code
132334 ,p_event_class_code => l_event_class_code);
132335 --
132336 -- set accounting class
132337 --
132338 xla_ae_lines_pkg.SetAcctClass(
132339 p_accounting_class_code => 'ASSET'
132340 , p_ae_header_id => l_ae_header_id
132341 );
132342
132343 --
132344 -- set rounding class
132345 --
132346 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
132347 'ASSET';
132348
132349 --
132350 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
132351 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
132352 --
132353 -- bulk performance
132354 --
132355 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
132356
132357 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
132358 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
132359
132360 -- 4955764
132361 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
132362 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
132363
132364 -- 4458381 Public Sector Enh
132365
132366 --
132367 -- set accounting attributes for the line type
132368 --
132369 l_entered_amt_idx := 4;
132370 l_accted_amt_idx := 6;
132371 l_bflow_applied_to_amt_idx := NULL; -- 5132302
132375 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
132372 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
132373 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
132374 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
132376 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
132377 l_rec_acct_attrs.array_char_value(3) := p_source_51;
132378 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
132379 l_rec_acct_attrs.array_num_value(4) := p_source_52;
132380 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
132381 l_rec_acct_attrs.array_char_value(5) := p_source_53;
132382 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
132383 l_rec_acct_attrs.array_num_value(6) := p_source_52;
132384
132385 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
132386 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
132387
132388 ---------------------------------------------------------------------------------------------------------------
132389 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
132390 ---------------------------------------------------------------------------------------------------------------
132391 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
132392
132393 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
132394 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
132395
132396 IF xla_accounting_cache_pkg.GetValueChar
132397 (p_source_code => 'LEDGER_CATEGORY_CODE'
132398 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
132399 AND l_bflow_method_code = 'PRIOR_ENTRY'
132400 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
132401 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
132402 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
132403 )
132404 THEN
132405 xla_ae_lines_pkg.BflowUpgEntry
132406 (p_business_method_code => l_bflow_method_code
132407 ,p_business_class_code => l_bflow_class_code
132408 ,p_balance_type => l_balance_type_code);
132409 ELSE
132410 NULL;
132411 -- No business flow processing for business flow method of NONE.
132412 END IF;
132413
132414 --
132415 -- call analytical criteria
132416 --
132417
132418 --
132419 -- call description
132420 --
132421
132422 xla_ae_lines_pkg.SetLineDescription(
132423 p_ae_header_id => l_ae_header_id
132424 ,p_description => Description_105 (
132425 p_application_id => p_application_id
132426 , p_ae_header_id => l_ae_header_id
132427 , p_source_1 => p_source_1
132428 )
132429 );
132430
132431
132432 --
132433 -- call ADRs
132434 -- Bug 4922099
132435 --
132436 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
132437 (NVL(l_actual_upg_option, 'N') = 'O') OR
132438 (NVL(l_enc_upg_option, 'N') = 'O')
132439 )
132440 THEN
132441 NULL;
132442 --
132443 --
132444
132445 l_ccid := AcctDerRule_174(
132446 p_application_id => p_application_id
132447 , p_ae_header_id => l_ae_header_id
132448 , p_source_5 => p_source_5
132449 , p_source_32 => p_source_32
132450 , x_transaction_coa_id => l_adr_transaction_coa_id
132451 , x_accounting_coa_id => l_adr_accounting_coa_id
132452 , x_value_type_code => l_adr_value_type_code
132453 , p_side => 'NA'
132454 );
132455
132456 xla_ae_lines_pkg.set_ccid(
132457 p_code_combination_id => l_ccid
132458 , p_value_type_code => l_adr_value_type_code
132459 , p_transaction_coa_id => l_adr_transaction_coa_id
132460 , p_accounting_coa_id => l_adr_accounting_coa_id
132461 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
132462 , p_adr_type_code => 'S'
132463 , p_component_type => l_component_type
132464 , p_component_code => l_component_code
132465 , p_component_type_code => l_component_type_code
132466 , p_component_appl_id => l_component_appl_id
132467 , p_amb_context_code => l_amb_context_code
132468 , p_side => 'NA'
132469 );
132470
132471
132472 l_segment := AcctDerRule_147(
132473 p_application_id => p_application_id
132474 , p_ae_header_id => l_ae_header_id
132475 , p_source_5 => p_source_5
132476 , p_source_9 => p_source_9
132477 , x_transaction_coa_id => l_adr_transaction_coa_id
132478 , x_accounting_coa_id => l_adr_accounting_coa_id
132479 , x_flexfield_segment_code => l_adr_flexfield_segment_code
132480 , x_flex_value_set_id => l_adr_flex_value_set_id
132481 , x_value_type_code => l_adr_value_type_code
132482 , x_value_combination_id => l_adr_value_combination_id
132483 , x_value_segment_code => l_adr_value_segment_code
132484 , p_side => 'NA'
132485 , p_override_seg_flag => 'Y'
132486 );
132487
132491 p_to_segment_code => 'GL_ACCOUNT'
132488 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
132489
132490 xla_ae_lines_pkg.set_segment(
132492 , p_segment_value => l_segment
132493 , p_from_segment_code => l_adr_value_segment_code
132494 , p_from_combination_id => l_adr_value_combination_id
132495 , p_value_type_code => l_adr_value_type_code
132496 , p_transaction_coa_id => l_adr_transaction_coa_id
132497 , p_accounting_coa_id => l_adr_accounting_coa_id
132498 , p_flexfield_segment_code => l_adr_flexfield_segment_code
132499 , p_flex_value_set_id => l_adr_flex_value_set_id
132500 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
132501 , p_adr_type_code => 'S'
132502 , p_component_type => l_component_type
132503 , p_component_code => l_component_code
132504 , p_component_type_code => l_component_type_code
132505 , p_component_appl_id => l_component_appl_id
132506 , p_amb_context_code => l_amb_context_code
132507 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
132508 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
132509 , p_side => 'NA'
132510 );
132511
132512 END IF;
132513
132514 l_segment := AcctDerRule_169(
132515 p_application_id => p_application_id
132516 , p_ae_header_id => l_ae_header_id
132517 , p_source_5 => p_source_5
132518 , p_source_31 => p_source_31
132519 , x_transaction_coa_id => l_adr_transaction_coa_id
132520 , x_accounting_coa_id => l_adr_accounting_coa_id
132521 , x_flexfield_segment_code => l_adr_flexfield_segment_code
132522 , x_flex_value_set_id => l_adr_flex_value_set_id
132523 , x_value_type_code => l_adr_value_type_code
132524 , x_value_combination_id => l_adr_value_combination_id
132525 , x_value_segment_code => l_adr_value_segment_code
132526 , p_side => 'NA'
132527 , p_override_seg_flag => 'Y'
132528 );
132529
132530 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
132531
132532 xla_ae_lines_pkg.set_segment(
132533 p_to_segment_code => 'GL_BALANCING'
132534 , p_segment_value => l_segment
132535 , p_from_segment_code => l_adr_value_segment_code
132536 , p_from_combination_id => l_adr_value_combination_id
132537 , p_value_type_code => l_adr_value_type_code
132538 , p_transaction_coa_id => l_adr_transaction_coa_id
132539 , p_accounting_coa_id => l_adr_accounting_coa_id
132540 , p_flexfield_segment_code => l_adr_flexfield_segment_code
132541 , p_flex_value_set_id => l_adr_flex_value_set_id
132542 , p_adr_code => 'FA_EXPENSE_ACCT'
132543 , p_adr_type_code => 'S'
132544 , p_component_type => l_component_type
132545 , p_component_code => l_component_code
132546 , p_component_type_code => l_component_type_code
132547 , p_component_appl_id => l_component_appl_id
132548 , p_amb_context_code => l_amb_context_code
132549 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
132550 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
132551 , p_side => 'NA'
132552 );
132553
132554 END IF;
132555
132556 --
132557 --
132558 END IF;
132559 --
132560 -- Bug 4922099
132561 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
132562 (NVL(l_enc_upg_option, 'N') = 'O')
132563 ) AND
132564 (l_bflow_method_code = 'PRIOR_ENTRY')
132565 )
132566 THEN
132567 IF
132568 --
132569 1 = 2
132570 --
132571 THEN
132572 xla_accounting_err_pkg.build_message
132573 (p_appli_s_name => 'XLA'
132574 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
132575 ,p_token_1 => 'LINE_NUMBER'
132576 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
132577 ,p_token_2 => 'LINE_TYPE_NAME'
132578 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
132579 l_component_type
132580 ,l_component_code
132581 ,l_component_type_code
132582 ,l_component_appl_id
132583 ,l_amb_context_code
132584 ,l_entity_code
132585 ,l_event_class_code
132586 )
132587 ,p_token_3 => 'OWNER'
132588 ,p_value_3 => xla_lookups_pkg.get_meaning(
132589 p_lookup_type => 'XLA_OWNER_TYPE'
132593 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
132590 ,p_lookup_code => l_component_type_code
132591 )
132592 ,p_token_4 => 'PRODUCT_NAME'
132594 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
132595 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
132596 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
132597 ,p_ae_header_id => NULL
132598 );
132599
132600 IF (C_LEVEL_ERROR>= g_log_level) THEN
132601 trace
132602 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
132603 ,p_level => C_LEVEL_ERROR
132604 ,p_module => l_log_module);
132605 END IF;
132606 END IF;
132607 END IF;
132608 --
132609 --
132610 ------------------------------------------------------------------------------------------------
132611 -- 4219869 Business Flow
132612 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
132613 -- Prior Entry. Currently, the following code is always generated.
132614 ------------------------------------------------------------------------------------------------
132615 XLA_AE_LINES_PKG.ValidateCurrentLine;
132616
132617 ------------------------------------------------------------------------------------
132618 -- 4219869 Business Flow
132619 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
132620 ------------------------------------------------------------------------------------
132621 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
132622
132623 ----------------------------------------------------------------------------------
132624 -- 4219869 Business Flow
132625 -- Update journal entry status -- Need to generate this within IF <condition>
132626 ----------------------------------------------------------------------------------
132627 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
132628 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
132629 ,p_balance_type_code => l_balance_type_code
132630 );
132631
132632 -------------------------------------------------------------------------------------------
132633 -- 4262811 - Generate the Accrual Reversal lines
132634 -------------------------------------------------------------------------------------------
132635 BEGIN
132636 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
132637 (g_array_event(p_event_id).array_value_num('header_index'));
132638 IF l_acc_rev_flag IS NULL THEN
132639 l_acc_rev_flag := 'N';
132640 END IF;
132641 EXCEPTION
132642 WHEN OTHERS THEN
132643 l_acc_rev_flag := 'N';
132644 END;
132645 --
132646 IF (l_acc_rev_flag = 'Y') THEN
132647
132648 -- 4645092 ------------------------------------------------------------------------------
132649 -- To allow MPA report to determine if it should generate report process
132650 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
132651 ------------------------------------------------------------------------------------------
132652
132653 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
132654 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
132655 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
132656 -- call ADRs
132657 -- Bug 4922099
132658 --
132659 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
132660 (NVL(l_actual_upg_option, 'N') = 'O') OR
132661 (NVL(l_enc_upg_option, 'N') = 'O')
132662 )
132663 THEN
132664 NULL;
132665 --
132666 --
132667
132668 l_ccid := AcctDerRule_174(
132669 p_application_id => p_application_id
132670 , p_ae_header_id => l_ae_header_id
132671 , p_source_5 => p_source_5
132672 , p_source_32 => p_source_32
132673 , x_transaction_coa_id => l_adr_transaction_coa_id
132674 , x_accounting_coa_id => l_adr_accounting_coa_id
132675 , x_value_type_code => l_adr_value_type_code
132676 , p_side => 'NA'
132677 );
132678
132679 xla_ae_lines_pkg.set_ccid(
132680 p_code_combination_id => l_ccid
132681 , p_value_type_code => l_adr_value_type_code
132682 , p_transaction_coa_id => l_adr_transaction_coa_id
132683 , p_accounting_coa_id => l_adr_accounting_coa_id
132684 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
132685 , p_adr_type_code => 'S'
132686 , p_component_type => l_component_type
132687 , p_component_code => l_component_code
132688 , p_component_type_code => l_component_type_code
132689 , p_component_appl_id => l_component_appl_id
132690 , p_amb_context_code => l_amb_context_code
132691 , p_side => 'NA'
132692 );
132693
132694
132695 l_segment := AcctDerRule_147(
132696 p_application_id => p_application_id
132700 , x_transaction_coa_id => l_adr_transaction_coa_id
132697 , p_ae_header_id => l_ae_header_id
132698 , p_source_5 => p_source_5
132699 , p_source_9 => p_source_9
132701 , x_accounting_coa_id => l_adr_accounting_coa_id
132702 , x_flexfield_segment_code => l_adr_flexfield_segment_code
132703 , x_flex_value_set_id => l_adr_flex_value_set_id
132704 , x_value_type_code => l_adr_value_type_code
132705 , x_value_combination_id => l_adr_value_combination_id
132706 , x_value_segment_code => l_adr_value_segment_code
132707 , p_side => 'NA'
132708 , p_override_seg_flag => 'Y'
132709 );
132710
132711 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
132712
132713 xla_ae_lines_pkg.set_segment(
132714 p_to_segment_code => 'GL_ACCOUNT'
132715 , p_segment_value => l_segment
132716 , p_from_segment_code => l_adr_value_segment_code
132717 , p_from_combination_id => l_adr_value_combination_id
132718 , p_value_type_code => l_adr_value_type_code
132719 , p_transaction_coa_id => l_adr_transaction_coa_id
132720 , p_accounting_coa_id => l_adr_accounting_coa_id
132721 , p_flexfield_segment_code => l_adr_flexfield_segment_code
132722 , p_flex_value_set_id => l_adr_flex_value_set_id
132723 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
132724 , p_adr_type_code => 'S'
132725 , p_component_type => l_component_type
132726 , p_component_code => l_component_code
132727 , p_component_type_code => l_component_type_code
132728 , p_component_appl_id => l_component_appl_id
132729 , p_amb_context_code => l_amb_context_code
132730 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
132731 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
132732 , p_side => 'NA'
132733 );
132734
132735 END IF;
132736
132737 l_segment := AcctDerRule_169(
132738 p_application_id => p_application_id
132739 , p_ae_header_id => l_ae_header_id
132740 , p_source_5 => p_source_5
132741 , p_source_31 => p_source_31
132742 , x_transaction_coa_id => l_adr_transaction_coa_id
132743 , x_accounting_coa_id => l_adr_accounting_coa_id
132744 , x_flexfield_segment_code => l_adr_flexfield_segment_code
132745 , x_flex_value_set_id => l_adr_flex_value_set_id
132746 , x_value_type_code => l_adr_value_type_code
132747 , x_value_combination_id => l_adr_value_combination_id
132748 , x_value_segment_code => l_adr_value_segment_code
132749 , p_side => 'NA'
132750 , p_override_seg_flag => 'Y'
132751 );
132752
132753 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
132754
132755 xla_ae_lines_pkg.set_segment(
132756 p_to_segment_code => 'GL_BALANCING'
132757 , p_segment_value => l_segment
132758 , p_from_segment_code => l_adr_value_segment_code
132759 , p_from_combination_id => l_adr_value_combination_id
132760 , p_value_type_code => l_adr_value_type_code
132761 , p_transaction_coa_id => l_adr_transaction_coa_id
132762 , p_accounting_coa_id => l_adr_accounting_coa_id
132763 , p_flexfield_segment_code => l_adr_flexfield_segment_code
132764 , p_flex_value_set_id => l_adr_flex_value_set_id
132765 , p_adr_code => 'FA_EXPENSE_ACCT'
132766 , p_adr_type_code => 'S'
132767 , p_component_type => l_component_type
132768 , p_component_code => l_component_code
132769 , p_component_type_code => l_component_type_code
132770 , p_component_appl_id => l_component_appl_id
132771 , p_amb_context_code => l_amb_context_code
132772 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
132773 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
132774 , p_side => 'NA'
132775 );
132776
132777 END IF;
132778
132779 --
132780 --
132781 END IF;
132782
132783 --
132784 -- Update the line information that should be overwritten
132785 --
132786 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
132787 p_header_num => 1);
132788 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
132789
132790 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
132791
132792 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
132793 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
132794 END IF;
132795
132796 --
132797 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
132798 --
132799 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
132800 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
132801 ELSE
132802 ---------------------------------------------------------------------------------------------------
132803 -- 4262811a Switch Sign
132807 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
132804 ---------------------------------------------------------------------------------------------------
132805 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
132806 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
132808 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
132809 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
132810 -- 5132302
132811 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
132812 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
132813
132814 END IF;
132815
132816 -- 4955764
132817 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
132818 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
132819
132820
132821 XLA_AE_LINES_PKG.ValidateCurrentLine;
132822 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
132823
132824 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
132825 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
132826 ,p_balance_type_code => l_balance_type_code);
132827
132828 END IF;
132829
132830 -----------------------------------------------------------------------------------------
132831 -- 4262811 Multiperiod Accounting
132832 -----------------------------------------------------------------------------------------
132833 -- No MPA option is assigned.
132834
132835
132836 END IF;
132837 END IF;
132838 --
132839
132840 --
132841 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
132842 trace
132843 (p_msg => 'END of AcctLineType_350'
132844 ,p_level => C_LEVEL_PROCEDURE
132845 ,p_module => l_log_module);
132846 END IF;
132847 --
132848 EXCEPTION
132849 WHEN xla_exceptions_pkg.application_exception THEN
132850 RAISE;
132851 WHEN OTHERS THEN
132852 xla_exceptions_pkg.raise_message
132853 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_350');
132854 END AcctLineType_350;
132855 --
132856
132857 ---------------------------------------
132858 --
132859 -- PRIVATE FUNCTION
132860 -- AcctLineType_351
132861 --
132862 ---------------------------------------
132863 PROCEDURE AcctLineType_351 (
132864 p_application_id IN NUMBER
132865 ,p_event_id IN NUMBER
132866 ,p_calculate_acctd_flag IN VARCHAR2
132867 ,p_calculate_g_l_flag IN VARCHAR2
132868 ,p_actual_flag IN OUT VARCHAR2
132869 ,p_balance_type_code OUT VARCHAR2
132870 ,p_gain_or_loss_ref OUT VARCHAR2
132871
132872 --Period Close Date
132873 , p_source_1 IN DATE
132874 --Generated Code Combination Identifier
132875 , p_source_5 IN NUMBER
132876 --CIP Cost Account
132877 , p_source_9 IN VARCHAR2
132878 --Expense Account Code Combination Identifier
132879 , p_source_31 IN NUMBER
132880 --Default Code Combination Identifier
132881 , p_source_32 IN NUMBER
132882 --Adjustment Type
132883 , p_source_48 IN VARCHAR2
132884 --Transaction Header Identifier
132885 , p_source_49 IN NUMBER
132886 --Adjustment Line Identifier
132887 , p_source_50 IN NUMBER
132888 --Distribution Type Code
132889 , p_source_51 IN VARCHAR2
132890 --Entered Amount
132891 , p_source_52 IN NUMBER
132892 --Currency Code
132893 , p_source_53 IN VARCHAR2
132894 --Source Destination Code
132895 , p_source_55 IN VARCHAR2
132896 )
132897 IS
132898
132899 l_component_type VARCHAR2(80);
132900 l_component_code VARCHAR2(30);
132901 l_component_type_code VARCHAR2(1);
132902 l_component_appl_id INTEGER;
132903 l_amb_context_code VARCHAR2(30);
132904 l_entity_code VARCHAR2(30);
132905 l_event_class_code VARCHAR2(30);
132906 l_ae_header_id NUMBER;
132907 l_event_type_code VARCHAR2(30);
132908 l_line_definition_code VARCHAR2(30);
132909 l_line_definition_owner_code VARCHAR2(1);
132910 --
132911 -- adr variables
132912 l_segment VARCHAR2(30);
132913 l_ccid NUMBER;
132914 l_adr_transaction_coa_id NUMBER;
132915 l_adr_accounting_coa_id NUMBER;
132916 l_adr_flexfield_segment_code VARCHAR2(30);
132917 l_adr_flex_value_set_id NUMBER;
132918 l_adr_value_type_code VARCHAR2(30);
132919 l_adr_value_combination_id NUMBER;
132920 l_adr_value_segment_code VARCHAR2(30);
132921
132922 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
132923 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
132924 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
132925 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
132926
132927 -- 4262811 Variables ------------------------------------------------------------------------------------------
132928 l_entered_amt_idx NUMBER;
132929 l_accted_amt_idx NUMBER;
132933 l_acc_rev_natural_side_code VARCHAR2(1);
132930 l_acc_rev_flag VARCHAR2(1);
132931 l_accrual_line_num NUMBER;
132932 l_tmp_amt NUMBER;
132934
132935 l_num_entries NUMBER;
132936 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
132937 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
132938 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
132939 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
132940 l_recog_line_1 NUMBER;
132941 l_recog_line_2 NUMBER;
132942
132943 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
132944 l_bflow_applied_to_amt NUMBER; -- 5132302
132945 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
132946
132947 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
132948
132949 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
132950 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
132951
132952 ---------------------------------------------------------------------------------------------------------------
132953
132954
132955 --
132956 -- bulk performance
132957 --
132958 l_balance_type_code VARCHAR2(1);
132959 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
132960 l_log_module VARCHAR2(240);
132961
132962 --
132963 -- Upgrade strategy
132964 --
132965 l_actual_upg_option VARCHAR2(1);
132966 l_enc_upg_option VARCHAR2(1);
132967
132968 --
132969 BEGIN
132970 --
132971 IF g_log_enabled THEN
132972 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_351';
132973 END IF;
132974 --
132975 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
132976
132977 trace
132978 (p_msg => 'BEGIN of AcctLineType_351'
132979 ,p_level => C_LEVEL_PROCEDURE
132980 ,p_module => l_log_module);
132981
132982 END IF;
132983 --
132984 l_component_type := 'AMB_JLT';
132985 l_component_code := 'FA_SLT_DEST_CIP_COST';
132986 l_component_type_code := 'S';
132987 l_component_appl_id := 140;
132988 l_amb_context_code := 'DEFAULT';
132989 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
132990 l_event_class_code := 'CIP_SOURCE_LINE_TRANSFERS';
132991 l_event_type_code := 'CIP_SOURCE_LINE_TRANSFERS_ALL';
132992 l_line_definition_owner_code := 'S';
132993 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_S11';
132994 --
132995 l_balance_type_code := 'A';
132996 l_segment := NULL;
132997 l_ccid := NULL;
132998 l_adr_transaction_coa_id := NULL;
132999 l_adr_accounting_coa_id := NULL;
133000 l_adr_flexfield_segment_code := NULL;
133001 l_adr_flex_value_set_id := NULL;
133002 l_adr_value_type_code := NULL;
133003 l_adr_value_combination_id := NULL;
133004 l_adr_value_segment_code := NULL;
133005
133006 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
133007 l_bflow_class_code := ''; -- 4219869 Business Flow
133008 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
133009 l_budgetary_control_flag := 'N';
133010
133011 l_bflow_applied_to_amt_idx := NULL; -- 5132302
133012 l_bflow_applied_to_amt := NULL; -- 5132302
133013 l_entered_amt_idx := NULL; -- 4262811
133014 l_accted_amt_idx := NULL; -- 4262811
133015 l_acc_rev_flag := NULL; -- 4262811
133016 l_accrual_line_num := NULL; -- 4262811
133017 l_tmp_amt := NULL; -- 4262811
133018 --
133019
133020 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
133021 l_balance_type_code <> 'B' THEN
133022 IF NVL(p_source_48,'
133023 ') = 'CIP COST' AND
133024 NVL(p_source_55,'
133025 ') = 'DEST'
133026 THEN
133027
133028 --
133029 XLA_AE_LINES_PKG.SetNewLine;
133030
133031 p_balance_type_code := l_balance_type_code;
133032 -- set the flag so later we will know whether the gain loss line needs to be created
133033
133034 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
133035 p_actual_flag :='A';
133036 END IF;
133037
133038 --
133039 -- bulk performance
133040 --
133041 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
133042 p_header_num => 0); -- 4262811
133043 --
133044 -- set accounting line options
133045 --
133046 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
133047 p_natural_side_code => 'D'
133048 , p_gain_or_loss_flag => 'N'
133049 , p_gl_transfer_mode_code => 'S'
133050 , p_acct_entry_type_code => 'A'
133051 , p_switch_side_flag => 'Y'
133052 , p_merge_duplicate_code => 'N'
133053 );
133054 --
133055 l_acc_rev_natural_side_code := 'C'; -- 4262811
133056 --
133057 --
133058 -- set accounting line type info
133059 --
133060 xla_ae_lines_pkg.SetAcctLineType
133061 (p_component_type => l_component_type
133062 ,p_event_type_code => l_event_type_code
133066 ,p_accounting_line_type_code => l_component_type_code
133063 ,p_line_definition_owner_code => l_line_definition_owner_code
133064 ,p_line_definition_code => l_line_definition_code
133065 ,p_accounting_line_code => l_component_code
133067 ,p_accounting_line_appl_id => l_component_appl_id
133068 ,p_amb_context_code => l_amb_context_code
133069 ,p_entity_code => l_entity_code
133070 ,p_event_class_code => l_event_class_code);
133071 --
133072 -- set accounting class
133073 --
133074 xla_ae_lines_pkg.SetAcctClass(
133075 p_accounting_class_code => 'ASSET'
133076 , p_ae_header_id => l_ae_header_id
133077 );
133078
133079 --
133080 -- set rounding class
133081 --
133082 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
133083 'ASSET';
133084
133085 --
133086 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
133087 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
133088 --
133089 -- bulk performance
133090 --
133091 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
133092
133093 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
133094 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
133095
133096 -- 4955764
133097 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
133098 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
133099
133100 -- 4458381 Public Sector Enh
133101
133102 --
133103 -- set accounting attributes for the line type
133104 --
133105 l_entered_amt_idx := 4;
133106 l_accted_amt_idx := 6;
133107 l_bflow_applied_to_amt_idx := NULL; -- 5132302
133108 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
133109 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
133110 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
133111 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
133112 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
133113 l_rec_acct_attrs.array_char_value(3) := p_source_51;
133114 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
133115 l_rec_acct_attrs.array_num_value(4) := p_source_52;
133116 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
133117 l_rec_acct_attrs.array_char_value(5) := p_source_53;
133118 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
133119 l_rec_acct_attrs.array_num_value(6) := p_source_52;
133120
133121 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
133122 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
133123
133124 ---------------------------------------------------------------------------------------------------------------
133125 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
133126 ---------------------------------------------------------------------------------------------------------------
133127 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
133128
133129 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
133130 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
133131
133132 IF xla_accounting_cache_pkg.GetValueChar
133133 (p_source_code => 'LEDGER_CATEGORY_CODE'
133134 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
133135 AND l_bflow_method_code = 'PRIOR_ENTRY'
133136 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
133137 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
133138 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
133139 )
133140 THEN
133141 xla_ae_lines_pkg.BflowUpgEntry
133142 (p_business_method_code => l_bflow_method_code
133143 ,p_business_class_code => l_bflow_class_code
133144 ,p_balance_type => l_balance_type_code);
133145 ELSE
133146 NULL;
133147 -- No business flow processing for business flow method of NONE.
133148 END IF;
133149
133150 --
133151 -- call analytical criteria
133152 --
133153
133154 --
133155 -- call description
133156 --
133157
133158 xla_ae_lines_pkg.SetLineDescription(
133159 p_ae_header_id => l_ae_header_id
133160 ,p_description => Description_105 (
133161 p_application_id => p_application_id
133162 , p_ae_header_id => l_ae_header_id
133163 , p_source_1 => p_source_1
133164 )
133165 );
133166
133167
133168 --
133169 -- call ADRs
133170 -- Bug 4922099
133171 --
133172 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
133173 (NVL(l_actual_upg_option, 'N') = 'O') OR
133174 (NVL(l_enc_upg_option, 'N') = 'O')
133175 )
133176 THEN
133177 NULL;
133178 --
133179 --
133180
133181 l_ccid := AcctDerRule_174(
133182 p_application_id => p_application_id
133183 , p_ae_header_id => l_ae_header_id
133184 , p_source_5 => p_source_5
133188 , x_value_type_code => l_adr_value_type_code
133185 , p_source_32 => p_source_32
133186 , x_transaction_coa_id => l_adr_transaction_coa_id
133187 , x_accounting_coa_id => l_adr_accounting_coa_id
133189 , p_side => 'NA'
133190 );
133191
133192 xla_ae_lines_pkg.set_ccid(
133193 p_code_combination_id => l_ccid
133194 , p_value_type_code => l_adr_value_type_code
133195 , p_transaction_coa_id => l_adr_transaction_coa_id
133196 , p_accounting_coa_id => l_adr_accounting_coa_id
133197 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
133198 , p_adr_type_code => 'S'
133199 , p_component_type => l_component_type
133200 , p_component_code => l_component_code
133201 , p_component_type_code => l_component_type_code
133202 , p_component_appl_id => l_component_appl_id
133203 , p_amb_context_code => l_amb_context_code
133204 , p_side => 'NA'
133205 );
133206
133207
133208 l_segment := AcctDerRule_147(
133209 p_application_id => p_application_id
133210 , p_ae_header_id => l_ae_header_id
133211 , p_source_5 => p_source_5
133212 , p_source_9 => p_source_9
133213 , x_transaction_coa_id => l_adr_transaction_coa_id
133214 , x_accounting_coa_id => l_adr_accounting_coa_id
133215 , x_flexfield_segment_code => l_adr_flexfield_segment_code
133216 , x_flex_value_set_id => l_adr_flex_value_set_id
133217 , x_value_type_code => l_adr_value_type_code
133218 , x_value_combination_id => l_adr_value_combination_id
133219 , x_value_segment_code => l_adr_value_segment_code
133220 , p_side => 'NA'
133221 , p_override_seg_flag => 'Y'
133222 );
133223
133224 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
133225
133226 xla_ae_lines_pkg.set_segment(
133227 p_to_segment_code => 'GL_ACCOUNT'
133228 , p_segment_value => l_segment
133229 , p_from_segment_code => l_adr_value_segment_code
133230 , p_from_combination_id => l_adr_value_combination_id
133231 , p_value_type_code => l_adr_value_type_code
133232 , p_transaction_coa_id => l_adr_transaction_coa_id
133233 , p_accounting_coa_id => l_adr_accounting_coa_id
133234 , p_flexfield_segment_code => l_adr_flexfield_segment_code
133235 , p_flex_value_set_id => l_adr_flex_value_set_id
133236 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
133237 , p_adr_type_code => 'S'
133238 , p_component_type => l_component_type
133239 , p_component_code => l_component_code
133240 , p_component_type_code => l_component_type_code
133241 , p_component_appl_id => l_component_appl_id
133242 , p_amb_context_code => l_amb_context_code
133243 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
133244 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
133245 , p_side => 'NA'
133246 );
133247
133248 END IF;
133249
133250 l_segment := AcctDerRule_169(
133251 p_application_id => p_application_id
133252 , p_ae_header_id => l_ae_header_id
133253 , p_source_5 => p_source_5
133254 , p_source_31 => p_source_31
133255 , x_transaction_coa_id => l_adr_transaction_coa_id
133256 , x_accounting_coa_id => l_adr_accounting_coa_id
133257 , x_flexfield_segment_code => l_adr_flexfield_segment_code
133258 , x_flex_value_set_id => l_adr_flex_value_set_id
133259 , x_value_type_code => l_adr_value_type_code
133260 , x_value_combination_id => l_adr_value_combination_id
133261 , x_value_segment_code => l_adr_value_segment_code
133262 , p_side => 'NA'
133263 , p_override_seg_flag => 'Y'
133264 );
133265
133266 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
133267
133268 xla_ae_lines_pkg.set_segment(
133269 p_to_segment_code => 'GL_BALANCING'
133270 , p_segment_value => l_segment
133271 , p_from_segment_code => l_adr_value_segment_code
133272 , p_from_combination_id => l_adr_value_combination_id
133273 , p_value_type_code => l_adr_value_type_code
133274 , p_transaction_coa_id => l_adr_transaction_coa_id
133275 , p_accounting_coa_id => l_adr_accounting_coa_id
133276 , p_flexfield_segment_code => l_adr_flexfield_segment_code
133277 , p_flex_value_set_id => l_adr_flex_value_set_id
133278 , p_adr_code => 'FA_EXPENSE_ACCT'
133279 , p_adr_type_code => 'S'
133280 , p_component_type => l_component_type
133281 , p_component_code => l_component_code
133282 , p_component_type_code => l_component_type_code
133283 , p_component_appl_id => l_component_appl_id
133284 , p_amb_context_code => l_amb_context_code
133285 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
133286 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
133287 , p_side => 'NA'
133288 );
133289
133290 END IF;
133291
133292 --
133293 --
133294 END IF;
133298 (NVL(l_enc_upg_option, 'N') = 'O')
133295 --
133296 -- Bug 4922099
133297 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
133299 ) AND
133300 (l_bflow_method_code = 'PRIOR_ENTRY')
133301 )
133302 THEN
133303 IF
133304 --
133305 1 = 2
133306 --
133307 THEN
133308 xla_accounting_err_pkg.build_message
133309 (p_appli_s_name => 'XLA'
133310 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
133311 ,p_token_1 => 'LINE_NUMBER'
133312 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
133313 ,p_token_2 => 'LINE_TYPE_NAME'
133314 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
133315 l_component_type
133316 ,l_component_code
133317 ,l_component_type_code
133318 ,l_component_appl_id
133319 ,l_amb_context_code
133320 ,l_entity_code
133321 ,l_event_class_code
133322 )
133323 ,p_token_3 => 'OWNER'
133324 ,p_value_3 => xla_lookups_pkg.get_meaning(
133325 p_lookup_type => 'XLA_OWNER_TYPE'
133326 ,p_lookup_code => l_component_type_code
133327 )
133328 ,p_token_4 => 'PRODUCT_NAME'
133329 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
133330 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
133331 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
133332 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
133333 ,p_ae_header_id => NULL
133334 );
133335
133336 IF (C_LEVEL_ERROR>= g_log_level) THEN
133337 trace
133338 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
133339 ,p_level => C_LEVEL_ERROR
133340 ,p_module => l_log_module);
133341 END IF;
133342 END IF;
133343 END IF;
133344 --
133345 --
133346 ------------------------------------------------------------------------------------------------
133347 -- 4219869 Business Flow
133348 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
133349 -- Prior Entry. Currently, the following code is always generated.
133350 ------------------------------------------------------------------------------------------------
133351 XLA_AE_LINES_PKG.ValidateCurrentLine;
133352
133353 ------------------------------------------------------------------------------------
133354 -- 4219869 Business Flow
133355 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
133356 ------------------------------------------------------------------------------------
133357 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
133358
133359 ----------------------------------------------------------------------------------
133360 -- 4219869 Business Flow
133361 -- Update journal entry status -- Need to generate this within IF <condition>
133362 ----------------------------------------------------------------------------------
133363 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
133364 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
133365 ,p_balance_type_code => l_balance_type_code
133366 );
133367
133368 -------------------------------------------------------------------------------------------
133369 -- 4262811 - Generate the Accrual Reversal lines
133370 -------------------------------------------------------------------------------------------
133371 BEGIN
133372 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
133373 (g_array_event(p_event_id).array_value_num('header_index'));
133374 IF l_acc_rev_flag IS NULL THEN
133375 l_acc_rev_flag := 'N';
133376 END IF;
133377 EXCEPTION
133378 WHEN OTHERS THEN
133379 l_acc_rev_flag := 'N';
133380 END;
133381 --
133382 IF (l_acc_rev_flag = 'Y') THEN
133383
133384 -- 4645092 ------------------------------------------------------------------------------
133385 -- To allow MPA report to determine if it should generate report process
133386 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
133387 ------------------------------------------------------------------------------------------
133388
133392 -- call ADRs
133389 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
133390 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
133391 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
133393 -- Bug 4922099
133394 --
133395 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
133396 (NVL(l_actual_upg_option, 'N') = 'O') OR
133397 (NVL(l_enc_upg_option, 'N') = 'O')
133398 )
133399 THEN
133400 NULL;
133401 --
133402 --
133403
133404 l_ccid := AcctDerRule_174(
133405 p_application_id => p_application_id
133406 , p_ae_header_id => l_ae_header_id
133407 , p_source_5 => p_source_5
133408 , p_source_32 => p_source_32
133409 , x_transaction_coa_id => l_adr_transaction_coa_id
133410 , x_accounting_coa_id => l_adr_accounting_coa_id
133411 , x_value_type_code => l_adr_value_type_code
133412 , p_side => 'NA'
133413 );
133414
133415 xla_ae_lines_pkg.set_ccid(
133416 p_code_combination_id => l_ccid
133417 , p_value_type_code => l_adr_value_type_code
133418 , p_transaction_coa_id => l_adr_transaction_coa_id
133419 , p_accounting_coa_id => l_adr_accounting_coa_id
133420 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
133421 , p_adr_type_code => 'S'
133422 , p_component_type => l_component_type
133423 , p_component_code => l_component_code
133424 , p_component_type_code => l_component_type_code
133425 , p_component_appl_id => l_component_appl_id
133426 , p_amb_context_code => l_amb_context_code
133427 , p_side => 'NA'
133428 );
133429
133430
133431 l_segment := AcctDerRule_147(
133432 p_application_id => p_application_id
133433 , p_ae_header_id => l_ae_header_id
133434 , p_source_5 => p_source_5
133435 , p_source_9 => p_source_9
133436 , x_transaction_coa_id => l_adr_transaction_coa_id
133437 , x_accounting_coa_id => l_adr_accounting_coa_id
133438 , x_flexfield_segment_code => l_adr_flexfield_segment_code
133439 , x_flex_value_set_id => l_adr_flex_value_set_id
133440 , x_value_type_code => l_adr_value_type_code
133441 , x_value_combination_id => l_adr_value_combination_id
133442 , x_value_segment_code => l_adr_value_segment_code
133443 , p_side => 'NA'
133444 , p_override_seg_flag => 'Y'
133445 );
133446
133447 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
133448
133449 xla_ae_lines_pkg.set_segment(
133450 p_to_segment_code => 'GL_ACCOUNT'
133451 , p_segment_value => l_segment
133452 , p_from_segment_code => l_adr_value_segment_code
133453 , p_from_combination_id => l_adr_value_combination_id
133454 , p_value_type_code => l_adr_value_type_code
133455 , p_transaction_coa_id => l_adr_transaction_coa_id
133456 , p_accounting_coa_id => l_adr_accounting_coa_id
133457 , p_flexfield_segment_code => l_adr_flexfield_segment_code
133458 , p_flex_value_set_id => l_adr_flex_value_set_id
133459 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
133460 , p_adr_type_code => 'S'
133461 , p_component_type => l_component_type
133462 , p_component_code => l_component_code
133463 , p_component_type_code => l_component_type_code
133464 , p_component_appl_id => l_component_appl_id
133465 , p_amb_context_code => l_amb_context_code
133466 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
133467 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
133468 , p_side => 'NA'
133469 );
133470
133471 END IF;
133472
133473 l_segment := AcctDerRule_169(
133474 p_application_id => p_application_id
133475 , p_ae_header_id => l_ae_header_id
133476 , p_source_5 => p_source_5
133477 , p_source_31 => p_source_31
133478 , x_transaction_coa_id => l_adr_transaction_coa_id
133479 , x_accounting_coa_id => l_adr_accounting_coa_id
133480 , x_flexfield_segment_code => l_adr_flexfield_segment_code
133481 , x_flex_value_set_id => l_adr_flex_value_set_id
133482 , x_value_type_code => l_adr_value_type_code
133483 , x_value_combination_id => l_adr_value_combination_id
133484 , x_value_segment_code => l_adr_value_segment_code
133485 , p_side => 'NA'
133486 , p_override_seg_flag => 'Y'
133487 );
133488
133489 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
133490
133491 xla_ae_lines_pkg.set_segment(
133492 p_to_segment_code => 'GL_BALANCING'
133493 , p_segment_value => l_segment
133494 , p_from_segment_code => l_adr_value_segment_code
133495 , p_from_combination_id => l_adr_value_combination_id
133496 , p_value_type_code => l_adr_value_type_code
133497 , p_transaction_coa_id => l_adr_transaction_coa_id
133498 , p_accounting_coa_id => l_adr_accounting_coa_id
133502 , p_adr_type_code => 'S'
133499 , p_flexfield_segment_code => l_adr_flexfield_segment_code
133500 , p_flex_value_set_id => l_adr_flex_value_set_id
133501 , p_adr_code => 'FA_EXPENSE_ACCT'
133503 , p_component_type => l_component_type
133504 , p_component_code => l_component_code
133505 , p_component_type_code => l_component_type_code
133506 , p_component_appl_id => l_component_appl_id
133507 , p_amb_context_code => l_amb_context_code
133508 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
133509 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
133510 , p_side => 'NA'
133511 );
133512
133513 END IF;
133514
133515 --
133516 --
133517 END IF;
133518
133519 --
133520 -- Update the line information that should be overwritten
133521 --
133522 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
133523 p_header_num => 1);
133524 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
133525
133526 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
133527
133528 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
133529 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
133530 END IF;
133531
133532 --
133533 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
133534 --
133535 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
133536 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
133537 ELSE
133538 ---------------------------------------------------------------------------------------------------
133539 -- 4262811a Switch Sign
133540 ---------------------------------------------------------------------------------------------------
133541 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
133542 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
133543 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
133544 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
133545 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
133546 -- 5132302
133547 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
133548 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
133549
133550 END IF;
133551
133552 -- 4955764
133553 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
133554 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
133555
133556
133557 XLA_AE_LINES_PKG.ValidateCurrentLine;
133558 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
133559
133560 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
133561 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
133562 ,p_balance_type_code => l_balance_type_code);
133563
133564 END IF;
133565
133566 -----------------------------------------------------------------------------------------
133567 -- 4262811 Multiperiod Accounting
133568 -----------------------------------------------------------------------------------------
133569 -- No MPA option is assigned.
133570
133571
133572 END IF;
133573 END IF;
133574 --
133575
133576 --
133577 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
133578 trace
133579 (p_msg => 'END of AcctLineType_351'
133580 ,p_level => C_LEVEL_PROCEDURE
133581 ,p_module => l_log_module);
133582 END IF;
133583 --
133584 EXCEPTION
133585 WHEN xla_exceptions_pkg.application_exception THEN
133586 RAISE;
133587 WHEN OTHERS THEN
133588 xla_exceptions_pkg.raise_message
133589 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_351');
133590 END AcctLineType_351;
133591 --
133592
133593 ---------------------------------------
133594 --
133595 -- PRIVATE FUNCTION
133596 -- AcctLineType_352
133597 --
133598 ---------------------------------------
133599 PROCEDURE AcctLineType_352 (
133600 p_application_id IN NUMBER
133601 ,p_event_id IN NUMBER
133602 ,p_calculate_acctd_flag IN VARCHAR2
133603 ,p_calculate_g_l_flag IN VARCHAR2
133604 ,p_actual_flag IN OUT VARCHAR2
133605 ,p_balance_type_code OUT VARCHAR2
133606 ,p_gain_or_loss_ref OUT VARCHAR2
133607
133608 --Period Close Date
133609 , p_source_1 IN DATE
133610 --Generated Code Combination Identifier
133611 , p_source_5 IN NUMBER
133612 --CIP Clearing Account
133613 , p_source_7 IN VARCHAR2
133614 --Payables Code Combination Identifier
133615 , p_source_8 IN NUMBER
133616 --Expense Account Code Combination Identifier
133617 , p_source_31 IN NUMBER
133618 --Default Code Combination Identifier
133619 , p_source_32 IN NUMBER
133620 --Adjustment Type
133621 , p_source_48 IN VARCHAR2
133625 , p_source_50 IN NUMBER
133622 --Transaction Header Identifier
133623 , p_source_49 IN NUMBER
133624 --Adjustment Line Identifier
133626 --Distribution Type Code
133627 , p_source_51 IN VARCHAR2
133628 --Entered Amount
133629 , p_source_52 IN NUMBER
133630 --Currency Code
133631 , p_source_53 IN VARCHAR2
133632 --Source Destination Code
133633 , p_source_55 IN VARCHAR2
133634 )
133635 IS
133636
133637 l_component_type VARCHAR2(80);
133638 l_component_code VARCHAR2(30);
133639 l_component_type_code VARCHAR2(1);
133640 l_component_appl_id INTEGER;
133641 l_amb_context_code VARCHAR2(30);
133642 l_entity_code VARCHAR2(30);
133643 l_event_class_code VARCHAR2(30);
133644 l_ae_header_id NUMBER;
133645 l_event_type_code VARCHAR2(30);
133646 l_line_definition_code VARCHAR2(30);
133647 l_line_definition_owner_code VARCHAR2(1);
133648 --
133649 -- adr variables
133650 l_segment VARCHAR2(30);
133651 l_ccid NUMBER;
133652 l_adr_transaction_coa_id NUMBER;
133653 l_adr_accounting_coa_id NUMBER;
133654 l_adr_flexfield_segment_code VARCHAR2(30);
133655 l_adr_flex_value_set_id NUMBER;
133656 l_adr_value_type_code VARCHAR2(30);
133657 l_adr_value_combination_id NUMBER;
133658 l_adr_value_segment_code VARCHAR2(30);
133659
133660 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
133661 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
133662 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
133663 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
133664
133665 -- 4262811 Variables ------------------------------------------------------------------------------------------
133666 l_entered_amt_idx NUMBER;
133667 l_accted_amt_idx NUMBER;
133668 l_acc_rev_flag VARCHAR2(1);
133669 l_accrual_line_num NUMBER;
133670 l_tmp_amt NUMBER;
133671 l_acc_rev_natural_side_code VARCHAR2(1);
133672
133673 l_num_entries NUMBER;
133674 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
133675 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
133676 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
133677 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
133678 l_recog_line_1 NUMBER;
133679 l_recog_line_2 NUMBER;
133680
133681 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
133682 l_bflow_applied_to_amt NUMBER; -- 5132302
133683 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
133684
133685 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
133686
133687 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
133688 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
133689
133690 ---------------------------------------------------------------------------------------------------------------
133691
133692
133693 --
133694 -- bulk performance
133695 --
133696 l_balance_type_code VARCHAR2(1);
133697 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
133698 l_log_module VARCHAR2(240);
133699
133700 --
133701 -- Upgrade strategy
133702 --
133703 l_actual_upg_option VARCHAR2(1);
133704 l_enc_upg_option VARCHAR2(1);
133705
133706 --
133707 BEGIN
133708 --
133709 IF g_log_enabled THEN
133710 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_352';
133711 END IF;
133712 --
133713 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
133714
133715 trace
133716 (p_msg => 'BEGIN of AcctLineType_352'
133717 ,p_level => C_LEVEL_PROCEDURE
133718 ,p_module => l_log_module);
133719
133720 END IF;
133721 --
133722 l_component_type := 'AMB_JLT';
133723 l_component_code := 'FA_SLT_DEST_CIP_COST_CLR';
133724 l_component_type_code := 'S';
133725 l_component_appl_id := 140;
133726 l_amb_context_code := 'DEFAULT';
133727 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
133728 l_event_class_code := 'CIP_SOURCE_LINE_TRANSFERS';
133729 l_event_type_code := 'CIP_SOURCE_LINE_TRANSFERS_ALL';
133730 l_line_definition_owner_code := 'S';
133731 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_S11';
133732 --
133733 l_balance_type_code := 'A';
133734 l_segment := NULL;
133735 l_ccid := NULL;
133736 l_adr_transaction_coa_id := NULL;
133737 l_adr_accounting_coa_id := NULL;
133738 l_adr_flexfield_segment_code := NULL;
133739 l_adr_flex_value_set_id := NULL;
133740 l_adr_value_type_code := NULL;
133741 l_adr_value_combination_id := NULL;
133742 l_adr_value_segment_code := NULL;
133743
133744 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
133745 l_bflow_class_code := ''; -- 4219869 Business Flow
133746 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
133747 l_budgetary_control_flag := 'N';
133748
133749 l_bflow_applied_to_amt_idx := NULL; -- 5132302
133750 l_bflow_applied_to_amt := NULL; -- 5132302
133751 l_entered_amt_idx := NULL; -- 4262811
133755 l_tmp_amt := NULL; -- 4262811
133752 l_accted_amt_idx := NULL; -- 4262811
133753 l_acc_rev_flag := NULL; -- 4262811
133754 l_accrual_line_num := NULL; -- 4262811
133756 --
133757
133758 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
133759 l_balance_type_code <> 'B' THEN
133760 IF NVL(p_source_48,'
133761 ') = 'COST CLEARING' AND
133762 NVL(p_source_55,'
133763 ') = 'DEST'
133764 THEN
133765
133766 --
133767 XLA_AE_LINES_PKG.SetNewLine;
133768
133769 p_balance_type_code := l_balance_type_code;
133770 -- set the flag so later we will know whether the gain loss line needs to be created
133771
133772 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
133773 p_actual_flag :='A';
133774 END IF;
133775
133776 --
133777 -- bulk performance
133778 --
133779 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
133780 p_header_num => 0); -- 4262811
133781 --
133782 -- set accounting line options
133783 --
133784 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
133785 p_natural_side_code => 'C'
133786 , p_gain_or_loss_flag => 'N'
133787 , p_gl_transfer_mode_code => 'S'
133788 , p_acct_entry_type_code => 'A'
133789 , p_switch_side_flag => 'Y'
133790 , p_merge_duplicate_code => 'N'
133791 );
133792 --
133793 l_acc_rev_natural_side_code := 'D'; -- 4262811
133794 --
133795 --
133796 -- set accounting line type info
133797 --
133798 xla_ae_lines_pkg.SetAcctLineType
133799 (p_component_type => l_component_type
133800 ,p_event_type_code => l_event_type_code
133801 ,p_line_definition_owner_code => l_line_definition_owner_code
133802 ,p_line_definition_code => l_line_definition_code
133803 ,p_accounting_line_code => l_component_code
133804 ,p_accounting_line_type_code => l_component_type_code
133805 ,p_accounting_line_appl_id => l_component_appl_id
133806 ,p_amb_context_code => l_amb_context_code
133807 ,p_entity_code => l_entity_code
133808 ,p_event_class_code => l_event_class_code);
133809 --
133810 -- set accounting class
133811 --
133812 xla_ae_lines_pkg.SetAcctClass(
133813 p_accounting_class_code => 'ASSET'
133814 , p_ae_header_id => l_ae_header_id
133815 );
133816
133817 --
133818 -- set rounding class
133819 --
133820 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
133821 'ASSET';
133822
133823 --
133824 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
133825 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
133826 --
133827 -- bulk performance
133828 --
133829 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
133830
133831 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
133832 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
133833
133834 -- 4955764
133835 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
133836 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
133837
133838 -- 4458381 Public Sector Enh
133839
133840 --
133841 -- set accounting attributes for the line type
133842 --
133843 l_entered_amt_idx := 4;
133844 l_accted_amt_idx := 6;
133845 l_bflow_applied_to_amt_idx := NULL; -- 5132302
133846 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
133847 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
133848 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
133849 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
133850 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
133851 l_rec_acct_attrs.array_char_value(3) := p_source_51;
133852 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
133853 l_rec_acct_attrs.array_num_value(4) := p_source_52;
133854 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
133855 l_rec_acct_attrs.array_char_value(5) := p_source_53;
133856 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
133857 l_rec_acct_attrs.array_num_value(6) := p_source_52;
133858
133859 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
133860 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
133861
133862 ---------------------------------------------------------------------------------------------------------------
133863 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
133864 ---------------------------------------------------------------------------------------------------------------
133865 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
133866
133867 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
133871 (p_source_code => 'LEDGER_CATEGORY_CODE'
133868 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
133869
133870 IF xla_accounting_cache_pkg.GetValueChar
133872 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
133873 AND l_bflow_method_code = 'PRIOR_ENTRY'
133874 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
133875 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
133876 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
133877 )
133878 THEN
133879 xla_ae_lines_pkg.BflowUpgEntry
133880 (p_business_method_code => l_bflow_method_code
133881 ,p_business_class_code => l_bflow_class_code
133882 ,p_balance_type => l_balance_type_code);
133883 ELSE
133884 NULL;
133885 -- No business flow processing for business flow method of NONE.
133886 END IF;
133887
133888 --
133889 -- call analytical criteria
133890 --
133891
133892 --
133893 -- call description
133894 --
133895
133896 xla_ae_lines_pkg.SetLineDescription(
133897 p_ae_header_id => l_ae_header_id
133898 ,p_description => Description_106 (
133899 p_application_id => p_application_id
133900 , p_ae_header_id => l_ae_header_id
133901 , p_source_1 => p_source_1
133902 )
133903 );
133904
133905
133906 --
133907 -- call ADRs
133908 -- Bug 4922099
133909 --
133910 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
133911 (NVL(l_actual_upg_option, 'N') = 'O') OR
133912 (NVL(l_enc_upg_option, 'N') = 'O')
133913 )
133914 THEN
133915 NULL;
133916 --
133917 --
133918
133919 l_ccid := AcctDerRule_174(
133920 p_application_id => p_application_id
133921 , p_ae_header_id => l_ae_header_id
133922 , p_source_5 => p_source_5
133923 , p_source_32 => p_source_32
133924 , x_transaction_coa_id => l_adr_transaction_coa_id
133925 , x_accounting_coa_id => l_adr_accounting_coa_id
133926 , x_value_type_code => l_adr_value_type_code
133927 , p_side => 'NA'
133928 );
133929
133930 xla_ae_lines_pkg.set_ccid(
133931 p_code_combination_id => l_ccid
133932 , p_value_type_code => l_adr_value_type_code
133933 , p_transaction_coa_id => l_adr_transaction_coa_id
133934 , p_accounting_coa_id => l_adr_accounting_coa_id
133935 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
133936 , p_adr_type_code => 'S'
133937 , p_component_type => l_component_type
133938 , p_component_code => l_component_code
133939 , p_component_type_code => l_component_type_code
133940 , p_component_appl_id => l_component_appl_id
133941 , p_amb_context_code => l_amb_context_code
133942 , p_side => 'NA'
133943 );
133944
133945
133946 l_segment := AcctDerRule_146(
133947 p_application_id => p_application_id
133948 , p_ae_header_id => l_ae_header_id
133949 , p_source_5 => p_source_5
133950 , p_source_7 => p_source_7
133951 , p_source_8 => p_source_8
133952 , x_transaction_coa_id => l_adr_transaction_coa_id
133953 , x_accounting_coa_id => l_adr_accounting_coa_id
133954 , x_flexfield_segment_code => l_adr_flexfield_segment_code
133955 , x_flex_value_set_id => l_adr_flex_value_set_id
133956 , x_value_type_code => l_adr_value_type_code
133957 , x_value_combination_id => l_adr_value_combination_id
133958 , x_value_segment_code => l_adr_value_segment_code
133959 , p_side => 'NA'
133960 , p_override_seg_flag => 'Y'
133961 );
133962
133963 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
133964
133965 xla_ae_lines_pkg.set_segment(
133966 p_to_segment_code => 'GL_ACCOUNT'
133967 , p_segment_value => l_segment
133968 , p_from_segment_code => l_adr_value_segment_code
133969 , p_from_combination_id => l_adr_value_combination_id
133970 , p_value_type_code => l_adr_value_type_code
133971 , p_transaction_coa_id => l_adr_transaction_coa_id
133972 , p_accounting_coa_id => l_adr_accounting_coa_id
133973 , p_flexfield_segment_code => l_adr_flexfield_segment_code
133974 , p_flex_value_set_id => l_adr_flex_value_set_id
133975 , p_adr_code => 'FA_CAT_CIP_CLR_SEGMENT'
133976 , p_adr_type_code => 'S'
133977 , p_component_type => l_component_type
133978 , p_component_code => l_component_code
133979 , p_component_type_code => l_component_type_code
133980 , p_component_appl_id => l_component_appl_id
133981 , p_amb_context_code => l_amb_context_code
133982 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
133983 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
133984 , p_side => 'NA'
133985 );
133986
133987 END IF;
133988
133989 l_segment := AcctDerRule_170(
133990 p_application_id => p_application_id
133994 , p_source_31 => p_source_31
133991 , p_ae_header_id => l_ae_header_id
133992 , p_source_5 => p_source_5
133993 , p_source_8 => p_source_8
133995 , x_transaction_coa_id => l_adr_transaction_coa_id
133996 , x_accounting_coa_id => l_adr_accounting_coa_id
133997 , x_flexfield_segment_code => l_adr_flexfield_segment_code
133998 , x_flex_value_set_id => l_adr_flex_value_set_id
133999 , x_value_type_code => l_adr_value_type_code
134000 , x_value_combination_id => l_adr_value_combination_id
134001 , x_value_segment_code => l_adr_value_segment_code
134002 , p_side => 'NA'
134003 , p_override_seg_flag => 'Y'
134004 );
134005
134006 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
134007
134008 xla_ae_lines_pkg.set_segment(
134009 p_to_segment_code => 'GL_BALANCING'
134010 , p_segment_value => l_segment
134011 , p_from_segment_code => l_adr_value_segment_code
134012 , p_from_combination_id => l_adr_value_combination_id
134013 , p_value_type_code => l_adr_value_type_code
134014 , p_transaction_coa_id => l_adr_transaction_coa_id
134015 , p_accounting_coa_id => l_adr_accounting_coa_id
134016 , p_flexfield_segment_code => l_adr_flexfield_segment_code
134017 , p_flex_value_set_id => l_adr_flex_value_set_id
134018 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
134019 , p_adr_type_code => 'S'
134020 , p_component_type => l_component_type
134021 , p_component_code => l_component_code
134022 , p_component_type_code => l_component_type_code
134023 , p_component_appl_id => l_component_appl_id
134024 , p_amb_context_code => l_amb_context_code
134025 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
134026 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
134027 , p_side => 'NA'
134028 );
134029
134030 END IF;
134031
134032 --
134033 --
134034 END IF;
134035 --
134036 -- Bug 4922099
134037 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
134038 (NVL(l_enc_upg_option, 'N') = 'O')
134039 ) AND
134040 (l_bflow_method_code = 'PRIOR_ENTRY')
134041 )
134042 THEN
134043 IF
134044 --
134045 1 = 2
134046 --
134047 THEN
134048 xla_accounting_err_pkg.build_message
134049 (p_appli_s_name => 'XLA'
134050 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
134051 ,p_token_1 => 'LINE_NUMBER'
134052 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
134053 ,p_token_2 => 'LINE_TYPE_NAME'
134054 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
134055 l_component_type
134056 ,l_component_code
134057 ,l_component_type_code
134058 ,l_component_appl_id
134059 ,l_amb_context_code
134060 ,l_entity_code
134061 ,l_event_class_code
134062 )
134063 ,p_token_3 => 'OWNER'
134064 ,p_value_3 => xla_lookups_pkg.get_meaning(
134065 p_lookup_type => 'XLA_OWNER_TYPE'
134066 ,p_lookup_code => l_component_type_code
134067 )
134068 ,p_token_4 => 'PRODUCT_NAME'
134069 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
134070 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
134071 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
134072 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
134073 ,p_ae_header_id => NULL
134074 );
134075
134076 IF (C_LEVEL_ERROR>= g_log_level) THEN
134077 trace
134078 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
134079 ,p_level => C_LEVEL_ERROR
134080 ,p_module => l_log_module);
134081 END IF;
134082 END IF;
134083 END IF;
134084 --
134085 --
134086 ------------------------------------------------------------------------------------------------
134087 -- 4219869 Business Flow
134091 XLA_AE_LINES_PKG.ValidateCurrentLine;
134088 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
134089 -- Prior Entry. Currently, the following code is always generated.
134090 ------------------------------------------------------------------------------------------------
134092
134093 ------------------------------------------------------------------------------------
134094 -- 4219869 Business Flow
134095 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
134096 ------------------------------------------------------------------------------------
134097 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
134098
134099 ----------------------------------------------------------------------------------
134100 -- 4219869 Business Flow
134101 -- Update journal entry status -- Need to generate this within IF <condition>
134102 ----------------------------------------------------------------------------------
134103 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
134104 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
134105 ,p_balance_type_code => l_balance_type_code
134106 );
134107
134108 -------------------------------------------------------------------------------------------
134109 -- 4262811 - Generate the Accrual Reversal lines
134110 -------------------------------------------------------------------------------------------
134111 BEGIN
134112 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
134113 (g_array_event(p_event_id).array_value_num('header_index'));
134114 IF l_acc_rev_flag IS NULL THEN
134115 l_acc_rev_flag := 'N';
134116 END IF;
134117 EXCEPTION
134118 WHEN OTHERS THEN
134119 l_acc_rev_flag := 'N';
134120 END;
134121 --
134122 IF (l_acc_rev_flag = 'Y') THEN
134123
134124 -- 4645092 ------------------------------------------------------------------------------
134125 -- To allow MPA report to determine if it should generate report process
134126 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
134127 ------------------------------------------------------------------------------------------
134128
134129 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
134130 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
134131 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
134132 -- call ADRs
134133 -- Bug 4922099
134134 --
134135 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
134136 (NVL(l_actual_upg_option, 'N') = 'O') OR
134137 (NVL(l_enc_upg_option, 'N') = 'O')
134138 )
134139 THEN
134140 NULL;
134141 --
134142 --
134143
134144 l_ccid := AcctDerRule_174(
134145 p_application_id => p_application_id
134146 , p_ae_header_id => l_ae_header_id
134147 , p_source_5 => p_source_5
134148 , p_source_32 => p_source_32
134149 , x_transaction_coa_id => l_adr_transaction_coa_id
134150 , x_accounting_coa_id => l_adr_accounting_coa_id
134151 , x_value_type_code => l_adr_value_type_code
134152 , p_side => 'NA'
134153 );
134154
134155 xla_ae_lines_pkg.set_ccid(
134156 p_code_combination_id => l_ccid
134157 , p_value_type_code => l_adr_value_type_code
134158 , p_transaction_coa_id => l_adr_transaction_coa_id
134159 , p_accounting_coa_id => l_adr_accounting_coa_id
134160 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
134161 , p_adr_type_code => 'S'
134162 , p_component_type => l_component_type
134163 , p_component_code => l_component_code
134164 , p_component_type_code => l_component_type_code
134165 , p_component_appl_id => l_component_appl_id
134166 , p_amb_context_code => l_amb_context_code
134167 , p_side => 'NA'
134168 );
134169
134170
134171 l_segment := AcctDerRule_146(
134172 p_application_id => p_application_id
134173 , p_ae_header_id => l_ae_header_id
134174 , p_source_5 => p_source_5
134175 , p_source_7 => p_source_7
134176 , p_source_8 => p_source_8
134177 , x_transaction_coa_id => l_adr_transaction_coa_id
134178 , x_accounting_coa_id => l_adr_accounting_coa_id
134179 , x_flexfield_segment_code => l_adr_flexfield_segment_code
134180 , x_flex_value_set_id => l_adr_flex_value_set_id
134181 , x_value_type_code => l_adr_value_type_code
134182 , x_value_combination_id => l_adr_value_combination_id
134183 , x_value_segment_code => l_adr_value_segment_code
134184 , p_side => 'NA'
134185 , p_override_seg_flag => 'Y'
134186 );
134187
134188 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
134189
134190 xla_ae_lines_pkg.set_segment(
134191 p_to_segment_code => 'GL_ACCOUNT'
134192 , p_segment_value => l_segment
134193 , p_from_segment_code => l_adr_value_segment_code
134194 , p_from_combination_id => l_adr_value_combination_id
134195 , p_value_type_code => l_adr_value_type_code
134196 , p_transaction_coa_id => l_adr_transaction_coa_id
134197 , p_accounting_coa_id => l_adr_accounting_coa_id
134198 , p_flexfield_segment_code => l_adr_flexfield_segment_code
134202 , p_component_type => l_component_type
134199 , p_flex_value_set_id => l_adr_flex_value_set_id
134200 , p_adr_code => 'FA_CAT_CIP_CLR_SEGMENT'
134201 , p_adr_type_code => 'S'
134203 , p_component_code => l_component_code
134204 , p_component_type_code => l_component_type_code
134205 , p_component_appl_id => l_component_appl_id
134206 , p_amb_context_code => l_amb_context_code
134207 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
134208 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
134209 , p_side => 'NA'
134210 );
134211
134212 END IF;
134213
134214 l_segment := AcctDerRule_170(
134215 p_application_id => p_application_id
134216 , p_ae_header_id => l_ae_header_id
134217 , p_source_5 => p_source_5
134218 , p_source_8 => p_source_8
134219 , p_source_31 => p_source_31
134220 , x_transaction_coa_id => l_adr_transaction_coa_id
134221 , x_accounting_coa_id => l_adr_accounting_coa_id
134222 , x_flexfield_segment_code => l_adr_flexfield_segment_code
134223 , x_flex_value_set_id => l_adr_flex_value_set_id
134224 , x_value_type_code => l_adr_value_type_code
134225 , x_value_combination_id => l_adr_value_combination_id
134226 , x_value_segment_code => l_adr_value_segment_code
134227 , p_side => 'NA'
134228 , p_override_seg_flag => 'Y'
134229 );
134230
134231 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
134232
134233 xla_ae_lines_pkg.set_segment(
134234 p_to_segment_code => 'GL_BALANCING'
134235 , p_segment_value => l_segment
134236 , p_from_segment_code => l_adr_value_segment_code
134237 , p_from_combination_id => l_adr_value_combination_id
134238 , p_value_type_code => l_adr_value_type_code
134239 , p_transaction_coa_id => l_adr_transaction_coa_id
134240 , p_accounting_coa_id => l_adr_accounting_coa_id
134241 , p_flexfield_segment_code => l_adr_flexfield_segment_code
134242 , p_flex_value_set_id => l_adr_flex_value_set_id
134243 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
134244 , p_adr_type_code => 'S'
134245 , p_component_type => l_component_type
134246 , p_component_code => l_component_code
134247 , p_component_type_code => l_component_type_code
134248 , p_component_appl_id => l_component_appl_id
134249 , p_amb_context_code => l_amb_context_code
134250 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
134251 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
134252 , p_side => 'NA'
134253 );
134254
134255 END IF;
134256
134257 --
134258 --
134259 END IF;
134260
134261 --
134262 -- Update the line information that should be overwritten
134263 --
134264 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
134265 p_header_num => 1);
134266 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
134267
134268 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
134269
134270 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
134271 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
134272 END IF;
134273
134274 --
134275 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
134276 --
134277 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
134278 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
134279 ELSE
134280 ---------------------------------------------------------------------------------------------------
134281 -- 4262811a Switch Sign
134282 ---------------------------------------------------------------------------------------------------
134283 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
134284 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
134285 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
134286 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
134287 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
134288 -- 5132302
134289 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
134290 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
134291
134292 END IF;
134293
134294 -- 4955764
134295 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
134296 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
134297
134298
134299 XLA_AE_LINES_PKG.ValidateCurrentLine;
134300 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
134301
134302 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
134306 END IF;
134303 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
134304 ,p_balance_type_code => l_balance_type_code);
134305
134307
134308 -----------------------------------------------------------------------------------------
134309 -- 4262811 Multiperiod Accounting
134310 -----------------------------------------------------------------------------------------
134311 -- No MPA option is assigned.
134312
134313
134314 END IF;
134315 END IF;
134316 --
134317
134318 --
134319 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
134320 trace
134321 (p_msg => 'END of AcctLineType_352'
134322 ,p_level => C_LEVEL_PROCEDURE
134323 ,p_module => l_log_module);
134324 END IF;
134325 --
134326 EXCEPTION
134327 WHEN xla_exceptions_pkg.application_exception THEN
134328 RAISE;
134329 WHEN OTHERS THEN
134330 xla_exceptions_pkg.raise_message
134331 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_352');
134332 END AcctLineType_352;
134333 --
134334
134335 ---------------------------------------
134336 --
134337 -- PRIVATE FUNCTION
134338 -- AcctLineType_353
134339 --
134340 ---------------------------------------
134341 PROCEDURE AcctLineType_353 (
134342 p_application_id IN NUMBER
134343 ,p_event_id IN NUMBER
134344 ,p_calculate_acctd_flag IN VARCHAR2
134345 ,p_calculate_g_l_flag IN VARCHAR2
134346 ,p_actual_flag IN OUT VARCHAR2
134347 ,p_balance_type_code OUT VARCHAR2
134348 ,p_gain_or_loss_ref OUT VARCHAR2
134349
134350 --Period Close Date
134351 , p_source_1 IN DATE
134352 --Generated Code Combination Identifier
134353 , p_source_5 IN NUMBER
134354 --Revaluation Reserve Account
134355 , p_source_13 IN VARCHAR2
134356 --Generated Offset Code Combination Identifier
134357 , p_source_19 IN NUMBER
134358 --Expense Account Code Combination Identifier
134359 , p_source_31 IN NUMBER
134360 --Default Code Combination Identifier
134361 , p_source_32 IN NUMBER
134362 --Adjustment Type
134363 , p_source_48 IN VARCHAR2
134364 --Transaction Header Identifier
134365 , p_source_49 IN NUMBER
134366 --Adjustment Line Identifier
134367 , p_source_50 IN NUMBER
134368 --Distribution Type Code
134369 , p_source_51 IN VARCHAR2
134370 --Entered Amount
134371 , p_source_52 IN NUMBER
134372 --Currency Code
134373 , p_source_53 IN VARCHAR2
134374 --Source Destination Code
134375 , p_source_55 IN VARCHAR2
134376 )
134377 IS
134378
134379 l_component_type VARCHAR2(80);
134380 l_component_code VARCHAR2(30);
134381 l_component_type_code VARCHAR2(1);
134382 l_component_appl_id INTEGER;
134383 l_amb_context_code VARCHAR2(30);
134384 l_entity_code VARCHAR2(30);
134385 l_event_class_code VARCHAR2(30);
134386 l_ae_header_id NUMBER;
134387 l_event_type_code VARCHAR2(30);
134388 l_line_definition_code VARCHAR2(30);
134389 l_line_definition_owner_code VARCHAR2(1);
134390 --
134391 -- adr variables
134392 l_segment VARCHAR2(30);
134393 l_ccid NUMBER;
134394 l_adr_transaction_coa_id NUMBER;
134395 l_adr_accounting_coa_id NUMBER;
134396 l_adr_flexfield_segment_code VARCHAR2(30);
134397 l_adr_flex_value_set_id NUMBER;
134398 l_adr_value_type_code VARCHAR2(30);
134399 l_adr_value_combination_id NUMBER;
134400 l_adr_value_segment_code VARCHAR2(30);
134401
134402 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
134403 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
134404 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
134405 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
134406
134407 -- 4262811 Variables ------------------------------------------------------------------------------------------
134408 l_entered_amt_idx NUMBER;
134409 l_accted_amt_idx NUMBER;
134410 l_acc_rev_flag VARCHAR2(1);
134411 l_accrual_line_num NUMBER;
134412 l_tmp_amt NUMBER;
134413 l_acc_rev_natural_side_code VARCHAR2(1);
134414
134415 l_num_entries NUMBER;
134416 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
134417 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
134418 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
134419 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
134420 l_recog_line_1 NUMBER;
134421 l_recog_line_2 NUMBER;
134422
134423 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
134424 l_bflow_applied_to_amt NUMBER; -- 5132302
134425 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
134426
134427 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
134428
134429 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
134430 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
134431
134432 ---------------------------------------------------------------------------------------------------------------
134436 -- bulk performance
134433
134434
134435 --
134437 --
134438 l_balance_type_code VARCHAR2(1);
134439 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
134440 l_log_module VARCHAR2(240);
134441
134442 --
134443 -- Upgrade strategy
134444 --
134445 l_actual_upg_option VARCHAR2(1);
134446 l_enc_upg_option VARCHAR2(1);
134447
134448 --
134449 BEGIN
134450 --
134451 IF g_log_enabled THEN
134452 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_353';
134453 END IF;
134454 --
134455 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
134456
134457 trace
134458 (p_msg => 'BEGIN of AcctLineType_353'
134459 ,p_level => C_LEVEL_PROCEDURE
134460 ,p_module => l_log_module);
134461
134462 END IF;
134463 --
134464 l_component_type := 'AMB_JLT';
134465 l_component_code := 'FA_SLT_DEST_CIP_REVAL_RESERVE';
134466 l_component_type_code := 'S';
134467 l_component_appl_id := 140;
134468 l_amb_context_code := 'DEFAULT';
134469 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
134470 l_event_class_code := 'CIP_SOURCE_LINE_TRANSFERS';
134471 l_event_type_code := 'CIP_SOURCE_LINE_TRANSFERS_ALL';
134472 l_line_definition_owner_code := 'S';
134473 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_S11';
134474 --
134475 l_balance_type_code := 'A';
134476 l_segment := NULL;
134477 l_ccid := NULL;
134478 l_adr_transaction_coa_id := NULL;
134479 l_adr_accounting_coa_id := NULL;
134480 l_adr_flexfield_segment_code := NULL;
134481 l_adr_flex_value_set_id := NULL;
134482 l_adr_value_type_code := NULL;
134483 l_adr_value_combination_id := NULL;
134484 l_adr_value_segment_code := NULL;
134485
134486 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
134487 l_bflow_class_code := ''; -- 4219869 Business Flow
134488 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
134489 l_budgetary_control_flag := 'N';
134490
134491 l_bflow_applied_to_amt_idx := NULL; -- 5132302
134492 l_bflow_applied_to_amt := NULL; -- 5132302
134493 l_entered_amt_idx := NULL; -- 4262811
134494 l_accted_amt_idx := NULL; -- 4262811
134495 l_acc_rev_flag := NULL; -- 4262811
134496 l_accrual_line_num := NULL; -- 4262811
134497 l_tmp_amt := NULL; -- 4262811
134498 --
134499
134500 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
134501 l_balance_type_code <> 'B' THEN
134502 IF NVL(p_source_48,'
134503 ') = 'REVAL RESERVE' AND
134504 NVL(p_source_55,'
134505 ') = 'DEST'
134506 THEN
134507
134508 --
134509 XLA_AE_LINES_PKG.SetNewLine;
134510
134511 p_balance_type_code := l_balance_type_code;
134512 -- set the flag so later we will know whether the gain loss line needs to be created
134513
134514 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
134515 p_actual_flag :='A';
134516 END IF;
134517
134518 --
134519 -- bulk performance
134520 --
134521 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
134522 p_header_num => 0); -- 4262811
134523 --
134524 -- set accounting line options
134525 --
134526 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
134527 p_natural_side_code => 'C'
134528 , p_gain_or_loss_flag => 'N'
134529 , p_gl_transfer_mode_code => 'S'
134530 , p_acct_entry_type_code => 'A'
134531 , p_switch_side_flag => 'Y'
134532 , p_merge_duplicate_code => 'N'
134533 );
134534 --
134535 l_acc_rev_natural_side_code := 'D'; -- 4262811
134536 --
134537 --
134538 -- set accounting line type info
134539 --
134540 xla_ae_lines_pkg.SetAcctLineType
134541 (p_component_type => l_component_type
134542 ,p_event_type_code => l_event_type_code
134543 ,p_line_definition_owner_code => l_line_definition_owner_code
134544 ,p_line_definition_code => l_line_definition_code
134545 ,p_accounting_line_code => l_component_code
134546 ,p_accounting_line_type_code => l_component_type_code
134547 ,p_accounting_line_appl_id => l_component_appl_id
134548 ,p_amb_context_code => l_amb_context_code
134549 ,p_entity_code => l_entity_code
134550 ,p_event_class_code => l_event_class_code);
134551 --
134552 -- set accounting class
134553 --
134554 xla_ae_lines_pkg.SetAcctClass(
134555 p_accounting_class_code => 'ASSET'
134556 , p_ae_header_id => l_ae_header_id
134557 );
134558
134559 --
134560 -- set rounding class
134561 --
134562 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
134563 'ASSET';
134564
134565 --
134566 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
134567 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
134571 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
134568 --
134569 -- bulk performance
134570 --
134572
134573 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
134574 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
134575
134576 -- 4955764
134577 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
134578 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
134579
134580 -- 4458381 Public Sector Enh
134581
134582 --
134583 -- set accounting attributes for the line type
134584 --
134585 l_entered_amt_idx := 4;
134586 l_accted_amt_idx := 6;
134587 l_bflow_applied_to_amt_idx := NULL; -- 5132302
134588 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
134589 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
134590 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
134591 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
134592 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
134593 l_rec_acct_attrs.array_char_value(3) := p_source_51;
134594 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
134595 l_rec_acct_attrs.array_num_value(4) := p_source_52;
134596 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
134597 l_rec_acct_attrs.array_char_value(5) := p_source_53;
134598 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
134599 l_rec_acct_attrs.array_num_value(6) := p_source_52;
134600
134601 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
134602 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
134603
134604 ---------------------------------------------------------------------------------------------------------------
134605 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
134606 ---------------------------------------------------------------------------------------------------------------
134607 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
134608
134609 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
134610 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
134611
134612 IF xla_accounting_cache_pkg.GetValueChar
134613 (p_source_code => 'LEDGER_CATEGORY_CODE'
134614 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
134615 AND l_bflow_method_code = 'PRIOR_ENTRY'
134616 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
134617 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
134618 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
134619 )
134620 THEN
134621 xla_ae_lines_pkg.BflowUpgEntry
134622 (p_business_method_code => l_bflow_method_code
134623 ,p_business_class_code => l_bflow_class_code
134624 ,p_balance_type => l_balance_type_code);
134625 ELSE
134626 NULL;
134627 -- No business flow processing for business flow method of NONE.
134628 END IF;
134629
134630 --
134631 -- call analytical criteria
134632 --
134633
134634 --
134635 -- call description
134636 --
134637
134638 xla_ae_lines_pkg.SetLineDescription(
134639 p_ae_header_id => l_ae_header_id
134640 ,p_description => Description_109 (
134641 p_application_id => p_application_id
134642 , p_ae_header_id => l_ae_header_id
134643 , p_source_1 => p_source_1
134644 )
134645 );
134646
134647
134648 --
134649 -- call ADRs
134650 -- Bug 4922099
134651 --
134652 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
134653 (NVL(l_actual_upg_option, 'N') = 'O') OR
134654 (NVL(l_enc_upg_option, 'N') = 'O')
134655 )
134656 THEN
134657 NULL;
134658 --
134659 --
134660
134661 l_ccid := AcctDerRule_175(
134662 p_application_id => p_application_id
134663 , p_ae_header_id => l_ae_header_id
134664 , p_source_5 => p_source_5
134665 , p_source_19 => p_source_19
134666 , p_source_32 => p_source_32
134667 , x_transaction_coa_id => l_adr_transaction_coa_id
134668 , x_accounting_coa_id => l_adr_accounting_coa_id
134669 , x_value_type_code => l_adr_value_type_code
134670 , p_side => 'NA'
134671 );
134672
134673 xla_ae_lines_pkg.set_ccid(
134674 p_code_combination_id => l_ccid
134675 , p_value_type_code => l_adr_value_type_code
134676 , p_transaction_coa_id => l_adr_transaction_coa_id
134677 , p_accounting_coa_id => l_adr_accounting_coa_id
134678 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
134679 , p_adr_type_code => 'S'
134680 , p_component_type => l_component_type
134681 , p_component_code => l_component_code
134682 , p_component_type_code => l_component_type_code
134683 , p_component_appl_id => l_component_appl_id
134684 , p_amb_context_code => l_amb_context_code
134685 , p_side => 'NA'
134689 l_segment := AcctDerRule_151(
134686 );
134687
134688
134690 p_application_id => p_application_id
134691 , p_ae_header_id => l_ae_header_id
134692 , p_source_5 => p_source_5
134693 , p_source_13 => p_source_13
134694 , x_transaction_coa_id => l_adr_transaction_coa_id
134695 , x_accounting_coa_id => l_adr_accounting_coa_id
134696 , x_flexfield_segment_code => l_adr_flexfield_segment_code
134697 , x_flex_value_set_id => l_adr_flex_value_set_id
134698 , x_value_type_code => l_adr_value_type_code
134699 , x_value_combination_id => l_adr_value_combination_id
134700 , x_value_segment_code => l_adr_value_segment_code
134701 , p_side => 'NA'
134702 , p_override_seg_flag => 'Y'
134703 );
134704
134705 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
134706
134707 xla_ae_lines_pkg.set_segment(
134708 p_to_segment_code => 'GL_ACCOUNT'
134709 , p_segment_value => l_segment
134710 , p_from_segment_code => l_adr_value_segment_code
134711 , p_from_combination_id => l_adr_value_combination_id
134712 , p_value_type_code => l_adr_value_type_code
134713 , p_transaction_coa_id => l_adr_transaction_coa_id
134714 , p_accounting_coa_id => l_adr_accounting_coa_id
134715 , p_flexfield_segment_code => l_adr_flexfield_segment_code
134716 , p_flex_value_set_id => l_adr_flex_value_set_id
134717 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
134718 , p_adr_type_code => 'S'
134719 , p_component_type => l_component_type
134720 , p_component_code => l_component_code
134721 , p_component_type_code => l_component_type_code
134722 , p_component_appl_id => l_component_appl_id
134723 , p_amb_context_code => l_amb_context_code
134724 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
134725 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
134726 , p_side => 'NA'
134727 );
134728
134729 END IF;
134730
134731 l_segment := AcctDerRule_169(
134732 p_application_id => p_application_id
134733 , p_ae_header_id => l_ae_header_id
134734 , p_source_5 => p_source_5
134735 , p_source_31 => p_source_31
134736 , x_transaction_coa_id => l_adr_transaction_coa_id
134737 , x_accounting_coa_id => l_adr_accounting_coa_id
134738 , x_flexfield_segment_code => l_adr_flexfield_segment_code
134739 , x_flex_value_set_id => l_adr_flex_value_set_id
134740 , x_value_type_code => l_adr_value_type_code
134741 , x_value_combination_id => l_adr_value_combination_id
134742 , x_value_segment_code => l_adr_value_segment_code
134743 , p_side => 'NA'
134744 , p_override_seg_flag => 'Y'
134745 );
134746
134747 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
134748
134749 xla_ae_lines_pkg.set_segment(
134750 p_to_segment_code => 'GL_BALANCING'
134751 , p_segment_value => l_segment
134752 , p_from_segment_code => l_adr_value_segment_code
134753 , p_from_combination_id => l_adr_value_combination_id
134754 , p_value_type_code => l_adr_value_type_code
134755 , p_transaction_coa_id => l_adr_transaction_coa_id
134756 , p_accounting_coa_id => l_adr_accounting_coa_id
134757 , p_flexfield_segment_code => l_adr_flexfield_segment_code
134758 , p_flex_value_set_id => l_adr_flex_value_set_id
134759 , p_adr_code => 'FA_EXPENSE_ACCT'
134760 , p_adr_type_code => 'S'
134761 , p_component_type => l_component_type
134762 , p_component_code => l_component_code
134763 , p_component_type_code => l_component_type_code
134764 , p_component_appl_id => l_component_appl_id
134765 , p_amb_context_code => l_amb_context_code
134766 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
134767 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
134768 , p_side => 'NA'
134769 );
134770
134771 END IF;
134772
134773 --
134774 --
134775 END IF;
134776 --
134777 -- Bug 4922099
134778 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
134779 (NVL(l_enc_upg_option, 'N') = 'O')
134780 ) AND
134781 (l_bflow_method_code = 'PRIOR_ENTRY')
134782 )
134783 THEN
134784 IF
134785 --
134786 1 = 2
134787 --
134788 THEN
134789 xla_accounting_err_pkg.build_message
134790 (p_appli_s_name => 'XLA'
134791 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
134792 ,p_token_1 => 'LINE_NUMBER'
134793 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
134794 ,p_token_2 => 'LINE_TYPE_NAME'
134795 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
134796 l_component_type
134797 ,l_component_code
134801 ,l_entity_code
134798 ,l_component_type_code
134799 ,l_component_appl_id
134800 ,l_amb_context_code
134802 ,l_event_class_code
134803 )
134804 ,p_token_3 => 'OWNER'
134805 ,p_value_3 => xla_lookups_pkg.get_meaning(
134806 p_lookup_type => 'XLA_OWNER_TYPE'
134807 ,p_lookup_code => l_component_type_code
134808 )
134809 ,p_token_4 => 'PRODUCT_NAME'
134810 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
134811 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
134812 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
134813 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
134814 ,p_ae_header_id => NULL
134815 );
134816
134817 IF (C_LEVEL_ERROR>= g_log_level) THEN
134818 trace
134819 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
134820 ,p_level => C_LEVEL_ERROR
134821 ,p_module => l_log_module);
134822 END IF;
134823 END IF;
134824 END IF;
134825 --
134826 --
134827 ------------------------------------------------------------------------------------------------
134828 -- 4219869 Business Flow
134829 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
134830 -- Prior Entry. Currently, the following code is always generated.
134831 ------------------------------------------------------------------------------------------------
134832 XLA_AE_LINES_PKG.ValidateCurrentLine;
134833
134834 ------------------------------------------------------------------------------------
134835 -- 4219869 Business Flow
134836 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
134837 ------------------------------------------------------------------------------------
134838 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
134839
134840 ----------------------------------------------------------------------------------
134841 -- 4219869 Business Flow
134842 -- Update journal entry status -- Need to generate this within IF <condition>
134843 ----------------------------------------------------------------------------------
134844 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
134845 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
134846 ,p_balance_type_code => l_balance_type_code
134847 );
134848
134849 -------------------------------------------------------------------------------------------
134850 -- 4262811 - Generate the Accrual Reversal lines
134851 -------------------------------------------------------------------------------------------
134852 BEGIN
134853 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
134854 (g_array_event(p_event_id).array_value_num('header_index'));
134855 IF l_acc_rev_flag IS NULL THEN
134856 l_acc_rev_flag := 'N';
134857 END IF;
134858 EXCEPTION
134859 WHEN OTHERS THEN
134860 l_acc_rev_flag := 'N';
134861 END;
134862 --
134863 IF (l_acc_rev_flag = 'Y') THEN
134864
134865 -- 4645092 ------------------------------------------------------------------------------
134866 -- To allow MPA report to determine if it should generate report process
134867 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
134868 ------------------------------------------------------------------------------------------
134869
134870 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
134871 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
134872 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
134873 -- call ADRs
134874 -- Bug 4922099
134875 --
134876 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
134877 (NVL(l_actual_upg_option, 'N') = 'O') OR
134878 (NVL(l_enc_upg_option, 'N') = 'O')
134879 )
134880 THEN
134881 NULL;
134882 --
134883 --
134884
134885 l_ccid := AcctDerRule_175(
134886 p_application_id => p_application_id
134887 , p_ae_header_id => l_ae_header_id
134888 , p_source_5 => p_source_5
134889 , p_source_19 => p_source_19
134890 , p_source_32 => p_source_32
134891 , x_transaction_coa_id => l_adr_transaction_coa_id
134892 , x_accounting_coa_id => l_adr_accounting_coa_id
134893 , x_value_type_code => l_adr_value_type_code
134894 , p_side => 'NA'
134895 );
134896
134897 xla_ae_lines_pkg.set_ccid(
134901 , p_accounting_coa_id => l_adr_accounting_coa_id
134898 p_code_combination_id => l_ccid
134899 , p_value_type_code => l_adr_value_type_code
134900 , p_transaction_coa_id => l_adr_transaction_coa_id
134902 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
134903 , p_adr_type_code => 'S'
134904 , p_component_type => l_component_type
134905 , p_component_code => l_component_code
134906 , p_component_type_code => l_component_type_code
134907 , p_component_appl_id => l_component_appl_id
134908 , p_amb_context_code => l_amb_context_code
134909 , p_side => 'NA'
134910 );
134911
134912
134913 l_segment := AcctDerRule_151(
134914 p_application_id => p_application_id
134915 , p_ae_header_id => l_ae_header_id
134916 , p_source_5 => p_source_5
134917 , p_source_13 => p_source_13
134918 , x_transaction_coa_id => l_adr_transaction_coa_id
134919 , x_accounting_coa_id => l_adr_accounting_coa_id
134920 , x_flexfield_segment_code => l_adr_flexfield_segment_code
134921 , x_flex_value_set_id => l_adr_flex_value_set_id
134922 , x_value_type_code => l_adr_value_type_code
134923 , x_value_combination_id => l_adr_value_combination_id
134924 , x_value_segment_code => l_adr_value_segment_code
134925 , p_side => 'NA'
134926 , p_override_seg_flag => 'Y'
134927 );
134928
134929 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
134930
134931 xla_ae_lines_pkg.set_segment(
134932 p_to_segment_code => 'GL_ACCOUNT'
134933 , p_segment_value => l_segment
134934 , p_from_segment_code => l_adr_value_segment_code
134935 , p_from_combination_id => l_adr_value_combination_id
134936 , p_value_type_code => l_adr_value_type_code
134937 , p_transaction_coa_id => l_adr_transaction_coa_id
134938 , p_accounting_coa_id => l_adr_accounting_coa_id
134939 , p_flexfield_segment_code => l_adr_flexfield_segment_code
134940 , p_flex_value_set_id => l_adr_flex_value_set_id
134941 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
134942 , p_adr_type_code => 'S'
134943 , p_component_type => l_component_type
134944 , p_component_code => l_component_code
134945 , p_component_type_code => l_component_type_code
134946 , p_component_appl_id => l_component_appl_id
134947 , p_amb_context_code => l_amb_context_code
134948 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
134949 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
134950 , p_side => 'NA'
134951 );
134952
134953 END IF;
134954
134955 l_segment := AcctDerRule_169(
134956 p_application_id => p_application_id
134957 , p_ae_header_id => l_ae_header_id
134958 , p_source_5 => p_source_5
134959 , p_source_31 => p_source_31
134960 , x_transaction_coa_id => l_adr_transaction_coa_id
134961 , x_accounting_coa_id => l_adr_accounting_coa_id
134962 , x_flexfield_segment_code => l_adr_flexfield_segment_code
134963 , x_flex_value_set_id => l_adr_flex_value_set_id
134964 , x_value_type_code => l_adr_value_type_code
134965 , x_value_combination_id => l_adr_value_combination_id
134966 , x_value_segment_code => l_adr_value_segment_code
134967 , p_side => 'NA'
134968 , p_override_seg_flag => 'Y'
134969 );
134970
134971 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
134972
134973 xla_ae_lines_pkg.set_segment(
134974 p_to_segment_code => 'GL_BALANCING'
134975 , p_segment_value => l_segment
134976 , p_from_segment_code => l_adr_value_segment_code
134977 , p_from_combination_id => l_adr_value_combination_id
134978 , p_value_type_code => l_adr_value_type_code
134979 , p_transaction_coa_id => l_adr_transaction_coa_id
134980 , p_accounting_coa_id => l_adr_accounting_coa_id
134981 , p_flexfield_segment_code => l_adr_flexfield_segment_code
134982 , p_flex_value_set_id => l_adr_flex_value_set_id
134983 , p_adr_code => 'FA_EXPENSE_ACCT'
134984 , p_adr_type_code => 'S'
134985 , p_component_type => l_component_type
134986 , p_component_code => l_component_code
134987 , p_component_type_code => l_component_type_code
134988 , p_component_appl_id => l_component_appl_id
134989 , p_amb_context_code => l_amb_context_code
134990 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
134991 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
134992 , p_side => 'NA'
134993 );
134994
134995 END IF;
134996
134997 --
134998 --
134999 END IF;
135000
135001 --
135002 -- Update the line information that should be overwritten
135003 --
135004 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
135005 p_header_num => 1);
135009
135006 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
135007
135008 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
135010 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
135011 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
135012 END IF;
135013
135014 --
135015 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
135016 --
135017 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
135018 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
135019 ELSE
135020 ---------------------------------------------------------------------------------------------------
135021 -- 4262811a Switch Sign
135022 ---------------------------------------------------------------------------------------------------
135023 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
135024 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
135025 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
135026 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
135027 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
135028 -- 5132302
135029 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
135030 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
135031
135032 END IF;
135033
135034 -- 4955764
135035 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
135036 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
135037
135038
135039 XLA_AE_LINES_PKG.ValidateCurrentLine;
135040 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
135041
135042 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
135043 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
135044 ,p_balance_type_code => l_balance_type_code);
135045
135046 END IF;
135047
135048 -----------------------------------------------------------------------------------------
135049 -- 4262811 Multiperiod Accounting
135050 -----------------------------------------------------------------------------------------
135051 -- No MPA option is assigned.
135052
135053
135054 END IF;
135055 END IF;
135056 --
135057
135058 --
135059 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
135060 trace
135061 (p_msg => 'END of AcctLineType_353'
135062 ,p_level => C_LEVEL_PROCEDURE
135063 ,p_module => l_log_module);
135064 END IF;
135065 --
135066 EXCEPTION
135067 WHEN xla_exceptions_pkg.application_exception THEN
135068 RAISE;
135069 WHEN OTHERS THEN
135070 xla_exceptions_pkg.raise_message
135071 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_353');
135072 END AcctLineType_353;
135073 --
135074
135075 ---------------------------------------
135076 --
135077 -- PRIVATE FUNCTION
135078 -- AcctLineType_354
135079 --
135080 ---------------------------------------
135081 PROCEDURE AcctLineType_354 (
135082 p_application_id IN NUMBER
135083 ,p_event_id IN NUMBER
135084 ,p_calculate_acctd_flag IN VARCHAR2
135085 ,p_calculate_g_l_flag IN VARCHAR2
135086 ,p_actual_flag IN OUT VARCHAR2
135087 ,p_balance_type_code OUT VARCHAR2
135088 ,p_gain_or_loss_ref OUT VARCHAR2
135089
135090 --Period Close Date
135091 , p_source_1 IN DATE
135092 --Generated Code Combination Identifier
135093 , p_source_5 IN NUMBER
135094 --Asset Cost Account
135095 , p_source_11 IN VARCHAR2
135096 --Expense Account Code Combination Identifier
135097 , p_source_31 IN NUMBER
135098 --Default Code Combination Identifier
135099 , p_source_32 IN NUMBER
135100 --Adjustment Type
135101 , p_source_48 IN VARCHAR2
135102 --Transaction Header Identifier
135103 , p_source_49 IN NUMBER
135104 --Adjustment Line Identifier
135105 , p_source_50 IN NUMBER
135106 --Distribution Type Code
135107 , p_source_51 IN VARCHAR2
135108 --Entered Amount
135109 , p_source_52 IN NUMBER
135110 --Currency Code
135111 , p_source_53 IN VARCHAR2
135112 --Source Destination Code
135113 , p_source_55 IN VARCHAR2
135114 )
135115 IS
135116
135117 l_component_type VARCHAR2(80);
135118 l_component_code VARCHAR2(30);
135119 l_component_type_code VARCHAR2(1);
135120 l_component_appl_id INTEGER;
135121 l_amb_context_code VARCHAR2(30);
135122 l_entity_code VARCHAR2(30);
135123 l_event_class_code VARCHAR2(30);
135124 l_ae_header_id NUMBER;
135125 l_event_type_code VARCHAR2(30);
135126 l_line_definition_code VARCHAR2(30);
135127 l_line_definition_owner_code VARCHAR2(1);
135128 --
135129 -- adr variables
135133 l_adr_accounting_coa_id NUMBER;
135130 l_segment VARCHAR2(30);
135131 l_ccid NUMBER;
135132 l_adr_transaction_coa_id NUMBER;
135134 l_adr_flexfield_segment_code VARCHAR2(30);
135135 l_adr_flex_value_set_id NUMBER;
135136 l_adr_value_type_code VARCHAR2(30);
135137 l_adr_value_combination_id NUMBER;
135138 l_adr_value_segment_code VARCHAR2(30);
135139
135140 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
135141 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
135142 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
135143 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
135144
135145 -- 4262811 Variables ------------------------------------------------------------------------------------------
135146 l_entered_amt_idx NUMBER;
135147 l_accted_amt_idx NUMBER;
135148 l_acc_rev_flag VARCHAR2(1);
135149 l_accrual_line_num NUMBER;
135150 l_tmp_amt NUMBER;
135151 l_acc_rev_natural_side_code VARCHAR2(1);
135152
135153 l_num_entries NUMBER;
135154 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
135155 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
135156 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
135157 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
135158 l_recog_line_1 NUMBER;
135159 l_recog_line_2 NUMBER;
135160
135161 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
135162 l_bflow_applied_to_amt NUMBER; -- 5132302
135163 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
135164
135165 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
135166
135167 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
135168 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
135169
135170 ---------------------------------------------------------------------------------------------------------------
135171
135172
135173 --
135174 -- bulk performance
135175 --
135176 l_balance_type_code VARCHAR2(1);
135177 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
135178 l_log_module VARCHAR2(240);
135179
135180 --
135181 -- Upgrade strategy
135182 --
135183 l_actual_upg_option VARCHAR2(1);
135184 l_enc_upg_option VARCHAR2(1);
135185
135186 --
135187 BEGIN
135188 --
135189 IF g_log_enabled THEN
135190 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_354';
135191 END IF;
135192 --
135193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
135194
135195 trace
135196 (p_msg => 'BEGIN of AcctLineType_354'
135197 ,p_level => C_LEVEL_PROCEDURE
135198 ,p_module => l_log_module);
135199
135200 END IF;
135201 --
135202 l_component_type := 'AMB_JLT';
135203 l_component_code := 'FA_SLT_DEST_COST';
135204 l_component_type_code := 'S';
135205 l_component_appl_id := 140;
135206 l_amb_context_code := 'DEFAULT';
135207 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
135208 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
135209 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
135210 l_line_definition_owner_code := 'S';
135211 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
135212 --
135213 l_balance_type_code := 'A';
135214 l_segment := NULL;
135215 l_ccid := NULL;
135216 l_adr_transaction_coa_id := NULL;
135217 l_adr_accounting_coa_id := NULL;
135218 l_adr_flexfield_segment_code := NULL;
135219 l_adr_flex_value_set_id := NULL;
135220 l_adr_value_type_code := NULL;
135221 l_adr_value_combination_id := NULL;
135222 l_adr_value_segment_code := NULL;
135223
135224 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
135225 l_bflow_class_code := ''; -- 4219869 Business Flow
135226 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
135227 l_budgetary_control_flag := 'N';
135228
135229 l_bflow_applied_to_amt_idx := NULL; -- 5132302
135230 l_bflow_applied_to_amt := NULL; -- 5132302
135231 l_entered_amt_idx := NULL; -- 4262811
135232 l_accted_amt_idx := NULL; -- 4262811
135233 l_acc_rev_flag := NULL; -- 4262811
135234 l_accrual_line_num := NULL; -- 4262811
135235 l_tmp_amt := NULL; -- 4262811
135236 --
135237
135238 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
135239 l_balance_type_code <> 'B' THEN
135240 IF NVL(p_source_48,'
135241 ') = 'COST' AND
135242 NVL(p_source_55,'
135243 ') = 'DEST'
135244 THEN
135245
135246 --
135247 XLA_AE_LINES_PKG.SetNewLine;
135248
135249 p_balance_type_code := l_balance_type_code;
135250 -- set the flag so later we will know whether the gain loss line needs to be created
135251
135252 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
135253 p_actual_flag :='A';
135254 END IF;
135255
135256 --
135257 -- bulk performance
135258 --
135262 -- set accounting line options
135259 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
135260 p_header_num => 0); -- 4262811
135261 --
135263 --
135264 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
135265 p_natural_side_code => 'D'
135266 , p_gain_or_loss_flag => 'N'
135267 , p_gl_transfer_mode_code => 'S'
135268 , p_acct_entry_type_code => 'A'
135269 , p_switch_side_flag => 'Y'
135270 , p_merge_duplicate_code => 'N'
135271 );
135272 --
135273 l_acc_rev_natural_side_code := 'C'; -- 4262811
135274 --
135275 --
135276 -- set accounting line type info
135277 --
135278 xla_ae_lines_pkg.SetAcctLineType
135279 (p_component_type => l_component_type
135280 ,p_event_type_code => l_event_type_code
135281 ,p_line_definition_owner_code => l_line_definition_owner_code
135282 ,p_line_definition_code => l_line_definition_code
135283 ,p_accounting_line_code => l_component_code
135284 ,p_accounting_line_type_code => l_component_type_code
135285 ,p_accounting_line_appl_id => l_component_appl_id
135286 ,p_amb_context_code => l_amb_context_code
135287 ,p_entity_code => l_entity_code
135288 ,p_event_class_code => l_event_class_code);
135289 --
135290 -- set accounting class
135291 --
135292 xla_ae_lines_pkg.SetAcctClass(
135293 p_accounting_class_code => 'ASSET'
135294 , p_ae_header_id => l_ae_header_id
135295 );
135296
135297 --
135298 -- set rounding class
135299 --
135300 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
135301 'ASSET';
135302
135303 --
135304 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
135305 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
135306 --
135307 -- bulk performance
135308 --
135309 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
135310
135311 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
135312 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
135313
135314 -- 4955764
135315 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
135316 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
135317
135318 -- 4458381 Public Sector Enh
135319
135320 --
135321 -- set accounting attributes for the line type
135322 --
135323 l_entered_amt_idx := 4;
135324 l_accted_amt_idx := 6;
135325 l_bflow_applied_to_amt_idx := NULL; -- 5132302
135326 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
135327 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
135328 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
135329 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
135330 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
135331 l_rec_acct_attrs.array_char_value(3) := p_source_51;
135332 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
135333 l_rec_acct_attrs.array_num_value(4) := p_source_52;
135334 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
135335 l_rec_acct_attrs.array_char_value(5) := p_source_53;
135336 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
135337 l_rec_acct_attrs.array_num_value(6) := p_source_52;
135338
135339 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
135340 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
135341
135342 ---------------------------------------------------------------------------------------------------------------
135343 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
135344 ---------------------------------------------------------------------------------------------------------------
135345 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
135346
135347 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
135348 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
135349
135350 IF xla_accounting_cache_pkg.GetValueChar
135351 (p_source_code => 'LEDGER_CATEGORY_CODE'
135352 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
135353 AND l_bflow_method_code = 'PRIOR_ENTRY'
135354 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
135355 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
135356 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
135357 )
135358 THEN
135359 xla_ae_lines_pkg.BflowUpgEntry
135360 (p_business_method_code => l_bflow_method_code
135361 ,p_business_class_code => l_bflow_class_code
135362 ,p_balance_type => l_balance_type_code);
135363 ELSE
135364 NULL;
135365 -- No business flow processing for business flow method of NONE.
135366 END IF;
135367
135368 --
135369 -- call analytical criteria
135370 --
135371
135372 --
135373 -- call description
135377 p_ae_header_id => l_ae_header_id
135374 --
135375
135376 xla_ae_lines_pkg.SetLineDescription(
135378 ,p_description => Description_110 (
135379 p_application_id => p_application_id
135380 , p_ae_header_id => l_ae_header_id
135381 , p_source_1 => p_source_1
135382 )
135383 );
135384
135385
135386 --
135387 -- call ADRs
135388 -- Bug 4922099
135389 --
135390 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
135391 (NVL(l_actual_upg_option, 'N') = 'O') OR
135392 (NVL(l_enc_upg_option, 'N') = 'O')
135393 )
135394 THEN
135395 NULL;
135396 --
135397 --
135398
135399 l_ccid := AcctDerRule_174(
135400 p_application_id => p_application_id
135401 , p_ae_header_id => l_ae_header_id
135402 , p_source_5 => p_source_5
135403 , p_source_32 => p_source_32
135404 , x_transaction_coa_id => l_adr_transaction_coa_id
135405 , x_accounting_coa_id => l_adr_accounting_coa_id
135406 , x_value_type_code => l_adr_value_type_code
135407 , p_side => 'NA'
135408 );
135409
135410 xla_ae_lines_pkg.set_ccid(
135411 p_code_combination_id => l_ccid
135412 , p_value_type_code => l_adr_value_type_code
135413 , p_transaction_coa_id => l_adr_transaction_coa_id
135414 , p_accounting_coa_id => l_adr_accounting_coa_id
135415 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
135416 , p_adr_type_code => 'S'
135417 , p_component_type => l_component_type
135418 , p_component_code => l_component_code
135419 , p_component_type_code => l_component_type_code
135420 , p_component_appl_id => l_component_appl_id
135421 , p_amb_context_code => l_amb_context_code
135422 , p_side => 'NA'
135423 );
135424
135425
135426 l_segment := AcctDerRule_149(
135427 p_application_id => p_application_id
135428 , p_ae_header_id => l_ae_header_id
135429 , p_source_5 => p_source_5
135430 , p_source_11 => p_source_11
135431 , x_transaction_coa_id => l_adr_transaction_coa_id
135432 , x_accounting_coa_id => l_adr_accounting_coa_id
135433 , x_flexfield_segment_code => l_adr_flexfield_segment_code
135434 , x_flex_value_set_id => l_adr_flex_value_set_id
135435 , x_value_type_code => l_adr_value_type_code
135436 , x_value_combination_id => l_adr_value_combination_id
135437 , x_value_segment_code => l_adr_value_segment_code
135438 , p_side => 'NA'
135439 , p_override_seg_flag => 'Y'
135440 );
135441
135442 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
135443
135444 xla_ae_lines_pkg.set_segment(
135445 p_to_segment_code => 'GL_ACCOUNT'
135446 , p_segment_value => l_segment
135447 , p_from_segment_code => l_adr_value_segment_code
135448 , p_from_combination_id => l_adr_value_combination_id
135449 , p_value_type_code => l_adr_value_type_code
135450 , p_transaction_coa_id => l_adr_transaction_coa_id
135451 , p_accounting_coa_id => l_adr_accounting_coa_id
135452 , p_flexfield_segment_code => l_adr_flexfield_segment_code
135453 , p_flex_value_set_id => l_adr_flex_value_set_id
135454 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
135455 , p_adr_type_code => 'S'
135456 , p_component_type => l_component_type
135457 , p_component_code => l_component_code
135458 , p_component_type_code => l_component_type_code
135459 , p_component_appl_id => l_component_appl_id
135460 , p_amb_context_code => l_amb_context_code
135461 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
135462 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
135463 , p_side => 'NA'
135464 );
135465
135466 END IF;
135467
135468 l_segment := AcctDerRule_169(
135469 p_application_id => p_application_id
135470 , p_ae_header_id => l_ae_header_id
135471 , p_source_5 => p_source_5
135472 , p_source_31 => p_source_31
135473 , x_transaction_coa_id => l_adr_transaction_coa_id
135474 , x_accounting_coa_id => l_adr_accounting_coa_id
135475 , x_flexfield_segment_code => l_adr_flexfield_segment_code
135476 , x_flex_value_set_id => l_adr_flex_value_set_id
135477 , x_value_type_code => l_adr_value_type_code
135478 , x_value_combination_id => l_adr_value_combination_id
135479 , x_value_segment_code => l_adr_value_segment_code
135480 , p_side => 'NA'
135481 , p_override_seg_flag => 'Y'
135482 );
135483
135484 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
135485
135486 xla_ae_lines_pkg.set_segment(
135487 p_to_segment_code => 'GL_BALANCING'
135488 , p_segment_value => l_segment
135489 , p_from_segment_code => l_adr_value_segment_code
135490 , p_from_combination_id => l_adr_value_combination_id
135491 , p_value_type_code => l_adr_value_type_code
135495 , p_flex_value_set_id => l_adr_flex_value_set_id
135492 , p_transaction_coa_id => l_adr_transaction_coa_id
135493 , p_accounting_coa_id => l_adr_accounting_coa_id
135494 , p_flexfield_segment_code => l_adr_flexfield_segment_code
135496 , p_adr_code => 'FA_EXPENSE_ACCT'
135497 , p_adr_type_code => 'S'
135498 , p_component_type => l_component_type
135499 , p_component_code => l_component_code
135500 , p_component_type_code => l_component_type_code
135501 , p_component_appl_id => l_component_appl_id
135502 , p_amb_context_code => l_amb_context_code
135503 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
135504 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
135505 , p_side => 'NA'
135506 );
135507
135508 END IF;
135509
135510 --
135511 --
135512 END IF;
135513 --
135514 -- Bug 4922099
135515 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
135516 (NVL(l_enc_upg_option, 'N') = 'O')
135517 ) AND
135518 (l_bflow_method_code = 'PRIOR_ENTRY')
135519 )
135520 THEN
135521 IF
135522 --
135523 1 = 2
135524 --
135525 THEN
135526 xla_accounting_err_pkg.build_message
135527 (p_appli_s_name => 'XLA'
135528 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
135529 ,p_token_1 => 'LINE_NUMBER'
135530 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
135531 ,p_token_2 => 'LINE_TYPE_NAME'
135532 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
135533 l_component_type
135534 ,l_component_code
135535 ,l_component_type_code
135536 ,l_component_appl_id
135537 ,l_amb_context_code
135538 ,l_entity_code
135539 ,l_event_class_code
135540 )
135541 ,p_token_3 => 'OWNER'
135542 ,p_value_3 => xla_lookups_pkg.get_meaning(
135543 p_lookup_type => 'XLA_OWNER_TYPE'
135544 ,p_lookup_code => l_component_type_code
135545 )
135546 ,p_token_4 => 'PRODUCT_NAME'
135547 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
135548 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
135549 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
135550 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
135551 ,p_ae_header_id => NULL
135552 );
135553
135554 IF (C_LEVEL_ERROR>= g_log_level) THEN
135555 trace
135556 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
135557 ,p_level => C_LEVEL_ERROR
135558 ,p_module => l_log_module);
135559 END IF;
135560 END IF;
135561 END IF;
135562 --
135563 --
135564 ------------------------------------------------------------------------------------------------
135565 -- 4219869 Business Flow
135566 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
135567 -- Prior Entry. Currently, the following code is always generated.
135568 ------------------------------------------------------------------------------------------------
135569 XLA_AE_LINES_PKG.ValidateCurrentLine;
135570
135571 ------------------------------------------------------------------------------------
135572 -- 4219869 Business Flow
135573 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
135574 ------------------------------------------------------------------------------------
135575 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
135576
135577 ----------------------------------------------------------------------------------
135578 -- 4219869 Business Flow
135579 -- Update journal entry status -- Need to generate this within IF <condition>
135580 ----------------------------------------------------------------------------------
135581 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
135582 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
135583 ,p_balance_type_code => l_balance_type_code
135584 );
135585
135589 BEGIN
135586 -------------------------------------------------------------------------------------------
135587 -- 4262811 - Generate the Accrual Reversal lines
135588 -------------------------------------------------------------------------------------------
135590 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
135591 (g_array_event(p_event_id).array_value_num('header_index'));
135592 IF l_acc_rev_flag IS NULL THEN
135593 l_acc_rev_flag := 'N';
135594 END IF;
135595 EXCEPTION
135596 WHEN OTHERS THEN
135597 l_acc_rev_flag := 'N';
135598 END;
135599 --
135600 IF (l_acc_rev_flag = 'Y') THEN
135601
135602 -- 4645092 ------------------------------------------------------------------------------
135603 -- To allow MPA report to determine if it should generate report process
135604 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
135605 ------------------------------------------------------------------------------------------
135606
135607 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
135608 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
135609 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
135610 -- call ADRs
135611 -- Bug 4922099
135612 --
135613 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
135614 (NVL(l_actual_upg_option, 'N') = 'O') OR
135615 (NVL(l_enc_upg_option, 'N') = 'O')
135616 )
135617 THEN
135618 NULL;
135619 --
135620 --
135621
135622 l_ccid := AcctDerRule_174(
135623 p_application_id => p_application_id
135624 , p_ae_header_id => l_ae_header_id
135625 , p_source_5 => p_source_5
135626 , p_source_32 => p_source_32
135627 , x_transaction_coa_id => l_adr_transaction_coa_id
135628 , x_accounting_coa_id => l_adr_accounting_coa_id
135629 , x_value_type_code => l_adr_value_type_code
135630 , p_side => 'NA'
135631 );
135632
135633 xla_ae_lines_pkg.set_ccid(
135634 p_code_combination_id => l_ccid
135635 , p_value_type_code => l_adr_value_type_code
135636 , p_transaction_coa_id => l_adr_transaction_coa_id
135637 , p_accounting_coa_id => l_adr_accounting_coa_id
135638 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
135639 , p_adr_type_code => 'S'
135640 , p_component_type => l_component_type
135641 , p_component_code => l_component_code
135642 , p_component_type_code => l_component_type_code
135643 , p_component_appl_id => l_component_appl_id
135644 , p_amb_context_code => l_amb_context_code
135645 , p_side => 'NA'
135646 );
135647
135648
135649 l_segment := AcctDerRule_149(
135650 p_application_id => p_application_id
135651 , p_ae_header_id => l_ae_header_id
135652 , p_source_5 => p_source_5
135653 , p_source_11 => p_source_11
135654 , x_transaction_coa_id => l_adr_transaction_coa_id
135655 , x_accounting_coa_id => l_adr_accounting_coa_id
135656 , x_flexfield_segment_code => l_adr_flexfield_segment_code
135657 , x_flex_value_set_id => l_adr_flex_value_set_id
135658 , x_value_type_code => l_adr_value_type_code
135659 , x_value_combination_id => l_adr_value_combination_id
135660 , x_value_segment_code => l_adr_value_segment_code
135661 , p_side => 'NA'
135662 , p_override_seg_flag => 'Y'
135663 );
135664
135665 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
135666
135667 xla_ae_lines_pkg.set_segment(
135668 p_to_segment_code => 'GL_ACCOUNT'
135669 , p_segment_value => l_segment
135670 , p_from_segment_code => l_adr_value_segment_code
135671 , p_from_combination_id => l_adr_value_combination_id
135672 , p_value_type_code => l_adr_value_type_code
135673 , p_transaction_coa_id => l_adr_transaction_coa_id
135674 , p_accounting_coa_id => l_adr_accounting_coa_id
135675 , p_flexfield_segment_code => l_adr_flexfield_segment_code
135676 , p_flex_value_set_id => l_adr_flex_value_set_id
135677 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
135678 , p_adr_type_code => 'S'
135679 , p_component_type => l_component_type
135680 , p_component_code => l_component_code
135681 , p_component_type_code => l_component_type_code
135682 , p_component_appl_id => l_component_appl_id
135683 , p_amb_context_code => l_amb_context_code
135684 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
135685 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
135686 , p_side => 'NA'
135687 );
135688
135689 END IF;
135690
135691 l_segment := AcctDerRule_169(
135692 p_application_id => p_application_id
135693 , p_ae_header_id => l_ae_header_id
135694 , p_source_5 => p_source_5
135695 , p_source_31 => p_source_31
135696 , x_transaction_coa_id => l_adr_transaction_coa_id
135697 , x_accounting_coa_id => l_adr_accounting_coa_id
135701 , x_value_combination_id => l_adr_value_combination_id
135698 , x_flexfield_segment_code => l_adr_flexfield_segment_code
135699 , x_flex_value_set_id => l_adr_flex_value_set_id
135700 , x_value_type_code => l_adr_value_type_code
135702 , x_value_segment_code => l_adr_value_segment_code
135703 , p_side => 'NA'
135704 , p_override_seg_flag => 'Y'
135705 );
135706
135707 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
135708
135709 xla_ae_lines_pkg.set_segment(
135710 p_to_segment_code => 'GL_BALANCING'
135711 , p_segment_value => l_segment
135712 , p_from_segment_code => l_adr_value_segment_code
135713 , p_from_combination_id => l_adr_value_combination_id
135714 , p_value_type_code => l_adr_value_type_code
135715 , p_transaction_coa_id => l_adr_transaction_coa_id
135716 , p_accounting_coa_id => l_adr_accounting_coa_id
135717 , p_flexfield_segment_code => l_adr_flexfield_segment_code
135718 , p_flex_value_set_id => l_adr_flex_value_set_id
135719 , p_adr_code => 'FA_EXPENSE_ACCT'
135720 , p_adr_type_code => 'S'
135721 , p_component_type => l_component_type
135722 , p_component_code => l_component_code
135723 , p_component_type_code => l_component_type_code
135724 , p_component_appl_id => l_component_appl_id
135725 , p_amb_context_code => l_amb_context_code
135726 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
135727 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
135728 , p_side => 'NA'
135729 );
135730
135731 END IF;
135732
135733 --
135734 --
135735 END IF;
135736
135737 --
135738 -- Update the line information that should be overwritten
135739 --
135740 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
135741 p_header_num => 1);
135742 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
135743
135744 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
135745
135746 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
135747 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
135748 END IF;
135749
135750 --
135751 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
135752 --
135753 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
135754 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
135755 ELSE
135756 ---------------------------------------------------------------------------------------------------
135757 -- 4262811a Switch Sign
135758 ---------------------------------------------------------------------------------------------------
135759 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
135760 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
135761 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
135762 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
135763 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
135764 -- 5132302
135765 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
135766 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
135767
135768 END IF;
135769
135770 -- 4955764
135771 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
135772 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
135773
135774
135775 XLA_AE_LINES_PKG.ValidateCurrentLine;
135776 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
135777
135778 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
135779 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
135780 ,p_balance_type_code => l_balance_type_code);
135781
135782 END IF;
135783
135784 -----------------------------------------------------------------------------------------
135785 -- 4262811 Multiperiod Accounting
135786 -----------------------------------------------------------------------------------------
135787 -- No MPA option is assigned.
135788
135789
135790 END IF;
135791 END IF;
135792 --
135793
135794 --
135795 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
135796 trace
135797 (p_msg => 'END of AcctLineType_354'
135798 ,p_level => C_LEVEL_PROCEDURE
135799 ,p_module => l_log_module);
135800 END IF;
135801 --
135802 EXCEPTION
135803 WHEN xla_exceptions_pkg.application_exception THEN
135804 RAISE;
135805 WHEN OTHERS THEN
135806 xla_exceptions_pkg.raise_message
135807 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_354');
135808 END AcctLineType_354;
135809 --
135810
135811 ---------------------------------------
135812 --
135813 -- PRIVATE FUNCTION
135817 PROCEDURE AcctLineType_355 (
135814 -- AcctLineType_355
135815 --
135816 ---------------------------------------
135818 p_application_id IN NUMBER
135819 ,p_event_id IN NUMBER
135820 ,p_calculate_acctd_flag IN VARCHAR2
135821 ,p_calculate_g_l_flag IN VARCHAR2
135822 ,p_actual_flag IN OUT VARCHAR2
135823 ,p_balance_type_code OUT VARCHAR2
135824 ,p_gain_or_loss_ref OUT VARCHAR2
135825
135826 --Period Close Date
135827 , p_source_1 IN DATE
135828 --Generated Code Combination Identifier
135829 , p_source_5 IN NUMBER
135830 --Payables Code Combination Identifier
135831 , p_source_8 IN NUMBER
135832 --Asset Clearing Account
135833 , p_source_10 IN VARCHAR2
135834 --Expense Account Code Combination Identifier
135835 , p_source_31 IN NUMBER
135836 --Default Code Combination Identifier
135837 , p_source_32 IN NUMBER
135838 --Adjustment Type
135839 , p_source_48 IN VARCHAR2
135840 --Transaction Header Identifier
135841 , p_source_49 IN NUMBER
135842 --Adjustment Line Identifier
135843 , p_source_50 IN NUMBER
135844 --Distribution Type Code
135845 , p_source_51 IN VARCHAR2
135846 --Entered Amount
135847 , p_source_52 IN NUMBER
135848 --Currency Code
135849 , p_source_53 IN VARCHAR2
135850 --Source Destination Code
135851 , p_source_55 IN VARCHAR2
135852 )
135853 IS
135854
135855 l_component_type VARCHAR2(80);
135856 l_component_code VARCHAR2(30);
135857 l_component_type_code VARCHAR2(1);
135858 l_component_appl_id INTEGER;
135859 l_amb_context_code VARCHAR2(30);
135860 l_entity_code VARCHAR2(30);
135861 l_event_class_code VARCHAR2(30);
135862 l_ae_header_id NUMBER;
135863 l_event_type_code VARCHAR2(30);
135864 l_line_definition_code VARCHAR2(30);
135865 l_line_definition_owner_code VARCHAR2(1);
135866 --
135867 -- adr variables
135868 l_segment VARCHAR2(30);
135869 l_ccid NUMBER;
135870 l_adr_transaction_coa_id NUMBER;
135871 l_adr_accounting_coa_id NUMBER;
135872 l_adr_flexfield_segment_code VARCHAR2(30);
135873 l_adr_flex_value_set_id NUMBER;
135874 l_adr_value_type_code VARCHAR2(30);
135875 l_adr_value_combination_id NUMBER;
135876 l_adr_value_segment_code VARCHAR2(30);
135877
135878 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
135879 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
135880 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
135881 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
135882
135883 -- 4262811 Variables ------------------------------------------------------------------------------------------
135884 l_entered_amt_idx NUMBER;
135885 l_accted_amt_idx NUMBER;
135886 l_acc_rev_flag VARCHAR2(1);
135887 l_accrual_line_num NUMBER;
135888 l_tmp_amt NUMBER;
135889 l_acc_rev_natural_side_code VARCHAR2(1);
135890
135891 l_num_entries NUMBER;
135892 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
135893 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
135894 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
135895 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
135896 l_recog_line_1 NUMBER;
135897 l_recog_line_2 NUMBER;
135898
135899 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
135900 l_bflow_applied_to_amt NUMBER; -- 5132302
135901 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
135902
135903 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
135904
135905 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
135906 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
135907
135908 ---------------------------------------------------------------------------------------------------------------
135909
135910
135911 --
135912 -- bulk performance
135913 --
135914 l_balance_type_code VARCHAR2(1);
135915 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
135916 l_log_module VARCHAR2(240);
135917
135918 --
135919 -- Upgrade strategy
135920 --
135921 l_actual_upg_option VARCHAR2(1);
135922 l_enc_upg_option VARCHAR2(1);
135923
135924 --
135925 BEGIN
135926 --
135927 IF g_log_enabled THEN
135928 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_355';
135929 END IF;
135930 --
135931 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
135932
135933 trace
135934 (p_msg => 'BEGIN of AcctLineType_355'
135935 ,p_level => C_LEVEL_PROCEDURE
135936 ,p_module => l_log_module);
135937
135938 END IF;
135939 --
135940 l_component_type := 'AMB_JLT';
135941 l_component_code := 'FA_SLT_DEST_COST_CLEARING';
135942 l_component_type_code := 'S';
135943 l_component_appl_id := 140;
135944 l_amb_context_code := 'DEFAULT';
135945 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
135946 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
135950 --
135947 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
135948 l_line_definition_owner_code := 'S';
135949 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
135951 l_balance_type_code := 'A';
135952 l_segment := NULL;
135953 l_ccid := NULL;
135954 l_adr_transaction_coa_id := NULL;
135955 l_adr_accounting_coa_id := NULL;
135956 l_adr_flexfield_segment_code := NULL;
135957 l_adr_flex_value_set_id := NULL;
135958 l_adr_value_type_code := NULL;
135959 l_adr_value_combination_id := NULL;
135960 l_adr_value_segment_code := NULL;
135961
135962 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
135963 l_bflow_class_code := ''; -- 4219869 Business Flow
135964 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
135965 l_budgetary_control_flag := 'N';
135966
135967 l_bflow_applied_to_amt_idx := NULL; -- 5132302
135968 l_bflow_applied_to_amt := NULL; -- 5132302
135969 l_entered_amt_idx := NULL; -- 4262811
135970 l_accted_amt_idx := NULL; -- 4262811
135971 l_acc_rev_flag := NULL; -- 4262811
135972 l_accrual_line_num := NULL; -- 4262811
135973 l_tmp_amt := NULL; -- 4262811
135974 --
135975
135976 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
135977 l_balance_type_code <> 'B' THEN
135978 IF NVL(p_source_48,'
135979 ') = 'COST CLEARING' AND
135980 NVL(p_source_55,'
135981 ') = 'DEST'
135982 THEN
135983
135984 --
135985 XLA_AE_LINES_PKG.SetNewLine;
135986
135987 p_balance_type_code := l_balance_type_code;
135988 -- set the flag so later we will know whether the gain loss line needs to be created
135989
135990 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
135991 p_actual_flag :='A';
135992 END IF;
135993
135994 --
135995 -- bulk performance
135996 --
135997 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
135998 p_header_num => 0); -- 4262811
135999 --
136000 -- set accounting line options
136001 --
136002 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
136003 p_natural_side_code => 'C'
136004 , p_gain_or_loss_flag => 'N'
136005 , p_gl_transfer_mode_code => 'S'
136006 , p_acct_entry_type_code => 'A'
136007 , p_switch_side_flag => 'Y'
136008 , p_merge_duplicate_code => 'N'
136009 );
136010 --
136011 l_acc_rev_natural_side_code := 'D'; -- 4262811
136012 --
136013 --
136014 -- set accounting line type info
136015 --
136016 xla_ae_lines_pkg.SetAcctLineType
136017 (p_component_type => l_component_type
136018 ,p_event_type_code => l_event_type_code
136019 ,p_line_definition_owner_code => l_line_definition_owner_code
136020 ,p_line_definition_code => l_line_definition_code
136021 ,p_accounting_line_code => l_component_code
136022 ,p_accounting_line_type_code => l_component_type_code
136023 ,p_accounting_line_appl_id => l_component_appl_id
136024 ,p_amb_context_code => l_amb_context_code
136025 ,p_entity_code => l_entity_code
136026 ,p_event_class_code => l_event_class_code);
136027 --
136028 -- set accounting class
136029 --
136030 xla_ae_lines_pkg.SetAcctClass(
136031 p_accounting_class_code => 'ASSET'
136032 , p_ae_header_id => l_ae_header_id
136033 );
136034
136035 --
136036 -- set rounding class
136037 --
136038 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
136039 'ASSET';
136040
136041 --
136042 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
136043 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
136044 --
136045 -- bulk performance
136046 --
136047 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
136048
136049 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
136050 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
136051
136052 -- 4955764
136053 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
136054 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
136055
136056 -- 4458381 Public Sector Enh
136057
136058 --
136059 -- set accounting attributes for the line type
136060 --
136061 l_entered_amt_idx := 4;
136062 l_accted_amt_idx := 6;
136063 l_bflow_applied_to_amt_idx := NULL; -- 5132302
136064 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
136065 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
136066 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
136067 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
136068 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
136069 l_rec_acct_attrs.array_char_value(3) := p_source_51;
136070 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
136074 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
136071 l_rec_acct_attrs.array_num_value(4) := p_source_52;
136072 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
136073 l_rec_acct_attrs.array_char_value(5) := p_source_53;
136075 l_rec_acct_attrs.array_num_value(6) := p_source_52;
136076
136077 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
136078 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
136079
136080 ---------------------------------------------------------------------------------------------------------------
136081 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
136082 ---------------------------------------------------------------------------------------------------------------
136083 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
136084
136085 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
136086 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
136087
136088 IF xla_accounting_cache_pkg.GetValueChar
136089 (p_source_code => 'LEDGER_CATEGORY_CODE'
136090 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
136091 AND l_bflow_method_code = 'PRIOR_ENTRY'
136092 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
136093 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
136094 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
136095 )
136096 THEN
136097 xla_ae_lines_pkg.BflowUpgEntry
136098 (p_business_method_code => l_bflow_method_code
136099 ,p_business_class_code => l_bflow_class_code
136100 ,p_balance_type => l_balance_type_code);
136101 ELSE
136102 NULL;
136103 -- No business flow processing for business flow method of NONE.
136104 END IF;
136105
136106 --
136107 -- call analytical criteria
136108 --
136109
136110 --
136111 -- call description
136112 --
136113
136114 xla_ae_lines_pkg.SetLineDescription(
136115 p_ae_header_id => l_ae_header_id
136116 ,p_description => Description_111 (
136117 p_application_id => p_application_id
136118 , p_ae_header_id => l_ae_header_id
136119 , p_source_1 => p_source_1
136120 )
136121 );
136122
136123
136124 --
136125 -- call ADRs
136126 -- Bug 4922099
136127 --
136128 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
136129 (NVL(l_actual_upg_option, 'N') = 'O') OR
136130 (NVL(l_enc_upg_option, 'N') = 'O')
136131 )
136132 THEN
136133 NULL;
136134 --
136135 --
136136
136137 l_ccid := AcctDerRule_173(
136138 p_application_id => p_application_id
136139 , p_ae_header_id => l_ae_header_id
136140 , p_source_5 => p_source_5
136141 , p_source_8 => p_source_8
136142 , p_source_32 => p_source_32
136143 , x_transaction_coa_id => l_adr_transaction_coa_id
136144 , x_accounting_coa_id => l_adr_accounting_coa_id
136145 , x_value_type_code => l_adr_value_type_code
136146 , p_side => 'NA'
136147 );
136148
136149 xla_ae_lines_pkg.set_ccid(
136150 p_code_combination_id => l_ccid
136151 , p_value_type_code => l_adr_value_type_code
136152 , p_transaction_coa_id => l_adr_transaction_coa_id
136153 , p_accounting_coa_id => l_adr_accounting_coa_id
136154 , p_adr_code => 'FA_CAT_COST_CLEARING'
136155 , p_adr_type_code => 'S'
136156 , p_component_type => l_component_type
136157 , p_component_code => l_component_code
136158 , p_component_type_code => l_component_type_code
136159 , p_component_appl_id => l_component_appl_id
136160 , p_amb_context_code => l_amb_context_code
136161 , p_side => 'NA'
136162 );
136163
136164
136165 l_segment := AcctDerRule_148(
136166 p_application_id => p_application_id
136167 , p_ae_header_id => l_ae_header_id
136168 , p_source_5 => p_source_5
136169 , p_source_8 => p_source_8
136170 , p_source_10 => p_source_10
136171 , x_transaction_coa_id => l_adr_transaction_coa_id
136172 , x_accounting_coa_id => l_adr_accounting_coa_id
136173 , x_flexfield_segment_code => l_adr_flexfield_segment_code
136174 , x_flex_value_set_id => l_adr_flex_value_set_id
136175 , x_value_type_code => l_adr_value_type_code
136176 , x_value_combination_id => l_adr_value_combination_id
136177 , x_value_segment_code => l_adr_value_segment_code
136178 , p_side => 'NA'
136179 , p_override_seg_flag => 'Y'
136180 );
136181
136182 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
136183
136184 xla_ae_lines_pkg.set_segment(
136185 p_to_segment_code => 'GL_ACCOUNT'
136186 , p_segment_value => l_segment
136187 , p_from_segment_code => l_adr_value_segment_code
136188 , p_from_combination_id => l_adr_value_combination_id
136192 , p_flexfield_segment_code => l_adr_flexfield_segment_code
136189 , p_value_type_code => l_adr_value_type_code
136190 , p_transaction_coa_id => l_adr_transaction_coa_id
136191 , p_accounting_coa_id => l_adr_accounting_coa_id
136193 , p_flex_value_set_id => l_adr_flex_value_set_id
136194 , p_adr_code => 'FA_CAT_CLR_ACCOUNT_SEGMENT'
136195 , p_adr_type_code => 'S'
136196 , p_component_type => l_component_type
136197 , p_component_code => l_component_code
136198 , p_component_type_code => l_component_type_code
136199 , p_component_appl_id => l_component_appl_id
136200 , p_amb_context_code => l_amb_context_code
136201 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
136202 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
136203 , p_side => 'NA'
136204 );
136205
136206 END IF;
136207
136208 l_segment := AcctDerRule_170(
136209 p_application_id => p_application_id
136210 , p_ae_header_id => l_ae_header_id
136211 , p_source_5 => p_source_5
136212 , p_source_8 => p_source_8
136213 , p_source_31 => p_source_31
136214 , x_transaction_coa_id => l_adr_transaction_coa_id
136215 , x_accounting_coa_id => l_adr_accounting_coa_id
136216 , x_flexfield_segment_code => l_adr_flexfield_segment_code
136217 , x_flex_value_set_id => l_adr_flex_value_set_id
136218 , x_value_type_code => l_adr_value_type_code
136219 , x_value_combination_id => l_adr_value_combination_id
136220 , x_value_segment_code => l_adr_value_segment_code
136221 , p_side => 'NA'
136222 , p_override_seg_flag => 'Y'
136223 );
136224
136225 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
136226
136227 xla_ae_lines_pkg.set_segment(
136228 p_to_segment_code => 'GL_BALANCING'
136229 , p_segment_value => l_segment
136230 , p_from_segment_code => l_adr_value_segment_code
136231 , p_from_combination_id => l_adr_value_combination_id
136232 , p_value_type_code => l_adr_value_type_code
136233 , p_transaction_coa_id => l_adr_transaction_coa_id
136234 , p_accounting_coa_id => l_adr_accounting_coa_id
136235 , p_flexfield_segment_code => l_adr_flexfield_segment_code
136236 , p_flex_value_set_id => l_adr_flex_value_set_id
136237 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
136238 , p_adr_type_code => 'S'
136239 , p_component_type => l_component_type
136240 , p_component_code => l_component_code
136241 , p_component_type_code => l_component_type_code
136242 , p_component_appl_id => l_component_appl_id
136243 , p_amb_context_code => l_amb_context_code
136244 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
136245 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
136246 , p_side => 'NA'
136247 );
136248
136249 END IF;
136250
136251 --
136252 --
136253 END IF;
136254 --
136255 -- Bug 4922099
136256 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
136257 (NVL(l_enc_upg_option, 'N') = 'O')
136258 ) AND
136259 (l_bflow_method_code = 'PRIOR_ENTRY')
136260 )
136261 THEN
136262 IF
136263 --
136264 1 = 2
136265 --
136266 THEN
136267 xla_accounting_err_pkg.build_message
136268 (p_appli_s_name => 'XLA'
136269 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
136270 ,p_token_1 => 'LINE_NUMBER'
136271 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
136272 ,p_token_2 => 'LINE_TYPE_NAME'
136273 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
136274 l_component_type
136275 ,l_component_code
136276 ,l_component_type_code
136277 ,l_component_appl_id
136278 ,l_amb_context_code
136279 ,l_entity_code
136280 ,l_event_class_code
136281 )
136282 ,p_token_3 => 'OWNER'
136283 ,p_value_3 => xla_lookups_pkg.get_meaning(
136284 p_lookup_type => 'XLA_OWNER_TYPE'
136285 ,p_lookup_code => l_component_type_code
136286 )
136287 ,p_token_4 => 'PRODUCT_NAME'
136291 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
136288 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
136289 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
136290 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
136292 ,p_ae_header_id => NULL
136293 );
136294
136295 IF (C_LEVEL_ERROR>= g_log_level) THEN
136296 trace
136297 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
136298 ,p_level => C_LEVEL_ERROR
136299 ,p_module => l_log_module);
136300 END IF;
136301 END IF;
136302 END IF;
136303 --
136304 --
136305 ------------------------------------------------------------------------------------------------
136306 -- 4219869 Business Flow
136307 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
136308 -- Prior Entry. Currently, the following code is always generated.
136309 ------------------------------------------------------------------------------------------------
136310 XLA_AE_LINES_PKG.ValidateCurrentLine;
136311
136312 ------------------------------------------------------------------------------------
136313 -- 4219869 Business Flow
136314 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
136315 ------------------------------------------------------------------------------------
136316 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
136317
136318 ----------------------------------------------------------------------------------
136319 -- 4219869 Business Flow
136320 -- Update journal entry status -- Need to generate this within IF <condition>
136321 ----------------------------------------------------------------------------------
136322 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
136323 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
136324 ,p_balance_type_code => l_balance_type_code
136325 );
136326
136327 -------------------------------------------------------------------------------------------
136328 -- 4262811 - Generate the Accrual Reversal lines
136329 -------------------------------------------------------------------------------------------
136330 BEGIN
136331 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
136332 (g_array_event(p_event_id).array_value_num('header_index'));
136333 IF l_acc_rev_flag IS NULL THEN
136334 l_acc_rev_flag := 'N';
136335 END IF;
136336 EXCEPTION
136337 WHEN OTHERS THEN
136338 l_acc_rev_flag := 'N';
136339 END;
136340 --
136341 IF (l_acc_rev_flag = 'Y') THEN
136342
136343 -- 4645092 ------------------------------------------------------------------------------
136344 -- To allow MPA report to determine if it should generate report process
136345 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
136346 ------------------------------------------------------------------------------------------
136347
136348 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
136349 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
136350 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
136351 -- call ADRs
136352 -- Bug 4922099
136353 --
136354 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
136355 (NVL(l_actual_upg_option, 'N') = 'O') OR
136356 (NVL(l_enc_upg_option, 'N') = 'O')
136357 )
136358 THEN
136359 NULL;
136360 --
136361 --
136362
136363 l_ccid := AcctDerRule_173(
136364 p_application_id => p_application_id
136365 , p_ae_header_id => l_ae_header_id
136366 , p_source_5 => p_source_5
136367 , p_source_8 => p_source_8
136368 , p_source_32 => p_source_32
136369 , x_transaction_coa_id => l_adr_transaction_coa_id
136370 , x_accounting_coa_id => l_adr_accounting_coa_id
136371 , x_value_type_code => l_adr_value_type_code
136372 , p_side => 'NA'
136373 );
136374
136375 xla_ae_lines_pkg.set_ccid(
136376 p_code_combination_id => l_ccid
136377 , p_value_type_code => l_adr_value_type_code
136378 , p_transaction_coa_id => l_adr_transaction_coa_id
136379 , p_accounting_coa_id => l_adr_accounting_coa_id
136380 , p_adr_code => 'FA_CAT_COST_CLEARING'
136381 , p_adr_type_code => 'S'
136382 , p_component_type => l_component_type
136383 , p_component_code => l_component_code
136384 , p_component_type_code => l_component_type_code
136385 , p_component_appl_id => l_component_appl_id
136386 , p_amb_context_code => l_amb_context_code
136387 , p_side => 'NA'
136388 );
136389
136390
136391 l_segment := AcctDerRule_148(
136392 p_application_id => p_application_id
136393 , p_ae_header_id => l_ae_header_id
136394 , p_source_5 => p_source_5
136395 , p_source_8 => p_source_8
136396 , p_source_10 => p_source_10
136397 , x_transaction_coa_id => l_adr_transaction_coa_id
136398 , x_accounting_coa_id => l_adr_accounting_coa_id
136402 , x_value_combination_id => l_adr_value_combination_id
136399 , x_flexfield_segment_code => l_adr_flexfield_segment_code
136400 , x_flex_value_set_id => l_adr_flex_value_set_id
136401 , x_value_type_code => l_adr_value_type_code
136403 , x_value_segment_code => l_adr_value_segment_code
136404 , p_side => 'NA'
136405 , p_override_seg_flag => 'Y'
136406 );
136407
136408 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
136409
136410 xla_ae_lines_pkg.set_segment(
136411 p_to_segment_code => 'GL_ACCOUNT'
136412 , p_segment_value => l_segment
136413 , p_from_segment_code => l_adr_value_segment_code
136414 , p_from_combination_id => l_adr_value_combination_id
136415 , p_value_type_code => l_adr_value_type_code
136416 , p_transaction_coa_id => l_adr_transaction_coa_id
136417 , p_accounting_coa_id => l_adr_accounting_coa_id
136418 , p_flexfield_segment_code => l_adr_flexfield_segment_code
136419 , p_flex_value_set_id => l_adr_flex_value_set_id
136420 , p_adr_code => 'FA_CAT_CLR_ACCOUNT_SEGMENT'
136421 , p_adr_type_code => 'S'
136422 , p_component_type => l_component_type
136423 , p_component_code => l_component_code
136424 , p_component_type_code => l_component_type_code
136425 , p_component_appl_id => l_component_appl_id
136426 , p_amb_context_code => l_amb_context_code
136427 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
136428 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
136429 , p_side => 'NA'
136430 );
136431
136432 END IF;
136433
136434 l_segment := AcctDerRule_170(
136435 p_application_id => p_application_id
136436 , p_ae_header_id => l_ae_header_id
136437 , p_source_5 => p_source_5
136438 , p_source_8 => p_source_8
136439 , p_source_31 => p_source_31
136440 , x_transaction_coa_id => l_adr_transaction_coa_id
136441 , x_accounting_coa_id => l_adr_accounting_coa_id
136442 , x_flexfield_segment_code => l_adr_flexfield_segment_code
136443 , x_flex_value_set_id => l_adr_flex_value_set_id
136444 , x_value_type_code => l_adr_value_type_code
136445 , x_value_combination_id => l_adr_value_combination_id
136446 , x_value_segment_code => l_adr_value_segment_code
136447 , p_side => 'NA'
136448 , p_override_seg_flag => 'Y'
136449 );
136450
136451 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
136452
136453 xla_ae_lines_pkg.set_segment(
136454 p_to_segment_code => 'GL_BALANCING'
136455 , p_segment_value => l_segment
136456 , p_from_segment_code => l_adr_value_segment_code
136457 , p_from_combination_id => l_adr_value_combination_id
136458 , p_value_type_code => l_adr_value_type_code
136459 , p_transaction_coa_id => l_adr_transaction_coa_id
136460 , p_accounting_coa_id => l_adr_accounting_coa_id
136461 , p_flexfield_segment_code => l_adr_flexfield_segment_code
136462 , p_flex_value_set_id => l_adr_flex_value_set_id
136463 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
136464 , p_adr_type_code => 'S'
136465 , p_component_type => l_component_type
136466 , p_component_code => l_component_code
136467 , p_component_type_code => l_component_type_code
136468 , p_component_appl_id => l_component_appl_id
136469 , p_amb_context_code => l_amb_context_code
136470 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
136471 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
136472 , p_side => 'NA'
136473 );
136474
136475 END IF;
136476
136477 --
136478 --
136479 END IF;
136480
136481 --
136482 -- Update the line information that should be overwritten
136483 --
136484 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
136485 p_header_num => 1);
136486 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
136487
136488 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
136489
136490 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
136491 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
136492 END IF;
136493
136494 --
136495 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
136496 --
136497 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
136498 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
136499 ELSE
136500 ---------------------------------------------------------------------------------------------------
136501 -- 4262811a Switch Sign
136502 ---------------------------------------------------------------------------------------------------
136503 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
136507 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
136504 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
136505 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
136506 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
136508 -- 5132302
136509 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
136510 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
136511
136512 END IF;
136513
136514 -- 4955764
136515 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
136516 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
136517
136518
136519 XLA_AE_LINES_PKG.ValidateCurrentLine;
136520 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
136521
136522 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
136523 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
136524 ,p_balance_type_code => l_balance_type_code);
136525
136526 END IF;
136527
136528 -----------------------------------------------------------------------------------------
136529 -- 4262811 Multiperiod Accounting
136530 -----------------------------------------------------------------------------------------
136531 -- No MPA option is assigned.
136532
136533
136534 END IF;
136535 END IF;
136536 --
136537
136538 --
136539 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
136540 trace
136541 (p_msg => 'END of AcctLineType_355'
136542 ,p_level => C_LEVEL_PROCEDURE
136543 ,p_module => l_log_module);
136544 END IF;
136545 --
136546 EXCEPTION
136547 WHEN xla_exceptions_pkg.application_exception THEN
136548 RAISE;
136549 WHEN OTHERS THEN
136550 xla_exceptions_pkg.raise_message
136551 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_355');
136552 END AcctLineType_355;
136553 --
136554
136555 ---------------------------------------
136556 --
136557 -- PRIVATE FUNCTION
136558 -- AcctLineType_356
136559 --
136560 ---------------------------------------
136561 PROCEDURE AcctLineType_356 (
136562 p_application_id IN NUMBER
136563 ,p_event_id IN NUMBER
136564 ,p_calculate_acctd_flag IN VARCHAR2
136565 ,p_calculate_g_l_flag IN VARCHAR2
136566 ,p_actual_flag IN OUT VARCHAR2
136567 ,p_balance_type_code OUT VARCHAR2
136568 ,p_gain_or_loss_ref OUT VARCHAR2
136569
136570 --Period Close Date
136571 , p_source_1 IN DATE
136572 --Generated Code Combination Identifier
136573 , p_source_5 IN NUMBER
136574 --Expense Account Code Combination Identifier
136575 , p_source_31 IN NUMBER
136576 --Adjustment Type
136577 , p_source_48 IN VARCHAR2
136578 --Transaction Header Identifier
136579 , p_source_49 IN NUMBER
136580 --Adjustment Line Identifier
136581 , p_source_50 IN NUMBER
136582 --Distribution Type Code
136583 , p_source_51 IN VARCHAR2
136584 --Entered Amount
136585 , p_source_52 IN NUMBER
136586 --Currency Code
136587 , p_source_53 IN VARCHAR2
136588 --Source Destination Code
136589 , p_source_55 IN VARCHAR2
136590 )
136591 IS
136592
136593 l_component_type VARCHAR2(80);
136594 l_component_code VARCHAR2(30);
136595 l_component_type_code VARCHAR2(1);
136596 l_component_appl_id INTEGER;
136597 l_amb_context_code VARCHAR2(30);
136598 l_entity_code VARCHAR2(30);
136599 l_event_class_code VARCHAR2(30);
136600 l_ae_header_id NUMBER;
136601 l_event_type_code VARCHAR2(30);
136602 l_line_definition_code VARCHAR2(30);
136603 l_line_definition_owner_code VARCHAR2(1);
136604 --
136605 -- adr variables
136606 l_segment VARCHAR2(30);
136607 l_ccid NUMBER;
136608 l_adr_transaction_coa_id NUMBER;
136609 l_adr_accounting_coa_id NUMBER;
136610 l_adr_flexfield_segment_code VARCHAR2(30);
136611 l_adr_flex_value_set_id NUMBER;
136612 l_adr_value_type_code VARCHAR2(30);
136613 l_adr_value_combination_id NUMBER;
136614 l_adr_value_segment_code VARCHAR2(30);
136615
136616 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
136617 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
136618 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
136619 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
136620
136621 -- 4262811 Variables ------------------------------------------------------------------------------------------
136622 l_entered_amt_idx NUMBER;
136623 l_accted_amt_idx NUMBER;
136624 l_acc_rev_flag VARCHAR2(1);
136625 l_accrual_line_num NUMBER;
136626 l_tmp_amt NUMBER;
136627 l_acc_rev_natural_side_code VARCHAR2(1);
136628
136629 l_num_entries NUMBER;
136630 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
136631 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
136635 l_recog_line_2 NUMBER;
136632 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
136633 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
136634 l_recog_line_1 NUMBER;
136636
136637 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
136638 l_bflow_applied_to_amt NUMBER; -- 5132302
136639 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
136640
136641 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
136642
136643 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
136644 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
136645
136646 ---------------------------------------------------------------------------------------------------------------
136647
136648
136649 --
136650 -- bulk performance
136651 --
136652 l_balance_type_code VARCHAR2(1);
136653 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
136654 l_log_module VARCHAR2(240);
136655
136656 --
136657 -- Upgrade strategy
136658 --
136659 l_actual_upg_option VARCHAR2(1);
136660 l_enc_upg_option VARCHAR2(1);
136661
136662 --
136663 BEGIN
136664 --
136665 IF g_log_enabled THEN
136666 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_356';
136667 END IF;
136668 --
136669 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
136670
136671 trace
136672 (p_msg => 'BEGIN of AcctLineType_356'
136673 ,p_level => C_LEVEL_PROCEDURE
136674 ,p_module => l_log_module);
136675
136676 END IF;
136677 --
136678 l_component_type := 'AMB_JLT';
136679 l_component_code := 'FA_SLT_DEST_DEPRN_EXP';
136680 l_component_type_code := 'S';
136681 l_component_appl_id := 140;
136682 l_amb_context_code := 'DEFAULT';
136683 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
136684 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
136685 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
136686 l_line_definition_owner_code := 'S';
136687 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
136688 --
136689 l_balance_type_code := 'A';
136690 l_segment := NULL;
136691 l_ccid := NULL;
136692 l_adr_transaction_coa_id := NULL;
136693 l_adr_accounting_coa_id := NULL;
136694 l_adr_flexfield_segment_code := NULL;
136695 l_adr_flex_value_set_id := NULL;
136696 l_adr_value_type_code := NULL;
136697 l_adr_value_combination_id := NULL;
136698 l_adr_value_segment_code := NULL;
136699
136700 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
136701 l_bflow_class_code := ''; -- 4219869 Business Flow
136702 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
136703 l_budgetary_control_flag := 'N';
136704
136705 l_bflow_applied_to_amt_idx := NULL; -- 5132302
136706 l_bflow_applied_to_amt := NULL; -- 5132302
136707 l_entered_amt_idx := NULL; -- 4262811
136708 l_accted_amt_idx := NULL; -- 4262811
136709 l_acc_rev_flag := NULL; -- 4262811
136710 l_accrual_line_num := NULL; -- 4262811
136711 l_tmp_amt := NULL; -- 4262811
136712 --
136713
136714 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
136715 l_balance_type_code <> 'B' THEN
136716 IF NVL(p_source_48,'
136717 ') = 'EXPENSE' AND
136718 NVL(p_source_55,'
136719 ') = 'DEST'
136720 THEN
136721
136722 --
136723 XLA_AE_LINES_PKG.SetNewLine;
136724
136725 p_balance_type_code := l_balance_type_code;
136726 -- set the flag so later we will know whether the gain loss line needs to be created
136727
136728 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
136729 p_actual_flag :='A';
136730 END IF;
136731
136732 --
136733 -- bulk performance
136734 --
136735 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
136736 p_header_num => 0); -- 4262811
136737 --
136738 -- set accounting line options
136739 --
136740 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
136741 p_natural_side_code => 'D'
136742 , p_gain_or_loss_flag => 'N'
136743 , p_gl_transfer_mode_code => 'S'
136744 , p_acct_entry_type_code => 'A'
136745 , p_switch_side_flag => 'Y'
136746 , p_merge_duplicate_code => 'N'
136747 );
136748 --
136749 l_acc_rev_natural_side_code := 'C'; -- 4262811
136750 --
136751 --
136752 -- set accounting line type info
136753 --
136754 xla_ae_lines_pkg.SetAcctLineType
136755 (p_component_type => l_component_type
136756 ,p_event_type_code => l_event_type_code
136757 ,p_line_definition_owner_code => l_line_definition_owner_code
136758 ,p_line_definition_code => l_line_definition_code
136759 ,p_accounting_line_code => l_component_code
136760 ,p_accounting_line_type_code => l_component_type_code
136761 ,p_accounting_line_appl_id => l_component_appl_id
136765 --
136762 ,p_amb_context_code => l_amb_context_code
136763 ,p_entity_code => l_entity_code
136764 ,p_event_class_code => l_event_class_code);
136766 -- set accounting class
136767 --
136768 xla_ae_lines_pkg.SetAcctClass(
136769 p_accounting_class_code => 'EXPENSE'
136770 , p_ae_header_id => l_ae_header_id
136771 );
136772
136773 --
136774 -- set rounding class
136775 --
136776 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
136777 'EXPENSE';
136778
136779 --
136780 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
136781 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
136782 --
136783 -- bulk performance
136784 --
136785 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
136786
136787 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
136788 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
136789
136790 -- 4955764
136791 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
136792 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
136793
136794 -- 4458381 Public Sector Enh
136795
136796 --
136797 -- set accounting attributes for the line type
136798 --
136799 l_entered_amt_idx := 4;
136800 l_accted_amt_idx := 6;
136801 l_bflow_applied_to_amt_idx := NULL; -- 5132302
136802 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
136803 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
136804 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
136805 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
136806 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
136807 l_rec_acct_attrs.array_char_value(3) := p_source_51;
136808 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
136809 l_rec_acct_attrs.array_num_value(4) := p_source_52;
136810 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
136811 l_rec_acct_attrs.array_char_value(5) := p_source_53;
136812 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
136813 l_rec_acct_attrs.array_num_value(6) := p_source_52;
136814
136815 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
136816 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
136817
136818 ---------------------------------------------------------------------------------------------------------------
136819 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
136820 ---------------------------------------------------------------------------------------------------------------
136821 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
136822
136823 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
136824 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
136825
136826 IF xla_accounting_cache_pkg.GetValueChar
136827 (p_source_code => 'LEDGER_CATEGORY_CODE'
136828 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
136829 AND l_bflow_method_code = 'PRIOR_ENTRY'
136830 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
136831 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
136832 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
136833 )
136834 THEN
136835 xla_ae_lines_pkg.BflowUpgEntry
136836 (p_business_method_code => l_bflow_method_code
136837 ,p_business_class_code => l_bflow_class_code
136838 ,p_balance_type => l_balance_type_code);
136839 ELSE
136840 NULL;
136841 -- No business flow processing for business flow method of NONE.
136842 END IF;
136843
136844 --
136845 -- call analytical criteria
136846 --
136847
136848 --
136849 -- call description
136850 --
136851
136852 xla_ae_lines_pkg.SetLineDescription(
136853 p_ae_header_id => l_ae_header_id
136854 ,p_description => Description_112 (
136855 p_application_id => p_application_id
136856 , p_ae_header_id => l_ae_header_id
136857 , p_source_1 => p_source_1
136858 )
136859 );
136860
136861
136862 --
136863 -- call ADRs
136864 -- Bug 4922099
136865 --
136866 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
136867 (NVL(l_actual_upg_option, 'N') = 'O') OR
136868 (NVL(l_enc_upg_option, 'N') = 'O')
136869 )
136870 THEN
136871 NULL;
136872 --
136873 --
136874
136875 l_ccid := AcctDerRule_176(
136876 p_application_id => p_application_id
136877 , p_ae_header_id => l_ae_header_id
136878 , p_source_5 => p_source_5
136879 , p_source_31 => p_source_31
136880 , x_transaction_coa_id => l_adr_transaction_coa_id
136881 , x_accounting_coa_id => l_adr_accounting_coa_id
136882 , x_value_type_code => l_adr_value_type_code
136886 xla_ae_lines_pkg.set_ccid(
136883 , p_side => 'NA'
136884 );
136885
136887 p_code_combination_id => l_ccid
136888 , p_value_type_code => l_adr_value_type_code
136889 , p_transaction_coa_id => l_adr_transaction_coa_id
136890 , p_accounting_coa_id => l_adr_accounting_coa_id
136891 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
136892 , p_adr_type_code => 'S'
136893 , p_component_type => l_component_type
136894 , p_component_code => l_component_code
136895 , p_component_type_code => l_component_type_code
136896 , p_component_appl_id => l_component_appl_id
136897 , p_amb_context_code => l_amb_context_code
136898 , p_side => 'NA'
136899 );
136900
136901
136902 --
136903 --
136904 END IF;
136905 --
136906 -- Bug 4922099
136907 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
136908 (NVL(l_enc_upg_option, 'N') = 'O')
136909 ) AND
136910 (l_bflow_method_code = 'PRIOR_ENTRY')
136911 )
136912 THEN
136913 IF
136914 --
136915 1 = 2
136916 --
136917 THEN
136918 xla_accounting_err_pkg.build_message
136919 (p_appli_s_name => 'XLA'
136920 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
136921 ,p_token_1 => 'LINE_NUMBER'
136922 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
136923 ,p_token_2 => 'LINE_TYPE_NAME'
136924 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
136925 l_component_type
136926 ,l_component_code
136927 ,l_component_type_code
136928 ,l_component_appl_id
136929 ,l_amb_context_code
136930 ,l_entity_code
136931 ,l_event_class_code
136932 )
136933 ,p_token_3 => 'OWNER'
136934 ,p_value_3 => xla_lookups_pkg.get_meaning(
136935 p_lookup_type => 'XLA_OWNER_TYPE'
136936 ,p_lookup_code => l_component_type_code
136937 )
136938 ,p_token_4 => 'PRODUCT_NAME'
136939 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
136940 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
136941 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
136942 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
136943 ,p_ae_header_id => NULL
136944 );
136945
136946 IF (C_LEVEL_ERROR>= g_log_level) THEN
136947 trace
136948 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
136949 ,p_level => C_LEVEL_ERROR
136950 ,p_module => l_log_module);
136951 END IF;
136952 END IF;
136953 END IF;
136954 --
136955 --
136956 ------------------------------------------------------------------------------------------------
136957 -- 4219869 Business Flow
136958 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
136959 -- Prior Entry. Currently, the following code is always generated.
136960 ------------------------------------------------------------------------------------------------
136961 XLA_AE_LINES_PKG.ValidateCurrentLine;
136962
136963 ------------------------------------------------------------------------------------
136964 -- 4219869 Business Flow
136965 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
136966 ------------------------------------------------------------------------------------
136967 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
136968
136969 ----------------------------------------------------------------------------------
136970 -- 4219869 Business Flow
136971 -- Update journal entry status -- Need to generate this within IF <condition>
136972 ----------------------------------------------------------------------------------
136973 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
136974 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
136975 ,p_balance_type_code => l_balance_type_code
136976 );
136977
136978 -------------------------------------------------------------------------------------------
136979 -- 4262811 - Generate the Accrual Reversal lines
136980 -------------------------------------------------------------------------------------------
136984 IF l_acc_rev_flag IS NULL THEN
136981 BEGIN
136982 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
136983 (g_array_event(p_event_id).array_value_num('header_index'));
136985 l_acc_rev_flag := 'N';
136986 END IF;
136987 EXCEPTION
136988 WHEN OTHERS THEN
136989 l_acc_rev_flag := 'N';
136990 END;
136991 --
136992 IF (l_acc_rev_flag = 'Y') THEN
136993
136994 -- 4645092 ------------------------------------------------------------------------------
136995 -- To allow MPA report to determine if it should generate report process
136996 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
136997 ------------------------------------------------------------------------------------------
136998
136999 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
137000 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
137001 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
137002 -- call ADRs
137003 -- Bug 4922099
137004 --
137005 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
137006 (NVL(l_actual_upg_option, 'N') = 'O') OR
137007 (NVL(l_enc_upg_option, 'N') = 'O')
137008 )
137009 THEN
137010 NULL;
137011 --
137012 --
137013
137014 l_ccid := AcctDerRule_176(
137015 p_application_id => p_application_id
137016 , p_ae_header_id => l_ae_header_id
137017 , p_source_5 => p_source_5
137018 , p_source_31 => p_source_31
137019 , x_transaction_coa_id => l_adr_transaction_coa_id
137020 , x_accounting_coa_id => l_adr_accounting_coa_id
137021 , x_value_type_code => l_adr_value_type_code
137022 , p_side => 'NA'
137023 );
137024
137025 xla_ae_lines_pkg.set_ccid(
137026 p_code_combination_id => l_ccid
137027 , p_value_type_code => l_adr_value_type_code
137028 , p_transaction_coa_id => l_adr_transaction_coa_id
137029 , p_accounting_coa_id => l_adr_accounting_coa_id
137030 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
137031 , p_adr_type_code => 'S'
137032 , p_component_type => l_component_type
137033 , p_component_code => l_component_code
137034 , p_component_type_code => l_component_type_code
137035 , p_component_appl_id => l_component_appl_id
137036 , p_amb_context_code => l_amb_context_code
137037 , p_side => 'NA'
137038 );
137039
137040
137041 --
137042 --
137043 END IF;
137044
137045 --
137046 -- Update the line information that should be overwritten
137047 --
137048 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
137049 p_header_num => 1);
137050 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
137051
137052 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
137053
137054 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
137055 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
137056 END IF;
137057
137058 --
137059 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
137060 --
137061 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
137062 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
137063 ELSE
137064 ---------------------------------------------------------------------------------------------------
137065 -- 4262811a Switch Sign
137066 ---------------------------------------------------------------------------------------------------
137067 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
137068 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
137069 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
137070 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
137071 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
137072 -- 5132302
137073 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
137074 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
137075
137076 END IF;
137077
137078 -- 4955764
137079 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
137080 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
137081
137082
137083 XLA_AE_LINES_PKG.ValidateCurrentLine;
137084 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
137085
137086 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
137087 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
137088 ,p_balance_type_code => l_balance_type_code);
137089
137090 END IF;
137091
137092 -----------------------------------------------------------------------------------------
137096
137093 -- 4262811 Multiperiod Accounting
137094 -----------------------------------------------------------------------------------------
137095 -- No MPA option is assigned.
137097
137098 END IF;
137099 END IF;
137100 --
137101
137102 --
137103 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
137104 trace
137105 (p_msg => 'END of AcctLineType_356'
137106 ,p_level => C_LEVEL_PROCEDURE
137107 ,p_module => l_log_module);
137108 END IF;
137109 --
137110 EXCEPTION
137111 WHEN xla_exceptions_pkg.application_exception THEN
137112 RAISE;
137113 WHEN OTHERS THEN
137114 xla_exceptions_pkg.raise_message
137115 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_356');
137116 END AcctLineType_356;
137117 --
137118
137119 ---------------------------------------
137120 --
137121 -- PRIVATE FUNCTION
137122 -- AcctLineType_357
137123 --
137124 ---------------------------------------
137125 PROCEDURE AcctLineType_357 (
137126 p_application_id IN NUMBER
137127 ,p_event_id IN NUMBER
137128 ,p_calculate_acctd_flag IN VARCHAR2
137129 ,p_calculate_g_l_flag IN VARCHAR2
137130 ,p_actual_flag IN OUT VARCHAR2
137131 ,p_balance_type_code OUT VARCHAR2
137132 ,p_gain_or_loss_ref OUT VARCHAR2
137133
137134 --Period Close Date
137135 , p_source_1 IN DATE
137136 --Generated Code Combination Identifier
137137 , p_source_5 IN NUMBER
137138 --Depreciation Reserve Account
137139 , p_source_12 IN VARCHAR2
137140 --Generated Offset Code Combination Identifier
137141 , p_source_19 IN NUMBER
137142 --Expense Account Code Combination Identifier
137143 , p_source_31 IN NUMBER
137144 --Default Code Combination Identifier
137145 , p_source_32 IN NUMBER
137146 --Adjustment Type
137147 , p_source_48 IN VARCHAR2
137148 --Transaction Header Identifier
137149 , p_source_49 IN NUMBER
137150 --Adjustment Line Identifier
137151 , p_source_50 IN NUMBER
137152 --Distribution Type Code
137153 , p_source_51 IN VARCHAR2
137154 --Entered Amount
137155 , p_source_52 IN NUMBER
137156 --Currency Code
137157 , p_source_53 IN VARCHAR2
137158 --Source Destination Code
137159 , p_source_55 IN VARCHAR2
137160 )
137161 IS
137162
137163 l_component_type VARCHAR2(80);
137164 l_component_code VARCHAR2(30);
137165 l_component_type_code VARCHAR2(1);
137166 l_component_appl_id INTEGER;
137167 l_amb_context_code VARCHAR2(30);
137168 l_entity_code VARCHAR2(30);
137169 l_event_class_code VARCHAR2(30);
137170 l_ae_header_id NUMBER;
137171 l_event_type_code VARCHAR2(30);
137172 l_line_definition_code VARCHAR2(30);
137173 l_line_definition_owner_code VARCHAR2(1);
137174 --
137175 -- adr variables
137176 l_segment VARCHAR2(30);
137177 l_ccid NUMBER;
137178 l_adr_transaction_coa_id NUMBER;
137179 l_adr_accounting_coa_id NUMBER;
137180 l_adr_flexfield_segment_code VARCHAR2(30);
137181 l_adr_flex_value_set_id NUMBER;
137182 l_adr_value_type_code VARCHAR2(30);
137183 l_adr_value_combination_id NUMBER;
137184 l_adr_value_segment_code VARCHAR2(30);
137185
137186 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
137187 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
137188 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
137189 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
137190
137191 -- 4262811 Variables ------------------------------------------------------------------------------------------
137192 l_entered_amt_idx NUMBER;
137193 l_accted_amt_idx NUMBER;
137194 l_acc_rev_flag VARCHAR2(1);
137195 l_accrual_line_num NUMBER;
137196 l_tmp_amt NUMBER;
137197 l_acc_rev_natural_side_code VARCHAR2(1);
137198
137199 l_num_entries NUMBER;
137200 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
137201 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
137202 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
137203 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
137204 l_recog_line_1 NUMBER;
137205 l_recog_line_2 NUMBER;
137206
137207 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
137208 l_bflow_applied_to_amt NUMBER; -- 5132302
137209 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
137210
137211 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
137212
137213 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
137214 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
137215
137216 ---------------------------------------------------------------------------------------------------------------
137217
137218
137219 --
137220 -- bulk performance
137221 --
137222 l_balance_type_code VARCHAR2(1);
137223 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
137224 l_log_module VARCHAR2(240);
137225
137229 l_actual_upg_option VARCHAR2(1);
137226 --
137227 -- Upgrade strategy
137228 --
137230 l_enc_upg_option VARCHAR2(1);
137231
137232 --
137233 BEGIN
137234 --
137235 IF g_log_enabled THEN
137236 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_357';
137237 END IF;
137238 --
137239 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
137240
137241 trace
137242 (p_msg => 'BEGIN of AcctLineType_357'
137243 ,p_level => C_LEVEL_PROCEDURE
137244 ,p_module => l_log_module);
137245
137246 END IF;
137247 --
137248 l_component_type := 'AMB_JLT';
137249 l_component_code := 'FA_SLT_DEST_DEPRN_RESERVE';
137250 l_component_type_code := 'S';
137251 l_component_appl_id := 140;
137252 l_amb_context_code := 'DEFAULT';
137253 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
137254 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
137255 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
137256 l_line_definition_owner_code := 'S';
137257 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
137258 --
137259 l_balance_type_code := 'A';
137260 l_segment := NULL;
137261 l_ccid := NULL;
137262 l_adr_transaction_coa_id := NULL;
137263 l_adr_accounting_coa_id := NULL;
137264 l_adr_flexfield_segment_code := NULL;
137265 l_adr_flex_value_set_id := NULL;
137266 l_adr_value_type_code := NULL;
137267 l_adr_value_combination_id := NULL;
137268 l_adr_value_segment_code := NULL;
137269
137270 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
137271 l_bflow_class_code := ''; -- 4219869 Business Flow
137272 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
137273 l_budgetary_control_flag := 'N';
137274
137275 l_bflow_applied_to_amt_idx := NULL; -- 5132302
137276 l_bflow_applied_to_amt := NULL; -- 5132302
137277 l_entered_amt_idx := NULL; -- 4262811
137278 l_accted_amt_idx := NULL; -- 4262811
137279 l_acc_rev_flag := NULL; -- 4262811
137280 l_accrual_line_num := NULL; -- 4262811
137281 l_tmp_amt := NULL; -- 4262811
137282 --
137283
137284 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
137285 l_balance_type_code <> 'B' THEN
137286 IF (NVL(p_source_48,'
137287 ') = 'EXPENSE' OR
137288 NVL(p_source_48,'
137289 ') = 'RESERVE') AND
137290 NVL(p_source_55,'
137291 ') = 'DEST'
137292 THEN
137293
137294 --
137295 XLA_AE_LINES_PKG.SetNewLine;
137296
137297 p_balance_type_code := l_balance_type_code;
137298 -- set the flag so later we will know whether the gain loss line needs to be created
137299
137300 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
137301 p_actual_flag :='A';
137302 END IF;
137303
137304 --
137305 -- bulk performance
137306 --
137307 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
137308 p_header_num => 0); -- 4262811
137309 --
137310 -- set accounting line options
137311 --
137312 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
137313 p_natural_side_code => 'C'
137314 , p_gain_or_loss_flag => 'N'
137315 , p_gl_transfer_mode_code => 'S'
137316 , p_acct_entry_type_code => 'A'
137317 , p_switch_side_flag => 'Y'
137318 , p_merge_duplicate_code => 'N'
137319 );
137320 --
137321 l_acc_rev_natural_side_code := 'D'; -- 4262811
137322 --
137323 --
137324 -- set accounting line type info
137325 --
137326 xla_ae_lines_pkg.SetAcctLineType
137327 (p_component_type => l_component_type
137328 ,p_event_type_code => l_event_type_code
137329 ,p_line_definition_owner_code => l_line_definition_owner_code
137330 ,p_line_definition_code => l_line_definition_code
137331 ,p_accounting_line_code => l_component_code
137332 ,p_accounting_line_type_code => l_component_type_code
137333 ,p_accounting_line_appl_id => l_component_appl_id
137334 ,p_amb_context_code => l_amb_context_code
137335 ,p_entity_code => l_entity_code
137336 ,p_event_class_code => l_event_class_code);
137337 --
137338 -- set accounting class
137339 --
137340 xla_ae_lines_pkg.SetAcctClass(
137341 p_accounting_class_code => 'ASSET'
137342 , p_ae_header_id => l_ae_header_id
137343 );
137344
137345 --
137346 -- set rounding class
137347 --
137348 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
137349 'ASSET';
137350
137351 --
137352 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
137353 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
137354 --
137355 -- bulk performance
137356 --
137357 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
137358
137359 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
137363 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
137360 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
137361
137362 -- 4955764
137364 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
137365
137366 -- 4458381 Public Sector Enh
137367
137368 --
137369 -- set accounting attributes for the line type
137370 --
137371 l_entered_amt_idx := 4;
137372 l_accted_amt_idx := 6;
137373 l_bflow_applied_to_amt_idx := NULL; -- 5132302
137374 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
137375 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
137376 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
137377 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
137378 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
137379 l_rec_acct_attrs.array_char_value(3) := p_source_51;
137380 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
137381 l_rec_acct_attrs.array_num_value(4) := p_source_52;
137382 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
137383 l_rec_acct_attrs.array_char_value(5) := p_source_53;
137384 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
137385 l_rec_acct_attrs.array_num_value(6) := p_source_52;
137386
137387 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
137388 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
137389
137390 ---------------------------------------------------------------------------------------------------------------
137391 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
137392 ---------------------------------------------------------------------------------------------------------------
137393 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
137394
137395 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
137396 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
137397
137398 IF xla_accounting_cache_pkg.GetValueChar
137399 (p_source_code => 'LEDGER_CATEGORY_CODE'
137400 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
137401 AND l_bflow_method_code = 'PRIOR_ENTRY'
137402 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
137403 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
137404 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
137405 )
137406 THEN
137407 xla_ae_lines_pkg.BflowUpgEntry
137408 (p_business_method_code => l_bflow_method_code
137409 ,p_business_class_code => l_bflow_class_code
137410 ,p_balance_type => l_balance_type_code);
137411 ELSE
137412 NULL;
137413 -- No business flow processing for business flow method of NONE.
137414 END IF;
137415
137416 --
137417 -- call analytical criteria
137418 --
137419
137420 --
137421 -- call description
137422 --
137423
137424 xla_ae_lines_pkg.SetLineDescription(
137425 p_ae_header_id => l_ae_header_id
137426 ,p_description => Description_113 (
137427 p_application_id => p_application_id
137428 , p_ae_header_id => l_ae_header_id
137429 , p_source_1 => p_source_1
137430 )
137431 );
137432
137433
137434 --
137435 -- call ADRs
137436 -- Bug 4922099
137437 --
137438 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
137439 (NVL(l_actual_upg_option, 'N') = 'O') OR
137440 (NVL(l_enc_upg_option, 'N') = 'O')
137441 )
137442 THEN
137443 NULL;
137444 --
137445 --
137446
137447 l_ccid := AcctDerRule_175(
137448 p_application_id => p_application_id
137449 , p_ae_header_id => l_ae_header_id
137450 , p_source_5 => p_source_5
137451 , p_source_19 => p_source_19
137452 , p_source_32 => p_source_32
137453 , x_transaction_coa_id => l_adr_transaction_coa_id
137454 , x_accounting_coa_id => l_adr_accounting_coa_id
137455 , x_value_type_code => l_adr_value_type_code
137456 , p_side => 'NA'
137457 );
137458
137459 xla_ae_lines_pkg.set_ccid(
137460 p_code_combination_id => l_ccid
137461 , p_value_type_code => l_adr_value_type_code
137462 , p_transaction_coa_id => l_adr_transaction_coa_id
137463 , p_accounting_coa_id => l_adr_accounting_coa_id
137464 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
137465 , p_adr_type_code => 'S'
137466 , p_component_type => l_component_type
137467 , p_component_code => l_component_code
137468 , p_component_type_code => l_component_type_code
137469 , p_component_appl_id => l_component_appl_id
137470 , p_amb_context_code => l_amb_context_code
137471 , p_side => 'NA'
137472 );
137473
137474
137475 l_segment := AcctDerRule_150(
137476 p_application_id => p_application_id
137477 , p_ae_header_id => l_ae_header_id
137478 , p_source_5 => p_source_5
137479 , p_source_12 => p_source_12
137480 , x_transaction_coa_id => l_adr_transaction_coa_id
137484 , x_value_type_code => l_adr_value_type_code
137481 , x_accounting_coa_id => l_adr_accounting_coa_id
137482 , x_flexfield_segment_code => l_adr_flexfield_segment_code
137483 , x_flex_value_set_id => l_adr_flex_value_set_id
137485 , x_value_combination_id => l_adr_value_combination_id
137486 , x_value_segment_code => l_adr_value_segment_code
137487 , p_side => 'NA'
137488 , p_override_seg_flag => 'Y'
137489 );
137490
137491 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
137492
137493 xla_ae_lines_pkg.set_segment(
137494 p_to_segment_code => 'GL_ACCOUNT'
137495 , p_segment_value => l_segment
137496 , p_from_segment_code => l_adr_value_segment_code
137497 , p_from_combination_id => l_adr_value_combination_id
137498 , p_value_type_code => l_adr_value_type_code
137499 , p_transaction_coa_id => l_adr_transaction_coa_id
137500 , p_accounting_coa_id => l_adr_accounting_coa_id
137501 , p_flexfield_segment_code => l_adr_flexfield_segment_code
137502 , p_flex_value_set_id => l_adr_flex_value_set_id
137503 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
137504 , p_adr_type_code => 'S'
137505 , p_component_type => l_component_type
137506 , p_component_code => l_component_code
137507 , p_component_type_code => l_component_type_code
137508 , p_component_appl_id => l_component_appl_id
137509 , p_amb_context_code => l_amb_context_code
137510 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
137511 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
137512 , p_side => 'NA'
137513 );
137514
137515 END IF;
137516
137517 l_segment := AcctDerRule_169(
137518 p_application_id => p_application_id
137519 , p_ae_header_id => l_ae_header_id
137520 , p_source_5 => p_source_5
137521 , p_source_31 => p_source_31
137522 , x_transaction_coa_id => l_adr_transaction_coa_id
137523 , x_accounting_coa_id => l_adr_accounting_coa_id
137524 , x_flexfield_segment_code => l_adr_flexfield_segment_code
137525 , x_flex_value_set_id => l_adr_flex_value_set_id
137526 , x_value_type_code => l_adr_value_type_code
137527 , x_value_combination_id => l_adr_value_combination_id
137528 , x_value_segment_code => l_adr_value_segment_code
137529 , p_side => 'NA'
137530 , p_override_seg_flag => 'Y'
137531 );
137532
137533 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
137534
137535 xla_ae_lines_pkg.set_segment(
137536 p_to_segment_code => 'GL_BALANCING'
137537 , p_segment_value => l_segment
137538 , p_from_segment_code => l_adr_value_segment_code
137539 , p_from_combination_id => l_adr_value_combination_id
137540 , p_value_type_code => l_adr_value_type_code
137541 , p_transaction_coa_id => l_adr_transaction_coa_id
137542 , p_accounting_coa_id => l_adr_accounting_coa_id
137543 , p_flexfield_segment_code => l_adr_flexfield_segment_code
137544 , p_flex_value_set_id => l_adr_flex_value_set_id
137545 , p_adr_code => 'FA_EXPENSE_ACCT'
137546 , p_adr_type_code => 'S'
137547 , p_component_type => l_component_type
137548 , p_component_code => l_component_code
137549 , p_component_type_code => l_component_type_code
137550 , p_component_appl_id => l_component_appl_id
137551 , p_amb_context_code => l_amb_context_code
137552 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
137553 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
137554 , p_side => 'NA'
137555 );
137556
137557 END IF;
137558
137559 --
137560 --
137561 END IF;
137562 --
137563 -- Bug 4922099
137564 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
137565 (NVL(l_enc_upg_option, 'N') = 'O')
137566 ) AND
137567 (l_bflow_method_code = 'PRIOR_ENTRY')
137568 )
137569 THEN
137570 IF
137571 --
137572 1 = 2
137573 --
137574 THEN
137575 xla_accounting_err_pkg.build_message
137576 (p_appli_s_name => 'XLA'
137577 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
137578 ,p_token_1 => 'LINE_NUMBER'
137579 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
137580 ,p_token_2 => 'LINE_TYPE_NAME'
137581 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
137582 l_component_type
137583 ,l_component_code
137584 ,l_component_type_code
137585 ,l_component_appl_id
137586 ,l_amb_context_code
137590 ,p_token_3 => 'OWNER'
137587 ,l_entity_code
137588 ,l_event_class_code
137589 )
137591 ,p_value_3 => xla_lookups_pkg.get_meaning(
137592 p_lookup_type => 'XLA_OWNER_TYPE'
137593 ,p_lookup_code => l_component_type_code
137594 )
137595 ,p_token_4 => 'PRODUCT_NAME'
137596 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
137597 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
137598 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
137599 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
137600 ,p_ae_header_id => NULL
137601 );
137602
137603 IF (C_LEVEL_ERROR>= g_log_level) THEN
137604 trace
137605 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
137606 ,p_level => C_LEVEL_ERROR
137607 ,p_module => l_log_module);
137608 END IF;
137609 END IF;
137610 END IF;
137611 --
137612 --
137613 ------------------------------------------------------------------------------------------------
137614 -- 4219869 Business Flow
137615 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
137616 -- Prior Entry. Currently, the following code is always generated.
137617 ------------------------------------------------------------------------------------------------
137618 XLA_AE_LINES_PKG.ValidateCurrentLine;
137619
137620 ------------------------------------------------------------------------------------
137621 -- 4219869 Business Flow
137622 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
137623 ------------------------------------------------------------------------------------
137624 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
137625
137626 ----------------------------------------------------------------------------------
137627 -- 4219869 Business Flow
137628 -- Update journal entry status -- Need to generate this within IF <condition>
137629 ----------------------------------------------------------------------------------
137630 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
137631 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
137632 ,p_balance_type_code => l_balance_type_code
137633 );
137634
137635 -------------------------------------------------------------------------------------------
137636 -- 4262811 - Generate the Accrual Reversal lines
137637 -------------------------------------------------------------------------------------------
137638 BEGIN
137639 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
137640 (g_array_event(p_event_id).array_value_num('header_index'));
137641 IF l_acc_rev_flag IS NULL THEN
137642 l_acc_rev_flag := 'N';
137643 END IF;
137644 EXCEPTION
137645 WHEN OTHERS THEN
137646 l_acc_rev_flag := 'N';
137647 END;
137648 --
137649 IF (l_acc_rev_flag = 'Y') THEN
137650
137651 -- 4645092 ------------------------------------------------------------------------------
137652 -- To allow MPA report to determine if it should generate report process
137653 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
137654 ------------------------------------------------------------------------------------------
137655
137656 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
137657 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
137658 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
137659 -- call ADRs
137660 -- Bug 4922099
137661 --
137662 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
137663 (NVL(l_actual_upg_option, 'N') = 'O') OR
137664 (NVL(l_enc_upg_option, 'N') = 'O')
137665 )
137666 THEN
137667 NULL;
137668 --
137669 --
137670
137671 l_ccid := AcctDerRule_175(
137672 p_application_id => p_application_id
137673 , p_ae_header_id => l_ae_header_id
137674 , p_source_5 => p_source_5
137675 , p_source_19 => p_source_19
137676 , p_source_32 => p_source_32
137677 , x_transaction_coa_id => l_adr_transaction_coa_id
137678 , x_accounting_coa_id => l_adr_accounting_coa_id
137679 , x_value_type_code => l_adr_value_type_code
137680 , p_side => 'NA'
137681 );
137682
137683 xla_ae_lines_pkg.set_ccid(
137684 p_code_combination_id => l_ccid
137685 , p_value_type_code => l_adr_value_type_code
137686 , p_transaction_coa_id => l_adr_transaction_coa_id
137687 , p_accounting_coa_id => l_adr_accounting_coa_id
137691 , p_component_code => l_component_code
137688 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
137689 , p_adr_type_code => 'S'
137690 , p_component_type => l_component_type
137692 , p_component_type_code => l_component_type_code
137693 , p_component_appl_id => l_component_appl_id
137694 , p_amb_context_code => l_amb_context_code
137695 , p_side => 'NA'
137696 );
137697
137698
137699 l_segment := AcctDerRule_150(
137700 p_application_id => p_application_id
137701 , p_ae_header_id => l_ae_header_id
137702 , p_source_5 => p_source_5
137703 , p_source_12 => p_source_12
137704 , x_transaction_coa_id => l_adr_transaction_coa_id
137705 , x_accounting_coa_id => l_adr_accounting_coa_id
137706 , x_flexfield_segment_code => l_adr_flexfield_segment_code
137707 , x_flex_value_set_id => l_adr_flex_value_set_id
137708 , x_value_type_code => l_adr_value_type_code
137709 , x_value_combination_id => l_adr_value_combination_id
137710 , x_value_segment_code => l_adr_value_segment_code
137711 , p_side => 'NA'
137712 , p_override_seg_flag => 'Y'
137713 );
137714
137715 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
137716
137717 xla_ae_lines_pkg.set_segment(
137718 p_to_segment_code => 'GL_ACCOUNT'
137719 , p_segment_value => l_segment
137720 , p_from_segment_code => l_adr_value_segment_code
137721 , p_from_combination_id => l_adr_value_combination_id
137722 , p_value_type_code => l_adr_value_type_code
137723 , p_transaction_coa_id => l_adr_transaction_coa_id
137724 , p_accounting_coa_id => l_adr_accounting_coa_id
137725 , p_flexfield_segment_code => l_adr_flexfield_segment_code
137726 , p_flex_value_set_id => l_adr_flex_value_set_id
137727 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
137728 , p_adr_type_code => 'S'
137729 , p_component_type => l_component_type
137730 , p_component_code => l_component_code
137731 , p_component_type_code => l_component_type_code
137732 , p_component_appl_id => l_component_appl_id
137733 , p_amb_context_code => l_amb_context_code
137734 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
137735 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
137736 , p_side => 'NA'
137737 );
137738
137739 END IF;
137740
137741 l_segment := AcctDerRule_169(
137742 p_application_id => p_application_id
137743 , p_ae_header_id => l_ae_header_id
137744 , p_source_5 => p_source_5
137745 , p_source_31 => p_source_31
137746 , x_transaction_coa_id => l_adr_transaction_coa_id
137747 , x_accounting_coa_id => l_adr_accounting_coa_id
137748 , x_flexfield_segment_code => l_adr_flexfield_segment_code
137749 , x_flex_value_set_id => l_adr_flex_value_set_id
137750 , x_value_type_code => l_adr_value_type_code
137751 , x_value_combination_id => l_adr_value_combination_id
137752 , x_value_segment_code => l_adr_value_segment_code
137753 , p_side => 'NA'
137754 , p_override_seg_flag => 'Y'
137755 );
137756
137757 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
137758
137759 xla_ae_lines_pkg.set_segment(
137760 p_to_segment_code => 'GL_BALANCING'
137761 , p_segment_value => l_segment
137762 , p_from_segment_code => l_adr_value_segment_code
137763 , p_from_combination_id => l_adr_value_combination_id
137764 , p_value_type_code => l_adr_value_type_code
137765 , p_transaction_coa_id => l_adr_transaction_coa_id
137766 , p_accounting_coa_id => l_adr_accounting_coa_id
137767 , p_flexfield_segment_code => l_adr_flexfield_segment_code
137768 , p_flex_value_set_id => l_adr_flex_value_set_id
137769 , p_adr_code => 'FA_EXPENSE_ACCT'
137770 , p_adr_type_code => 'S'
137771 , p_component_type => l_component_type
137772 , p_component_code => l_component_code
137773 , p_component_type_code => l_component_type_code
137774 , p_component_appl_id => l_component_appl_id
137775 , p_amb_context_code => l_amb_context_code
137776 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
137777 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
137778 , p_side => 'NA'
137779 );
137780
137781 END IF;
137782
137783 --
137784 --
137785 END IF;
137786
137787 --
137788 -- Update the line information that should be overwritten
137789 --
137790 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
137791 p_header_num => 1);
137792 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
137793
137794 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
137795
137796 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
137800 --
137797 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
137798 END IF;
137799
137801 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
137802 --
137803 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
137804 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
137805 ELSE
137806 ---------------------------------------------------------------------------------------------------
137807 -- 4262811a Switch Sign
137808 ---------------------------------------------------------------------------------------------------
137809 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
137810 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
137811 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
137812 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
137813 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
137814 -- 5132302
137815 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
137816 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
137817
137818 END IF;
137819
137820 -- 4955764
137821 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
137822 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
137823
137824
137825 XLA_AE_LINES_PKG.ValidateCurrentLine;
137826 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
137827
137828 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
137829 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
137830 ,p_balance_type_code => l_balance_type_code);
137831
137832 END IF;
137833
137834 -----------------------------------------------------------------------------------------
137835 -- 4262811 Multiperiod Accounting
137836 -----------------------------------------------------------------------------------------
137837 -- No MPA option is assigned.
137838
137839
137840 END IF;
137841 END IF;
137842 --
137843
137844 --
137845 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
137846 trace
137847 (p_msg => 'END of AcctLineType_357'
137848 ,p_level => C_LEVEL_PROCEDURE
137849 ,p_module => l_log_module);
137850 END IF;
137851 --
137852 EXCEPTION
137853 WHEN xla_exceptions_pkg.application_exception THEN
137854 RAISE;
137855 WHEN OTHERS THEN
137856 xla_exceptions_pkg.raise_message
137857 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_357');
137858 END AcctLineType_357;
137859 --
137860
137861 ---------------------------------------
137862 --
137863 -- PRIVATE FUNCTION
137864 -- AcctLineType_358
137865 --
137866 ---------------------------------------
137867 PROCEDURE AcctLineType_358 (
137868 p_application_id IN NUMBER
137869 ,p_event_id IN NUMBER
137870 ,p_calculate_acctd_flag IN VARCHAR2
137871 ,p_calculate_g_l_flag IN VARCHAR2
137872 ,p_actual_flag IN OUT VARCHAR2
137873 ,p_balance_type_code OUT VARCHAR2
137874 ,p_gain_or_loss_ref OUT VARCHAR2
137875
137876 --Period Close Date
137877 , p_source_1 IN DATE
137878 --Generated Code Combination Identifier
137879 , p_source_5 IN NUMBER
137880 --Expense Account Code Combination Identifier
137881 , p_source_31 IN NUMBER
137882 --Adjustment Type
137883 , p_source_48 IN VARCHAR2
137884 --Transaction Header Identifier
137885 , p_source_49 IN NUMBER
137886 --Adjustment Line Identifier
137887 , p_source_50 IN NUMBER
137888 --Distribution Type Code
137889 , p_source_51 IN VARCHAR2
137890 --Entered Amount
137891 , p_source_52 IN NUMBER
137892 --Currency Code
137893 , p_source_53 IN VARCHAR2
137894 --Source Destination Code
137895 , p_source_55 IN VARCHAR2
137896 )
137897 IS
137898
137899 l_component_type VARCHAR2(80);
137900 l_component_code VARCHAR2(30);
137901 l_component_type_code VARCHAR2(1);
137902 l_component_appl_id INTEGER;
137903 l_amb_context_code VARCHAR2(30);
137904 l_entity_code VARCHAR2(30);
137905 l_event_class_code VARCHAR2(30);
137906 l_ae_header_id NUMBER;
137907 l_event_type_code VARCHAR2(30);
137908 l_line_definition_code VARCHAR2(30);
137909 l_line_definition_owner_code VARCHAR2(1);
137910 --
137911 -- adr variables
137912 l_segment VARCHAR2(30);
137913 l_ccid NUMBER;
137914 l_adr_transaction_coa_id NUMBER;
137915 l_adr_accounting_coa_id NUMBER;
137916 l_adr_flexfield_segment_code VARCHAR2(30);
137917 l_adr_flex_value_set_id NUMBER;
137918 l_adr_value_type_code VARCHAR2(30);
137919 l_adr_value_combination_id NUMBER;
137920 l_adr_value_segment_code VARCHAR2(30);
137921
137922 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
137923 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
137927 -- 4262811 Variables ------------------------------------------------------------------------------------------
137924 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
137925 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
137926
137928 l_entered_amt_idx NUMBER;
137929 l_accted_amt_idx NUMBER;
137930 l_acc_rev_flag VARCHAR2(1);
137931 l_accrual_line_num NUMBER;
137932 l_tmp_amt NUMBER;
137933 l_acc_rev_natural_side_code VARCHAR2(1);
137934
137935 l_num_entries NUMBER;
137936 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
137937 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
137938 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
137939 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
137940 l_recog_line_1 NUMBER;
137941 l_recog_line_2 NUMBER;
137942
137943 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
137944 l_bflow_applied_to_amt NUMBER; -- 5132302
137945 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
137946
137947 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
137948
137949 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
137950 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
137951
137952 ---------------------------------------------------------------------------------------------------------------
137953
137954
137955 --
137956 -- bulk performance
137957 --
137958 l_balance_type_code VARCHAR2(1);
137959 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
137960 l_log_module VARCHAR2(240);
137961
137962 --
137963 -- Upgrade strategy
137964 --
137965 l_actual_upg_option VARCHAR2(1);
137966 l_enc_upg_option VARCHAR2(1);
137967
137968 --
137969 BEGIN
137970 --
137971 IF g_log_enabled THEN
137972 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_358';
137973 END IF;
137974 --
137975 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
137976
137977 trace
137978 (p_msg => 'BEGIN of AcctLineType_358'
137979 ,p_level => C_LEVEL_PROCEDURE
137980 ,p_module => l_log_module);
137981
137982 END IF;
137983 --
137984 l_component_type := 'AMB_JLT';
137985 l_component_code := 'FA_SLT_DEST_EXP_BAL';
137986 l_component_type_code := 'S';
137987 l_component_appl_id := 140;
137988 l_amb_context_code := 'DEFAULT';
137989 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
137990 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
137991 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
137992 l_line_definition_owner_code := 'S';
137993 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
137994 --
137995 l_balance_type_code := 'A';
137996 l_segment := NULL;
137997 l_ccid := NULL;
137998 l_adr_transaction_coa_id := NULL;
137999 l_adr_accounting_coa_id := NULL;
138000 l_adr_flexfield_segment_code := NULL;
138001 l_adr_flex_value_set_id := NULL;
138002 l_adr_value_type_code := NULL;
138003 l_adr_value_combination_id := NULL;
138004 l_adr_value_segment_code := NULL;
138005
138006 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
138007 l_bflow_class_code := ''; -- 4219869 Business Flow
138008 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
138009 l_budgetary_control_flag := 'N';
138010
138011 l_bflow_applied_to_amt_idx := NULL; -- 5132302
138012 l_bflow_applied_to_amt := NULL; -- 5132302
138013 l_entered_amt_idx := NULL; -- 4262811
138014 l_accted_amt_idx := NULL; -- 4262811
138015 l_acc_rev_flag := NULL; -- 4262811
138016 l_accrual_line_num := NULL; -- 4262811
138017 l_tmp_amt := NULL; -- 4262811
138018 --
138019
138020 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
138021 l_balance_type_code <> 'B' THEN
138022 IF NVL(p_source_48,'
138023 ') = 'BONUS EXPENSE' AND
138024 NVL(p_source_55,'
138025 ') = 'DEST'
138026 THEN
138027
138028 --
138029 XLA_AE_LINES_PKG.SetNewLine;
138030
138031 p_balance_type_code := l_balance_type_code;
138032 -- set the flag so later we will know whether the gain loss line needs to be created
138033
138034 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
138035 p_actual_flag :='A';
138036 END IF;
138037
138038 --
138039 -- bulk performance
138040 --
138041 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
138042 p_header_num => 0); -- 4262811
138043 --
138044 -- set accounting line options
138045 --
138046 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
138047 p_natural_side_code => 'C'
138048 , p_gain_or_loss_flag => 'N'
138049 , p_gl_transfer_mode_code => 'S'
138050 , p_acct_entry_type_code => 'A'
138051 , p_switch_side_flag => 'Y'
138052 , p_merge_duplicate_code => 'N'
138056 --
138053 );
138054 --
138055 l_acc_rev_natural_side_code := 'D'; -- 4262811
138057 --
138058 -- set accounting line type info
138059 --
138060 xla_ae_lines_pkg.SetAcctLineType
138061 (p_component_type => l_component_type
138062 ,p_event_type_code => l_event_type_code
138063 ,p_line_definition_owner_code => l_line_definition_owner_code
138064 ,p_line_definition_code => l_line_definition_code
138065 ,p_accounting_line_code => l_component_code
138066 ,p_accounting_line_type_code => l_component_type_code
138067 ,p_accounting_line_appl_id => l_component_appl_id
138068 ,p_amb_context_code => l_amb_context_code
138069 ,p_entity_code => l_entity_code
138070 ,p_event_class_code => l_event_class_code);
138071 --
138072 -- set accounting class
138073 --
138074 xla_ae_lines_pkg.SetAcctClass(
138075 p_accounting_class_code => 'EXPENSE'
138076 , p_ae_header_id => l_ae_header_id
138077 );
138078
138079 --
138080 -- set rounding class
138081 --
138082 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
138083 'EXPENSE';
138084
138085 --
138086 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
138087 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
138088 --
138089 -- bulk performance
138090 --
138091 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
138092
138093 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
138094 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
138095
138096 -- 4955764
138097 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
138098 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
138099
138100 -- 4458381 Public Sector Enh
138101
138102 --
138103 -- set accounting attributes for the line type
138104 --
138105 l_entered_amt_idx := 4;
138106 l_accted_amt_idx := 6;
138107 l_bflow_applied_to_amt_idx := NULL; -- 5132302
138108 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
138109 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
138110 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
138111 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
138112 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
138113 l_rec_acct_attrs.array_char_value(3) := p_source_51;
138114 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
138115 l_rec_acct_attrs.array_num_value(4) := p_source_52;
138116 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
138117 l_rec_acct_attrs.array_char_value(5) := p_source_53;
138118 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
138119 l_rec_acct_attrs.array_num_value(6) := p_source_52;
138120
138121 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
138122 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
138123
138124 ---------------------------------------------------------------------------------------------------------------
138125 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
138126 ---------------------------------------------------------------------------------------------------------------
138127 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
138128
138129 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
138130 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
138131
138132 IF xla_accounting_cache_pkg.GetValueChar
138133 (p_source_code => 'LEDGER_CATEGORY_CODE'
138134 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
138135 AND l_bflow_method_code = 'PRIOR_ENTRY'
138136 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
138137 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
138138 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
138139 )
138140 THEN
138141 xla_ae_lines_pkg.BflowUpgEntry
138142 (p_business_method_code => l_bflow_method_code
138143 ,p_business_class_code => l_bflow_class_code
138144 ,p_balance_type => l_balance_type_code);
138145 ELSE
138146 NULL;
138147 -- No business flow processing for business flow method of NONE.
138148 END IF;
138149
138150 --
138151 -- call analytical criteria
138152 --
138153
138154 --
138155 -- call description
138156 --
138157
138158 xla_ae_lines_pkg.SetLineDescription(
138159 p_ae_header_id => l_ae_header_id
138160 ,p_description => Description_112 (
138161 p_application_id => p_application_id
138162 , p_ae_header_id => l_ae_header_id
138163 , p_source_1 => p_source_1
138164 )
138165 );
138166
138167
138168 --
138169 -- call ADRs
138170 -- Bug 4922099
138171 --
138175 )
138172 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
138173 (NVL(l_actual_upg_option, 'N') = 'O') OR
138174 (NVL(l_enc_upg_option, 'N') = 'O')
138176 THEN
138177 NULL;
138178 --
138179 --
138180
138181 l_ccid := AcctDerRule_176(
138182 p_application_id => p_application_id
138183 , p_ae_header_id => l_ae_header_id
138184 , p_source_5 => p_source_5
138185 , p_source_31 => p_source_31
138186 , x_transaction_coa_id => l_adr_transaction_coa_id
138187 , x_accounting_coa_id => l_adr_accounting_coa_id
138188 , x_value_type_code => l_adr_value_type_code
138189 , p_side => 'NA'
138190 );
138191
138192 xla_ae_lines_pkg.set_ccid(
138193 p_code_combination_id => l_ccid
138194 , p_value_type_code => l_adr_value_type_code
138195 , p_transaction_coa_id => l_adr_transaction_coa_id
138196 , p_accounting_coa_id => l_adr_accounting_coa_id
138197 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
138198 , p_adr_type_code => 'S'
138199 , p_component_type => l_component_type
138200 , p_component_code => l_component_code
138201 , p_component_type_code => l_component_type_code
138202 , p_component_appl_id => l_component_appl_id
138203 , p_amb_context_code => l_amb_context_code
138204 , p_side => 'NA'
138205 );
138206
138207
138208 --
138209 --
138210 END IF;
138211 --
138212 -- Bug 4922099
138213 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
138214 (NVL(l_enc_upg_option, 'N') = 'O')
138215 ) AND
138216 (l_bflow_method_code = 'PRIOR_ENTRY')
138217 )
138218 THEN
138219 IF
138220 --
138221 1 = 2
138222 --
138223 THEN
138224 xla_accounting_err_pkg.build_message
138225 (p_appli_s_name => 'XLA'
138226 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
138227 ,p_token_1 => 'LINE_NUMBER'
138228 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
138229 ,p_token_2 => 'LINE_TYPE_NAME'
138230 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
138231 l_component_type
138232 ,l_component_code
138233 ,l_component_type_code
138234 ,l_component_appl_id
138235 ,l_amb_context_code
138236 ,l_entity_code
138237 ,l_event_class_code
138238 )
138239 ,p_token_3 => 'OWNER'
138240 ,p_value_3 => xla_lookups_pkg.get_meaning(
138241 p_lookup_type => 'XLA_OWNER_TYPE'
138242 ,p_lookup_code => l_component_type_code
138243 )
138244 ,p_token_4 => 'PRODUCT_NAME'
138245 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
138246 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
138247 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
138248 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
138249 ,p_ae_header_id => NULL
138250 );
138251
138252 IF (C_LEVEL_ERROR>= g_log_level) THEN
138253 trace
138254 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
138255 ,p_level => C_LEVEL_ERROR
138256 ,p_module => l_log_module);
138257 END IF;
138258 END IF;
138259 END IF;
138260 --
138261 --
138262 ------------------------------------------------------------------------------------------------
138263 -- 4219869 Business Flow
138264 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
138265 -- Prior Entry. Currently, the following code is always generated.
138266 ------------------------------------------------------------------------------------------------
138267 XLA_AE_LINES_PKG.ValidateCurrentLine;
138268
138269 ------------------------------------------------------------------------------------
138270 -- 4219869 Business Flow
138271 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
138272 ------------------------------------------------------------------------------------
138276 -- 4219869 Business Flow
138273 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
138274
138275 ----------------------------------------------------------------------------------
138277 -- Update journal entry status -- Need to generate this within IF <condition>
138278 ----------------------------------------------------------------------------------
138279 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
138280 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
138281 ,p_balance_type_code => l_balance_type_code
138282 );
138283
138284 -------------------------------------------------------------------------------------------
138285 -- 4262811 - Generate the Accrual Reversal lines
138286 -------------------------------------------------------------------------------------------
138287 BEGIN
138288 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
138289 (g_array_event(p_event_id).array_value_num('header_index'));
138290 IF l_acc_rev_flag IS NULL THEN
138291 l_acc_rev_flag := 'N';
138292 END IF;
138293 EXCEPTION
138294 WHEN OTHERS THEN
138295 l_acc_rev_flag := 'N';
138296 END;
138297 --
138298 IF (l_acc_rev_flag = 'Y') THEN
138299
138300 -- 4645092 ------------------------------------------------------------------------------
138301 -- To allow MPA report to determine if it should generate report process
138302 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
138303 ------------------------------------------------------------------------------------------
138304
138305 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
138306 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
138307 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
138308 -- call ADRs
138309 -- Bug 4922099
138310 --
138311 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
138312 (NVL(l_actual_upg_option, 'N') = 'O') OR
138313 (NVL(l_enc_upg_option, 'N') = 'O')
138314 )
138315 THEN
138316 NULL;
138317 --
138318 --
138319
138320 l_ccid := AcctDerRule_176(
138321 p_application_id => p_application_id
138322 , p_ae_header_id => l_ae_header_id
138323 , p_source_5 => p_source_5
138324 , p_source_31 => p_source_31
138325 , x_transaction_coa_id => l_adr_transaction_coa_id
138326 , x_accounting_coa_id => l_adr_accounting_coa_id
138327 , x_value_type_code => l_adr_value_type_code
138328 , p_side => 'NA'
138329 );
138330
138331 xla_ae_lines_pkg.set_ccid(
138332 p_code_combination_id => l_ccid
138333 , p_value_type_code => l_adr_value_type_code
138334 , p_transaction_coa_id => l_adr_transaction_coa_id
138335 , p_accounting_coa_id => l_adr_accounting_coa_id
138336 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
138337 , p_adr_type_code => 'S'
138338 , p_component_type => l_component_type
138339 , p_component_code => l_component_code
138340 , p_component_type_code => l_component_type_code
138341 , p_component_appl_id => l_component_appl_id
138342 , p_amb_context_code => l_amb_context_code
138343 , p_side => 'NA'
138344 );
138345
138346
138347 --
138348 --
138349 END IF;
138350
138351 --
138352 -- Update the line information that should be overwritten
138353 --
138354 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
138355 p_header_num => 1);
138356 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
138357
138358 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
138359
138360 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
138361 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
138362 END IF;
138363
138364 --
138365 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
138366 --
138367 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
138368 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
138369 ELSE
138370 ---------------------------------------------------------------------------------------------------
138371 -- 4262811a Switch Sign
138372 ---------------------------------------------------------------------------------------------------
138373 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
138374 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
138375 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
138376 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
138377 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
138378 -- 5132302
138379 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
138383
138380 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
138381
138382 END IF;
138384 -- 4955764
138385 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
138386 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
138387
138388
138389 XLA_AE_LINES_PKG.ValidateCurrentLine;
138390 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
138391
138392 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
138393 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
138394 ,p_balance_type_code => l_balance_type_code);
138395
138396 END IF;
138397
138398 -----------------------------------------------------------------------------------------
138399 -- 4262811 Multiperiod Accounting
138400 -----------------------------------------------------------------------------------------
138401 -- No MPA option is assigned.
138402
138403
138404 END IF;
138405 END IF;
138406 --
138407
138408 --
138409 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
138410 trace
138411 (p_msg => 'END of AcctLineType_358'
138412 ,p_level => C_LEVEL_PROCEDURE
138413 ,p_module => l_log_module);
138414 END IF;
138415 --
138416 EXCEPTION
138417 WHEN xla_exceptions_pkg.application_exception THEN
138418 RAISE;
138419 WHEN OTHERS THEN
138420 xla_exceptions_pkg.raise_message
138421 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_358');
138422 END AcctLineType_358;
138423 --
138424
138425 ---------------------------------------
138426 --
138427 -- PRIVATE FUNCTION
138428 -- AcctLineType_359
138429 --
138430 ---------------------------------------
138431 PROCEDURE AcctLineType_359 (
138432 p_application_id IN NUMBER
138433 ,p_event_id IN NUMBER
138434 ,p_calculate_acctd_flag IN VARCHAR2
138435 ,p_calculate_g_l_flag IN VARCHAR2
138436 ,p_actual_flag IN OUT VARCHAR2
138437 ,p_balance_type_code OUT VARCHAR2
138438 ,p_gain_or_loss_ref OUT VARCHAR2
138439
138440 --Period Close Date
138441 , p_source_1 IN DATE
138442 --Generated Code Combination Identifier
138443 , p_source_5 IN NUMBER
138444 --Depreciation Reserve Account
138445 , p_source_12 IN VARCHAR2
138446 --Generated Offset Code Combination Identifier
138447 , p_source_19 IN NUMBER
138448 --Expense Account Code Combination Identifier
138449 , p_source_31 IN NUMBER
138450 --Default Code Combination Identifier
138451 , p_source_32 IN NUMBER
138452 --Adjustment Type
138453 , p_source_48 IN VARCHAR2
138454 --Transaction Header Identifier
138455 , p_source_49 IN NUMBER
138456 --Adjustment Line Identifier
138457 , p_source_50 IN NUMBER
138458 --Distribution Type Code
138459 , p_source_51 IN VARCHAR2
138460 --Entered Amount
138461 , p_source_52 IN NUMBER
138462 --Currency Code
138463 , p_source_53 IN VARCHAR2
138464 --Source Destination Code
138465 , p_source_55 IN VARCHAR2
138466 )
138467 IS
138468
138469 l_component_type VARCHAR2(80);
138470 l_component_code VARCHAR2(30);
138471 l_component_type_code VARCHAR2(1);
138472 l_component_appl_id INTEGER;
138473 l_amb_context_code VARCHAR2(30);
138474 l_entity_code VARCHAR2(30);
138475 l_event_class_code VARCHAR2(30);
138476 l_ae_header_id NUMBER;
138477 l_event_type_code VARCHAR2(30);
138478 l_line_definition_code VARCHAR2(30);
138479 l_line_definition_owner_code VARCHAR2(1);
138480 --
138481 -- adr variables
138482 l_segment VARCHAR2(30);
138483 l_ccid NUMBER;
138484 l_adr_transaction_coa_id NUMBER;
138485 l_adr_accounting_coa_id NUMBER;
138486 l_adr_flexfield_segment_code VARCHAR2(30);
138487 l_adr_flex_value_set_id NUMBER;
138488 l_adr_value_type_code VARCHAR2(30);
138489 l_adr_value_combination_id NUMBER;
138490 l_adr_value_segment_code VARCHAR2(30);
138491
138492 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
138493 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
138494 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
138495 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
138496
138497 -- 4262811 Variables ------------------------------------------------------------------------------------------
138498 l_entered_amt_idx NUMBER;
138499 l_accted_amt_idx NUMBER;
138500 l_acc_rev_flag VARCHAR2(1);
138501 l_accrual_line_num NUMBER;
138502 l_tmp_amt NUMBER;
138503 l_acc_rev_natural_side_code VARCHAR2(1);
138504
138505 l_num_entries NUMBER;
138506 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
138507 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
138508 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
138509 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
138510 l_recog_line_1 NUMBER;
138511 l_recog_line_2 NUMBER;
138512
138513 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
138517 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
138514 l_bflow_applied_to_amt NUMBER; -- 5132302
138515 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
138516
138518
138519 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
138520 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
138521
138522 ---------------------------------------------------------------------------------------------------------------
138523
138524
138525 --
138526 -- bulk performance
138527 --
138528 l_balance_type_code VARCHAR2(1);
138529 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
138530 l_log_module VARCHAR2(240);
138531
138532 --
138533 -- Upgrade strategy
138534 --
138535 l_actual_upg_option VARCHAR2(1);
138536 l_enc_upg_option VARCHAR2(1);
138537
138538 --
138539 BEGIN
138540 --
138541 IF g_log_enabled THEN
138542 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_359';
138543 END IF;
138544 --
138545 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
138546
138547 trace
138548 (p_msg => 'BEGIN of AcctLineType_359'
138549 ,p_level => C_LEVEL_PROCEDURE
138550 ,p_module => l_log_module);
138551
138552 END IF;
138553 --
138554 l_component_type := 'AMB_JLT';
138555 l_component_code := 'FA_SLT_DEST_RESERVE_BAL';
138556 l_component_type_code := 'S';
138557 l_component_appl_id := 140;
138558 l_amb_context_code := 'DEFAULT';
138559 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
138560 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
138561 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
138562 l_line_definition_owner_code := 'S';
138563 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
138564 --
138565 l_balance_type_code := 'A';
138566 l_segment := NULL;
138567 l_ccid := NULL;
138568 l_adr_transaction_coa_id := NULL;
138569 l_adr_accounting_coa_id := NULL;
138570 l_adr_flexfield_segment_code := NULL;
138571 l_adr_flex_value_set_id := NULL;
138572 l_adr_value_type_code := NULL;
138573 l_adr_value_combination_id := NULL;
138574 l_adr_value_segment_code := NULL;
138575
138576 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
138577 l_bflow_class_code := ''; -- 4219869 Business Flow
138578 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
138579 l_budgetary_control_flag := 'N';
138580
138581 l_bflow_applied_to_amt_idx := NULL; -- 5132302
138582 l_bflow_applied_to_amt := NULL; -- 5132302
138583 l_entered_amt_idx := NULL; -- 4262811
138584 l_accted_amt_idx := NULL; -- 4262811
138585 l_acc_rev_flag := NULL; -- 4262811
138586 l_accrual_line_num := NULL; -- 4262811
138587 l_tmp_amt := NULL; -- 4262811
138588 --
138589
138590 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
138591 l_balance_type_code <> 'B' THEN
138592 IF (NVL(p_source_48,'
138593 ') = 'BONUS EXPENSE' OR
138594 NVL(p_source_48,'
138595 ') = 'BONUS RESERVE') AND
138596 NVL(p_source_55,'
138597 ') = 'DEST'
138598 THEN
138599
138600 --
138601 XLA_AE_LINES_PKG.SetNewLine;
138602
138603 p_balance_type_code := l_balance_type_code;
138604 -- set the flag so later we will know whether the gain loss line needs to be created
138605
138606 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
138607 p_actual_flag :='A';
138608 END IF;
138609
138610 --
138611 -- bulk performance
138612 --
138613 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
138614 p_header_num => 0); -- 4262811
138615 --
138616 -- set accounting line options
138617 --
138618 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
138619 p_natural_side_code => 'D'
138620 , p_gain_or_loss_flag => 'N'
138621 , p_gl_transfer_mode_code => 'S'
138622 , p_acct_entry_type_code => 'A'
138623 , p_switch_side_flag => 'Y'
138624 , p_merge_duplicate_code => 'N'
138625 );
138626 --
138627 l_acc_rev_natural_side_code := 'C'; -- 4262811
138628 --
138629 --
138630 -- set accounting line type info
138631 --
138632 xla_ae_lines_pkg.SetAcctLineType
138633 (p_component_type => l_component_type
138634 ,p_event_type_code => l_event_type_code
138635 ,p_line_definition_owner_code => l_line_definition_owner_code
138636 ,p_line_definition_code => l_line_definition_code
138637 ,p_accounting_line_code => l_component_code
138638 ,p_accounting_line_type_code => l_component_type_code
138639 ,p_accounting_line_appl_id => l_component_appl_id
138640 ,p_amb_context_code => l_amb_context_code
138641 ,p_entity_code => l_entity_code
138642 ,p_event_class_code => l_event_class_code);
138643 --
138644 -- set accounting class
138645 --
138646 xla_ae_lines_pkg.SetAcctClass(
138650
138647 p_accounting_class_code => 'ASSET'
138648 , p_ae_header_id => l_ae_header_id
138649 );
138651 --
138652 -- set rounding class
138653 --
138654 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
138655 'ASSET';
138656
138657 --
138658 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
138659 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
138660 --
138661 -- bulk performance
138662 --
138663 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
138664
138665 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
138666 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
138667
138668 -- 4955764
138669 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
138670 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
138671
138672 -- 4458381 Public Sector Enh
138673
138674 --
138675 -- set accounting attributes for the line type
138676 --
138677 l_entered_amt_idx := 4;
138678 l_accted_amt_idx := 6;
138679 l_bflow_applied_to_amt_idx := NULL; -- 5132302
138680 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
138681 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
138682 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
138683 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
138684 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
138685 l_rec_acct_attrs.array_char_value(3) := p_source_51;
138686 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
138687 l_rec_acct_attrs.array_num_value(4) := p_source_52;
138688 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
138689 l_rec_acct_attrs.array_char_value(5) := p_source_53;
138690 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
138691 l_rec_acct_attrs.array_num_value(6) := p_source_52;
138692
138693 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
138694 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
138695
138696 ---------------------------------------------------------------------------------------------------------------
138697 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
138698 ---------------------------------------------------------------------------------------------------------------
138699 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
138700
138701 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
138702 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
138703
138704 IF xla_accounting_cache_pkg.GetValueChar
138705 (p_source_code => 'LEDGER_CATEGORY_CODE'
138706 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
138707 AND l_bflow_method_code = 'PRIOR_ENTRY'
138708 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
138709 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
138710 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
138711 )
138712 THEN
138713 xla_ae_lines_pkg.BflowUpgEntry
138714 (p_business_method_code => l_bflow_method_code
138715 ,p_business_class_code => l_bflow_class_code
138716 ,p_balance_type => l_balance_type_code);
138717 ELSE
138718 NULL;
138719 -- No business flow processing for business flow method of NONE.
138720 END IF;
138721
138722 --
138723 -- call analytical criteria
138724 --
138725
138726 --
138727 -- call description
138728 --
138729
138730 xla_ae_lines_pkg.SetLineDescription(
138731 p_ae_header_id => l_ae_header_id
138732 ,p_description => Description_113 (
138733 p_application_id => p_application_id
138734 , p_ae_header_id => l_ae_header_id
138735 , p_source_1 => p_source_1
138736 )
138737 );
138738
138739
138740 --
138741 -- call ADRs
138742 -- Bug 4922099
138743 --
138744 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
138745 (NVL(l_actual_upg_option, 'N') = 'O') OR
138746 (NVL(l_enc_upg_option, 'N') = 'O')
138747 )
138748 THEN
138749 NULL;
138750 --
138751 --
138752
138753 l_ccid := AcctDerRule_175(
138754 p_application_id => p_application_id
138755 , p_ae_header_id => l_ae_header_id
138756 , p_source_5 => p_source_5
138757 , p_source_19 => p_source_19
138758 , p_source_32 => p_source_32
138759 , x_transaction_coa_id => l_adr_transaction_coa_id
138760 , x_accounting_coa_id => l_adr_accounting_coa_id
138761 , x_value_type_code => l_adr_value_type_code
138762 , p_side => 'NA'
138763 );
138764
138765 xla_ae_lines_pkg.set_ccid(
138766 p_code_combination_id => l_ccid
138767 , p_value_type_code => l_adr_value_type_code
138771 , p_adr_type_code => 'S'
138768 , p_transaction_coa_id => l_adr_transaction_coa_id
138769 , p_accounting_coa_id => l_adr_accounting_coa_id
138770 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
138772 , p_component_type => l_component_type
138773 , p_component_code => l_component_code
138774 , p_component_type_code => l_component_type_code
138775 , p_component_appl_id => l_component_appl_id
138776 , p_amb_context_code => l_amb_context_code
138777 , p_side => 'NA'
138778 );
138779
138780
138781 l_segment := AcctDerRule_150(
138782 p_application_id => p_application_id
138783 , p_ae_header_id => l_ae_header_id
138784 , p_source_5 => p_source_5
138785 , p_source_12 => p_source_12
138786 , x_transaction_coa_id => l_adr_transaction_coa_id
138787 , x_accounting_coa_id => l_adr_accounting_coa_id
138788 , x_flexfield_segment_code => l_adr_flexfield_segment_code
138789 , x_flex_value_set_id => l_adr_flex_value_set_id
138790 , x_value_type_code => l_adr_value_type_code
138791 , x_value_combination_id => l_adr_value_combination_id
138792 , x_value_segment_code => l_adr_value_segment_code
138793 , p_side => 'NA'
138794 , p_override_seg_flag => 'Y'
138795 );
138796
138797 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
138798
138799 xla_ae_lines_pkg.set_segment(
138800 p_to_segment_code => 'GL_ACCOUNT'
138801 , p_segment_value => l_segment
138802 , p_from_segment_code => l_adr_value_segment_code
138803 , p_from_combination_id => l_adr_value_combination_id
138804 , p_value_type_code => l_adr_value_type_code
138805 , p_transaction_coa_id => l_adr_transaction_coa_id
138806 , p_accounting_coa_id => l_adr_accounting_coa_id
138807 , p_flexfield_segment_code => l_adr_flexfield_segment_code
138808 , p_flex_value_set_id => l_adr_flex_value_set_id
138809 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
138810 , p_adr_type_code => 'S'
138811 , p_component_type => l_component_type
138812 , p_component_code => l_component_code
138813 , p_component_type_code => l_component_type_code
138814 , p_component_appl_id => l_component_appl_id
138815 , p_amb_context_code => l_amb_context_code
138816 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
138817 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
138818 , p_side => 'NA'
138819 );
138820
138821 END IF;
138822
138823 l_segment := AcctDerRule_169(
138824 p_application_id => p_application_id
138825 , p_ae_header_id => l_ae_header_id
138826 , p_source_5 => p_source_5
138827 , p_source_31 => p_source_31
138828 , x_transaction_coa_id => l_adr_transaction_coa_id
138829 , x_accounting_coa_id => l_adr_accounting_coa_id
138830 , x_flexfield_segment_code => l_adr_flexfield_segment_code
138831 , x_flex_value_set_id => l_adr_flex_value_set_id
138832 , x_value_type_code => l_adr_value_type_code
138833 , x_value_combination_id => l_adr_value_combination_id
138834 , x_value_segment_code => l_adr_value_segment_code
138835 , p_side => 'NA'
138836 , p_override_seg_flag => 'Y'
138837 );
138838
138839 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
138840
138841 xla_ae_lines_pkg.set_segment(
138842 p_to_segment_code => 'GL_BALANCING'
138843 , p_segment_value => l_segment
138844 , p_from_segment_code => l_adr_value_segment_code
138845 , p_from_combination_id => l_adr_value_combination_id
138846 , p_value_type_code => l_adr_value_type_code
138847 , p_transaction_coa_id => l_adr_transaction_coa_id
138848 , p_accounting_coa_id => l_adr_accounting_coa_id
138849 , p_flexfield_segment_code => l_adr_flexfield_segment_code
138850 , p_flex_value_set_id => l_adr_flex_value_set_id
138851 , p_adr_code => 'FA_EXPENSE_ACCT'
138852 , p_adr_type_code => 'S'
138853 , p_component_type => l_component_type
138854 , p_component_code => l_component_code
138855 , p_component_type_code => l_component_type_code
138856 , p_component_appl_id => l_component_appl_id
138857 , p_amb_context_code => l_amb_context_code
138858 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
138859 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
138860 , p_side => 'NA'
138861 );
138862
138863 END IF;
138864
138865 --
138866 --
138867 END IF;
138868 --
138869 -- Bug 4922099
138870 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
138871 (NVL(l_enc_upg_option, 'N') = 'O')
138872 ) AND
138873 (l_bflow_method_code = 'PRIOR_ENTRY')
138874 )
138875 THEN
138876 IF
138877 --
138878 1 = 2
138879 --
138880 THEN
138881 xla_accounting_err_pkg.build_message
138885 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
138882 (p_appli_s_name => 'XLA'
138883 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
138884 ,p_token_1 => 'LINE_NUMBER'
138886 ,p_token_2 => 'LINE_TYPE_NAME'
138887 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
138888 l_component_type
138889 ,l_component_code
138890 ,l_component_type_code
138891 ,l_component_appl_id
138892 ,l_amb_context_code
138893 ,l_entity_code
138894 ,l_event_class_code
138895 )
138896 ,p_token_3 => 'OWNER'
138897 ,p_value_3 => xla_lookups_pkg.get_meaning(
138898 p_lookup_type => 'XLA_OWNER_TYPE'
138899 ,p_lookup_code => l_component_type_code
138900 )
138901 ,p_token_4 => 'PRODUCT_NAME'
138902 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
138903 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
138904 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
138905 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
138906 ,p_ae_header_id => NULL
138907 );
138908
138909 IF (C_LEVEL_ERROR>= g_log_level) THEN
138910 trace
138911 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
138912 ,p_level => C_LEVEL_ERROR
138913 ,p_module => l_log_module);
138914 END IF;
138915 END IF;
138916 END IF;
138917 --
138918 --
138919 ------------------------------------------------------------------------------------------------
138920 -- 4219869 Business Flow
138921 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
138922 -- Prior Entry. Currently, the following code is always generated.
138923 ------------------------------------------------------------------------------------------------
138924 XLA_AE_LINES_PKG.ValidateCurrentLine;
138925
138926 ------------------------------------------------------------------------------------
138927 -- 4219869 Business Flow
138928 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
138929 ------------------------------------------------------------------------------------
138930 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
138931
138932 ----------------------------------------------------------------------------------
138933 -- 4219869 Business Flow
138934 -- Update journal entry status -- Need to generate this within IF <condition>
138935 ----------------------------------------------------------------------------------
138936 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
138937 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
138938 ,p_balance_type_code => l_balance_type_code
138939 );
138940
138941 -------------------------------------------------------------------------------------------
138942 -- 4262811 - Generate the Accrual Reversal lines
138943 -------------------------------------------------------------------------------------------
138944 BEGIN
138945 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
138946 (g_array_event(p_event_id).array_value_num('header_index'));
138947 IF l_acc_rev_flag IS NULL THEN
138948 l_acc_rev_flag := 'N';
138949 END IF;
138950 EXCEPTION
138951 WHEN OTHERS THEN
138952 l_acc_rev_flag := 'N';
138953 END;
138954 --
138955 IF (l_acc_rev_flag = 'Y') THEN
138956
138957 -- 4645092 ------------------------------------------------------------------------------
138958 -- To allow MPA report to determine if it should generate report process
138959 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
138960 ------------------------------------------------------------------------------------------
138961
138962 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
138963 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
138964 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
138965 -- call ADRs
138966 -- Bug 4922099
138967 --
138968 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
138969 (NVL(l_actual_upg_option, 'N') = 'O') OR
138970 (NVL(l_enc_upg_option, 'N') = 'O')
138974 --
138971 )
138972 THEN
138973 NULL;
138975 --
138976
138977 l_ccid := AcctDerRule_175(
138978 p_application_id => p_application_id
138979 , p_ae_header_id => l_ae_header_id
138980 , p_source_5 => p_source_5
138981 , p_source_19 => p_source_19
138982 , p_source_32 => p_source_32
138983 , x_transaction_coa_id => l_adr_transaction_coa_id
138984 , x_accounting_coa_id => l_adr_accounting_coa_id
138985 , x_value_type_code => l_adr_value_type_code
138986 , p_side => 'NA'
138987 );
138988
138989 xla_ae_lines_pkg.set_ccid(
138990 p_code_combination_id => l_ccid
138991 , p_value_type_code => l_adr_value_type_code
138992 , p_transaction_coa_id => l_adr_transaction_coa_id
138993 , p_accounting_coa_id => l_adr_accounting_coa_id
138994 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
138995 , p_adr_type_code => 'S'
138996 , p_component_type => l_component_type
138997 , p_component_code => l_component_code
138998 , p_component_type_code => l_component_type_code
138999 , p_component_appl_id => l_component_appl_id
139000 , p_amb_context_code => l_amb_context_code
139001 , p_side => 'NA'
139002 );
139003
139004
139005 l_segment := AcctDerRule_150(
139006 p_application_id => p_application_id
139007 , p_ae_header_id => l_ae_header_id
139008 , p_source_5 => p_source_5
139009 , p_source_12 => p_source_12
139010 , x_transaction_coa_id => l_adr_transaction_coa_id
139011 , x_accounting_coa_id => l_adr_accounting_coa_id
139012 , x_flexfield_segment_code => l_adr_flexfield_segment_code
139013 , x_flex_value_set_id => l_adr_flex_value_set_id
139014 , x_value_type_code => l_adr_value_type_code
139015 , x_value_combination_id => l_adr_value_combination_id
139016 , x_value_segment_code => l_adr_value_segment_code
139017 , p_side => 'NA'
139018 , p_override_seg_flag => 'Y'
139019 );
139020
139021 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
139022
139023 xla_ae_lines_pkg.set_segment(
139024 p_to_segment_code => 'GL_ACCOUNT'
139025 , p_segment_value => l_segment
139026 , p_from_segment_code => l_adr_value_segment_code
139027 , p_from_combination_id => l_adr_value_combination_id
139028 , p_value_type_code => l_adr_value_type_code
139029 , p_transaction_coa_id => l_adr_transaction_coa_id
139030 , p_accounting_coa_id => l_adr_accounting_coa_id
139031 , p_flexfield_segment_code => l_adr_flexfield_segment_code
139032 , p_flex_value_set_id => l_adr_flex_value_set_id
139033 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
139034 , p_adr_type_code => 'S'
139035 , p_component_type => l_component_type
139036 , p_component_code => l_component_code
139037 , p_component_type_code => l_component_type_code
139038 , p_component_appl_id => l_component_appl_id
139039 , p_amb_context_code => l_amb_context_code
139040 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
139041 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
139042 , p_side => 'NA'
139043 );
139044
139045 END IF;
139046
139047 l_segment := AcctDerRule_169(
139048 p_application_id => p_application_id
139049 , p_ae_header_id => l_ae_header_id
139050 , p_source_5 => p_source_5
139051 , p_source_31 => p_source_31
139052 , x_transaction_coa_id => l_adr_transaction_coa_id
139053 , x_accounting_coa_id => l_adr_accounting_coa_id
139054 , x_flexfield_segment_code => l_adr_flexfield_segment_code
139055 , x_flex_value_set_id => l_adr_flex_value_set_id
139056 , x_value_type_code => l_adr_value_type_code
139057 , x_value_combination_id => l_adr_value_combination_id
139058 , x_value_segment_code => l_adr_value_segment_code
139059 , p_side => 'NA'
139060 , p_override_seg_flag => 'Y'
139061 );
139062
139063 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
139064
139065 xla_ae_lines_pkg.set_segment(
139066 p_to_segment_code => 'GL_BALANCING'
139067 , p_segment_value => l_segment
139068 , p_from_segment_code => l_adr_value_segment_code
139069 , p_from_combination_id => l_adr_value_combination_id
139070 , p_value_type_code => l_adr_value_type_code
139071 , p_transaction_coa_id => l_adr_transaction_coa_id
139072 , p_accounting_coa_id => l_adr_accounting_coa_id
139073 , p_flexfield_segment_code => l_adr_flexfield_segment_code
139074 , p_flex_value_set_id => l_adr_flex_value_set_id
139075 , p_adr_code => 'FA_EXPENSE_ACCT'
139076 , p_adr_type_code => 'S'
139077 , p_component_type => l_component_type
139078 , p_component_code => l_component_code
139079 , p_component_type_code => l_component_type_code
139080 , p_component_appl_id => l_component_appl_id
139081 , p_amb_context_code => l_amb_context_code
139085 );
139082 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
139083 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
139084 , p_side => 'NA'
139086
139087 END IF;
139088
139089 --
139090 --
139091 END IF;
139092
139093 --
139094 -- Update the line information that should be overwritten
139095 --
139096 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
139097 p_header_num => 1);
139098 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
139099
139100 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
139101
139102 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
139103 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
139104 END IF;
139105
139106 --
139107 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
139108 --
139109 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
139110 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
139111 ELSE
139112 ---------------------------------------------------------------------------------------------------
139113 -- 4262811a Switch Sign
139114 ---------------------------------------------------------------------------------------------------
139115 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
139116 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
139117 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
139118 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
139119 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
139120 -- 5132302
139121 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
139122 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
139123
139124 END IF;
139125
139126 -- 4955764
139127 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
139128 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
139129
139130
139131 XLA_AE_LINES_PKG.ValidateCurrentLine;
139132 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
139133
139134 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
139135 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
139136 ,p_balance_type_code => l_balance_type_code);
139137
139138 END IF;
139139
139140 -----------------------------------------------------------------------------------------
139141 -- 4262811 Multiperiod Accounting
139142 -----------------------------------------------------------------------------------------
139143 -- No MPA option is assigned.
139144
139145
139146 END IF;
139147 END IF;
139148 --
139149
139150 --
139151 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
139152 trace
139153 (p_msg => 'END of AcctLineType_359'
139154 ,p_level => C_LEVEL_PROCEDURE
139155 ,p_module => l_log_module);
139156 END IF;
139157 --
139158 EXCEPTION
139159 WHEN xla_exceptions_pkg.application_exception THEN
139160 RAISE;
139161 WHEN OTHERS THEN
139162 xla_exceptions_pkg.raise_message
139163 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_359');
139164 END AcctLineType_359;
139165 --
139166
139167 ---------------------------------------
139168 --
139169 -- PRIVATE FUNCTION
139170 -- AcctLineType_360
139171 --
139172 ---------------------------------------
139173 PROCEDURE AcctLineType_360 (
139174 p_application_id IN NUMBER
139175 ,p_event_id IN NUMBER
139176 ,p_calculate_acctd_flag IN VARCHAR2
139177 ,p_calculate_g_l_flag IN VARCHAR2
139178 ,p_actual_flag IN OUT VARCHAR2
139179 ,p_balance_type_code OUT VARCHAR2
139180 ,p_gain_or_loss_ref OUT VARCHAR2
139181
139182 --Period Close Date
139183 , p_source_1 IN DATE
139184 --Generated Code Combination Identifier
139185 , p_source_5 IN NUMBER
139186 --Revaluation Reserve Account
139187 , p_source_13 IN VARCHAR2
139188 --Generated Offset Code Combination Identifier
139189 , p_source_19 IN NUMBER
139190 --Expense Account Code Combination Identifier
139191 , p_source_31 IN NUMBER
139192 --Default Code Combination Identifier
139193 , p_source_32 IN NUMBER
139194 --Adjustment Type
139195 , p_source_48 IN VARCHAR2
139196 --Transaction Header Identifier
139197 , p_source_49 IN NUMBER
139198 --Adjustment Line Identifier
139199 , p_source_50 IN NUMBER
139200 --Distribution Type Code
139201 , p_source_51 IN VARCHAR2
139202 --Entered Amount
139203 , p_source_52 IN NUMBER
139204 --Currency Code
139205 , p_source_53 IN VARCHAR2
139206 --Source Destination Code
139210
139207 , p_source_55 IN VARCHAR2
139208 )
139209 IS
139211 l_component_type VARCHAR2(80);
139212 l_component_code VARCHAR2(30);
139213 l_component_type_code VARCHAR2(1);
139214 l_component_appl_id INTEGER;
139215 l_amb_context_code VARCHAR2(30);
139216 l_entity_code VARCHAR2(30);
139217 l_event_class_code VARCHAR2(30);
139218 l_ae_header_id NUMBER;
139219 l_event_type_code VARCHAR2(30);
139220 l_line_definition_code VARCHAR2(30);
139221 l_line_definition_owner_code VARCHAR2(1);
139222 --
139223 -- adr variables
139224 l_segment VARCHAR2(30);
139225 l_ccid NUMBER;
139226 l_adr_transaction_coa_id NUMBER;
139227 l_adr_accounting_coa_id NUMBER;
139228 l_adr_flexfield_segment_code VARCHAR2(30);
139229 l_adr_flex_value_set_id NUMBER;
139230 l_adr_value_type_code VARCHAR2(30);
139231 l_adr_value_combination_id NUMBER;
139232 l_adr_value_segment_code VARCHAR2(30);
139233
139234 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
139235 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
139236 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
139237 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
139238
139239 -- 4262811 Variables ------------------------------------------------------------------------------------------
139240 l_entered_amt_idx NUMBER;
139241 l_accted_amt_idx NUMBER;
139242 l_acc_rev_flag VARCHAR2(1);
139243 l_accrual_line_num NUMBER;
139244 l_tmp_amt NUMBER;
139245 l_acc_rev_natural_side_code VARCHAR2(1);
139246
139247 l_num_entries NUMBER;
139248 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
139249 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
139250 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
139251 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
139252 l_recog_line_1 NUMBER;
139253 l_recog_line_2 NUMBER;
139254
139255 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
139256 l_bflow_applied_to_amt NUMBER; -- 5132302
139257 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
139258
139259 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
139260
139261 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
139262 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
139263
139264 ---------------------------------------------------------------------------------------------------------------
139265
139266
139267 --
139268 -- bulk performance
139269 --
139270 l_balance_type_code VARCHAR2(1);
139271 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
139272 l_log_module VARCHAR2(240);
139273
139274 --
139275 -- Upgrade strategy
139276 --
139277 l_actual_upg_option VARCHAR2(1);
139278 l_enc_upg_option VARCHAR2(1);
139279
139280 --
139281 BEGIN
139282 --
139283 IF g_log_enabled THEN
139284 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_360';
139285 END IF;
139286 --
139287 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
139288
139289 trace
139290 (p_msg => 'BEGIN of AcctLineType_360'
139291 ,p_level => C_LEVEL_PROCEDURE
139292 ,p_module => l_log_module);
139293
139294 END IF;
139295 --
139296 l_component_type := 'AMB_JLT';
139297 l_component_code := 'FA_SLT_DEST_REVAL_RESERVE';
139298 l_component_type_code := 'S';
139299 l_component_appl_id := 140;
139300 l_amb_context_code := 'DEFAULT';
139301 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
139302 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
139303 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
139304 l_line_definition_owner_code := 'S';
139305 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
139306 --
139307 l_balance_type_code := 'A';
139308 l_segment := NULL;
139309 l_ccid := NULL;
139310 l_adr_transaction_coa_id := NULL;
139311 l_adr_accounting_coa_id := NULL;
139312 l_adr_flexfield_segment_code := NULL;
139313 l_adr_flex_value_set_id := NULL;
139314 l_adr_value_type_code := NULL;
139315 l_adr_value_combination_id := NULL;
139316 l_adr_value_segment_code := NULL;
139317
139318 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
139319 l_bflow_class_code := ''; -- 4219869 Business Flow
139320 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
139321 l_budgetary_control_flag := 'N';
139322
139323 l_bflow_applied_to_amt_idx := NULL; -- 5132302
139324 l_bflow_applied_to_amt := NULL; -- 5132302
139325 l_entered_amt_idx := NULL; -- 4262811
139326 l_accted_amt_idx := NULL; -- 4262811
139327 l_acc_rev_flag := NULL; -- 4262811
139328 l_accrual_line_num := NULL; -- 4262811
139329 l_tmp_amt := NULL; -- 4262811
139330 --
139331
139335 ') = 'REVAL RESERVE' AND
139332 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
139333 l_balance_type_code <> 'B' THEN
139334 IF NVL(p_source_48,'
139336 NVL(p_source_55,'
139337 ') = 'DEST'
139338 THEN
139339
139340 --
139341 XLA_AE_LINES_PKG.SetNewLine;
139342
139343 p_balance_type_code := l_balance_type_code;
139344 -- set the flag so later we will know whether the gain loss line needs to be created
139345
139346 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
139347 p_actual_flag :='A';
139348 END IF;
139349
139350 --
139351 -- bulk performance
139352 --
139353 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
139354 p_header_num => 0); -- 4262811
139355 --
139356 -- set accounting line options
139357 --
139358 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
139359 p_natural_side_code => 'C'
139360 , p_gain_or_loss_flag => 'N'
139361 , p_gl_transfer_mode_code => 'S'
139362 , p_acct_entry_type_code => 'A'
139363 , p_switch_side_flag => 'Y'
139364 , p_merge_duplicate_code => 'N'
139365 );
139366 --
139367 l_acc_rev_natural_side_code := 'D'; -- 4262811
139368 --
139369 --
139370 -- set accounting line type info
139371 --
139372 xla_ae_lines_pkg.SetAcctLineType
139373 (p_component_type => l_component_type
139374 ,p_event_type_code => l_event_type_code
139375 ,p_line_definition_owner_code => l_line_definition_owner_code
139376 ,p_line_definition_code => l_line_definition_code
139377 ,p_accounting_line_code => l_component_code
139378 ,p_accounting_line_type_code => l_component_type_code
139379 ,p_accounting_line_appl_id => l_component_appl_id
139380 ,p_amb_context_code => l_amb_context_code
139381 ,p_entity_code => l_entity_code
139382 ,p_event_class_code => l_event_class_code);
139383 --
139384 -- set accounting class
139385 --
139386 xla_ae_lines_pkg.SetAcctClass(
139387 p_accounting_class_code => 'ASSET'
139388 , p_ae_header_id => l_ae_header_id
139389 );
139390
139391 --
139392 -- set rounding class
139393 --
139394 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
139395 'ASSET';
139396
139397 --
139398 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
139399 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
139400 --
139401 -- bulk performance
139402 --
139403 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
139404
139405 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
139406 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
139407
139408 -- 4955764
139409 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
139410 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
139411
139412 -- 4458381 Public Sector Enh
139413
139414 --
139415 -- set accounting attributes for the line type
139416 --
139417 l_entered_amt_idx := 4;
139418 l_accted_amt_idx := 6;
139419 l_bflow_applied_to_amt_idx := NULL; -- 5132302
139420 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
139421 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
139422 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
139423 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
139424 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
139425 l_rec_acct_attrs.array_char_value(3) := p_source_51;
139426 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
139427 l_rec_acct_attrs.array_num_value(4) := p_source_52;
139428 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
139429 l_rec_acct_attrs.array_char_value(5) := p_source_53;
139430 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
139431 l_rec_acct_attrs.array_num_value(6) := p_source_52;
139432
139433 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
139434 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
139435
139436 ---------------------------------------------------------------------------------------------------------------
139437 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
139438 ---------------------------------------------------------------------------------------------------------------
139439 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
139440
139441 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
139442 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
139443
139444 IF xla_accounting_cache_pkg.GetValueChar
139445 (p_source_code => 'LEDGER_CATEGORY_CODE'
139449 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
139446 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
139447 AND l_bflow_method_code = 'PRIOR_ENTRY'
139448 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
139450 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
139451 )
139452 THEN
139453 xla_ae_lines_pkg.BflowUpgEntry
139454 (p_business_method_code => l_bflow_method_code
139455 ,p_business_class_code => l_bflow_class_code
139456 ,p_balance_type => l_balance_type_code);
139457 ELSE
139458 NULL;
139459 -- No business flow processing for business flow method of NONE.
139460 END IF;
139461
139462 --
139463 -- call analytical criteria
139464 --
139465
139466 --
139467 -- call description
139468 --
139469
139470 xla_ae_lines_pkg.SetLineDescription(
139471 p_ae_header_id => l_ae_header_id
139472 ,p_description => Description_116 (
139473 p_application_id => p_application_id
139474 , p_ae_header_id => l_ae_header_id
139475 , p_source_1 => p_source_1
139476 )
139477 );
139478
139479
139480 --
139481 -- call ADRs
139482 -- Bug 4922099
139483 --
139484 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
139485 (NVL(l_actual_upg_option, 'N') = 'O') OR
139486 (NVL(l_enc_upg_option, 'N') = 'O')
139487 )
139488 THEN
139489 NULL;
139490 --
139491 --
139492
139493 l_ccid := AcctDerRule_175(
139494 p_application_id => p_application_id
139495 , p_ae_header_id => l_ae_header_id
139496 , p_source_5 => p_source_5
139497 , p_source_19 => p_source_19
139498 , p_source_32 => p_source_32
139499 , x_transaction_coa_id => l_adr_transaction_coa_id
139500 , x_accounting_coa_id => l_adr_accounting_coa_id
139501 , x_value_type_code => l_adr_value_type_code
139502 , p_side => 'NA'
139503 );
139504
139505 xla_ae_lines_pkg.set_ccid(
139506 p_code_combination_id => l_ccid
139507 , p_value_type_code => l_adr_value_type_code
139508 , p_transaction_coa_id => l_adr_transaction_coa_id
139509 , p_accounting_coa_id => l_adr_accounting_coa_id
139510 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
139511 , p_adr_type_code => 'S'
139512 , p_component_type => l_component_type
139513 , p_component_code => l_component_code
139514 , p_component_type_code => l_component_type_code
139515 , p_component_appl_id => l_component_appl_id
139516 , p_amb_context_code => l_amb_context_code
139517 , p_side => 'NA'
139518 );
139519
139520
139521 l_segment := AcctDerRule_151(
139522 p_application_id => p_application_id
139523 , p_ae_header_id => l_ae_header_id
139524 , p_source_5 => p_source_5
139525 , p_source_13 => p_source_13
139526 , x_transaction_coa_id => l_adr_transaction_coa_id
139527 , x_accounting_coa_id => l_adr_accounting_coa_id
139528 , x_flexfield_segment_code => l_adr_flexfield_segment_code
139529 , x_flex_value_set_id => l_adr_flex_value_set_id
139530 , x_value_type_code => l_adr_value_type_code
139531 , x_value_combination_id => l_adr_value_combination_id
139532 , x_value_segment_code => l_adr_value_segment_code
139533 , p_side => 'NA'
139534 , p_override_seg_flag => 'Y'
139535 );
139536
139537 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
139538
139539 xla_ae_lines_pkg.set_segment(
139540 p_to_segment_code => 'GL_ACCOUNT'
139541 , p_segment_value => l_segment
139542 , p_from_segment_code => l_adr_value_segment_code
139543 , p_from_combination_id => l_adr_value_combination_id
139544 , p_value_type_code => l_adr_value_type_code
139545 , p_transaction_coa_id => l_adr_transaction_coa_id
139546 , p_accounting_coa_id => l_adr_accounting_coa_id
139547 , p_flexfield_segment_code => l_adr_flexfield_segment_code
139548 , p_flex_value_set_id => l_adr_flex_value_set_id
139549 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
139550 , p_adr_type_code => 'S'
139551 , p_component_type => l_component_type
139552 , p_component_code => l_component_code
139553 , p_component_type_code => l_component_type_code
139554 , p_component_appl_id => l_component_appl_id
139555 , p_amb_context_code => l_amb_context_code
139556 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
139557 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
139558 , p_side => 'NA'
139559 );
139560
139561 END IF;
139562
139563 l_segment := AcctDerRule_169(
139564 p_application_id => p_application_id
139565 , p_ae_header_id => l_ae_header_id
139566 , p_source_5 => p_source_5
139567 , p_source_31 => p_source_31
139568 , x_transaction_coa_id => l_adr_transaction_coa_id
139569 , x_accounting_coa_id => l_adr_accounting_coa_id
139573 , x_value_combination_id => l_adr_value_combination_id
139570 , x_flexfield_segment_code => l_adr_flexfield_segment_code
139571 , x_flex_value_set_id => l_adr_flex_value_set_id
139572 , x_value_type_code => l_adr_value_type_code
139574 , x_value_segment_code => l_adr_value_segment_code
139575 , p_side => 'NA'
139576 , p_override_seg_flag => 'Y'
139577 );
139578
139579 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
139580
139581 xla_ae_lines_pkg.set_segment(
139582 p_to_segment_code => 'GL_BALANCING'
139583 , p_segment_value => l_segment
139584 , p_from_segment_code => l_adr_value_segment_code
139585 , p_from_combination_id => l_adr_value_combination_id
139586 , p_value_type_code => l_adr_value_type_code
139587 , p_transaction_coa_id => l_adr_transaction_coa_id
139588 , p_accounting_coa_id => l_adr_accounting_coa_id
139589 , p_flexfield_segment_code => l_adr_flexfield_segment_code
139590 , p_flex_value_set_id => l_adr_flex_value_set_id
139591 , p_adr_code => 'FA_EXPENSE_ACCT'
139592 , p_adr_type_code => 'S'
139593 , p_component_type => l_component_type
139594 , p_component_code => l_component_code
139595 , p_component_type_code => l_component_type_code
139596 , p_component_appl_id => l_component_appl_id
139597 , p_amb_context_code => l_amb_context_code
139598 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
139599 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
139600 , p_side => 'NA'
139601 );
139602
139603 END IF;
139604
139605 --
139606 --
139607 END IF;
139608 --
139609 -- Bug 4922099
139610 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
139611 (NVL(l_enc_upg_option, 'N') = 'O')
139612 ) AND
139613 (l_bflow_method_code = 'PRIOR_ENTRY')
139614 )
139615 THEN
139616 IF
139617 --
139618 1 = 2
139619 --
139620 THEN
139621 xla_accounting_err_pkg.build_message
139622 (p_appli_s_name => 'XLA'
139623 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
139624 ,p_token_1 => 'LINE_NUMBER'
139625 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
139626 ,p_token_2 => 'LINE_TYPE_NAME'
139627 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
139628 l_component_type
139629 ,l_component_code
139630 ,l_component_type_code
139631 ,l_component_appl_id
139632 ,l_amb_context_code
139633 ,l_entity_code
139634 ,l_event_class_code
139635 )
139636 ,p_token_3 => 'OWNER'
139637 ,p_value_3 => xla_lookups_pkg.get_meaning(
139638 p_lookup_type => 'XLA_OWNER_TYPE'
139639 ,p_lookup_code => l_component_type_code
139640 )
139641 ,p_token_4 => 'PRODUCT_NAME'
139642 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
139643 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
139644 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
139645 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
139646 ,p_ae_header_id => NULL
139647 );
139648
139649 IF (C_LEVEL_ERROR>= g_log_level) THEN
139650 trace
139651 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
139652 ,p_level => C_LEVEL_ERROR
139653 ,p_module => l_log_module);
139654 END IF;
139655 END IF;
139656 END IF;
139657 --
139658 --
139659 ------------------------------------------------------------------------------------------------
139660 -- 4219869 Business Flow
139661 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
139662 -- Prior Entry. Currently, the following code is always generated.
139663 ------------------------------------------------------------------------------------------------
139664 XLA_AE_LINES_PKG.ValidateCurrentLine;
139665
139666 ------------------------------------------------------------------------------------
139667 -- 4219869 Business Flow
139671
139668 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
139669 ------------------------------------------------------------------------------------
139670 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
139672 ----------------------------------------------------------------------------------
139673 -- 4219869 Business Flow
139674 -- Update journal entry status -- Need to generate this within IF <condition>
139675 ----------------------------------------------------------------------------------
139676 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
139677 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
139678 ,p_balance_type_code => l_balance_type_code
139679 );
139680
139681 -------------------------------------------------------------------------------------------
139682 -- 4262811 - Generate the Accrual Reversal lines
139683 -------------------------------------------------------------------------------------------
139684 BEGIN
139685 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
139686 (g_array_event(p_event_id).array_value_num('header_index'));
139687 IF l_acc_rev_flag IS NULL THEN
139688 l_acc_rev_flag := 'N';
139689 END IF;
139690 EXCEPTION
139691 WHEN OTHERS THEN
139692 l_acc_rev_flag := 'N';
139693 END;
139694 --
139695 IF (l_acc_rev_flag = 'Y') THEN
139696
139697 -- 4645092 ------------------------------------------------------------------------------
139698 -- To allow MPA report to determine if it should generate report process
139699 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
139700 ------------------------------------------------------------------------------------------
139701
139702 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
139703 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
139704 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
139705 -- call ADRs
139706 -- Bug 4922099
139707 --
139708 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
139709 (NVL(l_actual_upg_option, 'N') = 'O') OR
139710 (NVL(l_enc_upg_option, 'N') = 'O')
139711 )
139712 THEN
139713 NULL;
139714 --
139715 --
139716
139717 l_ccid := AcctDerRule_175(
139718 p_application_id => p_application_id
139719 , p_ae_header_id => l_ae_header_id
139720 , p_source_5 => p_source_5
139721 , p_source_19 => p_source_19
139722 , p_source_32 => p_source_32
139723 , x_transaction_coa_id => l_adr_transaction_coa_id
139724 , x_accounting_coa_id => l_adr_accounting_coa_id
139725 , x_value_type_code => l_adr_value_type_code
139726 , p_side => 'NA'
139727 );
139728
139729 xla_ae_lines_pkg.set_ccid(
139730 p_code_combination_id => l_ccid
139731 , p_value_type_code => l_adr_value_type_code
139732 , p_transaction_coa_id => l_adr_transaction_coa_id
139733 , p_accounting_coa_id => l_adr_accounting_coa_id
139734 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
139735 , p_adr_type_code => 'S'
139736 , p_component_type => l_component_type
139737 , p_component_code => l_component_code
139738 , p_component_type_code => l_component_type_code
139739 , p_component_appl_id => l_component_appl_id
139740 , p_amb_context_code => l_amb_context_code
139741 , p_side => 'NA'
139742 );
139743
139744
139745 l_segment := AcctDerRule_151(
139746 p_application_id => p_application_id
139747 , p_ae_header_id => l_ae_header_id
139748 , p_source_5 => p_source_5
139749 , p_source_13 => p_source_13
139750 , x_transaction_coa_id => l_adr_transaction_coa_id
139751 , x_accounting_coa_id => l_adr_accounting_coa_id
139752 , x_flexfield_segment_code => l_adr_flexfield_segment_code
139753 , x_flex_value_set_id => l_adr_flex_value_set_id
139754 , x_value_type_code => l_adr_value_type_code
139755 , x_value_combination_id => l_adr_value_combination_id
139756 , x_value_segment_code => l_adr_value_segment_code
139757 , p_side => 'NA'
139758 , p_override_seg_flag => 'Y'
139759 );
139760
139761 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
139762
139763 xla_ae_lines_pkg.set_segment(
139764 p_to_segment_code => 'GL_ACCOUNT'
139765 , p_segment_value => l_segment
139766 , p_from_segment_code => l_adr_value_segment_code
139767 , p_from_combination_id => l_adr_value_combination_id
139768 , p_value_type_code => l_adr_value_type_code
139769 , p_transaction_coa_id => l_adr_transaction_coa_id
139770 , p_accounting_coa_id => l_adr_accounting_coa_id
139771 , p_flexfield_segment_code => l_adr_flexfield_segment_code
139772 , p_flex_value_set_id => l_adr_flex_value_set_id
139773 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
139774 , p_adr_type_code => 'S'
139775 , p_component_type => l_component_type
139776 , p_component_code => l_component_code
139777 , p_component_type_code => l_component_type_code
139781 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
139778 , p_component_appl_id => l_component_appl_id
139779 , p_amb_context_code => l_amb_context_code
139780 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
139782 , p_side => 'NA'
139783 );
139784
139785 END IF;
139786
139787 l_segment := AcctDerRule_169(
139788 p_application_id => p_application_id
139789 , p_ae_header_id => l_ae_header_id
139790 , p_source_5 => p_source_5
139791 , p_source_31 => p_source_31
139792 , x_transaction_coa_id => l_adr_transaction_coa_id
139793 , x_accounting_coa_id => l_adr_accounting_coa_id
139794 , x_flexfield_segment_code => l_adr_flexfield_segment_code
139795 , x_flex_value_set_id => l_adr_flex_value_set_id
139796 , x_value_type_code => l_adr_value_type_code
139797 , x_value_combination_id => l_adr_value_combination_id
139798 , x_value_segment_code => l_adr_value_segment_code
139799 , p_side => 'NA'
139800 , p_override_seg_flag => 'Y'
139801 );
139802
139803 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
139804
139805 xla_ae_lines_pkg.set_segment(
139806 p_to_segment_code => 'GL_BALANCING'
139807 , p_segment_value => l_segment
139808 , p_from_segment_code => l_adr_value_segment_code
139809 , p_from_combination_id => l_adr_value_combination_id
139810 , p_value_type_code => l_adr_value_type_code
139811 , p_transaction_coa_id => l_adr_transaction_coa_id
139812 , p_accounting_coa_id => l_adr_accounting_coa_id
139813 , p_flexfield_segment_code => l_adr_flexfield_segment_code
139814 , p_flex_value_set_id => l_adr_flex_value_set_id
139815 , p_adr_code => 'FA_EXPENSE_ACCT'
139816 , p_adr_type_code => 'S'
139817 , p_component_type => l_component_type
139818 , p_component_code => l_component_code
139819 , p_component_type_code => l_component_type_code
139820 , p_component_appl_id => l_component_appl_id
139821 , p_amb_context_code => l_amb_context_code
139822 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
139823 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
139824 , p_side => 'NA'
139825 );
139826
139827 END IF;
139828
139829 --
139830 --
139831 END IF;
139832
139833 --
139834 -- Update the line information that should be overwritten
139835 --
139836 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
139837 p_header_num => 1);
139838 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
139839
139840 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
139841
139842 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
139843 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
139844 END IF;
139845
139846 --
139847 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
139848 --
139849 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
139850 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
139851 ELSE
139852 ---------------------------------------------------------------------------------------------------
139853 -- 4262811a Switch Sign
139854 ---------------------------------------------------------------------------------------------------
139855 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
139856 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
139857 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
139858 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
139859 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
139860 -- 5132302
139861 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
139862 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
139863
139864 END IF;
139865
139866 -- 4955764
139867 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
139868 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
139869
139870
139871 XLA_AE_LINES_PKG.ValidateCurrentLine;
139872 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
139873
139874 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
139875 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
139876 ,p_balance_type_code => l_balance_type_code);
139877
139878 END IF;
139879
139880 -----------------------------------------------------------------------------------------
139881 -- 4262811 Multiperiod Accounting
139885
139882 -----------------------------------------------------------------------------------------
139883 -- No MPA option is assigned.
139884
139886 END IF;
139887 END IF;
139888 --
139889
139890 --
139891 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
139892 trace
139893 (p_msg => 'END of AcctLineType_360'
139894 ,p_level => C_LEVEL_PROCEDURE
139895 ,p_module => l_log_module);
139896 END IF;
139897 --
139898 EXCEPTION
139899 WHEN xla_exceptions_pkg.application_exception THEN
139900 RAISE;
139901 WHEN OTHERS THEN
139902 xla_exceptions_pkg.raise_message
139903 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_360');
139904 END AcctLineType_360;
139905 --
139906
139907 ---------------------------------------
139908 --
139909 -- PRIVATE FUNCTION
139910 -- AcctLineType_361
139911 --
139912 ---------------------------------------
139913 PROCEDURE AcctLineType_361 (
139914 p_application_id IN NUMBER
139915 ,p_event_id IN NUMBER
139916 ,p_calculate_acctd_flag IN VARCHAR2
139917 ,p_calculate_g_l_flag IN VARCHAR2
139918 ,p_actual_flag IN OUT VARCHAR2
139919 ,p_balance_type_code OUT VARCHAR2
139920 ,p_gain_or_loss_ref OUT VARCHAR2
139921
139922 --Period Close Date
139923 , p_source_1 IN DATE
139924 --Generated Code Combination Identifier
139925 , p_source_5 IN NUMBER
139926 --Intercompany Payables Account
139927 , p_source_21 IN VARCHAR2
139928 --Expense Account Code Combination Identifier
139929 , p_source_31 IN NUMBER
139930 --Default Code Combination Identifier
139931 , p_source_32 IN NUMBER
139932 --Adjustment Type
139933 , p_source_48 IN VARCHAR2
139934 --Transaction Header Identifier
139935 , p_source_49 IN NUMBER
139936 --Adjustment Line Identifier
139937 , p_source_50 IN NUMBER
139938 --Distribution Type Code
139939 , p_source_51 IN VARCHAR2
139940 --Entered Amount
139941 , p_source_52 IN NUMBER
139942 --Currency Code
139943 , p_source_53 IN VARCHAR2
139944 )
139945 IS
139946
139947 l_component_type VARCHAR2(80);
139948 l_component_code VARCHAR2(30);
139949 l_component_type_code VARCHAR2(1);
139950 l_component_appl_id INTEGER;
139951 l_amb_context_code VARCHAR2(30);
139952 l_entity_code VARCHAR2(30);
139953 l_event_class_code VARCHAR2(30);
139954 l_ae_header_id NUMBER;
139955 l_event_type_code VARCHAR2(30);
139956 l_line_definition_code VARCHAR2(30);
139957 l_line_definition_owner_code VARCHAR2(1);
139958 --
139959 -- adr variables
139960 l_segment VARCHAR2(30);
139961 l_ccid NUMBER;
139962 l_adr_transaction_coa_id NUMBER;
139963 l_adr_accounting_coa_id NUMBER;
139964 l_adr_flexfield_segment_code VARCHAR2(30);
139965 l_adr_flex_value_set_id NUMBER;
139966 l_adr_value_type_code VARCHAR2(30);
139967 l_adr_value_combination_id NUMBER;
139968 l_adr_value_segment_code VARCHAR2(30);
139969
139970 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
139971 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
139972 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
139973 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
139974
139975 -- 4262811 Variables ------------------------------------------------------------------------------------------
139976 l_entered_amt_idx NUMBER;
139977 l_accted_amt_idx NUMBER;
139978 l_acc_rev_flag VARCHAR2(1);
139979 l_accrual_line_num NUMBER;
139980 l_tmp_amt NUMBER;
139981 l_acc_rev_natural_side_code VARCHAR2(1);
139982
139983 l_num_entries NUMBER;
139984 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
139985 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
139986 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
139987 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
139988 l_recog_line_1 NUMBER;
139989 l_recog_line_2 NUMBER;
139990
139991 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
139992 l_bflow_applied_to_amt NUMBER; -- 5132302
139993 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
139994
139995 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
139996
139997 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
139998 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
139999
140000 ---------------------------------------------------------------------------------------------------------------
140001
140002
140003 --
140004 -- bulk performance
140005 --
140006 l_balance_type_code VARCHAR2(1);
140007 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
140008 l_log_module VARCHAR2(240);
140009
140010 --
140011 -- Upgrade strategy
140012 --
140013 l_actual_upg_option VARCHAR2(1);
140014 l_enc_upg_option VARCHAR2(1);
140015
140016 --
140017 BEGIN
140021 END IF;
140018 --
140019 IF g_log_enabled THEN
140020 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_361';
140022 --
140023 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
140024
140025 trace
140026 (p_msg => 'BEGIN of AcctLineType_361'
140027 ,p_level => C_LEVEL_PROCEDURE
140028 ,p_module => l_log_module);
140029
140030 END IF;
140031 --
140032 l_component_type := 'AMB_JLT';
140033 l_component_code := 'FA_SLT_IC_PAY';
140034 l_component_type_code := 'S';
140035 l_component_appl_id := 140;
140036 l_amb_context_code := 'DEFAULT';
140037 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
140038 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
140039 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
140040 l_line_definition_owner_code := 'S';
140041 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
140042 --
140043 l_balance_type_code := 'A';
140044 l_segment := NULL;
140045 l_ccid := NULL;
140046 l_adr_transaction_coa_id := NULL;
140047 l_adr_accounting_coa_id := NULL;
140048 l_adr_flexfield_segment_code := NULL;
140049 l_adr_flex_value_set_id := NULL;
140050 l_adr_value_type_code := NULL;
140051 l_adr_value_combination_id := NULL;
140052 l_adr_value_segment_code := NULL;
140053
140054 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
140055 l_bflow_class_code := ''; -- 4219869 Business Flow
140056 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
140057 l_budgetary_control_flag := 'N';
140058
140059 l_bflow_applied_to_amt_idx := NULL; -- 5132302
140060 l_bflow_applied_to_amt := NULL; -- 5132302
140061 l_entered_amt_idx := NULL; -- 4262811
140062 l_accted_amt_idx := NULL; -- 4262811
140063 l_acc_rev_flag := NULL; -- 4262811
140064 l_accrual_line_num := NULL; -- 4262811
140065 l_tmp_amt := NULL; -- 4262811
140066 --
140067
140068 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
140069 l_balance_type_code <> 'B' THEN
140070 IF NVL(p_source_48,'
140071 ') = 'INTERCO AP'
140072 THEN
140073
140074 --
140075 XLA_AE_LINES_PKG.SetNewLine;
140076
140077 p_balance_type_code := l_balance_type_code;
140078 -- set the flag so later we will know whether the gain loss line needs to be created
140079
140080 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
140081 p_actual_flag :='A';
140082 END IF;
140083
140084 --
140085 -- bulk performance
140086 --
140087 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
140088 p_header_num => 0); -- 4262811
140089 --
140090 -- set accounting line options
140091 --
140092 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
140093 p_natural_side_code => 'C'
140094 , p_gain_or_loss_flag => 'N'
140095 , p_gl_transfer_mode_code => 'S'
140096 , p_acct_entry_type_code => 'A'
140097 , p_switch_side_flag => 'Y'
140098 , p_merge_duplicate_code => 'N'
140099 );
140100 --
140101 l_acc_rev_natural_side_code := 'D'; -- 4262811
140102 --
140103 --
140104 -- set accounting line type info
140105 --
140106 xla_ae_lines_pkg.SetAcctLineType
140107 (p_component_type => l_component_type
140108 ,p_event_type_code => l_event_type_code
140109 ,p_line_definition_owner_code => l_line_definition_owner_code
140110 ,p_line_definition_code => l_line_definition_code
140111 ,p_accounting_line_code => l_component_code
140112 ,p_accounting_line_type_code => l_component_type_code
140113 ,p_accounting_line_appl_id => l_component_appl_id
140114 ,p_amb_context_code => l_amb_context_code
140115 ,p_entity_code => l_entity_code
140116 ,p_event_class_code => l_event_class_code);
140117 --
140118 -- set accounting class
140119 --
140120 xla_ae_lines_pkg.SetAcctClass(
140121 p_accounting_class_code => 'LIABILITY'
140122 , p_ae_header_id => l_ae_header_id
140123 );
140124
140125 --
140126 -- set rounding class
140127 --
140128 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
140129 'LIABILITY';
140130
140131 --
140132 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
140133 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
140134 --
140135 -- bulk performance
140136 --
140137 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
140138
140139 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
140140 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
140141
140142 -- 4955764
140143 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
140144 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
140145
140146 -- 4458381 Public Sector Enh
140147
140148 --
140152 l_accted_amt_idx := 6;
140149 -- set accounting attributes for the line type
140150 --
140151 l_entered_amt_idx := 4;
140153 l_bflow_applied_to_amt_idx := NULL; -- 5132302
140154 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
140155 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
140156 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
140157 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
140158 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
140159 l_rec_acct_attrs.array_char_value(3) := p_source_51;
140160 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
140161 l_rec_acct_attrs.array_num_value(4) := p_source_52;
140162 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
140163 l_rec_acct_attrs.array_char_value(5) := p_source_53;
140164 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
140165 l_rec_acct_attrs.array_num_value(6) := p_source_52;
140166
140167 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
140168 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
140169
140170 ---------------------------------------------------------------------------------------------------------------
140171 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
140172 ---------------------------------------------------------------------------------------------------------------
140173 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
140174
140175 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
140176 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
140177
140178 IF xla_accounting_cache_pkg.GetValueChar
140179 (p_source_code => 'LEDGER_CATEGORY_CODE'
140180 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
140181 AND l_bflow_method_code = 'PRIOR_ENTRY'
140182 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
140183 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
140184 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
140185 )
140186 THEN
140187 xla_ae_lines_pkg.BflowUpgEntry
140188 (p_business_method_code => l_bflow_method_code
140189 ,p_business_class_code => l_bflow_class_code
140190 ,p_balance_type => l_balance_type_code);
140191 ELSE
140192 NULL;
140193 -- No business flow processing for business flow method of NONE.
140194 END IF;
140195
140196 --
140197 -- call analytical criteria
140198 --
140199
140200 --
140201 -- call description
140202 --
140203
140204 xla_ae_lines_pkg.SetLineDescription(
140205 p_ae_header_id => l_ae_header_id
140206 ,p_description => Description_114 (
140207 p_application_id => p_application_id
140208 , p_ae_header_id => l_ae_header_id
140209 , p_source_1 => p_source_1
140210 )
140211 );
140212
140213
140214 --
140215 -- call ADRs
140216 -- Bug 4922099
140217 --
140218 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
140219 (NVL(l_actual_upg_option, 'N') = 'O') OR
140220 (NVL(l_enc_upg_option, 'N') = 'O')
140221 )
140222 THEN
140223 NULL;
140224 --
140225 --
140226
140227 l_ccid := AcctDerRule_174(
140228 p_application_id => p_application_id
140229 , p_ae_header_id => l_ae_header_id
140230 , p_source_5 => p_source_5
140231 , p_source_32 => p_source_32
140232 , x_transaction_coa_id => l_adr_transaction_coa_id
140233 , x_accounting_coa_id => l_adr_accounting_coa_id
140234 , x_value_type_code => l_adr_value_type_code
140235 , p_side => 'NA'
140236 );
140237
140238 xla_ae_lines_pkg.set_ccid(
140239 p_code_combination_id => l_ccid
140240 , p_value_type_code => l_adr_value_type_code
140241 , p_transaction_coa_id => l_adr_transaction_coa_id
140242 , p_accounting_coa_id => l_adr_accounting_coa_id
140243 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
140244 , p_adr_type_code => 'S'
140245 , p_component_type => l_component_type
140246 , p_component_code => l_component_code
140247 , p_component_type_code => l_component_type_code
140248 , p_component_appl_id => l_component_appl_id
140249 , p_amb_context_code => l_amb_context_code
140250 , p_side => 'NA'
140251 );
140252
140253
140254 l_segment := AcctDerRule_169(
140255 p_application_id => p_application_id
140256 , p_ae_header_id => l_ae_header_id
140257 , p_source_5 => p_source_5
140258 , p_source_31 => p_source_31
140259 , x_transaction_coa_id => l_adr_transaction_coa_id
140260 , x_accounting_coa_id => l_adr_accounting_coa_id
140261 , x_flexfield_segment_code => l_adr_flexfield_segment_code
140262 , x_flex_value_set_id => l_adr_flex_value_set_id
140263 , x_value_type_code => l_adr_value_type_code
140264 , x_value_combination_id => l_adr_value_combination_id
140265 , x_value_segment_code => l_adr_value_segment_code
140269
140266 , p_side => 'NA'
140267 , p_override_seg_flag => 'Y'
140268 );
140270 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
140271
140272 xla_ae_lines_pkg.set_segment(
140273 p_to_segment_code => 'GL_BALANCING'
140274 , p_segment_value => l_segment
140275 , p_from_segment_code => l_adr_value_segment_code
140276 , p_from_combination_id => l_adr_value_combination_id
140277 , p_value_type_code => l_adr_value_type_code
140278 , p_transaction_coa_id => l_adr_transaction_coa_id
140279 , p_accounting_coa_id => l_adr_accounting_coa_id
140280 , p_flexfield_segment_code => l_adr_flexfield_segment_code
140281 , p_flex_value_set_id => l_adr_flex_value_set_id
140282 , p_adr_code => 'FA_EXPENSE_ACCT'
140283 , p_adr_type_code => 'S'
140284 , p_component_type => l_component_type
140285 , p_component_code => l_component_code
140286 , p_component_type_code => l_component_type_code
140287 , p_component_appl_id => l_component_appl_id
140288 , p_amb_context_code => l_amb_context_code
140289 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
140290 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
140291 , p_side => 'NA'
140292 );
140293
140294 END IF;
140295
140296 l_segment := AcctDerRule_158(
140297 p_application_id => p_application_id
140298 , p_ae_header_id => l_ae_header_id
140299 , p_source_5 => p_source_5
140300 , p_source_21 => p_source_21
140301 , x_transaction_coa_id => l_adr_transaction_coa_id
140302 , x_accounting_coa_id => l_adr_accounting_coa_id
140303 , x_flexfield_segment_code => l_adr_flexfield_segment_code
140304 , x_flex_value_set_id => l_adr_flex_value_set_id
140305 , x_value_type_code => l_adr_value_type_code
140306 , x_value_combination_id => l_adr_value_combination_id
140307 , x_value_segment_code => l_adr_value_segment_code
140308 , p_side => 'NA'
140309 , p_override_seg_flag => 'Y'
140310 );
140311
140312 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
140313
140314 xla_ae_lines_pkg.set_segment(
140315 p_to_segment_code => 'GL_ACCOUNT'
140316 , p_segment_value => l_segment
140317 , p_from_segment_code => l_adr_value_segment_code
140318 , p_from_combination_id => l_adr_value_combination_id
140319 , p_value_type_code => l_adr_value_type_code
140320 , p_transaction_coa_id => l_adr_transaction_coa_id
140321 , p_accounting_coa_id => l_adr_accounting_coa_id
140322 , p_flexfield_segment_code => l_adr_flexfield_segment_code
140323 , p_flex_value_set_id => l_adr_flex_value_set_id
140324 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
140325 , p_adr_type_code => 'S'
140326 , p_component_type => l_component_type
140327 , p_component_code => l_component_code
140328 , p_component_type_code => l_component_type_code
140329 , p_component_appl_id => l_component_appl_id
140330 , p_amb_context_code => l_amb_context_code
140331 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
140332 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
140333 , p_side => 'NA'
140334 );
140335
140336 END IF;
140337
140338 --
140339 --
140340 END IF;
140341 --
140342 -- Bug 4922099
140343 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
140344 (NVL(l_enc_upg_option, 'N') = 'O')
140345 ) AND
140346 (l_bflow_method_code = 'PRIOR_ENTRY')
140347 )
140348 THEN
140349 IF
140350 --
140351 1 = 2
140352 --
140353 THEN
140354 xla_accounting_err_pkg.build_message
140355 (p_appli_s_name => 'XLA'
140356 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
140357 ,p_token_1 => 'LINE_NUMBER'
140358 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
140359 ,p_token_2 => 'LINE_TYPE_NAME'
140360 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
140361 l_component_type
140362 ,l_component_code
140363 ,l_component_type_code
140364 ,l_component_appl_id
140365 ,l_amb_context_code
140366 ,l_entity_code
140367 ,l_event_class_code
140368 )
140369 ,p_token_3 => 'OWNER'
140373 )
140370 ,p_value_3 => xla_lookups_pkg.get_meaning(
140371 p_lookup_type => 'XLA_OWNER_TYPE'
140372 ,p_lookup_code => l_component_type_code
140374 ,p_token_4 => 'PRODUCT_NAME'
140375 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
140376 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
140377 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
140378 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
140379 ,p_ae_header_id => NULL
140380 );
140381
140382 IF (C_LEVEL_ERROR>= g_log_level) THEN
140383 trace
140384 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
140385 ,p_level => C_LEVEL_ERROR
140386 ,p_module => l_log_module);
140387 END IF;
140388 END IF;
140389 END IF;
140390 --
140391 --
140392 ------------------------------------------------------------------------------------------------
140393 -- 4219869 Business Flow
140394 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
140395 -- Prior Entry. Currently, the following code is always generated.
140396 ------------------------------------------------------------------------------------------------
140397 XLA_AE_LINES_PKG.ValidateCurrentLine;
140398
140399 ------------------------------------------------------------------------------------
140400 -- 4219869 Business Flow
140401 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
140402 ------------------------------------------------------------------------------------
140403 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
140404
140405 ----------------------------------------------------------------------------------
140406 -- 4219869 Business Flow
140407 -- Update journal entry status -- Need to generate this within IF <condition>
140408 ----------------------------------------------------------------------------------
140409 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
140410 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
140411 ,p_balance_type_code => l_balance_type_code
140412 );
140413
140414 -------------------------------------------------------------------------------------------
140415 -- 4262811 - Generate the Accrual Reversal lines
140416 -------------------------------------------------------------------------------------------
140417 BEGIN
140418 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
140419 (g_array_event(p_event_id).array_value_num('header_index'));
140420 IF l_acc_rev_flag IS NULL THEN
140421 l_acc_rev_flag := 'N';
140422 END IF;
140423 EXCEPTION
140424 WHEN OTHERS THEN
140425 l_acc_rev_flag := 'N';
140426 END;
140427 --
140428 IF (l_acc_rev_flag = 'Y') THEN
140429
140430 -- 4645092 ------------------------------------------------------------------------------
140431 -- To allow MPA report to determine if it should generate report process
140432 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
140433 ------------------------------------------------------------------------------------------
140434
140435 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
140436 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
140437 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
140438 -- call ADRs
140439 -- Bug 4922099
140440 --
140441 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
140442 (NVL(l_actual_upg_option, 'N') = 'O') OR
140443 (NVL(l_enc_upg_option, 'N') = 'O')
140444 )
140445 THEN
140446 NULL;
140447 --
140448 --
140449
140450 l_ccid := AcctDerRule_174(
140451 p_application_id => p_application_id
140452 , p_ae_header_id => l_ae_header_id
140453 , p_source_5 => p_source_5
140454 , p_source_32 => p_source_32
140455 , x_transaction_coa_id => l_adr_transaction_coa_id
140456 , x_accounting_coa_id => l_adr_accounting_coa_id
140457 , x_value_type_code => l_adr_value_type_code
140458 , p_side => 'NA'
140459 );
140460
140461 xla_ae_lines_pkg.set_ccid(
140462 p_code_combination_id => l_ccid
140463 , p_value_type_code => l_adr_value_type_code
140464 , p_transaction_coa_id => l_adr_transaction_coa_id
140465 , p_accounting_coa_id => l_adr_accounting_coa_id
140466 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
140467 , p_adr_type_code => 'S'
140468 , p_component_type => l_component_type
140469 , p_component_code => l_component_code
140470 , p_component_type_code => l_component_type_code
140471 , p_component_appl_id => l_component_appl_id
140475
140472 , p_amb_context_code => l_amb_context_code
140473 , p_side => 'NA'
140474 );
140476
140477 l_segment := AcctDerRule_169(
140478 p_application_id => p_application_id
140479 , p_ae_header_id => l_ae_header_id
140480 , p_source_5 => p_source_5
140481 , p_source_31 => p_source_31
140482 , x_transaction_coa_id => l_adr_transaction_coa_id
140483 , x_accounting_coa_id => l_adr_accounting_coa_id
140484 , x_flexfield_segment_code => l_adr_flexfield_segment_code
140485 , x_flex_value_set_id => l_adr_flex_value_set_id
140486 , x_value_type_code => l_adr_value_type_code
140487 , x_value_combination_id => l_adr_value_combination_id
140488 , x_value_segment_code => l_adr_value_segment_code
140489 , p_side => 'NA'
140490 , p_override_seg_flag => 'Y'
140491 );
140492
140493 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
140494
140495 xla_ae_lines_pkg.set_segment(
140496 p_to_segment_code => 'GL_BALANCING'
140497 , p_segment_value => l_segment
140498 , p_from_segment_code => l_adr_value_segment_code
140499 , p_from_combination_id => l_adr_value_combination_id
140500 , p_value_type_code => l_adr_value_type_code
140501 , p_transaction_coa_id => l_adr_transaction_coa_id
140502 , p_accounting_coa_id => l_adr_accounting_coa_id
140503 , p_flexfield_segment_code => l_adr_flexfield_segment_code
140504 , p_flex_value_set_id => l_adr_flex_value_set_id
140505 , p_adr_code => 'FA_EXPENSE_ACCT'
140506 , p_adr_type_code => 'S'
140507 , p_component_type => l_component_type
140508 , p_component_code => l_component_code
140509 , p_component_type_code => l_component_type_code
140510 , p_component_appl_id => l_component_appl_id
140511 , p_amb_context_code => l_amb_context_code
140512 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
140513 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
140514 , p_side => 'NA'
140515 );
140516
140517 END IF;
140518
140519 l_segment := AcctDerRule_158(
140520 p_application_id => p_application_id
140521 , p_ae_header_id => l_ae_header_id
140522 , p_source_5 => p_source_5
140523 , p_source_21 => p_source_21
140524 , x_transaction_coa_id => l_adr_transaction_coa_id
140525 , x_accounting_coa_id => l_adr_accounting_coa_id
140526 , x_flexfield_segment_code => l_adr_flexfield_segment_code
140527 , x_flex_value_set_id => l_adr_flex_value_set_id
140528 , x_value_type_code => l_adr_value_type_code
140529 , x_value_combination_id => l_adr_value_combination_id
140530 , x_value_segment_code => l_adr_value_segment_code
140531 , p_side => 'NA'
140532 , p_override_seg_flag => 'Y'
140533 );
140534
140535 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
140536
140537 xla_ae_lines_pkg.set_segment(
140538 p_to_segment_code => 'GL_ACCOUNT'
140539 , p_segment_value => l_segment
140540 , p_from_segment_code => l_adr_value_segment_code
140541 , p_from_combination_id => l_adr_value_combination_id
140542 , p_value_type_code => l_adr_value_type_code
140543 , p_transaction_coa_id => l_adr_transaction_coa_id
140544 , p_accounting_coa_id => l_adr_accounting_coa_id
140545 , p_flexfield_segment_code => l_adr_flexfield_segment_code
140546 , p_flex_value_set_id => l_adr_flex_value_set_id
140547 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
140548 , p_adr_type_code => 'S'
140549 , p_component_type => l_component_type
140550 , p_component_code => l_component_code
140551 , p_component_type_code => l_component_type_code
140552 , p_component_appl_id => l_component_appl_id
140553 , p_amb_context_code => l_amb_context_code
140554 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
140555 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
140556 , p_side => 'NA'
140557 );
140558
140559 END IF;
140560
140561 --
140562 --
140563 END IF;
140564
140565 --
140566 -- Update the line information that should be overwritten
140567 --
140568 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
140569 p_header_num => 1);
140570 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
140571
140572 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
140573
140574 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
140575 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
140576 END IF;
140577
140578 --
140579 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
140580 --
140581 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
140585 -- 4262811a Switch Sign
140582 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
140583 ELSE
140584 ---------------------------------------------------------------------------------------------------
140586 ---------------------------------------------------------------------------------------------------
140587 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
140588 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
140589 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
140590 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
140591 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
140592 -- 5132302
140593 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
140594 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
140595
140596 END IF;
140597
140598 -- 4955764
140599 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
140600 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
140601
140602
140603 XLA_AE_LINES_PKG.ValidateCurrentLine;
140604 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
140605
140606 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
140607 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
140608 ,p_balance_type_code => l_balance_type_code);
140609
140610 END IF;
140611
140612 -----------------------------------------------------------------------------------------
140613 -- 4262811 Multiperiod Accounting
140614 -----------------------------------------------------------------------------------------
140615 -- No MPA option is assigned.
140616
140617
140618 END IF;
140619 END IF;
140620 --
140621
140622 --
140623 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
140624 trace
140625 (p_msg => 'END of AcctLineType_361'
140626 ,p_level => C_LEVEL_PROCEDURE
140627 ,p_module => l_log_module);
140628 END IF;
140629 --
140630 EXCEPTION
140631 WHEN xla_exceptions_pkg.application_exception THEN
140632 RAISE;
140633 WHEN OTHERS THEN
140634 xla_exceptions_pkg.raise_message
140635 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_361');
140636 END AcctLineType_361;
140637 --
140638
140639 ---------------------------------------
140640 --
140641 -- PRIVATE FUNCTION
140642 -- AcctLineType_362
140643 --
140644 ---------------------------------------
140645 PROCEDURE AcctLineType_362 (
140646 p_application_id IN NUMBER
140647 ,p_event_id IN NUMBER
140648 ,p_calculate_acctd_flag IN VARCHAR2
140649 ,p_calculate_g_l_flag IN VARCHAR2
140650 ,p_actual_flag IN OUT VARCHAR2
140651 ,p_balance_type_code OUT VARCHAR2
140652 ,p_gain_or_loss_ref OUT VARCHAR2
140653
140654 --Period Close Date
140655 , p_source_1 IN DATE
140656 --Generated Code Combination Identifier
140657 , p_source_5 IN NUMBER
140658 --Intercompany Receivables Account
140659 , p_source_22 IN VARCHAR2
140660 --Expense Account Code Combination Identifier
140661 , p_source_31 IN NUMBER
140662 --Default Code Combination Identifier
140663 , p_source_32 IN NUMBER
140664 --Adjustment Type
140665 , p_source_48 IN VARCHAR2
140666 --Transaction Header Identifier
140667 , p_source_49 IN NUMBER
140668 --Adjustment Line Identifier
140669 , p_source_50 IN NUMBER
140670 --Distribution Type Code
140671 , p_source_51 IN VARCHAR2
140672 --Entered Amount
140673 , p_source_52 IN NUMBER
140674 --Currency Code
140675 , p_source_53 IN VARCHAR2
140676 )
140677 IS
140678
140679 l_component_type VARCHAR2(80);
140680 l_component_code VARCHAR2(30);
140681 l_component_type_code VARCHAR2(1);
140682 l_component_appl_id INTEGER;
140683 l_amb_context_code VARCHAR2(30);
140684 l_entity_code VARCHAR2(30);
140685 l_event_class_code VARCHAR2(30);
140686 l_ae_header_id NUMBER;
140687 l_event_type_code VARCHAR2(30);
140688 l_line_definition_code VARCHAR2(30);
140689 l_line_definition_owner_code VARCHAR2(1);
140690 --
140691 -- adr variables
140692 l_segment VARCHAR2(30);
140693 l_ccid NUMBER;
140694 l_adr_transaction_coa_id NUMBER;
140695 l_adr_accounting_coa_id NUMBER;
140696 l_adr_flexfield_segment_code VARCHAR2(30);
140697 l_adr_flex_value_set_id NUMBER;
140698 l_adr_value_type_code VARCHAR2(30);
140699 l_adr_value_combination_id NUMBER;
140700 l_adr_value_segment_code VARCHAR2(30);
140701
140702 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
140703 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
140704 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
140705 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
140706
140707 -- 4262811 Variables ------------------------------------------------------------------------------------------
140711 l_accrual_line_num NUMBER;
140708 l_entered_amt_idx NUMBER;
140709 l_accted_amt_idx NUMBER;
140710 l_acc_rev_flag VARCHAR2(1);
140712 l_tmp_amt NUMBER;
140713 l_acc_rev_natural_side_code VARCHAR2(1);
140714
140715 l_num_entries NUMBER;
140716 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
140717 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
140718 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
140719 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
140720 l_recog_line_1 NUMBER;
140721 l_recog_line_2 NUMBER;
140722
140723 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
140724 l_bflow_applied_to_amt NUMBER; -- 5132302
140725 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
140726
140727 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
140728
140729 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
140730 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
140731
140732 ---------------------------------------------------------------------------------------------------------------
140733
140734
140735 --
140736 -- bulk performance
140737 --
140738 l_balance_type_code VARCHAR2(1);
140739 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
140740 l_log_module VARCHAR2(240);
140741
140742 --
140743 -- Upgrade strategy
140744 --
140745 l_actual_upg_option VARCHAR2(1);
140746 l_enc_upg_option VARCHAR2(1);
140747
140748 --
140749 BEGIN
140750 --
140751 IF g_log_enabled THEN
140752 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_362';
140753 END IF;
140754 --
140755 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
140756
140757 trace
140758 (p_msg => 'BEGIN of AcctLineType_362'
140759 ,p_level => C_LEVEL_PROCEDURE
140760 ,p_module => l_log_module);
140761
140762 END IF;
140763 --
140764 l_component_type := 'AMB_JLT';
140765 l_component_code := 'FA_SLT_IC_REC';
140766 l_component_type_code := 'S';
140767 l_component_appl_id := 140;
140768 l_amb_context_code := 'DEFAULT';
140769 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
140770 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
140771 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
140772 l_line_definition_owner_code := 'S';
140773 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
140774 --
140775 l_balance_type_code := 'A';
140776 l_segment := NULL;
140777 l_ccid := NULL;
140778 l_adr_transaction_coa_id := NULL;
140779 l_adr_accounting_coa_id := NULL;
140780 l_adr_flexfield_segment_code := NULL;
140781 l_adr_flex_value_set_id := NULL;
140782 l_adr_value_type_code := NULL;
140783 l_adr_value_combination_id := NULL;
140784 l_adr_value_segment_code := NULL;
140785
140786 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
140787 l_bflow_class_code := ''; -- 4219869 Business Flow
140788 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
140789 l_budgetary_control_flag := 'N';
140790
140791 l_bflow_applied_to_amt_idx := NULL; -- 5132302
140792 l_bflow_applied_to_amt := NULL; -- 5132302
140793 l_entered_amt_idx := NULL; -- 4262811
140794 l_accted_amt_idx := NULL; -- 4262811
140795 l_acc_rev_flag := NULL; -- 4262811
140796 l_accrual_line_num := NULL; -- 4262811
140797 l_tmp_amt := NULL; -- 4262811
140798 --
140799
140800 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
140801 l_balance_type_code <> 'B' THEN
140802 IF NVL(p_source_48,'
140803 ') = 'INTERCO AR'
140804 THEN
140805
140806 --
140807 XLA_AE_LINES_PKG.SetNewLine;
140808
140809 p_balance_type_code := l_balance_type_code;
140810 -- set the flag so later we will know whether the gain loss line needs to be created
140811
140812 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
140813 p_actual_flag :='A';
140814 END IF;
140815
140816 --
140817 -- bulk performance
140818 --
140819 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
140820 p_header_num => 0); -- 4262811
140821 --
140822 -- set accounting line options
140823 --
140824 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
140825 p_natural_side_code => 'D'
140826 , p_gain_or_loss_flag => 'N'
140827 , p_gl_transfer_mode_code => 'S'
140828 , p_acct_entry_type_code => 'A'
140829 , p_switch_side_flag => 'Y'
140830 , p_merge_duplicate_code => 'N'
140831 );
140832 --
140833 l_acc_rev_natural_side_code := 'C'; -- 4262811
140834 --
140835 --
140836 -- set accounting line type info
140837 --
140838 xla_ae_lines_pkg.SetAcctLineType
140839 (p_component_type => l_component_type
140843 ,p_accounting_line_code => l_component_code
140840 ,p_event_type_code => l_event_type_code
140841 ,p_line_definition_owner_code => l_line_definition_owner_code
140842 ,p_line_definition_code => l_line_definition_code
140844 ,p_accounting_line_type_code => l_component_type_code
140845 ,p_accounting_line_appl_id => l_component_appl_id
140846 ,p_amb_context_code => l_amb_context_code
140847 ,p_entity_code => l_entity_code
140848 ,p_event_class_code => l_event_class_code);
140849 --
140850 -- set accounting class
140851 --
140852 xla_ae_lines_pkg.SetAcctClass(
140853 p_accounting_class_code => 'ASSET'
140854 , p_ae_header_id => l_ae_header_id
140855 );
140856
140857 --
140858 -- set rounding class
140859 --
140860 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
140861 'ASSET';
140862
140863 --
140864 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
140865 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
140866 --
140867 -- bulk performance
140868 --
140869 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
140870
140871 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
140872 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
140873
140874 -- 4955764
140875 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
140876 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
140877
140878 -- 4458381 Public Sector Enh
140879
140880 --
140881 -- set accounting attributes for the line type
140882 --
140883 l_entered_amt_idx := 4;
140884 l_accted_amt_idx := 6;
140885 l_bflow_applied_to_amt_idx := NULL; -- 5132302
140886 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
140887 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
140888 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
140889 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
140890 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
140891 l_rec_acct_attrs.array_char_value(3) := p_source_51;
140892 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
140893 l_rec_acct_attrs.array_num_value(4) := p_source_52;
140894 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
140895 l_rec_acct_attrs.array_char_value(5) := p_source_53;
140896 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
140897 l_rec_acct_attrs.array_num_value(6) := p_source_52;
140898
140899 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
140900 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
140901
140902 ---------------------------------------------------------------------------------------------------------------
140903 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
140904 ---------------------------------------------------------------------------------------------------------------
140905 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
140906
140907 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
140908 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
140909
140910 IF xla_accounting_cache_pkg.GetValueChar
140911 (p_source_code => 'LEDGER_CATEGORY_CODE'
140912 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
140913 AND l_bflow_method_code = 'PRIOR_ENTRY'
140914 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
140915 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
140916 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
140917 )
140918 THEN
140919 xla_ae_lines_pkg.BflowUpgEntry
140920 (p_business_method_code => l_bflow_method_code
140921 ,p_business_class_code => l_bflow_class_code
140922 ,p_balance_type => l_balance_type_code);
140923 ELSE
140924 NULL;
140925 -- No business flow processing for business flow method of NONE.
140926 END IF;
140927
140928 --
140929 -- call analytical criteria
140930 --
140931
140932 --
140933 -- call description
140934 --
140935
140936 xla_ae_lines_pkg.SetLineDescription(
140937 p_ae_header_id => l_ae_header_id
140938 ,p_description => Description_115 (
140939 p_application_id => p_application_id
140940 , p_ae_header_id => l_ae_header_id
140941 , p_source_1 => p_source_1
140942 )
140943 );
140944
140945
140946 --
140947 -- call ADRs
140948 -- Bug 4922099
140949 --
140950 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
140951 (NVL(l_actual_upg_option, 'N') = 'O') OR
140952 (NVL(l_enc_upg_option, 'N') = 'O')
140953 )
140954 THEN
140955 NULL;
140956 --
140957 --
140958
140959 l_ccid := AcctDerRule_174(
140963 , p_source_32 => p_source_32
140960 p_application_id => p_application_id
140961 , p_ae_header_id => l_ae_header_id
140962 , p_source_5 => p_source_5
140964 , x_transaction_coa_id => l_adr_transaction_coa_id
140965 , x_accounting_coa_id => l_adr_accounting_coa_id
140966 , x_value_type_code => l_adr_value_type_code
140967 , p_side => 'NA'
140968 );
140969
140970 xla_ae_lines_pkg.set_ccid(
140971 p_code_combination_id => l_ccid
140972 , p_value_type_code => l_adr_value_type_code
140973 , p_transaction_coa_id => l_adr_transaction_coa_id
140974 , p_accounting_coa_id => l_adr_accounting_coa_id
140975 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
140976 , p_adr_type_code => 'S'
140977 , p_component_type => l_component_type
140978 , p_component_code => l_component_code
140979 , p_component_type_code => l_component_type_code
140980 , p_component_appl_id => l_component_appl_id
140981 , p_amb_context_code => l_amb_context_code
140982 , p_side => 'NA'
140983 );
140984
140985
140986 l_segment := AcctDerRule_169(
140987 p_application_id => p_application_id
140988 , p_ae_header_id => l_ae_header_id
140989 , p_source_5 => p_source_5
140990 , p_source_31 => p_source_31
140991 , x_transaction_coa_id => l_adr_transaction_coa_id
140992 , x_accounting_coa_id => l_adr_accounting_coa_id
140993 , x_flexfield_segment_code => l_adr_flexfield_segment_code
140994 , x_flex_value_set_id => l_adr_flex_value_set_id
140995 , x_value_type_code => l_adr_value_type_code
140996 , x_value_combination_id => l_adr_value_combination_id
140997 , x_value_segment_code => l_adr_value_segment_code
140998 , p_side => 'NA'
140999 , p_override_seg_flag => 'Y'
141000 );
141001
141002 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
141003
141004 xla_ae_lines_pkg.set_segment(
141005 p_to_segment_code => 'GL_BALANCING'
141006 , p_segment_value => l_segment
141007 , p_from_segment_code => l_adr_value_segment_code
141008 , p_from_combination_id => l_adr_value_combination_id
141009 , p_value_type_code => l_adr_value_type_code
141010 , p_transaction_coa_id => l_adr_transaction_coa_id
141011 , p_accounting_coa_id => l_adr_accounting_coa_id
141012 , p_flexfield_segment_code => l_adr_flexfield_segment_code
141013 , p_flex_value_set_id => l_adr_flex_value_set_id
141014 , p_adr_code => 'FA_EXPENSE_ACCT'
141015 , p_adr_type_code => 'S'
141016 , p_component_type => l_component_type
141017 , p_component_code => l_component_code
141018 , p_component_type_code => l_component_type_code
141019 , p_component_appl_id => l_component_appl_id
141020 , p_amb_context_code => l_amb_context_code
141021 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
141022 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
141023 , p_side => 'NA'
141024 );
141025
141026 END IF;
141027
141028 l_segment := AcctDerRule_159(
141029 p_application_id => p_application_id
141030 , p_ae_header_id => l_ae_header_id
141031 , p_source_5 => p_source_5
141032 , p_source_22 => p_source_22
141033 , x_transaction_coa_id => l_adr_transaction_coa_id
141034 , x_accounting_coa_id => l_adr_accounting_coa_id
141035 , x_flexfield_segment_code => l_adr_flexfield_segment_code
141036 , x_flex_value_set_id => l_adr_flex_value_set_id
141037 , x_value_type_code => l_adr_value_type_code
141038 , x_value_combination_id => l_adr_value_combination_id
141039 , x_value_segment_code => l_adr_value_segment_code
141040 , p_side => 'NA'
141041 , p_override_seg_flag => 'Y'
141042 );
141043
141044 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
141045
141046 xla_ae_lines_pkg.set_segment(
141047 p_to_segment_code => 'GL_ACCOUNT'
141048 , p_segment_value => l_segment
141049 , p_from_segment_code => l_adr_value_segment_code
141050 , p_from_combination_id => l_adr_value_combination_id
141051 , p_value_type_code => l_adr_value_type_code
141052 , p_transaction_coa_id => l_adr_transaction_coa_id
141053 , p_accounting_coa_id => l_adr_accounting_coa_id
141054 , p_flexfield_segment_code => l_adr_flexfield_segment_code
141055 , p_flex_value_set_id => l_adr_flex_value_set_id
141056 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
141057 , p_adr_type_code => 'S'
141058 , p_component_type => l_component_type
141059 , p_component_code => l_component_code
141060 , p_component_type_code => l_component_type_code
141061 , p_component_appl_id => l_component_appl_id
141062 , p_amb_context_code => l_amb_context_code
141063 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
141067
141064 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
141065 , p_side => 'NA'
141066 );
141068 END IF;
141069
141070 --
141071 --
141072 END IF;
141073 --
141074 -- Bug 4922099
141075 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
141076 (NVL(l_enc_upg_option, 'N') = 'O')
141077 ) AND
141078 (l_bflow_method_code = 'PRIOR_ENTRY')
141079 )
141080 THEN
141081 IF
141082 --
141083 1 = 2
141084 --
141085 THEN
141086 xla_accounting_err_pkg.build_message
141087 (p_appli_s_name => 'XLA'
141088 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
141089 ,p_token_1 => 'LINE_NUMBER'
141090 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
141091 ,p_token_2 => 'LINE_TYPE_NAME'
141092 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
141093 l_component_type
141094 ,l_component_code
141095 ,l_component_type_code
141096 ,l_component_appl_id
141097 ,l_amb_context_code
141098 ,l_entity_code
141099 ,l_event_class_code
141100 )
141101 ,p_token_3 => 'OWNER'
141102 ,p_value_3 => xla_lookups_pkg.get_meaning(
141103 p_lookup_type => 'XLA_OWNER_TYPE'
141104 ,p_lookup_code => l_component_type_code
141105 )
141106 ,p_token_4 => 'PRODUCT_NAME'
141107 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
141108 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
141109 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
141110 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
141111 ,p_ae_header_id => NULL
141112 );
141113
141114 IF (C_LEVEL_ERROR>= g_log_level) THEN
141115 trace
141116 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
141117 ,p_level => C_LEVEL_ERROR
141118 ,p_module => l_log_module);
141119 END IF;
141120 END IF;
141121 END IF;
141122 --
141123 --
141124 ------------------------------------------------------------------------------------------------
141125 -- 4219869 Business Flow
141126 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
141127 -- Prior Entry. Currently, the following code is always generated.
141128 ------------------------------------------------------------------------------------------------
141129 XLA_AE_LINES_PKG.ValidateCurrentLine;
141130
141131 ------------------------------------------------------------------------------------
141132 -- 4219869 Business Flow
141133 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
141134 ------------------------------------------------------------------------------------
141135 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
141136
141137 ----------------------------------------------------------------------------------
141138 -- 4219869 Business Flow
141139 -- Update journal entry status -- Need to generate this within IF <condition>
141140 ----------------------------------------------------------------------------------
141141 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
141142 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
141143 ,p_balance_type_code => l_balance_type_code
141144 );
141145
141146 -------------------------------------------------------------------------------------------
141147 -- 4262811 - Generate the Accrual Reversal lines
141148 -------------------------------------------------------------------------------------------
141149 BEGIN
141150 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
141151 (g_array_event(p_event_id).array_value_num('header_index'));
141152 IF l_acc_rev_flag IS NULL THEN
141153 l_acc_rev_flag := 'N';
141154 END IF;
141155 EXCEPTION
141156 WHEN OTHERS THEN
141157 l_acc_rev_flag := 'N';
141158 END;
141159 --
141160 IF (l_acc_rev_flag = 'Y') THEN
141161
141162 -- 4645092 ------------------------------------------------------------------------------
141163 -- To allow MPA report to determine if it should generate report process
141167 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
141164 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
141165 ------------------------------------------------------------------------------------------
141166
141168 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
141169 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
141170 -- call ADRs
141171 -- Bug 4922099
141172 --
141173 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
141174 (NVL(l_actual_upg_option, 'N') = 'O') OR
141175 (NVL(l_enc_upg_option, 'N') = 'O')
141176 )
141177 THEN
141178 NULL;
141179 --
141180 --
141181
141182 l_ccid := AcctDerRule_174(
141183 p_application_id => p_application_id
141184 , p_ae_header_id => l_ae_header_id
141185 , p_source_5 => p_source_5
141186 , p_source_32 => p_source_32
141187 , x_transaction_coa_id => l_adr_transaction_coa_id
141188 , x_accounting_coa_id => l_adr_accounting_coa_id
141189 , x_value_type_code => l_adr_value_type_code
141190 , p_side => 'NA'
141191 );
141192
141193 xla_ae_lines_pkg.set_ccid(
141194 p_code_combination_id => l_ccid
141195 , p_value_type_code => l_adr_value_type_code
141196 , p_transaction_coa_id => l_adr_transaction_coa_id
141197 , p_accounting_coa_id => l_adr_accounting_coa_id
141198 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
141199 , p_adr_type_code => 'S'
141200 , p_component_type => l_component_type
141201 , p_component_code => l_component_code
141202 , p_component_type_code => l_component_type_code
141203 , p_component_appl_id => l_component_appl_id
141204 , p_amb_context_code => l_amb_context_code
141205 , p_side => 'NA'
141206 );
141207
141208
141209 l_segment := AcctDerRule_169(
141210 p_application_id => p_application_id
141211 , p_ae_header_id => l_ae_header_id
141212 , p_source_5 => p_source_5
141213 , p_source_31 => p_source_31
141214 , x_transaction_coa_id => l_adr_transaction_coa_id
141215 , x_accounting_coa_id => l_adr_accounting_coa_id
141216 , x_flexfield_segment_code => l_adr_flexfield_segment_code
141217 , x_flex_value_set_id => l_adr_flex_value_set_id
141218 , x_value_type_code => l_adr_value_type_code
141219 , x_value_combination_id => l_adr_value_combination_id
141220 , x_value_segment_code => l_adr_value_segment_code
141221 , p_side => 'NA'
141222 , p_override_seg_flag => 'Y'
141223 );
141224
141225 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
141226
141227 xla_ae_lines_pkg.set_segment(
141228 p_to_segment_code => 'GL_BALANCING'
141229 , p_segment_value => l_segment
141230 , p_from_segment_code => l_adr_value_segment_code
141231 , p_from_combination_id => l_adr_value_combination_id
141232 , p_value_type_code => l_adr_value_type_code
141233 , p_transaction_coa_id => l_adr_transaction_coa_id
141234 , p_accounting_coa_id => l_adr_accounting_coa_id
141235 , p_flexfield_segment_code => l_adr_flexfield_segment_code
141236 , p_flex_value_set_id => l_adr_flex_value_set_id
141237 , p_adr_code => 'FA_EXPENSE_ACCT'
141238 , p_adr_type_code => 'S'
141239 , p_component_type => l_component_type
141240 , p_component_code => l_component_code
141241 , p_component_type_code => l_component_type_code
141242 , p_component_appl_id => l_component_appl_id
141243 , p_amb_context_code => l_amb_context_code
141244 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
141245 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
141246 , p_side => 'NA'
141247 );
141248
141249 END IF;
141250
141251 l_segment := AcctDerRule_159(
141252 p_application_id => p_application_id
141253 , p_ae_header_id => l_ae_header_id
141254 , p_source_5 => p_source_5
141255 , p_source_22 => p_source_22
141256 , x_transaction_coa_id => l_adr_transaction_coa_id
141257 , x_accounting_coa_id => l_adr_accounting_coa_id
141258 , x_flexfield_segment_code => l_adr_flexfield_segment_code
141259 , x_flex_value_set_id => l_adr_flex_value_set_id
141260 , x_value_type_code => l_adr_value_type_code
141261 , x_value_combination_id => l_adr_value_combination_id
141262 , x_value_segment_code => l_adr_value_segment_code
141263 , p_side => 'NA'
141264 , p_override_seg_flag => 'Y'
141265 );
141266
141267 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
141268
141269 xla_ae_lines_pkg.set_segment(
141270 p_to_segment_code => 'GL_ACCOUNT'
141271 , p_segment_value => l_segment
141272 , p_from_segment_code => l_adr_value_segment_code
141273 , p_from_combination_id => l_adr_value_combination_id
141274 , p_value_type_code => l_adr_value_type_code
141275 , p_transaction_coa_id => l_adr_transaction_coa_id
141276 , p_accounting_coa_id => l_adr_accounting_coa_id
141280 , p_adr_type_code => 'S'
141277 , p_flexfield_segment_code => l_adr_flexfield_segment_code
141278 , p_flex_value_set_id => l_adr_flex_value_set_id
141279 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
141281 , p_component_type => l_component_type
141282 , p_component_code => l_component_code
141283 , p_component_type_code => l_component_type_code
141284 , p_component_appl_id => l_component_appl_id
141285 , p_amb_context_code => l_amb_context_code
141286 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
141287 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
141288 , p_side => 'NA'
141289 );
141290
141291 END IF;
141292
141293 --
141294 --
141295 END IF;
141296
141297 --
141298 -- Update the line information that should be overwritten
141299 --
141300 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
141301 p_header_num => 1);
141302 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
141303
141304 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
141305
141306 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
141307 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
141308 END IF;
141309
141310 --
141311 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
141312 --
141313 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
141314 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
141315 ELSE
141316 ---------------------------------------------------------------------------------------------------
141317 -- 4262811a Switch Sign
141318 ---------------------------------------------------------------------------------------------------
141319 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
141320 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
141321 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
141322 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
141323 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
141324 -- 5132302
141325 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
141326 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
141327
141328 END IF;
141329
141330 -- 4955764
141331 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
141332 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
141333
141334
141335 XLA_AE_LINES_PKG.ValidateCurrentLine;
141336 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
141337
141338 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
141339 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
141340 ,p_balance_type_code => l_balance_type_code);
141341
141342 END IF;
141343
141344 -----------------------------------------------------------------------------------------
141345 -- 4262811 Multiperiod Accounting
141346 -----------------------------------------------------------------------------------------
141347 -- No MPA option is assigned.
141348
141349
141350 END IF;
141351 END IF;
141352 --
141353
141354 --
141355 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
141356 trace
141357 (p_msg => 'END of AcctLineType_362'
141358 ,p_level => C_LEVEL_PROCEDURE
141359 ,p_module => l_log_module);
141360 END IF;
141361 --
141362 EXCEPTION
141363 WHEN xla_exceptions_pkg.application_exception THEN
141364 RAISE;
141365 WHEN OTHERS THEN
141366 xla_exceptions_pkg.raise_message
141367 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_362');
141368 END AcctLineType_362;
141369 --
141370
141371 ---------------------------------------
141372 --
141373 -- PRIVATE FUNCTION
141374 -- AcctLineType_363
141375 --
141376 ---------------------------------------
141377 PROCEDURE AcctLineType_363 (
141378 p_application_id IN NUMBER
141379 ,p_event_id IN NUMBER
141380 ,p_calculate_acctd_flag IN VARCHAR2
141381 ,p_calculate_g_l_flag IN VARCHAR2
141382 ,p_actual_flag IN OUT VARCHAR2
141383 ,p_balance_type_code OUT VARCHAR2
141384 ,p_gain_or_loss_ref OUT VARCHAR2
141385
141386 --Period Close Date
141387 , p_source_1 IN DATE
141388 --Bonus Depreciation Expense Account
141389 , p_source_4 IN VARCHAR2
141390 --Generated Code Combination Identifier
141391 , p_source_5 IN NUMBER
141392 --Expense Account Code Combination Identifier
141393 , p_source_31 IN NUMBER
141394 --Adjustment Type
141395 , p_source_48 IN VARCHAR2
141396 --Transaction Header Identifier
141397 , p_source_49 IN NUMBER
141401 , p_source_51 IN VARCHAR2
141398 --Adjustment Line Identifier
141399 , p_source_50 IN NUMBER
141400 --Distribution Type Code
141402 --Entered Amount
141403 , p_source_52 IN NUMBER
141404 --Currency Code
141405 , p_source_53 IN VARCHAR2
141406 --Source Destination Code
141407 , p_source_55 IN VARCHAR2
141408 )
141409 IS
141410
141411 l_component_type VARCHAR2(80);
141412 l_component_code VARCHAR2(30);
141413 l_component_type_code VARCHAR2(1);
141414 l_component_appl_id INTEGER;
141415 l_amb_context_code VARCHAR2(30);
141416 l_entity_code VARCHAR2(30);
141417 l_event_class_code VARCHAR2(30);
141418 l_ae_header_id NUMBER;
141419 l_event_type_code VARCHAR2(30);
141420 l_line_definition_code VARCHAR2(30);
141421 l_line_definition_owner_code VARCHAR2(1);
141422 --
141423 -- adr variables
141424 l_segment VARCHAR2(30);
141425 l_ccid NUMBER;
141426 l_adr_transaction_coa_id NUMBER;
141427 l_adr_accounting_coa_id NUMBER;
141428 l_adr_flexfield_segment_code VARCHAR2(30);
141429 l_adr_flex_value_set_id NUMBER;
141430 l_adr_value_type_code VARCHAR2(30);
141431 l_adr_value_combination_id NUMBER;
141432 l_adr_value_segment_code VARCHAR2(30);
141433
141434 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
141435 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
141436 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
141437 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
141438
141439 -- 4262811 Variables ------------------------------------------------------------------------------------------
141440 l_entered_amt_idx NUMBER;
141441 l_accted_amt_idx NUMBER;
141442 l_acc_rev_flag VARCHAR2(1);
141443 l_accrual_line_num NUMBER;
141444 l_tmp_amt NUMBER;
141445 l_acc_rev_natural_side_code VARCHAR2(1);
141446
141447 l_num_entries NUMBER;
141448 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
141449 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
141450 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
141451 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
141452 l_recog_line_1 NUMBER;
141453 l_recog_line_2 NUMBER;
141454
141455 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
141456 l_bflow_applied_to_amt NUMBER; -- 5132302
141457 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
141458
141459 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
141460
141461 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
141462 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
141463
141464 ---------------------------------------------------------------------------------------------------------------
141465
141466
141467 --
141468 -- bulk performance
141469 --
141470 l_balance_type_code VARCHAR2(1);
141471 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
141472 l_log_module VARCHAR2(240);
141473
141474 --
141475 -- Upgrade strategy
141476 --
141477 l_actual_upg_option VARCHAR2(1);
141478 l_enc_upg_option VARCHAR2(1);
141479
141480 --
141481 BEGIN
141482 --
141483 IF g_log_enabled THEN
141484 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_363';
141485 END IF;
141486 --
141487 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
141488
141489 trace
141490 (p_msg => 'BEGIN of AcctLineType_363'
141491 ,p_level => C_LEVEL_PROCEDURE
141492 ,p_module => l_log_module);
141493
141494 END IF;
141495 --
141496 l_component_type := 'AMB_JLT';
141497 l_component_code := 'FA_SLT_SOURCE_BONUS_EXP';
141498 l_component_type_code := 'S';
141499 l_component_appl_id := 140;
141500 l_amb_context_code := 'DEFAULT';
141501 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
141502 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
141503 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
141504 l_line_definition_owner_code := 'S';
141505 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
141506 --
141507 l_balance_type_code := 'A';
141508 l_segment := NULL;
141509 l_ccid := NULL;
141510 l_adr_transaction_coa_id := NULL;
141511 l_adr_accounting_coa_id := NULL;
141512 l_adr_flexfield_segment_code := NULL;
141513 l_adr_flex_value_set_id := NULL;
141514 l_adr_value_type_code := NULL;
141515 l_adr_value_combination_id := NULL;
141516 l_adr_value_segment_code := NULL;
141517
141518 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
141519 l_bflow_class_code := ''; -- 4219869 Business Flow
141520 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
141521 l_budgetary_control_flag := 'N';
141522
141523 l_bflow_applied_to_amt_idx := NULL; -- 5132302
141524 l_bflow_applied_to_amt := NULL; -- 5132302
141528 l_accrual_line_num := NULL; -- 4262811
141525 l_entered_amt_idx := NULL; -- 4262811
141526 l_accted_amt_idx := NULL; -- 4262811
141527 l_acc_rev_flag := NULL; -- 4262811
141529 l_tmp_amt := NULL; -- 4262811
141530 --
141531
141532 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
141533 l_balance_type_code <> 'B' THEN
141534 IF NVL(p_source_48,'
141535 ') = 'BONUS EXPENSE' AND
141536 NVL(p_source_55,'
141537 ') = 'SOURCE'
141538 THEN
141539
141540 --
141541 XLA_AE_LINES_PKG.SetNewLine;
141542
141543 p_balance_type_code := l_balance_type_code;
141544 -- set the flag so later we will know whether the gain loss line needs to be created
141545
141546 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
141547 p_actual_flag :='A';
141548 END IF;
141549
141550 --
141551 -- bulk performance
141552 --
141553 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
141554 p_header_num => 0); -- 4262811
141555 --
141556 -- set accounting line options
141557 --
141558 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
141559 p_natural_side_code => 'C'
141560 , p_gain_or_loss_flag => 'N'
141561 , p_gl_transfer_mode_code => 'S'
141562 , p_acct_entry_type_code => 'A'
141563 , p_switch_side_flag => 'Y'
141564 , p_merge_duplicate_code => 'N'
141565 );
141566 --
141567 l_acc_rev_natural_side_code := 'D'; -- 4262811
141568 --
141569 --
141570 -- set accounting line type info
141571 --
141572 xla_ae_lines_pkg.SetAcctLineType
141573 (p_component_type => l_component_type
141574 ,p_event_type_code => l_event_type_code
141575 ,p_line_definition_owner_code => l_line_definition_owner_code
141576 ,p_line_definition_code => l_line_definition_code
141577 ,p_accounting_line_code => l_component_code
141578 ,p_accounting_line_type_code => l_component_type_code
141579 ,p_accounting_line_appl_id => l_component_appl_id
141580 ,p_amb_context_code => l_amb_context_code
141581 ,p_entity_code => l_entity_code
141582 ,p_event_class_code => l_event_class_code);
141583 --
141584 -- set accounting class
141585 --
141586 xla_ae_lines_pkg.SetAcctClass(
141587 p_accounting_class_code => 'EXPENSE'
141588 , p_ae_header_id => l_ae_header_id
141589 );
141590
141591 --
141592 -- set rounding class
141593 --
141594 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
141595 'EXPENSE';
141596
141597 --
141598 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
141599 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
141600 --
141601 -- bulk performance
141602 --
141603 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
141604
141605 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
141606 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
141607
141608 -- 4955764
141609 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
141610 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
141611
141612 -- 4458381 Public Sector Enh
141613
141614 --
141615 -- set accounting attributes for the line type
141616 --
141617 l_entered_amt_idx := 4;
141618 l_accted_amt_idx := 6;
141619 l_bflow_applied_to_amt_idx := NULL; -- 5132302
141620 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
141621 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
141622 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
141623 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
141624 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
141625 l_rec_acct_attrs.array_char_value(3) := p_source_51;
141626 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
141627 l_rec_acct_attrs.array_num_value(4) := p_source_52;
141628 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
141629 l_rec_acct_attrs.array_char_value(5) := p_source_53;
141630 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
141631 l_rec_acct_attrs.array_num_value(6) := p_source_52;
141632
141633 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
141634 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
141635
141636 ---------------------------------------------------------------------------------------------------------------
141637 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
141638 ---------------------------------------------------------------------------------------------------------------
141639 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
141640
141644 IF xla_accounting_cache_pkg.GetValueChar
141641 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
141642 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
141643
141645 (p_source_code => 'LEDGER_CATEGORY_CODE'
141646 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
141647 AND l_bflow_method_code = 'PRIOR_ENTRY'
141648 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
141649 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
141650 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
141651 )
141652 THEN
141653 xla_ae_lines_pkg.BflowUpgEntry
141654 (p_business_method_code => l_bflow_method_code
141655 ,p_business_class_code => l_bflow_class_code
141656 ,p_balance_type => l_balance_type_code);
141657 ELSE
141658 NULL;
141659 -- No business flow processing for business flow method of NONE.
141660 END IF;
141661
141662 --
141663 -- call analytical criteria
141664 --
141665
141666 --
141667 -- call description
141668 --
141669
141670 xla_ae_lines_pkg.SetLineDescription(
141671 p_ae_header_id => l_ae_header_id
141672 ,p_description => Description_103 (
141673 p_application_id => p_application_id
141674 , p_ae_header_id => l_ae_header_id
141675 , p_source_1 => p_source_1
141676 )
141677 );
141678
141679
141680 --
141681 -- call ADRs
141682 -- Bug 4922099
141683 --
141684 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
141685 (NVL(l_actual_upg_option, 'N') = 'O') OR
141686 (NVL(l_enc_upg_option, 'N') = 'O')
141687 )
141688 THEN
141689 NULL;
141690 --
141691 --
141692
141693 l_ccid := AcctDerRule_176(
141694 p_application_id => p_application_id
141695 , p_ae_header_id => l_ae_header_id
141696 , p_source_5 => p_source_5
141697 , p_source_31 => p_source_31
141698 , x_transaction_coa_id => l_adr_transaction_coa_id
141699 , x_accounting_coa_id => l_adr_accounting_coa_id
141700 , x_value_type_code => l_adr_value_type_code
141701 , p_side => 'NA'
141702 );
141703
141704 xla_ae_lines_pkg.set_ccid(
141705 p_code_combination_id => l_ccid
141706 , p_value_type_code => l_adr_value_type_code
141707 , p_transaction_coa_id => l_adr_transaction_coa_id
141708 , p_accounting_coa_id => l_adr_accounting_coa_id
141709 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
141710 , p_adr_type_code => 'S'
141711 , p_component_type => l_component_type
141712 , p_component_code => l_component_code
141713 , p_component_type_code => l_component_type_code
141714 , p_component_appl_id => l_component_appl_id
141715 , p_amb_context_code => l_amb_context_code
141716 , p_side => 'NA'
141717 );
141718
141719
141720 l_segment := AcctDerRule_144(
141721 p_application_id => p_application_id
141722 , p_ae_header_id => l_ae_header_id
141723 , p_source_4 => p_source_4
141724 , p_source_5 => p_source_5
141725 , x_transaction_coa_id => l_adr_transaction_coa_id
141726 , x_accounting_coa_id => l_adr_accounting_coa_id
141727 , x_flexfield_segment_code => l_adr_flexfield_segment_code
141728 , x_flex_value_set_id => l_adr_flex_value_set_id
141729 , x_value_type_code => l_adr_value_type_code
141730 , x_value_combination_id => l_adr_value_combination_id
141731 , x_value_segment_code => l_adr_value_segment_code
141732 , p_side => 'NA'
141733 , p_override_seg_flag => 'Y'
141734 );
141735
141736 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
141737
141738 xla_ae_lines_pkg.set_segment(
141739 p_to_segment_code => 'GL_ACCOUNT'
141740 , p_segment_value => l_segment
141741 , p_from_segment_code => l_adr_value_segment_code
141742 , p_from_combination_id => l_adr_value_combination_id
141743 , p_value_type_code => l_adr_value_type_code
141744 , p_transaction_coa_id => l_adr_transaction_coa_id
141745 , p_accounting_coa_id => l_adr_accounting_coa_id
141746 , p_flexfield_segment_code => l_adr_flexfield_segment_code
141747 , p_flex_value_set_id => l_adr_flex_value_set_id
141748 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
141749 , p_adr_type_code => 'S'
141750 , p_component_type => l_component_type
141751 , p_component_code => l_component_code
141752 , p_component_type_code => l_component_type_code
141753 , p_component_appl_id => l_component_appl_id
141754 , p_amb_context_code => l_amb_context_code
141755 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
141756 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
141757 , p_side => 'NA'
141758 );
141759
141760 END IF;
141761
141762 --
141763 --
141764 END IF;
141765 --
141766 -- Bug 4922099
141767 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
141771 )
141768 (NVL(l_enc_upg_option, 'N') = 'O')
141769 ) AND
141770 (l_bflow_method_code = 'PRIOR_ENTRY')
141772 THEN
141773 IF
141774 --
141775 1 = 2
141776 --
141777 THEN
141778 xla_accounting_err_pkg.build_message
141779 (p_appli_s_name => 'XLA'
141780 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
141781 ,p_token_1 => 'LINE_NUMBER'
141782 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
141783 ,p_token_2 => 'LINE_TYPE_NAME'
141784 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
141785 l_component_type
141786 ,l_component_code
141787 ,l_component_type_code
141788 ,l_component_appl_id
141789 ,l_amb_context_code
141790 ,l_entity_code
141791 ,l_event_class_code
141792 )
141793 ,p_token_3 => 'OWNER'
141794 ,p_value_3 => xla_lookups_pkg.get_meaning(
141795 p_lookup_type => 'XLA_OWNER_TYPE'
141796 ,p_lookup_code => l_component_type_code
141797 )
141798 ,p_token_4 => 'PRODUCT_NAME'
141799 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
141800 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
141801 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
141802 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
141803 ,p_ae_header_id => NULL
141804 );
141805
141806 IF (C_LEVEL_ERROR>= g_log_level) THEN
141807 trace
141808 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
141809 ,p_level => C_LEVEL_ERROR
141810 ,p_module => l_log_module);
141811 END IF;
141812 END IF;
141813 END IF;
141814 --
141815 --
141816 ------------------------------------------------------------------------------------------------
141817 -- 4219869 Business Flow
141818 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
141819 -- Prior Entry. Currently, the following code is always generated.
141820 ------------------------------------------------------------------------------------------------
141821 XLA_AE_LINES_PKG.ValidateCurrentLine;
141822
141823 ------------------------------------------------------------------------------------
141824 -- 4219869 Business Flow
141825 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
141826 ------------------------------------------------------------------------------------
141827 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
141828
141829 ----------------------------------------------------------------------------------
141830 -- 4219869 Business Flow
141831 -- Update journal entry status -- Need to generate this within IF <condition>
141832 ----------------------------------------------------------------------------------
141833 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
141834 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
141835 ,p_balance_type_code => l_balance_type_code
141836 );
141837
141838 -------------------------------------------------------------------------------------------
141839 -- 4262811 - Generate the Accrual Reversal lines
141840 -------------------------------------------------------------------------------------------
141841 BEGIN
141842 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
141843 (g_array_event(p_event_id).array_value_num('header_index'));
141844 IF l_acc_rev_flag IS NULL THEN
141845 l_acc_rev_flag := 'N';
141846 END IF;
141847 EXCEPTION
141848 WHEN OTHERS THEN
141849 l_acc_rev_flag := 'N';
141850 END;
141851 --
141852 IF (l_acc_rev_flag = 'Y') THEN
141853
141854 -- 4645092 ------------------------------------------------------------------------------
141855 -- To allow MPA report to determine if it should generate report process
141856 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
141857 ------------------------------------------------------------------------------------------
141858
141859 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
141860 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
141864 --
141861 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
141862 -- call ADRs
141863 -- Bug 4922099
141865 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
141866 (NVL(l_actual_upg_option, 'N') = 'O') OR
141867 (NVL(l_enc_upg_option, 'N') = 'O')
141868 )
141869 THEN
141870 NULL;
141871 --
141872 --
141873
141874 l_ccid := AcctDerRule_176(
141875 p_application_id => p_application_id
141876 , p_ae_header_id => l_ae_header_id
141877 , p_source_5 => p_source_5
141878 , p_source_31 => p_source_31
141879 , x_transaction_coa_id => l_adr_transaction_coa_id
141880 , x_accounting_coa_id => l_adr_accounting_coa_id
141881 , x_value_type_code => l_adr_value_type_code
141882 , p_side => 'NA'
141883 );
141884
141885 xla_ae_lines_pkg.set_ccid(
141886 p_code_combination_id => l_ccid
141887 , p_value_type_code => l_adr_value_type_code
141888 , p_transaction_coa_id => l_adr_transaction_coa_id
141889 , p_accounting_coa_id => l_adr_accounting_coa_id
141890 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
141891 , p_adr_type_code => 'S'
141892 , p_component_type => l_component_type
141893 , p_component_code => l_component_code
141894 , p_component_type_code => l_component_type_code
141895 , p_component_appl_id => l_component_appl_id
141896 , p_amb_context_code => l_amb_context_code
141897 , p_side => 'NA'
141898 );
141899
141900
141901 l_segment := AcctDerRule_144(
141902 p_application_id => p_application_id
141903 , p_ae_header_id => l_ae_header_id
141904 , p_source_4 => p_source_4
141905 , p_source_5 => p_source_5
141906 , x_transaction_coa_id => l_adr_transaction_coa_id
141907 , x_accounting_coa_id => l_adr_accounting_coa_id
141908 , x_flexfield_segment_code => l_adr_flexfield_segment_code
141909 , x_flex_value_set_id => l_adr_flex_value_set_id
141910 , x_value_type_code => l_adr_value_type_code
141911 , x_value_combination_id => l_adr_value_combination_id
141912 , x_value_segment_code => l_adr_value_segment_code
141913 , p_side => 'NA'
141914 , p_override_seg_flag => 'Y'
141915 );
141916
141917 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
141918
141919 xla_ae_lines_pkg.set_segment(
141920 p_to_segment_code => 'GL_ACCOUNT'
141921 , p_segment_value => l_segment
141922 , p_from_segment_code => l_adr_value_segment_code
141923 , p_from_combination_id => l_adr_value_combination_id
141924 , p_value_type_code => l_adr_value_type_code
141925 , p_transaction_coa_id => l_adr_transaction_coa_id
141926 , p_accounting_coa_id => l_adr_accounting_coa_id
141927 , p_flexfield_segment_code => l_adr_flexfield_segment_code
141928 , p_flex_value_set_id => l_adr_flex_value_set_id
141929 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
141930 , p_adr_type_code => 'S'
141931 , p_component_type => l_component_type
141932 , p_component_code => l_component_code
141933 , p_component_type_code => l_component_type_code
141934 , p_component_appl_id => l_component_appl_id
141935 , p_amb_context_code => l_amb_context_code
141936 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
141937 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
141938 , p_side => 'NA'
141939 );
141940
141941 END IF;
141942
141943 --
141944 --
141945 END IF;
141946
141947 --
141948 -- Update the line information that should be overwritten
141949 --
141950 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
141951 p_header_num => 1);
141952 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
141953
141954 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
141955
141956 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
141957 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
141958 END IF;
141959
141960 --
141961 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
141962 --
141963 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
141964 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
141965 ELSE
141966 ---------------------------------------------------------------------------------------------------
141967 -- 4262811a Switch Sign
141968 ---------------------------------------------------------------------------------------------------
141969 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
141970 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
141974 -- 5132302
141971 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
141972 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
141973 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
141975 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
141976 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
141977
141978 END IF;
141979
141980 -- 4955764
141981 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
141982 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
141983
141984
141985 XLA_AE_LINES_PKG.ValidateCurrentLine;
141986 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
141987
141988 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
141989 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
141990 ,p_balance_type_code => l_balance_type_code);
141991
141992 END IF;
141993
141994 -----------------------------------------------------------------------------------------
141995 -- 4262811 Multiperiod Accounting
141996 -----------------------------------------------------------------------------------------
141997 -- No MPA option is assigned.
141998
141999
142000 END IF;
142001 END IF;
142002 --
142003
142004 --
142005 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
142006 trace
142007 (p_msg => 'END of AcctLineType_363'
142008 ,p_level => C_LEVEL_PROCEDURE
142009 ,p_module => l_log_module);
142010 END IF;
142011 --
142012 EXCEPTION
142013 WHEN xla_exceptions_pkg.application_exception THEN
142014 RAISE;
142015 WHEN OTHERS THEN
142016 xla_exceptions_pkg.raise_message
142017 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_363');
142018 END AcctLineType_363;
142019 --
142020
142021 ---------------------------------------
142022 --
142023 -- PRIVATE FUNCTION
142024 -- AcctLineType_364
142025 --
142026 ---------------------------------------
142027 PROCEDURE AcctLineType_364 (
142028 p_application_id IN NUMBER
142029 ,p_event_id IN NUMBER
142030 ,p_calculate_acctd_flag IN VARCHAR2
142031 ,p_calculate_g_l_flag IN VARCHAR2
142032 ,p_actual_flag IN OUT VARCHAR2
142033 ,p_balance_type_code OUT VARCHAR2
142034 ,p_gain_or_loss_ref OUT VARCHAR2
142035
142036 --Period Close Date
142037 , p_source_1 IN DATE
142038 --Generated Code Combination Identifier
142039 , p_source_5 IN NUMBER
142040 --Bonus Reserve Account
142041 , p_source_6 IN VARCHAR2
142042 --Generated Offset Code Combination Identifier
142043 , p_source_19 IN NUMBER
142044 --Expense Account Code Combination Identifier
142045 , p_source_31 IN NUMBER
142046 --Default Code Combination Identifier
142047 , p_source_32 IN NUMBER
142048 --Adjustment Type
142049 , p_source_48 IN VARCHAR2
142050 --Transaction Header Identifier
142051 , p_source_49 IN NUMBER
142052 --Adjustment Line Identifier
142053 , p_source_50 IN NUMBER
142054 --Distribution Type Code
142055 , p_source_51 IN VARCHAR2
142056 --Entered Amount
142057 , p_source_52 IN NUMBER
142058 --Currency Code
142059 , p_source_53 IN VARCHAR2
142060 --Source Destination Code
142061 , p_source_55 IN VARCHAR2
142062 )
142063 IS
142064
142065 l_component_type VARCHAR2(80);
142066 l_component_code VARCHAR2(30);
142067 l_component_type_code VARCHAR2(1);
142068 l_component_appl_id INTEGER;
142069 l_amb_context_code VARCHAR2(30);
142070 l_entity_code VARCHAR2(30);
142071 l_event_class_code VARCHAR2(30);
142072 l_ae_header_id NUMBER;
142073 l_event_type_code VARCHAR2(30);
142074 l_line_definition_code VARCHAR2(30);
142075 l_line_definition_owner_code VARCHAR2(1);
142076 --
142077 -- adr variables
142078 l_segment VARCHAR2(30);
142079 l_ccid NUMBER;
142080 l_adr_transaction_coa_id NUMBER;
142081 l_adr_accounting_coa_id NUMBER;
142082 l_adr_flexfield_segment_code VARCHAR2(30);
142083 l_adr_flex_value_set_id NUMBER;
142084 l_adr_value_type_code VARCHAR2(30);
142085 l_adr_value_combination_id NUMBER;
142086 l_adr_value_segment_code VARCHAR2(30);
142087
142088 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
142089 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
142090 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
142091 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
142092
142093 -- 4262811 Variables ------------------------------------------------------------------------------------------
142094 l_entered_amt_idx NUMBER;
142095 l_accted_amt_idx NUMBER;
142096 l_acc_rev_flag VARCHAR2(1);
142097 l_accrual_line_num NUMBER;
142098 l_tmp_amt NUMBER;
142099 l_acc_rev_natural_side_code VARCHAR2(1);
142100
142104 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
142101 l_num_entries NUMBER;
142102 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
142103 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
142105 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
142106 l_recog_line_1 NUMBER;
142107 l_recog_line_2 NUMBER;
142108
142109 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
142110 l_bflow_applied_to_amt NUMBER; -- 5132302
142111 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
142112
142113 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
142114
142115 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
142116 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
142117
142118 ---------------------------------------------------------------------------------------------------------------
142119
142120
142121 --
142122 -- bulk performance
142123 --
142124 l_balance_type_code VARCHAR2(1);
142125 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
142126 l_log_module VARCHAR2(240);
142127
142128 --
142129 -- Upgrade strategy
142130 --
142131 l_actual_upg_option VARCHAR2(1);
142132 l_enc_upg_option VARCHAR2(1);
142133
142134 --
142135 BEGIN
142136 --
142137 IF g_log_enabled THEN
142138 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_364';
142139 END IF;
142140 --
142141 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
142142
142143 trace
142144 (p_msg => 'BEGIN of AcctLineType_364'
142145 ,p_level => C_LEVEL_PROCEDURE
142146 ,p_module => l_log_module);
142147
142148 END IF;
142149 --
142150 l_component_type := 'AMB_JLT';
142151 l_component_code := 'FA_SLT_SOURCE_BONUS_RESERVE';
142152 l_component_type_code := 'S';
142153 l_component_appl_id := 140;
142154 l_amb_context_code := 'DEFAULT';
142155 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
142156 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
142157 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
142158 l_line_definition_owner_code := 'S';
142159 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
142160 --
142161 l_balance_type_code := 'A';
142162 l_segment := NULL;
142163 l_ccid := NULL;
142164 l_adr_transaction_coa_id := NULL;
142165 l_adr_accounting_coa_id := NULL;
142166 l_adr_flexfield_segment_code := NULL;
142167 l_adr_flex_value_set_id := NULL;
142168 l_adr_value_type_code := NULL;
142169 l_adr_value_combination_id := NULL;
142170 l_adr_value_segment_code := NULL;
142171
142172 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
142173 l_bflow_class_code := ''; -- 4219869 Business Flow
142174 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
142175 l_budgetary_control_flag := 'N';
142176
142177 l_bflow_applied_to_amt_idx := NULL; -- 5132302
142178 l_bflow_applied_to_amt := NULL; -- 5132302
142179 l_entered_amt_idx := NULL; -- 4262811
142180 l_accted_amt_idx := NULL; -- 4262811
142181 l_acc_rev_flag := NULL; -- 4262811
142182 l_accrual_line_num := NULL; -- 4262811
142183 l_tmp_amt := NULL; -- 4262811
142184 --
142185
142186 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
142187 l_balance_type_code <> 'B' THEN
142188 IF (NVL(p_source_48,'
142189 ') = 'BONUS EXPENSE' OR
142190 NVL(p_source_48,'
142191 ') = 'BONUS RESERVE') AND
142192 NVL(p_source_55,'
142193 ') = 'SOURCE'
142194 THEN
142195
142196 --
142197 XLA_AE_LINES_PKG.SetNewLine;
142198
142199 p_balance_type_code := l_balance_type_code;
142200 -- set the flag so later we will know whether the gain loss line needs to be created
142201
142202 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
142203 p_actual_flag :='A';
142204 END IF;
142205
142206 --
142207 -- bulk performance
142208 --
142209 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
142210 p_header_num => 0); -- 4262811
142211 --
142212 -- set accounting line options
142213 --
142214 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
142215 p_natural_side_code => 'D'
142216 , p_gain_or_loss_flag => 'N'
142217 , p_gl_transfer_mode_code => 'S'
142218 , p_acct_entry_type_code => 'A'
142219 , p_switch_side_flag => 'Y'
142220 , p_merge_duplicate_code => 'N'
142221 );
142222 --
142223 l_acc_rev_natural_side_code := 'C'; -- 4262811
142224 --
142225 --
142226 -- set accounting line type info
142227 --
142228 xla_ae_lines_pkg.SetAcctLineType
142229 (p_component_type => l_component_type
142230 ,p_event_type_code => l_event_type_code
142231 ,p_line_definition_owner_code => l_line_definition_owner_code
142235 ,p_accounting_line_appl_id => l_component_appl_id
142232 ,p_line_definition_code => l_line_definition_code
142233 ,p_accounting_line_code => l_component_code
142234 ,p_accounting_line_type_code => l_component_type_code
142236 ,p_amb_context_code => l_amb_context_code
142237 ,p_entity_code => l_entity_code
142238 ,p_event_class_code => l_event_class_code);
142239 --
142240 -- set accounting class
142241 --
142242 xla_ae_lines_pkg.SetAcctClass(
142243 p_accounting_class_code => 'ASSET'
142244 , p_ae_header_id => l_ae_header_id
142245 );
142246
142247 --
142248 -- set rounding class
142249 --
142250 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
142251 'ASSET';
142252
142253 --
142254 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
142255 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
142256 --
142257 -- bulk performance
142258 --
142259 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
142260
142261 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
142262 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
142263
142264 -- 4955764
142265 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
142266 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
142267
142268 -- 4458381 Public Sector Enh
142269
142270 --
142271 -- set accounting attributes for the line type
142272 --
142273 l_entered_amt_idx := 4;
142274 l_accted_amt_idx := 6;
142275 l_bflow_applied_to_amt_idx := NULL; -- 5132302
142276 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
142277 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
142278 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
142279 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
142280 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
142281 l_rec_acct_attrs.array_char_value(3) := p_source_51;
142282 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
142283 l_rec_acct_attrs.array_num_value(4) := p_source_52;
142284 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
142285 l_rec_acct_attrs.array_char_value(5) := p_source_53;
142286 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
142287 l_rec_acct_attrs.array_num_value(6) := p_source_52;
142288
142289 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
142290 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
142291
142292 ---------------------------------------------------------------------------------------------------------------
142293 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
142294 ---------------------------------------------------------------------------------------------------------------
142295 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
142296
142297 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
142298 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
142299
142300 IF xla_accounting_cache_pkg.GetValueChar
142301 (p_source_code => 'LEDGER_CATEGORY_CODE'
142302 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
142303 AND l_bflow_method_code = 'PRIOR_ENTRY'
142304 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
142305 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
142306 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
142307 )
142308 THEN
142309 xla_ae_lines_pkg.BflowUpgEntry
142310 (p_business_method_code => l_bflow_method_code
142311 ,p_business_class_code => l_bflow_class_code
142312 ,p_balance_type => l_balance_type_code);
142313 ELSE
142314 NULL;
142315 -- No business flow processing for business flow method of NONE.
142316 END IF;
142317
142318 --
142319 -- call analytical criteria
142320 --
142321
142322 --
142323 -- call description
142324 --
142325
142326 xla_ae_lines_pkg.SetLineDescription(
142327 p_ae_header_id => l_ae_header_id
142328 ,p_description => Description_104 (
142329 p_application_id => p_application_id
142330 , p_ae_header_id => l_ae_header_id
142331 , p_source_1 => p_source_1
142332 )
142333 );
142334
142335
142336 --
142337 -- call ADRs
142338 -- Bug 4922099
142339 --
142340 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
142341 (NVL(l_actual_upg_option, 'N') = 'O') OR
142342 (NVL(l_enc_upg_option, 'N') = 'O')
142343 )
142344 THEN
142345 NULL;
142346 --
142347 --
142348
142349 l_ccid := AcctDerRule_175(
142350 p_application_id => p_application_id
142351 , p_ae_header_id => l_ae_header_id
142352 , p_source_5 => p_source_5
142353 , p_source_19 => p_source_19
142354 , p_source_32 => p_source_32
142358 , p_side => 'NA'
142355 , x_transaction_coa_id => l_adr_transaction_coa_id
142356 , x_accounting_coa_id => l_adr_accounting_coa_id
142357 , x_value_type_code => l_adr_value_type_code
142359 );
142360
142361 xla_ae_lines_pkg.set_ccid(
142362 p_code_combination_id => l_ccid
142363 , p_value_type_code => l_adr_value_type_code
142364 , p_transaction_coa_id => l_adr_transaction_coa_id
142365 , p_accounting_coa_id => l_adr_accounting_coa_id
142366 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
142367 , p_adr_type_code => 'S'
142368 , p_component_type => l_component_type
142369 , p_component_code => l_component_code
142370 , p_component_type_code => l_component_type_code
142371 , p_component_appl_id => l_component_appl_id
142372 , p_amb_context_code => l_amb_context_code
142373 , p_side => 'NA'
142374 );
142375
142376
142377 l_segment := AcctDerRule_145(
142378 p_application_id => p_application_id
142379 , p_ae_header_id => l_ae_header_id
142380 , p_source_5 => p_source_5
142381 , p_source_6 => p_source_6
142382 , x_transaction_coa_id => l_adr_transaction_coa_id
142383 , x_accounting_coa_id => l_adr_accounting_coa_id
142384 , x_flexfield_segment_code => l_adr_flexfield_segment_code
142385 , x_flex_value_set_id => l_adr_flex_value_set_id
142386 , x_value_type_code => l_adr_value_type_code
142387 , x_value_combination_id => l_adr_value_combination_id
142388 , x_value_segment_code => l_adr_value_segment_code
142389 , p_side => 'NA'
142390 , p_override_seg_flag => 'Y'
142391 );
142392
142393 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
142394
142395 xla_ae_lines_pkg.set_segment(
142396 p_to_segment_code => 'GL_ACCOUNT'
142397 , p_segment_value => l_segment
142398 , p_from_segment_code => l_adr_value_segment_code
142399 , p_from_combination_id => l_adr_value_combination_id
142400 , p_value_type_code => l_adr_value_type_code
142401 , p_transaction_coa_id => l_adr_transaction_coa_id
142402 , p_accounting_coa_id => l_adr_accounting_coa_id
142403 , p_flexfield_segment_code => l_adr_flexfield_segment_code
142404 , p_flex_value_set_id => l_adr_flex_value_set_id
142405 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
142406 , p_adr_type_code => 'S'
142407 , p_component_type => l_component_type
142408 , p_component_code => l_component_code
142409 , p_component_type_code => l_component_type_code
142410 , p_component_appl_id => l_component_appl_id
142411 , p_amb_context_code => l_amb_context_code
142412 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
142413 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
142414 , p_side => 'NA'
142415 );
142416
142417 END IF;
142418
142419 l_segment := AcctDerRule_169(
142420 p_application_id => p_application_id
142421 , p_ae_header_id => l_ae_header_id
142422 , p_source_5 => p_source_5
142423 , p_source_31 => p_source_31
142424 , x_transaction_coa_id => l_adr_transaction_coa_id
142425 , x_accounting_coa_id => l_adr_accounting_coa_id
142426 , x_flexfield_segment_code => l_adr_flexfield_segment_code
142427 , x_flex_value_set_id => l_adr_flex_value_set_id
142428 , x_value_type_code => l_adr_value_type_code
142429 , x_value_combination_id => l_adr_value_combination_id
142430 , x_value_segment_code => l_adr_value_segment_code
142431 , p_side => 'NA'
142432 , p_override_seg_flag => 'Y'
142433 );
142434
142435 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
142436
142437 xla_ae_lines_pkg.set_segment(
142438 p_to_segment_code => 'GL_BALANCING'
142439 , p_segment_value => l_segment
142440 , p_from_segment_code => l_adr_value_segment_code
142441 , p_from_combination_id => l_adr_value_combination_id
142442 , p_value_type_code => l_adr_value_type_code
142443 , p_transaction_coa_id => l_adr_transaction_coa_id
142444 , p_accounting_coa_id => l_adr_accounting_coa_id
142445 , p_flexfield_segment_code => l_adr_flexfield_segment_code
142446 , p_flex_value_set_id => l_adr_flex_value_set_id
142447 , p_adr_code => 'FA_EXPENSE_ACCT'
142448 , p_adr_type_code => 'S'
142449 , p_component_type => l_component_type
142450 , p_component_code => l_component_code
142451 , p_component_type_code => l_component_type_code
142452 , p_component_appl_id => l_component_appl_id
142453 , p_amb_context_code => l_amb_context_code
142454 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
142455 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
142456 , p_side => 'NA'
142457 );
142458
142459 END IF;
142460
142461 --
142462 --
142463 END IF;
142464 --
142465 -- Bug 4922099
142469 (l_bflow_method_code = 'PRIOR_ENTRY')
142466 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
142467 (NVL(l_enc_upg_option, 'N') = 'O')
142468 ) AND
142470 )
142471 THEN
142472 IF
142473 --
142474 1 = 2
142475 --
142476 THEN
142477 xla_accounting_err_pkg.build_message
142478 (p_appli_s_name => 'XLA'
142479 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
142480 ,p_token_1 => 'LINE_NUMBER'
142481 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
142482 ,p_token_2 => 'LINE_TYPE_NAME'
142483 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
142484 l_component_type
142485 ,l_component_code
142486 ,l_component_type_code
142487 ,l_component_appl_id
142488 ,l_amb_context_code
142489 ,l_entity_code
142490 ,l_event_class_code
142491 )
142492 ,p_token_3 => 'OWNER'
142493 ,p_value_3 => xla_lookups_pkg.get_meaning(
142494 p_lookup_type => 'XLA_OWNER_TYPE'
142495 ,p_lookup_code => l_component_type_code
142496 )
142497 ,p_token_4 => 'PRODUCT_NAME'
142498 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
142499 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
142500 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
142501 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
142502 ,p_ae_header_id => NULL
142503 );
142504
142505 IF (C_LEVEL_ERROR>= g_log_level) THEN
142506 trace
142507 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
142508 ,p_level => C_LEVEL_ERROR
142509 ,p_module => l_log_module);
142510 END IF;
142511 END IF;
142512 END IF;
142513 --
142514 --
142515 ------------------------------------------------------------------------------------------------
142516 -- 4219869 Business Flow
142517 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
142518 -- Prior Entry. Currently, the following code is always generated.
142519 ------------------------------------------------------------------------------------------------
142520 XLA_AE_LINES_PKG.ValidateCurrentLine;
142521
142522 ------------------------------------------------------------------------------------
142523 -- 4219869 Business Flow
142524 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
142525 ------------------------------------------------------------------------------------
142526 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
142527
142528 ----------------------------------------------------------------------------------
142529 -- 4219869 Business Flow
142530 -- Update journal entry status -- Need to generate this within IF <condition>
142531 ----------------------------------------------------------------------------------
142532 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
142533 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
142534 ,p_balance_type_code => l_balance_type_code
142535 );
142536
142537 -------------------------------------------------------------------------------------------
142538 -- 4262811 - Generate the Accrual Reversal lines
142539 -------------------------------------------------------------------------------------------
142540 BEGIN
142541 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
142542 (g_array_event(p_event_id).array_value_num('header_index'));
142543 IF l_acc_rev_flag IS NULL THEN
142544 l_acc_rev_flag := 'N';
142545 END IF;
142546 EXCEPTION
142547 WHEN OTHERS THEN
142548 l_acc_rev_flag := 'N';
142549 END;
142550 --
142551 IF (l_acc_rev_flag = 'Y') THEN
142552
142553 -- 4645092 ------------------------------------------------------------------------------
142554 -- To allow MPA report to determine if it should generate report process
142555 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
142556 ------------------------------------------------------------------------------------------
142557
142558 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
142562 -- Bug 4922099
142559 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
142560 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
142561 -- call ADRs
142563 --
142564 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
142565 (NVL(l_actual_upg_option, 'N') = 'O') OR
142566 (NVL(l_enc_upg_option, 'N') = 'O')
142567 )
142568 THEN
142569 NULL;
142570 --
142571 --
142572
142573 l_ccid := AcctDerRule_175(
142574 p_application_id => p_application_id
142575 , p_ae_header_id => l_ae_header_id
142576 , p_source_5 => p_source_5
142577 , p_source_19 => p_source_19
142578 , p_source_32 => p_source_32
142579 , x_transaction_coa_id => l_adr_transaction_coa_id
142580 , x_accounting_coa_id => l_adr_accounting_coa_id
142581 , x_value_type_code => l_adr_value_type_code
142582 , p_side => 'NA'
142583 );
142584
142585 xla_ae_lines_pkg.set_ccid(
142586 p_code_combination_id => l_ccid
142587 , p_value_type_code => l_adr_value_type_code
142588 , p_transaction_coa_id => l_adr_transaction_coa_id
142589 , p_accounting_coa_id => l_adr_accounting_coa_id
142590 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
142591 , p_adr_type_code => 'S'
142592 , p_component_type => l_component_type
142593 , p_component_code => l_component_code
142594 , p_component_type_code => l_component_type_code
142595 , p_component_appl_id => l_component_appl_id
142596 , p_amb_context_code => l_amb_context_code
142597 , p_side => 'NA'
142598 );
142599
142600
142601 l_segment := AcctDerRule_145(
142602 p_application_id => p_application_id
142603 , p_ae_header_id => l_ae_header_id
142604 , p_source_5 => p_source_5
142605 , p_source_6 => p_source_6
142606 , x_transaction_coa_id => l_adr_transaction_coa_id
142607 , x_accounting_coa_id => l_adr_accounting_coa_id
142608 , x_flexfield_segment_code => l_adr_flexfield_segment_code
142609 , x_flex_value_set_id => l_adr_flex_value_set_id
142610 , x_value_type_code => l_adr_value_type_code
142611 , x_value_combination_id => l_adr_value_combination_id
142612 , x_value_segment_code => l_adr_value_segment_code
142613 , p_side => 'NA'
142614 , p_override_seg_flag => 'Y'
142615 );
142616
142617 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
142618
142619 xla_ae_lines_pkg.set_segment(
142620 p_to_segment_code => 'GL_ACCOUNT'
142621 , p_segment_value => l_segment
142622 , p_from_segment_code => l_adr_value_segment_code
142623 , p_from_combination_id => l_adr_value_combination_id
142624 , p_value_type_code => l_adr_value_type_code
142625 , p_transaction_coa_id => l_adr_transaction_coa_id
142626 , p_accounting_coa_id => l_adr_accounting_coa_id
142627 , p_flexfield_segment_code => l_adr_flexfield_segment_code
142628 , p_flex_value_set_id => l_adr_flex_value_set_id
142629 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
142630 , p_adr_type_code => 'S'
142631 , p_component_type => l_component_type
142632 , p_component_code => l_component_code
142633 , p_component_type_code => l_component_type_code
142634 , p_component_appl_id => l_component_appl_id
142635 , p_amb_context_code => l_amb_context_code
142636 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
142637 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
142638 , p_side => 'NA'
142639 );
142640
142641 END IF;
142642
142643 l_segment := AcctDerRule_169(
142644 p_application_id => p_application_id
142645 , p_ae_header_id => l_ae_header_id
142646 , p_source_5 => p_source_5
142647 , p_source_31 => p_source_31
142648 , x_transaction_coa_id => l_adr_transaction_coa_id
142649 , x_accounting_coa_id => l_adr_accounting_coa_id
142650 , x_flexfield_segment_code => l_adr_flexfield_segment_code
142651 , x_flex_value_set_id => l_adr_flex_value_set_id
142652 , x_value_type_code => l_adr_value_type_code
142653 , x_value_combination_id => l_adr_value_combination_id
142654 , x_value_segment_code => l_adr_value_segment_code
142655 , p_side => 'NA'
142656 , p_override_seg_flag => 'Y'
142657 );
142658
142659 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
142660
142661 xla_ae_lines_pkg.set_segment(
142662 p_to_segment_code => 'GL_BALANCING'
142663 , p_segment_value => l_segment
142664 , p_from_segment_code => l_adr_value_segment_code
142665 , p_from_combination_id => l_adr_value_combination_id
142666 , p_value_type_code => l_adr_value_type_code
142667 , p_transaction_coa_id => l_adr_transaction_coa_id
142668 , p_accounting_coa_id => l_adr_accounting_coa_id
142669 , p_flexfield_segment_code => l_adr_flexfield_segment_code
142673 , p_component_type => l_component_type
142670 , p_flex_value_set_id => l_adr_flex_value_set_id
142671 , p_adr_code => 'FA_EXPENSE_ACCT'
142672 , p_adr_type_code => 'S'
142674 , p_component_code => l_component_code
142675 , p_component_type_code => l_component_type_code
142676 , p_component_appl_id => l_component_appl_id
142677 , p_amb_context_code => l_amb_context_code
142678 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
142679 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
142680 , p_side => 'NA'
142681 );
142682
142683 END IF;
142684
142685 --
142686 --
142687 END IF;
142688
142689 --
142690 -- Update the line information that should be overwritten
142691 --
142692 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
142693 p_header_num => 1);
142694 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
142695
142696 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
142697
142698 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
142699 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
142700 END IF;
142701
142702 --
142703 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
142704 --
142705 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
142706 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
142707 ELSE
142708 ---------------------------------------------------------------------------------------------------
142709 -- 4262811a Switch Sign
142710 ---------------------------------------------------------------------------------------------------
142711 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
142712 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
142713 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
142714 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
142715 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
142716 -- 5132302
142717 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
142718 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
142719
142720 END IF;
142721
142722 -- 4955764
142723 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
142724 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
142725
142726
142727 XLA_AE_LINES_PKG.ValidateCurrentLine;
142728 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
142729
142730 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
142731 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
142732 ,p_balance_type_code => l_balance_type_code);
142733
142734 END IF;
142735
142736 -----------------------------------------------------------------------------------------
142737 -- 4262811 Multiperiod Accounting
142738 -----------------------------------------------------------------------------------------
142739 -- No MPA option is assigned.
142740
142741
142742 END IF;
142743 END IF;
142744 --
142745
142746 --
142747 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
142748 trace
142749 (p_msg => 'END of AcctLineType_364'
142750 ,p_level => C_LEVEL_PROCEDURE
142751 ,p_module => l_log_module);
142752 END IF;
142753 --
142754 EXCEPTION
142755 WHEN xla_exceptions_pkg.application_exception THEN
142756 RAISE;
142757 WHEN OTHERS THEN
142758 xla_exceptions_pkg.raise_message
142759 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_364');
142760 END AcctLineType_364;
142761 --
142762
142763 ---------------------------------------
142764 --
142765 -- PRIVATE FUNCTION
142766 -- AcctLineType_365
142767 --
142768 ---------------------------------------
142769 PROCEDURE AcctLineType_365 (
142770 p_application_id IN NUMBER
142771 ,p_event_id IN NUMBER
142772 ,p_calculate_acctd_flag IN VARCHAR2
142773 ,p_calculate_g_l_flag IN VARCHAR2
142774 ,p_actual_flag IN OUT VARCHAR2
142775 ,p_balance_type_code OUT VARCHAR2
142776 ,p_gain_or_loss_ref OUT VARCHAR2
142777
142778 --Period Close Date
142779 , p_source_1 IN DATE
142780 --Generated Code Combination Identifier
142781 , p_source_5 IN NUMBER
142782 --CIP Cost Account
142783 , p_source_9 IN VARCHAR2
142784 --Expense Account Code Combination Identifier
142785 , p_source_31 IN NUMBER
142786 --Default Code Combination Identifier
142787 , p_source_32 IN NUMBER
142788 --Adjustment Type
142789 , p_source_48 IN VARCHAR2
142790 --Transaction Header Identifier
142794 --Distribution Type Code
142791 , p_source_49 IN NUMBER
142792 --Adjustment Line Identifier
142793 , p_source_50 IN NUMBER
142795 , p_source_51 IN VARCHAR2
142796 --Entered Amount
142797 , p_source_52 IN NUMBER
142798 --Currency Code
142799 , p_source_53 IN VARCHAR2
142800 --Source Destination Code
142801 , p_source_55 IN VARCHAR2
142802 )
142803 IS
142804
142805 l_component_type VARCHAR2(80);
142806 l_component_code VARCHAR2(30);
142807 l_component_type_code VARCHAR2(1);
142808 l_component_appl_id INTEGER;
142809 l_amb_context_code VARCHAR2(30);
142810 l_entity_code VARCHAR2(30);
142811 l_event_class_code VARCHAR2(30);
142812 l_ae_header_id NUMBER;
142813 l_event_type_code VARCHAR2(30);
142814 l_line_definition_code VARCHAR2(30);
142815 l_line_definition_owner_code VARCHAR2(1);
142816 --
142817 -- adr variables
142818 l_segment VARCHAR2(30);
142819 l_ccid NUMBER;
142820 l_adr_transaction_coa_id NUMBER;
142821 l_adr_accounting_coa_id NUMBER;
142822 l_adr_flexfield_segment_code VARCHAR2(30);
142823 l_adr_flex_value_set_id NUMBER;
142824 l_adr_value_type_code VARCHAR2(30);
142825 l_adr_value_combination_id NUMBER;
142826 l_adr_value_segment_code VARCHAR2(30);
142827
142828 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
142829 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
142830 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
142831 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
142832
142833 -- 4262811 Variables ------------------------------------------------------------------------------------------
142834 l_entered_amt_idx NUMBER;
142835 l_accted_amt_idx NUMBER;
142836 l_acc_rev_flag VARCHAR2(1);
142837 l_accrual_line_num NUMBER;
142838 l_tmp_amt NUMBER;
142839 l_acc_rev_natural_side_code VARCHAR2(1);
142840
142841 l_num_entries NUMBER;
142842 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
142843 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
142844 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
142845 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
142846 l_recog_line_1 NUMBER;
142847 l_recog_line_2 NUMBER;
142848
142849 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
142850 l_bflow_applied_to_amt NUMBER; -- 5132302
142851 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
142852
142853 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
142854
142855 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
142856 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
142857
142858 ---------------------------------------------------------------------------------------------------------------
142859
142860
142861 --
142862 -- bulk performance
142863 --
142864 l_balance_type_code VARCHAR2(1);
142865 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
142866 l_log_module VARCHAR2(240);
142867
142868 --
142869 -- Upgrade strategy
142870 --
142871 l_actual_upg_option VARCHAR2(1);
142872 l_enc_upg_option VARCHAR2(1);
142873
142874 --
142875 BEGIN
142876 --
142877 IF g_log_enabled THEN
142878 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_365';
142879 END IF;
142880 --
142881 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
142882
142883 trace
142884 (p_msg => 'BEGIN of AcctLineType_365'
142885 ,p_level => C_LEVEL_PROCEDURE
142886 ,p_module => l_log_module);
142887
142888 END IF;
142889 --
142890 l_component_type := 'AMB_JLT';
142891 l_component_code := 'FA_SLT_SOURCE_CIP_COST';
142892 l_component_type_code := 'S';
142893 l_component_appl_id := 140;
142894 l_amb_context_code := 'DEFAULT';
142895 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
142896 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
142897 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
142898 l_line_definition_owner_code := 'S';
142899 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
142900 --
142901 l_balance_type_code := 'A';
142902 l_segment := NULL;
142903 l_ccid := NULL;
142904 l_adr_transaction_coa_id := NULL;
142905 l_adr_accounting_coa_id := NULL;
142906 l_adr_flexfield_segment_code := NULL;
142907 l_adr_flex_value_set_id := NULL;
142908 l_adr_value_type_code := NULL;
142909 l_adr_value_combination_id := NULL;
142910 l_adr_value_segment_code := NULL;
142911
142912 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
142913 l_bflow_class_code := ''; -- 4219869 Business Flow
142914 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
142915 l_budgetary_control_flag := 'N';
142916
142917 l_bflow_applied_to_amt_idx := NULL; -- 5132302
142918 l_bflow_applied_to_amt := NULL; -- 5132302
142919 l_entered_amt_idx := NULL; -- 4262811
142920 l_accted_amt_idx := NULL; -- 4262811
142924 --
142921 l_acc_rev_flag := NULL; -- 4262811
142922 l_accrual_line_num := NULL; -- 4262811
142923 l_tmp_amt := NULL; -- 4262811
142925
142926 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
142927 l_balance_type_code <> 'B' THEN
142928 IF NVL(p_source_48,'
142929 ') = 'CIP COST' AND
142930 NVL(p_source_55,'
142931 ') = 'SOURCE'
142932 THEN
142933
142934 --
142935 XLA_AE_LINES_PKG.SetNewLine;
142936
142937 p_balance_type_code := l_balance_type_code;
142938 -- set the flag so later we will know whether the gain loss line needs to be created
142939
142940 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
142941 p_actual_flag :='A';
142942 END IF;
142943
142944 --
142945 -- bulk performance
142946 --
142947 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
142948 p_header_num => 0); -- 4262811
142949 --
142950 -- set accounting line options
142951 --
142952 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
142953 p_natural_side_code => 'C'
142954 , p_gain_or_loss_flag => 'N'
142955 , p_gl_transfer_mode_code => 'S'
142956 , p_acct_entry_type_code => 'A'
142957 , p_switch_side_flag => 'Y'
142958 , p_merge_duplicate_code => 'N'
142959 );
142960 --
142961 l_acc_rev_natural_side_code := 'D'; -- 4262811
142962 --
142963 --
142964 -- set accounting line type info
142965 --
142966 xla_ae_lines_pkg.SetAcctLineType
142967 (p_component_type => l_component_type
142968 ,p_event_type_code => l_event_type_code
142969 ,p_line_definition_owner_code => l_line_definition_owner_code
142970 ,p_line_definition_code => l_line_definition_code
142971 ,p_accounting_line_code => l_component_code
142972 ,p_accounting_line_type_code => l_component_type_code
142973 ,p_accounting_line_appl_id => l_component_appl_id
142974 ,p_amb_context_code => l_amb_context_code
142975 ,p_entity_code => l_entity_code
142976 ,p_event_class_code => l_event_class_code);
142977 --
142978 -- set accounting class
142979 --
142980 xla_ae_lines_pkg.SetAcctClass(
142981 p_accounting_class_code => 'ASSET'
142982 , p_ae_header_id => l_ae_header_id
142983 );
142984
142985 --
142986 -- set rounding class
142987 --
142988 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
142989 'ASSET';
142990
142991 --
142992 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
142993 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
142994 --
142995 -- bulk performance
142996 --
142997 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
142998
142999 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
143000 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
143001
143002 -- 4955764
143003 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
143004 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
143005
143006 -- 4458381 Public Sector Enh
143007
143008 --
143009 -- set accounting attributes for the line type
143010 --
143011 l_entered_amt_idx := 4;
143012 l_accted_amt_idx := 6;
143013 l_bflow_applied_to_amt_idx := NULL; -- 5132302
143014 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
143015 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
143016 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
143017 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
143018 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
143019 l_rec_acct_attrs.array_char_value(3) := p_source_51;
143020 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
143021 l_rec_acct_attrs.array_num_value(4) := p_source_52;
143022 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
143023 l_rec_acct_attrs.array_char_value(5) := p_source_53;
143024 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
143025 l_rec_acct_attrs.array_num_value(6) := p_source_52;
143026
143027 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
143028 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
143029
143030 ---------------------------------------------------------------------------------------------------------------
143031 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
143032 ---------------------------------------------------------------------------------------------------------------
143033 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
143034
143035 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
143036 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
143037
143041 AND l_bflow_method_code = 'PRIOR_ENTRY'
143038 IF xla_accounting_cache_pkg.GetValueChar
143039 (p_source_code => 'LEDGER_CATEGORY_CODE'
143040 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
143042 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
143043 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
143044 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
143045 )
143046 THEN
143047 xla_ae_lines_pkg.BflowUpgEntry
143048 (p_business_method_code => l_bflow_method_code
143049 ,p_business_class_code => l_bflow_class_code
143050 ,p_balance_type => l_balance_type_code);
143051 ELSE
143052 NULL;
143053 -- No business flow processing for business flow method of NONE.
143054 END IF;
143055
143056 --
143057 -- call analytical criteria
143058 --
143059
143060 --
143061 -- call description
143062 --
143063
143064 xla_ae_lines_pkg.SetLineDescription(
143065 p_ae_header_id => l_ae_header_id
143066 ,p_description => Description_105 (
143067 p_application_id => p_application_id
143068 , p_ae_header_id => l_ae_header_id
143069 , p_source_1 => p_source_1
143070 )
143071 );
143072
143073
143074 --
143075 -- call ADRs
143076 -- Bug 4922099
143077 --
143078 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
143079 (NVL(l_actual_upg_option, 'N') = 'O') OR
143080 (NVL(l_enc_upg_option, 'N') = 'O')
143081 )
143082 THEN
143083 NULL;
143084 --
143085 --
143086
143087 l_ccid := AcctDerRule_174(
143088 p_application_id => p_application_id
143089 , p_ae_header_id => l_ae_header_id
143090 , p_source_5 => p_source_5
143091 , p_source_32 => p_source_32
143092 , x_transaction_coa_id => l_adr_transaction_coa_id
143093 , x_accounting_coa_id => l_adr_accounting_coa_id
143094 , x_value_type_code => l_adr_value_type_code
143095 , p_side => 'NA'
143096 );
143097
143098 xla_ae_lines_pkg.set_ccid(
143099 p_code_combination_id => l_ccid
143100 , p_value_type_code => l_adr_value_type_code
143101 , p_transaction_coa_id => l_adr_transaction_coa_id
143102 , p_accounting_coa_id => l_adr_accounting_coa_id
143103 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
143104 , p_adr_type_code => 'S'
143105 , p_component_type => l_component_type
143106 , p_component_code => l_component_code
143107 , p_component_type_code => l_component_type_code
143108 , p_component_appl_id => l_component_appl_id
143109 , p_amb_context_code => l_amb_context_code
143110 , p_side => 'NA'
143111 );
143112
143113
143114 l_segment := AcctDerRule_147(
143115 p_application_id => p_application_id
143116 , p_ae_header_id => l_ae_header_id
143117 , p_source_5 => p_source_5
143118 , p_source_9 => p_source_9
143119 , x_transaction_coa_id => l_adr_transaction_coa_id
143120 , x_accounting_coa_id => l_adr_accounting_coa_id
143121 , x_flexfield_segment_code => l_adr_flexfield_segment_code
143122 , x_flex_value_set_id => l_adr_flex_value_set_id
143123 , x_value_type_code => l_adr_value_type_code
143124 , x_value_combination_id => l_adr_value_combination_id
143125 , x_value_segment_code => l_adr_value_segment_code
143126 , p_side => 'NA'
143127 , p_override_seg_flag => 'Y'
143128 );
143129
143130 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
143131
143132 xla_ae_lines_pkg.set_segment(
143133 p_to_segment_code => 'GL_ACCOUNT'
143134 , p_segment_value => l_segment
143135 , p_from_segment_code => l_adr_value_segment_code
143136 , p_from_combination_id => l_adr_value_combination_id
143137 , p_value_type_code => l_adr_value_type_code
143138 , p_transaction_coa_id => l_adr_transaction_coa_id
143139 , p_accounting_coa_id => l_adr_accounting_coa_id
143140 , p_flexfield_segment_code => l_adr_flexfield_segment_code
143141 , p_flex_value_set_id => l_adr_flex_value_set_id
143142 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
143143 , p_adr_type_code => 'S'
143144 , p_component_type => l_component_type
143145 , p_component_code => l_component_code
143146 , p_component_type_code => l_component_type_code
143147 , p_component_appl_id => l_component_appl_id
143148 , p_amb_context_code => l_amb_context_code
143149 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
143150 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
143151 , p_side => 'NA'
143152 );
143153
143154 END IF;
143155
143156 l_segment := AcctDerRule_169(
143157 p_application_id => p_application_id
143158 , p_ae_header_id => l_ae_header_id
143159 , p_source_5 => p_source_5
143160 , p_source_31 => p_source_31
143161 , x_transaction_coa_id => l_adr_transaction_coa_id
143165 , x_value_type_code => l_adr_value_type_code
143162 , x_accounting_coa_id => l_adr_accounting_coa_id
143163 , x_flexfield_segment_code => l_adr_flexfield_segment_code
143164 , x_flex_value_set_id => l_adr_flex_value_set_id
143166 , x_value_combination_id => l_adr_value_combination_id
143167 , x_value_segment_code => l_adr_value_segment_code
143168 , p_side => 'NA'
143169 , p_override_seg_flag => 'Y'
143170 );
143171
143172 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
143173
143174 xla_ae_lines_pkg.set_segment(
143175 p_to_segment_code => 'GL_BALANCING'
143176 , p_segment_value => l_segment
143177 , p_from_segment_code => l_adr_value_segment_code
143178 , p_from_combination_id => l_adr_value_combination_id
143179 , p_value_type_code => l_adr_value_type_code
143180 , p_transaction_coa_id => l_adr_transaction_coa_id
143181 , p_accounting_coa_id => l_adr_accounting_coa_id
143182 , p_flexfield_segment_code => l_adr_flexfield_segment_code
143183 , p_flex_value_set_id => l_adr_flex_value_set_id
143184 , p_adr_code => 'FA_EXPENSE_ACCT'
143185 , p_adr_type_code => 'S'
143186 , p_component_type => l_component_type
143187 , p_component_code => l_component_code
143188 , p_component_type_code => l_component_type_code
143189 , p_component_appl_id => l_component_appl_id
143190 , p_amb_context_code => l_amb_context_code
143191 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
143192 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
143193 , p_side => 'NA'
143194 );
143195
143196 END IF;
143197
143198 --
143199 --
143200 END IF;
143201 --
143202 -- Bug 4922099
143203 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
143204 (NVL(l_enc_upg_option, 'N') = 'O')
143205 ) AND
143206 (l_bflow_method_code = 'PRIOR_ENTRY')
143207 )
143208 THEN
143209 IF
143210 --
143211 1 = 2
143212 --
143213 THEN
143214 xla_accounting_err_pkg.build_message
143215 (p_appli_s_name => 'XLA'
143216 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
143217 ,p_token_1 => 'LINE_NUMBER'
143218 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
143219 ,p_token_2 => 'LINE_TYPE_NAME'
143220 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
143221 l_component_type
143222 ,l_component_code
143223 ,l_component_type_code
143224 ,l_component_appl_id
143225 ,l_amb_context_code
143226 ,l_entity_code
143227 ,l_event_class_code
143228 )
143229 ,p_token_3 => 'OWNER'
143230 ,p_value_3 => xla_lookups_pkg.get_meaning(
143231 p_lookup_type => 'XLA_OWNER_TYPE'
143232 ,p_lookup_code => l_component_type_code
143233 )
143234 ,p_token_4 => 'PRODUCT_NAME'
143235 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
143236 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
143237 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
143238 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
143239 ,p_ae_header_id => NULL
143240 );
143241
143242 IF (C_LEVEL_ERROR>= g_log_level) THEN
143243 trace
143244 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
143245 ,p_level => C_LEVEL_ERROR
143246 ,p_module => l_log_module);
143247 END IF;
143248 END IF;
143249 END IF;
143250 --
143251 --
143252 ------------------------------------------------------------------------------------------------
143253 -- 4219869 Business Flow
143254 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
143255 -- Prior Entry. Currently, the following code is always generated.
143256 ------------------------------------------------------------------------------------------------
143260 -- 4219869 Business Flow
143257 XLA_AE_LINES_PKG.ValidateCurrentLine;
143258
143259 ------------------------------------------------------------------------------------
143261 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
143262 ------------------------------------------------------------------------------------
143263 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
143264
143265 ----------------------------------------------------------------------------------
143266 -- 4219869 Business Flow
143267 -- Update journal entry status -- Need to generate this within IF <condition>
143268 ----------------------------------------------------------------------------------
143269 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
143270 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
143271 ,p_balance_type_code => l_balance_type_code
143272 );
143273
143274 -------------------------------------------------------------------------------------------
143275 -- 4262811 - Generate the Accrual Reversal lines
143276 -------------------------------------------------------------------------------------------
143277 BEGIN
143278 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
143279 (g_array_event(p_event_id).array_value_num('header_index'));
143280 IF l_acc_rev_flag IS NULL THEN
143281 l_acc_rev_flag := 'N';
143282 END IF;
143283 EXCEPTION
143284 WHEN OTHERS THEN
143285 l_acc_rev_flag := 'N';
143286 END;
143287 --
143288 IF (l_acc_rev_flag = 'Y') THEN
143289
143290 -- 4645092 ------------------------------------------------------------------------------
143291 -- To allow MPA report to determine if it should generate report process
143292 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
143293 ------------------------------------------------------------------------------------------
143294
143295 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
143296 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
143297 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
143298 -- call ADRs
143299 -- Bug 4922099
143300 --
143301 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
143302 (NVL(l_actual_upg_option, 'N') = 'O') OR
143303 (NVL(l_enc_upg_option, 'N') = 'O')
143304 )
143305 THEN
143306 NULL;
143307 --
143308 --
143309
143310 l_ccid := AcctDerRule_174(
143311 p_application_id => p_application_id
143312 , p_ae_header_id => l_ae_header_id
143313 , p_source_5 => p_source_5
143314 , p_source_32 => p_source_32
143315 , x_transaction_coa_id => l_adr_transaction_coa_id
143316 , x_accounting_coa_id => l_adr_accounting_coa_id
143317 , x_value_type_code => l_adr_value_type_code
143318 , p_side => 'NA'
143319 );
143320
143321 xla_ae_lines_pkg.set_ccid(
143322 p_code_combination_id => l_ccid
143323 , p_value_type_code => l_adr_value_type_code
143324 , p_transaction_coa_id => l_adr_transaction_coa_id
143325 , p_accounting_coa_id => l_adr_accounting_coa_id
143326 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
143327 , p_adr_type_code => 'S'
143328 , p_component_type => l_component_type
143329 , p_component_code => l_component_code
143330 , p_component_type_code => l_component_type_code
143331 , p_component_appl_id => l_component_appl_id
143332 , p_amb_context_code => l_amb_context_code
143333 , p_side => 'NA'
143334 );
143335
143336
143337 l_segment := AcctDerRule_147(
143338 p_application_id => p_application_id
143339 , p_ae_header_id => l_ae_header_id
143340 , p_source_5 => p_source_5
143341 , p_source_9 => p_source_9
143342 , x_transaction_coa_id => l_adr_transaction_coa_id
143343 , x_accounting_coa_id => l_adr_accounting_coa_id
143344 , x_flexfield_segment_code => l_adr_flexfield_segment_code
143345 , x_flex_value_set_id => l_adr_flex_value_set_id
143346 , x_value_type_code => l_adr_value_type_code
143347 , x_value_combination_id => l_adr_value_combination_id
143348 , x_value_segment_code => l_adr_value_segment_code
143349 , p_side => 'NA'
143350 , p_override_seg_flag => 'Y'
143351 );
143352
143353 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
143354
143355 xla_ae_lines_pkg.set_segment(
143356 p_to_segment_code => 'GL_ACCOUNT'
143357 , p_segment_value => l_segment
143358 , p_from_segment_code => l_adr_value_segment_code
143359 , p_from_combination_id => l_adr_value_combination_id
143360 , p_value_type_code => l_adr_value_type_code
143361 , p_transaction_coa_id => l_adr_transaction_coa_id
143362 , p_accounting_coa_id => l_adr_accounting_coa_id
143363 , p_flexfield_segment_code => l_adr_flexfield_segment_code
143364 , p_flex_value_set_id => l_adr_flex_value_set_id
143365 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
143366 , p_adr_type_code => 'S'
143367 , p_component_type => l_component_type
143371 , p_amb_context_code => l_amb_context_code
143368 , p_component_code => l_component_code
143369 , p_component_type_code => l_component_type_code
143370 , p_component_appl_id => l_component_appl_id
143372 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
143373 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
143374 , p_side => 'NA'
143375 );
143376
143377 END IF;
143378
143379 l_segment := AcctDerRule_169(
143380 p_application_id => p_application_id
143381 , p_ae_header_id => l_ae_header_id
143382 , p_source_5 => p_source_5
143383 , p_source_31 => p_source_31
143384 , x_transaction_coa_id => l_adr_transaction_coa_id
143385 , x_accounting_coa_id => l_adr_accounting_coa_id
143386 , x_flexfield_segment_code => l_adr_flexfield_segment_code
143387 , x_flex_value_set_id => l_adr_flex_value_set_id
143388 , x_value_type_code => l_adr_value_type_code
143389 , x_value_combination_id => l_adr_value_combination_id
143390 , x_value_segment_code => l_adr_value_segment_code
143391 , p_side => 'NA'
143392 , p_override_seg_flag => 'Y'
143393 );
143394
143395 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
143396
143397 xla_ae_lines_pkg.set_segment(
143398 p_to_segment_code => 'GL_BALANCING'
143399 , p_segment_value => l_segment
143400 , p_from_segment_code => l_adr_value_segment_code
143401 , p_from_combination_id => l_adr_value_combination_id
143402 , p_value_type_code => l_adr_value_type_code
143403 , p_transaction_coa_id => l_adr_transaction_coa_id
143404 , p_accounting_coa_id => l_adr_accounting_coa_id
143405 , p_flexfield_segment_code => l_adr_flexfield_segment_code
143406 , p_flex_value_set_id => l_adr_flex_value_set_id
143407 , p_adr_code => 'FA_EXPENSE_ACCT'
143408 , p_adr_type_code => 'S'
143409 , p_component_type => l_component_type
143410 , p_component_code => l_component_code
143411 , p_component_type_code => l_component_type_code
143412 , p_component_appl_id => l_component_appl_id
143413 , p_amb_context_code => l_amb_context_code
143414 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
143415 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
143416 , p_side => 'NA'
143417 );
143418
143419 END IF;
143420
143421 --
143422 --
143423 END IF;
143424
143425 --
143426 -- Update the line information that should be overwritten
143427 --
143428 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
143429 p_header_num => 1);
143430 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
143431
143432 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
143433
143434 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
143435 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
143436 END IF;
143437
143438 --
143439 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
143440 --
143441 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
143442 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
143443 ELSE
143444 ---------------------------------------------------------------------------------------------------
143445 -- 4262811a Switch Sign
143446 ---------------------------------------------------------------------------------------------------
143447 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
143448 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
143449 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
143450 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
143451 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
143452 -- 5132302
143453 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
143454 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
143455
143456 END IF;
143457
143458 -- 4955764
143459 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
143460 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
143461
143462
143463 XLA_AE_LINES_PKG.ValidateCurrentLine;
143464 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
143465
143466 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
143467 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
143468 ,p_balance_type_code => l_balance_type_code);
143469
143470 END IF;
143471
143472 -----------------------------------------------------------------------------------------
143473 -- 4262811 Multiperiod Accounting
143477
143474 -----------------------------------------------------------------------------------------
143475 -- No MPA option is assigned.
143476
143478 END IF;
143479 END IF;
143480 --
143481
143482 --
143483 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
143484 trace
143485 (p_msg => 'END of AcctLineType_365'
143486 ,p_level => C_LEVEL_PROCEDURE
143487 ,p_module => l_log_module);
143488 END IF;
143489 --
143490 EXCEPTION
143491 WHEN xla_exceptions_pkg.application_exception THEN
143492 RAISE;
143493 WHEN OTHERS THEN
143494 xla_exceptions_pkg.raise_message
143495 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_365');
143496 END AcctLineType_365;
143497 --
143498
143499 ---------------------------------------
143500 --
143501 -- PRIVATE FUNCTION
143502 -- AcctLineType_366
143503 --
143504 ---------------------------------------
143505 PROCEDURE AcctLineType_366 (
143506 p_application_id IN NUMBER
143507 ,p_event_id IN NUMBER
143508 ,p_calculate_acctd_flag IN VARCHAR2
143509 ,p_calculate_g_l_flag IN VARCHAR2
143510 ,p_actual_flag IN OUT VARCHAR2
143511 ,p_balance_type_code OUT VARCHAR2
143512 ,p_gain_or_loss_ref OUT VARCHAR2
143513
143514 --Period Close Date
143515 , p_source_1 IN DATE
143516 --Generated Code Combination Identifier
143517 , p_source_5 IN NUMBER
143518 --CIP Cost Account
143519 , p_source_9 IN VARCHAR2
143520 --Expense Account Code Combination Identifier
143521 , p_source_31 IN NUMBER
143522 --Default Code Combination Identifier
143523 , p_source_32 IN NUMBER
143524 --Adjustment Type
143525 , p_source_48 IN VARCHAR2
143526 --Transaction Header Identifier
143527 , p_source_49 IN NUMBER
143528 --Adjustment Line Identifier
143529 , p_source_50 IN NUMBER
143530 --Distribution Type Code
143531 , p_source_51 IN VARCHAR2
143532 --Entered Amount
143533 , p_source_52 IN NUMBER
143534 --Currency Code
143535 , p_source_53 IN VARCHAR2
143536 --Source Destination Code
143537 , p_source_55 IN VARCHAR2
143538 )
143539 IS
143540
143541 l_component_type VARCHAR2(80);
143542 l_component_code VARCHAR2(30);
143543 l_component_type_code VARCHAR2(1);
143544 l_component_appl_id INTEGER;
143545 l_amb_context_code VARCHAR2(30);
143546 l_entity_code VARCHAR2(30);
143547 l_event_class_code VARCHAR2(30);
143548 l_ae_header_id NUMBER;
143549 l_event_type_code VARCHAR2(30);
143550 l_line_definition_code VARCHAR2(30);
143551 l_line_definition_owner_code VARCHAR2(1);
143552 --
143553 -- adr variables
143554 l_segment VARCHAR2(30);
143555 l_ccid NUMBER;
143556 l_adr_transaction_coa_id NUMBER;
143557 l_adr_accounting_coa_id NUMBER;
143558 l_adr_flexfield_segment_code VARCHAR2(30);
143559 l_adr_flex_value_set_id NUMBER;
143560 l_adr_value_type_code VARCHAR2(30);
143561 l_adr_value_combination_id NUMBER;
143562 l_adr_value_segment_code VARCHAR2(30);
143563
143564 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
143565 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
143566 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
143567 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
143568
143569 -- 4262811 Variables ------------------------------------------------------------------------------------------
143570 l_entered_amt_idx NUMBER;
143571 l_accted_amt_idx NUMBER;
143572 l_acc_rev_flag VARCHAR2(1);
143573 l_accrual_line_num NUMBER;
143574 l_tmp_amt NUMBER;
143575 l_acc_rev_natural_side_code VARCHAR2(1);
143576
143577 l_num_entries NUMBER;
143578 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
143579 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
143580 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
143581 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
143582 l_recog_line_1 NUMBER;
143583 l_recog_line_2 NUMBER;
143584
143585 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
143586 l_bflow_applied_to_amt NUMBER; -- 5132302
143587 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
143588
143589 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
143590
143591 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
143592 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
143593
143594 ---------------------------------------------------------------------------------------------------------------
143595
143596
143597 --
143598 -- bulk performance
143599 --
143600 l_balance_type_code VARCHAR2(1);
143601 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
143602 l_log_module VARCHAR2(240);
143603
143604 --
143605 -- Upgrade strategy
143606 --
143607 l_actual_upg_option VARCHAR2(1);
143608 l_enc_upg_option VARCHAR2(1);
143609
143610 --
143611 BEGIN
143615 END IF;
143612 --
143613 IF g_log_enabled THEN
143614 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_366';
143616 --
143617 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
143618
143619 trace
143620 (p_msg => 'BEGIN of AcctLineType_366'
143621 ,p_level => C_LEVEL_PROCEDURE
143622 ,p_module => l_log_module);
143623
143624 END IF;
143625 --
143626 l_component_type := 'AMB_JLT';
143627 l_component_code := 'FA_SLT_SOURCE_CIP_COST';
143628 l_component_type_code := 'S';
143629 l_component_appl_id := 140;
143630 l_amb_context_code := 'DEFAULT';
143631 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
143632 l_event_class_code := 'CIP_SOURCE_LINE_TRANSFERS';
143633 l_event_type_code := 'CIP_SOURCE_LINE_TRANSFERS_ALL';
143634 l_line_definition_owner_code := 'S';
143635 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_S11';
143636 --
143637 l_balance_type_code := 'A';
143638 l_segment := NULL;
143639 l_ccid := NULL;
143640 l_adr_transaction_coa_id := NULL;
143641 l_adr_accounting_coa_id := NULL;
143642 l_adr_flexfield_segment_code := NULL;
143643 l_adr_flex_value_set_id := NULL;
143644 l_adr_value_type_code := NULL;
143645 l_adr_value_combination_id := NULL;
143646 l_adr_value_segment_code := NULL;
143647
143648 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
143649 l_bflow_class_code := ''; -- 4219869 Business Flow
143650 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
143651 l_budgetary_control_flag := 'N';
143652
143653 l_bflow_applied_to_amt_idx := NULL; -- 5132302
143654 l_bflow_applied_to_amt := NULL; -- 5132302
143655 l_entered_amt_idx := NULL; -- 4262811
143656 l_accted_amt_idx := NULL; -- 4262811
143657 l_acc_rev_flag := NULL; -- 4262811
143658 l_accrual_line_num := NULL; -- 4262811
143659 l_tmp_amt := NULL; -- 4262811
143660 --
143661
143662 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
143663 l_balance_type_code <> 'B' THEN
143664 IF NVL(p_source_48,'
143665 ') = 'CIP COST' AND
143666 NVL(p_source_55,'
143667 ') = 'SOURCE'
143668 THEN
143669
143670 --
143671 XLA_AE_LINES_PKG.SetNewLine;
143672
143673 p_balance_type_code := l_balance_type_code;
143674 -- set the flag so later we will know whether the gain loss line needs to be created
143675
143676 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
143677 p_actual_flag :='A';
143678 END IF;
143679
143680 --
143681 -- bulk performance
143682 --
143683 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
143684 p_header_num => 0); -- 4262811
143685 --
143686 -- set accounting line options
143687 --
143688 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
143689 p_natural_side_code => 'C'
143690 , p_gain_or_loss_flag => 'N'
143691 , p_gl_transfer_mode_code => 'S'
143692 , p_acct_entry_type_code => 'A'
143693 , p_switch_side_flag => 'Y'
143694 , p_merge_duplicate_code => 'N'
143695 );
143696 --
143697 l_acc_rev_natural_side_code := 'D'; -- 4262811
143698 --
143699 --
143700 -- set accounting line type info
143701 --
143702 xla_ae_lines_pkg.SetAcctLineType
143703 (p_component_type => l_component_type
143704 ,p_event_type_code => l_event_type_code
143705 ,p_line_definition_owner_code => l_line_definition_owner_code
143706 ,p_line_definition_code => l_line_definition_code
143707 ,p_accounting_line_code => l_component_code
143708 ,p_accounting_line_type_code => l_component_type_code
143709 ,p_accounting_line_appl_id => l_component_appl_id
143710 ,p_amb_context_code => l_amb_context_code
143711 ,p_entity_code => l_entity_code
143712 ,p_event_class_code => l_event_class_code);
143713 --
143714 -- set accounting class
143715 --
143716 xla_ae_lines_pkg.SetAcctClass(
143717 p_accounting_class_code => 'ASSET'
143718 , p_ae_header_id => l_ae_header_id
143719 );
143720
143721 --
143722 -- set rounding class
143723 --
143724 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
143725 'ASSET';
143726
143727 --
143728 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
143729 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
143730 --
143731 -- bulk performance
143732 --
143733 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
143734
143735 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
143736 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
143737
143738 -- 4955764
143739 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
143743
143740 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
143741
143742 -- 4458381 Public Sector Enh
143744 --
143745 -- set accounting attributes for the line type
143746 --
143747 l_entered_amt_idx := 4;
143748 l_accted_amt_idx := 6;
143749 l_bflow_applied_to_amt_idx := NULL; -- 5132302
143750 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
143751 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
143752 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
143753 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
143754 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
143755 l_rec_acct_attrs.array_char_value(3) := p_source_51;
143756 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
143757 l_rec_acct_attrs.array_num_value(4) := p_source_52;
143758 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
143759 l_rec_acct_attrs.array_char_value(5) := p_source_53;
143760 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
143761 l_rec_acct_attrs.array_num_value(6) := p_source_52;
143762
143763 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
143764 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
143765
143766 ---------------------------------------------------------------------------------------------------------------
143767 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
143768 ---------------------------------------------------------------------------------------------------------------
143769 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
143770
143771 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
143772 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
143773
143774 IF xla_accounting_cache_pkg.GetValueChar
143775 (p_source_code => 'LEDGER_CATEGORY_CODE'
143776 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
143777 AND l_bflow_method_code = 'PRIOR_ENTRY'
143778 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
143779 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
143780 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
143781 )
143782 THEN
143783 xla_ae_lines_pkg.BflowUpgEntry
143784 (p_business_method_code => l_bflow_method_code
143785 ,p_business_class_code => l_bflow_class_code
143786 ,p_balance_type => l_balance_type_code);
143787 ELSE
143788 NULL;
143789 -- No business flow processing for business flow method of NONE.
143790 END IF;
143791
143792 --
143793 -- call analytical criteria
143794 --
143795
143796 --
143797 -- call description
143798 --
143799
143800 xla_ae_lines_pkg.SetLineDescription(
143801 p_ae_header_id => l_ae_header_id
143802 ,p_description => Description_105 (
143803 p_application_id => p_application_id
143804 , p_ae_header_id => l_ae_header_id
143805 , p_source_1 => p_source_1
143806 )
143807 );
143808
143809
143810 --
143811 -- call ADRs
143812 -- Bug 4922099
143813 --
143814 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
143815 (NVL(l_actual_upg_option, 'N') = 'O') OR
143816 (NVL(l_enc_upg_option, 'N') = 'O')
143817 )
143818 THEN
143819 NULL;
143820 --
143821 --
143822
143823 l_ccid := AcctDerRule_174(
143824 p_application_id => p_application_id
143825 , p_ae_header_id => l_ae_header_id
143826 , p_source_5 => p_source_5
143827 , p_source_32 => p_source_32
143828 , x_transaction_coa_id => l_adr_transaction_coa_id
143829 , x_accounting_coa_id => l_adr_accounting_coa_id
143830 , x_value_type_code => l_adr_value_type_code
143831 , p_side => 'NA'
143832 );
143833
143834 xla_ae_lines_pkg.set_ccid(
143835 p_code_combination_id => l_ccid
143836 , p_value_type_code => l_adr_value_type_code
143837 , p_transaction_coa_id => l_adr_transaction_coa_id
143838 , p_accounting_coa_id => l_adr_accounting_coa_id
143839 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
143840 , p_adr_type_code => 'S'
143841 , p_component_type => l_component_type
143842 , p_component_code => l_component_code
143843 , p_component_type_code => l_component_type_code
143844 , p_component_appl_id => l_component_appl_id
143845 , p_amb_context_code => l_amb_context_code
143846 , p_side => 'NA'
143847 );
143848
143849
143850 l_segment := AcctDerRule_147(
143851 p_application_id => p_application_id
143852 , p_ae_header_id => l_ae_header_id
143853 , p_source_5 => p_source_5
143854 , p_source_9 => p_source_9
143855 , x_transaction_coa_id => l_adr_transaction_coa_id
143856 , x_accounting_coa_id => l_adr_accounting_coa_id
143857 , x_flexfield_segment_code => l_adr_flexfield_segment_code
143861 , x_value_segment_code => l_adr_value_segment_code
143858 , x_flex_value_set_id => l_adr_flex_value_set_id
143859 , x_value_type_code => l_adr_value_type_code
143860 , x_value_combination_id => l_adr_value_combination_id
143862 , p_side => 'NA'
143863 , p_override_seg_flag => 'Y'
143864 );
143865
143866 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
143867
143868 xla_ae_lines_pkg.set_segment(
143869 p_to_segment_code => 'GL_ACCOUNT'
143870 , p_segment_value => l_segment
143871 , p_from_segment_code => l_adr_value_segment_code
143872 , p_from_combination_id => l_adr_value_combination_id
143873 , p_value_type_code => l_adr_value_type_code
143874 , p_transaction_coa_id => l_adr_transaction_coa_id
143875 , p_accounting_coa_id => l_adr_accounting_coa_id
143876 , p_flexfield_segment_code => l_adr_flexfield_segment_code
143877 , p_flex_value_set_id => l_adr_flex_value_set_id
143878 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
143879 , p_adr_type_code => 'S'
143880 , p_component_type => l_component_type
143881 , p_component_code => l_component_code
143882 , p_component_type_code => l_component_type_code
143883 , p_component_appl_id => l_component_appl_id
143884 , p_amb_context_code => l_amb_context_code
143885 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
143886 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
143887 , p_side => 'NA'
143888 );
143889
143890 END IF;
143891
143892 l_segment := AcctDerRule_169(
143893 p_application_id => p_application_id
143894 , p_ae_header_id => l_ae_header_id
143895 , p_source_5 => p_source_5
143896 , p_source_31 => p_source_31
143897 , x_transaction_coa_id => l_adr_transaction_coa_id
143898 , x_accounting_coa_id => l_adr_accounting_coa_id
143899 , x_flexfield_segment_code => l_adr_flexfield_segment_code
143900 , x_flex_value_set_id => l_adr_flex_value_set_id
143901 , x_value_type_code => l_adr_value_type_code
143902 , x_value_combination_id => l_adr_value_combination_id
143903 , x_value_segment_code => l_adr_value_segment_code
143904 , p_side => 'NA'
143905 , p_override_seg_flag => 'Y'
143906 );
143907
143908 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
143909
143910 xla_ae_lines_pkg.set_segment(
143911 p_to_segment_code => 'GL_BALANCING'
143912 , p_segment_value => l_segment
143913 , p_from_segment_code => l_adr_value_segment_code
143914 , p_from_combination_id => l_adr_value_combination_id
143915 , p_value_type_code => l_adr_value_type_code
143916 , p_transaction_coa_id => l_adr_transaction_coa_id
143917 , p_accounting_coa_id => l_adr_accounting_coa_id
143918 , p_flexfield_segment_code => l_adr_flexfield_segment_code
143919 , p_flex_value_set_id => l_adr_flex_value_set_id
143920 , p_adr_code => 'FA_EXPENSE_ACCT'
143921 , p_adr_type_code => 'S'
143922 , p_component_type => l_component_type
143923 , p_component_code => l_component_code
143924 , p_component_type_code => l_component_type_code
143925 , p_component_appl_id => l_component_appl_id
143926 , p_amb_context_code => l_amb_context_code
143927 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
143928 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
143929 , p_side => 'NA'
143930 );
143931
143932 END IF;
143933
143934 --
143935 --
143936 END IF;
143937 --
143938 -- Bug 4922099
143939 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
143940 (NVL(l_enc_upg_option, 'N') = 'O')
143941 ) AND
143942 (l_bflow_method_code = 'PRIOR_ENTRY')
143943 )
143944 THEN
143945 IF
143946 --
143947 1 = 2
143948 --
143949 THEN
143950 xla_accounting_err_pkg.build_message
143951 (p_appli_s_name => 'XLA'
143952 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
143953 ,p_token_1 => 'LINE_NUMBER'
143954 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
143955 ,p_token_2 => 'LINE_TYPE_NAME'
143956 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
143957 l_component_type
143958 ,l_component_code
143959 ,l_component_type_code
143960 ,l_component_appl_id
143961 ,l_amb_context_code
143962 ,l_entity_code
143966 ,p_value_3 => xla_lookups_pkg.get_meaning(
143963 ,l_event_class_code
143964 )
143965 ,p_token_3 => 'OWNER'
143967 p_lookup_type => 'XLA_OWNER_TYPE'
143968 ,p_lookup_code => l_component_type_code
143969 )
143970 ,p_token_4 => 'PRODUCT_NAME'
143971 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
143972 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
143973 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
143974 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
143975 ,p_ae_header_id => NULL
143976 );
143977
143978 IF (C_LEVEL_ERROR>= g_log_level) THEN
143979 trace
143980 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
143981 ,p_level => C_LEVEL_ERROR
143982 ,p_module => l_log_module);
143983 END IF;
143984 END IF;
143985 END IF;
143986 --
143987 --
143988 ------------------------------------------------------------------------------------------------
143989 -- 4219869 Business Flow
143990 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
143991 -- Prior Entry. Currently, the following code is always generated.
143992 ------------------------------------------------------------------------------------------------
143993 XLA_AE_LINES_PKG.ValidateCurrentLine;
143994
143995 ------------------------------------------------------------------------------------
143996 -- 4219869 Business Flow
143997 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
143998 ------------------------------------------------------------------------------------
143999 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
144000
144001 ----------------------------------------------------------------------------------
144002 -- 4219869 Business Flow
144003 -- Update journal entry status -- Need to generate this within IF <condition>
144004 ----------------------------------------------------------------------------------
144005 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
144006 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
144007 ,p_balance_type_code => l_balance_type_code
144008 );
144009
144010 -------------------------------------------------------------------------------------------
144011 -- 4262811 - Generate the Accrual Reversal lines
144012 -------------------------------------------------------------------------------------------
144013 BEGIN
144014 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
144015 (g_array_event(p_event_id).array_value_num('header_index'));
144016 IF l_acc_rev_flag IS NULL THEN
144017 l_acc_rev_flag := 'N';
144018 END IF;
144019 EXCEPTION
144020 WHEN OTHERS THEN
144021 l_acc_rev_flag := 'N';
144022 END;
144023 --
144024 IF (l_acc_rev_flag = 'Y') THEN
144025
144026 -- 4645092 ------------------------------------------------------------------------------
144027 -- To allow MPA report to determine if it should generate report process
144028 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
144029 ------------------------------------------------------------------------------------------
144030
144031 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
144032 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
144033 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
144034 -- call ADRs
144035 -- Bug 4922099
144036 --
144037 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
144038 (NVL(l_actual_upg_option, 'N') = 'O') OR
144039 (NVL(l_enc_upg_option, 'N') = 'O')
144040 )
144041 THEN
144042 NULL;
144043 --
144044 --
144045
144046 l_ccid := AcctDerRule_174(
144047 p_application_id => p_application_id
144048 , p_ae_header_id => l_ae_header_id
144049 , p_source_5 => p_source_5
144050 , p_source_32 => p_source_32
144051 , x_transaction_coa_id => l_adr_transaction_coa_id
144052 , x_accounting_coa_id => l_adr_accounting_coa_id
144053 , x_value_type_code => l_adr_value_type_code
144054 , p_side => 'NA'
144055 );
144056
144057 xla_ae_lines_pkg.set_ccid(
144058 p_code_combination_id => l_ccid
144059 , p_value_type_code => l_adr_value_type_code
144060 , p_transaction_coa_id => l_adr_transaction_coa_id
144061 , p_accounting_coa_id => l_adr_accounting_coa_id
144062 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
144063 , p_adr_type_code => 'S'
144064 , p_component_type => l_component_type
144065 , p_component_code => l_component_code
144069 , p_side => 'NA'
144066 , p_component_type_code => l_component_type_code
144067 , p_component_appl_id => l_component_appl_id
144068 , p_amb_context_code => l_amb_context_code
144070 );
144071
144072
144073 l_segment := AcctDerRule_147(
144074 p_application_id => p_application_id
144075 , p_ae_header_id => l_ae_header_id
144076 , p_source_5 => p_source_5
144077 , p_source_9 => p_source_9
144078 , x_transaction_coa_id => l_adr_transaction_coa_id
144079 , x_accounting_coa_id => l_adr_accounting_coa_id
144080 , x_flexfield_segment_code => l_adr_flexfield_segment_code
144081 , x_flex_value_set_id => l_adr_flex_value_set_id
144082 , x_value_type_code => l_adr_value_type_code
144083 , x_value_combination_id => l_adr_value_combination_id
144084 , x_value_segment_code => l_adr_value_segment_code
144085 , p_side => 'NA'
144086 , p_override_seg_flag => 'Y'
144087 );
144088
144089 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
144090
144091 xla_ae_lines_pkg.set_segment(
144092 p_to_segment_code => 'GL_ACCOUNT'
144093 , p_segment_value => l_segment
144094 , p_from_segment_code => l_adr_value_segment_code
144095 , p_from_combination_id => l_adr_value_combination_id
144096 , p_value_type_code => l_adr_value_type_code
144097 , p_transaction_coa_id => l_adr_transaction_coa_id
144098 , p_accounting_coa_id => l_adr_accounting_coa_id
144099 , p_flexfield_segment_code => l_adr_flexfield_segment_code
144100 , p_flex_value_set_id => l_adr_flex_value_set_id
144101 , p_adr_code => 'FA_CAT_CIP_COST_SEGMENT'
144102 , p_adr_type_code => 'S'
144103 , p_component_type => l_component_type
144104 , p_component_code => l_component_code
144105 , p_component_type_code => l_component_type_code
144106 , p_component_appl_id => l_component_appl_id
144107 , p_amb_context_code => l_amb_context_code
144108 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
144109 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
144110 , p_side => 'NA'
144111 );
144112
144113 END IF;
144114
144115 l_segment := AcctDerRule_169(
144116 p_application_id => p_application_id
144117 , p_ae_header_id => l_ae_header_id
144118 , p_source_5 => p_source_5
144119 , p_source_31 => p_source_31
144120 , x_transaction_coa_id => l_adr_transaction_coa_id
144121 , x_accounting_coa_id => l_adr_accounting_coa_id
144122 , x_flexfield_segment_code => l_adr_flexfield_segment_code
144123 , x_flex_value_set_id => l_adr_flex_value_set_id
144124 , x_value_type_code => l_adr_value_type_code
144125 , x_value_combination_id => l_adr_value_combination_id
144126 , x_value_segment_code => l_adr_value_segment_code
144127 , p_side => 'NA'
144128 , p_override_seg_flag => 'Y'
144129 );
144130
144131 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
144132
144133 xla_ae_lines_pkg.set_segment(
144134 p_to_segment_code => 'GL_BALANCING'
144135 , p_segment_value => l_segment
144136 , p_from_segment_code => l_adr_value_segment_code
144137 , p_from_combination_id => l_adr_value_combination_id
144138 , p_value_type_code => l_adr_value_type_code
144139 , p_transaction_coa_id => l_adr_transaction_coa_id
144140 , p_accounting_coa_id => l_adr_accounting_coa_id
144141 , p_flexfield_segment_code => l_adr_flexfield_segment_code
144142 , p_flex_value_set_id => l_adr_flex_value_set_id
144143 , p_adr_code => 'FA_EXPENSE_ACCT'
144144 , p_adr_type_code => 'S'
144145 , p_component_type => l_component_type
144146 , p_component_code => l_component_code
144147 , p_component_type_code => l_component_type_code
144148 , p_component_appl_id => l_component_appl_id
144149 , p_amb_context_code => l_amb_context_code
144150 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
144151 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
144152 , p_side => 'NA'
144153 );
144154
144155 END IF;
144156
144157 --
144158 --
144159 END IF;
144160
144161 --
144162 -- Update the line information that should be overwritten
144163 --
144164 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
144165 p_header_num => 1);
144166 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
144167
144168 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
144169
144170 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
144171 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
144172 END IF;
144173
144174 --
144175 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
144176 --
144180 ---------------------------------------------------------------------------------------------------
144177 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
144178 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
144179 ELSE
144181 -- 4262811a Switch Sign
144182 ---------------------------------------------------------------------------------------------------
144183 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
144184 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
144185 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
144186 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
144187 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
144188 -- 5132302
144189 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
144190 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
144191
144192 END IF;
144193
144194 -- 4955764
144195 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
144196 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
144197
144198
144199 XLA_AE_LINES_PKG.ValidateCurrentLine;
144200 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
144201
144202 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
144203 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
144204 ,p_balance_type_code => l_balance_type_code);
144205
144206 END IF;
144207
144208 -----------------------------------------------------------------------------------------
144209 -- 4262811 Multiperiod Accounting
144210 -----------------------------------------------------------------------------------------
144211 -- No MPA option is assigned.
144212
144213
144214 END IF;
144215 END IF;
144216 --
144217
144218 --
144219 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
144220 trace
144221 (p_msg => 'END of AcctLineType_366'
144222 ,p_level => C_LEVEL_PROCEDURE
144223 ,p_module => l_log_module);
144224 END IF;
144225 --
144226 EXCEPTION
144227 WHEN xla_exceptions_pkg.application_exception THEN
144228 RAISE;
144229 WHEN OTHERS THEN
144230 xla_exceptions_pkg.raise_message
144231 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_366');
144232 END AcctLineType_366;
144233 --
144234
144235 ---------------------------------------
144236 --
144237 -- PRIVATE FUNCTION
144238 -- AcctLineType_367
144239 --
144240 ---------------------------------------
144241 PROCEDURE AcctLineType_367 (
144242 p_application_id IN NUMBER
144243 ,p_event_id IN NUMBER
144244 ,p_calculate_acctd_flag IN VARCHAR2
144245 ,p_calculate_g_l_flag IN VARCHAR2
144246 ,p_actual_flag IN OUT VARCHAR2
144247 ,p_balance_type_code OUT VARCHAR2
144248 ,p_gain_or_loss_ref OUT VARCHAR2
144249
144250 --Period Close Date
144251 , p_source_1 IN DATE
144252 --Generated Code Combination Identifier
144253 , p_source_5 IN NUMBER
144254 --CIP Clearing Account
144255 , p_source_7 IN VARCHAR2
144256 --Payables Code Combination Identifier
144257 , p_source_8 IN NUMBER
144258 --Expense Account Code Combination Identifier
144259 , p_source_31 IN NUMBER
144260 --Default Code Combination Identifier
144261 , p_source_32 IN NUMBER
144262 --Adjustment Type
144263 , p_source_48 IN VARCHAR2
144264 --Transaction Header Identifier
144265 , p_source_49 IN NUMBER
144266 --Adjustment Line Identifier
144267 , p_source_50 IN NUMBER
144268 --Distribution Type Code
144269 , p_source_51 IN VARCHAR2
144270 --Entered Amount
144271 , p_source_52 IN NUMBER
144272 --Currency Code
144273 , p_source_53 IN VARCHAR2
144274 --Source Destination Code
144275 , p_source_55 IN VARCHAR2
144276 )
144277 IS
144278
144279 l_component_type VARCHAR2(80);
144280 l_component_code VARCHAR2(30);
144281 l_component_type_code VARCHAR2(1);
144282 l_component_appl_id INTEGER;
144283 l_amb_context_code VARCHAR2(30);
144284 l_entity_code VARCHAR2(30);
144285 l_event_class_code VARCHAR2(30);
144286 l_ae_header_id NUMBER;
144287 l_event_type_code VARCHAR2(30);
144288 l_line_definition_code VARCHAR2(30);
144289 l_line_definition_owner_code VARCHAR2(1);
144290 --
144291 -- adr variables
144292 l_segment VARCHAR2(30);
144293 l_ccid NUMBER;
144294 l_adr_transaction_coa_id NUMBER;
144295 l_adr_accounting_coa_id NUMBER;
144296 l_adr_flexfield_segment_code VARCHAR2(30);
144297 l_adr_flex_value_set_id NUMBER;
144298 l_adr_value_type_code VARCHAR2(30);
144299 l_adr_value_combination_id NUMBER;
144300 l_adr_value_segment_code VARCHAR2(30);
144301
144302 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
144306
144303 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
144304 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
144305 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
144307 -- 4262811 Variables ------------------------------------------------------------------------------------------
144308 l_entered_amt_idx NUMBER;
144309 l_accted_amt_idx NUMBER;
144310 l_acc_rev_flag VARCHAR2(1);
144311 l_accrual_line_num NUMBER;
144312 l_tmp_amt NUMBER;
144313 l_acc_rev_natural_side_code VARCHAR2(1);
144314
144315 l_num_entries NUMBER;
144316 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
144317 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
144318 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
144319 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
144320 l_recog_line_1 NUMBER;
144321 l_recog_line_2 NUMBER;
144322
144323 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
144324 l_bflow_applied_to_amt NUMBER; -- 5132302
144325 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
144326
144327 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
144328
144329 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
144330 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
144331
144332 ---------------------------------------------------------------------------------------------------------------
144333
144334
144335 --
144336 -- bulk performance
144337 --
144338 l_balance_type_code VARCHAR2(1);
144339 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
144340 l_log_module VARCHAR2(240);
144341
144342 --
144343 -- Upgrade strategy
144344 --
144345 l_actual_upg_option VARCHAR2(1);
144346 l_enc_upg_option VARCHAR2(1);
144347
144348 --
144349 BEGIN
144350 --
144351 IF g_log_enabled THEN
144352 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_367';
144353 END IF;
144354 --
144355 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
144356
144357 trace
144358 (p_msg => 'BEGIN of AcctLineType_367'
144359 ,p_level => C_LEVEL_PROCEDURE
144360 ,p_module => l_log_module);
144361
144362 END IF;
144363 --
144364 l_component_type := 'AMB_JLT';
144365 l_component_code := 'FA_SLT_SOURCE_CIP_COST_CLR';
144366 l_component_type_code := 'S';
144367 l_component_appl_id := 140;
144368 l_amb_context_code := 'DEFAULT';
144369 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
144370 l_event_class_code := 'CIP_SOURCE_LINE_TRANSFERS';
144371 l_event_type_code := 'CIP_SOURCE_LINE_TRANSFERS_ALL';
144372 l_line_definition_owner_code := 'S';
144373 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_S11';
144374 --
144375 l_balance_type_code := 'A';
144376 l_segment := NULL;
144377 l_ccid := NULL;
144378 l_adr_transaction_coa_id := NULL;
144379 l_adr_accounting_coa_id := NULL;
144380 l_adr_flexfield_segment_code := NULL;
144381 l_adr_flex_value_set_id := NULL;
144382 l_adr_value_type_code := NULL;
144383 l_adr_value_combination_id := NULL;
144384 l_adr_value_segment_code := NULL;
144385
144386 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
144387 l_bflow_class_code := ''; -- 4219869 Business Flow
144388 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
144389 l_budgetary_control_flag := 'N';
144390
144391 l_bflow_applied_to_amt_idx := NULL; -- 5132302
144392 l_bflow_applied_to_amt := NULL; -- 5132302
144393 l_entered_amt_idx := NULL; -- 4262811
144394 l_accted_amt_idx := NULL; -- 4262811
144395 l_acc_rev_flag := NULL; -- 4262811
144396 l_accrual_line_num := NULL; -- 4262811
144397 l_tmp_amt := NULL; -- 4262811
144398 --
144399
144400 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
144401 l_balance_type_code <> 'B' THEN
144402 IF NVL(p_source_48,'
144403 ') = 'COST CLEARING' AND
144404 NVL(p_source_55,'
144405 ') = 'SOURCE'
144406 THEN
144407
144408 --
144409 XLA_AE_LINES_PKG.SetNewLine;
144410
144411 p_balance_type_code := l_balance_type_code;
144412 -- set the flag so later we will know whether the gain loss line needs to be created
144413
144414 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
144415 p_actual_flag :='A';
144416 END IF;
144417
144418 --
144419 -- bulk performance
144420 --
144421 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
144422 p_header_num => 0); -- 4262811
144423 --
144424 -- set accounting line options
144425 --
144426 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
144427 p_natural_side_code => 'D'
144428 , p_gain_or_loss_flag => 'N'
144429 , p_gl_transfer_mode_code => 'S'
144433 );
144430 , p_acct_entry_type_code => 'A'
144431 , p_switch_side_flag => 'Y'
144432 , p_merge_duplicate_code => 'N'
144434 --
144435 l_acc_rev_natural_side_code := 'C'; -- 4262811
144436 --
144437 --
144438 -- set accounting line type info
144439 --
144440 xla_ae_lines_pkg.SetAcctLineType
144441 (p_component_type => l_component_type
144442 ,p_event_type_code => l_event_type_code
144443 ,p_line_definition_owner_code => l_line_definition_owner_code
144444 ,p_line_definition_code => l_line_definition_code
144445 ,p_accounting_line_code => l_component_code
144446 ,p_accounting_line_type_code => l_component_type_code
144447 ,p_accounting_line_appl_id => l_component_appl_id
144448 ,p_amb_context_code => l_amb_context_code
144449 ,p_entity_code => l_entity_code
144450 ,p_event_class_code => l_event_class_code);
144451 --
144452 -- set accounting class
144453 --
144454 xla_ae_lines_pkg.SetAcctClass(
144455 p_accounting_class_code => 'ASSET'
144456 , p_ae_header_id => l_ae_header_id
144457 );
144458
144459 --
144460 -- set rounding class
144461 --
144462 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
144463 'ASSET';
144464
144465 --
144466 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
144467 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
144468 --
144469 -- bulk performance
144470 --
144471 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
144472
144473 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
144474 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
144475
144476 -- 4955764
144477 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
144478 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
144479
144480 -- 4458381 Public Sector Enh
144481
144482 --
144483 -- set accounting attributes for the line type
144484 --
144485 l_entered_amt_idx := 4;
144486 l_accted_amt_idx := 6;
144487 l_bflow_applied_to_amt_idx := NULL; -- 5132302
144488 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
144489 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
144490 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
144491 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
144492 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
144493 l_rec_acct_attrs.array_char_value(3) := p_source_51;
144494 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
144495 l_rec_acct_attrs.array_num_value(4) := p_source_52;
144496 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
144497 l_rec_acct_attrs.array_char_value(5) := p_source_53;
144498 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
144499 l_rec_acct_attrs.array_num_value(6) := p_source_52;
144500
144501 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
144502 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
144503
144504 ---------------------------------------------------------------------------------------------------------------
144505 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
144506 ---------------------------------------------------------------------------------------------------------------
144507 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
144508
144509 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
144510 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
144511
144512 IF xla_accounting_cache_pkg.GetValueChar
144513 (p_source_code => 'LEDGER_CATEGORY_CODE'
144514 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
144515 AND l_bflow_method_code = 'PRIOR_ENTRY'
144516 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
144517 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
144518 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
144519 )
144520 THEN
144521 xla_ae_lines_pkg.BflowUpgEntry
144522 (p_business_method_code => l_bflow_method_code
144523 ,p_business_class_code => l_bflow_class_code
144524 ,p_balance_type => l_balance_type_code);
144525 ELSE
144526 NULL;
144527 -- No business flow processing for business flow method of NONE.
144528 END IF;
144529
144530 --
144531 -- call analytical criteria
144532 --
144533
144534 --
144535 -- call description
144536 --
144537
144538 xla_ae_lines_pkg.SetLineDescription(
144539 p_ae_header_id => l_ae_header_id
144540 ,p_description => Description_106 (
144541 p_application_id => p_application_id
144542 , p_ae_header_id => l_ae_header_id
144543 , p_source_1 => p_source_1
144544 )
144548 --
144545 );
144546
144547
144549 -- call ADRs
144550 -- Bug 4922099
144551 --
144552 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
144553 (NVL(l_actual_upg_option, 'N') = 'O') OR
144554 (NVL(l_enc_upg_option, 'N') = 'O')
144555 )
144556 THEN
144557 NULL;
144558 --
144559 --
144560
144561 l_ccid := AcctDerRule_174(
144562 p_application_id => p_application_id
144563 , p_ae_header_id => l_ae_header_id
144564 , p_source_5 => p_source_5
144565 , p_source_32 => p_source_32
144566 , x_transaction_coa_id => l_adr_transaction_coa_id
144567 , x_accounting_coa_id => l_adr_accounting_coa_id
144568 , x_value_type_code => l_adr_value_type_code
144569 , p_side => 'NA'
144570 );
144571
144572 xla_ae_lines_pkg.set_ccid(
144573 p_code_combination_id => l_ccid
144574 , p_value_type_code => l_adr_value_type_code
144575 , p_transaction_coa_id => l_adr_transaction_coa_id
144576 , p_accounting_coa_id => l_adr_accounting_coa_id
144577 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
144578 , p_adr_type_code => 'S'
144579 , p_component_type => l_component_type
144580 , p_component_code => l_component_code
144581 , p_component_type_code => l_component_type_code
144582 , p_component_appl_id => l_component_appl_id
144583 , p_amb_context_code => l_amb_context_code
144584 , p_side => 'NA'
144585 );
144586
144587
144588 l_segment := AcctDerRule_146(
144589 p_application_id => p_application_id
144590 , p_ae_header_id => l_ae_header_id
144591 , p_source_5 => p_source_5
144592 , p_source_7 => p_source_7
144593 , p_source_8 => p_source_8
144594 , x_transaction_coa_id => l_adr_transaction_coa_id
144595 , x_accounting_coa_id => l_adr_accounting_coa_id
144596 , x_flexfield_segment_code => l_adr_flexfield_segment_code
144597 , x_flex_value_set_id => l_adr_flex_value_set_id
144598 , x_value_type_code => l_adr_value_type_code
144599 , x_value_combination_id => l_adr_value_combination_id
144600 , x_value_segment_code => l_adr_value_segment_code
144601 , p_side => 'NA'
144602 , p_override_seg_flag => 'Y'
144603 );
144604
144605 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
144606
144607 xla_ae_lines_pkg.set_segment(
144608 p_to_segment_code => 'GL_ACCOUNT'
144609 , p_segment_value => l_segment
144610 , p_from_segment_code => l_adr_value_segment_code
144611 , p_from_combination_id => l_adr_value_combination_id
144612 , p_value_type_code => l_adr_value_type_code
144613 , p_transaction_coa_id => l_adr_transaction_coa_id
144614 , p_accounting_coa_id => l_adr_accounting_coa_id
144615 , p_flexfield_segment_code => l_adr_flexfield_segment_code
144616 , p_flex_value_set_id => l_adr_flex_value_set_id
144617 , p_adr_code => 'FA_CAT_CIP_CLR_SEGMENT'
144618 , p_adr_type_code => 'S'
144619 , p_component_type => l_component_type
144620 , p_component_code => l_component_code
144621 , p_component_type_code => l_component_type_code
144622 , p_component_appl_id => l_component_appl_id
144623 , p_amb_context_code => l_amb_context_code
144624 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
144625 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
144626 , p_side => 'NA'
144627 );
144628
144629 END IF;
144630
144631 l_segment := AcctDerRule_170(
144632 p_application_id => p_application_id
144633 , p_ae_header_id => l_ae_header_id
144634 , p_source_5 => p_source_5
144635 , p_source_8 => p_source_8
144636 , p_source_31 => p_source_31
144637 , x_transaction_coa_id => l_adr_transaction_coa_id
144638 , x_accounting_coa_id => l_adr_accounting_coa_id
144639 , x_flexfield_segment_code => l_adr_flexfield_segment_code
144640 , x_flex_value_set_id => l_adr_flex_value_set_id
144641 , x_value_type_code => l_adr_value_type_code
144642 , x_value_combination_id => l_adr_value_combination_id
144643 , x_value_segment_code => l_adr_value_segment_code
144644 , p_side => 'NA'
144645 , p_override_seg_flag => 'Y'
144646 );
144647
144648 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
144649
144650 xla_ae_lines_pkg.set_segment(
144651 p_to_segment_code => 'GL_BALANCING'
144652 , p_segment_value => l_segment
144653 , p_from_segment_code => l_adr_value_segment_code
144654 , p_from_combination_id => l_adr_value_combination_id
144655 , p_value_type_code => l_adr_value_type_code
144656 , p_transaction_coa_id => l_adr_transaction_coa_id
144657 , p_accounting_coa_id => l_adr_accounting_coa_id
144658 , p_flexfield_segment_code => l_adr_flexfield_segment_code
144659 , p_flex_value_set_id => l_adr_flex_value_set_id
144660 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
144661 , p_adr_type_code => 'S'
144665 , p_component_appl_id => l_component_appl_id
144662 , p_component_type => l_component_type
144663 , p_component_code => l_component_code
144664 , p_component_type_code => l_component_type_code
144666 , p_amb_context_code => l_amb_context_code
144667 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
144668 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
144669 , p_side => 'NA'
144670 );
144671
144672 END IF;
144673
144674 --
144675 --
144676 END IF;
144677 --
144678 -- Bug 4922099
144679 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
144680 (NVL(l_enc_upg_option, 'N') = 'O')
144681 ) AND
144682 (l_bflow_method_code = 'PRIOR_ENTRY')
144683 )
144684 THEN
144685 IF
144686 --
144687 1 = 2
144688 --
144689 THEN
144690 xla_accounting_err_pkg.build_message
144691 (p_appli_s_name => 'XLA'
144692 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
144693 ,p_token_1 => 'LINE_NUMBER'
144694 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
144695 ,p_token_2 => 'LINE_TYPE_NAME'
144696 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
144697 l_component_type
144698 ,l_component_code
144699 ,l_component_type_code
144700 ,l_component_appl_id
144701 ,l_amb_context_code
144702 ,l_entity_code
144703 ,l_event_class_code
144704 )
144705 ,p_token_3 => 'OWNER'
144706 ,p_value_3 => xla_lookups_pkg.get_meaning(
144707 p_lookup_type => 'XLA_OWNER_TYPE'
144708 ,p_lookup_code => l_component_type_code
144709 )
144710 ,p_token_4 => 'PRODUCT_NAME'
144711 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
144712 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
144713 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
144714 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
144715 ,p_ae_header_id => NULL
144716 );
144717
144718 IF (C_LEVEL_ERROR>= g_log_level) THEN
144719 trace
144720 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
144721 ,p_level => C_LEVEL_ERROR
144722 ,p_module => l_log_module);
144723 END IF;
144724 END IF;
144725 END IF;
144726 --
144727 --
144728 ------------------------------------------------------------------------------------------------
144729 -- 4219869 Business Flow
144730 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
144731 -- Prior Entry. Currently, the following code is always generated.
144732 ------------------------------------------------------------------------------------------------
144733 XLA_AE_LINES_PKG.ValidateCurrentLine;
144734
144735 ------------------------------------------------------------------------------------
144736 -- 4219869 Business Flow
144737 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
144738 ------------------------------------------------------------------------------------
144739 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
144740
144741 ----------------------------------------------------------------------------------
144742 -- 4219869 Business Flow
144743 -- Update journal entry status -- Need to generate this within IF <condition>
144744 ----------------------------------------------------------------------------------
144745 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
144746 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
144747 ,p_balance_type_code => l_balance_type_code
144748 );
144749
144750 -------------------------------------------------------------------------------------------
144751 -- 4262811 - Generate the Accrual Reversal lines
144752 -------------------------------------------------------------------------------------------
144753 BEGIN
144754 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
144755 (g_array_event(p_event_id).array_value_num('header_index'));
144756 IF l_acc_rev_flag IS NULL THEN
144760 WHEN OTHERS THEN
144757 l_acc_rev_flag := 'N';
144758 END IF;
144759 EXCEPTION
144761 l_acc_rev_flag := 'N';
144762 END;
144763 --
144764 IF (l_acc_rev_flag = 'Y') THEN
144765
144766 -- 4645092 ------------------------------------------------------------------------------
144767 -- To allow MPA report to determine if it should generate report process
144768 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
144769 ------------------------------------------------------------------------------------------
144770
144771 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
144772 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
144773 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
144774 -- call ADRs
144775 -- Bug 4922099
144776 --
144777 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
144778 (NVL(l_actual_upg_option, 'N') = 'O') OR
144779 (NVL(l_enc_upg_option, 'N') = 'O')
144780 )
144781 THEN
144782 NULL;
144783 --
144784 --
144785
144786 l_ccid := AcctDerRule_174(
144787 p_application_id => p_application_id
144788 , p_ae_header_id => l_ae_header_id
144789 , p_source_5 => p_source_5
144790 , p_source_32 => p_source_32
144791 , x_transaction_coa_id => l_adr_transaction_coa_id
144792 , x_accounting_coa_id => l_adr_accounting_coa_id
144793 , x_value_type_code => l_adr_value_type_code
144794 , p_side => 'NA'
144795 );
144796
144797 xla_ae_lines_pkg.set_ccid(
144798 p_code_combination_id => l_ccid
144799 , p_value_type_code => l_adr_value_type_code
144800 , p_transaction_coa_id => l_adr_transaction_coa_id
144801 , p_accounting_coa_id => l_adr_accounting_coa_id
144802 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
144803 , p_adr_type_code => 'S'
144804 , p_component_type => l_component_type
144805 , p_component_code => l_component_code
144806 , p_component_type_code => l_component_type_code
144807 , p_component_appl_id => l_component_appl_id
144808 , p_amb_context_code => l_amb_context_code
144809 , p_side => 'NA'
144810 );
144811
144812
144813 l_segment := AcctDerRule_146(
144814 p_application_id => p_application_id
144815 , p_ae_header_id => l_ae_header_id
144816 , p_source_5 => p_source_5
144817 , p_source_7 => p_source_7
144818 , p_source_8 => p_source_8
144819 , x_transaction_coa_id => l_adr_transaction_coa_id
144820 , x_accounting_coa_id => l_adr_accounting_coa_id
144821 , x_flexfield_segment_code => l_adr_flexfield_segment_code
144822 , x_flex_value_set_id => l_adr_flex_value_set_id
144823 , x_value_type_code => l_adr_value_type_code
144824 , x_value_combination_id => l_adr_value_combination_id
144825 , x_value_segment_code => l_adr_value_segment_code
144826 , p_side => 'NA'
144827 , p_override_seg_flag => 'Y'
144828 );
144829
144830 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
144831
144832 xla_ae_lines_pkg.set_segment(
144833 p_to_segment_code => 'GL_ACCOUNT'
144834 , p_segment_value => l_segment
144835 , p_from_segment_code => l_adr_value_segment_code
144836 , p_from_combination_id => l_adr_value_combination_id
144837 , p_value_type_code => l_adr_value_type_code
144838 , p_transaction_coa_id => l_adr_transaction_coa_id
144839 , p_accounting_coa_id => l_adr_accounting_coa_id
144840 , p_flexfield_segment_code => l_adr_flexfield_segment_code
144841 , p_flex_value_set_id => l_adr_flex_value_set_id
144842 , p_adr_code => 'FA_CAT_CIP_CLR_SEGMENT'
144843 , p_adr_type_code => 'S'
144844 , p_component_type => l_component_type
144845 , p_component_code => l_component_code
144846 , p_component_type_code => l_component_type_code
144847 , p_component_appl_id => l_component_appl_id
144848 , p_amb_context_code => l_amb_context_code
144849 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
144850 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
144851 , p_side => 'NA'
144852 );
144853
144854 END IF;
144855
144856 l_segment := AcctDerRule_170(
144857 p_application_id => p_application_id
144858 , p_ae_header_id => l_ae_header_id
144859 , p_source_5 => p_source_5
144860 , p_source_8 => p_source_8
144861 , p_source_31 => p_source_31
144862 , x_transaction_coa_id => l_adr_transaction_coa_id
144863 , x_accounting_coa_id => l_adr_accounting_coa_id
144864 , x_flexfield_segment_code => l_adr_flexfield_segment_code
144865 , x_flex_value_set_id => l_adr_flex_value_set_id
144866 , x_value_type_code => l_adr_value_type_code
144867 , x_value_combination_id => l_adr_value_combination_id
144868 , x_value_segment_code => l_adr_value_segment_code
144869 , p_side => 'NA'
144870 , p_override_seg_flag => 'Y'
144874
144871 );
144872
144873 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
144875 xla_ae_lines_pkg.set_segment(
144876 p_to_segment_code => 'GL_BALANCING'
144877 , p_segment_value => l_segment
144878 , p_from_segment_code => l_adr_value_segment_code
144879 , p_from_combination_id => l_adr_value_combination_id
144880 , p_value_type_code => l_adr_value_type_code
144881 , p_transaction_coa_id => l_adr_transaction_coa_id
144882 , p_accounting_coa_id => l_adr_accounting_coa_id
144883 , p_flexfield_segment_code => l_adr_flexfield_segment_code
144884 , p_flex_value_set_id => l_adr_flex_value_set_id
144885 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
144886 , p_adr_type_code => 'S'
144887 , p_component_type => l_component_type
144888 , p_component_code => l_component_code
144889 , p_component_type_code => l_component_type_code
144890 , p_component_appl_id => l_component_appl_id
144891 , p_amb_context_code => l_amb_context_code
144892 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
144893 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
144894 , p_side => 'NA'
144895 );
144896
144897 END IF;
144898
144899 --
144900 --
144901 END IF;
144902
144903 --
144904 -- Update the line information that should be overwritten
144905 --
144906 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
144907 p_header_num => 1);
144908 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
144909
144910 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
144911
144912 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
144913 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
144914 END IF;
144915
144916 --
144917 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
144918 --
144919 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
144920 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
144921 ELSE
144922 ---------------------------------------------------------------------------------------------------
144923 -- 4262811a Switch Sign
144924 ---------------------------------------------------------------------------------------------------
144925 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
144926 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
144927 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
144928 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
144929 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
144930 -- 5132302
144931 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
144932 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
144933
144934 END IF;
144935
144936 -- 4955764
144937 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
144938 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
144939
144940
144941 XLA_AE_LINES_PKG.ValidateCurrentLine;
144942 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
144943
144944 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
144945 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
144946 ,p_balance_type_code => l_balance_type_code);
144947
144948 END IF;
144949
144950 -----------------------------------------------------------------------------------------
144951 -- 4262811 Multiperiod Accounting
144952 -----------------------------------------------------------------------------------------
144953 -- No MPA option is assigned.
144954
144955
144956 END IF;
144957 END IF;
144958 --
144959
144960 --
144961 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
144962 trace
144963 (p_msg => 'END of AcctLineType_367'
144964 ,p_level => C_LEVEL_PROCEDURE
144965 ,p_module => l_log_module);
144966 END IF;
144967 --
144968 EXCEPTION
144969 WHEN xla_exceptions_pkg.application_exception THEN
144970 RAISE;
144971 WHEN OTHERS THEN
144972 xla_exceptions_pkg.raise_message
144973 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_367');
144974 END AcctLineType_367;
144975 --
144976
144977 ---------------------------------------
144978 --
144979 -- PRIVATE FUNCTION
144980 -- AcctLineType_368
144981 --
144982 ---------------------------------------
144983 PROCEDURE AcctLineType_368 (
144984 p_application_id IN NUMBER
144985 ,p_event_id IN NUMBER
144986 ,p_calculate_acctd_flag IN VARCHAR2
144987 ,p_calculate_g_l_flag IN VARCHAR2
144991
144988 ,p_actual_flag IN OUT VARCHAR2
144989 ,p_balance_type_code OUT VARCHAR2
144990 ,p_gain_or_loss_ref OUT VARCHAR2
144992 --Period Close Date
144993 , p_source_1 IN DATE
144994 --Generated Code Combination Identifier
144995 , p_source_5 IN NUMBER
144996 --Revaluation Reserve Account
144997 , p_source_13 IN VARCHAR2
144998 --Generated Offset Code Combination Identifier
144999 , p_source_19 IN NUMBER
145000 --Expense Account Code Combination Identifier
145001 , p_source_31 IN NUMBER
145002 --Default Code Combination Identifier
145003 , p_source_32 IN NUMBER
145004 --Adjustment Type
145005 , p_source_48 IN VARCHAR2
145006 --Transaction Header Identifier
145007 , p_source_49 IN NUMBER
145008 --Adjustment Line Identifier
145009 , p_source_50 IN NUMBER
145010 --Distribution Type Code
145011 , p_source_51 IN VARCHAR2
145012 --Entered Amount
145013 , p_source_52 IN NUMBER
145014 --Currency Code
145015 , p_source_53 IN VARCHAR2
145016 --Source Destination Code
145017 , p_source_55 IN VARCHAR2
145018 )
145019 IS
145020
145021 l_component_type VARCHAR2(80);
145022 l_component_code VARCHAR2(30);
145023 l_component_type_code VARCHAR2(1);
145024 l_component_appl_id INTEGER;
145025 l_amb_context_code VARCHAR2(30);
145026 l_entity_code VARCHAR2(30);
145027 l_event_class_code VARCHAR2(30);
145028 l_ae_header_id NUMBER;
145029 l_event_type_code VARCHAR2(30);
145030 l_line_definition_code VARCHAR2(30);
145031 l_line_definition_owner_code VARCHAR2(1);
145032 --
145033 -- adr variables
145034 l_segment VARCHAR2(30);
145035 l_ccid NUMBER;
145036 l_adr_transaction_coa_id NUMBER;
145037 l_adr_accounting_coa_id NUMBER;
145038 l_adr_flexfield_segment_code VARCHAR2(30);
145039 l_adr_flex_value_set_id NUMBER;
145040 l_adr_value_type_code VARCHAR2(30);
145041 l_adr_value_combination_id NUMBER;
145042 l_adr_value_segment_code VARCHAR2(30);
145043
145044 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
145045 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
145046 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
145047 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
145048
145049 -- 4262811 Variables ------------------------------------------------------------------------------------------
145050 l_entered_amt_idx NUMBER;
145051 l_accted_amt_idx NUMBER;
145052 l_acc_rev_flag VARCHAR2(1);
145053 l_accrual_line_num NUMBER;
145054 l_tmp_amt NUMBER;
145055 l_acc_rev_natural_side_code VARCHAR2(1);
145056
145057 l_num_entries NUMBER;
145058 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
145059 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
145060 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
145061 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
145062 l_recog_line_1 NUMBER;
145063 l_recog_line_2 NUMBER;
145064
145065 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
145066 l_bflow_applied_to_amt NUMBER; -- 5132302
145067 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
145068
145069 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
145070
145071 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
145072 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
145073
145074 ---------------------------------------------------------------------------------------------------------------
145075
145076
145077 --
145078 -- bulk performance
145079 --
145080 l_balance_type_code VARCHAR2(1);
145081 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
145082 l_log_module VARCHAR2(240);
145083
145084 --
145085 -- Upgrade strategy
145086 --
145087 l_actual_upg_option VARCHAR2(1);
145088 l_enc_upg_option VARCHAR2(1);
145089
145090 --
145091 BEGIN
145092 --
145093 IF g_log_enabled THEN
145094 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_368';
145095 END IF;
145096 --
145097 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
145098
145099 trace
145100 (p_msg => 'BEGIN of AcctLineType_368'
145101 ,p_level => C_LEVEL_PROCEDURE
145102 ,p_module => l_log_module);
145103
145104 END IF;
145105 --
145106 l_component_type := 'AMB_JLT';
145107 l_component_code := 'FA_SLT_SOURCE_CIP_REVAL_RESERV';
145108 l_component_type_code := 'S';
145109 l_component_appl_id := 140;
145110 l_amb_context_code := 'DEFAULT';
145111 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
145112 l_event_class_code := 'CIP_SOURCE_LINE_TRANSFERS';
145113 l_event_type_code := 'CIP_SOURCE_LINE_TRANSFERS_ALL';
145114 l_line_definition_owner_code := 'S';
145115 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_CIP_S11';
145116 --
145117 l_balance_type_code := 'A';
145118 l_segment := NULL;
145119 l_ccid := NULL;
145123 l_adr_flex_value_set_id := NULL;
145120 l_adr_transaction_coa_id := NULL;
145121 l_adr_accounting_coa_id := NULL;
145122 l_adr_flexfield_segment_code := NULL;
145124 l_adr_value_type_code := NULL;
145125 l_adr_value_combination_id := NULL;
145126 l_adr_value_segment_code := NULL;
145127
145128 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
145129 l_bflow_class_code := ''; -- 4219869 Business Flow
145130 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
145131 l_budgetary_control_flag := 'N';
145132
145133 l_bflow_applied_to_amt_idx := NULL; -- 5132302
145134 l_bflow_applied_to_amt := NULL; -- 5132302
145135 l_entered_amt_idx := NULL; -- 4262811
145136 l_accted_amt_idx := NULL; -- 4262811
145137 l_acc_rev_flag := NULL; -- 4262811
145138 l_accrual_line_num := NULL; -- 4262811
145139 l_tmp_amt := NULL; -- 4262811
145140 --
145141
145142 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
145143 l_balance_type_code <> 'B' THEN
145144 IF NVL(p_source_48,'
145145 ') = 'REVAL RESERVE' AND
145146 NVL(p_source_55,'
145147 ') = 'SOURCE'
145148 THEN
145149
145150 --
145151 XLA_AE_LINES_PKG.SetNewLine;
145152
145153 p_balance_type_code := l_balance_type_code;
145154 -- set the flag so later we will know whether the gain loss line needs to be created
145155
145156 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
145157 p_actual_flag :='A';
145158 END IF;
145159
145160 --
145161 -- bulk performance
145162 --
145163 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
145164 p_header_num => 0); -- 4262811
145165 --
145166 -- set accounting line options
145167 --
145168 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
145169 p_natural_side_code => 'D'
145170 , p_gain_or_loss_flag => 'N'
145171 , p_gl_transfer_mode_code => 'S'
145172 , p_acct_entry_type_code => 'A'
145173 , p_switch_side_flag => 'Y'
145174 , p_merge_duplicate_code => 'N'
145175 );
145176 --
145177 l_acc_rev_natural_side_code := 'C'; -- 4262811
145178 --
145179 --
145180 -- set accounting line type info
145181 --
145182 xla_ae_lines_pkg.SetAcctLineType
145183 (p_component_type => l_component_type
145184 ,p_event_type_code => l_event_type_code
145185 ,p_line_definition_owner_code => l_line_definition_owner_code
145186 ,p_line_definition_code => l_line_definition_code
145187 ,p_accounting_line_code => l_component_code
145188 ,p_accounting_line_type_code => l_component_type_code
145189 ,p_accounting_line_appl_id => l_component_appl_id
145190 ,p_amb_context_code => l_amb_context_code
145191 ,p_entity_code => l_entity_code
145192 ,p_event_class_code => l_event_class_code);
145193 --
145194 -- set accounting class
145195 --
145196 xla_ae_lines_pkg.SetAcctClass(
145197 p_accounting_class_code => 'ASSET'
145198 , p_ae_header_id => l_ae_header_id
145199 );
145200
145201 --
145202 -- set rounding class
145203 --
145204 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
145205 'ASSET';
145206
145207 --
145208 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
145209 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
145210 --
145211 -- bulk performance
145212 --
145213 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
145214
145215 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
145216 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
145217
145218 -- 4955764
145219 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
145220 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
145221
145222 -- 4458381 Public Sector Enh
145223
145224 --
145225 -- set accounting attributes for the line type
145226 --
145227 l_entered_amt_idx := 4;
145228 l_accted_amt_idx := 6;
145229 l_bflow_applied_to_amt_idx := NULL; -- 5132302
145230 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
145231 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
145232 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
145233 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
145234 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
145235 l_rec_acct_attrs.array_char_value(3) := p_source_51;
145236 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
145237 l_rec_acct_attrs.array_num_value(4) := p_source_52;
145238 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
145239 l_rec_acct_attrs.array_char_value(5) := p_source_53;
145240 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
145241 l_rec_acct_attrs.array_num_value(6) := p_source_52;
145242
145246 ---------------------------------------------------------------------------------------------------------------
145243 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
145244 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
145245
145247 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
145248 ---------------------------------------------------------------------------------------------------------------
145249 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
145250
145251 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
145252 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
145253
145254 IF xla_accounting_cache_pkg.GetValueChar
145255 (p_source_code => 'LEDGER_CATEGORY_CODE'
145256 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
145257 AND l_bflow_method_code = 'PRIOR_ENTRY'
145258 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
145259 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
145260 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
145261 )
145262 THEN
145263 xla_ae_lines_pkg.BflowUpgEntry
145264 (p_business_method_code => l_bflow_method_code
145265 ,p_business_class_code => l_bflow_class_code
145266 ,p_balance_type => l_balance_type_code);
145267 ELSE
145268 NULL;
145269 -- No business flow processing for business flow method of NONE.
145270 END IF;
145271
145272 --
145273 -- call analytical criteria
145274 --
145275
145276 --
145277 -- call description
145278 --
145279
145280 xla_ae_lines_pkg.SetLineDescription(
145281 p_ae_header_id => l_ae_header_id
145282 ,p_description => Description_109 (
145283 p_application_id => p_application_id
145284 , p_ae_header_id => l_ae_header_id
145285 , p_source_1 => p_source_1
145286 )
145287 );
145288
145289
145290 --
145291 -- call ADRs
145292 -- Bug 4922099
145293 --
145294 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
145295 (NVL(l_actual_upg_option, 'N') = 'O') OR
145296 (NVL(l_enc_upg_option, 'N') = 'O')
145297 )
145298 THEN
145299 NULL;
145300 --
145301 --
145302
145303 l_ccid := AcctDerRule_175(
145304 p_application_id => p_application_id
145305 , p_ae_header_id => l_ae_header_id
145306 , p_source_5 => p_source_5
145307 , p_source_19 => p_source_19
145308 , p_source_32 => p_source_32
145309 , x_transaction_coa_id => l_adr_transaction_coa_id
145310 , x_accounting_coa_id => l_adr_accounting_coa_id
145311 , x_value_type_code => l_adr_value_type_code
145312 , p_side => 'NA'
145313 );
145314
145315 xla_ae_lines_pkg.set_ccid(
145316 p_code_combination_id => l_ccid
145317 , p_value_type_code => l_adr_value_type_code
145318 , p_transaction_coa_id => l_adr_transaction_coa_id
145319 , p_accounting_coa_id => l_adr_accounting_coa_id
145320 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
145321 , p_adr_type_code => 'S'
145322 , p_component_type => l_component_type
145323 , p_component_code => l_component_code
145324 , p_component_type_code => l_component_type_code
145325 , p_component_appl_id => l_component_appl_id
145326 , p_amb_context_code => l_amb_context_code
145327 , p_side => 'NA'
145328 );
145329
145330
145331 l_segment := AcctDerRule_151(
145332 p_application_id => p_application_id
145333 , p_ae_header_id => l_ae_header_id
145334 , p_source_5 => p_source_5
145335 , p_source_13 => p_source_13
145336 , x_transaction_coa_id => l_adr_transaction_coa_id
145337 , x_accounting_coa_id => l_adr_accounting_coa_id
145338 , x_flexfield_segment_code => l_adr_flexfield_segment_code
145339 , x_flex_value_set_id => l_adr_flex_value_set_id
145340 , x_value_type_code => l_adr_value_type_code
145341 , x_value_combination_id => l_adr_value_combination_id
145342 , x_value_segment_code => l_adr_value_segment_code
145343 , p_side => 'NA'
145344 , p_override_seg_flag => 'Y'
145345 );
145346
145347 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
145348
145349 xla_ae_lines_pkg.set_segment(
145350 p_to_segment_code => 'GL_ACCOUNT'
145351 , p_segment_value => l_segment
145352 , p_from_segment_code => l_adr_value_segment_code
145353 , p_from_combination_id => l_adr_value_combination_id
145354 , p_value_type_code => l_adr_value_type_code
145355 , p_transaction_coa_id => l_adr_transaction_coa_id
145356 , p_accounting_coa_id => l_adr_accounting_coa_id
145357 , p_flexfield_segment_code => l_adr_flexfield_segment_code
145358 , p_flex_value_set_id => l_adr_flex_value_set_id
145359 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
145360 , p_adr_type_code => 'S'
145364 , p_component_appl_id => l_component_appl_id
145361 , p_component_type => l_component_type
145362 , p_component_code => l_component_code
145363 , p_component_type_code => l_component_type_code
145365 , p_amb_context_code => l_amb_context_code
145366 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
145367 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
145368 , p_side => 'NA'
145369 );
145370
145371 END IF;
145372
145373 l_segment := AcctDerRule_169(
145374 p_application_id => p_application_id
145375 , p_ae_header_id => l_ae_header_id
145376 , p_source_5 => p_source_5
145377 , p_source_31 => p_source_31
145378 , x_transaction_coa_id => l_adr_transaction_coa_id
145379 , x_accounting_coa_id => l_adr_accounting_coa_id
145380 , x_flexfield_segment_code => l_adr_flexfield_segment_code
145381 , x_flex_value_set_id => l_adr_flex_value_set_id
145382 , x_value_type_code => l_adr_value_type_code
145383 , x_value_combination_id => l_adr_value_combination_id
145384 , x_value_segment_code => l_adr_value_segment_code
145385 , p_side => 'NA'
145386 , p_override_seg_flag => 'Y'
145387 );
145388
145389 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
145390
145391 xla_ae_lines_pkg.set_segment(
145392 p_to_segment_code => 'GL_BALANCING'
145393 , p_segment_value => l_segment
145394 , p_from_segment_code => l_adr_value_segment_code
145395 , p_from_combination_id => l_adr_value_combination_id
145396 , p_value_type_code => l_adr_value_type_code
145397 , p_transaction_coa_id => l_adr_transaction_coa_id
145398 , p_accounting_coa_id => l_adr_accounting_coa_id
145399 , p_flexfield_segment_code => l_adr_flexfield_segment_code
145400 , p_flex_value_set_id => l_adr_flex_value_set_id
145401 , p_adr_code => 'FA_EXPENSE_ACCT'
145402 , p_adr_type_code => 'S'
145403 , p_component_type => l_component_type
145404 , p_component_code => l_component_code
145405 , p_component_type_code => l_component_type_code
145406 , p_component_appl_id => l_component_appl_id
145407 , p_amb_context_code => l_amb_context_code
145408 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
145409 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
145410 , p_side => 'NA'
145411 );
145412
145413 END IF;
145414
145415 --
145416 --
145417 END IF;
145418 --
145419 -- Bug 4922099
145420 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
145421 (NVL(l_enc_upg_option, 'N') = 'O')
145422 ) AND
145423 (l_bflow_method_code = 'PRIOR_ENTRY')
145424 )
145425 THEN
145426 IF
145427 --
145428 1 = 2
145429 --
145430 THEN
145431 xla_accounting_err_pkg.build_message
145432 (p_appli_s_name => 'XLA'
145433 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
145434 ,p_token_1 => 'LINE_NUMBER'
145435 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
145436 ,p_token_2 => 'LINE_TYPE_NAME'
145437 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
145438 l_component_type
145439 ,l_component_code
145440 ,l_component_type_code
145441 ,l_component_appl_id
145442 ,l_amb_context_code
145443 ,l_entity_code
145444 ,l_event_class_code
145445 )
145446 ,p_token_3 => 'OWNER'
145447 ,p_value_3 => xla_lookups_pkg.get_meaning(
145448 p_lookup_type => 'XLA_OWNER_TYPE'
145449 ,p_lookup_code => l_component_type_code
145450 )
145451 ,p_token_4 => 'PRODUCT_NAME'
145452 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
145453 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
145454 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
145455 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
145456 ,p_ae_header_id => NULL
145460 trace
145457 );
145458
145459 IF (C_LEVEL_ERROR>= g_log_level) THEN
145461 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
145462 ,p_level => C_LEVEL_ERROR
145463 ,p_module => l_log_module);
145464 END IF;
145465 END IF;
145466 END IF;
145467 --
145468 --
145469 ------------------------------------------------------------------------------------------------
145470 -- 4219869 Business Flow
145471 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
145472 -- Prior Entry. Currently, the following code is always generated.
145473 ------------------------------------------------------------------------------------------------
145474 XLA_AE_LINES_PKG.ValidateCurrentLine;
145475
145476 ------------------------------------------------------------------------------------
145477 -- 4219869 Business Flow
145478 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
145479 ------------------------------------------------------------------------------------
145480 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
145481
145482 ----------------------------------------------------------------------------------
145483 -- 4219869 Business Flow
145484 -- Update journal entry status -- Need to generate this within IF <condition>
145485 ----------------------------------------------------------------------------------
145486 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
145487 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
145488 ,p_balance_type_code => l_balance_type_code
145489 );
145490
145491 -------------------------------------------------------------------------------------------
145492 -- 4262811 - Generate the Accrual Reversal lines
145493 -------------------------------------------------------------------------------------------
145494 BEGIN
145495 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
145496 (g_array_event(p_event_id).array_value_num('header_index'));
145497 IF l_acc_rev_flag IS NULL THEN
145498 l_acc_rev_flag := 'N';
145499 END IF;
145500 EXCEPTION
145501 WHEN OTHERS THEN
145502 l_acc_rev_flag := 'N';
145503 END;
145504 --
145505 IF (l_acc_rev_flag = 'Y') THEN
145506
145507 -- 4645092 ------------------------------------------------------------------------------
145508 -- To allow MPA report to determine if it should generate report process
145509 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
145510 ------------------------------------------------------------------------------------------
145511
145512 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
145513 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
145514 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
145515 -- call ADRs
145516 -- Bug 4922099
145517 --
145518 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
145519 (NVL(l_actual_upg_option, 'N') = 'O') OR
145520 (NVL(l_enc_upg_option, 'N') = 'O')
145521 )
145522 THEN
145523 NULL;
145524 --
145525 --
145526
145527 l_ccid := AcctDerRule_175(
145528 p_application_id => p_application_id
145529 , p_ae_header_id => l_ae_header_id
145530 , p_source_5 => p_source_5
145531 , p_source_19 => p_source_19
145532 , p_source_32 => p_source_32
145533 , x_transaction_coa_id => l_adr_transaction_coa_id
145534 , x_accounting_coa_id => l_adr_accounting_coa_id
145535 , x_value_type_code => l_adr_value_type_code
145536 , p_side => 'NA'
145537 );
145538
145539 xla_ae_lines_pkg.set_ccid(
145540 p_code_combination_id => l_ccid
145541 , p_value_type_code => l_adr_value_type_code
145542 , p_transaction_coa_id => l_adr_transaction_coa_id
145543 , p_accounting_coa_id => l_adr_accounting_coa_id
145544 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
145545 , p_adr_type_code => 'S'
145546 , p_component_type => l_component_type
145547 , p_component_code => l_component_code
145548 , p_component_type_code => l_component_type_code
145549 , p_component_appl_id => l_component_appl_id
145550 , p_amb_context_code => l_amb_context_code
145551 , p_side => 'NA'
145552 );
145553
145554
145555 l_segment := AcctDerRule_151(
145556 p_application_id => p_application_id
145557 , p_ae_header_id => l_ae_header_id
145558 , p_source_5 => p_source_5
145559 , p_source_13 => p_source_13
145560 , x_transaction_coa_id => l_adr_transaction_coa_id
145561 , x_accounting_coa_id => l_adr_accounting_coa_id
145562 , x_flexfield_segment_code => l_adr_flexfield_segment_code
145563 , x_flex_value_set_id => l_adr_flex_value_set_id
145564 , x_value_type_code => l_adr_value_type_code
145565 , x_value_combination_id => l_adr_value_combination_id
145566 , x_value_segment_code => l_adr_value_segment_code
145567 , p_side => 'NA'
145568 , p_override_seg_flag => 'Y'
145569 );
145573 xla_ae_lines_pkg.set_segment(
145570
145571 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
145572
145574 p_to_segment_code => 'GL_ACCOUNT'
145575 , p_segment_value => l_segment
145576 , p_from_segment_code => l_adr_value_segment_code
145577 , p_from_combination_id => l_adr_value_combination_id
145578 , p_value_type_code => l_adr_value_type_code
145579 , p_transaction_coa_id => l_adr_transaction_coa_id
145580 , p_accounting_coa_id => l_adr_accounting_coa_id
145581 , p_flexfield_segment_code => l_adr_flexfield_segment_code
145582 , p_flex_value_set_id => l_adr_flex_value_set_id
145583 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
145584 , p_adr_type_code => 'S'
145585 , p_component_type => l_component_type
145586 , p_component_code => l_component_code
145587 , p_component_type_code => l_component_type_code
145588 , p_component_appl_id => l_component_appl_id
145589 , p_amb_context_code => l_amb_context_code
145590 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
145591 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
145592 , p_side => 'NA'
145593 );
145594
145595 END IF;
145596
145597 l_segment := AcctDerRule_169(
145598 p_application_id => p_application_id
145599 , p_ae_header_id => l_ae_header_id
145600 , p_source_5 => p_source_5
145601 , p_source_31 => p_source_31
145602 , x_transaction_coa_id => l_adr_transaction_coa_id
145603 , x_accounting_coa_id => l_adr_accounting_coa_id
145604 , x_flexfield_segment_code => l_adr_flexfield_segment_code
145605 , x_flex_value_set_id => l_adr_flex_value_set_id
145606 , x_value_type_code => l_adr_value_type_code
145607 , x_value_combination_id => l_adr_value_combination_id
145608 , x_value_segment_code => l_adr_value_segment_code
145609 , p_side => 'NA'
145610 , p_override_seg_flag => 'Y'
145611 );
145612
145613 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
145614
145615 xla_ae_lines_pkg.set_segment(
145616 p_to_segment_code => 'GL_BALANCING'
145617 , p_segment_value => l_segment
145618 , p_from_segment_code => l_adr_value_segment_code
145619 , p_from_combination_id => l_adr_value_combination_id
145620 , p_value_type_code => l_adr_value_type_code
145621 , p_transaction_coa_id => l_adr_transaction_coa_id
145622 , p_accounting_coa_id => l_adr_accounting_coa_id
145623 , p_flexfield_segment_code => l_adr_flexfield_segment_code
145624 , p_flex_value_set_id => l_adr_flex_value_set_id
145625 , p_adr_code => 'FA_EXPENSE_ACCT'
145626 , p_adr_type_code => 'S'
145627 , p_component_type => l_component_type
145628 , p_component_code => l_component_code
145629 , p_component_type_code => l_component_type_code
145630 , p_component_appl_id => l_component_appl_id
145631 , p_amb_context_code => l_amb_context_code
145632 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
145633 , p_event_class_code => 'CIP_SOURCE_LINE_TRANSFERS'
145634 , p_side => 'NA'
145635 );
145636
145637 END IF;
145638
145639 --
145640 --
145641 END IF;
145642
145643 --
145644 -- Update the line information that should be overwritten
145645 --
145646 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
145647 p_header_num => 1);
145648 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
145649
145650 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
145651
145652 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
145653 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
145654 END IF;
145655
145656 --
145657 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
145658 --
145659 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
145660 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
145661 ELSE
145662 ---------------------------------------------------------------------------------------------------
145663 -- 4262811a Switch Sign
145664 ---------------------------------------------------------------------------------------------------
145665 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
145666 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
145667 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
145668 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
145669 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
145670 -- 5132302
145671 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
145675
145672 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
145673
145674 END IF;
145676 -- 4955764
145677 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
145678 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
145679
145680
145681 XLA_AE_LINES_PKG.ValidateCurrentLine;
145682 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
145683
145684 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
145685 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
145686 ,p_balance_type_code => l_balance_type_code);
145687
145688 END IF;
145689
145690 -----------------------------------------------------------------------------------------
145691 -- 4262811 Multiperiod Accounting
145692 -----------------------------------------------------------------------------------------
145693 -- No MPA option is assigned.
145694
145695
145696 END IF;
145697 END IF;
145698 --
145699
145700 --
145701 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
145702 trace
145703 (p_msg => 'END of AcctLineType_368'
145704 ,p_level => C_LEVEL_PROCEDURE
145705 ,p_module => l_log_module);
145706 END IF;
145707 --
145708 EXCEPTION
145709 WHEN xla_exceptions_pkg.application_exception THEN
145710 RAISE;
145711 WHEN OTHERS THEN
145712 xla_exceptions_pkg.raise_message
145713 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_368');
145714 END AcctLineType_368;
145715 --
145716
145717 ---------------------------------------
145718 --
145719 -- PRIVATE FUNCTION
145720 -- AcctLineType_369
145721 --
145722 ---------------------------------------
145723 PROCEDURE AcctLineType_369 (
145724 p_application_id IN NUMBER
145725 ,p_event_id IN NUMBER
145726 ,p_calculate_acctd_flag IN VARCHAR2
145727 ,p_calculate_g_l_flag IN VARCHAR2
145728 ,p_actual_flag IN OUT VARCHAR2
145729 ,p_balance_type_code OUT VARCHAR2
145730 ,p_gain_or_loss_ref OUT VARCHAR2
145731
145732 --Period Close Date
145733 , p_source_1 IN DATE
145734 --Generated Code Combination Identifier
145735 , p_source_5 IN NUMBER
145736 --Asset Cost Account
145737 , p_source_11 IN VARCHAR2
145738 --Expense Account Code Combination Identifier
145739 , p_source_31 IN NUMBER
145740 --Default Code Combination Identifier
145741 , p_source_32 IN NUMBER
145742 --Adjustment Type
145743 , p_source_48 IN VARCHAR2
145744 --Transaction Header Identifier
145745 , p_source_49 IN NUMBER
145746 --Adjustment Line Identifier
145747 , p_source_50 IN NUMBER
145748 --Distribution Type Code
145749 , p_source_51 IN VARCHAR2
145750 --Entered Amount
145751 , p_source_52 IN NUMBER
145752 --Currency Code
145753 , p_source_53 IN VARCHAR2
145754 --Source Destination Code
145755 , p_source_55 IN VARCHAR2
145756 )
145757 IS
145758
145759 l_component_type VARCHAR2(80);
145760 l_component_code VARCHAR2(30);
145761 l_component_type_code VARCHAR2(1);
145762 l_component_appl_id INTEGER;
145763 l_amb_context_code VARCHAR2(30);
145764 l_entity_code VARCHAR2(30);
145765 l_event_class_code VARCHAR2(30);
145766 l_ae_header_id NUMBER;
145767 l_event_type_code VARCHAR2(30);
145768 l_line_definition_code VARCHAR2(30);
145769 l_line_definition_owner_code VARCHAR2(1);
145770 --
145771 -- adr variables
145772 l_segment VARCHAR2(30);
145773 l_ccid NUMBER;
145774 l_adr_transaction_coa_id NUMBER;
145775 l_adr_accounting_coa_id NUMBER;
145776 l_adr_flexfield_segment_code VARCHAR2(30);
145777 l_adr_flex_value_set_id NUMBER;
145778 l_adr_value_type_code VARCHAR2(30);
145779 l_adr_value_combination_id NUMBER;
145780 l_adr_value_segment_code VARCHAR2(30);
145781
145782 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
145783 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
145784 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
145785 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
145786
145787 -- 4262811 Variables ------------------------------------------------------------------------------------------
145788 l_entered_amt_idx NUMBER;
145789 l_accted_amt_idx NUMBER;
145790 l_acc_rev_flag VARCHAR2(1);
145791 l_accrual_line_num NUMBER;
145792 l_tmp_amt NUMBER;
145793 l_acc_rev_natural_side_code VARCHAR2(1);
145794
145795 l_num_entries NUMBER;
145796 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
145797 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
145798 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
145799 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
145800 l_recog_line_1 NUMBER;
145801 l_recog_line_2 NUMBER;
145802
145803 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
145804 l_bflow_applied_to_amt NUMBER; -- 5132302
145808
145805 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
145806
145807 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
145809 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
145810 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
145811
145812 ---------------------------------------------------------------------------------------------------------------
145813
145814
145815 --
145816 -- bulk performance
145817 --
145818 l_balance_type_code VARCHAR2(1);
145819 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
145820 l_log_module VARCHAR2(240);
145821
145822 --
145823 -- Upgrade strategy
145824 --
145825 l_actual_upg_option VARCHAR2(1);
145826 l_enc_upg_option VARCHAR2(1);
145827
145828 --
145829 BEGIN
145830 --
145831 IF g_log_enabled THEN
145832 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_369';
145833 END IF;
145834 --
145835 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
145836
145837 trace
145838 (p_msg => 'BEGIN of AcctLineType_369'
145839 ,p_level => C_LEVEL_PROCEDURE
145840 ,p_module => l_log_module);
145841
145842 END IF;
145843 --
145844 l_component_type := 'AMB_JLT';
145845 l_component_code := 'FA_SLT_SOURCE_COST';
145846 l_component_type_code := 'S';
145847 l_component_appl_id := 140;
145848 l_amb_context_code := 'DEFAULT';
145849 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
145850 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
145851 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
145852 l_line_definition_owner_code := 'S';
145853 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
145854 --
145855 l_balance_type_code := 'A';
145856 l_segment := NULL;
145857 l_ccid := NULL;
145858 l_adr_transaction_coa_id := NULL;
145859 l_adr_accounting_coa_id := NULL;
145860 l_adr_flexfield_segment_code := NULL;
145861 l_adr_flex_value_set_id := NULL;
145862 l_adr_value_type_code := NULL;
145863 l_adr_value_combination_id := NULL;
145864 l_adr_value_segment_code := NULL;
145865
145866 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
145867 l_bflow_class_code := ''; -- 4219869 Business Flow
145868 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
145869 l_budgetary_control_flag := 'N';
145870
145871 l_bflow_applied_to_amt_idx := NULL; -- 5132302
145872 l_bflow_applied_to_amt := NULL; -- 5132302
145873 l_entered_amt_idx := NULL; -- 4262811
145874 l_accted_amt_idx := NULL; -- 4262811
145875 l_acc_rev_flag := NULL; -- 4262811
145876 l_accrual_line_num := NULL; -- 4262811
145877 l_tmp_amt := NULL; -- 4262811
145878 --
145879
145880 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
145881 l_balance_type_code <> 'B' THEN
145882 IF NVL(p_source_48,'
145883 ') = 'COST' AND
145884 NVL(p_source_55,'
145885 ') = 'SOURCE'
145886 THEN
145887
145888 --
145889 XLA_AE_LINES_PKG.SetNewLine;
145890
145891 p_balance_type_code := l_balance_type_code;
145892 -- set the flag so later we will know whether the gain loss line needs to be created
145893
145894 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
145895 p_actual_flag :='A';
145896 END IF;
145897
145898 --
145899 -- bulk performance
145900 --
145901 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
145902 p_header_num => 0); -- 4262811
145903 --
145904 -- set accounting line options
145905 --
145906 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
145907 p_natural_side_code => 'C'
145908 , p_gain_or_loss_flag => 'N'
145909 , p_gl_transfer_mode_code => 'S'
145910 , p_acct_entry_type_code => 'A'
145911 , p_switch_side_flag => 'Y'
145912 , p_merge_duplicate_code => 'N'
145913 );
145914 --
145915 l_acc_rev_natural_side_code := 'D'; -- 4262811
145916 --
145917 --
145918 -- set accounting line type info
145919 --
145920 xla_ae_lines_pkg.SetAcctLineType
145921 (p_component_type => l_component_type
145922 ,p_event_type_code => l_event_type_code
145923 ,p_line_definition_owner_code => l_line_definition_owner_code
145924 ,p_line_definition_code => l_line_definition_code
145925 ,p_accounting_line_code => l_component_code
145926 ,p_accounting_line_type_code => l_component_type_code
145927 ,p_accounting_line_appl_id => l_component_appl_id
145928 ,p_amb_context_code => l_amb_context_code
145929 ,p_entity_code => l_entity_code
145930 ,p_event_class_code => l_event_class_code);
145931 --
145932 -- set accounting class
145933 --
145934 xla_ae_lines_pkg.SetAcctClass(
145935 p_accounting_class_code => 'ASSET'
145936 , p_ae_header_id => l_ae_header_id
145937 );
145938
145939 --
145943 'ASSET';
145940 -- set rounding class
145941 --
145942 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
145944
145945 --
145946 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
145947 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
145948 --
145949 -- bulk performance
145950 --
145951 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
145952
145953 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
145954 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
145955
145956 -- 4955764
145957 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
145958 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
145959
145960 -- 4458381 Public Sector Enh
145961
145962 --
145963 -- set accounting attributes for the line type
145964 --
145965 l_entered_amt_idx := 4;
145966 l_accted_amt_idx := 6;
145967 l_bflow_applied_to_amt_idx := NULL; -- 5132302
145968 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
145969 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
145970 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
145971 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
145972 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
145973 l_rec_acct_attrs.array_char_value(3) := p_source_51;
145974 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
145975 l_rec_acct_attrs.array_num_value(4) := p_source_52;
145976 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
145977 l_rec_acct_attrs.array_char_value(5) := p_source_53;
145978 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
145979 l_rec_acct_attrs.array_num_value(6) := p_source_52;
145980
145981 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
145982 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
145983
145984 ---------------------------------------------------------------------------------------------------------------
145985 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
145986 ---------------------------------------------------------------------------------------------------------------
145987 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
145988
145989 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
145990 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
145991
145992 IF xla_accounting_cache_pkg.GetValueChar
145993 (p_source_code => 'LEDGER_CATEGORY_CODE'
145994 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
145995 AND l_bflow_method_code = 'PRIOR_ENTRY'
145996 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
145997 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
145998 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
145999 )
146000 THEN
146001 xla_ae_lines_pkg.BflowUpgEntry
146002 (p_business_method_code => l_bflow_method_code
146003 ,p_business_class_code => l_bflow_class_code
146004 ,p_balance_type => l_balance_type_code);
146005 ELSE
146006 NULL;
146007 -- No business flow processing for business flow method of NONE.
146008 END IF;
146009
146010 --
146011 -- call analytical criteria
146012 --
146013
146014 --
146015 -- call description
146016 --
146017
146018 xla_ae_lines_pkg.SetLineDescription(
146019 p_ae_header_id => l_ae_header_id
146020 ,p_description => Description_110 (
146021 p_application_id => p_application_id
146022 , p_ae_header_id => l_ae_header_id
146023 , p_source_1 => p_source_1
146024 )
146025 );
146026
146027
146028 --
146029 -- call ADRs
146030 -- Bug 4922099
146031 --
146032 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
146033 (NVL(l_actual_upg_option, 'N') = 'O') OR
146034 (NVL(l_enc_upg_option, 'N') = 'O')
146035 )
146036 THEN
146037 NULL;
146038 --
146039 --
146040
146041 l_ccid := AcctDerRule_174(
146042 p_application_id => p_application_id
146043 , p_ae_header_id => l_ae_header_id
146044 , p_source_5 => p_source_5
146045 , p_source_32 => p_source_32
146046 , x_transaction_coa_id => l_adr_transaction_coa_id
146047 , x_accounting_coa_id => l_adr_accounting_coa_id
146048 , x_value_type_code => l_adr_value_type_code
146049 , p_side => 'NA'
146050 );
146051
146052 xla_ae_lines_pkg.set_ccid(
146053 p_code_combination_id => l_ccid
146054 , p_value_type_code => l_adr_value_type_code
146055 , p_transaction_coa_id => l_adr_transaction_coa_id
146056 , p_accounting_coa_id => l_adr_accounting_coa_id
146057 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
146061 , p_component_type_code => l_component_type_code
146058 , p_adr_type_code => 'S'
146059 , p_component_type => l_component_type
146060 , p_component_code => l_component_code
146062 , p_component_appl_id => l_component_appl_id
146063 , p_amb_context_code => l_amb_context_code
146064 , p_side => 'NA'
146065 );
146066
146067
146068 l_segment := AcctDerRule_149(
146069 p_application_id => p_application_id
146070 , p_ae_header_id => l_ae_header_id
146071 , p_source_5 => p_source_5
146072 , p_source_11 => p_source_11
146073 , x_transaction_coa_id => l_adr_transaction_coa_id
146074 , x_accounting_coa_id => l_adr_accounting_coa_id
146075 , x_flexfield_segment_code => l_adr_flexfield_segment_code
146076 , x_flex_value_set_id => l_adr_flex_value_set_id
146077 , x_value_type_code => l_adr_value_type_code
146078 , x_value_combination_id => l_adr_value_combination_id
146079 , x_value_segment_code => l_adr_value_segment_code
146080 , p_side => 'NA'
146081 , p_override_seg_flag => 'Y'
146082 );
146083
146084 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
146085
146086 xla_ae_lines_pkg.set_segment(
146087 p_to_segment_code => 'GL_ACCOUNT'
146088 , p_segment_value => l_segment
146089 , p_from_segment_code => l_adr_value_segment_code
146090 , p_from_combination_id => l_adr_value_combination_id
146091 , p_value_type_code => l_adr_value_type_code
146092 , p_transaction_coa_id => l_adr_transaction_coa_id
146093 , p_accounting_coa_id => l_adr_accounting_coa_id
146094 , p_flexfield_segment_code => l_adr_flexfield_segment_code
146095 , p_flex_value_set_id => l_adr_flex_value_set_id
146096 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
146097 , p_adr_type_code => 'S'
146098 , p_component_type => l_component_type
146099 , p_component_code => l_component_code
146100 , p_component_type_code => l_component_type_code
146101 , p_component_appl_id => l_component_appl_id
146102 , p_amb_context_code => l_amb_context_code
146103 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
146104 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
146105 , p_side => 'NA'
146106 );
146107
146108 END IF;
146109
146110 l_segment := AcctDerRule_169(
146111 p_application_id => p_application_id
146112 , p_ae_header_id => l_ae_header_id
146113 , p_source_5 => p_source_5
146114 , p_source_31 => p_source_31
146115 , x_transaction_coa_id => l_adr_transaction_coa_id
146116 , x_accounting_coa_id => l_adr_accounting_coa_id
146117 , x_flexfield_segment_code => l_adr_flexfield_segment_code
146118 , x_flex_value_set_id => l_adr_flex_value_set_id
146119 , x_value_type_code => l_adr_value_type_code
146120 , x_value_combination_id => l_adr_value_combination_id
146121 , x_value_segment_code => l_adr_value_segment_code
146122 , p_side => 'NA'
146123 , p_override_seg_flag => 'Y'
146124 );
146125
146126 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
146127
146128 xla_ae_lines_pkg.set_segment(
146129 p_to_segment_code => 'GL_BALANCING'
146130 , p_segment_value => l_segment
146131 , p_from_segment_code => l_adr_value_segment_code
146132 , p_from_combination_id => l_adr_value_combination_id
146133 , p_value_type_code => l_adr_value_type_code
146134 , p_transaction_coa_id => l_adr_transaction_coa_id
146135 , p_accounting_coa_id => l_adr_accounting_coa_id
146136 , p_flexfield_segment_code => l_adr_flexfield_segment_code
146137 , p_flex_value_set_id => l_adr_flex_value_set_id
146138 , p_adr_code => 'FA_EXPENSE_ACCT'
146139 , p_adr_type_code => 'S'
146140 , p_component_type => l_component_type
146141 , p_component_code => l_component_code
146142 , p_component_type_code => l_component_type_code
146143 , p_component_appl_id => l_component_appl_id
146144 , p_amb_context_code => l_amb_context_code
146145 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
146146 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
146147 , p_side => 'NA'
146148 );
146149
146150 END IF;
146151
146152 --
146153 --
146154 END IF;
146155 --
146156 -- Bug 4922099
146157 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
146158 (NVL(l_enc_upg_option, 'N') = 'O')
146159 ) AND
146160 (l_bflow_method_code = 'PRIOR_ENTRY')
146161 )
146162 THEN
146163 IF
146164 --
146165 1 = 2
146166 --
146167 THEN
146168 xla_accounting_err_pkg.build_message
146169 (p_appli_s_name => 'XLA'
146170 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
146174 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
146171 ,p_token_1 => 'LINE_NUMBER'
146172 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
146173 ,p_token_2 => 'LINE_TYPE_NAME'
146175 l_component_type
146176 ,l_component_code
146177 ,l_component_type_code
146178 ,l_component_appl_id
146179 ,l_amb_context_code
146180 ,l_entity_code
146181 ,l_event_class_code
146182 )
146183 ,p_token_3 => 'OWNER'
146184 ,p_value_3 => xla_lookups_pkg.get_meaning(
146185 p_lookup_type => 'XLA_OWNER_TYPE'
146186 ,p_lookup_code => l_component_type_code
146187 )
146188 ,p_token_4 => 'PRODUCT_NAME'
146189 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
146190 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
146191 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
146192 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
146193 ,p_ae_header_id => NULL
146194 );
146195
146196 IF (C_LEVEL_ERROR>= g_log_level) THEN
146197 trace
146198 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
146199 ,p_level => C_LEVEL_ERROR
146200 ,p_module => l_log_module);
146201 END IF;
146202 END IF;
146203 END IF;
146204 --
146205 --
146206 ------------------------------------------------------------------------------------------------
146207 -- 4219869 Business Flow
146208 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
146209 -- Prior Entry. Currently, the following code is always generated.
146210 ------------------------------------------------------------------------------------------------
146211 XLA_AE_LINES_PKG.ValidateCurrentLine;
146212
146213 ------------------------------------------------------------------------------------
146214 -- 4219869 Business Flow
146215 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
146216 ------------------------------------------------------------------------------------
146217 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
146218
146219 ----------------------------------------------------------------------------------
146220 -- 4219869 Business Flow
146221 -- Update journal entry status -- Need to generate this within IF <condition>
146222 ----------------------------------------------------------------------------------
146223 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
146224 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
146225 ,p_balance_type_code => l_balance_type_code
146226 );
146227
146228 -------------------------------------------------------------------------------------------
146229 -- 4262811 - Generate the Accrual Reversal lines
146230 -------------------------------------------------------------------------------------------
146231 BEGIN
146232 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
146233 (g_array_event(p_event_id).array_value_num('header_index'));
146234 IF l_acc_rev_flag IS NULL THEN
146235 l_acc_rev_flag := 'N';
146236 END IF;
146237 EXCEPTION
146238 WHEN OTHERS THEN
146239 l_acc_rev_flag := 'N';
146240 END;
146241 --
146242 IF (l_acc_rev_flag = 'Y') THEN
146243
146244 -- 4645092 ------------------------------------------------------------------------------
146245 -- To allow MPA report to determine if it should generate report process
146246 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
146247 ------------------------------------------------------------------------------------------
146248
146249 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
146250 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
146251 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
146252 -- call ADRs
146253 -- Bug 4922099
146254 --
146255 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
146256 (NVL(l_actual_upg_option, 'N') = 'O') OR
146257 (NVL(l_enc_upg_option, 'N') = 'O')
146258 )
146259 THEN
146260 NULL;
146261 --
146262 --
146263
146264 l_ccid := AcctDerRule_174(
146265 p_application_id => p_application_id
146269 , x_transaction_coa_id => l_adr_transaction_coa_id
146266 , p_ae_header_id => l_ae_header_id
146267 , p_source_5 => p_source_5
146268 , p_source_32 => p_source_32
146270 , x_accounting_coa_id => l_adr_accounting_coa_id
146271 , x_value_type_code => l_adr_value_type_code
146272 , p_side => 'NA'
146273 );
146274
146275 xla_ae_lines_pkg.set_ccid(
146276 p_code_combination_id => l_ccid
146277 , p_value_type_code => l_adr_value_type_code
146278 , p_transaction_coa_id => l_adr_transaction_coa_id
146279 , p_accounting_coa_id => l_adr_accounting_coa_id
146280 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
146281 , p_adr_type_code => 'S'
146282 , p_component_type => l_component_type
146283 , p_component_code => l_component_code
146284 , p_component_type_code => l_component_type_code
146285 , p_component_appl_id => l_component_appl_id
146286 , p_amb_context_code => l_amb_context_code
146287 , p_side => 'NA'
146288 );
146289
146290
146291 l_segment := AcctDerRule_149(
146292 p_application_id => p_application_id
146293 , p_ae_header_id => l_ae_header_id
146294 , p_source_5 => p_source_5
146295 , p_source_11 => p_source_11
146296 , x_transaction_coa_id => l_adr_transaction_coa_id
146297 , x_accounting_coa_id => l_adr_accounting_coa_id
146298 , x_flexfield_segment_code => l_adr_flexfield_segment_code
146299 , x_flex_value_set_id => l_adr_flex_value_set_id
146300 , x_value_type_code => l_adr_value_type_code
146301 , x_value_combination_id => l_adr_value_combination_id
146302 , x_value_segment_code => l_adr_value_segment_code
146303 , p_side => 'NA'
146304 , p_override_seg_flag => 'Y'
146305 );
146306
146307 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
146308
146309 xla_ae_lines_pkg.set_segment(
146310 p_to_segment_code => 'GL_ACCOUNT'
146311 , p_segment_value => l_segment
146312 , p_from_segment_code => l_adr_value_segment_code
146313 , p_from_combination_id => l_adr_value_combination_id
146314 , p_value_type_code => l_adr_value_type_code
146315 , p_transaction_coa_id => l_adr_transaction_coa_id
146316 , p_accounting_coa_id => l_adr_accounting_coa_id
146317 , p_flexfield_segment_code => l_adr_flexfield_segment_code
146318 , p_flex_value_set_id => l_adr_flex_value_set_id
146319 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
146320 , p_adr_type_code => 'S'
146321 , p_component_type => l_component_type
146322 , p_component_code => l_component_code
146323 , p_component_type_code => l_component_type_code
146324 , p_component_appl_id => l_component_appl_id
146325 , p_amb_context_code => l_amb_context_code
146326 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
146327 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
146328 , p_side => 'NA'
146329 );
146330
146331 END IF;
146332
146333 l_segment := AcctDerRule_169(
146334 p_application_id => p_application_id
146335 , p_ae_header_id => l_ae_header_id
146336 , p_source_5 => p_source_5
146337 , p_source_31 => p_source_31
146338 , x_transaction_coa_id => l_adr_transaction_coa_id
146339 , x_accounting_coa_id => l_adr_accounting_coa_id
146340 , x_flexfield_segment_code => l_adr_flexfield_segment_code
146341 , x_flex_value_set_id => l_adr_flex_value_set_id
146342 , x_value_type_code => l_adr_value_type_code
146343 , x_value_combination_id => l_adr_value_combination_id
146344 , x_value_segment_code => l_adr_value_segment_code
146345 , p_side => 'NA'
146346 , p_override_seg_flag => 'Y'
146347 );
146348
146349 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
146350
146351 xla_ae_lines_pkg.set_segment(
146352 p_to_segment_code => 'GL_BALANCING'
146353 , p_segment_value => l_segment
146354 , p_from_segment_code => l_adr_value_segment_code
146355 , p_from_combination_id => l_adr_value_combination_id
146356 , p_value_type_code => l_adr_value_type_code
146357 , p_transaction_coa_id => l_adr_transaction_coa_id
146358 , p_accounting_coa_id => l_adr_accounting_coa_id
146359 , p_flexfield_segment_code => l_adr_flexfield_segment_code
146360 , p_flex_value_set_id => l_adr_flex_value_set_id
146361 , p_adr_code => 'FA_EXPENSE_ACCT'
146362 , p_adr_type_code => 'S'
146363 , p_component_type => l_component_type
146364 , p_component_code => l_component_code
146365 , p_component_type_code => l_component_type_code
146366 , p_component_appl_id => l_component_appl_id
146367 , p_amb_context_code => l_amb_context_code
146368 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
146369 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
146370 , p_side => 'NA'
146371 );
146372
146376 --
146373 END IF;
146374
146375 --
146377 END IF;
146378
146379 --
146380 -- Update the line information that should be overwritten
146381 --
146382 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
146383 p_header_num => 1);
146384 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
146385
146386 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
146387
146388 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
146389 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
146390 END IF;
146391
146392 --
146393 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
146394 --
146395 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
146396 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
146397 ELSE
146398 ---------------------------------------------------------------------------------------------------
146399 -- 4262811a Switch Sign
146400 ---------------------------------------------------------------------------------------------------
146401 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
146402 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
146403 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
146404 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
146405 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
146406 -- 5132302
146407 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
146408 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
146409
146410 END IF;
146411
146412 -- 4955764
146413 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
146414 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
146415
146416
146417 XLA_AE_LINES_PKG.ValidateCurrentLine;
146418 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
146419
146420 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
146421 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
146422 ,p_balance_type_code => l_balance_type_code);
146423
146424 END IF;
146425
146426 -----------------------------------------------------------------------------------------
146427 -- 4262811 Multiperiod Accounting
146428 -----------------------------------------------------------------------------------------
146429 -- No MPA option is assigned.
146430
146431
146432 END IF;
146433 END IF;
146434 --
146435
146436 --
146437 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
146438 trace
146439 (p_msg => 'END of AcctLineType_369'
146440 ,p_level => C_LEVEL_PROCEDURE
146441 ,p_module => l_log_module);
146442 END IF;
146443 --
146444 EXCEPTION
146445 WHEN xla_exceptions_pkg.application_exception THEN
146446 RAISE;
146447 WHEN OTHERS THEN
146448 xla_exceptions_pkg.raise_message
146449 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_369');
146450 END AcctLineType_369;
146451 --
146452
146453 ---------------------------------------
146454 --
146455 -- PRIVATE FUNCTION
146456 -- AcctLineType_370
146457 --
146458 ---------------------------------------
146459 PROCEDURE AcctLineType_370 (
146460 p_application_id IN NUMBER
146461 ,p_event_id IN NUMBER
146462 ,p_calculate_acctd_flag IN VARCHAR2
146463 ,p_calculate_g_l_flag IN VARCHAR2
146464 ,p_actual_flag IN OUT VARCHAR2
146465 ,p_balance_type_code OUT VARCHAR2
146466 ,p_gain_or_loss_ref OUT VARCHAR2
146467
146468 --Period Close Date
146469 , p_source_1 IN DATE
146470 --Generated Code Combination Identifier
146471 , p_source_5 IN NUMBER
146472 --Payables Code Combination Identifier
146473 , p_source_8 IN NUMBER
146474 --Asset Clearing Account
146475 , p_source_10 IN VARCHAR2
146476 --Expense Account Code Combination Identifier
146477 , p_source_31 IN NUMBER
146478 --Default Code Combination Identifier
146479 , p_source_32 IN NUMBER
146480 --Adjustment Type
146481 , p_source_48 IN VARCHAR2
146482 --Transaction Header Identifier
146483 , p_source_49 IN NUMBER
146484 --Adjustment Line Identifier
146485 , p_source_50 IN NUMBER
146486 --Distribution Type Code
146487 , p_source_51 IN VARCHAR2
146488 --Entered Amount
146489 , p_source_52 IN NUMBER
146490 --Currency Code
146491 , p_source_53 IN VARCHAR2
146492 --Source Destination Code
146493 , p_source_55 IN VARCHAR2
146494 )
146495 IS
146496
146497 l_component_type VARCHAR2(80);
146498 l_component_code VARCHAR2(30);
146502 l_entity_code VARCHAR2(30);
146499 l_component_type_code VARCHAR2(1);
146500 l_component_appl_id INTEGER;
146501 l_amb_context_code VARCHAR2(30);
146503 l_event_class_code VARCHAR2(30);
146504 l_ae_header_id NUMBER;
146505 l_event_type_code VARCHAR2(30);
146506 l_line_definition_code VARCHAR2(30);
146507 l_line_definition_owner_code VARCHAR2(1);
146508 --
146509 -- adr variables
146510 l_segment VARCHAR2(30);
146511 l_ccid NUMBER;
146512 l_adr_transaction_coa_id NUMBER;
146513 l_adr_accounting_coa_id NUMBER;
146514 l_adr_flexfield_segment_code VARCHAR2(30);
146515 l_adr_flex_value_set_id NUMBER;
146516 l_adr_value_type_code VARCHAR2(30);
146517 l_adr_value_combination_id NUMBER;
146518 l_adr_value_segment_code VARCHAR2(30);
146519
146520 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
146521 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
146522 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
146523 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
146524
146525 -- 4262811 Variables ------------------------------------------------------------------------------------------
146526 l_entered_amt_idx NUMBER;
146527 l_accted_amt_idx NUMBER;
146528 l_acc_rev_flag VARCHAR2(1);
146529 l_accrual_line_num NUMBER;
146530 l_tmp_amt NUMBER;
146531 l_acc_rev_natural_side_code VARCHAR2(1);
146532
146533 l_num_entries NUMBER;
146534 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
146535 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
146536 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
146537 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
146538 l_recog_line_1 NUMBER;
146539 l_recog_line_2 NUMBER;
146540
146541 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
146542 l_bflow_applied_to_amt NUMBER; -- 5132302
146543 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
146544
146545 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
146546
146547 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
146548 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
146549
146550 ---------------------------------------------------------------------------------------------------------------
146551
146552
146553 --
146554 -- bulk performance
146555 --
146556 l_balance_type_code VARCHAR2(1);
146557 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
146558 l_log_module VARCHAR2(240);
146559
146560 --
146561 -- Upgrade strategy
146562 --
146563 l_actual_upg_option VARCHAR2(1);
146564 l_enc_upg_option VARCHAR2(1);
146565
146566 --
146567 BEGIN
146568 --
146569 IF g_log_enabled THEN
146570 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_370';
146571 END IF;
146572 --
146573 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
146574
146575 trace
146576 (p_msg => 'BEGIN of AcctLineType_370'
146577 ,p_level => C_LEVEL_PROCEDURE
146578 ,p_module => l_log_module);
146579
146580 END IF;
146581 --
146582 l_component_type := 'AMB_JLT';
146583 l_component_code := 'FA_SLT_SOURCE_COST_CLEARING';
146584 l_component_type_code := 'S';
146585 l_component_appl_id := 140;
146586 l_amb_context_code := 'DEFAULT';
146587 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
146588 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
146589 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
146590 l_line_definition_owner_code := 'S';
146591 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
146592 --
146593 l_balance_type_code := 'A';
146594 l_segment := NULL;
146595 l_ccid := NULL;
146596 l_adr_transaction_coa_id := NULL;
146597 l_adr_accounting_coa_id := NULL;
146598 l_adr_flexfield_segment_code := NULL;
146599 l_adr_flex_value_set_id := NULL;
146600 l_adr_value_type_code := NULL;
146601 l_adr_value_combination_id := NULL;
146602 l_adr_value_segment_code := NULL;
146603
146604 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
146605 l_bflow_class_code := ''; -- 4219869 Business Flow
146606 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
146607 l_budgetary_control_flag := 'N';
146608
146609 l_bflow_applied_to_amt_idx := NULL; -- 5132302
146610 l_bflow_applied_to_amt := NULL; -- 5132302
146611 l_entered_amt_idx := NULL; -- 4262811
146612 l_accted_amt_idx := NULL; -- 4262811
146613 l_acc_rev_flag := NULL; -- 4262811
146614 l_accrual_line_num := NULL; -- 4262811
146615 l_tmp_amt := NULL; -- 4262811
146616 --
146617
146618 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
146619 l_balance_type_code <> 'B' THEN
146620 IF NVL(p_source_48,'
146621 ') = 'COST CLEARING' AND
146625
146622 NVL(p_source_55,'
146623 ') = 'SOURCE'
146624 THEN
146626 --
146627 XLA_AE_LINES_PKG.SetNewLine;
146628
146629 p_balance_type_code := l_balance_type_code;
146630 -- set the flag so later we will know whether the gain loss line needs to be created
146631
146632 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
146633 p_actual_flag :='A';
146634 END IF;
146635
146636 --
146637 -- bulk performance
146638 --
146639 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
146640 p_header_num => 0); -- 4262811
146641 --
146642 -- set accounting line options
146643 --
146644 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
146645 p_natural_side_code => 'D'
146646 , p_gain_or_loss_flag => 'N'
146647 , p_gl_transfer_mode_code => 'S'
146648 , p_acct_entry_type_code => 'A'
146649 , p_switch_side_flag => 'Y'
146650 , p_merge_duplicate_code => 'N'
146651 );
146652 --
146653 l_acc_rev_natural_side_code := 'C'; -- 4262811
146654 --
146655 --
146656 -- set accounting line type info
146657 --
146658 xla_ae_lines_pkg.SetAcctLineType
146659 (p_component_type => l_component_type
146660 ,p_event_type_code => l_event_type_code
146661 ,p_line_definition_owner_code => l_line_definition_owner_code
146662 ,p_line_definition_code => l_line_definition_code
146663 ,p_accounting_line_code => l_component_code
146664 ,p_accounting_line_type_code => l_component_type_code
146665 ,p_accounting_line_appl_id => l_component_appl_id
146666 ,p_amb_context_code => l_amb_context_code
146667 ,p_entity_code => l_entity_code
146668 ,p_event_class_code => l_event_class_code);
146669 --
146670 -- set accounting class
146671 --
146672 xla_ae_lines_pkg.SetAcctClass(
146673 p_accounting_class_code => 'ASSET'
146674 , p_ae_header_id => l_ae_header_id
146675 );
146676
146677 --
146678 -- set rounding class
146679 --
146680 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
146681 'ASSET';
146682
146683 --
146684 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
146685 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
146686 --
146687 -- bulk performance
146688 --
146689 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
146690
146691 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
146692 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
146693
146694 -- 4955764
146695 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
146696 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
146697
146698 -- 4458381 Public Sector Enh
146699
146700 --
146701 -- set accounting attributes for the line type
146702 --
146703 l_entered_amt_idx := 4;
146704 l_accted_amt_idx := 6;
146705 l_bflow_applied_to_amt_idx := NULL; -- 5132302
146706 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
146707 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
146708 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
146709 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
146710 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
146711 l_rec_acct_attrs.array_char_value(3) := p_source_51;
146712 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
146713 l_rec_acct_attrs.array_num_value(4) := p_source_52;
146714 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
146715 l_rec_acct_attrs.array_char_value(5) := p_source_53;
146716 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
146717 l_rec_acct_attrs.array_num_value(6) := p_source_52;
146718
146719 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
146720 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
146721
146722 ---------------------------------------------------------------------------------------------------------------
146723 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
146724 ---------------------------------------------------------------------------------------------------------------
146725 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
146726
146727 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
146728 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
146729
146730 IF xla_accounting_cache_pkg.GetValueChar
146731 (p_source_code => 'LEDGER_CATEGORY_CODE'
146732 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
146733 AND l_bflow_method_code = 'PRIOR_ENTRY'
146734 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
146735 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
146736 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
146737 )
146738 THEN
146742 ,p_balance_type => l_balance_type_code);
146739 xla_ae_lines_pkg.BflowUpgEntry
146740 (p_business_method_code => l_bflow_method_code
146741 ,p_business_class_code => l_bflow_class_code
146743 ELSE
146744 NULL;
146745 -- No business flow processing for business flow method of NONE.
146746 END IF;
146747
146748 --
146749 -- call analytical criteria
146750 --
146751
146752 --
146753 -- call description
146754 --
146755
146756 xla_ae_lines_pkg.SetLineDescription(
146757 p_ae_header_id => l_ae_header_id
146758 ,p_description => Description_111 (
146759 p_application_id => p_application_id
146760 , p_ae_header_id => l_ae_header_id
146761 , p_source_1 => p_source_1
146762 )
146763 );
146764
146765
146766 --
146767 -- call ADRs
146768 -- Bug 4922099
146769 --
146770 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
146771 (NVL(l_actual_upg_option, 'N') = 'O') OR
146772 (NVL(l_enc_upg_option, 'N') = 'O')
146773 )
146774 THEN
146775 NULL;
146776 --
146777 --
146778
146779 l_ccid := AcctDerRule_173(
146780 p_application_id => p_application_id
146781 , p_ae_header_id => l_ae_header_id
146782 , p_source_5 => p_source_5
146783 , p_source_8 => p_source_8
146784 , p_source_32 => p_source_32
146785 , x_transaction_coa_id => l_adr_transaction_coa_id
146786 , x_accounting_coa_id => l_adr_accounting_coa_id
146787 , x_value_type_code => l_adr_value_type_code
146788 , p_side => 'NA'
146789 );
146790
146791 xla_ae_lines_pkg.set_ccid(
146792 p_code_combination_id => l_ccid
146793 , p_value_type_code => l_adr_value_type_code
146794 , p_transaction_coa_id => l_adr_transaction_coa_id
146795 , p_accounting_coa_id => l_adr_accounting_coa_id
146796 , p_adr_code => 'FA_CAT_COST_CLEARING'
146797 , p_adr_type_code => 'S'
146798 , p_component_type => l_component_type
146799 , p_component_code => l_component_code
146800 , p_component_type_code => l_component_type_code
146801 , p_component_appl_id => l_component_appl_id
146802 , p_amb_context_code => l_amb_context_code
146803 , p_side => 'NA'
146804 );
146805
146806
146807 l_segment := AcctDerRule_148(
146808 p_application_id => p_application_id
146809 , p_ae_header_id => l_ae_header_id
146810 , p_source_5 => p_source_5
146811 , p_source_8 => p_source_8
146812 , p_source_10 => p_source_10
146813 , x_transaction_coa_id => l_adr_transaction_coa_id
146814 , x_accounting_coa_id => l_adr_accounting_coa_id
146815 , x_flexfield_segment_code => l_adr_flexfield_segment_code
146816 , x_flex_value_set_id => l_adr_flex_value_set_id
146817 , x_value_type_code => l_adr_value_type_code
146818 , x_value_combination_id => l_adr_value_combination_id
146819 , x_value_segment_code => l_adr_value_segment_code
146820 , p_side => 'NA'
146821 , p_override_seg_flag => 'Y'
146822 );
146823
146824 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
146825
146826 xla_ae_lines_pkg.set_segment(
146827 p_to_segment_code => 'GL_ACCOUNT'
146828 , p_segment_value => l_segment
146829 , p_from_segment_code => l_adr_value_segment_code
146830 , p_from_combination_id => l_adr_value_combination_id
146831 , p_value_type_code => l_adr_value_type_code
146832 , p_transaction_coa_id => l_adr_transaction_coa_id
146833 , p_accounting_coa_id => l_adr_accounting_coa_id
146834 , p_flexfield_segment_code => l_adr_flexfield_segment_code
146835 , p_flex_value_set_id => l_adr_flex_value_set_id
146836 , p_adr_code => 'FA_CAT_CLR_ACCOUNT_SEGMENT'
146837 , p_adr_type_code => 'S'
146838 , p_component_type => l_component_type
146839 , p_component_code => l_component_code
146840 , p_component_type_code => l_component_type_code
146841 , p_component_appl_id => l_component_appl_id
146842 , p_amb_context_code => l_amb_context_code
146843 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
146844 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
146845 , p_side => 'NA'
146846 );
146847
146848 END IF;
146849
146850 l_segment := AcctDerRule_170(
146851 p_application_id => p_application_id
146852 , p_ae_header_id => l_ae_header_id
146853 , p_source_5 => p_source_5
146854 , p_source_8 => p_source_8
146855 , p_source_31 => p_source_31
146856 , x_transaction_coa_id => l_adr_transaction_coa_id
146857 , x_accounting_coa_id => l_adr_accounting_coa_id
146858 , x_flexfield_segment_code => l_adr_flexfield_segment_code
146859 , x_flex_value_set_id => l_adr_flex_value_set_id
146860 , x_value_type_code => l_adr_value_type_code
146861 , x_value_combination_id => l_adr_value_combination_id
146862 , x_value_segment_code => l_adr_value_segment_code
146866
146863 , p_side => 'NA'
146864 , p_override_seg_flag => 'Y'
146865 );
146867 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
146868
146869 xla_ae_lines_pkg.set_segment(
146870 p_to_segment_code => 'GL_BALANCING'
146871 , p_segment_value => l_segment
146872 , p_from_segment_code => l_adr_value_segment_code
146873 , p_from_combination_id => l_adr_value_combination_id
146874 , p_value_type_code => l_adr_value_type_code
146875 , p_transaction_coa_id => l_adr_transaction_coa_id
146876 , p_accounting_coa_id => l_adr_accounting_coa_id
146877 , p_flexfield_segment_code => l_adr_flexfield_segment_code
146878 , p_flex_value_set_id => l_adr_flex_value_set_id
146879 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
146880 , p_adr_type_code => 'S'
146881 , p_component_type => l_component_type
146882 , p_component_code => l_component_code
146883 , p_component_type_code => l_component_type_code
146884 , p_component_appl_id => l_component_appl_id
146885 , p_amb_context_code => l_amb_context_code
146886 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
146887 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
146888 , p_side => 'NA'
146889 );
146890
146891 END IF;
146892
146893 --
146894 --
146895 END IF;
146896 --
146897 -- Bug 4922099
146898 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
146899 (NVL(l_enc_upg_option, 'N') = 'O')
146900 ) AND
146901 (l_bflow_method_code = 'PRIOR_ENTRY')
146902 )
146903 THEN
146904 IF
146905 --
146906 1 = 2
146907 --
146908 THEN
146909 xla_accounting_err_pkg.build_message
146910 (p_appli_s_name => 'XLA'
146911 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
146912 ,p_token_1 => 'LINE_NUMBER'
146913 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
146914 ,p_token_2 => 'LINE_TYPE_NAME'
146915 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
146916 l_component_type
146917 ,l_component_code
146918 ,l_component_type_code
146919 ,l_component_appl_id
146920 ,l_amb_context_code
146921 ,l_entity_code
146922 ,l_event_class_code
146923 )
146924 ,p_token_3 => 'OWNER'
146925 ,p_value_3 => xla_lookups_pkg.get_meaning(
146926 p_lookup_type => 'XLA_OWNER_TYPE'
146927 ,p_lookup_code => l_component_type_code
146928 )
146929 ,p_token_4 => 'PRODUCT_NAME'
146930 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
146931 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
146932 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
146933 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
146934 ,p_ae_header_id => NULL
146935 );
146936
146937 IF (C_LEVEL_ERROR>= g_log_level) THEN
146938 trace
146939 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
146940 ,p_level => C_LEVEL_ERROR
146941 ,p_module => l_log_module);
146942 END IF;
146943 END IF;
146944 END IF;
146945 --
146946 --
146947 ------------------------------------------------------------------------------------------------
146948 -- 4219869 Business Flow
146949 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
146950 -- Prior Entry. Currently, the following code is always generated.
146951 ------------------------------------------------------------------------------------------------
146952 XLA_AE_LINES_PKG.ValidateCurrentLine;
146953
146954 ------------------------------------------------------------------------------------
146955 -- 4219869 Business Flow
146956 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
146957 ------------------------------------------------------------------------------------
146958 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
146959
146963 ----------------------------------------------------------------------------------
146960 ----------------------------------------------------------------------------------
146961 -- 4219869 Business Flow
146962 -- Update journal entry status -- Need to generate this within IF <condition>
146964 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
146965 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
146966 ,p_balance_type_code => l_balance_type_code
146967 );
146968
146969 -------------------------------------------------------------------------------------------
146970 -- 4262811 - Generate the Accrual Reversal lines
146971 -------------------------------------------------------------------------------------------
146972 BEGIN
146973 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
146974 (g_array_event(p_event_id).array_value_num('header_index'));
146975 IF l_acc_rev_flag IS NULL THEN
146976 l_acc_rev_flag := 'N';
146977 END IF;
146978 EXCEPTION
146979 WHEN OTHERS THEN
146980 l_acc_rev_flag := 'N';
146981 END;
146982 --
146983 IF (l_acc_rev_flag = 'Y') THEN
146984
146985 -- 4645092 ------------------------------------------------------------------------------
146986 -- To allow MPA report to determine if it should generate report process
146987 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
146988 ------------------------------------------------------------------------------------------
146989
146990 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
146991 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
146992 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
146993 -- call ADRs
146994 -- Bug 4922099
146995 --
146996 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
146997 (NVL(l_actual_upg_option, 'N') = 'O') OR
146998 (NVL(l_enc_upg_option, 'N') = 'O')
146999 )
147000 THEN
147001 NULL;
147002 --
147003 --
147004
147005 l_ccid := AcctDerRule_173(
147006 p_application_id => p_application_id
147007 , p_ae_header_id => l_ae_header_id
147008 , p_source_5 => p_source_5
147009 , p_source_8 => p_source_8
147010 , p_source_32 => p_source_32
147011 , x_transaction_coa_id => l_adr_transaction_coa_id
147012 , x_accounting_coa_id => l_adr_accounting_coa_id
147013 , x_value_type_code => l_adr_value_type_code
147014 , p_side => 'NA'
147015 );
147016
147017 xla_ae_lines_pkg.set_ccid(
147018 p_code_combination_id => l_ccid
147019 , p_value_type_code => l_adr_value_type_code
147020 , p_transaction_coa_id => l_adr_transaction_coa_id
147021 , p_accounting_coa_id => l_adr_accounting_coa_id
147022 , p_adr_code => 'FA_CAT_COST_CLEARING'
147023 , p_adr_type_code => 'S'
147024 , p_component_type => l_component_type
147025 , p_component_code => l_component_code
147026 , p_component_type_code => l_component_type_code
147027 , p_component_appl_id => l_component_appl_id
147028 , p_amb_context_code => l_amb_context_code
147029 , p_side => 'NA'
147030 );
147031
147032
147033 l_segment := AcctDerRule_148(
147034 p_application_id => p_application_id
147035 , p_ae_header_id => l_ae_header_id
147036 , p_source_5 => p_source_5
147037 , p_source_8 => p_source_8
147038 , p_source_10 => p_source_10
147039 , x_transaction_coa_id => l_adr_transaction_coa_id
147040 , x_accounting_coa_id => l_adr_accounting_coa_id
147041 , x_flexfield_segment_code => l_adr_flexfield_segment_code
147042 , x_flex_value_set_id => l_adr_flex_value_set_id
147043 , x_value_type_code => l_adr_value_type_code
147044 , x_value_combination_id => l_adr_value_combination_id
147045 , x_value_segment_code => l_adr_value_segment_code
147046 , p_side => 'NA'
147047 , p_override_seg_flag => 'Y'
147048 );
147049
147050 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
147051
147052 xla_ae_lines_pkg.set_segment(
147053 p_to_segment_code => 'GL_ACCOUNT'
147054 , p_segment_value => l_segment
147055 , p_from_segment_code => l_adr_value_segment_code
147056 , p_from_combination_id => l_adr_value_combination_id
147057 , p_value_type_code => l_adr_value_type_code
147058 , p_transaction_coa_id => l_adr_transaction_coa_id
147059 , p_accounting_coa_id => l_adr_accounting_coa_id
147060 , p_flexfield_segment_code => l_adr_flexfield_segment_code
147061 , p_flex_value_set_id => l_adr_flex_value_set_id
147062 , p_adr_code => 'FA_CAT_CLR_ACCOUNT_SEGMENT'
147063 , p_adr_type_code => 'S'
147064 , p_component_type => l_component_type
147065 , p_component_code => l_component_code
147066 , p_component_type_code => l_component_type_code
147067 , p_component_appl_id => l_component_appl_id
147068 , p_amb_context_code => l_amb_context_code
147069 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
147073
147070 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
147071 , p_side => 'NA'
147072 );
147074 END IF;
147075
147076 l_segment := AcctDerRule_170(
147077 p_application_id => p_application_id
147078 , p_ae_header_id => l_ae_header_id
147079 , p_source_5 => p_source_5
147080 , p_source_8 => p_source_8
147081 , p_source_31 => p_source_31
147082 , x_transaction_coa_id => l_adr_transaction_coa_id
147083 , x_accounting_coa_id => l_adr_accounting_coa_id
147084 , x_flexfield_segment_code => l_adr_flexfield_segment_code
147085 , x_flex_value_set_id => l_adr_flex_value_set_id
147086 , x_value_type_code => l_adr_value_type_code
147087 , x_value_combination_id => l_adr_value_combination_id
147088 , x_value_segment_code => l_adr_value_segment_code
147089 , p_side => 'NA'
147090 , p_override_seg_flag => 'Y'
147091 );
147092
147093 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
147094
147095 xla_ae_lines_pkg.set_segment(
147096 p_to_segment_code => 'GL_BALANCING'
147097 , p_segment_value => l_segment
147098 , p_from_segment_code => l_adr_value_segment_code
147099 , p_from_combination_id => l_adr_value_combination_id
147100 , p_value_type_code => l_adr_value_type_code
147101 , p_transaction_coa_id => l_adr_transaction_coa_id
147102 , p_accounting_coa_id => l_adr_accounting_coa_id
147103 , p_flexfield_segment_code => l_adr_flexfield_segment_code
147104 , p_flex_value_set_id => l_adr_flex_value_set_id
147105 , p_adr_code => 'FA_EXPENSE_ACCT_PAY'
147106 , p_adr_type_code => 'S'
147107 , p_component_type => l_component_type
147108 , p_component_code => l_component_code
147109 , p_component_type_code => l_component_type_code
147110 , p_component_appl_id => l_component_appl_id
147111 , p_amb_context_code => l_amb_context_code
147112 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
147113 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
147114 , p_side => 'NA'
147115 );
147116
147117 END IF;
147118
147119 --
147120 --
147121 END IF;
147122
147123 --
147124 -- Update the line information that should be overwritten
147125 --
147126 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
147127 p_header_num => 1);
147128 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
147129
147130 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
147131
147132 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
147133 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
147134 END IF;
147135
147136 --
147137 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
147138 --
147139 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
147140 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
147141 ELSE
147142 ---------------------------------------------------------------------------------------------------
147143 -- 4262811a Switch Sign
147144 ---------------------------------------------------------------------------------------------------
147145 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
147146 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
147147 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
147148 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
147149 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
147150 -- 5132302
147151 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
147152 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
147153
147154 END IF;
147155
147156 -- 4955764
147157 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
147158 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
147159
147160
147161 XLA_AE_LINES_PKG.ValidateCurrentLine;
147162 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
147163
147164 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
147165 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
147166 ,p_balance_type_code => l_balance_type_code);
147167
147168 END IF;
147169
147170 -----------------------------------------------------------------------------------------
147171 -- 4262811 Multiperiod Accounting
147172 -----------------------------------------------------------------------------------------
147173 -- No MPA option is assigned.
147174
147175
147176 END IF;
147177 END IF;
147181 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
147178 --
147179
147180 --
147182 trace
147183 (p_msg => 'END of AcctLineType_370'
147184 ,p_level => C_LEVEL_PROCEDURE
147185 ,p_module => l_log_module);
147186 END IF;
147187 --
147188 EXCEPTION
147189 WHEN xla_exceptions_pkg.application_exception THEN
147190 RAISE;
147191 WHEN OTHERS THEN
147192 xla_exceptions_pkg.raise_message
147193 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_370');
147194 END AcctLineType_370;
147195 --
147196
147197 ---------------------------------------
147198 --
147199 -- PRIVATE FUNCTION
147200 -- AcctLineType_371
147201 --
147202 ---------------------------------------
147203 PROCEDURE AcctLineType_371 (
147204 p_application_id IN NUMBER
147205 ,p_event_id IN NUMBER
147206 ,p_calculate_acctd_flag IN VARCHAR2
147207 ,p_calculate_g_l_flag IN VARCHAR2
147208 ,p_actual_flag IN OUT VARCHAR2
147209 ,p_balance_type_code OUT VARCHAR2
147210 ,p_gain_or_loss_ref OUT VARCHAR2
147211
147212 --Period Close Date
147213 , p_source_1 IN DATE
147214 --Generated Code Combination Identifier
147215 , p_source_5 IN NUMBER
147216 --Expense Account Code Combination Identifier
147217 , p_source_31 IN NUMBER
147218 --Adjustment Type
147219 , p_source_48 IN VARCHAR2
147220 --Transaction Header Identifier
147221 , p_source_49 IN NUMBER
147222 --Adjustment Line Identifier
147223 , p_source_50 IN NUMBER
147224 --Distribution Type Code
147225 , p_source_51 IN VARCHAR2
147226 --Entered Amount
147227 , p_source_52 IN NUMBER
147228 --Currency Code
147229 , p_source_53 IN VARCHAR2
147230 --Source Destination Code
147231 , p_source_55 IN VARCHAR2
147232 )
147233 IS
147234
147235 l_component_type VARCHAR2(80);
147236 l_component_code VARCHAR2(30);
147237 l_component_type_code VARCHAR2(1);
147238 l_component_appl_id INTEGER;
147239 l_amb_context_code VARCHAR2(30);
147240 l_entity_code VARCHAR2(30);
147241 l_event_class_code VARCHAR2(30);
147242 l_ae_header_id NUMBER;
147243 l_event_type_code VARCHAR2(30);
147244 l_line_definition_code VARCHAR2(30);
147245 l_line_definition_owner_code VARCHAR2(1);
147246 --
147247 -- adr variables
147248 l_segment VARCHAR2(30);
147249 l_ccid NUMBER;
147250 l_adr_transaction_coa_id NUMBER;
147251 l_adr_accounting_coa_id NUMBER;
147252 l_adr_flexfield_segment_code VARCHAR2(30);
147253 l_adr_flex_value_set_id NUMBER;
147254 l_adr_value_type_code VARCHAR2(30);
147255 l_adr_value_combination_id NUMBER;
147256 l_adr_value_segment_code VARCHAR2(30);
147257
147258 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
147259 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
147260 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
147261 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
147262
147263 -- 4262811 Variables ------------------------------------------------------------------------------------------
147264 l_entered_amt_idx NUMBER;
147265 l_accted_amt_idx NUMBER;
147266 l_acc_rev_flag VARCHAR2(1);
147267 l_accrual_line_num NUMBER;
147268 l_tmp_amt NUMBER;
147269 l_acc_rev_natural_side_code VARCHAR2(1);
147270
147271 l_num_entries NUMBER;
147272 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
147273 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
147274 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
147275 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
147276 l_recog_line_1 NUMBER;
147277 l_recog_line_2 NUMBER;
147278
147279 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
147280 l_bflow_applied_to_amt NUMBER; -- 5132302
147281 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
147282
147283 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
147284
147285 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
147286 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
147287
147288 ---------------------------------------------------------------------------------------------------------------
147289
147290
147291 --
147292 -- bulk performance
147293 --
147294 l_balance_type_code VARCHAR2(1);
147295 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
147296 l_log_module VARCHAR2(240);
147297
147298 --
147299 -- Upgrade strategy
147300 --
147301 l_actual_upg_option VARCHAR2(1);
147302 l_enc_upg_option VARCHAR2(1);
147303
147304 --
147305 BEGIN
147306 --
147307 IF g_log_enabled THEN
147308 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_371';
147309 END IF;
147310 --
147311 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
147312
147313 trace
147314 (p_msg => 'BEGIN of AcctLineType_371'
147315 ,p_level => C_LEVEL_PROCEDURE
147316 ,p_module => l_log_module);
147317
147318 END IF;
147319 --
147323 l_component_appl_id := 140;
147320 l_component_type := 'AMB_JLT';
147321 l_component_code := 'FA_SLT_SOURCE_DEPRN_EXP';
147322 l_component_type_code := 'S';
147324 l_amb_context_code := 'DEFAULT';
147325 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
147326 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
147327 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
147328 l_line_definition_owner_code := 'S';
147329 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
147330 --
147331 l_balance_type_code := 'A';
147332 l_segment := NULL;
147333 l_ccid := NULL;
147334 l_adr_transaction_coa_id := NULL;
147335 l_adr_accounting_coa_id := NULL;
147336 l_adr_flexfield_segment_code := NULL;
147337 l_adr_flex_value_set_id := NULL;
147338 l_adr_value_type_code := NULL;
147339 l_adr_value_combination_id := NULL;
147340 l_adr_value_segment_code := NULL;
147341
147342 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
147343 l_bflow_class_code := ''; -- 4219869 Business Flow
147344 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
147345 l_budgetary_control_flag := 'N';
147346
147347 l_bflow_applied_to_amt_idx := NULL; -- 5132302
147348 l_bflow_applied_to_amt := NULL; -- 5132302
147349 l_entered_amt_idx := NULL; -- 4262811
147350 l_accted_amt_idx := NULL; -- 4262811
147351 l_acc_rev_flag := NULL; -- 4262811
147352 l_accrual_line_num := NULL; -- 4262811
147353 l_tmp_amt := NULL; -- 4262811
147354 --
147355
147356 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
147357 l_balance_type_code <> 'B' THEN
147358 IF NVL(p_source_48,'
147359 ') = 'EXPENSE' AND
147360 NVL(p_source_55,'
147361 ') = 'SOURCE'
147362 THEN
147363
147364 --
147365 XLA_AE_LINES_PKG.SetNewLine;
147366
147367 p_balance_type_code := l_balance_type_code;
147368 -- set the flag so later we will know whether the gain loss line needs to be created
147369
147370 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
147371 p_actual_flag :='A';
147372 END IF;
147373
147374 --
147375 -- bulk performance
147376 --
147377 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
147378 p_header_num => 0); -- 4262811
147379 --
147380 -- set accounting line options
147381 --
147382 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
147383 p_natural_side_code => 'C'
147384 , p_gain_or_loss_flag => 'N'
147385 , p_gl_transfer_mode_code => 'S'
147386 , p_acct_entry_type_code => 'A'
147387 , p_switch_side_flag => 'Y'
147388 , p_merge_duplicate_code => 'N'
147389 );
147390 --
147391 l_acc_rev_natural_side_code := 'D'; -- 4262811
147392 --
147393 --
147394 -- set accounting line type info
147395 --
147396 xla_ae_lines_pkg.SetAcctLineType
147397 (p_component_type => l_component_type
147398 ,p_event_type_code => l_event_type_code
147399 ,p_line_definition_owner_code => l_line_definition_owner_code
147400 ,p_line_definition_code => l_line_definition_code
147401 ,p_accounting_line_code => l_component_code
147402 ,p_accounting_line_type_code => l_component_type_code
147403 ,p_accounting_line_appl_id => l_component_appl_id
147404 ,p_amb_context_code => l_amb_context_code
147405 ,p_entity_code => l_entity_code
147406 ,p_event_class_code => l_event_class_code);
147407 --
147408 -- set accounting class
147409 --
147410 xla_ae_lines_pkg.SetAcctClass(
147411 p_accounting_class_code => 'EXPENSE'
147412 , p_ae_header_id => l_ae_header_id
147413 );
147414
147415 --
147416 -- set rounding class
147417 --
147418 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
147419 'EXPENSE';
147420
147421 --
147422 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
147423 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
147424 --
147425 -- bulk performance
147426 --
147427 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
147428
147429 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
147430 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
147431
147432 -- 4955764
147433 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
147434 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
147435
147436 -- 4458381 Public Sector Enh
147437
147438 --
147439 -- set accounting attributes for the line type
147440 --
147441 l_entered_amt_idx := 4;
147442 l_accted_amt_idx := 6;
147443 l_bflow_applied_to_amt_idx := NULL; -- 5132302
147444 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
147445 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
147449 l_rec_acct_attrs.array_char_value(3) := p_source_51;
147446 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
147447 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
147448 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
147450 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
147451 l_rec_acct_attrs.array_num_value(4) := p_source_52;
147452 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
147453 l_rec_acct_attrs.array_char_value(5) := p_source_53;
147454 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
147455 l_rec_acct_attrs.array_num_value(6) := p_source_52;
147456
147457 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
147458 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
147459
147460 ---------------------------------------------------------------------------------------------------------------
147461 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
147462 ---------------------------------------------------------------------------------------------------------------
147463 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
147464
147465 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
147466 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
147467
147468 IF xla_accounting_cache_pkg.GetValueChar
147469 (p_source_code => 'LEDGER_CATEGORY_CODE'
147470 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
147471 AND l_bflow_method_code = 'PRIOR_ENTRY'
147472 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
147473 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
147474 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
147475 )
147476 THEN
147477 xla_ae_lines_pkg.BflowUpgEntry
147478 (p_business_method_code => l_bflow_method_code
147479 ,p_business_class_code => l_bflow_class_code
147480 ,p_balance_type => l_balance_type_code);
147481 ELSE
147482 NULL;
147483 -- No business flow processing for business flow method of NONE.
147484 END IF;
147485
147486 --
147487 -- call analytical criteria
147488 --
147489
147490 --
147491 -- call description
147492 --
147493
147494 xla_ae_lines_pkg.SetLineDescription(
147495 p_ae_header_id => l_ae_header_id
147496 ,p_description => Description_112 (
147497 p_application_id => p_application_id
147498 , p_ae_header_id => l_ae_header_id
147499 , p_source_1 => p_source_1
147500 )
147501 );
147502
147503
147504 --
147505 -- call ADRs
147506 -- Bug 4922099
147507 --
147508 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
147509 (NVL(l_actual_upg_option, 'N') = 'O') OR
147510 (NVL(l_enc_upg_option, 'N') = 'O')
147511 )
147512 THEN
147513 NULL;
147514 --
147515 --
147516
147517 l_ccid := AcctDerRule_176(
147518 p_application_id => p_application_id
147519 , p_ae_header_id => l_ae_header_id
147520 , p_source_5 => p_source_5
147521 , p_source_31 => p_source_31
147522 , x_transaction_coa_id => l_adr_transaction_coa_id
147523 , x_accounting_coa_id => l_adr_accounting_coa_id
147524 , x_value_type_code => l_adr_value_type_code
147525 , p_side => 'NA'
147526 );
147527
147528 xla_ae_lines_pkg.set_ccid(
147529 p_code_combination_id => l_ccid
147530 , p_value_type_code => l_adr_value_type_code
147531 , p_transaction_coa_id => l_adr_transaction_coa_id
147532 , p_accounting_coa_id => l_adr_accounting_coa_id
147533 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
147534 , p_adr_type_code => 'S'
147535 , p_component_type => l_component_type
147536 , p_component_code => l_component_code
147537 , p_component_type_code => l_component_type_code
147538 , p_component_appl_id => l_component_appl_id
147539 , p_amb_context_code => l_amb_context_code
147540 , p_side => 'NA'
147541 );
147542
147543
147544 --
147545 --
147546 END IF;
147547 --
147548 -- Bug 4922099
147549 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
147550 (NVL(l_enc_upg_option, 'N') = 'O')
147551 ) AND
147552 (l_bflow_method_code = 'PRIOR_ENTRY')
147553 )
147554 THEN
147555 IF
147556 --
147557 1 = 2
147558 --
147559 THEN
147560 xla_accounting_err_pkg.build_message
147561 (p_appli_s_name => 'XLA'
147562 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
147563 ,p_token_1 => 'LINE_NUMBER'
147564 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
147565 ,p_token_2 => 'LINE_TYPE_NAME'
147566 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
147570 ,l_component_appl_id
147567 l_component_type
147568 ,l_component_code
147569 ,l_component_type_code
147571 ,l_amb_context_code
147572 ,l_entity_code
147573 ,l_event_class_code
147574 )
147575 ,p_token_3 => 'OWNER'
147576 ,p_value_3 => xla_lookups_pkg.get_meaning(
147577 p_lookup_type => 'XLA_OWNER_TYPE'
147578 ,p_lookup_code => l_component_type_code
147579 )
147580 ,p_token_4 => 'PRODUCT_NAME'
147581 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
147582 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
147583 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
147584 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
147585 ,p_ae_header_id => NULL
147586 );
147587
147588 IF (C_LEVEL_ERROR>= g_log_level) THEN
147589 trace
147590 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
147591 ,p_level => C_LEVEL_ERROR
147592 ,p_module => l_log_module);
147593 END IF;
147594 END IF;
147595 END IF;
147596 --
147597 --
147598 ------------------------------------------------------------------------------------------------
147599 -- 4219869 Business Flow
147600 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
147601 -- Prior Entry. Currently, the following code is always generated.
147602 ------------------------------------------------------------------------------------------------
147603 XLA_AE_LINES_PKG.ValidateCurrentLine;
147604
147605 ------------------------------------------------------------------------------------
147606 -- 4219869 Business Flow
147607 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
147608 ------------------------------------------------------------------------------------
147609 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
147610
147611 ----------------------------------------------------------------------------------
147612 -- 4219869 Business Flow
147613 -- Update journal entry status -- Need to generate this within IF <condition>
147614 ----------------------------------------------------------------------------------
147615 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
147616 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
147617 ,p_balance_type_code => l_balance_type_code
147618 );
147619
147620 -------------------------------------------------------------------------------------------
147621 -- 4262811 - Generate the Accrual Reversal lines
147622 -------------------------------------------------------------------------------------------
147623 BEGIN
147624 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
147625 (g_array_event(p_event_id).array_value_num('header_index'));
147626 IF l_acc_rev_flag IS NULL THEN
147627 l_acc_rev_flag := 'N';
147628 END IF;
147629 EXCEPTION
147630 WHEN OTHERS THEN
147631 l_acc_rev_flag := 'N';
147632 END;
147633 --
147634 IF (l_acc_rev_flag = 'Y') THEN
147635
147636 -- 4645092 ------------------------------------------------------------------------------
147637 -- To allow MPA report to determine if it should generate report process
147638 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
147639 ------------------------------------------------------------------------------------------
147640
147641 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
147642 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
147643 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
147644 -- call ADRs
147645 -- Bug 4922099
147646 --
147647 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
147648 (NVL(l_actual_upg_option, 'N') = 'O') OR
147649 (NVL(l_enc_upg_option, 'N') = 'O')
147650 )
147651 THEN
147652 NULL;
147653 --
147654 --
147655
147656 l_ccid := AcctDerRule_176(
147657 p_application_id => p_application_id
147658 , p_ae_header_id => l_ae_header_id
147659 , p_source_5 => p_source_5
147660 , p_source_31 => p_source_31
147661 , x_transaction_coa_id => l_adr_transaction_coa_id
147662 , x_accounting_coa_id => l_adr_accounting_coa_id
147666
147663 , x_value_type_code => l_adr_value_type_code
147664 , p_side => 'NA'
147665 );
147667 xla_ae_lines_pkg.set_ccid(
147668 p_code_combination_id => l_ccid
147669 , p_value_type_code => l_adr_value_type_code
147670 , p_transaction_coa_id => l_adr_transaction_coa_id
147671 , p_accounting_coa_id => l_adr_accounting_coa_id
147672 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
147673 , p_adr_type_code => 'S'
147674 , p_component_type => l_component_type
147675 , p_component_code => l_component_code
147676 , p_component_type_code => l_component_type_code
147677 , p_component_appl_id => l_component_appl_id
147678 , p_amb_context_code => l_amb_context_code
147679 , p_side => 'NA'
147680 );
147681
147682
147683 --
147684 --
147685 END IF;
147686
147687 --
147688 -- Update the line information that should be overwritten
147689 --
147690 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
147691 p_header_num => 1);
147692 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
147693
147694 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
147695
147696 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
147697 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
147698 END IF;
147699
147700 --
147701 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
147702 --
147703 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
147704 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
147705 ELSE
147706 ---------------------------------------------------------------------------------------------------
147707 -- 4262811a Switch Sign
147708 ---------------------------------------------------------------------------------------------------
147709 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
147710 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
147711 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
147712 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
147713 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
147714 -- 5132302
147715 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
147716 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
147717
147718 END IF;
147719
147720 -- 4955764
147721 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
147722 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
147723
147724
147725 XLA_AE_LINES_PKG.ValidateCurrentLine;
147726 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
147727
147728 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
147729 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
147730 ,p_balance_type_code => l_balance_type_code);
147731
147732 END IF;
147733
147734 -----------------------------------------------------------------------------------------
147735 -- 4262811 Multiperiod Accounting
147736 -----------------------------------------------------------------------------------------
147737 -- No MPA option is assigned.
147738
147739
147740 END IF;
147741 END IF;
147742 --
147743
147744 --
147745 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
147746 trace
147747 (p_msg => 'END of AcctLineType_371'
147748 ,p_level => C_LEVEL_PROCEDURE
147749 ,p_module => l_log_module);
147750 END IF;
147751 --
147752 EXCEPTION
147753 WHEN xla_exceptions_pkg.application_exception THEN
147754 RAISE;
147755 WHEN OTHERS THEN
147756 xla_exceptions_pkg.raise_message
147757 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_371');
147758 END AcctLineType_371;
147759 --
147760
147761 ---------------------------------------
147762 --
147763 -- PRIVATE FUNCTION
147764 -- AcctLineType_372
147765 --
147766 ---------------------------------------
147767 PROCEDURE AcctLineType_372 (
147768 p_application_id IN NUMBER
147769 ,p_event_id IN NUMBER
147770 ,p_calculate_acctd_flag IN VARCHAR2
147771 ,p_calculate_g_l_flag IN VARCHAR2
147772 ,p_actual_flag IN OUT VARCHAR2
147773 ,p_balance_type_code OUT VARCHAR2
147774 ,p_gain_or_loss_ref OUT VARCHAR2
147775
147776 --Period Close Date
147777 , p_source_1 IN DATE
147778 --Generated Code Combination Identifier
147779 , p_source_5 IN NUMBER
147780 --Depreciation Reserve Account
147781 , p_source_12 IN VARCHAR2
147782 --Generated Offset Code Combination Identifier
147783 , p_source_19 IN NUMBER
147787 , p_source_32 IN NUMBER
147784 --Expense Account Code Combination Identifier
147785 , p_source_31 IN NUMBER
147786 --Default Code Combination Identifier
147788 --Adjustment Type
147789 , p_source_48 IN VARCHAR2
147790 --Transaction Header Identifier
147791 , p_source_49 IN NUMBER
147792 --Adjustment Line Identifier
147793 , p_source_50 IN NUMBER
147794 --Distribution Type Code
147795 , p_source_51 IN VARCHAR2
147796 --Entered Amount
147797 , p_source_52 IN NUMBER
147798 --Currency Code
147799 , p_source_53 IN VARCHAR2
147800 --Source Destination Code
147801 , p_source_55 IN VARCHAR2
147802 )
147803 IS
147804
147805 l_component_type VARCHAR2(80);
147806 l_component_code VARCHAR2(30);
147807 l_component_type_code VARCHAR2(1);
147808 l_component_appl_id INTEGER;
147809 l_amb_context_code VARCHAR2(30);
147810 l_entity_code VARCHAR2(30);
147811 l_event_class_code VARCHAR2(30);
147812 l_ae_header_id NUMBER;
147813 l_event_type_code VARCHAR2(30);
147814 l_line_definition_code VARCHAR2(30);
147815 l_line_definition_owner_code VARCHAR2(1);
147816 --
147817 -- adr variables
147818 l_segment VARCHAR2(30);
147819 l_ccid NUMBER;
147820 l_adr_transaction_coa_id NUMBER;
147821 l_adr_accounting_coa_id NUMBER;
147822 l_adr_flexfield_segment_code VARCHAR2(30);
147823 l_adr_flex_value_set_id NUMBER;
147824 l_adr_value_type_code VARCHAR2(30);
147825 l_adr_value_combination_id NUMBER;
147826 l_adr_value_segment_code VARCHAR2(30);
147827
147828 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
147829 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
147830 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
147831 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
147832
147833 -- 4262811 Variables ------------------------------------------------------------------------------------------
147834 l_entered_amt_idx NUMBER;
147835 l_accted_amt_idx NUMBER;
147836 l_acc_rev_flag VARCHAR2(1);
147837 l_accrual_line_num NUMBER;
147838 l_tmp_amt NUMBER;
147839 l_acc_rev_natural_side_code VARCHAR2(1);
147840
147841 l_num_entries NUMBER;
147842 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
147843 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
147844 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
147845 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
147846 l_recog_line_1 NUMBER;
147847 l_recog_line_2 NUMBER;
147848
147849 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
147850 l_bflow_applied_to_amt NUMBER; -- 5132302
147851 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
147852
147853 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
147854
147855 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
147856 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
147857
147858 ---------------------------------------------------------------------------------------------------------------
147859
147860
147861 --
147862 -- bulk performance
147863 --
147864 l_balance_type_code VARCHAR2(1);
147865 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
147866 l_log_module VARCHAR2(240);
147867
147868 --
147869 -- Upgrade strategy
147870 --
147871 l_actual_upg_option VARCHAR2(1);
147872 l_enc_upg_option VARCHAR2(1);
147873
147874 --
147875 BEGIN
147876 --
147877 IF g_log_enabled THEN
147878 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_372';
147879 END IF;
147880 --
147881 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
147882
147883 trace
147884 (p_msg => 'BEGIN of AcctLineType_372'
147885 ,p_level => C_LEVEL_PROCEDURE
147886 ,p_module => l_log_module);
147887
147888 END IF;
147889 --
147890 l_component_type := 'AMB_JLT';
147891 l_component_code := 'FA_SLT_SOURCE_DEPRN_RESERVE';
147892 l_component_type_code := 'S';
147893 l_component_appl_id := 140;
147894 l_amb_context_code := 'DEFAULT';
147895 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
147896 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
147897 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
147898 l_line_definition_owner_code := 'S';
147899 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
147900 --
147901 l_balance_type_code := 'A';
147902 l_segment := NULL;
147903 l_ccid := NULL;
147904 l_adr_transaction_coa_id := NULL;
147905 l_adr_accounting_coa_id := NULL;
147906 l_adr_flexfield_segment_code := NULL;
147907 l_adr_flex_value_set_id := NULL;
147908 l_adr_value_type_code := NULL;
147909 l_adr_value_combination_id := NULL;
147910 l_adr_value_segment_code := NULL;
147911
147912 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
147913 l_bflow_class_code := ''; -- 4219869 Business Flow
147917 l_bflow_applied_to_amt_idx := NULL; -- 5132302
147914 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
147915 l_budgetary_control_flag := 'N';
147916
147918 l_bflow_applied_to_amt := NULL; -- 5132302
147919 l_entered_amt_idx := NULL; -- 4262811
147920 l_accted_amt_idx := NULL; -- 4262811
147921 l_acc_rev_flag := NULL; -- 4262811
147922 l_accrual_line_num := NULL; -- 4262811
147923 l_tmp_amt := NULL; -- 4262811
147924 --
147925
147926 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
147927 l_balance_type_code <> 'B' THEN
147928 IF (NVL(p_source_48,'
147929 ') = 'EXPENSE' OR
147930 NVL(p_source_48,'
147931 ') = 'RESERVE') AND
147932 NVL(p_source_55,'
147933 ') = 'SOURCE'
147934 THEN
147935
147936 --
147937 XLA_AE_LINES_PKG.SetNewLine;
147938
147939 p_balance_type_code := l_balance_type_code;
147940 -- set the flag so later we will know whether the gain loss line needs to be created
147941
147942 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
147943 p_actual_flag :='A';
147944 END IF;
147945
147946 --
147947 -- bulk performance
147948 --
147949 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
147950 p_header_num => 0); -- 4262811
147951 --
147952 -- set accounting line options
147953 --
147954 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
147955 p_natural_side_code => 'D'
147956 , p_gain_or_loss_flag => 'N'
147957 , p_gl_transfer_mode_code => 'S'
147958 , p_acct_entry_type_code => 'A'
147959 , p_switch_side_flag => 'Y'
147960 , p_merge_duplicate_code => 'N'
147961 );
147962 --
147963 l_acc_rev_natural_side_code := 'C'; -- 4262811
147964 --
147965 --
147966 -- set accounting line type info
147967 --
147968 xla_ae_lines_pkg.SetAcctLineType
147969 (p_component_type => l_component_type
147970 ,p_event_type_code => l_event_type_code
147971 ,p_line_definition_owner_code => l_line_definition_owner_code
147972 ,p_line_definition_code => l_line_definition_code
147973 ,p_accounting_line_code => l_component_code
147974 ,p_accounting_line_type_code => l_component_type_code
147975 ,p_accounting_line_appl_id => l_component_appl_id
147976 ,p_amb_context_code => l_amb_context_code
147977 ,p_entity_code => l_entity_code
147978 ,p_event_class_code => l_event_class_code);
147979 --
147980 -- set accounting class
147981 --
147982 xla_ae_lines_pkg.SetAcctClass(
147983 p_accounting_class_code => 'ASSET'
147984 , p_ae_header_id => l_ae_header_id
147985 );
147986
147987 --
147988 -- set rounding class
147989 --
147990 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
147991 'ASSET';
147992
147993 --
147994 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
147995 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
147996 --
147997 -- bulk performance
147998 --
147999 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
148000
148001 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
148002 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
148003
148004 -- 4955764
148005 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
148006 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
148007
148008 -- 4458381 Public Sector Enh
148009
148010 --
148011 -- set accounting attributes for the line type
148012 --
148013 l_entered_amt_idx := 4;
148014 l_accted_amt_idx := 6;
148015 l_bflow_applied_to_amt_idx := NULL; -- 5132302
148016 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
148017 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
148018 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
148019 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
148020 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
148021 l_rec_acct_attrs.array_char_value(3) := p_source_51;
148022 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
148023 l_rec_acct_attrs.array_num_value(4) := p_source_52;
148024 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
148025 l_rec_acct_attrs.array_char_value(5) := p_source_53;
148026 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
148027 l_rec_acct_attrs.array_num_value(6) := p_source_52;
148028
148029 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
148030 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
148031
148032 ---------------------------------------------------------------------------------------------------------------
148033 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
148037 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
148034 ---------------------------------------------------------------------------------------------------------------
148035 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
148036
148038 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
148039
148040 IF xla_accounting_cache_pkg.GetValueChar
148041 (p_source_code => 'LEDGER_CATEGORY_CODE'
148042 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
148043 AND l_bflow_method_code = 'PRIOR_ENTRY'
148044 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
148045 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
148046 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
148047 )
148048 THEN
148049 xla_ae_lines_pkg.BflowUpgEntry
148050 (p_business_method_code => l_bflow_method_code
148051 ,p_business_class_code => l_bflow_class_code
148052 ,p_balance_type => l_balance_type_code);
148053 ELSE
148054 NULL;
148055 -- No business flow processing for business flow method of NONE.
148056 END IF;
148057
148058 --
148059 -- call analytical criteria
148060 --
148061
148062 --
148063 -- call description
148064 --
148065
148066 xla_ae_lines_pkg.SetLineDescription(
148067 p_ae_header_id => l_ae_header_id
148068 ,p_description => Description_113 (
148069 p_application_id => p_application_id
148070 , p_ae_header_id => l_ae_header_id
148071 , p_source_1 => p_source_1
148072 )
148073 );
148074
148075
148076 --
148077 -- call ADRs
148078 -- Bug 4922099
148079 --
148080 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
148081 (NVL(l_actual_upg_option, 'N') = 'O') OR
148082 (NVL(l_enc_upg_option, 'N') = 'O')
148083 )
148084 THEN
148085 NULL;
148086 --
148087 --
148088
148089 l_ccid := AcctDerRule_175(
148090 p_application_id => p_application_id
148091 , p_ae_header_id => l_ae_header_id
148092 , p_source_5 => p_source_5
148093 , p_source_19 => p_source_19
148094 , p_source_32 => p_source_32
148095 , x_transaction_coa_id => l_adr_transaction_coa_id
148096 , x_accounting_coa_id => l_adr_accounting_coa_id
148097 , x_value_type_code => l_adr_value_type_code
148098 , p_side => 'NA'
148099 );
148100
148101 xla_ae_lines_pkg.set_ccid(
148102 p_code_combination_id => l_ccid
148103 , p_value_type_code => l_adr_value_type_code
148104 , p_transaction_coa_id => l_adr_transaction_coa_id
148105 , p_accounting_coa_id => l_adr_accounting_coa_id
148106 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
148107 , p_adr_type_code => 'S'
148108 , p_component_type => l_component_type
148109 , p_component_code => l_component_code
148110 , p_component_type_code => l_component_type_code
148111 , p_component_appl_id => l_component_appl_id
148112 , p_amb_context_code => l_amb_context_code
148113 , p_side => 'NA'
148114 );
148115
148116
148117 l_segment := AcctDerRule_150(
148118 p_application_id => p_application_id
148119 , p_ae_header_id => l_ae_header_id
148120 , p_source_5 => p_source_5
148121 , p_source_12 => p_source_12
148122 , x_transaction_coa_id => l_adr_transaction_coa_id
148123 , x_accounting_coa_id => l_adr_accounting_coa_id
148124 , x_flexfield_segment_code => l_adr_flexfield_segment_code
148125 , x_flex_value_set_id => l_adr_flex_value_set_id
148126 , x_value_type_code => l_adr_value_type_code
148127 , x_value_combination_id => l_adr_value_combination_id
148128 , x_value_segment_code => l_adr_value_segment_code
148129 , p_side => 'NA'
148130 , p_override_seg_flag => 'Y'
148131 );
148132
148133 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
148134
148135 xla_ae_lines_pkg.set_segment(
148136 p_to_segment_code => 'GL_ACCOUNT'
148137 , p_segment_value => l_segment
148138 , p_from_segment_code => l_adr_value_segment_code
148139 , p_from_combination_id => l_adr_value_combination_id
148140 , p_value_type_code => l_adr_value_type_code
148141 , p_transaction_coa_id => l_adr_transaction_coa_id
148142 , p_accounting_coa_id => l_adr_accounting_coa_id
148143 , p_flexfield_segment_code => l_adr_flexfield_segment_code
148144 , p_flex_value_set_id => l_adr_flex_value_set_id
148145 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
148146 , p_adr_type_code => 'S'
148147 , p_component_type => l_component_type
148148 , p_component_code => l_component_code
148149 , p_component_type_code => l_component_type_code
148150 , p_component_appl_id => l_component_appl_id
148151 , p_amb_context_code => l_amb_context_code
148155 );
148152 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
148153 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
148154 , p_side => 'NA'
148156
148157 END IF;
148158
148159 l_segment := AcctDerRule_169(
148160 p_application_id => p_application_id
148161 , p_ae_header_id => l_ae_header_id
148162 , p_source_5 => p_source_5
148163 , p_source_31 => p_source_31
148164 , x_transaction_coa_id => l_adr_transaction_coa_id
148165 , x_accounting_coa_id => l_adr_accounting_coa_id
148166 , x_flexfield_segment_code => l_adr_flexfield_segment_code
148167 , x_flex_value_set_id => l_adr_flex_value_set_id
148168 , x_value_type_code => l_adr_value_type_code
148169 , x_value_combination_id => l_adr_value_combination_id
148170 , x_value_segment_code => l_adr_value_segment_code
148171 , p_side => 'NA'
148172 , p_override_seg_flag => 'Y'
148173 );
148174
148175 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
148176
148177 xla_ae_lines_pkg.set_segment(
148178 p_to_segment_code => 'GL_BALANCING'
148179 , p_segment_value => l_segment
148180 , p_from_segment_code => l_adr_value_segment_code
148181 , p_from_combination_id => l_adr_value_combination_id
148182 , p_value_type_code => l_adr_value_type_code
148183 , p_transaction_coa_id => l_adr_transaction_coa_id
148184 , p_accounting_coa_id => l_adr_accounting_coa_id
148185 , p_flexfield_segment_code => l_adr_flexfield_segment_code
148186 , p_flex_value_set_id => l_adr_flex_value_set_id
148187 , p_adr_code => 'FA_EXPENSE_ACCT'
148188 , p_adr_type_code => 'S'
148189 , p_component_type => l_component_type
148190 , p_component_code => l_component_code
148191 , p_component_type_code => l_component_type_code
148192 , p_component_appl_id => l_component_appl_id
148193 , p_amb_context_code => l_amb_context_code
148194 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
148195 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
148196 , p_side => 'NA'
148197 );
148198
148199 END IF;
148200
148201 --
148202 --
148203 END IF;
148204 --
148205 -- Bug 4922099
148206 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
148207 (NVL(l_enc_upg_option, 'N') = 'O')
148208 ) AND
148209 (l_bflow_method_code = 'PRIOR_ENTRY')
148210 )
148211 THEN
148212 IF
148213 --
148214 1 = 2
148215 --
148216 THEN
148217 xla_accounting_err_pkg.build_message
148218 (p_appli_s_name => 'XLA'
148219 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
148220 ,p_token_1 => 'LINE_NUMBER'
148221 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
148222 ,p_token_2 => 'LINE_TYPE_NAME'
148223 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
148224 l_component_type
148225 ,l_component_code
148226 ,l_component_type_code
148227 ,l_component_appl_id
148228 ,l_amb_context_code
148229 ,l_entity_code
148230 ,l_event_class_code
148231 )
148232 ,p_token_3 => 'OWNER'
148233 ,p_value_3 => xla_lookups_pkg.get_meaning(
148234 p_lookup_type => 'XLA_OWNER_TYPE'
148235 ,p_lookup_code => l_component_type_code
148236 )
148237 ,p_token_4 => 'PRODUCT_NAME'
148238 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
148239 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
148240 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
148241 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
148242 ,p_ae_header_id => NULL
148243 );
148244
148245 IF (C_LEVEL_ERROR>= g_log_level) THEN
148246 trace
148247 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
148248 ,p_level => C_LEVEL_ERROR
148249 ,p_module => l_log_module);
148253 --
148250 END IF;
148251 END IF;
148252 END IF;
148254 --
148255 ------------------------------------------------------------------------------------------------
148256 -- 4219869 Business Flow
148257 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
148258 -- Prior Entry. Currently, the following code is always generated.
148259 ------------------------------------------------------------------------------------------------
148260 XLA_AE_LINES_PKG.ValidateCurrentLine;
148261
148262 ------------------------------------------------------------------------------------
148263 -- 4219869 Business Flow
148264 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
148265 ------------------------------------------------------------------------------------
148266 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
148267
148268 ----------------------------------------------------------------------------------
148269 -- 4219869 Business Flow
148270 -- Update journal entry status -- Need to generate this within IF <condition>
148271 ----------------------------------------------------------------------------------
148272 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
148273 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
148274 ,p_balance_type_code => l_balance_type_code
148275 );
148276
148277 -------------------------------------------------------------------------------------------
148278 -- 4262811 - Generate the Accrual Reversal lines
148279 -------------------------------------------------------------------------------------------
148280 BEGIN
148281 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
148282 (g_array_event(p_event_id).array_value_num('header_index'));
148283 IF l_acc_rev_flag IS NULL THEN
148284 l_acc_rev_flag := 'N';
148285 END IF;
148286 EXCEPTION
148287 WHEN OTHERS THEN
148288 l_acc_rev_flag := 'N';
148289 END;
148290 --
148291 IF (l_acc_rev_flag = 'Y') THEN
148292
148293 -- 4645092 ------------------------------------------------------------------------------
148294 -- To allow MPA report to determine if it should generate report process
148295 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
148296 ------------------------------------------------------------------------------------------
148297
148298 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
148299 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
148300 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
148301 -- call ADRs
148302 -- Bug 4922099
148303 --
148304 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
148305 (NVL(l_actual_upg_option, 'N') = 'O') OR
148306 (NVL(l_enc_upg_option, 'N') = 'O')
148307 )
148308 THEN
148309 NULL;
148310 --
148311 --
148312
148313 l_ccid := AcctDerRule_175(
148314 p_application_id => p_application_id
148315 , p_ae_header_id => l_ae_header_id
148316 , p_source_5 => p_source_5
148317 , p_source_19 => p_source_19
148318 , p_source_32 => p_source_32
148319 , x_transaction_coa_id => l_adr_transaction_coa_id
148320 , x_accounting_coa_id => l_adr_accounting_coa_id
148321 , x_value_type_code => l_adr_value_type_code
148322 , p_side => 'NA'
148323 );
148324
148325 xla_ae_lines_pkg.set_ccid(
148326 p_code_combination_id => l_ccid
148327 , p_value_type_code => l_adr_value_type_code
148328 , p_transaction_coa_id => l_adr_transaction_coa_id
148329 , p_accounting_coa_id => l_adr_accounting_coa_id
148330 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
148331 , p_adr_type_code => 'S'
148332 , p_component_type => l_component_type
148333 , p_component_code => l_component_code
148334 , p_component_type_code => l_component_type_code
148335 , p_component_appl_id => l_component_appl_id
148336 , p_amb_context_code => l_amb_context_code
148337 , p_side => 'NA'
148338 );
148339
148340
148341 l_segment := AcctDerRule_150(
148342 p_application_id => p_application_id
148343 , p_ae_header_id => l_ae_header_id
148344 , p_source_5 => p_source_5
148345 , p_source_12 => p_source_12
148346 , x_transaction_coa_id => l_adr_transaction_coa_id
148347 , x_accounting_coa_id => l_adr_accounting_coa_id
148348 , x_flexfield_segment_code => l_adr_flexfield_segment_code
148349 , x_flex_value_set_id => l_adr_flex_value_set_id
148350 , x_value_type_code => l_adr_value_type_code
148351 , x_value_combination_id => l_adr_value_combination_id
148352 , x_value_segment_code => l_adr_value_segment_code
148353 , p_side => 'NA'
148354 , p_override_seg_flag => 'Y'
148355 );
148356
148357 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
148358
148359 xla_ae_lines_pkg.set_segment(
148360 p_to_segment_code => 'GL_ACCOUNT'
148361 , p_segment_value => l_segment
148362 , p_from_segment_code => l_adr_value_segment_code
148363 , p_from_combination_id => l_adr_value_combination_id
148364 , p_value_type_code => l_adr_value_type_code
148368 , p_flex_value_set_id => l_adr_flex_value_set_id
148365 , p_transaction_coa_id => l_adr_transaction_coa_id
148366 , p_accounting_coa_id => l_adr_accounting_coa_id
148367 , p_flexfield_segment_code => l_adr_flexfield_segment_code
148369 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
148370 , p_adr_type_code => 'S'
148371 , p_component_type => l_component_type
148372 , p_component_code => l_component_code
148373 , p_component_type_code => l_component_type_code
148374 , p_component_appl_id => l_component_appl_id
148375 , p_amb_context_code => l_amb_context_code
148376 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
148377 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
148378 , p_side => 'NA'
148379 );
148380
148381 END IF;
148382
148383 l_segment := AcctDerRule_169(
148384 p_application_id => p_application_id
148385 , p_ae_header_id => l_ae_header_id
148386 , p_source_5 => p_source_5
148387 , p_source_31 => p_source_31
148388 , x_transaction_coa_id => l_adr_transaction_coa_id
148389 , x_accounting_coa_id => l_adr_accounting_coa_id
148390 , x_flexfield_segment_code => l_adr_flexfield_segment_code
148391 , x_flex_value_set_id => l_adr_flex_value_set_id
148392 , x_value_type_code => l_adr_value_type_code
148393 , x_value_combination_id => l_adr_value_combination_id
148394 , x_value_segment_code => l_adr_value_segment_code
148395 , p_side => 'NA'
148396 , p_override_seg_flag => 'Y'
148397 );
148398
148399 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
148400
148401 xla_ae_lines_pkg.set_segment(
148402 p_to_segment_code => 'GL_BALANCING'
148403 , p_segment_value => l_segment
148404 , p_from_segment_code => l_adr_value_segment_code
148405 , p_from_combination_id => l_adr_value_combination_id
148406 , p_value_type_code => l_adr_value_type_code
148407 , p_transaction_coa_id => l_adr_transaction_coa_id
148408 , p_accounting_coa_id => l_adr_accounting_coa_id
148409 , p_flexfield_segment_code => l_adr_flexfield_segment_code
148410 , p_flex_value_set_id => l_adr_flex_value_set_id
148411 , p_adr_code => 'FA_EXPENSE_ACCT'
148412 , p_adr_type_code => 'S'
148413 , p_component_type => l_component_type
148414 , p_component_code => l_component_code
148415 , p_component_type_code => l_component_type_code
148416 , p_component_appl_id => l_component_appl_id
148417 , p_amb_context_code => l_amb_context_code
148418 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
148419 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
148420 , p_side => 'NA'
148421 );
148422
148423 END IF;
148424
148425 --
148426 --
148427 END IF;
148428
148429 --
148430 -- Update the line information that should be overwritten
148431 --
148432 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
148433 p_header_num => 1);
148434 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
148435
148436 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
148437
148438 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
148439 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
148440 END IF;
148441
148442 --
148443 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
148444 --
148445 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
148446 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
148447 ELSE
148448 ---------------------------------------------------------------------------------------------------
148449 -- 4262811a Switch Sign
148450 ---------------------------------------------------------------------------------------------------
148451 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
148452 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
148453 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
148454 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
148455 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
148456 -- 5132302
148457 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
148458 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
148459
148460 END IF;
148461
148462 -- 4955764
148463 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
148464 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
148465
148466
148467 XLA_AE_LINES_PKG.ValidateCurrentLine;
148471 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
148468 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
148469
148470 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
148472 ,p_balance_type_code => l_balance_type_code);
148473
148474 END IF;
148475
148476 -----------------------------------------------------------------------------------------
148477 -- 4262811 Multiperiod Accounting
148478 -----------------------------------------------------------------------------------------
148479 -- No MPA option is assigned.
148480
148481
148482 END IF;
148483 END IF;
148484 --
148485
148486 --
148487 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
148488 trace
148489 (p_msg => 'END of AcctLineType_372'
148490 ,p_level => C_LEVEL_PROCEDURE
148491 ,p_module => l_log_module);
148492 END IF;
148493 --
148494 EXCEPTION
148495 WHEN xla_exceptions_pkg.application_exception THEN
148496 RAISE;
148497 WHEN OTHERS THEN
148498 xla_exceptions_pkg.raise_message
148499 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_372');
148500 END AcctLineType_372;
148501 --
148502
148503 ---------------------------------------
148504 --
148505 -- PRIVATE FUNCTION
148506 -- AcctLineType_373
148507 --
148508 ---------------------------------------
148509 PROCEDURE AcctLineType_373 (
148510 p_application_id IN NUMBER
148511 ,p_event_id IN NUMBER
148512 ,p_calculate_acctd_flag IN VARCHAR2
148513 ,p_calculate_g_l_flag IN VARCHAR2
148514 ,p_actual_flag IN OUT VARCHAR2
148515 ,p_balance_type_code OUT VARCHAR2
148516 ,p_gain_or_loss_ref OUT VARCHAR2
148517
148518 --Period Close Date
148519 , p_source_1 IN DATE
148520 --Generated Code Combination Identifier
148521 , p_source_5 IN NUMBER
148522 --Expense Account Code Combination Identifier
148523 , p_source_31 IN NUMBER
148524 --Adjustment Type
148525 , p_source_48 IN VARCHAR2
148526 --Transaction Header Identifier
148527 , p_source_49 IN NUMBER
148528 --Adjustment Line Identifier
148529 , p_source_50 IN NUMBER
148530 --Distribution Type Code
148531 , p_source_51 IN VARCHAR2
148532 --Entered Amount
148533 , p_source_52 IN NUMBER
148534 --Currency Code
148535 , p_source_53 IN VARCHAR2
148536 --Source Destination Code
148537 , p_source_55 IN VARCHAR2
148538 )
148539 IS
148540
148541 l_component_type VARCHAR2(80);
148542 l_component_code VARCHAR2(30);
148543 l_component_type_code VARCHAR2(1);
148544 l_component_appl_id INTEGER;
148545 l_amb_context_code VARCHAR2(30);
148546 l_entity_code VARCHAR2(30);
148547 l_event_class_code VARCHAR2(30);
148548 l_ae_header_id NUMBER;
148549 l_event_type_code VARCHAR2(30);
148550 l_line_definition_code VARCHAR2(30);
148551 l_line_definition_owner_code VARCHAR2(1);
148552 --
148553 -- adr variables
148554 l_segment VARCHAR2(30);
148555 l_ccid NUMBER;
148556 l_adr_transaction_coa_id NUMBER;
148557 l_adr_accounting_coa_id NUMBER;
148558 l_adr_flexfield_segment_code VARCHAR2(30);
148559 l_adr_flex_value_set_id NUMBER;
148560 l_adr_value_type_code VARCHAR2(30);
148561 l_adr_value_combination_id NUMBER;
148562 l_adr_value_segment_code VARCHAR2(30);
148563
148564 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
148565 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
148566 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
148567 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
148568
148569 -- 4262811 Variables ------------------------------------------------------------------------------------------
148570 l_entered_amt_idx NUMBER;
148571 l_accted_amt_idx NUMBER;
148572 l_acc_rev_flag VARCHAR2(1);
148573 l_accrual_line_num NUMBER;
148574 l_tmp_amt NUMBER;
148575 l_acc_rev_natural_side_code VARCHAR2(1);
148576
148577 l_num_entries NUMBER;
148578 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
148579 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
148580 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
148581 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
148582 l_recog_line_1 NUMBER;
148583 l_recog_line_2 NUMBER;
148584
148585 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
148586 l_bflow_applied_to_amt NUMBER; -- 5132302
148587 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
148588
148589 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
148590
148591 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
148592 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
148593
148594 ---------------------------------------------------------------------------------------------------------------
148595
148596
148597 --
148598 -- bulk performance
148599 --
148600 l_balance_type_code VARCHAR2(1);
148604 --
148601 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
148602 l_log_module VARCHAR2(240);
148603
148605 -- Upgrade strategy
148606 --
148607 l_actual_upg_option VARCHAR2(1);
148608 l_enc_upg_option VARCHAR2(1);
148609
148610 --
148611 BEGIN
148612 --
148613 IF g_log_enabled THEN
148614 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_373';
148615 END IF;
148616 --
148617 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
148618
148619 trace
148620 (p_msg => 'BEGIN of AcctLineType_373'
148621 ,p_level => C_LEVEL_PROCEDURE
148622 ,p_module => l_log_module);
148623
148624 END IF;
148625 --
148626 l_component_type := 'AMB_JLT';
148627 l_component_code := 'FA_SLT_SOURCE_EXP_BAL';
148628 l_component_type_code := 'S';
148629 l_component_appl_id := 140;
148630 l_amb_context_code := 'DEFAULT';
148631 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
148632 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
148633 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
148634 l_line_definition_owner_code := 'S';
148635 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
148636 --
148637 l_balance_type_code := 'A';
148638 l_segment := NULL;
148639 l_ccid := NULL;
148640 l_adr_transaction_coa_id := NULL;
148641 l_adr_accounting_coa_id := NULL;
148642 l_adr_flexfield_segment_code := NULL;
148643 l_adr_flex_value_set_id := NULL;
148644 l_adr_value_type_code := NULL;
148645 l_adr_value_combination_id := NULL;
148646 l_adr_value_segment_code := NULL;
148647
148648 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
148649 l_bflow_class_code := ''; -- 4219869 Business Flow
148650 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
148651 l_budgetary_control_flag := 'N';
148652
148653 l_bflow_applied_to_amt_idx := NULL; -- 5132302
148654 l_bflow_applied_to_amt := NULL; -- 5132302
148655 l_entered_amt_idx := NULL; -- 4262811
148656 l_accted_amt_idx := NULL; -- 4262811
148657 l_acc_rev_flag := NULL; -- 4262811
148658 l_accrual_line_num := NULL; -- 4262811
148659 l_tmp_amt := NULL; -- 4262811
148660 --
148661
148662 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
148663 l_balance_type_code <> 'B' THEN
148664 IF NVL(p_source_48,'
148665 ') = 'BONUS EXPENSE' AND
148666 NVL(p_source_55,'
148667 ') = 'SOURCE'
148668 THEN
148669
148670 --
148671 XLA_AE_LINES_PKG.SetNewLine;
148672
148673 p_balance_type_code := l_balance_type_code;
148674 -- set the flag so later we will know whether the gain loss line needs to be created
148675
148676 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
148677 p_actual_flag :='A';
148678 END IF;
148679
148680 --
148681 -- bulk performance
148682 --
148683 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
148684 p_header_num => 0); -- 4262811
148685 --
148686 -- set accounting line options
148687 --
148688 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
148689 p_natural_side_code => 'D'
148690 , p_gain_or_loss_flag => 'N'
148691 , p_gl_transfer_mode_code => 'S'
148692 , p_acct_entry_type_code => 'A'
148693 , p_switch_side_flag => 'Y'
148694 , p_merge_duplicate_code => 'N'
148695 );
148696 --
148697 l_acc_rev_natural_side_code := 'C'; -- 4262811
148698 --
148699 --
148700 -- set accounting line type info
148701 --
148702 xla_ae_lines_pkg.SetAcctLineType
148703 (p_component_type => l_component_type
148704 ,p_event_type_code => l_event_type_code
148705 ,p_line_definition_owner_code => l_line_definition_owner_code
148706 ,p_line_definition_code => l_line_definition_code
148707 ,p_accounting_line_code => l_component_code
148708 ,p_accounting_line_type_code => l_component_type_code
148709 ,p_accounting_line_appl_id => l_component_appl_id
148710 ,p_amb_context_code => l_amb_context_code
148711 ,p_entity_code => l_entity_code
148712 ,p_event_class_code => l_event_class_code);
148713 --
148714 -- set accounting class
148715 --
148716 xla_ae_lines_pkg.SetAcctClass(
148717 p_accounting_class_code => 'EXPENSE'
148718 , p_ae_header_id => l_ae_header_id
148719 );
148720
148721 --
148722 -- set rounding class
148723 --
148724 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
148725 'EXPENSE';
148726
148727 --
148728 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
148729 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
148730 --
148731 -- bulk performance
148732 --
148736 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
148733 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
148734
148735 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
148737
148738 -- 4955764
148739 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
148740 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
148741
148742 -- 4458381 Public Sector Enh
148743
148744 --
148745 -- set accounting attributes for the line type
148746 --
148747 l_entered_amt_idx := 4;
148748 l_accted_amt_idx := 6;
148749 l_bflow_applied_to_amt_idx := NULL; -- 5132302
148750 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
148751 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
148752 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
148753 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
148754 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
148755 l_rec_acct_attrs.array_char_value(3) := p_source_51;
148756 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
148757 l_rec_acct_attrs.array_num_value(4) := p_source_52;
148758 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
148759 l_rec_acct_attrs.array_char_value(5) := p_source_53;
148760 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
148761 l_rec_acct_attrs.array_num_value(6) := p_source_52;
148762
148763 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
148764 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
148765
148766 ---------------------------------------------------------------------------------------------------------------
148767 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
148768 ---------------------------------------------------------------------------------------------------------------
148769 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
148770
148771 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
148772 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
148773
148774 IF xla_accounting_cache_pkg.GetValueChar
148775 (p_source_code => 'LEDGER_CATEGORY_CODE'
148776 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
148777 AND l_bflow_method_code = 'PRIOR_ENTRY'
148778 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
148779 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
148780 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
148781 )
148782 THEN
148783 xla_ae_lines_pkg.BflowUpgEntry
148784 (p_business_method_code => l_bflow_method_code
148785 ,p_business_class_code => l_bflow_class_code
148786 ,p_balance_type => l_balance_type_code);
148787 ELSE
148788 NULL;
148789 -- No business flow processing for business flow method of NONE.
148790 END IF;
148791
148792 --
148793 -- call analytical criteria
148794 --
148795
148796 --
148797 -- call description
148798 --
148799
148800 xla_ae_lines_pkg.SetLineDescription(
148801 p_ae_header_id => l_ae_header_id
148802 ,p_description => Description_112 (
148803 p_application_id => p_application_id
148804 , p_ae_header_id => l_ae_header_id
148805 , p_source_1 => p_source_1
148806 )
148807 );
148808
148809
148810 --
148811 -- call ADRs
148812 -- Bug 4922099
148813 --
148814 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
148815 (NVL(l_actual_upg_option, 'N') = 'O') OR
148816 (NVL(l_enc_upg_option, 'N') = 'O')
148817 )
148818 THEN
148819 NULL;
148820 --
148821 --
148822
148823 l_ccid := AcctDerRule_176(
148824 p_application_id => p_application_id
148825 , p_ae_header_id => l_ae_header_id
148826 , p_source_5 => p_source_5
148827 , p_source_31 => p_source_31
148828 , x_transaction_coa_id => l_adr_transaction_coa_id
148829 , x_accounting_coa_id => l_adr_accounting_coa_id
148830 , x_value_type_code => l_adr_value_type_code
148831 , p_side => 'NA'
148832 );
148833
148834 xla_ae_lines_pkg.set_ccid(
148835 p_code_combination_id => l_ccid
148836 , p_value_type_code => l_adr_value_type_code
148837 , p_transaction_coa_id => l_adr_transaction_coa_id
148838 , p_accounting_coa_id => l_adr_accounting_coa_id
148839 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
148840 , p_adr_type_code => 'S'
148841 , p_component_type => l_component_type
148842 , p_component_code => l_component_code
148843 , p_component_type_code => l_component_type_code
148844 , p_component_appl_id => l_component_appl_id
148845 , p_amb_context_code => l_amb_context_code
148846 , p_side => 'NA'
148847 );
148848
148849
148850 --
148851 --
148852 END IF;
148853 --
148857 ) AND
148854 -- Bug 4922099
148855 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
148856 (NVL(l_enc_upg_option, 'N') = 'O')
148858 (l_bflow_method_code = 'PRIOR_ENTRY')
148859 )
148860 THEN
148861 IF
148862 --
148863 1 = 2
148864 --
148865 THEN
148866 xla_accounting_err_pkg.build_message
148867 (p_appli_s_name => 'XLA'
148868 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
148869 ,p_token_1 => 'LINE_NUMBER'
148870 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
148871 ,p_token_2 => 'LINE_TYPE_NAME'
148872 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
148873 l_component_type
148874 ,l_component_code
148875 ,l_component_type_code
148876 ,l_component_appl_id
148877 ,l_amb_context_code
148878 ,l_entity_code
148879 ,l_event_class_code
148880 )
148881 ,p_token_3 => 'OWNER'
148882 ,p_value_3 => xla_lookups_pkg.get_meaning(
148883 p_lookup_type => 'XLA_OWNER_TYPE'
148884 ,p_lookup_code => l_component_type_code
148885 )
148886 ,p_token_4 => 'PRODUCT_NAME'
148887 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
148888 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
148889 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
148890 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
148891 ,p_ae_header_id => NULL
148892 );
148893
148894 IF (C_LEVEL_ERROR>= g_log_level) THEN
148895 trace
148896 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
148897 ,p_level => C_LEVEL_ERROR
148898 ,p_module => l_log_module);
148899 END IF;
148900 END IF;
148901 END IF;
148902 --
148903 --
148904 ------------------------------------------------------------------------------------------------
148905 -- 4219869 Business Flow
148906 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
148907 -- Prior Entry. Currently, the following code is always generated.
148908 ------------------------------------------------------------------------------------------------
148909 XLA_AE_LINES_PKG.ValidateCurrentLine;
148910
148911 ------------------------------------------------------------------------------------
148912 -- 4219869 Business Flow
148913 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
148914 ------------------------------------------------------------------------------------
148915 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
148916
148917 ----------------------------------------------------------------------------------
148918 -- 4219869 Business Flow
148919 -- Update journal entry status -- Need to generate this within IF <condition>
148920 ----------------------------------------------------------------------------------
148921 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
148922 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
148923 ,p_balance_type_code => l_balance_type_code
148924 );
148925
148926 -------------------------------------------------------------------------------------------
148927 -- 4262811 - Generate the Accrual Reversal lines
148928 -------------------------------------------------------------------------------------------
148929 BEGIN
148930 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
148931 (g_array_event(p_event_id).array_value_num('header_index'));
148932 IF l_acc_rev_flag IS NULL THEN
148933 l_acc_rev_flag := 'N';
148934 END IF;
148935 EXCEPTION
148936 WHEN OTHERS THEN
148937 l_acc_rev_flag := 'N';
148938 END;
148939 --
148940 IF (l_acc_rev_flag = 'Y') THEN
148941
148942 -- 4645092 ------------------------------------------------------------------------------
148943 -- To allow MPA report to determine if it should generate report process
148944 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
148945 ------------------------------------------------------------------------------------------
148946
148947 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
148948 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
148952 --
148949 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
148950 -- call ADRs
148951 -- Bug 4922099
148953 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
148954 (NVL(l_actual_upg_option, 'N') = 'O') OR
148955 (NVL(l_enc_upg_option, 'N') = 'O')
148956 )
148957 THEN
148958 NULL;
148959 --
148960 --
148961
148962 l_ccid := AcctDerRule_176(
148963 p_application_id => p_application_id
148964 , p_ae_header_id => l_ae_header_id
148965 , p_source_5 => p_source_5
148966 , p_source_31 => p_source_31
148967 , x_transaction_coa_id => l_adr_transaction_coa_id
148968 , x_accounting_coa_id => l_adr_accounting_coa_id
148969 , x_value_type_code => l_adr_value_type_code
148970 , p_side => 'NA'
148971 );
148972
148973 xla_ae_lines_pkg.set_ccid(
148974 p_code_combination_id => l_ccid
148975 , p_value_type_code => l_adr_value_type_code
148976 , p_transaction_coa_id => l_adr_transaction_coa_id
148977 , p_accounting_coa_id => l_adr_accounting_coa_id
148978 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
148979 , p_adr_type_code => 'S'
148980 , p_component_type => l_component_type
148981 , p_component_code => l_component_code
148982 , p_component_type_code => l_component_type_code
148983 , p_component_appl_id => l_component_appl_id
148984 , p_amb_context_code => l_amb_context_code
148985 , p_side => 'NA'
148986 );
148987
148988
148989 --
148990 --
148991 END IF;
148992
148993 --
148994 -- Update the line information that should be overwritten
148995 --
148996 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
148997 p_header_num => 1);
148998 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
148999
149000 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
149001
149002 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
149003 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
149004 END IF;
149005
149006 --
149007 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
149008 --
149009 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
149010 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
149011 ELSE
149012 ---------------------------------------------------------------------------------------------------
149013 -- 4262811a Switch Sign
149014 ---------------------------------------------------------------------------------------------------
149015 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
149016 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
149017 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
149018 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
149019 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
149020 -- 5132302
149021 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
149022 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
149023
149024 END IF;
149025
149026 -- 4955764
149027 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
149028 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
149029
149030
149031 XLA_AE_LINES_PKG.ValidateCurrentLine;
149032 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
149033
149034 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
149035 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
149036 ,p_balance_type_code => l_balance_type_code);
149037
149038 END IF;
149039
149040 -----------------------------------------------------------------------------------------
149041 -- 4262811 Multiperiod Accounting
149042 -----------------------------------------------------------------------------------------
149043 -- No MPA option is assigned.
149044
149045
149046 END IF;
149047 END IF;
149048 --
149049
149050 --
149051 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
149052 trace
149053 (p_msg => 'END of AcctLineType_373'
149054 ,p_level => C_LEVEL_PROCEDURE
149055 ,p_module => l_log_module);
149056 END IF;
149057 --
149058 EXCEPTION
149059 WHEN xla_exceptions_pkg.application_exception THEN
149060 RAISE;
149061 WHEN OTHERS THEN
149062 xla_exceptions_pkg.raise_message
149063 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_373');
149064 END AcctLineType_373;
149065 --
149066
149067 ---------------------------------------
149068 --
149069 -- PRIVATE FUNCTION
149070 -- AcctLineType_374
149071 --
149075 ,p_event_id IN NUMBER
149072 ---------------------------------------
149073 PROCEDURE AcctLineType_374 (
149074 p_application_id IN NUMBER
149076 ,p_calculate_acctd_flag IN VARCHAR2
149077 ,p_calculate_g_l_flag IN VARCHAR2
149078 ,p_actual_flag IN OUT VARCHAR2
149079 ,p_balance_type_code OUT VARCHAR2
149080 ,p_gain_or_loss_ref OUT VARCHAR2
149081
149082 --Period Close Date
149083 , p_source_1 IN DATE
149084 --Generated Code Combination Identifier
149085 , p_source_5 IN NUMBER
149086 --Depreciation Reserve Account
149087 , p_source_12 IN VARCHAR2
149088 --Generated Offset Code Combination Identifier
149089 , p_source_19 IN NUMBER
149090 --Expense Account Code Combination Identifier
149091 , p_source_31 IN NUMBER
149092 --Default Code Combination Identifier
149093 , p_source_32 IN NUMBER
149094 --Adjustment Type
149095 , p_source_48 IN VARCHAR2
149096 --Transaction Header Identifier
149097 , p_source_49 IN NUMBER
149098 --Adjustment Line Identifier
149099 , p_source_50 IN NUMBER
149100 --Distribution Type Code
149101 , p_source_51 IN VARCHAR2
149102 --Entered Amount
149103 , p_source_52 IN NUMBER
149104 --Currency Code
149105 , p_source_53 IN VARCHAR2
149106 --Source Destination Code
149107 , p_source_55 IN VARCHAR2
149108 )
149109 IS
149110
149111 l_component_type VARCHAR2(80);
149112 l_component_code VARCHAR2(30);
149113 l_component_type_code VARCHAR2(1);
149114 l_component_appl_id INTEGER;
149115 l_amb_context_code VARCHAR2(30);
149116 l_entity_code VARCHAR2(30);
149117 l_event_class_code VARCHAR2(30);
149118 l_ae_header_id NUMBER;
149119 l_event_type_code VARCHAR2(30);
149120 l_line_definition_code VARCHAR2(30);
149121 l_line_definition_owner_code VARCHAR2(1);
149122 --
149123 -- adr variables
149124 l_segment VARCHAR2(30);
149125 l_ccid NUMBER;
149126 l_adr_transaction_coa_id NUMBER;
149127 l_adr_accounting_coa_id NUMBER;
149128 l_adr_flexfield_segment_code VARCHAR2(30);
149129 l_adr_flex_value_set_id NUMBER;
149130 l_adr_value_type_code VARCHAR2(30);
149131 l_adr_value_combination_id NUMBER;
149132 l_adr_value_segment_code VARCHAR2(30);
149133
149134 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
149135 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
149136 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
149137 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
149138
149139 -- 4262811 Variables ------------------------------------------------------------------------------------------
149140 l_entered_amt_idx NUMBER;
149141 l_accted_amt_idx NUMBER;
149142 l_acc_rev_flag VARCHAR2(1);
149143 l_accrual_line_num NUMBER;
149144 l_tmp_amt NUMBER;
149145 l_acc_rev_natural_side_code VARCHAR2(1);
149146
149147 l_num_entries NUMBER;
149148 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
149149 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
149150 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
149151 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
149152 l_recog_line_1 NUMBER;
149153 l_recog_line_2 NUMBER;
149154
149155 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
149156 l_bflow_applied_to_amt NUMBER; -- 5132302
149157 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
149158
149159 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
149160
149161 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
149162 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
149163
149164 ---------------------------------------------------------------------------------------------------------------
149165
149166
149167 --
149168 -- bulk performance
149169 --
149170 l_balance_type_code VARCHAR2(1);
149171 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
149172 l_log_module VARCHAR2(240);
149173
149174 --
149175 -- Upgrade strategy
149176 --
149177 l_actual_upg_option VARCHAR2(1);
149178 l_enc_upg_option VARCHAR2(1);
149179
149180 --
149181 BEGIN
149182 --
149183 IF g_log_enabled THEN
149184 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_374';
149185 END IF;
149186 --
149187 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
149188
149189 trace
149190 (p_msg => 'BEGIN of AcctLineType_374'
149191 ,p_level => C_LEVEL_PROCEDURE
149192 ,p_module => l_log_module);
149193
149194 END IF;
149195 --
149196 l_component_type := 'AMB_JLT';
149197 l_component_code := 'FA_SLT_SOURCE_RESERVE_BAL';
149198 l_component_type_code := 'S';
149199 l_component_appl_id := 140;
149200 l_amb_context_code := 'DEFAULT';
149201 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
149202 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
149206 --
149203 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
149204 l_line_definition_owner_code := 'S';
149205 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
149207 l_balance_type_code := 'A';
149208 l_segment := NULL;
149209 l_ccid := NULL;
149210 l_adr_transaction_coa_id := NULL;
149211 l_adr_accounting_coa_id := NULL;
149212 l_adr_flexfield_segment_code := NULL;
149213 l_adr_flex_value_set_id := NULL;
149214 l_adr_value_type_code := NULL;
149215 l_adr_value_combination_id := NULL;
149216 l_adr_value_segment_code := NULL;
149217
149218 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
149219 l_bflow_class_code := ''; -- 4219869 Business Flow
149220 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
149221 l_budgetary_control_flag := 'N';
149222
149223 l_bflow_applied_to_amt_idx := NULL; -- 5132302
149224 l_bflow_applied_to_amt := NULL; -- 5132302
149225 l_entered_amt_idx := NULL; -- 4262811
149226 l_accted_amt_idx := NULL; -- 4262811
149227 l_acc_rev_flag := NULL; -- 4262811
149228 l_accrual_line_num := NULL; -- 4262811
149229 l_tmp_amt := NULL; -- 4262811
149230 --
149231
149232 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
149233 l_balance_type_code <> 'B' THEN
149234 IF (NVL(p_source_48,'
149235 ') = 'BONUS EXPENSE' OR
149236 NVL(p_source_48,'
149237 ') = 'BONUS RESERVE') AND
149238 NVL(p_source_55,'
149239 ') = 'SOURCE'
149240 THEN
149241
149242 --
149243 XLA_AE_LINES_PKG.SetNewLine;
149244
149245 p_balance_type_code := l_balance_type_code;
149246 -- set the flag so later we will know whether the gain loss line needs to be created
149247
149248 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
149249 p_actual_flag :='A';
149250 END IF;
149251
149252 --
149253 -- bulk performance
149254 --
149255 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
149256 p_header_num => 0); -- 4262811
149257 --
149258 -- set accounting line options
149259 --
149260 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
149261 p_natural_side_code => 'C'
149262 , p_gain_or_loss_flag => 'N'
149263 , p_gl_transfer_mode_code => 'S'
149264 , p_acct_entry_type_code => 'A'
149265 , p_switch_side_flag => 'Y'
149266 , p_merge_duplicate_code => 'N'
149267 );
149268 --
149269 l_acc_rev_natural_side_code := 'D'; -- 4262811
149270 --
149271 --
149272 -- set accounting line type info
149273 --
149274 xla_ae_lines_pkg.SetAcctLineType
149275 (p_component_type => l_component_type
149276 ,p_event_type_code => l_event_type_code
149277 ,p_line_definition_owner_code => l_line_definition_owner_code
149278 ,p_line_definition_code => l_line_definition_code
149279 ,p_accounting_line_code => l_component_code
149280 ,p_accounting_line_type_code => l_component_type_code
149281 ,p_accounting_line_appl_id => l_component_appl_id
149282 ,p_amb_context_code => l_amb_context_code
149283 ,p_entity_code => l_entity_code
149284 ,p_event_class_code => l_event_class_code);
149285 --
149286 -- set accounting class
149287 --
149288 xla_ae_lines_pkg.SetAcctClass(
149289 p_accounting_class_code => 'ASSET'
149290 , p_ae_header_id => l_ae_header_id
149291 );
149292
149293 --
149294 -- set rounding class
149295 --
149296 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
149297 'ASSET';
149298
149299 --
149300 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
149301 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
149302 --
149303 -- bulk performance
149304 --
149305 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
149306
149307 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
149308 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
149309
149310 -- 4955764
149311 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
149312 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
149313
149314 -- 4458381 Public Sector Enh
149315
149316 --
149317 -- set accounting attributes for the line type
149318 --
149319 l_entered_amt_idx := 4;
149320 l_accted_amt_idx := 6;
149321 l_bflow_applied_to_amt_idx := NULL; -- 5132302
149322 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
149323 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
149324 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
149325 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
149326 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
149330 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
149327 l_rec_acct_attrs.array_char_value(3) := p_source_51;
149328 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
149329 l_rec_acct_attrs.array_num_value(4) := p_source_52;
149331 l_rec_acct_attrs.array_char_value(5) := p_source_53;
149332 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
149333 l_rec_acct_attrs.array_num_value(6) := p_source_52;
149334
149335 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
149336 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
149337
149338 ---------------------------------------------------------------------------------------------------------------
149339 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
149340 ---------------------------------------------------------------------------------------------------------------
149341 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
149342
149343 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
149344 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
149345
149346 IF xla_accounting_cache_pkg.GetValueChar
149347 (p_source_code => 'LEDGER_CATEGORY_CODE'
149348 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
149349 AND l_bflow_method_code = 'PRIOR_ENTRY'
149350 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
149351 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
149352 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
149353 )
149354 THEN
149355 xla_ae_lines_pkg.BflowUpgEntry
149356 (p_business_method_code => l_bflow_method_code
149357 ,p_business_class_code => l_bflow_class_code
149358 ,p_balance_type => l_balance_type_code);
149359 ELSE
149360 NULL;
149361 -- No business flow processing for business flow method of NONE.
149362 END IF;
149363
149364 --
149365 -- call analytical criteria
149366 --
149367
149368 --
149369 -- call description
149370 --
149371
149372 xla_ae_lines_pkg.SetLineDescription(
149373 p_ae_header_id => l_ae_header_id
149374 ,p_description => Description_113 (
149375 p_application_id => p_application_id
149376 , p_ae_header_id => l_ae_header_id
149377 , p_source_1 => p_source_1
149378 )
149379 );
149380
149381
149382 --
149383 -- call ADRs
149384 -- Bug 4922099
149385 --
149386 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
149387 (NVL(l_actual_upg_option, 'N') = 'O') OR
149388 (NVL(l_enc_upg_option, 'N') = 'O')
149389 )
149390 THEN
149391 NULL;
149392 --
149393 --
149394
149395 l_ccid := AcctDerRule_175(
149396 p_application_id => p_application_id
149397 , p_ae_header_id => l_ae_header_id
149398 , p_source_5 => p_source_5
149399 , p_source_19 => p_source_19
149400 , p_source_32 => p_source_32
149401 , x_transaction_coa_id => l_adr_transaction_coa_id
149402 , x_accounting_coa_id => l_adr_accounting_coa_id
149403 , x_value_type_code => l_adr_value_type_code
149404 , p_side => 'NA'
149405 );
149406
149407 xla_ae_lines_pkg.set_ccid(
149408 p_code_combination_id => l_ccid
149409 , p_value_type_code => l_adr_value_type_code
149410 , p_transaction_coa_id => l_adr_transaction_coa_id
149411 , p_accounting_coa_id => l_adr_accounting_coa_id
149412 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
149413 , p_adr_type_code => 'S'
149414 , p_component_type => l_component_type
149415 , p_component_code => l_component_code
149416 , p_component_type_code => l_component_type_code
149417 , p_component_appl_id => l_component_appl_id
149418 , p_amb_context_code => l_amb_context_code
149419 , p_side => 'NA'
149420 );
149421
149422
149423 l_segment := AcctDerRule_150(
149424 p_application_id => p_application_id
149425 , p_ae_header_id => l_ae_header_id
149426 , p_source_5 => p_source_5
149427 , p_source_12 => p_source_12
149428 , x_transaction_coa_id => l_adr_transaction_coa_id
149429 , x_accounting_coa_id => l_adr_accounting_coa_id
149430 , x_flexfield_segment_code => l_adr_flexfield_segment_code
149431 , x_flex_value_set_id => l_adr_flex_value_set_id
149432 , x_value_type_code => l_adr_value_type_code
149433 , x_value_combination_id => l_adr_value_combination_id
149434 , x_value_segment_code => l_adr_value_segment_code
149435 , p_side => 'NA'
149436 , p_override_seg_flag => 'Y'
149437 );
149438
149439 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
149440
149441 xla_ae_lines_pkg.set_segment(
149442 p_to_segment_code => 'GL_ACCOUNT'
149443 , p_segment_value => l_segment
149444 , p_from_segment_code => l_adr_value_segment_code
149448 , p_accounting_coa_id => l_adr_accounting_coa_id
149445 , p_from_combination_id => l_adr_value_combination_id
149446 , p_value_type_code => l_adr_value_type_code
149447 , p_transaction_coa_id => l_adr_transaction_coa_id
149449 , p_flexfield_segment_code => l_adr_flexfield_segment_code
149450 , p_flex_value_set_id => l_adr_flex_value_set_id
149451 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
149452 , p_adr_type_code => 'S'
149453 , p_component_type => l_component_type
149454 , p_component_code => l_component_code
149455 , p_component_type_code => l_component_type_code
149456 , p_component_appl_id => l_component_appl_id
149457 , p_amb_context_code => l_amb_context_code
149458 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
149459 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
149460 , p_side => 'NA'
149461 );
149462
149463 END IF;
149464
149465 l_segment := AcctDerRule_169(
149466 p_application_id => p_application_id
149467 , p_ae_header_id => l_ae_header_id
149468 , p_source_5 => p_source_5
149469 , p_source_31 => p_source_31
149470 , x_transaction_coa_id => l_adr_transaction_coa_id
149471 , x_accounting_coa_id => l_adr_accounting_coa_id
149472 , x_flexfield_segment_code => l_adr_flexfield_segment_code
149473 , x_flex_value_set_id => l_adr_flex_value_set_id
149474 , x_value_type_code => l_adr_value_type_code
149475 , x_value_combination_id => l_adr_value_combination_id
149476 , x_value_segment_code => l_adr_value_segment_code
149477 , p_side => 'NA'
149478 , p_override_seg_flag => 'Y'
149479 );
149480
149481 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
149482
149483 xla_ae_lines_pkg.set_segment(
149484 p_to_segment_code => 'GL_BALANCING'
149485 , p_segment_value => l_segment
149486 , p_from_segment_code => l_adr_value_segment_code
149487 , p_from_combination_id => l_adr_value_combination_id
149488 , p_value_type_code => l_adr_value_type_code
149489 , p_transaction_coa_id => l_adr_transaction_coa_id
149490 , p_accounting_coa_id => l_adr_accounting_coa_id
149491 , p_flexfield_segment_code => l_adr_flexfield_segment_code
149492 , p_flex_value_set_id => l_adr_flex_value_set_id
149493 , p_adr_code => 'FA_EXPENSE_ACCT'
149494 , p_adr_type_code => 'S'
149495 , p_component_type => l_component_type
149496 , p_component_code => l_component_code
149497 , p_component_type_code => l_component_type_code
149498 , p_component_appl_id => l_component_appl_id
149499 , p_amb_context_code => l_amb_context_code
149500 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
149501 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
149502 , p_side => 'NA'
149503 );
149504
149505 END IF;
149506
149507 --
149508 --
149509 END IF;
149510 --
149511 -- Bug 4922099
149512 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
149513 (NVL(l_enc_upg_option, 'N') = 'O')
149514 ) AND
149515 (l_bflow_method_code = 'PRIOR_ENTRY')
149516 )
149517 THEN
149518 IF
149519 --
149520 1 = 2
149521 --
149522 THEN
149523 xla_accounting_err_pkg.build_message
149524 (p_appli_s_name => 'XLA'
149525 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
149526 ,p_token_1 => 'LINE_NUMBER'
149527 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
149528 ,p_token_2 => 'LINE_TYPE_NAME'
149529 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
149530 l_component_type
149531 ,l_component_code
149532 ,l_component_type_code
149533 ,l_component_appl_id
149534 ,l_amb_context_code
149535 ,l_entity_code
149536 ,l_event_class_code
149537 )
149538 ,p_token_3 => 'OWNER'
149539 ,p_value_3 => xla_lookups_pkg.get_meaning(
149540 p_lookup_type => 'XLA_OWNER_TYPE'
149541 ,p_lookup_code => l_component_type_code
149542 )
149543 ,p_token_4 => 'PRODUCT_NAME'
149544 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
149548 ,p_ae_header_id => NULL
149545 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
149546 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
149547 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
149549 );
149550
149551 IF (C_LEVEL_ERROR>= g_log_level) THEN
149552 trace
149553 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
149554 ,p_level => C_LEVEL_ERROR
149555 ,p_module => l_log_module);
149556 END IF;
149557 END IF;
149558 END IF;
149559 --
149560 --
149561 ------------------------------------------------------------------------------------------------
149562 -- 4219869 Business Flow
149563 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
149564 -- Prior Entry. Currently, the following code is always generated.
149565 ------------------------------------------------------------------------------------------------
149566 XLA_AE_LINES_PKG.ValidateCurrentLine;
149567
149568 ------------------------------------------------------------------------------------
149569 -- 4219869 Business Flow
149570 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
149571 ------------------------------------------------------------------------------------
149572 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
149573
149574 ----------------------------------------------------------------------------------
149575 -- 4219869 Business Flow
149576 -- Update journal entry status -- Need to generate this within IF <condition>
149577 ----------------------------------------------------------------------------------
149578 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
149579 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
149580 ,p_balance_type_code => l_balance_type_code
149581 );
149582
149583 -------------------------------------------------------------------------------------------
149584 -- 4262811 - Generate the Accrual Reversal lines
149585 -------------------------------------------------------------------------------------------
149586 BEGIN
149587 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
149588 (g_array_event(p_event_id).array_value_num('header_index'));
149589 IF l_acc_rev_flag IS NULL THEN
149590 l_acc_rev_flag := 'N';
149591 END IF;
149592 EXCEPTION
149593 WHEN OTHERS THEN
149594 l_acc_rev_flag := 'N';
149595 END;
149596 --
149597 IF (l_acc_rev_flag = 'Y') THEN
149598
149599 -- 4645092 ------------------------------------------------------------------------------
149600 -- To allow MPA report to determine if it should generate report process
149601 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
149602 ------------------------------------------------------------------------------------------
149603
149604 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
149605 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
149606 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
149607 -- call ADRs
149608 -- Bug 4922099
149609 --
149610 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
149611 (NVL(l_actual_upg_option, 'N') = 'O') OR
149612 (NVL(l_enc_upg_option, 'N') = 'O')
149613 )
149614 THEN
149615 NULL;
149616 --
149617 --
149618
149619 l_ccid := AcctDerRule_175(
149620 p_application_id => p_application_id
149621 , p_ae_header_id => l_ae_header_id
149622 , p_source_5 => p_source_5
149623 , p_source_19 => p_source_19
149624 , p_source_32 => p_source_32
149625 , x_transaction_coa_id => l_adr_transaction_coa_id
149626 , x_accounting_coa_id => l_adr_accounting_coa_id
149627 , x_value_type_code => l_adr_value_type_code
149628 , p_side => 'NA'
149629 );
149630
149631 xla_ae_lines_pkg.set_ccid(
149632 p_code_combination_id => l_ccid
149633 , p_value_type_code => l_adr_value_type_code
149634 , p_transaction_coa_id => l_adr_transaction_coa_id
149635 , p_accounting_coa_id => l_adr_accounting_coa_id
149636 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
149637 , p_adr_type_code => 'S'
149638 , p_component_type => l_component_type
149639 , p_component_code => l_component_code
149640 , p_component_type_code => l_component_type_code
149641 , p_component_appl_id => l_component_appl_id
149642 , p_amb_context_code => l_amb_context_code
149643 , p_side => 'NA'
149644 );
149645
149646
149647 l_segment := AcctDerRule_150(
149648 p_application_id => p_application_id
149649 , p_ae_header_id => l_ae_header_id
149650 , p_source_5 => p_source_5
149651 , p_source_12 => p_source_12
149652 , x_transaction_coa_id => l_adr_transaction_coa_id
149653 , x_accounting_coa_id => l_adr_accounting_coa_id
149654 , x_flexfield_segment_code => l_adr_flexfield_segment_code
149658 , x_value_segment_code => l_adr_value_segment_code
149655 , x_flex_value_set_id => l_adr_flex_value_set_id
149656 , x_value_type_code => l_adr_value_type_code
149657 , x_value_combination_id => l_adr_value_combination_id
149659 , p_side => 'NA'
149660 , p_override_seg_flag => 'Y'
149661 );
149662
149663 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
149664
149665 xla_ae_lines_pkg.set_segment(
149666 p_to_segment_code => 'GL_ACCOUNT'
149667 , p_segment_value => l_segment
149668 , p_from_segment_code => l_adr_value_segment_code
149669 , p_from_combination_id => l_adr_value_combination_id
149670 , p_value_type_code => l_adr_value_type_code
149671 , p_transaction_coa_id => l_adr_transaction_coa_id
149672 , p_accounting_coa_id => l_adr_accounting_coa_id
149673 , p_flexfield_segment_code => l_adr_flexfield_segment_code
149674 , p_flex_value_set_id => l_adr_flex_value_set_id
149675 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
149676 , p_adr_type_code => 'S'
149677 , p_component_type => l_component_type
149678 , p_component_code => l_component_code
149679 , p_component_type_code => l_component_type_code
149680 , p_component_appl_id => l_component_appl_id
149681 , p_amb_context_code => l_amb_context_code
149682 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
149683 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
149684 , p_side => 'NA'
149685 );
149686
149687 END IF;
149688
149689 l_segment := AcctDerRule_169(
149690 p_application_id => p_application_id
149691 , p_ae_header_id => l_ae_header_id
149692 , p_source_5 => p_source_5
149693 , p_source_31 => p_source_31
149694 , x_transaction_coa_id => l_adr_transaction_coa_id
149695 , x_accounting_coa_id => l_adr_accounting_coa_id
149696 , x_flexfield_segment_code => l_adr_flexfield_segment_code
149697 , x_flex_value_set_id => l_adr_flex_value_set_id
149698 , x_value_type_code => l_adr_value_type_code
149699 , x_value_combination_id => l_adr_value_combination_id
149700 , x_value_segment_code => l_adr_value_segment_code
149701 , p_side => 'NA'
149702 , p_override_seg_flag => 'Y'
149703 );
149704
149705 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
149706
149707 xla_ae_lines_pkg.set_segment(
149708 p_to_segment_code => 'GL_BALANCING'
149709 , p_segment_value => l_segment
149710 , p_from_segment_code => l_adr_value_segment_code
149711 , p_from_combination_id => l_adr_value_combination_id
149712 , p_value_type_code => l_adr_value_type_code
149713 , p_transaction_coa_id => l_adr_transaction_coa_id
149714 , p_accounting_coa_id => l_adr_accounting_coa_id
149715 , p_flexfield_segment_code => l_adr_flexfield_segment_code
149716 , p_flex_value_set_id => l_adr_flex_value_set_id
149717 , p_adr_code => 'FA_EXPENSE_ACCT'
149718 , p_adr_type_code => 'S'
149719 , p_component_type => l_component_type
149720 , p_component_code => l_component_code
149721 , p_component_type_code => l_component_type_code
149722 , p_component_appl_id => l_component_appl_id
149723 , p_amb_context_code => l_amb_context_code
149724 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
149725 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
149726 , p_side => 'NA'
149727 );
149728
149729 END IF;
149730
149731 --
149732 --
149733 END IF;
149734
149735 --
149736 -- Update the line information that should be overwritten
149737 --
149738 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
149739 p_header_num => 1);
149740 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
149741
149742 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
149743
149744 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
149745 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
149746 END IF;
149747
149748 --
149749 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
149750 --
149751 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
149752 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
149753 ELSE
149754 ---------------------------------------------------------------------------------------------------
149755 -- 4262811a Switch Sign
149756 ---------------------------------------------------------------------------------------------------
149757 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
149758 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
149762 -- 5132302
149759 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
149760 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
149761 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
149763 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
149764 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
149765
149766 END IF;
149767
149768 -- 4955764
149769 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
149770 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
149771
149772
149773 XLA_AE_LINES_PKG.ValidateCurrentLine;
149774 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
149775
149776 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
149777 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
149778 ,p_balance_type_code => l_balance_type_code);
149779
149780 END IF;
149781
149782 -----------------------------------------------------------------------------------------
149783 -- 4262811 Multiperiod Accounting
149784 -----------------------------------------------------------------------------------------
149785 -- No MPA option is assigned.
149786
149787
149788 END IF;
149789 END IF;
149790 --
149791
149792 --
149793 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
149794 trace
149795 (p_msg => 'END of AcctLineType_374'
149796 ,p_level => C_LEVEL_PROCEDURE
149797 ,p_module => l_log_module);
149798 END IF;
149799 --
149800 EXCEPTION
149801 WHEN xla_exceptions_pkg.application_exception THEN
149802 RAISE;
149803 WHEN OTHERS THEN
149804 xla_exceptions_pkg.raise_message
149805 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_374');
149806 END AcctLineType_374;
149807 --
149808
149809 ---------------------------------------
149810 --
149811 -- PRIVATE FUNCTION
149812 -- AcctLineType_375
149813 --
149814 ---------------------------------------
149815 PROCEDURE AcctLineType_375 (
149816 p_application_id IN NUMBER
149817 ,p_event_id IN NUMBER
149818 ,p_calculate_acctd_flag IN VARCHAR2
149819 ,p_calculate_g_l_flag IN VARCHAR2
149820 ,p_actual_flag IN OUT VARCHAR2
149821 ,p_balance_type_code OUT VARCHAR2
149822 ,p_gain_or_loss_ref OUT VARCHAR2
149823
149824 --Period Close Date
149825 , p_source_1 IN DATE
149826 --Generated Code Combination Identifier
149827 , p_source_5 IN NUMBER
149828 --Revaluation Reserve Account
149829 , p_source_13 IN VARCHAR2
149830 --Generated Offset Code Combination Identifier
149831 , p_source_19 IN NUMBER
149832 --Expense Account Code Combination Identifier
149833 , p_source_31 IN NUMBER
149834 --Default Code Combination Identifier
149835 , p_source_32 IN NUMBER
149836 --Adjustment Type
149837 , p_source_48 IN VARCHAR2
149838 --Transaction Header Identifier
149839 , p_source_49 IN NUMBER
149840 --Adjustment Line Identifier
149841 , p_source_50 IN NUMBER
149842 --Distribution Type Code
149843 , p_source_51 IN VARCHAR2
149844 --Entered Amount
149845 , p_source_52 IN NUMBER
149846 --Currency Code
149847 , p_source_53 IN VARCHAR2
149848 --Source Destination Code
149849 , p_source_55 IN VARCHAR2
149850 )
149851 IS
149852
149853 l_component_type VARCHAR2(80);
149854 l_component_code VARCHAR2(30);
149855 l_component_type_code VARCHAR2(1);
149856 l_component_appl_id INTEGER;
149857 l_amb_context_code VARCHAR2(30);
149858 l_entity_code VARCHAR2(30);
149859 l_event_class_code VARCHAR2(30);
149860 l_ae_header_id NUMBER;
149861 l_event_type_code VARCHAR2(30);
149862 l_line_definition_code VARCHAR2(30);
149863 l_line_definition_owner_code VARCHAR2(1);
149864 --
149865 -- adr variables
149866 l_segment VARCHAR2(30);
149867 l_ccid NUMBER;
149868 l_adr_transaction_coa_id NUMBER;
149869 l_adr_accounting_coa_id NUMBER;
149870 l_adr_flexfield_segment_code VARCHAR2(30);
149871 l_adr_flex_value_set_id NUMBER;
149872 l_adr_value_type_code VARCHAR2(30);
149873 l_adr_value_combination_id NUMBER;
149874 l_adr_value_segment_code VARCHAR2(30);
149875
149876 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
149877 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
149878 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
149879 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
149880
149881 -- 4262811 Variables ------------------------------------------------------------------------------------------
149882 l_entered_amt_idx NUMBER;
149883 l_accted_amt_idx NUMBER;
149884 l_acc_rev_flag VARCHAR2(1);
149885 l_accrual_line_num NUMBER;
149886 l_tmp_amt NUMBER;
149887 l_acc_rev_natural_side_code VARCHAR2(1);
149888
149892 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
149889 l_num_entries NUMBER;
149890 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
149891 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
149893 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
149894 l_recog_line_1 NUMBER;
149895 l_recog_line_2 NUMBER;
149896
149897 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
149898 l_bflow_applied_to_amt NUMBER; -- 5132302
149899 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
149900
149901 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
149902
149903 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
149904 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
149905
149906 ---------------------------------------------------------------------------------------------------------------
149907
149908
149909 --
149910 -- bulk performance
149911 --
149912 l_balance_type_code VARCHAR2(1);
149913 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
149914 l_log_module VARCHAR2(240);
149915
149916 --
149917 -- Upgrade strategy
149918 --
149919 l_actual_upg_option VARCHAR2(1);
149920 l_enc_upg_option VARCHAR2(1);
149921
149922 --
149923 BEGIN
149924 --
149925 IF g_log_enabled THEN
149926 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_375';
149927 END IF;
149928 --
149929 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
149930
149931 trace
149932 (p_msg => 'BEGIN of AcctLineType_375'
149933 ,p_level => C_LEVEL_PROCEDURE
149934 ,p_module => l_log_module);
149935
149936 END IF;
149937 --
149938 l_component_type := 'AMB_JLT';
149939 l_component_code := 'FA_SLT_SOURCE_REVAL_RESERVE';
149940 l_component_type_code := 'S';
149941 l_component_appl_id := 140;
149942 l_amb_context_code := 'DEFAULT';
149943 l_entity_code := 'INTER_ASSET_TRANSACTIONS';
149944 l_event_class_code := 'SOURCE_LINE_TRANSFERS';
149945 l_event_type_code := 'SOURCE_LINE_TRANSFERS_ALL';
149946 l_line_definition_owner_code := 'S';
149947 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_SOURC23';
149948 --
149949 l_balance_type_code := 'A';
149950 l_segment := NULL;
149951 l_ccid := NULL;
149952 l_adr_transaction_coa_id := NULL;
149953 l_adr_accounting_coa_id := NULL;
149954 l_adr_flexfield_segment_code := NULL;
149955 l_adr_flex_value_set_id := NULL;
149956 l_adr_value_type_code := NULL;
149957 l_adr_value_combination_id := NULL;
149958 l_adr_value_segment_code := NULL;
149959
149960 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
149961 l_bflow_class_code := ''; -- 4219869 Business Flow
149962 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
149963 l_budgetary_control_flag := 'N';
149964
149965 l_bflow_applied_to_amt_idx := NULL; -- 5132302
149966 l_bflow_applied_to_amt := NULL; -- 5132302
149967 l_entered_amt_idx := NULL; -- 4262811
149968 l_accted_amt_idx := NULL; -- 4262811
149969 l_acc_rev_flag := NULL; -- 4262811
149970 l_accrual_line_num := NULL; -- 4262811
149971 l_tmp_amt := NULL; -- 4262811
149972 --
149973
149974 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
149975 l_balance_type_code <> 'B' THEN
149976 IF NVL(p_source_48,'
149977 ') = 'REVAL RESERVE' AND
149978 NVL(p_source_55,'
149979 ') = 'SOURCE'
149980 THEN
149981
149982 --
149983 XLA_AE_LINES_PKG.SetNewLine;
149984
149985 p_balance_type_code := l_balance_type_code;
149986 -- set the flag so later we will know whether the gain loss line needs to be created
149987
149988 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
149989 p_actual_flag :='A';
149990 END IF;
149991
149992 --
149993 -- bulk performance
149994 --
149995 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
149996 p_header_num => 0); -- 4262811
149997 --
149998 -- set accounting line options
149999 --
150000 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
150001 p_natural_side_code => 'D'
150002 , p_gain_or_loss_flag => 'N'
150003 , p_gl_transfer_mode_code => 'S'
150004 , p_acct_entry_type_code => 'A'
150005 , p_switch_side_flag => 'Y'
150006 , p_merge_duplicate_code => 'N'
150007 );
150008 --
150009 l_acc_rev_natural_side_code := 'C'; -- 4262811
150010 --
150011 --
150012 -- set accounting line type info
150013 --
150014 xla_ae_lines_pkg.SetAcctLineType
150015 (p_component_type => l_component_type
150016 ,p_event_type_code => l_event_type_code
150017 ,p_line_definition_owner_code => l_line_definition_owner_code
150018 ,p_line_definition_code => l_line_definition_code
150019 ,p_accounting_line_code => l_component_code
150020 ,p_accounting_line_type_code => l_component_type_code
150024 ,p_event_class_code => l_event_class_code);
150021 ,p_accounting_line_appl_id => l_component_appl_id
150022 ,p_amb_context_code => l_amb_context_code
150023 ,p_entity_code => l_entity_code
150025 --
150026 -- set accounting class
150027 --
150028 xla_ae_lines_pkg.SetAcctClass(
150029 p_accounting_class_code => 'ASSET'
150030 , p_ae_header_id => l_ae_header_id
150031 );
150032
150033 --
150034 -- set rounding class
150035 --
150036 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
150037 'ASSET';
150038
150039 --
150040 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
150041 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
150042 --
150043 -- bulk performance
150044 --
150045 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
150046
150047 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
150048 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
150049
150050 -- 4955764
150051 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
150052 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
150053
150054 -- 4458381 Public Sector Enh
150055
150056 --
150057 -- set accounting attributes for the line type
150058 --
150059 l_entered_amt_idx := 4;
150060 l_accted_amt_idx := 6;
150061 l_bflow_applied_to_amt_idx := NULL; -- 5132302
150062 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
150063 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
150064 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
150065 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
150066 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
150067 l_rec_acct_attrs.array_char_value(3) := p_source_51;
150068 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
150069 l_rec_acct_attrs.array_num_value(4) := p_source_52;
150070 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
150071 l_rec_acct_attrs.array_char_value(5) := p_source_53;
150072 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
150073 l_rec_acct_attrs.array_num_value(6) := p_source_52;
150074
150075 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
150076 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
150077
150078 ---------------------------------------------------------------------------------------------------------------
150079 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
150080 ---------------------------------------------------------------------------------------------------------------
150081 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
150082
150083 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
150084 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
150085
150086 IF xla_accounting_cache_pkg.GetValueChar
150087 (p_source_code => 'LEDGER_CATEGORY_CODE'
150088 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
150089 AND l_bflow_method_code = 'PRIOR_ENTRY'
150090 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
150091 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
150092 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
150093 )
150094 THEN
150095 xla_ae_lines_pkg.BflowUpgEntry
150096 (p_business_method_code => l_bflow_method_code
150097 ,p_business_class_code => l_bflow_class_code
150098 ,p_balance_type => l_balance_type_code);
150099 ELSE
150100 NULL;
150101 -- No business flow processing for business flow method of NONE.
150102 END IF;
150103
150104 --
150105 -- call analytical criteria
150106 --
150107
150108 --
150109 -- call description
150110 --
150111
150112 xla_ae_lines_pkg.SetLineDescription(
150113 p_ae_header_id => l_ae_header_id
150114 ,p_description => Description_116 (
150115 p_application_id => p_application_id
150116 , p_ae_header_id => l_ae_header_id
150117 , p_source_1 => p_source_1
150118 )
150119 );
150120
150121
150122 --
150123 -- call ADRs
150124 -- Bug 4922099
150125 --
150126 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
150127 (NVL(l_actual_upg_option, 'N') = 'O') OR
150128 (NVL(l_enc_upg_option, 'N') = 'O')
150129 )
150130 THEN
150131 NULL;
150132 --
150133 --
150134
150135 l_ccid := AcctDerRule_175(
150136 p_application_id => p_application_id
150137 , p_ae_header_id => l_ae_header_id
150138 , p_source_5 => p_source_5
150139 , p_source_19 => p_source_19
150140 , p_source_32 => p_source_32
150141 , x_transaction_coa_id => l_adr_transaction_coa_id
150142 , x_accounting_coa_id => l_adr_accounting_coa_id
150146
150143 , x_value_type_code => l_adr_value_type_code
150144 , p_side => 'NA'
150145 );
150147 xla_ae_lines_pkg.set_ccid(
150148 p_code_combination_id => l_ccid
150149 , p_value_type_code => l_adr_value_type_code
150150 , p_transaction_coa_id => l_adr_transaction_coa_id
150151 , p_accounting_coa_id => l_adr_accounting_coa_id
150152 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
150153 , p_adr_type_code => 'S'
150154 , p_component_type => l_component_type
150155 , p_component_code => l_component_code
150156 , p_component_type_code => l_component_type_code
150157 , p_component_appl_id => l_component_appl_id
150158 , p_amb_context_code => l_amb_context_code
150159 , p_side => 'NA'
150160 );
150161
150162
150163 l_segment := AcctDerRule_151(
150164 p_application_id => p_application_id
150165 , p_ae_header_id => l_ae_header_id
150166 , p_source_5 => p_source_5
150167 , p_source_13 => p_source_13
150168 , x_transaction_coa_id => l_adr_transaction_coa_id
150169 , x_accounting_coa_id => l_adr_accounting_coa_id
150170 , x_flexfield_segment_code => l_adr_flexfield_segment_code
150171 , x_flex_value_set_id => l_adr_flex_value_set_id
150172 , x_value_type_code => l_adr_value_type_code
150173 , x_value_combination_id => l_adr_value_combination_id
150174 , x_value_segment_code => l_adr_value_segment_code
150175 , p_side => 'NA'
150176 , p_override_seg_flag => 'Y'
150177 );
150178
150179 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
150180
150181 xla_ae_lines_pkg.set_segment(
150182 p_to_segment_code => 'GL_ACCOUNT'
150183 , p_segment_value => l_segment
150184 , p_from_segment_code => l_adr_value_segment_code
150185 , p_from_combination_id => l_adr_value_combination_id
150186 , p_value_type_code => l_adr_value_type_code
150187 , p_transaction_coa_id => l_adr_transaction_coa_id
150188 , p_accounting_coa_id => l_adr_accounting_coa_id
150189 , p_flexfield_segment_code => l_adr_flexfield_segment_code
150190 , p_flex_value_set_id => l_adr_flex_value_set_id
150191 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
150192 , p_adr_type_code => 'S'
150193 , p_component_type => l_component_type
150194 , p_component_code => l_component_code
150195 , p_component_type_code => l_component_type_code
150196 , p_component_appl_id => l_component_appl_id
150197 , p_amb_context_code => l_amb_context_code
150198 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
150199 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
150200 , p_side => 'NA'
150201 );
150202
150203 END IF;
150204
150205 l_segment := AcctDerRule_169(
150206 p_application_id => p_application_id
150207 , p_ae_header_id => l_ae_header_id
150208 , p_source_5 => p_source_5
150209 , p_source_31 => p_source_31
150210 , x_transaction_coa_id => l_adr_transaction_coa_id
150211 , x_accounting_coa_id => l_adr_accounting_coa_id
150212 , x_flexfield_segment_code => l_adr_flexfield_segment_code
150213 , x_flex_value_set_id => l_adr_flex_value_set_id
150214 , x_value_type_code => l_adr_value_type_code
150215 , x_value_combination_id => l_adr_value_combination_id
150216 , x_value_segment_code => l_adr_value_segment_code
150217 , p_side => 'NA'
150218 , p_override_seg_flag => 'Y'
150219 );
150220
150221 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
150222
150223 xla_ae_lines_pkg.set_segment(
150224 p_to_segment_code => 'GL_BALANCING'
150225 , p_segment_value => l_segment
150226 , p_from_segment_code => l_adr_value_segment_code
150227 , p_from_combination_id => l_adr_value_combination_id
150228 , p_value_type_code => l_adr_value_type_code
150229 , p_transaction_coa_id => l_adr_transaction_coa_id
150230 , p_accounting_coa_id => l_adr_accounting_coa_id
150231 , p_flexfield_segment_code => l_adr_flexfield_segment_code
150232 , p_flex_value_set_id => l_adr_flex_value_set_id
150233 , p_adr_code => 'FA_EXPENSE_ACCT'
150234 , p_adr_type_code => 'S'
150235 , p_component_type => l_component_type
150236 , p_component_code => l_component_code
150237 , p_component_type_code => l_component_type_code
150238 , p_component_appl_id => l_component_appl_id
150239 , p_amb_context_code => l_amb_context_code
150240 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
150241 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
150242 , p_side => 'NA'
150243 );
150244
150245 END IF;
150246
150247 --
150248 --
150249 END IF;
150250 --
150251 -- Bug 4922099
150252 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
150253 (NVL(l_enc_upg_option, 'N') = 'O')
150254 ) AND
150258 IF
150255 (l_bflow_method_code = 'PRIOR_ENTRY')
150256 )
150257 THEN
150259 --
150260 1 = 2
150261 --
150262 THEN
150263 xla_accounting_err_pkg.build_message
150264 (p_appli_s_name => 'XLA'
150265 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
150266 ,p_token_1 => 'LINE_NUMBER'
150267 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
150268 ,p_token_2 => 'LINE_TYPE_NAME'
150269 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
150270 l_component_type
150271 ,l_component_code
150272 ,l_component_type_code
150273 ,l_component_appl_id
150274 ,l_amb_context_code
150275 ,l_entity_code
150276 ,l_event_class_code
150277 )
150278 ,p_token_3 => 'OWNER'
150279 ,p_value_3 => xla_lookups_pkg.get_meaning(
150280 p_lookup_type => 'XLA_OWNER_TYPE'
150281 ,p_lookup_code => l_component_type_code
150282 )
150283 ,p_token_4 => 'PRODUCT_NAME'
150284 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
150285 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
150286 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
150287 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
150288 ,p_ae_header_id => NULL
150289 );
150290
150291 IF (C_LEVEL_ERROR>= g_log_level) THEN
150292 trace
150293 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
150294 ,p_level => C_LEVEL_ERROR
150295 ,p_module => l_log_module);
150296 END IF;
150297 END IF;
150298 END IF;
150299 --
150300 --
150301 ------------------------------------------------------------------------------------------------
150302 -- 4219869 Business Flow
150303 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
150304 -- Prior Entry. Currently, the following code is always generated.
150305 ------------------------------------------------------------------------------------------------
150306 XLA_AE_LINES_PKG.ValidateCurrentLine;
150307
150308 ------------------------------------------------------------------------------------
150309 -- 4219869 Business Flow
150310 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
150311 ------------------------------------------------------------------------------------
150312 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
150313
150314 ----------------------------------------------------------------------------------
150315 -- 4219869 Business Flow
150316 -- Update journal entry status -- Need to generate this within IF <condition>
150317 ----------------------------------------------------------------------------------
150318 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
150319 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
150320 ,p_balance_type_code => l_balance_type_code
150321 );
150322
150323 -------------------------------------------------------------------------------------------
150324 -- 4262811 - Generate the Accrual Reversal lines
150325 -------------------------------------------------------------------------------------------
150326 BEGIN
150327 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
150328 (g_array_event(p_event_id).array_value_num('header_index'));
150329 IF l_acc_rev_flag IS NULL THEN
150330 l_acc_rev_flag := 'N';
150331 END IF;
150332 EXCEPTION
150333 WHEN OTHERS THEN
150334 l_acc_rev_flag := 'N';
150335 END;
150336 --
150337 IF (l_acc_rev_flag = 'Y') THEN
150338
150339 -- 4645092 ------------------------------------------------------------------------------
150340 -- To allow MPA report to determine if it should generate report process
150341 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
150342 ------------------------------------------------------------------------------------------
150343
150344 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
150345 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
150349 --
150346 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
150347 -- call ADRs
150348 -- Bug 4922099
150350 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
150351 (NVL(l_actual_upg_option, 'N') = 'O') OR
150352 (NVL(l_enc_upg_option, 'N') = 'O')
150353 )
150354 THEN
150355 NULL;
150356 --
150357 --
150358
150359 l_ccid := AcctDerRule_175(
150360 p_application_id => p_application_id
150361 , p_ae_header_id => l_ae_header_id
150362 , p_source_5 => p_source_5
150363 , p_source_19 => p_source_19
150364 , p_source_32 => p_source_32
150365 , x_transaction_coa_id => l_adr_transaction_coa_id
150366 , x_accounting_coa_id => l_adr_accounting_coa_id
150367 , x_value_type_code => l_adr_value_type_code
150368 , p_side => 'NA'
150369 );
150370
150371 xla_ae_lines_pkg.set_ccid(
150372 p_code_combination_id => l_ccid
150373 , p_value_type_code => l_adr_value_type_code
150374 , p_transaction_coa_id => l_adr_transaction_coa_id
150375 , p_accounting_coa_id => l_adr_accounting_coa_id
150376 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
150377 , p_adr_type_code => 'S'
150378 , p_component_type => l_component_type
150379 , p_component_code => l_component_code
150380 , p_component_type_code => l_component_type_code
150381 , p_component_appl_id => l_component_appl_id
150382 , p_amb_context_code => l_amb_context_code
150383 , p_side => 'NA'
150384 );
150385
150386
150387 l_segment := AcctDerRule_151(
150388 p_application_id => p_application_id
150389 , p_ae_header_id => l_ae_header_id
150390 , p_source_5 => p_source_5
150391 , p_source_13 => p_source_13
150392 , x_transaction_coa_id => l_adr_transaction_coa_id
150393 , x_accounting_coa_id => l_adr_accounting_coa_id
150394 , x_flexfield_segment_code => l_adr_flexfield_segment_code
150395 , x_flex_value_set_id => l_adr_flex_value_set_id
150396 , x_value_type_code => l_adr_value_type_code
150397 , x_value_combination_id => l_adr_value_combination_id
150398 , x_value_segment_code => l_adr_value_segment_code
150399 , p_side => 'NA'
150400 , p_override_seg_flag => 'Y'
150401 );
150402
150403 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
150404
150405 xla_ae_lines_pkg.set_segment(
150406 p_to_segment_code => 'GL_ACCOUNT'
150407 , p_segment_value => l_segment
150408 , p_from_segment_code => l_adr_value_segment_code
150409 , p_from_combination_id => l_adr_value_combination_id
150410 , p_value_type_code => l_adr_value_type_code
150411 , p_transaction_coa_id => l_adr_transaction_coa_id
150412 , p_accounting_coa_id => l_adr_accounting_coa_id
150413 , p_flexfield_segment_code => l_adr_flexfield_segment_code
150414 , p_flex_value_set_id => l_adr_flex_value_set_id
150415 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
150416 , p_adr_type_code => 'S'
150417 , p_component_type => l_component_type
150418 , p_component_code => l_component_code
150419 , p_component_type_code => l_component_type_code
150420 , p_component_appl_id => l_component_appl_id
150421 , p_amb_context_code => l_amb_context_code
150422 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
150423 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
150424 , p_side => 'NA'
150425 );
150426
150427 END IF;
150428
150429 l_segment := AcctDerRule_169(
150430 p_application_id => p_application_id
150431 , p_ae_header_id => l_ae_header_id
150432 , p_source_5 => p_source_5
150433 , p_source_31 => p_source_31
150434 , x_transaction_coa_id => l_adr_transaction_coa_id
150435 , x_accounting_coa_id => l_adr_accounting_coa_id
150436 , x_flexfield_segment_code => l_adr_flexfield_segment_code
150437 , x_flex_value_set_id => l_adr_flex_value_set_id
150438 , x_value_type_code => l_adr_value_type_code
150439 , x_value_combination_id => l_adr_value_combination_id
150440 , x_value_segment_code => l_adr_value_segment_code
150441 , p_side => 'NA'
150442 , p_override_seg_flag => 'Y'
150443 );
150444
150445 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
150446
150447 xla_ae_lines_pkg.set_segment(
150448 p_to_segment_code => 'GL_BALANCING'
150449 , p_segment_value => l_segment
150450 , p_from_segment_code => l_adr_value_segment_code
150451 , p_from_combination_id => l_adr_value_combination_id
150452 , p_value_type_code => l_adr_value_type_code
150453 , p_transaction_coa_id => l_adr_transaction_coa_id
150454 , p_accounting_coa_id => l_adr_accounting_coa_id
150455 , p_flexfield_segment_code => l_adr_flexfield_segment_code
150456 , p_flex_value_set_id => l_adr_flex_value_set_id
150460 , p_component_code => l_component_code
150457 , p_adr_code => 'FA_EXPENSE_ACCT'
150458 , p_adr_type_code => 'S'
150459 , p_component_type => l_component_type
150461 , p_component_type_code => l_component_type_code
150462 , p_component_appl_id => l_component_appl_id
150463 , p_amb_context_code => l_amb_context_code
150464 , p_entity_code => 'INTER_ASSET_TRANSACTIONS'
150465 , p_event_class_code => 'SOURCE_LINE_TRANSFERS'
150466 , p_side => 'NA'
150467 );
150468
150469 END IF;
150470
150471 --
150472 --
150473 END IF;
150474
150475 --
150476 -- Update the line information that should be overwritten
150477 --
150478 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
150479 p_header_num => 1);
150480 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
150481
150482 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
150483
150484 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
150485 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
150486 END IF;
150487
150488 --
150489 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
150490 --
150491 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
150492 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
150493 ELSE
150494 ---------------------------------------------------------------------------------------------------
150495 -- 4262811a Switch Sign
150496 ---------------------------------------------------------------------------------------------------
150497 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
150498 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
150499 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
150500 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
150501 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
150502 -- 5132302
150503 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
150504 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
150505
150506 END IF;
150507
150508 -- 4955764
150509 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
150510 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
150511
150512
150513 XLA_AE_LINES_PKG.ValidateCurrentLine;
150514 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
150515
150516 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
150517 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
150518 ,p_balance_type_code => l_balance_type_code);
150519
150520 END IF;
150521
150522 -----------------------------------------------------------------------------------------
150523 -- 4262811 Multiperiod Accounting
150524 -----------------------------------------------------------------------------------------
150525 -- No MPA option is assigned.
150526
150527
150528 END IF;
150529 END IF;
150530 --
150531
150532 --
150533 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
150534 trace
150535 (p_msg => 'END of AcctLineType_375'
150536 ,p_level => C_LEVEL_PROCEDURE
150537 ,p_module => l_log_module);
150538 END IF;
150539 --
150540 EXCEPTION
150541 WHEN xla_exceptions_pkg.application_exception THEN
150542 RAISE;
150543 WHEN OTHERS THEN
150544 xla_exceptions_pkg.raise_message
150545 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_375');
150546 END AcctLineType_375;
150547 --
150548
150549 ---------------------------------------
150550 --
150551 -- PRIVATE FUNCTION
150552 -- AcctLineType_376
150553 --
150554 ---------------------------------------
150555 PROCEDURE AcctLineType_376 (
150556 p_application_id IN NUMBER
150557 ,p_event_id IN NUMBER
150558 ,p_calculate_acctd_flag IN VARCHAR2
150559 ,p_calculate_g_l_flag IN VARCHAR2
150560 ,p_actual_flag IN OUT VARCHAR2
150561 ,p_balance_type_code OUT VARCHAR2
150562 ,p_gain_or_loss_ref OUT VARCHAR2
150563
150564 --Period Close Date
150565 , p_source_1 IN DATE
150566 --Generated Code Combination Identifier
150567 , p_source_5 IN NUMBER
150568 --Depreciation Adjustment Account
150569 , p_source_20 IN VARCHAR2
150570 --Expense Account Code Combination Identifier
150571 , p_source_31 IN NUMBER
150572 --Default Code Combination Identifier
150573 , p_source_32 IN NUMBER
150574 --Adjustment Type
150575 , p_source_48 IN VARCHAR2
150576 --Transaction Header Identifier
150577 , p_source_49 IN NUMBER
150578 --Adjustment Line Identifier
150579 , p_source_50 IN NUMBER
150580 --Distribution Type Code
150584 --Currency Code
150581 , p_source_51 IN VARCHAR2
150582 --Entered Amount
150583 , p_source_52 IN NUMBER
150585 , p_source_53 IN VARCHAR2
150586 )
150587 IS
150588
150589 l_component_type VARCHAR2(80);
150590 l_component_code VARCHAR2(30);
150591 l_component_type_code VARCHAR2(1);
150592 l_component_appl_id INTEGER;
150593 l_amb_context_code VARCHAR2(30);
150594 l_entity_code VARCHAR2(30);
150595 l_event_class_code VARCHAR2(30);
150596 l_ae_header_id NUMBER;
150597 l_event_type_code VARCHAR2(30);
150598 l_line_definition_code VARCHAR2(30);
150599 l_line_definition_owner_code VARCHAR2(1);
150600 --
150601 -- adr variables
150602 l_segment VARCHAR2(30);
150603 l_ccid NUMBER;
150604 l_adr_transaction_coa_id NUMBER;
150605 l_adr_accounting_coa_id NUMBER;
150606 l_adr_flexfield_segment_code VARCHAR2(30);
150607 l_adr_flex_value_set_id NUMBER;
150608 l_adr_value_type_code VARCHAR2(30);
150609 l_adr_value_combination_id NUMBER;
150610 l_adr_value_segment_code VARCHAR2(30);
150611
150612 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
150613 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
150614 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
150615 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
150616
150617 -- 4262811 Variables ------------------------------------------------------------------------------------------
150618 l_entered_amt_idx NUMBER;
150619 l_accted_amt_idx NUMBER;
150620 l_acc_rev_flag VARCHAR2(1);
150621 l_accrual_line_num NUMBER;
150622 l_tmp_amt NUMBER;
150623 l_acc_rev_natural_side_code VARCHAR2(1);
150624
150625 l_num_entries NUMBER;
150626 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
150627 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
150628 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
150629 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
150630 l_recog_line_1 NUMBER;
150631 l_recog_line_2 NUMBER;
150632
150633 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
150634 l_bflow_applied_to_amt NUMBER; -- 5132302
150635 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
150636
150637 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
150638
150639 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
150640 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
150641
150642 ---------------------------------------------------------------------------------------------------------------
150643
150644
150645 --
150646 -- bulk performance
150647 --
150648 l_balance_type_code VARCHAR2(1);
150649 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
150650 l_log_module VARCHAR2(240);
150651
150652 --
150653 -- Upgrade strategy
150654 --
150655 l_actual_upg_option VARCHAR2(1);
150656 l_enc_upg_option VARCHAR2(1);
150657
150658 --
150659 BEGIN
150660 --
150661 IF g_log_enabled THEN
150662 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_376';
150663 END IF;
150664 --
150665 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
150666
150667 trace
150668 (p_msg => 'BEGIN of AcctLineType_376'
150669 ,p_level => C_LEVEL_PROCEDURE
150670 ,p_module => l_log_module);
150671
150672 END IF;
150673 --
150674 l_component_type := 'AMB_JLT';
150675 l_component_code := 'FA_TAX_DEP_ADJUSTMENT';
150676 l_component_type_code := 'S';
150677 l_component_appl_id := 140;
150678 l_amb_context_code := 'DEFAULT';
150679 l_entity_code := 'TRANSACTIONS';
150680 l_event_class_code := 'DEPRECIATION_ADJUSTMENTS';
150681 l_event_type_code := 'DEPRECIATION_ADJUSTMENTS_ALL';
150682 l_line_definition_owner_code := 'S';
150683 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEPRE15';
150684 --
150685 l_balance_type_code := 'A';
150686 l_segment := NULL;
150687 l_ccid := NULL;
150688 l_adr_transaction_coa_id := NULL;
150689 l_adr_accounting_coa_id := NULL;
150690 l_adr_flexfield_segment_code := NULL;
150691 l_adr_flex_value_set_id := NULL;
150692 l_adr_value_type_code := NULL;
150693 l_adr_value_combination_id := NULL;
150694 l_adr_value_segment_code := NULL;
150695
150696 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
150697 l_bflow_class_code := ''; -- 4219869 Business Flow
150698 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
150699 l_budgetary_control_flag := 'N';
150700
150701 l_bflow_applied_to_amt_idx := NULL; -- 5132302
150702 l_bflow_applied_to_amt := NULL; -- 5132302
150703 l_entered_amt_idx := NULL; -- 4262811
150704 l_accted_amt_idx := NULL; -- 4262811
150705 l_acc_rev_flag := NULL; -- 4262811
150706 l_accrual_line_num := NULL; -- 4262811
150707 l_tmp_amt := NULL; -- 4262811
150708 --
150709
150713 ') = 'DEPRN ADJUST'
150710 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
150711 l_balance_type_code <> 'B' THEN
150712 IF NVL(p_source_48,'
150714 THEN
150715
150716 --
150717 XLA_AE_LINES_PKG.SetNewLine;
150718
150719 p_balance_type_code := l_balance_type_code;
150720 -- set the flag so later we will know whether the gain loss line needs to be created
150721
150722 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
150723 p_actual_flag :='A';
150724 END IF;
150725
150726 --
150727 -- bulk performance
150728 --
150729 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
150730 p_header_num => 0); -- 4262811
150731 --
150732 -- set accounting line options
150733 --
150734 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
150735 p_natural_side_code => 'D'
150736 , p_gain_or_loss_flag => 'N'
150737 , p_gl_transfer_mode_code => 'S'
150738 , p_acct_entry_type_code => 'A'
150739 , p_switch_side_flag => 'Y'
150740 , p_merge_duplicate_code => 'N'
150741 );
150742 --
150743 l_acc_rev_natural_side_code := 'C'; -- 4262811
150744 --
150745 --
150746 -- set accounting line type info
150747 --
150748 xla_ae_lines_pkg.SetAcctLineType
150749 (p_component_type => l_component_type
150750 ,p_event_type_code => l_event_type_code
150751 ,p_line_definition_owner_code => l_line_definition_owner_code
150752 ,p_line_definition_code => l_line_definition_code
150753 ,p_accounting_line_code => l_component_code
150754 ,p_accounting_line_type_code => l_component_type_code
150755 ,p_accounting_line_appl_id => l_component_appl_id
150756 ,p_amb_context_code => l_amb_context_code
150757 ,p_entity_code => l_entity_code
150758 ,p_event_class_code => l_event_class_code);
150759 --
150760 -- set accounting class
150761 --
150762 xla_ae_lines_pkg.SetAcctClass(
150763 p_accounting_class_code => 'EXPENSE'
150764 , p_ae_header_id => l_ae_header_id
150765 );
150766
150767 --
150768 -- set rounding class
150769 --
150770 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
150771 'EXPENSE';
150772
150773 --
150774 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
150775 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
150776 --
150777 -- bulk performance
150778 --
150779 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
150780
150781 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
150782 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
150783
150784 -- 4955764
150785 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
150786 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
150787
150788 -- 4458381 Public Sector Enh
150789
150790 --
150791 -- set accounting attributes for the line type
150792 --
150793 l_entered_amt_idx := 4;
150794 l_accted_amt_idx := 6;
150795 l_bflow_applied_to_amt_idx := NULL; -- 5132302
150796 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
150797 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
150798 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
150799 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
150800 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
150801 l_rec_acct_attrs.array_char_value(3) := p_source_51;
150802 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
150803 l_rec_acct_attrs.array_num_value(4) := p_source_52;
150804 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
150805 l_rec_acct_attrs.array_char_value(5) := p_source_53;
150806 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
150807 l_rec_acct_attrs.array_num_value(6) := p_source_52;
150808
150809 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
150810 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
150811
150812 ---------------------------------------------------------------------------------------------------------------
150813 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
150814 ---------------------------------------------------------------------------------------------------------------
150815 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
150816
150817 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
150818 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
150819
150820 IF xla_accounting_cache_pkg.GetValueChar
150821 (p_source_code => 'LEDGER_CATEGORY_CODE'
150822 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
150826 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
150823 AND l_bflow_method_code = 'PRIOR_ENTRY'
150824 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
150825 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
150827 )
150828 THEN
150829 xla_ae_lines_pkg.BflowUpgEntry
150830 (p_business_method_code => l_bflow_method_code
150831 ,p_business_class_code => l_bflow_class_code
150832 ,p_balance_type => l_balance_type_code);
150833 ELSE
150834 NULL;
150835 -- No business flow processing for business flow method of NONE.
150836 END IF;
150837
150838 --
150839 -- call analytical criteria
150840 --
150841
150842 --
150843 -- call description
150844 --
150845
150846 xla_ae_lines_pkg.SetLineDescription(
150847 p_ae_header_id => l_ae_header_id
150848 ,p_description => Description_58 (
150849 p_application_id => p_application_id
150850 , p_ae_header_id => l_ae_header_id
150851 , p_source_1 => p_source_1
150852 )
150853 );
150854
150855
150856 --
150857 -- call ADRs
150858 -- Bug 4922099
150859 --
150860 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
150861 (NVL(l_actual_upg_option, 'N') = 'O') OR
150862 (NVL(l_enc_upg_option, 'N') = 'O')
150863 )
150864 THEN
150865 NULL;
150866 --
150867 --
150868
150869 l_ccid := AcctDerRule_174(
150870 p_application_id => p_application_id
150871 , p_ae_header_id => l_ae_header_id
150872 , p_source_5 => p_source_5
150873 , p_source_32 => p_source_32
150874 , x_transaction_coa_id => l_adr_transaction_coa_id
150875 , x_accounting_coa_id => l_adr_accounting_coa_id
150876 , x_value_type_code => l_adr_value_type_code
150877 , p_side => 'NA'
150878 );
150879
150880 xla_ae_lines_pkg.set_ccid(
150881 p_code_combination_id => l_ccid
150882 , p_value_type_code => l_adr_value_type_code
150883 , p_transaction_coa_id => l_adr_transaction_coa_id
150884 , p_accounting_coa_id => l_adr_accounting_coa_id
150885 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
150886 , p_adr_type_code => 'S'
150887 , p_component_type => l_component_type
150888 , p_component_code => l_component_code
150889 , p_component_type_code => l_component_type_code
150890 , p_component_appl_id => l_component_appl_id
150891 , p_amb_context_code => l_amb_context_code
150892 , p_side => 'NA'
150893 );
150894
150895
150896 l_segment := AcctDerRule_157(
150897 p_application_id => p_application_id
150898 , p_ae_header_id => l_ae_header_id
150899 , p_source_5 => p_source_5
150900 , p_source_20 => p_source_20
150901 , x_transaction_coa_id => l_adr_transaction_coa_id
150902 , x_accounting_coa_id => l_adr_accounting_coa_id
150903 , x_flexfield_segment_code => l_adr_flexfield_segment_code
150904 , x_flex_value_set_id => l_adr_flex_value_set_id
150905 , x_value_type_code => l_adr_value_type_code
150906 , x_value_combination_id => l_adr_value_combination_id
150907 , x_value_segment_code => l_adr_value_segment_code
150908 , p_side => 'NA'
150909 , p_override_seg_flag => 'Y'
150910 );
150911
150912 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
150913
150914 xla_ae_lines_pkg.set_segment(
150915 p_to_segment_code => 'GL_ACCOUNT'
150916 , p_segment_value => l_segment
150917 , p_from_segment_code => l_adr_value_segment_code
150918 , p_from_combination_id => l_adr_value_combination_id
150919 , p_value_type_code => l_adr_value_type_code
150920 , p_transaction_coa_id => l_adr_transaction_coa_id
150921 , p_accounting_coa_id => l_adr_accounting_coa_id
150922 , p_flexfield_segment_code => l_adr_flexfield_segment_code
150923 , p_flex_value_set_id => l_adr_flex_value_set_id
150924 , p_adr_code => 'FA_DEPRN_ADJUSTMENT_SEGMENT'
150925 , p_adr_type_code => 'S'
150926 , p_component_type => l_component_type
150927 , p_component_code => l_component_code
150928 , p_component_type_code => l_component_type_code
150929 , p_component_appl_id => l_component_appl_id
150930 , p_amb_context_code => l_amb_context_code
150931 , p_entity_code => 'TRANSACTIONS'
150932 , p_event_class_code => 'DEPRECIATION_ADJUSTMENTS'
150933 , p_side => 'NA'
150934 );
150935
150936 END IF;
150937
150938 l_segment := AcctDerRule_169(
150939 p_application_id => p_application_id
150940 , p_ae_header_id => l_ae_header_id
150941 , p_source_5 => p_source_5
150942 , p_source_31 => p_source_31
150943 , x_transaction_coa_id => l_adr_transaction_coa_id
150944 , x_accounting_coa_id => l_adr_accounting_coa_id
150945 , x_flexfield_segment_code => l_adr_flexfield_segment_code
150949 , x_value_segment_code => l_adr_value_segment_code
150946 , x_flex_value_set_id => l_adr_flex_value_set_id
150947 , x_value_type_code => l_adr_value_type_code
150948 , x_value_combination_id => l_adr_value_combination_id
150950 , p_side => 'NA'
150951 , p_override_seg_flag => 'Y'
150952 );
150953
150954 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
150955
150956 xla_ae_lines_pkg.set_segment(
150957 p_to_segment_code => 'GL_BALANCING'
150958 , p_segment_value => l_segment
150959 , p_from_segment_code => l_adr_value_segment_code
150960 , p_from_combination_id => l_adr_value_combination_id
150961 , p_value_type_code => l_adr_value_type_code
150962 , p_transaction_coa_id => l_adr_transaction_coa_id
150963 , p_accounting_coa_id => l_adr_accounting_coa_id
150964 , p_flexfield_segment_code => l_adr_flexfield_segment_code
150965 , p_flex_value_set_id => l_adr_flex_value_set_id
150966 , p_adr_code => 'FA_EXPENSE_ACCT'
150967 , p_adr_type_code => 'S'
150968 , p_component_type => l_component_type
150969 , p_component_code => l_component_code
150970 , p_component_type_code => l_component_type_code
150971 , p_component_appl_id => l_component_appl_id
150972 , p_amb_context_code => l_amb_context_code
150973 , p_entity_code => 'TRANSACTIONS'
150974 , p_event_class_code => 'DEPRECIATION_ADJUSTMENTS'
150975 , p_side => 'NA'
150976 );
150977
150978 END IF;
150979
150980 --
150981 --
150982 END IF;
150983 --
150984 -- Bug 4922099
150985 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
150986 (NVL(l_enc_upg_option, 'N') = 'O')
150987 ) AND
150988 (l_bflow_method_code = 'PRIOR_ENTRY')
150989 )
150990 THEN
150991 IF
150992 --
150993 1 = 2
150994 --
150995 THEN
150996 xla_accounting_err_pkg.build_message
150997 (p_appli_s_name => 'XLA'
150998 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
150999 ,p_token_1 => 'LINE_NUMBER'
151000 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
151001 ,p_token_2 => 'LINE_TYPE_NAME'
151002 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
151003 l_component_type
151004 ,l_component_code
151005 ,l_component_type_code
151006 ,l_component_appl_id
151007 ,l_amb_context_code
151008 ,l_entity_code
151009 ,l_event_class_code
151010 )
151011 ,p_token_3 => 'OWNER'
151012 ,p_value_3 => xla_lookups_pkg.get_meaning(
151013 p_lookup_type => 'XLA_OWNER_TYPE'
151014 ,p_lookup_code => l_component_type_code
151015 )
151016 ,p_token_4 => 'PRODUCT_NAME'
151017 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
151018 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
151019 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
151020 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
151021 ,p_ae_header_id => NULL
151022 );
151023
151024 IF (C_LEVEL_ERROR>= g_log_level) THEN
151025 trace
151026 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
151027 ,p_level => C_LEVEL_ERROR
151028 ,p_module => l_log_module);
151029 END IF;
151030 END IF;
151031 END IF;
151032 --
151033 --
151034 ------------------------------------------------------------------------------------------------
151035 -- 4219869 Business Flow
151036 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
151037 -- Prior Entry. Currently, the following code is always generated.
151038 ------------------------------------------------------------------------------------------------
151039 XLA_AE_LINES_PKG.ValidateCurrentLine;
151040
151041 ------------------------------------------------------------------------------------
151042 -- 4219869 Business Flow
151046
151043 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
151044 ------------------------------------------------------------------------------------
151045 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
151047 ----------------------------------------------------------------------------------
151048 -- 4219869 Business Flow
151049 -- Update journal entry status -- Need to generate this within IF <condition>
151050 ----------------------------------------------------------------------------------
151051 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
151052 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
151053 ,p_balance_type_code => l_balance_type_code
151054 );
151055
151056 -------------------------------------------------------------------------------------------
151057 -- 4262811 - Generate the Accrual Reversal lines
151058 -------------------------------------------------------------------------------------------
151059 BEGIN
151060 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
151061 (g_array_event(p_event_id).array_value_num('header_index'));
151062 IF l_acc_rev_flag IS NULL THEN
151063 l_acc_rev_flag := 'N';
151064 END IF;
151065 EXCEPTION
151066 WHEN OTHERS THEN
151067 l_acc_rev_flag := 'N';
151068 END;
151069 --
151070 IF (l_acc_rev_flag = 'Y') THEN
151071
151072 -- 4645092 ------------------------------------------------------------------------------
151073 -- To allow MPA report to determine if it should generate report process
151074 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
151075 ------------------------------------------------------------------------------------------
151076
151077 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
151078 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
151079 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
151080 -- call ADRs
151081 -- Bug 4922099
151082 --
151083 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
151084 (NVL(l_actual_upg_option, 'N') = 'O') OR
151085 (NVL(l_enc_upg_option, 'N') = 'O')
151086 )
151087 THEN
151088 NULL;
151089 --
151090 --
151091
151092 l_ccid := AcctDerRule_174(
151093 p_application_id => p_application_id
151094 , p_ae_header_id => l_ae_header_id
151095 , p_source_5 => p_source_5
151096 , p_source_32 => p_source_32
151097 , x_transaction_coa_id => l_adr_transaction_coa_id
151098 , x_accounting_coa_id => l_adr_accounting_coa_id
151099 , x_value_type_code => l_adr_value_type_code
151100 , p_side => 'NA'
151101 );
151102
151103 xla_ae_lines_pkg.set_ccid(
151104 p_code_combination_id => l_ccid
151105 , p_value_type_code => l_adr_value_type_code
151106 , p_transaction_coa_id => l_adr_transaction_coa_id
151107 , p_accounting_coa_id => l_adr_accounting_coa_id
151108 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
151109 , p_adr_type_code => 'S'
151110 , p_component_type => l_component_type
151111 , p_component_code => l_component_code
151112 , p_component_type_code => l_component_type_code
151113 , p_component_appl_id => l_component_appl_id
151114 , p_amb_context_code => l_amb_context_code
151115 , p_side => 'NA'
151116 );
151117
151118
151119 l_segment := AcctDerRule_157(
151120 p_application_id => p_application_id
151121 , p_ae_header_id => l_ae_header_id
151122 , p_source_5 => p_source_5
151123 , p_source_20 => p_source_20
151124 , x_transaction_coa_id => l_adr_transaction_coa_id
151125 , x_accounting_coa_id => l_adr_accounting_coa_id
151126 , x_flexfield_segment_code => l_adr_flexfield_segment_code
151127 , x_flex_value_set_id => l_adr_flex_value_set_id
151128 , x_value_type_code => l_adr_value_type_code
151129 , x_value_combination_id => l_adr_value_combination_id
151130 , x_value_segment_code => l_adr_value_segment_code
151131 , p_side => 'NA'
151132 , p_override_seg_flag => 'Y'
151133 );
151134
151135 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
151136
151137 xla_ae_lines_pkg.set_segment(
151138 p_to_segment_code => 'GL_ACCOUNT'
151139 , p_segment_value => l_segment
151140 , p_from_segment_code => l_adr_value_segment_code
151141 , p_from_combination_id => l_adr_value_combination_id
151142 , p_value_type_code => l_adr_value_type_code
151143 , p_transaction_coa_id => l_adr_transaction_coa_id
151144 , p_accounting_coa_id => l_adr_accounting_coa_id
151145 , p_flexfield_segment_code => l_adr_flexfield_segment_code
151146 , p_flex_value_set_id => l_adr_flex_value_set_id
151147 , p_adr_code => 'FA_DEPRN_ADJUSTMENT_SEGMENT'
151148 , p_adr_type_code => 'S'
151149 , p_component_type => l_component_type
151150 , p_component_code => l_component_code
151151 , p_component_type_code => l_component_type_code
151152 , p_component_appl_id => l_component_appl_id
151153 , p_amb_context_code => l_amb_context_code
151157 );
151154 , p_entity_code => 'TRANSACTIONS'
151155 , p_event_class_code => 'DEPRECIATION_ADJUSTMENTS'
151156 , p_side => 'NA'
151158
151159 END IF;
151160
151161 l_segment := AcctDerRule_169(
151162 p_application_id => p_application_id
151163 , p_ae_header_id => l_ae_header_id
151164 , p_source_5 => p_source_5
151165 , p_source_31 => p_source_31
151166 , x_transaction_coa_id => l_adr_transaction_coa_id
151167 , x_accounting_coa_id => l_adr_accounting_coa_id
151168 , x_flexfield_segment_code => l_adr_flexfield_segment_code
151169 , x_flex_value_set_id => l_adr_flex_value_set_id
151170 , x_value_type_code => l_adr_value_type_code
151171 , x_value_combination_id => l_adr_value_combination_id
151172 , x_value_segment_code => l_adr_value_segment_code
151173 , p_side => 'NA'
151174 , p_override_seg_flag => 'Y'
151175 );
151176
151177 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
151178
151179 xla_ae_lines_pkg.set_segment(
151180 p_to_segment_code => 'GL_BALANCING'
151181 , p_segment_value => l_segment
151182 , p_from_segment_code => l_adr_value_segment_code
151183 , p_from_combination_id => l_adr_value_combination_id
151184 , p_value_type_code => l_adr_value_type_code
151185 , p_transaction_coa_id => l_adr_transaction_coa_id
151186 , p_accounting_coa_id => l_adr_accounting_coa_id
151187 , p_flexfield_segment_code => l_adr_flexfield_segment_code
151188 , p_flex_value_set_id => l_adr_flex_value_set_id
151189 , p_adr_code => 'FA_EXPENSE_ACCT'
151190 , p_adr_type_code => 'S'
151191 , p_component_type => l_component_type
151192 , p_component_code => l_component_code
151193 , p_component_type_code => l_component_type_code
151194 , p_component_appl_id => l_component_appl_id
151195 , p_amb_context_code => l_amb_context_code
151196 , p_entity_code => 'TRANSACTIONS'
151197 , p_event_class_code => 'DEPRECIATION_ADJUSTMENTS'
151198 , p_side => 'NA'
151199 );
151200
151201 END IF;
151202
151203 --
151204 --
151205 END IF;
151206
151207 --
151208 -- Update the line information that should be overwritten
151209 --
151210 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
151211 p_header_num => 1);
151212 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
151213
151214 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
151215
151216 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
151217 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
151218 END IF;
151219
151220 --
151221 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
151222 --
151223 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
151224 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
151225 ELSE
151226 ---------------------------------------------------------------------------------------------------
151227 -- 4262811a Switch Sign
151228 ---------------------------------------------------------------------------------------------------
151229 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
151230 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
151231 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
151232 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
151233 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
151234 -- 5132302
151235 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
151236 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
151237
151238 END IF;
151239
151240 -- 4955764
151241 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
151242 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
151243
151244
151245 XLA_AE_LINES_PKG.ValidateCurrentLine;
151246 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
151247
151248 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
151249 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
151250 ,p_balance_type_code => l_balance_type_code);
151251
151252 END IF;
151253
151254 -----------------------------------------------------------------------------------------
151255 -- 4262811 Multiperiod Accounting
151256 -----------------------------------------------------------------------------------------
151257 -- No MPA option is assigned.
151258
151259
151260 END IF;
151261 END IF;
151262 --
151263
151267 (p_msg => 'END of AcctLineType_376'
151264 --
151265 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
151266 trace
151268 ,p_level => C_LEVEL_PROCEDURE
151269 ,p_module => l_log_module);
151270 END IF;
151271 --
151272 EXCEPTION
151273 WHEN xla_exceptions_pkg.application_exception THEN
151274 RAISE;
151275 WHEN OTHERS THEN
151276 xla_exceptions_pkg.raise_message
151277 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_376');
151278 END AcctLineType_376;
151279 --
151280
151281 ---------------------------------------
151282 --
151283 -- PRIVATE FUNCTION
151284 -- AcctLineType_377
151285 --
151286 ---------------------------------------
151287 PROCEDURE AcctLineType_377 (
151288 p_application_id IN NUMBER
151289 ,p_event_id IN NUMBER
151290 ,p_calculate_acctd_flag IN VARCHAR2
151291 ,p_calculate_g_l_flag IN VARCHAR2
151292 ,p_actual_flag IN OUT VARCHAR2
151293 ,p_balance_type_code OUT VARCHAR2
151294 ,p_gain_or_loss_ref OUT VARCHAR2
151295
151296 --Period Close Date
151297 , p_source_1 IN DATE
151298 --Generated Code Combination Identifier
151299 , p_source_5 IN NUMBER
151300 --Depreciation Reserve Account
151301 , p_source_12 IN VARCHAR2
151302 --Generated Offset Code Combination Identifier
151303 , p_source_19 IN NUMBER
151304 --Expense Account Code Combination Identifier
151305 , p_source_31 IN NUMBER
151306 --Default Code Combination Identifier
151307 , p_source_32 IN NUMBER
151308 --Adjustment Type
151309 , p_source_48 IN VARCHAR2
151310 --Transaction Header Identifier
151311 , p_source_49 IN NUMBER
151312 --Adjustment Line Identifier
151313 , p_source_50 IN NUMBER
151314 --Distribution Type Code
151315 , p_source_51 IN VARCHAR2
151316 --Entered Amount
151317 , p_source_52 IN NUMBER
151318 --Currency Code
151319 , p_source_53 IN VARCHAR2
151320 )
151321 IS
151322
151323 l_component_type VARCHAR2(80);
151324 l_component_code VARCHAR2(30);
151325 l_component_type_code VARCHAR2(1);
151326 l_component_appl_id INTEGER;
151327 l_amb_context_code VARCHAR2(30);
151328 l_entity_code VARCHAR2(30);
151329 l_event_class_code VARCHAR2(30);
151330 l_ae_header_id NUMBER;
151331 l_event_type_code VARCHAR2(30);
151332 l_line_definition_code VARCHAR2(30);
151333 l_line_definition_owner_code VARCHAR2(1);
151334 --
151335 -- adr variables
151336 l_segment VARCHAR2(30);
151337 l_ccid NUMBER;
151338 l_adr_transaction_coa_id NUMBER;
151339 l_adr_accounting_coa_id NUMBER;
151340 l_adr_flexfield_segment_code VARCHAR2(30);
151341 l_adr_flex_value_set_id NUMBER;
151342 l_adr_value_type_code VARCHAR2(30);
151343 l_adr_value_combination_id NUMBER;
151344 l_adr_value_segment_code VARCHAR2(30);
151345
151346 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
151347 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
151348 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
151349 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
151350
151351 -- 4262811 Variables ------------------------------------------------------------------------------------------
151352 l_entered_amt_idx NUMBER;
151353 l_accted_amt_idx NUMBER;
151354 l_acc_rev_flag VARCHAR2(1);
151355 l_accrual_line_num NUMBER;
151356 l_tmp_amt NUMBER;
151357 l_acc_rev_natural_side_code VARCHAR2(1);
151358
151359 l_num_entries NUMBER;
151360 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
151361 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
151362 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
151363 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
151364 l_recog_line_1 NUMBER;
151365 l_recog_line_2 NUMBER;
151366
151367 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
151368 l_bflow_applied_to_amt NUMBER; -- 5132302
151369 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
151370
151371 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
151372
151373 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
151374 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
151375
151376 ---------------------------------------------------------------------------------------------------------------
151377
151378
151379 --
151380 -- bulk performance
151381 --
151382 l_balance_type_code VARCHAR2(1);
151383 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
151384 l_log_module VARCHAR2(240);
151385
151386 --
151387 -- Upgrade strategy
151388 --
151389 l_actual_upg_option VARCHAR2(1);
151390 l_enc_upg_option VARCHAR2(1);
151391
151392 --
151393 BEGIN
151394 --
151395 IF g_log_enabled THEN
151396 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_377';
151397 END IF;
151398 --
151402 (p_msg => 'BEGIN of AcctLineType_377'
151399 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
151400
151401 trace
151403 ,p_level => C_LEVEL_PROCEDURE
151404 ,p_module => l_log_module);
151405
151406 END IF;
151407 --
151408 l_component_type := 'AMB_JLT';
151409 l_component_code := 'FA_TAX_DEP_RESERVE';
151410 l_component_type_code := 'S';
151411 l_component_appl_id := 140;
151412 l_amb_context_code := 'DEFAULT';
151413 l_entity_code := 'TRANSACTIONS';
151414 l_event_class_code := 'DEPRECIATION_ADJUSTMENTS';
151415 l_event_type_code := 'DEPRECIATION_ADJUSTMENTS_ALL';
151416 l_line_definition_owner_code := 'S';
151417 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_DEPRE15';
151418 --
151419 l_balance_type_code := 'A';
151420 l_segment := NULL;
151421 l_ccid := NULL;
151422 l_adr_transaction_coa_id := NULL;
151423 l_adr_accounting_coa_id := NULL;
151424 l_adr_flexfield_segment_code := NULL;
151425 l_adr_flex_value_set_id := NULL;
151426 l_adr_value_type_code := NULL;
151427 l_adr_value_combination_id := NULL;
151428 l_adr_value_segment_code := NULL;
151429
151430 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
151431 l_bflow_class_code := ''; -- 4219869 Business Flow
151432 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
151433 l_budgetary_control_flag := 'N';
151434
151435 l_bflow_applied_to_amt_idx := NULL; -- 5132302
151436 l_bflow_applied_to_amt := NULL; -- 5132302
151437 l_entered_amt_idx := NULL; -- 4262811
151438 l_accted_amt_idx := NULL; -- 4262811
151439 l_acc_rev_flag := NULL; -- 4262811
151440 l_accrual_line_num := NULL; -- 4262811
151441 l_tmp_amt := NULL; -- 4262811
151442 --
151443
151444 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
151445 l_balance_type_code <> 'B' THEN
151446 IF NVL(p_source_48,'
151447 ') = 'DEPRN ADJUST' OR
151448 NVL(p_source_48,'
151449 ') = 'EXPENSE'
151450 THEN
151451
151452 --
151453 XLA_AE_LINES_PKG.SetNewLine;
151454
151455 p_balance_type_code := l_balance_type_code;
151456 -- set the flag so later we will know whether the gain loss line needs to be created
151457
151458 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
151459 p_actual_flag :='A';
151460 END IF;
151461
151462 --
151463 -- bulk performance
151464 --
151465 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
151466 p_header_num => 0); -- 4262811
151467 --
151468 -- set accounting line options
151469 --
151470 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
151471 p_natural_side_code => 'C'
151472 , p_gain_or_loss_flag => 'N'
151473 , p_gl_transfer_mode_code => 'S'
151474 , p_acct_entry_type_code => 'A'
151475 , p_switch_side_flag => 'Y'
151476 , p_merge_duplicate_code => 'N'
151477 );
151478 --
151479 l_acc_rev_natural_side_code := 'D'; -- 4262811
151480 --
151481 --
151482 -- set accounting line type info
151483 --
151484 xla_ae_lines_pkg.SetAcctLineType
151485 (p_component_type => l_component_type
151486 ,p_event_type_code => l_event_type_code
151487 ,p_line_definition_owner_code => l_line_definition_owner_code
151488 ,p_line_definition_code => l_line_definition_code
151489 ,p_accounting_line_code => l_component_code
151490 ,p_accounting_line_type_code => l_component_type_code
151491 ,p_accounting_line_appl_id => l_component_appl_id
151492 ,p_amb_context_code => l_amb_context_code
151493 ,p_entity_code => l_entity_code
151494 ,p_event_class_code => l_event_class_code);
151495 --
151496 -- set accounting class
151497 --
151498 xla_ae_lines_pkg.SetAcctClass(
151499 p_accounting_class_code => 'ASSET'
151500 , p_ae_header_id => l_ae_header_id
151501 );
151502
151503 --
151504 -- set rounding class
151505 --
151506 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
151507 'ASSET';
151508
151509 --
151510 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
151511 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
151512 --
151513 -- bulk performance
151514 --
151515 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
151516
151517 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
151518 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
151519
151520 -- 4955764
151521 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
151522 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
151523
151524 -- 4458381 Public Sector Enh
151525
151526 --
151530 l_accted_amt_idx := 6;
151527 -- set accounting attributes for the line type
151528 --
151529 l_entered_amt_idx := 4;
151531 l_bflow_applied_to_amt_idx := NULL; -- 5132302
151532 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
151533 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
151534 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
151535 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
151536 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
151537 l_rec_acct_attrs.array_char_value(3) := p_source_51;
151538 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
151539 l_rec_acct_attrs.array_num_value(4) := p_source_52;
151540 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
151541 l_rec_acct_attrs.array_char_value(5) := p_source_53;
151542 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
151543 l_rec_acct_attrs.array_num_value(6) := p_source_52;
151544
151545 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
151546 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
151547
151548 ---------------------------------------------------------------------------------------------------------------
151549 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
151550 ---------------------------------------------------------------------------------------------------------------
151551 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
151552
151553 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
151554 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
151555
151556 IF xla_accounting_cache_pkg.GetValueChar
151557 (p_source_code => 'LEDGER_CATEGORY_CODE'
151558 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
151559 AND l_bflow_method_code = 'PRIOR_ENTRY'
151560 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
151561 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
151562 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
151563 )
151564 THEN
151565 xla_ae_lines_pkg.BflowUpgEntry
151566 (p_business_method_code => l_bflow_method_code
151567 ,p_business_class_code => l_bflow_class_code
151568 ,p_balance_type => l_balance_type_code);
151569 ELSE
151570 NULL;
151571 -- No business flow processing for business flow method of NONE.
151572 END IF;
151573
151574 --
151575 -- call analytical criteria
151576 --
151577
151578 --
151579 -- call description
151580 --
151581
151582 xla_ae_lines_pkg.SetLineDescription(
151583 p_ae_header_id => l_ae_header_id
151584 ,p_description => Description_118 (
151585 p_application_id => p_application_id
151586 , p_ae_header_id => l_ae_header_id
151587 , p_source_1 => p_source_1
151588 )
151589 );
151590
151591
151592 --
151593 -- call ADRs
151594 -- Bug 4922099
151595 --
151596 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
151597 (NVL(l_actual_upg_option, 'N') = 'O') OR
151598 (NVL(l_enc_upg_option, 'N') = 'O')
151599 )
151600 THEN
151601 NULL;
151602 --
151603 --
151604
151605 l_ccid := AcctDerRule_175(
151606 p_application_id => p_application_id
151607 , p_ae_header_id => l_ae_header_id
151608 , p_source_5 => p_source_5
151609 , p_source_19 => p_source_19
151610 , p_source_32 => p_source_32
151611 , x_transaction_coa_id => l_adr_transaction_coa_id
151612 , x_accounting_coa_id => l_adr_accounting_coa_id
151613 , x_value_type_code => l_adr_value_type_code
151614 , p_side => 'NA'
151615 );
151616
151617 xla_ae_lines_pkg.set_ccid(
151618 p_code_combination_id => l_ccid
151619 , p_value_type_code => l_adr_value_type_code
151620 , p_transaction_coa_id => l_adr_transaction_coa_id
151621 , p_accounting_coa_id => l_adr_accounting_coa_id
151622 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
151623 , p_adr_type_code => 'S'
151624 , p_component_type => l_component_type
151625 , p_component_code => l_component_code
151626 , p_component_type_code => l_component_type_code
151627 , p_component_appl_id => l_component_appl_id
151628 , p_amb_context_code => l_amb_context_code
151629 , p_side => 'NA'
151630 );
151631
151632
151633 l_segment := AcctDerRule_150(
151634 p_application_id => p_application_id
151635 , p_ae_header_id => l_ae_header_id
151636 , p_source_5 => p_source_5
151637 , p_source_12 => p_source_12
151638 , x_transaction_coa_id => l_adr_transaction_coa_id
151639 , x_accounting_coa_id => l_adr_accounting_coa_id
151640 , x_flexfield_segment_code => l_adr_flexfield_segment_code
151641 , x_flex_value_set_id => l_adr_flex_value_set_id
151642 , x_value_type_code => l_adr_value_type_code
151646 , p_override_seg_flag => 'Y'
151643 , x_value_combination_id => l_adr_value_combination_id
151644 , x_value_segment_code => l_adr_value_segment_code
151645 , p_side => 'NA'
151647 );
151648
151649 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
151650
151651 xla_ae_lines_pkg.set_segment(
151652 p_to_segment_code => 'GL_ACCOUNT'
151653 , p_segment_value => l_segment
151654 , p_from_segment_code => l_adr_value_segment_code
151655 , p_from_combination_id => l_adr_value_combination_id
151656 , p_value_type_code => l_adr_value_type_code
151657 , p_transaction_coa_id => l_adr_transaction_coa_id
151658 , p_accounting_coa_id => l_adr_accounting_coa_id
151659 , p_flexfield_segment_code => l_adr_flexfield_segment_code
151660 , p_flex_value_set_id => l_adr_flex_value_set_id
151661 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
151662 , p_adr_type_code => 'S'
151663 , p_component_type => l_component_type
151664 , p_component_code => l_component_code
151665 , p_component_type_code => l_component_type_code
151666 , p_component_appl_id => l_component_appl_id
151667 , p_amb_context_code => l_amb_context_code
151668 , p_entity_code => 'TRANSACTIONS'
151669 , p_event_class_code => 'DEPRECIATION_ADJUSTMENTS'
151670 , p_side => 'NA'
151671 );
151672
151673 END IF;
151674
151675 l_segment := AcctDerRule_169(
151676 p_application_id => p_application_id
151677 , p_ae_header_id => l_ae_header_id
151678 , p_source_5 => p_source_5
151679 , p_source_31 => p_source_31
151680 , x_transaction_coa_id => l_adr_transaction_coa_id
151681 , x_accounting_coa_id => l_adr_accounting_coa_id
151682 , x_flexfield_segment_code => l_adr_flexfield_segment_code
151683 , x_flex_value_set_id => l_adr_flex_value_set_id
151684 , x_value_type_code => l_adr_value_type_code
151685 , x_value_combination_id => l_adr_value_combination_id
151686 , x_value_segment_code => l_adr_value_segment_code
151687 , p_side => 'NA'
151688 , p_override_seg_flag => 'Y'
151689 );
151690
151691 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
151692
151693 xla_ae_lines_pkg.set_segment(
151694 p_to_segment_code => 'GL_BALANCING'
151695 , p_segment_value => l_segment
151696 , p_from_segment_code => l_adr_value_segment_code
151697 , p_from_combination_id => l_adr_value_combination_id
151698 , p_value_type_code => l_adr_value_type_code
151699 , p_transaction_coa_id => l_adr_transaction_coa_id
151700 , p_accounting_coa_id => l_adr_accounting_coa_id
151701 , p_flexfield_segment_code => l_adr_flexfield_segment_code
151702 , p_flex_value_set_id => l_adr_flex_value_set_id
151703 , p_adr_code => 'FA_EXPENSE_ACCT'
151704 , p_adr_type_code => 'S'
151705 , p_component_type => l_component_type
151706 , p_component_code => l_component_code
151707 , p_component_type_code => l_component_type_code
151708 , p_component_appl_id => l_component_appl_id
151709 , p_amb_context_code => l_amb_context_code
151710 , p_entity_code => 'TRANSACTIONS'
151711 , p_event_class_code => 'DEPRECIATION_ADJUSTMENTS'
151712 , p_side => 'NA'
151713 );
151714
151715 END IF;
151716
151717 --
151718 --
151719 END IF;
151720 --
151721 -- Bug 4922099
151722 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
151723 (NVL(l_enc_upg_option, 'N') = 'O')
151724 ) AND
151725 (l_bflow_method_code = 'PRIOR_ENTRY')
151726 )
151727 THEN
151728 IF
151729 --
151730 1 = 2
151731 --
151732 THEN
151733 xla_accounting_err_pkg.build_message
151734 (p_appli_s_name => 'XLA'
151735 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
151736 ,p_token_1 => 'LINE_NUMBER'
151737 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
151738 ,p_token_2 => 'LINE_TYPE_NAME'
151739 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
151740 l_component_type
151741 ,l_component_code
151742 ,l_component_type_code
151743 ,l_component_appl_id
151744 ,l_amb_context_code
151745 ,l_entity_code
151746 ,l_event_class_code
151747 )
151748 ,p_token_3 => 'OWNER'
151752 )
151749 ,p_value_3 => xla_lookups_pkg.get_meaning(
151750 p_lookup_type => 'XLA_OWNER_TYPE'
151751 ,p_lookup_code => l_component_type_code
151753 ,p_token_4 => 'PRODUCT_NAME'
151754 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
151755 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
151756 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
151757 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
151758 ,p_ae_header_id => NULL
151759 );
151760
151761 IF (C_LEVEL_ERROR>= g_log_level) THEN
151762 trace
151763 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
151764 ,p_level => C_LEVEL_ERROR
151765 ,p_module => l_log_module);
151766 END IF;
151767 END IF;
151768 END IF;
151769 --
151770 --
151771 ------------------------------------------------------------------------------------------------
151772 -- 4219869 Business Flow
151773 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
151774 -- Prior Entry. Currently, the following code is always generated.
151775 ------------------------------------------------------------------------------------------------
151776 XLA_AE_LINES_PKG.ValidateCurrentLine;
151777
151778 ------------------------------------------------------------------------------------
151779 -- 4219869 Business Flow
151780 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
151781 ------------------------------------------------------------------------------------
151782 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
151783
151784 ----------------------------------------------------------------------------------
151785 -- 4219869 Business Flow
151786 -- Update journal entry status -- Need to generate this within IF <condition>
151787 ----------------------------------------------------------------------------------
151788 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
151789 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
151790 ,p_balance_type_code => l_balance_type_code
151791 );
151792
151793 -------------------------------------------------------------------------------------------
151794 -- 4262811 - Generate the Accrual Reversal lines
151795 -------------------------------------------------------------------------------------------
151796 BEGIN
151797 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
151798 (g_array_event(p_event_id).array_value_num('header_index'));
151799 IF l_acc_rev_flag IS NULL THEN
151800 l_acc_rev_flag := 'N';
151801 END IF;
151802 EXCEPTION
151803 WHEN OTHERS THEN
151804 l_acc_rev_flag := 'N';
151805 END;
151806 --
151807 IF (l_acc_rev_flag = 'Y') THEN
151808
151809 -- 4645092 ------------------------------------------------------------------------------
151810 -- To allow MPA report to determine if it should generate report process
151811 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
151812 ------------------------------------------------------------------------------------------
151813
151814 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
151815 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
151816 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
151817 -- call ADRs
151818 -- Bug 4922099
151819 --
151820 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
151821 (NVL(l_actual_upg_option, 'N') = 'O') OR
151822 (NVL(l_enc_upg_option, 'N') = 'O')
151823 )
151824 THEN
151825 NULL;
151826 --
151827 --
151828
151829 l_ccid := AcctDerRule_175(
151830 p_application_id => p_application_id
151831 , p_ae_header_id => l_ae_header_id
151832 , p_source_5 => p_source_5
151833 , p_source_19 => p_source_19
151834 , p_source_32 => p_source_32
151835 , x_transaction_coa_id => l_adr_transaction_coa_id
151836 , x_accounting_coa_id => l_adr_accounting_coa_id
151837 , x_value_type_code => l_adr_value_type_code
151838 , p_side => 'NA'
151839 );
151840
151841 xla_ae_lines_pkg.set_ccid(
151842 p_code_combination_id => l_ccid
151843 , p_value_type_code => l_adr_value_type_code
151844 , p_transaction_coa_id => l_adr_transaction_coa_id
151845 , p_accounting_coa_id => l_adr_accounting_coa_id
151846 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
151847 , p_adr_type_code => 'S'
151848 , p_component_type => l_component_type
151849 , p_component_code => l_component_code
151850 , p_component_type_code => l_component_type_code
151851 , p_component_appl_id => l_component_appl_id
151855
151852 , p_amb_context_code => l_amb_context_code
151853 , p_side => 'NA'
151854 );
151856
151857 l_segment := AcctDerRule_150(
151858 p_application_id => p_application_id
151859 , p_ae_header_id => l_ae_header_id
151860 , p_source_5 => p_source_5
151861 , p_source_12 => p_source_12
151862 , x_transaction_coa_id => l_adr_transaction_coa_id
151863 , x_accounting_coa_id => l_adr_accounting_coa_id
151864 , x_flexfield_segment_code => l_adr_flexfield_segment_code
151865 , x_flex_value_set_id => l_adr_flex_value_set_id
151866 , x_value_type_code => l_adr_value_type_code
151867 , x_value_combination_id => l_adr_value_combination_id
151868 , x_value_segment_code => l_adr_value_segment_code
151869 , p_side => 'NA'
151870 , p_override_seg_flag => 'Y'
151871 );
151872
151873 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
151874
151875 xla_ae_lines_pkg.set_segment(
151876 p_to_segment_code => 'GL_ACCOUNT'
151877 , p_segment_value => l_segment
151878 , p_from_segment_code => l_adr_value_segment_code
151879 , p_from_combination_id => l_adr_value_combination_id
151880 , p_value_type_code => l_adr_value_type_code
151881 , p_transaction_coa_id => l_adr_transaction_coa_id
151882 , p_accounting_coa_id => l_adr_accounting_coa_id
151883 , p_flexfield_segment_code => l_adr_flexfield_segment_code
151884 , p_flex_value_set_id => l_adr_flex_value_set_id
151885 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
151886 , p_adr_type_code => 'S'
151887 , p_component_type => l_component_type
151888 , p_component_code => l_component_code
151889 , p_component_type_code => l_component_type_code
151890 , p_component_appl_id => l_component_appl_id
151891 , p_amb_context_code => l_amb_context_code
151892 , p_entity_code => 'TRANSACTIONS'
151893 , p_event_class_code => 'DEPRECIATION_ADJUSTMENTS'
151894 , p_side => 'NA'
151895 );
151896
151897 END IF;
151898
151899 l_segment := AcctDerRule_169(
151900 p_application_id => p_application_id
151901 , p_ae_header_id => l_ae_header_id
151902 , p_source_5 => p_source_5
151903 , p_source_31 => p_source_31
151904 , x_transaction_coa_id => l_adr_transaction_coa_id
151905 , x_accounting_coa_id => l_adr_accounting_coa_id
151906 , x_flexfield_segment_code => l_adr_flexfield_segment_code
151907 , x_flex_value_set_id => l_adr_flex_value_set_id
151908 , x_value_type_code => l_adr_value_type_code
151909 , x_value_combination_id => l_adr_value_combination_id
151910 , x_value_segment_code => l_adr_value_segment_code
151911 , p_side => 'NA'
151912 , p_override_seg_flag => 'Y'
151913 );
151914
151915 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
151916
151917 xla_ae_lines_pkg.set_segment(
151918 p_to_segment_code => 'GL_BALANCING'
151919 , p_segment_value => l_segment
151920 , p_from_segment_code => l_adr_value_segment_code
151921 , p_from_combination_id => l_adr_value_combination_id
151922 , p_value_type_code => l_adr_value_type_code
151923 , p_transaction_coa_id => l_adr_transaction_coa_id
151924 , p_accounting_coa_id => l_adr_accounting_coa_id
151925 , p_flexfield_segment_code => l_adr_flexfield_segment_code
151926 , p_flex_value_set_id => l_adr_flex_value_set_id
151927 , p_adr_code => 'FA_EXPENSE_ACCT'
151928 , p_adr_type_code => 'S'
151929 , p_component_type => l_component_type
151930 , p_component_code => l_component_code
151931 , p_component_type_code => l_component_type_code
151932 , p_component_appl_id => l_component_appl_id
151933 , p_amb_context_code => l_amb_context_code
151934 , p_entity_code => 'TRANSACTIONS'
151935 , p_event_class_code => 'DEPRECIATION_ADJUSTMENTS'
151936 , p_side => 'NA'
151937 );
151938
151939 END IF;
151940
151941 --
151942 --
151943 END IF;
151944
151945 --
151946 -- Update the line information that should be overwritten
151947 --
151948 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
151949 p_header_num => 1);
151950 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
151951
151952 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
151953
151954 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
151955 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
151956 END IF;
151957
151958 --
151959 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
151960 --
151961 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
151965 -- 4262811a Switch Sign
151962 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
151963 ELSE
151964 ---------------------------------------------------------------------------------------------------
151966 ---------------------------------------------------------------------------------------------------
151967 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
151968 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
151969 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
151970 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
151971 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
151972 -- 5132302
151973 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
151974 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
151975
151976 END IF;
151977
151978 -- 4955764
151979 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
151980 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
151981
151982
151983 XLA_AE_LINES_PKG.ValidateCurrentLine;
151984 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
151985
151986 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
151987 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
151988 ,p_balance_type_code => l_balance_type_code);
151989
151990 END IF;
151991
151992 -----------------------------------------------------------------------------------------
151993 -- 4262811 Multiperiod Accounting
151994 -----------------------------------------------------------------------------------------
151995 -- No MPA option is assigned.
151996
151997
151998 END IF;
151999 END IF;
152000 --
152001
152002 --
152003 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
152004 trace
152005 (p_msg => 'END of AcctLineType_377'
152006 ,p_level => C_LEVEL_PROCEDURE
152007 ,p_module => l_log_module);
152008 END IF;
152009 --
152010 EXCEPTION
152011 WHEN xla_exceptions_pkg.application_exception THEN
152012 RAISE;
152013 WHEN OTHERS THEN
152014 xla_exceptions_pkg.raise_message
152015 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_377');
152016 END AcctLineType_377;
152017 --
152018
152019 ---------------------------------------
152020 --
152021 -- PRIVATE FUNCTION
152022 -- AcctLineType_378
152023 --
152024 ---------------------------------------
152025 PROCEDURE AcctLineType_378 (
152026 p_application_id IN NUMBER
152027 ,p_event_id IN NUMBER
152028 ,p_calculate_acctd_flag IN VARCHAR2
152029 ,p_calculate_g_l_flag IN VARCHAR2
152030 ,p_actual_flag IN OUT VARCHAR2
152031 ,p_balance_type_code OUT VARCHAR2
152032 ,p_gain_or_loss_ref OUT VARCHAR2
152033
152034 --Period Close Date
152035 , p_source_1 IN DATE
152036 --Generated Code Combination Identifier
152037 , p_source_5 IN NUMBER
152038 --Net Book Value Retired Gain Account
152039 , p_source_23 IN VARCHAR2
152040 --Expense Account Code Combination Identifier
152041 , p_source_31 IN NUMBER
152042 --Default Code Combination Identifier
152043 , p_source_32 IN NUMBER
152044 --Adjustment Type
152045 , p_source_48 IN VARCHAR2
152046 --Transaction Header Identifier
152047 , p_source_49 IN NUMBER
152048 --Adjustment Line Identifier
152049 , p_source_50 IN NUMBER
152050 --Distribution Type Code
152051 , p_source_51 IN VARCHAR2
152052 --Entered Amount
152053 , p_source_52 IN NUMBER
152054 --Currency Code
152055 , p_source_53 IN VARCHAR2
152056 )
152057 IS
152058
152059 l_component_type VARCHAR2(80);
152060 l_component_code VARCHAR2(30);
152061 l_component_type_code VARCHAR2(1);
152062 l_component_appl_id INTEGER;
152063 l_amb_context_code VARCHAR2(30);
152064 l_entity_code VARCHAR2(30);
152065 l_event_class_code VARCHAR2(30);
152066 l_ae_header_id NUMBER;
152067 l_event_type_code VARCHAR2(30);
152068 l_line_definition_code VARCHAR2(30);
152069 l_line_definition_owner_code VARCHAR2(1);
152070 --
152071 -- adr variables
152072 l_segment VARCHAR2(30);
152073 l_ccid NUMBER;
152074 l_adr_transaction_coa_id NUMBER;
152075 l_adr_accounting_coa_id NUMBER;
152076 l_adr_flexfield_segment_code VARCHAR2(30);
152077 l_adr_flex_value_set_id NUMBER;
152078 l_adr_value_type_code VARCHAR2(30);
152079 l_adr_value_combination_id NUMBER;
152080 l_adr_value_segment_code VARCHAR2(30);
152081
152082 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
152083 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
152084 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
152085 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
152086
152090 l_acc_rev_flag VARCHAR2(1);
152087 -- 4262811 Variables ------------------------------------------------------------------------------------------
152088 l_entered_amt_idx NUMBER;
152089 l_accted_amt_idx NUMBER;
152091 l_accrual_line_num NUMBER;
152092 l_tmp_amt NUMBER;
152093 l_acc_rev_natural_side_code VARCHAR2(1);
152094
152095 l_num_entries NUMBER;
152096 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
152097 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
152098 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
152099 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
152100 l_recog_line_1 NUMBER;
152101 l_recog_line_2 NUMBER;
152102
152103 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
152104 l_bflow_applied_to_amt NUMBER; -- 5132302
152105 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
152106
152107 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
152108
152109 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
152110 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
152111
152112 ---------------------------------------------------------------------------------------------------------------
152113
152114
152115 --
152116 -- bulk performance
152117 --
152118 l_balance_type_code VARCHAR2(1);
152119 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
152120 l_log_module VARCHAR2(240);
152121
152122 --
152123 -- Upgrade strategy
152124 --
152125 l_actual_upg_option VARCHAR2(1);
152126 l_enc_upg_option VARCHAR2(1);
152127
152128 --
152129 BEGIN
152130 --
152131 IF g_log_enabled THEN
152132 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_378';
152133 END IF;
152134 --
152135 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
152136
152137 trace
152138 (p_msg => 'BEGIN of AcctLineType_378'
152139 ,p_level => C_LEVEL_PROCEDURE
152140 ,p_module => l_log_module);
152141
152142 END IF;
152143 --
152144 l_component_type := 'AMB_JLT';
152145 l_component_code := 'FA_TGL_NBV_RETIRED_GAIN';
152146 l_component_type_code := 'S';
152147 l_component_appl_id := 140;
152148 l_amb_context_code := 'DEFAULT';
152149 l_entity_code := 'TRANSACTIONS';
152150 l_event_class_code := 'TERMINAL_GAIN_LOSS';
152151 l_event_type_code := 'TERMINAL_GAIN_LOSS_ALL';
152152 l_line_definition_owner_code := 'S';
152153 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TERMI24';
152154 --
152155 l_balance_type_code := 'A';
152156 l_segment := NULL;
152157 l_ccid := NULL;
152158 l_adr_transaction_coa_id := NULL;
152159 l_adr_accounting_coa_id := NULL;
152160 l_adr_flexfield_segment_code := NULL;
152161 l_adr_flex_value_set_id := NULL;
152162 l_adr_value_type_code := NULL;
152163 l_adr_value_combination_id := NULL;
152164 l_adr_value_segment_code := NULL;
152165
152166 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
152167 l_bflow_class_code := ''; -- 4219869 Business Flow
152168 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
152169 l_budgetary_control_flag := 'N';
152170
152171 l_bflow_applied_to_amt_idx := NULL; -- 5132302
152172 l_bflow_applied_to_amt := NULL; -- 5132302
152173 l_entered_amt_idx := NULL; -- 4262811
152174 l_accted_amt_idx := NULL; -- 4262811
152175 l_acc_rev_flag := NULL; -- 4262811
152176 l_accrual_line_num := NULL; -- 4262811
152177 l_tmp_amt := NULL; -- 4262811
152178 --
152179
152180 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
152181 l_balance_type_code <> 'B' THEN
152182 IF NVL(p_source_48,'
152183 ') = 'NBV RETIRED' AND
152184 p_source_52 > 0
152185 THEN
152186
152187 --
152188 XLA_AE_LINES_PKG.SetNewLine;
152189
152190 p_balance_type_code := l_balance_type_code;
152191 -- set the flag so later we will know whether the gain loss line needs to be created
152192
152193 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
152194 p_actual_flag :='A';
152195 END IF;
152196
152197 --
152198 -- bulk performance
152199 --
152200 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
152201 p_header_num => 0); -- 4262811
152202 --
152203 -- set accounting line options
152204 --
152205 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
152206 p_natural_side_code => 'D'
152207 , p_gain_or_loss_flag => 'N'
152208 , p_gl_transfer_mode_code => 'S'
152209 , p_acct_entry_type_code => 'A'
152210 , p_switch_side_flag => 'Y'
152211 , p_merge_duplicate_code => 'N'
152212 );
152213 --
152214 l_acc_rev_natural_side_code := 'C'; -- 4262811
152215 --
152216 --
152217 -- set accounting line type info
152221 ,p_event_type_code => l_event_type_code
152218 --
152219 xla_ae_lines_pkg.SetAcctLineType
152220 (p_component_type => l_component_type
152222 ,p_line_definition_owner_code => l_line_definition_owner_code
152223 ,p_line_definition_code => l_line_definition_code
152224 ,p_accounting_line_code => l_component_code
152225 ,p_accounting_line_type_code => l_component_type_code
152226 ,p_accounting_line_appl_id => l_component_appl_id
152227 ,p_amb_context_code => l_amb_context_code
152228 ,p_entity_code => l_entity_code
152229 ,p_event_class_code => l_event_class_code);
152230 --
152231 -- set accounting class
152232 --
152233 xla_ae_lines_pkg.SetAcctClass(
152234 p_accounting_class_code => 'ASSET'
152235 , p_ae_header_id => l_ae_header_id
152236 );
152237
152238 --
152239 -- set rounding class
152240 --
152241 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
152242 'ASSET';
152243
152244 --
152245 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
152246 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
152247 --
152248 -- bulk performance
152249 --
152250 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
152251
152252 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
152253 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
152254
152255 -- 4955764
152256 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
152257 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
152258
152259 -- 4458381 Public Sector Enh
152260
152261 --
152262 -- set accounting attributes for the line type
152263 --
152264 l_entered_amt_idx := 4;
152265 l_accted_amt_idx := 6;
152266 l_bflow_applied_to_amt_idx := NULL; -- 5132302
152267 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
152268 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
152269 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
152270 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
152271 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
152272 l_rec_acct_attrs.array_char_value(3) := p_source_51;
152273 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
152274 l_rec_acct_attrs.array_num_value(4) := p_source_52;
152275 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
152276 l_rec_acct_attrs.array_char_value(5) := p_source_53;
152277 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
152278 l_rec_acct_attrs.array_num_value(6) := p_source_52;
152279
152280 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
152281 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
152282
152283 ---------------------------------------------------------------------------------------------------------------
152284 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
152285 ---------------------------------------------------------------------------------------------------------------
152286 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
152287
152288 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
152289 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
152290
152291 IF xla_accounting_cache_pkg.GetValueChar
152292 (p_source_code => 'LEDGER_CATEGORY_CODE'
152293 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
152294 AND l_bflow_method_code = 'PRIOR_ENTRY'
152295 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
152296 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
152297 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
152298 )
152299 THEN
152300 xla_ae_lines_pkg.BflowUpgEntry
152301 (p_business_method_code => l_bflow_method_code
152302 ,p_business_class_code => l_bflow_class_code
152303 ,p_balance_type => l_balance_type_code);
152304 ELSE
152305 NULL;
152306 -- No business flow processing for business flow method of NONE.
152307 END IF;
152308
152309 --
152310 -- call analytical criteria
152311 --
152312
152313 --
152314 -- call description
152315 --
152316
152317 xla_ae_lines_pkg.SetLineDescription(
152318 p_ae_header_id => l_ae_header_id
152319 ,p_description => Description_120 (
152320 p_application_id => p_application_id
152321 , p_ae_header_id => l_ae_header_id
152322 , p_source_1 => p_source_1
152323 )
152324 );
152325
152326
152327 --
152328 -- call ADRs
152329 -- Bug 4922099
152330 --
152331 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
152332 (NVL(l_actual_upg_option, 'N') = 'O') OR
152333 (NVL(l_enc_upg_option, 'N') = 'O')
152334 )
152335 THEN
152336 NULL;
152337 --
152338 --
152339
152343 , p_source_5 => p_source_5
152340 l_ccid := AcctDerRule_174(
152341 p_application_id => p_application_id
152342 , p_ae_header_id => l_ae_header_id
152344 , p_source_32 => p_source_32
152345 , x_transaction_coa_id => l_adr_transaction_coa_id
152346 , x_accounting_coa_id => l_adr_accounting_coa_id
152347 , x_value_type_code => l_adr_value_type_code
152348 , p_side => 'NA'
152349 );
152350
152351 xla_ae_lines_pkg.set_ccid(
152352 p_code_combination_id => l_ccid
152353 , p_value_type_code => l_adr_value_type_code
152354 , p_transaction_coa_id => l_adr_transaction_coa_id
152355 , p_accounting_coa_id => l_adr_accounting_coa_id
152356 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
152357 , p_adr_type_code => 'S'
152358 , p_component_type => l_component_type
152359 , p_component_code => l_component_code
152360 , p_component_type_code => l_component_type_code
152361 , p_component_appl_id => l_component_appl_id
152362 , p_amb_context_code => l_amb_context_code
152363 , p_side => 'NA'
152364 );
152365
152366
152367 l_segment := AcctDerRule_169(
152368 p_application_id => p_application_id
152369 , p_ae_header_id => l_ae_header_id
152370 , p_source_5 => p_source_5
152371 , p_source_31 => p_source_31
152372 , x_transaction_coa_id => l_adr_transaction_coa_id
152373 , x_accounting_coa_id => l_adr_accounting_coa_id
152374 , x_flexfield_segment_code => l_adr_flexfield_segment_code
152375 , x_flex_value_set_id => l_adr_flex_value_set_id
152376 , x_value_type_code => l_adr_value_type_code
152377 , x_value_combination_id => l_adr_value_combination_id
152378 , x_value_segment_code => l_adr_value_segment_code
152379 , p_side => 'NA'
152380 , p_override_seg_flag => 'Y'
152381 );
152382
152383 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
152384
152385 xla_ae_lines_pkg.set_segment(
152386 p_to_segment_code => 'GL_BALANCING'
152387 , p_segment_value => l_segment
152388 , p_from_segment_code => l_adr_value_segment_code
152389 , p_from_combination_id => l_adr_value_combination_id
152390 , p_value_type_code => l_adr_value_type_code
152391 , p_transaction_coa_id => l_adr_transaction_coa_id
152392 , p_accounting_coa_id => l_adr_accounting_coa_id
152393 , p_flexfield_segment_code => l_adr_flexfield_segment_code
152394 , p_flex_value_set_id => l_adr_flex_value_set_id
152395 , p_adr_code => 'FA_EXPENSE_ACCT'
152396 , p_adr_type_code => 'S'
152397 , p_component_type => l_component_type
152398 , p_component_code => l_component_code
152399 , p_component_type_code => l_component_type_code
152400 , p_component_appl_id => l_component_appl_id
152401 , p_amb_context_code => l_amb_context_code
152402 , p_entity_code => 'TRANSACTIONS'
152403 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
152404 , p_side => 'NA'
152405 );
152406
152407 END IF;
152408
152409 l_segment := AcctDerRule_160(
152410 p_application_id => p_application_id
152411 , p_ae_header_id => l_ae_header_id
152412 , p_source_5 => p_source_5
152413 , p_source_23 => p_source_23
152414 , x_transaction_coa_id => l_adr_transaction_coa_id
152415 , x_accounting_coa_id => l_adr_accounting_coa_id
152416 , x_flexfield_segment_code => l_adr_flexfield_segment_code
152417 , x_flex_value_set_id => l_adr_flex_value_set_id
152418 , x_value_type_code => l_adr_value_type_code
152419 , x_value_combination_id => l_adr_value_combination_id
152420 , x_value_segment_code => l_adr_value_segment_code
152421 , p_side => 'NA'
152422 , p_override_seg_flag => 'Y'
152423 );
152424
152425 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
152426
152427 xla_ae_lines_pkg.set_segment(
152428 p_to_segment_code => 'GL_ACCOUNT'
152429 , p_segment_value => l_segment
152430 , p_from_segment_code => l_adr_value_segment_code
152431 , p_from_combination_id => l_adr_value_combination_id
152432 , p_value_type_code => l_adr_value_type_code
152433 , p_transaction_coa_id => l_adr_transaction_coa_id
152434 , p_accounting_coa_id => l_adr_accounting_coa_id
152435 , p_flexfield_segment_code => l_adr_flexfield_segment_code
152436 , p_flex_value_set_id => l_adr_flex_value_set_id
152437 , p_adr_code => 'FA_NBV_RETIRED_GAIN_SEGMENT'
152438 , p_adr_type_code => 'S'
152439 , p_component_type => l_component_type
152440 , p_component_code => l_component_code
152441 , p_component_type_code => l_component_type_code
152442 , p_component_appl_id => l_component_appl_id
152443 , p_amb_context_code => l_amb_context_code
152444 , p_entity_code => 'TRANSACTIONS'
152445 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
152449 END IF;
152446 , p_side => 'NA'
152447 );
152448
152450
152451 --
152452 --
152453 END IF;
152454 --
152455 -- Bug 4922099
152456 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
152457 (NVL(l_enc_upg_option, 'N') = 'O')
152458 ) AND
152459 (l_bflow_method_code = 'PRIOR_ENTRY')
152460 )
152461 THEN
152462 IF
152463 --
152464 1 = 2
152465 --
152466 THEN
152467 xla_accounting_err_pkg.build_message
152468 (p_appli_s_name => 'XLA'
152469 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
152470 ,p_token_1 => 'LINE_NUMBER'
152471 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
152472 ,p_token_2 => 'LINE_TYPE_NAME'
152473 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
152474 l_component_type
152475 ,l_component_code
152476 ,l_component_type_code
152477 ,l_component_appl_id
152478 ,l_amb_context_code
152479 ,l_entity_code
152480 ,l_event_class_code
152481 )
152482 ,p_token_3 => 'OWNER'
152483 ,p_value_3 => xla_lookups_pkg.get_meaning(
152484 p_lookup_type => 'XLA_OWNER_TYPE'
152485 ,p_lookup_code => l_component_type_code
152486 )
152487 ,p_token_4 => 'PRODUCT_NAME'
152488 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
152489 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
152490 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
152491 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
152492 ,p_ae_header_id => NULL
152493 );
152494
152495 IF (C_LEVEL_ERROR>= g_log_level) THEN
152496 trace
152497 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
152498 ,p_level => C_LEVEL_ERROR
152499 ,p_module => l_log_module);
152500 END IF;
152501 END IF;
152502 END IF;
152503 --
152504 --
152505 ------------------------------------------------------------------------------------------------
152506 -- 4219869 Business Flow
152507 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
152508 -- Prior Entry. Currently, the following code is always generated.
152509 ------------------------------------------------------------------------------------------------
152510 XLA_AE_LINES_PKG.ValidateCurrentLine;
152511
152512 ------------------------------------------------------------------------------------
152513 -- 4219869 Business Flow
152514 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
152515 ------------------------------------------------------------------------------------
152516 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
152517
152518 ----------------------------------------------------------------------------------
152519 -- 4219869 Business Flow
152520 -- Update journal entry status -- Need to generate this within IF <condition>
152521 ----------------------------------------------------------------------------------
152522 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
152523 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
152524 ,p_balance_type_code => l_balance_type_code
152525 );
152526
152527 -------------------------------------------------------------------------------------------
152528 -- 4262811 - Generate the Accrual Reversal lines
152529 -------------------------------------------------------------------------------------------
152530 BEGIN
152531 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
152532 (g_array_event(p_event_id).array_value_num('header_index'));
152533 IF l_acc_rev_flag IS NULL THEN
152534 l_acc_rev_flag := 'N';
152535 END IF;
152536 EXCEPTION
152537 WHEN OTHERS THEN
152538 l_acc_rev_flag := 'N';
152539 END;
152540 --
152541 IF (l_acc_rev_flag = 'Y') THEN
152542
152543 -- 4645092 ------------------------------------------------------------------------------
152544 -- To allow MPA report to determine if it should generate report process
152548 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
152545 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
152546 ------------------------------------------------------------------------------------------
152547
152549 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
152550 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
152551 -- call ADRs
152552 -- Bug 4922099
152553 --
152554 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
152555 (NVL(l_actual_upg_option, 'N') = 'O') OR
152556 (NVL(l_enc_upg_option, 'N') = 'O')
152557 )
152558 THEN
152559 NULL;
152560 --
152561 --
152562
152563 l_ccid := AcctDerRule_174(
152564 p_application_id => p_application_id
152565 , p_ae_header_id => l_ae_header_id
152566 , p_source_5 => p_source_5
152567 , p_source_32 => p_source_32
152568 , x_transaction_coa_id => l_adr_transaction_coa_id
152569 , x_accounting_coa_id => l_adr_accounting_coa_id
152570 , x_value_type_code => l_adr_value_type_code
152571 , p_side => 'NA'
152572 );
152573
152574 xla_ae_lines_pkg.set_ccid(
152575 p_code_combination_id => l_ccid
152576 , p_value_type_code => l_adr_value_type_code
152577 , p_transaction_coa_id => l_adr_transaction_coa_id
152578 , p_accounting_coa_id => l_adr_accounting_coa_id
152579 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
152580 , p_adr_type_code => 'S'
152581 , p_component_type => l_component_type
152582 , p_component_code => l_component_code
152583 , p_component_type_code => l_component_type_code
152584 , p_component_appl_id => l_component_appl_id
152585 , p_amb_context_code => l_amb_context_code
152586 , p_side => 'NA'
152587 );
152588
152589
152590 l_segment := AcctDerRule_169(
152591 p_application_id => p_application_id
152592 , p_ae_header_id => l_ae_header_id
152593 , p_source_5 => p_source_5
152594 , p_source_31 => p_source_31
152595 , x_transaction_coa_id => l_adr_transaction_coa_id
152596 , x_accounting_coa_id => l_adr_accounting_coa_id
152597 , x_flexfield_segment_code => l_adr_flexfield_segment_code
152598 , x_flex_value_set_id => l_adr_flex_value_set_id
152599 , x_value_type_code => l_adr_value_type_code
152600 , x_value_combination_id => l_adr_value_combination_id
152601 , x_value_segment_code => l_adr_value_segment_code
152602 , p_side => 'NA'
152603 , p_override_seg_flag => 'Y'
152604 );
152605
152606 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
152607
152608 xla_ae_lines_pkg.set_segment(
152609 p_to_segment_code => 'GL_BALANCING'
152610 , p_segment_value => l_segment
152611 , p_from_segment_code => l_adr_value_segment_code
152612 , p_from_combination_id => l_adr_value_combination_id
152613 , p_value_type_code => l_adr_value_type_code
152614 , p_transaction_coa_id => l_adr_transaction_coa_id
152615 , p_accounting_coa_id => l_adr_accounting_coa_id
152616 , p_flexfield_segment_code => l_adr_flexfield_segment_code
152617 , p_flex_value_set_id => l_adr_flex_value_set_id
152618 , p_adr_code => 'FA_EXPENSE_ACCT'
152619 , p_adr_type_code => 'S'
152620 , p_component_type => l_component_type
152621 , p_component_code => l_component_code
152622 , p_component_type_code => l_component_type_code
152623 , p_component_appl_id => l_component_appl_id
152624 , p_amb_context_code => l_amb_context_code
152625 , p_entity_code => 'TRANSACTIONS'
152626 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
152627 , p_side => 'NA'
152628 );
152629
152630 END IF;
152631
152632 l_segment := AcctDerRule_160(
152633 p_application_id => p_application_id
152634 , p_ae_header_id => l_ae_header_id
152635 , p_source_5 => p_source_5
152636 , p_source_23 => p_source_23
152637 , x_transaction_coa_id => l_adr_transaction_coa_id
152638 , x_accounting_coa_id => l_adr_accounting_coa_id
152639 , x_flexfield_segment_code => l_adr_flexfield_segment_code
152640 , x_flex_value_set_id => l_adr_flex_value_set_id
152641 , x_value_type_code => l_adr_value_type_code
152642 , x_value_combination_id => l_adr_value_combination_id
152643 , x_value_segment_code => l_adr_value_segment_code
152644 , p_side => 'NA'
152645 , p_override_seg_flag => 'Y'
152646 );
152647
152648 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
152649
152650 xla_ae_lines_pkg.set_segment(
152651 p_to_segment_code => 'GL_ACCOUNT'
152652 , p_segment_value => l_segment
152653 , p_from_segment_code => l_adr_value_segment_code
152654 , p_from_combination_id => l_adr_value_combination_id
152655 , p_value_type_code => l_adr_value_type_code
152656 , p_transaction_coa_id => l_adr_transaction_coa_id
152660 , p_adr_code => 'FA_NBV_RETIRED_GAIN_SEGMENT'
152657 , p_accounting_coa_id => l_adr_accounting_coa_id
152658 , p_flexfield_segment_code => l_adr_flexfield_segment_code
152659 , p_flex_value_set_id => l_adr_flex_value_set_id
152661 , p_adr_type_code => 'S'
152662 , p_component_type => l_component_type
152663 , p_component_code => l_component_code
152664 , p_component_type_code => l_component_type_code
152665 , p_component_appl_id => l_component_appl_id
152666 , p_amb_context_code => l_amb_context_code
152667 , p_entity_code => 'TRANSACTIONS'
152668 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
152669 , p_side => 'NA'
152670 );
152671
152672 END IF;
152673
152674 --
152675 --
152676 END IF;
152677
152678 --
152679 -- Update the line information that should be overwritten
152680 --
152681 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
152682 p_header_num => 1);
152683 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
152684
152685 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
152686
152687 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
152688 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
152689 END IF;
152690
152691 --
152692 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
152693 --
152694 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
152695 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
152696 ELSE
152697 ---------------------------------------------------------------------------------------------------
152698 -- 4262811a Switch Sign
152699 ---------------------------------------------------------------------------------------------------
152700 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
152701 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
152702 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
152703 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
152704 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
152705 -- 5132302
152706 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
152707 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
152708
152709 END IF;
152710
152711 -- 4955764
152712 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
152713 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
152714
152715
152716 XLA_AE_LINES_PKG.ValidateCurrentLine;
152717 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
152718
152719 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
152720 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
152721 ,p_balance_type_code => l_balance_type_code);
152722
152723 END IF;
152724
152725 -----------------------------------------------------------------------------------------
152726 -- 4262811 Multiperiod Accounting
152727 -----------------------------------------------------------------------------------------
152728 -- No MPA option is assigned.
152729
152730
152731 END IF;
152732 END IF;
152733 --
152734
152735 --
152736 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
152737 trace
152738 (p_msg => 'END of AcctLineType_378'
152739 ,p_level => C_LEVEL_PROCEDURE
152740 ,p_module => l_log_module);
152741 END IF;
152742 --
152743 EXCEPTION
152744 WHEN xla_exceptions_pkg.application_exception THEN
152745 RAISE;
152746 WHEN OTHERS THEN
152747 xla_exceptions_pkg.raise_message
152748 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_378');
152749 END AcctLineType_378;
152750 --
152751
152752 ---------------------------------------
152753 --
152754 -- PRIVATE FUNCTION
152755 -- AcctLineType_379
152756 --
152757 ---------------------------------------
152758 PROCEDURE AcctLineType_379 (
152759 p_application_id IN NUMBER
152760 ,p_event_id IN NUMBER
152761 ,p_calculate_acctd_flag IN VARCHAR2
152762 ,p_calculate_g_l_flag IN VARCHAR2
152763 ,p_actual_flag IN OUT VARCHAR2
152764 ,p_balance_type_code OUT VARCHAR2
152765 ,p_gain_or_loss_ref OUT VARCHAR2
152766
152767 --Period Close Date
152768 , p_source_1 IN DATE
152769 --Generated Code Combination Identifier
152770 , p_source_5 IN NUMBER
152771 --Net Book Value Retired Loss Account
152772 , p_source_24 IN VARCHAR2
152773 --Expense Account Code Combination Identifier
152774 , p_source_31 IN NUMBER
152775 --Default Code Combination Identifier
152776 , p_source_32 IN NUMBER
152780 , p_source_49 IN NUMBER
152777 --Adjustment Type
152778 , p_source_48 IN VARCHAR2
152779 --Transaction Header Identifier
152781 --Adjustment Line Identifier
152782 , p_source_50 IN NUMBER
152783 --Distribution Type Code
152784 , p_source_51 IN VARCHAR2
152785 --Entered Amount
152786 , p_source_52 IN NUMBER
152787 --Currency Code
152788 , p_source_53 IN VARCHAR2
152789 )
152790 IS
152791
152792 l_component_type VARCHAR2(80);
152793 l_component_code VARCHAR2(30);
152794 l_component_type_code VARCHAR2(1);
152795 l_component_appl_id INTEGER;
152796 l_amb_context_code VARCHAR2(30);
152797 l_entity_code VARCHAR2(30);
152798 l_event_class_code VARCHAR2(30);
152799 l_ae_header_id NUMBER;
152800 l_event_type_code VARCHAR2(30);
152801 l_line_definition_code VARCHAR2(30);
152802 l_line_definition_owner_code VARCHAR2(1);
152803 --
152804 -- adr variables
152805 l_segment VARCHAR2(30);
152806 l_ccid NUMBER;
152807 l_adr_transaction_coa_id NUMBER;
152808 l_adr_accounting_coa_id NUMBER;
152809 l_adr_flexfield_segment_code VARCHAR2(30);
152810 l_adr_flex_value_set_id NUMBER;
152811 l_adr_value_type_code VARCHAR2(30);
152812 l_adr_value_combination_id NUMBER;
152813 l_adr_value_segment_code VARCHAR2(30);
152814
152815 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
152816 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
152817 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
152818 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
152819
152820 -- 4262811 Variables ------------------------------------------------------------------------------------------
152821 l_entered_amt_idx NUMBER;
152822 l_accted_amt_idx NUMBER;
152823 l_acc_rev_flag VARCHAR2(1);
152824 l_accrual_line_num NUMBER;
152825 l_tmp_amt NUMBER;
152826 l_acc_rev_natural_side_code VARCHAR2(1);
152827
152828 l_num_entries NUMBER;
152829 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
152830 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
152831 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
152832 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
152833 l_recog_line_1 NUMBER;
152834 l_recog_line_2 NUMBER;
152835
152836 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
152837 l_bflow_applied_to_amt NUMBER; -- 5132302
152838 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
152839
152840 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
152841
152842 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
152843 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
152844
152845 ---------------------------------------------------------------------------------------------------------------
152846
152847
152848 --
152849 -- bulk performance
152850 --
152851 l_balance_type_code VARCHAR2(1);
152852 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
152853 l_log_module VARCHAR2(240);
152854
152855 --
152856 -- Upgrade strategy
152857 --
152858 l_actual_upg_option VARCHAR2(1);
152859 l_enc_upg_option VARCHAR2(1);
152860
152861 --
152862 BEGIN
152863 --
152864 IF g_log_enabled THEN
152865 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_379';
152866 END IF;
152867 --
152868 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
152869
152870 trace
152871 (p_msg => 'BEGIN of AcctLineType_379'
152872 ,p_level => C_LEVEL_PROCEDURE
152873 ,p_module => l_log_module);
152874
152875 END IF;
152876 --
152877 l_component_type := 'AMB_JLT';
152878 l_component_code := 'FA_TGL_NBV_RETIRED_LOSS';
152879 l_component_type_code := 'S';
152880 l_component_appl_id := 140;
152881 l_amb_context_code := 'DEFAULT';
152882 l_entity_code := 'TRANSACTIONS';
152883 l_event_class_code := 'TERMINAL_GAIN_LOSS';
152884 l_event_type_code := 'TERMINAL_GAIN_LOSS_ALL';
152885 l_line_definition_owner_code := 'S';
152886 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TERMI24';
152887 --
152888 l_balance_type_code := 'A';
152889 l_segment := NULL;
152890 l_ccid := NULL;
152891 l_adr_transaction_coa_id := NULL;
152892 l_adr_accounting_coa_id := NULL;
152893 l_adr_flexfield_segment_code := NULL;
152894 l_adr_flex_value_set_id := NULL;
152895 l_adr_value_type_code := NULL;
152896 l_adr_value_combination_id := NULL;
152897 l_adr_value_segment_code := NULL;
152898
152899 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
152900 l_bflow_class_code := ''; -- 4219869 Business Flow
152901 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
152902 l_budgetary_control_flag := 'N';
152903
152904 l_bflow_applied_to_amt_idx := NULL; -- 5132302
152905 l_bflow_applied_to_amt := NULL; -- 5132302
152906 l_entered_amt_idx := NULL; -- 4262811
152910 l_tmp_amt := NULL; -- 4262811
152907 l_accted_amt_idx := NULL; -- 4262811
152908 l_acc_rev_flag := NULL; -- 4262811
152909 l_accrual_line_num := NULL; -- 4262811
152911 --
152912
152913 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
152914 l_balance_type_code <> 'B' THEN
152915 IF NVL(p_source_48,'
152916 ') = 'NBV RETIRED' AND
152917 p_source_52 <= 0
152918 THEN
152919
152920 --
152921 XLA_AE_LINES_PKG.SetNewLine;
152922
152923 p_balance_type_code := l_balance_type_code;
152924 -- set the flag so later we will know whether the gain loss line needs to be created
152925
152926 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
152927 p_actual_flag :='A';
152928 END IF;
152929
152930 --
152931 -- bulk performance
152932 --
152933 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
152934 p_header_num => 0); -- 4262811
152935 --
152936 -- set accounting line options
152937 --
152938 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
152939 p_natural_side_code => 'D'
152940 , p_gain_or_loss_flag => 'N'
152941 , p_gl_transfer_mode_code => 'S'
152942 , p_acct_entry_type_code => 'A'
152943 , p_switch_side_flag => 'Y'
152944 , p_merge_duplicate_code => 'N'
152945 );
152946 --
152947 l_acc_rev_natural_side_code := 'C'; -- 4262811
152948 --
152949 --
152950 -- set accounting line type info
152951 --
152952 xla_ae_lines_pkg.SetAcctLineType
152953 (p_component_type => l_component_type
152954 ,p_event_type_code => l_event_type_code
152955 ,p_line_definition_owner_code => l_line_definition_owner_code
152956 ,p_line_definition_code => l_line_definition_code
152957 ,p_accounting_line_code => l_component_code
152958 ,p_accounting_line_type_code => l_component_type_code
152959 ,p_accounting_line_appl_id => l_component_appl_id
152960 ,p_amb_context_code => l_amb_context_code
152961 ,p_entity_code => l_entity_code
152962 ,p_event_class_code => l_event_class_code);
152963 --
152964 -- set accounting class
152965 --
152966 xla_ae_lines_pkg.SetAcctClass(
152967 p_accounting_class_code => 'ASSET'
152968 , p_ae_header_id => l_ae_header_id
152969 );
152970
152971 --
152972 -- set rounding class
152973 --
152974 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
152975 'ASSET';
152976
152977 --
152978 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
152979 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
152980 --
152981 -- bulk performance
152982 --
152983 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
152984
152985 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
152986 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
152987
152988 -- 4955764
152989 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
152990 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
152991
152992 -- 4458381 Public Sector Enh
152993
152994 --
152995 -- set accounting attributes for the line type
152996 --
152997 l_entered_amt_idx := 4;
152998 l_accted_amt_idx := 6;
152999 l_bflow_applied_to_amt_idx := NULL; -- 5132302
153000 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
153001 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
153002 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
153003 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
153004 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
153005 l_rec_acct_attrs.array_char_value(3) := p_source_51;
153006 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
153007 l_rec_acct_attrs.array_num_value(4) := p_source_52;
153008 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
153009 l_rec_acct_attrs.array_char_value(5) := p_source_53;
153010 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
153011 l_rec_acct_attrs.array_num_value(6) := p_source_52;
153012
153013 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
153014 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
153015
153016 ---------------------------------------------------------------------------------------------------------------
153017 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
153018 ---------------------------------------------------------------------------------------------------------------
153019 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
153020
153021 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
153025 (p_source_code => 'LEDGER_CATEGORY_CODE'
153022 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
153023
153024 IF xla_accounting_cache_pkg.GetValueChar
153026 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
153027 AND l_bflow_method_code = 'PRIOR_ENTRY'
153028 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
153029 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
153030 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
153031 )
153032 THEN
153033 xla_ae_lines_pkg.BflowUpgEntry
153034 (p_business_method_code => l_bflow_method_code
153035 ,p_business_class_code => l_bflow_class_code
153036 ,p_balance_type => l_balance_type_code);
153037 ELSE
153038 NULL;
153039 -- No business flow processing for business flow method of NONE.
153040 END IF;
153041
153042 --
153043 -- call analytical criteria
153044 --
153045
153046 --
153047 -- call description
153048 --
153049
153050 xla_ae_lines_pkg.SetLineDescription(
153051 p_ae_header_id => l_ae_header_id
153052 ,p_description => Description_121 (
153053 p_application_id => p_application_id
153054 , p_ae_header_id => l_ae_header_id
153055 , p_source_1 => p_source_1
153056 )
153057 );
153058
153059
153060 --
153061 -- call ADRs
153062 -- Bug 4922099
153063 --
153064 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
153065 (NVL(l_actual_upg_option, 'N') = 'O') OR
153066 (NVL(l_enc_upg_option, 'N') = 'O')
153067 )
153068 THEN
153069 NULL;
153070 --
153071 --
153072
153073 l_ccid := AcctDerRule_174(
153074 p_application_id => p_application_id
153075 , p_ae_header_id => l_ae_header_id
153076 , p_source_5 => p_source_5
153077 , p_source_32 => p_source_32
153078 , x_transaction_coa_id => l_adr_transaction_coa_id
153079 , x_accounting_coa_id => l_adr_accounting_coa_id
153080 , x_value_type_code => l_adr_value_type_code
153081 , p_side => 'NA'
153082 );
153083
153084 xla_ae_lines_pkg.set_ccid(
153085 p_code_combination_id => l_ccid
153086 , p_value_type_code => l_adr_value_type_code
153087 , p_transaction_coa_id => l_adr_transaction_coa_id
153088 , p_accounting_coa_id => l_adr_accounting_coa_id
153089 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
153090 , p_adr_type_code => 'S'
153091 , p_component_type => l_component_type
153092 , p_component_code => l_component_code
153093 , p_component_type_code => l_component_type_code
153094 , p_component_appl_id => l_component_appl_id
153095 , p_amb_context_code => l_amb_context_code
153096 , p_side => 'NA'
153097 );
153098
153099
153100 l_segment := AcctDerRule_169(
153101 p_application_id => p_application_id
153102 , p_ae_header_id => l_ae_header_id
153103 , p_source_5 => p_source_5
153104 , p_source_31 => p_source_31
153105 , x_transaction_coa_id => l_adr_transaction_coa_id
153106 , x_accounting_coa_id => l_adr_accounting_coa_id
153107 , x_flexfield_segment_code => l_adr_flexfield_segment_code
153108 , x_flex_value_set_id => l_adr_flex_value_set_id
153109 , x_value_type_code => l_adr_value_type_code
153110 , x_value_combination_id => l_adr_value_combination_id
153111 , x_value_segment_code => l_adr_value_segment_code
153112 , p_side => 'NA'
153113 , p_override_seg_flag => 'Y'
153114 );
153115
153116 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
153117
153118 xla_ae_lines_pkg.set_segment(
153119 p_to_segment_code => 'GL_BALANCING'
153120 , p_segment_value => l_segment
153121 , p_from_segment_code => l_adr_value_segment_code
153122 , p_from_combination_id => l_adr_value_combination_id
153123 , p_value_type_code => l_adr_value_type_code
153124 , p_transaction_coa_id => l_adr_transaction_coa_id
153125 , p_accounting_coa_id => l_adr_accounting_coa_id
153126 , p_flexfield_segment_code => l_adr_flexfield_segment_code
153127 , p_flex_value_set_id => l_adr_flex_value_set_id
153128 , p_adr_code => 'FA_EXPENSE_ACCT'
153129 , p_adr_type_code => 'S'
153130 , p_component_type => l_component_type
153131 , p_component_code => l_component_code
153132 , p_component_type_code => l_component_type_code
153133 , p_component_appl_id => l_component_appl_id
153134 , p_amb_context_code => l_amb_context_code
153135 , p_entity_code => 'TRANSACTIONS'
153136 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
153137 , p_side => 'NA'
153138 );
153139
153140 END IF;
153141
153142 l_segment := AcctDerRule_161(
153143 p_application_id => p_application_id
153144 , p_ae_header_id => l_ae_header_id
153145 , p_source_5 => p_source_5
153146 , p_source_24 => p_source_24
153150 , x_flex_value_set_id => l_adr_flex_value_set_id
153147 , x_transaction_coa_id => l_adr_transaction_coa_id
153148 , x_accounting_coa_id => l_adr_accounting_coa_id
153149 , x_flexfield_segment_code => l_adr_flexfield_segment_code
153151 , x_value_type_code => l_adr_value_type_code
153152 , x_value_combination_id => l_adr_value_combination_id
153153 , x_value_segment_code => l_adr_value_segment_code
153154 , p_side => 'NA'
153155 , p_override_seg_flag => 'Y'
153156 );
153157
153158 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
153159
153160 xla_ae_lines_pkg.set_segment(
153161 p_to_segment_code => 'GL_ACCOUNT'
153162 , p_segment_value => l_segment
153163 , p_from_segment_code => l_adr_value_segment_code
153164 , p_from_combination_id => l_adr_value_combination_id
153165 , p_value_type_code => l_adr_value_type_code
153166 , p_transaction_coa_id => l_adr_transaction_coa_id
153167 , p_accounting_coa_id => l_adr_accounting_coa_id
153168 , p_flexfield_segment_code => l_adr_flexfield_segment_code
153169 , p_flex_value_set_id => l_adr_flex_value_set_id
153170 , p_adr_code => 'FA_NBV_RETIRED_LOSS_SEGMENT'
153171 , p_adr_type_code => 'S'
153172 , p_component_type => l_component_type
153173 , p_component_code => l_component_code
153174 , p_component_type_code => l_component_type_code
153175 , p_component_appl_id => l_component_appl_id
153176 , p_amb_context_code => l_amb_context_code
153177 , p_entity_code => 'TRANSACTIONS'
153178 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
153179 , p_side => 'NA'
153180 );
153181
153182 END IF;
153183
153184 --
153185 --
153186 END IF;
153187 --
153188 -- Bug 4922099
153189 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
153190 (NVL(l_enc_upg_option, 'N') = 'O')
153191 ) AND
153192 (l_bflow_method_code = 'PRIOR_ENTRY')
153193 )
153194 THEN
153195 IF
153196 --
153197 1 = 2
153198 --
153199 THEN
153200 xla_accounting_err_pkg.build_message
153201 (p_appli_s_name => 'XLA'
153202 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
153203 ,p_token_1 => 'LINE_NUMBER'
153204 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
153205 ,p_token_2 => 'LINE_TYPE_NAME'
153206 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
153207 l_component_type
153208 ,l_component_code
153209 ,l_component_type_code
153210 ,l_component_appl_id
153211 ,l_amb_context_code
153212 ,l_entity_code
153213 ,l_event_class_code
153214 )
153215 ,p_token_3 => 'OWNER'
153216 ,p_value_3 => xla_lookups_pkg.get_meaning(
153217 p_lookup_type => 'XLA_OWNER_TYPE'
153218 ,p_lookup_code => l_component_type_code
153219 )
153220 ,p_token_4 => 'PRODUCT_NAME'
153221 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
153222 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
153223 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
153224 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
153225 ,p_ae_header_id => NULL
153226 );
153227
153228 IF (C_LEVEL_ERROR>= g_log_level) THEN
153229 trace
153230 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
153231 ,p_level => C_LEVEL_ERROR
153232 ,p_module => l_log_module);
153233 END IF;
153234 END IF;
153235 END IF;
153236 --
153237 --
153238 ------------------------------------------------------------------------------------------------
153239 -- 4219869 Business Flow
153240 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
153241 -- Prior Entry. Currently, the following code is always generated.
153245 ------------------------------------------------------------------------------------
153242 ------------------------------------------------------------------------------------------------
153243 XLA_AE_LINES_PKG.ValidateCurrentLine;
153244
153246 -- 4219869 Business Flow
153247 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
153248 ------------------------------------------------------------------------------------
153249 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
153250
153251 ----------------------------------------------------------------------------------
153252 -- 4219869 Business Flow
153253 -- Update journal entry status -- Need to generate this within IF <condition>
153254 ----------------------------------------------------------------------------------
153255 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
153256 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
153257 ,p_balance_type_code => l_balance_type_code
153258 );
153259
153260 -------------------------------------------------------------------------------------------
153261 -- 4262811 - Generate the Accrual Reversal lines
153262 -------------------------------------------------------------------------------------------
153263 BEGIN
153264 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
153265 (g_array_event(p_event_id).array_value_num('header_index'));
153266 IF l_acc_rev_flag IS NULL THEN
153267 l_acc_rev_flag := 'N';
153268 END IF;
153269 EXCEPTION
153270 WHEN OTHERS THEN
153271 l_acc_rev_flag := 'N';
153272 END;
153273 --
153274 IF (l_acc_rev_flag = 'Y') THEN
153275
153276 -- 4645092 ------------------------------------------------------------------------------
153277 -- To allow MPA report to determine if it should generate report process
153278 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
153279 ------------------------------------------------------------------------------------------
153280
153281 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
153282 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
153283 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
153284 -- call ADRs
153285 -- Bug 4922099
153286 --
153287 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
153288 (NVL(l_actual_upg_option, 'N') = 'O') OR
153289 (NVL(l_enc_upg_option, 'N') = 'O')
153290 )
153291 THEN
153292 NULL;
153293 --
153294 --
153295
153296 l_ccid := AcctDerRule_174(
153297 p_application_id => p_application_id
153298 , p_ae_header_id => l_ae_header_id
153299 , p_source_5 => p_source_5
153300 , p_source_32 => p_source_32
153301 , x_transaction_coa_id => l_adr_transaction_coa_id
153302 , x_accounting_coa_id => l_adr_accounting_coa_id
153303 , x_value_type_code => l_adr_value_type_code
153304 , p_side => 'NA'
153305 );
153306
153307 xla_ae_lines_pkg.set_ccid(
153308 p_code_combination_id => l_ccid
153309 , p_value_type_code => l_adr_value_type_code
153310 , p_transaction_coa_id => l_adr_transaction_coa_id
153311 , p_accounting_coa_id => l_adr_accounting_coa_id
153312 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
153313 , p_adr_type_code => 'S'
153314 , p_component_type => l_component_type
153315 , p_component_code => l_component_code
153316 , p_component_type_code => l_component_type_code
153317 , p_component_appl_id => l_component_appl_id
153318 , p_amb_context_code => l_amb_context_code
153319 , p_side => 'NA'
153320 );
153321
153322
153323 l_segment := AcctDerRule_169(
153324 p_application_id => p_application_id
153325 , p_ae_header_id => l_ae_header_id
153326 , p_source_5 => p_source_5
153327 , p_source_31 => p_source_31
153328 , x_transaction_coa_id => l_adr_transaction_coa_id
153329 , x_accounting_coa_id => l_adr_accounting_coa_id
153330 , x_flexfield_segment_code => l_adr_flexfield_segment_code
153331 , x_flex_value_set_id => l_adr_flex_value_set_id
153332 , x_value_type_code => l_adr_value_type_code
153333 , x_value_combination_id => l_adr_value_combination_id
153334 , x_value_segment_code => l_adr_value_segment_code
153335 , p_side => 'NA'
153336 , p_override_seg_flag => 'Y'
153337 );
153338
153339 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
153340
153341 xla_ae_lines_pkg.set_segment(
153342 p_to_segment_code => 'GL_BALANCING'
153343 , p_segment_value => l_segment
153344 , p_from_segment_code => l_adr_value_segment_code
153345 , p_from_combination_id => l_adr_value_combination_id
153346 , p_value_type_code => l_adr_value_type_code
153347 , p_transaction_coa_id => l_adr_transaction_coa_id
153348 , p_accounting_coa_id => l_adr_accounting_coa_id
153349 , p_flexfield_segment_code => l_adr_flexfield_segment_code
153350 , p_flex_value_set_id => l_adr_flex_value_set_id
153351 , p_adr_code => 'FA_EXPENSE_ACCT'
153352 , p_adr_type_code => 'S'
153356 , p_component_appl_id => l_component_appl_id
153353 , p_component_type => l_component_type
153354 , p_component_code => l_component_code
153355 , p_component_type_code => l_component_type_code
153357 , p_amb_context_code => l_amb_context_code
153358 , p_entity_code => 'TRANSACTIONS'
153359 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
153360 , p_side => 'NA'
153361 );
153362
153363 END IF;
153364
153365 l_segment := AcctDerRule_161(
153366 p_application_id => p_application_id
153367 , p_ae_header_id => l_ae_header_id
153368 , p_source_5 => p_source_5
153369 , p_source_24 => p_source_24
153370 , x_transaction_coa_id => l_adr_transaction_coa_id
153371 , x_accounting_coa_id => l_adr_accounting_coa_id
153372 , x_flexfield_segment_code => l_adr_flexfield_segment_code
153373 , x_flex_value_set_id => l_adr_flex_value_set_id
153374 , x_value_type_code => l_adr_value_type_code
153375 , x_value_combination_id => l_adr_value_combination_id
153376 , x_value_segment_code => l_adr_value_segment_code
153377 , p_side => 'NA'
153378 , p_override_seg_flag => 'Y'
153379 );
153380
153381 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
153382
153383 xla_ae_lines_pkg.set_segment(
153384 p_to_segment_code => 'GL_ACCOUNT'
153385 , p_segment_value => l_segment
153386 , p_from_segment_code => l_adr_value_segment_code
153387 , p_from_combination_id => l_adr_value_combination_id
153388 , p_value_type_code => l_adr_value_type_code
153389 , p_transaction_coa_id => l_adr_transaction_coa_id
153390 , p_accounting_coa_id => l_adr_accounting_coa_id
153391 , p_flexfield_segment_code => l_adr_flexfield_segment_code
153392 , p_flex_value_set_id => l_adr_flex_value_set_id
153393 , p_adr_code => 'FA_NBV_RETIRED_LOSS_SEGMENT'
153394 , p_adr_type_code => 'S'
153395 , p_component_type => l_component_type
153396 , p_component_code => l_component_code
153397 , p_component_type_code => l_component_type_code
153398 , p_component_appl_id => l_component_appl_id
153399 , p_amb_context_code => l_amb_context_code
153400 , p_entity_code => 'TRANSACTIONS'
153401 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
153402 , p_side => 'NA'
153403 );
153404
153405 END IF;
153406
153407 --
153408 --
153409 END IF;
153410
153411 --
153412 -- Update the line information that should be overwritten
153413 --
153414 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
153415 p_header_num => 1);
153416 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
153417
153418 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
153419
153420 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
153421 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
153422 END IF;
153423
153424 --
153425 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
153426 --
153427 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
153428 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
153429 ELSE
153430 ---------------------------------------------------------------------------------------------------
153431 -- 4262811a Switch Sign
153432 ---------------------------------------------------------------------------------------------------
153433 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
153434 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
153435 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
153436 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
153437 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
153438 -- 5132302
153439 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
153440 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
153441
153442 END IF;
153443
153444 -- 4955764
153445 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
153446 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
153447
153448
153449 XLA_AE_LINES_PKG.ValidateCurrentLine;
153450 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
153451
153452 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
153453 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
153454 ,p_balance_type_code => l_balance_type_code);
153455
153456 END IF;
153457
153458 -----------------------------------------------------------------------------------------
153462
153459 -- 4262811 Multiperiod Accounting
153460 -----------------------------------------------------------------------------------------
153461 -- No MPA option is assigned.
153463
153464 END IF;
153465 END IF;
153466 --
153467
153468 --
153469 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
153470 trace
153471 (p_msg => 'END of AcctLineType_379'
153472 ,p_level => C_LEVEL_PROCEDURE
153473 ,p_module => l_log_module);
153474 END IF;
153475 --
153476 EXCEPTION
153477 WHEN xla_exceptions_pkg.application_exception THEN
153478 RAISE;
153479 WHEN OTHERS THEN
153480 xla_exceptions_pkg.raise_message
153481 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_379');
153482 END AcctLineType_379;
153483 --
153484
153485 ---------------------------------------
153486 --
153487 -- PRIVATE FUNCTION
153488 -- AcctLineType_380
153489 --
153490 ---------------------------------------
153491 PROCEDURE AcctLineType_380 (
153492 p_application_id IN NUMBER
153493 ,p_event_id IN NUMBER
153494 ,p_calculate_acctd_flag IN VARCHAR2
153495 ,p_calculate_g_l_flag IN VARCHAR2
153496 ,p_actual_flag IN OUT VARCHAR2
153497 ,p_balance_type_code OUT VARCHAR2
153498 ,p_gain_or_loss_ref OUT VARCHAR2
153499
153500 --Period Close Date
153501 , p_source_1 IN DATE
153502 --Generated Code Combination Identifier
153503 , p_source_5 IN NUMBER
153504 --Depreciation Reserve Account
153505 , p_source_12 IN VARCHAR2
153506 --Generated Offset Code Combination Identifier
153507 , p_source_19 IN NUMBER
153508 --Expense Account Code Combination Identifier
153509 , p_source_31 IN NUMBER
153510 --Default Code Combination Identifier
153511 , p_source_32 IN NUMBER
153512 --Adjustment Type
153513 , p_source_48 IN VARCHAR2
153514 --Transaction Header Identifier
153515 , p_source_49 IN NUMBER
153516 --Adjustment Line Identifier
153517 , p_source_50 IN NUMBER
153518 --Distribution Type Code
153519 , p_source_51 IN VARCHAR2
153520 --Entered Amount
153521 , p_source_52 IN NUMBER
153522 --Currency Code
153523 , p_source_53 IN VARCHAR2
153524 )
153525 IS
153526
153527 l_component_type VARCHAR2(80);
153528 l_component_code VARCHAR2(30);
153529 l_component_type_code VARCHAR2(1);
153530 l_component_appl_id INTEGER;
153531 l_amb_context_code VARCHAR2(30);
153532 l_entity_code VARCHAR2(30);
153533 l_event_class_code VARCHAR2(30);
153534 l_ae_header_id NUMBER;
153535 l_event_type_code VARCHAR2(30);
153536 l_line_definition_code VARCHAR2(30);
153537 l_line_definition_owner_code VARCHAR2(1);
153538 --
153539 -- adr variables
153540 l_segment VARCHAR2(30);
153541 l_ccid NUMBER;
153542 l_adr_transaction_coa_id NUMBER;
153543 l_adr_accounting_coa_id NUMBER;
153544 l_adr_flexfield_segment_code VARCHAR2(30);
153545 l_adr_flex_value_set_id NUMBER;
153546 l_adr_value_type_code VARCHAR2(30);
153547 l_adr_value_combination_id NUMBER;
153548 l_adr_value_segment_code VARCHAR2(30);
153549
153550 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
153551 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
153552 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
153553 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
153554
153555 -- 4262811 Variables ------------------------------------------------------------------------------------------
153556 l_entered_amt_idx NUMBER;
153557 l_accted_amt_idx NUMBER;
153558 l_acc_rev_flag VARCHAR2(1);
153559 l_accrual_line_num NUMBER;
153560 l_tmp_amt NUMBER;
153561 l_acc_rev_natural_side_code VARCHAR2(1);
153562
153563 l_num_entries NUMBER;
153564 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
153565 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
153566 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
153567 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
153568 l_recog_line_1 NUMBER;
153569 l_recog_line_2 NUMBER;
153570
153571 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
153572 l_bflow_applied_to_amt NUMBER; -- 5132302
153573 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
153574
153575 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
153576
153577 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
153578 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
153579
153580 ---------------------------------------------------------------------------------------------------------------
153581
153582
153583 --
153584 -- bulk performance
153585 --
153586 l_balance_type_code VARCHAR2(1);
153587 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
153588 l_log_module VARCHAR2(240);
153589
153590 --
153591 -- Upgrade strategy
153592 --
153593 l_actual_upg_option VARCHAR2(1);
153597 BEGIN
153594 l_enc_upg_option VARCHAR2(1);
153595
153596 --
153598 --
153599 IF g_log_enabled THEN
153600 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_380';
153601 END IF;
153602 --
153603 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
153604
153605 trace
153606 (p_msg => 'BEGIN of AcctLineType_380'
153607 ,p_level => C_LEVEL_PROCEDURE
153608 ,p_module => l_log_module);
153609
153610 END IF;
153611 --
153612 l_component_type := 'AMB_JLT';
153613 l_component_code := 'FA_TGL_RES';
153614 l_component_type_code := 'S';
153615 l_component_appl_id := 140;
153616 l_amb_context_code := 'DEFAULT';
153617 l_entity_code := 'TRANSACTIONS';
153618 l_event_class_code := 'TERMINAL_GAIN_LOSS';
153619 l_event_type_code := 'TERMINAL_GAIN_LOSS_ALL';
153620 l_line_definition_owner_code := 'S';
153621 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TERMI24';
153622 --
153623 l_balance_type_code := 'A';
153624 l_segment := NULL;
153625 l_ccid := NULL;
153626 l_adr_transaction_coa_id := NULL;
153627 l_adr_accounting_coa_id := NULL;
153628 l_adr_flexfield_segment_code := NULL;
153629 l_adr_flex_value_set_id := NULL;
153630 l_adr_value_type_code := NULL;
153631 l_adr_value_combination_id := NULL;
153632 l_adr_value_segment_code := NULL;
153633
153634 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
153635 l_bflow_class_code := ''; -- 4219869 Business Flow
153636 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
153637 l_budgetary_control_flag := 'N';
153638
153639 l_bflow_applied_to_amt_idx := NULL; -- 5132302
153640 l_bflow_applied_to_amt := NULL; -- 5132302
153641 l_entered_amt_idx := NULL; -- 4262811
153642 l_accted_amt_idx := NULL; -- 4262811
153643 l_acc_rev_flag := NULL; -- 4262811
153644 l_accrual_line_num := NULL; -- 4262811
153645 l_tmp_amt := NULL; -- 4262811
153646 --
153647
153648 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
153649 l_balance_type_code <> 'B' THEN
153650 IF NVL(p_source_48,'
153651 ') = 'RESERVE'
153652 THEN
153653
153654 --
153655 XLA_AE_LINES_PKG.SetNewLine;
153656
153657 p_balance_type_code := l_balance_type_code;
153658 -- set the flag so later we will know whether the gain loss line needs to be created
153659
153660 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
153661 p_actual_flag :='A';
153662 END IF;
153663
153664 --
153665 -- bulk performance
153666 --
153667 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
153668 p_header_num => 0); -- 4262811
153669 --
153670 -- set accounting line options
153671 --
153672 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
153673 p_natural_side_code => 'C'
153674 , p_gain_or_loss_flag => 'N'
153675 , p_gl_transfer_mode_code => 'S'
153676 , p_acct_entry_type_code => 'A'
153677 , p_switch_side_flag => 'Y'
153678 , p_merge_duplicate_code => 'N'
153679 );
153680 --
153681 l_acc_rev_natural_side_code := 'D'; -- 4262811
153682 --
153683 --
153684 -- set accounting line type info
153685 --
153686 xla_ae_lines_pkg.SetAcctLineType
153687 (p_component_type => l_component_type
153688 ,p_event_type_code => l_event_type_code
153689 ,p_line_definition_owner_code => l_line_definition_owner_code
153690 ,p_line_definition_code => l_line_definition_code
153691 ,p_accounting_line_code => l_component_code
153692 ,p_accounting_line_type_code => l_component_type_code
153693 ,p_accounting_line_appl_id => l_component_appl_id
153694 ,p_amb_context_code => l_amb_context_code
153695 ,p_entity_code => l_entity_code
153696 ,p_event_class_code => l_event_class_code);
153697 --
153698 -- set accounting class
153699 --
153700 xla_ae_lines_pkg.SetAcctClass(
153701 p_accounting_class_code => 'ASSET'
153702 , p_ae_header_id => l_ae_header_id
153703 );
153704
153705 --
153706 -- set rounding class
153707 --
153708 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
153709 'ASSET';
153710
153711 --
153712 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
153713 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
153714 --
153715 -- bulk performance
153716 --
153717 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
153718
153719 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
153720 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
153721
153722 -- 4955764
153723 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
153727
153724 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
153725
153726 -- 4458381 Public Sector Enh
153728 --
153729 -- set accounting attributes for the line type
153730 --
153731 l_entered_amt_idx := 4;
153732 l_accted_amt_idx := 6;
153733 l_bflow_applied_to_amt_idx := NULL; -- 5132302
153734 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
153735 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
153736 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
153737 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
153738 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
153739 l_rec_acct_attrs.array_char_value(3) := p_source_51;
153740 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
153741 l_rec_acct_attrs.array_num_value(4) := p_source_52;
153742 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
153743 l_rec_acct_attrs.array_char_value(5) := p_source_53;
153744 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
153745 l_rec_acct_attrs.array_num_value(6) := p_source_52;
153746
153747 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
153748 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
153749
153750 ---------------------------------------------------------------------------------------------------------------
153751 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
153752 ---------------------------------------------------------------------------------------------------------------
153753 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
153754
153755 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
153756 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
153757
153758 IF xla_accounting_cache_pkg.GetValueChar
153759 (p_source_code => 'LEDGER_CATEGORY_CODE'
153760 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
153761 AND l_bflow_method_code = 'PRIOR_ENTRY'
153762 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
153763 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
153764 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
153765 )
153766 THEN
153767 xla_ae_lines_pkg.BflowUpgEntry
153768 (p_business_method_code => l_bflow_method_code
153769 ,p_business_class_code => l_bflow_class_code
153770 ,p_balance_type => l_balance_type_code);
153771 ELSE
153772 NULL;
153773 -- No business flow processing for business flow method of NONE.
153774 END IF;
153775
153776 --
153777 -- call analytical criteria
153778 --
153779
153780 --
153781 -- call description
153782 --
153783
153784 xla_ae_lines_pkg.SetLineDescription(
153785 p_ae_header_id => l_ae_header_id
153786 ,p_description => Description_122 (
153787 p_application_id => p_application_id
153788 , p_ae_header_id => l_ae_header_id
153789 , p_source_1 => p_source_1
153790 )
153791 );
153792
153793
153794 --
153795 -- call ADRs
153796 -- Bug 4922099
153797 --
153798 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
153799 (NVL(l_actual_upg_option, 'N') = 'O') OR
153800 (NVL(l_enc_upg_option, 'N') = 'O')
153801 )
153802 THEN
153803 NULL;
153804 --
153805 --
153806
153807 l_ccid := AcctDerRule_175(
153808 p_application_id => p_application_id
153809 , p_ae_header_id => l_ae_header_id
153810 , p_source_5 => p_source_5
153811 , p_source_19 => p_source_19
153812 , p_source_32 => p_source_32
153813 , x_transaction_coa_id => l_adr_transaction_coa_id
153814 , x_accounting_coa_id => l_adr_accounting_coa_id
153815 , x_value_type_code => l_adr_value_type_code
153816 , p_side => 'NA'
153817 );
153818
153819 xla_ae_lines_pkg.set_ccid(
153820 p_code_combination_id => l_ccid
153821 , p_value_type_code => l_adr_value_type_code
153822 , p_transaction_coa_id => l_adr_transaction_coa_id
153823 , p_accounting_coa_id => l_adr_accounting_coa_id
153824 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
153825 , p_adr_type_code => 'S'
153826 , p_component_type => l_component_type
153827 , p_component_code => l_component_code
153828 , p_component_type_code => l_component_type_code
153829 , p_component_appl_id => l_component_appl_id
153830 , p_amb_context_code => l_amb_context_code
153831 , p_side => 'NA'
153832 );
153833
153834
153835 l_segment := AcctDerRule_150(
153836 p_application_id => p_application_id
153837 , p_ae_header_id => l_ae_header_id
153838 , p_source_5 => p_source_5
153839 , p_source_12 => p_source_12
153840 , x_transaction_coa_id => l_adr_transaction_coa_id
153841 , x_accounting_coa_id => l_adr_accounting_coa_id
153845 , x_value_combination_id => l_adr_value_combination_id
153842 , x_flexfield_segment_code => l_adr_flexfield_segment_code
153843 , x_flex_value_set_id => l_adr_flex_value_set_id
153844 , x_value_type_code => l_adr_value_type_code
153846 , x_value_segment_code => l_adr_value_segment_code
153847 , p_side => 'NA'
153848 , p_override_seg_flag => 'Y'
153849 );
153850
153851 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
153852
153853 xla_ae_lines_pkg.set_segment(
153854 p_to_segment_code => 'GL_ACCOUNT'
153855 , p_segment_value => l_segment
153856 , p_from_segment_code => l_adr_value_segment_code
153857 , p_from_combination_id => l_adr_value_combination_id
153858 , p_value_type_code => l_adr_value_type_code
153859 , p_transaction_coa_id => l_adr_transaction_coa_id
153860 , p_accounting_coa_id => l_adr_accounting_coa_id
153861 , p_flexfield_segment_code => l_adr_flexfield_segment_code
153862 , p_flex_value_set_id => l_adr_flex_value_set_id
153863 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
153864 , p_adr_type_code => 'S'
153865 , p_component_type => l_component_type
153866 , p_component_code => l_component_code
153867 , p_component_type_code => l_component_type_code
153868 , p_component_appl_id => l_component_appl_id
153869 , p_amb_context_code => l_amb_context_code
153870 , p_entity_code => 'TRANSACTIONS'
153871 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
153872 , p_side => 'NA'
153873 );
153874
153875 END IF;
153876
153877 l_segment := AcctDerRule_169(
153878 p_application_id => p_application_id
153879 , p_ae_header_id => l_ae_header_id
153880 , p_source_5 => p_source_5
153881 , p_source_31 => p_source_31
153882 , x_transaction_coa_id => l_adr_transaction_coa_id
153883 , x_accounting_coa_id => l_adr_accounting_coa_id
153884 , x_flexfield_segment_code => l_adr_flexfield_segment_code
153885 , x_flex_value_set_id => l_adr_flex_value_set_id
153886 , x_value_type_code => l_adr_value_type_code
153887 , x_value_combination_id => l_adr_value_combination_id
153888 , x_value_segment_code => l_adr_value_segment_code
153889 , p_side => 'NA'
153890 , p_override_seg_flag => 'Y'
153891 );
153892
153893 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
153894
153895 xla_ae_lines_pkg.set_segment(
153896 p_to_segment_code => 'GL_BALANCING'
153897 , p_segment_value => l_segment
153898 , p_from_segment_code => l_adr_value_segment_code
153899 , p_from_combination_id => l_adr_value_combination_id
153900 , p_value_type_code => l_adr_value_type_code
153901 , p_transaction_coa_id => l_adr_transaction_coa_id
153902 , p_accounting_coa_id => l_adr_accounting_coa_id
153903 , p_flexfield_segment_code => l_adr_flexfield_segment_code
153904 , p_flex_value_set_id => l_adr_flex_value_set_id
153905 , p_adr_code => 'FA_EXPENSE_ACCT'
153906 , p_adr_type_code => 'S'
153907 , p_component_type => l_component_type
153908 , p_component_code => l_component_code
153909 , p_component_type_code => l_component_type_code
153910 , p_component_appl_id => l_component_appl_id
153911 , p_amb_context_code => l_amb_context_code
153912 , p_entity_code => 'TRANSACTIONS'
153913 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
153914 , p_side => 'NA'
153915 );
153916
153917 END IF;
153918
153919 --
153920 --
153921 END IF;
153922 --
153923 -- Bug 4922099
153924 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
153925 (NVL(l_enc_upg_option, 'N') = 'O')
153926 ) AND
153927 (l_bflow_method_code = 'PRIOR_ENTRY')
153928 )
153929 THEN
153930 IF
153931 --
153932 1 = 2
153933 --
153934 THEN
153935 xla_accounting_err_pkg.build_message
153936 (p_appli_s_name => 'XLA'
153937 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
153938 ,p_token_1 => 'LINE_NUMBER'
153939 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
153940 ,p_token_2 => 'LINE_TYPE_NAME'
153941 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
153942 l_component_type
153943 ,l_component_code
153944 ,l_component_type_code
153945 ,l_component_appl_id
153946 ,l_amb_context_code
153947 ,l_entity_code
153951 ,p_value_3 => xla_lookups_pkg.get_meaning(
153948 ,l_event_class_code
153949 )
153950 ,p_token_3 => 'OWNER'
153952 p_lookup_type => 'XLA_OWNER_TYPE'
153953 ,p_lookup_code => l_component_type_code
153954 )
153955 ,p_token_4 => 'PRODUCT_NAME'
153956 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
153957 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
153958 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
153959 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
153960 ,p_ae_header_id => NULL
153961 );
153962
153963 IF (C_LEVEL_ERROR>= g_log_level) THEN
153964 trace
153965 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
153966 ,p_level => C_LEVEL_ERROR
153967 ,p_module => l_log_module);
153968 END IF;
153969 END IF;
153970 END IF;
153971 --
153972 --
153973 ------------------------------------------------------------------------------------------------
153974 -- 4219869 Business Flow
153975 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
153976 -- Prior Entry. Currently, the following code is always generated.
153977 ------------------------------------------------------------------------------------------------
153978 XLA_AE_LINES_PKG.ValidateCurrentLine;
153979
153980 ------------------------------------------------------------------------------------
153981 -- 4219869 Business Flow
153982 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
153983 ------------------------------------------------------------------------------------
153984 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
153985
153986 ----------------------------------------------------------------------------------
153987 -- 4219869 Business Flow
153988 -- Update journal entry status -- Need to generate this within IF <condition>
153989 ----------------------------------------------------------------------------------
153990 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
153991 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
153992 ,p_balance_type_code => l_balance_type_code
153993 );
153994
153995 -------------------------------------------------------------------------------------------
153996 -- 4262811 - Generate the Accrual Reversal lines
153997 -------------------------------------------------------------------------------------------
153998 BEGIN
153999 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
154000 (g_array_event(p_event_id).array_value_num('header_index'));
154001 IF l_acc_rev_flag IS NULL THEN
154002 l_acc_rev_flag := 'N';
154003 END IF;
154004 EXCEPTION
154005 WHEN OTHERS THEN
154006 l_acc_rev_flag := 'N';
154007 END;
154008 --
154009 IF (l_acc_rev_flag = 'Y') THEN
154010
154011 -- 4645092 ------------------------------------------------------------------------------
154012 -- To allow MPA report to determine if it should generate report process
154013 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
154014 ------------------------------------------------------------------------------------------
154015
154016 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
154017 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
154018 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
154019 -- call ADRs
154020 -- Bug 4922099
154021 --
154022 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
154023 (NVL(l_actual_upg_option, 'N') = 'O') OR
154024 (NVL(l_enc_upg_option, 'N') = 'O')
154025 )
154026 THEN
154027 NULL;
154028 --
154029 --
154030
154031 l_ccid := AcctDerRule_175(
154032 p_application_id => p_application_id
154033 , p_ae_header_id => l_ae_header_id
154034 , p_source_5 => p_source_5
154035 , p_source_19 => p_source_19
154036 , p_source_32 => p_source_32
154037 , x_transaction_coa_id => l_adr_transaction_coa_id
154038 , x_accounting_coa_id => l_adr_accounting_coa_id
154039 , x_value_type_code => l_adr_value_type_code
154040 , p_side => 'NA'
154041 );
154042
154043 xla_ae_lines_pkg.set_ccid(
154044 p_code_combination_id => l_ccid
154045 , p_value_type_code => l_adr_value_type_code
154046 , p_transaction_coa_id => l_adr_transaction_coa_id
154047 , p_accounting_coa_id => l_adr_accounting_coa_id
154048 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
154049 , p_adr_type_code => 'S'
154053 , p_component_appl_id => l_component_appl_id
154050 , p_component_type => l_component_type
154051 , p_component_code => l_component_code
154052 , p_component_type_code => l_component_type_code
154054 , p_amb_context_code => l_amb_context_code
154055 , p_side => 'NA'
154056 );
154057
154058
154059 l_segment := AcctDerRule_150(
154060 p_application_id => p_application_id
154061 , p_ae_header_id => l_ae_header_id
154062 , p_source_5 => p_source_5
154063 , p_source_12 => p_source_12
154064 , x_transaction_coa_id => l_adr_transaction_coa_id
154065 , x_accounting_coa_id => l_adr_accounting_coa_id
154066 , x_flexfield_segment_code => l_adr_flexfield_segment_code
154067 , x_flex_value_set_id => l_adr_flex_value_set_id
154068 , x_value_type_code => l_adr_value_type_code
154069 , x_value_combination_id => l_adr_value_combination_id
154070 , x_value_segment_code => l_adr_value_segment_code
154071 , p_side => 'NA'
154072 , p_override_seg_flag => 'Y'
154073 );
154074
154075 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
154076
154077 xla_ae_lines_pkg.set_segment(
154078 p_to_segment_code => 'GL_ACCOUNT'
154079 , p_segment_value => l_segment
154080 , p_from_segment_code => l_adr_value_segment_code
154081 , p_from_combination_id => l_adr_value_combination_id
154082 , p_value_type_code => l_adr_value_type_code
154083 , p_transaction_coa_id => l_adr_transaction_coa_id
154084 , p_accounting_coa_id => l_adr_accounting_coa_id
154085 , p_flexfield_segment_code => l_adr_flexfield_segment_code
154086 , p_flex_value_set_id => l_adr_flex_value_set_id
154087 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
154088 , p_adr_type_code => 'S'
154089 , p_component_type => l_component_type
154090 , p_component_code => l_component_code
154091 , p_component_type_code => l_component_type_code
154092 , p_component_appl_id => l_component_appl_id
154093 , p_amb_context_code => l_amb_context_code
154094 , p_entity_code => 'TRANSACTIONS'
154095 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
154096 , p_side => 'NA'
154097 );
154098
154099 END IF;
154100
154101 l_segment := AcctDerRule_169(
154102 p_application_id => p_application_id
154103 , p_ae_header_id => l_ae_header_id
154104 , p_source_5 => p_source_5
154105 , p_source_31 => p_source_31
154106 , x_transaction_coa_id => l_adr_transaction_coa_id
154107 , x_accounting_coa_id => l_adr_accounting_coa_id
154108 , x_flexfield_segment_code => l_adr_flexfield_segment_code
154109 , x_flex_value_set_id => l_adr_flex_value_set_id
154110 , x_value_type_code => l_adr_value_type_code
154111 , x_value_combination_id => l_adr_value_combination_id
154112 , x_value_segment_code => l_adr_value_segment_code
154113 , p_side => 'NA'
154114 , p_override_seg_flag => 'Y'
154115 );
154116
154117 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
154118
154119 xla_ae_lines_pkg.set_segment(
154120 p_to_segment_code => 'GL_BALANCING'
154121 , p_segment_value => l_segment
154122 , p_from_segment_code => l_adr_value_segment_code
154123 , p_from_combination_id => l_adr_value_combination_id
154124 , p_value_type_code => l_adr_value_type_code
154125 , p_transaction_coa_id => l_adr_transaction_coa_id
154126 , p_accounting_coa_id => l_adr_accounting_coa_id
154127 , p_flexfield_segment_code => l_adr_flexfield_segment_code
154128 , p_flex_value_set_id => l_adr_flex_value_set_id
154129 , p_adr_code => 'FA_EXPENSE_ACCT'
154130 , p_adr_type_code => 'S'
154131 , p_component_type => l_component_type
154132 , p_component_code => l_component_code
154133 , p_component_type_code => l_component_type_code
154134 , p_component_appl_id => l_component_appl_id
154135 , p_amb_context_code => l_amb_context_code
154136 , p_entity_code => 'TRANSACTIONS'
154137 , p_event_class_code => 'TERMINAL_GAIN_LOSS'
154138 , p_side => 'NA'
154139 );
154140
154141 END IF;
154142
154143 --
154144 --
154145 END IF;
154146
154147 --
154148 -- Update the line information that should be overwritten
154149 --
154150 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
154151 p_header_num => 1);
154152 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
154153
154154 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
154155
154156 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
154157 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
154158 END IF;
154159
154160 --
154164 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
154161 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
154162 --
154163 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
154165 ELSE
154166 ---------------------------------------------------------------------------------------------------
154167 -- 4262811a Switch Sign
154168 ---------------------------------------------------------------------------------------------------
154169 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
154170 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
154171 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
154172 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
154173 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
154174 -- 5132302
154175 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
154176 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
154177
154178 END IF;
154179
154180 -- 4955764
154181 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
154182 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
154183
154184
154185 XLA_AE_LINES_PKG.ValidateCurrentLine;
154186 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
154187
154188 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
154189 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
154190 ,p_balance_type_code => l_balance_type_code);
154191
154192 END IF;
154193
154194 -----------------------------------------------------------------------------------------
154195 -- 4262811 Multiperiod Accounting
154196 -----------------------------------------------------------------------------------------
154197 -- No MPA option is assigned.
154198
154199
154200 END IF;
154201 END IF;
154202 --
154203
154204 --
154205 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
154206 trace
154207 (p_msg => 'END of AcctLineType_380'
154208 ,p_level => C_LEVEL_PROCEDURE
154209 ,p_module => l_log_module);
154210 END IF;
154211 --
154212 EXCEPTION
154213 WHEN xla_exceptions_pkg.application_exception THEN
154214 RAISE;
154215 WHEN OTHERS THEN
154216 xla_exceptions_pkg.raise_message
154217 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_380');
154218 END AcctLineType_380;
154219 --
154220
154221 ---------------------------------------
154222 --
154223 -- PRIVATE FUNCTION
154224 -- AcctLineType_381
154225 --
154226 ---------------------------------------
154227 PROCEDURE AcctLineType_381 (
154228 p_application_id IN NUMBER
154229 ,p_event_id IN NUMBER
154230 ,p_calculate_acctd_flag IN VARCHAR2
154231 ,p_calculate_g_l_flag IN VARCHAR2
154232 ,p_actual_flag IN OUT VARCHAR2
154233 ,p_balance_type_code OUT VARCHAR2
154234 ,p_gain_or_loss_ref OUT VARCHAR2
154235
154236 --Period Close Date
154237 , p_source_1 IN DATE
154238 --Bonus Depreciation Expense Account
154239 , p_source_4 IN VARCHAR2
154240 --Generated Code Combination Identifier
154241 , p_source_5 IN NUMBER
154242 --Expense Account Code Combination Identifier
154243 , p_source_31 IN NUMBER
154244 --Adjustment Type
154245 , p_source_48 IN VARCHAR2
154246 --Transaction Header Identifier
154247 , p_source_49 IN NUMBER
154248 --Adjustment Line Identifier
154249 , p_source_50 IN NUMBER
154250 --Distribution Type Code
154251 , p_source_51 IN VARCHAR2
154252 --Entered Amount
154253 , p_source_52 IN NUMBER
154254 --Currency Code
154255 , p_source_53 IN VARCHAR2
154256 --Source Destination Code
154257 , p_source_55 IN VARCHAR2
154258 )
154259 IS
154260
154261 l_component_type VARCHAR2(80);
154262 l_component_code VARCHAR2(30);
154263 l_component_type_code VARCHAR2(1);
154264 l_component_appl_id INTEGER;
154265 l_amb_context_code VARCHAR2(30);
154266 l_entity_code VARCHAR2(30);
154267 l_event_class_code VARCHAR2(30);
154268 l_ae_header_id NUMBER;
154269 l_event_type_code VARCHAR2(30);
154270 l_line_definition_code VARCHAR2(30);
154271 l_line_definition_owner_code VARCHAR2(1);
154272 --
154273 -- adr variables
154274 l_segment VARCHAR2(30);
154275 l_ccid NUMBER;
154276 l_adr_transaction_coa_id NUMBER;
154277 l_adr_accounting_coa_id NUMBER;
154278 l_adr_flexfield_segment_code VARCHAR2(30);
154279 l_adr_flex_value_set_id NUMBER;
154280 l_adr_value_type_code VARCHAR2(30);
154281 l_adr_value_combination_id NUMBER;
154282 l_adr_value_segment_code VARCHAR2(30);
154283
154284 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
154288
154285 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
154286 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
154287 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
154289 -- 4262811 Variables ------------------------------------------------------------------------------------------
154290 l_entered_amt_idx NUMBER;
154291 l_accted_amt_idx NUMBER;
154292 l_acc_rev_flag VARCHAR2(1);
154293 l_accrual_line_num NUMBER;
154294 l_tmp_amt NUMBER;
154295 l_acc_rev_natural_side_code VARCHAR2(1);
154296
154297 l_num_entries NUMBER;
154298 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
154299 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
154300 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
154301 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
154302 l_recog_line_1 NUMBER;
154303 l_recog_line_2 NUMBER;
154304
154305 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
154306 l_bflow_applied_to_amt NUMBER; -- 5132302
154307 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
154308
154309 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
154310
154311 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
154312 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
154313
154314 ---------------------------------------------------------------------------------------------------------------
154315
154316
154317 --
154318 -- bulk performance
154319 --
154320 l_balance_type_code VARCHAR2(1);
154321 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
154322 l_log_module VARCHAR2(240);
154323
154324 --
154325 -- Upgrade strategy
154326 --
154327 l_actual_upg_option VARCHAR2(1);
154328 l_enc_upg_option VARCHAR2(1);
154329
154330 --
154331 BEGIN
154332 --
154333 IF g_log_enabled THEN
154334 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_381';
154335 END IF;
154336 --
154337 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
154338
154339 trace
154340 (p_msg => 'BEGIN of AcctLineType_381'
154341 ,p_level => C_LEVEL_PROCEDURE
154342 ,p_module => l_log_module);
154343
154344 END IF;
154345 --
154346 l_component_type := 'AMB_JLT';
154347 l_component_code := 'FA_TRANSFER_DEST_BONUS_EXP';
154348 l_component_type_code := 'S';
154349 l_component_appl_id := 140;
154350 l_amb_context_code := 'DEFAULT';
154351 l_entity_code := 'TRANSACTIONS';
154352 l_event_class_code := 'TRANSFERS';
154353 l_event_type_code := 'TRANSFERS_ALL';
154354 l_line_definition_owner_code := 'S';
154355 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
154356 --
154357 l_balance_type_code := 'A';
154358 l_segment := NULL;
154359 l_ccid := NULL;
154360 l_adr_transaction_coa_id := NULL;
154361 l_adr_accounting_coa_id := NULL;
154362 l_adr_flexfield_segment_code := NULL;
154363 l_adr_flex_value_set_id := NULL;
154364 l_adr_value_type_code := NULL;
154365 l_adr_value_combination_id := NULL;
154366 l_adr_value_segment_code := NULL;
154367
154368 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
154369 l_bflow_class_code := ''; -- 4219869 Business Flow
154370 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
154371 l_budgetary_control_flag := 'N';
154372
154373 l_bflow_applied_to_amt_idx := NULL; -- 5132302
154374 l_bflow_applied_to_amt := NULL; -- 5132302
154375 l_entered_amt_idx := NULL; -- 4262811
154376 l_accted_amt_idx := NULL; -- 4262811
154377 l_acc_rev_flag := NULL; -- 4262811
154378 l_accrual_line_num := NULL; -- 4262811
154379 l_tmp_amt := NULL; -- 4262811
154380 --
154381
154382 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
154383 l_balance_type_code <> 'B' THEN
154384 IF NVL(p_source_48,'
154385 ') = 'BONUS EXPENSE' AND
154386 NVL(p_source_55,'
154387 ') = 'DEST'
154388 THEN
154389
154390 --
154391 XLA_AE_LINES_PKG.SetNewLine;
154392
154393 p_balance_type_code := l_balance_type_code;
154394 -- set the flag so later we will know whether the gain loss line needs to be created
154395
154396 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
154397 p_actual_flag :='A';
154398 END IF;
154399
154400 --
154401 -- bulk performance
154402 --
154403 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
154404 p_header_num => 0); -- 4262811
154405 --
154406 -- set accounting line options
154407 --
154408 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
154409 p_natural_side_code => 'D'
154410 , p_gain_or_loss_flag => 'N'
154411 , p_gl_transfer_mode_code => 'S'
154412 , p_acct_entry_type_code => 'A'
154413 , p_switch_side_flag => 'Y'
154417 l_acc_rev_natural_side_code := 'C'; -- 4262811
154414 , p_merge_duplicate_code => 'N'
154415 );
154416 --
154418 --
154419 --
154420 -- set accounting line type info
154421 --
154422 xla_ae_lines_pkg.SetAcctLineType
154423 (p_component_type => l_component_type
154424 ,p_event_type_code => l_event_type_code
154425 ,p_line_definition_owner_code => l_line_definition_owner_code
154426 ,p_line_definition_code => l_line_definition_code
154427 ,p_accounting_line_code => l_component_code
154428 ,p_accounting_line_type_code => l_component_type_code
154429 ,p_accounting_line_appl_id => l_component_appl_id
154430 ,p_amb_context_code => l_amb_context_code
154431 ,p_entity_code => l_entity_code
154432 ,p_event_class_code => l_event_class_code);
154433 --
154434 -- set accounting class
154435 --
154436 xla_ae_lines_pkg.SetAcctClass(
154437 p_accounting_class_code => 'EXPENSE'
154438 , p_ae_header_id => l_ae_header_id
154439 );
154440
154441 --
154442 -- set rounding class
154443 --
154444 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
154445 'EXPENSE';
154446
154447 --
154448 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
154449 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
154450 --
154451 -- bulk performance
154452 --
154453 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
154454
154455 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
154456 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
154457
154458 -- 4955764
154459 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
154460 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
154461
154462 -- 4458381 Public Sector Enh
154463
154464 --
154465 -- set accounting attributes for the line type
154466 --
154467 l_entered_amt_idx := 4;
154468 l_accted_amt_idx := 6;
154469 l_bflow_applied_to_amt_idx := NULL; -- 5132302
154470 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
154471 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
154472 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
154473 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
154474 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
154475 l_rec_acct_attrs.array_char_value(3) := p_source_51;
154476 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
154477 l_rec_acct_attrs.array_num_value(4) := p_source_52;
154478 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
154479 l_rec_acct_attrs.array_char_value(5) := p_source_53;
154480 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
154481 l_rec_acct_attrs.array_num_value(6) := p_source_52;
154482
154483 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
154484 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
154485
154486 ---------------------------------------------------------------------------------------------------------------
154487 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
154488 ---------------------------------------------------------------------------------------------------------------
154489 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
154490
154491 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
154492 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
154493
154494 IF xla_accounting_cache_pkg.GetValueChar
154495 (p_source_code => 'LEDGER_CATEGORY_CODE'
154496 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
154497 AND l_bflow_method_code = 'PRIOR_ENTRY'
154498 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
154499 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
154500 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
154501 )
154502 THEN
154503 xla_ae_lines_pkg.BflowUpgEntry
154504 (p_business_method_code => l_bflow_method_code
154505 ,p_business_class_code => l_bflow_class_code
154506 ,p_balance_type => l_balance_type_code);
154507 ELSE
154508 NULL;
154509 -- No business flow processing for business flow method of NONE.
154510 END IF;
154511
154512 --
154513 -- call analytical criteria
154514 --
154515
154516 --
154517 -- call description
154518 --
154519
154520 xla_ae_lines_pkg.SetLineDescription(
154521 p_ae_header_id => l_ae_header_id
154522 ,p_description => Description_124 (
154523 p_application_id => p_application_id
154524 , p_ae_header_id => l_ae_header_id
154525 , p_source_1 => p_source_1
154526 )
154527 );
154528
154529
154530 --
154531 -- call ADRs
154532 -- Bug 4922099
154533 --
154534 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
154538 THEN
154535 (NVL(l_actual_upg_option, 'N') = 'O') OR
154536 (NVL(l_enc_upg_option, 'N') = 'O')
154537 )
154539 NULL;
154540 --
154541 --
154542
154543 l_ccid := AcctDerRule_176(
154544 p_application_id => p_application_id
154545 , p_ae_header_id => l_ae_header_id
154546 , p_source_5 => p_source_5
154547 , p_source_31 => p_source_31
154548 , x_transaction_coa_id => l_adr_transaction_coa_id
154549 , x_accounting_coa_id => l_adr_accounting_coa_id
154550 , x_value_type_code => l_adr_value_type_code
154551 , p_side => 'NA'
154552 );
154553
154554 xla_ae_lines_pkg.set_ccid(
154555 p_code_combination_id => l_ccid
154556 , p_value_type_code => l_adr_value_type_code
154557 , p_transaction_coa_id => l_adr_transaction_coa_id
154558 , p_accounting_coa_id => l_adr_accounting_coa_id
154559 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
154560 , p_adr_type_code => 'S'
154561 , p_component_type => l_component_type
154562 , p_component_code => l_component_code
154563 , p_component_type_code => l_component_type_code
154564 , p_component_appl_id => l_component_appl_id
154565 , p_amb_context_code => l_amb_context_code
154566 , p_side => 'NA'
154567 );
154568
154569
154570 l_segment := AcctDerRule_144(
154571 p_application_id => p_application_id
154572 , p_ae_header_id => l_ae_header_id
154573 , p_source_4 => p_source_4
154574 , p_source_5 => p_source_5
154575 , x_transaction_coa_id => l_adr_transaction_coa_id
154576 , x_accounting_coa_id => l_adr_accounting_coa_id
154577 , x_flexfield_segment_code => l_adr_flexfield_segment_code
154578 , x_flex_value_set_id => l_adr_flex_value_set_id
154579 , x_value_type_code => l_adr_value_type_code
154580 , x_value_combination_id => l_adr_value_combination_id
154581 , x_value_segment_code => l_adr_value_segment_code
154582 , p_side => 'NA'
154583 , p_override_seg_flag => 'Y'
154584 );
154585
154586 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
154587
154588 xla_ae_lines_pkg.set_segment(
154589 p_to_segment_code => 'GL_ACCOUNT'
154590 , p_segment_value => l_segment
154591 , p_from_segment_code => l_adr_value_segment_code
154592 , p_from_combination_id => l_adr_value_combination_id
154593 , p_value_type_code => l_adr_value_type_code
154594 , p_transaction_coa_id => l_adr_transaction_coa_id
154595 , p_accounting_coa_id => l_adr_accounting_coa_id
154596 , p_flexfield_segment_code => l_adr_flexfield_segment_code
154597 , p_flex_value_set_id => l_adr_flex_value_set_id
154598 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
154599 , p_adr_type_code => 'S'
154600 , p_component_type => l_component_type
154601 , p_component_code => l_component_code
154602 , p_component_type_code => l_component_type_code
154603 , p_component_appl_id => l_component_appl_id
154604 , p_amb_context_code => l_amb_context_code
154605 , p_entity_code => 'TRANSACTIONS'
154606 , p_event_class_code => 'TRANSFERS'
154607 , p_side => 'NA'
154608 );
154609
154610 END IF;
154611
154612 --
154613 --
154614 END IF;
154615 --
154616 -- Bug 4922099
154617 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
154618 (NVL(l_enc_upg_option, 'N') = 'O')
154619 ) AND
154620 (l_bflow_method_code = 'PRIOR_ENTRY')
154621 )
154622 THEN
154623 IF
154624 --
154625 1 = 2
154626 --
154627 THEN
154628 xla_accounting_err_pkg.build_message
154629 (p_appli_s_name => 'XLA'
154630 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
154631 ,p_token_1 => 'LINE_NUMBER'
154632 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
154633 ,p_token_2 => 'LINE_TYPE_NAME'
154634 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
154635 l_component_type
154636 ,l_component_code
154637 ,l_component_type_code
154638 ,l_component_appl_id
154639 ,l_amb_context_code
154640 ,l_entity_code
154641 ,l_event_class_code
154642 )
154643 ,p_token_3 => 'OWNER'
154647 )
154644 ,p_value_3 => xla_lookups_pkg.get_meaning(
154645 p_lookup_type => 'XLA_OWNER_TYPE'
154646 ,p_lookup_code => l_component_type_code
154648 ,p_token_4 => 'PRODUCT_NAME'
154649 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
154650 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
154651 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
154652 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
154653 ,p_ae_header_id => NULL
154654 );
154655
154656 IF (C_LEVEL_ERROR>= g_log_level) THEN
154657 trace
154658 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
154659 ,p_level => C_LEVEL_ERROR
154660 ,p_module => l_log_module);
154661 END IF;
154662 END IF;
154663 END IF;
154664 --
154665 --
154666 ------------------------------------------------------------------------------------------------
154667 -- 4219869 Business Flow
154668 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
154669 -- Prior Entry. Currently, the following code is always generated.
154670 ------------------------------------------------------------------------------------------------
154671 XLA_AE_LINES_PKG.ValidateCurrentLine;
154672
154673 ------------------------------------------------------------------------------------
154674 -- 4219869 Business Flow
154675 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
154676 ------------------------------------------------------------------------------------
154677 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
154678
154679 ----------------------------------------------------------------------------------
154680 -- 4219869 Business Flow
154681 -- Update journal entry status -- Need to generate this within IF <condition>
154682 ----------------------------------------------------------------------------------
154683 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
154684 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
154685 ,p_balance_type_code => l_balance_type_code
154686 );
154687
154688 -------------------------------------------------------------------------------------------
154689 -- 4262811 - Generate the Accrual Reversal lines
154690 -------------------------------------------------------------------------------------------
154691 BEGIN
154692 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
154693 (g_array_event(p_event_id).array_value_num('header_index'));
154694 IF l_acc_rev_flag IS NULL THEN
154695 l_acc_rev_flag := 'N';
154696 END IF;
154697 EXCEPTION
154698 WHEN OTHERS THEN
154699 l_acc_rev_flag := 'N';
154700 END;
154701 --
154702 IF (l_acc_rev_flag = 'Y') THEN
154703
154704 -- 4645092 ------------------------------------------------------------------------------
154705 -- To allow MPA report to determine if it should generate report process
154706 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
154707 ------------------------------------------------------------------------------------------
154708
154709 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
154710 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
154711 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
154712 -- call ADRs
154713 -- Bug 4922099
154714 --
154715 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
154716 (NVL(l_actual_upg_option, 'N') = 'O') OR
154717 (NVL(l_enc_upg_option, 'N') = 'O')
154718 )
154719 THEN
154720 NULL;
154721 --
154722 --
154723
154724 l_ccid := AcctDerRule_176(
154725 p_application_id => p_application_id
154726 , p_ae_header_id => l_ae_header_id
154727 , p_source_5 => p_source_5
154728 , p_source_31 => p_source_31
154729 , x_transaction_coa_id => l_adr_transaction_coa_id
154730 , x_accounting_coa_id => l_adr_accounting_coa_id
154731 , x_value_type_code => l_adr_value_type_code
154732 , p_side => 'NA'
154733 );
154734
154735 xla_ae_lines_pkg.set_ccid(
154736 p_code_combination_id => l_ccid
154737 , p_value_type_code => l_adr_value_type_code
154738 , p_transaction_coa_id => l_adr_transaction_coa_id
154739 , p_accounting_coa_id => l_adr_accounting_coa_id
154740 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
154741 , p_adr_type_code => 'S'
154742 , p_component_type => l_component_type
154743 , p_component_code => l_component_code
154744 , p_component_type_code => l_component_type_code
154745 , p_component_appl_id => l_component_appl_id
154746 , p_amb_context_code => l_amb_context_code
154750
154747 , p_side => 'NA'
154748 );
154749
154751 l_segment := AcctDerRule_144(
154752 p_application_id => p_application_id
154753 , p_ae_header_id => l_ae_header_id
154754 , p_source_4 => p_source_4
154755 , p_source_5 => p_source_5
154756 , x_transaction_coa_id => l_adr_transaction_coa_id
154757 , x_accounting_coa_id => l_adr_accounting_coa_id
154758 , x_flexfield_segment_code => l_adr_flexfield_segment_code
154759 , x_flex_value_set_id => l_adr_flex_value_set_id
154760 , x_value_type_code => l_adr_value_type_code
154761 , x_value_combination_id => l_adr_value_combination_id
154762 , x_value_segment_code => l_adr_value_segment_code
154763 , p_side => 'NA'
154764 , p_override_seg_flag => 'Y'
154765 );
154766
154767 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
154768
154769 xla_ae_lines_pkg.set_segment(
154770 p_to_segment_code => 'GL_ACCOUNT'
154771 , p_segment_value => l_segment
154772 , p_from_segment_code => l_adr_value_segment_code
154773 , p_from_combination_id => l_adr_value_combination_id
154774 , p_value_type_code => l_adr_value_type_code
154775 , p_transaction_coa_id => l_adr_transaction_coa_id
154776 , p_accounting_coa_id => l_adr_accounting_coa_id
154777 , p_flexfield_segment_code => l_adr_flexfield_segment_code
154778 , p_flex_value_set_id => l_adr_flex_value_set_id
154779 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
154780 , p_adr_type_code => 'S'
154781 , p_component_type => l_component_type
154782 , p_component_code => l_component_code
154783 , p_component_type_code => l_component_type_code
154784 , p_component_appl_id => l_component_appl_id
154785 , p_amb_context_code => l_amb_context_code
154786 , p_entity_code => 'TRANSACTIONS'
154787 , p_event_class_code => 'TRANSFERS'
154788 , p_side => 'NA'
154789 );
154790
154791 END IF;
154792
154793 --
154794 --
154795 END IF;
154796
154797 --
154798 -- Update the line information that should be overwritten
154799 --
154800 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
154801 p_header_num => 1);
154802 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
154803
154804 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
154805
154806 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
154807 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
154808 END IF;
154809
154810 --
154811 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
154812 --
154813 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
154814 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
154815 ELSE
154816 ---------------------------------------------------------------------------------------------------
154817 -- 4262811a Switch Sign
154818 ---------------------------------------------------------------------------------------------------
154819 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
154820 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
154821 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
154822 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
154823 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
154824 -- 5132302
154825 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
154826 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
154827
154828 END IF;
154829
154830 -- 4955764
154831 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
154832 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
154833
154834
154835 XLA_AE_LINES_PKG.ValidateCurrentLine;
154836 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
154837
154838 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
154839 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
154840 ,p_balance_type_code => l_balance_type_code);
154841
154842 END IF;
154843
154844 -----------------------------------------------------------------------------------------
154845 -- 4262811 Multiperiod Accounting
154846 -----------------------------------------------------------------------------------------
154847 -- No MPA option is assigned.
154848
154849
154850 END IF;
154851 END IF;
154852 --
154853
154854 --
154855 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
154856 trace
154860 END IF;
154857 (p_msg => 'END of AcctLineType_381'
154858 ,p_level => C_LEVEL_PROCEDURE
154859 ,p_module => l_log_module);
154861 --
154862 EXCEPTION
154863 WHEN xla_exceptions_pkg.application_exception THEN
154864 RAISE;
154865 WHEN OTHERS THEN
154866 xla_exceptions_pkg.raise_message
154867 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_381');
154868 END AcctLineType_381;
154869 --
154870
154871 ---------------------------------------
154872 --
154873 -- PRIVATE FUNCTION
154874 -- AcctLineType_382
154875 --
154876 ---------------------------------------
154877 PROCEDURE AcctLineType_382 (
154878 p_application_id IN NUMBER
154879 ,p_event_id IN NUMBER
154880 ,p_calculate_acctd_flag IN VARCHAR2
154881 ,p_calculate_g_l_flag IN VARCHAR2
154882 ,p_actual_flag IN OUT VARCHAR2
154883 ,p_balance_type_code OUT VARCHAR2
154884 ,p_gain_or_loss_ref OUT VARCHAR2
154885
154886 --Period Close Date
154887 , p_source_1 IN DATE
154888 --Generated Code Combination Identifier
154889 , p_source_5 IN NUMBER
154890 --Bonus Reserve Account
154891 , p_source_6 IN VARCHAR2
154892 --Generated Offset Code Combination Identifier
154893 , p_source_19 IN NUMBER
154894 --Expense Account Code Combination Identifier
154895 , p_source_31 IN NUMBER
154896 --Default Code Combination Identifier
154897 , p_source_32 IN NUMBER
154898 --Adjustment Type
154899 , p_source_48 IN VARCHAR2
154900 --Transaction Header Identifier
154901 , p_source_49 IN NUMBER
154902 --Adjustment Line Identifier
154903 , p_source_50 IN NUMBER
154904 --Distribution Type Code
154905 , p_source_51 IN VARCHAR2
154906 --Entered Amount
154907 , p_source_52 IN NUMBER
154908 --Currency Code
154909 , p_source_53 IN VARCHAR2
154910 --Source Destination Code
154911 , p_source_55 IN VARCHAR2
154912 )
154913 IS
154914
154915 l_component_type VARCHAR2(80);
154916 l_component_code VARCHAR2(30);
154917 l_component_type_code VARCHAR2(1);
154918 l_component_appl_id INTEGER;
154919 l_amb_context_code VARCHAR2(30);
154920 l_entity_code VARCHAR2(30);
154921 l_event_class_code VARCHAR2(30);
154922 l_ae_header_id NUMBER;
154923 l_event_type_code VARCHAR2(30);
154924 l_line_definition_code VARCHAR2(30);
154925 l_line_definition_owner_code VARCHAR2(1);
154926 --
154927 -- adr variables
154928 l_segment VARCHAR2(30);
154929 l_ccid NUMBER;
154930 l_adr_transaction_coa_id NUMBER;
154931 l_adr_accounting_coa_id NUMBER;
154932 l_adr_flexfield_segment_code VARCHAR2(30);
154933 l_adr_flex_value_set_id NUMBER;
154934 l_adr_value_type_code VARCHAR2(30);
154935 l_adr_value_combination_id NUMBER;
154936 l_adr_value_segment_code VARCHAR2(30);
154937
154938 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
154939 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
154940 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
154941 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
154942
154943 -- 4262811 Variables ------------------------------------------------------------------------------------------
154944 l_entered_amt_idx NUMBER;
154945 l_accted_amt_idx NUMBER;
154946 l_acc_rev_flag VARCHAR2(1);
154947 l_accrual_line_num NUMBER;
154948 l_tmp_amt NUMBER;
154949 l_acc_rev_natural_side_code VARCHAR2(1);
154950
154951 l_num_entries NUMBER;
154952 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
154953 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
154954 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
154955 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
154956 l_recog_line_1 NUMBER;
154957 l_recog_line_2 NUMBER;
154958
154959 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
154960 l_bflow_applied_to_amt NUMBER; -- 5132302
154961 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
154962
154963 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
154964
154965 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
154966 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
154967
154968 ---------------------------------------------------------------------------------------------------------------
154969
154970
154971 --
154972 -- bulk performance
154973 --
154974 l_balance_type_code VARCHAR2(1);
154975 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
154976 l_log_module VARCHAR2(240);
154977
154978 --
154979 -- Upgrade strategy
154980 --
154981 l_actual_upg_option VARCHAR2(1);
154982 l_enc_upg_option VARCHAR2(1);
154983
154984 --
154985 BEGIN
154986 --
154987 IF g_log_enabled THEN
154988 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_382';
154989 END IF;
154990 --
154991 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
154992
154996 ,p_module => l_log_module);
154993 trace
154994 (p_msg => 'BEGIN of AcctLineType_382'
154995 ,p_level => C_LEVEL_PROCEDURE
154997
154998 END IF;
154999 --
155000 l_component_type := 'AMB_JLT';
155001 l_component_code := 'FA_TRANSFER_DEST_BONUS_RES';
155002 l_component_type_code := 'S';
155003 l_component_appl_id := 140;
155004 l_amb_context_code := 'DEFAULT';
155005 l_entity_code := 'TRANSACTIONS';
155006 l_event_class_code := 'TRANSFERS';
155007 l_event_type_code := 'TRANSFERS_ALL';
155008 l_line_definition_owner_code := 'S';
155009 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
155010 --
155011 l_balance_type_code := 'A';
155012 l_segment := NULL;
155013 l_ccid := NULL;
155014 l_adr_transaction_coa_id := NULL;
155015 l_adr_accounting_coa_id := NULL;
155016 l_adr_flexfield_segment_code := NULL;
155017 l_adr_flex_value_set_id := NULL;
155018 l_adr_value_type_code := NULL;
155019 l_adr_value_combination_id := NULL;
155020 l_adr_value_segment_code := NULL;
155021
155022 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
155023 l_bflow_class_code := ''; -- 4219869 Business Flow
155024 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
155025 l_budgetary_control_flag := 'N';
155026
155027 l_bflow_applied_to_amt_idx := NULL; -- 5132302
155028 l_bflow_applied_to_amt := NULL; -- 5132302
155029 l_entered_amt_idx := NULL; -- 4262811
155030 l_accted_amt_idx := NULL; -- 4262811
155031 l_acc_rev_flag := NULL; -- 4262811
155032 l_accrual_line_num := NULL; -- 4262811
155033 l_tmp_amt := NULL; -- 4262811
155034 --
155035
155036 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
155037 l_balance_type_code <> 'B' THEN
155038 IF (NVL(p_source_48,'
155039 ') = 'BONUS RESERVE' OR
155040 NVL(p_source_48,'
155041 ') = 'BONUS EXPENSE') AND
155042 NVL(p_source_55,'
155043 ') = 'DEST'
155044 THEN
155045
155046 --
155047 XLA_AE_LINES_PKG.SetNewLine;
155048
155049 p_balance_type_code := l_balance_type_code;
155050 -- set the flag so later we will know whether the gain loss line needs to be created
155051
155052 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
155053 p_actual_flag :='A';
155054 END IF;
155055
155056 --
155057 -- bulk performance
155058 --
155059 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
155060 p_header_num => 0); -- 4262811
155061 --
155062 -- set accounting line options
155063 --
155064 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
155065 p_natural_side_code => 'C'
155066 , p_gain_or_loss_flag => 'N'
155067 , p_gl_transfer_mode_code => 'S'
155068 , p_acct_entry_type_code => 'A'
155069 , p_switch_side_flag => 'Y'
155070 , p_merge_duplicate_code => 'N'
155071 );
155072 --
155073 l_acc_rev_natural_side_code := 'D'; -- 4262811
155074 --
155075 --
155076 -- set accounting line type info
155077 --
155078 xla_ae_lines_pkg.SetAcctLineType
155079 (p_component_type => l_component_type
155080 ,p_event_type_code => l_event_type_code
155081 ,p_line_definition_owner_code => l_line_definition_owner_code
155082 ,p_line_definition_code => l_line_definition_code
155083 ,p_accounting_line_code => l_component_code
155084 ,p_accounting_line_type_code => l_component_type_code
155085 ,p_accounting_line_appl_id => l_component_appl_id
155086 ,p_amb_context_code => l_amb_context_code
155087 ,p_entity_code => l_entity_code
155088 ,p_event_class_code => l_event_class_code);
155089 --
155090 -- set accounting class
155091 --
155092 xla_ae_lines_pkg.SetAcctClass(
155093 p_accounting_class_code => 'ASSET'
155094 , p_ae_header_id => l_ae_header_id
155095 );
155096
155097 --
155098 -- set rounding class
155099 --
155100 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
155101 'ASSET';
155102
155103 --
155104 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
155105 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
155106 --
155107 -- bulk performance
155108 --
155109 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
155110
155111 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
155112 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
155113
155114 -- 4955764
155115 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
155116 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
155117
155118 -- 4458381 Public Sector Enh
155119
155120 --
155121 -- set accounting attributes for the line type
155122 --
155123 l_entered_amt_idx := 4;
155124 l_accted_amt_idx := 6;
155128 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
155125 l_bflow_applied_to_amt_idx := NULL; -- 5132302
155126 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
155127 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
155129 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
155130 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
155131 l_rec_acct_attrs.array_char_value(3) := p_source_51;
155132 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
155133 l_rec_acct_attrs.array_num_value(4) := p_source_52;
155134 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
155135 l_rec_acct_attrs.array_char_value(5) := p_source_53;
155136 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
155137 l_rec_acct_attrs.array_num_value(6) := p_source_52;
155138
155139 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
155140 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
155141
155142 ---------------------------------------------------------------------------------------------------------------
155143 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
155144 ---------------------------------------------------------------------------------------------------------------
155145 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
155146
155147 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
155148 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
155149
155150 IF xla_accounting_cache_pkg.GetValueChar
155151 (p_source_code => 'LEDGER_CATEGORY_CODE'
155152 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
155153 AND l_bflow_method_code = 'PRIOR_ENTRY'
155154 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
155155 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
155156 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
155157 )
155158 THEN
155159 xla_ae_lines_pkg.BflowUpgEntry
155160 (p_business_method_code => l_bflow_method_code
155161 ,p_business_class_code => l_bflow_class_code
155162 ,p_balance_type => l_balance_type_code);
155163 ELSE
155164 NULL;
155165 -- No business flow processing for business flow method of NONE.
155166 END IF;
155167
155168 --
155169 -- call analytical criteria
155170 --
155171
155172 --
155173 -- call description
155174 --
155175
155176 xla_ae_lines_pkg.SetLineDescription(
155177 p_ae_header_id => l_ae_header_id
155178 ,p_description => Description_125 (
155179 p_application_id => p_application_id
155180 , p_ae_header_id => l_ae_header_id
155181 , p_source_1 => p_source_1
155182 )
155183 );
155184
155185
155186 --
155187 -- call ADRs
155188 -- Bug 4922099
155189 --
155190 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
155191 (NVL(l_actual_upg_option, 'N') = 'O') OR
155192 (NVL(l_enc_upg_option, 'N') = 'O')
155193 )
155194 THEN
155195 NULL;
155196 --
155197 --
155198
155199 l_ccid := AcctDerRule_175(
155200 p_application_id => p_application_id
155201 , p_ae_header_id => l_ae_header_id
155202 , p_source_5 => p_source_5
155203 , p_source_19 => p_source_19
155204 , p_source_32 => p_source_32
155205 , x_transaction_coa_id => l_adr_transaction_coa_id
155206 , x_accounting_coa_id => l_adr_accounting_coa_id
155207 , x_value_type_code => l_adr_value_type_code
155208 , p_side => 'NA'
155209 );
155210
155211 xla_ae_lines_pkg.set_ccid(
155212 p_code_combination_id => l_ccid
155213 , p_value_type_code => l_adr_value_type_code
155214 , p_transaction_coa_id => l_adr_transaction_coa_id
155215 , p_accounting_coa_id => l_adr_accounting_coa_id
155216 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
155217 , p_adr_type_code => 'S'
155218 , p_component_type => l_component_type
155219 , p_component_code => l_component_code
155220 , p_component_type_code => l_component_type_code
155221 , p_component_appl_id => l_component_appl_id
155222 , p_amb_context_code => l_amb_context_code
155223 , p_side => 'NA'
155224 );
155225
155226
155227 l_segment := AcctDerRule_145(
155228 p_application_id => p_application_id
155229 , p_ae_header_id => l_ae_header_id
155230 , p_source_5 => p_source_5
155231 , p_source_6 => p_source_6
155232 , x_transaction_coa_id => l_adr_transaction_coa_id
155233 , x_accounting_coa_id => l_adr_accounting_coa_id
155234 , x_flexfield_segment_code => l_adr_flexfield_segment_code
155235 , x_flex_value_set_id => l_adr_flex_value_set_id
155236 , x_value_type_code => l_adr_value_type_code
155237 , x_value_combination_id => l_adr_value_combination_id
155238 , x_value_segment_code => l_adr_value_segment_code
155239 , p_side => 'NA'
155243 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
155240 , p_override_seg_flag => 'Y'
155241 );
155242
155244
155245 xla_ae_lines_pkg.set_segment(
155246 p_to_segment_code => 'GL_ACCOUNT'
155247 , p_segment_value => l_segment
155248 , p_from_segment_code => l_adr_value_segment_code
155249 , p_from_combination_id => l_adr_value_combination_id
155250 , p_value_type_code => l_adr_value_type_code
155251 , p_transaction_coa_id => l_adr_transaction_coa_id
155252 , p_accounting_coa_id => l_adr_accounting_coa_id
155253 , p_flexfield_segment_code => l_adr_flexfield_segment_code
155254 , p_flex_value_set_id => l_adr_flex_value_set_id
155255 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
155256 , p_adr_type_code => 'S'
155257 , p_component_type => l_component_type
155258 , p_component_code => l_component_code
155259 , p_component_type_code => l_component_type_code
155260 , p_component_appl_id => l_component_appl_id
155261 , p_amb_context_code => l_amb_context_code
155262 , p_entity_code => 'TRANSACTIONS'
155263 , p_event_class_code => 'TRANSFERS'
155264 , p_side => 'NA'
155265 );
155266
155267 END IF;
155268
155269 l_segment := AcctDerRule_169(
155270 p_application_id => p_application_id
155271 , p_ae_header_id => l_ae_header_id
155272 , p_source_5 => p_source_5
155273 , p_source_31 => p_source_31
155274 , x_transaction_coa_id => l_adr_transaction_coa_id
155275 , x_accounting_coa_id => l_adr_accounting_coa_id
155276 , x_flexfield_segment_code => l_adr_flexfield_segment_code
155277 , x_flex_value_set_id => l_adr_flex_value_set_id
155278 , x_value_type_code => l_adr_value_type_code
155279 , x_value_combination_id => l_adr_value_combination_id
155280 , x_value_segment_code => l_adr_value_segment_code
155281 , p_side => 'NA'
155282 , p_override_seg_flag => 'Y'
155283 );
155284
155285 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
155286
155287 xla_ae_lines_pkg.set_segment(
155288 p_to_segment_code => 'GL_BALANCING'
155289 , p_segment_value => l_segment
155290 , p_from_segment_code => l_adr_value_segment_code
155291 , p_from_combination_id => l_adr_value_combination_id
155292 , p_value_type_code => l_adr_value_type_code
155293 , p_transaction_coa_id => l_adr_transaction_coa_id
155294 , p_accounting_coa_id => l_adr_accounting_coa_id
155295 , p_flexfield_segment_code => l_adr_flexfield_segment_code
155296 , p_flex_value_set_id => l_adr_flex_value_set_id
155297 , p_adr_code => 'FA_EXPENSE_ACCT'
155298 , p_adr_type_code => 'S'
155299 , p_component_type => l_component_type
155300 , p_component_code => l_component_code
155301 , p_component_type_code => l_component_type_code
155302 , p_component_appl_id => l_component_appl_id
155303 , p_amb_context_code => l_amb_context_code
155304 , p_entity_code => 'TRANSACTIONS'
155305 , p_event_class_code => 'TRANSFERS'
155306 , p_side => 'NA'
155307 );
155308
155309 END IF;
155310
155311 --
155312 --
155313 END IF;
155314 --
155315 -- Bug 4922099
155316 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
155317 (NVL(l_enc_upg_option, 'N') = 'O')
155318 ) AND
155319 (l_bflow_method_code = 'PRIOR_ENTRY')
155320 )
155321 THEN
155322 IF
155323 --
155324 1 = 2
155325 --
155326 THEN
155327 xla_accounting_err_pkg.build_message
155328 (p_appli_s_name => 'XLA'
155329 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
155330 ,p_token_1 => 'LINE_NUMBER'
155331 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
155332 ,p_token_2 => 'LINE_TYPE_NAME'
155333 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
155334 l_component_type
155335 ,l_component_code
155336 ,l_component_type_code
155337 ,l_component_appl_id
155338 ,l_amb_context_code
155339 ,l_entity_code
155340 ,l_event_class_code
155341 )
155342 ,p_token_3 => 'OWNER'
155343 ,p_value_3 => xla_lookups_pkg.get_meaning(
155347 ,p_token_4 => 'PRODUCT_NAME'
155344 p_lookup_type => 'XLA_OWNER_TYPE'
155345 ,p_lookup_code => l_component_type_code
155346 )
155348 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
155349 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
155350 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
155351 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
155352 ,p_ae_header_id => NULL
155353 );
155354
155355 IF (C_LEVEL_ERROR>= g_log_level) THEN
155356 trace
155357 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
155358 ,p_level => C_LEVEL_ERROR
155359 ,p_module => l_log_module);
155360 END IF;
155361 END IF;
155362 END IF;
155363 --
155364 --
155365 ------------------------------------------------------------------------------------------------
155366 -- 4219869 Business Flow
155367 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
155368 -- Prior Entry. Currently, the following code is always generated.
155369 ------------------------------------------------------------------------------------------------
155370 XLA_AE_LINES_PKG.ValidateCurrentLine;
155371
155372 ------------------------------------------------------------------------------------
155373 -- 4219869 Business Flow
155374 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
155375 ------------------------------------------------------------------------------------
155376 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
155377
155378 ----------------------------------------------------------------------------------
155379 -- 4219869 Business Flow
155380 -- Update journal entry status -- Need to generate this within IF <condition>
155381 ----------------------------------------------------------------------------------
155382 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
155383 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
155384 ,p_balance_type_code => l_balance_type_code
155385 );
155386
155387 -------------------------------------------------------------------------------------------
155388 -- 4262811 - Generate the Accrual Reversal lines
155389 -------------------------------------------------------------------------------------------
155390 BEGIN
155391 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
155392 (g_array_event(p_event_id).array_value_num('header_index'));
155393 IF l_acc_rev_flag IS NULL THEN
155394 l_acc_rev_flag := 'N';
155395 END IF;
155396 EXCEPTION
155397 WHEN OTHERS THEN
155398 l_acc_rev_flag := 'N';
155399 END;
155400 --
155401 IF (l_acc_rev_flag = 'Y') THEN
155402
155403 -- 4645092 ------------------------------------------------------------------------------
155404 -- To allow MPA report to determine if it should generate report process
155405 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
155406 ------------------------------------------------------------------------------------------
155407
155408 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
155409 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
155410 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
155411 -- call ADRs
155412 -- Bug 4922099
155413 --
155414 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
155415 (NVL(l_actual_upg_option, 'N') = 'O') OR
155416 (NVL(l_enc_upg_option, 'N') = 'O')
155417 )
155418 THEN
155419 NULL;
155420 --
155421 --
155422
155423 l_ccid := AcctDerRule_175(
155424 p_application_id => p_application_id
155425 , p_ae_header_id => l_ae_header_id
155426 , p_source_5 => p_source_5
155427 , p_source_19 => p_source_19
155428 , p_source_32 => p_source_32
155429 , x_transaction_coa_id => l_adr_transaction_coa_id
155430 , x_accounting_coa_id => l_adr_accounting_coa_id
155431 , x_value_type_code => l_adr_value_type_code
155432 , p_side => 'NA'
155433 );
155434
155435 xla_ae_lines_pkg.set_ccid(
155436 p_code_combination_id => l_ccid
155437 , p_value_type_code => l_adr_value_type_code
155438 , p_transaction_coa_id => l_adr_transaction_coa_id
155439 , p_accounting_coa_id => l_adr_accounting_coa_id
155440 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
155441 , p_adr_type_code => 'S'
155442 , p_component_type => l_component_type
155443 , p_component_code => l_component_code
155444 , p_component_type_code => l_component_type_code
155445 , p_component_appl_id => l_component_appl_id
155446 , p_amb_context_code => l_amb_context_code
155450
155447 , p_side => 'NA'
155448 );
155449
155451 l_segment := AcctDerRule_145(
155452 p_application_id => p_application_id
155453 , p_ae_header_id => l_ae_header_id
155454 , p_source_5 => p_source_5
155455 , p_source_6 => p_source_6
155456 , x_transaction_coa_id => l_adr_transaction_coa_id
155457 , x_accounting_coa_id => l_adr_accounting_coa_id
155458 , x_flexfield_segment_code => l_adr_flexfield_segment_code
155459 , x_flex_value_set_id => l_adr_flex_value_set_id
155460 , x_value_type_code => l_adr_value_type_code
155461 , x_value_combination_id => l_adr_value_combination_id
155462 , x_value_segment_code => l_adr_value_segment_code
155463 , p_side => 'NA'
155464 , p_override_seg_flag => 'Y'
155465 );
155466
155467 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
155468
155469 xla_ae_lines_pkg.set_segment(
155470 p_to_segment_code => 'GL_ACCOUNT'
155471 , p_segment_value => l_segment
155472 , p_from_segment_code => l_adr_value_segment_code
155473 , p_from_combination_id => l_adr_value_combination_id
155474 , p_value_type_code => l_adr_value_type_code
155475 , p_transaction_coa_id => l_adr_transaction_coa_id
155476 , p_accounting_coa_id => l_adr_accounting_coa_id
155477 , p_flexfield_segment_code => l_adr_flexfield_segment_code
155478 , p_flex_value_set_id => l_adr_flex_value_set_id
155479 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
155480 , p_adr_type_code => 'S'
155481 , p_component_type => l_component_type
155482 , p_component_code => l_component_code
155483 , p_component_type_code => l_component_type_code
155484 , p_component_appl_id => l_component_appl_id
155485 , p_amb_context_code => l_amb_context_code
155486 , p_entity_code => 'TRANSACTIONS'
155487 , p_event_class_code => 'TRANSFERS'
155488 , p_side => 'NA'
155489 );
155490
155491 END IF;
155492
155493 l_segment := AcctDerRule_169(
155494 p_application_id => p_application_id
155495 , p_ae_header_id => l_ae_header_id
155496 , p_source_5 => p_source_5
155497 , p_source_31 => p_source_31
155498 , x_transaction_coa_id => l_adr_transaction_coa_id
155499 , x_accounting_coa_id => l_adr_accounting_coa_id
155500 , x_flexfield_segment_code => l_adr_flexfield_segment_code
155501 , x_flex_value_set_id => l_adr_flex_value_set_id
155502 , x_value_type_code => l_adr_value_type_code
155503 , x_value_combination_id => l_adr_value_combination_id
155504 , x_value_segment_code => l_adr_value_segment_code
155505 , p_side => 'NA'
155506 , p_override_seg_flag => 'Y'
155507 );
155508
155509 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
155510
155511 xla_ae_lines_pkg.set_segment(
155512 p_to_segment_code => 'GL_BALANCING'
155513 , p_segment_value => l_segment
155514 , p_from_segment_code => l_adr_value_segment_code
155515 , p_from_combination_id => l_adr_value_combination_id
155516 , p_value_type_code => l_adr_value_type_code
155517 , p_transaction_coa_id => l_adr_transaction_coa_id
155518 , p_accounting_coa_id => l_adr_accounting_coa_id
155519 , p_flexfield_segment_code => l_adr_flexfield_segment_code
155520 , p_flex_value_set_id => l_adr_flex_value_set_id
155521 , p_adr_code => 'FA_EXPENSE_ACCT'
155522 , p_adr_type_code => 'S'
155523 , p_component_type => l_component_type
155524 , p_component_code => l_component_code
155525 , p_component_type_code => l_component_type_code
155526 , p_component_appl_id => l_component_appl_id
155527 , p_amb_context_code => l_amb_context_code
155528 , p_entity_code => 'TRANSACTIONS'
155529 , p_event_class_code => 'TRANSFERS'
155530 , p_side => 'NA'
155531 );
155532
155533 END IF;
155534
155535 --
155536 --
155537 END IF;
155538
155539 --
155540 -- Update the line information that should be overwritten
155541 --
155542 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
155543 p_header_num => 1);
155544 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
155545
155546 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
155547
155548 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
155549 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
155550 END IF;
155551
155552 --
155553 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
155554 --
155555 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
155556 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
155560 ---------------------------------------------------------------------------------------------------
155557 ELSE
155558 ---------------------------------------------------------------------------------------------------
155559 -- 4262811a Switch Sign
155561 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
155562 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
155563 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
155564 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
155565 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
155566 -- 5132302
155567 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
155568 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
155569
155570 END IF;
155571
155572 -- 4955764
155573 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
155574 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
155575
155576
155577 XLA_AE_LINES_PKG.ValidateCurrentLine;
155578 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
155579
155580 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
155581 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
155582 ,p_balance_type_code => l_balance_type_code);
155583
155584 END IF;
155585
155586 -----------------------------------------------------------------------------------------
155587 -- 4262811 Multiperiod Accounting
155588 -----------------------------------------------------------------------------------------
155589 -- No MPA option is assigned.
155590
155591
155592 END IF;
155593 END IF;
155594 --
155595
155596 --
155597 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
155598 trace
155599 (p_msg => 'END of AcctLineType_382'
155600 ,p_level => C_LEVEL_PROCEDURE
155601 ,p_module => l_log_module);
155602 END IF;
155603 --
155604 EXCEPTION
155605 WHEN xla_exceptions_pkg.application_exception THEN
155606 RAISE;
155607 WHEN OTHERS THEN
155608 xla_exceptions_pkg.raise_message
155609 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_382');
155610 END AcctLineType_382;
155611 --
155612
155613 ---------------------------------------
155614 --
155615 -- PRIVATE FUNCTION
155616 -- AcctLineType_383
155617 --
155618 ---------------------------------------
155619 PROCEDURE AcctLineType_383 (
155620 p_application_id IN NUMBER
155621 ,p_event_id IN NUMBER
155622 ,p_calculate_acctd_flag IN VARCHAR2
155623 ,p_calculate_g_l_flag IN VARCHAR2
155624 ,p_actual_flag IN OUT VARCHAR2
155625 ,p_balance_type_code OUT VARCHAR2
155626 ,p_gain_or_loss_ref OUT VARCHAR2
155627
155628 --Period Close Date
155629 , p_source_1 IN DATE
155630 --Generated Code Combination Identifier
155631 , p_source_5 IN NUMBER
155632 --Asset Cost Account
155633 , p_source_11 IN VARCHAR2
155634 --Expense Account Code Combination Identifier
155635 , p_source_31 IN NUMBER
155636 --Default Code Combination Identifier
155637 , p_source_32 IN NUMBER
155638 --Adjustment Type
155639 , p_source_48 IN VARCHAR2
155640 --Transaction Header Identifier
155641 , p_source_49 IN NUMBER
155642 --Adjustment Line Identifier
155643 , p_source_50 IN NUMBER
155644 --Distribution Type Code
155645 , p_source_51 IN VARCHAR2
155646 --Entered Amount
155647 , p_source_52 IN NUMBER
155648 --Currency Code
155649 , p_source_53 IN VARCHAR2
155650 --Source Destination Code
155651 , p_source_55 IN VARCHAR2
155652 )
155653 IS
155654
155655 l_component_type VARCHAR2(80);
155656 l_component_code VARCHAR2(30);
155657 l_component_type_code VARCHAR2(1);
155658 l_component_appl_id INTEGER;
155659 l_amb_context_code VARCHAR2(30);
155660 l_entity_code VARCHAR2(30);
155661 l_event_class_code VARCHAR2(30);
155662 l_ae_header_id NUMBER;
155663 l_event_type_code VARCHAR2(30);
155664 l_line_definition_code VARCHAR2(30);
155665 l_line_definition_owner_code VARCHAR2(1);
155666 --
155667 -- adr variables
155668 l_segment VARCHAR2(30);
155669 l_ccid NUMBER;
155670 l_adr_transaction_coa_id NUMBER;
155671 l_adr_accounting_coa_id NUMBER;
155672 l_adr_flexfield_segment_code VARCHAR2(30);
155673 l_adr_flex_value_set_id NUMBER;
155674 l_adr_value_type_code VARCHAR2(30);
155675 l_adr_value_combination_id NUMBER;
155676 l_adr_value_segment_code VARCHAR2(30);
155677
155678 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
155679 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
155680 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
155681 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
155682
155683 -- 4262811 Variables ------------------------------------------------------------------------------------------
155684 l_entered_amt_idx NUMBER;
155688 l_tmp_amt NUMBER;
155685 l_accted_amt_idx NUMBER;
155686 l_acc_rev_flag VARCHAR2(1);
155687 l_accrual_line_num NUMBER;
155689 l_acc_rev_natural_side_code VARCHAR2(1);
155690
155691 l_num_entries NUMBER;
155692 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
155693 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
155694 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
155695 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
155696 l_recog_line_1 NUMBER;
155697 l_recog_line_2 NUMBER;
155698
155699 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
155700 l_bflow_applied_to_amt NUMBER; -- 5132302
155701 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
155702
155703 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
155704
155705 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
155706 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
155707
155708 ---------------------------------------------------------------------------------------------------------------
155709
155710
155711 --
155712 -- bulk performance
155713 --
155714 l_balance_type_code VARCHAR2(1);
155715 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
155716 l_log_module VARCHAR2(240);
155717
155718 --
155719 -- Upgrade strategy
155720 --
155721 l_actual_upg_option VARCHAR2(1);
155722 l_enc_upg_option VARCHAR2(1);
155723
155724 --
155725 BEGIN
155726 --
155727 IF g_log_enabled THEN
155728 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_383';
155729 END IF;
155730 --
155731 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
155732
155733 trace
155734 (p_msg => 'BEGIN of AcctLineType_383'
155735 ,p_level => C_LEVEL_PROCEDURE
155736 ,p_module => l_log_module);
155737
155738 END IF;
155739 --
155740 l_component_type := 'AMB_JLT';
155741 l_component_code := 'FA_TRANSFER_DEST_COST';
155742 l_component_type_code := 'S';
155743 l_component_appl_id := 140;
155744 l_amb_context_code := 'DEFAULT';
155745 l_entity_code := 'TRANSACTIONS';
155746 l_event_class_code := 'TRANSFERS';
155747 l_event_type_code := 'TRANSFERS_ALL';
155748 l_line_definition_owner_code := 'S';
155749 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
155750 --
155751 l_balance_type_code := 'A';
155752 l_segment := NULL;
155753 l_ccid := NULL;
155754 l_adr_transaction_coa_id := NULL;
155755 l_adr_accounting_coa_id := NULL;
155756 l_adr_flexfield_segment_code := NULL;
155757 l_adr_flex_value_set_id := NULL;
155758 l_adr_value_type_code := NULL;
155759 l_adr_value_combination_id := NULL;
155760 l_adr_value_segment_code := NULL;
155761
155762 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
155763 l_bflow_class_code := ''; -- 4219869 Business Flow
155764 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
155765 l_budgetary_control_flag := 'N';
155766
155767 l_bflow_applied_to_amt_idx := NULL; -- 5132302
155768 l_bflow_applied_to_amt := NULL; -- 5132302
155769 l_entered_amt_idx := NULL; -- 4262811
155770 l_accted_amt_idx := NULL; -- 4262811
155771 l_acc_rev_flag := NULL; -- 4262811
155772 l_accrual_line_num := NULL; -- 4262811
155773 l_tmp_amt := NULL; -- 4262811
155774 --
155775
155776 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
155777 l_balance_type_code <> 'B' THEN
155778 IF NVL(p_source_48,'
155779 ') = 'COST' AND
155780 NVL(p_source_55,'
155781 ') = 'DEST'
155782 THEN
155783
155784 --
155785 XLA_AE_LINES_PKG.SetNewLine;
155786
155787 p_balance_type_code := l_balance_type_code;
155788 -- set the flag so later we will know whether the gain loss line needs to be created
155789
155790 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
155791 p_actual_flag :='A';
155792 END IF;
155793
155794 --
155795 -- bulk performance
155796 --
155797 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
155798 p_header_num => 0); -- 4262811
155799 --
155800 -- set accounting line options
155801 --
155802 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
155803 p_natural_side_code => 'D'
155804 , p_gain_or_loss_flag => 'N'
155805 , p_gl_transfer_mode_code => 'S'
155806 , p_acct_entry_type_code => 'A'
155807 , p_switch_side_flag => 'Y'
155808 , p_merge_duplicate_code => 'N'
155809 );
155810 --
155811 l_acc_rev_natural_side_code := 'C'; -- 4262811
155812 --
155813 --
155814 -- set accounting line type info
155815 --
155816 xla_ae_lines_pkg.SetAcctLineType
155817 (p_component_type => l_component_type
155821 ,p_accounting_line_code => l_component_code
155818 ,p_event_type_code => l_event_type_code
155819 ,p_line_definition_owner_code => l_line_definition_owner_code
155820 ,p_line_definition_code => l_line_definition_code
155822 ,p_accounting_line_type_code => l_component_type_code
155823 ,p_accounting_line_appl_id => l_component_appl_id
155824 ,p_amb_context_code => l_amb_context_code
155825 ,p_entity_code => l_entity_code
155826 ,p_event_class_code => l_event_class_code);
155827 --
155828 -- set accounting class
155829 --
155830 xla_ae_lines_pkg.SetAcctClass(
155831 p_accounting_class_code => 'ASSET'
155832 , p_ae_header_id => l_ae_header_id
155833 );
155834
155835 --
155836 -- set rounding class
155837 --
155838 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
155839 'ASSET';
155840
155841 --
155842 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
155843 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
155844 --
155845 -- bulk performance
155846 --
155847 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
155848
155849 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
155850 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
155851
155852 -- 4955764
155853 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
155854 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
155855
155856 -- 4458381 Public Sector Enh
155857
155858 --
155859 -- set accounting attributes for the line type
155860 --
155861 l_entered_amt_idx := 4;
155862 l_accted_amt_idx := 6;
155863 l_bflow_applied_to_amt_idx := NULL; -- 5132302
155864 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
155865 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
155866 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
155867 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
155868 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
155869 l_rec_acct_attrs.array_char_value(3) := p_source_51;
155870 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
155871 l_rec_acct_attrs.array_num_value(4) := p_source_52;
155872 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
155873 l_rec_acct_attrs.array_char_value(5) := p_source_53;
155874 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
155875 l_rec_acct_attrs.array_num_value(6) := p_source_52;
155876
155877 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
155878 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
155879
155880 ---------------------------------------------------------------------------------------------------------------
155881 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
155882 ---------------------------------------------------------------------------------------------------------------
155883 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
155884
155885 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
155886 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
155887
155888 IF xla_accounting_cache_pkg.GetValueChar
155889 (p_source_code => 'LEDGER_CATEGORY_CODE'
155890 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
155891 AND l_bflow_method_code = 'PRIOR_ENTRY'
155892 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
155893 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
155894 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
155895 )
155896 THEN
155897 xla_ae_lines_pkg.BflowUpgEntry
155898 (p_business_method_code => l_bflow_method_code
155899 ,p_business_class_code => l_bflow_class_code
155900 ,p_balance_type => l_balance_type_code);
155901 ELSE
155902 NULL;
155903 -- No business flow processing for business flow method of NONE.
155904 END IF;
155905
155906 --
155907 -- call analytical criteria
155908 --
155909
155910 --
155911 -- call description
155912 --
155913
155914 xla_ae_lines_pkg.SetLineDescription(
155915 p_ae_header_id => l_ae_header_id
155916 ,p_description => Description_126 (
155917 p_application_id => p_application_id
155918 , p_ae_header_id => l_ae_header_id
155919 , p_source_1 => p_source_1
155920 )
155921 );
155922
155923
155924 --
155925 -- call ADRs
155926 -- Bug 4922099
155927 --
155928 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
155929 (NVL(l_actual_upg_option, 'N') = 'O') OR
155930 (NVL(l_enc_upg_option, 'N') = 'O')
155931 )
155932 THEN
155933 NULL;
155934 --
155935 --
155936
155937 l_ccid := AcctDerRule_174(
155941 , p_source_32 => p_source_32
155938 p_application_id => p_application_id
155939 , p_ae_header_id => l_ae_header_id
155940 , p_source_5 => p_source_5
155942 , x_transaction_coa_id => l_adr_transaction_coa_id
155943 , x_accounting_coa_id => l_adr_accounting_coa_id
155944 , x_value_type_code => l_adr_value_type_code
155945 , p_side => 'NA'
155946 );
155947
155948 xla_ae_lines_pkg.set_ccid(
155949 p_code_combination_id => l_ccid
155950 , p_value_type_code => l_adr_value_type_code
155951 , p_transaction_coa_id => l_adr_transaction_coa_id
155952 , p_accounting_coa_id => l_adr_accounting_coa_id
155953 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
155954 , p_adr_type_code => 'S'
155955 , p_component_type => l_component_type
155956 , p_component_code => l_component_code
155957 , p_component_type_code => l_component_type_code
155958 , p_component_appl_id => l_component_appl_id
155959 , p_amb_context_code => l_amb_context_code
155960 , p_side => 'NA'
155961 );
155962
155963
155964 l_segment := AcctDerRule_149(
155965 p_application_id => p_application_id
155966 , p_ae_header_id => l_ae_header_id
155967 , p_source_5 => p_source_5
155968 , p_source_11 => p_source_11
155969 , x_transaction_coa_id => l_adr_transaction_coa_id
155970 , x_accounting_coa_id => l_adr_accounting_coa_id
155971 , x_flexfield_segment_code => l_adr_flexfield_segment_code
155972 , x_flex_value_set_id => l_adr_flex_value_set_id
155973 , x_value_type_code => l_adr_value_type_code
155974 , x_value_combination_id => l_adr_value_combination_id
155975 , x_value_segment_code => l_adr_value_segment_code
155976 , p_side => 'NA'
155977 , p_override_seg_flag => 'Y'
155978 );
155979
155980 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
155981
155982 xla_ae_lines_pkg.set_segment(
155983 p_to_segment_code => 'GL_ACCOUNT'
155984 , p_segment_value => l_segment
155985 , p_from_segment_code => l_adr_value_segment_code
155986 , p_from_combination_id => l_adr_value_combination_id
155987 , p_value_type_code => l_adr_value_type_code
155988 , p_transaction_coa_id => l_adr_transaction_coa_id
155989 , p_accounting_coa_id => l_adr_accounting_coa_id
155990 , p_flexfield_segment_code => l_adr_flexfield_segment_code
155991 , p_flex_value_set_id => l_adr_flex_value_set_id
155992 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
155993 , p_adr_type_code => 'S'
155994 , p_component_type => l_component_type
155995 , p_component_code => l_component_code
155996 , p_component_type_code => l_component_type_code
155997 , p_component_appl_id => l_component_appl_id
155998 , p_amb_context_code => l_amb_context_code
155999 , p_entity_code => 'TRANSACTIONS'
156000 , p_event_class_code => 'TRANSFERS'
156001 , p_side => 'NA'
156002 );
156003
156004 END IF;
156005
156006 l_segment := AcctDerRule_169(
156007 p_application_id => p_application_id
156008 , p_ae_header_id => l_ae_header_id
156009 , p_source_5 => p_source_5
156010 , p_source_31 => p_source_31
156011 , x_transaction_coa_id => l_adr_transaction_coa_id
156012 , x_accounting_coa_id => l_adr_accounting_coa_id
156013 , x_flexfield_segment_code => l_adr_flexfield_segment_code
156014 , x_flex_value_set_id => l_adr_flex_value_set_id
156015 , x_value_type_code => l_adr_value_type_code
156016 , x_value_combination_id => l_adr_value_combination_id
156017 , x_value_segment_code => l_adr_value_segment_code
156018 , p_side => 'NA'
156019 , p_override_seg_flag => 'Y'
156020 );
156021
156022 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
156023
156024 xla_ae_lines_pkg.set_segment(
156025 p_to_segment_code => 'GL_BALANCING'
156026 , p_segment_value => l_segment
156027 , p_from_segment_code => l_adr_value_segment_code
156028 , p_from_combination_id => l_adr_value_combination_id
156029 , p_value_type_code => l_adr_value_type_code
156030 , p_transaction_coa_id => l_adr_transaction_coa_id
156031 , p_accounting_coa_id => l_adr_accounting_coa_id
156032 , p_flexfield_segment_code => l_adr_flexfield_segment_code
156033 , p_flex_value_set_id => l_adr_flex_value_set_id
156034 , p_adr_code => 'FA_EXPENSE_ACCT'
156035 , p_adr_type_code => 'S'
156036 , p_component_type => l_component_type
156037 , p_component_code => l_component_code
156038 , p_component_type_code => l_component_type_code
156039 , p_component_appl_id => l_component_appl_id
156040 , p_amb_context_code => l_amb_context_code
156041 , p_entity_code => 'TRANSACTIONS'
156042 , p_event_class_code => 'TRANSFERS'
156046 END IF;
156043 , p_side => 'NA'
156044 );
156045
156047
156048 --
156049 --
156050 END IF;
156051 --
156052 -- Bug 4922099
156053 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
156054 (NVL(l_enc_upg_option, 'N') = 'O')
156055 ) AND
156056 (l_bflow_method_code = 'PRIOR_ENTRY')
156057 )
156058 THEN
156059 IF
156060 --
156061 1 = 2
156062 --
156063 THEN
156064 xla_accounting_err_pkg.build_message
156065 (p_appli_s_name => 'XLA'
156066 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
156067 ,p_token_1 => 'LINE_NUMBER'
156068 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
156069 ,p_token_2 => 'LINE_TYPE_NAME'
156070 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
156071 l_component_type
156072 ,l_component_code
156073 ,l_component_type_code
156074 ,l_component_appl_id
156075 ,l_amb_context_code
156076 ,l_entity_code
156077 ,l_event_class_code
156078 )
156079 ,p_token_3 => 'OWNER'
156080 ,p_value_3 => xla_lookups_pkg.get_meaning(
156081 p_lookup_type => 'XLA_OWNER_TYPE'
156082 ,p_lookup_code => l_component_type_code
156083 )
156084 ,p_token_4 => 'PRODUCT_NAME'
156085 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
156086 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
156087 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
156088 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
156089 ,p_ae_header_id => NULL
156090 );
156091
156092 IF (C_LEVEL_ERROR>= g_log_level) THEN
156093 trace
156094 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
156095 ,p_level => C_LEVEL_ERROR
156096 ,p_module => l_log_module);
156097 END IF;
156098 END IF;
156099 END IF;
156100 --
156101 --
156102 ------------------------------------------------------------------------------------------------
156103 -- 4219869 Business Flow
156104 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
156105 -- Prior Entry. Currently, the following code is always generated.
156106 ------------------------------------------------------------------------------------------------
156107 XLA_AE_LINES_PKG.ValidateCurrentLine;
156108
156109 ------------------------------------------------------------------------------------
156110 -- 4219869 Business Flow
156111 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
156112 ------------------------------------------------------------------------------------
156113 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
156114
156115 ----------------------------------------------------------------------------------
156116 -- 4219869 Business Flow
156117 -- Update journal entry status -- Need to generate this within IF <condition>
156118 ----------------------------------------------------------------------------------
156119 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
156120 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
156121 ,p_balance_type_code => l_balance_type_code
156122 );
156123
156124 -------------------------------------------------------------------------------------------
156125 -- 4262811 - Generate the Accrual Reversal lines
156126 -------------------------------------------------------------------------------------------
156127 BEGIN
156128 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
156129 (g_array_event(p_event_id).array_value_num('header_index'));
156130 IF l_acc_rev_flag IS NULL THEN
156131 l_acc_rev_flag := 'N';
156132 END IF;
156133 EXCEPTION
156134 WHEN OTHERS THEN
156135 l_acc_rev_flag := 'N';
156136 END;
156137 --
156138 IF (l_acc_rev_flag = 'Y') THEN
156139
156140 -- 4645092 ------------------------------------------------------------------------------
156141 -- To allow MPA report to determine if it should generate report process
156145 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
156142 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
156143 ------------------------------------------------------------------------------------------
156144
156146 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
156147 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
156148 -- call ADRs
156149 -- Bug 4922099
156150 --
156151 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
156152 (NVL(l_actual_upg_option, 'N') = 'O') OR
156153 (NVL(l_enc_upg_option, 'N') = 'O')
156154 )
156155 THEN
156156 NULL;
156157 --
156158 --
156159
156160 l_ccid := AcctDerRule_174(
156161 p_application_id => p_application_id
156162 , p_ae_header_id => l_ae_header_id
156163 , p_source_5 => p_source_5
156164 , p_source_32 => p_source_32
156165 , x_transaction_coa_id => l_adr_transaction_coa_id
156166 , x_accounting_coa_id => l_adr_accounting_coa_id
156167 , x_value_type_code => l_adr_value_type_code
156168 , p_side => 'NA'
156169 );
156170
156171 xla_ae_lines_pkg.set_ccid(
156172 p_code_combination_id => l_ccid
156173 , p_value_type_code => l_adr_value_type_code
156174 , p_transaction_coa_id => l_adr_transaction_coa_id
156175 , p_accounting_coa_id => l_adr_accounting_coa_id
156176 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
156177 , p_adr_type_code => 'S'
156178 , p_component_type => l_component_type
156179 , p_component_code => l_component_code
156180 , p_component_type_code => l_component_type_code
156181 , p_component_appl_id => l_component_appl_id
156182 , p_amb_context_code => l_amb_context_code
156183 , p_side => 'NA'
156184 );
156185
156186
156187 l_segment := AcctDerRule_149(
156188 p_application_id => p_application_id
156189 , p_ae_header_id => l_ae_header_id
156190 , p_source_5 => p_source_5
156191 , p_source_11 => p_source_11
156192 , x_transaction_coa_id => l_adr_transaction_coa_id
156193 , x_accounting_coa_id => l_adr_accounting_coa_id
156194 , x_flexfield_segment_code => l_adr_flexfield_segment_code
156195 , x_flex_value_set_id => l_adr_flex_value_set_id
156196 , x_value_type_code => l_adr_value_type_code
156197 , x_value_combination_id => l_adr_value_combination_id
156198 , x_value_segment_code => l_adr_value_segment_code
156199 , p_side => 'NA'
156200 , p_override_seg_flag => 'Y'
156201 );
156202
156203 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
156204
156205 xla_ae_lines_pkg.set_segment(
156206 p_to_segment_code => 'GL_ACCOUNT'
156207 , p_segment_value => l_segment
156208 , p_from_segment_code => l_adr_value_segment_code
156209 , p_from_combination_id => l_adr_value_combination_id
156210 , p_value_type_code => l_adr_value_type_code
156211 , p_transaction_coa_id => l_adr_transaction_coa_id
156212 , p_accounting_coa_id => l_adr_accounting_coa_id
156213 , p_flexfield_segment_code => l_adr_flexfield_segment_code
156214 , p_flex_value_set_id => l_adr_flex_value_set_id
156215 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
156216 , p_adr_type_code => 'S'
156217 , p_component_type => l_component_type
156218 , p_component_code => l_component_code
156219 , p_component_type_code => l_component_type_code
156220 , p_component_appl_id => l_component_appl_id
156221 , p_amb_context_code => l_amb_context_code
156222 , p_entity_code => 'TRANSACTIONS'
156223 , p_event_class_code => 'TRANSFERS'
156224 , p_side => 'NA'
156225 );
156226
156227 END IF;
156228
156229 l_segment := AcctDerRule_169(
156230 p_application_id => p_application_id
156231 , p_ae_header_id => l_ae_header_id
156232 , p_source_5 => p_source_5
156233 , p_source_31 => p_source_31
156234 , x_transaction_coa_id => l_adr_transaction_coa_id
156235 , x_accounting_coa_id => l_adr_accounting_coa_id
156236 , x_flexfield_segment_code => l_adr_flexfield_segment_code
156237 , x_flex_value_set_id => l_adr_flex_value_set_id
156238 , x_value_type_code => l_adr_value_type_code
156239 , x_value_combination_id => l_adr_value_combination_id
156240 , x_value_segment_code => l_adr_value_segment_code
156241 , p_side => 'NA'
156242 , p_override_seg_flag => 'Y'
156243 );
156244
156245 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
156246
156247 xla_ae_lines_pkg.set_segment(
156248 p_to_segment_code => 'GL_BALANCING'
156249 , p_segment_value => l_segment
156250 , p_from_segment_code => l_adr_value_segment_code
156251 , p_from_combination_id => l_adr_value_combination_id
156252 , p_value_type_code => l_adr_value_type_code
156253 , p_transaction_coa_id => l_adr_transaction_coa_id
156257 , p_adr_code => 'FA_EXPENSE_ACCT'
156254 , p_accounting_coa_id => l_adr_accounting_coa_id
156255 , p_flexfield_segment_code => l_adr_flexfield_segment_code
156256 , p_flex_value_set_id => l_adr_flex_value_set_id
156258 , p_adr_type_code => 'S'
156259 , p_component_type => l_component_type
156260 , p_component_code => l_component_code
156261 , p_component_type_code => l_component_type_code
156262 , p_component_appl_id => l_component_appl_id
156263 , p_amb_context_code => l_amb_context_code
156264 , p_entity_code => 'TRANSACTIONS'
156265 , p_event_class_code => 'TRANSFERS'
156266 , p_side => 'NA'
156267 );
156268
156269 END IF;
156270
156271 --
156272 --
156273 END IF;
156274
156275 --
156276 -- Update the line information that should be overwritten
156277 --
156278 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
156279 p_header_num => 1);
156280 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
156281
156282 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
156283
156284 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
156285 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
156286 END IF;
156287
156288 --
156289 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
156290 --
156291 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
156292 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
156293 ELSE
156294 ---------------------------------------------------------------------------------------------------
156295 -- 4262811a Switch Sign
156296 ---------------------------------------------------------------------------------------------------
156297 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
156298 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
156299 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
156300 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
156301 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
156302 -- 5132302
156303 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
156304 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
156305
156306 END IF;
156307
156308 -- 4955764
156309 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
156310 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
156311
156312
156313 XLA_AE_LINES_PKG.ValidateCurrentLine;
156314 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
156315
156316 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
156317 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
156318 ,p_balance_type_code => l_balance_type_code);
156319
156320 END IF;
156321
156322 -----------------------------------------------------------------------------------------
156323 -- 4262811 Multiperiod Accounting
156324 -----------------------------------------------------------------------------------------
156325 -- No MPA option is assigned.
156326
156327
156328 END IF;
156329 END IF;
156330 --
156331
156332 --
156333 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
156334 trace
156335 (p_msg => 'END of AcctLineType_383'
156336 ,p_level => C_LEVEL_PROCEDURE
156337 ,p_module => l_log_module);
156338 END IF;
156339 --
156340 EXCEPTION
156341 WHEN xla_exceptions_pkg.application_exception THEN
156342 RAISE;
156343 WHEN OTHERS THEN
156344 xla_exceptions_pkg.raise_message
156345 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_383');
156346 END AcctLineType_383;
156347 --
156348
156349 ---------------------------------------
156350 --
156351 -- PRIVATE FUNCTION
156352 -- AcctLineType_384
156353 --
156354 ---------------------------------------
156355 PROCEDURE AcctLineType_384 (
156356 p_application_id IN NUMBER
156357 ,p_event_id IN NUMBER
156358 ,p_calculate_acctd_flag IN VARCHAR2
156359 ,p_calculate_g_l_flag IN VARCHAR2
156360 ,p_actual_flag IN OUT VARCHAR2
156361 ,p_balance_type_code OUT VARCHAR2
156362 ,p_gain_or_loss_ref OUT VARCHAR2
156363
156364 --Period Close Date
156365 , p_source_1 IN DATE
156366 --Generated Code Combination Identifier
156367 , p_source_5 IN NUMBER
156368 --Expense Account Code Combination Identifier
156369 , p_source_31 IN NUMBER
156370 --Adjustment Type
156371 , p_source_48 IN VARCHAR2
156372 --Transaction Header Identifier
156373 , p_source_49 IN NUMBER
156374 --Adjustment Line Identifier
156375 , p_source_50 IN NUMBER
156379 , p_source_52 IN NUMBER
156376 --Distribution Type Code
156377 , p_source_51 IN VARCHAR2
156378 --Entered Amount
156380 --Currency Code
156381 , p_source_53 IN VARCHAR2
156382 --Source Destination Code
156383 , p_source_55 IN VARCHAR2
156384 )
156385 IS
156386
156387 l_component_type VARCHAR2(80);
156388 l_component_code VARCHAR2(30);
156389 l_component_type_code VARCHAR2(1);
156390 l_component_appl_id INTEGER;
156391 l_amb_context_code VARCHAR2(30);
156392 l_entity_code VARCHAR2(30);
156393 l_event_class_code VARCHAR2(30);
156394 l_ae_header_id NUMBER;
156395 l_event_type_code VARCHAR2(30);
156396 l_line_definition_code VARCHAR2(30);
156397 l_line_definition_owner_code VARCHAR2(1);
156398 --
156399 -- adr variables
156400 l_segment VARCHAR2(30);
156401 l_ccid NUMBER;
156402 l_adr_transaction_coa_id NUMBER;
156403 l_adr_accounting_coa_id NUMBER;
156404 l_adr_flexfield_segment_code VARCHAR2(30);
156405 l_adr_flex_value_set_id NUMBER;
156406 l_adr_value_type_code VARCHAR2(30);
156407 l_adr_value_combination_id NUMBER;
156408 l_adr_value_segment_code VARCHAR2(30);
156409
156410 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
156411 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
156412 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
156413 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
156414
156415 -- 4262811 Variables ------------------------------------------------------------------------------------------
156416 l_entered_amt_idx NUMBER;
156417 l_accted_amt_idx NUMBER;
156418 l_acc_rev_flag VARCHAR2(1);
156419 l_accrual_line_num NUMBER;
156420 l_tmp_amt NUMBER;
156421 l_acc_rev_natural_side_code VARCHAR2(1);
156422
156423 l_num_entries NUMBER;
156424 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
156425 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
156426 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
156427 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
156428 l_recog_line_1 NUMBER;
156429 l_recog_line_2 NUMBER;
156430
156431 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
156432 l_bflow_applied_to_amt NUMBER; -- 5132302
156433 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
156434
156435 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
156436
156437 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
156438 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
156439
156440 ---------------------------------------------------------------------------------------------------------------
156441
156442
156443 --
156444 -- bulk performance
156445 --
156446 l_balance_type_code VARCHAR2(1);
156447 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
156448 l_log_module VARCHAR2(240);
156449
156450 --
156451 -- Upgrade strategy
156452 --
156453 l_actual_upg_option VARCHAR2(1);
156454 l_enc_upg_option VARCHAR2(1);
156455
156456 --
156457 BEGIN
156458 --
156459 IF g_log_enabled THEN
156460 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_384';
156461 END IF;
156462 --
156463 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
156464
156465 trace
156466 (p_msg => 'BEGIN of AcctLineType_384'
156467 ,p_level => C_LEVEL_PROCEDURE
156468 ,p_module => l_log_module);
156469
156470 END IF;
156471 --
156472 l_component_type := 'AMB_JLT';
156473 l_component_code := 'FA_TRANSFER_DEST_DEPRN_EXP';
156474 l_component_type_code := 'S';
156475 l_component_appl_id := 140;
156476 l_amb_context_code := 'DEFAULT';
156477 l_entity_code := 'TRANSACTIONS';
156478 l_event_class_code := 'TRANSFERS';
156479 l_event_type_code := 'TRANSFERS_ALL';
156480 l_line_definition_owner_code := 'S';
156481 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
156482 --
156483 l_balance_type_code := 'A';
156484 l_segment := NULL;
156485 l_ccid := NULL;
156486 l_adr_transaction_coa_id := NULL;
156487 l_adr_accounting_coa_id := NULL;
156488 l_adr_flexfield_segment_code := NULL;
156489 l_adr_flex_value_set_id := NULL;
156490 l_adr_value_type_code := NULL;
156491 l_adr_value_combination_id := NULL;
156492 l_adr_value_segment_code := NULL;
156493
156494 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
156495 l_bflow_class_code := ''; -- 4219869 Business Flow
156496 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
156497 l_budgetary_control_flag := 'N';
156498
156499 l_bflow_applied_to_amt_idx := NULL; -- 5132302
156500 l_bflow_applied_to_amt := NULL; -- 5132302
156501 l_entered_amt_idx := NULL; -- 4262811
156502 l_accted_amt_idx := NULL; -- 4262811
156506 --
156503 l_acc_rev_flag := NULL; -- 4262811
156504 l_accrual_line_num := NULL; -- 4262811
156505 l_tmp_amt := NULL; -- 4262811
156507
156508 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
156509 l_balance_type_code <> 'B' THEN
156510 IF NVL(p_source_48,'
156511 ') = 'EXPENSE' AND
156512 NVL(p_source_55,'
156513 ') = 'DEST'
156514 THEN
156515
156516 --
156517 XLA_AE_LINES_PKG.SetNewLine;
156518
156519 p_balance_type_code := l_balance_type_code;
156520 -- set the flag so later we will know whether the gain loss line needs to be created
156521
156522 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
156523 p_actual_flag :='A';
156524 END IF;
156525
156526 --
156527 -- bulk performance
156528 --
156529 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
156530 p_header_num => 0); -- 4262811
156531 --
156532 -- set accounting line options
156533 --
156534 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
156535 p_natural_side_code => 'D'
156536 , p_gain_or_loss_flag => 'N'
156537 , p_gl_transfer_mode_code => 'S'
156538 , p_acct_entry_type_code => 'A'
156539 , p_switch_side_flag => 'Y'
156540 , p_merge_duplicate_code => 'N'
156541 );
156542 --
156543 l_acc_rev_natural_side_code := 'C'; -- 4262811
156544 --
156545 --
156546 -- set accounting line type info
156547 --
156548 xla_ae_lines_pkg.SetAcctLineType
156549 (p_component_type => l_component_type
156550 ,p_event_type_code => l_event_type_code
156551 ,p_line_definition_owner_code => l_line_definition_owner_code
156552 ,p_line_definition_code => l_line_definition_code
156553 ,p_accounting_line_code => l_component_code
156554 ,p_accounting_line_type_code => l_component_type_code
156555 ,p_accounting_line_appl_id => l_component_appl_id
156556 ,p_amb_context_code => l_amb_context_code
156557 ,p_entity_code => l_entity_code
156558 ,p_event_class_code => l_event_class_code);
156559 --
156560 -- set accounting class
156561 --
156562 xla_ae_lines_pkg.SetAcctClass(
156563 p_accounting_class_code => 'EXPENSE'
156564 , p_ae_header_id => l_ae_header_id
156565 );
156566
156567 --
156568 -- set rounding class
156569 --
156570 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
156571 'EXPENSE';
156572
156573 --
156574 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
156575 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
156576 --
156577 -- bulk performance
156578 --
156579 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
156580
156581 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
156582 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
156583
156584 -- 4955764
156585 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
156586 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
156587
156588 -- 4458381 Public Sector Enh
156589
156590 --
156591 -- set accounting attributes for the line type
156592 --
156593 l_entered_amt_idx := 4;
156594 l_accted_amt_idx := 6;
156595 l_bflow_applied_to_amt_idx := NULL; -- 5132302
156596 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
156597 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
156598 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
156599 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
156600 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
156601 l_rec_acct_attrs.array_char_value(3) := p_source_51;
156602 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
156603 l_rec_acct_attrs.array_num_value(4) := p_source_52;
156604 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
156605 l_rec_acct_attrs.array_char_value(5) := p_source_53;
156606 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
156607 l_rec_acct_attrs.array_num_value(6) := p_source_52;
156608
156609 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
156610 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
156611
156612 ---------------------------------------------------------------------------------------------------------------
156613 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
156614 ---------------------------------------------------------------------------------------------------------------
156615 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
156616
156617 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
156621 (p_source_code => 'LEDGER_CATEGORY_CODE'
156618 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
156619
156620 IF xla_accounting_cache_pkg.GetValueChar
156622 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
156623 AND l_bflow_method_code = 'PRIOR_ENTRY'
156624 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
156625 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
156626 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
156627 )
156628 THEN
156629 xla_ae_lines_pkg.BflowUpgEntry
156630 (p_business_method_code => l_bflow_method_code
156631 ,p_business_class_code => l_bflow_class_code
156632 ,p_balance_type => l_balance_type_code);
156633 ELSE
156634 NULL;
156635 -- No business flow processing for business flow method of NONE.
156636 END IF;
156637
156638 --
156639 -- call analytical criteria
156640 --
156641
156642 --
156643 -- call description
156644 --
156645
156646 xla_ae_lines_pkg.SetLineDescription(
156647 p_ae_header_id => l_ae_header_id
156648 ,p_description => Description_127 (
156649 p_application_id => p_application_id
156650 , p_ae_header_id => l_ae_header_id
156651 , p_source_1 => p_source_1
156652 )
156653 );
156654
156655
156656 --
156657 -- call ADRs
156658 -- Bug 4922099
156659 --
156660 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
156661 (NVL(l_actual_upg_option, 'N') = 'O') OR
156662 (NVL(l_enc_upg_option, 'N') = 'O')
156663 )
156664 THEN
156665 NULL;
156666 --
156667 --
156668
156669 l_ccid := AcctDerRule_176(
156670 p_application_id => p_application_id
156671 , p_ae_header_id => l_ae_header_id
156672 , p_source_5 => p_source_5
156673 , p_source_31 => p_source_31
156674 , x_transaction_coa_id => l_adr_transaction_coa_id
156675 , x_accounting_coa_id => l_adr_accounting_coa_id
156676 , x_value_type_code => l_adr_value_type_code
156677 , p_side => 'NA'
156678 );
156679
156680 xla_ae_lines_pkg.set_ccid(
156681 p_code_combination_id => l_ccid
156682 , p_value_type_code => l_adr_value_type_code
156683 , p_transaction_coa_id => l_adr_transaction_coa_id
156684 , p_accounting_coa_id => l_adr_accounting_coa_id
156685 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
156686 , p_adr_type_code => 'S'
156687 , p_component_type => l_component_type
156688 , p_component_code => l_component_code
156689 , p_component_type_code => l_component_type_code
156690 , p_component_appl_id => l_component_appl_id
156691 , p_amb_context_code => l_amb_context_code
156692 , p_side => 'NA'
156693 );
156694
156695
156696 --
156697 --
156698 END IF;
156699 --
156700 -- Bug 4922099
156701 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
156702 (NVL(l_enc_upg_option, 'N') = 'O')
156703 ) AND
156704 (l_bflow_method_code = 'PRIOR_ENTRY')
156705 )
156706 THEN
156707 IF
156708 --
156709 1 = 2
156710 --
156711 THEN
156712 xla_accounting_err_pkg.build_message
156713 (p_appli_s_name => 'XLA'
156714 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
156715 ,p_token_1 => 'LINE_NUMBER'
156716 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
156717 ,p_token_2 => 'LINE_TYPE_NAME'
156718 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
156719 l_component_type
156720 ,l_component_code
156721 ,l_component_type_code
156722 ,l_component_appl_id
156723 ,l_amb_context_code
156724 ,l_entity_code
156725 ,l_event_class_code
156726 )
156727 ,p_token_3 => 'OWNER'
156728 ,p_value_3 => xla_lookups_pkg.get_meaning(
156729 p_lookup_type => 'XLA_OWNER_TYPE'
156730 ,p_lookup_code => l_component_type_code
156731 )
156732 ,p_token_4 => 'PRODUCT_NAME'
156733 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
156734 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
156738 );
156735 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
156736 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
156737 ,p_ae_header_id => NULL
156739
156740 IF (C_LEVEL_ERROR>= g_log_level) THEN
156741 trace
156742 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
156743 ,p_level => C_LEVEL_ERROR
156744 ,p_module => l_log_module);
156745 END IF;
156746 END IF;
156747 END IF;
156748 --
156749 --
156750 ------------------------------------------------------------------------------------------------
156751 -- 4219869 Business Flow
156752 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
156753 -- Prior Entry. Currently, the following code is always generated.
156754 ------------------------------------------------------------------------------------------------
156755 XLA_AE_LINES_PKG.ValidateCurrentLine;
156756
156757 ------------------------------------------------------------------------------------
156758 -- 4219869 Business Flow
156759 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
156760 ------------------------------------------------------------------------------------
156761 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
156762
156763 ----------------------------------------------------------------------------------
156764 -- 4219869 Business Flow
156765 -- Update journal entry status -- Need to generate this within IF <condition>
156766 ----------------------------------------------------------------------------------
156767 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
156768 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
156769 ,p_balance_type_code => l_balance_type_code
156770 );
156771
156772 -------------------------------------------------------------------------------------------
156773 -- 4262811 - Generate the Accrual Reversal lines
156774 -------------------------------------------------------------------------------------------
156775 BEGIN
156776 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
156777 (g_array_event(p_event_id).array_value_num('header_index'));
156778 IF l_acc_rev_flag IS NULL THEN
156779 l_acc_rev_flag := 'N';
156780 END IF;
156781 EXCEPTION
156782 WHEN OTHERS THEN
156783 l_acc_rev_flag := 'N';
156784 END;
156785 --
156786 IF (l_acc_rev_flag = 'Y') THEN
156787
156788 -- 4645092 ------------------------------------------------------------------------------
156789 -- To allow MPA report to determine if it should generate report process
156790 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
156791 ------------------------------------------------------------------------------------------
156792
156793 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
156794 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
156795 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
156796 -- call ADRs
156797 -- Bug 4922099
156798 --
156799 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
156800 (NVL(l_actual_upg_option, 'N') = 'O') OR
156801 (NVL(l_enc_upg_option, 'N') = 'O')
156802 )
156803 THEN
156804 NULL;
156805 --
156806 --
156807
156808 l_ccid := AcctDerRule_176(
156809 p_application_id => p_application_id
156810 , p_ae_header_id => l_ae_header_id
156811 , p_source_5 => p_source_5
156812 , p_source_31 => p_source_31
156813 , x_transaction_coa_id => l_adr_transaction_coa_id
156814 , x_accounting_coa_id => l_adr_accounting_coa_id
156815 , x_value_type_code => l_adr_value_type_code
156816 , p_side => 'NA'
156817 );
156818
156819 xla_ae_lines_pkg.set_ccid(
156820 p_code_combination_id => l_ccid
156821 , p_value_type_code => l_adr_value_type_code
156822 , p_transaction_coa_id => l_adr_transaction_coa_id
156823 , p_accounting_coa_id => l_adr_accounting_coa_id
156824 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
156825 , p_adr_type_code => 'S'
156826 , p_component_type => l_component_type
156827 , p_component_code => l_component_code
156828 , p_component_type_code => l_component_type_code
156829 , p_component_appl_id => l_component_appl_id
156830 , p_amb_context_code => l_amb_context_code
156831 , p_side => 'NA'
156832 );
156833
156834
156835 --
156836 --
156837 END IF;
156838
156839 --
156840 -- Update the line information that should be overwritten
156841 --
156842 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
156843 p_header_num => 1);
156844 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
156845
156846 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
156847
156851
156848 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
156849 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
156850 END IF;
156852 --
156853 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
156854 --
156855 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
156856 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
156857 ELSE
156858 ---------------------------------------------------------------------------------------------------
156859 -- 4262811a Switch Sign
156860 ---------------------------------------------------------------------------------------------------
156861 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
156862 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
156863 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
156864 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
156865 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
156866 -- 5132302
156867 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
156868 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
156869
156870 END IF;
156871
156872 -- 4955764
156873 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
156874 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
156875
156876
156877 XLA_AE_LINES_PKG.ValidateCurrentLine;
156878 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
156879
156880 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
156881 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
156882 ,p_balance_type_code => l_balance_type_code);
156883
156884 END IF;
156885
156886 -----------------------------------------------------------------------------------------
156887 -- 4262811 Multiperiod Accounting
156888 -----------------------------------------------------------------------------------------
156889 -- No MPA option is assigned.
156890
156891
156892 END IF;
156893 END IF;
156894 --
156895
156896 --
156897 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
156898 trace
156899 (p_msg => 'END of AcctLineType_384'
156900 ,p_level => C_LEVEL_PROCEDURE
156901 ,p_module => l_log_module);
156902 END IF;
156903 --
156904 EXCEPTION
156905 WHEN xla_exceptions_pkg.application_exception THEN
156906 RAISE;
156907 WHEN OTHERS THEN
156908 xla_exceptions_pkg.raise_message
156909 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_384');
156910 END AcctLineType_384;
156911 --
156912
156913 ---------------------------------------
156914 --
156915 -- PRIVATE FUNCTION
156916 -- AcctLineType_385
156917 --
156918 ---------------------------------------
156919 PROCEDURE AcctLineType_385 (
156920 p_application_id IN NUMBER
156921 ,p_event_id IN NUMBER
156922 ,p_calculate_acctd_flag IN VARCHAR2
156923 ,p_calculate_g_l_flag IN VARCHAR2
156924 ,p_actual_flag IN OUT VARCHAR2
156925 ,p_balance_type_code OUT VARCHAR2
156926 ,p_gain_or_loss_ref OUT VARCHAR2
156927
156928 --Period Close Date
156929 , p_source_1 IN DATE
156930 --Generated Code Combination Identifier
156931 , p_source_5 IN NUMBER
156932 --Depreciation Reserve Account
156933 , p_source_12 IN VARCHAR2
156934 --Generated Offset Code Combination Identifier
156935 , p_source_19 IN NUMBER
156936 --Expense Account Code Combination Identifier
156937 , p_source_31 IN NUMBER
156938 --Default Code Combination Identifier
156939 , p_source_32 IN NUMBER
156940 --Adjustment Type
156941 , p_source_48 IN VARCHAR2
156942 --Transaction Header Identifier
156943 , p_source_49 IN NUMBER
156944 --Adjustment Line Identifier
156945 , p_source_50 IN NUMBER
156946 --Distribution Type Code
156947 , p_source_51 IN VARCHAR2
156948 --Entered Amount
156949 , p_source_52 IN NUMBER
156950 --Currency Code
156951 , p_source_53 IN VARCHAR2
156952 --Source Destination Code
156953 , p_source_55 IN VARCHAR2
156954 )
156955 IS
156956
156957 l_component_type VARCHAR2(80);
156958 l_component_code VARCHAR2(30);
156959 l_component_type_code VARCHAR2(1);
156960 l_component_appl_id INTEGER;
156961 l_amb_context_code VARCHAR2(30);
156962 l_entity_code VARCHAR2(30);
156963 l_event_class_code VARCHAR2(30);
156964 l_ae_header_id NUMBER;
156965 l_event_type_code VARCHAR2(30);
156966 l_line_definition_code VARCHAR2(30);
156967 l_line_definition_owner_code VARCHAR2(1);
156968 --
156969 -- adr variables
156970 l_segment VARCHAR2(30);
156971 l_ccid NUMBER;
156972 l_adr_transaction_coa_id NUMBER;
156973 l_adr_accounting_coa_id NUMBER;
156977 l_adr_value_combination_id NUMBER;
156974 l_adr_flexfield_segment_code VARCHAR2(30);
156975 l_adr_flex_value_set_id NUMBER;
156976 l_adr_value_type_code VARCHAR2(30);
156978 l_adr_value_segment_code VARCHAR2(30);
156979
156980 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
156981 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
156982 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
156983 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
156984
156985 -- 4262811 Variables ------------------------------------------------------------------------------------------
156986 l_entered_amt_idx NUMBER;
156987 l_accted_amt_idx NUMBER;
156988 l_acc_rev_flag VARCHAR2(1);
156989 l_accrual_line_num NUMBER;
156990 l_tmp_amt NUMBER;
156991 l_acc_rev_natural_side_code VARCHAR2(1);
156992
156993 l_num_entries NUMBER;
156994 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
156995 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
156996 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
156997 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
156998 l_recog_line_1 NUMBER;
156999 l_recog_line_2 NUMBER;
157000
157001 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
157002 l_bflow_applied_to_amt NUMBER; -- 5132302
157003 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
157004
157005 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
157006
157007 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
157008 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
157009
157010 ---------------------------------------------------------------------------------------------------------------
157011
157012
157013 --
157014 -- bulk performance
157015 --
157016 l_balance_type_code VARCHAR2(1);
157017 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
157018 l_log_module VARCHAR2(240);
157019
157020 --
157021 -- Upgrade strategy
157022 --
157023 l_actual_upg_option VARCHAR2(1);
157024 l_enc_upg_option VARCHAR2(1);
157025
157026 --
157027 BEGIN
157028 --
157029 IF g_log_enabled THEN
157030 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_385';
157031 END IF;
157032 --
157033 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
157034
157035 trace
157036 (p_msg => 'BEGIN of AcctLineType_385'
157037 ,p_level => C_LEVEL_PROCEDURE
157038 ,p_module => l_log_module);
157039
157040 END IF;
157041 --
157042 l_component_type := 'AMB_JLT';
157043 l_component_code := 'FA_TRANSFER_DEST_DEPRN_RES';
157044 l_component_type_code := 'S';
157045 l_component_appl_id := 140;
157046 l_amb_context_code := 'DEFAULT';
157047 l_entity_code := 'TRANSACTIONS';
157048 l_event_class_code := 'TRANSFERS';
157049 l_event_type_code := 'TRANSFERS_ALL';
157050 l_line_definition_owner_code := 'S';
157051 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
157052 --
157053 l_balance_type_code := 'A';
157054 l_segment := NULL;
157055 l_ccid := NULL;
157056 l_adr_transaction_coa_id := NULL;
157057 l_adr_accounting_coa_id := NULL;
157058 l_adr_flexfield_segment_code := NULL;
157059 l_adr_flex_value_set_id := NULL;
157060 l_adr_value_type_code := NULL;
157061 l_adr_value_combination_id := NULL;
157062 l_adr_value_segment_code := NULL;
157063
157064 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
157065 l_bflow_class_code := ''; -- 4219869 Business Flow
157066 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
157067 l_budgetary_control_flag := 'N';
157068
157069 l_bflow_applied_to_amt_idx := NULL; -- 5132302
157070 l_bflow_applied_to_amt := NULL; -- 5132302
157071 l_entered_amt_idx := NULL; -- 4262811
157072 l_accted_amt_idx := NULL; -- 4262811
157073 l_acc_rev_flag := NULL; -- 4262811
157074 l_accrual_line_num := NULL; -- 4262811
157075 l_tmp_amt := NULL; -- 4262811
157076 --
157077
157078 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
157079 l_balance_type_code <> 'B' THEN
157080 IF (NVL(p_source_48,'
157081 ') = 'RESERVE' OR
157082 NVL(p_source_48,'
157083 ') = 'EXPENSE') AND
157084 NVL(p_source_55,'
157085 ') = 'DEST'
157086 THEN
157087
157088 --
157089 XLA_AE_LINES_PKG.SetNewLine;
157090
157091 p_balance_type_code := l_balance_type_code;
157092 -- set the flag so later we will know whether the gain loss line needs to be created
157093
157094 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
157095 p_actual_flag :='A';
157096 END IF;
157097
157098 --
157099 -- bulk performance
157100 --
157101 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
157105 --
157102 p_header_num => 0); -- 4262811
157103 --
157104 -- set accounting line options
157106 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
157107 p_natural_side_code => 'C'
157108 , p_gain_or_loss_flag => 'N'
157109 , p_gl_transfer_mode_code => 'S'
157110 , p_acct_entry_type_code => 'A'
157111 , p_switch_side_flag => 'Y'
157112 , p_merge_duplicate_code => 'N'
157113 );
157114 --
157115 l_acc_rev_natural_side_code := 'D'; -- 4262811
157116 --
157117 --
157118 -- set accounting line type info
157119 --
157120 xla_ae_lines_pkg.SetAcctLineType
157121 (p_component_type => l_component_type
157122 ,p_event_type_code => l_event_type_code
157123 ,p_line_definition_owner_code => l_line_definition_owner_code
157124 ,p_line_definition_code => l_line_definition_code
157125 ,p_accounting_line_code => l_component_code
157126 ,p_accounting_line_type_code => l_component_type_code
157127 ,p_accounting_line_appl_id => l_component_appl_id
157128 ,p_amb_context_code => l_amb_context_code
157129 ,p_entity_code => l_entity_code
157130 ,p_event_class_code => l_event_class_code);
157131 --
157132 -- set accounting class
157133 --
157134 xla_ae_lines_pkg.SetAcctClass(
157135 p_accounting_class_code => 'ASSET'
157136 , p_ae_header_id => l_ae_header_id
157137 );
157138
157139 --
157140 -- set rounding class
157141 --
157142 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
157143 'ASSET';
157144
157145 --
157146 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
157147 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
157148 --
157149 -- bulk performance
157150 --
157151 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
157152
157153 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
157154 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
157155
157156 -- 4955764
157157 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
157158 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
157159
157160 -- 4458381 Public Sector Enh
157161
157162 --
157163 -- set accounting attributes for the line type
157164 --
157165 l_entered_amt_idx := 4;
157166 l_accted_amt_idx := 6;
157167 l_bflow_applied_to_amt_idx := NULL; -- 5132302
157168 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
157169 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
157170 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
157171 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
157172 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
157173 l_rec_acct_attrs.array_char_value(3) := p_source_51;
157174 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
157175 l_rec_acct_attrs.array_num_value(4) := p_source_52;
157176 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
157177 l_rec_acct_attrs.array_char_value(5) := p_source_53;
157178 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
157179 l_rec_acct_attrs.array_num_value(6) := p_source_52;
157180
157181 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
157182 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
157183
157184 ---------------------------------------------------------------------------------------------------------------
157185 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
157186 ---------------------------------------------------------------------------------------------------------------
157187 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
157188
157189 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
157190 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
157191
157192 IF xla_accounting_cache_pkg.GetValueChar
157193 (p_source_code => 'LEDGER_CATEGORY_CODE'
157194 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
157195 AND l_bflow_method_code = 'PRIOR_ENTRY'
157196 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
157197 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
157198 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
157199 )
157200 THEN
157201 xla_ae_lines_pkg.BflowUpgEntry
157202 (p_business_method_code => l_bflow_method_code
157203 ,p_business_class_code => l_bflow_class_code
157204 ,p_balance_type => l_balance_type_code);
157205 ELSE
157206 NULL;
157207 -- No business flow processing for business flow method of NONE.
157208 END IF;
157209
157210 --
157211 -- call analytical criteria
157212 --
157213
157214 --
157218 xla_ae_lines_pkg.SetLineDescription(
157215 -- call description
157216 --
157217
157219 p_ae_header_id => l_ae_header_id
157220 ,p_description => Description_130 (
157221 p_application_id => p_application_id
157222 , p_ae_header_id => l_ae_header_id
157223 , p_source_1 => p_source_1
157224 )
157225 );
157226
157227
157228 --
157229 -- call ADRs
157230 -- Bug 4922099
157231 --
157232 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
157233 (NVL(l_actual_upg_option, 'N') = 'O') OR
157234 (NVL(l_enc_upg_option, 'N') = 'O')
157235 )
157236 THEN
157237 NULL;
157238 --
157239 --
157240
157241 l_ccid := AcctDerRule_175(
157242 p_application_id => p_application_id
157243 , p_ae_header_id => l_ae_header_id
157244 , p_source_5 => p_source_5
157245 , p_source_19 => p_source_19
157246 , p_source_32 => p_source_32
157247 , x_transaction_coa_id => l_adr_transaction_coa_id
157248 , x_accounting_coa_id => l_adr_accounting_coa_id
157249 , x_value_type_code => l_adr_value_type_code
157250 , p_side => 'NA'
157251 );
157252
157253 xla_ae_lines_pkg.set_ccid(
157254 p_code_combination_id => l_ccid
157255 , p_value_type_code => l_adr_value_type_code
157256 , p_transaction_coa_id => l_adr_transaction_coa_id
157257 , p_accounting_coa_id => l_adr_accounting_coa_id
157258 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
157259 , p_adr_type_code => 'S'
157260 , p_component_type => l_component_type
157261 , p_component_code => l_component_code
157262 , p_component_type_code => l_component_type_code
157263 , p_component_appl_id => l_component_appl_id
157264 , p_amb_context_code => l_amb_context_code
157265 , p_side => 'NA'
157266 );
157267
157268
157269 l_segment := AcctDerRule_150(
157270 p_application_id => p_application_id
157271 , p_ae_header_id => l_ae_header_id
157272 , p_source_5 => p_source_5
157273 , p_source_12 => p_source_12
157274 , x_transaction_coa_id => l_adr_transaction_coa_id
157275 , x_accounting_coa_id => l_adr_accounting_coa_id
157276 , x_flexfield_segment_code => l_adr_flexfield_segment_code
157277 , x_flex_value_set_id => l_adr_flex_value_set_id
157278 , x_value_type_code => l_adr_value_type_code
157279 , x_value_combination_id => l_adr_value_combination_id
157280 , x_value_segment_code => l_adr_value_segment_code
157281 , p_side => 'NA'
157282 , p_override_seg_flag => 'Y'
157283 );
157284
157285 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
157286
157287 xla_ae_lines_pkg.set_segment(
157288 p_to_segment_code => 'GL_ACCOUNT'
157289 , p_segment_value => l_segment
157290 , p_from_segment_code => l_adr_value_segment_code
157291 , p_from_combination_id => l_adr_value_combination_id
157292 , p_value_type_code => l_adr_value_type_code
157293 , p_transaction_coa_id => l_adr_transaction_coa_id
157294 , p_accounting_coa_id => l_adr_accounting_coa_id
157295 , p_flexfield_segment_code => l_adr_flexfield_segment_code
157296 , p_flex_value_set_id => l_adr_flex_value_set_id
157297 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
157298 , p_adr_type_code => 'S'
157299 , p_component_type => l_component_type
157300 , p_component_code => l_component_code
157301 , p_component_type_code => l_component_type_code
157302 , p_component_appl_id => l_component_appl_id
157303 , p_amb_context_code => l_amb_context_code
157304 , p_entity_code => 'TRANSACTIONS'
157305 , p_event_class_code => 'TRANSFERS'
157306 , p_side => 'NA'
157307 );
157308
157309 END IF;
157310
157311 l_segment := AcctDerRule_169(
157312 p_application_id => p_application_id
157313 , p_ae_header_id => l_ae_header_id
157314 , p_source_5 => p_source_5
157315 , p_source_31 => p_source_31
157316 , x_transaction_coa_id => l_adr_transaction_coa_id
157317 , x_accounting_coa_id => l_adr_accounting_coa_id
157318 , x_flexfield_segment_code => l_adr_flexfield_segment_code
157319 , x_flex_value_set_id => l_adr_flex_value_set_id
157320 , x_value_type_code => l_adr_value_type_code
157321 , x_value_combination_id => l_adr_value_combination_id
157322 , x_value_segment_code => l_adr_value_segment_code
157323 , p_side => 'NA'
157324 , p_override_seg_flag => 'Y'
157325 );
157326
157327 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
157328
157329 xla_ae_lines_pkg.set_segment(
157330 p_to_segment_code => 'GL_BALANCING'
157331 , p_segment_value => l_segment
157332 , p_from_segment_code => l_adr_value_segment_code
157333 , p_from_combination_id => l_adr_value_combination_id
157334 , p_value_type_code => l_adr_value_type_code
157335 , p_transaction_coa_id => l_adr_transaction_coa_id
157339 , p_adr_code => 'FA_EXPENSE_ACCT'
157336 , p_accounting_coa_id => l_adr_accounting_coa_id
157337 , p_flexfield_segment_code => l_adr_flexfield_segment_code
157338 , p_flex_value_set_id => l_adr_flex_value_set_id
157340 , p_adr_type_code => 'S'
157341 , p_component_type => l_component_type
157342 , p_component_code => l_component_code
157343 , p_component_type_code => l_component_type_code
157344 , p_component_appl_id => l_component_appl_id
157345 , p_amb_context_code => l_amb_context_code
157346 , p_entity_code => 'TRANSACTIONS'
157347 , p_event_class_code => 'TRANSFERS'
157348 , p_side => 'NA'
157349 );
157350
157351 END IF;
157352
157353 --
157354 --
157355 END IF;
157356 --
157357 -- Bug 4922099
157358 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
157359 (NVL(l_enc_upg_option, 'N') = 'O')
157360 ) AND
157361 (l_bflow_method_code = 'PRIOR_ENTRY')
157362 )
157363 THEN
157364 IF
157365 --
157366 1 = 2
157367 --
157368 THEN
157369 xla_accounting_err_pkg.build_message
157370 (p_appli_s_name => 'XLA'
157371 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
157372 ,p_token_1 => 'LINE_NUMBER'
157373 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
157374 ,p_token_2 => 'LINE_TYPE_NAME'
157375 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
157376 l_component_type
157377 ,l_component_code
157378 ,l_component_type_code
157379 ,l_component_appl_id
157380 ,l_amb_context_code
157381 ,l_entity_code
157382 ,l_event_class_code
157383 )
157384 ,p_token_3 => 'OWNER'
157385 ,p_value_3 => xla_lookups_pkg.get_meaning(
157386 p_lookup_type => 'XLA_OWNER_TYPE'
157387 ,p_lookup_code => l_component_type_code
157388 )
157389 ,p_token_4 => 'PRODUCT_NAME'
157390 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
157391 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
157392 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
157393 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
157394 ,p_ae_header_id => NULL
157395 );
157396
157397 IF (C_LEVEL_ERROR>= g_log_level) THEN
157398 trace
157399 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
157400 ,p_level => C_LEVEL_ERROR
157401 ,p_module => l_log_module);
157402 END IF;
157403 END IF;
157404 END IF;
157405 --
157406 --
157407 ------------------------------------------------------------------------------------------------
157408 -- 4219869 Business Flow
157409 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
157410 -- Prior Entry. Currently, the following code is always generated.
157411 ------------------------------------------------------------------------------------------------
157412 XLA_AE_LINES_PKG.ValidateCurrentLine;
157413
157414 ------------------------------------------------------------------------------------
157415 -- 4219869 Business Flow
157416 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
157417 ------------------------------------------------------------------------------------
157418 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
157419
157420 ----------------------------------------------------------------------------------
157421 -- 4219869 Business Flow
157422 -- Update journal entry status -- Need to generate this within IF <condition>
157423 ----------------------------------------------------------------------------------
157424 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
157425 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
157426 ,p_balance_type_code => l_balance_type_code
157427 );
157428
157429 -------------------------------------------------------------------------------------------
157430 -- 4262811 - Generate the Accrual Reversal lines
157434 (g_array_event(p_event_id).array_value_num('header_index'));
157431 -------------------------------------------------------------------------------------------
157432 BEGIN
157433 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
157435 IF l_acc_rev_flag IS NULL THEN
157436 l_acc_rev_flag := 'N';
157437 END IF;
157438 EXCEPTION
157439 WHEN OTHERS THEN
157440 l_acc_rev_flag := 'N';
157441 END;
157442 --
157443 IF (l_acc_rev_flag = 'Y') THEN
157444
157445 -- 4645092 ------------------------------------------------------------------------------
157446 -- To allow MPA report to determine if it should generate report process
157447 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
157448 ------------------------------------------------------------------------------------------
157449
157450 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
157451 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
157452 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
157453 -- call ADRs
157454 -- Bug 4922099
157455 --
157456 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
157457 (NVL(l_actual_upg_option, 'N') = 'O') OR
157458 (NVL(l_enc_upg_option, 'N') = 'O')
157459 )
157460 THEN
157461 NULL;
157462 --
157463 --
157464
157465 l_ccid := AcctDerRule_175(
157466 p_application_id => p_application_id
157467 , p_ae_header_id => l_ae_header_id
157468 , p_source_5 => p_source_5
157469 , p_source_19 => p_source_19
157470 , p_source_32 => p_source_32
157471 , x_transaction_coa_id => l_adr_transaction_coa_id
157472 , x_accounting_coa_id => l_adr_accounting_coa_id
157473 , x_value_type_code => l_adr_value_type_code
157474 , p_side => 'NA'
157475 );
157476
157477 xla_ae_lines_pkg.set_ccid(
157478 p_code_combination_id => l_ccid
157479 , p_value_type_code => l_adr_value_type_code
157480 , p_transaction_coa_id => l_adr_transaction_coa_id
157481 , p_accounting_coa_id => l_adr_accounting_coa_id
157482 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
157483 , p_adr_type_code => 'S'
157484 , p_component_type => l_component_type
157485 , p_component_code => l_component_code
157486 , p_component_type_code => l_component_type_code
157487 , p_component_appl_id => l_component_appl_id
157488 , p_amb_context_code => l_amb_context_code
157489 , p_side => 'NA'
157490 );
157491
157492
157493 l_segment := AcctDerRule_150(
157494 p_application_id => p_application_id
157495 , p_ae_header_id => l_ae_header_id
157496 , p_source_5 => p_source_5
157497 , p_source_12 => p_source_12
157498 , x_transaction_coa_id => l_adr_transaction_coa_id
157499 , x_accounting_coa_id => l_adr_accounting_coa_id
157500 , x_flexfield_segment_code => l_adr_flexfield_segment_code
157501 , x_flex_value_set_id => l_adr_flex_value_set_id
157502 , x_value_type_code => l_adr_value_type_code
157503 , x_value_combination_id => l_adr_value_combination_id
157504 , x_value_segment_code => l_adr_value_segment_code
157505 , p_side => 'NA'
157506 , p_override_seg_flag => 'Y'
157507 );
157508
157509 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
157510
157511 xla_ae_lines_pkg.set_segment(
157512 p_to_segment_code => 'GL_ACCOUNT'
157513 , p_segment_value => l_segment
157514 , p_from_segment_code => l_adr_value_segment_code
157515 , p_from_combination_id => l_adr_value_combination_id
157516 , p_value_type_code => l_adr_value_type_code
157517 , p_transaction_coa_id => l_adr_transaction_coa_id
157518 , p_accounting_coa_id => l_adr_accounting_coa_id
157519 , p_flexfield_segment_code => l_adr_flexfield_segment_code
157520 , p_flex_value_set_id => l_adr_flex_value_set_id
157521 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
157522 , p_adr_type_code => 'S'
157523 , p_component_type => l_component_type
157524 , p_component_code => l_component_code
157525 , p_component_type_code => l_component_type_code
157526 , p_component_appl_id => l_component_appl_id
157527 , p_amb_context_code => l_amb_context_code
157528 , p_entity_code => 'TRANSACTIONS'
157529 , p_event_class_code => 'TRANSFERS'
157530 , p_side => 'NA'
157531 );
157532
157533 END IF;
157534
157535 l_segment := AcctDerRule_169(
157536 p_application_id => p_application_id
157537 , p_ae_header_id => l_ae_header_id
157538 , p_source_5 => p_source_5
157539 , p_source_31 => p_source_31
157540 , x_transaction_coa_id => l_adr_transaction_coa_id
157541 , x_accounting_coa_id => l_adr_accounting_coa_id
157542 , x_flexfield_segment_code => l_adr_flexfield_segment_code
157543 , x_flex_value_set_id => l_adr_flex_value_set_id
157547 , p_side => 'NA'
157544 , x_value_type_code => l_adr_value_type_code
157545 , x_value_combination_id => l_adr_value_combination_id
157546 , x_value_segment_code => l_adr_value_segment_code
157548 , p_override_seg_flag => 'Y'
157549 );
157550
157551 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
157552
157553 xla_ae_lines_pkg.set_segment(
157554 p_to_segment_code => 'GL_BALANCING'
157555 , p_segment_value => l_segment
157556 , p_from_segment_code => l_adr_value_segment_code
157557 , p_from_combination_id => l_adr_value_combination_id
157558 , p_value_type_code => l_adr_value_type_code
157559 , p_transaction_coa_id => l_adr_transaction_coa_id
157560 , p_accounting_coa_id => l_adr_accounting_coa_id
157561 , p_flexfield_segment_code => l_adr_flexfield_segment_code
157562 , p_flex_value_set_id => l_adr_flex_value_set_id
157563 , p_adr_code => 'FA_EXPENSE_ACCT'
157564 , p_adr_type_code => 'S'
157565 , p_component_type => l_component_type
157566 , p_component_code => l_component_code
157567 , p_component_type_code => l_component_type_code
157568 , p_component_appl_id => l_component_appl_id
157569 , p_amb_context_code => l_amb_context_code
157570 , p_entity_code => 'TRANSACTIONS'
157571 , p_event_class_code => 'TRANSFERS'
157572 , p_side => 'NA'
157573 );
157574
157575 END IF;
157576
157577 --
157578 --
157579 END IF;
157580
157581 --
157582 -- Update the line information that should be overwritten
157583 --
157584 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
157585 p_header_num => 1);
157586 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
157587
157588 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
157589
157590 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
157591 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
157592 END IF;
157593
157594 --
157595 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
157596 --
157597 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
157598 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
157599 ELSE
157600 ---------------------------------------------------------------------------------------------------
157601 -- 4262811a Switch Sign
157602 ---------------------------------------------------------------------------------------------------
157603 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
157604 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
157605 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
157606 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
157607 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
157608 -- 5132302
157609 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
157610 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
157611
157612 END IF;
157613
157614 -- 4955764
157615 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
157616 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
157617
157618
157619 XLA_AE_LINES_PKG.ValidateCurrentLine;
157620 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
157621
157622 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
157623 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
157624 ,p_balance_type_code => l_balance_type_code);
157625
157626 END IF;
157627
157628 -----------------------------------------------------------------------------------------
157629 -- 4262811 Multiperiod Accounting
157630 -----------------------------------------------------------------------------------------
157631 -- No MPA option is assigned.
157632
157633
157634 END IF;
157635 END IF;
157636 --
157637
157638 --
157639 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
157640 trace
157641 (p_msg => 'END of AcctLineType_385'
157642 ,p_level => C_LEVEL_PROCEDURE
157643 ,p_module => l_log_module);
157644 END IF;
157645 --
157646 EXCEPTION
157647 WHEN xla_exceptions_pkg.application_exception THEN
157648 RAISE;
157649 WHEN OTHERS THEN
157650 xla_exceptions_pkg.raise_message
157651 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_385');
157652 END AcctLineType_385;
157653 --
157654
157655 ---------------------------------------
157656 --
157657 -- PRIVATE FUNCTION
157658 -- AcctLineType_386
157662 p_application_id IN NUMBER
157659 --
157660 ---------------------------------------
157661 PROCEDURE AcctLineType_386 (
157663 ,p_event_id IN NUMBER
157664 ,p_calculate_acctd_flag IN VARCHAR2
157665 ,p_calculate_g_l_flag IN VARCHAR2
157666 ,p_actual_flag IN OUT VARCHAR2
157667 ,p_balance_type_code OUT VARCHAR2
157668 ,p_gain_or_loss_ref OUT VARCHAR2
157669
157670 --Period Close Date
157671 , p_source_1 IN DATE
157672 --Generated Code Combination Identifier
157673 , p_source_5 IN NUMBER
157674 --Expense Account Code Combination Identifier
157675 , p_source_31 IN NUMBER
157676 --Adjustment Type
157677 , p_source_48 IN VARCHAR2
157678 --Transaction Header Identifier
157679 , p_source_49 IN NUMBER
157680 --Adjustment Line Identifier
157681 , p_source_50 IN NUMBER
157682 --Distribution Type Code
157683 , p_source_51 IN VARCHAR2
157684 --Entered Amount
157685 , p_source_52 IN NUMBER
157686 --Currency Code
157687 , p_source_53 IN VARCHAR2
157688 --Source Destination Code
157689 , p_source_55 IN VARCHAR2
157690 )
157691 IS
157692
157693 l_component_type VARCHAR2(80);
157694 l_component_code VARCHAR2(30);
157695 l_component_type_code VARCHAR2(1);
157696 l_component_appl_id INTEGER;
157697 l_amb_context_code VARCHAR2(30);
157698 l_entity_code VARCHAR2(30);
157699 l_event_class_code VARCHAR2(30);
157700 l_ae_header_id NUMBER;
157701 l_event_type_code VARCHAR2(30);
157702 l_line_definition_code VARCHAR2(30);
157703 l_line_definition_owner_code VARCHAR2(1);
157704 --
157705 -- adr variables
157706 l_segment VARCHAR2(30);
157707 l_ccid NUMBER;
157708 l_adr_transaction_coa_id NUMBER;
157709 l_adr_accounting_coa_id NUMBER;
157710 l_adr_flexfield_segment_code VARCHAR2(30);
157711 l_adr_flex_value_set_id NUMBER;
157712 l_adr_value_type_code VARCHAR2(30);
157713 l_adr_value_combination_id NUMBER;
157714 l_adr_value_segment_code VARCHAR2(30);
157715
157716 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
157717 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
157718 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
157719 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
157720
157721 -- 4262811 Variables ------------------------------------------------------------------------------------------
157722 l_entered_amt_idx NUMBER;
157723 l_accted_amt_idx NUMBER;
157724 l_acc_rev_flag VARCHAR2(1);
157725 l_accrual_line_num NUMBER;
157726 l_tmp_amt NUMBER;
157727 l_acc_rev_natural_side_code VARCHAR2(1);
157728
157729 l_num_entries NUMBER;
157730 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
157731 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
157732 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
157733 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
157734 l_recog_line_1 NUMBER;
157735 l_recog_line_2 NUMBER;
157736
157737 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
157738 l_bflow_applied_to_amt NUMBER; -- 5132302
157739 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
157740
157741 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
157742
157743 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
157744 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
157745
157746 ---------------------------------------------------------------------------------------------------------------
157747
157748
157749 --
157750 -- bulk performance
157751 --
157752 l_balance_type_code VARCHAR2(1);
157753 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
157754 l_log_module VARCHAR2(240);
157755
157756 --
157757 -- Upgrade strategy
157758 --
157759 l_actual_upg_option VARCHAR2(1);
157760 l_enc_upg_option VARCHAR2(1);
157761
157762 --
157763 BEGIN
157764 --
157765 IF g_log_enabled THEN
157766 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_386';
157767 END IF;
157768 --
157769 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
157770
157771 trace
157772 (p_msg => 'BEGIN of AcctLineType_386'
157773 ,p_level => C_LEVEL_PROCEDURE
157774 ,p_module => l_log_module);
157775
157776 END IF;
157777 --
157778 l_component_type := 'AMB_JLT';
157779 l_component_code := 'FA_TRANSFER_DEST_EXP_BAL';
157780 l_component_type_code := 'S';
157781 l_component_appl_id := 140;
157782 l_amb_context_code := 'DEFAULT';
157783 l_entity_code := 'TRANSACTIONS';
157784 l_event_class_code := 'TRANSFERS';
157785 l_event_type_code := 'TRANSFERS_ALL';
157786 l_line_definition_owner_code := 'S';
157787 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
157788 --
157789 l_balance_type_code := 'A';
157790 l_segment := NULL;
157791 l_ccid := NULL;
157792 l_adr_transaction_coa_id := NULL;
157796 l_adr_value_type_code := NULL;
157793 l_adr_accounting_coa_id := NULL;
157794 l_adr_flexfield_segment_code := NULL;
157795 l_adr_flex_value_set_id := NULL;
157797 l_adr_value_combination_id := NULL;
157798 l_adr_value_segment_code := NULL;
157799
157800 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
157801 l_bflow_class_code := ''; -- 4219869 Business Flow
157802 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
157803 l_budgetary_control_flag := 'N';
157804
157805 l_bflow_applied_to_amt_idx := NULL; -- 5132302
157806 l_bflow_applied_to_amt := NULL; -- 5132302
157807 l_entered_amt_idx := NULL; -- 4262811
157808 l_accted_amt_idx := NULL; -- 4262811
157809 l_acc_rev_flag := NULL; -- 4262811
157810 l_accrual_line_num := NULL; -- 4262811
157811 l_tmp_amt := NULL; -- 4262811
157812 --
157813
157814 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
157815 l_balance_type_code <> 'B' THEN
157816 IF NVL(p_source_48,'
157817 ') = 'BONUS EXPENSE' AND
157818 NVL(p_source_55,'
157819 ') = 'DEST'
157820 THEN
157821
157822 --
157823 XLA_AE_LINES_PKG.SetNewLine;
157824
157825 p_balance_type_code := l_balance_type_code;
157826 -- set the flag so later we will know whether the gain loss line needs to be created
157827
157828 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
157829 p_actual_flag :='A';
157830 END IF;
157831
157832 --
157833 -- bulk performance
157834 --
157835 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
157836 p_header_num => 0); -- 4262811
157837 --
157838 -- set accounting line options
157839 --
157840 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
157841 p_natural_side_code => 'C'
157842 , p_gain_or_loss_flag => 'N'
157843 , p_gl_transfer_mode_code => 'S'
157844 , p_acct_entry_type_code => 'A'
157845 , p_switch_side_flag => 'Y'
157846 , p_merge_duplicate_code => 'N'
157847 );
157848 --
157849 l_acc_rev_natural_side_code := 'D'; -- 4262811
157850 --
157851 --
157852 -- set accounting line type info
157853 --
157854 xla_ae_lines_pkg.SetAcctLineType
157855 (p_component_type => l_component_type
157856 ,p_event_type_code => l_event_type_code
157857 ,p_line_definition_owner_code => l_line_definition_owner_code
157858 ,p_line_definition_code => l_line_definition_code
157859 ,p_accounting_line_code => l_component_code
157860 ,p_accounting_line_type_code => l_component_type_code
157861 ,p_accounting_line_appl_id => l_component_appl_id
157862 ,p_amb_context_code => l_amb_context_code
157863 ,p_entity_code => l_entity_code
157864 ,p_event_class_code => l_event_class_code);
157865 --
157866 -- set accounting class
157867 --
157868 xla_ae_lines_pkg.SetAcctClass(
157869 p_accounting_class_code => 'EXPENSE'
157870 , p_ae_header_id => l_ae_header_id
157871 );
157872
157873 --
157874 -- set rounding class
157875 --
157876 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
157877 'EXPENSE';
157878
157879 --
157880 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
157881 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
157882 --
157883 -- bulk performance
157884 --
157885 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
157886
157887 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
157888 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
157889
157890 -- 4955764
157891 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
157892 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
157893
157894 -- 4458381 Public Sector Enh
157895
157896 --
157897 -- set accounting attributes for the line type
157898 --
157899 l_entered_amt_idx := 4;
157900 l_accted_amt_idx := 6;
157901 l_bflow_applied_to_amt_idx := NULL; -- 5132302
157902 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
157903 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
157904 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
157905 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
157906 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
157907 l_rec_acct_attrs.array_char_value(3) := p_source_51;
157908 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
157909 l_rec_acct_attrs.array_num_value(4) := p_source_52;
157910 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
157911 l_rec_acct_attrs.array_char_value(5) := p_source_53;
157912 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
157913 l_rec_acct_attrs.array_num_value(6) := p_source_52;
157914
157915 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
157919 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
157916 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
157917
157918 ---------------------------------------------------------------------------------------------------------------
157920 ---------------------------------------------------------------------------------------------------------------
157921 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
157922
157923 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
157924 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
157925
157926 IF xla_accounting_cache_pkg.GetValueChar
157927 (p_source_code => 'LEDGER_CATEGORY_CODE'
157928 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
157929 AND l_bflow_method_code = 'PRIOR_ENTRY'
157930 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
157931 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
157932 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
157933 )
157934 THEN
157935 xla_ae_lines_pkg.BflowUpgEntry
157936 (p_business_method_code => l_bflow_method_code
157937 ,p_business_class_code => l_bflow_class_code
157938 ,p_balance_type => l_balance_type_code);
157939 ELSE
157940 NULL;
157941 -- No business flow processing for business flow method of NONE.
157942 END IF;
157943
157944 --
157945 -- call analytical criteria
157946 --
157947
157948 --
157949 -- call description
157950 --
157951
157952 xla_ae_lines_pkg.SetLineDescription(
157953 p_ae_header_id => l_ae_header_id
157954 ,p_description => Description_127 (
157955 p_application_id => p_application_id
157956 , p_ae_header_id => l_ae_header_id
157957 , p_source_1 => p_source_1
157958 )
157959 );
157960
157961
157962 --
157963 -- call ADRs
157964 -- Bug 4922099
157965 --
157966 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
157967 (NVL(l_actual_upg_option, 'N') = 'O') OR
157968 (NVL(l_enc_upg_option, 'N') = 'O')
157969 )
157970 THEN
157971 NULL;
157972 --
157973 --
157974
157975 l_ccid := AcctDerRule_176(
157976 p_application_id => p_application_id
157977 , p_ae_header_id => l_ae_header_id
157978 , p_source_5 => p_source_5
157979 , p_source_31 => p_source_31
157980 , x_transaction_coa_id => l_adr_transaction_coa_id
157981 , x_accounting_coa_id => l_adr_accounting_coa_id
157982 , x_value_type_code => l_adr_value_type_code
157983 , p_side => 'NA'
157984 );
157985
157986 xla_ae_lines_pkg.set_ccid(
157987 p_code_combination_id => l_ccid
157988 , p_value_type_code => l_adr_value_type_code
157989 , p_transaction_coa_id => l_adr_transaction_coa_id
157990 , p_accounting_coa_id => l_adr_accounting_coa_id
157991 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
157992 , p_adr_type_code => 'S'
157993 , p_component_type => l_component_type
157994 , p_component_code => l_component_code
157995 , p_component_type_code => l_component_type_code
157996 , p_component_appl_id => l_component_appl_id
157997 , p_amb_context_code => l_amb_context_code
157998 , p_side => 'NA'
157999 );
158000
158001
158002 --
158003 --
158004 END IF;
158005 --
158006 -- Bug 4922099
158007 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
158008 (NVL(l_enc_upg_option, 'N') = 'O')
158009 ) AND
158010 (l_bflow_method_code = 'PRIOR_ENTRY')
158011 )
158012 THEN
158013 IF
158014 --
158015 1 = 2
158016 --
158017 THEN
158018 xla_accounting_err_pkg.build_message
158019 (p_appli_s_name => 'XLA'
158020 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
158021 ,p_token_1 => 'LINE_NUMBER'
158022 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
158023 ,p_token_2 => 'LINE_TYPE_NAME'
158024 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
158025 l_component_type
158026 ,l_component_code
158027 ,l_component_type_code
158028 ,l_component_appl_id
158029 ,l_amb_context_code
158030 ,l_entity_code
158031 ,l_event_class_code
158032 )
158036 ,p_lookup_code => l_component_type_code
158033 ,p_token_3 => 'OWNER'
158034 ,p_value_3 => xla_lookups_pkg.get_meaning(
158035 p_lookup_type => 'XLA_OWNER_TYPE'
158037 )
158038 ,p_token_4 => 'PRODUCT_NAME'
158039 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
158040 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
158041 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
158042 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
158043 ,p_ae_header_id => NULL
158044 );
158045
158046 IF (C_LEVEL_ERROR>= g_log_level) THEN
158047 trace
158048 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
158049 ,p_level => C_LEVEL_ERROR
158050 ,p_module => l_log_module);
158051 END IF;
158052 END IF;
158053 END IF;
158054 --
158055 --
158056 ------------------------------------------------------------------------------------------------
158057 -- 4219869 Business Flow
158058 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
158059 -- Prior Entry. Currently, the following code is always generated.
158060 ------------------------------------------------------------------------------------------------
158061 XLA_AE_LINES_PKG.ValidateCurrentLine;
158062
158063 ------------------------------------------------------------------------------------
158064 -- 4219869 Business Flow
158065 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
158066 ------------------------------------------------------------------------------------
158067 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
158068
158069 ----------------------------------------------------------------------------------
158070 -- 4219869 Business Flow
158071 -- Update journal entry status -- Need to generate this within IF <condition>
158072 ----------------------------------------------------------------------------------
158073 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
158074 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
158075 ,p_balance_type_code => l_balance_type_code
158076 );
158077
158078 -------------------------------------------------------------------------------------------
158079 -- 4262811 - Generate the Accrual Reversal lines
158080 -------------------------------------------------------------------------------------------
158081 BEGIN
158082 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
158083 (g_array_event(p_event_id).array_value_num('header_index'));
158084 IF l_acc_rev_flag IS NULL THEN
158085 l_acc_rev_flag := 'N';
158086 END IF;
158087 EXCEPTION
158088 WHEN OTHERS THEN
158089 l_acc_rev_flag := 'N';
158090 END;
158091 --
158092 IF (l_acc_rev_flag = 'Y') THEN
158093
158094 -- 4645092 ------------------------------------------------------------------------------
158095 -- To allow MPA report to determine if it should generate report process
158096 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
158097 ------------------------------------------------------------------------------------------
158098
158099 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
158100 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
158101 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
158102 -- call ADRs
158103 -- Bug 4922099
158104 --
158105 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
158106 (NVL(l_actual_upg_option, 'N') = 'O') OR
158107 (NVL(l_enc_upg_option, 'N') = 'O')
158108 )
158109 THEN
158110 NULL;
158111 --
158112 --
158113
158114 l_ccid := AcctDerRule_176(
158115 p_application_id => p_application_id
158116 , p_ae_header_id => l_ae_header_id
158117 , p_source_5 => p_source_5
158118 , p_source_31 => p_source_31
158119 , x_transaction_coa_id => l_adr_transaction_coa_id
158120 , x_accounting_coa_id => l_adr_accounting_coa_id
158121 , x_value_type_code => l_adr_value_type_code
158122 , p_side => 'NA'
158123 );
158124
158125 xla_ae_lines_pkg.set_ccid(
158126 p_code_combination_id => l_ccid
158127 , p_value_type_code => l_adr_value_type_code
158128 , p_transaction_coa_id => l_adr_transaction_coa_id
158129 , p_accounting_coa_id => l_adr_accounting_coa_id
158130 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
158131 , p_adr_type_code => 'S'
158132 , p_component_type => l_component_type
158133 , p_component_code => l_component_code
158134 , p_component_type_code => l_component_type_code
158138 );
158135 , p_component_appl_id => l_component_appl_id
158136 , p_amb_context_code => l_amb_context_code
158137 , p_side => 'NA'
158139
158140
158141 --
158142 --
158143 END IF;
158144
158145 --
158146 -- Update the line information that should be overwritten
158147 --
158148 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
158149 p_header_num => 1);
158150 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
158151
158152 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
158153
158154 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
158155 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
158156 END IF;
158157
158158 --
158159 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
158160 --
158161 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
158162 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
158163 ELSE
158164 ---------------------------------------------------------------------------------------------------
158165 -- 4262811a Switch Sign
158166 ---------------------------------------------------------------------------------------------------
158167 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
158168 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
158169 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
158170 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
158171 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
158172 -- 5132302
158173 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
158174 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
158175
158176 END IF;
158177
158178 -- 4955764
158179 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
158180 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
158181
158182
158183 XLA_AE_LINES_PKG.ValidateCurrentLine;
158184 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
158185
158186 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
158187 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
158188 ,p_balance_type_code => l_balance_type_code);
158189
158190 END IF;
158191
158192 -----------------------------------------------------------------------------------------
158193 -- 4262811 Multiperiod Accounting
158194 -----------------------------------------------------------------------------------------
158195 -- No MPA option is assigned.
158196
158197
158198 END IF;
158199 END IF;
158200 --
158201
158202 --
158203 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
158204 trace
158205 (p_msg => 'END of AcctLineType_386'
158206 ,p_level => C_LEVEL_PROCEDURE
158207 ,p_module => l_log_module);
158208 END IF;
158209 --
158210 EXCEPTION
158211 WHEN xla_exceptions_pkg.application_exception THEN
158212 RAISE;
158213 WHEN OTHERS THEN
158214 xla_exceptions_pkg.raise_message
158215 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_386');
158216 END AcctLineType_386;
158217 --
158218
158219 ---------------------------------------
158220 --
158221 -- PRIVATE FUNCTION
158222 -- AcctLineType_387
158223 --
158224 ---------------------------------------
158225 PROCEDURE AcctLineType_387 (
158226 p_application_id IN NUMBER
158227 ,p_event_id IN NUMBER
158228 ,p_calculate_acctd_flag IN VARCHAR2
158229 ,p_calculate_g_l_flag IN VARCHAR2
158230 ,p_actual_flag IN OUT VARCHAR2
158231 ,p_balance_type_code OUT VARCHAR2
158232 ,p_gain_or_loss_ref OUT VARCHAR2
158233
158234 --Period Close Date
158235 , p_source_1 IN DATE
158236 --Generated Code Combination Identifier
158237 , p_source_5 IN NUMBER
158238 --Depreciation Reserve Account
158239 , p_source_12 IN VARCHAR2
158240 --Generated Offset Code Combination Identifier
158241 , p_source_19 IN NUMBER
158242 --Expense Account Code Combination Identifier
158243 , p_source_31 IN NUMBER
158244 --Default Code Combination Identifier
158245 , p_source_32 IN NUMBER
158246 --Adjustment Type
158247 , p_source_48 IN VARCHAR2
158248 --Transaction Header Identifier
158249 , p_source_49 IN NUMBER
158250 --Adjustment Line Identifier
158251 , p_source_50 IN NUMBER
158252 --Distribution Type Code
158253 , p_source_51 IN VARCHAR2
158254 --Entered Amount
158255 , p_source_52 IN NUMBER
158256 --Currency Code
158257 , p_source_53 IN VARCHAR2
158258 --Source Destination Code
158259 , p_source_55 IN VARCHAR2
158263 l_component_type VARCHAR2(80);
158260 )
158261 IS
158262
158264 l_component_code VARCHAR2(30);
158265 l_component_type_code VARCHAR2(1);
158266 l_component_appl_id INTEGER;
158267 l_amb_context_code VARCHAR2(30);
158268 l_entity_code VARCHAR2(30);
158269 l_event_class_code VARCHAR2(30);
158270 l_ae_header_id NUMBER;
158271 l_event_type_code VARCHAR2(30);
158272 l_line_definition_code VARCHAR2(30);
158273 l_line_definition_owner_code VARCHAR2(1);
158274 --
158275 -- adr variables
158276 l_segment VARCHAR2(30);
158277 l_ccid NUMBER;
158278 l_adr_transaction_coa_id NUMBER;
158279 l_adr_accounting_coa_id NUMBER;
158280 l_adr_flexfield_segment_code VARCHAR2(30);
158281 l_adr_flex_value_set_id NUMBER;
158282 l_adr_value_type_code VARCHAR2(30);
158283 l_adr_value_combination_id NUMBER;
158284 l_adr_value_segment_code VARCHAR2(30);
158285
158286 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
158287 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
158288 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
158289 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
158290
158291 -- 4262811 Variables ------------------------------------------------------------------------------------------
158292 l_entered_amt_idx NUMBER;
158293 l_accted_amt_idx NUMBER;
158294 l_acc_rev_flag VARCHAR2(1);
158295 l_accrual_line_num NUMBER;
158296 l_tmp_amt NUMBER;
158297 l_acc_rev_natural_side_code VARCHAR2(1);
158298
158299 l_num_entries NUMBER;
158300 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
158301 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
158302 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
158303 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
158304 l_recog_line_1 NUMBER;
158305 l_recog_line_2 NUMBER;
158306
158307 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
158308 l_bflow_applied_to_amt NUMBER; -- 5132302
158309 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
158310
158311 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
158312
158313 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
158314 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
158315
158316 ---------------------------------------------------------------------------------------------------------------
158317
158318
158319 --
158320 -- bulk performance
158321 --
158322 l_balance_type_code VARCHAR2(1);
158323 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
158324 l_log_module VARCHAR2(240);
158325
158326 --
158327 -- Upgrade strategy
158328 --
158329 l_actual_upg_option VARCHAR2(1);
158330 l_enc_upg_option VARCHAR2(1);
158331
158332 --
158333 BEGIN
158334 --
158335 IF g_log_enabled THEN
158336 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_387';
158337 END IF;
158338 --
158339 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
158340
158341 trace
158342 (p_msg => 'BEGIN of AcctLineType_387'
158343 ,p_level => C_LEVEL_PROCEDURE
158344 ,p_module => l_log_module);
158345
158346 END IF;
158347 --
158348 l_component_type := 'AMB_JLT';
158349 l_component_code := 'FA_TRANSFER_DEST_RESERVE_BAL';
158350 l_component_type_code := 'S';
158351 l_component_appl_id := 140;
158352 l_amb_context_code := 'DEFAULT';
158353 l_entity_code := 'TRANSACTIONS';
158354 l_event_class_code := 'TRANSFERS';
158355 l_event_type_code := 'TRANSFERS_ALL';
158356 l_line_definition_owner_code := 'S';
158357 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
158358 --
158359 l_balance_type_code := 'A';
158360 l_segment := NULL;
158361 l_ccid := NULL;
158362 l_adr_transaction_coa_id := NULL;
158363 l_adr_accounting_coa_id := NULL;
158364 l_adr_flexfield_segment_code := NULL;
158365 l_adr_flex_value_set_id := NULL;
158366 l_adr_value_type_code := NULL;
158367 l_adr_value_combination_id := NULL;
158368 l_adr_value_segment_code := NULL;
158369
158370 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
158371 l_bflow_class_code := ''; -- 4219869 Business Flow
158372 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
158373 l_budgetary_control_flag := 'N';
158374
158375 l_bflow_applied_to_amt_idx := NULL; -- 5132302
158376 l_bflow_applied_to_amt := NULL; -- 5132302
158377 l_entered_amt_idx := NULL; -- 4262811
158378 l_accted_amt_idx := NULL; -- 4262811
158379 l_acc_rev_flag := NULL; -- 4262811
158380 l_accrual_line_num := NULL; -- 4262811
158381 l_tmp_amt := NULL; -- 4262811
158382 --
158383
158384 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
158385 l_balance_type_code <> 'B' THEN
158386 IF (NVL(p_source_48,'
158387 ') = 'BONUS RESERVE' OR
158388 NVL(p_source_48,'
158392 THEN
158389 ') = 'BONUS EXPENSE') AND
158390 NVL(p_source_55,'
158391 ') = 'DEST'
158393
158394 --
158395 XLA_AE_LINES_PKG.SetNewLine;
158396
158397 p_balance_type_code := l_balance_type_code;
158398 -- set the flag so later we will know whether the gain loss line needs to be created
158399
158400 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
158401 p_actual_flag :='A';
158402 END IF;
158403
158404 --
158405 -- bulk performance
158406 --
158407 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
158408 p_header_num => 0); -- 4262811
158409 --
158410 -- set accounting line options
158411 --
158412 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
158413 p_natural_side_code => 'D'
158414 , p_gain_or_loss_flag => 'N'
158415 , p_gl_transfer_mode_code => 'S'
158416 , p_acct_entry_type_code => 'A'
158417 , p_switch_side_flag => 'Y'
158418 , p_merge_duplicate_code => 'N'
158419 );
158420 --
158421 l_acc_rev_natural_side_code := 'C'; -- 4262811
158422 --
158423 --
158424 -- set accounting line type info
158425 --
158426 xla_ae_lines_pkg.SetAcctLineType
158427 (p_component_type => l_component_type
158428 ,p_event_type_code => l_event_type_code
158429 ,p_line_definition_owner_code => l_line_definition_owner_code
158430 ,p_line_definition_code => l_line_definition_code
158431 ,p_accounting_line_code => l_component_code
158432 ,p_accounting_line_type_code => l_component_type_code
158433 ,p_accounting_line_appl_id => l_component_appl_id
158434 ,p_amb_context_code => l_amb_context_code
158435 ,p_entity_code => l_entity_code
158436 ,p_event_class_code => l_event_class_code);
158437 --
158438 -- set accounting class
158439 --
158440 xla_ae_lines_pkg.SetAcctClass(
158441 p_accounting_class_code => 'ASSET'
158442 , p_ae_header_id => l_ae_header_id
158443 );
158444
158445 --
158446 -- set rounding class
158447 --
158448 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
158449 'ASSET';
158450
158451 --
158452 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
158453 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
158454 --
158455 -- bulk performance
158456 --
158457 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
158458
158459 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
158460 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
158461
158462 -- 4955764
158463 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
158464 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
158465
158466 -- 4458381 Public Sector Enh
158467
158468 --
158469 -- set accounting attributes for the line type
158470 --
158471 l_entered_amt_idx := 4;
158472 l_accted_amt_idx := 6;
158473 l_bflow_applied_to_amt_idx := NULL; -- 5132302
158474 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
158475 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
158476 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
158477 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
158478 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
158479 l_rec_acct_attrs.array_char_value(3) := p_source_51;
158480 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
158481 l_rec_acct_attrs.array_num_value(4) := p_source_52;
158482 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
158483 l_rec_acct_attrs.array_char_value(5) := p_source_53;
158484 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
158485 l_rec_acct_attrs.array_num_value(6) := p_source_52;
158486
158487 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
158488 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
158489
158490 ---------------------------------------------------------------------------------------------------------------
158491 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
158492 ---------------------------------------------------------------------------------------------------------------
158493 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
158494
158495 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
158496 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
158497
158498 IF xla_accounting_cache_pkg.GetValueChar
158499 (p_source_code => 'LEDGER_CATEGORY_CODE'
158500 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
158501 AND l_bflow_method_code = 'PRIOR_ENTRY'
158502 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
158503 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
158507 xla_ae_lines_pkg.BflowUpgEntry
158504 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
158505 )
158506 THEN
158508 (p_business_method_code => l_bflow_method_code
158509 ,p_business_class_code => l_bflow_class_code
158510 ,p_balance_type => l_balance_type_code);
158511 ELSE
158512 NULL;
158513 -- No business flow processing for business flow method of NONE.
158514 END IF;
158515
158516 --
158517 -- call analytical criteria
158518 --
158519
158520 --
158521 -- call description
158522 --
158523
158524 xla_ae_lines_pkg.SetLineDescription(
158525 p_ae_header_id => l_ae_header_id
158526 ,p_description => Description_130 (
158527 p_application_id => p_application_id
158528 , p_ae_header_id => l_ae_header_id
158529 , p_source_1 => p_source_1
158530 )
158531 );
158532
158533
158534 --
158535 -- call ADRs
158536 -- Bug 4922099
158537 --
158538 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
158539 (NVL(l_actual_upg_option, 'N') = 'O') OR
158540 (NVL(l_enc_upg_option, 'N') = 'O')
158541 )
158542 THEN
158543 NULL;
158544 --
158545 --
158546
158547 l_ccid := AcctDerRule_175(
158548 p_application_id => p_application_id
158549 , p_ae_header_id => l_ae_header_id
158550 , p_source_5 => p_source_5
158551 , p_source_19 => p_source_19
158552 , p_source_32 => p_source_32
158553 , x_transaction_coa_id => l_adr_transaction_coa_id
158554 , x_accounting_coa_id => l_adr_accounting_coa_id
158555 , x_value_type_code => l_adr_value_type_code
158556 , p_side => 'NA'
158557 );
158558
158559 xla_ae_lines_pkg.set_ccid(
158560 p_code_combination_id => l_ccid
158561 , p_value_type_code => l_adr_value_type_code
158562 , p_transaction_coa_id => l_adr_transaction_coa_id
158563 , p_accounting_coa_id => l_adr_accounting_coa_id
158564 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
158565 , p_adr_type_code => 'S'
158566 , p_component_type => l_component_type
158567 , p_component_code => l_component_code
158568 , p_component_type_code => l_component_type_code
158569 , p_component_appl_id => l_component_appl_id
158570 , p_amb_context_code => l_amb_context_code
158571 , p_side => 'NA'
158572 );
158573
158574
158575 l_segment := AcctDerRule_150(
158576 p_application_id => p_application_id
158577 , p_ae_header_id => l_ae_header_id
158578 , p_source_5 => p_source_5
158579 , p_source_12 => p_source_12
158580 , x_transaction_coa_id => l_adr_transaction_coa_id
158581 , x_accounting_coa_id => l_adr_accounting_coa_id
158582 , x_flexfield_segment_code => l_adr_flexfield_segment_code
158583 , x_flex_value_set_id => l_adr_flex_value_set_id
158584 , x_value_type_code => l_adr_value_type_code
158585 , x_value_combination_id => l_adr_value_combination_id
158586 , x_value_segment_code => l_adr_value_segment_code
158587 , p_side => 'NA'
158588 , p_override_seg_flag => 'Y'
158589 );
158590
158591 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
158592
158593 xla_ae_lines_pkg.set_segment(
158594 p_to_segment_code => 'GL_ACCOUNT'
158595 , p_segment_value => l_segment
158596 , p_from_segment_code => l_adr_value_segment_code
158597 , p_from_combination_id => l_adr_value_combination_id
158598 , p_value_type_code => l_adr_value_type_code
158599 , p_transaction_coa_id => l_adr_transaction_coa_id
158600 , p_accounting_coa_id => l_adr_accounting_coa_id
158601 , p_flexfield_segment_code => l_adr_flexfield_segment_code
158602 , p_flex_value_set_id => l_adr_flex_value_set_id
158603 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
158604 , p_adr_type_code => 'S'
158605 , p_component_type => l_component_type
158606 , p_component_code => l_component_code
158607 , p_component_type_code => l_component_type_code
158608 , p_component_appl_id => l_component_appl_id
158609 , p_amb_context_code => l_amb_context_code
158610 , p_entity_code => 'TRANSACTIONS'
158611 , p_event_class_code => 'TRANSFERS'
158612 , p_side => 'NA'
158613 );
158614
158615 END IF;
158616
158617 l_segment := AcctDerRule_169(
158618 p_application_id => p_application_id
158619 , p_ae_header_id => l_ae_header_id
158620 , p_source_5 => p_source_5
158621 , p_source_31 => p_source_31
158622 , x_transaction_coa_id => l_adr_transaction_coa_id
158623 , x_accounting_coa_id => l_adr_accounting_coa_id
158624 , x_flexfield_segment_code => l_adr_flexfield_segment_code
158625 , x_flex_value_set_id => l_adr_flex_value_set_id
158626 , x_value_type_code => l_adr_value_type_code
158627 , x_value_combination_id => l_adr_value_combination_id
158631 );
158628 , x_value_segment_code => l_adr_value_segment_code
158629 , p_side => 'NA'
158630 , p_override_seg_flag => 'Y'
158632
158633 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
158634
158635 xla_ae_lines_pkg.set_segment(
158636 p_to_segment_code => 'GL_BALANCING'
158637 , p_segment_value => l_segment
158638 , p_from_segment_code => l_adr_value_segment_code
158639 , p_from_combination_id => l_adr_value_combination_id
158640 , p_value_type_code => l_adr_value_type_code
158641 , p_transaction_coa_id => l_adr_transaction_coa_id
158642 , p_accounting_coa_id => l_adr_accounting_coa_id
158643 , p_flexfield_segment_code => l_adr_flexfield_segment_code
158644 , p_flex_value_set_id => l_adr_flex_value_set_id
158645 , p_adr_code => 'FA_EXPENSE_ACCT'
158646 , p_adr_type_code => 'S'
158647 , p_component_type => l_component_type
158648 , p_component_code => l_component_code
158649 , p_component_type_code => l_component_type_code
158650 , p_component_appl_id => l_component_appl_id
158651 , p_amb_context_code => l_amb_context_code
158652 , p_entity_code => 'TRANSACTIONS'
158653 , p_event_class_code => 'TRANSFERS'
158654 , p_side => 'NA'
158655 );
158656
158657 END IF;
158658
158659 --
158660 --
158661 END IF;
158662 --
158663 -- Bug 4922099
158664 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
158665 (NVL(l_enc_upg_option, 'N') = 'O')
158666 ) AND
158667 (l_bflow_method_code = 'PRIOR_ENTRY')
158668 )
158669 THEN
158670 IF
158671 --
158672 1 = 2
158673 --
158674 THEN
158675 xla_accounting_err_pkg.build_message
158676 (p_appli_s_name => 'XLA'
158677 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
158678 ,p_token_1 => 'LINE_NUMBER'
158679 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
158680 ,p_token_2 => 'LINE_TYPE_NAME'
158681 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
158682 l_component_type
158683 ,l_component_code
158684 ,l_component_type_code
158685 ,l_component_appl_id
158686 ,l_amb_context_code
158687 ,l_entity_code
158688 ,l_event_class_code
158689 )
158690 ,p_token_3 => 'OWNER'
158691 ,p_value_3 => xla_lookups_pkg.get_meaning(
158692 p_lookup_type => 'XLA_OWNER_TYPE'
158693 ,p_lookup_code => l_component_type_code
158694 )
158695 ,p_token_4 => 'PRODUCT_NAME'
158696 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
158697 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
158698 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
158699 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
158700 ,p_ae_header_id => NULL
158701 );
158702
158703 IF (C_LEVEL_ERROR>= g_log_level) THEN
158704 trace
158705 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
158706 ,p_level => C_LEVEL_ERROR
158707 ,p_module => l_log_module);
158708 END IF;
158709 END IF;
158710 END IF;
158711 --
158712 --
158713 ------------------------------------------------------------------------------------------------
158714 -- 4219869 Business Flow
158715 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
158716 -- Prior Entry. Currently, the following code is always generated.
158717 ------------------------------------------------------------------------------------------------
158718 XLA_AE_LINES_PKG.ValidateCurrentLine;
158719
158720 ------------------------------------------------------------------------------------
158721 -- 4219869 Business Flow
158722 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
158723 ------------------------------------------------------------------------------------
158727 -- 4219869 Business Flow
158724 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
158725
158726 ----------------------------------------------------------------------------------
158728 -- Update journal entry status -- Need to generate this within IF <condition>
158729 ----------------------------------------------------------------------------------
158730 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
158731 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
158732 ,p_balance_type_code => l_balance_type_code
158733 );
158734
158735 -------------------------------------------------------------------------------------------
158736 -- 4262811 - Generate the Accrual Reversal lines
158737 -------------------------------------------------------------------------------------------
158738 BEGIN
158739 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
158740 (g_array_event(p_event_id).array_value_num('header_index'));
158741 IF l_acc_rev_flag IS NULL THEN
158742 l_acc_rev_flag := 'N';
158743 END IF;
158744 EXCEPTION
158745 WHEN OTHERS THEN
158746 l_acc_rev_flag := 'N';
158747 END;
158748 --
158749 IF (l_acc_rev_flag = 'Y') THEN
158750
158751 -- 4645092 ------------------------------------------------------------------------------
158752 -- To allow MPA report to determine if it should generate report process
158753 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
158754 ------------------------------------------------------------------------------------------
158755
158756 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
158757 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
158758 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
158759 -- call ADRs
158760 -- Bug 4922099
158761 --
158762 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
158763 (NVL(l_actual_upg_option, 'N') = 'O') OR
158764 (NVL(l_enc_upg_option, 'N') = 'O')
158765 )
158766 THEN
158767 NULL;
158768 --
158769 --
158770
158771 l_ccid := AcctDerRule_175(
158772 p_application_id => p_application_id
158773 , p_ae_header_id => l_ae_header_id
158774 , p_source_5 => p_source_5
158775 , p_source_19 => p_source_19
158776 , p_source_32 => p_source_32
158777 , x_transaction_coa_id => l_adr_transaction_coa_id
158778 , x_accounting_coa_id => l_adr_accounting_coa_id
158779 , x_value_type_code => l_adr_value_type_code
158780 , p_side => 'NA'
158781 );
158782
158783 xla_ae_lines_pkg.set_ccid(
158784 p_code_combination_id => l_ccid
158785 , p_value_type_code => l_adr_value_type_code
158786 , p_transaction_coa_id => l_adr_transaction_coa_id
158787 , p_accounting_coa_id => l_adr_accounting_coa_id
158788 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
158789 , p_adr_type_code => 'S'
158790 , p_component_type => l_component_type
158791 , p_component_code => l_component_code
158792 , p_component_type_code => l_component_type_code
158793 , p_component_appl_id => l_component_appl_id
158794 , p_amb_context_code => l_amb_context_code
158795 , p_side => 'NA'
158796 );
158797
158798
158799 l_segment := AcctDerRule_150(
158800 p_application_id => p_application_id
158801 , p_ae_header_id => l_ae_header_id
158802 , p_source_5 => p_source_5
158803 , p_source_12 => p_source_12
158804 , x_transaction_coa_id => l_adr_transaction_coa_id
158805 , x_accounting_coa_id => l_adr_accounting_coa_id
158806 , x_flexfield_segment_code => l_adr_flexfield_segment_code
158807 , x_flex_value_set_id => l_adr_flex_value_set_id
158808 , x_value_type_code => l_adr_value_type_code
158809 , x_value_combination_id => l_adr_value_combination_id
158810 , x_value_segment_code => l_adr_value_segment_code
158811 , p_side => 'NA'
158812 , p_override_seg_flag => 'Y'
158813 );
158814
158815 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
158816
158817 xla_ae_lines_pkg.set_segment(
158818 p_to_segment_code => 'GL_ACCOUNT'
158819 , p_segment_value => l_segment
158820 , p_from_segment_code => l_adr_value_segment_code
158821 , p_from_combination_id => l_adr_value_combination_id
158822 , p_value_type_code => l_adr_value_type_code
158823 , p_transaction_coa_id => l_adr_transaction_coa_id
158824 , p_accounting_coa_id => l_adr_accounting_coa_id
158825 , p_flexfield_segment_code => l_adr_flexfield_segment_code
158826 , p_flex_value_set_id => l_adr_flex_value_set_id
158827 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
158828 , p_adr_type_code => 'S'
158829 , p_component_type => l_component_type
158830 , p_component_code => l_component_code
158831 , p_component_type_code => l_component_type_code
158832 , p_component_appl_id => l_component_appl_id
158833 , p_amb_context_code => l_amb_context_code
158834 , p_entity_code => 'TRANSACTIONS'
158838
158835 , p_event_class_code => 'TRANSFERS'
158836 , p_side => 'NA'
158837 );
158839 END IF;
158840
158841 l_segment := AcctDerRule_169(
158842 p_application_id => p_application_id
158843 , p_ae_header_id => l_ae_header_id
158844 , p_source_5 => p_source_5
158845 , p_source_31 => p_source_31
158846 , x_transaction_coa_id => l_adr_transaction_coa_id
158847 , x_accounting_coa_id => l_adr_accounting_coa_id
158848 , x_flexfield_segment_code => l_adr_flexfield_segment_code
158849 , x_flex_value_set_id => l_adr_flex_value_set_id
158850 , x_value_type_code => l_adr_value_type_code
158851 , x_value_combination_id => l_adr_value_combination_id
158852 , x_value_segment_code => l_adr_value_segment_code
158853 , p_side => 'NA'
158854 , p_override_seg_flag => 'Y'
158855 );
158856
158857 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
158858
158859 xla_ae_lines_pkg.set_segment(
158860 p_to_segment_code => 'GL_BALANCING'
158861 , p_segment_value => l_segment
158862 , p_from_segment_code => l_adr_value_segment_code
158863 , p_from_combination_id => l_adr_value_combination_id
158864 , p_value_type_code => l_adr_value_type_code
158865 , p_transaction_coa_id => l_adr_transaction_coa_id
158866 , p_accounting_coa_id => l_adr_accounting_coa_id
158867 , p_flexfield_segment_code => l_adr_flexfield_segment_code
158868 , p_flex_value_set_id => l_adr_flex_value_set_id
158869 , p_adr_code => 'FA_EXPENSE_ACCT'
158870 , p_adr_type_code => 'S'
158871 , p_component_type => l_component_type
158872 , p_component_code => l_component_code
158873 , p_component_type_code => l_component_type_code
158874 , p_component_appl_id => l_component_appl_id
158875 , p_amb_context_code => l_amb_context_code
158876 , p_entity_code => 'TRANSACTIONS'
158877 , p_event_class_code => 'TRANSFERS'
158878 , p_side => 'NA'
158879 );
158880
158881 END IF;
158882
158883 --
158884 --
158885 END IF;
158886
158887 --
158888 -- Update the line information that should be overwritten
158889 --
158890 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
158891 p_header_num => 1);
158892 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
158893
158894 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
158895
158896 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
158897 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
158898 END IF;
158899
158900 --
158901 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
158902 --
158903 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
158904 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
158905 ELSE
158906 ---------------------------------------------------------------------------------------------------
158907 -- 4262811a Switch Sign
158908 ---------------------------------------------------------------------------------------------------
158909 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
158910 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
158911 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
158912 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
158913 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
158914 -- 5132302
158915 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
158916 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
158917
158918 END IF;
158919
158920 -- 4955764
158921 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
158922 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
158923
158924
158925 XLA_AE_LINES_PKG.ValidateCurrentLine;
158926 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
158927
158928 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
158929 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
158930 ,p_balance_type_code => l_balance_type_code);
158931
158932 END IF;
158933
158934 -----------------------------------------------------------------------------------------
158935 -- 4262811 Multiperiod Accounting
158936 -----------------------------------------------------------------------------------------
158937 -- No MPA option is assigned.
158938
158939
158940 END IF;
158941 END IF;
158942 --
158943
158944 --
158945 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
158946 trace
158947 (p_msg => 'END of AcctLineType_387'
158951 --
158948 ,p_level => C_LEVEL_PROCEDURE
158949 ,p_module => l_log_module);
158950 END IF;
158952 EXCEPTION
158953 WHEN xla_exceptions_pkg.application_exception THEN
158954 RAISE;
158955 WHEN OTHERS THEN
158956 xla_exceptions_pkg.raise_message
158957 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_387');
158958 END AcctLineType_387;
158959 --
158960
158961 ---------------------------------------
158962 --
158963 -- PRIVATE FUNCTION
158964 -- AcctLineType_388
158965 --
158966 ---------------------------------------
158967 PROCEDURE AcctLineType_388 (
158968 p_application_id IN NUMBER
158969 ,p_event_id IN NUMBER
158970 ,p_calculate_acctd_flag IN VARCHAR2
158971 ,p_calculate_g_l_flag IN VARCHAR2
158972 ,p_actual_flag IN OUT VARCHAR2
158973 ,p_balance_type_code OUT VARCHAR2
158974 ,p_gain_or_loss_ref OUT VARCHAR2
158975
158976 --Period Close Date
158977 , p_source_1 IN DATE
158978 --Generated Code Combination Identifier
158979 , p_source_5 IN NUMBER
158980 --Revaluation Reserve Account
158981 , p_source_13 IN VARCHAR2
158982 --Generated Offset Code Combination Identifier
158983 , p_source_19 IN NUMBER
158984 --Expense Account Code Combination Identifier
158985 , p_source_31 IN NUMBER
158986 --Default Code Combination Identifier
158987 , p_source_32 IN NUMBER
158988 --Adjustment Type
158989 , p_source_48 IN VARCHAR2
158990 --Transaction Header Identifier
158991 , p_source_49 IN NUMBER
158992 --Adjustment Line Identifier
158993 , p_source_50 IN NUMBER
158994 --Distribution Type Code
158995 , p_source_51 IN VARCHAR2
158996 --Entered Amount
158997 , p_source_52 IN NUMBER
158998 --Currency Code
158999 , p_source_53 IN VARCHAR2
159000 --Source Destination Code
159001 , p_source_55 IN VARCHAR2
159002 )
159003 IS
159004
159005 l_component_type VARCHAR2(80);
159006 l_component_code VARCHAR2(30);
159007 l_component_type_code VARCHAR2(1);
159008 l_component_appl_id INTEGER;
159009 l_amb_context_code VARCHAR2(30);
159010 l_entity_code VARCHAR2(30);
159011 l_event_class_code VARCHAR2(30);
159012 l_ae_header_id NUMBER;
159013 l_event_type_code VARCHAR2(30);
159014 l_line_definition_code VARCHAR2(30);
159015 l_line_definition_owner_code VARCHAR2(1);
159016 --
159017 -- adr variables
159018 l_segment VARCHAR2(30);
159019 l_ccid NUMBER;
159020 l_adr_transaction_coa_id NUMBER;
159021 l_adr_accounting_coa_id NUMBER;
159022 l_adr_flexfield_segment_code VARCHAR2(30);
159023 l_adr_flex_value_set_id NUMBER;
159024 l_adr_value_type_code VARCHAR2(30);
159025 l_adr_value_combination_id NUMBER;
159026 l_adr_value_segment_code VARCHAR2(30);
159027
159028 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
159029 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
159030 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
159031 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
159032
159033 -- 4262811 Variables ------------------------------------------------------------------------------------------
159034 l_entered_amt_idx NUMBER;
159035 l_accted_amt_idx NUMBER;
159036 l_acc_rev_flag VARCHAR2(1);
159037 l_accrual_line_num NUMBER;
159038 l_tmp_amt NUMBER;
159039 l_acc_rev_natural_side_code VARCHAR2(1);
159040
159041 l_num_entries NUMBER;
159042 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
159043 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
159044 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
159045 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
159046 l_recog_line_1 NUMBER;
159047 l_recog_line_2 NUMBER;
159048
159049 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
159050 l_bflow_applied_to_amt NUMBER; -- 5132302
159051 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
159052
159053 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
159054
159055 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
159056 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
159057
159058 ---------------------------------------------------------------------------------------------------------------
159059
159060
159061 --
159062 -- bulk performance
159063 --
159064 l_balance_type_code VARCHAR2(1);
159065 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
159066 l_log_module VARCHAR2(240);
159067
159068 --
159069 -- Upgrade strategy
159070 --
159071 l_actual_upg_option VARCHAR2(1);
159072 l_enc_upg_option VARCHAR2(1);
159073
159074 --
159075 BEGIN
159076 --
159077 IF g_log_enabled THEN
159078 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_388';
159079 END IF;
159080 --
159081 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
159082
159083 trace
159087
159084 (p_msg => 'BEGIN of AcctLineType_388'
159085 ,p_level => C_LEVEL_PROCEDURE
159086 ,p_module => l_log_module);
159088 END IF;
159089 --
159090 l_component_type := 'AMB_JLT';
159091 l_component_code := 'FA_TRANSFER_DEST_REVAL_RES';
159092 l_component_type_code := 'S';
159093 l_component_appl_id := 140;
159094 l_amb_context_code := 'DEFAULT';
159095 l_entity_code := 'TRANSACTIONS';
159096 l_event_class_code := 'TRANSFERS';
159097 l_event_type_code := 'TRANSFERS_ALL';
159098 l_line_definition_owner_code := 'S';
159099 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
159100 --
159101 l_balance_type_code := 'A';
159102 l_segment := NULL;
159103 l_ccid := NULL;
159104 l_adr_transaction_coa_id := NULL;
159105 l_adr_accounting_coa_id := NULL;
159106 l_adr_flexfield_segment_code := NULL;
159107 l_adr_flex_value_set_id := NULL;
159108 l_adr_value_type_code := NULL;
159109 l_adr_value_combination_id := NULL;
159110 l_adr_value_segment_code := NULL;
159111
159112 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
159113 l_bflow_class_code := ''; -- 4219869 Business Flow
159114 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
159115 l_budgetary_control_flag := 'N';
159116
159117 l_bflow_applied_to_amt_idx := NULL; -- 5132302
159118 l_bflow_applied_to_amt := NULL; -- 5132302
159119 l_entered_amt_idx := NULL; -- 4262811
159120 l_accted_amt_idx := NULL; -- 4262811
159121 l_acc_rev_flag := NULL; -- 4262811
159122 l_accrual_line_num := NULL; -- 4262811
159123 l_tmp_amt := NULL; -- 4262811
159124 --
159125
159126 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
159127 l_balance_type_code <> 'B' THEN
159128 IF NVL(p_source_48,'
159129 ') = 'REVAL RESERVE' AND
159130 NVL(p_source_55,'
159131 ') = 'DEST'
159132 THEN
159133
159134 --
159135 XLA_AE_LINES_PKG.SetNewLine;
159136
159137 p_balance_type_code := l_balance_type_code;
159138 -- set the flag so later we will know whether the gain loss line needs to be created
159139
159140 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
159141 p_actual_flag :='A';
159142 END IF;
159143
159144 --
159145 -- bulk performance
159146 --
159147 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
159148 p_header_num => 0); -- 4262811
159149 --
159150 -- set accounting line options
159151 --
159152 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
159153 p_natural_side_code => 'C'
159154 , p_gain_or_loss_flag => 'N'
159155 , p_gl_transfer_mode_code => 'S'
159156 , p_acct_entry_type_code => 'A'
159157 , p_switch_side_flag => 'Y'
159158 , p_merge_duplicate_code => 'N'
159159 );
159160 --
159161 l_acc_rev_natural_side_code := 'D'; -- 4262811
159162 --
159163 --
159164 -- set accounting line type info
159165 --
159166 xla_ae_lines_pkg.SetAcctLineType
159167 (p_component_type => l_component_type
159168 ,p_event_type_code => l_event_type_code
159169 ,p_line_definition_owner_code => l_line_definition_owner_code
159170 ,p_line_definition_code => l_line_definition_code
159171 ,p_accounting_line_code => l_component_code
159172 ,p_accounting_line_type_code => l_component_type_code
159173 ,p_accounting_line_appl_id => l_component_appl_id
159174 ,p_amb_context_code => l_amb_context_code
159175 ,p_entity_code => l_entity_code
159176 ,p_event_class_code => l_event_class_code);
159177 --
159178 -- set accounting class
159179 --
159180 xla_ae_lines_pkg.SetAcctClass(
159181 p_accounting_class_code => 'ASSET'
159182 , p_ae_header_id => l_ae_header_id
159183 );
159184
159185 --
159186 -- set rounding class
159187 --
159188 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
159189 'ASSET';
159190
159191 --
159192 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
159193 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
159194 --
159195 -- bulk performance
159196 --
159197 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
159198
159199 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
159200 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
159201
159202 -- 4955764
159203 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
159204 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
159205
159206 -- 4458381 Public Sector Enh
159207
159208 --
159209 -- set accounting attributes for the line type
159210 --
159211 l_entered_amt_idx := 4;
159212 l_accted_amt_idx := 6;
159216 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
159213 l_bflow_applied_to_amt_idx := NULL; -- 5132302
159214 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
159215 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
159217 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
159218 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
159219 l_rec_acct_attrs.array_char_value(3) := p_source_51;
159220 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
159221 l_rec_acct_attrs.array_num_value(4) := p_source_52;
159222 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
159223 l_rec_acct_attrs.array_char_value(5) := p_source_53;
159224 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
159225 l_rec_acct_attrs.array_num_value(6) := p_source_52;
159226
159227 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
159228 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
159229
159230 ---------------------------------------------------------------------------------------------------------------
159231 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
159232 ---------------------------------------------------------------------------------------------------------------
159233 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
159234
159235 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
159236 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
159237
159238 IF xla_accounting_cache_pkg.GetValueChar
159239 (p_source_code => 'LEDGER_CATEGORY_CODE'
159240 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
159241 AND l_bflow_method_code = 'PRIOR_ENTRY'
159242 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
159243 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
159244 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
159245 )
159246 THEN
159247 xla_ae_lines_pkg.BflowUpgEntry
159248 (p_business_method_code => l_bflow_method_code
159249 ,p_business_class_code => l_bflow_class_code
159250 ,p_balance_type => l_balance_type_code);
159251 ELSE
159252 NULL;
159253 -- No business flow processing for business flow method of NONE.
159254 END IF;
159255
159256 --
159257 -- call analytical criteria
159258 --
159259
159260 --
159261 -- call description
159262 --
159263
159264 xla_ae_lines_pkg.SetLineDescription(
159265 p_ae_header_id => l_ae_header_id
159266 ,p_description => Description_131 (
159267 p_application_id => p_application_id
159268 , p_ae_header_id => l_ae_header_id
159269 , p_source_1 => p_source_1
159270 )
159271 );
159272
159273
159274 --
159275 -- call ADRs
159276 -- Bug 4922099
159277 --
159278 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
159279 (NVL(l_actual_upg_option, 'N') = 'O') OR
159280 (NVL(l_enc_upg_option, 'N') = 'O')
159281 )
159282 THEN
159283 NULL;
159284 --
159285 --
159286
159287 l_ccid := AcctDerRule_175(
159288 p_application_id => p_application_id
159289 , p_ae_header_id => l_ae_header_id
159290 , p_source_5 => p_source_5
159291 , p_source_19 => p_source_19
159292 , p_source_32 => p_source_32
159293 , x_transaction_coa_id => l_adr_transaction_coa_id
159294 , x_accounting_coa_id => l_adr_accounting_coa_id
159295 , x_value_type_code => l_adr_value_type_code
159296 , p_side => 'NA'
159297 );
159298
159299 xla_ae_lines_pkg.set_ccid(
159300 p_code_combination_id => l_ccid
159301 , p_value_type_code => l_adr_value_type_code
159302 , p_transaction_coa_id => l_adr_transaction_coa_id
159303 , p_accounting_coa_id => l_adr_accounting_coa_id
159304 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
159305 , p_adr_type_code => 'S'
159306 , p_component_type => l_component_type
159307 , p_component_code => l_component_code
159308 , p_component_type_code => l_component_type_code
159309 , p_component_appl_id => l_component_appl_id
159310 , p_amb_context_code => l_amb_context_code
159311 , p_side => 'NA'
159312 );
159313
159314
159315 l_segment := AcctDerRule_151(
159316 p_application_id => p_application_id
159317 , p_ae_header_id => l_ae_header_id
159318 , p_source_5 => p_source_5
159319 , p_source_13 => p_source_13
159320 , x_transaction_coa_id => l_adr_transaction_coa_id
159321 , x_accounting_coa_id => l_adr_accounting_coa_id
159322 , x_flexfield_segment_code => l_adr_flexfield_segment_code
159323 , x_flex_value_set_id => l_adr_flex_value_set_id
159324 , x_value_type_code => l_adr_value_type_code
159325 , x_value_combination_id => l_adr_value_combination_id
159326 , x_value_segment_code => l_adr_value_segment_code
159330
159327 , p_side => 'NA'
159328 , p_override_seg_flag => 'Y'
159329 );
159331 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
159332
159333 xla_ae_lines_pkg.set_segment(
159334 p_to_segment_code => 'GL_ACCOUNT'
159335 , p_segment_value => l_segment
159336 , p_from_segment_code => l_adr_value_segment_code
159337 , p_from_combination_id => l_adr_value_combination_id
159338 , p_value_type_code => l_adr_value_type_code
159339 , p_transaction_coa_id => l_adr_transaction_coa_id
159340 , p_accounting_coa_id => l_adr_accounting_coa_id
159341 , p_flexfield_segment_code => l_adr_flexfield_segment_code
159342 , p_flex_value_set_id => l_adr_flex_value_set_id
159343 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
159344 , p_adr_type_code => 'S'
159345 , p_component_type => l_component_type
159346 , p_component_code => l_component_code
159347 , p_component_type_code => l_component_type_code
159348 , p_component_appl_id => l_component_appl_id
159349 , p_amb_context_code => l_amb_context_code
159350 , p_entity_code => 'TRANSACTIONS'
159351 , p_event_class_code => 'TRANSFERS'
159352 , p_side => 'NA'
159353 );
159354
159355 END IF;
159356
159357 l_segment := AcctDerRule_169(
159358 p_application_id => p_application_id
159359 , p_ae_header_id => l_ae_header_id
159360 , p_source_5 => p_source_5
159361 , p_source_31 => p_source_31
159362 , x_transaction_coa_id => l_adr_transaction_coa_id
159363 , x_accounting_coa_id => l_adr_accounting_coa_id
159364 , x_flexfield_segment_code => l_adr_flexfield_segment_code
159365 , x_flex_value_set_id => l_adr_flex_value_set_id
159366 , x_value_type_code => l_adr_value_type_code
159367 , x_value_combination_id => l_adr_value_combination_id
159368 , x_value_segment_code => l_adr_value_segment_code
159369 , p_side => 'NA'
159370 , p_override_seg_flag => 'Y'
159371 );
159372
159373 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
159374
159375 xla_ae_lines_pkg.set_segment(
159376 p_to_segment_code => 'GL_BALANCING'
159377 , p_segment_value => l_segment
159378 , p_from_segment_code => l_adr_value_segment_code
159379 , p_from_combination_id => l_adr_value_combination_id
159380 , p_value_type_code => l_adr_value_type_code
159381 , p_transaction_coa_id => l_adr_transaction_coa_id
159382 , p_accounting_coa_id => l_adr_accounting_coa_id
159383 , p_flexfield_segment_code => l_adr_flexfield_segment_code
159384 , p_flex_value_set_id => l_adr_flex_value_set_id
159385 , p_adr_code => 'FA_EXPENSE_ACCT'
159386 , p_adr_type_code => 'S'
159387 , p_component_type => l_component_type
159388 , p_component_code => l_component_code
159389 , p_component_type_code => l_component_type_code
159390 , p_component_appl_id => l_component_appl_id
159391 , p_amb_context_code => l_amb_context_code
159392 , p_entity_code => 'TRANSACTIONS'
159393 , p_event_class_code => 'TRANSFERS'
159394 , p_side => 'NA'
159395 );
159396
159397 END IF;
159398
159399 --
159400 --
159401 END IF;
159402 --
159403 -- Bug 4922099
159404 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
159405 (NVL(l_enc_upg_option, 'N') = 'O')
159406 ) AND
159407 (l_bflow_method_code = 'PRIOR_ENTRY')
159408 )
159409 THEN
159410 IF
159411 --
159412 1 = 2
159413 --
159414 THEN
159415 xla_accounting_err_pkg.build_message
159416 (p_appli_s_name => 'XLA'
159417 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
159418 ,p_token_1 => 'LINE_NUMBER'
159419 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
159420 ,p_token_2 => 'LINE_TYPE_NAME'
159421 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
159422 l_component_type
159423 ,l_component_code
159424 ,l_component_type_code
159425 ,l_component_appl_id
159426 ,l_amb_context_code
159427 ,l_entity_code
159428 ,l_event_class_code
159429 )
159430 ,p_token_3 => 'OWNER'
159431 ,p_value_3 => xla_lookups_pkg.get_meaning(
159435 ,p_token_4 => 'PRODUCT_NAME'
159432 p_lookup_type => 'XLA_OWNER_TYPE'
159433 ,p_lookup_code => l_component_type_code
159434 )
159436 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
159437 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
159438 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
159439 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
159440 ,p_ae_header_id => NULL
159441 );
159442
159443 IF (C_LEVEL_ERROR>= g_log_level) THEN
159444 trace
159445 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
159446 ,p_level => C_LEVEL_ERROR
159447 ,p_module => l_log_module);
159448 END IF;
159449 END IF;
159450 END IF;
159451 --
159452 --
159453 ------------------------------------------------------------------------------------------------
159454 -- 4219869 Business Flow
159455 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
159456 -- Prior Entry. Currently, the following code is always generated.
159457 ------------------------------------------------------------------------------------------------
159458 XLA_AE_LINES_PKG.ValidateCurrentLine;
159459
159460 ------------------------------------------------------------------------------------
159461 -- 4219869 Business Flow
159462 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
159463 ------------------------------------------------------------------------------------
159464 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
159465
159466 ----------------------------------------------------------------------------------
159467 -- 4219869 Business Flow
159468 -- Update journal entry status -- Need to generate this within IF <condition>
159469 ----------------------------------------------------------------------------------
159470 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
159471 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
159472 ,p_balance_type_code => l_balance_type_code
159473 );
159474
159475 -------------------------------------------------------------------------------------------
159476 -- 4262811 - Generate the Accrual Reversal lines
159477 -------------------------------------------------------------------------------------------
159478 BEGIN
159479 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
159480 (g_array_event(p_event_id).array_value_num('header_index'));
159481 IF l_acc_rev_flag IS NULL THEN
159482 l_acc_rev_flag := 'N';
159483 END IF;
159484 EXCEPTION
159485 WHEN OTHERS THEN
159486 l_acc_rev_flag := 'N';
159487 END;
159488 --
159489 IF (l_acc_rev_flag = 'Y') THEN
159490
159491 -- 4645092 ------------------------------------------------------------------------------
159492 -- To allow MPA report to determine if it should generate report process
159493 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
159494 ------------------------------------------------------------------------------------------
159495
159496 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
159497 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
159498 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
159499 -- call ADRs
159500 -- Bug 4922099
159501 --
159502 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
159503 (NVL(l_actual_upg_option, 'N') = 'O') OR
159504 (NVL(l_enc_upg_option, 'N') = 'O')
159505 )
159506 THEN
159507 NULL;
159508 --
159509 --
159510
159511 l_ccid := AcctDerRule_175(
159512 p_application_id => p_application_id
159513 , p_ae_header_id => l_ae_header_id
159514 , p_source_5 => p_source_5
159515 , p_source_19 => p_source_19
159516 , p_source_32 => p_source_32
159517 , x_transaction_coa_id => l_adr_transaction_coa_id
159518 , x_accounting_coa_id => l_adr_accounting_coa_id
159519 , x_value_type_code => l_adr_value_type_code
159520 , p_side => 'NA'
159521 );
159522
159523 xla_ae_lines_pkg.set_ccid(
159524 p_code_combination_id => l_ccid
159525 , p_value_type_code => l_adr_value_type_code
159526 , p_transaction_coa_id => l_adr_transaction_coa_id
159527 , p_accounting_coa_id => l_adr_accounting_coa_id
159528 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
159529 , p_adr_type_code => 'S'
159530 , p_component_type => l_component_type
159531 , p_component_code => l_component_code
159532 , p_component_type_code => l_component_type_code
159533 , p_component_appl_id => l_component_appl_id
159534 , p_amb_context_code => l_amb_context_code
159535 , p_side => 'NA'
159536 );
159537
159538
159542 , p_source_5 => p_source_5
159539 l_segment := AcctDerRule_151(
159540 p_application_id => p_application_id
159541 , p_ae_header_id => l_ae_header_id
159543 , p_source_13 => p_source_13
159544 , x_transaction_coa_id => l_adr_transaction_coa_id
159545 , x_accounting_coa_id => l_adr_accounting_coa_id
159546 , x_flexfield_segment_code => l_adr_flexfield_segment_code
159547 , x_flex_value_set_id => l_adr_flex_value_set_id
159548 , x_value_type_code => l_adr_value_type_code
159549 , x_value_combination_id => l_adr_value_combination_id
159550 , x_value_segment_code => l_adr_value_segment_code
159551 , p_side => 'NA'
159552 , p_override_seg_flag => 'Y'
159553 );
159554
159555 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
159556
159557 xla_ae_lines_pkg.set_segment(
159558 p_to_segment_code => 'GL_ACCOUNT'
159559 , p_segment_value => l_segment
159560 , p_from_segment_code => l_adr_value_segment_code
159561 , p_from_combination_id => l_adr_value_combination_id
159562 , p_value_type_code => l_adr_value_type_code
159563 , p_transaction_coa_id => l_adr_transaction_coa_id
159564 , p_accounting_coa_id => l_adr_accounting_coa_id
159565 , p_flexfield_segment_code => l_adr_flexfield_segment_code
159566 , p_flex_value_set_id => l_adr_flex_value_set_id
159567 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
159568 , p_adr_type_code => 'S'
159569 , p_component_type => l_component_type
159570 , p_component_code => l_component_code
159571 , p_component_type_code => l_component_type_code
159572 , p_component_appl_id => l_component_appl_id
159573 , p_amb_context_code => l_amb_context_code
159574 , p_entity_code => 'TRANSACTIONS'
159575 , p_event_class_code => 'TRANSFERS'
159576 , p_side => 'NA'
159577 );
159578
159579 END IF;
159580
159581 l_segment := AcctDerRule_169(
159582 p_application_id => p_application_id
159583 , p_ae_header_id => l_ae_header_id
159584 , p_source_5 => p_source_5
159585 , p_source_31 => p_source_31
159586 , x_transaction_coa_id => l_adr_transaction_coa_id
159587 , x_accounting_coa_id => l_adr_accounting_coa_id
159588 , x_flexfield_segment_code => l_adr_flexfield_segment_code
159589 , x_flex_value_set_id => l_adr_flex_value_set_id
159590 , x_value_type_code => l_adr_value_type_code
159591 , x_value_combination_id => l_adr_value_combination_id
159592 , x_value_segment_code => l_adr_value_segment_code
159593 , p_side => 'NA'
159594 , p_override_seg_flag => 'Y'
159595 );
159596
159597 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
159598
159599 xla_ae_lines_pkg.set_segment(
159600 p_to_segment_code => 'GL_BALANCING'
159601 , p_segment_value => l_segment
159602 , p_from_segment_code => l_adr_value_segment_code
159603 , p_from_combination_id => l_adr_value_combination_id
159604 , p_value_type_code => l_adr_value_type_code
159605 , p_transaction_coa_id => l_adr_transaction_coa_id
159606 , p_accounting_coa_id => l_adr_accounting_coa_id
159607 , p_flexfield_segment_code => l_adr_flexfield_segment_code
159608 , p_flex_value_set_id => l_adr_flex_value_set_id
159609 , p_adr_code => 'FA_EXPENSE_ACCT'
159610 , p_adr_type_code => 'S'
159611 , p_component_type => l_component_type
159612 , p_component_code => l_component_code
159613 , p_component_type_code => l_component_type_code
159614 , p_component_appl_id => l_component_appl_id
159615 , p_amb_context_code => l_amb_context_code
159616 , p_entity_code => 'TRANSACTIONS'
159617 , p_event_class_code => 'TRANSFERS'
159618 , p_side => 'NA'
159619 );
159620
159621 END IF;
159622
159623 --
159624 --
159625 END IF;
159626
159627 --
159628 -- Update the line information that should be overwritten
159629 --
159630 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
159631 p_header_num => 1);
159632 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
159633
159634 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
159635
159636 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
159637 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
159638 END IF;
159639
159640 --
159641 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
159642 --
159643 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
159644 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
159645 ELSE
159649 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
159646 ---------------------------------------------------------------------------------------------------
159647 -- 4262811a Switch Sign
159648 ---------------------------------------------------------------------------------------------------
159650 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
159651 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
159652 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
159653 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
159654 -- 5132302
159655 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
159656 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
159657
159658 END IF;
159659
159660 -- 4955764
159661 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
159662 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
159663
159664
159665 XLA_AE_LINES_PKG.ValidateCurrentLine;
159666 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
159667
159668 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
159669 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
159670 ,p_balance_type_code => l_balance_type_code);
159671
159672 END IF;
159673
159674 -----------------------------------------------------------------------------------------
159675 -- 4262811 Multiperiod Accounting
159676 -----------------------------------------------------------------------------------------
159677 -- No MPA option is assigned.
159678
159679
159680 END IF;
159681 END IF;
159682 --
159683
159684 --
159685 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
159686 trace
159687 (p_msg => 'END of AcctLineType_388'
159688 ,p_level => C_LEVEL_PROCEDURE
159689 ,p_module => l_log_module);
159690 END IF;
159691 --
159692 EXCEPTION
159693 WHEN xla_exceptions_pkg.application_exception THEN
159694 RAISE;
159695 WHEN OTHERS THEN
159696 xla_exceptions_pkg.raise_message
159697 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_388');
159698 END AcctLineType_388;
159699 --
159700
159701 ---------------------------------------
159702 --
159703 -- PRIVATE FUNCTION
159704 -- AcctLineType_389
159705 --
159706 ---------------------------------------
159707 PROCEDURE AcctLineType_389 (
159708 p_application_id IN NUMBER
159709 ,p_event_id IN NUMBER
159710 ,p_calculate_acctd_flag IN VARCHAR2
159711 ,p_calculate_g_l_flag IN VARCHAR2
159712 ,p_actual_flag IN OUT VARCHAR2
159713 ,p_balance_type_code OUT VARCHAR2
159714 ,p_gain_or_loss_ref OUT VARCHAR2
159715
159716 --Period Close Date
159717 , p_source_1 IN DATE
159718 --Generated Code Combination Identifier
159719 , p_source_5 IN NUMBER
159720 --Intercompany Payables Account
159721 , p_source_21 IN VARCHAR2
159722 --Expense Account Code Combination Identifier
159723 , p_source_31 IN NUMBER
159724 --Default Code Combination Identifier
159725 , p_source_32 IN NUMBER
159726 --Adjustment Type
159727 , p_source_48 IN VARCHAR2
159728 --Transaction Header Identifier
159729 , p_source_49 IN NUMBER
159730 --Adjustment Line Identifier
159731 , p_source_50 IN NUMBER
159732 --Distribution Type Code
159733 , p_source_51 IN VARCHAR2
159734 --Entered Amount
159735 , p_source_52 IN NUMBER
159736 --Currency Code
159737 , p_source_53 IN VARCHAR2
159738 )
159739 IS
159740
159741 l_component_type VARCHAR2(80);
159742 l_component_code VARCHAR2(30);
159743 l_component_type_code VARCHAR2(1);
159744 l_component_appl_id INTEGER;
159745 l_amb_context_code VARCHAR2(30);
159746 l_entity_code VARCHAR2(30);
159747 l_event_class_code VARCHAR2(30);
159748 l_ae_header_id NUMBER;
159749 l_event_type_code VARCHAR2(30);
159750 l_line_definition_code VARCHAR2(30);
159751 l_line_definition_owner_code VARCHAR2(1);
159752 --
159753 -- adr variables
159754 l_segment VARCHAR2(30);
159755 l_ccid NUMBER;
159756 l_adr_transaction_coa_id NUMBER;
159757 l_adr_accounting_coa_id NUMBER;
159758 l_adr_flexfield_segment_code VARCHAR2(30);
159759 l_adr_flex_value_set_id NUMBER;
159760 l_adr_value_type_code VARCHAR2(30);
159761 l_adr_value_combination_id NUMBER;
159762 l_adr_value_segment_code VARCHAR2(30);
159763
159764 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
159765 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
159766 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
159767 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
159768
159769 -- 4262811 Variables ------------------------------------------------------------------------------------------
159770 l_entered_amt_idx NUMBER;
159771 l_accted_amt_idx NUMBER;
159775 l_acc_rev_natural_side_code VARCHAR2(1);
159772 l_acc_rev_flag VARCHAR2(1);
159773 l_accrual_line_num NUMBER;
159774 l_tmp_amt NUMBER;
159776
159777 l_num_entries NUMBER;
159778 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
159779 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
159780 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
159781 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
159782 l_recog_line_1 NUMBER;
159783 l_recog_line_2 NUMBER;
159784
159785 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
159786 l_bflow_applied_to_amt NUMBER; -- 5132302
159787 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
159788
159789 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
159790
159791 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
159792 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
159793
159794 ---------------------------------------------------------------------------------------------------------------
159795
159796
159797 --
159798 -- bulk performance
159799 --
159800 l_balance_type_code VARCHAR2(1);
159801 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
159802 l_log_module VARCHAR2(240);
159803
159804 --
159805 -- Upgrade strategy
159806 --
159807 l_actual_upg_option VARCHAR2(1);
159808 l_enc_upg_option VARCHAR2(1);
159809
159810 --
159811 BEGIN
159812 --
159813 IF g_log_enabled THEN
159814 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_389';
159815 END IF;
159816 --
159817 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
159818
159819 trace
159820 (p_msg => 'BEGIN of AcctLineType_389'
159821 ,p_level => C_LEVEL_PROCEDURE
159822 ,p_module => l_log_module);
159823
159824 END IF;
159825 --
159826 l_component_type := 'AMB_JLT';
159827 l_component_code := 'FA_TRANSFER_IC_PAY';
159828 l_component_type_code := 'S';
159829 l_component_appl_id := 140;
159830 l_amb_context_code := 'DEFAULT';
159831 l_entity_code := 'TRANSACTIONS';
159832 l_event_class_code := 'TRANSFERS';
159833 l_event_type_code := 'TRANSFERS_ALL';
159834 l_line_definition_owner_code := 'S';
159835 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
159836 --
159837 l_balance_type_code := 'A';
159838 l_segment := NULL;
159839 l_ccid := NULL;
159840 l_adr_transaction_coa_id := NULL;
159841 l_adr_accounting_coa_id := NULL;
159842 l_adr_flexfield_segment_code := NULL;
159843 l_adr_flex_value_set_id := NULL;
159844 l_adr_value_type_code := NULL;
159845 l_adr_value_combination_id := NULL;
159846 l_adr_value_segment_code := NULL;
159847
159848 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
159849 l_bflow_class_code := ''; -- 4219869 Business Flow
159850 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
159851 l_budgetary_control_flag := 'N';
159852
159853 l_bflow_applied_to_amt_idx := NULL; -- 5132302
159854 l_bflow_applied_to_amt := NULL; -- 5132302
159855 l_entered_amt_idx := NULL; -- 4262811
159856 l_accted_amt_idx := NULL; -- 4262811
159857 l_acc_rev_flag := NULL; -- 4262811
159858 l_accrual_line_num := NULL; -- 4262811
159859 l_tmp_amt := NULL; -- 4262811
159860 --
159861
159862 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
159863 l_balance_type_code <> 'B' THEN
159864 IF NVL(p_source_48,'
159865 ') = 'INTERCO AP'
159866 THEN
159867
159868 --
159869 XLA_AE_LINES_PKG.SetNewLine;
159870
159871 p_balance_type_code := l_balance_type_code;
159872 -- set the flag so later we will know whether the gain loss line needs to be created
159873
159874 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
159875 p_actual_flag :='A';
159876 END IF;
159877
159878 --
159879 -- bulk performance
159880 --
159881 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
159882 p_header_num => 0); -- 4262811
159883 --
159884 -- set accounting line options
159885 --
159886 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
159887 p_natural_side_code => 'C'
159888 , p_gain_or_loss_flag => 'N'
159889 , p_gl_transfer_mode_code => 'S'
159890 , p_acct_entry_type_code => 'A'
159891 , p_switch_side_flag => 'Y'
159892 , p_merge_duplicate_code => 'N'
159893 );
159894 --
159895 l_acc_rev_natural_side_code := 'D'; -- 4262811
159896 --
159897 --
159898 -- set accounting line type info
159899 --
159900 xla_ae_lines_pkg.SetAcctLineType
159901 (p_component_type => l_component_type
159902 ,p_event_type_code => l_event_type_code
159906 ,p_accounting_line_type_code => l_component_type_code
159903 ,p_line_definition_owner_code => l_line_definition_owner_code
159904 ,p_line_definition_code => l_line_definition_code
159905 ,p_accounting_line_code => l_component_code
159907 ,p_accounting_line_appl_id => l_component_appl_id
159908 ,p_amb_context_code => l_amb_context_code
159909 ,p_entity_code => l_entity_code
159910 ,p_event_class_code => l_event_class_code);
159911 --
159912 -- set accounting class
159913 --
159914 xla_ae_lines_pkg.SetAcctClass(
159915 p_accounting_class_code => 'LIABILITY'
159916 , p_ae_header_id => l_ae_header_id
159917 );
159918
159919 --
159920 -- set rounding class
159921 --
159922 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
159923 'LIABILITY';
159924
159925 --
159926 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
159927 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
159928 --
159929 -- bulk performance
159930 --
159931 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
159932
159933 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
159934 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
159935
159936 -- 4955764
159937 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
159938 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
159939
159940 -- 4458381 Public Sector Enh
159941
159942 --
159943 -- set accounting attributes for the line type
159944 --
159945 l_entered_amt_idx := 4;
159946 l_accted_amt_idx := 6;
159947 l_bflow_applied_to_amt_idx := NULL; -- 5132302
159948 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
159949 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
159950 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
159951 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
159952 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
159953 l_rec_acct_attrs.array_char_value(3) := p_source_51;
159954 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
159955 l_rec_acct_attrs.array_num_value(4) := p_source_52;
159956 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
159957 l_rec_acct_attrs.array_char_value(5) := p_source_53;
159958 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
159959 l_rec_acct_attrs.array_num_value(6) := p_source_52;
159960
159961 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
159962 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
159963
159964 ---------------------------------------------------------------------------------------------------------------
159965 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
159966 ---------------------------------------------------------------------------------------------------------------
159967 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
159968
159969 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
159970 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
159971
159972 IF xla_accounting_cache_pkg.GetValueChar
159973 (p_source_code => 'LEDGER_CATEGORY_CODE'
159974 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
159975 AND l_bflow_method_code = 'PRIOR_ENTRY'
159976 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
159977 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
159978 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
159979 )
159980 THEN
159981 xla_ae_lines_pkg.BflowUpgEntry
159982 (p_business_method_code => l_bflow_method_code
159983 ,p_business_class_code => l_bflow_class_code
159984 ,p_balance_type => l_balance_type_code);
159985 ELSE
159986 NULL;
159987 -- No business flow processing for business flow method of NONE.
159988 END IF;
159989
159990 --
159991 -- call analytical criteria
159992 --
159993
159994 --
159995 -- call description
159996 --
159997
159998 xla_ae_lines_pkg.SetLineDescription(
159999 p_ae_header_id => l_ae_header_id
160000 ,p_description => Description_128 (
160001 p_application_id => p_application_id
160002 , p_ae_header_id => l_ae_header_id
160003 , p_source_1 => p_source_1
160004 )
160005 );
160006
160007
160008 --
160009 -- call ADRs
160010 -- Bug 4922099
160011 --
160012 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
160013 (NVL(l_actual_upg_option, 'N') = 'O') OR
160014 (NVL(l_enc_upg_option, 'N') = 'O')
160015 )
160016 THEN
160017 NULL;
160018 --
160019 --
160020
160021 l_ccid := AcctDerRule_174(
160022 p_application_id => p_application_id
160026 , x_transaction_coa_id => l_adr_transaction_coa_id
160023 , p_ae_header_id => l_ae_header_id
160024 , p_source_5 => p_source_5
160025 , p_source_32 => p_source_32
160027 , x_accounting_coa_id => l_adr_accounting_coa_id
160028 , x_value_type_code => l_adr_value_type_code
160029 , p_side => 'NA'
160030 );
160031
160032 xla_ae_lines_pkg.set_ccid(
160033 p_code_combination_id => l_ccid
160034 , p_value_type_code => l_adr_value_type_code
160035 , p_transaction_coa_id => l_adr_transaction_coa_id
160036 , p_accounting_coa_id => l_adr_accounting_coa_id
160037 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
160038 , p_adr_type_code => 'S'
160039 , p_component_type => l_component_type
160040 , p_component_code => l_component_code
160041 , p_component_type_code => l_component_type_code
160042 , p_component_appl_id => l_component_appl_id
160043 , p_amb_context_code => l_amb_context_code
160044 , p_side => 'NA'
160045 );
160046
160047
160048 l_segment := AcctDerRule_169(
160049 p_application_id => p_application_id
160050 , p_ae_header_id => l_ae_header_id
160051 , p_source_5 => p_source_5
160052 , p_source_31 => p_source_31
160053 , x_transaction_coa_id => l_adr_transaction_coa_id
160054 , x_accounting_coa_id => l_adr_accounting_coa_id
160055 , x_flexfield_segment_code => l_adr_flexfield_segment_code
160056 , x_flex_value_set_id => l_adr_flex_value_set_id
160057 , x_value_type_code => l_adr_value_type_code
160058 , x_value_combination_id => l_adr_value_combination_id
160059 , x_value_segment_code => l_adr_value_segment_code
160060 , p_side => 'NA'
160061 , p_override_seg_flag => 'Y'
160062 );
160063
160064 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
160065
160066 xla_ae_lines_pkg.set_segment(
160067 p_to_segment_code => 'GL_BALANCING'
160068 , p_segment_value => l_segment
160069 , p_from_segment_code => l_adr_value_segment_code
160070 , p_from_combination_id => l_adr_value_combination_id
160071 , p_value_type_code => l_adr_value_type_code
160072 , p_transaction_coa_id => l_adr_transaction_coa_id
160073 , p_accounting_coa_id => l_adr_accounting_coa_id
160074 , p_flexfield_segment_code => l_adr_flexfield_segment_code
160075 , p_flex_value_set_id => l_adr_flex_value_set_id
160076 , p_adr_code => 'FA_EXPENSE_ACCT'
160077 , p_adr_type_code => 'S'
160078 , p_component_type => l_component_type
160079 , p_component_code => l_component_code
160080 , p_component_type_code => l_component_type_code
160081 , p_component_appl_id => l_component_appl_id
160082 , p_amb_context_code => l_amb_context_code
160083 , p_entity_code => 'TRANSACTIONS'
160084 , p_event_class_code => 'TRANSFERS'
160085 , p_side => 'NA'
160086 );
160087
160088 END IF;
160089
160090 l_segment := AcctDerRule_158(
160091 p_application_id => p_application_id
160092 , p_ae_header_id => l_ae_header_id
160093 , p_source_5 => p_source_5
160094 , p_source_21 => p_source_21
160095 , x_transaction_coa_id => l_adr_transaction_coa_id
160096 , x_accounting_coa_id => l_adr_accounting_coa_id
160097 , x_flexfield_segment_code => l_adr_flexfield_segment_code
160098 , x_flex_value_set_id => l_adr_flex_value_set_id
160099 , x_value_type_code => l_adr_value_type_code
160100 , x_value_combination_id => l_adr_value_combination_id
160101 , x_value_segment_code => l_adr_value_segment_code
160102 , p_side => 'NA'
160103 , p_override_seg_flag => 'Y'
160104 );
160105
160106 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
160107
160108 xla_ae_lines_pkg.set_segment(
160109 p_to_segment_code => 'GL_ACCOUNT'
160110 , p_segment_value => l_segment
160111 , p_from_segment_code => l_adr_value_segment_code
160112 , p_from_combination_id => l_adr_value_combination_id
160113 , p_value_type_code => l_adr_value_type_code
160114 , p_transaction_coa_id => l_adr_transaction_coa_id
160115 , p_accounting_coa_id => l_adr_accounting_coa_id
160116 , p_flexfield_segment_code => l_adr_flexfield_segment_code
160117 , p_flex_value_set_id => l_adr_flex_value_set_id
160118 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
160119 , p_adr_type_code => 'S'
160120 , p_component_type => l_component_type
160121 , p_component_code => l_component_code
160122 , p_component_type_code => l_component_type_code
160123 , p_component_appl_id => l_component_appl_id
160124 , p_amb_context_code => l_amb_context_code
160125 , p_entity_code => 'TRANSACTIONS'
160126 , p_event_class_code => 'TRANSFERS'
160127 , p_side => 'NA'
160128 );
160129
160130 END IF;
160131
160132 --
160133 --
160134 END IF;
160135 --
160139 ) AND
160136 -- Bug 4922099
160137 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
160138 (NVL(l_enc_upg_option, 'N') = 'O')
160140 (l_bflow_method_code = 'PRIOR_ENTRY')
160141 )
160142 THEN
160143 IF
160144 --
160145 1 = 2
160146 --
160147 THEN
160148 xla_accounting_err_pkg.build_message
160149 (p_appli_s_name => 'XLA'
160150 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
160151 ,p_token_1 => 'LINE_NUMBER'
160152 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
160153 ,p_token_2 => 'LINE_TYPE_NAME'
160154 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
160155 l_component_type
160156 ,l_component_code
160157 ,l_component_type_code
160158 ,l_component_appl_id
160159 ,l_amb_context_code
160160 ,l_entity_code
160161 ,l_event_class_code
160162 )
160163 ,p_token_3 => 'OWNER'
160164 ,p_value_3 => xla_lookups_pkg.get_meaning(
160165 p_lookup_type => 'XLA_OWNER_TYPE'
160166 ,p_lookup_code => l_component_type_code
160167 )
160168 ,p_token_4 => 'PRODUCT_NAME'
160169 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
160170 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
160171 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
160172 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
160173 ,p_ae_header_id => NULL
160174 );
160175
160176 IF (C_LEVEL_ERROR>= g_log_level) THEN
160177 trace
160178 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
160179 ,p_level => C_LEVEL_ERROR
160180 ,p_module => l_log_module);
160181 END IF;
160182 END IF;
160183 END IF;
160184 --
160185 --
160186 ------------------------------------------------------------------------------------------------
160187 -- 4219869 Business Flow
160188 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
160189 -- Prior Entry. Currently, the following code is always generated.
160190 ------------------------------------------------------------------------------------------------
160191 XLA_AE_LINES_PKG.ValidateCurrentLine;
160192
160193 ------------------------------------------------------------------------------------
160194 -- 4219869 Business Flow
160195 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
160196 ------------------------------------------------------------------------------------
160197 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
160198
160199 ----------------------------------------------------------------------------------
160200 -- 4219869 Business Flow
160201 -- Update journal entry status -- Need to generate this within IF <condition>
160202 ----------------------------------------------------------------------------------
160203 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
160204 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
160205 ,p_balance_type_code => l_balance_type_code
160206 );
160207
160208 -------------------------------------------------------------------------------------------
160209 -- 4262811 - Generate the Accrual Reversal lines
160210 -------------------------------------------------------------------------------------------
160211 BEGIN
160212 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
160213 (g_array_event(p_event_id).array_value_num('header_index'));
160214 IF l_acc_rev_flag IS NULL THEN
160215 l_acc_rev_flag := 'N';
160216 END IF;
160217 EXCEPTION
160218 WHEN OTHERS THEN
160219 l_acc_rev_flag := 'N';
160220 END;
160221 --
160222 IF (l_acc_rev_flag = 'Y') THEN
160223
160224 -- 4645092 ------------------------------------------------------------------------------
160225 -- To allow MPA report to determine if it should generate report process
160226 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
160227 ------------------------------------------------------------------------------------------
160228
160232 -- call ADRs
160229 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
160230 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
160231 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
160233 -- Bug 4922099
160234 --
160235 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
160236 (NVL(l_actual_upg_option, 'N') = 'O') OR
160237 (NVL(l_enc_upg_option, 'N') = 'O')
160238 )
160239 THEN
160240 NULL;
160241 --
160242 --
160243
160244 l_ccid := AcctDerRule_174(
160245 p_application_id => p_application_id
160246 , p_ae_header_id => l_ae_header_id
160247 , p_source_5 => p_source_5
160248 , p_source_32 => p_source_32
160249 , x_transaction_coa_id => l_adr_transaction_coa_id
160250 , x_accounting_coa_id => l_adr_accounting_coa_id
160251 , x_value_type_code => l_adr_value_type_code
160252 , p_side => 'NA'
160253 );
160254
160255 xla_ae_lines_pkg.set_ccid(
160256 p_code_combination_id => l_ccid
160257 , p_value_type_code => l_adr_value_type_code
160258 , p_transaction_coa_id => l_adr_transaction_coa_id
160259 , p_accounting_coa_id => l_adr_accounting_coa_id
160260 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
160261 , p_adr_type_code => 'S'
160262 , p_component_type => l_component_type
160263 , p_component_code => l_component_code
160264 , p_component_type_code => l_component_type_code
160265 , p_component_appl_id => l_component_appl_id
160266 , p_amb_context_code => l_amb_context_code
160267 , p_side => 'NA'
160268 );
160269
160270
160271 l_segment := AcctDerRule_169(
160272 p_application_id => p_application_id
160273 , p_ae_header_id => l_ae_header_id
160274 , p_source_5 => p_source_5
160275 , p_source_31 => p_source_31
160276 , x_transaction_coa_id => l_adr_transaction_coa_id
160277 , x_accounting_coa_id => l_adr_accounting_coa_id
160278 , x_flexfield_segment_code => l_adr_flexfield_segment_code
160279 , x_flex_value_set_id => l_adr_flex_value_set_id
160280 , x_value_type_code => l_adr_value_type_code
160281 , x_value_combination_id => l_adr_value_combination_id
160282 , x_value_segment_code => l_adr_value_segment_code
160283 , p_side => 'NA'
160284 , p_override_seg_flag => 'Y'
160285 );
160286
160287 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
160288
160289 xla_ae_lines_pkg.set_segment(
160290 p_to_segment_code => 'GL_BALANCING'
160291 , p_segment_value => l_segment
160292 , p_from_segment_code => l_adr_value_segment_code
160293 , p_from_combination_id => l_adr_value_combination_id
160294 , p_value_type_code => l_adr_value_type_code
160295 , p_transaction_coa_id => l_adr_transaction_coa_id
160296 , p_accounting_coa_id => l_adr_accounting_coa_id
160297 , p_flexfield_segment_code => l_adr_flexfield_segment_code
160298 , p_flex_value_set_id => l_adr_flex_value_set_id
160299 , p_adr_code => 'FA_EXPENSE_ACCT'
160300 , p_adr_type_code => 'S'
160301 , p_component_type => l_component_type
160302 , p_component_code => l_component_code
160303 , p_component_type_code => l_component_type_code
160304 , p_component_appl_id => l_component_appl_id
160305 , p_amb_context_code => l_amb_context_code
160306 , p_entity_code => 'TRANSACTIONS'
160307 , p_event_class_code => 'TRANSFERS'
160308 , p_side => 'NA'
160309 );
160310
160311 END IF;
160312
160313 l_segment := AcctDerRule_158(
160314 p_application_id => p_application_id
160315 , p_ae_header_id => l_ae_header_id
160316 , p_source_5 => p_source_5
160317 , p_source_21 => p_source_21
160318 , x_transaction_coa_id => l_adr_transaction_coa_id
160319 , x_accounting_coa_id => l_adr_accounting_coa_id
160320 , x_flexfield_segment_code => l_adr_flexfield_segment_code
160321 , x_flex_value_set_id => l_adr_flex_value_set_id
160322 , x_value_type_code => l_adr_value_type_code
160323 , x_value_combination_id => l_adr_value_combination_id
160324 , x_value_segment_code => l_adr_value_segment_code
160325 , p_side => 'NA'
160326 , p_override_seg_flag => 'Y'
160327 );
160328
160329 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
160330
160331 xla_ae_lines_pkg.set_segment(
160332 p_to_segment_code => 'GL_ACCOUNT'
160333 , p_segment_value => l_segment
160334 , p_from_segment_code => l_adr_value_segment_code
160335 , p_from_combination_id => l_adr_value_combination_id
160336 , p_value_type_code => l_adr_value_type_code
160337 , p_transaction_coa_id => l_adr_transaction_coa_id
160338 , p_accounting_coa_id => l_adr_accounting_coa_id
160339 , p_flexfield_segment_code => l_adr_flexfield_segment_code
160340 , p_flex_value_set_id => l_adr_flex_value_set_id
160344 , p_component_code => l_component_code
160341 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
160342 , p_adr_type_code => 'S'
160343 , p_component_type => l_component_type
160345 , p_component_type_code => l_component_type_code
160346 , p_component_appl_id => l_component_appl_id
160347 , p_amb_context_code => l_amb_context_code
160348 , p_entity_code => 'TRANSACTIONS'
160349 , p_event_class_code => 'TRANSFERS'
160350 , p_side => 'NA'
160351 );
160352
160353 END IF;
160354
160355 --
160356 --
160357 END IF;
160358
160359 --
160360 -- Update the line information that should be overwritten
160361 --
160362 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
160363 p_header_num => 1);
160364 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
160365
160366 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
160367
160368 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
160369 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
160370 END IF;
160371
160372 --
160373 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
160374 --
160375 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
160376 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
160377 ELSE
160378 ---------------------------------------------------------------------------------------------------
160379 -- 4262811a Switch Sign
160380 ---------------------------------------------------------------------------------------------------
160381 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
160382 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
160383 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
160384 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
160385 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
160386 -- 5132302
160387 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
160388 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
160389
160390 END IF;
160391
160392 -- 4955764
160393 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
160394 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
160395
160396
160397 XLA_AE_LINES_PKG.ValidateCurrentLine;
160398 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
160399
160400 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
160401 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
160402 ,p_balance_type_code => l_balance_type_code);
160403
160404 END IF;
160405
160406 -----------------------------------------------------------------------------------------
160407 -- 4262811 Multiperiod Accounting
160408 -----------------------------------------------------------------------------------------
160409 -- No MPA option is assigned.
160410
160411
160412 END IF;
160413 END IF;
160414 --
160415
160416 --
160417 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
160418 trace
160419 (p_msg => 'END of AcctLineType_389'
160420 ,p_level => C_LEVEL_PROCEDURE
160421 ,p_module => l_log_module);
160422 END IF;
160423 --
160424 EXCEPTION
160425 WHEN xla_exceptions_pkg.application_exception THEN
160426 RAISE;
160427 WHEN OTHERS THEN
160428 xla_exceptions_pkg.raise_message
160429 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_389');
160430 END AcctLineType_389;
160431 --
160432
160433 ---------------------------------------
160434 --
160435 -- PRIVATE FUNCTION
160436 -- AcctLineType_390
160437 --
160438 ---------------------------------------
160439 PROCEDURE AcctLineType_390 (
160440 p_application_id IN NUMBER
160441 ,p_event_id IN NUMBER
160442 ,p_calculate_acctd_flag IN VARCHAR2
160443 ,p_calculate_g_l_flag IN VARCHAR2
160444 ,p_actual_flag IN OUT VARCHAR2
160445 ,p_balance_type_code OUT VARCHAR2
160446 ,p_gain_or_loss_ref OUT VARCHAR2
160447
160448 --Period Close Date
160449 , p_source_1 IN DATE
160450 --Generated Code Combination Identifier
160451 , p_source_5 IN NUMBER
160452 --Intercompany Receivables Account
160453 , p_source_22 IN VARCHAR2
160454 --Expense Account Code Combination Identifier
160455 , p_source_31 IN NUMBER
160456 --Default Code Combination Identifier
160457 , p_source_32 IN NUMBER
160458 --Adjustment Type
160459 , p_source_48 IN VARCHAR2
160460 --Transaction Header Identifier
160461 , p_source_49 IN NUMBER
160462 --Adjustment Line Identifier
160466 --Entered Amount
160463 , p_source_50 IN NUMBER
160464 --Distribution Type Code
160465 , p_source_51 IN VARCHAR2
160467 , p_source_52 IN NUMBER
160468 --Currency Code
160469 , p_source_53 IN VARCHAR2
160470 )
160471 IS
160472
160473 l_component_type VARCHAR2(80);
160474 l_component_code VARCHAR2(30);
160475 l_component_type_code VARCHAR2(1);
160476 l_component_appl_id INTEGER;
160477 l_amb_context_code VARCHAR2(30);
160478 l_entity_code VARCHAR2(30);
160479 l_event_class_code VARCHAR2(30);
160480 l_ae_header_id NUMBER;
160481 l_event_type_code VARCHAR2(30);
160482 l_line_definition_code VARCHAR2(30);
160483 l_line_definition_owner_code VARCHAR2(1);
160484 --
160485 -- adr variables
160486 l_segment VARCHAR2(30);
160487 l_ccid NUMBER;
160488 l_adr_transaction_coa_id NUMBER;
160489 l_adr_accounting_coa_id NUMBER;
160490 l_adr_flexfield_segment_code VARCHAR2(30);
160491 l_adr_flex_value_set_id NUMBER;
160492 l_adr_value_type_code VARCHAR2(30);
160493 l_adr_value_combination_id NUMBER;
160494 l_adr_value_segment_code VARCHAR2(30);
160495
160496 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
160497 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
160498 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
160499 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
160500
160501 -- 4262811 Variables ------------------------------------------------------------------------------------------
160502 l_entered_amt_idx NUMBER;
160503 l_accted_amt_idx NUMBER;
160504 l_acc_rev_flag VARCHAR2(1);
160505 l_accrual_line_num NUMBER;
160506 l_tmp_amt NUMBER;
160507 l_acc_rev_natural_side_code VARCHAR2(1);
160508
160509 l_num_entries NUMBER;
160510 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
160511 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
160512 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
160513 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
160514 l_recog_line_1 NUMBER;
160515 l_recog_line_2 NUMBER;
160516
160517 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
160518 l_bflow_applied_to_amt NUMBER; -- 5132302
160519 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
160520
160521 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
160522
160523 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
160524 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
160525
160526 ---------------------------------------------------------------------------------------------------------------
160527
160528
160529 --
160530 -- bulk performance
160531 --
160532 l_balance_type_code VARCHAR2(1);
160533 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
160534 l_log_module VARCHAR2(240);
160535
160536 --
160537 -- Upgrade strategy
160538 --
160539 l_actual_upg_option VARCHAR2(1);
160540 l_enc_upg_option VARCHAR2(1);
160541
160542 --
160543 BEGIN
160544 --
160545 IF g_log_enabled THEN
160546 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_390';
160547 END IF;
160548 --
160549 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
160550
160551 trace
160552 (p_msg => 'BEGIN of AcctLineType_390'
160553 ,p_level => C_LEVEL_PROCEDURE
160554 ,p_module => l_log_module);
160555
160556 END IF;
160557 --
160558 l_component_type := 'AMB_JLT';
160559 l_component_code := 'FA_TRANSFER_IC_REC';
160560 l_component_type_code := 'S';
160561 l_component_appl_id := 140;
160562 l_amb_context_code := 'DEFAULT';
160563 l_entity_code := 'TRANSACTIONS';
160564 l_event_class_code := 'TRANSFERS';
160565 l_event_type_code := 'TRANSFERS_ALL';
160566 l_line_definition_owner_code := 'S';
160567 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
160568 --
160569 l_balance_type_code := 'A';
160570 l_segment := NULL;
160571 l_ccid := NULL;
160572 l_adr_transaction_coa_id := NULL;
160573 l_adr_accounting_coa_id := NULL;
160574 l_adr_flexfield_segment_code := NULL;
160575 l_adr_flex_value_set_id := NULL;
160576 l_adr_value_type_code := NULL;
160577 l_adr_value_combination_id := NULL;
160578 l_adr_value_segment_code := NULL;
160579
160580 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
160581 l_bflow_class_code := ''; -- 4219869 Business Flow
160582 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
160583 l_budgetary_control_flag := 'N';
160584
160585 l_bflow_applied_to_amt_idx := NULL; -- 5132302
160586 l_bflow_applied_to_amt := NULL; -- 5132302
160587 l_entered_amt_idx := NULL; -- 4262811
160588 l_accted_amt_idx := NULL; -- 4262811
160589 l_acc_rev_flag := NULL; -- 4262811
160593
160590 l_accrual_line_num := NULL; -- 4262811
160591 l_tmp_amt := NULL; -- 4262811
160592 --
160594 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
160595 l_balance_type_code <> 'B' THEN
160596 IF NVL(p_source_48,'
160597 ') = 'INTERCO AR'
160598 THEN
160599
160600 --
160601 XLA_AE_LINES_PKG.SetNewLine;
160602
160603 p_balance_type_code := l_balance_type_code;
160604 -- set the flag so later we will know whether the gain loss line needs to be created
160605
160606 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
160607 p_actual_flag :='A';
160608 END IF;
160609
160610 --
160611 -- bulk performance
160612 --
160613 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
160614 p_header_num => 0); -- 4262811
160615 --
160616 -- set accounting line options
160617 --
160618 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
160619 p_natural_side_code => 'D'
160620 , p_gain_or_loss_flag => 'N'
160621 , p_gl_transfer_mode_code => 'S'
160622 , p_acct_entry_type_code => 'A'
160623 , p_switch_side_flag => 'Y'
160624 , p_merge_duplicate_code => 'N'
160625 );
160626 --
160627 l_acc_rev_natural_side_code := 'C'; -- 4262811
160628 --
160629 --
160630 -- set accounting line type info
160631 --
160632 xla_ae_lines_pkg.SetAcctLineType
160633 (p_component_type => l_component_type
160634 ,p_event_type_code => l_event_type_code
160635 ,p_line_definition_owner_code => l_line_definition_owner_code
160636 ,p_line_definition_code => l_line_definition_code
160637 ,p_accounting_line_code => l_component_code
160638 ,p_accounting_line_type_code => l_component_type_code
160639 ,p_accounting_line_appl_id => l_component_appl_id
160640 ,p_amb_context_code => l_amb_context_code
160641 ,p_entity_code => l_entity_code
160642 ,p_event_class_code => l_event_class_code);
160643 --
160644 -- set accounting class
160645 --
160646 xla_ae_lines_pkg.SetAcctClass(
160647 p_accounting_class_code => 'ASSET'
160648 , p_ae_header_id => l_ae_header_id
160649 );
160650
160651 --
160652 -- set rounding class
160653 --
160654 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
160655 'ASSET';
160656
160657 --
160658 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
160659 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
160660 --
160661 -- bulk performance
160662 --
160663 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
160664
160665 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
160666 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
160667
160668 -- 4955764
160669 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
160670 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
160671
160672 -- 4458381 Public Sector Enh
160673
160674 --
160675 -- set accounting attributes for the line type
160676 --
160677 l_entered_amt_idx := 4;
160678 l_accted_amt_idx := 6;
160679 l_bflow_applied_to_amt_idx := NULL; -- 5132302
160680 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
160681 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
160682 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
160683 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
160684 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
160685 l_rec_acct_attrs.array_char_value(3) := p_source_51;
160686 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
160687 l_rec_acct_attrs.array_num_value(4) := p_source_52;
160688 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
160689 l_rec_acct_attrs.array_char_value(5) := p_source_53;
160690 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
160691 l_rec_acct_attrs.array_num_value(6) := p_source_52;
160692
160693 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
160694 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
160695
160696 ---------------------------------------------------------------------------------------------------------------
160697 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
160698 ---------------------------------------------------------------------------------------------------------------
160699 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
160700
160701 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
160702 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
160703
160704 IF xla_accounting_cache_pkg.GetValueChar
160705 (p_source_code => 'LEDGER_CATEGORY_CODE'
160709 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
160706 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
160707 AND l_bflow_method_code = 'PRIOR_ENTRY'
160708 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
160710 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
160711 )
160712 THEN
160713 xla_ae_lines_pkg.BflowUpgEntry
160714 (p_business_method_code => l_bflow_method_code
160715 ,p_business_class_code => l_bflow_class_code
160716 ,p_balance_type => l_balance_type_code);
160717 ELSE
160718 NULL;
160719 -- No business flow processing for business flow method of NONE.
160720 END IF;
160721
160722 --
160723 -- call analytical criteria
160724 --
160725
160726 --
160727 -- call description
160728 --
160729
160730 xla_ae_lines_pkg.SetLineDescription(
160731 p_ae_header_id => l_ae_header_id
160732 ,p_description => Description_129 (
160733 p_application_id => p_application_id
160734 , p_ae_header_id => l_ae_header_id
160735 , p_source_1 => p_source_1
160736 )
160737 );
160738
160739
160740 --
160741 -- call ADRs
160742 -- Bug 4922099
160743 --
160744 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
160745 (NVL(l_actual_upg_option, 'N') = 'O') OR
160746 (NVL(l_enc_upg_option, 'N') = 'O')
160747 )
160748 THEN
160749 NULL;
160750 --
160751 --
160752
160753 l_ccid := AcctDerRule_174(
160754 p_application_id => p_application_id
160755 , p_ae_header_id => l_ae_header_id
160756 , p_source_5 => p_source_5
160757 , p_source_32 => p_source_32
160758 , x_transaction_coa_id => l_adr_transaction_coa_id
160759 , x_accounting_coa_id => l_adr_accounting_coa_id
160760 , x_value_type_code => l_adr_value_type_code
160761 , p_side => 'NA'
160762 );
160763
160764 xla_ae_lines_pkg.set_ccid(
160765 p_code_combination_id => l_ccid
160766 , p_value_type_code => l_adr_value_type_code
160767 , p_transaction_coa_id => l_adr_transaction_coa_id
160768 , p_accounting_coa_id => l_adr_accounting_coa_id
160769 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
160770 , p_adr_type_code => 'S'
160771 , p_component_type => l_component_type
160772 , p_component_code => l_component_code
160773 , p_component_type_code => l_component_type_code
160774 , p_component_appl_id => l_component_appl_id
160775 , p_amb_context_code => l_amb_context_code
160776 , p_side => 'NA'
160777 );
160778
160779
160780 l_segment := AcctDerRule_169(
160781 p_application_id => p_application_id
160782 , p_ae_header_id => l_ae_header_id
160783 , p_source_5 => p_source_5
160784 , p_source_31 => p_source_31
160785 , x_transaction_coa_id => l_adr_transaction_coa_id
160786 , x_accounting_coa_id => l_adr_accounting_coa_id
160787 , x_flexfield_segment_code => l_adr_flexfield_segment_code
160788 , x_flex_value_set_id => l_adr_flex_value_set_id
160789 , x_value_type_code => l_adr_value_type_code
160790 , x_value_combination_id => l_adr_value_combination_id
160791 , x_value_segment_code => l_adr_value_segment_code
160792 , p_side => 'NA'
160793 , p_override_seg_flag => 'Y'
160794 );
160795
160796 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
160797
160798 xla_ae_lines_pkg.set_segment(
160799 p_to_segment_code => 'GL_BALANCING'
160800 , p_segment_value => l_segment
160801 , p_from_segment_code => l_adr_value_segment_code
160802 , p_from_combination_id => l_adr_value_combination_id
160803 , p_value_type_code => l_adr_value_type_code
160804 , p_transaction_coa_id => l_adr_transaction_coa_id
160805 , p_accounting_coa_id => l_adr_accounting_coa_id
160806 , p_flexfield_segment_code => l_adr_flexfield_segment_code
160807 , p_flex_value_set_id => l_adr_flex_value_set_id
160808 , p_adr_code => 'FA_EXPENSE_ACCT'
160809 , p_adr_type_code => 'S'
160810 , p_component_type => l_component_type
160811 , p_component_code => l_component_code
160812 , p_component_type_code => l_component_type_code
160813 , p_component_appl_id => l_component_appl_id
160814 , p_amb_context_code => l_amb_context_code
160815 , p_entity_code => 'TRANSACTIONS'
160816 , p_event_class_code => 'TRANSFERS'
160817 , p_side => 'NA'
160818 );
160819
160820 END IF;
160821
160822 l_segment := AcctDerRule_159(
160823 p_application_id => p_application_id
160824 , p_ae_header_id => l_ae_header_id
160825 , p_source_5 => p_source_5
160826 , p_source_22 => p_source_22
160827 , x_transaction_coa_id => l_adr_transaction_coa_id
160828 , x_accounting_coa_id => l_adr_accounting_coa_id
160829 , x_flexfield_segment_code => l_adr_flexfield_segment_code
160833 , x_value_segment_code => l_adr_value_segment_code
160830 , x_flex_value_set_id => l_adr_flex_value_set_id
160831 , x_value_type_code => l_adr_value_type_code
160832 , x_value_combination_id => l_adr_value_combination_id
160834 , p_side => 'NA'
160835 , p_override_seg_flag => 'Y'
160836 );
160837
160838 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
160839
160840 xla_ae_lines_pkg.set_segment(
160841 p_to_segment_code => 'GL_ACCOUNT'
160842 , p_segment_value => l_segment
160843 , p_from_segment_code => l_adr_value_segment_code
160844 , p_from_combination_id => l_adr_value_combination_id
160845 , p_value_type_code => l_adr_value_type_code
160846 , p_transaction_coa_id => l_adr_transaction_coa_id
160847 , p_accounting_coa_id => l_adr_accounting_coa_id
160848 , p_flexfield_segment_code => l_adr_flexfield_segment_code
160849 , p_flex_value_set_id => l_adr_flex_value_set_id
160850 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
160851 , p_adr_type_code => 'S'
160852 , p_component_type => l_component_type
160853 , p_component_code => l_component_code
160854 , p_component_type_code => l_component_type_code
160855 , p_component_appl_id => l_component_appl_id
160856 , p_amb_context_code => l_amb_context_code
160857 , p_entity_code => 'TRANSACTIONS'
160858 , p_event_class_code => 'TRANSFERS'
160859 , p_side => 'NA'
160860 );
160861
160862 END IF;
160863
160864 --
160865 --
160866 END IF;
160867 --
160868 -- Bug 4922099
160869 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
160870 (NVL(l_enc_upg_option, 'N') = 'O')
160871 ) AND
160872 (l_bflow_method_code = 'PRIOR_ENTRY')
160873 )
160874 THEN
160875 IF
160876 --
160877 1 = 2
160878 --
160879 THEN
160880 xla_accounting_err_pkg.build_message
160881 (p_appli_s_name => 'XLA'
160882 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
160883 ,p_token_1 => 'LINE_NUMBER'
160884 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
160885 ,p_token_2 => 'LINE_TYPE_NAME'
160886 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
160887 l_component_type
160888 ,l_component_code
160889 ,l_component_type_code
160890 ,l_component_appl_id
160891 ,l_amb_context_code
160892 ,l_entity_code
160893 ,l_event_class_code
160894 )
160895 ,p_token_3 => 'OWNER'
160896 ,p_value_3 => xla_lookups_pkg.get_meaning(
160897 p_lookup_type => 'XLA_OWNER_TYPE'
160898 ,p_lookup_code => l_component_type_code
160899 )
160900 ,p_token_4 => 'PRODUCT_NAME'
160901 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
160902 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
160903 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
160904 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
160905 ,p_ae_header_id => NULL
160906 );
160907
160908 IF (C_LEVEL_ERROR>= g_log_level) THEN
160909 trace
160910 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
160911 ,p_level => C_LEVEL_ERROR
160912 ,p_module => l_log_module);
160913 END IF;
160914 END IF;
160915 END IF;
160916 --
160917 --
160918 ------------------------------------------------------------------------------------------------
160919 -- 4219869 Business Flow
160920 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
160921 -- Prior Entry. Currently, the following code is always generated.
160922 ------------------------------------------------------------------------------------------------
160923 XLA_AE_LINES_PKG.ValidateCurrentLine;
160924
160925 ------------------------------------------------------------------------------------
160926 -- 4219869 Business Flow
160930
160927 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
160928 ------------------------------------------------------------------------------------
160929 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
160931 ----------------------------------------------------------------------------------
160932 -- 4219869 Business Flow
160933 -- Update journal entry status -- Need to generate this within IF <condition>
160934 ----------------------------------------------------------------------------------
160935 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
160936 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
160937 ,p_balance_type_code => l_balance_type_code
160938 );
160939
160940 -------------------------------------------------------------------------------------------
160941 -- 4262811 - Generate the Accrual Reversal lines
160942 -------------------------------------------------------------------------------------------
160943 BEGIN
160944 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
160945 (g_array_event(p_event_id).array_value_num('header_index'));
160946 IF l_acc_rev_flag IS NULL THEN
160947 l_acc_rev_flag := 'N';
160948 END IF;
160949 EXCEPTION
160950 WHEN OTHERS THEN
160951 l_acc_rev_flag := 'N';
160952 END;
160953 --
160954 IF (l_acc_rev_flag = 'Y') THEN
160955
160956 -- 4645092 ------------------------------------------------------------------------------
160957 -- To allow MPA report to determine if it should generate report process
160958 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
160959 ------------------------------------------------------------------------------------------
160960
160961 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
160962 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
160963 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
160964 -- call ADRs
160965 -- Bug 4922099
160966 --
160967 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
160968 (NVL(l_actual_upg_option, 'N') = 'O') OR
160969 (NVL(l_enc_upg_option, 'N') = 'O')
160970 )
160971 THEN
160972 NULL;
160973 --
160974 --
160975
160976 l_ccid := AcctDerRule_174(
160977 p_application_id => p_application_id
160978 , p_ae_header_id => l_ae_header_id
160979 , p_source_5 => p_source_5
160980 , p_source_32 => p_source_32
160981 , x_transaction_coa_id => l_adr_transaction_coa_id
160982 , x_accounting_coa_id => l_adr_accounting_coa_id
160983 , x_value_type_code => l_adr_value_type_code
160984 , p_side => 'NA'
160985 );
160986
160987 xla_ae_lines_pkg.set_ccid(
160988 p_code_combination_id => l_ccid
160989 , p_value_type_code => l_adr_value_type_code
160990 , p_transaction_coa_id => l_adr_transaction_coa_id
160991 , p_accounting_coa_id => l_adr_accounting_coa_id
160992 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
160993 , p_adr_type_code => 'S'
160994 , p_component_type => l_component_type
160995 , p_component_code => l_component_code
160996 , p_component_type_code => l_component_type_code
160997 , p_component_appl_id => l_component_appl_id
160998 , p_amb_context_code => l_amb_context_code
160999 , p_side => 'NA'
161000 );
161001
161002
161003 l_segment := AcctDerRule_169(
161004 p_application_id => p_application_id
161005 , p_ae_header_id => l_ae_header_id
161006 , p_source_5 => p_source_5
161007 , p_source_31 => p_source_31
161008 , x_transaction_coa_id => l_adr_transaction_coa_id
161009 , x_accounting_coa_id => l_adr_accounting_coa_id
161010 , x_flexfield_segment_code => l_adr_flexfield_segment_code
161011 , x_flex_value_set_id => l_adr_flex_value_set_id
161012 , x_value_type_code => l_adr_value_type_code
161013 , x_value_combination_id => l_adr_value_combination_id
161014 , x_value_segment_code => l_adr_value_segment_code
161015 , p_side => 'NA'
161016 , p_override_seg_flag => 'Y'
161017 );
161018
161019 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
161020
161021 xla_ae_lines_pkg.set_segment(
161022 p_to_segment_code => 'GL_BALANCING'
161023 , p_segment_value => l_segment
161024 , p_from_segment_code => l_adr_value_segment_code
161025 , p_from_combination_id => l_adr_value_combination_id
161026 , p_value_type_code => l_adr_value_type_code
161027 , p_transaction_coa_id => l_adr_transaction_coa_id
161028 , p_accounting_coa_id => l_adr_accounting_coa_id
161029 , p_flexfield_segment_code => l_adr_flexfield_segment_code
161030 , p_flex_value_set_id => l_adr_flex_value_set_id
161031 , p_adr_code => 'FA_EXPENSE_ACCT'
161032 , p_adr_type_code => 'S'
161033 , p_component_type => l_component_type
161034 , p_component_code => l_component_code
161035 , p_component_type_code => l_component_type_code
161039 , p_event_class_code => 'TRANSFERS'
161036 , p_component_appl_id => l_component_appl_id
161037 , p_amb_context_code => l_amb_context_code
161038 , p_entity_code => 'TRANSACTIONS'
161040 , p_side => 'NA'
161041 );
161042
161043 END IF;
161044
161045 l_segment := AcctDerRule_159(
161046 p_application_id => p_application_id
161047 , p_ae_header_id => l_ae_header_id
161048 , p_source_5 => p_source_5
161049 , p_source_22 => p_source_22
161050 , x_transaction_coa_id => l_adr_transaction_coa_id
161051 , x_accounting_coa_id => l_adr_accounting_coa_id
161052 , x_flexfield_segment_code => l_adr_flexfield_segment_code
161053 , x_flex_value_set_id => l_adr_flex_value_set_id
161054 , x_value_type_code => l_adr_value_type_code
161055 , x_value_combination_id => l_adr_value_combination_id
161056 , x_value_segment_code => l_adr_value_segment_code
161057 , p_side => 'NA'
161058 , p_override_seg_flag => 'Y'
161059 );
161060
161061 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
161062
161063 xla_ae_lines_pkg.set_segment(
161064 p_to_segment_code => 'GL_ACCOUNT'
161065 , p_segment_value => l_segment
161066 , p_from_segment_code => l_adr_value_segment_code
161067 , p_from_combination_id => l_adr_value_combination_id
161068 , p_value_type_code => l_adr_value_type_code
161069 , p_transaction_coa_id => l_adr_transaction_coa_id
161070 , p_accounting_coa_id => l_adr_accounting_coa_id
161071 , p_flexfield_segment_code => l_adr_flexfield_segment_code
161072 , p_flex_value_set_id => l_adr_flex_value_set_id
161073 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
161074 , p_adr_type_code => 'S'
161075 , p_component_type => l_component_type
161076 , p_component_code => l_component_code
161077 , p_component_type_code => l_component_type_code
161078 , p_component_appl_id => l_component_appl_id
161079 , p_amb_context_code => l_amb_context_code
161080 , p_entity_code => 'TRANSACTIONS'
161081 , p_event_class_code => 'TRANSFERS'
161082 , p_side => 'NA'
161083 );
161084
161085 END IF;
161086
161087 --
161088 --
161089 END IF;
161090
161091 --
161092 -- Update the line information that should be overwritten
161093 --
161094 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
161095 p_header_num => 1);
161096 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
161097
161098 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
161099
161100 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
161101 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
161102 END IF;
161103
161104 --
161105 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
161106 --
161107 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
161108 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
161109 ELSE
161110 ---------------------------------------------------------------------------------------------------
161111 -- 4262811a Switch Sign
161112 ---------------------------------------------------------------------------------------------------
161113 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
161114 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
161115 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
161116 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
161117 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
161118 -- 5132302
161119 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
161120 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
161121
161122 END IF;
161123
161124 -- 4955764
161125 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
161126 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
161127
161128
161129 XLA_AE_LINES_PKG.ValidateCurrentLine;
161130 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
161131
161132 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
161133 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
161134 ,p_balance_type_code => l_balance_type_code);
161135
161136 END IF;
161137
161138 -----------------------------------------------------------------------------------------
161139 -- 4262811 Multiperiod Accounting
161140 -----------------------------------------------------------------------------------------
161144 END IF;
161141 -- No MPA option is assigned.
161142
161143
161145 END IF;
161146 --
161147
161148 --
161149 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
161150 trace
161151 (p_msg => 'END of AcctLineType_390'
161152 ,p_level => C_LEVEL_PROCEDURE
161153 ,p_module => l_log_module);
161154 END IF;
161155 --
161156 EXCEPTION
161157 WHEN xla_exceptions_pkg.application_exception THEN
161158 RAISE;
161159 WHEN OTHERS THEN
161160 xla_exceptions_pkg.raise_message
161161 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_390');
161162 END AcctLineType_390;
161163 --
161164
161165 ---------------------------------------
161166 --
161167 -- PRIVATE FUNCTION
161168 -- AcctLineType_391
161169 --
161170 ---------------------------------------
161171 PROCEDURE AcctLineType_391 (
161172 p_application_id IN NUMBER
161173 ,p_event_id IN NUMBER
161174 ,p_calculate_acctd_flag IN VARCHAR2
161175 ,p_calculate_g_l_flag IN VARCHAR2
161176 ,p_actual_flag IN OUT VARCHAR2
161177 ,p_balance_type_code OUT VARCHAR2
161178 ,p_gain_or_loss_ref OUT VARCHAR2
161179
161180 --Period Close Date
161181 , p_source_1 IN DATE
161182 --Bonus Depreciation Expense Account
161183 , p_source_4 IN VARCHAR2
161184 --Generated Code Combination Identifier
161185 , p_source_5 IN NUMBER
161186 --Expense Account Code Combination Identifier
161187 , p_source_31 IN NUMBER
161188 --Adjustment Type
161189 , p_source_48 IN VARCHAR2
161190 --Transaction Header Identifier
161191 , p_source_49 IN NUMBER
161192 --Adjustment Line Identifier
161193 , p_source_50 IN NUMBER
161194 --Distribution Type Code
161195 , p_source_51 IN VARCHAR2
161196 --Entered Amount
161197 , p_source_52 IN NUMBER
161198 --Currency Code
161199 , p_source_53 IN VARCHAR2
161200 --Source Destination Code
161201 , p_source_55 IN VARCHAR2
161202 )
161203 IS
161204
161205 l_component_type VARCHAR2(80);
161206 l_component_code VARCHAR2(30);
161207 l_component_type_code VARCHAR2(1);
161208 l_component_appl_id INTEGER;
161209 l_amb_context_code VARCHAR2(30);
161210 l_entity_code VARCHAR2(30);
161211 l_event_class_code VARCHAR2(30);
161212 l_ae_header_id NUMBER;
161213 l_event_type_code VARCHAR2(30);
161214 l_line_definition_code VARCHAR2(30);
161215 l_line_definition_owner_code VARCHAR2(1);
161216 --
161217 -- adr variables
161218 l_segment VARCHAR2(30);
161219 l_ccid NUMBER;
161220 l_adr_transaction_coa_id NUMBER;
161221 l_adr_accounting_coa_id NUMBER;
161222 l_adr_flexfield_segment_code VARCHAR2(30);
161223 l_adr_flex_value_set_id NUMBER;
161224 l_adr_value_type_code VARCHAR2(30);
161225 l_adr_value_combination_id NUMBER;
161226 l_adr_value_segment_code VARCHAR2(30);
161227
161228 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
161229 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
161230 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
161231 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
161232
161233 -- 4262811 Variables ------------------------------------------------------------------------------------------
161234 l_entered_amt_idx NUMBER;
161235 l_accted_amt_idx NUMBER;
161236 l_acc_rev_flag VARCHAR2(1);
161237 l_accrual_line_num NUMBER;
161238 l_tmp_amt NUMBER;
161239 l_acc_rev_natural_side_code VARCHAR2(1);
161240
161241 l_num_entries NUMBER;
161242 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
161243 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
161244 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
161245 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
161246 l_recog_line_1 NUMBER;
161247 l_recog_line_2 NUMBER;
161248
161249 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
161250 l_bflow_applied_to_amt NUMBER; -- 5132302
161251 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
161252
161253 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
161254
161255 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
161256 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
161257
161258 ---------------------------------------------------------------------------------------------------------------
161259
161260
161261 --
161262 -- bulk performance
161263 --
161264 l_balance_type_code VARCHAR2(1);
161265 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
161266 l_log_module VARCHAR2(240);
161267
161268 --
161269 -- Upgrade strategy
161270 --
161271 l_actual_upg_option VARCHAR2(1);
161272 l_enc_upg_option VARCHAR2(1);
161273
161274 --
161275 BEGIN
161276 --
161277 IF g_log_enabled THEN
161278 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_391';
161279 END IF;
161280 --
161281 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
161282
161286 ,p_module => l_log_module);
161283 trace
161284 (p_msg => 'BEGIN of AcctLineType_391'
161285 ,p_level => C_LEVEL_PROCEDURE
161287
161288 END IF;
161289 --
161290 l_component_type := 'AMB_JLT';
161291 l_component_code := 'FA_TRANSFER_SOURCE_BONUS_EXP';
161292 l_component_type_code := 'S';
161293 l_component_appl_id := 140;
161294 l_amb_context_code := 'DEFAULT';
161295 l_entity_code := 'TRANSACTIONS';
161296 l_event_class_code := 'TRANSFERS';
161297 l_event_type_code := 'TRANSFERS_ALL';
161298 l_line_definition_owner_code := 'S';
161299 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
161300 --
161301 l_balance_type_code := 'A';
161302 l_segment := NULL;
161303 l_ccid := NULL;
161304 l_adr_transaction_coa_id := NULL;
161305 l_adr_accounting_coa_id := NULL;
161306 l_adr_flexfield_segment_code := NULL;
161307 l_adr_flex_value_set_id := NULL;
161308 l_adr_value_type_code := NULL;
161309 l_adr_value_combination_id := NULL;
161310 l_adr_value_segment_code := NULL;
161311
161312 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
161313 l_bflow_class_code := ''; -- 4219869 Business Flow
161314 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
161315 l_budgetary_control_flag := 'N';
161316
161317 l_bflow_applied_to_amt_idx := NULL; -- 5132302
161318 l_bflow_applied_to_amt := NULL; -- 5132302
161319 l_entered_amt_idx := NULL; -- 4262811
161320 l_accted_amt_idx := NULL; -- 4262811
161321 l_acc_rev_flag := NULL; -- 4262811
161322 l_accrual_line_num := NULL; -- 4262811
161323 l_tmp_amt := NULL; -- 4262811
161324 --
161325
161326 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
161327 l_balance_type_code <> 'B' THEN
161328 IF NVL(p_source_48,'
161329 ') = 'BONUS EXPENSE' AND
161330 NVL(p_source_55,'
161331 ') = 'SOURCE'
161332 THEN
161333
161334 --
161335 XLA_AE_LINES_PKG.SetNewLine;
161336
161337 p_balance_type_code := l_balance_type_code;
161338 -- set the flag so later we will know whether the gain loss line needs to be created
161339
161340 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
161341 p_actual_flag :='A';
161342 END IF;
161343
161344 --
161345 -- bulk performance
161346 --
161347 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
161348 p_header_num => 0); -- 4262811
161349 --
161350 -- set accounting line options
161351 --
161352 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
161353 p_natural_side_code => 'C'
161354 , p_gain_or_loss_flag => 'N'
161355 , p_gl_transfer_mode_code => 'S'
161356 , p_acct_entry_type_code => 'A'
161357 , p_switch_side_flag => 'Y'
161358 , p_merge_duplicate_code => 'N'
161359 );
161360 --
161361 l_acc_rev_natural_side_code := 'D'; -- 4262811
161362 --
161363 --
161364 -- set accounting line type info
161365 --
161366 xla_ae_lines_pkg.SetAcctLineType
161367 (p_component_type => l_component_type
161368 ,p_event_type_code => l_event_type_code
161369 ,p_line_definition_owner_code => l_line_definition_owner_code
161370 ,p_line_definition_code => l_line_definition_code
161371 ,p_accounting_line_code => l_component_code
161372 ,p_accounting_line_type_code => l_component_type_code
161373 ,p_accounting_line_appl_id => l_component_appl_id
161374 ,p_amb_context_code => l_amb_context_code
161375 ,p_entity_code => l_entity_code
161376 ,p_event_class_code => l_event_class_code);
161377 --
161378 -- set accounting class
161379 --
161380 xla_ae_lines_pkg.SetAcctClass(
161381 p_accounting_class_code => 'EXPENSE'
161382 , p_ae_header_id => l_ae_header_id
161383 );
161384
161385 --
161386 -- set rounding class
161387 --
161388 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
161389 'EXPENSE';
161390
161391 --
161392 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
161393 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
161394 --
161395 -- bulk performance
161396 --
161397 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
161398
161399 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
161400 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
161401
161402 -- 4955764
161403 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
161404 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
161405
161406 -- 4458381 Public Sector Enh
161407
161408 --
161409 -- set accounting attributes for the line type
161410 --
161411 l_entered_amt_idx := 4;
161415 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
161412 l_accted_amt_idx := 6;
161413 l_bflow_applied_to_amt_idx := NULL; -- 5132302
161414 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
161416 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
161417 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
161418 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
161419 l_rec_acct_attrs.array_char_value(3) := p_source_51;
161420 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
161421 l_rec_acct_attrs.array_num_value(4) := p_source_52;
161422 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
161423 l_rec_acct_attrs.array_char_value(5) := p_source_53;
161424 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
161425 l_rec_acct_attrs.array_num_value(6) := p_source_52;
161426
161427 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
161428 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
161429
161430 ---------------------------------------------------------------------------------------------------------------
161431 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
161432 ---------------------------------------------------------------------------------------------------------------
161433 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
161434
161435 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
161436 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
161437
161438 IF xla_accounting_cache_pkg.GetValueChar
161439 (p_source_code => 'LEDGER_CATEGORY_CODE'
161440 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
161441 AND l_bflow_method_code = 'PRIOR_ENTRY'
161442 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
161443 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
161444 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
161445 )
161446 THEN
161447 xla_ae_lines_pkg.BflowUpgEntry
161448 (p_business_method_code => l_bflow_method_code
161449 ,p_business_class_code => l_bflow_class_code
161450 ,p_balance_type => l_balance_type_code);
161451 ELSE
161452 NULL;
161453 -- No business flow processing for business flow method of NONE.
161454 END IF;
161455
161456 --
161457 -- call analytical criteria
161458 --
161459
161460 --
161461 -- call description
161462 --
161463
161464 xla_ae_lines_pkg.SetLineDescription(
161465 p_ae_header_id => l_ae_header_id
161466 ,p_description => Description_124 (
161467 p_application_id => p_application_id
161468 , p_ae_header_id => l_ae_header_id
161469 , p_source_1 => p_source_1
161470 )
161471 );
161472
161473
161474 --
161475 -- call ADRs
161476 -- Bug 4922099
161477 --
161478 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
161479 (NVL(l_actual_upg_option, 'N') = 'O') OR
161480 (NVL(l_enc_upg_option, 'N') = 'O')
161481 )
161482 THEN
161483 NULL;
161484 --
161485 --
161486
161487 l_ccid := AcctDerRule_176(
161488 p_application_id => p_application_id
161489 , p_ae_header_id => l_ae_header_id
161490 , p_source_5 => p_source_5
161491 , p_source_31 => p_source_31
161492 , x_transaction_coa_id => l_adr_transaction_coa_id
161493 , x_accounting_coa_id => l_adr_accounting_coa_id
161494 , x_value_type_code => l_adr_value_type_code
161495 , p_side => 'NA'
161496 );
161497
161498 xla_ae_lines_pkg.set_ccid(
161499 p_code_combination_id => l_ccid
161500 , p_value_type_code => l_adr_value_type_code
161501 , p_transaction_coa_id => l_adr_transaction_coa_id
161502 , p_accounting_coa_id => l_adr_accounting_coa_id
161503 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
161504 , p_adr_type_code => 'S'
161505 , p_component_type => l_component_type
161506 , p_component_code => l_component_code
161507 , p_component_type_code => l_component_type_code
161508 , p_component_appl_id => l_component_appl_id
161509 , p_amb_context_code => l_amb_context_code
161510 , p_side => 'NA'
161511 );
161512
161513
161514 l_segment := AcctDerRule_144(
161515 p_application_id => p_application_id
161516 , p_ae_header_id => l_ae_header_id
161517 , p_source_4 => p_source_4
161518 , p_source_5 => p_source_5
161519 , x_transaction_coa_id => l_adr_transaction_coa_id
161520 , x_accounting_coa_id => l_adr_accounting_coa_id
161521 , x_flexfield_segment_code => l_adr_flexfield_segment_code
161522 , x_flex_value_set_id => l_adr_flex_value_set_id
161523 , x_value_type_code => l_adr_value_type_code
161524 , x_value_combination_id => l_adr_value_combination_id
161525 , x_value_segment_code => l_adr_value_segment_code
161526 , p_side => 'NA'
161530 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
161527 , p_override_seg_flag => 'Y'
161528 );
161529
161531
161532 xla_ae_lines_pkg.set_segment(
161533 p_to_segment_code => 'GL_ACCOUNT'
161534 , p_segment_value => l_segment
161535 , p_from_segment_code => l_adr_value_segment_code
161536 , p_from_combination_id => l_adr_value_combination_id
161537 , p_value_type_code => l_adr_value_type_code
161538 , p_transaction_coa_id => l_adr_transaction_coa_id
161539 , p_accounting_coa_id => l_adr_accounting_coa_id
161540 , p_flexfield_segment_code => l_adr_flexfield_segment_code
161541 , p_flex_value_set_id => l_adr_flex_value_set_id
161542 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
161543 , p_adr_type_code => 'S'
161544 , p_component_type => l_component_type
161545 , p_component_code => l_component_code
161546 , p_component_type_code => l_component_type_code
161547 , p_component_appl_id => l_component_appl_id
161548 , p_amb_context_code => l_amb_context_code
161549 , p_entity_code => 'TRANSACTIONS'
161550 , p_event_class_code => 'TRANSFERS'
161551 , p_side => 'NA'
161552 );
161553
161554 END IF;
161555
161556 --
161557 --
161558 END IF;
161559 --
161560 -- Bug 4922099
161561 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
161562 (NVL(l_enc_upg_option, 'N') = 'O')
161563 ) AND
161564 (l_bflow_method_code = 'PRIOR_ENTRY')
161565 )
161566 THEN
161567 IF
161568 --
161569 1 = 2
161570 --
161571 THEN
161572 xla_accounting_err_pkg.build_message
161573 (p_appli_s_name => 'XLA'
161574 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
161575 ,p_token_1 => 'LINE_NUMBER'
161576 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
161577 ,p_token_2 => 'LINE_TYPE_NAME'
161578 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
161579 l_component_type
161580 ,l_component_code
161581 ,l_component_type_code
161582 ,l_component_appl_id
161583 ,l_amb_context_code
161584 ,l_entity_code
161585 ,l_event_class_code
161586 )
161587 ,p_token_3 => 'OWNER'
161588 ,p_value_3 => xla_lookups_pkg.get_meaning(
161589 p_lookup_type => 'XLA_OWNER_TYPE'
161590 ,p_lookup_code => l_component_type_code
161591 )
161592 ,p_token_4 => 'PRODUCT_NAME'
161593 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
161594 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
161595 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
161596 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
161597 ,p_ae_header_id => NULL
161598 );
161599
161600 IF (C_LEVEL_ERROR>= g_log_level) THEN
161601 trace
161602 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
161603 ,p_level => C_LEVEL_ERROR
161604 ,p_module => l_log_module);
161605 END IF;
161606 END IF;
161607 END IF;
161608 --
161609 --
161610 ------------------------------------------------------------------------------------------------
161611 -- 4219869 Business Flow
161612 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
161613 -- Prior Entry. Currently, the following code is always generated.
161614 ------------------------------------------------------------------------------------------------
161615 XLA_AE_LINES_PKG.ValidateCurrentLine;
161616
161617 ------------------------------------------------------------------------------------
161618 -- 4219869 Business Flow
161619 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
161620 ------------------------------------------------------------------------------------
161621 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
161622
161626 ----------------------------------------------------------------------------------
161623 ----------------------------------------------------------------------------------
161624 -- 4219869 Business Flow
161625 -- Update journal entry status -- Need to generate this within IF <condition>
161627 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
161628 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
161629 ,p_balance_type_code => l_balance_type_code
161630 );
161631
161632 -------------------------------------------------------------------------------------------
161633 -- 4262811 - Generate the Accrual Reversal lines
161634 -------------------------------------------------------------------------------------------
161635 BEGIN
161636 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
161637 (g_array_event(p_event_id).array_value_num('header_index'));
161638 IF l_acc_rev_flag IS NULL THEN
161639 l_acc_rev_flag := 'N';
161640 END IF;
161641 EXCEPTION
161642 WHEN OTHERS THEN
161643 l_acc_rev_flag := 'N';
161644 END;
161645 --
161646 IF (l_acc_rev_flag = 'Y') THEN
161647
161648 -- 4645092 ------------------------------------------------------------------------------
161649 -- To allow MPA report to determine if it should generate report process
161650 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
161651 ------------------------------------------------------------------------------------------
161652
161653 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
161654 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
161655 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
161656 -- call ADRs
161657 -- Bug 4922099
161658 --
161659 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
161660 (NVL(l_actual_upg_option, 'N') = 'O') OR
161661 (NVL(l_enc_upg_option, 'N') = 'O')
161662 )
161663 THEN
161664 NULL;
161665 --
161666 --
161667
161668 l_ccid := AcctDerRule_176(
161669 p_application_id => p_application_id
161670 , p_ae_header_id => l_ae_header_id
161671 , p_source_5 => p_source_5
161672 , p_source_31 => p_source_31
161673 , x_transaction_coa_id => l_adr_transaction_coa_id
161674 , x_accounting_coa_id => l_adr_accounting_coa_id
161675 , x_value_type_code => l_adr_value_type_code
161676 , p_side => 'NA'
161677 );
161678
161679 xla_ae_lines_pkg.set_ccid(
161680 p_code_combination_id => l_ccid
161681 , p_value_type_code => l_adr_value_type_code
161682 , p_transaction_coa_id => l_adr_transaction_coa_id
161683 , p_accounting_coa_id => l_adr_accounting_coa_id
161684 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
161685 , p_adr_type_code => 'S'
161686 , p_component_type => l_component_type
161687 , p_component_code => l_component_code
161688 , p_component_type_code => l_component_type_code
161689 , p_component_appl_id => l_component_appl_id
161690 , p_amb_context_code => l_amb_context_code
161691 , p_side => 'NA'
161692 );
161693
161694
161695 l_segment := AcctDerRule_144(
161696 p_application_id => p_application_id
161697 , p_ae_header_id => l_ae_header_id
161698 , p_source_4 => p_source_4
161699 , p_source_5 => p_source_5
161700 , x_transaction_coa_id => l_adr_transaction_coa_id
161701 , x_accounting_coa_id => l_adr_accounting_coa_id
161702 , x_flexfield_segment_code => l_adr_flexfield_segment_code
161703 , x_flex_value_set_id => l_adr_flex_value_set_id
161704 , x_value_type_code => l_adr_value_type_code
161705 , x_value_combination_id => l_adr_value_combination_id
161706 , x_value_segment_code => l_adr_value_segment_code
161707 , p_side => 'NA'
161708 , p_override_seg_flag => 'Y'
161709 );
161710
161711 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
161712
161713 xla_ae_lines_pkg.set_segment(
161714 p_to_segment_code => 'GL_ACCOUNT'
161715 , p_segment_value => l_segment
161716 , p_from_segment_code => l_adr_value_segment_code
161717 , p_from_combination_id => l_adr_value_combination_id
161718 , p_value_type_code => l_adr_value_type_code
161719 , p_transaction_coa_id => l_adr_transaction_coa_id
161720 , p_accounting_coa_id => l_adr_accounting_coa_id
161721 , p_flexfield_segment_code => l_adr_flexfield_segment_code
161722 , p_flex_value_set_id => l_adr_flex_value_set_id
161723 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
161724 , p_adr_type_code => 'S'
161725 , p_component_type => l_component_type
161726 , p_component_code => l_component_code
161727 , p_component_type_code => l_component_type_code
161728 , p_component_appl_id => l_component_appl_id
161729 , p_amb_context_code => l_amb_context_code
161730 , p_entity_code => 'TRANSACTIONS'
161731 , p_event_class_code => 'TRANSFERS'
161732 , p_side => 'NA'
161733 );
161734
161738 --
161735 END IF;
161736
161737 --
161739 END IF;
161740
161741 --
161742 -- Update the line information that should be overwritten
161743 --
161744 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
161745 p_header_num => 1);
161746 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
161747
161748 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
161749
161750 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
161751 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
161752 END IF;
161753
161754 --
161755 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
161756 --
161757 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
161758 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
161759 ELSE
161760 ---------------------------------------------------------------------------------------------------
161761 -- 4262811a Switch Sign
161762 ---------------------------------------------------------------------------------------------------
161763 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
161764 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
161765 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
161766 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
161767 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
161768 -- 5132302
161769 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
161770 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
161771
161772 END IF;
161773
161774 -- 4955764
161775 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
161776 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
161777
161778
161779 XLA_AE_LINES_PKG.ValidateCurrentLine;
161780 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
161781
161782 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
161783 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
161784 ,p_balance_type_code => l_balance_type_code);
161785
161786 END IF;
161787
161788 -----------------------------------------------------------------------------------------
161789 -- 4262811 Multiperiod Accounting
161790 -----------------------------------------------------------------------------------------
161791 -- No MPA option is assigned.
161792
161793
161794 END IF;
161795 END IF;
161796 --
161797
161798 --
161799 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
161800 trace
161801 (p_msg => 'END of AcctLineType_391'
161802 ,p_level => C_LEVEL_PROCEDURE
161803 ,p_module => l_log_module);
161804 END IF;
161805 --
161806 EXCEPTION
161807 WHEN xla_exceptions_pkg.application_exception THEN
161808 RAISE;
161809 WHEN OTHERS THEN
161810 xla_exceptions_pkg.raise_message
161811 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_391');
161812 END AcctLineType_391;
161813 --
161814
161815 ---------------------------------------
161816 --
161817 -- PRIVATE FUNCTION
161818 -- AcctLineType_392
161819 --
161820 ---------------------------------------
161821 PROCEDURE AcctLineType_392 (
161822 p_application_id IN NUMBER
161823 ,p_event_id IN NUMBER
161824 ,p_calculate_acctd_flag IN VARCHAR2
161825 ,p_calculate_g_l_flag IN VARCHAR2
161826 ,p_actual_flag IN OUT VARCHAR2
161827 ,p_balance_type_code OUT VARCHAR2
161828 ,p_gain_or_loss_ref OUT VARCHAR2
161829
161830 --Period Close Date
161831 , p_source_1 IN DATE
161832 --Generated Code Combination Identifier
161833 , p_source_5 IN NUMBER
161834 --Bonus Reserve Account
161835 , p_source_6 IN VARCHAR2
161836 --Generated Offset Code Combination Identifier
161837 , p_source_19 IN NUMBER
161838 --Expense Account Code Combination Identifier
161839 , p_source_31 IN NUMBER
161840 --Default Code Combination Identifier
161841 , p_source_32 IN NUMBER
161842 --Adjustment Type
161843 , p_source_48 IN VARCHAR2
161844 --Transaction Header Identifier
161845 , p_source_49 IN NUMBER
161846 --Adjustment Line Identifier
161847 , p_source_50 IN NUMBER
161848 --Distribution Type Code
161849 , p_source_51 IN VARCHAR2
161850 --Entered Amount
161851 , p_source_52 IN NUMBER
161852 --Currency Code
161853 , p_source_53 IN VARCHAR2
161854 --Source Destination Code
161855 , p_source_55 IN VARCHAR2
161856 )
161857 IS
161858
161859 l_component_type VARCHAR2(80);
161860 l_component_code VARCHAR2(30);
161861 l_component_type_code VARCHAR2(1);
161862 l_component_appl_id INTEGER;
161863 l_amb_context_code VARCHAR2(30);
161867 l_event_type_code VARCHAR2(30);
161864 l_entity_code VARCHAR2(30);
161865 l_event_class_code VARCHAR2(30);
161866 l_ae_header_id NUMBER;
161868 l_line_definition_code VARCHAR2(30);
161869 l_line_definition_owner_code VARCHAR2(1);
161870 --
161871 -- adr variables
161872 l_segment VARCHAR2(30);
161873 l_ccid NUMBER;
161874 l_adr_transaction_coa_id NUMBER;
161875 l_adr_accounting_coa_id NUMBER;
161876 l_adr_flexfield_segment_code VARCHAR2(30);
161877 l_adr_flex_value_set_id NUMBER;
161878 l_adr_value_type_code VARCHAR2(30);
161879 l_adr_value_combination_id NUMBER;
161880 l_adr_value_segment_code VARCHAR2(30);
161881
161882 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
161883 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
161884 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
161885 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
161886
161887 -- 4262811 Variables ------------------------------------------------------------------------------------------
161888 l_entered_amt_idx NUMBER;
161889 l_accted_amt_idx NUMBER;
161890 l_acc_rev_flag VARCHAR2(1);
161891 l_accrual_line_num NUMBER;
161892 l_tmp_amt NUMBER;
161893 l_acc_rev_natural_side_code VARCHAR2(1);
161894
161895 l_num_entries NUMBER;
161896 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
161897 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
161898 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
161899 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
161900 l_recog_line_1 NUMBER;
161901 l_recog_line_2 NUMBER;
161902
161903 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
161904 l_bflow_applied_to_amt NUMBER; -- 5132302
161905 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
161906
161907 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
161908
161909 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
161910 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
161911
161912 ---------------------------------------------------------------------------------------------------------------
161913
161914
161915 --
161916 -- bulk performance
161917 --
161918 l_balance_type_code VARCHAR2(1);
161919 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
161920 l_log_module VARCHAR2(240);
161921
161922 --
161923 -- Upgrade strategy
161924 --
161925 l_actual_upg_option VARCHAR2(1);
161926 l_enc_upg_option VARCHAR2(1);
161927
161928 --
161929 BEGIN
161930 --
161931 IF g_log_enabled THEN
161932 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_392';
161933 END IF;
161934 --
161935 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
161936
161937 trace
161938 (p_msg => 'BEGIN of AcctLineType_392'
161939 ,p_level => C_LEVEL_PROCEDURE
161940 ,p_module => l_log_module);
161941
161942 END IF;
161943 --
161944 l_component_type := 'AMB_JLT';
161945 l_component_code := 'FA_TRANSFER_SOURCE_BONUS_RES';
161946 l_component_type_code := 'S';
161947 l_component_appl_id := 140;
161948 l_amb_context_code := 'DEFAULT';
161949 l_entity_code := 'TRANSACTIONS';
161950 l_event_class_code := 'TRANSFERS';
161951 l_event_type_code := 'TRANSFERS_ALL';
161952 l_line_definition_owner_code := 'S';
161953 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
161954 --
161955 l_balance_type_code := 'A';
161956 l_segment := NULL;
161957 l_ccid := NULL;
161958 l_adr_transaction_coa_id := NULL;
161959 l_adr_accounting_coa_id := NULL;
161960 l_adr_flexfield_segment_code := NULL;
161961 l_adr_flex_value_set_id := NULL;
161962 l_adr_value_type_code := NULL;
161963 l_adr_value_combination_id := NULL;
161964 l_adr_value_segment_code := NULL;
161965
161966 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
161967 l_bflow_class_code := ''; -- 4219869 Business Flow
161968 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
161969 l_budgetary_control_flag := 'N';
161970
161971 l_bflow_applied_to_amt_idx := NULL; -- 5132302
161972 l_bflow_applied_to_amt := NULL; -- 5132302
161973 l_entered_amt_idx := NULL; -- 4262811
161974 l_accted_amt_idx := NULL; -- 4262811
161975 l_acc_rev_flag := NULL; -- 4262811
161976 l_accrual_line_num := NULL; -- 4262811
161977 l_tmp_amt := NULL; -- 4262811
161978 --
161979
161980 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
161981 l_balance_type_code <> 'B' THEN
161982 IF (NVL(p_source_48,'
161983 ') = 'BONUS RESERVE' OR
161984 NVL(p_source_48,'
161985 ') = 'BONUS EXPENSE') AND
161986 NVL(p_source_55,'
161987 ') = 'SOURCE'
161988 THEN
161989
161990 --
161991 XLA_AE_LINES_PKG.SetNewLine;
161992
161996 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
161993 p_balance_type_code := l_balance_type_code;
161994 -- set the flag so later we will know whether the gain loss line needs to be created
161995
161997 p_actual_flag :='A';
161998 END IF;
161999
162000 --
162001 -- bulk performance
162002 --
162003 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
162004 p_header_num => 0); -- 4262811
162005 --
162006 -- set accounting line options
162007 --
162008 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
162009 p_natural_side_code => 'D'
162010 , p_gain_or_loss_flag => 'N'
162011 , p_gl_transfer_mode_code => 'S'
162012 , p_acct_entry_type_code => 'A'
162013 , p_switch_side_flag => 'Y'
162014 , p_merge_duplicate_code => 'N'
162015 );
162016 --
162017 l_acc_rev_natural_side_code := 'C'; -- 4262811
162018 --
162019 --
162020 -- set accounting line type info
162021 --
162022 xla_ae_lines_pkg.SetAcctLineType
162023 (p_component_type => l_component_type
162024 ,p_event_type_code => l_event_type_code
162025 ,p_line_definition_owner_code => l_line_definition_owner_code
162026 ,p_line_definition_code => l_line_definition_code
162027 ,p_accounting_line_code => l_component_code
162028 ,p_accounting_line_type_code => l_component_type_code
162029 ,p_accounting_line_appl_id => l_component_appl_id
162030 ,p_amb_context_code => l_amb_context_code
162031 ,p_entity_code => l_entity_code
162032 ,p_event_class_code => l_event_class_code);
162033 --
162034 -- set accounting class
162035 --
162036 xla_ae_lines_pkg.SetAcctClass(
162037 p_accounting_class_code => 'ASSET'
162038 , p_ae_header_id => l_ae_header_id
162039 );
162040
162041 --
162042 -- set rounding class
162043 --
162044 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
162045 'ASSET';
162046
162047 --
162048 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
162049 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
162050 --
162051 -- bulk performance
162052 --
162053 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
162054
162055 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
162056 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
162057
162058 -- 4955764
162059 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
162060 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
162061
162062 -- 4458381 Public Sector Enh
162063
162064 --
162065 -- set accounting attributes for the line type
162066 --
162067 l_entered_amt_idx := 4;
162068 l_accted_amt_idx := 6;
162069 l_bflow_applied_to_amt_idx := NULL; -- 5132302
162070 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
162071 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
162072 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
162073 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
162074 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
162075 l_rec_acct_attrs.array_char_value(3) := p_source_51;
162076 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
162077 l_rec_acct_attrs.array_num_value(4) := p_source_52;
162078 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
162079 l_rec_acct_attrs.array_char_value(5) := p_source_53;
162080 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
162081 l_rec_acct_attrs.array_num_value(6) := p_source_52;
162082
162083 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
162084 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
162085
162086 ---------------------------------------------------------------------------------------------------------------
162087 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
162088 ---------------------------------------------------------------------------------------------------------------
162089 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
162090
162091 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
162092 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
162093
162094 IF xla_accounting_cache_pkg.GetValueChar
162095 (p_source_code => 'LEDGER_CATEGORY_CODE'
162096 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
162097 AND l_bflow_method_code = 'PRIOR_ENTRY'
162098 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
162099 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
162100 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
162101 )
162102 THEN
162103 xla_ae_lines_pkg.BflowUpgEntry
162107 ELSE
162104 (p_business_method_code => l_bflow_method_code
162105 ,p_business_class_code => l_bflow_class_code
162106 ,p_balance_type => l_balance_type_code);
162108 NULL;
162109 -- No business flow processing for business flow method of NONE.
162110 END IF;
162111
162112 --
162113 -- call analytical criteria
162114 --
162115
162116 --
162117 -- call description
162118 --
162119
162120 xla_ae_lines_pkg.SetLineDescription(
162121 p_ae_header_id => l_ae_header_id
162122 ,p_description => Description_125 (
162123 p_application_id => p_application_id
162124 , p_ae_header_id => l_ae_header_id
162125 , p_source_1 => p_source_1
162126 )
162127 );
162128
162129
162130 --
162131 -- call ADRs
162132 -- Bug 4922099
162133 --
162134 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
162135 (NVL(l_actual_upg_option, 'N') = 'O') OR
162136 (NVL(l_enc_upg_option, 'N') = 'O')
162137 )
162138 THEN
162139 NULL;
162140 --
162141 --
162142
162143 l_ccid := AcctDerRule_175(
162144 p_application_id => p_application_id
162145 , p_ae_header_id => l_ae_header_id
162146 , p_source_5 => p_source_5
162147 , p_source_19 => p_source_19
162148 , p_source_32 => p_source_32
162149 , x_transaction_coa_id => l_adr_transaction_coa_id
162150 , x_accounting_coa_id => l_adr_accounting_coa_id
162151 , x_value_type_code => l_adr_value_type_code
162152 , p_side => 'NA'
162153 );
162154
162155 xla_ae_lines_pkg.set_ccid(
162156 p_code_combination_id => l_ccid
162157 , p_value_type_code => l_adr_value_type_code
162158 , p_transaction_coa_id => l_adr_transaction_coa_id
162159 , p_accounting_coa_id => l_adr_accounting_coa_id
162160 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
162161 , p_adr_type_code => 'S'
162162 , p_component_type => l_component_type
162163 , p_component_code => l_component_code
162164 , p_component_type_code => l_component_type_code
162165 , p_component_appl_id => l_component_appl_id
162166 , p_amb_context_code => l_amb_context_code
162167 , p_side => 'NA'
162168 );
162169
162170
162171 l_segment := AcctDerRule_145(
162172 p_application_id => p_application_id
162173 , p_ae_header_id => l_ae_header_id
162174 , p_source_5 => p_source_5
162175 , p_source_6 => p_source_6
162176 , x_transaction_coa_id => l_adr_transaction_coa_id
162177 , x_accounting_coa_id => l_adr_accounting_coa_id
162178 , x_flexfield_segment_code => l_adr_flexfield_segment_code
162179 , x_flex_value_set_id => l_adr_flex_value_set_id
162180 , x_value_type_code => l_adr_value_type_code
162181 , x_value_combination_id => l_adr_value_combination_id
162182 , x_value_segment_code => l_adr_value_segment_code
162183 , p_side => 'NA'
162184 , p_override_seg_flag => 'Y'
162185 );
162186
162187 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
162188
162189 xla_ae_lines_pkg.set_segment(
162190 p_to_segment_code => 'GL_ACCOUNT'
162191 , p_segment_value => l_segment
162192 , p_from_segment_code => l_adr_value_segment_code
162193 , p_from_combination_id => l_adr_value_combination_id
162194 , p_value_type_code => l_adr_value_type_code
162195 , p_transaction_coa_id => l_adr_transaction_coa_id
162196 , p_accounting_coa_id => l_adr_accounting_coa_id
162197 , p_flexfield_segment_code => l_adr_flexfield_segment_code
162198 , p_flex_value_set_id => l_adr_flex_value_set_id
162199 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
162200 , p_adr_type_code => 'S'
162201 , p_component_type => l_component_type
162202 , p_component_code => l_component_code
162203 , p_component_type_code => l_component_type_code
162204 , p_component_appl_id => l_component_appl_id
162205 , p_amb_context_code => l_amb_context_code
162206 , p_entity_code => 'TRANSACTIONS'
162207 , p_event_class_code => 'TRANSFERS'
162208 , p_side => 'NA'
162209 );
162210
162211 END IF;
162212
162213 l_segment := AcctDerRule_169(
162214 p_application_id => p_application_id
162215 , p_ae_header_id => l_ae_header_id
162216 , p_source_5 => p_source_5
162217 , p_source_31 => p_source_31
162218 , x_transaction_coa_id => l_adr_transaction_coa_id
162219 , x_accounting_coa_id => l_adr_accounting_coa_id
162220 , x_flexfield_segment_code => l_adr_flexfield_segment_code
162221 , x_flex_value_set_id => l_adr_flex_value_set_id
162222 , x_value_type_code => l_adr_value_type_code
162223 , x_value_combination_id => l_adr_value_combination_id
162224 , x_value_segment_code => l_adr_value_segment_code
162225 , p_side => 'NA'
162229 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
162226 , p_override_seg_flag => 'Y'
162227 );
162228
162230
162231 xla_ae_lines_pkg.set_segment(
162232 p_to_segment_code => 'GL_BALANCING'
162233 , p_segment_value => l_segment
162234 , p_from_segment_code => l_adr_value_segment_code
162235 , p_from_combination_id => l_adr_value_combination_id
162236 , p_value_type_code => l_adr_value_type_code
162237 , p_transaction_coa_id => l_adr_transaction_coa_id
162238 , p_accounting_coa_id => l_adr_accounting_coa_id
162239 , p_flexfield_segment_code => l_adr_flexfield_segment_code
162240 , p_flex_value_set_id => l_adr_flex_value_set_id
162241 , p_adr_code => 'FA_EXPENSE_ACCT'
162242 , p_adr_type_code => 'S'
162243 , p_component_type => l_component_type
162244 , p_component_code => l_component_code
162245 , p_component_type_code => l_component_type_code
162246 , p_component_appl_id => l_component_appl_id
162247 , p_amb_context_code => l_amb_context_code
162248 , p_entity_code => 'TRANSACTIONS'
162249 , p_event_class_code => 'TRANSFERS'
162250 , p_side => 'NA'
162251 );
162252
162253 END IF;
162254
162255 --
162256 --
162257 END IF;
162258 --
162259 -- Bug 4922099
162260 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
162261 (NVL(l_enc_upg_option, 'N') = 'O')
162262 ) AND
162263 (l_bflow_method_code = 'PRIOR_ENTRY')
162264 )
162265 THEN
162266 IF
162267 --
162268 1 = 2
162269 --
162270 THEN
162271 xla_accounting_err_pkg.build_message
162272 (p_appli_s_name => 'XLA'
162273 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
162274 ,p_token_1 => 'LINE_NUMBER'
162275 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
162276 ,p_token_2 => 'LINE_TYPE_NAME'
162277 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
162278 l_component_type
162279 ,l_component_code
162280 ,l_component_type_code
162281 ,l_component_appl_id
162282 ,l_amb_context_code
162283 ,l_entity_code
162284 ,l_event_class_code
162285 )
162286 ,p_token_3 => 'OWNER'
162287 ,p_value_3 => xla_lookups_pkg.get_meaning(
162288 p_lookup_type => 'XLA_OWNER_TYPE'
162289 ,p_lookup_code => l_component_type_code
162290 )
162291 ,p_token_4 => 'PRODUCT_NAME'
162292 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
162293 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
162294 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
162295 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
162296 ,p_ae_header_id => NULL
162297 );
162298
162299 IF (C_LEVEL_ERROR>= g_log_level) THEN
162300 trace
162301 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
162302 ,p_level => C_LEVEL_ERROR
162303 ,p_module => l_log_module);
162304 END IF;
162305 END IF;
162306 END IF;
162307 --
162308 --
162309 ------------------------------------------------------------------------------------------------
162310 -- 4219869 Business Flow
162311 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
162312 -- Prior Entry. Currently, the following code is always generated.
162313 ------------------------------------------------------------------------------------------------
162314 XLA_AE_LINES_PKG.ValidateCurrentLine;
162315
162316 ------------------------------------------------------------------------------------
162317 -- 4219869 Business Flow
162318 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
162319 ------------------------------------------------------------------------------------
162320 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
162321
162322 ----------------------------------------------------------------------------------
162323 -- 4219869 Business Flow
162327 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
162324 -- Update journal entry status -- Need to generate this within IF <condition>
162325 ----------------------------------------------------------------------------------
162326 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
162328 ,p_balance_type_code => l_balance_type_code
162329 );
162330
162331 -------------------------------------------------------------------------------------------
162332 -- 4262811 - Generate the Accrual Reversal lines
162333 -------------------------------------------------------------------------------------------
162334 BEGIN
162335 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
162336 (g_array_event(p_event_id).array_value_num('header_index'));
162337 IF l_acc_rev_flag IS NULL THEN
162338 l_acc_rev_flag := 'N';
162339 END IF;
162340 EXCEPTION
162341 WHEN OTHERS THEN
162342 l_acc_rev_flag := 'N';
162343 END;
162344 --
162345 IF (l_acc_rev_flag = 'Y') THEN
162346
162347 -- 4645092 ------------------------------------------------------------------------------
162348 -- To allow MPA report to determine if it should generate report process
162349 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
162350 ------------------------------------------------------------------------------------------
162351
162352 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
162353 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
162354 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
162355 -- call ADRs
162356 -- Bug 4922099
162357 --
162358 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
162359 (NVL(l_actual_upg_option, 'N') = 'O') OR
162360 (NVL(l_enc_upg_option, 'N') = 'O')
162361 )
162362 THEN
162363 NULL;
162364 --
162365 --
162366
162367 l_ccid := AcctDerRule_175(
162368 p_application_id => p_application_id
162369 , p_ae_header_id => l_ae_header_id
162370 , p_source_5 => p_source_5
162371 , p_source_19 => p_source_19
162372 , p_source_32 => p_source_32
162373 , x_transaction_coa_id => l_adr_transaction_coa_id
162374 , x_accounting_coa_id => l_adr_accounting_coa_id
162375 , x_value_type_code => l_adr_value_type_code
162376 , p_side => 'NA'
162377 );
162378
162379 xla_ae_lines_pkg.set_ccid(
162380 p_code_combination_id => l_ccid
162381 , p_value_type_code => l_adr_value_type_code
162382 , p_transaction_coa_id => l_adr_transaction_coa_id
162383 , p_accounting_coa_id => l_adr_accounting_coa_id
162384 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
162385 , p_adr_type_code => 'S'
162386 , p_component_type => l_component_type
162387 , p_component_code => l_component_code
162388 , p_component_type_code => l_component_type_code
162389 , p_component_appl_id => l_component_appl_id
162390 , p_amb_context_code => l_amb_context_code
162391 , p_side => 'NA'
162392 );
162393
162394
162395 l_segment := AcctDerRule_145(
162396 p_application_id => p_application_id
162397 , p_ae_header_id => l_ae_header_id
162398 , p_source_5 => p_source_5
162399 , p_source_6 => p_source_6
162400 , x_transaction_coa_id => l_adr_transaction_coa_id
162401 , x_accounting_coa_id => l_adr_accounting_coa_id
162402 , x_flexfield_segment_code => l_adr_flexfield_segment_code
162403 , x_flex_value_set_id => l_adr_flex_value_set_id
162404 , x_value_type_code => l_adr_value_type_code
162405 , x_value_combination_id => l_adr_value_combination_id
162406 , x_value_segment_code => l_adr_value_segment_code
162407 , p_side => 'NA'
162408 , p_override_seg_flag => 'Y'
162409 );
162410
162411 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
162412
162413 xla_ae_lines_pkg.set_segment(
162414 p_to_segment_code => 'GL_ACCOUNT'
162415 , p_segment_value => l_segment
162416 , p_from_segment_code => l_adr_value_segment_code
162417 , p_from_combination_id => l_adr_value_combination_id
162418 , p_value_type_code => l_adr_value_type_code
162419 , p_transaction_coa_id => l_adr_transaction_coa_id
162420 , p_accounting_coa_id => l_adr_accounting_coa_id
162421 , p_flexfield_segment_code => l_adr_flexfield_segment_code
162422 , p_flex_value_set_id => l_adr_flex_value_set_id
162423 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
162424 , p_adr_type_code => 'S'
162425 , p_component_type => l_component_type
162426 , p_component_code => l_component_code
162427 , p_component_type_code => l_component_type_code
162428 , p_component_appl_id => l_component_appl_id
162429 , p_amb_context_code => l_amb_context_code
162430 , p_entity_code => 'TRANSACTIONS'
162431 , p_event_class_code => 'TRANSFERS'
162432 , p_side => 'NA'
162433 );
162434
162435 END IF;
162436
162437 l_segment := AcctDerRule_169(
162438 p_application_id => p_application_id
162442 , x_transaction_coa_id => l_adr_transaction_coa_id
162439 , p_ae_header_id => l_ae_header_id
162440 , p_source_5 => p_source_5
162441 , p_source_31 => p_source_31
162443 , x_accounting_coa_id => l_adr_accounting_coa_id
162444 , x_flexfield_segment_code => l_adr_flexfield_segment_code
162445 , x_flex_value_set_id => l_adr_flex_value_set_id
162446 , x_value_type_code => l_adr_value_type_code
162447 , x_value_combination_id => l_adr_value_combination_id
162448 , x_value_segment_code => l_adr_value_segment_code
162449 , p_side => 'NA'
162450 , p_override_seg_flag => 'Y'
162451 );
162452
162453 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
162454
162455 xla_ae_lines_pkg.set_segment(
162456 p_to_segment_code => 'GL_BALANCING'
162457 , p_segment_value => l_segment
162458 , p_from_segment_code => l_adr_value_segment_code
162459 , p_from_combination_id => l_adr_value_combination_id
162460 , p_value_type_code => l_adr_value_type_code
162461 , p_transaction_coa_id => l_adr_transaction_coa_id
162462 , p_accounting_coa_id => l_adr_accounting_coa_id
162463 , p_flexfield_segment_code => l_adr_flexfield_segment_code
162464 , p_flex_value_set_id => l_adr_flex_value_set_id
162465 , p_adr_code => 'FA_EXPENSE_ACCT'
162466 , p_adr_type_code => 'S'
162467 , p_component_type => l_component_type
162468 , p_component_code => l_component_code
162469 , p_component_type_code => l_component_type_code
162470 , p_component_appl_id => l_component_appl_id
162471 , p_amb_context_code => l_amb_context_code
162472 , p_entity_code => 'TRANSACTIONS'
162473 , p_event_class_code => 'TRANSFERS'
162474 , p_side => 'NA'
162475 );
162476
162477 END IF;
162478
162479 --
162480 --
162481 END IF;
162482
162483 --
162484 -- Update the line information that should be overwritten
162485 --
162486 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
162487 p_header_num => 1);
162488 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
162489
162490 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
162491
162492 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
162493 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
162494 END IF;
162495
162496 --
162497 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
162498 --
162499 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
162500 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
162501 ELSE
162502 ---------------------------------------------------------------------------------------------------
162503 -- 4262811a Switch Sign
162504 ---------------------------------------------------------------------------------------------------
162505 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
162506 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
162507 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
162508 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
162509 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
162510 -- 5132302
162511 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
162512 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
162513
162514 END IF;
162515
162516 -- 4955764
162517 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
162518 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
162519
162520
162521 XLA_AE_LINES_PKG.ValidateCurrentLine;
162522 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
162523
162524 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
162525 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
162526 ,p_balance_type_code => l_balance_type_code);
162527
162528 END IF;
162529
162530 -----------------------------------------------------------------------------------------
162531 -- 4262811 Multiperiod Accounting
162532 -----------------------------------------------------------------------------------------
162533 -- No MPA option is assigned.
162534
162535
162536 END IF;
162537 END IF;
162538 --
162539
162540 --
162541 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
162542 trace
162543 (p_msg => 'END of AcctLineType_392'
162544 ,p_level => C_LEVEL_PROCEDURE
162545 ,p_module => l_log_module);
162546 END IF;
162547 --
162548 EXCEPTION
162549 WHEN xla_exceptions_pkg.application_exception THEN
162553 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_392');
162550 RAISE;
162551 WHEN OTHERS THEN
162552 xla_exceptions_pkg.raise_message
162554 END AcctLineType_392;
162555 --
162556
162557 ---------------------------------------
162558 --
162559 -- PRIVATE FUNCTION
162560 -- AcctLineType_393
162561 --
162562 ---------------------------------------
162563 PROCEDURE AcctLineType_393 (
162564 p_application_id IN NUMBER
162565 ,p_event_id IN NUMBER
162566 ,p_calculate_acctd_flag IN VARCHAR2
162567 ,p_calculate_g_l_flag IN VARCHAR2
162568 ,p_actual_flag IN OUT VARCHAR2
162569 ,p_balance_type_code OUT VARCHAR2
162570 ,p_gain_or_loss_ref OUT VARCHAR2
162571
162572 --Period Close Date
162573 , p_source_1 IN DATE
162574 --Generated Code Combination Identifier
162575 , p_source_5 IN NUMBER
162576 --Asset Cost Account
162577 , p_source_11 IN VARCHAR2
162578 --Expense Account Code Combination Identifier
162579 , p_source_31 IN NUMBER
162580 --Default Code Combination Identifier
162581 , p_source_32 IN NUMBER
162582 --Adjustment Type
162583 , p_source_48 IN VARCHAR2
162584 --Transaction Header Identifier
162585 , p_source_49 IN NUMBER
162586 --Adjustment Line Identifier
162587 , p_source_50 IN NUMBER
162588 --Distribution Type Code
162589 , p_source_51 IN VARCHAR2
162590 --Entered Amount
162591 , p_source_52 IN NUMBER
162592 --Currency Code
162593 , p_source_53 IN VARCHAR2
162594 --Source Destination Code
162595 , p_source_55 IN VARCHAR2
162596 )
162597 IS
162598
162599 l_component_type VARCHAR2(80);
162600 l_component_code VARCHAR2(30);
162601 l_component_type_code VARCHAR2(1);
162602 l_component_appl_id INTEGER;
162603 l_amb_context_code VARCHAR2(30);
162604 l_entity_code VARCHAR2(30);
162605 l_event_class_code VARCHAR2(30);
162606 l_ae_header_id NUMBER;
162607 l_event_type_code VARCHAR2(30);
162608 l_line_definition_code VARCHAR2(30);
162609 l_line_definition_owner_code VARCHAR2(1);
162610 --
162611 -- adr variables
162612 l_segment VARCHAR2(30);
162613 l_ccid NUMBER;
162614 l_adr_transaction_coa_id NUMBER;
162615 l_adr_accounting_coa_id NUMBER;
162616 l_adr_flexfield_segment_code VARCHAR2(30);
162617 l_adr_flex_value_set_id NUMBER;
162618 l_adr_value_type_code VARCHAR2(30);
162619 l_adr_value_combination_id NUMBER;
162620 l_adr_value_segment_code VARCHAR2(30);
162621
162622 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
162623 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
162624 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
162625 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
162626
162627 -- 4262811 Variables ------------------------------------------------------------------------------------------
162628 l_entered_amt_idx NUMBER;
162629 l_accted_amt_idx NUMBER;
162630 l_acc_rev_flag VARCHAR2(1);
162631 l_accrual_line_num NUMBER;
162632 l_tmp_amt NUMBER;
162633 l_acc_rev_natural_side_code VARCHAR2(1);
162634
162635 l_num_entries NUMBER;
162636 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
162637 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
162638 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
162639 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
162640 l_recog_line_1 NUMBER;
162641 l_recog_line_2 NUMBER;
162642
162643 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
162644 l_bflow_applied_to_amt NUMBER; -- 5132302
162645 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
162646
162647 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
162648
162649 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
162650 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
162651
162652 ---------------------------------------------------------------------------------------------------------------
162653
162654
162655 --
162656 -- bulk performance
162657 --
162658 l_balance_type_code VARCHAR2(1);
162659 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
162660 l_log_module VARCHAR2(240);
162661
162662 --
162663 -- Upgrade strategy
162664 --
162665 l_actual_upg_option VARCHAR2(1);
162666 l_enc_upg_option VARCHAR2(1);
162667
162668 --
162669 BEGIN
162670 --
162671 IF g_log_enabled THEN
162672 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_393';
162673 END IF;
162674 --
162675 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
162676
162677 trace
162678 (p_msg => 'BEGIN of AcctLineType_393'
162679 ,p_level => C_LEVEL_PROCEDURE
162680 ,p_module => l_log_module);
162681
162682 END IF;
162683 --
162684 l_component_type := 'AMB_JLT';
162688 l_amb_context_code := 'DEFAULT';
162685 l_component_code := 'FA_TRANSFER_SOURCE_COST';
162686 l_component_type_code := 'S';
162687 l_component_appl_id := 140;
162689 l_entity_code := 'TRANSACTIONS';
162690 l_event_class_code := 'TRANSFERS';
162691 l_event_type_code := 'TRANSFERS_ALL';
162692 l_line_definition_owner_code := 'S';
162693 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
162694 --
162695 l_balance_type_code := 'A';
162696 l_segment := NULL;
162697 l_ccid := NULL;
162698 l_adr_transaction_coa_id := NULL;
162699 l_adr_accounting_coa_id := NULL;
162700 l_adr_flexfield_segment_code := NULL;
162701 l_adr_flex_value_set_id := NULL;
162702 l_adr_value_type_code := NULL;
162703 l_adr_value_combination_id := NULL;
162704 l_adr_value_segment_code := NULL;
162705
162706 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
162707 l_bflow_class_code := ''; -- 4219869 Business Flow
162708 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
162709 l_budgetary_control_flag := 'N';
162710
162711 l_bflow_applied_to_amt_idx := NULL; -- 5132302
162712 l_bflow_applied_to_amt := NULL; -- 5132302
162713 l_entered_amt_idx := NULL; -- 4262811
162714 l_accted_amt_idx := NULL; -- 4262811
162715 l_acc_rev_flag := NULL; -- 4262811
162716 l_accrual_line_num := NULL; -- 4262811
162717 l_tmp_amt := NULL; -- 4262811
162718 --
162719
162720 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
162721 l_balance_type_code <> 'B' THEN
162722 IF NVL(p_source_48,'
162723 ') = 'COST' AND
162724 NVL(p_source_55,'
162725 ') = 'SOURCE'
162726 THEN
162727
162728 --
162729 XLA_AE_LINES_PKG.SetNewLine;
162730
162731 p_balance_type_code := l_balance_type_code;
162732 -- set the flag so later we will know whether the gain loss line needs to be created
162733
162734 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
162735 p_actual_flag :='A';
162736 END IF;
162737
162738 --
162739 -- bulk performance
162740 --
162741 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
162742 p_header_num => 0); -- 4262811
162743 --
162744 -- set accounting line options
162745 --
162746 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
162747 p_natural_side_code => 'C'
162748 , p_gain_or_loss_flag => 'N'
162749 , p_gl_transfer_mode_code => 'S'
162750 , p_acct_entry_type_code => 'A'
162751 , p_switch_side_flag => 'Y'
162752 , p_merge_duplicate_code => 'N'
162753 );
162754 --
162755 l_acc_rev_natural_side_code := 'D'; -- 4262811
162756 --
162757 --
162758 -- set accounting line type info
162759 --
162760 xla_ae_lines_pkg.SetAcctLineType
162761 (p_component_type => l_component_type
162762 ,p_event_type_code => l_event_type_code
162763 ,p_line_definition_owner_code => l_line_definition_owner_code
162764 ,p_line_definition_code => l_line_definition_code
162765 ,p_accounting_line_code => l_component_code
162766 ,p_accounting_line_type_code => l_component_type_code
162767 ,p_accounting_line_appl_id => l_component_appl_id
162768 ,p_amb_context_code => l_amb_context_code
162769 ,p_entity_code => l_entity_code
162770 ,p_event_class_code => l_event_class_code);
162771 --
162772 -- set accounting class
162773 --
162774 xla_ae_lines_pkg.SetAcctClass(
162775 p_accounting_class_code => 'ASSET'
162776 , p_ae_header_id => l_ae_header_id
162777 );
162778
162779 --
162780 -- set rounding class
162781 --
162782 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
162783 'ASSET';
162784
162785 --
162786 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
162787 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
162788 --
162789 -- bulk performance
162790 --
162791 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
162792
162793 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
162794 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
162795
162796 -- 4955764
162797 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
162798 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
162799
162800 -- 4458381 Public Sector Enh
162801
162802 --
162803 -- set accounting attributes for the line type
162804 --
162805 l_entered_amt_idx := 4;
162806 l_accted_amt_idx := 6;
162807 l_bflow_applied_to_amt_idx := NULL; -- 5132302
162808 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
162809 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
162813 l_rec_acct_attrs.array_char_value(3) := p_source_51;
162810 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
162811 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
162812 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
162814 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
162815 l_rec_acct_attrs.array_num_value(4) := p_source_52;
162816 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
162817 l_rec_acct_attrs.array_char_value(5) := p_source_53;
162818 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
162819 l_rec_acct_attrs.array_num_value(6) := p_source_52;
162820
162821 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
162822 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
162823
162824 ---------------------------------------------------------------------------------------------------------------
162825 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
162826 ---------------------------------------------------------------------------------------------------------------
162827 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
162828
162829 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
162830 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
162831
162832 IF xla_accounting_cache_pkg.GetValueChar
162833 (p_source_code => 'LEDGER_CATEGORY_CODE'
162834 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
162835 AND l_bflow_method_code = 'PRIOR_ENTRY'
162836 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
162837 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
162838 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
162839 )
162840 THEN
162841 xla_ae_lines_pkg.BflowUpgEntry
162842 (p_business_method_code => l_bflow_method_code
162843 ,p_business_class_code => l_bflow_class_code
162844 ,p_balance_type => l_balance_type_code);
162845 ELSE
162846 NULL;
162847 -- No business flow processing for business flow method of NONE.
162848 END IF;
162849
162850 --
162851 -- call analytical criteria
162852 --
162853
162854 --
162855 -- call description
162856 --
162857
162858 xla_ae_lines_pkg.SetLineDescription(
162859 p_ae_header_id => l_ae_header_id
162860 ,p_description => Description_126 (
162861 p_application_id => p_application_id
162862 , p_ae_header_id => l_ae_header_id
162863 , p_source_1 => p_source_1
162864 )
162865 );
162866
162867
162868 --
162869 -- call ADRs
162870 -- Bug 4922099
162871 --
162872 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
162873 (NVL(l_actual_upg_option, 'N') = 'O') OR
162874 (NVL(l_enc_upg_option, 'N') = 'O')
162875 )
162876 THEN
162877 NULL;
162878 --
162879 --
162880
162881 l_ccid := AcctDerRule_174(
162882 p_application_id => p_application_id
162883 , p_ae_header_id => l_ae_header_id
162884 , p_source_5 => p_source_5
162885 , p_source_32 => p_source_32
162886 , x_transaction_coa_id => l_adr_transaction_coa_id
162887 , x_accounting_coa_id => l_adr_accounting_coa_id
162888 , x_value_type_code => l_adr_value_type_code
162889 , p_side => 'NA'
162890 );
162891
162892 xla_ae_lines_pkg.set_ccid(
162893 p_code_combination_id => l_ccid
162894 , p_value_type_code => l_adr_value_type_code
162895 , p_transaction_coa_id => l_adr_transaction_coa_id
162896 , p_accounting_coa_id => l_adr_accounting_coa_id
162897 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
162898 , p_adr_type_code => 'S'
162899 , p_component_type => l_component_type
162900 , p_component_code => l_component_code
162901 , p_component_type_code => l_component_type_code
162902 , p_component_appl_id => l_component_appl_id
162903 , p_amb_context_code => l_amb_context_code
162904 , p_side => 'NA'
162905 );
162906
162907
162908 l_segment := AcctDerRule_149(
162909 p_application_id => p_application_id
162910 , p_ae_header_id => l_ae_header_id
162911 , p_source_5 => p_source_5
162912 , p_source_11 => p_source_11
162913 , x_transaction_coa_id => l_adr_transaction_coa_id
162914 , x_accounting_coa_id => l_adr_accounting_coa_id
162915 , x_flexfield_segment_code => l_adr_flexfield_segment_code
162916 , x_flex_value_set_id => l_adr_flex_value_set_id
162917 , x_value_type_code => l_adr_value_type_code
162918 , x_value_combination_id => l_adr_value_combination_id
162919 , x_value_segment_code => l_adr_value_segment_code
162920 , p_side => 'NA'
162921 , p_override_seg_flag => 'Y'
162922 );
162923
162924 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
162925
162926 xla_ae_lines_pkg.set_segment(
162927 p_to_segment_code => 'GL_ACCOUNT'
162928 , p_segment_value => l_segment
162932 , p_transaction_coa_id => l_adr_transaction_coa_id
162929 , p_from_segment_code => l_adr_value_segment_code
162930 , p_from_combination_id => l_adr_value_combination_id
162931 , p_value_type_code => l_adr_value_type_code
162933 , p_accounting_coa_id => l_adr_accounting_coa_id
162934 , p_flexfield_segment_code => l_adr_flexfield_segment_code
162935 , p_flex_value_set_id => l_adr_flex_value_set_id
162936 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
162937 , p_adr_type_code => 'S'
162938 , p_component_type => l_component_type
162939 , p_component_code => l_component_code
162940 , p_component_type_code => l_component_type_code
162941 , p_component_appl_id => l_component_appl_id
162942 , p_amb_context_code => l_amb_context_code
162943 , p_entity_code => 'TRANSACTIONS'
162944 , p_event_class_code => 'TRANSFERS'
162945 , p_side => 'NA'
162946 );
162947
162948 END IF;
162949
162950 l_segment := AcctDerRule_169(
162951 p_application_id => p_application_id
162952 , p_ae_header_id => l_ae_header_id
162953 , p_source_5 => p_source_5
162954 , p_source_31 => p_source_31
162955 , x_transaction_coa_id => l_adr_transaction_coa_id
162956 , x_accounting_coa_id => l_adr_accounting_coa_id
162957 , x_flexfield_segment_code => l_adr_flexfield_segment_code
162958 , x_flex_value_set_id => l_adr_flex_value_set_id
162959 , x_value_type_code => l_adr_value_type_code
162960 , x_value_combination_id => l_adr_value_combination_id
162961 , x_value_segment_code => l_adr_value_segment_code
162962 , p_side => 'NA'
162963 , p_override_seg_flag => 'Y'
162964 );
162965
162966 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
162967
162968 xla_ae_lines_pkg.set_segment(
162969 p_to_segment_code => 'GL_BALANCING'
162970 , p_segment_value => l_segment
162971 , p_from_segment_code => l_adr_value_segment_code
162972 , p_from_combination_id => l_adr_value_combination_id
162973 , p_value_type_code => l_adr_value_type_code
162974 , p_transaction_coa_id => l_adr_transaction_coa_id
162975 , p_accounting_coa_id => l_adr_accounting_coa_id
162976 , p_flexfield_segment_code => l_adr_flexfield_segment_code
162977 , p_flex_value_set_id => l_adr_flex_value_set_id
162978 , p_adr_code => 'FA_EXPENSE_ACCT'
162979 , p_adr_type_code => 'S'
162980 , p_component_type => l_component_type
162981 , p_component_code => l_component_code
162982 , p_component_type_code => l_component_type_code
162983 , p_component_appl_id => l_component_appl_id
162984 , p_amb_context_code => l_amb_context_code
162985 , p_entity_code => 'TRANSACTIONS'
162986 , p_event_class_code => 'TRANSFERS'
162987 , p_side => 'NA'
162988 );
162989
162990 END IF;
162991
162992 --
162993 --
162994 END IF;
162995 --
162996 -- Bug 4922099
162997 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
162998 (NVL(l_enc_upg_option, 'N') = 'O')
162999 ) AND
163000 (l_bflow_method_code = 'PRIOR_ENTRY')
163001 )
163002 THEN
163003 IF
163004 --
163005 1 = 2
163006 --
163007 THEN
163008 xla_accounting_err_pkg.build_message
163009 (p_appli_s_name => 'XLA'
163010 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
163011 ,p_token_1 => 'LINE_NUMBER'
163012 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
163013 ,p_token_2 => 'LINE_TYPE_NAME'
163014 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
163015 l_component_type
163016 ,l_component_code
163017 ,l_component_type_code
163018 ,l_component_appl_id
163019 ,l_amb_context_code
163020 ,l_entity_code
163021 ,l_event_class_code
163022 )
163023 ,p_token_3 => 'OWNER'
163024 ,p_value_3 => xla_lookups_pkg.get_meaning(
163025 p_lookup_type => 'XLA_OWNER_TYPE'
163026 ,p_lookup_code => l_component_type_code
163027 )
163028 ,p_token_4 => 'PRODUCT_NAME'
163032 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
163029 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
163030 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
163031 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
163033 ,p_ae_header_id => NULL
163034 );
163035
163036 IF (C_LEVEL_ERROR>= g_log_level) THEN
163037 trace
163038 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
163039 ,p_level => C_LEVEL_ERROR
163040 ,p_module => l_log_module);
163041 END IF;
163042 END IF;
163043 END IF;
163044 --
163045 --
163046 ------------------------------------------------------------------------------------------------
163047 -- 4219869 Business Flow
163048 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
163049 -- Prior Entry. Currently, the following code is always generated.
163050 ------------------------------------------------------------------------------------------------
163051 XLA_AE_LINES_PKG.ValidateCurrentLine;
163052
163053 ------------------------------------------------------------------------------------
163054 -- 4219869 Business Flow
163055 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
163056 ------------------------------------------------------------------------------------
163057 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
163058
163059 ----------------------------------------------------------------------------------
163060 -- 4219869 Business Flow
163061 -- Update journal entry status -- Need to generate this within IF <condition>
163062 ----------------------------------------------------------------------------------
163063 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
163064 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
163065 ,p_balance_type_code => l_balance_type_code
163066 );
163067
163068 -------------------------------------------------------------------------------------------
163069 -- 4262811 - Generate the Accrual Reversal lines
163070 -------------------------------------------------------------------------------------------
163071 BEGIN
163072 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
163073 (g_array_event(p_event_id).array_value_num('header_index'));
163074 IF l_acc_rev_flag IS NULL THEN
163075 l_acc_rev_flag := 'N';
163076 END IF;
163077 EXCEPTION
163078 WHEN OTHERS THEN
163079 l_acc_rev_flag := 'N';
163080 END;
163081 --
163082 IF (l_acc_rev_flag = 'Y') THEN
163083
163084 -- 4645092 ------------------------------------------------------------------------------
163085 -- To allow MPA report to determine if it should generate report process
163086 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
163087 ------------------------------------------------------------------------------------------
163088
163089 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
163090 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
163091 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
163092 -- call ADRs
163093 -- Bug 4922099
163094 --
163095 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
163096 (NVL(l_actual_upg_option, 'N') = 'O') OR
163097 (NVL(l_enc_upg_option, 'N') = 'O')
163098 )
163099 THEN
163100 NULL;
163101 --
163102 --
163103
163104 l_ccid := AcctDerRule_174(
163105 p_application_id => p_application_id
163106 , p_ae_header_id => l_ae_header_id
163107 , p_source_5 => p_source_5
163108 , p_source_32 => p_source_32
163109 , x_transaction_coa_id => l_adr_transaction_coa_id
163110 , x_accounting_coa_id => l_adr_accounting_coa_id
163111 , x_value_type_code => l_adr_value_type_code
163112 , p_side => 'NA'
163113 );
163114
163115 xla_ae_lines_pkg.set_ccid(
163116 p_code_combination_id => l_ccid
163117 , p_value_type_code => l_adr_value_type_code
163118 , p_transaction_coa_id => l_adr_transaction_coa_id
163119 , p_accounting_coa_id => l_adr_accounting_coa_id
163120 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
163121 , p_adr_type_code => 'S'
163122 , p_component_type => l_component_type
163123 , p_component_code => l_component_code
163124 , p_component_type_code => l_component_type_code
163125 , p_component_appl_id => l_component_appl_id
163126 , p_amb_context_code => l_amb_context_code
163127 , p_side => 'NA'
163128 );
163129
163130
163131 l_segment := AcctDerRule_149(
163132 p_application_id => p_application_id
163133 , p_ae_header_id => l_ae_header_id
163134 , p_source_5 => p_source_5
163135 , p_source_11 => p_source_11
163136 , x_transaction_coa_id => l_adr_transaction_coa_id
163137 , x_accounting_coa_id => l_adr_accounting_coa_id
163141 , x_value_combination_id => l_adr_value_combination_id
163138 , x_flexfield_segment_code => l_adr_flexfield_segment_code
163139 , x_flex_value_set_id => l_adr_flex_value_set_id
163140 , x_value_type_code => l_adr_value_type_code
163142 , x_value_segment_code => l_adr_value_segment_code
163143 , p_side => 'NA'
163144 , p_override_seg_flag => 'Y'
163145 );
163146
163147 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
163148
163149 xla_ae_lines_pkg.set_segment(
163150 p_to_segment_code => 'GL_ACCOUNT'
163151 , p_segment_value => l_segment
163152 , p_from_segment_code => l_adr_value_segment_code
163153 , p_from_combination_id => l_adr_value_combination_id
163154 , p_value_type_code => l_adr_value_type_code
163155 , p_transaction_coa_id => l_adr_transaction_coa_id
163156 , p_accounting_coa_id => l_adr_accounting_coa_id
163157 , p_flexfield_segment_code => l_adr_flexfield_segment_code
163158 , p_flex_value_set_id => l_adr_flex_value_set_id
163159 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
163160 , p_adr_type_code => 'S'
163161 , p_component_type => l_component_type
163162 , p_component_code => l_component_code
163163 , p_component_type_code => l_component_type_code
163164 , p_component_appl_id => l_component_appl_id
163165 , p_amb_context_code => l_amb_context_code
163166 , p_entity_code => 'TRANSACTIONS'
163167 , p_event_class_code => 'TRANSFERS'
163168 , p_side => 'NA'
163169 );
163170
163171 END IF;
163172
163173 l_segment := AcctDerRule_169(
163174 p_application_id => p_application_id
163175 , p_ae_header_id => l_ae_header_id
163176 , p_source_5 => p_source_5
163177 , p_source_31 => p_source_31
163178 , x_transaction_coa_id => l_adr_transaction_coa_id
163179 , x_accounting_coa_id => l_adr_accounting_coa_id
163180 , x_flexfield_segment_code => l_adr_flexfield_segment_code
163181 , x_flex_value_set_id => l_adr_flex_value_set_id
163182 , x_value_type_code => l_adr_value_type_code
163183 , x_value_combination_id => l_adr_value_combination_id
163184 , x_value_segment_code => l_adr_value_segment_code
163185 , p_side => 'NA'
163186 , p_override_seg_flag => 'Y'
163187 );
163188
163189 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
163190
163191 xla_ae_lines_pkg.set_segment(
163192 p_to_segment_code => 'GL_BALANCING'
163193 , p_segment_value => l_segment
163194 , p_from_segment_code => l_adr_value_segment_code
163195 , p_from_combination_id => l_adr_value_combination_id
163196 , p_value_type_code => l_adr_value_type_code
163197 , p_transaction_coa_id => l_adr_transaction_coa_id
163198 , p_accounting_coa_id => l_adr_accounting_coa_id
163199 , p_flexfield_segment_code => l_adr_flexfield_segment_code
163200 , p_flex_value_set_id => l_adr_flex_value_set_id
163201 , p_adr_code => 'FA_EXPENSE_ACCT'
163202 , p_adr_type_code => 'S'
163203 , p_component_type => l_component_type
163204 , p_component_code => l_component_code
163205 , p_component_type_code => l_component_type_code
163206 , p_component_appl_id => l_component_appl_id
163207 , p_amb_context_code => l_amb_context_code
163208 , p_entity_code => 'TRANSACTIONS'
163209 , p_event_class_code => 'TRANSFERS'
163210 , p_side => 'NA'
163211 );
163212
163213 END IF;
163214
163215 --
163216 --
163217 END IF;
163218
163219 --
163220 -- Update the line information that should be overwritten
163221 --
163222 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
163223 p_header_num => 1);
163224 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
163225
163226 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
163227
163228 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
163229 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
163230 END IF;
163231
163232 --
163233 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
163234 --
163235 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
163236 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
163237 ELSE
163238 ---------------------------------------------------------------------------------------------------
163239 -- 4262811a Switch Sign
163240 ---------------------------------------------------------------------------------------------------
163241 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
163245 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
163242 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
163243 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
163244 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
163246 -- 5132302
163247 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
163248 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
163249
163250 END IF;
163251
163252 -- 4955764
163253 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
163254 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
163255
163256
163257 XLA_AE_LINES_PKG.ValidateCurrentLine;
163258 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
163259
163260 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
163261 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
163262 ,p_balance_type_code => l_balance_type_code);
163263
163264 END IF;
163265
163266 -----------------------------------------------------------------------------------------
163267 -- 4262811 Multiperiod Accounting
163268 -----------------------------------------------------------------------------------------
163269 -- No MPA option is assigned.
163270
163271
163272 END IF;
163273 END IF;
163274 --
163275
163276 --
163277 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
163278 trace
163279 (p_msg => 'END of AcctLineType_393'
163280 ,p_level => C_LEVEL_PROCEDURE
163281 ,p_module => l_log_module);
163282 END IF;
163283 --
163284 EXCEPTION
163285 WHEN xla_exceptions_pkg.application_exception THEN
163286 RAISE;
163287 WHEN OTHERS THEN
163288 xla_exceptions_pkg.raise_message
163289 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_393');
163290 END AcctLineType_393;
163291 --
163292
163293 ---------------------------------------
163294 --
163295 -- PRIVATE FUNCTION
163296 -- AcctLineType_394
163297 --
163298 ---------------------------------------
163299 PROCEDURE AcctLineType_394 (
163300 p_application_id IN NUMBER
163301 ,p_event_id IN NUMBER
163302 ,p_calculate_acctd_flag IN VARCHAR2
163303 ,p_calculate_g_l_flag IN VARCHAR2
163304 ,p_actual_flag IN OUT VARCHAR2
163305 ,p_balance_type_code OUT VARCHAR2
163306 ,p_gain_or_loss_ref OUT VARCHAR2
163307
163308 --Period Close Date
163309 , p_source_1 IN DATE
163310 --Generated Code Combination Identifier
163311 , p_source_5 IN NUMBER
163312 --Expense Account Code Combination Identifier
163313 , p_source_31 IN NUMBER
163314 --Adjustment Type
163315 , p_source_48 IN VARCHAR2
163316 --Transaction Header Identifier
163317 , p_source_49 IN NUMBER
163318 --Adjustment Line Identifier
163319 , p_source_50 IN NUMBER
163320 --Distribution Type Code
163321 , p_source_51 IN VARCHAR2
163322 --Entered Amount
163323 , p_source_52 IN NUMBER
163324 --Currency Code
163325 , p_source_53 IN VARCHAR2
163326 --Source Destination Code
163327 , p_source_55 IN VARCHAR2
163328 )
163329 IS
163330
163331 l_component_type VARCHAR2(80);
163332 l_component_code VARCHAR2(30);
163333 l_component_type_code VARCHAR2(1);
163334 l_component_appl_id INTEGER;
163335 l_amb_context_code VARCHAR2(30);
163336 l_entity_code VARCHAR2(30);
163337 l_event_class_code VARCHAR2(30);
163338 l_ae_header_id NUMBER;
163339 l_event_type_code VARCHAR2(30);
163340 l_line_definition_code VARCHAR2(30);
163341 l_line_definition_owner_code VARCHAR2(1);
163342 --
163343 -- adr variables
163344 l_segment VARCHAR2(30);
163345 l_ccid NUMBER;
163346 l_adr_transaction_coa_id NUMBER;
163347 l_adr_accounting_coa_id NUMBER;
163348 l_adr_flexfield_segment_code VARCHAR2(30);
163349 l_adr_flex_value_set_id NUMBER;
163350 l_adr_value_type_code VARCHAR2(30);
163351 l_adr_value_combination_id NUMBER;
163352 l_adr_value_segment_code VARCHAR2(30);
163353
163354 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
163355 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
163356 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
163357 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
163358
163359 -- 4262811 Variables ------------------------------------------------------------------------------------------
163360 l_entered_amt_idx NUMBER;
163361 l_accted_amt_idx NUMBER;
163362 l_acc_rev_flag VARCHAR2(1);
163363 l_accrual_line_num NUMBER;
163364 l_tmp_amt NUMBER;
163365 l_acc_rev_natural_side_code VARCHAR2(1);
163366
163367 l_num_entries NUMBER;
163368 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
163369 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
163373 l_recog_line_2 NUMBER;
163370 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
163371 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
163372 l_recog_line_1 NUMBER;
163374
163375 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
163376 l_bflow_applied_to_amt NUMBER; -- 5132302
163377 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
163378
163379 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
163380
163381 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
163382 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
163383
163384 ---------------------------------------------------------------------------------------------------------------
163385
163386
163387 --
163388 -- bulk performance
163389 --
163390 l_balance_type_code VARCHAR2(1);
163391 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
163392 l_log_module VARCHAR2(240);
163393
163394 --
163395 -- Upgrade strategy
163396 --
163397 l_actual_upg_option VARCHAR2(1);
163398 l_enc_upg_option VARCHAR2(1);
163399
163400 --
163401 BEGIN
163402 --
163403 IF g_log_enabled THEN
163404 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_394';
163405 END IF;
163406 --
163407 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
163408
163409 trace
163410 (p_msg => 'BEGIN of AcctLineType_394'
163411 ,p_level => C_LEVEL_PROCEDURE
163412 ,p_module => l_log_module);
163413
163414 END IF;
163415 --
163416 l_component_type := 'AMB_JLT';
163417 l_component_code := 'FA_TRANSFER_SOURCE_DEPRN_EXP';
163418 l_component_type_code := 'S';
163419 l_component_appl_id := 140;
163420 l_amb_context_code := 'DEFAULT';
163421 l_entity_code := 'TRANSACTIONS';
163422 l_event_class_code := 'TRANSFERS';
163423 l_event_type_code := 'TRANSFERS_ALL';
163424 l_line_definition_owner_code := 'S';
163425 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
163426 --
163427 l_balance_type_code := 'A';
163428 l_segment := NULL;
163429 l_ccid := NULL;
163430 l_adr_transaction_coa_id := NULL;
163431 l_adr_accounting_coa_id := NULL;
163432 l_adr_flexfield_segment_code := NULL;
163433 l_adr_flex_value_set_id := NULL;
163434 l_adr_value_type_code := NULL;
163435 l_adr_value_combination_id := NULL;
163436 l_adr_value_segment_code := NULL;
163437
163438 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
163439 l_bflow_class_code := ''; -- 4219869 Business Flow
163440 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
163441 l_budgetary_control_flag := 'N';
163442
163443 l_bflow_applied_to_amt_idx := NULL; -- 5132302
163444 l_bflow_applied_to_amt := NULL; -- 5132302
163445 l_entered_amt_idx := NULL; -- 4262811
163446 l_accted_amt_idx := NULL; -- 4262811
163447 l_acc_rev_flag := NULL; -- 4262811
163448 l_accrual_line_num := NULL; -- 4262811
163449 l_tmp_amt := NULL; -- 4262811
163450 --
163451
163452 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
163453 l_balance_type_code <> 'B' THEN
163454 IF NVL(p_source_48,'
163455 ') = 'EXPENSE' AND
163456 NVL(p_source_55,'
163457 ') = 'SOURCE'
163458 THEN
163459
163460 --
163461 XLA_AE_LINES_PKG.SetNewLine;
163462
163463 p_balance_type_code := l_balance_type_code;
163464 -- set the flag so later we will know whether the gain loss line needs to be created
163465
163466 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
163467 p_actual_flag :='A';
163468 END IF;
163469
163470 --
163471 -- bulk performance
163472 --
163473 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
163474 p_header_num => 0); -- 4262811
163475 --
163476 -- set accounting line options
163477 --
163478 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
163479 p_natural_side_code => 'C'
163480 , p_gain_or_loss_flag => 'N'
163481 , p_gl_transfer_mode_code => 'S'
163482 , p_acct_entry_type_code => 'A'
163483 , p_switch_side_flag => 'Y'
163484 , p_merge_duplicate_code => 'N'
163485 );
163486 --
163487 l_acc_rev_natural_side_code := 'D'; -- 4262811
163488 --
163489 --
163490 -- set accounting line type info
163491 --
163492 xla_ae_lines_pkg.SetAcctLineType
163493 (p_component_type => l_component_type
163494 ,p_event_type_code => l_event_type_code
163495 ,p_line_definition_owner_code => l_line_definition_owner_code
163496 ,p_line_definition_code => l_line_definition_code
163497 ,p_accounting_line_code => l_component_code
163498 ,p_accounting_line_type_code => l_component_type_code
163499 ,p_accounting_line_appl_id => l_component_appl_id
163500 ,p_amb_context_code => l_amb_context_code
163501 ,p_entity_code => l_entity_code
163502 ,p_event_class_code => l_event_class_code);
163506 xla_ae_lines_pkg.SetAcctClass(
163503 --
163504 -- set accounting class
163505 --
163507 p_accounting_class_code => 'EXPENSE'
163508 , p_ae_header_id => l_ae_header_id
163509 );
163510
163511 --
163512 -- set rounding class
163513 --
163514 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
163515 'EXPENSE';
163516
163517 --
163518 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
163519 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
163520 --
163521 -- bulk performance
163522 --
163523 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
163524
163525 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
163526 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
163527
163528 -- 4955764
163529 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
163530 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
163531
163532 -- 4458381 Public Sector Enh
163533
163534 --
163535 -- set accounting attributes for the line type
163536 --
163537 l_entered_amt_idx := 4;
163538 l_accted_amt_idx := 6;
163539 l_bflow_applied_to_amt_idx := NULL; -- 5132302
163540 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
163541 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
163542 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
163543 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
163544 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
163545 l_rec_acct_attrs.array_char_value(3) := p_source_51;
163546 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
163547 l_rec_acct_attrs.array_num_value(4) := p_source_52;
163548 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
163549 l_rec_acct_attrs.array_char_value(5) := p_source_53;
163550 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
163551 l_rec_acct_attrs.array_num_value(6) := p_source_52;
163552
163553 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
163554 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
163555
163556 ---------------------------------------------------------------------------------------------------------------
163557 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
163558 ---------------------------------------------------------------------------------------------------------------
163559 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
163560
163561 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
163562 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
163563
163564 IF xla_accounting_cache_pkg.GetValueChar
163565 (p_source_code => 'LEDGER_CATEGORY_CODE'
163566 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
163567 AND l_bflow_method_code = 'PRIOR_ENTRY'
163568 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
163569 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
163570 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
163571 )
163572 THEN
163573 xla_ae_lines_pkg.BflowUpgEntry
163574 (p_business_method_code => l_bflow_method_code
163575 ,p_business_class_code => l_bflow_class_code
163576 ,p_balance_type => l_balance_type_code);
163577 ELSE
163578 NULL;
163579 -- No business flow processing for business flow method of NONE.
163580 END IF;
163581
163582 --
163583 -- call analytical criteria
163584 --
163585
163586 --
163587 -- call description
163588 --
163589
163590 xla_ae_lines_pkg.SetLineDescription(
163591 p_ae_header_id => l_ae_header_id
163592 ,p_description => Description_127 (
163593 p_application_id => p_application_id
163594 , p_ae_header_id => l_ae_header_id
163595 , p_source_1 => p_source_1
163596 )
163597 );
163598
163599
163600 --
163601 -- call ADRs
163602 -- Bug 4922099
163603 --
163604 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
163605 (NVL(l_actual_upg_option, 'N') = 'O') OR
163606 (NVL(l_enc_upg_option, 'N') = 'O')
163607 )
163608 THEN
163609 NULL;
163610 --
163611 --
163612
163613 l_ccid := AcctDerRule_176(
163614 p_application_id => p_application_id
163615 , p_ae_header_id => l_ae_header_id
163616 , p_source_5 => p_source_5
163617 , p_source_31 => p_source_31
163618 , x_transaction_coa_id => l_adr_transaction_coa_id
163619 , x_accounting_coa_id => l_adr_accounting_coa_id
163620 , x_value_type_code => l_adr_value_type_code
163621 , p_side => 'NA'
163622 );
163623
163624 xla_ae_lines_pkg.set_ccid(
163625 p_code_combination_id => l_ccid
163626 , p_value_type_code => l_adr_value_type_code
163630 , p_adr_type_code => 'S'
163627 , p_transaction_coa_id => l_adr_transaction_coa_id
163628 , p_accounting_coa_id => l_adr_accounting_coa_id
163629 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
163631 , p_component_type => l_component_type
163632 , p_component_code => l_component_code
163633 , p_component_type_code => l_component_type_code
163634 , p_component_appl_id => l_component_appl_id
163635 , p_amb_context_code => l_amb_context_code
163636 , p_side => 'NA'
163637 );
163638
163639
163640 --
163641 --
163642 END IF;
163643 --
163644 -- Bug 4922099
163645 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
163646 (NVL(l_enc_upg_option, 'N') = 'O')
163647 ) AND
163648 (l_bflow_method_code = 'PRIOR_ENTRY')
163649 )
163650 THEN
163651 IF
163652 --
163653 1 = 2
163654 --
163655 THEN
163656 xla_accounting_err_pkg.build_message
163657 (p_appli_s_name => 'XLA'
163658 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
163659 ,p_token_1 => 'LINE_NUMBER'
163660 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
163661 ,p_token_2 => 'LINE_TYPE_NAME'
163662 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
163663 l_component_type
163664 ,l_component_code
163665 ,l_component_type_code
163666 ,l_component_appl_id
163667 ,l_amb_context_code
163668 ,l_entity_code
163669 ,l_event_class_code
163670 )
163671 ,p_token_3 => 'OWNER'
163672 ,p_value_3 => xla_lookups_pkg.get_meaning(
163673 p_lookup_type => 'XLA_OWNER_TYPE'
163674 ,p_lookup_code => l_component_type_code
163675 )
163676 ,p_token_4 => 'PRODUCT_NAME'
163677 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
163678 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
163679 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
163680 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
163681 ,p_ae_header_id => NULL
163682 );
163683
163684 IF (C_LEVEL_ERROR>= g_log_level) THEN
163685 trace
163686 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
163687 ,p_level => C_LEVEL_ERROR
163688 ,p_module => l_log_module);
163689 END IF;
163690 END IF;
163691 END IF;
163692 --
163693 --
163694 ------------------------------------------------------------------------------------------------
163695 -- 4219869 Business Flow
163696 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
163697 -- Prior Entry. Currently, the following code is always generated.
163698 ------------------------------------------------------------------------------------------------
163699 XLA_AE_LINES_PKG.ValidateCurrentLine;
163700
163701 ------------------------------------------------------------------------------------
163702 -- 4219869 Business Flow
163703 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
163704 ------------------------------------------------------------------------------------
163705 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
163706
163707 ----------------------------------------------------------------------------------
163708 -- 4219869 Business Flow
163709 -- Update journal entry status -- Need to generate this within IF <condition>
163710 ----------------------------------------------------------------------------------
163711 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
163712 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
163713 ,p_balance_type_code => l_balance_type_code
163714 );
163715
163716 -------------------------------------------------------------------------------------------
163717 -- 4262811 - Generate the Accrual Reversal lines
163718 -------------------------------------------------------------------------------------------
163719 BEGIN
163720 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
163724 END IF;
163721 (g_array_event(p_event_id).array_value_num('header_index'));
163722 IF l_acc_rev_flag IS NULL THEN
163723 l_acc_rev_flag := 'N';
163725 EXCEPTION
163726 WHEN OTHERS THEN
163727 l_acc_rev_flag := 'N';
163728 END;
163729 --
163730 IF (l_acc_rev_flag = 'Y') THEN
163731
163732 -- 4645092 ------------------------------------------------------------------------------
163733 -- To allow MPA report to determine if it should generate report process
163734 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
163735 ------------------------------------------------------------------------------------------
163736
163737 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
163738 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
163739 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
163740 -- call ADRs
163741 -- Bug 4922099
163742 --
163743 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
163744 (NVL(l_actual_upg_option, 'N') = 'O') OR
163745 (NVL(l_enc_upg_option, 'N') = 'O')
163746 )
163747 THEN
163748 NULL;
163749 --
163750 --
163751
163752 l_ccid := AcctDerRule_176(
163753 p_application_id => p_application_id
163754 , p_ae_header_id => l_ae_header_id
163755 , p_source_5 => p_source_5
163756 , p_source_31 => p_source_31
163757 , x_transaction_coa_id => l_adr_transaction_coa_id
163758 , x_accounting_coa_id => l_adr_accounting_coa_id
163759 , x_value_type_code => l_adr_value_type_code
163760 , p_side => 'NA'
163761 );
163762
163763 xla_ae_lines_pkg.set_ccid(
163764 p_code_combination_id => l_ccid
163765 , p_value_type_code => l_adr_value_type_code
163766 , p_transaction_coa_id => l_adr_transaction_coa_id
163767 , p_accounting_coa_id => l_adr_accounting_coa_id
163768 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
163769 , p_adr_type_code => 'S'
163770 , p_component_type => l_component_type
163771 , p_component_code => l_component_code
163772 , p_component_type_code => l_component_type_code
163773 , p_component_appl_id => l_component_appl_id
163774 , p_amb_context_code => l_amb_context_code
163775 , p_side => 'NA'
163776 );
163777
163778
163779 --
163780 --
163781 END IF;
163782
163783 --
163784 -- Update the line information that should be overwritten
163785 --
163786 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
163787 p_header_num => 1);
163788 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
163789
163790 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
163791
163792 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
163793 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
163794 END IF;
163795
163796 --
163797 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
163798 --
163799 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
163800 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
163801 ELSE
163802 ---------------------------------------------------------------------------------------------------
163803 -- 4262811a Switch Sign
163804 ---------------------------------------------------------------------------------------------------
163805 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
163806 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
163807 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
163808 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
163809 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
163810 -- 5132302
163811 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
163812 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
163813
163814 END IF;
163815
163816 -- 4955764
163817 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
163818 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
163819
163820
163821 XLA_AE_LINES_PKG.ValidateCurrentLine;
163822 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
163823
163824 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
163825 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
163826 ,p_balance_type_code => l_balance_type_code);
163827
163828 END IF;
163829
163830 -----------------------------------------------------------------------------------------
163831 -- 4262811 Multiperiod Accounting
163835
163832 -----------------------------------------------------------------------------------------
163833 -- No MPA option is assigned.
163834
163836 END IF;
163837 END IF;
163838 --
163839
163840 --
163841 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
163842 trace
163843 (p_msg => 'END of AcctLineType_394'
163844 ,p_level => C_LEVEL_PROCEDURE
163845 ,p_module => l_log_module);
163846 END IF;
163847 --
163848 EXCEPTION
163849 WHEN xla_exceptions_pkg.application_exception THEN
163850 RAISE;
163851 WHEN OTHERS THEN
163852 xla_exceptions_pkg.raise_message
163853 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_394');
163854 END AcctLineType_394;
163855 --
163856
163857 ---------------------------------------
163858 --
163859 -- PRIVATE FUNCTION
163860 -- AcctLineType_395
163861 --
163862 ---------------------------------------
163863 PROCEDURE AcctLineType_395 (
163864 p_application_id IN NUMBER
163865 ,p_event_id IN NUMBER
163866 ,p_calculate_acctd_flag IN VARCHAR2
163867 ,p_calculate_g_l_flag IN VARCHAR2
163868 ,p_actual_flag IN OUT VARCHAR2
163869 ,p_balance_type_code OUT VARCHAR2
163870 ,p_gain_or_loss_ref OUT VARCHAR2
163871
163872 --Period Close Date
163873 , p_source_1 IN DATE
163874 --Generated Code Combination Identifier
163875 , p_source_5 IN NUMBER
163876 --Depreciation Reserve Account
163877 , p_source_12 IN VARCHAR2
163878 --Generated Offset Code Combination Identifier
163879 , p_source_19 IN NUMBER
163880 --Expense Account Code Combination Identifier
163881 , p_source_31 IN NUMBER
163882 --Default Code Combination Identifier
163883 , p_source_32 IN NUMBER
163884 --Adjustment Type
163885 , p_source_48 IN VARCHAR2
163886 --Transaction Header Identifier
163887 , p_source_49 IN NUMBER
163888 --Adjustment Line Identifier
163889 , p_source_50 IN NUMBER
163890 --Distribution Type Code
163891 , p_source_51 IN VARCHAR2
163892 --Entered Amount
163893 , p_source_52 IN NUMBER
163894 --Currency Code
163895 , p_source_53 IN VARCHAR2
163896 --Source Destination Code
163897 , p_source_55 IN VARCHAR2
163898 )
163899 IS
163900
163901 l_component_type VARCHAR2(80);
163902 l_component_code VARCHAR2(30);
163903 l_component_type_code VARCHAR2(1);
163904 l_component_appl_id INTEGER;
163905 l_amb_context_code VARCHAR2(30);
163906 l_entity_code VARCHAR2(30);
163907 l_event_class_code VARCHAR2(30);
163908 l_ae_header_id NUMBER;
163909 l_event_type_code VARCHAR2(30);
163910 l_line_definition_code VARCHAR2(30);
163911 l_line_definition_owner_code VARCHAR2(1);
163912 --
163913 -- adr variables
163914 l_segment VARCHAR2(30);
163915 l_ccid NUMBER;
163916 l_adr_transaction_coa_id NUMBER;
163917 l_adr_accounting_coa_id NUMBER;
163918 l_adr_flexfield_segment_code VARCHAR2(30);
163919 l_adr_flex_value_set_id NUMBER;
163920 l_adr_value_type_code VARCHAR2(30);
163921 l_adr_value_combination_id NUMBER;
163922 l_adr_value_segment_code VARCHAR2(30);
163923
163924 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
163925 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
163926 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
163927 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
163928
163929 -- 4262811 Variables ------------------------------------------------------------------------------------------
163930 l_entered_amt_idx NUMBER;
163931 l_accted_amt_idx NUMBER;
163932 l_acc_rev_flag VARCHAR2(1);
163933 l_accrual_line_num NUMBER;
163934 l_tmp_amt NUMBER;
163935 l_acc_rev_natural_side_code VARCHAR2(1);
163936
163937 l_num_entries NUMBER;
163938 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
163939 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
163940 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
163941 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
163942 l_recog_line_1 NUMBER;
163943 l_recog_line_2 NUMBER;
163944
163945 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
163946 l_bflow_applied_to_amt NUMBER; -- 5132302
163947 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
163948
163949 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
163950
163951 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
163952 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
163953
163954 ---------------------------------------------------------------------------------------------------------------
163955
163956
163957 --
163958 -- bulk performance
163959 --
163960 l_balance_type_code VARCHAR2(1);
163961 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
163962 l_log_module VARCHAR2(240);
163963
163964 --
163965 -- Upgrade strategy
163966 --
163970 --
163967 l_actual_upg_option VARCHAR2(1);
163968 l_enc_upg_option VARCHAR2(1);
163969
163971 BEGIN
163972 --
163973 IF g_log_enabled THEN
163974 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_395';
163975 END IF;
163976 --
163977 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
163978
163979 trace
163980 (p_msg => 'BEGIN of AcctLineType_395'
163981 ,p_level => C_LEVEL_PROCEDURE
163982 ,p_module => l_log_module);
163983
163984 END IF;
163985 --
163986 l_component_type := 'AMB_JLT';
163987 l_component_code := 'FA_TRANSFER_SOURCE_DEPRN_RES';
163988 l_component_type_code := 'S';
163989 l_component_appl_id := 140;
163990 l_amb_context_code := 'DEFAULT';
163991 l_entity_code := 'TRANSACTIONS';
163992 l_event_class_code := 'TRANSFERS';
163993 l_event_type_code := 'TRANSFERS_ALL';
163994 l_line_definition_owner_code := 'S';
163995 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
163996 --
163997 l_balance_type_code := 'A';
163998 l_segment := NULL;
163999 l_ccid := NULL;
164000 l_adr_transaction_coa_id := NULL;
164001 l_adr_accounting_coa_id := NULL;
164002 l_adr_flexfield_segment_code := NULL;
164003 l_adr_flex_value_set_id := NULL;
164004 l_adr_value_type_code := NULL;
164005 l_adr_value_combination_id := NULL;
164006 l_adr_value_segment_code := NULL;
164007
164008 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
164009 l_bflow_class_code := ''; -- 4219869 Business Flow
164010 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
164011 l_budgetary_control_flag := 'N';
164012
164013 l_bflow_applied_to_amt_idx := NULL; -- 5132302
164014 l_bflow_applied_to_amt := NULL; -- 5132302
164015 l_entered_amt_idx := NULL; -- 4262811
164016 l_accted_amt_idx := NULL; -- 4262811
164017 l_acc_rev_flag := NULL; -- 4262811
164018 l_accrual_line_num := NULL; -- 4262811
164019 l_tmp_amt := NULL; -- 4262811
164020 --
164021
164022 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
164023 l_balance_type_code <> 'B' THEN
164024 IF (NVL(p_source_48,'
164025 ') = 'RESERVE' OR
164026 NVL(p_source_48,'
164027 ') = 'EXPENSE') AND
164028 NVL(p_source_55,'
164029 ') = 'SOURCE'
164030 THEN
164031
164032 --
164033 XLA_AE_LINES_PKG.SetNewLine;
164034
164035 p_balance_type_code := l_balance_type_code;
164036 -- set the flag so later we will know whether the gain loss line needs to be created
164037
164038 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
164039 p_actual_flag :='A';
164040 END IF;
164041
164042 --
164043 -- bulk performance
164044 --
164045 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
164046 p_header_num => 0); -- 4262811
164047 --
164048 -- set accounting line options
164049 --
164050 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
164051 p_natural_side_code => 'D'
164052 , p_gain_or_loss_flag => 'N'
164053 , p_gl_transfer_mode_code => 'S'
164054 , p_acct_entry_type_code => 'A'
164055 , p_switch_side_flag => 'Y'
164056 , p_merge_duplicate_code => 'N'
164057 );
164058 --
164059 l_acc_rev_natural_side_code := 'C'; -- 4262811
164060 --
164061 --
164062 -- set accounting line type info
164063 --
164064 xla_ae_lines_pkg.SetAcctLineType
164065 (p_component_type => l_component_type
164066 ,p_event_type_code => l_event_type_code
164067 ,p_line_definition_owner_code => l_line_definition_owner_code
164068 ,p_line_definition_code => l_line_definition_code
164069 ,p_accounting_line_code => l_component_code
164070 ,p_accounting_line_type_code => l_component_type_code
164071 ,p_accounting_line_appl_id => l_component_appl_id
164072 ,p_amb_context_code => l_amb_context_code
164073 ,p_entity_code => l_entity_code
164074 ,p_event_class_code => l_event_class_code);
164075 --
164076 -- set accounting class
164077 --
164078 xla_ae_lines_pkg.SetAcctClass(
164079 p_accounting_class_code => 'ASSET'
164080 , p_ae_header_id => l_ae_header_id
164081 );
164082
164083 --
164084 -- set rounding class
164085 --
164086 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
164087 'ASSET';
164088
164089 --
164090 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
164091 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
164092 --
164093 -- bulk performance
164094 --
164095 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
164096
164097 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
164098 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
164099
164100 -- 4955764
164101 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
164105
164102 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
164103
164104 -- 4458381 Public Sector Enh
164106 --
164107 -- set accounting attributes for the line type
164108 --
164109 l_entered_amt_idx := 4;
164110 l_accted_amt_idx := 6;
164111 l_bflow_applied_to_amt_idx := NULL; -- 5132302
164112 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
164113 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
164114 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
164115 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
164116 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
164117 l_rec_acct_attrs.array_char_value(3) := p_source_51;
164118 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
164119 l_rec_acct_attrs.array_num_value(4) := p_source_52;
164120 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
164121 l_rec_acct_attrs.array_char_value(5) := p_source_53;
164122 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
164123 l_rec_acct_attrs.array_num_value(6) := p_source_52;
164124
164125 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
164126 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
164127
164128 ---------------------------------------------------------------------------------------------------------------
164129 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
164130 ---------------------------------------------------------------------------------------------------------------
164131 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
164132
164133 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
164134 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
164135
164136 IF xla_accounting_cache_pkg.GetValueChar
164137 (p_source_code => 'LEDGER_CATEGORY_CODE'
164138 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
164139 AND l_bflow_method_code = 'PRIOR_ENTRY'
164140 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
164141 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
164142 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
164143 )
164144 THEN
164145 xla_ae_lines_pkg.BflowUpgEntry
164146 (p_business_method_code => l_bflow_method_code
164147 ,p_business_class_code => l_bflow_class_code
164148 ,p_balance_type => l_balance_type_code);
164149 ELSE
164150 NULL;
164151 -- No business flow processing for business flow method of NONE.
164152 END IF;
164153
164154 --
164155 -- call analytical criteria
164156 --
164157
164158 --
164159 -- call description
164160 --
164161
164162 xla_ae_lines_pkg.SetLineDescription(
164163 p_ae_header_id => l_ae_header_id
164164 ,p_description => Description_130 (
164165 p_application_id => p_application_id
164166 , p_ae_header_id => l_ae_header_id
164167 , p_source_1 => p_source_1
164168 )
164169 );
164170
164171
164172 --
164173 -- call ADRs
164174 -- Bug 4922099
164175 --
164176 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
164177 (NVL(l_actual_upg_option, 'N') = 'O') OR
164178 (NVL(l_enc_upg_option, 'N') = 'O')
164179 )
164180 THEN
164181 NULL;
164182 --
164183 --
164184
164185 l_ccid := AcctDerRule_175(
164186 p_application_id => p_application_id
164187 , p_ae_header_id => l_ae_header_id
164188 , p_source_5 => p_source_5
164189 , p_source_19 => p_source_19
164190 , p_source_32 => p_source_32
164191 , x_transaction_coa_id => l_adr_transaction_coa_id
164192 , x_accounting_coa_id => l_adr_accounting_coa_id
164193 , x_value_type_code => l_adr_value_type_code
164194 , p_side => 'NA'
164195 );
164196
164197 xla_ae_lines_pkg.set_ccid(
164198 p_code_combination_id => l_ccid
164199 , p_value_type_code => l_adr_value_type_code
164200 , p_transaction_coa_id => l_adr_transaction_coa_id
164201 , p_accounting_coa_id => l_adr_accounting_coa_id
164202 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
164203 , p_adr_type_code => 'S'
164204 , p_component_type => l_component_type
164205 , p_component_code => l_component_code
164206 , p_component_type_code => l_component_type_code
164207 , p_component_appl_id => l_component_appl_id
164208 , p_amb_context_code => l_amb_context_code
164209 , p_side => 'NA'
164210 );
164211
164212
164213 l_segment := AcctDerRule_150(
164214 p_application_id => p_application_id
164215 , p_ae_header_id => l_ae_header_id
164216 , p_source_5 => p_source_5
164217 , p_source_12 => p_source_12
164218 , x_transaction_coa_id => l_adr_transaction_coa_id
164219 , x_accounting_coa_id => l_adr_accounting_coa_id
164220 , x_flexfield_segment_code => l_adr_flexfield_segment_code
164224 , x_value_segment_code => l_adr_value_segment_code
164221 , x_flex_value_set_id => l_adr_flex_value_set_id
164222 , x_value_type_code => l_adr_value_type_code
164223 , x_value_combination_id => l_adr_value_combination_id
164225 , p_side => 'NA'
164226 , p_override_seg_flag => 'Y'
164227 );
164228
164229 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
164230
164231 xla_ae_lines_pkg.set_segment(
164232 p_to_segment_code => 'GL_ACCOUNT'
164233 , p_segment_value => l_segment
164234 , p_from_segment_code => l_adr_value_segment_code
164235 , p_from_combination_id => l_adr_value_combination_id
164236 , p_value_type_code => l_adr_value_type_code
164237 , p_transaction_coa_id => l_adr_transaction_coa_id
164238 , p_accounting_coa_id => l_adr_accounting_coa_id
164239 , p_flexfield_segment_code => l_adr_flexfield_segment_code
164240 , p_flex_value_set_id => l_adr_flex_value_set_id
164241 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
164242 , p_adr_type_code => 'S'
164243 , p_component_type => l_component_type
164244 , p_component_code => l_component_code
164245 , p_component_type_code => l_component_type_code
164246 , p_component_appl_id => l_component_appl_id
164247 , p_amb_context_code => l_amb_context_code
164248 , p_entity_code => 'TRANSACTIONS'
164249 , p_event_class_code => 'TRANSFERS'
164250 , p_side => 'NA'
164251 );
164252
164253 END IF;
164254
164255 l_segment := AcctDerRule_169(
164256 p_application_id => p_application_id
164257 , p_ae_header_id => l_ae_header_id
164258 , p_source_5 => p_source_5
164259 , p_source_31 => p_source_31
164260 , x_transaction_coa_id => l_adr_transaction_coa_id
164261 , x_accounting_coa_id => l_adr_accounting_coa_id
164262 , x_flexfield_segment_code => l_adr_flexfield_segment_code
164263 , x_flex_value_set_id => l_adr_flex_value_set_id
164264 , x_value_type_code => l_adr_value_type_code
164265 , x_value_combination_id => l_adr_value_combination_id
164266 , x_value_segment_code => l_adr_value_segment_code
164267 , p_side => 'NA'
164268 , p_override_seg_flag => 'Y'
164269 );
164270
164271 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
164272
164273 xla_ae_lines_pkg.set_segment(
164274 p_to_segment_code => 'GL_BALANCING'
164275 , p_segment_value => l_segment
164276 , p_from_segment_code => l_adr_value_segment_code
164277 , p_from_combination_id => l_adr_value_combination_id
164278 , p_value_type_code => l_adr_value_type_code
164279 , p_transaction_coa_id => l_adr_transaction_coa_id
164280 , p_accounting_coa_id => l_adr_accounting_coa_id
164281 , p_flexfield_segment_code => l_adr_flexfield_segment_code
164282 , p_flex_value_set_id => l_adr_flex_value_set_id
164283 , p_adr_code => 'FA_EXPENSE_ACCT'
164284 , p_adr_type_code => 'S'
164285 , p_component_type => l_component_type
164286 , p_component_code => l_component_code
164287 , p_component_type_code => l_component_type_code
164288 , p_component_appl_id => l_component_appl_id
164289 , p_amb_context_code => l_amb_context_code
164290 , p_entity_code => 'TRANSACTIONS'
164291 , p_event_class_code => 'TRANSFERS'
164292 , p_side => 'NA'
164293 );
164294
164295 END IF;
164296
164297 --
164298 --
164299 END IF;
164300 --
164301 -- Bug 4922099
164302 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
164303 (NVL(l_enc_upg_option, 'N') = 'O')
164304 ) AND
164305 (l_bflow_method_code = 'PRIOR_ENTRY')
164306 )
164307 THEN
164308 IF
164309 --
164310 1 = 2
164311 --
164312 THEN
164313 xla_accounting_err_pkg.build_message
164314 (p_appli_s_name => 'XLA'
164315 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
164316 ,p_token_1 => 'LINE_NUMBER'
164317 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
164318 ,p_token_2 => 'LINE_TYPE_NAME'
164319 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
164320 l_component_type
164321 ,l_component_code
164322 ,l_component_type_code
164323 ,l_component_appl_id
164324 ,l_amb_context_code
164325 ,l_entity_code
164329 ,p_value_3 => xla_lookups_pkg.get_meaning(
164326 ,l_event_class_code
164327 )
164328 ,p_token_3 => 'OWNER'
164330 p_lookup_type => 'XLA_OWNER_TYPE'
164331 ,p_lookup_code => l_component_type_code
164332 )
164333 ,p_token_4 => 'PRODUCT_NAME'
164334 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
164335 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
164336 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
164337 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
164338 ,p_ae_header_id => NULL
164339 );
164340
164341 IF (C_LEVEL_ERROR>= g_log_level) THEN
164342 trace
164343 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
164344 ,p_level => C_LEVEL_ERROR
164345 ,p_module => l_log_module);
164346 END IF;
164347 END IF;
164348 END IF;
164349 --
164350 --
164351 ------------------------------------------------------------------------------------------------
164352 -- 4219869 Business Flow
164353 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
164354 -- Prior Entry. Currently, the following code is always generated.
164355 ------------------------------------------------------------------------------------------------
164356 XLA_AE_LINES_PKG.ValidateCurrentLine;
164357
164358 ------------------------------------------------------------------------------------
164359 -- 4219869 Business Flow
164360 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
164361 ------------------------------------------------------------------------------------
164362 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
164363
164364 ----------------------------------------------------------------------------------
164365 -- 4219869 Business Flow
164366 -- Update journal entry status -- Need to generate this within IF <condition>
164367 ----------------------------------------------------------------------------------
164368 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
164369 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
164370 ,p_balance_type_code => l_balance_type_code
164371 );
164372
164373 -------------------------------------------------------------------------------------------
164374 -- 4262811 - Generate the Accrual Reversal lines
164375 -------------------------------------------------------------------------------------------
164376 BEGIN
164377 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
164378 (g_array_event(p_event_id).array_value_num('header_index'));
164379 IF l_acc_rev_flag IS NULL THEN
164380 l_acc_rev_flag := 'N';
164381 END IF;
164382 EXCEPTION
164383 WHEN OTHERS THEN
164384 l_acc_rev_flag := 'N';
164385 END;
164386 --
164387 IF (l_acc_rev_flag = 'Y') THEN
164388
164389 -- 4645092 ------------------------------------------------------------------------------
164390 -- To allow MPA report to determine if it should generate report process
164391 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
164392 ------------------------------------------------------------------------------------------
164393
164394 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
164395 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
164396 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
164397 -- call ADRs
164398 -- Bug 4922099
164399 --
164400 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
164401 (NVL(l_actual_upg_option, 'N') = 'O') OR
164402 (NVL(l_enc_upg_option, 'N') = 'O')
164403 )
164404 THEN
164405 NULL;
164406 --
164407 --
164408
164409 l_ccid := AcctDerRule_175(
164410 p_application_id => p_application_id
164411 , p_ae_header_id => l_ae_header_id
164412 , p_source_5 => p_source_5
164413 , p_source_19 => p_source_19
164414 , p_source_32 => p_source_32
164415 , x_transaction_coa_id => l_adr_transaction_coa_id
164416 , x_accounting_coa_id => l_adr_accounting_coa_id
164417 , x_value_type_code => l_adr_value_type_code
164418 , p_side => 'NA'
164419 );
164420
164421 xla_ae_lines_pkg.set_ccid(
164422 p_code_combination_id => l_ccid
164423 , p_value_type_code => l_adr_value_type_code
164424 , p_transaction_coa_id => l_adr_transaction_coa_id
164425 , p_accounting_coa_id => l_adr_accounting_coa_id
164426 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
164430 , p_component_type_code => l_component_type_code
164427 , p_adr_type_code => 'S'
164428 , p_component_type => l_component_type
164429 , p_component_code => l_component_code
164431 , p_component_appl_id => l_component_appl_id
164432 , p_amb_context_code => l_amb_context_code
164433 , p_side => 'NA'
164434 );
164435
164436
164437 l_segment := AcctDerRule_150(
164438 p_application_id => p_application_id
164439 , p_ae_header_id => l_ae_header_id
164440 , p_source_5 => p_source_5
164441 , p_source_12 => p_source_12
164442 , x_transaction_coa_id => l_adr_transaction_coa_id
164443 , x_accounting_coa_id => l_adr_accounting_coa_id
164444 , x_flexfield_segment_code => l_adr_flexfield_segment_code
164445 , x_flex_value_set_id => l_adr_flex_value_set_id
164446 , x_value_type_code => l_adr_value_type_code
164447 , x_value_combination_id => l_adr_value_combination_id
164448 , x_value_segment_code => l_adr_value_segment_code
164449 , p_side => 'NA'
164450 , p_override_seg_flag => 'Y'
164451 );
164452
164453 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
164454
164455 xla_ae_lines_pkg.set_segment(
164456 p_to_segment_code => 'GL_ACCOUNT'
164457 , p_segment_value => l_segment
164458 , p_from_segment_code => l_adr_value_segment_code
164459 , p_from_combination_id => l_adr_value_combination_id
164460 , p_value_type_code => l_adr_value_type_code
164461 , p_transaction_coa_id => l_adr_transaction_coa_id
164462 , p_accounting_coa_id => l_adr_accounting_coa_id
164463 , p_flexfield_segment_code => l_adr_flexfield_segment_code
164464 , p_flex_value_set_id => l_adr_flex_value_set_id
164465 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
164466 , p_adr_type_code => 'S'
164467 , p_component_type => l_component_type
164468 , p_component_code => l_component_code
164469 , p_component_type_code => l_component_type_code
164470 , p_component_appl_id => l_component_appl_id
164471 , p_amb_context_code => l_amb_context_code
164472 , p_entity_code => 'TRANSACTIONS'
164473 , p_event_class_code => 'TRANSFERS'
164474 , p_side => 'NA'
164475 );
164476
164477 END IF;
164478
164479 l_segment := AcctDerRule_169(
164480 p_application_id => p_application_id
164481 , p_ae_header_id => l_ae_header_id
164482 , p_source_5 => p_source_5
164483 , p_source_31 => p_source_31
164484 , x_transaction_coa_id => l_adr_transaction_coa_id
164485 , x_accounting_coa_id => l_adr_accounting_coa_id
164486 , x_flexfield_segment_code => l_adr_flexfield_segment_code
164487 , x_flex_value_set_id => l_adr_flex_value_set_id
164488 , x_value_type_code => l_adr_value_type_code
164489 , x_value_combination_id => l_adr_value_combination_id
164490 , x_value_segment_code => l_adr_value_segment_code
164491 , p_side => 'NA'
164492 , p_override_seg_flag => 'Y'
164493 );
164494
164495 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
164496
164497 xla_ae_lines_pkg.set_segment(
164498 p_to_segment_code => 'GL_BALANCING'
164499 , p_segment_value => l_segment
164500 , p_from_segment_code => l_adr_value_segment_code
164501 , p_from_combination_id => l_adr_value_combination_id
164502 , p_value_type_code => l_adr_value_type_code
164503 , p_transaction_coa_id => l_adr_transaction_coa_id
164504 , p_accounting_coa_id => l_adr_accounting_coa_id
164505 , p_flexfield_segment_code => l_adr_flexfield_segment_code
164506 , p_flex_value_set_id => l_adr_flex_value_set_id
164507 , p_adr_code => 'FA_EXPENSE_ACCT'
164508 , p_adr_type_code => 'S'
164509 , p_component_type => l_component_type
164510 , p_component_code => l_component_code
164511 , p_component_type_code => l_component_type_code
164512 , p_component_appl_id => l_component_appl_id
164513 , p_amb_context_code => l_amb_context_code
164514 , p_entity_code => 'TRANSACTIONS'
164515 , p_event_class_code => 'TRANSFERS'
164516 , p_side => 'NA'
164517 );
164518
164519 END IF;
164520
164521 --
164522 --
164523 END IF;
164524
164525 --
164526 -- Update the line information that should be overwritten
164527 --
164528 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
164529 p_header_num => 1);
164530 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
164531
164532 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
164533
164534 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
164535 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
164536 END IF;
164540 --
164537
164538 --
164539 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
164541 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
164542 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
164543 ELSE
164544 ---------------------------------------------------------------------------------------------------
164545 -- 4262811a Switch Sign
164546 ---------------------------------------------------------------------------------------------------
164547 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
164548 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
164549 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
164550 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
164551 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
164552 -- 5132302
164553 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
164554 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
164555
164556 END IF;
164557
164558 -- 4955764
164559 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
164560 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
164561
164562
164563 XLA_AE_LINES_PKG.ValidateCurrentLine;
164564 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
164565
164566 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
164567 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
164568 ,p_balance_type_code => l_balance_type_code);
164569
164570 END IF;
164571
164572 -----------------------------------------------------------------------------------------
164573 -- 4262811 Multiperiod Accounting
164574 -----------------------------------------------------------------------------------------
164575 -- No MPA option is assigned.
164576
164577
164578 END IF;
164579 END IF;
164580 --
164581
164582 --
164583 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
164584 trace
164585 (p_msg => 'END of AcctLineType_395'
164586 ,p_level => C_LEVEL_PROCEDURE
164587 ,p_module => l_log_module);
164588 END IF;
164589 --
164590 EXCEPTION
164591 WHEN xla_exceptions_pkg.application_exception THEN
164592 RAISE;
164593 WHEN OTHERS THEN
164594 xla_exceptions_pkg.raise_message
164595 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_395');
164596 END AcctLineType_395;
164597 --
164598
164599 ---------------------------------------
164600 --
164601 -- PRIVATE FUNCTION
164602 -- AcctLineType_396
164603 --
164604 ---------------------------------------
164605 PROCEDURE AcctLineType_396 (
164606 p_application_id IN NUMBER
164607 ,p_event_id IN NUMBER
164608 ,p_calculate_acctd_flag IN VARCHAR2
164609 ,p_calculate_g_l_flag IN VARCHAR2
164610 ,p_actual_flag IN OUT VARCHAR2
164611 ,p_balance_type_code OUT VARCHAR2
164612 ,p_gain_or_loss_ref OUT VARCHAR2
164613
164614 --Period Close Date
164615 , p_source_1 IN DATE
164616 --Generated Code Combination Identifier
164617 , p_source_5 IN NUMBER
164618 --Expense Account Code Combination Identifier
164619 , p_source_31 IN NUMBER
164620 --Adjustment Type
164621 , p_source_48 IN VARCHAR2
164622 --Transaction Header Identifier
164623 , p_source_49 IN NUMBER
164624 --Adjustment Line Identifier
164625 , p_source_50 IN NUMBER
164626 --Distribution Type Code
164627 , p_source_51 IN VARCHAR2
164628 --Entered Amount
164629 , p_source_52 IN NUMBER
164630 --Currency Code
164631 , p_source_53 IN VARCHAR2
164632 --Source Destination Code
164633 , p_source_55 IN VARCHAR2
164634 )
164635 IS
164636
164637 l_component_type VARCHAR2(80);
164638 l_component_code VARCHAR2(30);
164639 l_component_type_code VARCHAR2(1);
164640 l_component_appl_id INTEGER;
164641 l_amb_context_code VARCHAR2(30);
164642 l_entity_code VARCHAR2(30);
164643 l_event_class_code VARCHAR2(30);
164644 l_ae_header_id NUMBER;
164645 l_event_type_code VARCHAR2(30);
164646 l_line_definition_code VARCHAR2(30);
164647 l_line_definition_owner_code VARCHAR2(1);
164648 --
164649 -- adr variables
164650 l_segment VARCHAR2(30);
164651 l_ccid NUMBER;
164652 l_adr_transaction_coa_id NUMBER;
164653 l_adr_accounting_coa_id NUMBER;
164654 l_adr_flexfield_segment_code VARCHAR2(30);
164655 l_adr_flex_value_set_id NUMBER;
164656 l_adr_value_type_code VARCHAR2(30);
164657 l_adr_value_combination_id NUMBER;
164658 l_adr_value_segment_code VARCHAR2(30);
164659
164660 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
164661 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
164662 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
164666 l_entered_amt_idx NUMBER;
164663 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
164664
164665 -- 4262811 Variables ------------------------------------------------------------------------------------------
164667 l_accted_amt_idx NUMBER;
164668 l_acc_rev_flag VARCHAR2(1);
164669 l_accrual_line_num NUMBER;
164670 l_tmp_amt NUMBER;
164671 l_acc_rev_natural_side_code VARCHAR2(1);
164672
164673 l_num_entries NUMBER;
164674 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
164675 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
164676 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
164677 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
164678 l_recog_line_1 NUMBER;
164679 l_recog_line_2 NUMBER;
164680
164681 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
164682 l_bflow_applied_to_amt NUMBER; -- 5132302
164683 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
164684
164685 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
164686
164687 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
164688 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
164689
164690 ---------------------------------------------------------------------------------------------------------------
164691
164692
164693 --
164694 -- bulk performance
164695 --
164696 l_balance_type_code VARCHAR2(1);
164697 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
164698 l_log_module VARCHAR2(240);
164699
164700 --
164701 -- Upgrade strategy
164702 --
164703 l_actual_upg_option VARCHAR2(1);
164704 l_enc_upg_option VARCHAR2(1);
164705
164706 --
164707 BEGIN
164708 --
164709 IF g_log_enabled THEN
164710 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_396';
164711 END IF;
164712 --
164713 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
164714
164715 trace
164716 (p_msg => 'BEGIN of AcctLineType_396'
164717 ,p_level => C_LEVEL_PROCEDURE
164718 ,p_module => l_log_module);
164719
164720 END IF;
164721 --
164722 l_component_type := 'AMB_JLT';
164723 l_component_code := 'FA_TRANSFER_SOURCE_EXP_BAL';
164724 l_component_type_code := 'S';
164725 l_component_appl_id := 140;
164726 l_amb_context_code := 'DEFAULT';
164727 l_entity_code := 'TRANSACTIONS';
164728 l_event_class_code := 'TRANSFERS';
164729 l_event_type_code := 'TRANSFERS_ALL';
164730 l_line_definition_owner_code := 'S';
164731 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
164732 --
164733 l_balance_type_code := 'A';
164734 l_segment := NULL;
164735 l_ccid := NULL;
164736 l_adr_transaction_coa_id := NULL;
164737 l_adr_accounting_coa_id := NULL;
164738 l_adr_flexfield_segment_code := NULL;
164739 l_adr_flex_value_set_id := NULL;
164740 l_adr_value_type_code := NULL;
164741 l_adr_value_combination_id := NULL;
164742 l_adr_value_segment_code := NULL;
164743
164744 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
164745 l_bflow_class_code := ''; -- 4219869 Business Flow
164746 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
164747 l_budgetary_control_flag := 'N';
164748
164749 l_bflow_applied_to_amt_idx := NULL; -- 5132302
164750 l_bflow_applied_to_amt := NULL; -- 5132302
164751 l_entered_amt_idx := NULL; -- 4262811
164752 l_accted_amt_idx := NULL; -- 4262811
164753 l_acc_rev_flag := NULL; -- 4262811
164754 l_accrual_line_num := NULL; -- 4262811
164755 l_tmp_amt := NULL; -- 4262811
164756 --
164757
164758 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
164759 l_balance_type_code <> 'B' THEN
164760 IF NVL(p_source_48,'
164761 ') = 'BONUS EXPENSE' AND
164762 NVL(p_source_55,'
164763 ') = 'SOURCE'
164764 THEN
164765
164766 --
164767 XLA_AE_LINES_PKG.SetNewLine;
164768
164769 p_balance_type_code := l_balance_type_code;
164770 -- set the flag so later we will know whether the gain loss line needs to be created
164771
164772 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
164773 p_actual_flag :='A';
164774 END IF;
164775
164776 --
164777 -- bulk performance
164778 --
164779 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
164780 p_header_num => 0); -- 4262811
164781 --
164782 -- set accounting line options
164783 --
164784 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
164785 p_natural_side_code => 'D'
164786 , p_gain_or_loss_flag => 'N'
164787 , p_gl_transfer_mode_code => 'S'
164788 , p_acct_entry_type_code => 'A'
164789 , p_switch_side_flag => 'Y'
164790 , p_merge_duplicate_code => 'N'
164791 );
164792 --
164793 l_acc_rev_natural_side_code := 'C'; -- 4262811
164797 --
164794 --
164795 --
164796 -- set accounting line type info
164798 xla_ae_lines_pkg.SetAcctLineType
164799 (p_component_type => l_component_type
164800 ,p_event_type_code => l_event_type_code
164801 ,p_line_definition_owner_code => l_line_definition_owner_code
164802 ,p_line_definition_code => l_line_definition_code
164803 ,p_accounting_line_code => l_component_code
164804 ,p_accounting_line_type_code => l_component_type_code
164805 ,p_accounting_line_appl_id => l_component_appl_id
164806 ,p_amb_context_code => l_amb_context_code
164807 ,p_entity_code => l_entity_code
164808 ,p_event_class_code => l_event_class_code);
164809 --
164810 -- set accounting class
164811 --
164812 xla_ae_lines_pkg.SetAcctClass(
164813 p_accounting_class_code => 'EXPENSE'
164814 , p_ae_header_id => l_ae_header_id
164815 );
164816
164817 --
164818 -- set rounding class
164819 --
164820 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
164821 'EXPENSE';
164822
164823 --
164824 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
164825 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
164826 --
164827 -- bulk performance
164828 --
164829 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
164830
164831 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
164832 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
164833
164834 -- 4955764
164835 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
164836 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
164837
164838 -- 4458381 Public Sector Enh
164839
164840 --
164841 -- set accounting attributes for the line type
164842 --
164843 l_entered_amt_idx := 4;
164844 l_accted_amt_idx := 6;
164845 l_bflow_applied_to_amt_idx := NULL; -- 5132302
164846 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
164847 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
164848 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
164849 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
164850 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
164851 l_rec_acct_attrs.array_char_value(3) := p_source_51;
164852 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
164853 l_rec_acct_attrs.array_num_value(4) := p_source_52;
164854 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
164855 l_rec_acct_attrs.array_char_value(5) := p_source_53;
164856 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
164857 l_rec_acct_attrs.array_num_value(6) := p_source_52;
164858
164859 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
164860 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
164861
164862 ---------------------------------------------------------------------------------------------------------------
164863 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
164864 ---------------------------------------------------------------------------------------------------------------
164865 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
164866
164867 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
164868 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
164869
164870 IF xla_accounting_cache_pkg.GetValueChar
164871 (p_source_code => 'LEDGER_CATEGORY_CODE'
164872 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
164873 AND l_bflow_method_code = 'PRIOR_ENTRY'
164874 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
164875 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
164876 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
164877 )
164878 THEN
164879 xla_ae_lines_pkg.BflowUpgEntry
164880 (p_business_method_code => l_bflow_method_code
164881 ,p_business_class_code => l_bflow_class_code
164882 ,p_balance_type => l_balance_type_code);
164883 ELSE
164884 NULL;
164885 -- No business flow processing for business flow method of NONE.
164886 END IF;
164887
164888 --
164889 -- call analytical criteria
164890 --
164891
164892 --
164893 -- call description
164894 --
164895
164896 xla_ae_lines_pkg.SetLineDescription(
164897 p_ae_header_id => l_ae_header_id
164898 ,p_description => Description_127 (
164899 p_application_id => p_application_id
164900 , p_ae_header_id => l_ae_header_id
164901 , p_source_1 => p_source_1
164902 )
164903 );
164904
164905
164906 --
164907 -- call ADRs
164908 -- Bug 4922099
164909 --
164910 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
164911 (NVL(l_actual_upg_option, 'N') = 'O') OR
164915 NULL;
164912 (NVL(l_enc_upg_option, 'N') = 'O')
164913 )
164914 THEN
164916 --
164917 --
164918
164919 l_ccid := AcctDerRule_176(
164920 p_application_id => p_application_id
164921 , p_ae_header_id => l_ae_header_id
164922 , p_source_5 => p_source_5
164923 , p_source_31 => p_source_31
164924 , x_transaction_coa_id => l_adr_transaction_coa_id
164925 , x_accounting_coa_id => l_adr_accounting_coa_id
164926 , x_value_type_code => l_adr_value_type_code
164927 , p_side => 'NA'
164928 );
164929
164930 xla_ae_lines_pkg.set_ccid(
164931 p_code_combination_id => l_ccid
164932 , p_value_type_code => l_adr_value_type_code
164933 , p_transaction_coa_id => l_adr_transaction_coa_id
164934 , p_accounting_coa_id => l_adr_accounting_coa_id
164935 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
164936 , p_adr_type_code => 'S'
164937 , p_component_type => l_component_type
164938 , p_component_code => l_component_code
164939 , p_component_type_code => l_component_type_code
164940 , p_component_appl_id => l_component_appl_id
164941 , p_amb_context_code => l_amb_context_code
164942 , p_side => 'NA'
164943 );
164944
164945
164946 --
164947 --
164948 END IF;
164949 --
164950 -- Bug 4922099
164951 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
164952 (NVL(l_enc_upg_option, 'N') = 'O')
164953 ) AND
164954 (l_bflow_method_code = 'PRIOR_ENTRY')
164955 )
164956 THEN
164957 IF
164958 --
164959 1 = 2
164960 --
164961 THEN
164962 xla_accounting_err_pkg.build_message
164963 (p_appli_s_name => 'XLA'
164964 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
164965 ,p_token_1 => 'LINE_NUMBER'
164966 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
164967 ,p_token_2 => 'LINE_TYPE_NAME'
164968 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
164969 l_component_type
164970 ,l_component_code
164971 ,l_component_type_code
164972 ,l_component_appl_id
164973 ,l_amb_context_code
164974 ,l_entity_code
164975 ,l_event_class_code
164976 )
164977 ,p_token_3 => 'OWNER'
164978 ,p_value_3 => xla_lookups_pkg.get_meaning(
164979 p_lookup_type => 'XLA_OWNER_TYPE'
164980 ,p_lookup_code => l_component_type_code
164981 )
164982 ,p_token_4 => 'PRODUCT_NAME'
164983 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
164984 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
164985 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
164986 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
164987 ,p_ae_header_id => NULL
164988 );
164989
164990 IF (C_LEVEL_ERROR>= g_log_level) THEN
164991 trace
164992 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
164993 ,p_level => C_LEVEL_ERROR
164994 ,p_module => l_log_module);
164995 END IF;
164996 END IF;
164997 END IF;
164998 --
164999 --
165000 ------------------------------------------------------------------------------------------------
165001 -- 4219869 Business Flow
165002 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
165003 -- Prior Entry. Currently, the following code is always generated.
165004 ------------------------------------------------------------------------------------------------
165005 XLA_AE_LINES_PKG.ValidateCurrentLine;
165006
165007 ------------------------------------------------------------------------------------
165008 -- 4219869 Business Flow
165009 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
165010 ------------------------------------------------------------------------------------
165011 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
165012
165016 ----------------------------------------------------------------------------------
165013 ----------------------------------------------------------------------------------
165014 -- 4219869 Business Flow
165015 -- Update journal entry status -- Need to generate this within IF <condition>
165017 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
165018 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
165019 ,p_balance_type_code => l_balance_type_code
165020 );
165021
165022 -------------------------------------------------------------------------------------------
165023 -- 4262811 - Generate the Accrual Reversal lines
165024 -------------------------------------------------------------------------------------------
165025 BEGIN
165026 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
165027 (g_array_event(p_event_id).array_value_num('header_index'));
165028 IF l_acc_rev_flag IS NULL THEN
165029 l_acc_rev_flag := 'N';
165030 END IF;
165031 EXCEPTION
165032 WHEN OTHERS THEN
165033 l_acc_rev_flag := 'N';
165034 END;
165035 --
165036 IF (l_acc_rev_flag = 'Y') THEN
165037
165038 -- 4645092 ------------------------------------------------------------------------------
165039 -- To allow MPA report to determine if it should generate report process
165040 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
165041 ------------------------------------------------------------------------------------------
165042
165043 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
165044 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
165045 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
165046 -- call ADRs
165047 -- Bug 4922099
165048 --
165049 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
165050 (NVL(l_actual_upg_option, 'N') = 'O') OR
165051 (NVL(l_enc_upg_option, 'N') = 'O')
165052 )
165053 THEN
165054 NULL;
165055 --
165056 --
165057
165058 l_ccid := AcctDerRule_176(
165059 p_application_id => p_application_id
165060 , p_ae_header_id => l_ae_header_id
165061 , p_source_5 => p_source_5
165062 , p_source_31 => p_source_31
165063 , x_transaction_coa_id => l_adr_transaction_coa_id
165064 , x_accounting_coa_id => l_adr_accounting_coa_id
165065 , x_value_type_code => l_adr_value_type_code
165066 , p_side => 'NA'
165067 );
165068
165069 xla_ae_lines_pkg.set_ccid(
165070 p_code_combination_id => l_ccid
165071 , p_value_type_code => l_adr_value_type_code
165072 , p_transaction_coa_id => l_adr_transaction_coa_id
165073 , p_accounting_coa_id => l_adr_accounting_coa_id
165074 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
165075 , p_adr_type_code => 'S'
165076 , p_component_type => l_component_type
165077 , p_component_code => l_component_code
165078 , p_component_type_code => l_component_type_code
165079 , p_component_appl_id => l_component_appl_id
165080 , p_amb_context_code => l_amb_context_code
165081 , p_side => 'NA'
165082 );
165083
165084
165085 --
165086 --
165087 END IF;
165088
165089 --
165090 -- Update the line information that should be overwritten
165091 --
165092 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
165093 p_header_num => 1);
165094 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
165095
165096 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
165097
165098 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
165099 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
165100 END IF;
165101
165102 --
165103 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
165104 --
165105 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
165106 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
165107 ELSE
165108 ---------------------------------------------------------------------------------------------------
165109 -- 4262811a Switch Sign
165110 ---------------------------------------------------------------------------------------------------
165111 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
165112 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
165113 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
165114 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
165115 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
165116 -- 5132302
165117 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
165118 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
165119
165123 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
165120 END IF;
165121
165122 -- 4955764
165124 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
165125
165126
165127 XLA_AE_LINES_PKG.ValidateCurrentLine;
165128 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
165129
165130 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
165131 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
165132 ,p_balance_type_code => l_balance_type_code);
165133
165134 END IF;
165135
165136 -----------------------------------------------------------------------------------------
165137 -- 4262811 Multiperiod Accounting
165138 -----------------------------------------------------------------------------------------
165139 -- No MPA option is assigned.
165140
165141
165142 END IF;
165143 END IF;
165144 --
165145
165146 --
165147 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
165148 trace
165149 (p_msg => 'END of AcctLineType_396'
165150 ,p_level => C_LEVEL_PROCEDURE
165151 ,p_module => l_log_module);
165152 END IF;
165153 --
165154 EXCEPTION
165155 WHEN xla_exceptions_pkg.application_exception THEN
165156 RAISE;
165157 WHEN OTHERS THEN
165158 xla_exceptions_pkg.raise_message
165159 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_396');
165160 END AcctLineType_396;
165161 --
165162
165163 ---------------------------------------
165164 --
165165 -- PRIVATE FUNCTION
165166 -- AcctLineType_397
165167 --
165168 ---------------------------------------
165169 PROCEDURE AcctLineType_397 (
165170 p_application_id IN NUMBER
165171 ,p_event_id IN NUMBER
165172 ,p_calculate_acctd_flag IN VARCHAR2
165173 ,p_calculate_g_l_flag IN VARCHAR2
165174 ,p_actual_flag IN OUT VARCHAR2
165175 ,p_balance_type_code OUT VARCHAR2
165176 ,p_gain_or_loss_ref OUT VARCHAR2
165177
165178 --Period Close Date
165179 , p_source_1 IN DATE
165180 --Generated Code Combination Identifier
165181 , p_source_5 IN NUMBER
165182 --Depreciation Reserve Account
165183 , p_source_12 IN VARCHAR2
165184 --Generated Offset Code Combination Identifier
165185 , p_source_19 IN NUMBER
165186 --Expense Account Code Combination Identifier
165187 , p_source_31 IN NUMBER
165188 --Default Code Combination Identifier
165189 , p_source_32 IN NUMBER
165190 --Adjustment Type
165191 , p_source_48 IN VARCHAR2
165192 --Transaction Header Identifier
165193 , p_source_49 IN NUMBER
165194 --Adjustment Line Identifier
165195 , p_source_50 IN NUMBER
165196 --Distribution Type Code
165197 , p_source_51 IN VARCHAR2
165198 --Entered Amount
165199 , p_source_52 IN NUMBER
165200 --Currency Code
165201 , p_source_53 IN VARCHAR2
165202 --Source Destination Code
165203 , p_source_55 IN VARCHAR2
165204 )
165205 IS
165206
165207 l_component_type VARCHAR2(80);
165208 l_component_code VARCHAR2(30);
165209 l_component_type_code VARCHAR2(1);
165210 l_component_appl_id INTEGER;
165211 l_amb_context_code VARCHAR2(30);
165212 l_entity_code VARCHAR2(30);
165213 l_event_class_code VARCHAR2(30);
165214 l_ae_header_id NUMBER;
165215 l_event_type_code VARCHAR2(30);
165216 l_line_definition_code VARCHAR2(30);
165217 l_line_definition_owner_code VARCHAR2(1);
165218 --
165219 -- adr variables
165220 l_segment VARCHAR2(30);
165221 l_ccid NUMBER;
165222 l_adr_transaction_coa_id NUMBER;
165223 l_adr_accounting_coa_id NUMBER;
165224 l_adr_flexfield_segment_code VARCHAR2(30);
165225 l_adr_flex_value_set_id NUMBER;
165226 l_adr_value_type_code VARCHAR2(30);
165227 l_adr_value_combination_id NUMBER;
165228 l_adr_value_segment_code VARCHAR2(30);
165229
165230 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
165231 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
165232 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
165233 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
165234
165235 -- 4262811 Variables ------------------------------------------------------------------------------------------
165236 l_entered_amt_idx NUMBER;
165237 l_accted_amt_idx NUMBER;
165238 l_acc_rev_flag VARCHAR2(1);
165239 l_accrual_line_num NUMBER;
165240 l_tmp_amt NUMBER;
165241 l_acc_rev_natural_side_code VARCHAR2(1);
165242
165243 l_num_entries NUMBER;
165244 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
165245 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
165246 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
165247 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
165248 l_recog_line_1 NUMBER;
165249 l_recog_line_2 NUMBER;
165250
165251 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
165252 l_bflow_applied_to_amt NUMBER; -- 5132302
165253 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
165254
165258 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
165255 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
165256
165257 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
165259
165260 ---------------------------------------------------------------------------------------------------------------
165261
165262
165263 --
165264 -- bulk performance
165265 --
165266 l_balance_type_code VARCHAR2(1);
165267 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
165268 l_log_module VARCHAR2(240);
165269
165270 --
165271 -- Upgrade strategy
165272 --
165273 l_actual_upg_option VARCHAR2(1);
165274 l_enc_upg_option VARCHAR2(1);
165275
165276 --
165277 BEGIN
165278 --
165279 IF g_log_enabled THEN
165280 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_397';
165281 END IF;
165282 --
165283 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
165284
165285 trace
165286 (p_msg => 'BEGIN of AcctLineType_397'
165287 ,p_level => C_LEVEL_PROCEDURE
165288 ,p_module => l_log_module);
165289
165290 END IF;
165291 --
165292 l_component_type := 'AMB_JLT';
165293 l_component_code := 'FA_TRANSFER_SOURCE_RESERVE_BAL';
165294 l_component_type_code := 'S';
165295 l_component_appl_id := 140;
165296 l_amb_context_code := 'DEFAULT';
165297 l_entity_code := 'TRANSACTIONS';
165298 l_event_class_code := 'TRANSFERS';
165299 l_event_type_code := 'TRANSFERS_ALL';
165300 l_line_definition_owner_code := 'S';
165301 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
165302 --
165303 l_balance_type_code := 'A';
165304 l_segment := NULL;
165305 l_ccid := NULL;
165306 l_adr_transaction_coa_id := NULL;
165307 l_adr_accounting_coa_id := NULL;
165308 l_adr_flexfield_segment_code := NULL;
165309 l_adr_flex_value_set_id := NULL;
165310 l_adr_value_type_code := NULL;
165311 l_adr_value_combination_id := NULL;
165312 l_adr_value_segment_code := NULL;
165313
165314 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
165315 l_bflow_class_code := ''; -- 4219869 Business Flow
165316 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
165317 l_budgetary_control_flag := 'N';
165318
165319 l_bflow_applied_to_amt_idx := NULL; -- 5132302
165320 l_bflow_applied_to_amt := NULL; -- 5132302
165321 l_entered_amt_idx := NULL; -- 4262811
165322 l_accted_amt_idx := NULL; -- 4262811
165323 l_acc_rev_flag := NULL; -- 4262811
165324 l_accrual_line_num := NULL; -- 4262811
165325 l_tmp_amt := NULL; -- 4262811
165326 --
165327
165328 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
165329 l_balance_type_code <> 'B' THEN
165330 IF (NVL(p_source_48,'
165331 ') = 'BONUS RESERVE' OR
165332 NVL(p_source_48,'
165333 ') = 'BONUS EXPENSE') AND
165334 NVL(p_source_55,'
165335 ') = 'SOURCE'
165336 THEN
165337
165338 --
165339 XLA_AE_LINES_PKG.SetNewLine;
165340
165341 p_balance_type_code := l_balance_type_code;
165342 -- set the flag so later we will know whether the gain loss line needs to be created
165343
165344 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
165345 p_actual_flag :='A';
165346 END IF;
165347
165348 --
165349 -- bulk performance
165350 --
165351 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
165352 p_header_num => 0); -- 4262811
165353 --
165354 -- set accounting line options
165355 --
165356 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
165357 p_natural_side_code => 'C'
165358 , p_gain_or_loss_flag => 'N'
165359 , p_gl_transfer_mode_code => 'S'
165360 , p_acct_entry_type_code => 'A'
165361 , p_switch_side_flag => 'Y'
165362 , p_merge_duplicate_code => 'N'
165363 );
165364 --
165365 l_acc_rev_natural_side_code := 'D'; -- 4262811
165366 --
165367 --
165368 -- set accounting line type info
165369 --
165370 xla_ae_lines_pkg.SetAcctLineType
165371 (p_component_type => l_component_type
165372 ,p_event_type_code => l_event_type_code
165373 ,p_line_definition_owner_code => l_line_definition_owner_code
165374 ,p_line_definition_code => l_line_definition_code
165375 ,p_accounting_line_code => l_component_code
165376 ,p_accounting_line_type_code => l_component_type_code
165377 ,p_accounting_line_appl_id => l_component_appl_id
165378 ,p_amb_context_code => l_amb_context_code
165379 ,p_entity_code => l_entity_code
165380 ,p_event_class_code => l_event_class_code);
165381 --
165382 -- set accounting class
165383 --
165384 xla_ae_lines_pkg.SetAcctClass(
165385 p_accounting_class_code => 'ASSET'
165386 , p_ae_header_id => l_ae_header_id
165387 );
165388
165389 --
165390 -- set rounding class
165394
165391 --
165392 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
165393 'ASSET';
165395 --
165396 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
165397 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
165398 --
165399 -- bulk performance
165400 --
165401 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
165402
165403 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
165404 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
165405
165406 -- 4955764
165407 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
165408 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
165409
165410 -- 4458381 Public Sector Enh
165411
165412 --
165413 -- set accounting attributes for the line type
165414 --
165415 l_entered_amt_idx := 4;
165416 l_accted_amt_idx := 6;
165417 l_bflow_applied_to_amt_idx := NULL; -- 5132302
165418 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
165419 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
165420 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
165421 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
165422 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
165423 l_rec_acct_attrs.array_char_value(3) := p_source_51;
165424 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
165425 l_rec_acct_attrs.array_num_value(4) := p_source_52;
165426 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
165427 l_rec_acct_attrs.array_char_value(5) := p_source_53;
165428 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
165429 l_rec_acct_attrs.array_num_value(6) := p_source_52;
165430
165431 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
165432 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
165433
165434 ---------------------------------------------------------------------------------------------------------------
165435 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
165436 ---------------------------------------------------------------------------------------------------------------
165437 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
165438
165439 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
165440 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
165441
165442 IF xla_accounting_cache_pkg.GetValueChar
165443 (p_source_code => 'LEDGER_CATEGORY_CODE'
165444 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
165445 AND l_bflow_method_code = 'PRIOR_ENTRY'
165446 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
165447 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
165448 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
165449 )
165450 THEN
165451 xla_ae_lines_pkg.BflowUpgEntry
165452 (p_business_method_code => l_bflow_method_code
165453 ,p_business_class_code => l_bflow_class_code
165454 ,p_balance_type => l_balance_type_code);
165455 ELSE
165456 NULL;
165457 -- No business flow processing for business flow method of NONE.
165458 END IF;
165459
165460 --
165461 -- call analytical criteria
165462 --
165463
165464 --
165465 -- call description
165466 --
165467
165468 xla_ae_lines_pkg.SetLineDescription(
165469 p_ae_header_id => l_ae_header_id
165470 ,p_description => Description_130 (
165471 p_application_id => p_application_id
165472 , p_ae_header_id => l_ae_header_id
165473 , p_source_1 => p_source_1
165474 )
165475 );
165476
165477
165478 --
165479 -- call ADRs
165480 -- Bug 4922099
165481 --
165482 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
165483 (NVL(l_actual_upg_option, 'N') = 'O') OR
165484 (NVL(l_enc_upg_option, 'N') = 'O')
165485 )
165486 THEN
165487 NULL;
165488 --
165489 --
165490
165491 l_ccid := AcctDerRule_175(
165492 p_application_id => p_application_id
165493 , p_ae_header_id => l_ae_header_id
165494 , p_source_5 => p_source_5
165495 , p_source_19 => p_source_19
165496 , p_source_32 => p_source_32
165497 , x_transaction_coa_id => l_adr_transaction_coa_id
165498 , x_accounting_coa_id => l_adr_accounting_coa_id
165499 , x_value_type_code => l_adr_value_type_code
165500 , p_side => 'NA'
165501 );
165502
165503 xla_ae_lines_pkg.set_ccid(
165504 p_code_combination_id => l_ccid
165505 , p_value_type_code => l_adr_value_type_code
165506 , p_transaction_coa_id => l_adr_transaction_coa_id
165507 , p_accounting_coa_id => l_adr_accounting_coa_id
165508 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
165509 , p_adr_type_code => 'S'
165513 , p_component_appl_id => l_component_appl_id
165510 , p_component_type => l_component_type
165511 , p_component_code => l_component_code
165512 , p_component_type_code => l_component_type_code
165514 , p_amb_context_code => l_amb_context_code
165515 , p_side => 'NA'
165516 );
165517
165518
165519 l_segment := AcctDerRule_150(
165520 p_application_id => p_application_id
165521 , p_ae_header_id => l_ae_header_id
165522 , p_source_5 => p_source_5
165523 , p_source_12 => p_source_12
165524 , x_transaction_coa_id => l_adr_transaction_coa_id
165525 , x_accounting_coa_id => l_adr_accounting_coa_id
165526 , x_flexfield_segment_code => l_adr_flexfield_segment_code
165527 , x_flex_value_set_id => l_adr_flex_value_set_id
165528 , x_value_type_code => l_adr_value_type_code
165529 , x_value_combination_id => l_adr_value_combination_id
165530 , x_value_segment_code => l_adr_value_segment_code
165531 , p_side => 'NA'
165532 , p_override_seg_flag => 'Y'
165533 );
165534
165535 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
165536
165537 xla_ae_lines_pkg.set_segment(
165538 p_to_segment_code => 'GL_ACCOUNT'
165539 , p_segment_value => l_segment
165540 , p_from_segment_code => l_adr_value_segment_code
165541 , p_from_combination_id => l_adr_value_combination_id
165542 , p_value_type_code => l_adr_value_type_code
165543 , p_transaction_coa_id => l_adr_transaction_coa_id
165544 , p_accounting_coa_id => l_adr_accounting_coa_id
165545 , p_flexfield_segment_code => l_adr_flexfield_segment_code
165546 , p_flex_value_set_id => l_adr_flex_value_set_id
165547 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
165548 , p_adr_type_code => 'S'
165549 , p_component_type => l_component_type
165550 , p_component_code => l_component_code
165551 , p_component_type_code => l_component_type_code
165552 , p_component_appl_id => l_component_appl_id
165553 , p_amb_context_code => l_amb_context_code
165554 , p_entity_code => 'TRANSACTIONS'
165555 , p_event_class_code => 'TRANSFERS'
165556 , p_side => 'NA'
165557 );
165558
165559 END IF;
165560
165561 l_segment := AcctDerRule_169(
165562 p_application_id => p_application_id
165563 , p_ae_header_id => l_ae_header_id
165564 , p_source_5 => p_source_5
165565 , p_source_31 => p_source_31
165566 , x_transaction_coa_id => l_adr_transaction_coa_id
165567 , x_accounting_coa_id => l_adr_accounting_coa_id
165568 , x_flexfield_segment_code => l_adr_flexfield_segment_code
165569 , x_flex_value_set_id => l_adr_flex_value_set_id
165570 , x_value_type_code => l_adr_value_type_code
165571 , x_value_combination_id => l_adr_value_combination_id
165572 , x_value_segment_code => l_adr_value_segment_code
165573 , p_side => 'NA'
165574 , p_override_seg_flag => 'Y'
165575 );
165576
165577 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
165578
165579 xla_ae_lines_pkg.set_segment(
165580 p_to_segment_code => 'GL_BALANCING'
165581 , p_segment_value => l_segment
165582 , p_from_segment_code => l_adr_value_segment_code
165583 , p_from_combination_id => l_adr_value_combination_id
165584 , p_value_type_code => l_adr_value_type_code
165585 , p_transaction_coa_id => l_adr_transaction_coa_id
165586 , p_accounting_coa_id => l_adr_accounting_coa_id
165587 , p_flexfield_segment_code => l_adr_flexfield_segment_code
165588 , p_flex_value_set_id => l_adr_flex_value_set_id
165589 , p_adr_code => 'FA_EXPENSE_ACCT'
165590 , p_adr_type_code => 'S'
165591 , p_component_type => l_component_type
165592 , p_component_code => l_component_code
165593 , p_component_type_code => l_component_type_code
165594 , p_component_appl_id => l_component_appl_id
165595 , p_amb_context_code => l_amb_context_code
165596 , p_entity_code => 'TRANSACTIONS'
165597 , p_event_class_code => 'TRANSFERS'
165598 , p_side => 'NA'
165599 );
165600
165601 END IF;
165602
165603 --
165604 --
165605 END IF;
165606 --
165607 -- Bug 4922099
165608 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
165609 (NVL(l_enc_upg_option, 'N') = 'O')
165610 ) AND
165611 (l_bflow_method_code = 'PRIOR_ENTRY')
165612 )
165613 THEN
165614 IF
165615 --
165616 1 = 2
165617 --
165618 THEN
165619 xla_accounting_err_pkg.build_message
165620 (p_appli_s_name => 'XLA'
165621 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
165622 ,p_token_1 => 'LINE_NUMBER'
165626 l_component_type
165623 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
165624 ,p_token_2 => 'LINE_TYPE_NAME'
165625 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
165627 ,l_component_code
165628 ,l_component_type_code
165629 ,l_component_appl_id
165630 ,l_amb_context_code
165631 ,l_entity_code
165632 ,l_event_class_code
165633 )
165634 ,p_token_3 => 'OWNER'
165635 ,p_value_3 => xla_lookups_pkg.get_meaning(
165636 p_lookup_type => 'XLA_OWNER_TYPE'
165637 ,p_lookup_code => l_component_type_code
165638 )
165639 ,p_token_4 => 'PRODUCT_NAME'
165640 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
165641 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
165642 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
165643 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
165644 ,p_ae_header_id => NULL
165645 );
165646
165647 IF (C_LEVEL_ERROR>= g_log_level) THEN
165648 trace
165649 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
165650 ,p_level => C_LEVEL_ERROR
165651 ,p_module => l_log_module);
165652 END IF;
165653 END IF;
165654 END IF;
165655 --
165656 --
165657 ------------------------------------------------------------------------------------------------
165658 -- 4219869 Business Flow
165659 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
165660 -- Prior Entry. Currently, the following code is always generated.
165661 ------------------------------------------------------------------------------------------------
165662 XLA_AE_LINES_PKG.ValidateCurrentLine;
165663
165664 ------------------------------------------------------------------------------------
165665 -- 4219869 Business Flow
165666 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
165667 ------------------------------------------------------------------------------------
165668 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
165669
165670 ----------------------------------------------------------------------------------
165671 -- 4219869 Business Flow
165672 -- Update journal entry status -- Need to generate this within IF <condition>
165673 ----------------------------------------------------------------------------------
165674 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
165675 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
165676 ,p_balance_type_code => l_balance_type_code
165677 );
165678
165679 -------------------------------------------------------------------------------------------
165680 -- 4262811 - Generate the Accrual Reversal lines
165681 -------------------------------------------------------------------------------------------
165682 BEGIN
165683 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
165684 (g_array_event(p_event_id).array_value_num('header_index'));
165685 IF l_acc_rev_flag IS NULL THEN
165686 l_acc_rev_flag := 'N';
165687 END IF;
165688 EXCEPTION
165689 WHEN OTHERS THEN
165690 l_acc_rev_flag := 'N';
165691 END;
165692 --
165693 IF (l_acc_rev_flag = 'Y') THEN
165694
165695 -- 4645092 ------------------------------------------------------------------------------
165696 -- To allow MPA report to determine if it should generate report process
165697 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
165698 ------------------------------------------------------------------------------------------
165699
165700 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
165701 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
165702 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
165703 -- call ADRs
165704 -- Bug 4922099
165705 --
165706 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
165707 (NVL(l_actual_upg_option, 'N') = 'O') OR
165708 (NVL(l_enc_upg_option, 'N') = 'O')
165709 )
165710 THEN
165711 NULL;
165712 --
165713 --
165714
165715 l_ccid := AcctDerRule_175(
165716 p_application_id => p_application_id
165720 , p_source_32 => p_source_32
165717 , p_ae_header_id => l_ae_header_id
165718 , p_source_5 => p_source_5
165719 , p_source_19 => p_source_19
165721 , x_transaction_coa_id => l_adr_transaction_coa_id
165722 , x_accounting_coa_id => l_adr_accounting_coa_id
165723 , x_value_type_code => l_adr_value_type_code
165724 , p_side => 'NA'
165725 );
165726
165727 xla_ae_lines_pkg.set_ccid(
165728 p_code_combination_id => l_ccid
165729 , p_value_type_code => l_adr_value_type_code
165730 , p_transaction_coa_id => l_adr_transaction_coa_id
165731 , p_accounting_coa_id => l_adr_accounting_coa_id
165732 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
165733 , p_adr_type_code => 'S'
165734 , p_component_type => l_component_type
165735 , p_component_code => l_component_code
165736 , p_component_type_code => l_component_type_code
165737 , p_component_appl_id => l_component_appl_id
165738 , p_amb_context_code => l_amb_context_code
165739 , p_side => 'NA'
165740 );
165741
165742
165743 l_segment := AcctDerRule_150(
165744 p_application_id => p_application_id
165745 , p_ae_header_id => l_ae_header_id
165746 , p_source_5 => p_source_5
165747 , p_source_12 => p_source_12
165748 , x_transaction_coa_id => l_adr_transaction_coa_id
165749 , x_accounting_coa_id => l_adr_accounting_coa_id
165750 , x_flexfield_segment_code => l_adr_flexfield_segment_code
165751 , x_flex_value_set_id => l_adr_flex_value_set_id
165752 , x_value_type_code => l_adr_value_type_code
165753 , x_value_combination_id => l_adr_value_combination_id
165754 , x_value_segment_code => l_adr_value_segment_code
165755 , p_side => 'NA'
165756 , p_override_seg_flag => 'Y'
165757 );
165758
165759 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
165760
165761 xla_ae_lines_pkg.set_segment(
165762 p_to_segment_code => 'GL_ACCOUNT'
165763 , p_segment_value => l_segment
165764 , p_from_segment_code => l_adr_value_segment_code
165765 , p_from_combination_id => l_adr_value_combination_id
165766 , p_value_type_code => l_adr_value_type_code
165767 , p_transaction_coa_id => l_adr_transaction_coa_id
165768 , p_accounting_coa_id => l_adr_accounting_coa_id
165769 , p_flexfield_segment_code => l_adr_flexfield_segment_code
165770 , p_flex_value_set_id => l_adr_flex_value_set_id
165771 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
165772 , p_adr_type_code => 'S'
165773 , p_component_type => l_component_type
165774 , p_component_code => l_component_code
165775 , p_component_type_code => l_component_type_code
165776 , p_component_appl_id => l_component_appl_id
165777 , p_amb_context_code => l_amb_context_code
165778 , p_entity_code => 'TRANSACTIONS'
165779 , p_event_class_code => 'TRANSFERS'
165780 , p_side => 'NA'
165781 );
165782
165783 END IF;
165784
165785 l_segment := AcctDerRule_169(
165786 p_application_id => p_application_id
165787 , p_ae_header_id => l_ae_header_id
165788 , p_source_5 => p_source_5
165789 , p_source_31 => p_source_31
165790 , x_transaction_coa_id => l_adr_transaction_coa_id
165791 , x_accounting_coa_id => l_adr_accounting_coa_id
165792 , x_flexfield_segment_code => l_adr_flexfield_segment_code
165793 , x_flex_value_set_id => l_adr_flex_value_set_id
165794 , x_value_type_code => l_adr_value_type_code
165795 , x_value_combination_id => l_adr_value_combination_id
165796 , x_value_segment_code => l_adr_value_segment_code
165797 , p_side => 'NA'
165798 , p_override_seg_flag => 'Y'
165799 );
165800
165801 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
165802
165803 xla_ae_lines_pkg.set_segment(
165804 p_to_segment_code => 'GL_BALANCING'
165805 , p_segment_value => l_segment
165806 , p_from_segment_code => l_adr_value_segment_code
165807 , p_from_combination_id => l_adr_value_combination_id
165808 , p_value_type_code => l_adr_value_type_code
165809 , p_transaction_coa_id => l_adr_transaction_coa_id
165810 , p_accounting_coa_id => l_adr_accounting_coa_id
165811 , p_flexfield_segment_code => l_adr_flexfield_segment_code
165812 , p_flex_value_set_id => l_adr_flex_value_set_id
165813 , p_adr_code => 'FA_EXPENSE_ACCT'
165814 , p_adr_type_code => 'S'
165815 , p_component_type => l_component_type
165816 , p_component_code => l_component_code
165817 , p_component_type_code => l_component_type_code
165818 , p_component_appl_id => l_component_appl_id
165819 , p_amb_context_code => l_amb_context_code
165820 , p_entity_code => 'TRANSACTIONS'
165821 , p_event_class_code => 'TRANSFERS'
165822 , p_side => 'NA'
165823 );
165824
165825 END IF;
165826
165827 --
165828 --
165832 -- Update the line information that should be overwritten
165829 END IF;
165830
165831 --
165833 --
165834 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
165835 p_header_num => 1);
165836 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
165837
165838 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
165839
165840 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
165841 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
165842 END IF;
165843
165844 --
165845 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
165846 --
165847 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
165848 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
165849 ELSE
165850 ---------------------------------------------------------------------------------------------------
165851 -- 4262811a Switch Sign
165852 ---------------------------------------------------------------------------------------------------
165853 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
165854 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
165855 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
165856 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
165857 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
165858 -- 5132302
165859 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
165860 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
165861
165862 END IF;
165863
165864 -- 4955764
165865 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
165866 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
165867
165868
165869 XLA_AE_LINES_PKG.ValidateCurrentLine;
165870 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
165871
165872 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
165873 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
165874 ,p_balance_type_code => l_balance_type_code);
165875
165876 END IF;
165877
165878 -----------------------------------------------------------------------------------------
165879 -- 4262811 Multiperiod Accounting
165880 -----------------------------------------------------------------------------------------
165881 -- No MPA option is assigned.
165882
165883
165884 END IF;
165885 END IF;
165886 --
165887
165888 --
165889 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
165890 trace
165891 (p_msg => 'END of AcctLineType_397'
165892 ,p_level => C_LEVEL_PROCEDURE
165893 ,p_module => l_log_module);
165894 END IF;
165895 --
165896 EXCEPTION
165897 WHEN xla_exceptions_pkg.application_exception THEN
165898 RAISE;
165899 WHEN OTHERS THEN
165900 xla_exceptions_pkg.raise_message
165901 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_397');
165902 END AcctLineType_397;
165903 --
165904
165905 ---------------------------------------
165906 --
165907 -- PRIVATE FUNCTION
165908 -- AcctLineType_398
165909 --
165910 ---------------------------------------
165911 PROCEDURE AcctLineType_398 (
165912 p_application_id IN NUMBER
165913 ,p_event_id IN NUMBER
165914 ,p_calculate_acctd_flag IN VARCHAR2
165915 ,p_calculate_g_l_flag IN VARCHAR2
165916 ,p_actual_flag IN OUT VARCHAR2
165917 ,p_balance_type_code OUT VARCHAR2
165918 ,p_gain_or_loss_ref OUT VARCHAR2
165919
165920 --Period Close Date
165921 , p_source_1 IN DATE
165922 --Generated Code Combination Identifier
165923 , p_source_5 IN NUMBER
165924 --Revaluation Reserve Account
165925 , p_source_13 IN VARCHAR2
165926 --Generated Offset Code Combination Identifier
165927 , p_source_19 IN NUMBER
165928 --Expense Account Code Combination Identifier
165929 , p_source_31 IN NUMBER
165930 --Default Code Combination Identifier
165931 , p_source_32 IN NUMBER
165932 --Adjustment Type
165933 , p_source_48 IN VARCHAR2
165934 --Transaction Header Identifier
165935 , p_source_49 IN NUMBER
165936 --Adjustment Line Identifier
165937 , p_source_50 IN NUMBER
165938 --Distribution Type Code
165939 , p_source_51 IN VARCHAR2
165940 --Entered Amount
165941 , p_source_52 IN NUMBER
165942 --Currency Code
165943 , p_source_53 IN VARCHAR2
165944 --Source Destination Code
165945 , p_source_55 IN VARCHAR2
165946 )
165947 IS
165948
165949 l_component_type VARCHAR2(80);
165950 l_component_code VARCHAR2(30);
165951 l_component_type_code VARCHAR2(1);
165952 l_component_appl_id INTEGER;
165956 l_ae_header_id NUMBER;
165953 l_amb_context_code VARCHAR2(30);
165954 l_entity_code VARCHAR2(30);
165955 l_event_class_code VARCHAR2(30);
165957 l_event_type_code VARCHAR2(30);
165958 l_line_definition_code VARCHAR2(30);
165959 l_line_definition_owner_code VARCHAR2(1);
165960 --
165961 -- adr variables
165962 l_segment VARCHAR2(30);
165963 l_ccid NUMBER;
165964 l_adr_transaction_coa_id NUMBER;
165965 l_adr_accounting_coa_id NUMBER;
165966 l_adr_flexfield_segment_code VARCHAR2(30);
165967 l_adr_flex_value_set_id NUMBER;
165968 l_adr_value_type_code VARCHAR2(30);
165969 l_adr_value_combination_id NUMBER;
165970 l_adr_value_segment_code VARCHAR2(30);
165971
165972 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
165973 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
165974 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
165975 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
165976
165977 -- 4262811 Variables ------------------------------------------------------------------------------------------
165978 l_entered_amt_idx NUMBER;
165979 l_accted_amt_idx NUMBER;
165980 l_acc_rev_flag VARCHAR2(1);
165981 l_accrual_line_num NUMBER;
165982 l_tmp_amt NUMBER;
165983 l_acc_rev_natural_side_code VARCHAR2(1);
165984
165985 l_num_entries NUMBER;
165986 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
165987 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
165988 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
165989 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
165990 l_recog_line_1 NUMBER;
165991 l_recog_line_2 NUMBER;
165992
165993 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
165994 l_bflow_applied_to_amt NUMBER; -- 5132302
165995 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
165996
165997 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
165998
165999 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
166000 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
166001
166002 ---------------------------------------------------------------------------------------------------------------
166003
166004
166005 --
166006 -- bulk performance
166007 --
166008 l_balance_type_code VARCHAR2(1);
166009 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
166010 l_log_module VARCHAR2(240);
166011
166012 --
166013 -- Upgrade strategy
166014 --
166015 l_actual_upg_option VARCHAR2(1);
166016 l_enc_upg_option VARCHAR2(1);
166017
166018 --
166019 BEGIN
166020 --
166021 IF g_log_enabled THEN
166022 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_398';
166023 END IF;
166024 --
166025 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
166026
166027 trace
166028 (p_msg => 'BEGIN of AcctLineType_398'
166029 ,p_level => C_LEVEL_PROCEDURE
166030 ,p_module => l_log_module);
166031
166032 END IF;
166033 --
166034 l_component_type := 'AMB_JLT';
166035 l_component_code := 'FA_TRANSFER_SOURCE_REVAL_RES';
166036 l_component_type_code := 'S';
166037 l_component_appl_id := 140;
166038 l_amb_context_code := 'DEFAULT';
166039 l_entity_code := 'TRANSACTIONS';
166040 l_event_class_code := 'TRANSFERS';
166041 l_event_type_code := 'TRANSFERS_ALL';
166042 l_line_definition_owner_code := 'S';
166043 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_TRANS25';
166044 --
166045 l_balance_type_code := 'A';
166046 l_segment := NULL;
166047 l_ccid := NULL;
166048 l_adr_transaction_coa_id := NULL;
166049 l_adr_accounting_coa_id := NULL;
166050 l_adr_flexfield_segment_code := NULL;
166051 l_adr_flex_value_set_id := NULL;
166052 l_adr_value_type_code := NULL;
166053 l_adr_value_combination_id := NULL;
166054 l_adr_value_segment_code := NULL;
166055
166056 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
166057 l_bflow_class_code := ''; -- 4219869 Business Flow
166058 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
166059 l_budgetary_control_flag := 'N';
166060
166061 l_bflow_applied_to_amt_idx := NULL; -- 5132302
166062 l_bflow_applied_to_amt := NULL; -- 5132302
166063 l_entered_amt_idx := NULL; -- 4262811
166064 l_accted_amt_idx := NULL; -- 4262811
166065 l_acc_rev_flag := NULL; -- 4262811
166066 l_accrual_line_num := NULL; -- 4262811
166067 l_tmp_amt := NULL; -- 4262811
166068 --
166069
166070 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
166071 l_balance_type_code <> 'B' THEN
166072 IF NVL(p_source_48,'
166073 ') = 'REVAL RESERVE' AND
166074 NVL(p_source_55,'
166075 ') = 'SOURCE'
166076 THEN
166077
166078 --
166079 XLA_AE_LINES_PKG.SetNewLine;
166080
166084 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
166081 p_balance_type_code := l_balance_type_code;
166082 -- set the flag so later we will know whether the gain loss line needs to be created
166083
166085 p_actual_flag :='A';
166086 END IF;
166087
166088 --
166089 -- bulk performance
166090 --
166091 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
166092 p_header_num => 0); -- 4262811
166093 --
166094 -- set accounting line options
166095 --
166096 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
166097 p_natural_side_code => 'D'
166098 , p_gain_or_loss_flag => 'N'
166099 , p_gl_transfer_mode_code => 'S'
166100 , p_acct_entry_type_code => 'A'
166101 , p_switch_side_flag => 'Y'
166102 , p_merge_duplicate_code => 'N'
166103 );
166104 --
166105 l_acc_rev_natural_side_code := 'C'; -- 4262811
166106 --
166107 --
166108 -- set accounting line type info
166109 --
166110 xla_ae_lines_pkg.SetAcctLineType
166111 (p_component_type => l_component_type
166112 ,p_event_type_code => l_event_type_code
166113 ,p_line_definition_owner_code => l_line_definition_owner_code
166114 ,p_line_definition_code => l_line_definition_code
166115 ,p_accounting_line_code => l_component_code
166116 ,p_accounting_line_type_code => l_component_type_code
166117 ,p_accounting_line_appl_id => l_component_appl_id
166118 ,p_amb_context_code => l_amb_context_code
166119 ,p_entity_code => l_entity_code
166120 ,p_event_class_code => l_event_class_code);
166121 --
166122 -- set accounting class
166123 --
166124 xla_ae_lines_pkg.SetAcctClass(
166125 p_accounting_class_code => 'ASSET'
166126 , p_ae_header_id => l_ae_header_id
166127 );
166128
166129 --
166130 -- set rounding class
166131 --
166132 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
166133 'ASSET';
166134
166135 --
166136 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
166137 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
166138 --
166139 -- bulk performance
166140 --
166141 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
166142
166143 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
166144 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
166145
166146 -- 4955764
166147 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
166148 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
166149
166150 -- 4458381 Public Sector Enh
166151
166152 --
166153 -- set accounting attributes for the line type
166154 --
166155 l_entered_amt_idx := 4;
166156 l_accted_amt_idx := 6;
166157 l_bflow_applied_to_amt_idx := NULL; -- 5132302
166158 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
166159 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
166160 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
166161 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
166162 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
166163 l_rec_acct_attrs.array_char_value(3) := p_source_51;
166164 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
166165 l_rec_acct_attrs.array_num_value(4) := p_source_52;
166166 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
166167 l_rec_acct_attrs.array_char_value(5) := p_source_53;
166168 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
166169 l_rec_acct_attrs.array_num_value(6) := p_source_52;
166170
166171 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
166172 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
166173
166174 ---------------------------------------------------------------------------------------------------------------
166175 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
166176 ---------------------------------------------------------------------------------------------------------------
166177 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
166178
166179 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
166180 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
166181
166182 IF xla_accounting_cache_pkg.GetValueChar
166183 (p_source_code => 'LEDGER_CATEGORY_CODE'
166184 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
166185 AND l_bflow_method_code = 'PRIOR_ENTRY'
166186 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
166187 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
166188 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
166189 )
166190 THEN
166194 ,p_balance_type => l_balance_type_code);
166191 xla_ae_lines_pkg.BflowUpgEntry
166192 (p_business_method_code => l_bflow_method_code
166193 ,p_business_class_code => l_bflow_class_code
166195 ELSE
166196 NULL;
166197 -- No business flow processing for business flow method of NONE.
166198 END IF;
166199
166200 --
166201 -- call analytical criteria
166202 --
166203
166204 --
166205 -- call description
166206 --
166207
166208 xla_ae_lines_pkg.SetLineDescription(
166209 p_ae_header_id => l_ae_header_id
166210 ,p_description => Description_131 (
166211 p_application_id => p_application_id
166212 , p_ae_header_id => l_ae_header_id
166213 , p_source_1 => p_source_1
166214 )
166215 );
166216
166217
166218 --
166219 -- call ADRs
166220 -- Bug 4922099
166221 --
166222 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
166223 (NVL(l_actual_upg_option, 'N') = 'O') OR
166224 (NVL(l_enc_upg_option, 'N') = 'O')
166225 )
166226 THEN
166227 NULL;
166228 --
166229 --
166230
166231 l_ccid := AcctDerRule_175(
166232 p_application_id => p_application_id
166233 , p_ae_header_id => l_ae_header_id
166234 , p_source_5 => p_source_5
166235 , p_source_19 => p_source_19
166236 , p_source_32 => p_source_32
166237 , x_transaction_coa_id => l_adr_transaction_coa_id
166238 , x_accounting_coa_id => l_adr_accounting_coa_id
166239 , x_value_type_code => l_adr_value_type_code
166240 , p_side => 'NA'
166241 );
166242
166243 xla_ae_lines_pkg.set_ccid(
166244 p_code_combination_id => l_ccid
166245 , p_value_type_code => l_adr_value_type_code
166246 , p_transaction_coa_id => l_adr_transaction_coa_id
166247 , p_accounting_coa_id => l_adr_accounting_coa_id
166248 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
166249 , p_adr_type_code => 'S'
166250 , p_component_type => l_component_type
166251 , p_component_code => l_component_code
166252 , p_component_type_code => l_component_type_code
166253 , p_component_appl_id => l_component_appl_id
166254 , p_amb_context_code => l_amb_context_code
166255 , p_side => 'NA'
166256 );
166257
166258
166259 l_segment := AcctDerRule_151(
166260 p_application_id => p_application_id
166261 , p_ae_header_id => l_ae_header_id
166262 , p_source_5 => p_source_5
166263 , p_source_13 => p_source_13
166264 , x_transaction_coa_id => l_adr_transaction_coa_id
166265 , x_accounting_coa_id => l_adr_accounting_coa_id
166266 , x_flexfield_segment_code => l_adr_flexfield_segment_code
166267 , x_flex_value_set_id => l_adr_flex_value_set_id
166268 , x_value_type_code => l_adr_value_type_code
166269 , x_value_combination_id => l_adr_value_combination_id
166270 , x_value_segment_code => l_adr_value_segment_code
166271 , p_side => 'NA'
166272 , p_override_seg_flag => 'Y'
166273 );
166274
166275 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
166276
166277 xla_ae_lines_pkg.set_segment(
166278 p_to_segment_code => 'GL_ACCOUNT'
166279 , p_segment_value => l_segment
166280 , p_from_segment_code => l_adr_value_segment_code
166281 , p_from_combination_id => l_adr_value_combination_id
166282 , p_value_type_code => l_adr_value_type_code
166283 , p_transaction_coa_id => l_adr_transaction_coa_id
166284 , p_accounting_coa_id => l_adr_accounting_coa_id
166285 , p_flexfield_segment_code => l_adr_flexfield_segment_code
166286 , p_flex_value_set_id => l_adr_flex_value_set_id
166287 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
166288 , p_adr_type_code => 'S'
166289 , p_component_type => l_component_type
166290 , p_component_code => l_component_code
166291 , p_component_type_code => l_component_type_code
166292 , p_component_appl_id => l_component_appl_id
166293 , p_amb_context_code => l_amb_context_code
166294 , p_entity_code => 'TRANSACTIONS'
166295 , p_event_class_code => 'TRANSFERS'
166296 , p_side => 'NA'
166297 );
166298
166299 END IF;
166300
166301 l_segment := AcctDerRule_169(
166302 p_application_id => p_application_id
166303 , p_ae_header_id => l_ae_header_id
166304 , p_source_5 => p_source_5
166305 , p_source_31 => p_source_31
166306 , x_transaction_coa_id => l_adr_transaction_coa_id
166307 , x_accounting_coa_id => l_adr_accounting_coa_id
166308 , x_flexfield_segment_code => l_adr_flexfield_segment_code
166309 , x_flex_value_set_id => l_adr_flex_value_set_id
166310 , x_value_type_code => l_adr_value_type_code
166311 , x_value_combination_id => l_adr_value_combination_id
166312 , x_value_segment_code => l_adr_value_segment_code
166313 , p_side => 'NA'
166314 , p_override_seg_flag => 'Y'
166315 );
166316
166320 p_to_segment_code => 'GL_BALANCING'
166317 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
166318
166319 xla_ae_lines_pkg.set_segment(
166321 , p_segment_value => l_segment
166322 , p_from_segment_code => l_adr_value_segment_code
166323 , p_from_combination_id => l_adr_value_combination_id
166324 , p_value_type_code => l_adr_value_type_code
166325 , p_transaction_coa_id => l_adr_transaction_coa_id
166326 , p_accounting_coa_id => l_adr_accounting_coa_id
166327 , p_flexfield_segment_code => l_adr_flexfield_segment_code
166328 , p_flex_value_set_id => l_adr_flex_value_set_id
166329 , p_adr_code => 'FA_EXPENSE_ACCT'
166330 , p_adr_type_code => 'S'
166331 , p_component_type => l_component_type
166332 , p_component_code => l_component_code
166333 , p_component_type_code => l_component_type_code
166334 , p_component_appl_id => l_component_appl_id
166335 , p_amb_context_code => l_amb_context_code
166336 , p_entity_code => 'TRANSACTIONS'
166337 , p_event_class_code => 'TRANSFERS'
166338 , p_side => 'NA'
166339 );
166340
166341 END IF;
166342
166343 --
166344 --
166345 END IF;
166346 --
166347 -- Bug 4922099
166348 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
166349 (NVL(l_enc_upg_option, 'N') = 'O')
166350 ) AND
166351 (l_bflow_method_code = 'PRIOR_ENTRY')
166352 )
166353 THEN
166354 IF
166355 --
166356 1 = 2
166357 --
166358 THEN
166359 xla_accounting_err_pkg.build_message
166360 (p_appli_s_name => 'XLA'
166361 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
166362 ,p_token_1 => 'LINE_NUMBER'
166363 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
166364 ,p_token_2 => 'LINE_TYPE_NAME'
166365 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
166366 l_component_type
166367 ,l_component_code
166368 ,l_component_type_code
166369 ,l_component_appl_id
166370 ,l_amb_context_code
166371 ,l_entity_code
166372 ,l_event_class_code
166373 )
166374 ,p_token_3 => 'OWNER'
166375 ,p_value_3 => xla_lookups_pkg.get_meaning(
166376 p_lookup_type => 'XLA_OWNER_TYPE'
166377 ,p_lookup_code => l_component_type_code
166378 )
166379 ,p_token_4 => 'PRODUCT_NAME'
166380 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
166381 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
166382 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
166383 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
166384 ,p_ae_header_id => NULL
166385 );
166386
166387 IF (C_LEVEL_ERROR>= g_log_level) THEN
166388 trace
166389 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
166390 ,p_level => C_LEVEL_ERROR
166391 ,p_module => l_log_module);
166392 END IF;
166393 END IF;
166394 END IF;
166395 --
166396 --
166397 ------------------------------------------------------------------------------------------------
166398 -- 4219869 Business Flow
166399 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
166400 -- Prior Entry. Currently, the following code is always generated.
166401 ------------------------------------------------------------------------------------------------
166402 XLA_AE_LINES_PKG.ValidateCurrentLine;
166403
166404 ------------------------------------------------------------------------------------
166405 -- 4219869 Business Flow
166406 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
166407 ------------------------------------------------------------------------------------
166408 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
166409
166410 ----------------------------------------------------------------------------------
166411 -- 4219869 Business Flow
166412 -- Update journal entry status -- Need to generate this within IF <condition>
166413 ----------------------------------------------------------------------------------
166417 );
166414 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
166415 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
166416 ,p_balance_type_code => l_balance_type_code
166418
166419 -------------------------------------------------------------------------------------------
166420 -- 4262811 - Generate the Accrual Reversal lines
166421 -------------------------------------------------------------------------------------------
166422 BEGIN
166423 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
166424 (g_array_event(p_event_id).array_value_num('header_index'));
166425 IF l_acc_rev_flag IS NULL THEN
166426 l_acc_rev_flag := 'N';
166427 END IF;
166428 EXCEPTION
166429 WHEN OTHERS THEN
166430 l_acc_rev_flag := 'N';
166431 END;
166432 --
166433 IF (l_acc_rev_flag = 'Y') THEN
166434
166435 -- 4645092 ------------------------------------------------------------------------------
166436 -- To allow MPA report to determine if it should generate report process
166437 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
166438 ------------------------------------------------------------------------------------------
166439
166440 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
166441 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
166442 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
166443 -- call ADRs
166444 -- Bug 4922099
166445 --
166446 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
166447 (NVL(l_actual_upg_option, 'N') = 'O') OR
166448 (NVL(l_enc_upg_option, 'N') = 'O')
166449 )
166450 THEN
166451 NULL;
166452 --
166453 --
166454
166455 l_ccid := AcctDerRule_175(
166456 p_application_id => p_application_id
166457 , p_ae_header_id => l_ae_header_id
166458 , p_source_5 => p_source_5
166459 , p_source_19 => p_source_19
166460 , p_source_32 => p_source_32
166461 , x_transaction_coa_id => l_adr_transaction_coa_id
166462 , x_accounting_coa_id => l_adr_accounting_coa_id
166463 , x_value_type_code => l_adr_value_type_code
166464 , p_side => 'NA'
166465 );
166466
166467 xla_ae_lines_pkg.set_ccid(
166468 p_code_combination_id => l_ccid
166469 , p_value_type_code => l_adr_value_type_code
166470 , p_transaction_coa_id => l_adr_transaction_coa_id
166471 , p_accounting_coa_id => l_adr_accounting_coa_id
166472 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
166473 , p_adr_type_code => 'S'
166474 , p_component_type => l_component_type
166475 , p_component_code => l_component_code
166476 , p_component_type_code => l_component_type_code
166477 , p_component_appl_id => l_component_appl_id
166478 , p_amb_context_code => l_amb_context_code
166479 , p_side => 'NA'
166480 );
166481
166482
166483 l_segment := AcctDerRule_151(
166484 p_application_id => p_application_id
166485 , p_ae_header_id => l_ae_header_id
166486 , p_source_5 => p_source_5
166487 , p_source_13 => p_source_13
166488 , x_transaction_coa_id => l_adr_transaction_coa_id
166489 , x_accounting_coa_id => l_adr_accounting_coa_id
166490 , x_flexfield_segment_code => l_adr_flexfield_segment_code
166491 , x_flex_value_set_id => l_adr_flex_value_set_id
166492 , x_value_type_code => l_adr_value_type_code
166493 , x_value_combination_id => l_adr_value_combination_id
166494 , x_value_segment_code => l_adr_value_segment_code
166495 , p_side => 'NA'
166496 , p_override_seg_flag => 'Y'
166497 );
166498
166499 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
166500
166501 xla_ae_lines_pkg.set_segment(
166502 p_to_segment_code => 'GL_ACCOUNT'
166503 , p_segment_value => l_segment
166504 , p_from_segment_code => l_adr_value_segment_code
166505 , p_from_combination_id => l_adr_value_combination_id
166506 , p_value_type_code => l_adr_value_type_code
166507 , p_transaction_coa_id => l_adr_transaction_coa_id
166508 , p_accounting_coa_id => l_adr_accounting_coa_id
166509 , p_flexfield_segment_code => l_adr_flexfield_segment_code
166510 , p_flex_value_set_id => l_adr_flex_value_set_id
166511 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
166512 , p_adr_type_code => 'S'
166513 , p_component_type => l_component_type
166514 , p_component_code => l_component_code
166515 , p_component_type_code => l_component_type_code
166516 , p_component_appl_id => l_component_appl_id
166517 , p_amb_context_code => l_amb_context_code
166518 , p_entity_code => 'TRANSACTIONS'
166519 , p_event_class_code => 'TRANSFERS'
166520 , p_side => 'NA'
166521 );
166522
166523 END IF;
166524
166525 l_segment := AcctDerRule_169(
166526 p_application_id => p_application_id
166527 , p_ae_header_id => l_ae_header_id
166528 , p_source_5 => p_source_5
166532 , x_flexfield_segment_code => l_adr_flexfield_segment_code
166529 , p_source_31 => p_source_31
166530 , x_transaction_coa_id => l_adr_transaction_coa_id
166531 , x_accounting_coa_id => l_adr_accounting_coa_id
166533 , x_flex_value_set_id => l_adr_flex_value_set_id
166534 , x_value_type_code => l_adr_value_type_code
166535 , x_value_combination_id => l_adr_value_combination_id
166536 , x_value_segment_code => l_adr_value_segment_code
166537 , p_side => 'NA'
166538 , p_override_seg_flag => 'Y'
166539 );
166540
166541 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
166542
166543 xla_ae_lines_pkg.set_segment(
166544 p_to_segment_code => 'GL_BALANCING'
166545 , p_segment_value => l_segment
166546 , p_from_segment_code => l_adr_value_segment_code
166547 , p_from_combination_id => l_adr_value_combination_id
166548 , p_value_type_code => l_adr_value_type_code
166549 , p_transaction_coa_id => l_adr_transaction_coa_id
166550 , p_accounting_coa_id => l_adr_accounting_coa_id
166551 , p_flexfield_segment_code => l_adr_flexfield_segment_code
166552 , p_flex_value_set_id => l_adr_flex_value_set_id
166553 , p_adr_code => 'FA_EXPENSE_ACCT'
166554 , p_adr_type_code => 'S'
166555 , p_component_type => l_component_type
166556 , p_component_code => l_component_code
166557 , p_component_type_code => l_component_type_code
166558 , p_component_appl_id => l_component_appl_id
166559 , p_amb_context_code => l_amb_context_code
166560 , p_entity_code => 'TRANSACTIONS'
166561 , p_event_class_code => 'TRANSFERS'
166562 , p_side => 'NA'
166563 );
166564
166565 END IF;
166566
166567 --
166568 --
166569 END IF;
166570
166571 --
166572 -- Update the line information that should be overwritten
166573 --
166574 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
166575 p_header_num => 1);
166576 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
166577
166578 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
166579
166580 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
166581 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
166582 END IF;
166583
166584 --
166585 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
166586 --
166587 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
166588 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
166589 ELSE
166590 ---------------------------------------------------------------------------------------------------
166591 -- 4262811a Switch Sign
166592 ---------------------------------------------------------------------------------------------------
166593 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
166594 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
166595 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
166596 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
166597 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
166598 -- 5132302
166599 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
166600 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
166601
166602 END IF;
166603
166604 -- 4955764
166605 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
166606 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
166607
166608
166609 XLA_AE_LINES_PKG.ValidateCurrentLine;
166610 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
166611
166612 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
166613 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
166614 ,p_balance_type_code => l_balance_type_code);
166615
166616 END IF;
166617
166618 -----------------------------------------------------------------------------------------
166619 -- 4262811 Multiperiod Accounting
166620 -----------------------------------------------------------------------------------------
166621 -- No MPA option is assigned.
166622
166623
166624 END IF;
166625 END IF;
166626 --
166627
166628 --
166629 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
166630 trace
166631 (p_msg => 'END of AcctLineType_398'
166632 ,p_level => C_LEVEL_PROCEDURE
166633 ,p_module => l_log_module);
166634 END IF;
166635 --
166636 EXCEPTION
166637 WHEN xla_exceptions_pkg.application_exception THEN
166638 RAISE;
166639 WHEN OTHERS THEN
166643 --
166640 xla_exceptions_pkg.raise_message
166641 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_398');
166642 END AcctLineType_398;
166644
166645 ---------------------------------------
166646 --
166647 -- PRIVATE FUNCTION
166648 -- AcctLineType_399
166649 --
166650 ---------------------------------------
166651 PROCEDURE AcctLineType_399 (
166652 p_application_id IN NUMBER
166653 ,p_event_id IN NUMBER
166654 ,p_calculate_acctd_flag IN VARCHAR2
166655 ,p_calculate_g_l_flag IN VARCHAR2
166656 ,p_actual_flag IN OUT VARCHAR2
166657 ,p_balance_type_code OUT VARCHAR2
166658 ,p_gain_or_loss_ref OUT VARCHAR2
166659
166660 --Period Close Date
166661 , p_source_1 IN DATE
166662 --Generated Code Combination Identifier
166663 , p_source_5 IN NUMBER
166664 --Asset Cost Account
166665 , p_source_11 IN VARCHAR2
166666 --Expense Account Code Combination Identifier
166667 , p_source_31 IN NUMBER
166668 --Default Code Combination Identifier
166669 , p_source_32 IN NUMBER
166670 --Adjustment Type
166671 , p_source_48 IN VARCHAR2
166672 --Transaction Header Identifier
166673 , p_source_49 IN NUMBER
166674 --Adjustment Line Identifier
166675 , p_source_50 IN NUMBER
166676 --Distribution Type Code
166677 , p_source_51 IN VARCHAR2
166678 --Entered Amount
166679 , p_source_52 IN NUMBER
166680 --Currency Code
166681 , p_source_53 IN VARCHAR2
166682 --Source Destination Code
166683 , p_source_55 IN VARCHAR2
166684 )
166685 IS
166686
166687 l_component_type VARCHAR2(80);
166688 l_component_code VARCHAR2(30);
166689 l_component_type_code VARCHAR2(1);
166690 l_component_appl_id INTEGER;
166691 l_amb_context_code VARCHAR2(30);
166692 l_entity_code VARCHAR2(30);
166693 l_event_class_code VARCHAR2(30);
166694 l_ae_header_id NUMBER;
166695 l_event_type_code VARCHAR2(30);
166696 l_line_definition_code VARCHAR2(30);
166697 l_line_definition_owner_code VARCHAR2(1);
166698 --
166699 -- adr variables
166700 l_segment VARCHAR2(30);
166701 l_ccid NUMBER;
166702 l_adr_transaction_coa_id NUMBER;
166703 l_adr_accounting_coa_id NUMBER;
166704 l_adr_flexfield_segment_code VARCHAR2(30);
166705 l_adr_flex_value_set_id NUMBER;
166706 l_adr_value_type_code VARCHAR2(30);
166707 l_adr_value_combination_id NUMBER;
166708 l_adr_value_segment_code VARCHAR2(30);
166709
166710 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
166711 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
166712 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
166713 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
166714
166715 -- 4262811 Variables ------------------------------------------------------------------------------------------
166716 l_entered_amt_idx NUMBER;
166717 l_accted_amt_idx NUMBER;
166718 l_acc_rev_flag VARCHAR2(1);
166719 l_accrual_line_num NUMBER;
166720 l_tmp_amt NUMBER;
166721 l_acc_rev_natural_side_code VARCHAR2(1);
166722
166723 l_num_entries NUMBER;
166724 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
166725 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
166726 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
166727 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
166728 l_recog_line_1 NUMBER;
166729 l_recog_line_2 NUMBER;
166730
166731 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
166732 l_bflow_applied_to_amt NUMBER; -- 5132302
166733 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
166734
166735 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
166736
166737 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
166738 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
166739
166740 ---------------------------------------------------------------------------------------------------------------
166741
166742
166743 --
166744 -- bulk performance
166745 --
166746 l_balance_type_code VARCHAR2(1);
166747 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
166748 l_log_module VARCHAR2(240);
166749
166750 --
166751 -- Upgrade strategy
166752 --
166753 l_actual_upg_option VARCHAR2(1);
166754 l_enc_upg_option VARCHAR2(1);
166755
166756 --
166757 BEGIN
166758 --
166759 IF g_log_enabled THEN
166760 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_399';
166761 END IF;
166762 --
166763 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
166764
166765 trace
166766 (p_msg => 'BEGIN of AcctLineType_399'
166767 ,p_level => C_LEVEL_PROCEDURE
166768 ,p_module => l_log_module);
166769
166770 END IF;
166771 --
166772 l_component_type := 'AMB_JLT';
166776 l_amb_context_code := 'DEFAULT';
166773 l_component_code := 'FA_UNITADJ _DEST_COST';
166774 l_component_type_code := 'S';
166775 l_component_appl_id := 140;
166777 l_entity_code := 'TRANSACTIONS';
166778 l_event_class_code := 'UNIT_ADJUSTMENTS';
166779 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
166780 l_line_definition_owner_code := 'S';
166781 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
166782 --
166783 l_balance_type_code := 'A';
166784 l_segment := NULL;
166785 l_ccid := NULL;
166786 l_adr_transaction_coa_id := NULL;
166787 l_adr_accounting_coa_id := NULL;
166788 l_adr_flexfield_segment_code := NULL;
166789 l_adr_flex_value_set_id := NULL;
166790 l_adr_value_type_code := NULL;
166791 l_adr_value_combination_id := NULL;
166792 l_adr_value_segment_code := NULL;
166793
166794 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
166795 l_bflow_class_code := ''; -- 4219869 Business Flow
166796 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
166797 l_budgetary_control_flag := 'N';
166798
166799 l_bflow_applied_to_amt_idx := NULL; -- 5132302
166800 l_bflow_applied_to_amt := NULL; -- 5132302
166801 l_entered_amt_idx := NULL; -- 4262811
166802 l_accted_amt_idx := NULL; -- 4262811
166803 l_acc_rev_flag := NULL; -- 4262811
166804 l_accrual_line_num := NULL; -- 4262811
166805 l_tmp_amt := NULL; -- 4262811
166806 --
166807
166808 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
166809 l_balance_type_code <> 'B' THEN
166810 IF NVL(p_source_48,'
166811 ') = 'COST' AND
166812 NVL(p_source_55,'
166813 ') = 'DEST'
166814 THEN
166815
166816 --
166817 XLA_AE_LINES_PKG.SetNewLine;
166818
166819 p_balance_type_code := l_balance_type_code;
166820 -- set the flag so later we will know whether the gain loss line needs to be created
166821
166822 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
166823 p_actual_flag :='A';
166824 END IF;
166825
166826 --
166827 -- bulk performance
166828 --
166829 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
166830 p_header_num => 0); -- 4262811
166831 --
166832 -- set accounting line options
166833 --
166834 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
166835 p_natural_side_code => 'D'
166836 , p_gain_or_loss_flag => 'N'
166837 , p_gl_transfer_mode_code => 'S'
166838 , p_acct_entry_type_code => 'A'
166839 , p_switch_side_flag => 'Y'
166840 , p_merge_duplicate_code => 'N'
166841 );
166842 --
166843 l_acc_rev_natural_side_code := 'C'; -- 4262811
166844 --
166845 --
166846 -- set accounting line type info
166847 --
166848 xla_ae_lines_pkg.SetAcctLineType
166849 (p_component_type => l_component_type
166850 ,p_event_type_code => l_event_type_code
166851 ,p_line_definition_owner_code => l_line_definition_owner_code
166852 ,p_line_definition_code => l_line_definition_code
166853 ,p_accounting_line_code => l_component_code
166854 ,p_accounting_line_type_code => l_component_type_code
166855 ,p_accounting_line_appl_id => l_component_appl_id
166856 ,p_amb_context_code => l_amb_context_code
166857 ,p_entity_code => l_entity_code
166858 ,p_event_class_code => l_event_class_code);
166859 --
166860 -- set accounting class
166861 --
166862 xla_ae_lines_pkg.SetAcctClass(
166863 p_accounting_class_code => 'ASSET'
166864 , p_ae_header_id => l_ae_header_id
166865 );
166866
166867 --
166868 -- set rounding class
166869 --
166870 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
166871 'ASSET';
166872
166873 --
166874 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
166875 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
166876 --
166877 -- bulk performance
166878 --
166879 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
166880
166881 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
166882 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
166883
166884 -- 4955764
166885 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
166886 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
166887
166888 -- 4458381 Public Sector Enh
166889
166890 --
166891 -- set accounting attributes for the line type
166892 --
166893 l_entered_amt_idx := 4;
166894 l_accted_amt_idx := 6;
166895 l_bflow_applied_to_amt_idx := NULL; -- 5132302
166896 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
166897 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
166898 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
166902 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
166899 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
166900 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
166901 l_rec_acct_attrs.array_char_value(3) := p_source_51;
166903 l_rec_acct_attrs.array_num_value(4) := p_source_52;
166904 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
166905 l_rec_acct_attrs.array_char_value(5) := p_source_53;
166906 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
166907 l_rec_acct_attrs.array_num_value(6) := p_source_52;
166908
166909 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
166910 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
166911
166912 ---------------------------------------------------------------------------------------------------------------
166913 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
166914 ---------------------------------------------------------------------------------------------------------------
166915 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
166916
166917 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
166918 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
166919
166920 IF xla_accounting_cache_pkg.GetValueChar
166921 (p_source_code => 'LEDGER_CATEGORY_CODE'
166922 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
166923 AND l_bflow_method_code = 'PRIOR_ENTRY'
166924 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
166925 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
166926 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
166927 )
166928 THEN
166929 xla_ae_lines_pkg.BflowUpgEntry
166930 (p_business_method_code => l_bflow_method_code
166931 ,p_business_class_code => l_bflow_class_code
166932 ,p_balance_type => l_balance_type_code);
166933 ELSE
166934 NULL;
166935 -- No business flow processing for business flow method of NONE.
166936 END IF;
166937
166938 --
166939 -- call analytical criteria
166940 --
166941
166942 --
166943 -- call description
166944 --
166945
166946 xla_ae_lines_pkg.SetLineDescription(
166947 p_ae_header_id => l_ae_header_id
166948 ,p_description => Description_133 (
166949 p_application_id => p_application_id
166950 , p_ae_header_id => l_ae_header_id
166951 , p_source_1 => p_source_1
166952 )
166953 );
166954
166955
166956 --
166957 -- call ADRs
166958 -- Bug 4922099
166959 --
166960 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
166961 (NVL(l_actual_upg_option, 'N') = 'O') OR
166962 (NVL(l_enc_upg_option, 'N') = 'O')
166963 )
166964 THEN
166965 NULL;
166966 --
166967 --
166968
166969 l_ccid := AcctDerRule_174(
166970 p_application_id => p_application_id
166971 , p_ae_header_id => l_ae_header_id
166972 , p_source_5 => p_source_5
166973 , p_source_32 => p_source_32
166974 , x_transaction_coa_id => l_adr_transaction_coa_id
166975 , x_accounting_coa_id => l_adr_accounting_coa_id
166976 , x_value_type_code => l_adr_value_type_code
166977 , p_side => 'NA'
166978 );
166979
166980 xla_ae_lines_pkg.set_ccid(
166981 p_code_combination_id => l_ccid
166982 , p_value_type_code => l_adr_value_type_code
166983 , p_transaction_coa_id => l_adr_transaction_coa_id
166984 , p_accounting_coa_id => l_adr_accounting_coa_id
166985 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
166986 , p_adr_type_code => 'S'
166987 , p_component_type => l_component_type
166988 , p_component_code => l_component_code
166989 , p_component_type_code => l_component_type_code
166990 , p_component_appl_id => l_component_appl_id
166991 , p_amb_context_code => l_amb_context_code
166992 , p_side => 'NA'
166993 );
166994
166995
166996 l_segment := AcctDerRule_149(
166997 p_application_id => p_application_id
166998 , p_ae_header_id => l_ae_header_id
166999 , p_source_5 => p_source_5
167000 , p_source_11 => p_source_11
167001 , x_transaction_coa_id => l_adr_transaction_coa_id
167002 , x_accounting_coa_id => l_adr_accounting_coa_id
167003 , x_flexfield_segment_code => l_adr_flexfield_segment_code
167004 , x_flex_value_set_id => l_adr_flex_value_set_id
167005 , x_value_type_code => l_adr_value_type_code
167006 , x_value_combination_id => l_adr_value_combination_id
167007 , x_value_segment_code => l_adr_value_segment_code
167008 , p_side => 'NA'
167009 , p_override_seg_flag => 'Y'
167010 );
167011
167012 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
167013
167014 xla_ae_lines_pkg.set_segment(
167015 p_to_segment_code => 'GL_ACCOUNT'
167016 , p_segment_value => l_segment
167017 , p_from_segment_code => l_adr_value_segment_code
167021 , p_accounting_coa_id => l_adr_accounting_coa_id
167018 , p_from_combination_id => l_adr_value_combination_id
167019 , p_value_type_code => l_adr_value_type_code
167020 , p_transaction_coa_id => l_adr_transaction_coa_id
167022 , p_flexfield_segment_code => l_adr_flexfield_segment_code
167023 , p_flex_value_set_id => l_adr_flex_value_set_id
167024 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
167025 , p_adr_type_code => 'S'
167026 , p_component_type => l_component_type
167027 , p_component_code => l_component_code
167028 , p_component_type_code => l_component_type_code
167029 , p_component_appl_id => l_component_appl_id
167030 , p_amb_context_code => l_amb_context_code
167031 , p_entity_code => 'TRANSACTIONS'
167032 , p_event_class_code => 'UNIT_ADJUSTMENTS'
167033 , p_side => 'NA'
167034 );
167035
167036 END IF;
167037
167038 l_segment := AcctDerRule_169(
167039 p_application_id => p_application_id
167040 , p_ae_header_id => l_ae_header_id
167041 , p_source_5 => p_source_5
167042 , p_source_31 => p_source_31
167043 , x_transaction_coa_id => l_adr_transaction_coa_id
167044 , x_accounting_coa_id => l_adr_accounting_coa_id
167045 , x_flexfield_segment_code => l_adr_flexfield_segment_code
167046 , x_flex_value_set_id => l_adr_flex_value_set_id
167047 , x_value_type_code => l_adr_value_type_code
167048 , x_value_combination_id => l_adr_value_combination_id
167049 , x_value_segment_code => l_adr_value_segment_code
167050 , p_side => 'NA'
167051 , p_override_seg_flag => 'Y'
167052 );
167053
167054 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
167055
167056 xla_ae_lines_pkg.set_segment(
167057 p_to_segment_code => 'GL_BALANCING'
167058 , p_segment_value => l_segment
167059 , p_from_segment_code => l_adr_value_segment_code
167060 , p_from_combination_id => l_adr_value_combination_id
167061 , p_value_type_code => l_adr_value_type_code
167062 , p_transaction_coa_id => l_adr_transaction_coa_id
167063 , p_accounting_coa_id => l_adr_accounting_coa_id
167064 , p_flexfield_segment_code => l_adr_flexfield_segment_code
167065 , p_flex_value_set_id => l_adr_flex_value_set_id
167066 , p_adr_code => 'FA_EXPENSE_ACCT'
167067 , p_adr_type_code => 'S'
167068 , p_component_type => l_component_type
167069 , p_component_code => l_component_code
167070 , p_component_type_code => l_component_type_code
167071 , p_component_appl_id => l_component_appl_id
167072 , p_amb_context_code => l_amb_context_code
167073 , p_entity_code => 'TRANSACTIONS'
167074 , p_event_class_code => 'UNIT_ADJUSTMENTS'
167075 , p_side => 'NA'
167076 );
167077
167078 END IF;
167079
167080 --
167081 --
167082 END IF;
167083 --
167084 -- Bug 4922099
167085 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
167086 (NVL(l_enc_upg_option, 'N') = 'O')
167087 ) AND
167088 (l_bflow_method_code = 'PRIOR_ENTRY')
167089 )
167090 THEN
167091 IF
167092 --
167093 1 = 2
167094 --
167095 THEN
167096 xla_accounting_err_pkg.build_message
167097 (p_appli_s_name => 'XLA'
167098 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
167099 ,p_token_1 => 'LINE_NUMBER'
167100 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
167101 ,p_token_2 => 'LINE_TYPE_NAME'
167102 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
167103 l_component_type
167104 ,l_component_code
167105 ,l_component_type_code
167106 ,l_component_appl_id
167107 ,l_amb_context_code
167108 ,l_entity_code
167109 ,l_event_class_code
167110 )
167111 ,p_token_3 => 'OWNER'
167112 ,p_value_3 => xla_lookups_pkg.get_meaning(
167113 p_lookup_type => 'XLA_OWNER_TYPE'
167114 ,p_lookup_code => l_component_type_code
167115 )
167116 ,p_token_4 => 'PRODUCT_NAME'
167120 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
167117 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
167118 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
167119 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
167121 ,p_ae_header_id => NULL
167122 );
167123
167124 IF (C_LEVEL_ERROR>= g_log_level) THEN
167125 trace
167126 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
167127 ,p_level => C_LEVEL_ERROR
167128 ,p_module => l_log_module);
167129 END IF;
167130 END IF;
167131 END IF;
167132 --
167133 --
167134 ------------------------------------------------------------------------------------------------
167135 -- 4219869 Business Flow
167136 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
167137 -- Prior Entry. Currently, the following code is always generated.
167138 ------------------------------------------------------------------------------------------------
167139 XLA_AE_LINES_PKG.ValidateCurrentLine;
167140
167141 ------------------------------------------------------------------------------------
167142 -- 4219869 Business Flow
167143 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
167144 ------------------------------------------------------------------------------------
167145 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
167146
167147 ----------------------------------------------------------------------------------
167148 -- 4219869 Business Flow
167149 -- Update journal entry status -- Need to generate this within IF <condition>
167150 ----------------------------------------------------------------------------------
167151 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
167152 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
167153 ,p_balance_type_code => l_balance_type_code
167154 );
167155
167156 -------------------------------------------------------------------------------------------
167157 -- 4262811 - Generate the Accrual Reversal lines
167158 -------------------------------------------------------------------------------------------
167159 BEGIN
167160 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
167161 (g_array_event(p_event_id).array_value_num('header_index'));
167162 IF l_acc_rev_flag IS NULL THEN
167163 l_acc_rev_flag := 'N';
167164 END IF;
167165 EXCEPTION
167166 WHEN OTHERS THEN
167167 l_acc_rev_flag := 'N';
167168 END;
167169 --
167170 IF (l_acc_rev_flag = 'Y') THEN
167171
167172 -- 4645092 ------------------------------------------------------------------------------
167173 -- To allow MPA report to determine if it should generate report process
167174 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
167175 ------------------------------------------------------------------------------------------
167176
167177 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
167178 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
167179 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
167180 -- call ADRs
167181 -- Bug 4922099
167182 --
167183 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
167184 (NVL(l_actual_upg_option, 'N') = 'O') OR
167185 (NVL(l_enc_upg_option, 'N') = 'O')
167186 )
167187 THEN
167188 NULL;
167189 --
167190 --
167191
167192 l_ccid := AcctDerRule_174(
167193 p_application_id => p_application_id
167194 , p_ae_header_id => l_ae_header_id
167195 , p_source_5 => p_source_5
167196 , p_source_32 => p_source_32
167197 , x_transaction_coa_id => l_adr_transaction_coa_id
167198 , x_accounting_coa_id => l_adr_accounting_coa_id
167199 , x_value_type_code => l_adr_value_type_code
167200 , p_side => 'NA'
167201 );
167202
167203 xla_ae_lines_pkg.set_ccid(
167204 p_code_combination_id => l_ccid
167205 , p_value_type_code => l_adr_value_type_code
167206 , p_transaction_coa_id => l_adr_transaction_coa_id
167207 , p_accounting_coa_id => l_adr_accounting_coa_id
167208 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
167209 , p_adr_type_code => 'S'
167210 , p_component_type => l_component_type
167211 , p_component_code => l_component_code
167212 , p_component_type_code => l_component_type_code
167213 , p_component_appl_id => l_component_appl_id
167214 , p_amb_context_code => l_amb_context_code
167215 , p_side => 'NA'
167216 );
167217
167218
167219 l_segment := AcctDerRule_149(
167220 p_application_id => p_application_id
167221 , p_ae_header_id => l_ae_header_id
167222 , p_source_5 => p_source_5
167223 , p_source_11 => p_source_11
167224 , x_transaction_coa_id => l_adr_transaction_coa_id
167228 , x_value_type_code => l_adr_value_type_code
167225 , x_accounting_coa_id => l_adr_accounting_coa_id
167226 , x_flexfield_segment_code => l_adr_flexfield_segment_code
167227 , x_flex_value_set_id => l_adr_flex_value_set_id
167229 , x_value_combination_id => l_adr_value_combination_id
167230 , x_value_segment_code => l_adr_value_segment_code
167231 , p_side => 'NA'
167232 , p_override_seg_flag => 'Y'
167233 );
167234
167235 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
167236
167237 xla_ae_lines_pkg.set_segment(
167238 p_to_segment_code => 'GL_ACCOUNT'
167239 , p_segment_value => l_segment
167240 , p_from_segment_code => l_adr_value_segment_code
167241 , p_from_combination_id => l_adr_value_combination_id
167242 , p_value_type_code => l_adr_value_type_code
167243 , p_transaction_coa_id => l_adr_transaction_coa_id
167244 , p_accounting_coa_id => l_adr_accounting_coa_id
167245 , p_flexfield_segment_code => l_adr_flexfield_segment_code
167246 , p_flex_value_set_id => l_adr_flex_value_set_id
167247 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
167248 , p_adr_type_code => 'S'
167249 , p_component_type => l_component_type
167250 , p_component_code => l_component_code
167251 , p_component_type_code => l_component_type_code
167252 , p_component_appl_id => l_component_appl_id
167253 , p_amb_context_code => l_amb_context_code
167254 , p_entity_code => 'TRANSACTIONS'
167255 , p_event_class_code => 'UNIT_ADJUSTMENTS'
167256 , p_side => 'NA'
167257 );
167258
167259 END IF;
167260
167261 l_segment := AcctDerRule_169(
167262 p_application_id => p_application_id
167263 , p_ae_header_id => l_ae_header_id
167264 , p_source_5 => p_source_5
167265 , p_source_31 => p_source_31
167266 , x_transaction_coa_id => l_adr_transaction_coa_id
167267 , x_accounting_coa_id => l_adr_accounting_coa_id
167268 , x_flexfield_segment_code => l_adr_flexfield_segment_code
167269 , x_flex_value_set_id => l_adr_flex_value_set_id
167270 , x_value_type_code => l_adr_value_type_code
167271 , x_value_combination_id => l_adr_value_combination_id
167272 , x_value_segment_code => l_adr_value_segment_code
167273 , p_side => 'NA'
167274 , p_override_seg_flag => 'Y'
167275 );
167276
167277 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
167278
167279 xla_ae_lines_pkg.set_segment(
167280 p_to_segment_code => 'GL_BALANCING'
167281 , p_segment_value => l_segment
167282 , p_from_segment_code => l_adr_value_segment_code
167283 , p_from_combination_id => l_adr_value_combination_id
167284 , p_value_type_code => l_adr_value_type_code
167285 , p_transaction_coa_id => l_adr_transaction_coa_id
167286 , p_accounting_coa_id => l_adr_accounting_coa_id
167287 , p_flexfield_segment_code => l_adr_flexfield_segment_code
167288 , p_flex_value_set_id => l_adr_flex_value_set_id
167289 , p_adr_code => 'FA_EXPENSE_ACCT'
167290 , p_adr_type_code => 'S'
167291 , p_component_type => l_component_type
167292 , p_component_code => l_component_code
167293 , p_component_type_code => l_component_type_code
167294 , p_component_appl_id => l_component_appl_id
167295 , p_amb_context_code => l_amb_context_code
167296 , p_entity_code => 'TRANSACTIONS'
167297 , p_event_class_code => 'UNIT_ADJUSTMENTS'
167298 , p_side => 'NA'
167299 );
167300
167301 END IF;
167302
167303 --
167304 --
167305 END IF;
167306
167307 --
167308 -- Update the line information that should be overwritten
167309 --
167310 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
167311 p_header_num => 1);
167312 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
167313
167314 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
167315
167316 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
167317 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
167318 END IF;
167319
167320 --
167321 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
167322 --
167323 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
167324 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
167325 ELSE
167326 ---------------------------------------------------------------------------------------------------
167327 -- 4262811a Switch Sign
167328 ---------------------------------------------------------------------------------------------------
167332 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
167329 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
167330 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
167331 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
167333 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
167334 -- 5132302
167335 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
167336 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
167337
167338 END IF;
167339
167340 -- 4955764
167341 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
167342 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
167343
167344
167345 XLA_AE_LINES_PKG.ValidateCurrentLine;
167346 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
167347
167348 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
167349 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
167350 ,p_balance_type_code => l_balance_type_code);
167351
167352 END IF;
167353
167354 -----------------------------------------------------------------------------------------
167355 -- 4262811 Multiperiod Accounting
167356 -----------------------------------------------------------------------------------------
167357 -- No MPA option is assigned.
167358
167359
167360 END IF;
167361 END IF;
167362 --
167363
167364 --
167365 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
167366 trace
167367 (p_msg => 'END of AcctLineType_399'
167368 ,p_level => C_LEVEL_PROCEDURE
167369 ,p_module => l_log_module);
167370 END IF;
167371 --
167372 EXCEPTION
167373 WHEN xla_exceptions_pkg.application_exception THEN
167374 RAISE;
167375 WHEN OTHERS THEN
167376 xla_exceptions_pkg.raise_message
167377 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_399');
167378 END AcctLineType_399;
167379 --
167380
167381 ---------------------------------------
167382 --
167383 -- PRIVATE FUNCTION
167384 -- AcctLineType_400
167385 --
167386 ---------------------------------------
167387 PROCEDURE AcctLineType_400 (
167388 p_application_id IN NUMBER
167389 ,p_event_id IN NUMBER
167390 ,p_calculate_acctd_flag IN VARCHAR2
167391 ,p_calculate_g_l_flag IN VARCHAR2
167392 ,p_actual_flag IN OUT VARCHAR2
167393 ,p_balance_type_code OUT VARCHAR2
167394 ,p_gain_or_loss_ref OUT VARCHAR2
167395
167396 --Period Close Date
167397 , p_source_1 IN DATE
167398 --Bonus Depreciation Expense Account
167399 , p_source_4 IN VARCHAR2
167400 --Generated Code Combination Identifier
167401 , p_source_5 IN NUMBER
167402 --Expense Account Code Combination Identifier
167403 , p_source_31 IN NUMBER
167404 --Adjustment Type
167405 , p_source_48 IN VARCHAR2
167406 --Transaction Header Identifier
167407 , p_source_49 IN NUMBER
167408 --Adjustment Line Identifier
167409 , p_source_50 IN NUMBER
167410 --Distribution Type Code
167411 , p_source_51 IN VARCHAR2
167412 --Entered Amount
167413 , p_source_52 IN NUMBER
167414 --Currency Code
167415 , p_source_53 IN VARCHAR2
167416 --Source Destination Code
167417 , p_source_55 IN VARCHAR2
167418 )
167419 IS
167420
167421 l_component_type VARCHAR2(80);
167422 l_component_code VARCHAR2(30);
167423 l_component_type_code VARCHAR2(1);
167424 l_component_appl_id INTEGER;
167425 l_amb_context_code VARCHAR2(30);
167426 l_entity_code VARCHAR2(30);
167427 l_event_class_code VARCHAR2(30);
167428 l_ae_header_id NUMBER;
167429 l_event_type_code VARCHAR2(30);
167430 l_line_definition_code VARCHAR2(30);
167431 l_line_definition_owner_code VARCHAR2(1);
167432 --
167433 -- adr variables
167434 l_segment VARCHAR2(30);
167435 l_ccid NUMBER;
167436 l_adr_transaction_coa_id NUMBER;
167437 l_adr_accounting_coa_id NUMBER;
167438 l_adr_flexfield_segment_code VARCHAR2(30);
167439 l_adr_flex_value_set_id NUMBER;
167440 l_adr_value_type_code VARCHAR2(30);
167441 l_adr_value_combination_id NUMBER;
167442 l_adr_value_segment_code VARCHAR2(30);
167443
167444 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
167445 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
167446 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
167447 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
167448
167449 -- 4262811 Variables ------------------------------------------------------------------------------------------
167450 l_entered_amt_idx NUMBER;
167451 l_accted_amt_idx NUMBER;
167452 l_acc_rev_flag VARCHAR2(1);
167453 l_accrual_line_num NUMBER;
167454 l_tmp_amt NUMBER;
167455 l_acc_rev_natural_side_code VARCHAR2(1);
167456
167457 l_num_entries NUMBER;
167458 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
167462 l_recog_line_1 NUMBER;
167459 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
167460 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
167461 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
167463 l_recog_line_2 NUMBER;
167464
167465 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
167466 l_bflow_applied_to_amt NUMBER; -- 5132302
167467 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
167468
167469 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
167470
167471 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
167472 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
167473
167474 ---------------------------------------------------------------------------------------------------------------
167475
167476
167477 --
167478 -- bulk performance
167479 --
167480 l_balance_type_code VARCHAR2(1);
167481 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
167482 l_log_module VARCHAR2(240);
167483
167484 --
167485 -- Upgrade strategy
167486 --
167487 l_actual_upg_option VARCHAR2(1);
167488 l_enc_upg_option VARCHAR2(1);
167489
167490 --
167491 BEGIN
167492 --
167493 IF g_log_enabled THEN
167494 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_400';
167495 END IF;
167496 --
167497 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
167498
167499 trace
167500 (p_msg => 'BEGIN of AcctLineType_400'
167501 ,p_level => C_LEVEL_PROCEDURE
167502 ,p_module => l_log_module);
167503
167504 END IF;
167505 --
167506 l_component_type := 'AMB_JLT';
167507 l_component_code := 'FA_UNITADJ_DEST_BONUS_EXP';
167508 l_component_type_code := 'S';
167509 l_component_appl_id := 140;
167510 l_amb_context_code := 'DEFAULT';
167511 l_entity_code := 'TRANSACTIONS';
167512 l_event_class_code := 'UNIT_ADJUSTMENTS';
167513 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
167514 l_line_definition_owner_code := 'S';
167515 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
167516 --
167517 l_balance_type_code := 'A';
167518 l_segment := NULL;
167519 l_ccid := NULL;
167520 l_adr_transaction_coa_id := NULL;
167521 l_adr_accounting_coa_id := NULL;
167522 l_adr_flexfield_segment_code := NULL;
167523 l_adr_flex_value_set_id := NULL;
167524 l_adr_value_type_code := NULL;
167525 l_adr_value_combination_id := NULL;
167526 l_adr_value_segment_code := NULL;
167527
167528 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
167529 l_bflow_class_code := ''; -- 4219869 Business Flow
167530 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
167531 l_budgetary_control_flag := 'N';
167532
167533 l_bflow_applied_to_amt_idx := NULL; -- 5132302
167534 l_bflow_applied_to_amt := NULL; -- 5132302
167535 l_entered_amt_idx := NULL; -- 4262811
167536 l_accted_amt_idx := NULL; -- 4262811
167537 l_acc_rev_flag := NULL; -- 4262811
167538 l_accrual_line_num := NULL; -- 4262811
167539 l_tmp_amt := NULL; -- 4262811
167540 --
167541
167542 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
167543 l_balance_type_code <> 'B' THEN
167544 IF NVL(p_source_48,'
167545 ') = 'BONUS EXPENSE' AND
167546 NVL(p_source_55,'
167547 ') = 'DEST'
167548 THEN
167549
167550 --
167551 XLA_AE_LINES_PKG.SetNewLine;
167552
167553 p_balance_type_code := l_balance_type_code;
167554 -- set the flag so later we will know whether the gain loss line needs to be created
167555
167556 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
167557 p_actual_flag :='A';
167558 END IF;
167559
167560 --
167561 -- bulk performance
167562 --
167563 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
167564 p_header_num => 0); -- 4262811
167565 --
167566 -- set accounting line options
167567 --
167568 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
167569 p_natural_side_code => 'D'
167570 , p_gain_or_loss_flag => 'N'
167571 , p_gl_transfer_mode_code => 'S'
167572 , p_acct_entry_type_code => 'A'
167573 , p_switch_side_flag => 'Y'
167574 , p_merge_duplicate_code => 'N'
167575 );
167576 --
167577 l_acc_rev_natural_side_code := 'C'; -- 4262811
167578 --
167579 --
167580 -- set accounting line type info
167581 --
167582 xla_ae_lines_pkg.SetAcctLineType
167583 (p_component_type => l_component_type
167584 ,p_event_type_code => l_event_type_code
167585 ,p_line_definition_owner_code => l_line_definition_owner_code
167586 ,p_line_definition_code => l_line_definition_code
167587 ,p_accounting_line_code => l_component_code
167588 ,p_accounting_line_type_code => l_component_type_code
167589 ,p_accounting_line_appl_id => l_component_appl_id
167590 ,p_amb_context_code => l_amb_context_code
167594 -- set accounting class
167591 ,p_entity_code => l_entity_code
167592 ,p_event_class_code => l_event_class_code);
167593 --
167595 --
167596 xla_ae_lines_pkg.SetAcctClass(
167597 p_accounting_class_code => 'EXPENSE'
167598 , p_ae_header_id => l_ae_header_id
167599 );
167600
167601 --
167602 -- set rounding class
167603 --
167604 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
167605 'EXPENSE';
167606
167607 --
167608 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
167609 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
167610 --
167611 -- bulk performance
167612 --
167613 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
167614
167615 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
167616 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
167617
167618 -- 4955764
167619 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
167620 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
167621
167622 -- 4458381 Public Sector Enh
167623
167624 --
167625 -- set accounting attributes for the line type
167626 --
167627 l_entered_amt_idx := 4;
167628 l_accted_amt_idx := 6;
167629 l_bflow_applied_to_amt_idx := NULL; -- 5132302
167630 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
167631 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
167632 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
167633 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
167634 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
167635 l_rec_acct_attrs.array_char_value(3) := p_source_51;
167636 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
167637 l_rec_acct_attrs.array_num_value(4) := p_source_52;
167638 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
167639 l_rec_acct_attrs.array_char_value(5) := p_source_53;
167640 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
167641 l_rec_acct_attrs.array_num_value(6) := p_source_52;
167642
167643 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
167644 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
167645
167646 ---------------------------------------------------------------------------------------------------------------
167647 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
167648 ---------------------------------------------------------------------------------------------------------------
167649 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
167650
167651 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
167652 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
167653
167654 IF xla_accounting_cache_pkg.GetValueChar
167655 (p_source_code => 'LEDGER_CATEGORY_CODE'
167656 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
167657 AND l_bflow_method_code = 'PRIOR_ENTRY'
167658 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
167659 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
167660 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
167661 )
167662 THEN
167663 xla_ae_lines_pkg.BflowUpgEntry
167664 (p_business_method_code => l_bflow_method_code
167665 ,p_business_class_code => l_bflow_class_code
167666 ,p_balance_type => l_balance_type_code);
167667 ELSE
167668 NULL;
167669 -- No business flow processing for business flow method of NONE.
167670 END IF;
167671
167672 --
167673 -- call analytical criteria
167674 --
167675
167676 --
167677 -- call description
167678 --
167679
167680 xla_ae_lines_pkg.SetLineDescription(
167681 p_ae_header_id => l_ae_header_id
167682 ,p_description => Description_139 (
167683 p_application_id => p_application_id
167684 , p_ae_header_id => l_ae_header_id
167685 , p_source_1 => p_source_1
167686 )
167687 );
167688
167689
167690 --
167691 -- call ADRs
167692 -- Bug 4922099
167693 --
167694 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
167695 (NVL(l_actual_upg_option, 'N') = 'O') OR
167696 (NVL(l_enc_upg_option, 'N') = 'O')
167697 )
167698 THEN
167699 NULL;
167700 --
167701 --
167702
167703 l_ccid := AcctDerRule_176(
167704 p_application_id => p_application_id
167705 , p_ae_header_id => l_ae_header_id
167706 , p_source_5 => p_source_5
167707 , p_source_31 => p_source_31
167708 , x_transaction_coa_id => l_adr_transaction_coa_id
167709 , x_accounting_coa_id => l_adr_accounting_coa_id
167710 , x_value_type_code => l_adr_value_type_code
167711 , p_side => 'NA'
167712 );
167716 , p_value_type_code => l_adr_value_type_code
167713
167714 xla_ae_lines_pkg.set_ccid(
167715 p_code_combination_id => l_ccid
167717 , p_transaction_coa_id => l_adr_transaction_coa_id
167718 , p_accounting_coa_id => l_adr_accounting_coa_id
167719 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
167720 , p_adr_type_code => 'S'
167721 , p_component_type => l_component_type
167722 , p_component_code => l_component_code
167723 , p_component_type_code => l_component_type_code
167724 , p_component_appl_id => l_component_appl_id
167725 , p_amb_context_code => l_amb_context_code
167726 , p_side => 'NA'
167727 );
167728
167729
167730 l_segment := AcctDerRule_144(
167731 p_application_id => p_application_id
167732 , p_ae_header_id => l_ae_header_id
167733 , p_source_4 => p_source_4
167734 , p_source_5 => p_source_5
167735 , x_transaction_coa_id => l_adr_transaction_coa_id
167736 , x_accounting_coa_id => l_adr_accounting_coa_id
167737 , x_flexfield_segment_code => l_adr_flexfield_segment_code
167738 , x_flex_value_set_id => l_adr_flex_value_set_id
167739 , x_value_type_code => l_adr_value_type_code
167740 , x_value_combination_id => l_adr_value_combination_id
167741 , x_value_segment_code => l_adr_value_segment_code
167742 , p_side => 'NA'
167743 , p_override_seg_flag => 'Y'
167744 );
167745
167746 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
167747
167748 xla_ae_lines_pkg.set_segment(
167749 p_to_segment_code => 'GL_ACCOUNT'
167750 , p_segment_value => l_segment
167751 , p_from_segment_code => l_adr_value_segment_code
167752 , p_from_combination_id => l_adr_value_combination_id
167753 , p_value_type_code => l_adr_value_type_code
167754 , p_transaction_coa_id => l_adr_transaction_coa_id
167755 , p_accounting_coa_id => l_adr_accounting_coa_id
167756 , p_flexfield_segment_code => l_adr_flexfield_segment_code
167757 , p_flex_value_set_id => l_adr_flex_value_set_id
167758 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
167759 , p_adr_type_code => 'S'
167760 , p_component_type => l_component_type
167761 , p_component_code => l_component_code
167762 , p_component_type_code => l_component_type_code
167763 , p_component_appl_id => l_component_appl_id
167764 , p_amb_context_code => l_amb_context_code
167765 , p_entity_code => 'TRANSACTIONS'
167766 , p_event_class_code => 'UNIT_ADJUSTMENTS'
167767 , p_side => 'NA'
167768 );
167769
167770 END IF;
167771
167772 --
167773 --
167774 END IF;
167775 --
167776 -- Bug 4922099
167777 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
167778 (NVL(l_enc_upg_option, 'N') = 'O')
167779 ) AND
167780 (l_bflow_method_code = 'PRIOR_ENTRY')
167781 )
167782 THEN
167783 IF
167784 --
167785 1 = 2
167786 --
167787 THEN
167788 xla_accounting_err_pkg.build_message
167789 (p_appli_s_name => 'XLA'
167790 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
167791 ,p_token_1 => 'LINE_NUMBER'
167792 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
167793 ,p_token_2 => 'LINE_TYPE_NAME'
167794 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
167795 l_component_type
167796 ,l_component_code
167797 ,l_component_type_code
167798 ,l_component_appl_id
167799 ,l_amb_context_code
167800 ,l_entity_code
167801 ,l_event_class_code
167802 )
167803 ,p_token_3 => 'OWNER'
167804 ,p_value_3 => xla_lookups_pkg.get_meaning(
167805 p_lookup_type => 'XLA_OWNER_TYPE'
167806 ,p_lookup_code => l_component_type_code
167807 )
167808 ,p_token_4 => 'PRODUCT_NAME'
167809 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
167810 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
167814 );
167811 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
167812 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
167813 ,p_ae_header_id => NULL
167815
167816 IF (C_LEVEL_ERROR>= g_log_level) THEN
167817 trace
167818 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
167819 ,p_level => C_LEVEL_ERROR
167820 ,p_module => l_log_module);
167821 END IF;
167822 END IF;
167823 END IF;
167824 --
167825 --
167826 ------------------------------------------------------------------------------------------------
167827 -- 4219869 Business Flow
167828 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
167829 -- Prior Entry. Currently, the following code is always generated.
167830 ------------------------------------------------------------------------------------------------
167831 XLA_AE_LINES_PKG.ValidateCurrentLine;
167832
167833 ------------------------------------------------------------------------------------
167834 -- 4219869 Business Flow
167835 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
167836 ------------------------------------------------------------------------------------
167837 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
167838
167839 ----------------------------------------------------------------------------------
167840 -- 4219869 Business Flow
167841 -- Update journal entry status -- Need to generate this within IF <condition>
167842 ----------------------------------------------------------------------------------
167843 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
167844 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
167845 ,p_balance_type_code => l_balance_type_code
167846 );
167847
167848 -------------------------------------------------------------------------------------------
167849 -- 4262811 - Generate the Accrual Reversal lines
167850 -------------------------------------------------------------------------------------------
167851 BEGIN
167852 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
167853 (g_array_event(p_event_id).array_value_num('header_index'));
167854 IF l_acc_rev_flag IS NULL THEN
167855 l_acc_rev_flag := 'N';
167856 END IF;
167857 EXCEPTION
167858 WHEN OTHERS THEN
167859 l_acc_rev_flag := 'N';
167860 END;
167861 --
167862 IF (l_acc_rev_flag = 'Y') THEN
167863
167864 -- 4645092 ------------------------------------------------------------------------------
167865 -- To allow MPA report to determine if it should generate report process
167866 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
167867 ------------------------------------------------------------------------------------------
167868
167869 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
167870 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
167871 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
167872 -- call ADRs
167873 -- Bug 4922099
167874 --
167875 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
167876 (NVL(l_actual_upg_option, 'N') = 'O') OR
167877 (NVL(l_enc_upg_option, 'N') = 'O')
167878 )
167879 THEN
167880 NULL;
167881 --
167882 --
167883
167884 l_ccid := AcctDerRule_176(
167885 p_application_id => p_application_id
167886 , p_ae_header_id => l_ae_header_id
167887 , p_source_5 => p_source_5
167888 , p_source_31 => p_source_31
167889 , x_transaction_coa_id => l_adr_transaction_coa_id
167890 , x_accounting_coa_id => l_adr_accounting_coa_id
167891 , x_value_type_code => l_adr_value_type_code
167892 , p_side => 'NA'
167893 );
167894
167895 xla_ae_lines_pkg.set_ccid(
167896 p_code_combination_id => l_ccid
167897 , p_value_type_code => l_adr_value_type_code
167898 , p_transaction_coa_id => l_adr_transaction_coa_id
167899 , p_accounting_coa_id => l_adr_accounting_coa_id
167900 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
167901 , p_adr_type_code => 'S'
167902 , p_component_type => l_component_type
167903 , p_component_code => l_component_code
167904 , p_component_type_code => l_component_type_code
167905 , p_component_appl_id => l_component_appl_id
167906 , p_amb_context_code => l_amb_context_code
167907 , p_side => 'NA'
167908 );
167909
167910
167911 l_segment := AcctDerRule_144(
167912 p_application_id => p_application_id
167913 , p_ae_header_id => l_ae_header_id
167914 , p_source_4 => p_source_4
167915 , p_source_5 => p_source_5
167916 , x_transaction_coa_id => l_adr_transaction_coa_id
167917 , x_accounting_coa_id => l_adr_accounting_coa_id
167918 , x_flexfield_segment_code => l_adr_flexfield_segment_code
167919 , x_flex_value_set_id => l_adr_flex_value_set_id
167923 , p_side => 'NA'
167920 , x_value_type_code => l_adr_value_type_code
167921 , x_value_combination_id => l_adr_value_combination_id
167922 , x_value_segment_code => l_adr_value_segment_code
167924 , p_override_seg_flag => 'Y'
167925 );
167926
167927 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
167928
167929 xla_ae_lines_pkg.set_segment(
167930 p_to_segment_code => 'GL_ACCOUNT'
167931 , p_segment_value => l_segment
167932 , p_from_segment_code => l_adr_value_segment_code
167933 , p_from_combination_id => l_adr_value_combination_id
167934 , p_value_type_code => l_adr_value_type_code
167935 , p_transaction_coa_id => l_adr_transaction_coa_id
167936 , p_accounting_coa_id => l_adr_accounting_coa_id
167937 , p_flexfield_segment_code => l_adr_flexfield_segment_code
167938 , p_flex_value_set_id => l_adr_flex_value_set_id
167939 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
167940 , p_adr_type_code => 'S'
167941 , p_component_type => l_component_type
167942 , p_component_code => l_component_code
167943 , p_component_type_code => l_component_type_code
167944 , p_component_appl_id => l_component_appl_id
167945 , p_amb_context_code => l_amb_context_code
167946 , p_entity_code => 'TRANSACTIONS'
167947 , p_event_class_code => 'UNIT_ADJUSTMENTS'
167948 , p_side => 'NA'
167949 );
167950
167951 END IF;
167952
167953 --
167954 --
167955 END IF;
167956
167957 --
167958 -- Update the line information that should be overwritten
167959 --
167960 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
167961 p_header_num => 1);
167962 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
167963
167964 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
167965
167966 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
167967 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
167968 END IF;
167969
167970 --
167971 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
167972 --
167973 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
167974 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
167975 ELSE
167976 ---------------------------------------------------------------------------------------------------
167977 -- 4262811a Switch Sign
167978 ---------------------------------------------------------------------------------------------------
167979 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
167980 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
167981 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
167982 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
167983 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
167984 -- 5132302
167985 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
167986 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
167987
167988 END IF;
167989
167990 -- 4955764
167991 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
167992 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
167993
167994
167995 XLA_AE_LINES_PKG.ValidateCurrentLine;
167996 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
167997
167998 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
167999 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
168000 ,p_balance_type_code => l_balance_type_code);
168001
168002 END IF;
168003
168004 -----------------------------------------------------------------------------------------
168005 -- 4262811 Multiperiod Accounting
168006 -----------------------------------------------------------------------------------------
168007 -- No MPA option is assigned.
168008
168009
168010 END IF;
168011 END IF;
168012 --
168013
168014 --
168015 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
168016 trace
168017 (p_msg => 'END of AcctLineType_400'
168018 ,p_level => C_LEVEL_PROCEDURE
168019 ,p_module => l_log_module);
168020 END IF;
168021 --
168022 EXCEPTION
168023 WHEN xla_exceptions_pkg.application_exception THEN
168024 RAISE;
168025 WHEN OTHERS THEN
168026 xla_exceptions_pkg.raise_message
168027 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_400');
168028 END AcctLineType_400;
168029 --
168030
168031 ---------------------------------------
168032 --
168033 -- PRIVATE FUNCTION
168034 -- AcctLineType_401
168035 --
168036 ---------------------------------------
168037 PROCEDURE AcctLineType_401 (
168041 ,p_calculate_g_l_flag IN VARCHAR2
168038 p_application_id IN NUMBER
168039 ,p_event_id IN NUMBER
168040 ,p_calculate_acctd_flag IN VARCHAR2
168042 ,p_actual_flag IN OUT VARCHAR2
168043 ,p_balance_type_code OUT VARCHAR2
168044 ,p_gain_or_loss_ref OUT VARCHAR2
168045
168046 --Period Close Date
168047 , p_source_1 IN DATE
168048 --Generated Code Combination Identifier
168049 , p_source_5 IN NUMBER
168050 --Bonus Reserve Account
168051 , p_source_6 IN VARCHAR2
168052 --Generated Offset Code Combination Identifier
168053 , p_source_19 IN NUMBER
168054 --Expense Account Code Combination Identifier
168055 , p_source_31 IN NUMBER
168056 --Default Code Combination Identifier
168057 , p_source_32 IN NUMBER
168058 --Adjustment Type
168059 , p_source_48 IN VARCHAR2
168060 --Transaction Header Identifier
168061 , p_source_49 IN NUMBER
168062 --Adjustment Line Identifier
168063 , p_source_50 IN NUMBER
168064 --Distribution Type Code
168065 , p_source_51 IN VARCHAR2
168066 --Entered Amount
168067 , p_source_52 IN NUMBER
168068 --Currency Code
168069 , p_source_53 IN VARCHAR2
168070 --Source Destination Code
168071 , p_source_55 IN VARCHAR2
168072 )
168073 IS
168074
168075 l_component_type VARCHAR2(80);
168076 l_component_code VARCHAR2(30);
168077 l_component_type_code VARCHAR2(1);
168078 l_component_appl_id INTEGER;
168079 l_amb_context_code VARCHAR2(30);
168080 l_entity_code VARCHAR2(30);
168081 l_event_class_code VARCHAR2(30);
168082 l_ae_header_id NUMBER;
168083 l_event_type_code VARCHAR2(30);
168084 l_line_definition_code VARCHAR2(30);
168085 l_line_definition_owner_code VARCHAR2(1);
168086 --
168087 -- adr variables
168088 l_segment VARCHAR2(30);
168089 l_ccid NUMBER;
168090 l_adr_transaction_coa_id NUMBER;
168091 l_adr_accounting_coa_id NUMBER;
168092 l_adr_flexfield_segment_code VARCHAR2(30);
168093 l_adr_flex_value_set_id NUMBER;
168094 l_adr_value_type_code VARCHAR2(30);
168095 l_adr_value_combination_id NUMBER;
168096 l_adr_value_segment_code VARCHAR2(30);
168097
168098 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
168099 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
168100 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
168101 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
168102
168103 -- 4262811 Variables ------------------------------------------------------------------------------------------
168104 l_entered_amt_idx NUMBER;
168105 l_accted_amt_idx NUMBER;
168106 l_acc_rev_flag VARCHAR2(1);
168107 l_accrual_line_num NUMBER;
168108 l_tmp_amt NUMBER;
168109 l_acc_rev_natural_side_code VARCHAR2(1);
168110
168111 l_num_entries NUMBER;
168112 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
168113 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
168114 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
168115 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
168116 l_recog_line_1 NUMBER;
168117 l_recog_line_2 NUMBER;
168118
168119 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
168120 l_bflow_applied_to_amt NUMBER; -- 5132302
168121 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
168122
168123 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
168124
168125 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
168126 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
168127
168128 ---------------------------------------------------------------------------------------------------------------
168129
168130
168131 --
168132 -- bulk performance
168133 --
168134 l_balance_type_code VARCHAR2(1);
168135 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
168136 l_log_module VARCHAR2(240);
168137
168138 --
168139 -- Upgrade strategy
168140 --
168141 l_actual_upg_option VARCHAR2(1);
168142 l_enc_upg_option VARCHAR2(1);
168143
168144 --
168145 BEGIN
168146 --
168147 IF g_log_enabled THEN
168148 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_401';
168149 END IF;
168150 --
168151 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
168152
168153 trace
168154 (p_msg => 'BEGIN of AcctLineType_401'
168155 ,p_level => C_LEVEL_PROCEDURE
168156 ,p_module => l_log_module);
168157
168158 END IF;
168159 --
168160 l_component_type := 'AMB_JLT';
168161 l_component_code := 'FA_UNITADJ_DEST_BONUS_RES';
168162 l_component_type_code := 'S';
168163 l_component_appl_id := 140;
168164 l_amb_context_code := 'DEFAULT';
168165 l_entity_code := 'TRANSACTIONS';
168166 l_event_class_code := 'UNIT_ADJUSTMENTS';
168167 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
168168 l_line_definition_owner_code := 'S';
168172 l_segment := NULL;
168169 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
168170 --
168171 l_balance_type_code := 'A';
168173 l_ccid := NULL;
168174 l_adr_transaction_coa_id := NULL;
168175 l_adr_accounting_coa_id := NULL;
168176 l_adr_flexfield_segment_code := NULL;
168177 l_adr_flex_value_set_id := NULL;
168178 l_adr_value_type_code := NULL;
168179 l_adr_value_combination_id := NULL;
168180 l_adr_value_segment_code := NULL;
168181
168182 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
168183 l_bflow_class_code := ''; -- 4219869 Business Flow
168184 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
168185 l_budgetary_control_flag := 'N';
168186
168187 l_bflow_applied_to_amt_idx := NULL; -- 5132302
168188 l_bflow_applied_to_amt := NULL; -- 5132302
168189 l_entered_amt_idx := NULL; -- 4262811
168190 l_accted_amt_idx := NULL; -- 4262811
168191 l_acc_rev_flag := NULL; -- 4262811
168192 l_accrual_line_num := NULL; -- 4262811
168193 l_tmp_amt := NULL; -- 4262811
168194 --
168195
168196 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
168197 l_balance_type_code <> 'B' THEN
168198 IF (NVL(p_source_48,'
168199 ') = 'BONUS EXPENSE' OR
168200 NVL(p_source_48,'
168201 ') = 'BONUS RESERVE') AND
168202 NVL(p_source_55,'
168203 ') = 'DEST'
168204 THEN
168205
168206 --
168207 XLA_AE_LINES_PKG.SetNewLine;
168208
168209 p_balance_type_code := l_balance_type_code;
168210 -- set the flag so later we will know whether the gain loss line needs to be created
168211
168212 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
168213 p_actual_flag :='A';
168214 END IF;
168215
168216 --
168217 -- bulk performance
168218 --
168219 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
168220 p_header_num => 0); -- 4262811
168221 --
168222 -- set accounting line options
168223 --
168224 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
168225 p_natural_side_code => 'C'
168226 , p_gain_or_loss_flag => 'N'
168227 , p_gl_transfer_mode_code => 'S'
168228 , p_acct_entry_type_code => 'A'
168229 , p_switch_side_flag => 'Y'
168230 , p_merge_duplicate_code => 'N'
168231 );
168232 --
168233 l_acc_rev_natural_side_code := 'D'; -- 4262811
168234 --
168235 --
168236 -- set accounting line type info
168237 --
168238 xla_ae_lines_pkg.SetAcctLineType
168239 (p_component_type => l_component_type
168240 ,p_event_type_code => l_event_type_code
168241 ,p_line_definition_owner_code => l_line_definition_owner_code
168242 ,p_line_definition_code => l_line_definition_code
168243 ,p_accounting_line_code => l_component_code
168244 ,p_accounting_line_type_code => l_component_type_code
168245 ,p_accounting_line_appl_id => l_component_appl_id
168246 ,p_amb_context_code => l_amb_context_code
168247 ,p_entity_code => l_entity_code
168248 ,p_event_class_code => l_event_class_code);
168249 --
168250 -- set accounting class
168251 --
168252 xla_ae_lines_pkg.SetAcctClass(
168253 p_accounting_class_code => 'ASSET'
168254 , p_ae_header_id => l_ae_header_id
168255 );
168256
168257 --
168258 -- set rounding class
168259 --
168260 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
168261 'ASSET';
168262
168263 --
168264 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
168265 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
168266 --
168267 -- bulk performance
168268 --
168269 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
168270
168271 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
168272 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
168273
168274 -- 4955764
168275 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
168276 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
168277
168278 -- 4458381 Public Sector Enh
168279
168280 --
168281 -- set accounting attributes for the line type
168282 --
168283 l_entered_amt_idx := 4;
168284 l_accted_amt_idx := 6;
168285 l_bflow_applied_to_amt_idx := NULL; -- 5132302
168286 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
168287 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
168288 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
168289 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
168290 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
168291 l_rec_acct_attrs.array_char_value(3) := p_source_51;
168292 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
168293 l_rec_acct_attrs.array_num_value(4) := p_source_52;
168297 l_rec_acct_attrs.array_num_value(6) := p_source_52;
168294 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
168295 l_rec_acct_attrs.array_char_value(5) := p_source_53;
168296 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
168298
168299 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
168300 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
168301
168302 ---------------------------------------------------------------------------------------------------------------
168303 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
168304 ---------------------------------------------------------------------------------------------------------------
168305 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
168306
168307 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
168308 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
168309
168310 IF xla_accounting_cache_pkg.GetValueChar
168311 (p_source_code => 'LEDGER_CATEGORY_CODE'
168312 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
168313 AND l_bflow_method_code = 'PRIOR_ENTRY'
168314 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
168315 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
168316 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
168317 )
168318 THEN
168319 xla_ae_lines_pkg.BflowUpgEntry
168320 (p_business_method_code => l_bflow_method_code
168321 ,p_business_class_code => l_bflow_class_code
168322 ,p_balance_type => l_balance_type_code);
168323 ELSE
168324 NULL;
168325 -- No business flow processing for business flow method of NONE.
168326 END IF;
168327
168328 --
168329 -- call analytical criteria
168330 --
168331
168332 --
168333 -- call description
168334 --
168335
168336 xla_ae_lines_pkg.SetLineDescription(
168337 p_ae_header_id => l_ae_header_id
168338 ,p_description => Description_132 (
168339 p_application_id => p_application_id
168340 , p_ae_header_id => l_ae_header_id
168341 , p_source_1 => p_source_1
168342 )
168343 );
168344
168345
168346 --
168347 -- call ADRs
168348 -- Bug 4922099
168349 --
168350 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
168351 (NVL(l_actual_upg_option, 'N') = 'O') OR
168352 (NVL(l_enc_upg_option, 'N') = 'O')
168353 )
168354 THEN
168355 NULL;
168356 --
168357 --
168358
168359 l_ccid := AcctDerRule_175(
168360 p_application_id => p_application_id
168361 , p_ae_header_id => l_ae_header_id
168362 , p_source_5 => p_source_5
168363 , p_source_19 => p_source_19
168364 , p_source_32 => p_source_32
168365 , x_transaction_coa_id => l_adr_transaction_coa_id
168366 , x_accounting_coa_id => l_adr_accounting_coa_id
168367 , x_value_type_code => l_adr_value_type_code
168368 , p_side => 'NA'
168369 );
168370
168371 xla_ae_lines_pkg.set_ccid(
168372 p_code_combination_id => l_ccid
168373 , p_value_type_code => l_adr_value_type_code
168374 , p_transaction_coa_id => l_adr_transaction_coa_id
168375 , p_accounting_coa_id => l_adr_accounting_coa_id
168376 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
168377 , p_adr_type_code => 'S'
168378 , p_component_type => l_component_type
168379 , p_component_code => l_component_code
168380 , p_component_type_code => l_component_type_code
168381 , p_component_appl_id => l_component_appl_id
168382 , p_amb_context_code => l_amb_context_code
168383 , p_side => 'NA'
168384 );
168385
168386
168387 l_segment := AcctDerRule_145(
168388 p_application_id => p_application_id
168389 , p_ae_header_id => l_ae_header_id
168390 , p_source_5 => p_source_5
168391 , p_source_6 => p_source_6
168392 , x_transaction_coa_id => l_adr_transaction_coa_id
168393 , x_accounting_coa_id => l_adr_accounting_coa_id
168394 , x_flexfield_segment_code => l_adr_flexfield_segment_code
168395 , x_flex_value_set_id => l_adr_flex_value_set_id
168396 , x_value_type_code => l_adr_value_type_code
168397 , x_value_combination_id => l_adr_value_combination_id
168398 , x_value_segment_code => l_adr_value_segment_code
168399 , p_side => 'NA'
168400 , p_override_seg_flag => 'Y'
168401 );
168402
168403 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
168404
168405 xla_ae_lines_pkg.set_segment(
168406 p_to_segment_code => 'GL_ACCOUNT'
168407 , p_segment_value => l_segment
168408 , p_from_segment_code => l_adr_value_segment_code
168409 , p_from_combination_id => l_adr_value_combination_id
168410 , p_value_type_code => l_adr_value_type_code
168411 , p_transaction_coa_id => l_adr_transaction_coa_id
168415 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
168412 , p_accounting_coa_id => l_adr_accounting_coa_id
168413 , p_flexfield_segment_code => l_adr_flexfield_segment_code
168414 , p_flex_value_set_id => l_adr_flex_value_set_id
168416 , p_adr_type_code => 'S'
168417 , p_component_type => l_component_type
168418 , p_component_code => l_component_code
168419 , p_component_type_code => l_component_type_code
168420 , p_component_appl_id => l_component_appl_id
168421 , p_amb_context_code => l_amb_context_code
168422 , p_entity_code => 'TRANSACTIONS'
168423 , p_event_class_code => 'UNIT_ADJUSTMENTS'
168424 , p_side => 'NA'
168425 );
168426
168427 END IF;
168428
168429 l_segment := AcctDerRule_169(
168430 p_application_id => p_application_id
168431 , p_ae_header_id => l_ae_header_id
168432 , p_source_5 => p_source_5
168433 , p_source_31 => p_source_31
168434 , x_transaction_coa_id => l_adr_transaction_coa_id
168435 , x_accounting_coa_id => l_adr_accounting_coa_id
168436 , x_flexfield_segment_code => l_adr_flexfield_segment_code
168437 , x_flex_value_set_id => l_adr_flex_value_set_id
168438 , x_value_type_code => l_adr_value_type_code
168439 , x_value_combination_id => l_adr_value_combination_id
168440 , x_value_segment_code => l_adr_value_segment_code
168441 , p_side => 'NA'
168442 , p_override_seg_flag => 'Y'
168443 );
168444
168445 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
168446
168447 xla_ae_lines_pkg.set_segment(
168448 p_to_segment_code => 'GL_BALANCING'
168449 , p_segment_value => l_segment
168450 , p_from_segment_code => l_adr_value_segment_code
168451 , p_from_combination_id => l_adr_value_combination_id
168452 , p_value_type_code => l_adr_value_type_code
168453 , p_transaction_coa_id => l_adr_transaction_coa_id
168454 , p_accounting_coa_id => l_adr_accounting_coa_id
168455 , p_flexfield_segment_code => l_adr_flexfield_segment_code
168456 , p_flex_value_set_id => l_adr_flex_value_set_id
168457 , p_adr_code => 'FA_EXPENSE_ACCT'
168458 , p_adr_type_code => 'S'
168459 , p_component_type => l_component_type
168460 , p_component_code => l_component_code
168461 , p_component_type_code => l_component_type_code
168462 , p_component_appl_id => l_component_appl_id
168463 , p_amb_context_code => l_amb_context_code
168464 , p_entity_code => 'TRANSACTIONS'
168465 , p_event_class_code => 'UNIT_ADJUSTMENTS'
168466 , p_side => 'NA'
168467 );
168468
168469 END IF;
168470
168471 --
168472 --
168473 END IF;
168474 --
168475 -- Bug 4922099
168476 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
168477 (NVL(l_enc_upg_option, 'N') = 'O')
168478 ) AND
168479 (l_bflow_method_code = 'PRIOR_ENTRY')
168480 )
168481 THEN
168482 IF
168483 --
168484 1 = 2
168485 --
168486 THEN
168487 xla_accounting_err_pkg.build_message
168488 (p_appli_s_name => 'XLA'
168489 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
168490 ,p_token_1 => 'LINE_NUMBER'
168491 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
168492 ,p_token_2 => 'LINE_TYPE_NAME'
168493 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
168494 l_component_type
168495 ,l_component_code
168496 ,l_component_type_code
168497 ,l_component_appl_id
168498 ,l_amb_context_code
168499 ,l_entity_code
168500 ,l_event_class_code
168501 )
168502 ,p_token_3 => 'OWNER'
168503 ,p_value_3 => xla_lookups_pkg.get_meaning(
168504 p_lookup_type => 'XLA_OWNER_TYPE'
168505 ,p_lookup_code => l_component_type_code
168506 )
168507 ,p_token_4 => 'PRODUCT_NAME'
168508 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
168509 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
168513 );
168510 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
168511 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
168512 ,p_ae_header_id => NULL
168514
168515 IF (C_LEVEL_ERROR>= g_log_level) THEN
168516 trace
168517 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
168518 ,p_level => C_LEVEL_ERROR
168519 ,p_module => l_log_module);
168520 END IF;
168521 END IF;
168522 END IF;
168523 --
168524 --
168525 ------------------------------------------------------------------------------------------------
168526 -- 4219869 Business Flow
168527 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
168528 -- Prior Entry. Currently, the following code is always generated.
168529 ------------------------------------------------------------------------------------------------
168530 XLA_AE_LINES_PKG.ValidateCurrentLine;
168531
168532 ------------------------------------------------------------------------------------
168533 -- 4219869 Business Flow
168534 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
168535 ------------------------------------------------------------------------------------
168536 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
168537
168538 ----------------------------------------------------------------------------------
168539 -- 4219869 Business Flow
168540 -- Update journal entry status -- Need to generate this within IF <condition>
168541 ----------------------------------------------------------------------------------
168542 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
168543 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
168544 ,p_balance_type_code => l_balance_type_code
168545 );
168546
168547 -------------------------------------------------------------------------------------------
168548 -- 4262811 - Generate the Accrual Reversal lines
168549 -------------------------------------------------------------------------------------------
168550 BEGIN
168551 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
168552 (g_array_event(p_event_id).array_value_num('header_index'));
168553 IF l_acc_rev_flag IS NULL THEN
168554 l_acc_rev_flag := 'N';
168555 END IF;
168556 EXCEPTION
168557 WHEN OTHERS THEN
168558 l_acc_rev_flag := 'N';
168559 END;
168560 --
168561 IF (l_acc_rev_flag = 'Y') THEN
168562
168563 -- 4645092 ------------------------------------------------------------------------------
168564 -- To allow MPA report to determine if it should generate report process
168565 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
168566 ------------------------------------------------------------------------------------------
168567
168568 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
168569 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
168570 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
168571 -- call ADRs
168572 -- Bug 4922099
168573 --
168574 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
168575 (NVL(l_actual_upg_option, 'N') = 'O') OR
168576 (NVL(l_enc_upg_option, 'N') = 'O')
168577 )
168578 THEN
168579 NULL;
168580 --
168581 --
168582
168583 l_ccid := AcctDerRule_175(
168584 p_application_id => p_application_id
168585 , p_ae_header_id => l_ae_header_id
168586 , p_source_5 => p_source_5
168587 , p_source_19 => p_source_19
168588 , p_source_32 => p_source_32
168589 , x_transaction_coa_id => l_adr_transaction_coa_id
168590 , x_accounting_coa_id => l_adr_accounting_coa_id
168591 , x_value_type_code => l_adr_value_type_code
168592 , p_side => 'NA'
168593 );
168594
168595 xla_ae_lines_pkg.set_ccid(
168596 p_code_combination_id => l_ccid
168597 , p_value_type_code => l_adr_value_type_code
168598 , p_transaction_coa_id => l_adr_transaction_coa_id
168599 , p_accounting_coa_id => l_adr_accounting_coa_id
168600 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
168601 , p_adr_type_code => 'S'
168602 , p_component_type => l_component_type
168603 , p_component_code => l_component_code
168604 , p_component_type_code => l_component_type_code
168605 , p_component_appl_id => l_component_appl_id
168606 , p_amb_context_code => l_amb_context_code
168607 , p_side => 'NA'
168608 );
168609
168610
168611 l_segment := AcctDerRule_145(
168612 p_application_id => p_application_id
168613 , p_ae_header_id => l_ae_header_id
168614 , p_source_5 => p_source_5
168615 , p_source_6 => p_source_6
168616 , x_transaction_coa_id => l_adr_transaction_coa_id
168617 , x_accounting_coa_id => l_adr_accounting_coa_id
168618 , x_flexfield_segment_code => l_adr_flexfield_segment_code
168619 , x_flex_value_set_id => l_adr_flex_value_set_id
168620 , x_value_type_code => l_adr_value_type_code
168624 , p_override_seg_flag => 'Y'
168621 , x_value_combination_id => l_adr_value_combination_id
168622 , x_value_segment_code => l_adr_value_segment_code
168623 , p_side => 'NA'
168625 );
168626
168627 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
168628
168629 xla_ae_lines_pkg.set_segment(
168630 p_to_segment_code => 'GL_ACCOUNT'
168631 , p_segment_value => l_segment
168632 , p_from_segment_code => l_adr_value_segment_code
168633 , p_from_combination_id => l_adr_value_combination_id
168634 , p_value_type_code => l_adr_value_type_code
168635 , p_transaction_coa_id => l_adr_transaction_coa_id
168636 , p_accounting_coa_id => l_adr_accounting_coa_id
168637 , p_flexfield_segment_code => l_adr_flexfield_segment_code
168638 , p_flex_value_set_id => l_adr_flex_value_set_id
168639 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
168640 , p_adr_type_code => 'S'
168641 , p_component_type => l_component_type
168642 , p_component_code => l_component_code
168643 , p_component_type_code => l_component_type_code
168644 , p_component_appl_id => l_component_appl_id
168645 , p_amb_context_code => l_amb_context_code
168646 , p_entity_code => 'TRANSACTIONS'
168647 , p_event_class_code => 'UNIT_ADJUSTMENTS'
168648 , p_side => 'NA'
168649 );
168650
168651 END IF;
168652
168653 l_segment := AcctDerRule_169(
168654 p_application_id => p_application_id
168655 , p_ae_header_id => l_ae_header_id
168656 , p_source_5 => p_source_5
168657 , p_source_31 => p_source_31
168658 , x_transaction_coa_id => l_adr_transaction_coa_id
168659 , x_accounting_coa_id => l_adr_accounting_coa_id
168660 , x_flexfield_segment_code => l_adr_flexfield_segment_code
168661 , x_flex_value_set_id => l_adr_flex_value_set_id
168662 , x_value_type_code => l_adr_value_type_code
168663 , x_value_combination_id => l_adr_value_combination_id
168664 , x_value_segment_code => l_adr_value_segment_code
168665 , p_side => 'NA'
168666 , p_override_seg_flag => 'Y'
168667 );
168668
168669 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
168670
168671 xla_ae_lines_pkg.set_segment(
168672 p_to_segment_code => 'GL_BALANCING'
168673 , p_segment_value => l_segment
168674 , p_from_segment_code => l_adr_value_segment_code
168675 , p_from_combination_id => l_adr_value_combination_id
168676 , p_value_type_code => l_adr_value_type_code
168677 , p_transaction_coa_id => l_adr_transaction_coa_id
168678 , p_accounting_coa_id => l_adr_accounting_coa_id
168679 , p_flexfield_segment_code => l_adr_flexfield_segment_code
168680 , p_flex_value_set_id => l_adr_flex_value_set_id
168681 , p_adr_code => 'FA_EXPENSE_ACCT'
168682 , p_adr_type_code => 'S'
168683 , p_component_type => l_component_type
168684 , p_component_code => l_component_code
168685 , p_component_type_code => l_component_type_code
168686 , p_component_appl_id => l_component_appl_id
168687 , p_amb_context_code => l_amb_context_code
168688 , p_entity_code => 'TRANSACTIONS'
168689 , p_event_class_code => 'UNIT_ADJUSTMENTS'
168690 , p_side => 'NA'
168691 );
168692
168693 END IF;
168694
168695 --
168696 --
168697 END IF;
168698
168699 --
168700 -- Update the line information that should be overwritten
168701 --
168702 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
168703 p_header_num => 1);
168704 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
168705
168706 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
168707
168708 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
168709 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
168710 END IF;
168711
168712 --
168713 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
168714 --
168715 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
168716 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
168717 ELSE
168718 ---------------------------------------------------------------------------------------------------
168719 -- 4262811a Switch Sign
168720 ---------------------------------------------------------------------------------------------------
168721 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
168722 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
168723 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
168727 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
168724 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
168725 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
168726 -- 5132302
168728 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
168729
168730 END IF;
168731
168732 -- 4955764
168733 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
168734 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
168735
168736
168737 XLA_AE_LINES_PKG.ValidateCurrentLine;
168738 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
168739
168740 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
168741 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
168742 ,p_balance_type_code => l_balance_type_code);
168743
168744 END IF;
168745
168746 -----------------------------------------------------------------------------------------
168747 -- 4262811 Multiperiod Accounting
168748 -----------------------------------------------------------------------------------------
168749 -- No MPA option is assigned.
168750
168751
168752 END IF;
168753 END IF;
168754 --
168755
168756 --
168757 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
168758 trace
168759 (p_msg => 'END of AcctLineType_401'
168760 ,p_level => C_LEVEL_PROCEDURE
168761 ,p_module => l_log_module);
168762 END IF;
168763 --
168764 EXCEPTION
168765 WHEN xla_exceptions_pkg.application_exception THEN
168766 RAISE;
168767 WHEN OTHERS THEN
168768 xla_exceptions_pkg.raise_message
168769 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_401');
168770 END AcctLineType_401;
168771 --
168772
168773 ---------------------------------------
168774 --
168775 -- PRIVATE FUNCTION
168776 -- AcctLineType_402
168777 --
168778 ---------------------------------------
168779 PROCEDURE AcctLineType_402 (
168780 p_application_id IN NUMBER
168781 ,p_event_id IN NUMBER
168782 ,p_calculate_acctd_flag IN VARCHAR2
168783 ,p_calculate_g_l_flag IN VARCHAR2
168784 ,p_actual_flag IN OUT VARCHAR2
168785 ,p_balance_type_code OUT VARCHAR2
168786 ,p_gain_or_loss_ref OUT VARCHAR2
168787
168788 --Period Close Date
168789 , p_source_1 IN DATE
168790 --Generated Code Combination Identifier
168791 , p_source_5 IN NUMBER
168792 --Expense Account Code Combination Identifier
168793 , p_source_31 IN NUMBER
168794 --Adjustment Type
168795 , p_source_48 IN VARCHAR2
168796 --Transaction Header Identifier
168797 , p_source_49 IN NUMBER
168798 --Adjustment Line Identifier
168799 , p_source_50 IN NUMBER
168800 --Distribution Type Code
168801 , p_source_51 IN VARCHAR2
168802 --Entered Amount
168803 , p_source_52 IN NUMBER
168804 --Currency Code
168805 , p_source_53 IN VARCHAR2
168806 --Source Destination Code
168807 , p_source_55 IN VARCHAR2
168808 )
168809 IS
168810
168811 l_component_type VARCHAR2(80);
168812 l_component_code VARCHAR2(30);
168813 l_component_type_code VARCHAR2(1);
168814 l_component_appl_id INTEGER;
168815 l_amb_context_code VARCHAR2(30);
168816 l_entity_code VARCHAR2(30);
168817 l_event_class_code VARCHAR2(30);
168818 l_ae_header_id NUMBER;
168819 l_event_type_code VARCHAR2(30);
168820 l_line_definition_code VARCHAR2(30);
168821 l_line_definition_owner_code VARCHAR2(1);
168822 --
168823 -- adr variables
168824 l_segment VARCHAR2(30);
168825 l_ccid NUMBER;
168826 l_adr_transaction_coa_id NUMBER;
168827 l_adr_accounting_coa_id NUMBER;
168828 l_adr_flexfield_segment_code VARCHAR2(30);
168829 l_adr_flex_value_set_id NUMBER;
168830 l_adr_value_type_code VARCHAR2(30);
168831 l_adr_value_combination_id NUMBER;
168832 l_adr_value_segment_code VARCHAR2(30);
168833
168834 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
168835 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
168836 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
168837 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
168838
168839 -- 4262811 Variables ------------------------------------------------------------------------------------------
168840 l_entered_amt_idx NUMBER;
168841 l_accted_amt_idx NUMBER;
168842 l_acc_rev_flag VARCHAR2(1);
168843 l_accrual_line_num NUMBER;
168844 l_tmp_amt NUMBER;
168845 l_acc_rev_natural_side_code VARCHAR2(1);
168846
168847 l_num_entries NUMBER;
168848 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
168849 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
168850 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
168851 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
168852 l_recog_line_1 NUMBER;
168853 l_recog_line_2 NUMBER;
168854
168858
168855 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
168856 l_bflow_applied_to_amt NUMBER; -- 5132302
168857 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
168859 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
168860
168861 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
168862 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
168863
168864 ---------------------------------------------------------------------------------------------------------------
168865
168866
168867 --
168868 -- bulk performance
168869 --
168870 l_balance_type_code VARCHAR2(1);
168871 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
168872 l_log_module VARCHAR2(240);
168873
168874 --
168875 -- Upgrade strategy
168876 --
168877 l_actual_upg_option VARCHAR2(1);
168878 l_enc_upg_option VARCHAR2(1);
168879
168880 --
168881 BEGIN
168882 --
168883 IF g_log_enabled THEN
168884 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_402';
168885 END IF;
168886 --
168887 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
168888
168889 trace
168890 (p_msg => 'BEGIN of AcctLineType_402'
168891 ,p_level => C_LEVEL_PROCEDURE
168892 ,p_module => l_log_module);
168893
168894 END IF;
168895 --
168896 l_component_type := 'AMB_JLT';
168897 l_component_code := 'FA_UNITADJ_DEST_DEPRN_EXP';
168898 l_component_type_code := 'S';
168899 l_component_appl_id := 140;
168900 l_amb_context_code := 'DEFAULT';
168901 l_entity_code := 'TRANSACTIONS';
168902 l_event_class_code := 'UNIT_ADJUSTMENTS';
168903 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
168904 l_line_definition_owner_code := 'S';
168905 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
168906 --
168907 l_balance_type_code := 'A';
168908 l_segment := NULL;
168909 l_ccid := NULL;
168910 l_adr_transaction_coa_id := NULL;
168911 l_adr_accounting_coa_id := NULL;
168912 l_adr_flexfield_segment_code := NULL;
168913 l_adr_flex_value_set_id := NULL;
168914 l_adr_value_type_code := NULL;
168915 l_adr_value_combination_id := NULL;
168916 l_adr_value_segment_code := NULL;
168917
168918 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
168919 l_bflow_class_code := ''; -- 4219869 Business Flow
168920 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
168921 l_budgetary_control_flag := 'N';
168922
168923 l_bflow_applied_to_amt_idx := NULL; -- 5132302
168924 l_bflow_applied_to_amt := NULL; -- 5132302
168925 l_entered_amt_idx := NULL; -- 4262811
168926 l_accted_amt_idx := NULL; -- 4262811
168927 l_acc_rev_flag := NULL; -- 4262811
168928 l_accrual_line_num := NULL; -- 4262811
168929 l_tmp_amt := NULL; -- 4262811
168930 --
168931
168932 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
168933 l_balance_type_code <> 'B' THEN
168934 IF NVL(p_source_48,'
168935 ') = 'EXPENSE' AND
168936 NVL(p_source_55,'
168937 ') = 'DEST'
168938 THEN
168939
168940 --
168941 XLA_AE_LINES_PKG.SetNewLine;
168942
168943 p_balance_type_code := l_balance_type_code;
168944 -- set the flag so later we will know whether the gain loss line needs to be created
168945
168946 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
168947 p_actual_flag :='A';
168948 END IF;
168949
168950 --
168951 -- bulk performance
168952 --
168953 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
168954 p_header_num => 0); -- 4262811
168955 --
168956 -- set accounting line options
168957 --
168958 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
168959 p_natural_side_code => 'D'
168960 , p_gain_or_loss_flag => 'N'
168961 , p_gl_transfer_mode_code => 'S'
168962 , p_acct_entry_type_code => 'A'
168963 , p_switch_side_flag => 'Y'
168964 , p_merge_duplicate_code => 'N'
168965 );
168966 --
168967 l_acc_rev_natural_side_code := 'C'; -- 4262811
168968 --
168969 --
168970 -- set accounting line type info
168971 --
168972 xla_ae_lines_pkg.SetAcctLineType
168973 (p_component_type => l_component_type
168974 ,p_event_type_code => l_event_type_code
168975 ,p_line_definition_owner_code => l_line_definition_owner_code
168976 ,p_line_definition_code => l_line_definition_code
168977 ,p_accounting_line_code => l_component_code
168978 ,p_accounting_line_type_code => l_component_type_code
168979 ,p_accounting_line_appl_id => l_component_appl_id
168980 ,p_amb_context_code => l_amb_context_code
168981 ,p_entity_code => l_entity_code
168982 ,p_event_class_code => l_event_class_code);
168983 --
168984 -- set accounting class
168985 --
168989 );
168986 xla_ae_lines_pkg.SetAcctClass(
168987 p_accounting_class_code => 'EXPENSE'
168988 , p_ae_header_id => l_ae_header_id
168990
168991 --
168992 -- set rounding class
168993 --
168994 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
168995 'EXPENSE';
168996
168997 --
168998 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
168999 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
169000 --
169001 -- bulk performance
169002 --
169003 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
169004
169005 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
169006 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
169007
169008 -- 4955764
169009 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
169010 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
169011
169012 -- 4458381 Public Sector Enh
169013
169014 --
169015 -- set accounting attributes for the line type
169016 --
169017 l_entered_amt_idx := 4;
169018 l_accted_amt_idx := 6;
169019 l_bflow_applied_to_amt_idx := NULL; -- 5132302
169020 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
169021 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
169022 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
169023 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
169024 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
169025 l_rec_acct_attrs.array_char_value(3) := p_source_51;
169026 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
169027 l_rec_acct_attrs.array_num_value(4) := p_source_52;
169028 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
169029 l_rec_acct_attrs.array_char_value(5) := p_source_53;
169030 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
169031 l_rec_acct_attrs.array_num_value(6) := p_source_52;
169032
169033 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
169034 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
169035
169036 ---------------------------------------------------------------------------------------------------------------
169037 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
169038 ---------------------------------------------------------------------------------------------------------------
169039 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
169040
169041 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
169042 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
169043
169044 IF xla_accounting_cache_pkg.GetValueChar
169045 (p_source_code => 'LEDGER_CATEGORY_CODE'
169046 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
169047 AND l_bflow_method_code = 'PRIOR_ENTRY'
169048 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
169049 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
169050 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
169051 )
169052 THEN
169053 xla_ae_lines_pkg.BflowUpgEntry
169054 (p_business_method_code => l_bflow_method_code
169055 ,p_business_class_code => l_bflow_class_code
169056 ,p_balance_type => l_balance_type_code);
169057 ELSE
169058 NULL;
169059 -- No business flow processing for business flow method of NONE.
169060 END IF;
169061
169062 --
169063 -- call analytical criteria
169064 --
169065
169066 --
169067 -- call description
169068 --
169069
169070 xla_ae_lines_pkg.SetLineDescription(
169071 p_ae_header_id => l_ae_header_id
169072 ,p_description => Description_134 (
169073 p_application_id => p_application_id
169074 , p_ae_header_id => l_ae_header_id
169075 , p_source_1 => p_source_1
169076 )
169077 );
169078
169079
169080 --
169081 -- call ADRs
169082 -- Bug 4922099
169083 --
169084 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
169085 (NVL(l_actual_upg_option, 'N') = 'O') OR
169086 (NVL(l_enc_upg_option, 'N') = 'O')
169087 )
169088 THEN
169089 NULL;
169090 --
169091 --
169092
169093 l_ccid := AcctDerRule_176(
169094 p_application_id => p_application_id
169095 , p_ae_header_id => l_ae_header_id
169096 , p_source_5 => p_source_5
169097 , p_source_31 => p_source_31
169098 , x_transaction_coa_id => l_adr_transaction_coa_id
169099 , x_accounting_coa_id => l_adr_accounting_coa_id
169100 , x_value_type_code => l_adr_value_type_code
169101 , p_side => 'NA'
169102 );
169103
169104 xla_ae_lines_pkg.set_ccid(
169105 p_code_combination_id => l_ccid
169106 , p_value_type_code => l_adr_value_type_code
169107 , p_transaction_coa_id => l_adr_transaction_coa_id
169111 , p_component_type => l_component_type
169108 , p_accounting_coa_id => l_adr_accounting_coa_id
169109 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
169110 , p_adr_type_code => 'S'
169112 , p_component_code => l_component_code
169113 , p_component_type_code => l_component_type_code
169114 , p_component_appl_id => l_component_appl_id
169115 , p_amb_context_code => l_amb_context_code
169116 , p_side => 'NA'
169117 );
169118
169119
169120 --
169121 --
169122 END IF;
169123 --
169124 -- Bug 4922099
169125 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
169126 (NVL(l_enc_upg_option, 'N') = 'O')
169127 ) AND
169128 (l_bflow_method_code = 'PRIOR_ENTRY')
169129 )
169130 THEN
169131 IF
169132 --
169133 1 = 2
169134 --
169135 THEN
169136 xla_accounting_err_pkg.build_message
169137 (p_appli_s_name => 'XLA'
169138 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
169139 ,p_token_1 => 'LINE_NUMBER'
169140 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
169141 ,p_token_2 => 'LINE_TYPE_NAME'
169142 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
169143 l_component_type
169144 ,l_component_code
169145 ,l_component_type_code
169146 ,l_component_appl_id
169147 ,l_amb_context_code
169148 ,l_entity_code
169149 ,l_event_class_code
169150 )
169151 ,p_token_3 => 'OWNER'
169152 ,p_value_3 => xla_lookups_pkg.get_meaning(
169153 p_lookup_type => 'XLA_OWNER_TYPE'
169154 ,p_lookup_code => l_component_type_code
169155 )
169156 ,p_token_4 => 'PRODUCT_NAME'
169157 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
169158 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
169159 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
169160 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
169161 ,p_ae_header_id => NULL
169162 );
169163
169164 IF (C_LEVEL_ERROR>= g_log_level) THEN
169165 trace
169166 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
169167 ,p_level => C_LEVEL_ERROR
169168 ,p_module => l_log_module);
169169 END IF;
169170 END IF;
169171 END IF;
169172 --
169173 --
169174 ------------------------------------------------------------------------------------------------
169175 -- 4219869 Business Flow
169176 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
169177 -- Prior Entry. Currently, the following code is always generated.
169178 ------------------------------------------------------------------------------------------------
169179 XLA_AE_LINES_PKG.ValidateCurrentLine;
169180
169181 ------------------------------------------------------------------------------------
169182 -- 4219869 Business Flow
169183 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
169184 ------------------------------------------------------------------------------------
169185 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
169186
169187 ----------------------------------------------------------------------------------
169188 -- 4219869 Business Flow
169189 -- Update journal entry status -- Need to generate this within IF <condition>
169190 ----------------------------------------------------------------------------------
169191 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
169192 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
169193 ,p_balance_type_code => l_balance_type_code
169194 );
169195
169196 -------------------------------------------------------------------------------------------
169197 -- 4262811 - Generate the Accrual Reversal lines
169198 -------------------------------------------------------------------------------------------
169199 BEGIN
169200 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
169201 (g_array_event(p_event_id).array_value_num('header_index'));
169202 IF l_acc_rev_flag IS NULL THEN
169203 l_acc_rev_flag := 'N';
169204 END IF;
169208 END;
169205 EXCEPTION
169206 WHEN OTHERS THEN
169207 l_acc_rev_flag := 'N';
169209 --
169210 IF (l_acc_rev_flag = 'Y') THEN
169211
169212 -- 4645092 ------------------------------------------------------------------------------
169213 -- To allow MPA report to determine if it should generate report process
169214 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
169215 ------------------------------------------------------------------------------------------
169216
169217 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
169218 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
169219 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
169220 -- call ADRs
169221 -- Bug 4922099
169222 --
169223 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
169224 (NVL(l_actual_upg_option, 'N') = 'O') OR
169225 (NVL(l_enc_upg_option, 'N') = 'O')
169226 )
169227 THEN
169228 NULL;
169229 --
169230 --
169231
169232 l_ccid := AcctDerRule_176(
169233 p_application_id => p_application_id
169234 , p_ae_header_id => l_ae_header_id
169235 , p_source_5 => p_source_5
169236 , p_source_31 => p_source_31
169237 , x_transaction_coa_id => l_adr_transaction_coa_id
169238 , x_accounting_coa_id => l_adr_accounting_coa_id
169239 , x_value_type_code => l_adr_value_type_code
169240 , p_side => 'NA'
169241 );
169242
169243 xla_ae_lines_pkg.set_ccid(
169244 p_code_combination_id => l_ccid
169245 , p_value_type_code => l_adr_value_type_code
169246 , p_transaction_coa_id => l_adr_transaction_coa_id
169247 , p_accounting_coa_id => l_adr_accounting_coa_id
169248 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
169249 , p_adr_type_code => 'S'
169250 , p_component_type => l_component_type
169251 , p_component_code => l_component_code
169252 , p_component_type_code => l_component_type_code
169253 , p_component_appl_id => l_component_appl_id
169254 , p_amb_context_code => l_amb_context_code
169255 , p_side => 'NA'
169256 );
169257
169258
169259 --
169260 --
169261 END IF;
169262
169263 --
169264 -- Update the line information that should be overwritten
169265 --
169266 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
169267 p_header_num => 1);
169268 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
169269
169270 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
169271
169272 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
169273 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
169274 END IF;
169275
169276 --
169277 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
169278 --
169279 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
169280 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
169281 ELSE
169282 ---------------------------------------------------------------------------------------------------
169283 -- 4262811a Switch Sign
169284 ---------------------------------------------------------------------------------------------------
169285 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
169286 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
169287 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
169288 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
169289 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
169290 -- 5132302
169291 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
169292 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
169293
169294 END IF;
169295
169296 -- 4955764
169297 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
169298 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
169299
169300
169301 XLA_AE_LINES_PKG.ValidateCurrentLine;
169302 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
169303
169304 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
169305 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
169306 ,p_balance_type_code => l_balance_type_code);
169307
169308 END IF;
169309
169310 -----------------------------------------------------------------------------------------
169311 -- 4262811 Multiperiod Accounting
169312 -----------------------------------------------------------------------------------------
169313 -- No MPA option is assigned.
169314
169315
169316 END IF;
169317 END IF;
169318 --
169319
169320 --
169324 ,p_level => C_LEVEL_PROCEDURE
169321 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
169322 trace
169323 (p_msg => 'END of AcctLineType_402'
169325 ,p_module => l_log_module);
169326 END IF;
169327 --
169328 EXCEPTION
169329 WHEN xla_exceptions_pkg.application_exception THEN
169330 RAISE;
169331 WHEN OTHERS THEN
169332 xla_exceptions_pkg.raise_message
169333 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_402');
169334 END AcctLineType_402;
169335 --
169336
169337 ---------------------------------------
169338 --
169339 -- PRIVATE FUNCTION
169340 -- AcctLineType_403
169341 --
169342 ---------------------------------------
169343 PROCEDURE AcctLineType_403 (
169344 p_application_id IN NUMBER
169345 ,p_event_id IN NUMBER
169346 ,p_calculate_acctd_flag IN VARCHAR2
169347 ,p_calculate_g_l_flag IN VARCHAR2
169348 ,p_actual_flag IN OUT VARCHAR2
169349 ,p_balance_type_code OUT VARCHAR2
169350 ,p_gain_or_loss_ref OUT VARCHAR2
169351
169352 --Period Close Date
169353 , p_source_1 IN DATE
169354 --Generated Code Combination Identifier
169355 , p_source_5 IN NUMBER
169356 --Depreciation Reserve Account
169357 , p_source_12 IN VARCHAR2
169358 --Generated Offset Code Combination Identifier
169359 , p_source_19 IN NUMBER
169360 --Expense Account Code Combination Identifier
169361 , p_source_31 IN NUMBER
169362 --Default Code Combination Identifier
169363 , p_source_32 IN NUMBER
169364 --Adjustment Type
169365 , p_source_48 IN VARCHAR2
169366 --Transaction Header Identifier
169367 , p_source_49 IN NUMBER
169368 --Adjustment Line Identifier
169369 , p_source_50 IN NUMBER
169370 --Distribution Type Code
169371 , p_source_51 IN VARCHAR2
169372 --Entered Amount
169373 , p_source_52 IN NUMBER
169374 --Currency Code
169375 , p_source_53 IN VARCHAR2
169376 --Source Destination Code
169377 , p_source_55 IN VARCHAR2
169378 )
169379 IS
169380
169381 l_component_type VARCHAR2(80);
169382 l_component_code VARCHAR2(30);
169383 l_component_type_code VARCHAR2(1);
169384 l_component_appl_id INTEGER;
169385 l_amb_context_code VARCHAR2(30);
169386 l_entity_code VARCHAR2(30);
169387 l_event_class_code VARCHAR2(30);
169388 l_ae_header_id NUMBER;
169389 l_event_type_code VARCHAR2(30);
169390 l_line_definition_code VARCHAR2(30);
169391 l_line_definition_owner_code VARCHAR2(1);
169392 --
169393 -- adr variables
169394 l_segment VARCHAR2(30);
169395 l_ccid NUMBER;
169396 l_adr_transaction_coa_id NUMBER;
169397 l_adr_accounting_coa_id NUMBER;
169398 l_adr_flexfield_segment_code VARCHAR2(30);
169399 l_adr_flex_value_set_id NUMBER;
169400 l_adr_value_type_code VARCHAR2(30);
169401 l_adr_value_combination_id NUMBER;
169402 l_adr_value_segment_code VARCHAR2(30);
169403
169404 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
169405 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
169406 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
169407 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
169408
169409 -- 4262811 Variables ------------------------------------------------------------------------------------------
169410 l_entered_amt_idx NUMBER;
169411 l_accted_amt_idx NUMBER;
169412 l_acc_rev_flag VARCHAR2(1);
169413 l_accrual_line_num NUMBER;
169414 l_tmp_amt NUMBER;
169415 l_acc_rev_natural_side_code VARCHAR2(1);
169416
169417 l_num_entries NUMBER;
169418 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
169419 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
169420 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
169421 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
169422 l_recog_line_1 NUMBER;
169423 l_recog_line_2 NUMBER;
169424
169425 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
169426 l_bflow_applied_to_amt NUMBER; -- 5132302
169427 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
169428
169429 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
169430
169431 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
169432 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
169433
169434 ---------------------------------------------------------------------------------------------------------------
169435
169436
169437 --
169438 -- bulk performance
169439 --
169440 l_balance_type_code VARCHAR2(1);
169441 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
169442 l_log_module VARCHAR2(240);
169443
169444 --
169445 -- Upgrade strategy
169446 --
169447 l_actual_upg_option VARCHAR2(1);
169448 l_enc_upg_option VARCHAR2(1);
169449
169450 --
169451 BEGIN
169452 --
169453 IF g_log_enabled THEN
169454 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_403';
169458
169455 END IF;
169456 --
169457 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
169459 trace
169460 (p_msg => 'BEGIN of AcctLineType_403'
169461 ,p_level => C_LEVEL_PROCEDURE
169462 ,p_module => l_log_module);
169463
169464 END IF;
169465 --
169466 l_component_type := 'AMB_JLT';
169467 l_component_code := 'FA_UNITADJ_DEST_DEPRN_RESERVE';
169468 l_component_type_code := 'S';
169469 l_component_appl_id := 140;
169470 l_amb_context_code := 'DEFAULT';
169471 l_entity_code := 'TRANSACTIONS';
169472 l_event_class_code := 'UNIT_ADJUSTMENTS';
169473 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
169474 l_line_definition_owner_code := 'S';
169475 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
169476 --
169477 l_balance_type_code := 'A';
169478 l_segment := NULL;
169479 l_ccid := NULL;
169480 l_adr_transaction_coa_id := NULL;
169481 l_adr_accounting_coa_id := NULL;
169482 l_adr_flexfield_segment_code := NULL;
169483 l_adr_flex_value_set_id := NULL;
169484 l_adr_value_type_code := NULL;
169485 l_adr_value_combination_id := NULL;
169486 l_adr_value_segment_code := NULL;
169487
169488 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
169489 l_bflow_class_code := ''; -- 4219869 Business Flow
169490 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
169491 l_budgetary_control_flag := 'N';
169492
169493 l_bflow_applied_to_amt_idx := NULL; -- 5132302
169494 l_bflow_applied_to_amt := NULL; -- 5132302
169495 l_entered_amt_idx := NULL; -- 4262811
169496 l_accted_amt_idx := NULL; -- 4262811
169497 l_acc_rev_flag := NULL; -- 4262811
169498 l_accrual_line_num := NULL; -- 4262811
169499 l_tmp_amt := NULL; -- 4262811
169500 --
169501
169502 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
169503 l_balance_type_code <> 'B' THEN
169504 IF (NVL(p_source_48,'
169505 ') = 'RESERVE' OR
169506 NVL(p_source_48,'
169507 ') = 'EXPENSE') AND
169508 NVL(p_source_55,'
169509 ') = 'DEST'
169510 THEN
169511
169512 --
169513 XLA_AE_LINES_PKG.SetNewLine;
169514
169515 p_balance_type_code := l_balance_type_code;
169516 -- set the flag so later we will know whether the gain loss line needs to be created
169517
169518 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
169519 p_actual_flag :='A';
169520 END IF;
169521
169522 --
169523 -- bulk performance
169524 --
169525 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
169526 p_header_num => 0); -- 4262811
169527 --
169528 -- set accounting line options
169529 --
169530 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
169531 p_natural_side_code => 'C'
169532 , p_gain_or_loss_flag => 'N'
169533 , p_gl_transfer_mode_code => 'S'
169534 , p_acct_entry_type_code => 'A'
169535 , p_switch_side_flag => 'Y'
169536 , p_merge_duplicate_code => 'N'
169537 );
169538 --
169539 l_acc_rev_natural_side_code := 'D'; -- 4262811
169540 --
169541 --
169542 -- set accounting line type info
169543 --
169544 xla_ae_lines_pkg.SetAcctLineType
169545 (p_component_type => l_component_type
169546 ,p_event_type_code => l_event_type_code
169547 ,p_line_definition_owner_code => l_line_definition_owner_code
169548 ,p_line_definition_code => l_line_definition_code
169549 ,p_accounting_line_code => l_component_code
169550 ,p_accounting_line_type_code => l_component_type_code
169551 ,p_accounting_line_appl_id => l_component_appl_id
169552 ,p_amb_context_code => l_amb_context_code
169553 ,p_entity_code => l_entity_code
169554 ,p_event_class_code => l_event_class_code);
169555 --
169556 -- set accounting class
169557 --
169558 xla_ae_lines_pkg.SetAcctClass(
169559 p_accounting_class_code => 'ASSET'
169560 , p_ae_header_id => l_ae_header_id
169561 );
169562
169563 --
169564 -- set rounding class
169565 --
169566 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
169567 'ASSET';
169568
169569 --
169570 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
169571 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
169572 --
169573 -- bulk performance
169574 --
169575 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
169576
169577 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
169578 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
169579
169580 -- 4955764
169581 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
169585
169582 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
169583
169584 -- 4458381 Public Sector Enh
169586 --
169587 -- set accounting attributes for the line type
169588 --
169589 l_entered_amt_idx := 4;
169590 l_accted_amt_idx := 6;
169591 l_bflow_applied_to_amt_idx := NULL; -- 5132302
169592 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
169593 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
169594 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
169595 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
169596 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
169597 l_rec_acct_attrs.array_char_value(3) := p_source_51;
169598 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
169599 l_rec_acct_attrs.array_num_value(4) := p_source_52;
169600 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
169601 l_rec_acct_attrs.array_char_value(5) := p_source_53;
169602 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
169603 l_rec_acct_attrs.array_num_value(6) := p_source_52;
169604
169605 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
169606 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
169607
169608 ---------------------------------------------------------------------------------------------------------------
169609 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
169610 ---------------------------------------------------------------------------------------------------------------
169611 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
169612
169613 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
169614 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
169615
169616 IF xla_accounting_cache_pkg.GetValueChar
169617 (p_source_code => 'LEDGER_CATEGORY_CODE'
169618 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
169619 AND l_bflow_method_code = 'PRIOR_ENTRY'
169620 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
169621 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
169622 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
169623 )
169624 THEN
169625 xla_ae_lines_pkg.BflowUpgEntry
169626 (p_business_method_code => l_bflow_method_code
169627 ,p_business_class_code => l_bflow_class_code
169628 ,p_balance_type => l_balance_type_code);
169629 ELSE
169630 NULL;
169631 -- No business flow processing for business flow method of NONE.
169632 END IF;
169633
169634 --
169635 -- call analytical criteria
169636 --
169637
169638 --
169639 -- call description
169640 --
169641
169642 xla_ae_lines_pkg.SetLineDescription(
169643 p_ae_header_id => l_ae_header_id
169644 ,p_description => Description_137 (
169645 p_application_id => p_application_id
169646 , p_ae_header_id => l_ae_header_id
169647 , p_source_1 => p_source_1
169648 )
169649 );
169650
169651
169652 --
169653 -- call ADRs
169654 -- Bug 4922099
169655 --
169656 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
169657 (NVL(l_actual_upg_option, 'N') = 'O') OR
169658 (NVL(l_enc_upg_option, 'N') = 'O')
169659 )
169660 THEN
169661 NULL;
169662 --
169663 --
169664
169665 l_ccid := AcctDerRule_175(
169666 p_application_id => p_application_id
169667 , p_ae_header_id => l_ae_header_id
169668 , p_source_5 => p_source_5
169669 , p_source_19 => p_source_19
169670 , p_source_32 => p_source_32
169671 , x_transaction_coa_id => l_adr_transaction_coa_id
169672 , x_accounting_coa_id => l_adr_accounting_coa_id
169673 , x_value_type_code => l_adr_value_type_code
169674 , p_side => 'NA'
169675 );
169676
169677 xla_ae_lines_pkg.set_ccid(
169678 p_code_combination_id => l_ccid
169679 , p_value_type_code => l_adr_value_type_code
169680 , p_transaction_coa_id => l_adr_transaction_coa_id
169681 , p_accounting_coa_id => l_adr_accounting_coa_id
169682 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
169683 , p_adr_type_code => 'S'
169684 , p_component_type => l_component_type
169685 , p_component_code => l_component_code
169686 , p_component_type_code => l_component_type_code
169687 , p_component_appl_id => l_component_appl_id
169688 , p_amb_context_code => l_amb_context_code
169689 , p_side => 'NA'
169690 );
169691
169692
169693 l_segment := AcctDerRule_150(
169694 p_application_id => p_application_id
169695 , p_ae_header_id => l_ae_header_id
169696 , p_source_5 => p_source_5
169697 , p_source_12 => p_source_12
169698 , x_transaction_coa_id => l_adr_transaction_coa_id
169699 , x_accounting_coa_id => l_adr_accounting_coa_id
169700 , x_flexfield_segment_code => l_adr_flexfield_segment_code
169701 , x_flex_value_set_id => l_adr_flex_value_set_id
169705 , p_side => 'NA'
169702 , x_value_type_code => l_adr_value_type_code
169703 , x_value_combination_id => l_adr_value_combination_id
169704 , x_value_segment_code => l_adr_value_segment_code
169706 , p_override_seg_flag => 'Y'
169707 );
169708
169709 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
169710
169711 xla_ae_lines_pkg.set_segment(
169712 p_to_segment_code => 'GL_ACCOUNT'
169713 , p_segment_value => l_segment
169714 , p_from_segment_code => l_adr_value_segment_code
169715 , p_from_combination_id => l_adr_value_combination_id
169716 , p_value_type_code => l_adr_value_type_code
169717 , p_transaction_coa_id => l_adr_transaction_coa_id
169718 , p_accounting_coa_id => l_adr_accounting_coa_id
169719 , p_flexfield_segment_code => l_adr_flexfield_segment_code
169720 , p_flex_value_set_id => l_adr_flex_value_set_id
169721 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
169722 , p_adr_type_code => 'S'
169723 , p_component_type => l_component_type
169724 , p_component_code => l_component_code
169725 , p_component_type_code => l_component_type_code
169726 , p_component_appl_id => l_component_appl_id
169727 , p_amb_context_code => l_amb_context_code
169728 , p_entity_code => 'TRANSACTIONS'
169729 , p_event_class_code => 'UNIT_ADJUSTMENTS'
169730 , p_side => 'NA'
169731 );
169732
169733 END IF;
169734
169735 l_segment := AcctDerRule_169(
169736 p_application_id => p_application_id
169737 , p_ae_header_id => l_ae_header_id
169738 , p_source_5 => p_source_5
169739 , p_source_31 => p_source_31
169740 , x_transaction_coa_id => l_adr_transaction_coa_id
169741 , x_accounting_coa_id => l_adr_accounting_coa_id
169742 , x_flexfield_segment_code => l_adr_flexfield_segment_code
169743 , x_flex_value_set_id => l_adr_flex_value_set_id
169744 , x_value_type_code => l_adr_value_type_code
169745 , x_value_combination_id => l_adr_value_combination_id
169746 , x_value_segment_code => l_adr_value_segment_code
169747 , p_side => 'NA'
169748 , p_override_seg_flag => 'Y'
169749 );
169750
169751 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
169752
169753 xla_ae_lines_pkg.set_segment(
169754 p_to_segment_code => 'GL_BALANCING'
169755 , p_segment_value => l_segment
169756 , p_from_segment_code => l_adr_value_segment_code
169757 , p_from_combination_id => l_adr_value_combination_id
169758 , p_value_type_code => l_adr_value_type_code
169759 , p_transaction_coa_id => l_adr_transaction_coa_id
169760 , p_accounting_coa_id => l_adr_accounting_coa_id
169761 , p_flexfield_segment_code => l_adr_flexfield_segment_code
169762 , p_flex_value_set_id => l_adr_flex_value_set_id
169763 , p_adr_code => 'FA_EXPENSE_ACCT'
169764 , p_adr_type_code => 'S'
169765 , p_component_type => l_component_type
169766 , p_component_code => l_component_code
169767 , p_component_type_code => l_component_type_code
169768 , p_component_appl_id => l_component_appl_id
169769 , p_amb_context_code => l_amb_context_code
169770 , p_entity_code => 'TRANSACTIONS'
169771 , p_event_class_code => 'UNIT_ADJUSTMENTS'
169772 , p_side => 'NA'
169773 );
169774
169775 END IF;
169776
169777 --
169778 --
169779 END IF;
169780 --
169781 -- Bug 4922099
169782 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
169783 (NVL(l_enc_upg_option, 'N') = 'O')
169784 ) AND
169785 (l_bflow_method_code = 'PRIOR_ENTRY')
169786 )
169787 THEN
169788 IF
169789 --
169790 1 = 2
169791 --
169792 THEN
169793 xla_accounting_err_pkg.build_message
169794 (p_appli_s_name => 'XLA'
169795 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
169796 ,p_token_1 => 'LINE_NUMBER'
169797 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
169798 ,p_token_2 => 'LINE_TYPE_NAME'
169799 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
169800 l_component_type
169801 ,l_component_code
169802 ,l_component_type_code
169803 ,l_component_appl_id
169804 ,l_amb_context_code
169805 ,l_entity_code
169806 ,l_event_class_code
169807 )
169811 ,p_lookup_code => l_component_type_code
169808 ,p_token_3 => 'OWNER'
169809 ,p_value_3 => xla_lookups_pkg.get_meaning(
169810 p_lookup_type => 'XLA_OWNER_TYPE'
169812 )
169813 ,p_token_4 => 'PRODUCT_NAME'
169814 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
169815 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
169816 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
169817 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
169818 ,p_ae_header_id => NULL
169819 );
169820
169821 IF (C_LEVEL_ERROR>= g_log_level) THEN
169822 trace
169823 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
169824 ,p_level => C_LEVEL_ERROR
169825 ,p_module => l_log_module);
169826 END IF;
169827 END IF;
169828 END IF;
169829 --
169830 --
169831 ------------------------------------------------------------------------------------------------
169832 -- 4219869 Business Flow
169833 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
169834 -- Prior Entry. Currently, the following code is always generated.
169835 ------------------------------------------------------------------------------------------------
169836 XLA_AE_LINES_PKG.ValidateCurrentLine;
169837
169838 ------------------------------------------------------------------------------------
169839 -- 4219869 Business Flow
169840 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
169841 ------------------------------------------------------------------------------------
169842 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
169843
169844 ----------------------------------------------------------------------------------
169845 -- 4219869 Business Flow
169846 -- Update journal entry status -- Need to generate this within IF <condition>
169847 ----------------------------------------------------------------------------------
169848 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
169849 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
169850 ,p_balance_type_code => l_balance_type_code
169851 );
169852
169853 -------------------------------------------------------------------------------------------
169854 -- 4262811 - Generate the Accrual Reversal lines
169855 -------------------------------------------------------------------------------------------
169856 BEGIN
169857 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
169858 (g_array_event(p_event_id).array_value_num('header_index'));
169859 IF l_acc_rev_flag IS NULL THEN
169860 l_acc_rev_flag := 'N';
169861 END IF;
169862 EXCEPTION
169863 WHEN OTHERS THEN
169864 l_acc_rev_flag := 'N';
169865 END;
169866 --
169867 IF (l_acc_rev_flag = 'Y') THEN
169868
169869 -- 4645092 ------------------------------------------------------------------------------
169870 -- To allow MPA report to determine if it should generate report process
169871 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
169872 ------------------------------------------------------------------------------------------
169873
169874 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
169875 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
169876 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
169877 -- call ADRs
169878 -- Bug 4922099
169879 --
169880 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
169881 (NVL(l_actual_upg_option, 'N') = 'O') OR
169882 (NVL(l_enc_upg_option, 'N') = 'O')
169883 )
169884 THEN
169885 NULL;
169886 --
169887 --
169888
169889 l_ccid := AcctDerRule_175(
169890 p_application_id => p_application_id
169891 , p_ae_header_id => l_ae_header_id
169892 , p_source_5 => p_source_5
169893 , p_source_19 => p_source_19
169894 , p_source_32 => p_source_32
169895 , x_transaction_coa_id => l_adr_transaction_coa_id
169896 , x_accounting_coa_id => l_adr_accounting_coa_id
169897 , x_value_type_code => l_adr_value_type_code
169898 , p_side => 'NA'
169899 );
169900
169901 xla_ae_lines_pkg.set_ccid(
169902 p_code_combination_id => l_ccid
169903 , p_value_type_code => l_adr_value_type_code
169904 , p_transaction_coa_id => l_adr_transaction_coa_id
169905 , p_accounting_coa_id => l_adr_accounting_coa_id
169906 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
169907 , p_adr_type_code => 'S'
169908 , p_component_type => l_component_type
169909 , p_component_code => l_component_code
169910 , p_component_type_code => l_component_type_code
169914 );
169911 , p_component_appl_id => l_component_appl_id
169912 , p_amb_context_code => l_amb_context_code
169913 , p_side => 'NA'
169915
169916
169917 l_segment := AcctDerRule_150(
169918 p_application_id => p_application_id
169919 , p_ae_header_id => l_ae_header_id
169920 , p_source_5 => p_source_5
169921 , p_source_12 => p_source_12
169922 , x_transaction_coa_id => l_adr_transaction_coa_id
169923 , x_accounting_coa_id => l_adr_accounting_coa_id
169924 , x_flexfield_segment_code => l_adr_flexfield_segment_code
169925 , x_flex_value_set_id => l_adr_flex_value_set_id
169926 , x_value_type_code => l_adr_value_type_code
169927 , x_value_combination_id => l_adr_value_combination_id
169928 , x_value_segment_code => l_adr_value_segment_code
169929 , p_side => 'NA'
169930 , p_override_seg_flag => 'Y'
169931 );
169932
169933 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
169934
169935 xla_ae_lines_pkg.set_segment(
169936 p_to_segment_code => 'GL_ACCOUNT'
169937 , p_segment_value => l_segment
169938 , p_from_segment_code => l_adr_value_segment_code
169939 , p_from_combination_id => l_adr_value_combination_id
169940 , p_value_type_code => l_adr_value_type_code
169941 , p_transaction_coa_id => l_adr_transaction_coa_id
169942 , p_accounting_coa_id => l_adr_accounting_coa_id
169943 , p_flexfield_segment_code => l_adr_flexfield_segment_code
169944 , p_flex_value_set_id => l_adr_flex_value_set_id
169945 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
169946 , p_adr_type_code => 'S'
169947 , p_component_type => l_component_type
169948 , p_component_code => l_component_code
169949 , p_component_type_code => l_component_type_code
169950 , p_component_appl_id => l_component_appl_id
169951 , p_amb_context_code => l_amb_context_code
169952 , p_entity_code => 'TRANSACTIONS'
169953 , p_event_class_code => 'UNIT_ADJUSTMENTS'
169954 , p_side => 'NA'
169955 );
169956
169957 END IF;
169958
169959 l_segment := AcctDerRule_169(
169960 p_application_id => p_application_id
169961 , p_ae_header_id => l_ae_header_id
169962 , p_source_5 => p_source_5
169963 , p_source_31 => p_source_31
169964 , x_transaction_coa_id => l_adr_transaction_coa_id
169965 , x_accounting_coa_id => l_adr_accounting_coa_id
169966 , x_flexfield_segment_code => l_adr_flexfield_segment_code
169967 , x_flex_value_set_id => l_adr_flex_value_set_id
169968 , x_value_type_code => l_adr_value_type_code
169969 , x_value_combination_id => l_adr_value_combination_id
169970 , x_value_segment_code => l_adr_value_segment_code
169971 , p_side => 'NA'
169972 , p_override_seg_flag => 'Y'
169973 );
169974
169975 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
169976
169977 xla_ae_lines_pkg.set_segment(
169978 p_to_segment_code => 'GL_BALANCING'
169979 , p_segment_value => l_segment
169980 , p_from_segment_code => l_adr_value_segment_code
169981 , p_from_combination_id => l_adr_value_combination_id
169982 , p_value_type_code => l_adr_value_type_code
169983 , p_transaction_coa_id => l_adr_transaction_coa_id
169984 , p_accounting_coa_id => l_adr_accounting_coa_id
169985 , p_flexfield_segment_code => l_adr_flexfield_segment_code
169986 , p_flex_value_set_id => l_adr_flex_value_set_id
169987 , p_adr_code => 'FA_EXPENSE_ACCT'
169988 , p_adr_type_code => 'S'
169989 , p_component_type => l_component_type
169990 , p_component_code => l_component_code
169991 , p_component_type_code => l_component_type_code
169992 , p_component_appl_id => l_component_appl_id
169993 , p_amb_context_code => l_amb_context_code
169994 , p_entity_code => 'TRANSACTIONS'
169995 , p_event_class_code => 'UNIT_ADJUSTMENTS'
169996 , p_side => 'NA'
169997 );
169998
169999 END IF;
170000
170001 --
170002 --
170003 END IF;
170004
170005 --
170006 -- Update the line information that should be overwritten
170007 --
170008 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
170009 p_header_num => 1);
170010 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
170011
170012 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
170013
170014 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
170015 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
170016 END IF;
170017
170018 --
170019 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
170020 --
170024 ---------------------------------------------------------------------------------------------------
170021 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
170022 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
170023 ELSE
170025 -- 4262811a Switch Sign
170026 ---------------------------------------------------------------------------------------------------
170027 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
170028 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
170029 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
170030 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
170031 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
170032 -- 5132302
170033 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
170034 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
170035
170036 END IF;
170037
170038 -- 4955764
170039 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
170040 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
170041
170042
170043 XLA_AE_LINES_PKG.ValidateCurrentLine;
170044 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
170045
170046 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
170047 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
170048 ,p_balance_type_code => l_balance_type_code);
170049
170050 END IF;
170051
170052 -----------------------------------------------------------------------------------------
170053 -- 4262811 Multiperiod Accounting
170054 -----------------------------------------------------------------------------------------
170055 -- No MPA option is assigned.
170056
170057
170058 END IF;
170059 END IF;
170060 --
170061
170062 --
170063 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
170064 trace
170065 (p_msg => 'END of AcctLineType_403'
170066 ,p_level => C_LEVEL_PROCEDURE
170067 ,p_module => l_log_module);
170068 END IF;
170069 --
170070 EXCEPTION
170071 WHEN xla_exceptions_pkg.application_exception THEN
170072 RAISE;
170073 WHEN OTHERS THEN
170074 xla_exceptions_pkg.raise_message
170075 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_403');
170076 END AcctLineType_403;
170077 --
170078
170079 ---------------------------------------
170080 --
170081 -- PRIVATE FUNCTION
170082 -- AcctLineType_404
170083 --
170084 ---------------------------------------
170085 PROCEDURE AcctLineType_404 (
170086 p_application_id IN NUMBER
170087 ,p_event_id IN NUMBER
170088 ,p_calculate_acctd_flag IN VARCHAR2
170089 ,p_calculate_g_l_flag IN VARCHAR2
170090 ,p_actual_flag IN OUT VARCHAR2
170091 ,p_balance_type_code OUT VARCHAR2
170092 ,p_gain_or_loss_ref OUT VARCHAR2
170093
170094 --Period Close Date
170095 , p_source_1 IN DATE
170096 --Generated Code Combination Identifier
170097 , p_source_5 IN NUMBER
170098 --Expense Account Code Combination Identifier
170099 , p_source_31 IN NUMBER
170100 --Adjustment Type
170101 , p_source_48 IN VARCHAR2
170102 --Transaction Header Identifier
170103 , p_source_49 IN NUMBER
170104 --Adjustment Line Identifier
170105 , p_source_50 IN NUMBER
170106 --Distribution Type Code
170107 , p_source_51 IN VARCHAR2
170108 --Entered Amount
170109 , p_source_52 IN NUMBER
170110 --Currency Code
170111 , p_source_53 IN VARCHAR2
170112 --Source Destination Code
170113 , p_source_55 IN VARCHAR2
170114 )
170115 IS
170116
170117 l_component_type VARCHAR2(80);
170118 l_component_code VARCHAR2(30);
170119 l_component_type_code VARCHAR2(1);
170120 l_component_appl_id INTEGER;
170121 l_amb_context_code VARCHAR2(30);
170122 l_entity_code VARCHAR2(30);
170123 l_event_class_code VARCHAR2(30);
170124 l_ae_header_id NUMBER;
170125 l_event_type_code VARCHAR2(30);
170126 l_line_definition_code VARCHAR2(30);
170127 l_line_definition_owner_code VARCHAR2(1);
170128 --
170129 -- adr variables
170130 l_segment VARCHAR2(30);
170131 l_ccid NUMBER;
170132 l_adr_transaction_coa_id NUMBER;
170133 l_adr_accounting_coa_id NUMBER;
170134 l_adr_flexfield_segment_code VARCHAR2(30);
170135 l_adr_flex_value_set_id NUMBER;
170136 l_adr_value_type_code VARCHAR2(30);
170137 l_adr_value_combination_id NUMBER;
170138 l_adr_value_segment_code VARCHAR2(30);
170139
170140 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
170141 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
170142 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
170143 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
170144
170148 l_acc_rev_flag VARCHAR2(1);
170145 -- 4262811 Variables ------------------------------------------------------------------------------------------
170146 l_entered_amt_idx NUMBER;
170147 l_accted_amt_idx NUMBER;
170149 l_accrual_line_num NUMBER;
170150 l_tmp_amt NUMBER;
170151 l_acc_rev_natural_side_code VARCHAR2(1);
170152
170153 l_num_entries NUMBER;
170154 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
170155 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
170156 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
170157 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
170158 l_recog_line_1 NUMBER;
170159 l_recog_line_2 NUMBER;
170160
170161 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
170162 l_bflow_applied_to_amt NUMBER; -- 5132302
170163 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
170164
170165 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
170166
170167 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
170168 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
170169
170170 ---------------------------------------------------------------------------------------------------------------
170171
170172
170173 --
170174 -- bulk performance
170175 --
170176 l_balance_type_code VARCHAR2(1);
170177 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
170178 l_log_module VARCHAR2(240);
170179
170180 --
170181 -- Upgrade strategy
170182 --
170183 l_actual_upg_option VARCHAR2(1);
170184 l_enc_upg_option VARCHAR2(1);
170185
170186 --
170187 BEGIN
170188 --
170189 IF g_log_enabled THEN
170190 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_404';
170191 END IF;
170192 --
170193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
170194
170195 trace
170196 (p_msg => 'BEGIN of AcctLineType_404'
170197 ,p_level => C_LEVEL_PROCEDURE
170198 ,p_module => l_log_module);
170199
170200 END IF;
170201 --
170202 l_component_type := 'AMB_JLT';
170203 l_component_code := 'FA_UNITADJ_DEST_EXP_BAL';
170204 l_component_type_code := 'S';
170205 l_component_appl_id := 140;
170206 l_amb_context_code := 'DEFAULT';
170207 l_entity_code := 'TRANSACTIONS';
170208 l_event_class_code := 'UNIT_ADJUSTMENTS';
170209 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
170210 l_line_definition_owner_code := 'S';
170211 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
170212 --
170213 l_balance_type_code := 'A';
170214 l_segment := NULL;
170215 l_ccid := NULL;
170216 l_adr_transaction_coa_id := NULL;
170217 l_adr_accounting_coa_id := NULL;
170218 l_adr_flexfield_segment_code := NULL;
170219 l_adr_flex_value_set_id := NULL;
170220 l_adr_value_type_code := NULL;
170221 l_adr_value_combination_id := NULL;
170222 l_adr_value_segment_code := NULL;
170223
170224 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
170225 l_bflow_class_code := ''; -- 4219869 Business Flow
170226 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
170227 l_budgetary_control_flag := 'N';
170228
170229 l_bflow_applied_to_amt_idx := NULL; -- 5132302
170230 l_bflow_applied_to_amt := NULL; -- 5132302
170231 l_entered_amt_idx := NULL; -- 4262811
170232 l_accted_amt_idx := NULL; -- 4262811
170233 l_acc_rev_flag := NULL; -- 4262811
170234 l_accrual_line_num := NULL; -- 4262811
170235 l_tmp_amt := NULL; -- 4262811
170236 --
170237
170238 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
170239 l_balance_type_code <> 'B' THEN
170240 IF NVL(p_source_48,'
170241 ') = 'BONUS EXPENSE' AND
170242 NVL(p_source_55,'
170243 ') = 'DEST'
170244 THEN
170245
170246 --
170247 XLA_AE_LINES_PKG.SetNewLine;
170248
170249 p_balance_type_code := l_balance_type_code;
170250 -- set the flag so later we will know whether the gain loss line needs to be created
170251
170252 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
170253 p_actual_flag :='A';
170254 END IF;
170255
170256 --
170257 -- bulk performance
170258 --
170259 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
170260 p_header_num => 0); -- 4262811
170261 --
170262 -- set accounting line options
170263 --
170264 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
170265 p_natural_side_code => 'C'
170266 , p_gain_or_loss_flag => 'N'
170267 , p_gl_transfer_mode_code => 'S'
170268 , p_acct_entry_type_code => 'A'
170269 , p_switch_side_flag => 'Y'
170270 , p_merge_duplicate_code => 'N'
170271 );
170272 --
170273 l_acc_rev_natural_side_code := 'D'; -- 4262811
170274 --
170275 --
170276 -- set accounting line type info
170277 --
170278 xla_ae_lines_pkg.SetAcctLineType
170282 ,p_line_definition_code => l_line_definition_code
170279 (p_component_type => l_component_type
170280 ,p_event_type_code => l_event_type_code
170281 ,p_line_definition_owner_code => l_line_definition_owner_code
170283 ,p_accounting_line_code => l_component_code
170284 ,p_accounting_line_type_code => l_component_type_code
170285 ,p_accounting_line_appl_id => l_component_appl_id
170286 ,p_amb_context_code => l_amb_context_code
170287 ,p_entity_code => l_entity_code
170288 ,p_event_class_code => l_event_class_code);
170289 --
170290 -- set accounting class
170291 --
170292 xla_ae_lines_pkg.SetAcctClass(
170293 p_accounting_class_code => 'EXPENSE'
170294 , p_ae_header_id => l_ae_header_id
170295 );
170296
170297 --
170298 -- set rounding class
170299 --
170300 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
170301 'EXPENSE';
170302
170303 --
170304 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
170305 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
170306 --
170307 -- bulk performance
170308 --
170309 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
170310
170311 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
170312 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
170313
170314 -- 4955764
170315 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
170316 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
170317
170318 -- 4458381 Public Sector Enh
170319
170320 --
170321 -- set accounting attributes for the line type
170322 --
170323 l_entered_amt_idx := 4;
170324 l_accted_amt_idx := 6;
170325 l_bflow_applied_to_amt_idx := NULL; -- 5132302
170326 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
170327 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
170328 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
170329 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
170330 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
170331 l_rec_acct_attrs.array_char_value(3) := p_source_51;
170332 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
170333 l_rec_acct_attrs.array_num_value(4) := p_source_52;
170334 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
170335 l_rec_acct_attrs.array_char_value(5) := p_source_53;
170336 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
170337 l_rec_acct_attrs.array_num_value(6) := p_source_52;
170338
170339 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
170340 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
170341
170342 ---------------------------------------------------------------------------------------------------------------
170343 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
170344 ---------------------------------------------------------------------------------------------------------------
170345 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
170346
170347 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
170348 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
170349
170350 IF xla_accounting_cache_pkg.GetValueChar
170351 (p_source_code => 'LEDGER_CATEGORY_CODE'
170352 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
170353 AND l_bflow_method_code = 'PRIOR_ENTRY'
170354 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
170355 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
170356 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
170357 )
170358 THEN
170359 xla_ae_lines_pkg.BflowUpgEntry
170360 (p_business_method_code => l_bflow_method_code
170361 ,p_business_class_code => l_bflow_class_code
170362 ,p_balance_type => l_balance_type_code);
170363 ELSE
170364 NULL;
170365 -- No business flow processing for business flow method of NONE.
170366 END IF;
170367
170368 --
170369 -- call analytical criteria
170370 --
170371
170372 --
170373 -- call description
170374 --
170375
170376 xla_ae_lines_pkg.SetLineDescription(
170377 p_ae_header_id => l_ae_header_id
170378 ,p_description => Description_134 (
170379 p_application_id => p_application_id
170380 , p_ae_header_id => l_ae_header_id
170381 , p_source_1 => p_source_1
170382 )
170383 );
170384
170385
170386 --
170387 -- call ADRs
170388 -- Bug 4922099
170389 --
170390 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
170391 (NVL(l_actual_upg_option, 'N') = 'O') OR
170392 (NVL(l_enc_upg_option, 'N') = 'O')
170393 )
170394 THEN
170395 NULL;
170396 --
170397 --
170398
170399 l_ccid := AcctDerRule_176(
170403 , p_source_31 => p_source_31
170400 p_application_id => p_application_id
170401 , p_ae_header_id => l_ae_header_id
170402 , p_source_5 => p_source_5
170404 , x_transaction_coa_id => l_adr_transaction_coa_id
170405 , x_accounting_coa_id => l_adr_accounting_coa_id
170406 , x_value_type_code => l_adr_value_type_code
170407 , p_side => 'NA'
170408 );
170409
170410 xla_ae_lines_pkg.set_ccid(
170411 p_code_combination_id => l_ccid
170412 , p_value_type_code => l_adr_value_type_code
170413 , p_transaction_coa_id => l_adr_transaction_coa_id
170414 , p_accounting_coa_id => l_adr_accounting_coa_id
170415 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
170416 , p_adr_type_code => 'S'
170417 , p_component_type => l_component_type
170418 , p_component_code => l_component_code
170419 , p_component_type_code => l_component_type_code
170420 , p_component_appl_id => l_component_appl_id
170421 , p_amb_context_code => l_amb_context_code
170422 , p_side => 'NA'
170423 );
170424
170425
170426 --
170427 --
170428 END IF;
170429 --
170430 -- Bug 4922099
170431 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
170432 (NVL(l_enc_upg_option, 'N') = 'O')
170433 ) AND
170434 (l_bflow_method_code = 'PRIOR_ENTRY')
170435 )
170436 THEN
170437 IF
170438 --
170439 1 = 2
170440 --
170441 THEN
170442 xla_accounting_err_pkg.build_message
170443 (p_appli_s_name => 'XLA'
170444 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
170445 ,p_token_1 => 'LINE_NUMBER'
170446 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
170447 ,p_token_2 => 'LINE_TYPE_NAME'
170448 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
170449 l_component_type
170450 ,l_component_code
170451 ,l_component_type_code
170452 ,l_component_appl_id
170453 ,l_amb_context_code
170454 ,l_entity_code
170455 ,l_event_class_code
170456 )
170457 ,p_token_3 => 'OWNER'
170458 ,p_value_3 => xla_lookups_pkg.get_meaning(
170459 p_lookup_type => 'XLA_OWNER_TYPE'
170460 ,p_lookup_code => l_component_type_code
170461 )
170462 ,p_token_4 => 'PRODUCT_NAME'
170463 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
170464 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
170465 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
170466 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
170467 ,p_ae_header_id => NULL
170468 );
170469
170470 IF (C_LEVEL_ERROR>= g_log_level) THEN
170471 trace
170472 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
170473 ,p_level => C_LEVEL_ERROR
170474 ,p_module => l_log_module);
170475 END IF;
170476 END IF;
170477 END IF;
170478 --
170479 --
170480 ------------------------------------------------------------------------------------------------
170481 -- 4219869 Business Flow
170482 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
170483 -- Prior Entry. Currently, the following code is always generated.
170484 ------------------------------------------------------------------------------------------------
170485 XLA_AE_LINES_PKG.ValidateCurrentLine;
170486
170487 ------------------------------------------------------------------------------------
170488 -- 4219869 Business Flow
170489 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
170490 ------------------------------------------------------------------------------------
170491 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
170492
170493 ----------------------------------------------------------------------------------
170494 -- 4219869 Business Flow
170495 -- Update journal entry status -- Need to generate this within IF <condition>
170496 ----------------------------------------------------------------------------------
170500 );
170497 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
170498 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
170499 ,p_balance_type_code => l_balance_type_code
170501
170502 -------------------------------------------------------------------------------------------
170503 -- 4262811 - Generate the Accrual Reversal lines
170504 -------------------------------------------------------------------------------------------
170505 BEGIN
170506 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
170507 (g_array_event(p_event_id).array_value_num('header_index'));
170508 IF l_acc_rev_flag IS NULL THEN
170509 l_acc_rev_flag := 'N';
170510 END IF;
170511 EXCEPTION
170512 WHEN OTHERS THEN
170513 l_acc_rev_flag := 'N';
170514 END;
170515 --
170516 IF (l_acc_rev_flag = 'Y') THEN
170517
170518 -- 4645092 ------------------------------------------------------------------------------
170519 -- To allow MPA report to determine if it should generate report process
170520 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
170521 ------------------------------------------------------------------------------------------
170522
170523 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
170524 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
170525 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
170526 -- call ADRs
170527 -- Bug 4922099
170528 --
170529 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
170530 (NVL(l_actual_upg_option, 'N') = 'O') OR
170531 (NVL(l_enc_upg_option, 'N') = 'O')
170532 )
170533 THEN
170534 NULL;
170535 --
170536 --
170537
170538 l_ccid := AcctDerRule_176(
170539 p_application_id => p_application_id
170540 , p_ae_header_id => l_ae_header_id
170541 , p_source_5 => p_source_5
170542 , p_source_31 => p_source_31
170543 , x_transaction_coa_id => l_adr_transaction_coa_id
170544 , x_accounting_coa_id => l_adr_accounting_coa_id
170545 , x_value_type_code => l_adr_value_type_code
170546 , p_side => 'NA'
170547 );
170548
170549 xla_ae_lines_pkg.set_ccid(
170550 p_code_combination_id => l_ccid
170551 , p_value_type_code => l_adr_value_type_code
170552 , p_transaction_coa_id => l_adr_transaction_coa_id
170553 , p_accounting_coa_id => l_adr_accounting_coa_id
170554 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
170555 , p_adr_type_code => 'S'
170556 , p_component_type => l_component_type
170557 , p_component_code => l_component_code
170558 , p_component_type_code => l_component_type_code
170559 , p_component_appl_id => l_component_appl_id
170560 , p_amb_context_code => l_amb_context_code
170561 , p_side => 'NA'
170562 );
170563
170564
170565 --
170566 --
170567 END IF;
170568
170569 --
170570 -- Update the line information that should be overwritten
170571 --
170572 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
170573 p_header_num => 1);
170574 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
170575
170576 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
170577
170578 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
170579 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
170580 END IF;
170581
170582 --
170583 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
170584 --
170585 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
170586 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
170587 ELSE
170588 ---------------------------------------------------------------------------------------------------
170589 -- 4262811a Switch Sign
170590 ---------------------------------------------------------------------------------------------------
170591 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
170592 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
170593 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
170594 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
170595 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
170596 -- 5132302
170597 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
170598 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
170599
170600 END IF;
170601
170602 -- 4955764
170603 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
170604 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
170608 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
170605
170606
170607 XLA_AE_LINES_PKG.ValidateCurrentLine;
170609
170610 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
170611 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
170612 ,p_balance_type_code => l_balance_type_code);
170613
170614 END IF;
170615
170616 -----------------------------------------------------------------------------------------
170617 -- 4262811 Multiperiod Accounting
170618 -----------------------------------------------------------------------------------------
170619 -- No MPA option is assigned.
170620
170621
170622 END IF;
170623 END IF;
170624 --
170625
170626 --
170627 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
170628 trace
170629 (p_msg => 'END of AcctLineType_404'
170630 ,p_level => C_LEVEL_PROCEDURE
170631 ,p_module => l_log_module);
170632 END IF;
170633 --
170634 EXCEPTION
170635 WHEN xla_exceptions_pkg.application_exception THEN
170636 RAISE;
170637 WHEN OTHERS THEN
170638 xla_exceptions_pkg.raise_message
170639 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_404');
170640 END AcctLineType_404;
170641 --
170642
170643 ---------------------------------------
170644 --
170645 -- PRIVATE FUNCTION
170646 -- AcctLineType_405
170647 --
170648 ---------------------------------------
170649 PROCEDURE AcctLineType_405 (
170650 p_application_id IN NUMBER
170651 ,p_event_id IN NUMBER
170652 ,p_calculate_acctd_flag IN VARCHAR2
170653 ,p_calculate_g_l_flag IN VARCHAR2
170654 ,p_actual_flag IN OUT VARCHAR2
170655 ,p_balance_type_code OUT VARCHAR2
170656 ,p_gain_or_loss_ref OUT VARCHAR2
170657
170658 --Period Close Date
170659 , p_source_1 IN DATE
170660 --Generated Code Combination Identifier
170661 , p_source_5 IN NUMBER
170662 --Depreciation Reserve Account
170663 , p_source_12 IN VARCHAR2
170664 --Generated Offset Code Combination Identifier
170665 , p_source_19 IN NUMBER
170666 --Expense Account Code Combination Identifier
170667 , p_source_31 IN NUMBER
170668 --Default Code Combination Identifier
170669 , p_source_32 IN NUMBER
170670 --Adjustment Type
170671 , p_source_48 IN VARCHAR2
170672 --Transaction Header Identifier
170673 , p_source_49 IN NUMBER
170674 --Adjustment Line Identifier
170675 , p_source_50 IN NUMBER
170676 --Distribution Type Code
170677 , p_source_51 IN VARCHAR2
170678 --Entered Amount
170679 , p_source_52 IN NUMBER
170680 --Currency Code
170681 , p_source_53 IN VARCHAR2
170682 --Source Destination Code
170683 , p_source_55 IN VARCHAR2
170684 )
170685 IS
170686
170687 l_component_type VARCHAR2(80);
170688 l_component_code VARCHAR2(30);
170689 l_component_type_code VARCHAR2(1);
170690 l_component_appl_id INTEGER;
170691 l_amb_context_code VARCHAR2(30);
170692 l_entity_code VARCHAR2(30);
170693 l_event_class_code VARCHAR2(30);
170694 l_ae_header_id NUMBER;
170695 l_event_type_code VARCHAR2(30);
170696 l_line_definition_code VARCHAR2(30);
170697 l_line_definition_owner_code VARCHAR2(1);
170698 --
170699 -- adr variables
170700 l_segment VARCHAR2(30);
170701 l_ccid NUMBER;
170702 l_adr_transaction_coa_id NUMBER;
170703 l_adr_accounting_coa_id NUMBER;
170704 l_adr_flexfield_segment_code VARCHAR2(30);
170705 l_adr_flex_value_set_id NUMBER;
170706 l_adr_value_type_code VARCHAR2(30);
170707 l_adr_value_combination_id NUMBER;
170708 l_adr_value_segment_code VARCHAR2(30);
170709
170710 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
170711 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
170712 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
170713 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
170714
170715 -- 4262811 Variables ------------------------------------------------------------------------------------------
170716 l_entered_amt_idx NUMBER;
170717 l_accted_amt_idx NUMBER;
170718 l_acc_rev_flag VARCHAR2(1);
170719 l_accrual_line_num NUMBER;
170720 l_tmp_amt NUMBER;
170721 l_acc_rev_natural_side_code VARCHAR2(1);
170722
170723 l_num_entries NUMBER;
170724 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
170725 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
170726 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
170727 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
170728 l_recog_line_1 NUMBER;
170729 l_recog_line_2 NUMBER;
170730
170731 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
170732 l_bflow_applied_to_amt NUMBER; -- 5132302
170733 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
170734
170735 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
170736
170740 ---------------------------------------------------------------------------------------------------------------
170737 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
170738 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
170739
170741
170742
170743 --
170744 -- bulk performance
170745 --
170746 l_balance_type_code VARCHAR2(1);
170747 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
170748 l_log_module VARCHAR2(240);
170749
170750 --
170751 -- Upgrade strategy
170752 --
170753 l_actual_upg_option VARCHAR2(1);
170754 l_enc_upg_option VARCHAR2(1);
170755
170756 --
170757 BEGIN
170758 --
170759 IF g_log_enabled THEN
170760 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_405';
170761 END IF;
170762 --
170763 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
170764
170765 trace
170766 (p_msg => 'BEGIN of AcctLineType_405'
170767 ,p_level => C_LEVEL_PROCEDURE
170768 ,p_module => l_log_module);
170769
170770 END IF;
170771 --
170772 l_component_type := 'AMB_JLT';
170773 l_component_code := 'FA_UNITADJ_DEST_RESERVE_BAL';
170774 l_component_type_code := 'S';
170775 l_component_appl_id := 140;
170776 l_amb_context_code := 'DEFAULT';
170777 l_entity_code := 'TRANSACTIONS';
170778 l_event_class_code := 'UNIT_ADJUSTMENTS';
170779 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
170780 l_line_definition_owner_code := 'S';
170781 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
170782 --
170783 l_balance_type_code := 'A';
170784 l_segment := NULL;
170785 l_ccid := NULL;
170786 l_adr_transaction_coa_id := NULL;
170787 l_adr_accounting_coa_id := NULL;
170788 l_adr_flexfield_segment_code := NULL;
170789 l_adr_flex_value_set_id := NULL;
170790 l_adr_value_type_code := NULL;
170791 l_adr_value_combination_id := NULL;
170792 l_adr_value_segment_code := NULL;
170793
170794 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
170795 l_bflow_class_code := ''; -- 4219869 Business Flow
170796 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
170797 l_budgetary_control_flag := 'N';
170798
170799 l_bflow_applied_to_amt_idx := NULL; -- 5132302
170800 l_bflow_applied_to_amt := NULL; -- 5132302
170801 l_entered_amt_idx := NULL; -- 4262811
170802 l_accted_amt_idx := NULL; -- 4262811
170803 l_acc_rev_flag := NULL; -- 4262811
170804 l_accrual_line_num := NULL; -- 4262811
170805 l_tmp_amt := NULL; -- 4262811
170806 --
170807
170808 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
170809 l_balance_type_code <> 'B' THEN
170810 IF (NVL(p_source_48,'
170811 ') = 'BONUS EXPENSE' OR
170812 NVL(p_source_48,'
170813 ') = 'BONUS RESERVE') AND
170814 NVL(p_source_55,'
170815 ') = 'DEST'
170816 THEN
170817
170818 --
170819 XLA_AE_LINES_PKG.SetNewLine;
170820
170821 p_balance_type_code := l_balance_type_code;
170822 -- set the flag so later we will know whether the gain loss line needs to be created
170823
170824 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
170825 p_actual_flag :='A';
170826 END IF;
170827
170828 --
170829 -- bulk performance
170830 --
170831 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
170832 p_header_num => 0); -- 4262811
170833 --
170834 -- set accounting line options
170835 --
170836 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
170837 p_natural_side_code => 'D'
170838 , p_gain_or_loss_flag => 'N'
170839 , p_gl_transfer_mode_code => 'S'
170840 , p_acct_entry_type_code => 'A'
170841 , p_switch_side_flag => 'Y'
170842 , p_merge_duplicate_code => 'N'
170843 );
170844 --
170845 l_acc_rev_natural_side_code := 'C'; -- 4262811
170846 --
170847 --
170848 -- set accounting line type info
170849 --
170850 xla_ae_lines_pkg.SetAcctLineType
170851 (p_component_type => l_component_type
170852 ,p_event_type_code => l_event_type_code
170853 ,p_line_definition_owner_code => l_line_definition_owner_code
170854 ,p_line_definition_code => l_line_definition_code
170855 ,p_accounting_line_code => l_component_code
170856 ,p_accounting_line_type_code => l_component_type_code
170857 ,p_accounting_line_appl_id => l_component_appl_id
170858 ,p_amb_context_code => l_amb_context_code
170859 ,p_entity_code => l_entity_code
170860 ,p_event_class_code => l_event_class_code);
170861 --
170862 -- set accounting class
170863 --
170864 xla_ae_lines_pkg.SetAcctClass(
170865 p_accounting_class_code => 'ASSET'
170866 , p_ae_header_id => l_ae_header_id
170867 );
170868
170869 --
170870 -- set rounding class
170871 --
170872 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
170873 'ASSET';
170874
170875 --
170879 -- bulk performance
170876 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
170877 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
170878 --
170880 --
170881 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
170882
170883 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
170884 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
170885
170886 -- 4955764
170887 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
170888 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
170889
170890 -- 4458381 Public Sector Enh
170891
170892 --
170893 -- set accounting attributes for the line type
170894 --
170895 l_entered_amt_idx := 4;
170896 l_accted_amt_idx := 6;
170897 l_bflow_applied_to_amt_idx := NULL; -- 5132302
170898 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
170899 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
170900 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
170901 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
170902 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
170903 l_rec_acct_attrs.array_char_value(3) := p_source_51;
170904 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
170905 l_rec_acct_attrs.array_num_value(4) := p_source_52;
170906 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
170907 l_rec_acct_attrs.array_char_value(5) := p_source_53;
170908 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
170909 l_rec_acct_attrs.array_num_value(6) := p_source_52;
170910
170911 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
170912 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
170913
170914 ---------------------------------------------------------------------------------------------------------------
170915 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
170916 ---------------------------------------------------------------------------------------------------------------
170917 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
170918
170919 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
170920 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
170921
170922 IF xla_accounting_cache_pkg.GetValueChar
170923 (p_source_code => 'LEDGER_CATEGORY_CODE'
170924 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
170925 AND l_bflow_method_code = 'PRIOR_ENTRY'
170926 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
170927 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
170928 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
170929 )
170930 THEN
170931 xla_ae_lines_pkg.BflowUpgEntry
170932 (p_business_method_code => l_bflow_method_code
170933 ,p_business_class_code => l_bflow_class_code
170934 ,p_balance_type => l_balance_type_code);
170935 ELSE
170936 NULL;
170937 -- No business flow processing for business flow method of NONE.
170938 END IF;
170939
170940 --
170941 -- call analytical criteria
170942 --
170943
170944 --
170945 -- call description
170946 --
170947
170948 xla_ae_lines_pkg.SetLineDescription(
170949 p_ae_header_id => l_ae_header_id
170950 ,p_description => Description_137 (
170951 p_application_id => p_application_id
170952 , p_ae_header_id => l_ae_header_id
170953 , p_source_1 => p_source_1
170954 )
170955 );
170956
170957
170958 --
170959 -- call ADRs
170960 -- Bug 4922099
170961 --
170962 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
170963 (NVL(l_actual_upg_option, 'N') = 'O') OR
170964 (NVL(l_enc_upg_option, 'N') = 'O')
170965 )
170966 THEN
170967 NULL;
170968 --
170969 --
170970
170971 l_ccid := AcctDerRule_175(
170972 p_application_id => p_application_id
170973 , p_ae_header_id => l_ae_header_id
170974 , p_source_5 => p_source_5
170975 , p_source_19 => p_source_19
170976 , p_source_32 => p_source_32
170977 , x_transaction_coa_id => l_adr_transaction_coa_id
170978 , x_accounting_coa_id => l_adr_accounting_coa_id
170979 , x_value_type_code => l_adr_value_type_code
170980 , p_side => 'NA'
170981 );
170982
170983 xla_ae_lines_pkg.set_ccid(
170984 p_code_combination_id => l_ccid
170985 , p_value_type_code => l_adr_value_type_code
170986 , p_transaction_coa_id => l_adr_transaction_coa_id
170987 , p_accounting_coa_id => l_adr_accounting_coa_id
170988 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
170989 , p_adr_type_code => 'S'
170990 , p_component_type => l_component_type
170991 , p_component_code => l_component_code
170992 , p_component_type_code => l_component_type_code
170996 );
170993 , p_component_appl_id => l_component_appl_id
170994 , p_amb_context_code => l_amb_context_code
170995 , p_side => 'NA'
170997
170998
170999 l_segment := AcctDerRule_150(
171000 p_application_id => p_application_id
171001 , p_ae_header_id => l_ae_header_id
171002 , p_source_5 => p_source_5
171003 , p_source_12 => p_source_12
171004 , x_transaction_coa_id => l_adr_transaction_coa_id
171005 , x_accounting_coa_id => l_adr_accounting_coa_id
171006 , x_flexfield_segment_code => l_adr_flexfield_segment_code
171007 , x_flex_value_set_id => l_adr_flex_value_set_id
171008 , x_value_type_code => l_adr_value_type_code
171009 , x_value_combination_id => l_adr_value_combination_id
171010 , x_value_segment_code => l_adr_value_segment_code
171011 , p_side => 'NA'
171012 , p_override_seg_flag => 'Y'
171013 );
171014
171015 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
171016
171017 xla_ae_lines_pkg.set_segment(
171018 p_to_segment_code => 'GL_ACCOUNT'
171019 , p_segment_value => l_segment
171020 , p_from_segment_code => l_adr_value_segment_code
171021 , p_from_combination_id => l_adr_value_combination_id
171022 , p_value_type_code => l_adr_value_type_code
171023 , p_transaction_coa_id => l_adr_transaction_coa_id
171024 , p_accounting_coa_id => l_adr_accounting_coa_id
171025 , p_flexfield_segment_code => l_adr_flexfield_segment_code
171026 , p_flex_value_set_id => l_adr_flex_value_set_id
171027 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
171028 , p_adr_type_code => 'S'
171029 , p_component_type => l_component_type
171030 , p_component_code => l_component_code
171031 , p_component_type_code => l_component_type_code
171032 , p_component_appl_id => l_component_appl_id
171033 , p_amb_context_code => l_amb_context_code
171034 , p_entity_code => 'TRANSACTIONS'
171035 , p_event_class_code => 'UNIT_ADJUSTMENTS'
171036 , p_side => 'NA'
171037 );
171038
171039 END IF;
171040
171041 l_segment := AcctDerRule_169(
171042 p_application_id => p_application_id
171043 , p_ae_header_id => l_ae_header_id
171044 , p_source_5 => p_source_5
171045 , p_source_31 => p_source_31
171046 , x_transaction_coa_id => l_adr_transaction_coa_id
171047 , x_accounting_coa_id => l_adr_accounting_coa_id
171048 , x_flexfield_segment_code => l_adr_flexfield_segment_code
171049 , x_flex_value_set_id => l_adr_flex_value_set_id
171050 , x_value_type_code => l_adr_value_type_code
171051 , x_value_combination_id => l_adr_value_combination_id
171052 , x_value_segment_code => l_adr_value_segment_code
171053 , p_side => 'NA'
171054 , p_override_seg_flag => 'Y'
171055 );
171056
171057 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
171058
171059 xla_ae_lines_pkg.set_segment(
171060 p_to_segment_code => 'GL_BALANCING'
171061 , p_segment_value => l_segment
171062 , p_from_segment_code => l_adr_value_segment_code
171063 , p_from_combination_id => l_adr_value_combination_id
171064 , p_value_type_code => l_adr_value_type_code
171065 , p_transaction_coa_id => l_adr_transaction_coa_id
171066 , p_accounting_coa_id => l_adr_accounting_coa_id
171067 , p_flexfield_segment_code => l_adr_flexfield_segment_code
171068 , p_flex_value_set_id => l_adr_flex_value_set_id
171069 , p_adr_code => 'FA_EXPENSE_ACCT'
171070 , p_adr_type_code => 'S'
171071 , p_component_type => l_component_type
171072 , p_component_code => l_component_code
171073 , p_component_type_code => l_component_type_code
171074 , p_component_appl_id => l_component_appl_id
171075 , p_amb_context_code => l_amb_context_code
171076 , p_entity_code => 'TRANSACTIONS'
171077 , p_event_class_code => 'UNIT_ADJUSTMENTS'
171078 , p_side => 'NA'
171079 );
171080
171081 END IF;
171082
171083 --
171084 --
171085 END IF;
171086 --
171087 -- Bug 4922099
171088 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
171089 (NVL(l_enc_upg_option, 'N') = 'O')
171090 ) AND
171091 (l_bflow_method_code = 'PRIOR_ENTRY')
171092 )
171093 THEN
171094 IF
171095 --
171096 1 = 2
171097 --
171098 THEN
171099 xla_accounting_err_pkg.build_message
171100 (p_appli_s_name => 'XLA'
171101 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
171102 ,p_token_1 => 'LINE_NUMBER'
171103 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
171104 ,p_token_2 => 'LINE_TYPE_NAME'
171108 ,l_component_type_code
171105 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
171106 l_component_type
171107 ,l_component_code
171109 ,l_component_appl_id
171110 ,l_amb_context_code
171111 ,l_entity_code
171112 ,l_event_class_code
171113 )
171114 ,p_token_3 => 'OWNER'
171115 ,p_value_3 => xla_lookups_pkg.get_meaning(
171116 p_lookup_type => 'XLA_OWNER_TYPE'
171117 ,p_lookup_code => l_component_type_code
171118 )
171119 ,p_token_4 => 'PRODUCT_NAME'
171120 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
171121 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
171122 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
171123 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
171124 ,p_ae_header_id => NULL
171125 );
171126
171127 IF (C_LEVEL_ERROR>= g_log_level) THEN
171128 trace
171129 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
171130 ,p_level => C_LEVEL_ERROR
171131 ,p_module => l_log_module);
171132 END IF;
171133 END IF;
171134 END IF;
171135 --
171136 --
171137 ------------------------------------------------------------------------------------------------
171138 -- 4219869 Business Flow
171139 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
171140 -- Prior Entry. Currently, the following code is always generated.
171141 ------------------------------------------------------------------------------------------------
171142 XLA_AE_LINES_PKG.ValidateCurrentLine;
171143
171144 ------------------------------------------------------------------------------------
171145 -- 4219869 Business Flow
171146 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
171147 ------------------------------------------------------------------------------------
171148 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
171149
171150 ----------------------------------------------------------------------------------
171151 -- 4219869 Business Flow
171152 -- Update journal entry status -- Need to generate this within IF <condition>
171153 ----------------------------------------------------------------------------------
171154 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
171155 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
171156 ,p_balance_type_code => l_balance_type_code
171157 );
171158
171159 -------------------------------------------------------------------------------------------
171160 -- 4262811 - Generate the Accrual Reversal lines
171161 -------------------------------------------------------------------------------------------
171162 BEGIN
171163 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
171164 (g_array_event(p_event_id).array_value_num('header_index'));
171165 IF l_acc_rev_flag IS NULL THEN
171166 l_acc_rev_flag := 'N';
171167 END IF;
171168 EXCEPTION
171169 WHEN OTHERS THEN
171170 l_acc_rev_flag := 'N';
171171 END;
171172 --
171173 IF (l_acc_rev_flag = 'Y') THEN
171174
171175 -- 4645092 ------------------------------------------------------------------------------
171176 -- To allow MPA report to determine if it should generate report process
171177 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
171178 ------------------------------------------------------------------------------------------
171179
171180 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
171181 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
171182 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
171183 -- call ADRs
171184 -- Bug 4922099
171185 --
171186 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
171187 (NVL(l_actual_upg_option, 'N') = 'O') OR
171188 (NVL(l_enc_upg_option, 'N') = 'O')
171189 )
171190 THEN
171191 NULL;
171192 --
171193 --
171194
171195 l_ccid := AcctDerRule_175(
171196 p_application_id => p_application_id
171197 , p_ae_header_id => l_ae_header_id
171198 , p_source_5 => p_source_5
171199 , p_source_19 => p_source_19
171200 , p_source_32 => p_source_32
171204 , p_side => 'NA'
171201 , x_transaction_coa_id => l_adr_transaction_coa_id
171202 , x_accounting_coa_id => l_adr_accounting_coa_id
171203 , x_value_type_code => l_adr_value_type_code
171205 );
171206
171207 xla_ae_lines_pkg.set_ccid(
171208 p_code_combination_id => l_ccid
171209 , p_value_type_code => l_adr_value_type_code
171210 , p_transaction_coa_id => l_adr_transaction_coa_id
171211 , p_accounting_coa_id => l_adr_accounting_coa_id
171212 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
171213 , p_adr_type_code => 'S'
171214 , p_component_type => l_component_type
171215 , p_component_code => l_component_code
171216 , p_component_type_code => l_component_type_code
171217 , p_component_appl_id => l_component_appl_id
171218 , p_amb_context_code => l_amb_context_code
171219 , p_side => 'NA'
171220 );
171221
171222
171223 l_segment := AcctDerRule_150(
171224 p_application_id => p_application_id
171225 , p_ae_header_id => l_ae_header_id
171226 , p_source_5 => p_source_5
171227 , p_source_12 => p_source_12
171228 , x_transaction_coa_id => l_adr_transaction_coa_id
171229 , x_accounting_coa_id => l_adr_accounting_coa_id
171230 , x_flexfield_segment_code => l_adr_flexfield_segment_code
171231 , x_flex_value_set_id => l_adr_flex_value_set_id
171232 , x_value_type_code => l_adr_value_type_code
171233 , x_value_combination_id => l_adr_value_combination_id
171234 , x_value_segment_code => l_adr_value_segment_code
171235 , p_side => 'NA'
171236 , p_override_seg_flag => 'Y'
171237 );
171238
171239 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
171240
171241 xla_ae_lines_pkg.set_segment(
171242 p_to_segment_code => 'GL_ACCOUNT'
171243 , p_segment_value => l_segment
171244 , p_from_segment_code => l_adr_value_segment_code
171245 , p_from_combination_id => l_adr_value_combination_id
171246 , p_value_type_code => l_adr_value_type_code
171247 , p_transaction_coa_id => l_adr_transaction_coa_id
171248 , p_accounting_coa_id => l_adr_accounting_coa_id
171249 , p_flexfield_segment_code => l_adr_flexfield_segment_code
171250 , p_flex_value_set_id => l_adr_flex_value_set_id
171251 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
171252 , p_adr_type_code => 'S'
171253 , p_component_type => l_component_type
171254 , p_component_code => l_component_code
171255 , p_component_type_code => l_component_type_code
171256 , p_component_appl_id => l_component_appl_id
171257 , p_amb_context_code => l_amb_context_code
171258 , p_entity_code => 'TRANSACTIONS'
171259 , p_event_class_code => 'UNIT_ADJUSTMENTS'
171260 , p_side => 'NA'
171261 );
171262
171263 END IF;
171264
171265 l_segment := AcctDerRule_169(
171266 p_application_id => p_application_id
171267 , p_ae_header_id => l_ae_header_id
171268 , p_source_5 => p_source_5
171269 , p_source_31 => p_source_31
171270 , x_transaction_coa_id => l_adr_transaction_coa_id
171271 , x_accounting_coa_id => l_adr_accounting_coa_id
171272 , x_flexfield_segment_code => l_adr_flexfield_segment_code
171273 , x_flex_value_set_id => l_adr_flex_value_set_id
171274 , x_value_type_code => l_adr_value_type_code
171275 , x_value_combination_id => l_adr_value_combination_id
171276 , x_value_segment_code => l_adr_value_segment_code
171277 , p_side => 'NA'
171278 , p_override_seg_flag => 'Y'
171279 );
171280
171281 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
171282
171283 xla_ae_lines_pkg.set_segment(
171284 p_to_segment_code => 'GL_BALANCING'
171285 , p_segment_value => l_segment
171286 , p_from_segment_code => l_adr_value_segment_code
171287 , p_from_combination_id => l_adr_value_combination_id
171288 , p_value_type_code => l_adr_value_type_code
171289 , p_transaction_coa_id => l_adr_transaction_coa_id
171290 , p_accounting_coa_id => l_adr_accounting_coa_id
171291 , p_flexfield_segment_code => l_adr_flexfield_segment_code
171292 , p_flex_value_set_id => l_adr_flex_value_set_id
171293 , p_adr_code => 'FA_EXPENSE_ACCT'
171294 , p_adr_type_code => 'S'
171295 , p_component_type => l_component_type
171296 , p_component_code => l_component_code
171297 , p_component_type_code => l_component_type_code
171298 , p_component_appl_id => l_component_appl_id
171299 , p_amb_context_code => l_amb_context_code
171300 , p_entity_code => 'TRANSACTIONS'
171301 , p_event_class_code => 'UNIT_ADJUSTMENTS'
171302 , p_side => 'NA'
171303 );
171304
171305 END IF;
171306
171307 --
171308 --
171309 END IF;
171310
171311 --
171315 p_header_num => 1);
171312 -- Update the line information that should be overwritten
171313 --
171314 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
171316 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
171317
171318 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
171319
171320 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
171321 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
171322 END IF;
171323
171324 --
171325 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
171326 --
171327 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
171328 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
171329 ELSE
171330 ---------------------------------------------------------------------------------------------------
171331 -- 4262811a Switch Sign
171332 ---------------------------------------------------------------------------------------------------
171333 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
171334 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
171335 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
171336 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
171337 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
171338 -- 5132302
171339 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
171340 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
171341
171342 END IF;
171343
171344 -- 4955764
171345 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
171346 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
171347
171348
171349 XLA_AE_LINES_PKG.ValidateCurrentLine;
171350 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
171351
171352 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
171353 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
171354 ,p_balance_type_code => l_balance_type_code);
171355
171356 END IF;
171357
171358 -----------------------------------------------------------------------------------------
171359 -- 4262811 Multiperiod Accounting
171360 -----------------------------------------------------------------------------------------
171361 -- No MPA option is assigned.
171362
171363
171364 END IF;
171365 END IF;
171366 --
171367
171368 --
171369 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
171370 trace
171371 (p_msg => 'END of AcctLineType_405'
171372 ,p_level => C_LEVEL_PROCEDURE
171373 ,p_module => l_log_module);
171374 END IF;
171375 --
171376 EXCEPTION
171377 WHEN xla_exceptions_pkg.application_exception THEN
171378 RAISE;
171379 WHEN OTHERS THEN
171380 xla_exceptions_pkg.raise_message
171381 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_405');
171382 END AcctLineType_405;
171383 --
171384
171385 ---------------------------------------
171386 --
171387 -- PRIVATE FUNCTION
171388 -- AcctLineType_406
171389 --
171390 ---------------------------------------
171391 PROCEDURE AcctLineType_406 (
171392 p_application_id IN NUMBER
171393 ,p_event_id IN NUMBER
171394 ,p_calculate_acctd_flag IN VARCHAR2
171395 ,p_calculate_g_l_flag IN VARCHAR2
171396 ,p_actual_flag IN OUT VARCHAR2
171397 ,p_balance_type_code OUT VARCHAR2
171398 ,p_gain_or_loss_ref OUT VARCHAR2
171399
171400 --Period Close Date
171401 , p_source_1 IN DATE
171402 --Generated Code Combination Identifier
171403 , p_source_5 IN NUMBER
171404 --Revaluation Reserve Account
171405 , p_source_13 IN VARCHAR2
171406 --Generated Offset Code Combination Identifier
171407 , p_source_19 IN NUMBER
171408 --Expense Account Code Combination Identifier
171409 , p_source_31 IN NUMBER
171410 --Default Code Combination Identifier
171411 , p_source_32 IN NUMBER
171412 --Adjustment Type
171413 , p_source_48 IN VARCHAR2
171414 --Transaction Header Identifier
171415 , p_source_49 IN NUMBER
171416 --Adjustment Line Identifier
171417 , p_source_50 IN NUMBER
171418 --Distribution Type Code
171419 , p_source_51 IN VARCHAR2
171420 --Entered Amount
171421 , p_source_52 IN NUMBER
171422 --Currency Code
171423 , p_source_53 IN VARCHAR2
171424 --Source Destination Code
171425 , p_source_55 IN VARCHAR2
171426 )
171427 IS
171428
171429 l_component_type VARCHAR2(80);
171430 l_component_code VARCHAR2(30);
171431 l_component_type_code VARCHAR2(1);
171432 l_component_appl_id INTEGER;
171433 l_amb_context_code VARCHAR2(30);
171434 l_entity_code VARCHAR2(30);
171435 l_event_class_code VARCHAR2(30);
171436 l_ae_header_id NUMBER;
171440 --
171437 l_event_type_code VARCHAR2(30);
171438 l_line_definition_code VARCHAR2(30);
171439 l_line_definition_owner_code VARCHAR2(1);
171441 -- adr variables
171442 l_segment VARCHAR2(30);
171443 l_ccid NUMBER;
171444 l_adr_transaction_coa_id NUMBER;
171445 l_adr_accounting_coa_id NUMBER;
171446 l_adr_flexfield_segment_code VARCHAR2(30);
171447 l_adr_flex_value_set_id NUMBER;
171448 l_adr_value_type_code VARCHAR2(30);
171449 l_adr_value_combination_id NUMBER;
171450 l_adr_value_segment_code VARCHAR2(30);
171451
171452 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
171453 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
171454 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
171455 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
171456
171457 -- 4262811 Variables ------------------------------------------------------------------------------------------
171458 l_entered_amt_idx NUMBER;
171459 l_accted_amt_idx NUMBER;
171460 l_acc_rev_flag VARCHAR2(1);
171461 l_accrual_line_num NUMBER;
171462 l_tmp_amt NUMBER;
171463 l_acc_rev_natural_side_code VARCHAR2(1);
171464
171465 l_num_entries NUMBER;
171466 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
171467 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
171468 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
171469 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
171470 l_recog_line_1 NUMBER;
171471 l_recog_line_2 NUMBER;
171472
171473 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
171474 l_bflow_applied_to_amt NUMBER; -- 5132302
171475 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
171476
171477 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
171478
171479 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
171480 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
171481
171482 ---------------------------------------------------------------------------------------------------------------
171483
171484
171485 --
171486 -- bulk performance
171487 --
171488 l_balance_type_code VARCHAR2(1);
171489 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
171490 l_log_module VARCHAR2(240);
171491
171492 --
171493 -- Upgrade strategy
171494 --
171495 l_actual_upg_option VARCHAR2(1);
171496 l_enc_upg_option VARCHAR2(1);
171497
171498 --
171499 BEGIN
171500 --
171501 IF g_log_enabled THEN
171502 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_406';
171503 END IF;
171504 --
171505 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
171506
171507 trace
171508 (p_msg => 'BEGIN of AcctLineType_406'
171509 ,p_level => C_LEVEL_PROCEDURE
171510 ,p_module => l_log_module);
171511
171512 END IF;
171513 --
171514 l_component_type := 'AMB_JLT';
171515 l_component_code := 'FA_UNITADJ_DEST_REVAL_RESERV';
171516 l_component_type_code := 'S';
171517 l_component_appl_id := 140;
171518 l_amb_context_code := 'DEFAULT';
171519 l_entity_code := 'TRANSACTIONS';
171520 l_event_class_code := 'UNIT_ADJUSTMENTS';
171521 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
171522 l_line_definition_owner_code := 'S';
171523 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
171524 --
171525 l_balance_type_code := 'A';
171526 l_segment := NULL;
171527 l_ccid := NULL;
171528 l_adr_transaction_coa_id := NULL;
171529 l_adr_accounting_coa_id := NULL;
171530 l_adr_flexfield_segment_code := NULL;
171531 l_adr_flex_value_set_id := NULL;
171532 l_adr_value_type_code := NULL;
171533 l_adr_value_combination_id := NULL;
171534 l_adr_value_segment_code := NULL;
171535
171536 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
171537 l_bflow_class_code := ''; -- 4219869 Business Flow
171538 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
171539 l_budgetary_control_flag := 'N';
171540
171541 l_bflow_applied_to_amt_idx := NULL; -- 5132302
171542 l_bflow_applied_to_amt := NULL; -- 5132302
171543 l_entered_amt_idx := NULL; -- 4262811
171544 l_accted_amt_idx := NULL; -- 4262811
171545 l_acc_rev_flag := NULL; -- 4262811
171546 l_accrual_line_num := NULL; -- 4262811
171547 l_tmp_amt := NULL; -- 4262811
171548 --
171549
171550 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
171551 l_balance_type_code <> 'B' THEN
171552 IF NVL(p_source_48,'
171553 ') = 'REVAL RESERVE' AND
171554 NVL(p_source_55,'
171555 ') = 'DEST'
171556 THEN
171557
171558 --
171559 XLA_AE_LINES_PKG.SetNewLine;
171560
171561 p_balance_type_code := l_balance_type_code;
171562 -- set the flag so later we will know whether the gain loss line needs to be created
171563
171567
171564 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
171565 p_actual_flag :='A';
171566 END IF;
171568 --
171569 -- bulk performance
171570 --
171571 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
171572 p_header_num => 0); -- 4262811
171573 --
171574 -- set accounting line options
171575 --
171576 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
171577 p_natural_side_code => 'C'
171578 , p_gain_or_loss_flag => 'N'
171579 , p_gl_transfer_mode_code => 'S'
171580 , p_acct_entry_type_code => 'A'
171581 , p_switch_side_flag => 'Y'
171582 , p_merge_duplicate_code => 'N'
171583 );
171584 --
171585 l_acc_rev_natural_side_code := 'D'; -- 4262811
171586 --
171587 --
171588 -- set accounting line type info
171589 --
171590 xla_ae_lines_pkg.SetAcctLineType
171591 (p_component_type => l_component_type
171592 ,p_event_type_code => l_event_type_code
171593 ,p_line_definition_owner_code => l_line_definition_owner_code
171594 ,p_line_definition_code => l_line_definition_code
171595 ,p_accounting_line_code => l_component_code
171596 ,p_accounting_line_type_code => l_component_type_code
171597 ,p_accounting_line_appl_id => l_component_appl_id
171598 ,p_amb_context_code => l_amb_context_code
171599 ,p_entity_code => l_entity_code
171600 ,p_event_class_code => l_event_class_code);
171601 --
171602 -- set accounting class
171603 --
171604 xla_ae_lines_pkg.SetAcctClass(
171605 p_accounting_class_code => 'ASSET'
171606 , p_ae_header_id => l_ae_header_id
171607 );
171608
171609 --
171610 -- set rounding class
171611 --
171612 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
171613 'ASSET';
171614
171615 --
171616 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
171617 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
171618 --
171619 -- bulk performance
171620 --
171621 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
171622
171623 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
171624 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
171625
171626 -- 4955764
171627 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
171628 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
171629
171630 -- 4458381 Public Sector Enh
171631
171632 --
171633 -- set accounting attributes for the line type
171634 --
171635 l_entered_amt_idx := 4;
171636 l_accted_amt_idx := 6;
171637 l_bflow_applied_to_amt_idx := NULL; -- 5132302
171638 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
171639 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
171640 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
171641 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
171642 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
171643 l_rec_acct_attrs.array_char_value(3) := p_source_51;
171644 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
171645 l_rec_acct_attrs.array_num_value(4) := p_source_52;
171646 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
171647 l_rec_acct_attrs.array_char_value(5) := p_source_53;
171648 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
171649 l_rec_acct_attrs.array_num_value(6) := p_source_52;
171650
171651 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
171652 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
171653
171654 ---------------------------------------------------------------------------------------------------------------
171655 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
171656 ---------------------------------------------------------------------------------------------------------------
171657 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
171658
171659 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
171660 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
171661
171662 IF xla_accounting_cache_pkg.GetValueChar
171663 (p_source_code => 'LEDGER_CATEGORY_CODE'
171664 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
171665 AND l_bflow_method_code = 'PRIOR_ENTRY'
171666 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
171667 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
171668 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
171669 )
171670 THEN
171671 xla_ae_lines_pkg.BflowUpgEntry
171672 (p_business_method_code => l_bflow_method_code
171673 ,p_business_class_code => l_bflow_class_code
171677 -- No business flow processing for business flow method of NONE.
171674 ,p_balance_type => l_balance_type_code);
171675 ELSE
171676 NULL;
171678 END IF;
171679
171680 --
171681 -- call analytical criteria
171682 --
171683
171684 --
171685 -- call description
171686 --
171687
171688 xla_ae_lines_pkg.SetLineDescription(
171689 p_ae_header_id => l_ae_header_id
171690 ,p_description => Description_138 (
171691 p_application_id => p_application_id
171692 , p_ae_header_id => l_ae_header_id
171693 , p_source_1 => p_source_1
171694 )
171695 );
171696
171697
171698 --
171699 -- call ADRs
171700 -- Bug 4922099
171701 --
171702 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
171703 (NVL(l_actual_upg_option, 'N') = 'O') OR
171704 (NVL(l_enc_upg_option, 'N') = 'O')
171705 )
171706 THEN
171707 NULL;
171708 --
171709 --
171710
171711 l_ccid := AcctDerRule_175(
171712 p_application_id => p_application_id
171713 , p_ae_header_id => l_ae_header_id
171714 , p_source_5 => p_source_5
171715 , p_source_19 => p_source_19
171716 , p_source_32 => p_source_32
171717 , x_transaction_coa_id => l_adr_transaction_coa_id
171718 , x_accounting_coa_id => l_adr_accounting_coa_id
171719 , x_value_type_code => l_adr_value_type_code
171720 , p_side => 'NA'
171721 );
171722
171723 xla_ae_lines_pkg.set_ccid(
171724 p_code_combination_id => l_ccid
171725 , p_value_type_code => l_adr_value_type_code
171726 , p_transaction_coa_id => l_adr_transaction_coa_id
171727 , p_accounting_coa_id => l_adr_accounting_coa_id
171728 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
171729 , p_adr_type_code => 'S'
171730 , p_component_type => l_component_type
171731 , p_component_code => l_component_code
171732 , p_component_type_code => l_component_type_code
171733 , p_component_appl_id => l_component_appl_id
171734 , p_amb_context_code => l_amb_context_code
171735 , p_side => 'NA'
171736 );
171737
171738
171739 l_segment := AcctDerRule_151(
171740 p_application_id => p_application_id
171741 , p_ae_header_id => l_ae_header_id
171742 , p_source_5 => p_source_5
171743 , p_source_13 => p_source_13
171744 , x_transaction_coa_id => l_adr_transaction_coa_id
171745 , x_accounting_coa_id => l_adr_accounting_coa_id
171746 , x_flexfield_segment_code => l_adr_flexfield_segment_code
171747 , x_flex_value_set_id => l_adr_flex_value_set_id
171748 , x_value_type_code => l_adr_value_type_code
171749 , x_value_combination_id => l_adr_value_combination_id
171750 , x_value_segment_code => l_adr_value_segment_code
171751 , p_side => 'NA'
171752 , p_override_seg_flag => 'Y'
171753 );
171754
171755 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
171756
171757 xla_ae_lines_pkg.set_segment(
171758 p_to_segment_code => 'GL_ACCOUNT'
171759 , p_segment_value => l_segment
171760 , p_from_segment_code => l_adr_value_segment_code
171761 , p_from_combination_id => l_adr_value_combination_id
171762 , p_value_type_code => l_adr_value_type_code
171763 , p_transaction_coa_id => l_adr_transaction_coa_id
171764 , p_accounting_coa_id => l_adr_accounting_coa_id
171765 , p_flexfield_segment_code => l_adr_flexfield_segment_code
171766 , p_flex_value_set_id => l_adr_flex_value_set_id
171767 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
171768 , p_adr_type_code => 'S'
171769 , p_component_type => l_component_type
171770 , p_component_code => l_component_code
171771 , p_component_type_code => l_component_type_code
171772 , p_component_appl_id => l_component_appl_id
171773 , p_amb_context_code => l_amb_context_code
171774 , p_entity_code => 'TRANSACTIONS'
171775 , p_event_class_code => 'UNIT_ADJUSTMENTS'
171776 , p_side => 'NA'
171777 );
171778
171779 END IF;
171780
171781 l_segment := AcctDerRule_169(
171782 p_application_id => p_application_id
171783 , p_ae_header_id => l_ae_header_id
171784 , p_source_5 => p_source_5
171785 , p_source_31 => p_source_31
171786 , x_transaction_coa_id => l_adr_transaction_coa_id
171787 , x_accounting_coa_id => l_adr_accounting_coa_id
171788 , x_flexfield_segment_code => l_adr_flexfield_segment_code
171789 , x_flex_value_set_id => l_adr_flex_value_set_id
171790 , x_value_type_code => l_adr_value_type_code
171791 , x_value_combination_id => l_adr_value_combination_id
171792 , x_value_segment_code => l_adr_value_segment_code
171793 , p_side => 'NA'
171794 , p_override_seg_flag => 'Y'
171795 );
171796
171797 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
171798
171802 , p_from_segment_code => l_adr_value_segment_code
171799 xla_ae_lines_pkg.set_segment(
171800 p_to_segment_code => 'GL_BALANCING'
171801 , p_segment_value => l_segment
171803 , p_from_combination_id => l_adr_value_combination_id
171804 , p_value_type_code => l_adr_value_type_code
171805 , p_transaction_coa_id => l_adr_transaction_coa_id
171806 , p_accounting_coa_id => l_adr_accounting_coa_id
171807 , p_flexfield_segment_code => l_adr_flexfield_segment_code
171808 , p_flex_value_set_id => l_adr_flex_value_set_id
171809 , p_adr_code => 'FA_EXPENSE_ACCT'
171810 , p_adr_type_code => 'S'
171811 , p_component_type => l_component_type
171812 , p_component_code => l_component_code
171813 , p_component_type_code => l_component_type_code
171814 , p_component_appl_id => l_component_appl_id
171815 , p_amb_context_code => l_amb_context_code
171816 , p_entity_code => 'TRANSACTIONS'
171817 , p_event_class_code => 'UNIT_ADJUSTMENTS'
171818 , p_side => 'NA'
171819 );
171820
171821 END IF;
171822
171823 --
171824 --
171825 END IF;
171826 --
171827 -- Bug 4922099
171828 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
171829 (NVL(l_enc_upg_option, 'N') = 'O')
171830 ) AND
171831 (l_bflow_method_code = 'PRIOR_ENTRY')
171832 )
171833 THEN
171834 IF
171835 --
171836 1 = 2
171837 --
171838 THEN
171839 xla_accounting_err_pkg.build_message
171840 (p_appli_s_name => 'XLA'
171841 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
171842 ,p_token_1 => 'LINE_NUMBER'
171843 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
171844 ,p_token_2 => 'LINE_TYPE_NAME'
171845 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
171846 l_component_type
171847 ,l_component_code
171848 ,l_component_type_code
171849 ,l_component_appl_id
171850 ,l_amb_context_code
171851 ,l_entity_code
171852 ,l_event_class_code
171853 )
171854 ,p_token_3 => 'OWNER'
171855 ,p_value_3 => xla_lookups_pkg.get_meaning(
171856 p_lookup_type => 'XLA_OWNER_TYPE'
171857 ,p_lookup_code => l_component_type_code
171858 )
171859 ,p_token_4 => 'PRODUCT_NAME'
171860 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
171861 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
171862 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
171863 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
171864 ,p_ae_header_id => NULL
171865 );
171866
171867 IF (C_LEVEL_ERROR>= g_log_level) THEN
171868 trace
171869 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
171870 ,p_level => C_LEVEL_ERROR
171871 ,p_module => l_log_module);
171872 END IF;
171873 END IF;
171874 END IF;
171875 --
171876 --
171877 ------------------------------------------------------------------------------------------------
171878 -- 4219869 Business Flow
171879 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
171880 -- Prior Entry. Currently, the following code is always generated.
171881 ------------------------------------------------------------------------------------------------
171882 XLA_AE_LINES_PKG.ValidateCurrentLine;
171883
171884 ------------------------------------------------------------------------------------
171885 -- 4219869 Business Flow
171886 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
171887 ------------------------------------------------------------------------------------
171888 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
171889
171890 ----------------------------------------------------------------------------------
171891 -- 4219869 Business Flow
171892 -- Update journal entry status -- Need to generate this within IF <condition>
171896 ,p_balance_type_code => l_balance_type_code
171893 ----------------------------------------------------------------------------------
171894 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
171895 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
171897 );
171898
171899 -------------------------------------------------------------------------------------------
171900 -- 4262811 - Generate the Accrual Reversal lines
171901 -------------------------------------------------------------------------------------------
171902 BEGIN
171903 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
171904 (g_array_event(p_event_id).array_value_num('header_index'));
171905 IF l_acc_rev_flag IS NULL THEN
171906 l_acc_rev_flag := 'N';
171907 END IF;
171908 EXCEPTION
171909 WHEN OTHERS THEN
171910 l_acc_rev_flag := 'N';
171911 END;
171912 --
171913 IF (l_acc_rev_flag = 'Y') THEN
171914
171915 -- 4645092 ------------------------------------------------------------------------------
171916 -- To allow MPA report to determine if it should generate report process
171917 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
171918 ------------------------------------------------------------------------------------------
171919
171920 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
171921 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
171922 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
171923 -- call ADRs
171924 -- Bug 4922099
171925 --
171926 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
171927 (NVL(l_actual_upg_option, 'N') = 'O') OR
171928 (NVL(l_enc_upg_option, 'N') = 'O')
171929 )
171930 THEN
171931 NULL;
171932 --
171933 --
171934
171935 l_ccid := AcctDerRule_175(
171936 p_application_id => p_application_id
171937 , p_ae_header_id => l_ae_header_id
171938 , p_source_5 => p_source_5
171939 , p_source_19 => p_source_19
171940 , p_source_32 => p_source_32
171941 , x_transaction_coa_id => l_adr_transaction_coa_id
171942 , x_accounting_coa_id => l_adr_accounting_coa_id
171943 , x_value_type_code => l_adr_value_type_code
171944 , p_side => 'NA'
171945 );
171946
171947 xla_ae_lines_pkg.set_ccid(
171948 p_code_combination_id => l_ccid
171949 , p_value_type_code => l_adr_value_type_code
171950 , p_transaction_coa_id => l_adr_transaction_coa_id
171951 , p_accounting_coa_id => l_adr_accounting_coa_id
171952 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
171953 , p_adr_type_code => 'S'
171954 , p_component_type => l_component_type
171955 , p_component_code => l_component_code
171956 , p_component_type_code => l_component_type_code
171957 , p_component_appl_id => l_component_appl_id
171958 , p_amb_context_code => l_amb_context_code
171959 , p_side => 'NA'
171960 );
171961
171962
171963 l_segment := AcctDerRule_151(
171964 p_application_id => p_application_id
171965 , p_ae_header_id => l_ae_header_id
171966 , p_source_5 => p_source_5
171967 , p_source_13 => p_source_13
171968 , x_transaction_coa_id => l_adr_transaction_coa_id
171969 , x_accounting_coa_id => l_adr_accounting_coa_id
171970 , x_flexfield_segment_code => l_adr_flexfield_segment_code
171971 , x_flex_value_set_id => l_adr_flex_value_set_id
171972 , x_value_type_code => l_adr_value_type_code
171973 , x_value_combination_id => l_adr_value_combination_id
171974 , x_value_segment_code => l_adr_value_segment_code
171975 , p_side => 'NA'
171976 , p_override_seg_flag => 'Y'
171977 );
171978
171979 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
171980
171981 xla_ae_lines_pkg.set_segment(
171982 p_to_segment_code => 'GL_ACCOUNT'
171983 , p_segment_value => l_segment
171984 , p_from_segment_code => l_adr_value_segment_code
171985 , p_from_combination_id => l_adr_value_combination_id
171986 , p_value_type_code => l_adr_value_type_code
171987 , p_transaction_coa_id => l_adr_transaction_coa_id
171988 , p_accounting_coa_id => l_adr_accounting_coa_id
171989 , p_flexfield_segment_code => l_adr_flexfield_segment_code
171990 , p_flex_value_set_id => l_adr_flex_value_set_id
171991 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
171992 , p_adr_type_code => 'S'
171993 , p_component_type => l_component_type
171994 , p_component_code => l_component_code
171995 , p_component_type_code => l_component_type_code
171996 , p_component_appl_id => l_component_appl_id
171997 , p_amb_context_code => l_amb_context_code
171998 , p_entity_code => 'TRANSACTIONS'
171999 , p_event_class_code => 'UNIT_ADJUSTMENTS'
172000 , p_side => 'NA'
172001 );
172002
172003 END IF;
172004
172005 l_segment := AcctDerRule_169(
172006 p_application_id => p_application_id
172007 , p_ae_header_id => l_ae_header_id
172011 , x_accounting_coa_id => l_adr_accounting_coa_id
172008 , p_source_5 => p_source_5
172009 , p_source_31 => p_source_31
172010 , x_transaction_coa_id => l_adr_transaction_coa_id
172012 , x_flexfield_segment_code => l_adr_flexfield_segment_code
172013 , x_flex_value_set_id => l_adr_flex_value_set_id
172014 , x_value_type_code => l_adr_value_type_code
172015 , x_value_combination_id => l_adr_value_combination_id
172016 , x_value_segment_code => l_adr_value_segment_code
172017 , p_side => 'NA'
172018 , p_override_seg_flag => 'Y'
172019 );
172020
172021 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
172022
172023 xla_ae_lines_pkg.set_segment(
172024 p_to_segment_code => 'GL_BALANCING'
172025 , p_segment_value => l_segment
172026 , p_from_segment_code => l_adr_value_segment_code
172027 , p_from_combination_id => l_adr_value_combination_id
172028 , p_value_type_code => l_adr_value_type_code
172029 , p_transaction_coa_id => l_adr_transaction_coa_id
172030 , p_accounting_coa_id => l_adr_accounting_coa_id
172031 , p_flexfield_segment_code => l_adr_flexfield_segment_code
172032 , p_flex_value_set_id => l_adr_flex_value_set_id
172033 , p_adr_code => 'FA_EXPENSE_ACCT'
172034 , p_adr_type_code => 'S'
172035 , p_component_type => l_component_type
172036 , p_component_code => l_component_code
172037 , p_component_type_code => l_component_type_code
172038 , p_component_appl_id => l_component_appl_id
172039 , p_amb_context_code => l_amb_context_code
172040 , p_entity_code => 'TRANSACTIONS'
172041 , p_event_class_code => 'UNIT_ADJUSTMENTS'
172042 , p_side => 'NA'
172043 );
172044
172045 END IF;
172046
172047 --
172048 --
172049 END IF;
172050
172051 --
172052 -- Update the line information that should be overwritten
172053 --
172054 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
172055 p_header_num => 1);
172056 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
172057
172058 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
172059
172060 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
172061 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
172062 END IF;
172063
172064 --
172065 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
172066 --
172067 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
172068 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
172069 ELSE
172070 ---------------------------------------------------------------------------------------------------
172071 -- 4262811a Switch Sign
172072 ---------------------------------------------------------------------------------------------------
172073 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
172074 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
172075 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
172076 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
172077 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
172078 -- 5132302
172079 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
172080 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
172081
172082 END IF;
172083
172084 -- 4955764
172085 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
172086 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
172087
172088
172089 XLA_AE_LINES_PKG.ValidateCurrentLine;
172090 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
172091
172092 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
172093 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
172094 ,p_balance_type_code => l_balance_type_code);
172095
172096 END IF;
172097
172098 -----------------------------------------------------------------------------------------
172099 -- 4262811 Multiperiod Accounting
172100 -----------------------------------------------------------------------------------------
172101 -- No MPA option is assigned.
172102
172103
172104 END IF;
172105 END IF;
172106 --
172107
172108 --
172109 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
172110 trace
172111 (p_msg => 'END of AcctLineType_406'
172112 ,p_level => C_LEVEL_PROCEDURE
172113 ,p_module => l_log_module);
172114 END IF;
172115 --
172116 EXCEPTION
172117 WHEN xla_exceptions_pkg.application_exception THEN
172118 RAISE;
172119 WHEN OTHERS THEN
172123 --
172120 xla_exceptions_pkg.raise_message
172121 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_406');
172122 END AcctLineType_406;
172124
172125 ---------------------------------------
172126 --
172127 -- PRIVATE FUNCTION
172128 -- AcctLineType_407
172129 --
172130 ---------------------------------------
172131 PROCEDURE AcctLineType_407 (
172132 p_application_id IN NUMBER
172133 ,p_event_id IN NUMBER
172134 ,p_calculate_acctd_flag IN VARCHAR2
172135 ,p_calculate_g_l_flag IN VARCHAR2
172136 ,p_actual_flag IN OUT VARCHAR2
172137 ,p_balance_type_code OUT VARCHAR2
172138 ,p_gain_or_loss_ref OUT VARCHAR2
172139
172140 --Period Close Date
172141 , p_source_1 IN DATE
172142 --Generated Code Combination Identifier
172143 , p_source_5 IN NUMBER
172144 --Intercompany Payables Account
172145 , p_source_21 IN VARCHAR2
172146 --Expense Account Code Combination Identifier
172147 , p_source_31 IN NUMBER
172148 --Default Code Combination Identifier
172149 , p_source_32 IN NUMBER
172150 --Adjustment Type
172151 , p_source_48 IN VARCHAR2
172152 --Transaction Header Identifier
172153 , p_source_49 IN NUMBER
172154 --Adjustment Line Identifier
172155 , p_source_50 IN NUMBER
172156 --Distribution Type Code
172157 , p_source_51 IN VARCHAR2
172158 --Entered Amount
172159 , p_source_52 IN NUMBER
172160 --Currency Code
172161 , p_source_53 IN VARCHAR2
172162 )
172163 IS
172164
172165 l_component_type VARCHAR2(80);
172166 l_component_code VARCHAR2(30);
172167 l_component_type_code VARCHAR2(1);
172168 l_component_appl_id INTEGER;
172169 l_amb_context_code VARCHAR2(30);
172170 l_entity_code VARCHAR2(30);
172171 l_event_class_code VARCHAR2(30);
172172 l_ae_header_id NUMBER;
172173 l_event_type_code VARCHAR2(30);
172174 l_line_definition_code VARCHAR2(30);
172175 l_line_definition_owner_code VARCHAR2(1);
172176 --
172177 -- adr variables
172178 l_segment VARCHAR2(30);
172179 l_ccid NUMBER;
172180 l_adr_transaction_coa_id NUMBER;
172181 l_adr_accounting_coa_id NUMBER;
172182 l_adr_flexfield_segment_code VARCHAR2(30);
172183 l_adr_flex_value_set_id NUMBER;
172184 l_adr_value_type_code VARCHAR2(30);
172185 l_adr_value_combination_id NUMBER;
172186 l_adr_value_segment_code VARCHAR2(30);
172187
172188 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
172189 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
172190 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
172191 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
172192
172193 -- 4262811 Variables ------------------------------------------------------------------------------------------
172194 l_entered_amt_idx NUMBER;
172195 l_accted_amt_idx NUMBER;
172196 l_acc_rev_flag VARCHAR2(1);
172197 l_accrual_line_num NUMBER;
172198 l_tmp_amt NUMBER;
172199 l_acc_rev_natural_side_code VARCHAR2(1);
172200
172201 l_num_entries NUMBER;
172202 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
172203 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
172204 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
172205 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
172206 l_recog_line_1 NUMBER;
172207 l_recog_line_2 NUMBER;
172208
172209 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
172210 l_bflow_applied_to_amt NUMBER; -- 5132302
172211 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
172212
172213 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
172214
172215 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
172216 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
172217
172218 ---------------------------------------------------------------------------------------------------------------
172219
172220
172221 --
172222 -- bulk performance
172223 --
172224 l_balance_type_code VARCHAR2(1);
172225 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
172226 l_log_module VARCHAR2(240);
172227
172228 --
172229 -- Upgrade strategy
172230 --
172231 l_actual_upg_option VARCHAR2(1);
172232 l_enc_upg_option VARCHAR2(1);
172233
172234 --
172235 BEGIN
172236 --
172237 IF g_log_enabled THEN
172238 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_407';
172239 END IF;
172240 --
172241 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
172242
172243 trace
172244 (p_msg => 'BEGIN of AcctLineType_407'
172245 ,p_level => C_LEVEL_PROCEDURE
172246 ,p_module => l_log_module);
172247
172248 END IF;
172249 --
172250 l_component_type := 'AMB_JLT';
172251 l_component_code := 'FA_UNITADJ_IC_PAY';
172252 l_component_type_code := 'S';
172253 l_component_appl_id := 140;
172254 l_amb_context_code := 'DEFAULT';
172258 l_line_definition_owner_code := 'S';
172255 l_entity_code := 'TRANSACTIONS';
172256 l_event_class_code := 'UNIT_ADJUSTMENTS';
172257 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
172259 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
172260 --
172261 l_balance_type_code := 'A';
172262 l_segment := NULL;
172263 l_ccid := NULL;
172264 l_adr_transaction_coa_id := NULL;
172265 l_adr_accounting_coa_id := NULL;
172266 l_adr_flexfield_segment_code := NULL;
172267 l_adr_flex_value_set_id := NULL;
172268 l_adr_value_type_code := NULL;
172269 l_adr_value_combination_id := NULL;
172270 l_adr_value_segment_code := NULL;
172271
172272 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
172273 l_bflow_class_code := ''; -- 4219869 Business Flow
172274 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
172275 l_budgetary_control_flag := 'N';
172276
172277 l_bflow_applied_to_amt_idx := NULL; -- 5132302
172278 l_bflow_applied_to_amt := NULL; -- 5132302
172279 l_entered_amt_idx := NULL; -- 4262811
172280 l_accted_amt_idx := NULL; -- 4262811
172281 l_acc_rev_flag := NULL; -- 4262811
172282 l_accrual_line_num := NULL; -- 4262811
172283 l_tmp_amt := NULL; -- 4262811
172284 --
172285
172286 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
172287 l_balance_type_code <> 'B' THEN
172288 IF NVL(p_source_48,'
172289 ') = 'INTERCO AP'
172290 THEN
172291
172292 --
172293 XLA_AE_LINES_PKG.SetNewLine;
172294
172295 p_balance_type_code := l_balance_type_code;
172296 -- set the flag so later we will know whether the gain loss line needs to be created
172297
172298 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
172299 p_actual_flag :='A';
172300 END IF;
172301
172302 --
172303 -- bulk performance
172304 --
172305 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
172306 p_header_num => 0); -- 4262811
172307 --
172308 -- set accounting line options
172309 --
172310 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
172311 p_natural_side_code => 'C'
172312 , p_gain_or_loss_flag => 'N'
172313 , p_gl_transfer_mode_code => 'S'
172314 , p_acct_entry_type_code => 'A'
172315 , p_switch_side_flag => 'Y'
172316 , p_merge_duplicate_code => 'N'
172317 );
172318 --
172319 l_acc_rev_natural_side_code := 'D'; -- 4262811
172320 --
172321 --
172322 -- set accounting line type info
172323 --
172324 xla_ae_lines_pkg.SetAcctLineType
172325 (p_component_type => l_component_type
172326 ,p_event_type_code => l_event_type_code
172327 ,p_line_definition_owner_code => l_line_definition_owner_code
172328 ,p_line_definition_code => l_line_definition_code
172329 ,p_accounting_line_code => l_component_code
172330 ,p_accounting_line_type_code => l_component_type_code
172331 ,p_accounting_line_appl_id => l_component_appl_id
172332 ,p_amb_context_code => l_amb_context_code
172333 ,p_entity_code => l_entity_code
172334 ,p_event_class_code => l_event_class_code);
172335 --
172336 -- set accounting class
172337 --
172338 xla_ae_lines_pkg.SetAcctClass(
172339 p_accounting_class_code => 'LIABILITY'
172340 , p_ae_header_id => l_ae_header_id
172341 );
172342
172343 --
172344 -- set rounding class
172345 --
172346 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
172347 'LIABILITY';
172348
172349 --
172350 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
172351 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
172352 --
172353 -- bulk performance
172354 --
172355 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
172356
172357 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
172358 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
172359
172360 -- 4955764
172361 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
172362 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
172363
172364 -- 4458381 Public Sector Enh
172365
172366 --
172367 -- set accounting attributes for the line type
172368 --
172369 l_entered_amt_idx := 4;
172370 l_accted_amt_idx := 6;
172371 l_bflow_applied_to_amt_idx := NULL; -- 5132302
172372 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
172373 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
172374 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
172375 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
172376 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
172377 l_rec_acct_attrs.array_char_value(3) := p_source_51;
172381 l_rec_acct_attrs.array_char_value(5) := p_source_53;
172378 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
172379 l_rec_acct_attrs.array_num_value(4) := p_source_52;
172380 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
172382 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
172383 l_rec_acct_attrs.array_num_value(6) := p_source_52;
172384
172385 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
172386 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
172387
172388 ---------------------------------------------------------------------------------------------------------------
172389 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
172390 ---------------------------------------------------------------------------------------------------------------
172391 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
172392
172393 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
172394 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
172395
172396 IF xla_accounting_cache_pkg.GetValueChar
172397 (p_source_code => 'LEDGER_CATEGORY_CODE'
172398 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
172399 AND l_bflow_method_code = 'PRIOR_ENTRY'
172400 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
172401 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
172402 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
172403 )
172404 THEN
172405 xla_ae_lines_pkg.BflowUpgEntry
172406 (p_business_method_code => l_bflow_method_code
172407 ,p_business_class_code => l_bflow_class_code
172408 ,p_balance_type => l_balance_type_code);
172409 ELSE
172410 NULL;
172411 -- No business flow processing for business flow method of NONE.
172412 END IF;
172413
172414 --
172415 -- call analytical criteria
172416 --
172417
172418 --
172419 -- call description
172420 --
172421
172422 xla_ae_lines_pkg.SetLineDescription(
172423 p_ae_header_id => l_ae_header_id
172424 ,p_description => Description_135 (
172425 p_application_id => p_application_id
172426 , p_ae_header_id => l_ae_header_id
172427 , p_source_1 => p_source_1
172428 )
172429 );
172430
172431
172432 --
172433 -- call ADRs
172434 -- Bug 4922099
172435 --
172436 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
172437 (NVL(l_actual_upg_option, 'N') = 'O') OR
172438 (NVL(l_enc_upg_option, 'N') = 'O')
172439 )
172440 THEN
172441 NULL;
172442 --
172443 --
172444
172445 l_ccid := AcctDerRule_174(
172446 p_application_id => p_application_id
172447 , p_ae_header_id => l_ae_header_id
172448 , p_source_5 => p_source_5
172449 , p_source_32 => p_source_32
172450 , x_transaction_coa_id => l_adr_transaction_coa_id
172451 , x_accounting_coa_id => l_adr_accounting_coa_id
172452 , x_value_type_code => l_adr_value_type_code
172453 , p_side => 'NA'
172454 );
172455
172456 xla_ae_lines_pkg.set_ccid(
172457 p_code_combination_id => l_ccid
172458 , p_value_type_code => l_adr_value_type_code
172459 , p_transaction_coa_id => l_adr_transaction_coa_id
172460 , p_accounting_coa_id => l_adr_accounting_coa_id
172461 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
172462 , p_adr_type_code => 'S'
172463 , p_component_type => l_component_type
172464 , p_component_code => l_component_code
172465 , p_component_type_code => l_component_type_code
172466 , p_component_appl_id => l_component_appl_id
172467 , p_amb_context_code => l_amb_context_code
172468 , p_side => 'NA'
172469 );
172470
172471
172472 l_segment := AcctDerRule_169(
172473 p_application_id => p_application_id
172474 , p_ae_header_id => l_ae_header_id
172475 , p_source_5 => p_source_5
172476 , p_source_31 => p_source_31
172477 , x_transaction_coa_id => l_adr_transaction_coa_id
172478 , x_accounting_coa_id => l_adr_accounting_coa_id
172479 , x_flexfield_segment_code => l_adr_flexfield_segment_code
172480 , x_flex_value_set_id => l_adr_flex_value_set_id
172481 , x_value_type_code => l_adr_value_type_code
172482 , x_value_combination_id => l_adr_value_combination_id
172483 , x_value_segment_code => l_adr_value_segment_code
172484 , p_side => 'NA'
172485 , p_override_seg_flag => 'Y'
172486 );
172487
172488 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
172489
172490 xla_ae_lines_pkg.set_segment(
172491 p_to_segment_code => 'GL_BALANCING'
172492 , p_segment_value => l_segment
172493 , p_from_segment_code => l_adr_value_segment_code
172494 , p_from_combination_id => l_adr_value_combination_id
172495 , p_value_type_code => l_adr_value_type_code
172499 , p_flex_value_set_id => l_adr_flex_value_set_id
172496 , p_transaction_coa_id => l_adr_transaction_coa_id
172497 , p_accounting_coa_id => l_adr_accounting_coa_id
172498 , p_flexfield_segment_code => l_adr_flexfield_segment_code
172500 , p_adr_code => 'FA_EXPENSE_ACCT'
172501 , p_adr_type_code => 'S'
172502 , p_component_type => l_component_type
172503 , p_component_code => l_component_code
172504 , p_component_type_code => l_component_type_code
172505 , p_component_appl_id => l_component_appl_id
172506 , p_amb_context_code => l_amb_context_code
172507 , p_entity_code => 'TRANSACTIONS'
172508 , p_event_class_code => 'UNIT_ADJUSTMENTS'
172509 , p_side => 'NA'
172510 );
172511
172512 END IF;
172513
172514 l_segment := AcctDerRule_158(
172515 p_application_id => p_application_id
172516 , p_ae_header_id => l_ae_header_id
172517 , p_source_5 => p_source_5
172518 , p_source_21 => p_source_21
172519 , x_transaction_coa_id => l_adr_transaction_coa_id
172520 , x_accounting_coa_id => l_adr_accounting_coa_id
172521 , x_flexfield_segment_code => l_adr_flexfield_segment_code
172522 , x_flex_value_set_id => l_adr_flex_value_set_id
172523 , x_value_type_code => l_adr_value_type_code
172524 , x_value_combination_id => l_adr_value_combination_id
172525 , x_value_segment_code => l_adr_value_segment_code
172526 , p_side => 'NA'
172527 , p_override_seg_flag => 'Y'
172528 );
172529
172530 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
172531
172532 xla_ae_lines_pkg.set_segment(
172533 p_to_segment_code => 'GL_ACCOUNT'
172534 , p_segment_value => l_segment
172535 , p_from_segment_code => l_adr_value_segment_code
172536 , p_from_combination_id => l_adr_value_combination_id
172537 , p_value_type_code => l_adr_value_type_code
172538 , p_transaction_coa_id => l_adr_transaction_coa_id
172539 , p_accounting_coa_id => l_adr_accounting_coa_id
172540 , p_flexfield_segment_code => l_adr_flexfield_segment_code
172541 , p_flex_value_set_id => l_adr_flex_value_set_id
172542 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
172543 , p_adr_type_code => 'S'
172544 , p_component_type => l_component_type
172545 , p_component_code => l_component_code
172546 , p_component_type_code => l_component_type_code
172547 , p_component_appl_id => l_component_appl_id
172548 , p_amb_context_code => l_amb_context_code
172549 , p_entity_code => 'TRANSACTIONS'
172550 , p_event_class_code => 'UNIT_ADJUSTMENTS'
172551 , p_side => 'NA'
172552 );
172553
172554 END IF;
172555
172556 --
172557 --
172558 END IF;
172559 --
172560 -- Bug 4922099
172561 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
172562 (NVL(l_enc_upg_option, 'N') = 'O')
172563 ) AND
172564 (l_bflow_method_code = 'PRIOR_ENTRY')
172565 )
172566 THEN
172567 IF
172568 --
172569 1 = 2
172570 --
172571 THEN
172572 xla_accounting_err_pkg.build_message
172573 (p_appli_s_name => 'XLA'
172574 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
172575 ,p_token_1 => 'LINE_NUMBER'
172576 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
172577 ,p_token_2 => 'LINE_TYPE_NAME'
172578 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
172579 l_component_type
172580 ,l_component_code
172581 ,l_component_type_code
172582 ,l_component_appl_id
172583 ,l_amb_context_code
172584 ,l_entity_code
172585 ,l_event_class_code
172586 )
172587 ,p_token_3 => 'OWNER'
172588 ,p_value_3 => xla_lookups_pkg.get_meaning(
172589 p_lookup_type => 'XLA_OWNER_TYPE'
172590 ,p_lookup_code => l_component_type_code
172591 )
172592 ,p_token_4 => 'PRODUCT_NAME'
172593 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
172594 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
172598 );
172595 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
172596 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
172597 ,p_ae_header_id => NULL
172599
172600 IF (C_LEVEL_ERROR>= g_log_level) THEN
172601 trace
172602 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
172603 ,p_level => C_LEVEL_ERROR
172604 ,p_module => l_log_module);
172605 END IF;
172606 END IF;
172607 END IF;
172608 --
172609 --
172610 ------------------------------------------------------------------------------------------------
172611 -- 4219869 Business Flow
172612 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
172613 -- Prior Entry. Currently, the following code is always generated.
172614 ------------------------------------------------------------------------------------------------
172615 XLA_AE_LINES_PKG.ValidateCurrentLine;
172616
172617 ------------------------------------------------------------------------------------
172618 -- 4219869 Business Flow
172619 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
172620 ------------------------------------------------------------------------------------
172621 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
172622
172623 ----------------------------------------------------------------------------------
172624 -- 4219869 Business Flow
172625 -- Update journal entry status -- Need to generate this within IF <condition>
172626 ----------------------------------------------------------------------------------
172627 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
172628 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
172629 ,p_balance_type_code => l_balance_type_code
172630 );
172631
172632 -------------------------------------------------------------------------------------------
172633 -- 4262811 - Generate the Accrual Reversal lines
172634 -------------------------------------------------------------------------------------------
172635 BEGIN
172636 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
172637 (g_array_event(p_event_id).array_value_num('header_index'));
172638 IF l_acc_rev_flag IS NULL THEN
172639 l_acc_rev_flag := 'N';
172640 END IF;
172641 EXCEPTION
172642 WHEN OTHERS THEN
172643 l_acc_rev_flag := 'N';
172644 END;
172645 --
172646 IF (l_acc_rev_flag = 'Y') THEN
172647
172648 -- 4645092 ------------------------------------------------------------------------------
172649 -- To allow MPA report to determine if it should generate report process
172650 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
172651 ------------------------------------------------------------------------------------------
172652
172653 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
172654 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
172655 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
172656 -- call ADRs
172657 -- Bug 4922099
172658 --
172659 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
172660 (NVL(l_actual_upg_option, 'N') = 'O') OR
172661 (NVL(l_enc_upg_option, 'N') = 'O')
172662 )
172663 THEN
172664 NULL;
172665 --
172666 --
172667
172668 l_ccid := AcctDerRule_174(
172669 p_application_id => p_application_id
172670 , p_ae_header_id => l_ae_header_id
172671 , p_source_5 => p_source_5
172672 , p_source_32 => p_source_32
172673 , x_transaction_coa_id => l_adr_transaction_coa_id
172674 , x_accounting_coa_id => l_adr_accounting_coa_id
172675 , x_value_type_code => l_adr_value_type_code
172676 , p_side => 'NA'
172677 );
172678
172679 xla_ae_lines_pkg.set_ccid(
172680 p_code_combination_id => l_ccid
172681 , p_value_type_code => l_adr_value_type_code
172682 , p_transaction_coa_id => l_adr_transaction_coa_id
172683 , p_accounting_coa_id => l_adr_accounting_coa_id
172684 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
172685 , p_adr_type_code => 'S'
172686 , p_component_type => l_component_type
172687 , p_component_code => l_component_code
172688 , p_component_type_code => l_component_type_code
172689 , p_component_appl_id => l_component_appl_id
172690 , p_amb_context_code => l_amb_context_code
172691 , p_side => 'NA'
172692 );
172693
172694
172695 l_segment := AcctDerRule_169(
172696 p_application_id => p_application_id
172697 , p_ae_header_id => l_ae_header_id
172698 , p_source_5 => p_source_5
172699 , p_source_31 => p_source_31
172700 , x_transaction_coa_id => l_adr_transaction_coa_id
172701 , x_accounting_coa_id => l_adr_accounting_coa_id
172702 , x_flexfield_segment_code => l_adr_flexfield_segment_code
172703 , x_flex_value_set_id => l_adr_flex_value_set_id
172704 , x_value_type_code => l_adr_value_type_code
172708 , p_override_seg_flag => 'Y'
172705 , x_value_combination_id => l_adr_value_combination_id
172706 , x_value_segment_code => l_adr_value_segment_code
172707 , p_side => 'NA'
172709 );
172710
172711 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
172712
172713 xla_ae_lines_pkg.set_segment(
172714 p_to_segment_code => 'GL_BALANCING'
172715 , p_segment_value => l_segment
172716 , p_from_segment_code => l_adr_value_segment_code
172717 , p_from_combination_id => l_adr_value_combination_id
172718 , p_value_type_code => l_adr_value_type_code
172719 , p_transaction_coa_id => l_adr_transaction_coa_id
172720 , p_accounting_coa_id => l_adr_accounting_coa_id
172721 , p_flexfield_segment_code => l_adr_flexfield_segment_code
172722 , p_flex_value_set_id => l_adr_flex_value_set_id
172723 , p_adr_code => 'FA_EXPENSE_ACCT'
172724 , p_adr_type_code => 'S'
172725 , p_component_type => l_component_type
172726 , p_component_code => l_component_code
172727 , p_component_type_code => l_component_type_code
172728 , p_component_appl_id => l_component_appl_id
172729 , p_amb_context_code => l_amb_context_code
172730 , p_entity_code => 'TRANSACTIONS'
172731 , p_event_class_code => 'UNIT_ADJUSTMENTS'
172732 , p_side => 'NA'
172733 );
172734
172735 END IF;
172736
172737 l_segment := AcctDerRule_158(
172738 p_application_id => p_application_id
172739 , p_ae_header_id => l_ae_header_id
172740 , p_source_5 => p_source_5
172741 , p_source_21 => p_source_21
172742 , x_transaction_coa_id => l_adr_transaction_coa_id
172743 , x_accounting_coa_id => l_adr_accounting_coa_id
172744 , x_flexfield_segment_code => l_adr_flexfield_segment_code
172745 , x_flex_value_set_id => l_adr_flex_value_set_id
172746 , x_value_type_code => l_adr_value_type_code
172747 , x_value_combination_id => l_adr_value_combination_id
172748 , x_value_segment_code => l_adr_value_segment_code
172749 , p_side => 'NA'
172750 , p_override_seg_flag => 'Y'
172751 );
172752
172753 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
172754
172755 xla_ae_lines_pkg.set_segment(
172756 p_to_segment_code => 'GL_ACCOUNT'
172757 , p_segment_value => l_segment
172758 , p_from_segment_code => l_adr_value_segment_code
172759 , p_from_combination_id => l_adr_value_combination_id
172760 , p_value_type_code => l_adr_value_type_code
172761 , p_transaction_coa_id => l_adr_transaction_coa_id
172762 , p_accounting_coa_id => l_adr_accounting_coa_id
172763 , p_flexfield_segment_code => l_adr_flexfield_segment_code
172764 , p_flex_value_set_id => l_adr_flex_value_set_id
172765 , p_adr_code => 'FA_IC_PAYABLE_ACCOUNT'
172766 , p_adr_type_code => 'S'
172767 , p_component_type => l_component_type
172768 , p_component_code => l_component_code
172769 , p_component_type_code => l_component_type_code
172770 , p_component_appl_id => l_component_appl_id
172771 , p_amb_context_code => l_amb_context_code
172772 , p_entity_code => 'TRANSACTIONS'
172773 , p_event_class_code => 'UNIT_ADJUSTMENTS'
172774 , p_side => 'NA'
172775 );
172776
172777 END IF;
172778
172779 --
172780 --
172781 END IF;
172782
172783 --
172784 -- Update the line information that should be overwritten
172785 --
172786 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
172787 p_header_num => 1);
172788 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
172789
172790 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
172791
172792 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
172793 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
172794 END IF;
172795
172796 --
172797 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
172798 --
172799 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
172800 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
172801 ELSE
172802 ---------------------------------------------------------------------------------------------------
172803 -- 4262811a Switch Sign
172804 ---------------------------------------------------------------------------------------------------
172805 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
172806 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
172807 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
172808 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
172812 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
172809 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
172810 -- 5132302
172811 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
172813
172814 END IF;
172815
172816 -- 4955764
172817 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
172818 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
172819
172820
172821 XLA_AE_LINES_PKG.ValidateCurrentLine;
172822 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
172823
172824 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
172825 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
172826 ,p_balance_type_code => l_balance_type_code);
172827
172828 END IF;
172829
172830 -----------------------------------------------------------------------------------------
172831 -- 4262811 Multiperiod Accounting
172832 -----------------------------------------------------------------------------------------
172833 -- No MPA option is assigned.
172834
172835
172836 END IF;
172837 END IF;
172838 --
172839
172840 --
172841 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
172842 trace
172843 (p_msg => 'END of AcctLineType_407'
172844 ,p_level => C_LEVEL_PROCEDURE
172845 ,p_module => l_log_module);
172846 END IF;
172847 --
172848 EXCEPTION
172849 WHEN xla_exceptions_pkg.application_exception THEN
172850 RAISE;
172851 WHEN OTHERS THEN
172852 xla_exceptions_pkg.raise_message
172853 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_407');
172854 END AcctLineType_407;
172855 --
172856
172857 ---------------------------------------
172858 --
172859 -- PRIVATE FUNCTION
172860 -- AcctLineType_408
172861 --
172862 ---------------------------------------
172863 PROCEDURE AcctLineType_408 (
172864 p_application_id IN NUMBER
172865 ,p_event_id IN NUMBER
172866 ,p_calculate_acctd_flag IN VARCHAR2
172867 ,p_calculate_g_l_flag IN VARCHAR2
172868 ,p_actual_flag IN OUT VARCHAR2
172869 ,p_balance_type_code OUT VARCHAR2
172870 ,p_gain_or_loss_ref OUT VARCHAR2
172871
172872 --Period Close Date
172873 , p_source_1 IN DATE
172874 --Generated Code Combination Identifier
172875 , p_source_5 IN NUMBER
172876 --Intercompany Receivables Account
172877 , p_source_22 IN VARCHAR2
172878 --Expense Account Code Combination Identifier
172879 , p_source_31 IN NUMBER
172880 --Default Code Combination Identifier
172881 , p_source_32 IN NUMBER
172882 --Adjustment Type
172883 , p_source_48 IN VARCHAR2
172884 --Transaction Header Identifier
172885 , p_source_49 IN NUMBER
172886 --Adjustment Line Identifier
172887 , p_source_50 IN NUMBER
172888 --Distribution Type Code
172889 , p_source_51 IN VARCHAR2
172890 --Entered Amount
172891 , p_source_52 IN NUMBER
172892 --Currency Code
172893 , p_source_53 IN VARCHAR2
172894 )
172895 IS
172896
172897 l_component_type VARCHAR2(80);
172898 l_component_code VARCHAR2(30);
172899 l_component_type_code VARCHAR2(1);
172900 l_component_appl_id INTEGER;
172901 l_amb_context_code VARCHAR2(30);
172902 l_entity_code VARCHAR2(30);
172903 l_event_class_code VARCHAR2(30);
172904 l_ae_header_id NUMBER;
172905 l_event_type_code VARCHAR2(30);
172906 l_line_definition_code VARCHAR2(30);
172907 l_line_definition_owner_code VARCHAR2(1);
172908 --
172909 -- adr variables
172910 l_segment VARCHAR2(30);
172911 l_ccid NUMBER;
172912 l_adr_transaction_coa_id NUMBER;
172913 l_adr_accounting_coa_id NUMBER;
172914 l_adr_flexfield_segment_code VARCHAR2(30);
172915 l_adr_flex_value_set_id NUMBER;
172916 l_adr_value_type_code VARCHAR2(30);
172917 l_adr_value_combination_id NUMBER;
172918 l_adr_value_segment_code VARCHAR2(30);
172919
172920 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
172921 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
172922 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
172923 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
172924
172925 -- 4262811 Variables ------------------------------------------------------------------------------------------
172926 l_entered_amt_idx NUMBER;
172927 l_accted_amt_idx NUMBER;
172928 l_acc_rev_flag VARCHAR2(1);
172929 l_accrual_line_num NUMBER;
172930 l_tmp_amt NUMBER;
172931 l_acc_rev_natural_side_code VARCHAR2(1);
172932
172933 l_num_entries NUMBER;
172934 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
172935 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
172936 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
172937 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
172938 l_recog_line_1 NUMBER;
172942 l_bflow_applied_to_amt NUMBER; -- 5132302
172939 l_recog_line_2 NUMBER;
172940
172941 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
172943 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
172944
172945 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
172946
172947 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
172948 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
172949
172950 ---------------------------------------------------------------------------------------------------------------
172951
172952
172953 --
172954 -- bulk performance
172955 --
172956 l_balance_type_code VARCHAR2(1);
172957 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
172958 l_log_module VARCHAR2(240);
172959
172960 --
172961 -- Upgrade strategy
172962 --
172963 l_actual_upg_option VARCHAR2(1);
172964 l_enc_upg_option VARCHAR2(1);
172965
172966 --
172967 BEGIN
172968 --
172969 IF g_log_enabled THEN
172970 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_408';
172971 END IF;
172972 --
172973 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
172974
172975 trace
172976 (p_msg => 'BEGIN of AcctLineType_408'
172977 ,p_level => C_LEVEL_PROCEDURE
172978 ,p_module => l_log_module);
172979
172980 END IF;
172981 --
172982 l_component_type := 'AMB_JLT';
172983 l_component_code := 'FA_UNITADJ_IC_REC';
172984 l_component_type_code := 'S';
172985 l_component_appl_id := 140;
172986 l_amb_context_code := 'DEFAULT';
172987 l_entity_code := 'TRANSACTIONS';
172988 l_event_class_code := 'UNIT_ADJUSTMENTS';
172989 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
172990 l_line_definition_owner_code := 'S';
172991 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
172992 --
172993 l_balance_type_code := 'A';
172994 l_segment := NULL;
172995 l_ccid := NULL;
172996 l_adr_transaction_coa_id := NULL;
172997 l_adr_accounting_coa_id := NULL;
172998 l_adr_flexfield_segment_code := NULL;
172999 l_adr_flex_value_set_id := NULL;
173000 l_adr_value_type_code := NULL;
173001 l_adr_value_combination_id := NULL;
173002 l_adr_value_segment_code := NULL;
173003
173004 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
173005 l_bflow_class_code := ''; -- 4219869 Business Flow
173006 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
173007 l_budgetary_control_flag := 'N';
173008
173009 l_bflow_applied_to_amt_idx := NULL; -- 5132302
173010 l_bflow_applied_to_amt := NULL; -- 5132302
173011 l_entered_amt_idx := NULL; -- 4262811
173012 l_accted_amt_idx := NULL; -- 4262811
173013 l_acc_rev_flag := NULL; -- 4262811
173014 l_accrual_line_num := NULL; -- 4262811
173015 l_tmp_amt := NULL; -- 4262811
173016 --
173017
173018 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
173019 l_balance_type_code <> 'B' THEN
173020 IF NVL(p_source_48,'
173021 ') = 'INTERCO AR'
173022 THEN
173023
173024 --
173025 XLA_AE_LINES_PKG.SetNewLine;
173026
173027 p_balance_type_code := l_balance_type_code;
173028 -- set the flag so later we will know whether the gain loss line needs to be created
173029
173030 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
173031 p_actual_flag :='A';
173032 END IF;
173033
173034 --
173035 -- bulk performance
173036 --
173037 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
173038 p_header_num => 0); -- 4262811
173039 --
173040 -- set accounting line options
173041 --
173042 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
173043 p_natural_side_code => 'D'
173044 , p_gain_or_loss_flag => 'N'
173045 , p_gl_transfer_mode_code => 'S'
173046 , p_acct_entry_type_code => 'A'
173047 , p_switch_side_flag => 'Y'
173048 , p_merge_duplicate_code => 'N'
173049 );
173050 --
173051 l_acc_rev_natural_side_code := 'C'; -- 4262811
173052 --
173053 --
173054 -- set accounting line type info
173055 --
173056 xla_ae_lines_pkg.SetAcctLineType
173057 (p_component_type => l_component_type
173058 ,p_event_type_code => l_event_type_code
173059 ,p_line_definition_owner_code => l_line_definition_owner_code
173060 ,p_line_definition_code => l_line_definition_code
173061 ,p_accounting_line_code => l_component_code
173062 ,p_accounting_line_type_code => l_component_type_code
173063 ,p_accounting_line_appl_id => l_component_appl_id
173064 ,p_amb_context_code => l_amb_context_code
173065 ,p_entity_code => l_entity_code
173066 ,p_event_class_code => l_event_class_code);
173067 --
173068 -- set accounting class
173069 --
173070 xla_ae_lines_pkg.SetAcctClass(
173074
173071 p_accounting_class_code => 'ASSET'
173072 , p_ae_header_id => l_ae_header_id
173073 );
173075 --
173076 -- set rounding class
173077 --
173078 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
173079 'ASSET';
173080
173081 --
173082 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
173083 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
173084 --
173085 -- bulk performance
173086 --
173087 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
173088
173089 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
173090 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
173091
173092 -- 4955764
173093 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
173094 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
173095
173096 -- 4458381 Public Sector Enh
173097
173098 --
173099 -- set accounting attributes for the line type
173100 --
173101 l_entered_amt_idx := 4;
173102 l_accted_amt_idx := 6;
173103 l_bflow_applied_to_amt_idx := NULL; -- 5132302
173104 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
173105 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
173106 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
173107 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
173108 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
173109 l_rec_acct_attrs.array_char_value(3) := p_source_51;
173110 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
173111 l_rec_acct_attrs.array_num_value(4) := p_source_52;
173112 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
173113 l_rec_acct_attrs.array_char_value(5) := p_source_53;
173114 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
173115 l_rec_acct_attrs.array_num_value(6) := p_source_52;
173116
173117 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
173118 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
173119
173120 ---------------------------------------------------------------------------------------------------------------
173121 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
173122 ---------------------------------------------------------------------------------------------------------------
173123 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
173124
173125 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
173126 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
173127
173128 IF xla_accounting_cache_pkg.GetValueChar
173129 (p_source_code => 'LEDGER_CATEGORY_CODE'
173130 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
173131 AND l_bflow_method_code = 'PRIOR_ENTRY'
173132 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
173133 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
173134 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
173135 )
173136 THEN
173137 xla_ae_lines_pkg.BflowUpgEntry
173138 (p_business_method_code => l_bflow_method_code
173139 ,p_business_class_code => l_bflow_class_code
173140 ,p_balance_type => l_balance_type_code);
173141 ELSE
173142 NULL;
173143 -- No business flow processing for business flow method of NONE.
173144 END IF;
173145
173146 --
173147 -- call analytical criteria
173148 --
173149
173150 --
173151 -- call description
173152 --
173153
173154 xla_ae_lines_pkg.SetLineDescription(
173155 p_ae_header_id => l_ae_header_id
173156 ,p_description => Description_136 (
173157 p_application_id => p_application_id
173158 , p_ae_header_id => l_ae_header_id
173159 , p_source_1 => p_source_1
173160 )
173161 );
173162
173163
173164 --
173165 -- call ADRs
173166 -- Bug 4922099
173167 --
173168 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
173169 (NVL(l_actual_upg_option, 'N') = 'O') OR
173170 (NVL(l_enc_upg_option, 'N') = 'O')
173171 )
173172 THEN
173173 NULL;
173174 --
173175 --
173176
173177 l_ccid := AcctDerRule_174(
173178 p_application_id => p_application_id
173179 , p_ae_header_id => l_ae_header_id
173180 , p_source_5 => p_source_5
173181 , p_source_32 => p_source_32
173182 , x_transaction_coa_id => l_adr_transaction_coa_id
173183 , x_accounting_coa_id => l_adr_accounting_coa_id
173184 , x_value_type_code => l_adr_value_type_code
173185 , p_side => 'NA'
173186 );
173187
173188 xla_ae_lines_pkg.set_ccid(
173189 p_code_combination_id => l_ccid
173190 , p_value_type_code => l_adr_value_type_code
173191 , p_transaction_coa_id => l_adr_transaction_coa_id
173192 , p_accounting_coa_id => l_adr_accounting_coa_id
173196 , p_component_code => l_component_code
173193 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
173194 , p_adr_type_code => 'S'
173195 , p_component_type => l_component_type
173197 , p_component_type_code => l_component_type_code
173198 , p_component_appl_id => l_component_appl_id
173199 , p_amb_context_code => l_amb_context_code
173200 , p_side => 'NA'
173201 );
173202
173203
173204 l_segment := AcctDerRule_169(
173205 p_application_id => p_application_id
173206 , p_ae_header_id => l_ae_header_id
173207 , p_source_5 => p_source_5
173208 , p_source_31 => p_source_31
173209 , x_transaction_coa_id => l_adr_transaction_coa_id
173210 , x_accounting_coa_id => l_adr_accounting_coa_id
173211 , x_flexfield_segment_code => l_adr_flexfield_segment_code
173212 , x_flex_value_set_id => l_adr_flex_value_set_id
173213 , x_value_type_code => l_adr_value_type_code
173214 , x_value_combination_id => l_adr_value_combination_id
173215 , x_value_segment_code => l_adr_value_segment_code
173216 , p_side => 'NA'
173217 , p_override_seg_flag => 'Y'
173218 );
173219
173220 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
173221
173222 xla_ae_lines_pkg.set_segment(
173223 p_to_segment_code => 'GL_BALANCING'
173224 , p_segment_value => l_segment
173225 , p_from_segment_code => l_adr_value_segment_code
173226 , p_from_combination_id => l_adr_value_combination_id
173227 , p_value_type_code => l_adr_value_type_code
173228 , p_transaction_coa_id => l_adr_transaction_coa_id
173229 , p_accounting_coa_id => l_adr_accounting_coa_id
173230 , p_flexfield_segment_code => l_adr_flexfield_segment_code
173231 , p_flex_value_set_id => l_adr_flex_value_set_id
173232 , p_adr_code => 'FA_EXPENSE_ACCT'
173233 , p_adr_type_code => 'S'
173234 , p_component_type => l_component_type
173235 , p_component_code => l_component_code
173236 , p_component_type_code => l_component_type_code
173237 , p_component_appl_id => l_component_appl_id
173238 , p_amb_context_code => l_amb_context_code
173239 , p_entity_code => 'TRANSACTIONS'
173240 , p_event_class_code => 'UNIT_ADJUSTMENTS'
173241 , p_side => 'NA'
173242 );
173243
173244 END IF;
173245
173246 l_segment := AcctDerRule_159(
173247 p_application_id => p_application_id
173248 , p_ae_header_id => l_ae_header_id
173249 , p_source_5 => p_source_5
173250 , p_source_22 => p_source_22
173251 , x_transaction_coa_id => l_adr_transaction_coa_id
173252 , x_accounting_coa_id => l_adr_accounting_coa_id
173253 , x_flexfield_segment_code => l_adr_flexfield_segment_code
173254 , x_flex_value_set_id => l_adr_flex_value_set_id
173255 , x_value_type_code => l_adr_value_type_code
173256 , x_value_combination_id => l_adr_value_combination_id
173257 , x_value_segment_code => l_adr_value_segment_code
173258 , p_side => 'NA'
173259 , p_override_seg_flag => 'Y'
173260 );
173261
173262 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
173263
173264 xla_ae_lines_pkg.set_segment(
173265 p_to_segment_code => 'GL_ACCOUNT'
173266 , p_segment_value => l_segment
173267 , p_from_segment_code => l_adr_value_segment_code
173268 , p_from_combination_id => l_adr_value_combination_id
173269 , p_value_type_code => l_adr_value_type_code
173270 , p_transaction_coa_id => l_adr_transaction_coa_id
173271 , p_accounting_coa_id => l_adr_accounting_coa_id
173272 , p_flexfield_segment_code => l_adr_flexfield_segment_code
173273 , p_flex_value_set_id => l_adr_flex_value_set_id
173274 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
173275 , p_adr_type_code => 'S'
173276 , p_component_type => l_component_type
173277 , p_component_code => l_component_code
173278 , p_component_type_code => l_component_type_code
173279 , p_component_appl_id => l_component_appl_id
173280 , p_amb_context_code => l_amb_context_code
173281 , p_entity_code => 'TRANSACTIONS'
173282 , p_event_class_code => 'UNIT_ADJUSTMENTS'
173283 , p_side => 'NA'
173284 );
173285
173286 END IF;
173287
173288 --
173289 --
173290 END IF;
173291 --
173292 -- Bug 4922099
173293 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
173294 (NVL(l_enc_upg_option, 'N') = 'O')
173295 ) AND
173296 (l_bflow_method_code = 'PRIOR_ENTRY')
173297 )
173298 THEN
173299 IF
173300 --
173301 1 = 2
173302 --
173303 THEN
173304 xla_accounting_err_pkg.build_message
173305 (p_appli_s_name => 'XLA'
173306 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
173310 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
173307 ,p_token_1 => 'LINE_NUMBER'
173308 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
173309 ,p_token_2 => 'LINE_TYPE_NAME'
173311 l_component_type
173312 ,l_component_code
173313 ,l_component_type_code
173314 ,l_component_appl_id
173315 ,l_amb_context_code
173316 ,l_entity_code
173317 ,l_event_class_code
173318 )
173319 ,p_token_3 => 'OWNER'
173320 ,p_value_3 => xla_lookups_pkg.get_meaning(
173321 p_lookup_type => 'XLA_OWNER_TYPE'
173322 ,p_lookup_code => l_component_type_code
173323 )
173324 ,p_token_4 => 'PRODUCT_NAME'
173325 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
173326 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
173327 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
173328 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
173329 ,p_ae_header_id => NULL
173330 );
173331
173332 IF (C_LEVEL_ERROR>= g_log_level) THEN
173333 trace
173334 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
173335 ,p_level => C_LEVEL_ERROR
173336 ,p_module => l_log_module);
173337 END IF;
173338 END IF;
173339 END IF;
173340 --
173341 --
173342 ------------------------------------------------------------------------------------------------
173343 -- 4219869 Business Flow
173344 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
173345 -- Prior Entry. Currently, the following code is always generated.
173346 ------------------------------------------------------------------------------------------------
173347 XLA_AE_LINES_PKG.ValidateCurrentLine;
173348
173349 ------------------------------------------------------------------------------------
173350 -- 4219869 Business Flow
173351 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
173352 ------------------------------------------------------------------------------------
173353 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
173354
173355 ----------------------------------------------------------------------------------
173356 -- 4219869 Business Flow
173357 -- Update journal entry status -- Need to generate this within IF <condition>
173358 ----------------------------------------------------------------------------------
173359 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
173360 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
173361 ,p_balance_type_code => l_balance_type_code
173362 );
173363
173364 -------------------------------------------------------------------------------------------
173365 -- 4262811 - Generate the Accrual Reversal lines
173366 -------------------------------------------------------------------------------------------
173367 BEGIN
173368 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
173369 (g_array_event(p_event_id).array_value_num('header_index'));
173370 IF l_acc_rev_flag IS NULL THEN
173371 l_acc_rev_flag := 'N';
173372 END IF;
173373 EXCEPTION
173374 WHEN OTHERS THEN
173375 l_acc_rev_flag := 'N';
173376 END;
173377 --
173378 IF (l_acc_rev_flag = 'Y') THEN
173379
173380 -- 4645092 ------------------------------------------------------------------------------
173381 -- To allow MPA report to determine if it should generate report process
173382 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
173383 ------------------------------------------------------------------------------------------
173384
173385 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
173386 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
173387 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
173388 -- call ADRs
173389 -- Bug 4922099
173390 --
173391 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
173392 (NVL(l_actual_upg_option, 'N') = 'O') OR
173393 (NVL(l_enc_upg_option, 'N') = 'O')
173394 )
173395 THEN
173396 NULL;
173397 --
173398 --
173399
173400 l_ccid := AcctDerRule_174(
173404 , p_source_32 => p_source_32
173401 p_application_id => p_application_id
173402 , p_ae_header_id => l_ae_header_id
173403 , p_source_5 => p_source_5
173405 , x_transaction_coa_id => l_adr_transaction_coa_id
173406 , x_accounting_coa_id => l_adr_accounting_coa_id
173407 , x_value_type_code => l_adr_value_type_code
173408 , p_side => 'NA'
173409 );
173410
173411 xla_ae_lines_pkg.set_ccid(
173412 p_code_combination_id => l_ccid
173413 , p_value_type_code => l_adr_value_type_code
173414 , p_transaction_coa_id => l_adr_transaction_coa_id
173415 , p_accounting_coa_id => l_adr_accounting_coa_id
173416 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
173417 , p_adr_type_code => 'S'
173418 , p_component_type => l_component_type
173419 , p_component_code => l_component_code
173420 , p_component_type_code => l_component_type_code
173421 , p_component_appl_id => l_component_appl_id
173422 , p_amb_context_code => l_amb_context_code
173423 , p_side => 'NA'
173424 );
173425
173426
173427 l_segment := AcctDerRule_169(
173428 p_application_id => p_application_id
173429 , p_ae_header_id => l_ae_header_id
173430 , p_source_5 => p_source_5
173431 , p_source_31 => p_source_31
173432 , x_transaction_coa_id => l_adr_transaction_coa_id
173433 , x_accounting_coa_id => l_adr_accounting_coa_id
173434 , x_flexfield_segment_code => l_adr_flexfield_segment_code
173435 , x_flex_value_set_id => l_adr_flex_value_set_id
173436 , x_value_type_code => l_adr_value_type_code
173437 , x_value_combination_id => l_adr_value_combination_id
173438 , x_value_segment_code => l_adr_value_segment_code
173439 , p_side => 'NA'
173440 , p_override_seg_flag => 'Y'
173441 );
173442
173443 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
173444
173445 xla_ae_lines_pkg.set_segment(
173446 p_to_segment_code => 'GL_BALANCING'
173447 , p_segment_value => l_segment
173448 , p_from_segment_code => l_adr_value_segment_code
173449 , p_from_combination_id => l_adr_value_combination_id
173450 , p_value_type_code => l_adr_value_type_code
173451 , p_transaction_coa_id => l_adr_transaction_coa_id
173452 , p_accounting_coa_id => l_adr_accounting_coa_id
173453 , p_flexfield_segment_code => l_adr_flexfield_segment_code
173454 , p_flex_value_set_id => l_adr_flex_value_set_id
173455 , p_adr_code => 'FA_EXPENSE_ACCT'
173456 , p_adr_type_code => 'S'
173457 , p_component_type => l_component_type
173458 , p_component_code => l_component_code
173459 , p_component_type_code => l_component_type_code
173460 , p_component_appl_id => l_component_appl_id
173461 , p_amb_context_code => l_amb_context_code
173462 , p_entity_code => 'TRANSACTIONS'
173463 , p_event_class_code => 'UNIT_ADJUSTMENTS'
173464 , p_side => 'NA'
173465 );
173466
173467 END IF;
173468
173469 l_segment := AcctDerRule_159(
173470 p_application_id => p_application_id
173471 , p_ae_header_id => l_ae_header_id
173472 , p_source_5 => p_source_5
173473 , p_source_22 => p_source_22
173474 , x_transaction_coa_id => l_adr_transaction_coa_id
173475 , x_accounting_coa_id => l_adr_accounting_coa_id
173476 , x_flexfield_segment_code => l_adr_flexfield_segment_code
173477 , x_flex_value_set_id => l_adr_flex_value_set_id
173478 , x_value_type_code => l_adr_value_type_code
173479 , x_value_combination_id => l_adr_value_combination_id
173480 , x_value_segment_code => l_adr_value_segment_code
173481 , p_side => 'NA'
173482 , p_override_seg_flag => 'Y'
173483 );
173484
173485 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
173486
173487 xla_ae_lines_pkg.set_segment(
173488 p_to_segment_code => 'GL_ACCOUNT'
173489 , p_segment_value => l_segment
173490 , p_from_segment_code => l_adr_value_segment_code
173491 , p_from_combination_id => l_adr_value_combination_id
173492 , p_value_type_code => l_adr_value_type_code
173493 , p_transaction_coa_id => l_adr_transaction_coa_id
173494 , p_accounting_coa_id => l_adr_accounting_coa_id
173495 , p_flexfield_segment_code => l_adr_flexfield_segment_code
173496 , p_flex_value_set_id => l_adr_flex_value_set_id
173497 , p_adr_code => 'FA_IC_RECEIVABLE_ACCOUNT'
173498 , p_adr_type_code => 'S'
173499 , p_component_type => l_component_type
173500 , p_component_code => l_component_code
173501 , p_component_type_code => l_component_type_code
173502 , p_component_appl_id => l_component_appl_id
173503 , p_amb_context_code => l_amb_context_code
173504 , p_entity_code => 'TRANSACTIONS'
173505 , p_event_class_code => 'UNIT_ADJUSTMENTS'
173509 END IF;
173506 , p_side => 'NA'
173507 );
173508
173510
173511 --
173512 --
173513 END IF;
173514
173515 --
173516 -- Update the line information that should be overwritten
173517 --
173518 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
173519 p_header_num => 1);
173520 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
173521
173522 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
173523
173524 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
173525 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
173526 END IF;
173527
173528 --
173529 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
173530 --
173531 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
173532 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
173533 ELSE
173534 ---------------------------------------------------------------------------------------------------
173535 -- 4262811a Switch Sign
173536 ---------------------------------------------------------------------------------------------------
173537 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
173538 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
173539 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
173540 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
173541 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
173542 -- 5132302
173543 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
173544 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
173545
173546 END IF;
173547
173548 -- 4955764
173549 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
173550 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
173551
173552
173553 XLA_AE_LINES_PKG.ValidateCurrentLine;
173554 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
173555
173556 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
173557 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
173558 ,p_balance_type_code => l_balance_type_code);
173559
173560 END IF;
173561
173562 -----------------------------------------------------------------------------------------
173563 -- 4262811 Multiperiod Accounting
173564 -----------------------------------------------------------------------------------------
173565 -- No MPA option is assigned.
173566
173567
173568 END IF;
173569 END IF;
173570 --
173571
173572 --
173573 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
173574 trace
173575 (p_msg => 'END of AcctLineType_408'
173576 ,p_level => C_LEVEL_PROCEDURE
173577 ,p_module => l_log_module);
173578 END IF;
173579 --
173580 EXCEPTION
173581 WHEN xla_exceptions_pkg.application_exception THEN
173582 RAISE;
173583 WHEN OTHERS THEN
173584 xla_exceptions_pkg.raise_message
173585 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_408');
173586 END AcctLineType_408;
173587 --
173588
173589 ---------------------------------------
173590 --
173591 -- PRIVATE FUNCTION
173592 -- AcctLineType_409
173593 --
173594 ---------------------------------------
173595 PROCEDURE AcctLineType_409 (
173596 p_application_id IN NUMBER
173597 ,p_event_id IN NUMBER
173598 ,p_calculate_acctd_flag IN VARCHAR2
173599 ,p_calculate_g_l_flag IN VARCHAR2
173600 ,p_actual_flag IN OUT VARCHAR2
173601 ,p_balance_type_code OUT VARCHAR2
173602 ,p_gain_or_loss_ref OUT VARCHAR2
173603
173604 --Period Close Date
173605 , p_source_1 IN DATE
173606 --Bonus Depreciation Expense Account
173607 , p_source_4 IN VARCHAR2
173608 --Generated Code Combination Identifier
173609 , p_source_5 IN NUMBER
173610 --Expense Account Code Combination Identifier
173611 , p_source_31 IN NUMBER
173612 --Adjustment Type
173613 , p_source_48 IN VARCHAR2
173614 --Transaction Header Identifier
173615 , p_source_49 IN NUMBER
173616 --Adjustment Line Identifier
173617 , p_source_50 IN NUMBER
173618 --Distribution Type Code
173619 , p_source_51 IN VARCHAR2
173620 --Entered Amount
173621 , p_source_52 IN NUMBER
173622 --Currency Code
173623 , p_source_53 IN VARCHAR2
173624 --Source Destination Code
173625 , p_source_55 IN VARCHAR2
173626 )
173627 IS
173628
173629 l_component_type VARCHAR2(80);
173630 l_component_code VARCHAR2(30);
173631 l_component_type_code VARCHAR2(1);
173632 l_component_appl_id INTEGER;
173633 l_amb_context_code VARCHAR2(30);
173634 l_entity_code VARCHAR2(30);
173638 l_line_definition_code VARCHAR2(30);
173635 l_event_class_code VARCHAR2(30);
173636 l_ae_header_id NUMBER;
173637 l_event_type_code VARCHAR2(30);
173639 l_line_definition_owner_code VARCHAR2(1);
173640 --
173641 -- adr variables
173642 l_segment VARCHAR2(30);
173643 l_ccid NUMBER;
173644 l_adr_transaction_coa_id NUMBER;
173645 l_adr_accounting_coa_id NUMBER;
173646 l_adr_flexfield_segment_code VARCHAR2(30);
173647 l_adr_flex_value_set_id NUMBER;
173648 l_adr_value_type_code VARCHAR2(30);
173649 l_adr_value_combination_id NUMBER;
173650 l_adr_value_segment_code VARCHAR2(30);
173651
173652 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
173653 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
173654 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
173655 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
173656
173657 -- 4262811 Variables ------------------------------------------------------------------------------------------
173658 l_entered_amt_idx NUMBER;
173659 l_accted_amt_idx NUMBER;
173660 l_acc_rev_flag VARCHAR2(1);
173661 l_accrual_line_num NUMBER;
173662 l_tmp_amt NUMBER;
173663 l_acc_rev_natural_side_code VARCHAR2(1);
173664
173665 l_num_entries NUMBER;
173666 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
173667 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
173668 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
173669 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
173670 l_recog_line_1 NUMBER;
173671 l_recog_line_2 NUMBER;
173672
173673 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
173674 l_bflow_applied_to_amt NUMBER; -- 5132302
173675 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
173676
173677 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
173678
173679 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
173680 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
173681
173682 ---------------------------------------------------------------------------------------------------------------
173683
173684
173685 --
173686 -- bulk performance
173687 --
173688 l_balance_type_code VARCHAR2(1);
173689 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
173690 l_log_module VARCHAR2(240);
173691
173692 --
173693 -- Upgrade strategy
173694 --
173695 l_actual_upg_option VARCHAR2(1);
173696 l_enc_upg_option VARCHAR2(1);
173697
173698 --
173699 BEGIN
173700 --
173701 IF g_log_enabled THEN
173702 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_409';
173703 END IF;
173704 --
173705 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
173706
173707 trace
173708 (p_msg => 'BEGIN of AcctLineType_409'
173709 ,p_level => C_LEVEL_PROCEDURE
173710 ,p_module => l_log_module);
173711
173712 END IF;
173713 --
173714 l_component_type := 'AMB_JLT';
173715 l_component_code := 'FA_UNITADJ_SOURCE_BONUS_EXP';
173716 l_component_type_code := 'S';
173717 l_component_appl_id := 140;
173718 l_amb_context_code := 'DEFAULT';
173719 l_entity_code := 'TRANSACTIONS';
173720 l_event_class_code := 'UNIT_ADJUSTMENTS';
173721 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
173722 l_line_definition_owner_code := 'S';
173723 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
173724 --
173725 l_balance_type_code := 'A';
173726 l_segment := NULL;
173727 l_ccid := NULL;
173728 l_adr_transaction_coa_id := NULL;
173729 l_adr_accounting_coa_id := NULL;
173730 l_adr_flexfield_segment_code := NULL;
173731 l_adr_flex_value_set_id := NULL;
173732 l_adr_value_type_code := NULL;
173733 l_adr_value_combination_id := NULL;
173734 l_adr_value_segment_code := NULL;
173735
173736 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
173737 l_bflow_class_code := ''; -- 4219869 Business Flow
173738 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
173739 l_budgetary_control_flag := 'N';
173740
173741 l_bflow_applied_to_amt_idx := NULL; -- 5132302
173742 l_bflow_applied_to_amt := NULL; -- 5132302
173743 l_entered_amt_idx := NULL; -- 4262811
173744 l_accted_amt_idx := NULL; -- 4262811
173745 l_acc_rev_flag := NULL; -- 4262811
173746 l_accrual_line_num := NULL; -- 4262811
173747 l_tmp_amt := NULL; -- 4262811
173748 --
173749
173750 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
173751 l_balance_type_code <> 'B' THEN
173752 IF NVL(p_source_48,'
173753 ') = 'BONUS EXPENSE' AND
173754 NVL(p_source_55,'
173755 ') = 'SOURCE'
173756 THEN
173757
173758 --
173759 XLA_AE_LINES_PKG.SetNewLine;
173760
173761 p_balance_type_code := l_balance_type_code;
173762 -- set the flag so later we will know whether the gain loss line needs to be created
173763
173767
173764 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
173765 p_actual_flag :='A';
173766 END IF;
173768 --
173769 -- bulk performance
173770 --
173771 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
173772 p_header_num => 0); -- 4262811
173773 --
173774 -- set accounting line options
173775 --
173776 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
173777 p_natural_side_code => 'C'
173778 , p_gain_or_loss_flag => 'N'
173779 , p_gl_transfer_mode_code => 'S'
173780 , p_acct_entry_type_code => 'A'
173781 , p_switch_side_flag => 'Y'
173782 , p_merge_duplicate_code => 'N'
173783 );
173784 --
173785 l_acc_rev_natural_side_code := 'D'; -- 4262811
173786 --
173787 --
173788 -- set accounting line type info
173789 --
173790 xla_ae_lines_pkg.SetAcctLineType
173791 (p_component_type => l_component_type
173792 ,p_event_type_code => l_event_type_code
173793 ,p_line_definition_owner_code => l_line_definition_owner_code
173794 ,p_line_definition_code => l_line_definition_code
173795 ,p_accounting_line_code => l_component_code
173796 ,p_accounting_line_type_code => l_component_type_code
173797 ,p_accounting_line_appl_id => l_component_appl_id
173798 ,p_amb_context_code => l_amb_context_code
173799 ,p_entity_code => l_entity_code
173800 ,p_event_class_code => l_event_class_code);
173801 --
173802 -- set accounting class
173803 --
173804 xla_ae_lines_pkg.SetAcctClass(
173805 p_accounting_class_code => 'EXPENSE'
173806 , p_ae_header_id => l_ae_header_id
173807 );
173808
173809 --
173810 -- set rounding class
173811 --
173812 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
173813 'EXPENSE';
173814
173815 --
173816 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
173817 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
173818 --
173819 -- bulk performance
173820 --
173821 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
173822
173823 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
173824 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
173825
173826 -- 4955764
173827 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
173828 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
173829
173830 -- 4458381 Public Sector Enh
173831
173832 --
173833 -- set accounting attributes for the line type
173834 --
173835 l_entered_amt_idx := 4;
173836 l_accted_amt_idx := 6;
173837 l_bflow_applied_to_amt_idx := NULL; -- 5132302
173838 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
173839 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
173840 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
173841 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
173842 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
173843 l_rec_acct_attrs.array_char_value(3) := p_source_51;
173844 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
173845 l_rec_acct_attrs.array_num_value(4) := p_source_52;
173846 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
173847 l_rec_acct_attrs.array_char_value(5) := p_source_53;
173848 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
173849 l_rec_acct_attrs.array_num_value(6) := p_source_52;
173850
173851 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
173852 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
173853
173854 ---------------------------------------------------------------------------------------------------------------
173855 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
173856 ---------------------------------------------------------------------------------------------------------------
173857 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
173858
173859 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
173860 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
173861
173862 IF xla_accounting_cache_pkg.GetValueChar
173863 (p_source_code => 'LEDGER_CATEGORY_CODE'
173864 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
173865 AND l_bflow_method_code = 'PRIOR_ENTRY'
173866 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
173867 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
173868 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
173869 )
173870 THEN
173871 xla_ae_lines_pkg.BflowUpgEntry
173872 (p_business_method_code => l_bflow_method_code
173873 ,p_business_class_code => l_bflow_class_code
173874 ,p_balance_type => l_balance_type_code);
173878 END IF;
173875 ELSE
173876 NULL;
173877 -- No business flow processing for business flow method of NONE.
173879
173880 --
173881 -- call analytical criteria
173882 --
173883
173884 --
173885 -- call description
173886 --
173887
173888 xla_ae_lines_pkg.SetLineDescription(
173889 p_ae_header_id => l_ae_header_id
173890 ,p_description => Description_139 (
173891 p_application_id => p_application_id
173892 , p_ae_header_id => l_ae_header_id
173893 , p_source_1 => p_source_1
173894 )
173895 );
173896
173897
173898 --
173899 -- call ADRs
173900 -- Bug 4922099
173901 --
173902 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
173903 (NVL(l_actual_upg_option, 'N') = 'O') OR
173904 (NVL(l_enc_upg_option, 'N') = 'O')
173905 )
173906 THEN
173907 NULL;
173908 --
173909 --
173910
173911 l_ccid := AcctDerRule_176(
173912 p_application_id => p_application_id
173913 , p_ae_header_id => l_ae_header_id
173914 , p_source_5 => p_source_5
173915 , p_source_31 => p_source_31
173916 , x_transaction_coa_id => l_adr_transaction_coa_id
173917 , x_accounting_coa_id => l_adr_accounting_coa_id
173918 , x_value_type_code => l_adr_value_type_code
173919 , p_side => 'NA'
173920 );
173921
173922 xla_ae_lines_pkg.set_ccid(
173923 p_code_combination_id => l_ccid
173924 , p_value_type_code => l_adr_value_type_code
173925 , p_transaction_coa_id => l_adr_transaction_coa_id
173926 , p_accounting_coa_id => l_adr_accounting_coa_id
173927 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
173928 , p_adr_type_code => 'S'
173929 , p_component_type => l_component_type
173930 , p_component_code => l_component_code
173931 , p_component_type_code => l_component_type_code
173932 , p_component_appl_id => l_component_appl_id
173933 , p_amb_context_code => l_amb_context_code
173934 , p_side => 'NA'
173935 );
173936
173937
173938 l_segment := AcctDerRule_144(
173939 p_application_id => p_application_id
173940 , p_ae_header_id => l_ae_header_id
173941 , p_source_4 => p_source_4
173942 , p_source_5 => p_source_5
173943 , x_transaction_coa_id => l_adr_transaction_coa_id
173944 , x_accounting_coa_id => l_adr_accounting_coa_id
173945 , x_flexfield_segment_code => l_adr_flexfield_segment_code
173946 , x_flex_value_set_id => l_adr_flex_value_set_id
173947 , x_value_type_code => l_adr_value_type_code
173948 , x_value_combination_id => l_adr_value_combination_id
173949 , x_value_segment_code => l_adr_value_segment_code
173950 , p_side => 'NA'
173951 , p_override_seg_flag => 'Y'
173952 );
173953
173954 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
173955
173956 xla_ae_lines_pkg.set_segment(
173957 p_to_segment_code => 'GL_ACCOUNT'
173958 , p_segment_value => l_segment
173959 , p_from_segment_code => l_adr_value_segment_code
173960 , p_from_combination_id => l_adr_value_combination_id
173961 , p_value_type_code => l_adr_value_type_code
173962 , p_transaction_coa_id => l_adr_transaction_coa_id
173963 , p_accounting_coa_id => l_adr_accounting_coa_id
173964 , p_flexfield_segment_code => l_adr_flexfield_segment_code
173965 , p_flex_value_set_id => l_adr_flex_value_set_id
173966 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
173967 , p_adr_type_code => 'S'
173968 , p_component_type => l_component_type
173969 , p_component_code => l_component_code
173970 , p_component_type_code => l_component_type_code
173971 , p_component_appl_id => l_component_appl_id
173972 , p_amb_context_code => l_amb_context_code
173973 , p_entity_code => 'TRANSACTIONS'
173974 , p_event_class_code => 'UNIT_ADJUSTMENTS'
173975 , p_side => 'NA'
173976 );
173977
173978 END IF;
173979
173980 --
173981 --
173982 END IF;
173983 --
173984 -- Bug 4922099
173985 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
173986 (NVL(l_enc_upg_option, 'N') = 'O')
173987 ) AND
173988 (l_bflow_method_code = 'PRIOR_ENTRY')
173989 )
173990 THEN
173991 IF
173992 --
173993 1 = 2
173994 --
173995 THEN
173996 xla_accounting_err_pkg.build_message
173997 (p_appli_s_name => 'XLA'
173998 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
173999 ,p_token_1 => 'LINE_NUMBER'
174000 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
174001 ,p_token_2 => 'LINE_TYPE_NAME'
174002 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
174006 ,l_component_appl_id
174003 l_component_type
174004 ,l_component_code
174005 ,l_component_type_code
174007 ,l_amb_context_code
174008 ,l_entity_code
174009 ,l_event_class_code
174010 )
174011 ,p_token_3 => 'OWNER'
174012 ,p_value_3 => xla_lookups_pkg.get_meaning(
174013 p_lookup_type => 'XLA_OWNER_TYPE'
174014 ,p_lookup_code => l_component_type_code
174015 )
174016 ,p_token_4 => 'PRODUCT_NAME'
174017 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
174018 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
174019 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
174020 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
174021 ,p_ae_header_id => NULL
174022 );
174023
174024 IF (C_LEVEL_ERROR>= g_log_level) THEN
174025 trace
174026 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
174027 ,p_level => C_LEVEL_ERROR
174028 ,p_module => l_log_module);
174029 END IF;
174030 END IF;
174031 END IF;
174032 --
174033 --
174034 ------------------------------------------------------------------------------------------------
174035 -- 4219869 Business Flow
174036 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
174037 -- Prior Entry. Currently, the following code is always generated.
174038 ------------------------------------------------------------------------------------------------
174039 XLA_AE_LINES_PKG.ValidateCurrentLine;
174040
174041 ------------------------------------------------------------------------------------
174042 -- 4219869 Business Flow
174043 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
174044 ------------------------------------------------------------------------------------
174045 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
174046
174047 ----------------------------------------------------------------------------------
174048 -- 4219869 Business Flow
174049 -- Update journal entry status -- Need to generate this within IF <condition>
174050 ----------------------------------------------------------------------------------
174051 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
174052 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
174053 ,p_balance_type_code => l_balance_type_code
174054 );
174055
174056 -------------------------------------------------------------------------------------------
174057 -- 4262811 - Generate the Accrual Reversal lines
174058 -------------------------------------------------------------------------------------------
174059 BEGIN
174060 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
174061 (g_array_event(p_event_id).array_value_num('header_index'));
174062 IF l_acc_rev_flag IS NULL THEN
174063 l_acc_rev_flag := 'N';
174064 END IF;
174065 EXCEPTION
174066 WHEN OTHERS THEN
174067 l_acc_rev_flag := 'N';
174068 END;
174069 --
174070 IF (l_acc_rev_flag = 'Y') THEN
174071
174072 -- 4645092 ------------------------------------------------------------------------------
174073 -- To allow MPA report to determine if it should generate report process
174074 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
174075 ------------------------------------------------------------------------------------------
174076
174077 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
174078 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
174079 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
174080 -- call ADRs
174081 -- Bug 4922099
174082 --
174083 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
174084 (NVL(l_actual_upg_option, 'N') = 'O') OR
174085 (NVL(l_enc_upg_option, 'N') = 'O')
174086 )
174087 THEN
174088 NULL;
174089 --
174090 --
174091
174092 l_ccid := AcctDerRule_176(
174093 p_application_id => p_application_id
174094 , p_ae_header_id => l_ae_header_id
174095 , p_source_5 => p_source_5
174096 , p_source_31 => p_source_31
174097 , x_transaction_coa_id => l_adr_transaction_coa_id
174101 );
174098 , x_accounting_coa_id => l_adr_accounting_coa_id
174099 , x_value_type_code => l_adr_value_type_code
174100 , p_side => 'NA'
174102
174103 xla_ae_lines_pkg.set_ccid(
174104 p_code_combination_id => l_ccid
174105 , p_value_type_code => l_adr_value_type_code
174106 , p_transaction_coa_id => l_adr_transaction_coa_id
174107 , p_accounting_coa_id => l_adr_accounting_coa_id
174108 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
174109 , p_adr_type_code => 'S'
174110 , p_component_type => l_component_type
174111 , p_component_code => l_component_code
174112 , p_component_type_code => l_component_type_code
174113 , p_component_appl_id => l_component_appl_id
174114 , p_amb_context_code => l_amb_context_code
174115 , p_side => 'NA'
174116 );
174117
174118
174119 l_segment := AcctDerRule_144(
174120 p_application_id => p_application_id
174121 , p_ae_header_id => l_ae_header_id
174122 , p_source_4 => p_source_4
174123 , p_source_5 => p_source_5
174124 , x_transaction_coa_id => l_adr_transaction_coa_id
174125 , x_accounting_coa_id => l_adr_accounting_coa_id
174126 , x_flexfield_segment_code => l_adr_flexfield_segment_code
174127 , x_flex_value_set_id => l_adr_flex_value_set_id
174128 , x_value_type_code => l_adr_value_type_code
174129 , x_value_combination_id => l_adr_value_combination_id
174130 , x_value_segment_code => l_adr_value_segment_code
174131 , p_side => 'NA'
174132 , p_override_seg_flag => 'Y'
174133 );
174134
174135 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
174136
174137 xla_ae_lines_pkg.set_segment(
174138 p_to_segment_code => 'GL_ACCOUNT'
174139 , p_segment_value => l_segment
174140 , p_from_segment_code => l_adr_value_segment_code
174141 , p_from_combination_id => l_adr_value_combination_id
174142 , p_value_type_code => l_adr_value_type_code
174143 , p_transaction_coa_id => l_adr_transaction_coa_id
174144 , p_accounting_coa_id => l_adr_accounting_coa_id
174145 , p_flexfield_segment_code => l_adr_flexfield_segment_code
174146 , p_flex_value_set_id => l_adr_flex_value_set_id
174147 , p_adr_code => 'FA_BONUS_DEPRN_EXPENSE_SEGMENT'
174148 , p_adr_type_code => 'S'
174149 , p_component_type => l_component_type
174150 , p_component_code => l_component_code
174151 , p_component_type_code => l_component_type_code
174152 , p_component_appl_id => l_component_appl_id
174153 , p_amb_context_code => l_amb_context_code
174154 , p_entity_code => 'TRANSACTIONS'
174155 , p_event_class_code => 'UNIT_ADJUSTMENTS'
174156 , p_side => 'NA'
174157 );
174158
174159 END IF;
174160
174161 --
174162 --
174163 END IF;
174164
174165 --
174166 -- Update the line information that should be overwritten
174167 --
174168 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
174169 p_header_num => 1);
174170 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
174171
174172 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
174173
174174 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
174175 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
174176 END IF;
174177
174178 --
174179 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
174180 --
174181 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
174182 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
174183 ELSE
174184 ---------------------------------------------------------------------------------------------------
174185 -- 4262811a Switch Sign
174186 ---------------------------------------------------------------------------------------------------
174187 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
174188 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
174189 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
174190 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
174191 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
174192 -- 5132302
174193 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
174194 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
174195
174196 END IF;
174197
174198 -- 4955764
174199 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
174200 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
174201
174202
174206 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
174203 XLA_AE_LINES_PKG.ValidateCurrentLine;
174204 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
174205
174207 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
174208 ,p_balance_type_code => l_balance_type_code);
174209
174210 END IF;
174211
174212 -----------------------------------------------------------------------------------------
174213 -- 4262811 Multiperiod Accounting
174214 -----------------------------------------------------------------------------------------
174215 -- No MPA option is assigned.
174216
174217
174218 END IF;
174219 END IF;
174220 --
174221
174222 --
174223 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
174224 trace
174225 (p_msg => 'END of AcctLineType_409'
174226 ,p_level => C_LEVEL_PROCEDURE
174227 ,p_module => l_log_module);
174228 END IF;
174229 --
174230 EXCEPTION
174231 WHEN xla_exceptions_pkg.application_exception THEN
174232 RAISE;
174233 WHEN OTHERS THEN
174234 xla_exceptions_pkg.raise_message
174235 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_409');
174236 END AcctLineType_409;
174237 --
174238
174239 ---------------------------------------
174240 --
174241 -- PRIVATE FUNCTION
174242 -- AcctLineType_410
174243 --
174244 ---------------------------------------
174245 PROCEDURE AcctLineType_410 (
174246 p_application_id IN NUMBER
174247 ,p_event_id IN NUMBER
174248 ,p_calculate_acctd_flag IN VARCHAR2
174249 ,p_calculate_g_l_flag IN VARCHAR2
174250 ,p_actual_flag IN OUT VARCHAR2
174251 ,p_balance_type_code OUT VARCHAR2
174252 ,p_gain_or_loss_ref OUT VARCHAR2
174253
174254 --Period Close Date
174255 , p_source_1 IN DATE
174256 --Generated Code Combination Identifier
174257 , p_source_5 IN NUMBER
174258 --Bonus Reserve Account
174259 , p_source_6 IN VARCHAR2
174260 --Generated Offset Code Combination Identifier
174261 , p_source_19 IN NUMBER
174262 --Expense Account Code Combination Identifier
174263 , p_source_31 IN NUMBER
174264 --Default Code Combination Identifier
174265 , p_source_32 IN NUMBER
174266 --Adjustment Type
174267 , p_source_48 IN VARCHAR2
174268 --Transaction Header Identifier
174269 , p_source_49 IN NUMBER
174270 --Adjustment Line Identifier
174271 , p_source_50 IN NUMBER
174272 --Distribution Type Code
174273 , p_source_51 IN VARCHAR2
174274 --Entered Amount
174275 , p_source_52 IN NUMBER
174276 --Currency Code
174277 , p_source_53 IN VARCHAR2
174278 --Source Destination Code
174279 , p_source_55 IN VARCHAR2
174280 )
174281 IS
174282
174283 l_component_type VARCHAR2(80);
174284 l_component_code VARCHAR2(30);
174285 l_component_type_code VARCHAR2(1);
174286 l_component_appl_id INTEGER;
174287 l_amb_context_code VARCHAR2(30);
174288 l_entity_code VARCHAR2(30);
174289 l_event_class_code VARCHAR2(30);
174290 l_ae_header_id NUMBER;
174291 l_event_type_code VARCHAR2(30);
174292 l_line_definition_code VARCHAR2(30);
174293 l_line_definition_owner_code VARCHAR2(1);
174294 --
174295 -- adr variables
174296 l_segment VARCHAR2(30);
174297 l_ccid NUMBER;
174298 l_adr_transaction_coa_id NUMBER;
174299 l_adr_accounting_coa_id NUMBER;
174300 l_adr_flexfield_segment_code VARCHAR2(30);
174301 l_adr_flex_value_set_id NUMBER;
174302 l_adr_value_type_code VARCHAR2(30);
174303 l_adr_value_combination_id NUMBER;
174304 l_adr_value_segment_code VARCHAR2(30);
174305
174306 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
174307 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
174308 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
174309 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
174310
174311 -- 4262811 Variables ------------------------------------------------------------------------------------------
174312 l_entered_amt_idx NUMBER;
174313 l_accted_amt_idx NUMBER;
174314 l_acc_rev_flag VARCHAR2(1);
174315 l_accrual_line_num NUMBER;
174316 l_tmp_amt NUMBER;
174317 l_acc_rev_natural_side_code VARCHAR2(1);
174318
174319 l_num_entries NUMBER;
174320 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
174321 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
174322 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
174323 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
174324 l_recog_line_1 NUMBER;
174325 l_recog_line_2 NUMBER;
174326
174327 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
174328 l_bflow_applied_to_amt NUMBER; -- 5132302
174329 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
174330
174331 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
174332
174333 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
174334 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
174335
174339 --
174336 ---------------------------------------------------------------------------------------------------------------
174337
174338
174340 -- bulk performance
174341 --
174342 l_balance_type_code VARCHAR2(1);
174343 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
174344 l_log_module VARCHAR2(240);
174345
174346 --
174347 -- Upgrade strategy
174348 --
174349 l_actual_upg_option VARCHAR2(1);
174350 l_enc_upg_option VARCHAR2(1);
174351
174352 --
174353 BEGIN
174354 --
174355 IF g_log_enabled THEN
174356 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_410';
174357 END IF;
174358 --
174359 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
174360
174361 trace
174362 (p_msg => 'BEGIN of AcctLineType_410'
174363 ,p_level => C_LEVEL_PROCEDURE
174364 ,p_module => l_log_module);
174365
174366 END IF;
174367 --
174368 l_component_type := 'AMB_JLT';
174369 l_component_code := 'FA_UNITADJ_SOURCE_BONUS_RES';
174370 l_component_type_code := 'S';
174371 l_component_appl_id := 140;
174372 l_amb_context_code := 'DEFAULT';
174373 l_entity_code := 'TRANSACTIONS';
174374 l_event_class_code := 'UNIT_ADJUSTMENTS';
174375 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
174376 l_line_definition_owner_code := 'S';
174377 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
174378 --
174379 l_balance_type_code := 'A';
174380 l_segment := NULL;
174381 l_ccid := NULL;
174382 l_adr_transaction_coa_id := NULL;
174383 l_adr_accounting_coa_id := NULL;
174384 l_adr_flexfield_segment_code := NULL;
174385 l_adr_flex_value_set_id := NULL;
174386 l_adr_value_type_code := NULL;
174387 l_adr_value_combination_id := NULL;
174388 l_adr_value_segment_code := NULL;
174389
174390 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
174391 l_bflow_class_code := ''; -- 4219869 Business Flow
174392 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
174393 l_budgetary_control_flag := 'N';
174394
174395 l_bflow_applied_to_amt_idx := NULL; -- 5132302
174396 l_bflow_applied_to_amt := NULL; -- 5132302
174397 l_entered_amt_idx := NULL; -- 4262811
174398 l_accted_amt_idx := NULL; -- 4262811
174399 l_acc_rev_flag := NULL; -- 4262811
174400 l_accrual_line_num := NULL; -- 4262811
174401 l_tmp_amt := NULL; -- 4262811
174402 --
174403
174404 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
174405 l_balance_type_code <> 'B' THEN
174406 IF (NVL(p_source_48,'
174407 ') = 'BONUS EXPENSE' OR
174408 NVL(p_source_48,'
174409 ') = 'BONUS RESERVE') AND
174410 NVL(p_source_55,'
174411 ') = 'SOURCE'
174412 THEN
174413
174414 --
174415 XLA_AE_LINES_PKG.SetNewLine;
174416
174417 p_balance_type_code := l_balance_type_code;
174418 -- set the flag so later we will know whether the gain loss line needs to be created
174419
174420 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
174421 p_actual_flag :='A';
174422 END IF;
174423
174424 --
174425 -- bulk performance
174426 --
174427 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
174428 p_header_num => 0); -- 4262811
174429 --
174430 -- set accounting line options
174431 --
174432 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
174433 p_natural_side_code => 'D'
174434 , p_gain_or_loss_flag => 'N'
174435 , p_gl_transfer_mode_code => 'S'
174436 , p_acct_entry_type_code => 'A'
174437 , p_switch_side_flag => 'Y'
174438 , p_merge_duplicate_code => 'N'
174439 );
174440 --
174441 l_acc_rev_natural_side_code := 'C'; -- 4262811
174442 --
174443 --
174444 -- set accounting line type info
174445 --
174446 xla_ae_lines_pkg.SetAcctLineType
174447 (p_component_type => l_component_type
174448 ,p_event_type_code => l_event_type_code
174449 ,p_line_definition_owner_code => l_line_definition_owner_code
174450 ,p_line_definition_code => l_line_definition_code
174451 ,p_accounting_line_code => l_component_code
174452 ,p_accounting_line_type_code => l_component_type_code
174453 ,p_accounting_line_appl_id => l_component_appl_id
174454 ,p_amb_context_code => l_amb_context_code
174455 ,p_entity_code => l_entity_code
174456 ,p_event_class_code => l_event_class_code);
174457 --
174458 -- set accounting class
174459 --
174460 xla_ae_lines_pkg.SetAcctClass(
174461 p_accounting_class_code => 'ASSET'
174462 , p_ae_header_id => l_ae_header_id
174463 );
174464
174465 --
174466 -- set rounding class
174467 --
174468 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
174469 'ASSET';
174470
174471 --
174472 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
174476 --
174473 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
174474 --
174475 -- bulk performance
174477 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
174478
174479 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
174480 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
174481
174482 -- 4955764
174483 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
174484 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
174485
174486 -- 4458381 Public Sector Enh
174487
174488 --
174489 -- set accounting attributes for the line type
174490 --
174491 l_entered_amt_idx := 4;
174492 l_accted_amt_idx := 6;
174493 l_bflow_applied_to_amt_idx := NULL; -- 5132302
174494 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
174495 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
174496 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
174497 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
174498 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
174499 l_rec_acct_attrs.array_char_value(3) := p_source_51;
174500 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
174501 l_rec_acct_attrs.array_num_value(4) := p_source_52;
174502 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
174503 l_rec_acct_attrs.array_char_value(5) := p_source_53;
174504 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
174505 l_rec_acct_attrs.array_num_value(6) := p_source_52;
174506
174507 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
174508 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
174509
174510 ---------------------------------------------------------------------------------------------------------------
174511 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
174512 ---------------------------------------------------------------------------------------------------------------
174513 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
174514
174515 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
174516 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
174517
174518 IF xla_accounting_cache_pkg.GetValueChar
174519 (p_source_code => 'LEDGER_CATEGORY_CODE'
174520 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
174521 AND l_bflow_method_code = 'PRIOR_ENTRY'
174522 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
174523 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
174524 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
174525 )
174526 THEN
174527 xla_ae_lines_pkg.BflowUpgEntry
174528 (p_business_method_code => l_bflow_method_code
174529 ,p_business_class_code => l_bflow_class_code
174530 ,p_balance_type => l_balance_type_code);
174531 ELSE
174532 NULL;
174533 -- No business flow processing for business flow method of NONE.
174534 END IF;
174535
174536 --
174537 -- call analytical criteria
174538 --
174539
174540 --
174541 -- call description
174542 --
174543
174544 xla_ae_lines_pkg.SetLineDescription(
174545 p_ae_header_id => l_ae_header_id
174546 ,p_description => Description_132 (
174547 p_application_id => p_application_id
174548 , p_ae_header_id => l_ae_header_id
174549 , p_source_1 => p_source_1
174550 )
174551 );
174552
174553
174554 --
174555 -- call ADRs
174556 -- Bug 4922099
174557 --
174558 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
174559 (NVL(l_actual_upg_option, 'N') = 'O') OR
174560 (NVL(l_enc_upg_option, 'N') = 'O')
174561 )
174562 THEN
174563 NULL;
174564 --
174565 --
174566
174567 l_ccid := AcctDerRule_175(
174568 p_application_id => p_application_id
174569 , p_ae_header_id => l_ae_header_id
174570 , p_source_5 => p_source_5
174571 , p_source_19 => p_source_19
174572 , p_source_32 => p_source_32
174573 , x_transaction_coa_id => l_adr_transaction_coa_id
174574 , x_accounting_coa_id => l_adr_accounting_coa_id
174575 , x_value_type_code => l_adr_value_type_code
174576 , p_side => 'NA'
174577 );
174578
174579 xla_ae_lines_pkg.set_ccid(
174580 p_code_combination_id => l_ccid
174581 , p_value_type_code => l_adr_value_type_code
174582 , p_transaction_coa_id => l_adr_transaction_coa_id
174583 , p_accounting_coa_id => l_adr_accounting_coa_id
174584 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
174585 , p_adr_type_code => 'S'
174586 , p_component_type => l_component_type
174587 , p_component_code => l_component_code
174588 , p_component_type_code => l_component_type_code
174592 );
174589 , p_component_appl_id => l_component_appl_id
174590 , p_amb_context_code => l_amb_context_code
174591 , p_side => 'NA'
174593
174594
174595 l_segment := AcctDerRule_145(
174596 p_application_id => p_application_id
174597 , p_ae_header_id => l_ae_header_id
174598 , p_source_5 => p_source_5
174599 , p_source_6 => p_source_6
174600 , x_transaction_coa_id => l_adr_transaction_coa_id
174601 , x_accounting_coa_id => l_adr_accounting_coa_id
174602 , x_flexfield_segment_code => l_adr_flexfield_segment_code
174603 , x_flex_value_set_id => l_adr_flex_value_set_id
174604 , x_value_type_code => l_adr_value_type_code
174605 , x_value_combination_id => l_adr_value_combination_id
174606 , x_value_segment_code => l_adr_value_segment_code
174607 , p_side => 'NA'
174608 , p_override_seg_flag => 'Y'
174609 );
174610
174611 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
174612
174613 xla_ae_lines_pkg.set_segment(
174614 p_to_segment_code => 'GL_ACCOUNT'
174615 , p_segment_value => l_segment
174616 , p_from_segment_code => l_adr_value_segment_code
174617 , p_from_combination_id => l_adr_value_combination_id
174618 , p_value_type_code => l_adr_value_type_code
174619 , p_transaction_coa_id => l_adr_transaction_coa_id
174620 , p_accounting_coa_id => l_adr_accounting_coa_id
174621 , p_flexfield_segment_code => l_adr_flexfield_segment_code
174622 , p_flex_value_set_id => l_adr_flex_value_set_id
174623 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
174624 , p_adr_type_code => 'S'
174625 , p_component_type => l_component_type
174626 , p_component_code => l_component_code
174627 , p_component_type_code => l_component_type_code
174628 , p_component_appl_id => l_component_appl_id
174629 , p_amb_context_code => l_amb_context_code
174630 , p_entity_code => 'TRANSACTIONS'
174631 , p_event_class_code => 'UNIT_ADJUSTMENTS'
174632 , p_side => 'NA'
174633 );
174634
174635 END IF;
174636
174637 l_segment := AcctDerRule_169(
174638 p_application_id => p_application_id
174639 , p_ae_header_id => l_ae_header_id
174640 , p_source_5 => p_source_5
174641 , p_source_31 => p_source_31
174642 , x_transaction_coa_id => l_adr_transaction_coa_id
174643 , x_accounting_coa_id => l_adr_accounting_coa_id
174644 , x_flexfield_segment_code => l_adr_flexfield_segment_code
174645 , x_flex_value_set_id => l_adr_flex_value_set_id
174646 , x_value_type_code => l_adr_value_type_code
174647 , x_value_combination_id => l_adr_value_combination_id
174648 , x_value_segment_code => l_adr_value_segment_code
174649 , p_side => 'NA'
174650 , p_override_seg_flag => 'Y'
174651 );
174652
174653 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
174654
174655 xla_ae_lines_pkg.set_segment(
174656 p_to_segment_code => 'GL_BALANCING'
174657 , p_segment_value => l_segment
174658 , p_from_segment_code => l_adr_value_segment_code
174659 , p_from_combination_id => l_adr_value_combination_id
174660 , p_value_type_code => l_adr_value_type_code
174661 , p_transaction_coa_id => l_adr_transaction_coa_id
174662 , p_accounting_coa_id => l_adr_accounting_coa_id
174663 , p_flexfield_segment_code => l_adr_flexfield_segment_code
174664 , p_flex_value_set_id => l_adr_flex_value_set_id
174665 , p_adr_code => 'FA_EXPENSE_ACCT'
174666 , p_adr_type_code => 'S'
174667 , p_component_type => l_component_type
174668 , p_component_code => l_component_code
174669 , p_component_type_code => l_component_type_code
174670 , p_component_appl_id => l_component_appl_id
174671 , p_amb_context_code => l_amb_context_code
174672 , p_entity_code => 'TRANSACTIONS'
174673 , p_event_class_code => 'UNIT_ADJUSTMENTS'
174674 , p_side => 'NA'
174675 );
174676
174677 END IF;
174678
174679 --
174680 --
174681 END IF;
174682 --
174683 -- Bug 4922099
174684 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
174685 (NVL(l_enc_upg_option, 'N') = 'O')
174686 ) AND
174687 (l_bflow_method_code = 'PRIOR_ENTRY')
174688 )
174689 THEN
174690 IF
174691 --
174692 1 = 2
174693 --
174694 THEN
174695 xla_accounting_err_pkg.build_message
174696 (p_appli_s_name => 'XLA'
174697 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
174698 ,p_token_1 => 'LINE_NUMBER'
174699 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
174700 ,p_token_2 => 'LINE_TYPE_NAME'
174704 ,l_component_type_code
174701 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
174702 l_component_type
174703 ,l_component_code
174705 ,l_component_appl_id
174706 ,l_amb_context_code
174707 ,l_entity_code
174708 ,l_event_class_code
174709 )
174710 ,p_token_3 => 'OWNER'
174711 ,p_value_3 => xla_lookups_pkg.get_meaning(
174712 p_lookup_type => 'XLA_OWNER_TYPE'
174713 ,p_lookup_code => l_component_type_code
174714 )
174715 ,p_token_4 => 'PRODUCT_NAME'
174716 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
174717 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
174718 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
174719 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
174720 ,p_ae_header_id => NULL
174721 );
174722
174723 IF (C_LEVEL_ERROR>= g_log_level) THEN
174724 trace
174725 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
174726 ,p_level => C_LEVEL_ERROR
174727 ,p_module => l_log_module);
174728 END IF;
174729 END IF;
174730 END IF;
174731 --
174732 --
174733 ------------------------------------------------------------------------------------------------
174734 -- 4219869 Business Flow
174735 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
174736 -- Prior Entry. Currently, the following code is always generated.
174737 ------------------------------------------------------------------------------------------------
174738 XLA_AE_LINES_PKG.ValidateCurrentLine;
174739
174740 ------------------------------------------------------------------------------------
174741 -- 4219869 Business Flow
174742 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
174743 ------------------------------------------------------------------------------------
174744 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
174745
174746 ----------------------------------------------------------------------------------
174747 -- 4219869 Business Flow
174748 -- Update journal entry status -- Need to generate this within IF <condition>
174749 ----------------------------------------------------------------------------------
174750 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
174751 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
174752 ,p_balance_type_code => l_balance_type_code
174753 );
174754
174755 -------------------------------------------------------------------------------------------
174756 -- 4262811 - Generate the Accrual Reversal lines
174757 -------------------------------------------------------------------------------------------
174758 BEGIN
174759 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
174760 (g_array_event(p_event_id).array_value_num('header_index'));
174761 IF l_acc_rev_flag IS NULL THEN
174762 l_acc_rev_flag := 'N';
174763 END IF;
174764 EXCEPTION
174765 WHEN OTHERS THEN
174766 l_acc_rev_flag := 'N';
174767 END;
174768 --
174769 IF (l_acc_rev_flag = 'Y') THEN
174770
174771 -- 4645092 ------------------------------------------------------------------------------
174772 -- To allow MPA report to determine if it should generate report process
174773 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
174774 ------------------------------------------------------------------------------------------
174775
174776 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
174777 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
174778 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
174779 -- call ADRs
174780 -- Bug 4922099
174781 --
174782 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
174783 (NVL(l_actual_upg_option, 'N') = 'O') OR
174784 (NVL(l_enc_upg_option, 'N') = 'O')
174785 )
174786 THEN
174787 NULL;
174788 --
174789 --
174790
174791 l_ccid := AcctDerRule_175(
174792 p_application_id => p_application_id
174793 , p_ae_header_id => l_ae_header_id
174794 , p_source_5 => p_source_5
174795 , p_source_19 => p_source_19
174796 , p_source_32 => p_source_32
174797 , x_transaction_coa_id => l_adr_transaction_coa_id
174798 , x_accounting_coa_id => l_adr_accounting_coa_id
174802
174799 , x_value_type_code => l_adr_value_type_code
174800 , p_side => 'NA'
174801 );
174803 xla_ae_lines_pkg.set_ccid(
174804 p_code_combination_id => l_ccid
174805 , p_value_type_code => l_adr_value_type_code
174806 , p_transaction_coa_id => l_adr_transaction_coa_id
174807 , p_accounting_coa_id => l_adr_accounting_coa_id
174808 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
174809 , p_adr_type_code => 'S'
174810 , p_component_type => l_component_type
174811 , p_component_code => l_component_code
174812 , p_component_type_code => l_component_type_code
174813 , p_component_appl_id => l_component_appl_id
174814 , p_amb_context_code => l_amb_context_code
174815 , p_side => 'NA'
174816 );
174817
174818
174819 l_segment := AcctDerRule_145(
174820 p_application_id => p_application_id
174821 , p_ae_header_id => l_ae_header_id
174822 , p_source_5 => p_source_5
174823 , p_source_6 => p_source_6
174824 , x_transaction_coa_id => l_adr_transaction_coa_id
174825 , x_accounting_coa_id => l_adr_accounting_coa_id
174826 , x_flexfield_segment_code => l_adr_flexfield_segment_code
174827 , x_flex_value_set_id => l_adr_flex_value_set_id
174828 , x_value_type_code => l_adr_value_type_code
174829 , x_value_combination_id => l_adr_value_combination_id
174830 , x_value_segment_code => l_adr_value_segment_code
174831 , p_side => 'NA'
174832 , p_override_seg_flag => 'Y'
174833 );
174834
174835 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
174836
174837 xla_ae_lines_pkg.set_segment(
174838 p_to_segment_code => 'GL_ACCOUNT'
174839 , p_segment_value => l_segment
174840 , p_from_segment_code => l_adr_value_segment_code
174841 , p_from_combination_id => l_adr_value_combination_id
174842 , p_value_type_code => l_adr_value_type_code
174843 , p_transaction_coa_id => l_adr_transaction_coa_id
174844 , p_accounting_coa_id => l_adr_accounting_coa_id
174845 , p_flexfield_segment_code => l_adr_flexfield_segment_code
174846 , p_flex_value_set_id => l_adr_flex_value_set_id
174847 , p_adr_code => 'FA_BONUS_RES_ACCOUNT_SEGMENT'
174848 , p_adr_type_code => 'S'
174849 , p_component_type => l_component_type
174850 , p_component_code => l_component_code
174851 , p_component_type_code => l_component_type_code
174852 , p_component_appl_id => l_component_appl_id
174853 , p_amb_context_code => l_amb_context_code
174854 , p_entity_code => 'TRANSACTIONS'
174855 , p_event_class_code => 'UNIT_ADJUSTMENTS'
174856 , p_side => 'NA'
174857 );
174858
174859 END IF;
174860
174861 l_segment := AcctDerRule_169(
174862 p_application_id => p_application_id
174863 , p_ae_header_id => l_ae_header_id
174864 , p_source_5 => p_source_5
174865 , p_source_31 => p_source_31
174866 , x_transaction_coa_id => l_adr_transaction_coa_id
174867 , x_accounting_coa_id => l_adr_accounting_coa_id
174868 , x_flexfield_segment_code => l_adr_flexfield_segment_code
174869 , x_flex_value_set_id => l_adr_flex_value_set_id
174870 , x_value_type_code => l_adr_value_type_code
174871 , x_value_combination_id => l_adr_value_combination_id
174872 , x_value_segment_code => l_adr_value_segment_code
174873 , p_side => 'NA'
174874 , p_override_seg_flag => 'Y'
174875 );
174876
174877 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
174878
174879 xla_ae_lines_pkg.set_segment(
174880 p_to_segment_code => 'GL_BALANCING'
174881 , p_segment_value => l_segment
174882 , p_from_segment_code => l_adr_value_segment_code
174883 , p_from_combination_id => l_adr_value_combination_id
174884 , p_value_type_code => l_adr_value_type_code
174885 , p_transaction_coa_id => l_adr_transaction_coa_id
174886 , p_accounting_coa_id => l_adr_accounting_coa_id
174887 , p_flexfield_segment_code => l_adr_flexfield_segment_code
174888 , p_flex_value_set_id => l_adr_flex_value_set_id
174889 , p_adr_code => 'FA_EXPENSE_ACCT'
174890 , p_adr_type_code => 'S'
174891 , p_component_type => l_component_type
174892 , p_component_code => l_component_code
174893 , p_component_type_code => l_component_type_code
174894 , p_component_appl_id => l_component_appl_id
174895 , p_amb_context_code => l_amb_context_code
174896 , p_entity_code => 'TRANSACTIONS'
174897 , p_event_class_code => 'UNIT_ADJUSTMENTS'
174898 , p_side => 'NA'
174899 );
174900
174901 END IF;
174902
174903 --
174904 --
174905 END IF;
174906
174907 --
174908 -- Update the line information that should be overwritten
174909 --
174910 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
174914 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
174911 p_header_num => 1);
174912 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
174913
174915
174916 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
174917 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
174918 END IF;
174919
174920 --
174921 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
174922 --
174923 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
174924 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
174925 ELSE
174926 ---------------------------------------------------------------------------------------------------
174927 -- 4262811a Switch Sign
174928 ---------------------------------------------------------------------------------------------------
174929 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
174930 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
174931 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
174932 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
174933 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
174934 -- 5132302
174935 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
174936 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
174937
174938 END IF;
174939
174940 -- 4955764
174941 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
174942 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
174943
174944
174945 XLA_AE_LINES_PKG.ValidateCurrentLine;
174946 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
174947
174948 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
174949 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
174950 ,p_balance_type_code => l_balance_type_code);
174951
174952 END IF;
174953
174954 -----------------------------------------------------------------------------------------
174955 -- 4262811 Multiperiod Accounting
174956 -----------------------------------------------------------------------------------------
174957 -- No MPA option is assigned.
174958
174959
174960 END IF;
174961 END IF;
174962 --
174963
174964 --
174965 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
174966 trace
174967 (p_msg => 'END of AcctLineType_410'
174968 ,p_level => C_LEVEL_PROCEDURE
174969 ,p_module => l_log_module);
174970 END IF;
174971 --
174972 EXCEPTION
174973 WHEN xla_exceptions_pkg.application_exception THEN
174974 RAISE;
174975 WHEN OTHERS THEN
174976 xla_exceptions_pkg.raise_message
174977 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_410');
174978 END AcctLineType_410;
174979 --
174980
174981 ---------------------------------------
174982 --
174983 -- PRIVATE FUNCTION
174984 -- AcctLineType_411
174985 --
174986 ---------------------------------------
174987 PROCEDURE AcctLineType_411 (
174988 p_application_id IN NUMBER
174989 ,p_event_id IN NUMBER
174990 ,p_calculate_acctd_flag IN VARCHAR2
174991 ,p_calculate_g_l_flag IN VARCHAR2
174992 ,p_actual_flag IN OUT VARCHAR2
174993 ,p_balance_type_code OUT VARCHAR2
174994 ,p_gain_or_loss_ref OUT VARCHAR2
174995
174996 --Period Close Date
174997 , p_source_1 IN DATE
174998 --Generated Code Combination Identifier
174999 , p_source_5 IN NUMBER
175000 --Asset Cost Account
175001 , p_source_11 IN VARCHAR2
175002 --Expense Account Code Combination Identifier
175003 , p_source_31 IN NUMBER
175004 --Default Code Combination Identifier
175005 , p_source_32 IN NUMBER
175006 --Adjustment Type
175007 , p_source_48 IN VARCHAR2
175008 --Transaction Header Identifier
175009 , p_source_49 IN NUMBER
175010 --Adjustment Line Identifier
175011 , p_source_50 IN NUMBER
175012 --Distribution Type Code
175013 , p_source_51 IN VARCHAR2
175014 --Entered Amount
175015 , p_source_52 IN NUMBER
175016 --Currency Code
175017 , p_source_53 IN VARCHAR2
175018 --Source Destination Code
175019 , p_source_55 IN VARCHAR2
175020 )
175021 IS
175022
175023 l_component_type VARCHAR2(80);
175024 l_component_code VARCHAR2(30);
175025 l_component_type_code VARCHAR2(1);
175026 l_component_appl_id INTEGER;
175027 l_amb_context_code VARCHAR2(30);
175028 l_entity_code VARCHAR2(30);
175029 l_event_class_code VARCHAR2(30);
175030 l_ae_header_id NUMBER;
175031 l_event_type_code VARCHAR2(30);
175032 l_line_definition_code VARCHAR2(30);
175033 l_line_definition_owner_code VARCHAR2(1);
175034 --
175038 l_adr_transaction_coa_id NUMBER;
175035 -- adr variables
175036 l_segment VARCHAR2(30);
175037 l_ccid NUMBER;
175039 l_adr_accounting_coa_id NUMBER;
175040 l_adr_flexfield_segment_code VARCHAR2(30);
175041 l_adr_flex_value_set_id NUMBER;
175042 l_adr_value_type_code VARCHAR2(30);
175043 l_adr_value_combination_id NUMBER;
175044 l_adr_value_segment_code VARCHAR2(30);
175045
175046 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
175047 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
175048 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
175049 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
175050
175051 -- 4262811 Variables ------------------------------------------------------------------------------------------
175052 l_entered_amt_idx NUMBER;
175053 l_accted_amt_idx NUMBER;
175054 l_acc_rev_flag VARCHAR2(1);
175055 l_accrual_line_num NUMBER;
175056 l_tmp_amt NUMBER;
175057 l_acc_rev_natural_side_code VARCHAR2(1);
175058
175059 l_num_entries NUMBER;
175060 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
175061 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
175062 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
175063 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
175064 l_recog_line_1 NUMBER;
175065 l_recog_line_2 NUMBER;
175066
175067 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
175068 l_bflow_applied_to_amt NUMBER; -- 5132302
175069 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
175070
175071 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
175072
175073 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
175074 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
175075
175076 ---------------------------------------------------------------------------------------------------------------
175077
175078
175079 --
175080 -- bulk performance
175081 --
175082 l_balance_type_code VARCHAR2(1);
175083 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
175084 l_log_module VARCHAR2(240);
175085
175086 --
175087 -- Upgrade strategy
175088 --
175089 l_actual_upg_option VARCHAR2(1);
175090 l_enc_upg_option VARCHAR2(1);
175091
175092 --
175093 BEGIN
175094 --
175095 IF g_log_enabled THEN
175096 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_411';
175097 END IF;
175098 --
175099 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
175100
175101 trace
175102 (p_msg => 'BEGIN of AcctLineType_411'
175103 ,p_level => C_LEVEL_PROCEDURE
175104 ,p_module => l_log_module);
175105
175106 END IF;
175107 --
175108 l_component_type := 'AMB_JLT';
175109 l_component_code := 'FA_UNITADJ_SOURCE_COST';
175110 l_component_type_code := 'S';
175111 l_component_appl_id := 140;
175112 l_amb_context_code := 'DEFAULT';
175113 l_entity_code := 'TRANSACTIONS';
175114 l_event_class_code := 'UNIT_ADJUSTMENTS';
175115 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
175116 l_line_definition_owner_code := 'S';
175117 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
175118 --
175119 l_balance_type_code := 'A';
175120 l_segment := NULL;
175121 l_ccid := NULL;
175122 l_adr_transaction_coa_id := NULL;
175123 l_adr_accounting_coa_id := NULL;
175124 l_adr_flexfield_segment_code := NULL;
175125 l_adr_flex_value_set_id := NULL;
175126 l_adr_value_type_code := NULL;
175127 l_adr_value_combination_id := NULL;
175128 l_adr_value_segment_code := NULL;
175129
175130 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
175131 l_bflow_class_code := ''; -- 4219869 Business Flow
175132 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
175133 l_budgetary_control_flag := 'N';
175134
175135 l_bflow_applied_to_amt_idx := NULL; -- 5132302
175136 l_bflow_applied_to_amt := NULL; -- 5132302
175137 l_entered_amt_idx := NULL; -- 4262811
175138 l_accted_amt_idx := NULL; -- 4262811
175139 l_acc_rev_flag := NULL; -- 4262811
175140 l_accrual_line_num := NULL; -- 4262811
175141 l_tmp_amt := NULL; -- 4262811
175142 --
175143
175144 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
175145 l_balance_type_code <> 'B' THEN
175146 IF NVL(p_source_48,'
175147 ') = 'COST' AND
175148 NVL(p_source_55,'
175149 ') = 'SOURCE'
175150 THEN
175151
175152 --
175153 XLA_AE_LINES_PKG.SetNewLine;
175154
175155 p_balance_type_code := l_balance_type_code;
175156 -- set the flag so later we will know whether the gain loss line needs to be created
175157
175158 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
175159 p_actual_flag :='A';
175160 END IF;
175161
175162 --
175166 p_header_num => 0); -- 4262811
175163 -- bulk performance
175164 --
175165 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
175167 --
175168 -- set accounting line options
175169 --
175170 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
175171 p_natural_side_code => 'C'
175172 , p_gain_or_loss_flag => 'N'
175173 , p_gl_transfer_mode_code => 'S'
175174 , p_acct_entry_type_code => 'A'
175175 , p_switch_side_flag => 'Y'
175176 , p_merge_duplicate_code => 'N'
175177 );
175178 --
175179 l_acc_rev_natural_side_code := 'D'; -- 4262811
175180 --
175181 --
175182 -- set accounting line type info
175183 --
175184 xla_ae_lines_pkg.SetAcctLineType
175185 (p_component_type => l_component_type
175186 ,p_event_type_code => l_event_type_code
175187 ,p_line_definition_owner_code => l_line_definition_owner_code
175188 ,p_line_definition_code => l_line_definition_code
175189 ,p_accounting_line_code => l_component_code
175190 ,p_accounting_line_type_code => l_component_type_code
175191 ,p_accounting_line_appl_id => l_component_appl_id
175192 ,p_amb_context_code => l_amb_context_code
175193 ,p_entity_code => l_entity_code
175194 ,p_event_class_code => l_event_class_code);
175195 --
175196 -- set accounting class
175197 --
175198 xla_ae_lines_pkg.SetAcctClass(
175199 p_accounting_class_code => 'ASSET'
175200 , p_ae_header_id => l_ae_header_id
175201 );
175202
175203 --
175204 -- set rounding class
175205 --
175206 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
175207 'ASSET';
175208
175209 --
175210 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
175211 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
175212 --
175213 -- bulk performance
175214 --
175215 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
175216
175217 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
175218 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
175219
175220 -- 4955764
175221 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
175222 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
175223
175224 -- 4458381 Public Sector Enh
175225
175226 --
175227 -- set accounting attributes for the line type
175228 --
175229 l_entered_amt_idx := 4;
175230 l_accted_amt_idx := 6;
175231 l_bflow_applied_to_amt_idx := NULL; -- 5132302
175232 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
175233 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
175234 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
175235 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
175236 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
175237 l_rec_acct_attrs.array_char_value(3) := p_source_51;
175238 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
175239 l_rec_acct_attrs.array_num_value(4) := p_source_52;
175240 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
175241 l_rec_acct_attrs.array_char_value(5) := p_source_53;
175242 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
175243 l_rec_acct_attrs.array_num_value(6) := p_source_52;
175244
175245 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
175246 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
175247
175248 ---------------------------------------------------------------------------------------------------------------
175249 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
175250 ---------------------------------------------------------------------------------------------------------------
175251 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
175252
175253 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
175254 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
175255
175256 IF xla_accounting_cache_pkg.GetValueChar
175257 (p_source_code => 'LEDGER_CATEGORY_CODE'
175258 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
175259 AND l_bflow_method_code = 'PRIOR_ENTRY'
175260 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
175261 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
175262 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
175263 )
175264 THEN
175265 xla_ae_lines_pkg.BflowUpgEntry
175266 (p_business_method_code => l_bflow_method_code
175267 ,p_business_class_code => l_bflow_class_code
175268 ,p_balance_type => l_balance_type_code);
175269 ELSE
175270 NULL;
175271 -- No business flow processing for business flow method of NONE.
175275 -- call analytical criteria
175272 END IF;
175273
175274 --
175276 --
175277
175278 --
175279 -- call description
175280 --
175281
175282 xla_ae_lines_pkg.SetLineDescription(
175283 p_ae_header_id => l_ae_header_id
175284 ,p_description => Description_133 (
175285 p_application_id => p_application_id
175286 , p_ae_header_id => l_ae_header_id
175287 , p_source_1 => p_source_1
175288 )
175289 );
175290
175291
175292 --
175293 -- call ADRs
175294 -- Bug 4922099
175295 --
175296 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
175297 (NVL(l_actual_upg_option, 'N') = 'O') OR
175298 (NVL(l_enc_upg_option, 'N') = 'O')
175299 )
175300 THEN
175301 NULL;
175302 --
175303 --
175304
175305 l_ccid := AcctDerRule_174(
175306 p_application_id => p_application_id
175307 , p_ae_header_id => l_ae_header_id
175308 , p_source_5 => p_source_5
175309 , p_source_32 => p_source_32
175310 , x_transaction_coa_id => l_adr_transaction_coa_id
175311 , x_accounting_coa_id => l_adr_accounting_coa_id
175312 , x_value_type_code => l_adr_value_type_code
175313 , p_side => 'NA'
175314 );
175315
175316 xla_ae_lines_pkg.set_ccid(
175317 p_code_combination_id => l_ccid
175318 , p_value_type_code => l_adr_value_type_code
175319 , p_transaction_coa_id => l_adr_transaction_coa_id
175320 , p_accounting_coa_id => l_adr_accounting_coa_id
175321 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
175322 , p_adr_type_code => 'S'
175323 , p_component_type => l_component_type
175324 , p_component_code => l_component_code
175325 , p_component_type_code => l_component_type_code
175326 , p_component_appl_id => l_component_appl_id
175327 , p_amb_context_code => l_amb_context_code
175328 , p_side => 'NA'
175329 );
175330
175331
175332 l_segment := AcctDerRule_149(
175333 p_application_id => p_application_id
175334 , p_ae_header_id => l_ae_header_id
175335 , p_source_5 => p_source_5
175336 , p_source_11 => p_source_11
175337 , x_transaction_coa_id => l_adr_transaction_coa_id
175338 , x_accounting_coa_id => l_adr_accounting_coa_id
175339 , x_flexfield_segment_code => l_adr_flexfield_segment_code
175340 , x_flex_value_set_id => l_adr_flex_value_set_id
175341 , x_value_type_code => l_adr_value_type_code
175342 , x_value_combination_id => l_adr_value_combination_id
175343 , x_value_segment_code => l_adr_value_segment_code
175344 , p_side => 'NA'
175345 , p_override_seg_flag => 'Y'
175346 );
175347
175348 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
175349
175350 xla_ae_lines_pkg.set_segment(
175351 p_to_segment_code => 'GL_ACCOUNT'
175352 , p_segment_value => l_segment
175353 , p_from_segment_code => l_adr_value_segment_code
175354 , p_from_combination_id => l_adr_value_combination_id
175355 , p_value_type_code => l_adr_value_type_code
175356 , p_transaction_coa_id => l_adr_transaction_coa_id
175357 , p_accounting_coa_id => l_adr_accounting_coa_id
175358 , p_flexfield_segment_code => l_adr_flexfield_segment_code
175359 , p_flex_value_set_id => l_adr_flex_value_set_id
175360 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
175361 , p_adr_type_code => 'S'
175362 , p_component_type => l_component_type
175363 , p_component_code => l_component_code
175364 , p_component_type_code => l_component_type_code
175365 , p_component_appl_id => l_component_appl_id
175366 , p_amb_context_code => l_amb_context_code
175367 , p_entity_code => 'TRANSACTIONS'
175368 , p_event_class_code => 'UNIT_ADJUSTMENTS'
175369 , p_side => 'NA'
175370 );
175371
175372 END IF;
175373
175374 l_segment := AcctDerRule_169(
175375 p_application_id => p_application_id
175376 , p_ae_header_id => l_ae_header_id
175377 , p_source_5 => p_source_5
175378 , p_source_31 => p_source_31
175379 , x_transaction_coa_id => l_adr_transaction_coa_id
175380 , x_accounting_coa_id => l_adr_accounting_coa_id
175381 , x_flexfield_segment_code => l_adr_flexfield_segment_code
175382 , x_flex_value_set_id => l_adr_flex_value_set_id
175383 , x_value_type_code => l_adr_value_type_code
175384 , x_value_combination_id => l_adr_value_combination_id
175385 , x_value_segment_code => l_adr_value_segment_code
175386 , p_side => 'NA'
175387 , p_override_seg_flag => 'Y'
175388 );
175389
175390 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
175391
175392 xla_ae_lines_pkg.set_segment(
175393 p_to_segment_code => 'GL_BALANCING'
175394 , p_segment_value => l_segment
175395 , p_from_segment_code => l_adr_value_segment_code
175396 , p_from_combination_id => l_adr_value_combination_id
175397 , p_value_type_code => l_adr_value_type_code
175401 , p_flex_value_set_id => l_adr_flex_value_set_id
175398 , p_transaction_coa_id => l_adr_transaction_coa_id
175399 , p_accounting_coa_id => l_adr_accounting_coa_id
175400 , p_flexfield_segment_code => l_adr_flexfield_segment_code
175402 , p_adr_code => 'FA_EXPENSE_ACCT'
175403 , p_adr_type_code => 'S'
175404 , p_component_type => l_component_type
175405 , p_component_code => l_component_code
175406 , p_component_type_code => l_component_type_code
175407 , p_component_appl_id => l_component_appl_id
175408 , p_amb_context_code => l_amb_context_code
175409 , p_entity_code => 'TRANSACTIONS'
175410 , p_event_class_code => 'UNIT_ADJUSTMENTS'
175411 , p_side => 'NA'
175412 );
175413
175414 END IF;
175415
175416 --
175417 --
175418 END IF;
175419 --
175420 -- Bug 4922099
175421 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
175422 (NVL(l_enc_upg_option, 'N') = 'O')
175423 ) AND
175424 (l_bflow_method_code = 'PRIOR_ENTRY')
175425 )
175426 THEN
175427 IF
175428 --
175429 1 = 2
175430 --
175431 THEN
175432 xla_accounting_err_pkg.build_message
175433 (p_appli_s_name => 'XLA'
175434 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
175435 ,p_token_1 => 'LINE_NUMBER'
175436 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
175437 ,p_token_2 => 'LINE_TYPE_NAME'
175438 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
175439 l_component_type
175440 ,l_component_code
175441 ,l_component_type_code
175442 ,l_component_appl_id
175443 ,l_amb_context_code
175444 ,l_entity_code
175445 ,l_event_class_code
175446 )
175447 ,p_token_3 => 'OWNER'
175448 ,p_value_3 => xla_lookups_pkg.get_meaning(
175449 p_lookup_type => 'XLA_OWNER_TYPE'
175450 ,p_lookup_code => l_component_type_code
175451 )
175452 ,p_token_4 => 'PRODUCT_NAME'
175453 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
175454 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
175455 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
175456 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
175457 ,p_ae_header_id => NULL
175458 );
175459
175460 IF (C_LEVEL_ERROR>= g_log_level) THEN
175461 trace
175462 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
175463 ,p_level => C_LEVEL_ERROR
175464 ,p_module => l_log_module);
175465 END IF;
175466 END IF;
175467 END IF;
175468 --
175469 --
175470 ------------------------------------------------------------------------------------------------
175471 -- 4219869 Business Flow
175472 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
175473 -- Prior Entry. Currently, the following code is always generated.
175474 ------------------------------------------------------------------------------------------------
175475 XLA_AE_LINES_PKG.ValidateCurrentLine;
175476
175477 ------------------------------------------------------------------------------------
175478 -- 4219869 Business Flow
175479 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
175480 ------------------------------------------------------------------------------------
175481 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
175482
175483 ----------------------------------------------------------------------------------
175484 -- 4219869 Business Flow
175485 -- Update journal entry status -- Need to generate this within IF <condition>
175486 ----------------------------------------------------------------------------------
175487 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
175488 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
175489 ,p_balance_type_code => l_balance_type_code
175490 );
175491
175492 -------------------------------------------------------------------------------------------
175493 -- 4262811 - Generate the Accrual Reversal lines
175497 (g_array_event(p_event_id).array_value_num('header_index'));
175494 -------------------------------------------------------------------------------------------
175495 BEGIN
175496 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
175498 IF l_acc_rev_flag IS NULL THEN
175499 l_acc_rev_flag := 'N';
175500 END IF;
175501 EXCEPTION
175502 WHEN OTHERS THEN
175503 l_acc_rev_flag := 'N';
175504 END;
175505 --
175506 IF (l_acc_rev_flag = 'Y') THEN
175507
175508 -- 4645092 ------------------------------------------------------------------------------
175509 -- To allow MPA report to determine if it should generate report process
175510 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
175511 ------------------------------------------------------------------------------------------
175512
175513 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
175514 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
175515 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
175516 -- call ADRs
175517 -- Bug 4922099
175518 --
175519 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
175520 (NVL(l_actual_upg_option, 'N') = 'O') OR
175521 (NVL(l_enc_upg_option, 'N') = 'O')
175522 )
175523 THEN
175524 NULL;
175525 --
175526 --
175527
175528 l_ccid := AcctDerRule_174(
175529 p_application_id => p_application_id
175530 , p_ae_header_id => l_ae_header_id
175531 , p_source_5 => p_source_5
175532 , p_source_32 => p_source_32
175533 , x_transaction_coa_id => l_adr_transaction_coa_id
175534 , x_accounting_coa_id => l_adr_accounting_coa_id
175535 , x_value_type_code => l_adr_value_type_code
175536 , p_side => 'NA'
175537 );
175538
175539 xla_ae_lines_pkg.set_ccid(
175540 p_code_combination_id => l_ccid
175541 , p_value_type_code => l_adr_value_type_code
175542 , p_transaction_coa_id => l_adr_transaction_coa_id
175543 , p_accounting_coa_id => l_adr_accounting_coa_id
175544 , p_adr_code => 'FA_DEFAULT_ACCOUNT'
175545 , p_adr_type_code => 'S'
175546 , p_component_type => l_component_type
175547 , p_component_code => l_component_code
175548 , p_component_type_code => l_component_type_code
175549 , p_component_appl_id => l_component_appl_id
175550 , p_amb_context_code => l_amb_context_code
175551 , p_side => 'NA'
175552 );
175553
175554
175555 l_segment := AcctDerRule_149(
175556 p_application_id => p_application_id
175557 , p_ae_header_id => l_ae_header_id
175558 , p_source_5 => p_source_5
175559 , p_source_11 => p_source_11
175560 , x_transaction_coa_id => l_adr_transaction_coa_id
175561 , x_accounting_coa_id => l_adr_accounting_coa_id
175562 , x_flexfield_segment_code => l_adr_flexfield_segment_code
175563 , x_flex_value_set_id => l_adr_flex_value_set_id
175564 , x_value_type_code => l_adr_value_type_code
175565 , x_value_combination_id => l_adr_value_combination_id
175566 , x_value_segment_code => l_adr_value_segment_code
175567 , p_side => 'NA'
175568 , p_override_seg_flag => 'Y'
175569 );
175570
175571 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
175572
175573 xla_ae_lines_pkg.set_segment(
175574 p_to_segment_code => 'GL_ACCOUNT'
175575 , p_segment_value => l_segment
175576 , p_from_segment_code => l_adr_value_segment_code
175577 , p_from_combination_id => l_adr_value_combination_id
175578 , p_value_type_code => l_adr_value_type_code
175579 , p_transaction_coa_id => l_adr_transaction_coa_id
175580 , p_accounting_coa_id => l_adr_accounting_coa_id
175581 , p_flexfield_segment_code => l_adr_flexfield_segment_code
175582 , p_flex_value_set_id => l_adr_flex_value_set_id
175583 , p_adr_code => 'FA_CAT_COST_ACCOUNT_SEGMENT'
175584 , p_adr_type_code => 'S'
175585 , p_component_type => l_component_type
175586 , p_component_code => l_component_code
175587 , p_component_type_code => l_component_type_code
175588 , p_component_appl_id => l_component_appl_id
175589 , p_amb_context_code => l_amb_context_code
175590 , p_entity_code => 'TRANSACTIONS'
175591 , p_event_class_code => 'UNIT_ADJUSTMENTS'
175592 , p_side => 'NA'
175593 );
175594
175595 END IF;
175596
175597 l_segment := AcctDerRule_169(
175598 p_application_id => p_application_id
175599 , p_ae_header_id => l_ae_header_id
175600 , p_source_5 => p_source_5
175601 , p_source_31 => p_source_31
175602 , x_transaction_coa_id => l_adr_transaction_coa_id
175603 , x_accounting_coa_id => l_adr_accounting_coa_id
175604 , x_flexfield_segment_code => l_adr_flexfield_segment_code
175605 , x_flex_value_set_id => l_adr_flex_value_set_id
175606 , x_value_type_code => l_adr_value_type_code
175610 , p_override_seg_flag => 'Y'
175607 , x_value_combination_id => l_adr_value_combination_id
175608 , x_value_segment_code => l_adr_value_segment_code
175609 , p_side => 'NA'
175611 );
175612
175613 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
175614
175615 xla_ae_lines_pkg.set_segment(
175616 p_to_segment_code => 'GL_BALANCING'
175617 , p_segment_value => l_segment
175618 , p_from_segment_code => l_adr_value_segment_code
175619 , p_from_combination_id => l_adr_value_combination_id
175620 , p_value_type_code => l_adr_value_type_code
175621 , p_transaction_coa_id => l_adr_transaction_coa_id
175622 , p_accounting_coa_id => l_adr_accounting_coa_id
175623 , p_flexfield_segment_code => l_adr_flexfield_segment_code
175624 , p_flex_value_set_id => l_adr_flex_value_set_id
175625 , p_adr_code => 'FA_EXPENSE_ACCT'
175626 , p_adr_type_code => 'S'
175627 , p_component_type => l_component_type
175628 , p_component_code => l_component_code
175629 , p_component_type_code => l_component_type_code
175630 , p_component_appl_id => l_component_appl_id
175631 , p_amb_context_code => l_amb_context_code
175632 , p_entity_code => 'TRANSACTIONS'
175633 , p_event_class_code => 'UNIT_ADJUSTMENTS'
175634 , p_side => 'NA'
175635 );
175636
175637 END IF;
175638
175639 --
175640 --
175641 END IF;
175642
175643 --
175644 -- Update the line information that should be overwritten
175645 --
175646 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
175647 p_header_num => 1);
175648 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
175649
175650 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
175651
175652 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
175653 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
175654 END IF;
175655
175656 --
175657 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
175658 --
175659 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
175660 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
175661 ELSE
175662 ---------------------------------------------------------------------------------------------------
175663 -- 4262811a Switch Sign
175664 ---------------------------------------------------------------------------------------------------
175665 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
175666 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
175667 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
175668 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
175669 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
175670 -- 5132302
175671 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
175672 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
175673
175674 END IF;
175675
175676 -- 4955764
175677 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
175678 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
175679
175680
175681 XLA_AE_LINES_PKG.ValidateCurrentLine;
175682 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
175683
175684 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
175685 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
175686 ,p_balance_type_code => l_balance_type_code);
175687
175688 END IF;
175689
175690 -----------------------------------------------------------------------------------------
175691 -- 4262811 Multiperiod Accounting
175692 -----------------------------------------------------------------------------------------
175693 -- No MPA option is assigned.
175694
175695
175696 END IF;
175697 END IF;
175698 --
175699
175700 --
175701 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
175702 trace
175703 (p_msg => 'END of AcctLineType_411'
175704 ,p_level => C_LEVEL_PROCEDURE
175705 ,p_module => l_log_module);
175706 END IF;
175707 --
175708 EXCEPTION
175709 WHEN xla_exceptions_pkg.application_exception THEN
175710 RAISE;
175711 WHEN OTHERS THEN
175712 xla_exceptions_pkg.raise_message
175713 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_411');
175714 END AcctLineType_411;
175715 --
175716
175717 ---------------------------------------
175718 --
175719 -- PRIVATE FUNCTION
175720 -- AcctLineType_412
175721 --
175722 ---------------------------------------
175726 ,p_calculate_acctd_flag IN VARCHAR2
175723 PROCEDURE AcctLineType_412 (
175724 p_application_id IN NUMBER
175725 ,p_event_id IN NUMBER
175727 ,p_calculate_g_l_flag IN VARCHAR2
175728 ,p_actual_flag IN OUT VARCHAR2
175729 ,p_balance_type_code OUT VARCHAR2
175730 ,p_gain_or_loss_ref OUT VARCHAR2
175731
175732 --Period Close Date
175733 , p_source_1 IN DATE
175734 --Generated Code Combination Identifier
175735 , p_source_5 IN NUMBER
175736 --Expense Account Code Combination Identifier
175737 , p_source_31 IN NUMBER
175738 --Adjustment Type
175739 , p_source_48 IN VARCHAR2
175740 --Transaction Header Identifier
175741 , p_source_49 IN NUMBER
175742 --Adjustment Line Identifier
175743 , p_source_50 IN NUMBER
175744 --Distribution Type Code
175745 , p_source_51 IN VARCHAR2
175746 --Entered Amount
175747 , p_source_52 IN NUMBER
175748 --Currency Code
175749 , p_source_53 IN VARCHAR2
175750 --Source Destination Code
175751 , p_source_55 IN VARCHAR2
175752 )
175753 IS
175754
175755 l_component_type VARCHAR2(80);
175756 l_component_code VARCHAR2(30);
175757 l_component_type_code VARCHAR2(1);
175758 l_component_appl_id INTEGER;
175759 l_amb_context_code VARCHAR2(30);
175760 l_entity_code VARCHAR2(30);
175761 l_event_class_code VARCHAR2(30);
175762 l_ae_header_id NUMBER;
175763 l_event_type_code VARCHAR2(30);
175764 l_line_definition_code VARCHAR2(30);
175765 l_line_definition_owner_code VARCHAR2(1);
175766 --
175767 -- adr variables
175768 l_segment VARCHAR2(30);
175769 l_ccid NUMBER;
175770 l_adr_transaction_coa_id NUMBER;
175771 l_adr_accounting_coa_id NUMBER;
175772 l_adr_flexfield_segment_code VARCHAR2(30);
175773 l_adr_flex_value_set_id NUMBER;
175774 l_adr_value_type_code VARCHAR2(30);
175775 l_adr_value_combination_id NUMBER;
175776 l_adr_value_segment_code VARCHAR2(30);
175777
175778 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
175779 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
175780 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
175781 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
175782
175783 -- 4262811 Variables ------------------------------------------------------------------------------------------
175784 l_entered_amt_idx NUMBER;
175785 l_accted_amt_idx NUMBER;
175786 l_acc_rev_flag VARCHAR2(1);
175787 l_accrual_line_num NUMBER;
175788 l_tmp_amt NUMBER;
175789 l_acc_rev_natural_side_code VARCHAR2(1);
175790
175791 l_num_entries NUMBER;
175792 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
175793 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
175794 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
175795 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
175796 l_recog_line_1 NUMBER;
175797 l_recog_line_2 NUMBER;
175798
175799 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
175800 l_bflow_applied_to_amt NUMBER; -- 5132302
175801 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
175802
175803 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
175804
175805 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
175806 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
175807
175808 ---------------------------------------------------------------------------------------------------------------
175809
175810
175811 --
175812 -- bulk performance
175813 --
175814 l_balance_type_code VARCHAR2(1);
175815 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
175816 l_log_module VARCHAR2(240);
175817
175818 --
175819 -- Upgrade strategy
175820 --
175821 l_actual_upg_option VARCHAR2(1);
175822 l_enc_upg_option VARCHAR2(1);
175823
175824 --
175825 BEGIN
175826 --
175827 IF g_log_enabled THEN
175828 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_412';
175829 END IF;
175830 --
175831 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
175832
175833 trace
175834 (p_msg => 'BEGIN of AcctLineType_412'
175835 ,p_level => C_LEVEL_PROCEDURE
175836 ,p_module => l_log_module);
175837
175838 END IF;
175839 --
175840 l_component_type := 'AMB_JLT';
175841 l_component_code := 'FA_UNITADJ_SOURCE_DEPRN_EXP';
175842 l_component_type_code := 'S';
175843 l_component_appl_id := 140;
175844 l_amb_context_code := 'DEFAULT';
175845 l_entity_code := 'TRANSACTIONS';
175846 l_event_class_code := 'UNIT_ADJUSTMENTS';
175847 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
175848 l_line_definition_owner_code := 'S';
175849 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
175850 --
175851 l_balance_type_code := 'A';
175852 l_segment := NULL;
175853 l_ccid := NULL;
175857 l_adr_flex_value_set_id := NULL;
175854 l_adr_transaction_coa_id := NULL;
175855 l_adr_accounting_coa_id := NULL;
175856 l_adr_flexfield_segment_code := NULL;
175858 l_adr_value_type_code := NULL;
175859 l_adr_value_combination_id := NULL;
175860 l_adr_value_segment_code := NULL;
175861
175862 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
175863 l_bflow_class_code := ''; -- 4219869 Business Flow
175864 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
175865 l_budgetary_control_flag := 'N';
175866
175867 l_bflow_applied_to_amt_idx := NULL; -- 5132302
175868 l_bflow_applied_to_amt := NULL; -- 5132302
175869 l_entered_amt_idx := NULL; -- 4262811
175870 l_accted_amt_idx := NULL; -- 4262811
175871 l_acc_rev_flag := NULL; -- 4262811
175872 l_accrual_line_num := NULL; -- 4262811
175873 l_tmp_amt := NULL; -- 4262811
175874 --
175875
175876 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
175877 l_balance_type_code <> 'B' THEN
175878 IF NVL(p_source_48,'
175879 ') = 'EXPENSE' AND
175880 NVL(p_source_55,'
175881 ') = 'SOURCE'
175882 THEN
175883
175884 --
175885 XLA_AE_LINES_PKG.SetNewLine;
175886
175887 p_balance_type_code := l_balance_type_code;
175888 -- set the flag so later we will know whether the gain loss line needs to be created
175889
175890 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
175891 p_actual_flag :='A';
175892 END IF;
175893
175894 --
175895 -- bulk performance
175896 --
175897 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
175898 p_header_num => 0); -- 4262811
175899 --
175900 -- set accounting line options
175901 --
175902 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
175903 p_natural_side_code => 'C'
175904 , p_gain_or_loss_flag => 'N'
175905 , p_gl_transfer_mode_code => 'S'
175906 , p_acct_entry_type_code => 'A'
175907 , p_switch_side_flag => 'Y'
175908 , p_merge_duplicate_code => 'N'
175909 );
175910 --
175911 l_acc_rev_natural_side_code := 'D'; -- 4262811
175912 --
175913 --
175914 -- set accounting line type info
175915 --
175916 xla_ae_lines_pkg.SetAcctLineType
175917 (p_component_type => l_component_type
175918 ,p_event_type_code => l_event_type_code
175919 ,p_line_definition_owner_code => l_line_definition_owner_code
175920 ,p_line_definition_code => l_line_definition_code
175921 ,p_accounting_line_code => l_component_code
175922 ,p_accounting_line_type_code => l_component_type_code
175923 ,p_accounting_line_appl_id => l_component_appl_id
175924 ,p_amb_context_code => l_amb_context_code
175925 ,p_entity_code => l_entity_code
175926 ,p_event_class_code => l_event_class_code);
175927 --
175928 -- set accounting class
175929 --
175930 xla_ae_lines_pkg.SetAcctClass(
175931 p_accounting_class_code => 'EXPENSE'
175932 , p_ae_header_id => l_ae_header_id
175933 );
175934
175935 --
175936 -- set rounding class
175937 --
175938 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
175939 'EXPENSE';
175940
175941 --
175942 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
175943 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
175944 --
175945 -- bulk performance
175946 --
175947 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
175948
175949 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
175950 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
175951
175952 -- 4955764
175953 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
175954 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
175955
175956 -- 4458381 Public Sector Enh
175957
175958 --
175959 -- set accounting attributes for the line type
175960 --
175961 l_entered_amt_idx := 4;
175962 l_accted_amt_idx := 6;
175963 l_bflow_applied_to_amt_idx := NULL; -- 5132302
175964 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
175965 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
175966 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
175967 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
175968 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
175969 l_rec_acct_attrs.array_char_value(3) := p_source_51;
175970 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
175971 l_rec_acct_attrs.array_num_value(4) := p_source_52;
175972 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
175973 l_rec_acct_attrs.array_char_value(5) := p_source_53;
175974 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
175975 l_rec_acct_attrs.array_num_value(6) := p_source_52;
175976
175977 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
175981 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
175978 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
175979
175980 ---------------------------------------------------------------------------------------------------------------
175982 ---------------------------------------------------------------------------------------------------------------
175983 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
175984
175985 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
175986 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
175987
175988 IF xla_accounting_cache_pkg.GetValueChar
175989 (p_source_code => 'LEDGER_CATEGORY_CODE'
175990 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
175991 AND l_bflow_method_code = 'PRIOR_ENTRY'
175992 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
175993 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
175994 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
175995 )
175996 THEN
175997 xla_ae_lines_pkg.BflowUpgEntry
175998 (p_business_method_code => l_bflow_method_code
175999 ,p_business_class_code => l_bflow_class_code
176000 ,p_balance_type => l_balance_type_code);
176001 ELSE
176002 NULL;
176003 -- No business flow processing for business flow method of NONE.
176004 END IF;
176005
176006 --
176007 -- call analytical criteria
176008 --
176009
176010 --
176011 -- call description
176012 --
176013
176014 xla_ae_lines_pkg.SetLineDescription(
176015 p_ae_header_id => l_ae_header_id
176016 ,p_description => Description_134 (
176017 p_application_id => p_application_id
176018 , p_ae_header_id => l_ae_header_id
176019 , p_source_1 => p_source_1
176020 )
176021 );
176022
176023
176024 --
176025 -- call ADRs
176026 -- Bug 4922099
176027 --
176028 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
176029 (NVL(l_actual_upg_option, 'N') = 'O') OR
176030 (NVL(l_enc_upg_option, 'N') = 'O')
176031 )
176032 THEN
176033 NULL;
176034 --
176035 --
176036
176037 l_ccid := AcctDerRule_176(
176038 p_application_id => p_application_id
176039 , p_ae_header_id => l_ae_header_id
176040 , p_source_5 => p_source_5
176041 , p_source_31 => p_source_31
176042 , x_transaction_coa_id => l_adr_transaction_coa_id
176043 , x_accounting_coa_id => l_adr_accounting_coa_id
176044 , x_value_type_code => l_adr_value_type_code
176045 , p_side => 'NA'
176046 );
176047
176048 xla_ae_lines_pkg.set_ccid(
176049 p_code_combination_id => l_ccid
176050 , p_value_type_code => l_adr_value_type_code
176051 , p_transaction_coa_id => l_adr_transaction_coa_id
176052 , p_accounting_coa_id => l_adr_accounting_coa_id
176053 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
176054 , p_adr_type_code => 'S'
176055 , p_component_type => l_component_type
176056 , p_component_code => l_component_code
176057 , p_component_type_code => l_component_type_code
176058 , p_component_appl_id => l_component_appl_id
176059 , p_amb_context_code => l_amb_context_code
176060 , p_side => 'NA'
176061 );
176062
176063
176064 --
176065 --
176066 END IF;
176067 --
176068 -- Bug 4922099
176069 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
176070 (NVL(l_enc_upg_option, 'N') = 'O')
176071 ) AND
176072 (l_bflow_method_code = 'PRIOR_ENTRY')
176073 )
176074 THEN
176075 IF
176076 --
176077 1 = 2
176078 --
176079 THEN
176080 xla_accounting_err_pkg.build_message
176081 (p_appli_s_name => 'XLA'
176082 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
176083 ,p_token_1 => 'LINE_NUMBER'
176084 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
176085 ,p_token_2 => 'LINE_TYPE_NAME'
176086 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
176087 l_component_type
176088 ,l_component_code
176089 ,l_component_type_code
176090 ,l_component_appl_id
176091 ,l_amb_context_code
176092 ,l_entity_code
176093 ,l_event_class_code
176094 )
176098 ,p_lookup_code => l_component_type_code
176095 ,p_token_3 => 'OWNER'
176096 ,p_value_3 => xla_lookups_pkg.get_meaning(
176097 p_lookup_type => 'XLA_OWNER_TYPE'
176099 )
176100 ,p_token_4 => 'PRODUCT_NAME'
176101 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
176102 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
176103 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
176104 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
176105 ,p_ae_header_id => NULL
176106 );
176107
176108 IF (C_LEVEL_ERROR>= g_log_level) THEN
176109 trace
176110 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
176111 ,p_level => C_LEVEL_ERROR
176112 ,p_module => l_log_module);
176113 END IF;
176114 END IF;
176115 END IF;
176116 --
176117 --
176118 ------------------------------------------------------------------------------------------------
176119 -- 4219869 Business Flow
176120 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
176121 -- Prior Entry. Currently, the following code is always generated.
176122 ------------------------------------------------------------------------------------------------
176123 XLA_AE_LINES_PKG.ValidateCurrentLine;
176124
176125 ------------------------------------------------------------------------------------
176126 -- 4219869 Business Flow
176127 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
176128 ------------------------------------------------------------------------------------
176129 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
176130
176131 ----------------------------------------------------------------------------------
176132 -- 4219869 Business Flow
176133 -- Update journal entry status -- Need to generate this within IF <condition>
176134 ----------------------------------------------------------------------------------
176135 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
176136 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
176137 ,p_balance_type_code => l_balance_type_code
176138 );
176139
176140 -------------------------------------------------------------------------------------------
176141 -- 4262811 - Generate the Accrual Reversal lines
176142 -------------------------------------------------------------------------------------------
176143 BEGIN
176144 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
176145 (g_array_event(p_event_id).array_value_num('header_index'));
176146 IF l_acc_rev_flag IS NULL THEN
176147 l_acc_rev_flag := 'N';
176148 END IF;
176149 EXCEPTION
176150 WHEN OTHERS THEN
176151 l_acc_rev_flag := 'N';
176152 END;
176153 --
176154 IF (l_acc_rev_flag = 'Y') THEN
176155
176156 -- 4645092 ------------------------------------------------------------------------------
176157 -- To allow MPA report to determine if it should generate report process
176158 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
176159 ------------------------------------------------------------------------------------------
176160
176161 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
176162 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
176163 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
176164 -- call ADRs
176165 -- Bug 4922099
176166 --
176167 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
176168 (NVL(l_actual_upg_option, 'N') = 'O') OR
176169 (NVL(l_enc_upg_option, 'N') = 'O')
176170 )
176171 THEN
176172 NULL;
176173 --
176174 --
176175
176176 l_ccid := AcctDerRule_176(
176177 p_application_id => p_application_id
176178 , p_ae_header_id => l_ae_header_id
176179 , p_source_5 => p_source_5
176180 , p_source_31 => p_source_31
176181 , x_transaction_coa_id => l_adr_transaction_coa_id
176182 , x_accounting_coa_id => l_adr_accounting_coa_id
176183 , x_value_type_code => l_adr_value_type_code
176184 , p_side => 'NA'
176185 );
176186
176187 xla_ae_lines_pkg.set_ccid(
176188 p_code_combination_id => l_ccid
176189 , p_value_type_code => l_adr_value_type_code
176190 , p_transaction_coa_id => l_adr_transaction_coa_id
176191 , p_accounting_coa_id => l_adr_accounting_coa_id
176192 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
176193 , p_adr_type_code => 'S'
176194 , p_component_type => l_component_type
176195 , p_component_code => l_component_code
176196 , p_component_type_code => l_component_type_code
176200 );
176197 , p_component_appl_id => l_component_appl_id
176198 , p_amb_context_code => l_amb_context_code
176199 , p_side => 'NA'
176201
176202
176203 --
176204 --
176205 END IF;
176206
176207 --
176208 -- Update the line information that should be overwritten
176209 --
176210 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
176211 p_header_num => 1);
176212 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
176213
176214 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
176215
176216 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
176217 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
176218 END IF;
176219
176220 --
176221 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
176222 --
176223 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
176224 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
176225 ELSE
176226 ---------------------------------------------------------------------------------------------------
176227 -- 4262811a Switch Sign
176228 ---------------------------------------------------------------------------------------------------
176229 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
176230 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
176231 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
176232 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
176233 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
176234 -- 5132302
176235 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
176236 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
176237
176238 END IF;
176239
176240 -- 4955764
176241 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
176242 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
176243
176244
176245 XLA_AE_LINES_PKG.ValidateCurrentLine;
176246 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
176247
176248 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
176249 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
176250 ,p_balance_type_code => l_balance_type_code);
176251
176252 END IF;
176253
176254 -----------------------------------------------------------------------------------------
176255 -- 4262811 Multiperiod Accounting
176256 -----------------------------------------------------------------------------------------
176257 -- No MPA option is assigned.
176258
176259
176260 END IF;
176261 END IF;
176262 --
176263
176264 --
176265 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
176266 trace
176267 (p_msg => 'END of AcctLineType_412'
176268 ,p_level => C_LEVEL_PROCEDURE
176269 ,p_module => l_log_module);
176270 END IF;
176271 --
176272 EXCEPTION
176273 WHEN xla_exceptions_pkg.application_exception THEN
176274 RAISE;
176275 WHEN OTHERS THEN
176276 xla_exceptions_pkg.raise_message
176277 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_412');
176278 END AcctLineType_412;
176279 --
176280
176281 ---------------------------------------
176282 --
176283 -- PRIVATE FUNCTION
176284 -- AcctLineType_413
176285 --
176286 ---------------------------------------
176287 PROCEDURE AcctLineType_413 (
176288 p_application_id IN NUMBER
176289 ,p_event_id IN NUMBER
176290 ,p_calculate_acctd_flag IN VARCHAR2
176291 ,p_calculate_g_l_flag IN VARCHAR2
176292 ,p_actual_flag IN OUT VARCHAR2
176293 ,p_balance_type_code OUT VARCHAR2
176294 ,p_gain_or_loss_ref OUT VARCHAR2
176295
176296 --Period Close Date
176297 , p_source_1 IN DATE
176298 --Generated Code Combination Identifier
176299 , p_source_5 IN NUMBER
176300 --Depreciation Reserve Account
176301 , p_source_12 IN VARCHAR2
176302 --Generated Offset Code Combination Identifier
176303 , p_source_19 IN NUMBER
176304 --Expense Account Code Combination Identifier
176305 , p_source_31 IN NUMBER
176306 --Default Code Combination Identifier
176307 , p_source_32 IN NUMBER
176308 --Adjustment Type
176309 , p_source_48 IN VARCHAR2
176310 --Transaction Header Identifier
176311 , p_source_49 IN NUMBER
176312 --Adjustment Line Identifier
176313 , p_source_50 IN NUMBER
176314 --Distribution Type Code
176315 , p_source_51 IN VARCHAR2
176316 --Entered Amount
176317 , p_source_52 IN NUMBER
176318 --Currency Code
176319 , p_source_53 IN VARCHAR2
176320 --Source Destination Code
176321 , p_source_55 IN VARCHAR2
176325 l_component_type VARCHAR2(80);
176322 )
176323 IS
176324
176326 l_component_code VARCHAR2(30);
176327 l_component_type_code VARCHAR2(1);
176328 l_component_appl_id INTEGER;
176329 l_amb_context_code VARCHAR2(30);
176330 l_entity_code VARCHAR2(30);
176331 l_event_class_code VARCHAR2(30);
176332 l_ae_header_id NUMBER;
176333 l_event_type_code VARCHAR2(30);
176334 l_line_definition_code VARCHAR2(30);
176335 l_line_definition_owner_code VARCHAR2(1);
176336 --
176337 -- adr variables
176338 l_segment VARCHAR2(30);
176339 l_ccid NUMBER;
176340 l_adr_transaction_coa_id NUMBER;
176341 l_adr_accounting_coa_id NUMBER;
176342 l_adr_flexfield_segment_code VARCHAR2(30);
176343 l_adr_flex_value_set_id NUMBER;
176344 l_adr_value_type_code VARCHAR2(30);
176345 l_adr_value_combination_id NUMBER;
176346 l_adr_value_segment_code VARCHAR2(30);
176347
176348 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
176349 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
176350 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
176351 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
176352
176353 -- 4262811 Variables ------------------------------------------------------------------------------------------
176354 l_entered_amt_idx NUMBER;
176355 l_accted_amt_idx NUMBER;
176356 l_acc_rev_flag VARCHAR2(1);
176357 l_accrual_line_num NUMBER;
176358 l_tmp_amt NUMBER;
176359 l_acc_rev_natural_side_code VARCHAR2(1);
176360
176361 l_num_entries NUMBER;
176362 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
176363 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
176364 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
176365 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
176366 l_recog_line_1 NUMBER;
176367 l_recog_line_2 NUMBER;
176368
176369 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
176370 l_bflow_applied_to_amt NUMBER; -- 5132302
176371 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
176372
176373 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
176374
176375 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
176376 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
176377
176378 ---------------------------------------------------------------------------------------------------------------
176379
176380
176381 --
176382 -- bulk performance
176383 --
176384 l_balance_type_code VARCHAR2(1);
176385 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
176386 l_log_module VARCHAR2(240);
176387
176388 --
176389 -- Upgrade strategy
176390 --
176391 l_actual_upg_option VARCHAR2(1);
176392 l_enc_upg_option VARCHAR2(1);
176393
176394 --
176395 BEGIN
176396 --
176397 IF g_log_enabled THEN
176398 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_413';
176399 END IF;
176400 --
176401 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
176402
176403 trace
176404 (p_msg => 'BEGIN of AcctLineType_413'
176405 ,p_level => C_LEVEL_PROCEDURE
176406 ,p_module => l_log_module);
176407
176408 END IF;
176409 --
176410 l_component_type := 'AMB_JLT';
176411 l_component_code := 'FA_UNITADJ_SOURCE_DEPRN_RES';
176412 l_component_type_code := 'S';
176413 l_component_appl_id := 140;
176414 l_amb_context_code := 'DEFAULT';
176415 l_entity_code := 'TRANSACTIONS';
176416 l_event_class_code := 'UNIT_ADJUSTMENTS';
176417 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
176418 l_line_definition_owner_code := 'S';
176419 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
176420 --
176421 l_balance_type_code := 'A';
176422 l_segment := NULL;
176423 l_ccid := NULL;
176424 l_adr_transaction_coa_id := NULL;
176425 l_adr_accounting_coa_id := NULL;
176426 l_adr_flexfield_segment_code := NULL;
176427 l_adr_flex_value_set_id := NULL;
176428 l_adr_value_type_code := NULL;
176429 l_adr_value_combination_id := NULL;
176430 l_adr_value_segment_code := NULL;
176431
176432 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
176433 l_bflow_class_code := ''; -- 4219869 Business Flow
176434 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
176435 l_budgetary_control_flag := 'N';
176436
176437 l_bflow_applied_to_amt_idx := NULL; -- 5132302
176438 l_bflow_applied_to_amt := NULL; -- 5132302
176439 l_entered_amt_idx := NULL; -- 4262811
176440 l_accted_amt_idx := NULL; -- 4262811
176441 l_acc_rev_flag := NULL; -- 4262811
176442 l_accrual_line_num := NULL; -- 4262811
176443 l_tmp_amt := NULL; -- 4262811
176444 --
176445
176446 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
176450 NVL(p_source_48,'
176447 l_balance_type_code <> 'B' THEN
176448 IF (NVL(p_source_48,'
176449 ') = 'RESERVE' OR
176451 ') = 'EXPENSE') AND
176452 NVL(p_source_55,'
176453 ') = 'SOURCE'
176454 THEN
176455
176456 --
176457 XLA_AE_LINES_PKG.SetNewLine;
176458
176459 p_balance_type_code := l_balance_type_code;
176460 -- set the flag so later we will know whether the gain loss line needs to be created
176461
176462 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
176463 p_actual_flag :='A';
176464 END IF;
176465
176466 --
176467 -- bulk performance
176468 --
176469 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
176470 p_header_num => 0); -- 4262811
176471 --
176472 -- set accounting line options
176473 --
176474 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
176475 p_natural_side_code => 'D'
176476 , p_gain_or_loss_flag => 'N'
176477 , p_gl_transfer_mode_code => 'S'
176478 , p_acct_entry_type_code => 'A'
176479 , p_switch_side_flag => 'Y'
176480 , p_merge_duplicate_code => 'N'
176481 );
176482 --
176483 l_acc_rev_natural_side_code := 'C'; -- 4262811
176484 --
176485 --
176486 -- set accounting line type info
176487 --
176488 xla_ae_lines_pkg.SetAcctLineType
176489 (p_component_type => l_component_type
176490 ,p_event_type_code => l_event_type_code
176491 ,p_line_definition_owner_code => l_line_definition_owner_code
176492 ,p_line_definition_code => l_line_definition_code
176493 ,p_accounting_line_code => l_component_code
176494 ,p_accounting_line_type_code => l_component_type_code
176495 ,p_accounting_line_appl_id => l_component_appl_id
176496 ,p_amb_context_code => l_amb_context_code
176497 ,p_entity_code => l_entity_code
176498 ,p_event_class_code => l_event_class_code);
176499 --
176500 -- set accounting class
176501 --
176502 xla_ae_lines_pkg.SetAcctClass(
176503 p_accounting_class_code => 'ASSET'
176504 , p_ae_header_id => l_ae_header_id
176505 );
176506
176507 --
176508 -- set rounding class
176509 --
176510 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
176511 'ASSET';
176512
176513 --
176514 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
176515 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
176516 --
176517 -- bulk performance
176518 --
176519 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
176520
176521 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
176522 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
176523
176524 -- 4955764
176525 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
176526 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
176527
176528 -- 4458381 Public Sector Enh
176529
176530 --
176531 -- set accounting attributes for the line type
176532 --
176533 l_entered_amt_idx := 4;
176534 l_accted_amt_idx := 6;
176535 l_bflow_applied_to_amt_idx := NULL; -- 5132302
176536 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
176537 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
176538 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
176539 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
176540 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
176541 l_rec_acct_attrs.array_char_value(3) := p_source_51;
176542 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
176543 l_rec_acct_attrs.array_num_value(4) := p_source_52;
176544 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
176545 l_rec_acct_attrs.array_char_value(5) := p_source_53;
176546 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
176547 l_rec_acct_attrs.array_num_value(6) := p_source_52;
176548
176549 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
176550 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
176551
176552 ---------------------------------------------------------------------------------------------------------------
176553 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
176554 ---------------------------------------------------------------------------------------------------------------
176555 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
176556
176557 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
176558 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
176559
176560 IF xla_accounting_cache_pkg.GetValueChar
176561 (p_source_code => 'LEDGER_CATEGORY_CODE'
176562 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
176563 AND l_bflow_method_code = 'PRIOR_ENTRY'
176567 )
176564 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
176565 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
176566 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
176568 THEN
176569 xla_ae_lines_pkg.BflowUpgEntry
176570 (p_business_method_code => l_bflow_method_code
176571 ,p_business_class_code => l_bflow_class_code
176572 ,p_balance_type => l_balance_type_code);
176573 ELSE
176574 NULL;
176575 -- No business flow processing for business flow method of NONE.
176576 END IF;
176577
176578 --
176579 -- call analytical criteria
176580 --
176581
176582 --
176583 -- call description
176584 --
176585
176586 xla_ae_lines_pkg.SetLineDescription(
176587 p_ae_header_id => l_ae_header_id
176588 ,p_description => Description_137 (
176589 p_application_id => p_application_id
176590 , p_ae_header_id => l_ae_header_id
176591 , p_source_1 => p_source_1
176592 )
176593 );
176594
176595
176596 --
176597 -- call ADRs
176598 -- Bug 4922099
176599 --
176600 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
176601 (NVL(l_actual_upg_option, 'N') = 'O') OR
176602 (NVL(l_enc_upg_option, 'N') = 'O')
176603 )
176604 THEN
176605 NULL;
176606 --
176607 --
176608
176609 l_ccid := AcctDerRule_175(
176610 p_application_id => p_application_id
176611 , p_ae_header_id => l_ae_header_id
176612 , p_source_5 => p_source_5
176613 , p_source_19 => p_source_19
176614 , p_source_32 => p_source_32
176615 , x_transaction_coa_id => l_adr_transaction_coa_id
176616 , x_accounting_coa_id => l_adr_accounting_coa_id
176617 , x_value_type_code => l_adr_value_type_code
176618 , p_side => 'NA'
176619 );
176620
176621 xla_ae_lines_pkg.set_ccid(
176622 p_code_combination_id => l_ccid
176623 , p_value_type_code => l_adr_value_type_code
176624 , p_transaction_coa_id => l_adr_transaction_coa_id
176625 , p_accounting_coa_id => l_adr_accounting_coa_id
176626 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
176627 , p_adr_type_code => 'S'
176628 , p_component_type => l_component_type
176629 , p_component_code => l_component_code
176630 , p_component_type_code => l_component_type_code
176631 , p_component_appl_id => l_component_appl_id
176632 , p_amb_context_code => l_amb_context_code
176633 , p_side => 'NA'
176634 );
176635
176636
176637 l_segment := AcctDerRule_150(
176638 p_application_id => p_application_id
176639 , p_ae_header_id => l_ae_header_id
176640 , p_source_5 => p_source_5
176641 , p_source_12 => p_source_12
176642 , x_transaction_coa_id => l_adr_transaction_coa_id
176643 , x_accounting_coa_id => l_adr_accounting_coa_id
176644 , x_flexfield_segment_code => l_adr_flexfield_segment_code
176645 , x_flex_value_set_id => l_adr_flex_value_set_id
176646 , x_value_type_code => l_adr_value_type_code
176647 , x_value_combination_id => l_adr_value_combination_id
176648 , x_value_segment_code => l_adr_value_segment_code
176649 , p_side => 'NA'
176650 , p_override_seg_flag => 'Y'
176651 );
176652
176653 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
176654
176655 xla_ae_lines_pkg.set_segment(
176656 p_to_segment_code => 'GL_ACCOUNT'
176657 , p_segment_value => l_segment
176658 , p_from_segment_code => l_adr_value_segment_code
176659 , p_from_combination_id => l_adr_value_combination_id
176660 , p_value_type_code => l_adr_value_type_code
176661 , p_transaction_coa_id => l_adr_transaction_coa_id
176662 , p_accounting_coa_id => l_adr_accounting_coa_id
176663 , p_flexfield_segment_code => l_adr_flexfield_segment_code
176664 , p_flex_value_set_id => l_adr_flex_value_set_id
176665 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
176666 , p_adr_type_code => 'S'
176667 , p_component_type => l_component_type
176668 , p_component_code => l_component_code
176669 , p_component_type_code => l_component_type_code
176670 , p_component_appl_id => l_component_appl_id
176671 , p_amb_context_code => l_amb_context_code
176672 , p_entity_code => 'TRANSACTIONS'
176673 , p_event_class_code => 'UNIT_ADJUSTMENTS'
176674 , p_side => 'NA'
176675 );
176676
176677 END IF;
176678
176679 l_segment := AcctDerRule_169(
176680 p_application_id => p_application_id
176681 , p_ae_header_id => l_ae_header_id
176682 , p_source_5 => p_source_5
176683 , p_source_31 => p_source_31
176684 , x_transaction_coa_id => l_adr_transaction_coa_id
176685 , x_accounting_coa_id => l_adr_accounting_coa_id
176686 , x_flexfield_segment_code => l_adr_flexfield_segment_code
176687 , x_flex_value_set_id => l_adr_flex_value_set_id
176688 , x_value_type_code => l_adr_value_type_code
176692 , p_override_seg_flag => 'Y'
176689 , x_value_combination_id => l_adr_value_combination_id
176690 , x_value_segment_code => l_adr_value_segment_code
176691 , p_side => 'NA'
176693 );
176694
176695 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
176696
176697 xla_ae_lines_pkg.set_segment(
176698 p_to_segment_code => 'GL_BALANCING'
176699 , p_segment_value => l_segment
176700 , p_from_segment_code => l_adr_value_segment_code
176701 , p_from_combination_id => l_adr_value_combination_id
176702 , p_value_type_code => l_adr_value_type_code
176703 , p_transaction_coa_id => l_adr_transaction_coa_id
176704 , p_accounting_coa_id => l_adr_accounting_coa_id
176705 , p_flexfield_segment_code => l_adr_flexfield_segment_code
176706 , p_flex_value_set_id => l_adr_flex_value_set_id
176707 , p_adr_code => 'FA_EXPENSE_ACCT'
176708 , p_adr_type_code => 'S'
176709 , p_component_type => l_component_type
176710 , p_component_code => l_component_code
176711 , p_component_type_code => l_component_type_code
176712 , p_component_appl_id => l_component_appl_id
176713 , p_amb_context_code => l_amb_context_code
176714 , p_entity_code => 'TRANSACTIONS'
176715 , p_event_class_code => 'UNIT_ADJUSTMENTS'
176716 , p_side => 'NA'
176717 );
176718
176719 END IF;
176720
176721 --
176722 --
176723 END IF;
176724 --
176725 -- Bug 4922099
176726 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
176727 (NVL(l_enc_upg_option, 'N') = 'O')
176728 ) AND
176729 (l_bflow_method_code = 'PRIOR_ENTRY')
176730 )
176731 THEN
176732 IF
176733 --
176734 1 = 2
176735 --
176736 THEN
176737 xla_accounting_err_pkg.build_message
176738 (p_appli_s_name => 'XLA'
176739 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
176740 ,p_token_1 => 'LINE_NUMBER'
176741 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
176742 ,p_token_2 => 'LINE_TYPE_NAME'
176743 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
176744 l_component_type
176745 ,l_component_code
176746 ,l_component_type_code
176747 ,l_component_appl_id
176748 ,l_amb_context_code
176749 ,l_entity_code
176750 ,l_event_class_code
176751 )
176752 ,p_token_3 => 'OWNER'
176753 ,p_value_3 => xla_lookups_pkg.get_meaning(
176754 p_lookup_type => 'XLA_OWNER_TYPE'
176755 ,p_lookup_code => l_component_type_code
176756 )
176757 ,p_token_4 => 'PRODUCT_NAME'
176758 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
176759 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
176760 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
176761 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
176762 ,p_ae_header_id => NULL
176763 );
176764
176765 IF (C_LEVEL_ERROR>= g_log_level) THEN
176766 trace
176767 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
176768 ,p_level => C_LEVEL_ERROR
176769 ,p_module => l_log_module);
176770 END IF;
176771 END IF;
176772 END IF;
176773 --
176774 --
176775 ------------------------------------------------------------------------------------------------
176776 -- 4219869 Business Flow
176777 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
176778 -- Prior Entry. Currently, the following code is always generated.
176779 ------------------------------------------------------------------------------------------------
176780 XLA_AE_LINES_PKG.ValidateCurrentLine;
176781
176782 ------------------------------------------------------------------------------------
176783 -- 4219869 Business Flow
176784 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
176785 ------------------------------------------------------------------------------------
176789 -- 4219869 Business Flow
176786 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
176787
176788 ----------------------------------------------------------------------------------
176790 -- Update journal entry status -- Need to generate this within IF <condition>
176791 ----------------------------------------------------------------------------------
176792 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
176793 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
176794 ,p_balance_type_code => l_balance_type_code
176795 );
176796
176797 -------------------------------------------------------------------------------------------
176798 -- 4262811 - Generate the Accrual Reversal lines
176799 -------------------------------------------------------------------------------------------
176800 BEGIN
176801 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
176802 (g_array_event(p_event_id).array_value_num('header_index'));
176803 IF l_acc_rev_flag IS NULL THEN
176804 l_acc_rev_flag := 'N';
176805 END IF;
176806 EXCEPTION
176807 WHEN OTHERS THEN
176808 l_acc_rev_flag := 'N';
176809 END;
176810 --
176811 IF (l_acc_rev_flag = 'Y') THEN
176812
176813 -- 4645092 ------------------------------------------------------------------------------
176814 -- To allow MPA report to determine if it should generate report process
176815 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
176816 ------------------------------------------------------------------------------------------
176817
176818 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
176819 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
176820 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
176821 -- call ADRs
176822 -- Bug 4922099
176823 --
176824 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
176825 (NVL(l_actual_upg_option, 'N') = 'O') OR
176826 (NVL(l_enc_upg_option, 'N') = 'O')
176827 )
176828 THEN
176829 NULL;
176830 --
176831 --
176832
176833 l_ccid := AcctDerRule_175(
176834 p_application_id => p_application_id
176835 , p_ae_header_id => l_ae_header_id
176836 , p_source_5 => p_source_5
176837 , p_source_19 => p_source_19
176838 , p_source_32 => p_source_32
176839 , x_transaction_coa_id => l_adr_transaction_coa_id
176840 , x_accounting_coa_id => l_adr_accounting_coa_id
176841 , x_value_type_code => l_adr_value_type_code
176842 , p_side => 'NA'
176843 );
176844
176845 xla_ae_lines_pkg.set_ccid(
176846 p_code_combination_id => l_ccid
176847 , p_value_type_code => l_adr_value_type_code
176848 , p_transaction_coa_id => l_adr_transaction_coa_id
176849 , p_accounting_coa_id => l_adr_accounting_coa_id
176850 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
176851 , p_adr_type_code => 'S'
176852 , p_component_type => l_component_type
176853 , p_component_code => l_component_code
176854 , p_component_type_code => l_component_type_code
176855 , p_component_appl_id => l_component_appl_id
176856 , p_amb_context_code => l_amb_context_code
176857 , p_side => 'NA'
176858 );
176859
176860
176861 l_segment := AcctDerRule_150(
176862 p_application_id => p_application_id
176863 , p_ae_header_id => l_ae_header_id
176864 , p_source_5 => p_source_5
176865 , p_source_12 => p_source_12
176866 , x_transaction_coa_id => l_adr_transaction_coa_id
176867 , x_accounting_coa_id => l_adr_accounting_coa_id
176868 , x_flexfield_segment_code => l_adr_flexfield_segment_code
176869 , x_flex_value_set_id => l_adr_flex_value_set_id
176870 , x_value_type_code => l_adr_value_type_code
176871 , x_value_combination_id => l_adr_value_combination_id
176872 , x_value_segment_code => l_adr_value_segment_code
176873 , p_side => 'NA'
176874 , p_override_seg_flag => 'Y'
176875 );
176876
176877 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
176878
176879 xla_ae_lines_pkg.set_segment(
176880 p_to_segment_code => 'GL_ACCOUNT'
176881 , p_segment_value => l_segment
176882 , p_from_segment_code => l_adr_value_segment_code
176883 , p_from_combination_id => l_adr_value_combination_id
176884 , p_value_type_code => l_adr_value_type_code
176885 , p_transaction_coa_id => l_adr_transaction_coa_id
176886 , p_accounting_coa_id => l_adr_accounting_coa_id
176887 , p_flexfield_segment_code => l_adr_flexfield_segment_code
176888 , p_flex_value_set_id => l_adr_flex_value_set_id
176889 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
176890 , p_adr_type_code => 'S'
176891 , p_component_type => l_component_type
176892 , p_component_code => l_component_code
176893 , p_component_type_code => l_component_type_code
176894 , p_component_appl_id => l_component_appl_id
176895 , p_amb_context_code => l_amb_context_code
176899 );
176896 , p_entity_code => 'TRANSACTIONS'
176897 , p_event_class_code => 'UNIT_ADJUSTMENTS'
176898 , p_side => 'NA'
176900
176901 END IF;
176902
176903 l_segment := AcctDerRule_169(
176904 p_application_id => p_application_id
176905 , p_ae_header_id => l_ae_header_id
176906 , p_source_5 => p_source_5
176907 , p_source_31 => p_source_31
176908 , x_transaction_coa_id => l_adr_transaction_coa_id
176909 , x_accounting_coa_id => l_adr_accounting_coa_id
176910 , x_flexfield_segment_code => l_adr_flexfield_segment_code
176911 , x_flex_value_set_id => l_adr_flex_value_set_id
176912 , x_value_type_code => l_adr_value_type_code
176913 , x_value_combination_id => l_adr_value_combination_id
176914 , x_value_segment_code => l_adr_value_segment_code
176915 , p_side => 'NA'
176916 , p_override_seg_flag => 'Y'
176917 );
176918
176919 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
176920
176921 xla_ae_lines_pkg.set_segment(
176922 p_to_segment_code => 'GL_BALANCING'
176923 , p_segment_value => l_segment
176924 , p_from_segment_code => l_adr_value_segment_code
176925 , p_from_combination_id => l_adr_value_combination_id
176926 , p_value_type_code => l_adr_value_type_code
176927 , p_transaction_coa_id => l_adr_transaction_coa_id
176928 , p_accounting_coa_id => l_adr_accounting_coa_id
176929 , p_flexfield_segment_code => l_adr_flexfield_segment_code
176930 , p_flex_value_set_id => l_adr_flex_value_set_id
176931 , p_adr_code => 'FA_EXPENSE_ACCT'
176932 , p_adr_type_code => 'S'
176933 , p_component_type => l_component_type
176934 , p_component_code => l_component_code
176935 , p_component_type_code => l_component_type_code
176936 , p_component_appl_id => l_component_appl_id
176937 , p_amb_context_code => l_amb_context_code
176938 , p_entity_code => 'TRANSACTIONS'
176939 , p_event_class_code => 'UNIT_ADJUSTMENTS'
176940 , p_side => 'NA'
176941 );
176942
176943 END IF;
176944
176945 --
176946 --
176947 END IF;
176948
176949 --
176950 -- Update the line information that should be overwritten
176951 --
176952 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
176953 p_header_num => 1);
176954 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
176955
176956 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
176957
176958 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
176959 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
176960 END IF;
176961
176962 --
176963 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
176964 --
176965 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
176966 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
176967 ELSE
176968 ---------------------------------------------------------------------------------------------------
176969 -- 4262811a Switch Sign
176970 ---------------------------------------------------------------------------------------------------
176971 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
176972 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
176973 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
176974 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
176975 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
176976 -- 5132302
176977 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
176978 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
176979
176980 END IF;
176981
176982 -- 4955764
176983 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
176984 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
176985
176986
176987 XLA_AE_LINES_PKG.ValidateCurrentLine;
176988 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
176989
176990 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
176991 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
176992 ,p_balance_type_code => l_balance_type_code);
176993
176994 END IF;
176995
176996 -----------------------------------------------------------------------------------------
176997 -- 4262811 Multiperiod Accounting
176998 -----------------------------------------------------------------------------------------
176999 -- No MPA option is assigned.
177000
177001
177002 END IF;
177003 END IF;
177004 --
177008 trace
177005
177006 --
177007 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
177009 (p_msg => 'END of AcctLineType_413'
177010 ,p_level => C_LEVEL_PROCEDURE
177011 ,p_module => l_log_module);
177012 END IF;
177013 --
177014 EXCEPTION
177015 WHEN xla_exceptions_pkg.application_exception THEN
177016 RAISE;
177017 WHEN OTHERS THEN
177018 xla_exceptions_pkg.raise_message
177019 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_413');
177020 END AcctLineType_413;
177021 --
177022
177023 ---------------------------------------
177024 --
177025 -- PRIVATE FUNCTION
177026 -- AcctLineType_414
177027 --
177028 ---------------------------------------
177029 PROCEDURE AcctLineType_414 (
177030 p_application_id IN NUMBER
177031 ,p_event_id IN NUMBER
177032 ,p_calculate_acctd_flag IN VARCHAR2
177033 ,p_calculate_g_l_flag IN VARCHAR2
177034 ,p_actual_flag IN OUT VARCHAR2
177035 ,p_balance_type_code OUT VARCHAR2
177036 ,p_gain_or_loss_ref OUT VARCHAR2
177037
177038 --Period Close Date
177039 , p_source_1 IN DATE
177040 --Generated Code Combination Identifier
177041 , p_source_5 IN NUMBER
177042 --Expense Account Code Combination Identifier
177043 , p_source_31 IN NUMBER
177044 --Adjustment Type
177045 , p_source_48 IN VARCHAR2
177046 --Transaction Header Identifier
177047 , p_source_49 IN NUMBER
177048 --Adjustment Line Identifier
177049 , p_source_50 IN NUMBER
177050 --Distribution Type Code
177051 , p_source_51 IN VARCHAR2
177052 --Entered Amount
177053 , p_source_52 IN NUMBER
177054 --Currency Code
177055 , p_source_53 IN VARCHAR2
177056 --Source Destination Code
177057 , p_source_55 IN VARCHAR2
177058 )
177059 IS
177060
177061 l_component_type VARCHAR2(80);
177062 l_component_code VARCHAR2(30);
177063 l_component_type_code VARCHAR2(1);
177064 l_component_appl_id INTEGER;
177065 l_amb_context_code VARCHAR2(30);
177066 l_entity_code VARCHAR2(30);
177067 l_event_class_code VARCHAR2(30);
177068 l_ae_header_id NUMBER;
177069 l_event_type_code VARCHAR2(30);
177070 l_line_definition_code VARCHAR2(30);
177071 l_line_definition_owner_code VARCHAR2(1);
177072 --
177073 -- adr variables
177074 l_segment VARCHAR2(30);
177075 l_ccid NUMBER;
177076 l_adr_transaction_coa_id NUMBER;
177077 l_adr_accounting_coa_id NUMBER;
177078 l_adr_flexfield_segment_code VARCHAR2(30);
177079 l_adr_flex_value_set_id NUMBER;
177080 l_adr_value_type_code VARCHAR2(30);
177081 l_adr_value_combination_id NUMBER;
177082 l_adr_value_segment_code VARCHAR2(30);
177083
177084 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
177085 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
177086 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
177087 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
177088
177089 -- 4262811 Variables ------------------------------------------------------------------------------------------
177090 l_entered_amt_idx NUMBER;
177091 l_accted_amt_idx NUMBER;
177092 l_acc_rev_flag VARCHAR2(1);
177093 l_accrual_line_num NUMBER;
177094 l_tmp_amt NUMBER;
177095 l_acc_rev_natural_side_code VARCHAR2(1);
177096
177097 l_num_entries NUMBER;
177098 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
177099 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
177100 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
177101 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
177102 l_recog_line_1 NUMBER;
177103 l_recog_line_2 NUMBER;
177104
177105 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
177106 l_bflow_applied_to_amt NUMBER; -- 5132302
177107 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
177108
177109 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
177110
177111 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
177112 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
177113
177114 ---------------------------------------------------------------------------------------------------------------
177115
177116
177117 --
177118 -- bulk performance
177119 --
177120 l_balance_type_code VARCHAR2(1);
177121 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
177122 l_log_module VARCHAR2(240);
177123
177124 --
177125 -- Upgrade strategy
177126 --
177127 l_actual_upg_option VARCHAR2(1);
177128 l_enc_upg_option VARCHAR2(1);
177129
177130 --
177131 BEGIN
177132 --
177133 IF g_log_enabled THEN
177134 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_414';
177135 END IF;
177136 --
177137 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
177138
177139 trace
177140 (p_msg => 'BEGIN of AcctLineType_414'
177141 ,p_level => C_LEVEL_PROCEDURE
177142 ,p_module => l_log_module);
177143
177144 END IF;
177145 --
177149 l_component_appl_id := 140;
177146 l_component_type := 'AMB_JLT';
177147 l_component_code := 'FA_UNITADJ_SOURCE_EXP_BAL';
177148 l_component_type_code := 'S';
177150 l_amb_context_code := 'DEFAULT';
177151 l_entity_code := 'TRANSACTIONS';
177152 l_event_class_code := 'UNIT_ADJUSTMENTS';
177153 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
177154 l_line_definition_owner_code := 'S';
177155 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
177156 --
177157 l_balance_type_code := 'A';
177158 l_segment := NULL;
177159 l_ccid := NULL;
177160 l_adr_transaction_coa_id := NULL;
177161 l_adr_accounting_coa_id := NULL;
177162 l_adr_flexfield_segment_code := NULL;
177163 l_adr_flex_value_set_id := NULL;
177164 l_adr_value_type_code := NULL;
177165 l_adr_value_combination_id := NULL;
177166 l_adr_value_segment_code := NULL;
177167
177168 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
177169 l_bflow_class_code := ''; -- 4219869 Business Flow
177170 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
177171 l_budgetary_control_flag := 'N';
177172
177173 l_bflow_applied_to_amt_idx := NULL; -- 5132302
177174 l_bflow_applied_to_amt := NULL; -- 5132302
177175 l_entered_amt_idx := NULL; -- 4262811
177176 l_accted_amt_idx := NULL; -- 4262811
177177 l_acc_rev_flag := NULL; -- 4262811
177178 l_accrual_line_num := NULL; -- 4262811
177179 l_tmp_amt := NULL; -- 4262811
177180 --
177181
177182 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
177183 l_balance_type_code <> 'B' THEN
177184 IF NVL(p_source_48,'
177185 ') = 'BONUS EXPENSE' AND
177186 NVL(p_source_55,'
177187 ') = 'SOURCE'
177188 THEN
177189
177190 --
177191 XLA_AE_LINES_PKG.SetNewLine;
177192
177193 p_balance_type_code := l_balance_type_code;
177194 -- set the flag so later we will know whether the gain loss line needs to be created
177195
177196 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
177197 p_actual_flag :='A';
177198 END IF;
177199
177200 --
177201 -- bulk performance
177202 --
177203 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
177204 p_header_num => 0); -- 4262811
177205 --
177206 -- set accounting line options
177207 --
177208 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
177209 p_natural_side_code => 'D'
177210 , p_gain_or_loss_flag => 'N'
177211 , p_gl_transfer_mode_code => 'S'
177212 , p_acct_entry_type_code => 'A'
177213 , p_switch_side_flag => 'Y'
177214 , p_merge_duplicate_code => 'N'
177215 );
177216 --
177217 l_acc_rev_natural_side_code := 'C'; -- 4262811
177218 --
177219 --
177220 -- set accounting line type info
177221 --
177222 xla_ae_lines_pkg.SetAcctLineType
177223 (p_component_type => l_component_type
177224 ,p_event_type_code => l_event_type_code
177225 ,p_line_definition_owner_code => l_line_definition_owner_code
177226 ,p_line_definition_code => l_line_definition_code
177227 ,p_accounting_line_code => l_component_code
177228 ,p_accounting_line_type_code => l_component_type_code
177229 ,p_accounting_line_appl_id => l_component_appl_id
177230 ,p_amb_context_code => l_amb_context_code
177231 ,p_entity_code => l_entity_code
177232 ,p_event_class_code => l_event_class_code);
177233 --
177234 -- set accounting class
177235 --
177236 xla_ae_lines_pkg.SetAcctClass(
177237 p_accounting_class_code => 'EXPENSE'
177238 , p_ae_header_id => l_ae_header_id
177239 );
177240
177241 --
177242 -- set rounding class
177243 --
177244 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
177245 'EXPENSE';
177246
177247 --
177248 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
177249 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
177250 --
177251 -- bulk performance
177252 --
177253 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
177254
177255 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
177256 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
177257
177258 -- 4955764
177259 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
177260 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
177261
177262 -- 4458381 Public Sector Enh
177263
177264 --
177265 -- set accounting attributes for the line type
177266 --
177267 l_entered_amt_idx := 4;
177268 l_accted_amt_idx := 6;
177269 l_bflow_applied_to_amt_idx := NULL; -- 5132302
177270 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
177274 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
177271 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
177272 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
177273 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
177275 l_rec_acct_attrs.array_char_value(3) := p_source_51;
177276 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
177277 l_rec_acct_attrs.array_num_value(4) := p_source_52;
177278 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
177279 l_rec_acct_attrs.array_char_value(5) := p_source_53;
177280 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
177281 l_rec_acct_attrs.array_num_value(6) := p_source_52;
177282
177283 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
177284 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
177285
177286 ---------------------------------------------------------------------------------------------------------------
177287 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
177288 ---------------------------------------------------------------------------------------------------------------
177289 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
177290
177291 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
177292 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
177293
177294 IF xla_accounting_cache_pkg.GetValueChar
177295 (p_source_code => 'LEDGER_CATEGORY_CODE'
177296 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
177297 AND l_bflow_method_code = 'PRIOR_ENTRY'
177298 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
177299 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
177300 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
177301 )
177302 THEN
177303 xla_ae_lines_pkg.BflowUpgEntry
177304 (p_business_method_code => l_bflow_method_code
177305 ,p_business_class_code => l_bflow_class_code
177306 ,p_balance_type => l_balance_type_code);
177307 ELSE
177308 NULL;
177309 -- No business flow processing for business flow method of NONE.
177310 END IF;
177311
177312 --
177313 -- call analytical criteria
177314 --
177315
177316 --
177317 -- call description
177318 --
177319
177320 xla_ae_lines_pkg.SetLineDescription(
177321 p_ae_header_id => l_ae_header_id
177322 ,p_description => Description_134 (
177323 p_application_id => p_application_id
177324 , p_ae_header_id => l_ae_header_id
177325 , p_source_1 => p_source_1
177326 )
177327 );
177328
177329
177330 --
177331 -- call ADRs
177332 -- Bug 4922099
177333 --
177334 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
177335 (NVL(l_actual_upg_option, 'N') = 'O') OR
177336 (NVL(l_enc_upg_option, 'N') = 'O')
177337 )
177338 THEN
177339 NULL;
177340 --
177341 --
177342
177343 l_ccid := AcctDerRule_176(
177344 p_application_id => p_application_id
177345 , p_ae_header_id => l_ae_header_id
177346 , p_source_5 => p_source_5
177347 , p_source_31 => p_source_31
177348 , x_transaction_coa_id => l_adr_transaction_coa_id
177349 , x_accounting_coa_id => l_adr_accounting_coa_id
177350 , x_value_type_code => l_adr_value_type_code
177351 , p_side => 'NA'
177352 );
177353
177354 xla_ae_lines_pkg.set_ccid(
177355 p_code_combination_id => l_ccid
177356 , p_value_type_code => l_adr_value_type_code
177357 , p_transaction_coa_id => l_adr_transaction_coa_id
177358 , p_accounting_coa_id => l_adr_accounting_coa_id
177359 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
177360 , p_adr_type_code => 'S'
177361 , p_component_type => l_component_type
177362 , p_component_code => l_component_code
177363 , p_component_type_code => l_component_type_code
177364 , p_component_appl_id => l_component_appl_id
177365 , p_amb_context_code => l_amb_context_code
177366 , p_side => 'NA'
177367 );
177368
177369
177370 --
177371 --
177372 END IF;
177373 --
177374 -- Bug 4922099
177375 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
177376 (NVL(l_enc_upg_option, 'N') = 'O')
177377 ) AND
177378 (l_bflow_method_code = 'PRIOR_ENTRY')
177379 )
177380 THEN
177381 IF
177382 --
177383 1 = 2
177384 --
177385 THEN
177386 xla_accounting_err_pkg.build_message
177387 (p_appli_s_name => 'XLA'
177388 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
177389 ,p_token_1 => 'LINE_NUMBER'
177390 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
177391 ,p_token_2 => 'LINE_TYPE_NAME'
177395 ,l_component_type_code
177392 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
177393 l_component_type
177394 ,l_component_code
177396 ,l_component_appl_id
177397 ,l_amb_context_code
177398 ,l_entity_code
177399 ,l_event_class_code
177400 )
177401 ,p_token_3 => 'OWNER'
177402 ,p_value_3 => xla_lookups_pkg.get_meaning(
177403 p_lookup_type => 'XLA_OWNER_TYPE'
177404 ,p_lookup_code => l_component_type_code
177405 )
177406 ,p_token_4 => 'PRODUCT_NAME'
177407 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
177408 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
177409 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
177410 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
177411 ,p_ae_header_id => NULL
177412 );
177413
177414 IF (C_LEVEL_ERROR>= g_log_level) THEN
177415 trace
177416 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
177417 ,p_level => C_LEVEL_ERROR
177418 ,p_module => l_log_module);
177419 END IF;
177420 END IF;
177421 END IF;
177422 --
177423 --
177424 ------------------------------------------------------------------------------------------------
177425 -- 4219869 Business Flow
177426 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
177427 -- Prior Entry. Currently, the following code is always generated.
177428 ------------------------------------------------------------------------------------------------
177429 XLA_AE_LINES_PKG.ValidateCurrentLine;
177430
177431 ------------------------------------------------------------------------------------
177432 -- 4219869 Business Flow
177433 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
177434 ------------------------------------------------------------------------------------
177435 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
177436
177437 ----------------------------------------------------------------------------------
177438 -- 4219869 Business Flow
177439 -- Update journal entry status -- Need to generate this within IF <condition>
177440 ----------------------------------------------------------------------------------
177441 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
177442 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
177443 ,p_balance_type_code => l_balance_type_code
177444 );
177445
177446 -------------------------------------------------------------------------------------------
177447 -- 4262811 - Generate the Accrual Reversal lines
177448 -------------------------------------------------------------------------------------------
177449 BEGIN
177450 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
177451 (g_array_event(p_event_id).array_value_num('header_index'));
177452 IF l_acc_rev_flag IS NULL THEN
177453 l_acc_rev_flag := 'N';
177454 END IF;
177455 EXCEPTION
177456 WHEN OTHERS THEN
177457 l_acc_rev_flag := 'N';
177458 END;
177459 --
177460 IF (l_acc_rev_flag = 'Y') THEN
177461
177462 -- 4645092 ------------------------------------------------------------------------------
177463 -- To allow MPA report to determine if it should generate report process
177464 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
177465 ------------------------------------------------------------------------------------------
177466
177467 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
177468 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
177469 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
177470 -- call ADRs
177471 -- Bug 4922099
177472 --
177473 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
177474 (NVL(l_actual_upg_option, 'N') = 'O') OR
177475 (NVL(l_enc_upg_option, 'N') = 'O')
177476 )
177477 THEN
177478 NULL;
177479 --
177480 --
177481
177482 l_ccid := AcctDerRule_176(
177483 p_application_id => p_application_id
177484 , p_ae_header_id => l_ae_header_id
177485 , p_source_5 => p_source_5
177486 , p_source_31 => p_source_31
177490 , p_side => 'NA'
177487 , x_transaction_coa_id => l_adr_transaction_coa_id
177488 , x_accounting_coa_id => l_adr_accounting_coa_id
177489 , x_value_type_code => l_adr_value_type_code
177491 );
177492
177493 xla_ae_lines_pkg.set_ccid(
177494 p_code_combination_id => l_ccid
177495 , p_value_type_code => l_adr_value_type_code
177496 , p_transaction_coa_id => l_adr_transaction_coa_id
177497 , p_accounting_coa_id => l_adr_accounting_coa_id
177498 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
177499 , p_adr_type_code => 'S'
177500 , p_component_type => l_component_type
177501 , p_component_code => l_component_code
177502 , p_component_type_code => l_component_type_code
177503 , p_component_appl_id => l_component_appl_id
177504 , p_amb_context_code => l_amb_context_code
177505 , p_side => 'NA'
177506 );
177507
177508
177509 --
177510 --
177511 END IF;
177512
177513 --
177514 -- Update the line information that should be overwritten
177515 --
177516 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
177517 p_header_num => 1);
177518 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
177519
177520 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
177521
177522 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
177523 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
177524 END IF;
177525
177526 --
177527 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
177528 --
177529 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
177530 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
177531 ELSE
177532 ---------------------------------------------------------------------------------------------------
177533 -- 4262811a Switch Sign
177534 ---------------------------------------------------------------------------------------------------
177535 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
177536 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
177537 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
177538 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
177539 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
177540 -- 5132302
177541 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
177542 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
177543
177544 END IF;
177545
177546 -- 4955764
177547 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
177548 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
177549
177550
177551 XLA_AE_LINES_PKG.ValidateCurrentLine;
177552 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
177553
177554 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
177555 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
177556 ,p_balance_type_code => l_balance_type_code);
177557
177558 END IF;
177559
177560 -----------------------------------------------------------------------------------------
177561 -- 4262811 Multiperiod Accounting
177562 -----------------------------------------------------------------------------------------
177563 -- No MPA option is assigned.
177564
177565
177566 END IF;
177567 END IF;
177568 --
177569
177570 --
177571 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
177572 trace
177573 (p_msg => 'END of AcctLineType_414'
177574 ,p_level => C_LEVEL_PROCEDURE
177575 ,p_module => l_log_module);
177576 END IF;
177577 --
177578 EXCEPTION
177579 WHEN xla_exceptions_pkg.application_exception THEN
177580 RAISE;
177581 WHEN OTHERS THEN
177582 xla_exceptions_pkg.raise_message
177583 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_414');
177584 END AcctLineType_414;
177585 --
177586
177587 ---------------------------------------
177588 --
177589 -- PRIVATE FUNCTION
177590 -- AcctLineType_415
177591 --
177592 ---------------------------------------
177593 PROCEDURE AcctLineType_415 (
177594 p_application_id IN NUMBER
177595 ,p_event_id IN NUMBER
177596 ,p_calculate_acctd_flag IN VARCHAR2
177597 ,p_calculate_g_l_flag IN VARCHAR2
177598 ,p_actual_flag IN OUT VARCHAR2
177599 ,p_balance_type_code OUT VARCHAR2
177600 ,p_gain_or_loss_ref OUT VARCHAR2
177601
177602 --Period Close Date
177603 , p_source_1 IN DATE
177604 --Generated Code Combination Identifier
177605 , p_source_5 IN NUMBER
177606 --Depreciation Reserve Account
177607 , p_source_12 IN VARCHAR2
177611 , p_source_31 IN NUMBER
177608 --Generated Offset Code Combination Identifier
177609 , p_source_19 IN NUMBER
177610 --Expense Account Code Combination Identifier
177612 --Default Code Combination Identifier
177613 , p_source_32 IN NUMBER
177614 --Adjustment Type
177615 , p_source_48 IN VARCHAR2
177616 --Transaction Header Identifier
177617 , p_source_49 IN NUMBER
177618 --Adjustment Line Identifier
177619 , p_source_50 IN NUMBER
177620 --Distribution Type Code
177621 , p_source_51 IN VARCHAR2
177622 --Entered Amount
177623 , p_source_52 IN NUMBER
177624 --Currency Code
177625 , p_source_53 IN VARCHAR2
177626 --Source Destination Code
177627 , p_source_55 IN VARCHAR2
177628 )
177629 IS
177630
177631 l_component_type VARCHAR2(80);
177632 l_component_code VARCHAR2(30);
177633 l_component_type_code VARCHAR2(1);
177634 l_component_appl_id INTEGER;
177635 l_amb_context_code VARCHAR2(30);
177636 l_entity_code VARCHAR2(30);
177637 l_event_class_code VARCHAR2(30);
177638 l_ae_header_id NUMBER;
177639 l_event_type_code VARCHAR2(30);
177640 l_line_definition_code VARCHAR2(30);
177641 l_line_definition_owner_code VARCHAR2(1);
177642 --
177643 -- adr variables
177644 l_segment VARCHAR2(30);
177645 l_ccid NUMBER;
177646 l_adr_transaction_coa_id NUMBER;
177647 l_adr_accounting_coa_id NUMBER;
177648 l_adr_flexfield_segment_code VARCHAR2(30);
177649 l_adr_flex_value_set_id NUMBER;
177650 l_adr_value_type_code VARCHAR2(30);
177651 l_adr_value_combination_id NUMBER;
177652 l_adr_value_segment_code VARCHAR2(30);
177653
177654 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
177655 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
177656 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
177657 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
177658
177659 -- 4262811 Variables ------------------------------------------------------------------------------------------
177660 l_entered_amt_idx NUMBER;
177661 l_accted_amt_idx NUMBER;
177662 l_acc_rev_flag VARCHAR2(1);
177663 l_accrual_line_num NUMBER;
177664 l_tmp_amt NUMBER;
177665 l_acc_rev_natural_side_code VARCHAR2(1);
177666
177667 l_num_entries NUMBER;
177668 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
177669 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
177670 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
177671 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
177672 l_recog_line_1 NUMBER;
177673 l_recog_line_2 NUMBER;
177674
177675 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
177676 l_bflow_applied_to_amt NUMBER; -- 5132302
177677 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
177678
177679 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
177680
177681 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
177682 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
177683
177684 ---------------------------------------------------------------------------------------------------------------
177685
177686
177687 --
177688 -- bulk performance
177689 --
177690 l_balance_type_code VARCHAR2(1);
177691 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
177692 l_log_module VARCHAR2(240);
177693
177694 --
177695 -- Upgrade strategy
177696 --
177697 l_actual_upg_option VARCHAR2(1);
177698 l_enc_upg_option VARCHAR2(1);
177699
177700 --
177701 BEGIN
177702 --
177703 IF g_log_enabled THEN
177704 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_415';
177705 END IF;
177706 --
177707 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
177708
177709 trace
177710 (p_msg => 'BEGIN of AcctLineType_415'
177711 ,p_level => C_LEVEL_PROCEDURE
177712 ,p_module => l_log_module);
177713
177714 END IF;
177715 --
177716 l_component_type := 'AMB_JLT';
177717 l_component_code := 'FA_UNITADJ_SOURCE_RESERVE_BAL';
177718 l_component_type_code := 'S';
177719 l_component_appl_id := 140;
177720 l_amb_context_code := 'DEFAULT';
177721 l_entity_code := 'TRANSACTIONS';
177722 l_event_class_code := 'UNIT_ADJUSTMENTS';
177723 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
177724 l_line_definition_owner_code := 'S';
177725 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
177726 --
177727 l_balance_type_code := 'A';
177728 l_segment := NULL;
177729 l_ccid := NULL;
177730 l_adr_transaction_coa_id := NULL;
177731 l_adr_accounting_coa_id := NULL;
177732 l_adr_flexfield_segment_code := NULL;
177733 l_adr_flex_value_set_id := NULL;
177734 l_adr_value_type_code := NULL;
177735 l_adr_value_combination_id := NULL;
177736 l_adr_value_segment_code := NULL;
177737
177738 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
177742
177739 l_bflow_class_code := ''; -- 4219869 Business Flow
177740 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
177741 l_budgetary_control_flag := 'N';
177743 l_bflow_applied_to_amt_idx := NULL; -- 5132302
177744 l_bflow_applied_to_amt := NULL; -- 5132302
177745 l_entered_amt_idx := NULL; -- 4262811
177746 l_accted_amt_idx := NULL; -- 4262811
177747 l_acc_rev_flag := NULL; -- 4262811
177748 l_accrual_line_num := NULL; -- 4262811
177749 l_tmp_amt := NULL; -- 4262811
177750 --
177751
177752 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
177753 l_balance_type_code <> 'B' THEN
177754 IF (NVL(p_source_48,'
177755 ') = 'BONUS EXPENSE' OR
177756 NVL(p_source_48,'
177757 ') = 'BONUS RESERVE') AND
177758 NVL(p_source_55,'
177759 ') = 'SOURCE'
177760 THEN
177761
177762 --
177763 XLA_AE_LINES_PKG.SetNewLine;
177764
177765 p_balance_type_code := l_balance_type_code;
177766 -- set the flag so later we will know whether the gain loss line needs to be created
177767
177768 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
177769 p_actual_flag :='A';
177770 END IF;
177771
177772 --
177773 -- bulk performance
177774 --
177775 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
177776 p_header_num => 0); -- 4262811
177777 --
177778 -- set accounting line options
177779 --
177780 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
177781 p_natural_side_code => 'C'
177782 , p_gain_or_loss_flag => 'N'
177783 , p_gl_transfer_mode_code => 'S'
177784 , p_acct_entry_type_code => 'A'
177785 , p_switch_side_flag => 'Y'
177786 , p_merge_duplicate_code => 'N'
177787 );
177788 --
177789 l_acc_rev_natural_side_code := 'D'; -- 4262811
177790 --
177791 --
177792 -- set accounting line type info
177793 --
177794 xla_ae_lines_pkg.SetAcctLineType
177795 (p_component_type => l_component_type
177796 ,p_event_type_code => l_event_type_code
177797 ,p_line_definition_owner_code => l_line_definition_owner_code
177798 ,p_line_definition_code => l_line_definition_code
177799 ,p_accounting_line_code => l_component_code
177800 ,p_accounting_line_type_code => l_component_type_code
177801 ,p_accounting_line_appl_id => l_component_appl_id
177802 ,p_amb_context_code => l_amb_context_code
177803 ,p_entity_code => l_entity_code
177804 ,p_event_class_code => l_event_class_code);
177805 --
177806 -- set accounting class
177807 --
177808 xla_ae_lines_pkg.SetAcctClass(
177809 p_accounting_class_code => 'ASSET'
177810 , p_ae_header_id => l_ae_header_id
177811 );
177812
177813 --
177814 -- set rounding class
177815 --
177816 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
177817 'ASSET';
177818
177819 --
177820 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
177821 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
177822 --
177823 -- bulk performance
177824 --
177825 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
177826
177827 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
177828 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
177829
177830 -- 4955764
177831 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
177832 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
177833
177834 -- 4458381 Public Sector Enh
177835
177836 --
177837 -- set accounting attributes for the line type
177838 --
177839 l_entered_amt_idx := 4;
177840 l_accted_amt_idx := 6;
177841 l_bflow_applied_to_amt_idx := NULL; -- 5132302
177842 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
177843 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
177844 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
177845 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
177846 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
177847 l_rec_acct_attrs.array_char_value(3) := p_source_51;
177848 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
177849 l_rec_acct_attrs.array_num_value(4) := p_source_52;
177850 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
177851 l_rec_acct_attrs.array_char_value(5) := p_source_53;
177852 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
177853 l_rec_acct_attrs.array_num_value(6) := p_source_52;
177854
177855 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
177856 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
177857
177858 ---------------------------------------------------------------------------------------------------------------
177862
177859 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
177860 ---------------------------------------------------------------------------------------------------------------
177861 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
177863 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
177864 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
177865
177866 IF xla_accounting_cache_pkg.GetValueChar
177867 (p_source_code => 'LEDGER_CATEGORY_CODE'
177868 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
177869 AND l_bflow_method_code = 'PRIOR_ENTRY'
177870 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
177871 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
177872 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
177873 )
177874 THEN
177875 xla_ae_lines_pkg.BflowUpgEntry
177876 (p_business_method_code => l_bflow_method_code
177877 ,p_business_class_code => l_bflow_class_code
177878 ,p_balance_type => l_balance_type_code);
177879 ELSE
177880 NULL;
177881 -- No business flow processing for business flow method of NONE.
177882 END IF;
177883
177884 --
177885 -- call analytical criteria
177886 --
177887
177888 --
177889 -- call description
177890 --
177891
177892 xla_ae_lines_pkg.SetLineDescription(
177893 p_ae_header_id => l_ae_header_id
177894 ,p_description => Description_137 (
177895 p_application_id => p_application_id
177896 , p_ae_header_id => l_ae_header_id
177897 , p_source_1 => p_source_1
177898 )
177899 );
177900
177901
177902 --
177903 -- call ADRs
177904 -- Bug 4922099
177905 --
177906 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
177907 (NVL(l_actual_upg_option, 'N') = 'O') OR
177908 (NVL(l_enc_upg_option, 'N') = 'O')
177909 )
177910 THEN
177911 NULL;
177912 --
177913 --
177914
177915 l_ccid := AcctDerRule_175(
177916 p_application_id => p_application_id
177917 , p_ae_header_id => l_ae_header_id
177918 , p_source_5 => p_source_5
177919 , p_source_19 => p_source_19
177920 , p_source_32 => p_source_32
177921 , x_transaction_coa_id => l_adr_transaction_coa_id
177922 , x_accounting_coa_id => l_adr_accounting_coa_id
177923 , x_value_type_code => l_adr_value_type_code
177924 , p_side => 'NA'
177925 );
177926
177927 xla_ae_lines_pkg.set_ccid(
177928 p_code_combination_id => l_ccid
177929 , p_value_type_code => l_adr_value_type_code
177930 , p_transaction_coa_id => l_adr_transaction_coa_id
177931 , p_accounting_coa_id => l_adr_accounting_coa_id
177932 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
177933 , p_adr_type_code => 'S'
177934 , p_component_type => l_component_type
177935 , p_component_code => l_component_code
177936 , p_component_type_code => l_component_type_code
177937 , p_component_appl_id => l_component_appl_id
177938 , p_amb_context_code => l_amb_context_code
177939 , p_side => 'NA'
177940 );
177941
177942
177943 l_segment := AcctDerRule_150(
177944 p_application_id => p_application_id
177945 , p_ae_header_id => l_ae_header_id
177946 , p_source_5 => p_source_5
177947 , p_source_12 => p_source_12
177948 , x_transaction_coa_id => l_adr_transaction_coa_id
177949 , x_accounting_coa_id => l_adr_accounting_coa_id
177950 , x_flexfield_segment_code => l_adr_flexfield_segment_code
177951 , x_flex_value_set_id => l_adr_flex_value_set_id
177952 , x_value_type_code => l_adr_value_type_code
177953 , x_value_combination_id => l_adr_value_combination_id
177954 , x_value_segment_code => l_adr_value_segment_code
177955 , p_side => 'NA'
177956 , p_override_seg_flag => 'Y'
177957 );
177958
177959 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
177960
177961 xla_ae_lines_pkg.set_segment(
177962 p_to_segment_code => 'GL_ACCOUNT'
177963 , p_segment_value => l_segment
177964 , p_from_segment_code => l_adr_value_segment_code
177965 , p_from_combination_id => l_adr_value_combination_id
177966 , p_value_type_code => l_adr_value_type_code
177967 , p_transaction_coa_id => l_adr_transaction_coa_id
177968 , p_accounting_coa_id => l_adr_accounting_coa_id
177969 , p_flexfield_segment_code => l_adr_flexfield_segment_code
177970 , p_flex_value_set_id => l_adr_flex_value_set_id
177971 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
177972 , p_adr_type_code => 'S'
177973 , p_component_type => l_component_type
177974 , p_component_code => l_component_code
177975 , p_component_type_code => l_component_type_code
177976 , p_component_appl_id => l_component_appl_id
177980 , p_side => 'NA'
177977 , p_amb_context_code => l_amb_context_code
177978 , p_entity_code => 'TRANSACTIONS'
177979 , p_event_class_code => 'UNIT_ADJUSTMENTS'
177981 );
177982
177983 END IF;
177984
177985 l_segment := AcctDerRule_169(
177986 p_application_id => p_application_id
177987 , p_ae_header_id => l_ae_header_id
177988 , p_source_5 => p_source_5
177989 , p_source_31 => p_source_31
177990 , x_transaction_coa_id => l_adr_transaction_coa_id
177991 , x_accounting_coa_id => l_adr_accounting_coa_id
177992 , x_flexfield_segment_code => l_adr_flexfield_segment_code
177993 , x_flex_value_set_id => l_adr_flex_value_set_id
177994 , x_value_type_code => l_adr_value_type_code
177995 , x_value_combination_id => l_adr_value_combination_id
177996 , x_value_segment_code => l_adr_value_segment_code
177997 , p_side => 'NA'
177998 , p_override_seg_flag => 'Y'
177999 );
178000
178001 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
178002
178003 xla_ae_lines_pkg.set_segment(
178004 p_to_segment_code => 'GL_BALANCING'
178005 , p_segment_value => l_segment
178006 , p_from_segment_code => l_adr_value_segment_code
178007 , p_from_combination_id => l_adr_value_combination_id
178008 , p_value_type_code => l_adr_value_type_code
178009 , p_transaction_coa_id => l_adr_transaction_coa_id
178010 , p_accounting_coa_id => l_adr_accounting_coa_id
178011 , p_flexfield_segment_code => l_adr_flexfield_segment_code
178012 , p_flex_value_set_id => l_adr_flex_value_set_id
178013 , p_adr_code => 'FA_EXPENSE_ACCT'
178014 , p_adr_type_code => 'S'
178015 , p_component_type => l_component_type
178016 , p_component_code => l_component_code
178017 , p_component_type_code => l_component_type_code
178018 , p_component_appl_id => l_component_appl_id
178019 , p_amb_context_code => l_amb_context_code
178020 , p_entity_code => 'TRANSACTIONS'
178021 , p_event_class_code => 'UNIT_ADJUSTMENTS'
178022 , p_side => 'NA'
178023 );
178024
178025 END IF;
178026
178027 --
178028 --
178029 END IF;
178030 --
178031 -- Bug 4922099
178032 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
178033 (NVL(l_enc_upg_option, 'N') = 'O')
178034 ) AND
178035 (l_bflow_method_code = 'PRIOR_ENTRY')
178036 )
178037 THEN
178038 IF
178039 --
178040 1 = 2
178041 --
178042 THEN
178043 xla_accounting_err_pkg.build_message
178044 (p_appli_s_name => 'XLA'
178045 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
178046 ,p_token_1 => 'LINE_NUMBER'
178047 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
178048 ,p_token_2 => 'LINE_TYPE_NAME'
178049 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
178050 l_component_type
178051 ,l_component_code
178052 ,l_component_type_code
178053 ,l_component_appl_id
178054 ,l_amb_context_code
178055 ,l_entity_code
178056 ,l_event_class_code
178057 )
178058 ,p_token_3 => 'OWNER'
178059 ,p_value_3 => xla_lookups_pkg.get_meaning(
178060 p_lookup_type => 'XLA_OWNER_TYPE'
178061 ,p_lookup_code => l_component_type_code
178062 )
178063 ,p_token_4 => 'PRODUCT_NAME'
178064 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
178065 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
178066 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
178067 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
178068 ,p_ae_header_id => NULL
178069 );
178070
178071 IF (C_LEVEL_ERROR>= g_log_level) THEN
178072 trace
178073 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
178077 END IF;
178074 ,p_level => C_LEVEL_ERROR
178075 ,p_module => l_log_module);
178076 END IF;
178078 END IF;
178079 --
178080 --
178081 ------------------------------------------------------------------------------------------------
178082 -- 4219869 Business Flow
178083 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
178084 -- Prior Entry. Currently, the following code is always generated.
178085 ------------------------------------------------------------------------------------------------
178086 XLA_AE_LINES_PKG.ValidateCurrentLine;
178087
178088 ------------------------------------------------------------------------------------
178089 -- 4219869 Business Flow
178090 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
178091 ------------------------------------------------------------------------------------
178092 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
178093
178094 ----------------------------------------------------------------------------------
178095 -- 4219869 Business Flow
178096 -- Update journal entry status -- Need to generate this within IF <condition>
178097 ----------------------------------------------------------------------------------
178098 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
178099 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
178100 ,p_balance_type_code => l_balance_type_code
178101 );
178102
178103 -------------------------------------------------------------------------------------------
178104 -- 4262811 - Generate the Accrual Reversal lines
178105 -------------------------------------------------------------------------------------------
178106 BEGIN
178107 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
178108 (g_array_event(p_event_id).array_value_num('header_index'));
178109 IF l_acc_rev_flag IS NULL THEN
178110 l_acc_rev_flag := 'N';
178111 END IF;
178112 EXCEPTION
178113 WHEN OTHERS THEN
178114 l_acc_rev_flag := 'N';
178115 END;
178116 --
178117 IF (l_acc_rev_flag = 'Y') THEN
178118
178119 -- 4645092 ------------------------------------------------------------------------------
178120 -- To allow MPA report to determine if it should generate report process
178121 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
178122 ------------------------------------------------------------------------------------------
178123
178124 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
178125 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
178126 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
178127 -- call ADRs
178128 -- Bug 4922099
178129 --
178130 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
178131 (NVL(l_actual_upg_option, 'N') = 'O') OR
178132 (NVL(l_enc_upg_option, 'N') = 'O')
178133 )
178134 THEN
178135 NULL;
178136 --
178137 --
178138
178139 l_ccid := AcctDerRule_175(
178140 p_application_id => p_application_id
178141 , p_ae_header_id => l_ae_header_id
178142 , p_source_5 => p_source_5
178143 , p_source_19 => p_source_19
178144 , p_source_32 => p_source_32
178145 , x_transaction_coa_id => l_adr_transaction_coa_id
178146 , x_accounting_coa_id => l_adr_accounting_coa_id
178147 , x_value_type_code => l_adr_value_type_code
178148 , p_side => 'NA'
178149 );
178150
178151 xla_ae_lines_pkg.set_ccid(
178152 p_code_combination_id => l_ccid
178153 , p_value_type_code => l_adr_value_type_code
178154 , p_transaction_coa_id => l_adr_transaction_coa_id
178155 , p_accounting_coa_id => l_adr_accounting_coa_id
178156 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
178157 , p_adr_type_code => 'S'
178158 , p_component_type => l_component_type
178159 , p_component_code => l_component_code
178160 , p_component_type_code => l_component_type_code
178161 , p_component_appl_id => l_component_appl_id
178162 , p_amb_context_code => l_amb_context_code
178163 , p_side => 'NA'
178164 );
178165
178166
178167 l_segment := AcctDerRule_150(
178168 p_application_id => p_application_id
178169 , p_ae_header_id => l_ae_header_id
178170 , p_source_5 => p_source_5
178171 , p_source_12 => p_source_12
178172 , x_transaction_coa_id => l_adr_transaction_coa_id
178173 , x_accounting_coa_id => l_adr_accounting_coa_id
178174 , x_flexfield_segment_code => l_adr_flexfield_segment_code
178175 , x_flex_value_set_id => l_adr_flex_value_set_id
178176 , x_value_type_code => l_adr_value_type_code
178177 , x_value_combination_id => l_adr_value_combination_id
178178 , x_value_segment_code => l_adr_value_segment_code
178179 , p_side => 'NA'
178180 , p_override_seg_flag => 'Y'
178181 );
178182
178183 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
178184
178185 xla_ae_lines_pkg.set_segment(
178186 p_to_segment_code => 'GL_ACCOUNT'
178187 , p_segment_value => l_segment
178191 , p_transaction_coa_id => l_adr_transaction_coa_id
178188 , p_from_segment_code => l_adr_value_segment_code
178189 , p_from_combination_id => l_adr_value_combination_id
178190 , p_value_type_code => l_adr_value_type_code
178192 , p_accounting_coa_id => l_adr_accounting_coa_id
178193 , p_flexfield_segment_code => l_adr_flexfield_segment_code
178194 , p_flex_value_set_id => l_adr_flex_value_set_id
178195 , p_adr_code => 'FA_CAT_RES_ACCOUNT_SEGMENT'
178196 , p_adr_type_code => 'S'
178197 , p_component_type => l_component_type
178198 , p_component_code => l_component_code
178199 , p_component_type_code => l_component_type_code
178200 , p_component_appl_id => l_component_appl_id
178201 , p_amb_context_code => l_amb_context_code
178202 , p_entity_code => 'TRANSACTIONS'
178203 , p_event_class_code => 'UNIT_ADJUSTMENTS'
178204 , p_side => 'NA'
178205 );
178206
178207 END IF;
178208
178209 l_segment := AcctDerRule_169(
178210 p_application_id => p_application_id
178211 , p_ae_header_id => l_ae_header_id
178212 , p_source_5 => p_source_5
178213 , p_source_31 => p_source_31
178214 , x_transaction_coa_id => l_adr_transaction_coa_id
178215 , x_accounting_coa_id => l_adr_accounting_coa_id
178216 , x_flexfield_segment_code => l_adr_flexfield_segment_code
178217 , x_flex_value_set_id => l_adr_flex_value_set_id
178218 , x_value_type_code => l_adr_value_type_code
178219 , x_value_combination_id => l_adr_value_combination_id
178220 , x_value_segment_code => l_adr_value_segment_code
178221 , p_side => 'NA'
178222 , p_override_seg_flag => 'Y'
178223 );
178224
178225 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
178226
178227 xla_ae_lines_pkg.set_segment(
178228 p_to_segment_code => 'GL_BALANCING'
178229 , p_segment_value => l_segment
178230 , p_from_segment_code => l_adr_value_segment_code
178231 , p_from_combination_id => l_adr_value_combination_id
178232 , p_value_type_code => l_adr_value_type_code
178233 , p_transaction_coa_id => l_adr_transaction_coa_id
178234 , p_accounting_coa_id => l_adr_accounting_coa_id
178235 , p_flexfield_segment_code => l_adr_flexfield_segment_code
178236 , p_flex_value_set_id => l_adr_flex_value_set_id
178237 , p_adr_code => 'FA_EXPENSE_ACCT'
178238 , p_adr_type_code => 'S'
178239 , p_component_type => l_component_type
178240 , p_component_code => l_component_code
178241 , p_component_type_code => l_component_type_code
178242 , p_component_appl_id => l_component_appl_id
178243 , p_amb_context_code => l_amb_context_code
178244 , p_entity_code => 'TRANSACTIONS'
178245 , p_event_class_code => 'UNIT_ADJUSTMENTS'
178246 , p_side => 'NA'
178247 );
178248
178249 END IF;
178250
178251 --
178252 --
178253 END IF;
178254
178255 --
178256 -- Update the line information that should be overwritten
178257 --
178258 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
178259 p_header_num => 1);
178260 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
178261
178262 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
178263
178264 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
178265 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
178266 END IF;
178267
178268 --
178269 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
178270 --
178271 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
178272 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
178273 ELSE
178274 ---------------------------------------------------------------------------------------------------
178275 -- 4262811a Switch Sign
178276 ---------------------------------------------------------------------------------------------------
178277 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
178278 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
178279 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
178280 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
178281 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
178282 -- 5132302
178283 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
178284 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
178285
178286 END IF;
178287
178288 -- 4955764
178289 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
178293 XLA_AE_LINES_PKG.ValidateCurrentLine;
178290 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
178291
178292
178294 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
178295
178296 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
178297 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
178298 ,p_balance_type_code => l_balance_type_code);
178299
178300 END IF;
178301
178302 -----------------------------------------------------------------------------------------
178303 -- 4262811 Multiperiod Accounting
178304 -----------------------------------------------------------------------------------------
178305 -- No MPA option is assigned.
178306
178307
178308 END IF;
178309 END IF;
178310 --
178311
178312 --
178313 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
178314 trace
178315 (p_msg => 'END of AcctLineType_415'
178316 ,p_level => C_LEVEL_PROCEDURE
178317 ,p_module => l_log_module);
178318 END IF;
178319 --
178320 EXCEPTION
178321 WHEN xla_exceptions_pkg.application_exception THEN
178322 RAISE;
178323 WHEN OTHERS THEN
178324 xla_exceptions_pkg.raise_message
178325 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_415');
178326 END AcctLineType_415;
178327 --
178328
178329 ---------------------------------------
178330 --
178331 -- PRIVATE FUNCTION
178332 -- AcctLineType_416
178333 --
178334 ---------------------------------------
178335 PROCEDURE AcctLineType_416 (
178336 p_application_id IN NUMBER
178337 ,p_event_id IN NUMBER
178338 ,p_calculate_acctd_flag IN VARCHAR2
178339 ,p_calculate_g_l_flag IN VARCHAR2
178340 ,p_actual_flag IN OUT VARCHAR2
178341 ,p_balance_type_code OUT VARCHAR2
178342 ,p_gain_or_loss_ref OUT VARCHAR2
178343
178344 --Period Close Date
178345 , p_source_1 IN DATE
178346 --Generated Code Combination Identifier
178347 , p_source_5 IN NUMBER
178348 --Revaluation Reserve Account
178349 , p_source_13 IN VARCHAR2
178350 --Generated Offset Code Combination Identifier
178351 , p_source_19 IN NUMBER
178352 --Expense Account Code Combination Identifier
178353 , p_source_31 IN NUMBER
178354 --Default Code Combination Identifier
178355 , p_source_32 IN NUMBER
178356 --Adjustment Type
178357 , p_source_48 IN VARCHAR2
178358 --Transaction Header Identifier
178359 , p_source_49 IN NUMBER
178360 --Adjustment Line Identifier
178361 , p_source_50 IN NUMBER
178362 --Distribution Type Code
178363 , p_source_51 IN VARCHAR2
178364 --Entered Amount
178365 , p_source_52 IN NUMBER
178366 --Currency Code
178367 , p_source_53 IN VARCHAR2
178368 --Source Destination Code
178369 , p_source_55 IN VARCHAR2
178370 )
178371 IS
178372
178373 l_component_type VARCHAR2(80);
178374 l_component_code VARCHAR2(30);
178375 l_component_type_code VARCHAR2(1);
178376 l_component_appl_id INTEGER;
178377 l_amb_context_code VARCHAR2(30);
178378 l_entity_code VARCHAR2(30);
178379 l_event_class_code VARCHAR2(30);
178380 l_ae_header_id NUMBER;
178381 l_event_type_code VARCHAR2(30);
178382 l_line_definition_code VARCHAR2(30);
178383 l_line_definition_owner_code VARCHAR2(1);
178384 --
178385 -- adr variables
178386 l_segment VARCHAR2(30);
178387 l_ccid NUMBER;
178388 l_adr_transaction_coa_id NUMBER;
178389 l_adr_accounting_coa_id NUMBER;
178390 l_adr_flexfield_segment_code VARCHAR2(30);
178391 l_adr_flex_value_set_id NUMBER;
178392 l_adr_value_type_code VARCHAR2(30);
178393 l_adr_value_combination_id NUMBER;
178394 l_adr_value_segment_code VARCHAR2(30);
178395
178396 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
178397 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
178398 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
178399 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
178400
178401 -- 4262811 Variables ------------------------------------------------------------------------------------------
178402 l_entered_amt_idx NUMBER;
178403 l_accted_amt_idx NUMBER;
178404 l_acc_rev_flag VARCHAR2(1);
178405 l_accrual_line_num NUMBER;
178406 l_tmp_amt NUMBER;
178407 l_acc_rev_natural_side_code VARCHAR2(1);
178408
178409 l_num_entries NUMBER;
178410 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
178411 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
178412 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
178413 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
178414 l_recog_line_1 NUMBER;
178415 l_recog_line_2 NUMBER;
178416
178417 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
178418 l_bflow_applied_to_amt NUMBER; -- 5132302
178419 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
178420
178424 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
178421 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
178422
178423 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
178425
178426 ---------------------------------------------------------------------------------------------------------------
178427
178428
178429 --
178430 -- bulk performance
178431 --
178432 l_balance_type_code VARCHAR2(1);
178433 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
178434 l_log_module VARCHAR2(240);
178435
178436 --
178437 -- Upgrade strategy
178438 --
178439 l_actual_upg_option VARCHAR2(1);
178440 l_enc_upg_option VARCHAR2(1);
178441
178442 --
178443 BEGIN
178444 --
178445 IF g_log_enabled THEN
178446 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_416';
178447 END IF;
178448 --
178449 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
178450
178451 trace
178452 (p_msg => 'BEGIN of AcctLineType_416'
178453 ,p_level => C_LEVEL_PROCEDURE
178454 ,p_module => l_log_module);
178455
178456 END IF;
178457 --
178458 l_component_type := 'AMB_JLT';
178459 l_component_code := 'FA_UNITADJ_SOURCE_REVAL_RESERV';
178460 l_component_type_code := 'S';
178461 l_component_appl_id := 140;
178462 l_amb_context_code := 'DEFAULT';
178463 l_entity_code := 'TRANSACTIONS';
178464 l_event_class_code := 'UNIT_ADJUSTMENTS';
178465 l_event_type_code := 'UNIT_ADJUSTMENTS_ALL';
178466 l_line_definition_owner_code := 'S';
178467 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNIT_26';
178468 --
178469 l_balance_type_code := 'A';
178470 l_segment := NULL;
178471 l_ccid := NULL;
178472 l_adr_transaction_coa_id := NULL;
178473 l_adr_accounting_coa_id := NULL;
178474 l_adr_flexfield_segment_code := NULL;
178475 l_adr_flex_value_set_id := NULL;
178476 l_adr_value_type_code := NULL;
178477 l_adr_value_combination_id := NULL;
178478 l_adr_value_segment_code := NULL;
178479
178480 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
178481 l_bflow_class_code := ''; -- 4219869 Business Flow
178482 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
178483 l_budgetary_control_flag := 'N';
178484
178485 l_bflow_applied_to_amt_idx := NULL; -- 5132302
178486 l_bflow_applied_to_amt := NULL; -- 5132302
178487 l_entered_amt_idx := NULL; -- 4262811
178488 l_accted_amt_idx := NULL; -- 4262811
178489 l_acc_rev_flag := NULL; -- 4262811
178490 l_accrual_line_num := NULL; -- 4262811
178491 l_tmp_amt := NULL; -- 4262811
178492 --
178493
178494 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
178495 l_balance_type_code <> 'B' THEN
178496 IF NVL(p_source_48,'
178497 ') = 'REVAL RESERVE' AND
178498 NVL(p_source_55,'
178499 ') = 'SOURCE'
178500 THEN
178501
178502 --
178503 XLA_AE_LINES_PKG.SetNewLine;
178504
178505 p_balance_type_code := l_balance_type_code;
178506 -- set the flag so later we will know whether the gain loss line needs to be created
178507
178508 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
178509 p_actual_flag :='A';
178510 END IF;
178511
178512 --
178513 -- bulk performance
178514 --
178515 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
178516 p_header_num => 0); -- 4262811
178517 --
178518 -- set accounting line options
178519 --
178520 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
178521 p_natural_side_code => 'D'
178522 , p_gain_or_loss_flag => 'N'
178523 , p_gl_transfer_mode_code => 'S'
178524 , p_acct_entry_type_code => 'A'
178525 , p_switch_side_flag => 'Y'
178526 , p_merge_duplicate_code => 'N'
178527 );
178528 --
178529 l_acc_rev_natural_side_code := 'C'; -- 4262811
178530 --
178531 --
178532 -- set accounting line type info
178533 --
178534 xla_ae_lines_pkg.SetAcctLineType
178535 (p_component_type => l_component_type
178536 ,p_event_type_code => l_event_type_code
178537 ,p_line_definition_owner_code => l_line_definition_owner_code
178538 ,p_line_definition_code => l_line_definition_code
178539 ,p_accounting_line_code => l_component_code
178540 ,p_accounting_line_type_code => l_component_type_code
178541 ,p_accounting_line_appl_id => l_component_appl_id
178542 ,p_amb_context_code => l_amb_context_code
178543 ,p_entity_code => l_entity_code
178544 ,p_event_class_code => l_event_class_code);
178545 --
178546 -- set accounting class
178547 --
178548 xla_ae_lines_pkg.SetAcctClass(
178549 p_accounting_class_code => 'ASSET'
178550 , p_ae_header_id => l_ae_header_id
178551 );
178552
178553 --
178554 -- set rounding class
178555 --
178559 --
178556 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
178557 'ASSET';
178558
178560 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
178561 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
178562 --
178563 -- bulk performance
178564 --
178565 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
178566
178567 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
178568 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
178569
178570 -- 4955764
178571 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
178572 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
178573
178574 -- 4458381 Public Sector Enh
178575
178576 --
178577 -- set accounting attributes for the line type
178578 --
178579 l_entered_amt_idx := 4;
178580 l_accted_amt_idx := 6;
178581 l_bflow_applied_to_amt_idx := NULL; -- 5132302
178582 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
178583 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
178584 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
178585 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
178586 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
178587 l_rec_acct_attrs.array_char_value(3) := p_source_51;
178588 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
178589 l_rec_acct_attrs.array_num_value(4) := p_source_52;
178590 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
178591 l_rec_acct_attrs.array_char_value(5) := p_source_53;
178592 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
178593 l_rec_acct_attrs.array_num_value(6) := p_source_52;
178594
178595 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
178596 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
178597
178598 ---------------------------------------------------------------------------------------------------------------
178599 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
178600 ---------------------------------------------------------------------------------------------------------------
178601 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
178602
178603 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
178604 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
178605
178606 IF xla_accounting_cache_pkg.GetValueChar
178607 (p_source_code => 'LEDGER_CATEGORY_CODE'
178608 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
178609 AND l_bflow_method_code = 'PRIOR_ENTRY'
178610 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
178611 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
178612 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
178613 )
178614 THEN
178615 xla_ae_lines_pkg.BflowUpgEntry
178616 (p_business_method_code => l_bflow_method_code
178617 ,p_business_class_code => l_bflow_class_code
178618 ,p_balance_type => l_balance_type_code);
178619 ELSE
178620 NULL;
178621 -- No business flow processing for business flow method of NONE.
178622 END IF;
178623
178624 --
178625 -- call analytical criteria
178626 --
178627
178628 --
178629 -- call description
178630 --
178631
178632 xla_ae_lines_pkg.SetLineDescription(
178633 p_ae_header_id => l_ae_header_id
178634 ,p_description => Description_138 (
178635 p_application_id => p_application_id
178636 , p_ae_header_id => l_ae_header_id
178637 , p_source_1 => p_source_1
178638 )
178639 );
178640
178641
178642 --
178643 -- call ADRs
178644 -- Bug 4922099
178645 --
178646 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
178647 (NVL(l_actual_upg_option, 'N') = 'O') OR
178648 (NVL(l_enc_upg_option, 'N') = 'O')
178649 )
178650 THEN
178651 NULL;
178652 --
178653 --
178654
178655 l_ccid := AcctDerRule_175(
178656 p_application_id => p_application_id
178657 , p_ae_header_id => l_ae_header_id
178658 , p_source_5 => p_source_5
178659 , p_source_19 => p_source_19
178660 , p_source_32 => p_source_32
178661 , x_transaction_coa_id => l_adr_transaction_coa_id
178662 , x_accounting_coa_id => l_adr_accounting_coa_id
178663 , x_value_type_code => l_adr_value_type_code
178664 , p_side => 'NA'
178665 );
178666
178667 xla_ae_lines_pkg.set_ccid(
178668 p_code_combination_id => l_ccid
178669 , p_value_type_code => l_adr_value_type_code
178670 , p_transaction_coa_id => l_adr_transaction_coa_id
178671 , p_accounting_coa_id => l_adr_accounting_coa_id
178675 , p_component_code => l_component_code
178672 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
178673 , p_adr_type_code => 'S'
178674 , p_component_type => l_component_type
178676 , p_component_type_code => l_component_type_code
178677 , p_component_appl_id => l_component_appl_id
178678 , p_amb_context_code => l_amb_context_code
178679 , p_side => 'NA'
178680 );
178681
178682
178683 l_segment := AcctDerRule_151(
178684 p_application_id => p_application_id
178685 , p_ae_header_id => l_ae_header_id
178686 , p_source_5 => p_source_5
178687 , p_source_13 => p_source_13
178688 , x_transaction_coa_id => l_adr_transaction_coa_id
178689 , x_accounting_coa_id => l_adr_accounting_coa_id
178690 , x_flexfield_segment_code => l_adr_flexfield_segment_code
178691 , x_flex_value_set_id => l_adr_flex_value_set_id
178692 , x_value_type_code => l_adr_value_type_code
178693 , x_value_combination_id => l_adr_value_combination_id
178694 , x_value_segment_code => l_adr_value_segment_code
178695 , p_side => 'NA'
178696 , p_override_seg_flag => 'Y'
178697 );
178698
178699 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
178700
178701 xla_ae_lines_pkg.set_segment(
178702 p_to_segment_code => 'GL_ACCOUNT'
178703 , p_segment_value => l_segment
178704 , p_from_segment_code => l_adr_value_segment_code
178705 , p_from_combination_id => l_adr_value_combination_id
178706 , p_value_type_code => l_adr_value_type_code
178707 , p_transaction_coa_id => l_adr_transaction_coa_id
178708 , p_accounting_coa_id => l_adr_accounting_coa_id
178709 , p_flexfield_segment_code => l_adr_flexfield_segment_code
178710 , p_flex_value_set_id => l_adr_flex_value_set_id
178711 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
178712 , p_adr_type_code => 'S'
178713 , p_component_type => l_component_type
178714 , p_component_code => l_component_code
178715 , p_component_type_code => l_component_type_code
178716 , p_component_appl_id => l_component_appl_id
178717 , p_amb_context_code => l_amb_context_code
178718 , p_entity_code => 'TRANSACTIONS'
178719 , p_event_class_code => 'UNIT_ADJUSTMENTS'
178720 , p_side => 'NA'
178721 );
178722
178723 END IF;
178724
178725 l_segment := AcctDerRule_169(
178726 p_application_id => p_application_id
178727 , p_ae_header_id => l_ae_header_id
178728 , p_source_5 => p_source_5
178729 , p_source_31 => p_source_31
178730 , x_transaction_coa_id => l_adr_transaction_coa_id
178731 , x_accounting_coa_id => l_adr_accounting_coa_id
178732 , x_flexfield_segment_code => l_adr_flexfield_segment_code
178733 , x_flex_value_set_id => l_adr_flex_value_set_id
178734 , x_value_type_code => l_adr_value_type_code
178735 , x_value_combination_id => l_adr_value_combination_id
178736 , x_value_segment_code => l_adr_value_segment_code
178737 , p_side => 'NA'
178738 , p_override_seg_flag => 'Y'
178739 );
178740
178741 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
178742
178743 xla_ae_lines_pkg.set_segment(
178744 p_to_segment_code => 'GL_BALANCING'
178745 , p_segment_value => l_segment
178746 , p_from_segment_code => l_adr_value_segment_code
178747 , p_from_combination_id => l_adr_value_combination_id
178748 , p_value_type_code => l_adr_value_type_code
178749 , p_transaction_coa_id => l_adr_transaction_coa_id
178750 , p_accounting_coa_id => l_adr_accounting_coa_id
178751 , p_flexfield_segment_code => l_adr_flexfield_segment_code
178752 , p_flex_value_set_id => l_adr_flex_value_set_id
178753 , p_adr_code => 'FA_EXPENSE_ACCT'
178754 , p_adr_type_code => 'S'
178755 , p_component_type => l_component_type
178756 , p_component_code => l_component_code
178757 , p_component_type_code => l_component_type_code
178758 , p_component_appl_id => l_component_appl_id
178759 , p_amb_context_code => l_amb_context_code
178760 , p_entity_code => 'TRANSACTIONS'
178761 , p_event_class_code => 'UNIT_ADJUSTMENTS'
178762 , p_side => 'NA'
178763 );
178764
178765 END IF;
178766
178767 --
178768 --
178769 END IF;
178770 --
178771 -- Bug 4922099
178772 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
178773 (NVL(l_enc_upg_option, 'N') = 'O')
178774 ) AND
178775 (l_bflow_method_code = 'PRIOR_ENTRY')
178776 )
178777 THEN
178778 IF
178779 --
178780 1 = 2
178781 --
178782 THEN
178783 xla_accounting_err_pkg.build_message
178784 (p_appli_s_name => 'XLA'
178785 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
178786 ,p_token_1 => 'LINE_NUMBER'
178790 l_component_type
178787 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
178788 ,p_token_2 => 'LINE_TYPE_NAME'
178789 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
178791 ,l_component_code
178792 ,l_component_type_code
178793 ,l_component_appl_id
178794 ,l_amb_context_code
178795 ,l_entity_code
178796 ,l_event_class_code
178797 )
178798 ,p_token_3 => 'OWNER'
178799 ,p_value_3 => xla_lookups_pkg.get_meaning(
178800 p_lookup_type => 'XLA_OWNER_TYPE'
178801 ,p_lookup_code => l_component_type_code
178802 )
178803 ,p_token_4 => 'PRODUCT_NAME'
178804 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
178805 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
178806 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
178807 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
178808 ,p_ae_header_id => NULL
178809 );
178810
178811 IF (C_LEVEL_ERROR>= g_log_level) THEN
178812 trace
178813 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
178814 ,p_level => C_LEVEL_ERROR
178815 ,p_module => l_log_module);
178816 END IF;
178817 END IF;
178818 END IF;
178819 --
178820 --
178821 ------------------------------------------------------------------------------------------------
178822 -- 4219869 Business Flow
178823 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
178824 -- Prior Entry. Currently, the following code is always generated.
178825 ------------------------------------------------------------------------------------------------
178826 XLA_AE_LINES_PKG.ValidateCurrentLine;
178827
178828 ------------------------------------------------------------------------------------
178829 -- 4219869 Business Flow
178830 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
178831 ------------------------------------------------------------------------------------
178832 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
178833
178834 ----------------------------------------------------------------------------------
178835 -- 4219869 Business Flow
178836 -- Update journal entry status -- Need to generate this within IF <condition>
178837 ----------------------------------------------------------------------------------
178838 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
178839 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
178840 ,p_balance_type_code => l_balance_type_code
178841 );
178842
178843 -------------------------------------------------------------------------------------------
178844 -- 4262811 - Generate the Accrual Reversal lines
178845 -------------------------------------------------------------------------------------------
178846 BEGIN
178847 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
178848 (g_array_event(p_event_id).array_value_num('header_index'));
178849 IF l_acc_rev_flag IS NULL THEN
178850 l_acc_rev_flag := 'N';
178851 END IF;
178852 EXCEPTION
178853 WHEN OTHERS THEN
178854 l_acc_rev_flag := 'N';
178855 END;
178856 --
178857 IF (l_acc_rev_flag = 'Y') THEN
178858
178859 -- 4645092 ------------------------------------------------------------------------------
178860 -- To allow MPA report to determine if it should generate report process
178861 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
178862 ------------------------------------------------------------------------------------------
178863
178864 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
178865 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
178866 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
178867 -- call ADRs
178868 -- Bug 4922099
178869 --
178870 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
178871 (NVL(l_actual_upg_option, 'N') = 'O') OR
178872 (NVL(l_enc_upg_option, 'N') = 'O')
178873 )
178874 THEN
178875 NULL;
178876 --
178877 --
178878
178879 l_ccid := AcctDerRule_175(
178880 p_application_id => p_application_id
178881 , p_ae_header_id => l_ae_header_id
178882 , p_source_5 => p_source_5
178886 , x_accounting_coa_id => l_adr_accounting_coa_id
178883 , p_source_19 => p_source_19
178884 , p_source_32 => p_source_32
178885 , x_transaction_coa_id => l_adr_transaction_coa_id
178887 , x_value_type_code => l_adr_value_type_code
178888 , p_side => 'NA'
178889 );
178890
178891 xla_ae_lines_pkg.set_ccid(
178892 p_code_combination_id => l_ccid
178893 , p_value_type_code => l_adr_value_type_code
178894 , p_transaction_coa_id => l_adr_transaction_coa_id
178895 , p_accounting_coa_id => l_adr_accounting_coa_id
178896 , p_adr_code => 'FA_DEFAULT_OFFSET_ACCOUNT'
178897 , p_adr_type_code => 'S'
178898 , p_component_type => l_component_type
178899 , p_component_code => l_component_code
178900 , p_component_type_code => l_component_type_code
178901 , p_component_appl_id => l_component_appl_id
178902 , p_amb_context_code => l_amb_context_code
178903 , p_side => 'NA'
178904 );
178905
178906
178907 l_segment := AcctDerRule_151(
178908 p_application_id => p_application_id
178909 , p_ae_header_id => l_ae_header_id
178910 , p_source_5 => p_source_5
178911 , p_source_13 => p_source_13
178912 , x_transaction_coa_id => l_adr_transaction_coa_id
178913 , x_accounting_coa_id => l_adr_accounting_coa_id
178914 , x_flexfield_segment_code => l_adr_flexfield_segment_code
178915 , x_flex_value_set_id => l_adr_flex_value_set_id
178916 , x_value_type_code => l_adr_value_type_code
178917 , x_value_combination_id => l_adr_value_combination_id
178918 , x_value_segment_code => l_adr_value_segment_code
178919 , p_side => 'NA'
178920 , p_override_seg_flag => 'Y'
178921 );
178922
178923 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
178924
178925 xla_ae_lines_pkg.set_segment(
178926 p_to_segment_code => 'GL_ACCOUNT'
178927 , p_segment_value => l_segment
178928 , p_from_segment_code => l_adr_value_segment_code
178929 , p_from_combination_id => l_adr_value_combination_id
178930 , p_value_type_code => l_adr_value_type_code
178931 , p_transaction_coa_id => l_adr_transaction_coa_id
178932 , p_accounting_coa_id => l_adr_accounting_coa_id
178933 , p_flexfield_segment_code => l_adr_flexfield_segment_code
178934 , p_flex_value_set_id => l_adr_flex_value_set_id
178935 , p_adr_code => 'FA_CAT_REVAL_RES_SEGMENT'
178936 , p_adr_type_code => 'S'
178937 , p_component_type => l_component_type
178938 , p_component_code => l_component_code
178939 , p_component_type_code => l_component_type_code
178940 , p_component_appl_id => l_component_appl_id
178941 , p_amb_context_code => l_amb_context_code
178942 , p_entity_code => 'TRANSACTIONS'
178943 , p_event_class_code => 'UNIT_ADJUSTMENTS'
178944 , p_side => 'NA'
178945 );
178946
178947 END IF;
178948
178949 l_segment := AcctDerRule_169(
178950 p_application_id => p_application_id
178951 , p_ae_header_id => l_ae_header_id
178952 , p_source_5 => p_source_5
178953 , p_source_31 => p_source_31
178954 , x_transaction_coa_id => l_adr_transaction_coa_id
178955 , x_accounting_coa_id => l_adr_accounting_coa_id
178956 , x_flexfield_segment_code => l_adr_flexfield_segment_code
178957 , x_flex_value_set_id => l_adr_flex_value_set_id
178958 , x_value_type_code => l_adr_value_type_code
178959 , x_value_combination_id => l_adr_value_combination_id
178960 , x_value_segment_code => l_adr_value_segment_code
178961 , p_side => 'NA'
178962 , p_override_seg_flag => 'Y'
178963 );
178964
178965 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
178966
178967 xla_ae_lines_pkg.set_segment(
178968 p_to_segment_code => 'GL_BALANCING'
178969 , p_segment_value => l_segment
178970 , p_from_segment_code => l_adr_value_segment_code
178971 , p_from_combination_id => l_adr_value_combination_id
178972 , p_value_type_code => l_adr_value_type_code
178973 , p_transaction_coa_id => l_adr_transaction_coa_id
178974 , p_accounting_coa_id => l_adr_accounting_coa_id
178975 , p_flexfield_segment_code => l_adr_flexfield_segment_code
178976 , p_flex_value_set_id => l_adr_flex_value_set_id
178977 , p_adr_code => 'FA_EXPENSE_ACCT'
178978 , p_adr_type_code => 'S'
178979 , p_component_type => l_component_type
178980 , p_component_code => l_component_code
178981 , p_component_type_code => l_component_type_code
178982 , p_component_appl_id => l_component_appl_id
178983 , p_amb_context_code => l_amb_context_code
178984 , p_entity_code => 'TRANSACTIONS'
178985 , p_event_class_code => 'UNIT_ADJUSTMENTS'
178986 , p_side => 'NA'
178987 );
178988
178989 END IF;
178990
178991 --
178992 --
178996 -- Update the line information that should be overwritten
178993 END IF;
178994
178995 --
178997 --
178998 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
178999 p_header_num => 1);
179000 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
179001
179002 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
179003
179004 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
179005 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
179006 END IF;
179007
179008 --
179009 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
179010 --
179011 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
179012 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
179013 ELSE
179014 ---------------------------------------------------------------------------------------------------
179015 -- 4262811a Switch Sign
179016 ---------------------------------------------------------------------------------------------------
179017 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
179018 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
179019 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
179020 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
179021 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
179022 -- 5132302
179023 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
179024 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
179025
179026 END IF;
179027
179028 -- 4955764
179029 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
179030 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
179031
179032
179033 XLA_AE_LINES_PKG.ValidateCurrentLine;
179034 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
179035
179036 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
179037 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
179038 ,p_balance_type_code => l_balance_type_code);
179039
179040 END IF;
179041
179042 -----------------------------------------------------------------------------------------
179043 -- 4262811 Multiperiod Accounting
179044 -----------------------------------------------------------------------------------------
179045 -- No MPA option is assigned.
179046
179047
179048 END IF;
179049 END IF;
179050 --
179051
179052 --
179053 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
179054 trace
179055 (p_msg => 'END of AcctLineType_416'
179056 ,p_level => C_LEVEL_PROCEDURE
179057 ,p_module => l_log_module);
179058 END IF;
179059 --
179060 EXCEPTION
179061 WHEN xla_exceptions_pkg.application_exception THEN
179062 RAISE;
179063 WHEN OTHERS THEN
179064 xla_exceptions_pkg.raise_message
179065 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_416');
179066 END AcctLineType_416;
179067 --
179068
179069 ---------------------------------------
179070 --
179071 -- PRIVATE FUNCTION
179072 -- AcctLineType_417
179073 --
179074 ---------------------------------------
179075 PROCEDURE AcctLineType_417 (
179076 p_application_id IN NUMBER
179077 ,p_event_id IN NUMBER
179078 ,p_calculate_acctd_flag IN VARCHAR2
179079 ,p_calculate_g_l_flag IN VARCHAR2
179080 ,p_actual_flag IN OUT VARCHAR2
179081 ,p_balance_type_code OUT VARCHAR2
179082 ,p_gain_or_loss_ref OUT VARCHAR2
179083
179084 --Period Close Date
179085 , p_source_1 IN DATE
179086 --Generated Code Combination Identifier
179087 , p_source_5 IN NUMBER
179088 --Expense Account Code Combination Identifier
179089 , p_source_31 IN NUMBER
179090 --Adjustment Type
179091 , p_source_48 IN VARCHAR2
179092 --Transaction Header Identifier
179093 , p_source_49 IN NUMBER
179094 --Adjustment Line Identifier
179095 , p_source_50 IN NUMBER
179096 --Distribution Type Code
179097 , p_source_51 IN VARCHAR2
179098 --Entered Amount
179099 , p_source_52 IN NUMBER
179100 --Currency Code
179101 , p_source_53 IN VARCHAR2
179102 )
179103 IS
179104
179105 l_component_type VARCHAR2(80);
179106 l_component_code VARCHAR2(30);
179107 l_component_type_code VARCHAR2(1);
179108 l_component_appl_id INTEGER;
179109 l_amb_context_code VARCHAR2(30);
179110 l_entity_code VARCHAR2(30);
179111 l_event_class_code VARCHAR2(30);
179112 l_ae_header_id NUMBER;
179113 l_event_type_code VARCHAR2(30);
179114 l_line_definition_code VARCHAR2(30);
179115 l_line_definition_owner_code VARCHAR2(1);
179119 l_ccid NUMBER;
179116 --
179117 -- adr variables
179118 l_segment VARCHAR2(30);
179120 l_adr_transaction_coa_id NUMBER;
179121 l_adr_accounting_coa_id NUMBER;
179122 l_adr_flexfield_segment_code VARCHAR2(30);
179123 l_adr_flex_value_set_id NUMBER;
179124 l_adr_value_type_code VARCHAR2(30);
179125 l_adr_value_combination_id NUMBER;
179126 l_adr_value_segment_code VARCHAR2(30);
179127
179128 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
179129 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
179130 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
179131 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
179132
179133 -- 4262811 Variables ------------------------------------------------------------------------------------------
179134 l_entered_amt_idx NUMBER;
179135 l_accted_amt_idx NUMBER;
179136 l_acc_rev_flag VARCHAR2(1);
179137 l_accrual_line_num NUMBER;
179138 l_tmp_amt NUMBER;
179139 l_acc_rev_natural_side_code VARCHAR2(1);
179140
179141 l_num_entries NUMBER;
179142 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
179143 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
179144 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
179145 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
179146 l_recog_line_1 NUMBER;
179147 l_recog_line_2 NUMBER;
179148
179149 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
179150 l_bflow_applied_to_amt NUMBER; -- 5132302
179151 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
179152
179153 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
179154
179155 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
179156 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
179157
179158 ---------------------------------------------------------------------------------------------------------------
179159
179160
179161 --
179162 -- bulk performance
179163 --
179164 l_balance_type_code VARCHAR2(1);
179165 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
179166 l_log_module VARCHAR2(240);
179167
179168 --
179169 -- Upgrade strategy
179170 --
179171 l_actual_upg_option VARCHAR2(1);
179172 l_enc_upg_option VARCHAR2(1);
179173
179174 --
179175 BEGIN
179176 --
179177 IF g_log_enabled THEN
179178 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_417';
179179 END IF;
179180 --
179181 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
179182
179183 trace
179184 (p_msg => 'BEGIN of AcctLineType_417'
179185 ,p_level => C_LEVEL_PROCEDURE
179186 ,p_module => l_log_module);
179187
179188 END IF;
179189 --
179190 l_component_type := 'AMB_JLT';
179191 l_component_code := 'FA_UNPL_EXP';
179192 l_component_type_code := 'S';
179193 l_component_appl_id := 140;
179194 l_amb_context_code := 'DEFAULT';
179195 l_entity_code := 'TRANSACTIONS';
179196 l_event_class_code := 'UNPLANNED_DEPRECIATION';
179197 l_event_type_code := 'UNPLANNED_DEPRECIATION_ALL';
179198 l_line_definition_owner_code := 'S';
179199 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNPLA27';
179200 --
179201 l_balance_type_code := 'A';
179202 l_segment := NULL;
179203 l_ccid := NULL;
179204 l_adr_transaction_coa_id := NULL;
179205 l_adr_accounting_coa_id := NULL;
179206 l_adr_flexfield_segment_code := NULL;
179207 l_adr_flex_value_set_id := NULL;
179208 l_adr_value_type_code := NULL;
179209 l_adr_value_combination_id := NULL;
179210 l_adr_value_segment_code := NULL;
179211
179212 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
179213 l_bflow_class_code := ''; -- 4219869 Business Flow
179214 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
179215 l_budgetary_control_flag := 'N';
179216
179217 l_bflow_applied_to_amt_idx := NULL; -- 5132302
179218 l_bflow_applied_to_amt := NULL; -- 5132302
179219 l_entered_amt_idx := NULL; -- 4262811
179220 l_accted_amt_idx := NULL; -- 4262811
179221 l_acc_rev_flag := NULL; -- 4262811
179222 l_accrual_line_num := NULL; -- 4262811
179223 l_tmp_amt := NULL; -- 4262811
179224 --
179225
179226 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
179227 l_balance_type_code <> 'B' THEN
179228 IF NVL(p_source_48,'
179229 ') = 'EXPENSE'
179230 THEN
179231
179232 --
179233 XLA_AE_LINES_PKG.SetNewLine;
179234
179235 p_balance_type_code := l_balance_type_code;
179236 -- set the flag so later we will know whether the gain loss line needs to be created
179237
179238 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
179239 p_actual_flag :='A';
179240 END IF;
179241
179242 --
179243 -- bulk performance
179244 --
179248 -- set accounting line options
179245 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
179246 p_header_num => 0); -- 4262811
179247 --
179249 --
179250 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
179251 p_natural_side_code => 'D'
179252 , p_gain_or_loss_flag => 'N'
179253 , p_gl_transfer_mode_code => 'S'
179254 , p_acct_entry_type_code => 'A'
179255 , p_switch_side_flag => 'Y'
179256 , p_merge_duplicate_code => 'N'
179257 );
179258 --
179259 l_acc_rev_natural_side_code := 'C'; -- 4262811
179260 --
179261 --
179262 -- set accounting line type info
179263 --
179264 xla_ae_lines_pkg.SetAcctLineType
179265 (p_component_type => l_component_type
179266 ,p_event_type_code => l_event_type_code
179267 ,p_line_definition_owner_code => l_line_definition_owner_code
179268 ,p_line_definition_code => l_line_definition_code
179269 ,p_accounting_line_code => l_component_code
179270 ,p_accounting_line_type_code => l_component_type_code
179271 ,p_accounting_line_appl_id => l_component_appl_id
179272 ,p_amb_context_code => l_amb_context_code
179273 ,p_entity_code => l_entity_code
179274 ,p_event_class_code => l_event_class_code);
179275 --
179276 -- set accounting class
179277 --
179278 xla_ae_lines_pkg.SetAcctClass(
179279 p_accounting_class_code => 'EXPENSE'
179280 , p_ae_header_id => l_ae_header_id
179281 );
179282
179283 --
179284 -- set rounding class
179285 --
179286 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
179287 'EXPENSE';
179288
179289 --
179290 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
179291 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
179292 --
179293 -- bulk performance
179294 --
179295 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
179296
179297 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
179298 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
179299
179300 -- 4955764
179301 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
179302 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
179303
179304 -- 4458381 Public Sector Enh
179305
179306 --
179307 -- set accounting attributes for the line type
179308 --
179309 l_entered_amt_idx := 4;
179310 l_accted_amt_idx := 6;
179311 l_bflow_applied_to_amt_idx := NULL; -- 5132302
179312 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
179313 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
179314 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
179315 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
179316 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
179317 l_rec_acct_attrs.array_char_value(3) := p_source_51;
179318 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
179319 l_rec_acct_attrs.array_num_value(4) := p_source_52;
179320 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
179321 l_rec_acct_attrs.array_char_value(5) := p_source_53;
179322 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
179323 l_rec_acct_attrs.array_num_value(6) := p_source_52;
179324
179325 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
179326 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
179327
179328 ---------------------------------------------------------------------------------------------------------------
179329 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
179330 ---------------------------------------------------------------------------------------------------------------
179331 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
179332
179333 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
179334 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
179335
179336 IF xla_accounting_cache_pkg.GetValueChar
179337 (p_source_code => 'LEDGER_CATEGORY_CODE'
179338 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
179339 AND l_bflow_method_code = 'PRIOR_ENTRY'
179340 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
179341 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
179342 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
179343 )
179344 THEN
179345 xla_ae_lines_pkg.BflowUpgEntry
179346 (p_business_method_code => l_bflow_method_code
179347 ,p_business_class_code => l_bflow_class_code
179348 ,p_balance_type => l_balance_type_code);
179349 ELSE
179350 NULL;
179351 -- No business flow processing for business flow method of NONE.
179352 END IF;
179353
179354 --
179355 -- call analytical criteria
179356 --
179357
179358 --
179359 -- call description
179363 p_ae_header_id => l_ae_header_id
179360 --
179361
179362 xla_ae_lines_pkg.SetLineDescription(
179364 ,p_description => Description_141 (
179365 p_application_id => p_application_id
179366 , p_ae_header_id => l_ae_header_id
179367 , p_source_1 => p_source_1
179368 )
179369 );
179370
179371
179372 --
179373 -- call ADRs
179374 -- Bug 4922099
179375 --
179376 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
179377 (NVL(l_actual_upg_option, 'N') = 'O') OR
179378 (NVL(l_enc_upg_option, 'N') = 'O')
179379 )
179380 THEN
179381 NULL;
179382 --
179383 --
179384
179385 l_ccid := AcctDerRule_176(
179386 p_application_id => p_application_id
179387 , p_ae_header_id => l_ae_header_id
179388 , p_source_5 => p_source_5
179389 , p_source_31 => p_source_31
179390 , x_transaction_coa_id => l_adr_transaction_coa_id
179391 , x_accounting_coa_id => l_adr_accounting_coa_id
179392 , x_value_type_code => l_adr_value_type_code
179393 , p_side => 'NA'
179394 );
179395
179396 xla_ae_lines_pkg.set_ccid(
179397 p_code_combination_id => l_ccid
179398 , p_value_type_code => l_adr_value_type_code
179399 , p_transaction_coa_id => l_adr_transaction_coa_id
179400 , p_accounting_coa_id => l_adr_accounting_coa_id
179401 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
179402 , p_adr_type_code => 'S'
179403 , p_component_type => l_component_type
179404 , p_component_code => l_component_code
179405 , p_component_type_code => l_component_type_code
179406 , p_component_appl_id => l_component_appl_id
179407 , p_amb_context_code => l_amb_context_code
179408 , p_side => 'NA'
179409 );
179410
179411
179412 --
179413 --
179414 END IF;
179415 --
179416 -- Bug 4922099
179417 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
179418 (NVL(l_enc_upg_option, 'N') = 'O')
179419 ) AND
179420 (l_bflow_method_code = 'PRIOR_ENTRY')
179421 )
179422 THEN
179423 IF
179424 --
179425 1 = 2
179426 --
179427 THEN
179428 xla_accounting_err_pkg.build_message
179429 (p_appli_s_name => 'XLA'
179430 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
179431 ,p_token_1 => 'LINE_NUMBER'
179432 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
179433 ,p_token_2 => 'LINE_TYPE_NAME'
179434 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
179435 l_component_type
179436 ,l_component_code
179437 ,l_component_type_code
179438 ,l_component_appl_id
179439 ,l_amb_context_code
179440 ,l_entity_code
179441 ,l_event_class_code
179442 )
179443 ,p_token_3 => 'OWNER'
179444 ,p_value_3 => xla_lookups_pkg.get_meaning(
179445 p_lookup_type => 'XLA_OWNER_TYPE'
179446 ,p_lookup_code => l_component_type_code
179447 )
179448 ,p_token_4 => 'PRODUCT_NAME'
179449 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
179450 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
179451 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
179452 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
179453 ,p_ae_header_id => NULL
179454 );
179455
179456 IF (C_LEVEL_ERROR>= g_log_level) THEN
179457 trace
179458 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
179459 ,p_level => C_LEVEL_ERROR
179460 ,p_module => l_log_module);
179461 END IF;
179462 END IF;
179463 END IF;
179464 --
179465 --
179466 ------------------------------------------------------------------------------------------------
179467 -- 4219869 Business Flow
179468 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
179469 -- Prior Entry. Currently, the following code is always generated.
179470 ------------------------------------------------------------------------------------------------
179474 -- 4219869 Business Flow
179471 XLA_AE_LINES_PKG.ValidateCurrentLine;
179472
179473 ------------------------------------------------------------------------------------
179475 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
179476 ------------------------------------------------------------------------------------
179477 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
179478
179479 ----------------------------------------------------------------------------------
179480 -- 4219869 Business Flow
179481 -- Update journal entry status -- Need to generate this within IF <condition>
179482 ----------------------------------------------------------------------------------
179483 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
179484 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
179485 ,p_balance_type_code => l_balance_type_code
179486 );
179487
179488 -------------------------------------------------------------------------------------------
179489 -- 4262811 - Generate the Accrual Reversal lines
179490 -------------------------------------------------------------------------------------------
179491 BEGIN
179492 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
179493 (g_array_event(p_event_id).array_value_num('header_index'));
179494 IF l_acc_rev_flag IS NULL THEN
179495 l_acc_rev_flag := 'N';
179496 END IF;
179497 EXCEPTION
179498 WHEN OTHERS THEN
179499 l_acc_rev_flag := 'N';
179500 END;
179501 --
179502 IF (l_acc_rev_flag = 'Y') THEN
179503
179504 -- 4645092 ------------------------------------------------------------------------------
179505 -- To allow MPA report to determine if it should generate report process
179506 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
179507 ------------------------------------------------------------------------------------------
179508
179509 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
179510 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
179511 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
179512 -- call ADRs
179513 -- Bug 4922099
179514 --
179515 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
179516 (NVL(l_actual_upg_option, 'N') = 'O') OR
179517 (NVL(l_enc_upg_option, 'N') = 'O')
179518 )
179519 THEN
179520 NULL;
179521 --
179522 --
179523
179524 l_ccid := AcctDerRule_176(
179525 p_application_id => p_application_id
179526 , p_ae_header_id => l_ae_header_id
179527 , p_source_5 => p_source_5
179528 , p_source_31 => p_source_31
179529 , x_transaction_coa_id => l_adr_transaction_coa_id
179530 , x_accounting_coa_id => l_adr_accounting_coa_id
179531 , x_value_type_code => l_adr_value_type_code
179532 , p_side => 'NA'
179533 );
179534
179535 xla_ae_lines_pkg.set_ccid(
179536 p_code_combination_id => l_ccid
179537 , p_value_type_code => l_adr_value_type_code
179538 , p_transaction_coa_id => l_adr_transaction_coa_id
179539 , p_accounting_coa_id => l_adr_accounting_coa_id
179540 , p_adr_code => 'FA_EXPENSE_ACCOUNT'
179541 , p_adr_type_code => 'S'
179542 , p_component_type => l_component_type
179543 , p_component_code => l_component_code
179544 , p_component_type_code => l_component_type_code
179545 , p_component_appl_id => l_component_appl_id
179546 , p_amb_context_code => l_amb_context_code
179547 , p_side => 'NA'
179548 );
179549
179550
179551 --
179552 --
179553 END IF;
179554
179555 --
179556 -- Update the line information that should be overwritten
179557 --
179558 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
179559 p_header_num => 1);
179560 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
179561
179562 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
179563
179564 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
179565 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
179566 END IF;
179567
179568 --
179569 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
179570 --
179571 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
179572 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
179573 ELSE
179574 ---------------------------------------------------------------------------------------------------
179575 -- 4262811a Switch Sign
179576 ---------------------------------------------------------------------------------------------------
179577 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
179578 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
179579 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
179583 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
179580 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
179581 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
179582 -- 5132302
179584 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
179585
179586 END IF;
179587
179588 -- 4955764
179589 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
179590 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
179591
179592
179593 XLA_AE_LINES_PKG.ValidateCurrentLine;
179594 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
179595
179596 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
179597 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
179598 ,p_balance_type_code => l_balance_type_code);
179599
179600 END IF;
179601
179602 -----------------------------------------------------------------------------------------
179603 -- 4262811 Multiperiod Accounting
179604 -----------------------------------------------------------------------------------------
179605 -- No MPA option is assigned.
179606
179607
179608 END IF;
179609 END IF;
179610 --
179611
179612 --
179613 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
179614 trace
179615 (p_msg => 'END of AcctLineType_417'
179616 ,p_level => C_LEVEL_PROCEDURE
179617 ,p_module => l_log_module);
179618 END IF;
179619 --
179620 EXCEPTION
179621 WHEN xla_exceptions_pkg.application_exception THEN
179622 RAISE;
179623 WHEN OTHERS THEN
179624 xla_exceptions_pkg.raise_message
179625 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_417');
179626 END AcctLineType_417;
179627 --
179628
179629 ---------------------------------------
179630 --
179631 -- PRIVATE FUNCTION
179632 -- AcctLineType_418
179633 --
179634 ---------------------------------------
179635 PROCEDURE AcctLineType_418 (
179636 p_application_id IN NUMBER
179637 ,p_event_id IN NUMBER
179638 ,p_calculate_acctd_flag IN VARCHAR2
179639 ,p_calculate_g_l_flag IN VARCHAR2
179640 ,p_actual_flag IN OUT VARCHAR2
179641 ,p_balance_type_code OUT VARCHAR2
179642 ,p_gain_or_loss_ref OUT VARCHAR2
179643
179644 --Period Close Date
179645 , p_source_1 IN DATE
179646 --Depreciation Reserve Account
179647 , p_source_12 IN VARCHAR2
179648 --Generated Offset Code Combination Identifier
179649 , p_source_19 IN NUMBER
179650 --Expense Account Code Combination Identifier
179651 , p_source_31 IN NUMBER
179652 --Default Code Combination Identifier
179653 , p_source_32 IN NUMBER
179654 --Adjustment Type
179655 , p_source_48 IN VARCHAR2
179656 --Transaction Header Identifier
179657 , p_source_49 IN NUMBER
179658 --Adjustment Line Identifier
179659 , p_source_50 IN NUMBER
179660 --Distribution Type Code
179661 , p_source_51 IN VARCHAR2
179662 --Entered Amount
179663 , p_source_52 IN NUMBER
179664 --Currency Code
179665 , p_source_53 IN VARCHAR2
179666 )
179667 IS
179668
179669 l_component_type VARCHAR2(80);
179670 l_component_code VARCHAR2(30);
179671 l_component_type_code VARCHAR2(1);
179672 l_component_appl_id INTEGER;
179673 l_amb_context_code VARCHAR2(30);
179674 l_entity_code VARCHAR2(30);
179675 l_event_class_code VARCHAR2(30);
179676 l_ae_header_id NUMBER;
179677 l_event_type_code VARCHAR2(30);
179678 l_line_definition_code VARCHAR2(30);
179679 l_line_definition_owner_code VARCHAR2(1);
179680 --
179681 -- adr variables
179682 l_segment VARCHAR2(30);
179683 l_ccid NUMBER;
179684 l_adr_transaction_coa_id NUMBER;
179685 l_adr_accounting_coa_id NUMBER;
179686 l_adr_flexfield_segment_code VARCHAR2(30);
179687 l_adr_flex_value_set_id NUMBER;
179688 l_adr_value_type_code VARCHAR2(30);
179689 l_adr_value_combination_id NUMBER;
179690 l_adr_value_segment_code VARCHAR2(30);
179691
179692 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
179693 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
179694 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
179695 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
179696
179697 -- 4262811 Variables ------------------------------------------------------------------------------------------
179698 l_entered_amt_idx NUMBER;
179699 l_accted_amt_idx NUMBER;
179700 l_acc_rev_flag VARCHAR2(1);
179701 l_accrual_line_num NUMBER;
179702 l_tmp_amt NUMBER;
179703 l_acc_rev_natural_side_code VARCHAR2(1);
179704
179705 l_num_entries NUMBER;
179706 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
179707 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
179708 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
179712
179709 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
179710 l_recog_line_1 NUMBER;
179711 l_recog_line_2 NUMBER;
179713 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
179714 l_bflow_applied_to_amt NUMBER; -- 5132302
179715 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
179716
179717 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
179718
179719 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
179720 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
179721
179722 ---------------------------------------------------------------------------------------------------------------
179723
179724
179725 --
179726 -- bulk performance
179727 --
179728 l_balance_type_code VARCHAR2(1);
179729 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
179730 l_log_module VARCHAR2(240);
179731
179732 --
179733 -- Upgrade strategy
179734 --
179735 l_actual_upg_option VARCHAR2(1);
179736 l_enc_upg_option VARCHAR2(1);
179737
179738 --
179739 BEGIN
179740 --
179741 IF g_log_enabled THEN
179742 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_418';
179743 END IF;
179744 --
179745 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
179746
179747 trace
179748 (p_msg => 'BEGIN of AcctLineType_418'
179749 ,p_level => C_LEVEL_PROCEDURE
179750 ,p_module => l_log_module);
179751
179752 END IF;
179753 --
179754 l_component_type := 'AMB_JLT';
179755 l_component_code := 'FA_UNPL_RESERVE';
179756 l_component_type_code := 'S';
179757 l_component_appl_id := 140;
179758 l_amb_context_code := 'DEFAULT';
179759 l_entity_code := 'TRANSACTIONS';
179760 l_event_class_code := 'UNPLANNED_DEPRECIATION';
179761 l_event_type_code := 'UNPLANNED_DEPRECIATION_ALL';
179762 l_line_definition_owner_code := 'S';
179763 l_line_definition_code := 'FA_STANDARD_ACCOUNTING_UNPLA27';
179764 --
179765 l_balance_type_code := 'A';
179766 l_segment := NULL;
179767 l_ccid := NULL;
179768 l_adr_transaction_coa_id := NULL;
179769 l_adr_accounting_coa_id := NULL;
179770 l_adr_flexfield_segment_code := NULL;
179771 l_adr_flex_value_set_id := NULL;
179772 l_adr_value_type_code := NULL;
179773 l_adr_value_combination_id := NULL;
179774 l_adr_value_segment_code := NULL;
179775
179776 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
179777 l_bflow_class_code := ''; -- 4219869 Business Flow
179778 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
179779 l_budgetary_control_flag := 'N';
179780
179781 l_bflow_applied_to_amt_idx := NULL; -- 5132302
179782 l_bflow_applied_to_amt := NULL; -- 5132302
179783 l_entered_amt_idx := NULL; -- 4262811
179784 l_accted_amt_idx := NULL; -- 4262811
179785 l_acc_rev_flag := NULL; -- 4262811
179786 l_accrual_line_num := NULL; -- 4262811
179787 l_tmp_amt := NULL; -- 4262811
179788 --
179789
179790 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
179791 l_balance_type_code <> 'B' THEN
179792 IF NVL(p_source_48,'
179793 ') = 'EXPENSE'
179794 THEN
179795
179796 --
179797 XLA_AE_LINES_PKG.SetNewLine;
179798
179799 p_balance_type_code := l_balance_type_code;
179800 -- set the flag so later we will know whether the gain loss line needs to be created
179801
179802 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
179803 p_actual_flag :='A';
179804 END IF;
179805
179806 --
179807 -- bulk performance
179808 --
179809 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
179810 p_header_num => 0); -- 4262811
179811 --
179812 -- set accounting line options
179813 --
179814 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
179815 p_natural_side_code => 'C'
179816 , p_gain_or_loss_flag => 'N'
179817 , p_gl_transfer_mode_code => 'S'
179818 , p_acct_entry_type_code => 'A'
179819 , p_switch_side_flag => 'Y'
179820 , p_merge_duplicate_code => 'N'
179821 );
179822 --
179823 l_acc_rev_natural_side_code := 'D'; -- 4262811
179824 --
179825 --
179826 -- set accounting line type info
179827 --
179828 xla_ae_lines_pkg.SetAcctLineType
179829 (p_component_type => l_component_type
179830 ,p_event_type_code => l_event_type_code
179831 ,p_line_definition_owner_code => l_line_definition_owner_code
179832 ,p_line_definition_code => l_line_definition_code
179833 ,p_accounting_line_code => l_component_code
179834 ,p_accounting_line_type_code => l_component_type_code
179835 ,p_accounting_line_appl_id => l_component_appl_id
179836 ,p_amb_context_code => l_amb_context_code
179837 ,p_entity_code => l_entity_code
179838 ,p_event_class_code => l_event_class_code);
179842 xla_ae_lines_pkg.SetAcctClass(
179839 --
179840 -- set accounting class
179841 --
179843 p_accounting_class_code => 'ASSET'
179844 , p_ae_header_id => l_ae_header_id
179845 );
179846
179847 --
179848 -- set rounding class
179849 --
179850 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
179851 'ASSET';
179852
179853 --
179854 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
179855 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
179856 --
179857 -- bulk performance
179858 --
179859 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
179860
179861 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
179862 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
179863
179864 -- 4955764
179865 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
179866 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
179867
179868 -- 4458381 Public Sector Enh
179869
179870 --
179871 -- set accounting attributes for the line type
179872 --
179873 l_entered_amt_idx := 4;
179874 l_accted_amt_idx := 6;
179875 l_bflow_applied_to_amt_idx := NULL; -- 5132302
179876 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
179877 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
179878 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
179879 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
179880 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
179881 l_rec_acct_attrs.array_char_value(3) := p_source_51;
179882 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
179883 l_rec_acct_attrs.array_num_value(4) := p_source_52;
179884 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
179885 l_rec_acct_attrs.array_char_value(5) := p_source_53;
179886 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
179887 l_rec_acct_attrs.array_num_value(6) := p_source_52;
179888
179889 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
179890 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
179891
179892 ---------------------------------------------------------------------------------------------------------------
179893 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
179894 ---------------------------------------------------------------------------------------------------------------
179895 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
179896
179897 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
179898 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
179899
179900 IF xla_accounting_cache_pkg.GetValueChar
179901 (p_source_code => 'LEDGER_CATEGORY_CODE'
179902 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
179903 AND l_bflow_method_code = 'PRIOR_ENTRY'
179904 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
179905 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
179906 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
179907 )
179908 THEN
179909 xla_ae_lines_pkg.BflowUpgEntry
179910 (p_business_method_code => l_bflow_method_code
179911 ,p_business_class_code => l_bflow_class_code
179912 ,p_balance_type => l_balance_type_code);
179913 ELSE
179914 NULL;
179915 -- No business flow processing for business flow method of NONE.
179916 END IF;
179917
179918 --
179919 -- call analytical criteria
179920 --
179921
179922 --
179923 -- call description
179924 --
179925
179926 xla_ae_lines_pkg.SetLineDescription(
179927 p_ae_header_id => l_ae_header_id
179928 ,p_description => Description_142 (
179929 p_application_id => p_application_id
179930 , p_ae_header_id => l_ae_header_id
179931 , p_source_1 => p_source_1
179932 )
179933 );
179934
179935
179936 --
179937 -- call ADRs
179938 -- Bug 4922099
179939 --
179940 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
179941 (NVL(l_actual_upg_option, 'N') = 'O') OR
179942 (NVL(l_enc_upg_option, 'N') = 'O')
179943 )
179944 THEN
179945 NULL;
179946 --
179947 --
179948
179949 l_ccid := AcctDerRule_181(
179950 p_application_id => p_application_id
179951 , p_ae_header_id => l_ae_header_id
179952 , p_source_19 => p_source_19
179953 , p_source_32 => p_source_32
179954 , x_transaction_coa_id => l_adr_transaction_coa_id
179955 , x_accounting_coa_id => l_adr_accounting_coa_id
179956 , x_value_type_code => l_adr_value_type_code
179957 , p_side => 'NA'
179958 );
179959
179960 xla_ae_lines_pkg.set_ccid(
179961 p_code_combination_id => l_ccid
179962 , p_value_type_code => l_adr_value_type_code
179966 , p_adr_type_code => 'S'
179963 , p_transaction_coa_id => l_adr_transaction_coa_id
179964 , p_accounting_coa_id => l_adr_accounting_coa_id
179965 , p_adr_code => 'FA_UPL_RESERVE'
179967 , p_component_type => l_component_type
179968 , p_component_code => l_component_code
179969 , p_component_type_code => l_component_type_code
179970 , p_component_appl_id => l_component_appl_id
179971 , p_amb_context_code => l_amb_context_code
179972 , p_side => 'NA'
179973 );
179974
179975
179976 l_segment := AcctDerRule_168(
179977 p_application_id => p_application_id
179978 , p_ae_header_id => l_ae_header_id
179979 , p_source_12 => p_source_12
179980 , p_source_19 => p_source_19
179981 , x_transaction_coa_id => l_adr_transaction_coa_id
179982 , x_accounting_coa_id => l_adr_accounting_coa_id
179983 , x_flexfield_segment_code => l_adr_flexfield_segment_code
179984 , x_flex_value_set_id => l_adr_flex_value_set_id
179985 , x_value_type_code => l_adr_value_type_code
179986 , x_value_combination_id => l_adr_value_combination_id
179987 , x_value_segment_code => l_adr_value_segment_code
179988 , p_side => 'NA'
179989 , p_override_seg_flag => 'Y'
179990 );
179991
179992 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
179993
179994 xla_ae_lines_pkg.set_segment(
179995 p_to_segment_code => 'GL_ACCOUNT'
179996 , p_segment_value => l_segment
179997 , p_from_segment_code => l_adr_value_segment_code
179998 , p_from_combination_id => l_adr_value_combination_id
179999 , p_value_type_code => l_adr_value_type_code
180000 , p_transaction_coa_id => l_adr_transaction_coa_id
180001 , p_accounting_coa_id => l_adr_accounting_coa_id
180002 , p_flexfield_segment_code => l_adr_flexfield_segment_code
180003 , p_flex_value_set_id => l_adr_flex_value_set_id
180004 , p_adr_code => 'FA_UPL_CAT_RES_ACCOUNT_SEGMENT'
180005 , p_adr_type_code => 'S'
180006 , p_component_type => l_component_type
180007 , p_component_code => l_component_code
180008 , p_component_type_code => l_component_type_code
180009 , p_component_appl_id => l_component_appl_id
180010 , p_amb_context_code => l_amb_context_code
180011 , p_entity_code => 'TRANSACTIONS'
180012 , p_event_class_code => 'UNPLANNED_DEPRECIATION'
180013 , p_side => 'NA'
180014 );
180015
180016 END IF;
180017
180018 l_segment := AcctDerRule_171(
180019 p_application_id => p_application_id
180020 , p_ae_header_id => l_ae_header_id
180021 , p_source_19 => p_source_19
180022 , p_source_31 => p_source_31
180023 , x_transaction_coa_id => l_adr_transaction_coa_id
180024 , x_accounting_coa_id => l_adr_accounting_coa_id
180025 , x_flexfield_segment_code => l_adr_flexfield_segment_code
180026 , x_flex_value_set_id => l_adr_flex_value_set_id
180027 , x_value_type_code => l_adr_value_type_code
180028 , x_value_combination_id => l_adr_value_combination_id
180029 , x_value_segment_code => l_adr_value_segment_code
180030 , p_side => 'NA'
180031 , p_override_seg_flag => 'Y'
180032 );
180033
180034 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
180035
180036 xla_ae_lines_pkg.set_segment(
180037 p_to_segment_code => 'GL_BALANCING'
180038 , p_segment_value => l_segment
180039 , p_from_segment_code => l_adr_value_segment_code
180040 , p_from_combination_id => l_adr_value_combination_id
180041 , p_value_type_code => l_adr_value_type_code
180042 , p_transaction_coa_id => l_adr_transaction_coa_id
180043 , p_accounting_coa_id => l_adr_accounting_coa_id
180044 , p_flexfield_segment_code => l_adr_flexfield_segment_code
180045 , p_flex_value_set_id => l_adr_flex_value_set_id
180046 , p_adr_code => 'FA_UPL_EXP_ACCOUNT'
180047 , p_adr_type_code => 'S'
180048 , p_component_type => l_component_type
180049 , p_component_code => l_component_code
180050 , p_component_type_code => l_component_type_code
180051 , p_component_appl_id => l_component_appl_id
180052 , p_amb_context_code => l_amb_context_code
180053 , p_entity_code => 'TRANSACTIONS'
180054 , p_event_class_code => 'UNPLANNED_DEPRECIATION'
180055 , p_side => 'NA'
180056 );
180057
180058 END IF;
180059
180060 --
180061 --
180062 END IF;
180063 --
180064 -- Bug 4922099
180065 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
180066 (NVL(l_enc_upg_option, 'N') = 'O')
180067 ) AND
180068 (l_bflow_method_code = 'PRIOR_ENTRY')
180069 )
180070 THEN
180071 IF
180072 --
180073 1 = 2
180074 --
180075 THEN
180076 xla_accounting_err_pkg.build_message
180077 (p_appli_s_name => 'XLA'
180081 ,p_token_2 => 'LINE_TYPE_NAME'
180078 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
180079 ,p_token_1 => 'LINE_NUMBER'
180080 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
180082 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
180083 l_component_type
180084 ,l_component_code
180085 ,l_component_type_code
180086 ,l_component_appl_id
180087 ,l_amb_context_code
180088 ,l_entity_code
180089 ,l_event_class_code
180090 )
180091 ,p_token_3 => 'OWNER'
180092 ,p_value_3 => xla_lookups_pkg.get_meaning(
180093 p_lookup_type => 'XLA_OWNER_TYPE'
180094 ,p_lookup_code => l_component_type_code
180095 )
180096 ,p_token_4 => 'PRODUCT_NAME'
180097 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
180098 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
180099 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
180100 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
180101 ,p_ae_header_id => NULL
180102 );
180103
180104 IF (C_LEVEL_ERROR>= g_log_level) THEN
180105 trace
180106 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
180107 ,p_level => C_LEVEL_ERROR
180108 ,p_module => l_log_module);
180109 END IF;
180110 END IF;
180111 END IF;
180112 --
180113 --
180114 ------------------------------------------------------------------------------------------------
180115 -- 4219869 Business Flow
180116 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
180117 -- Prior Entry. Currently, the following code is always generated.
180118 ------------------------------------------------------------------------------------------------
180119 XLA_AE_LINES_PKG.ValidateCurrentLine;
180120
180121 ------------------------------------------------------------------------------------
180122 -- 4219869 Business Flow
180123 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
180124 ------------------------------------------------------------------------------------
180125 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
180126
180127 ----------------------------------------------------------------------------------
180128 -- 4219869 Business Flow
180129 -- Update journal entry status -- Need to generate this within IF <condition>
180130 ----------------------------------------------------------------------------------
180131 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
180132 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
180133 ,p_balance_type_code => l_balance_type_code
180134 );
180135
180136 -------------------------------------------------------------------------------------------
180137 -- 4262811 - Generate the Accrual Reversal lines
180138 -------------------------------------------------------------------------------------------
180139 BEGIN
180140 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
180141 (g_array_event(p_event_id).array_value_num('header_index'));
180142 IF l_acc_rev_flag IS NULL THEN
180143 l_acc_rev_flag := 'N';
180144 END IF;
180145 EXCEPTION
180146 WHEN OTHERS THEN
180147 l_acc_rev_flag := 'N';
180148 END;
180149 --
180150 IF (l_acc_rev_flag = 'Y') THEN
180151
180152 -- 4645092 ------------------------------------------------------------------------------
180153 -- To allow MPA report to determine if it should generate report process
180154 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
180155 ------------------------------------------------------------------------------------------
180156
180157 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
180158 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
180159 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
180160 -- call ADRs
180161 -- Bug 4922099
180162 --
180163 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
180164 (NVL(l_actual_upg_option, 'N') = 'O') OR
180165 (NVL(l_enc_upg_option, 'N') = 'O')
180166 )
180167 THEN
180168 NULL;
180169 --
180173 p_application_id => p_application_id
180170 --
180171
180172 l_ccid := AcctDerRule_181(
180174 , p_ae_header_id => l_ae_header_id
180175 , p_source_19 => p_source_19
180176 , p_source_32 => p_source_32
180177 , x_transaction_coa_id => l_adr_transaction_coa_id
180178 , x_accounting_coa_id => l_adr_accounting_coa_id
180179 , x_value_type_code => l_adr_value_type_code
180180 , p_side => 'NA'
180181 );
180182
180183 xla_ae_lines_pkg.set_ccid(
180184 p_code_combination_id => l_ccid
180185 , p_value_type_code => l_adr_value_type_code
180186 , p_transaction_coa_id => l_adr_transaction_coa_id
180187 , p_accounting_coa_id => l_adr_accounting_coa_id
180188 , p_adr_code => 'FA_UPL_RESERVE'
180189 , p_adr_type_code => 'S'
180190 , p_component_type => l_component_type
180191 , p_component_code => l_component_code
180192 , p_component_type_code => l_component_type_code
180193 , p_component_appl_id => l_component_appl_id
180194 , p_amb_context_code => l_amb_context_code
180195 , p_side => 'NA'
180196 );
180197
180198
180199 l_segment := AcctDerRule_168(
180200 p_application_id => p_application_id
180201 , p_ae_header_id => l_ae_header_id
180202 , p_source_12 => p_source_12
180203 , p_source_19 => p_source_19
180204 , x_transaction_coa_id => l_adr_transaction_coa_id
180205 , x_accounting_coa_id => l_adr_accounting_coa_id
180206 , x_flexfield_segment_code => l_adr_flexfield_segment_code
180207 , x_flex_value_set_id => l_adr_flex_value_set_id
180208 , x_value_type_code => l_adr_value_type_code
180209 , x_value_combination_id => l_adr_value_combination_id
180210 , x_value_segment_code => l_adr_value_segment_code
180211 , p_side => 'NA'
180212 , p_override_seg_flag => 'Y'
180213 );
180214
180215 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
180216
180217 xla_ae_lines_pkg.set_segment(
180218 p_to_segment_code => 'GL_ACCOUNT'
180219 , p_segment_value => l_segment
180220 , p_from_segment_code => l_adr_value_segment_code
180221 , p_from_combination_id => l_adr_value_combination_id
180222 , p_value_type_code => l_adr_value_type_code
180223 , p_transaction_coa_id => l_adr_transaction_coa_id
180224 , p_accounting_coa_id => l_adr_accounting_coa_id
180225 , p_flexfield_segment_code => l_adr_flexfield_segment_code
180226 , p_flex_value_set_id => l_adr_flex_value_set_id
180227 , p_adr_code => 'FA_UPL_CAT_RES_ACCOUNT_SEGMENT'
180228 , p_adr_type_code => 'S'
180229 , p_component_type => l_component_type
180230 , p_component_code => l_component_code
180231 , p_component_type_code => l_component_type_code
180232 , p_component_appl_id => l_component_appl_id
180233 , p_amb_context_code => l_amb_context_code
180234 , p_entity_code => 'TRANSACTIONS'
180235 , p_event_class_code => 'UNPLANNED_DEPRECIATION'
180236 , p_side => 'NA'
180237 );
180238
180239 END IF;
180240
180241 l_segment := AcctDerRule_171(
180242 p_application_id => p_application_id
180243 , p_ae_header_id => l_ae_header_id
180244 , p_source_19 => p_source_19
180245 , p_source_31 => p_source_31
180246 , x_transaction_coa_id => l_adr_transaction_coa_id
180247 , x_accounting_coa_id => l_adr_accounting_coa_id
180248 , x_flexfield_segment_code => l_adr_flexfield_segment_code
180249 , x_flex_value_set_id => l_adr_flex_value_set_id
180250 , x_value_type_code => l_adr_value_type_code
180251 , x_value_combination_id => l_adr_value_combination_id
180252 , x_value_segment_code => l_adr_value_segment_code
180253 , p_side => 'NA'
180254 , p_override_seg_flag => 'Y'
180255 );
180256
180257 IF NVL(l_segment,'NULL') <> '#$NO_OVERRIDE#$' THEN -- 4465612
180258
180259 xla_ae_lines_pkg.set_segment(
180260 p_to_segment_code => 'GL_BALANCING'
180261 , p_segment_value => l_segment
180262 , p_from_segment_code => l_adr_value_segment_code
180263 , p_from_combination_id => l_adr_value_combination_id
180264 , p_value_type_code => l_adr_value_type_code
180265 , p_transaction_coa_id => l_adr_transaction_coa_id
180266 , p_accounting_coa_id => l_adr_accounting_coa_id
180267 , p_flexfield_segment_code => l_adr_flexfield_segment_code
180268 , p_flex_value_set_id => l_adr_flex_value_set_id
180269 , p_adr_code => 'FA_UPL_EXP_ACCOUNT'
180270 , p_adr_type_code => 'S'
180271 , p_component_type => l_component_type
180272 , p_component_code => l_component_code
180273 , p_component_type_code => l_component_type_code
180274 , p_component_appl_id => l_component_appl_id
180275 , p_amb_context_code => l_amb_context_code
180279 );
180276 , p_entity_code => 'TRANSACTIONS'
180277 , p_event_class_code => 'UNPLANNED_DEPRECIATION'
180278 , p_side => 'NA'
180280
180281 END IF;
180282
180283 --
180284 --
180285 END IF;
180286
180287 --
180288 -- Update the line information that should be overwritten
180289 --
180290 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
180291 p_header_num => 1);
180292 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
180293
180294 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
180295
180296 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
180297 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
180298 END IF;
180299
180300 --
180301 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
180302 --
180303 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
180304 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
180305 ELSE
180306 ---------------------------------------------------------------------------------------------------
180307 -- 4262811a Switch Sign
180308 ---------------------------------------------------------------------------------------------------
180309 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
180310 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
180311 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
180312 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
180313 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
180314 -- 5132302
180315 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
180316 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
180317
180318 END IF;
180319
180320 -- 4955764
180321 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
180322 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
180323
180324
180325 XLA_AE_LINES_PKG.ValidateCurrentLine;
180326 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
180327
180328 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
180329 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
180330 ,p_balance_type_code => l_balance_type_code);
180331
180332 END IF;
180333
180334 -----------------------------------------------------------------------------------------
180335 -- 4262811 Multiperiod Accounting
180336 -----------------------------------------------------------------------------------------
180337 -- No MPA option is assigned.
180338
180339
180340 END IF;
180341 END IF;
180342 --
180343
180344 --
180345 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
180346 trace
180347 (p_msg => 'END of AcctLineType_418'
180348 ,p_level => C_LEVEL_PROCEDURE
180349 ,p_module => l_log_module);
180350 END IF;
180351 --
180352 EXCEPTION
180353 WHEN xla_exceptions_pkg.application_exception THEN
180354 RAISE;
180355 WHEN OTHERS THEN
180356 xla_exceptions_pkg.raise_message
180357 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_418');
180358 END AcctLineType_418;
180359 --
180360
180361 ---------------------------------------
180362 --
180363 -- PRIVATE FUNCTION
180364 -- AcctLineType_419
180365 --
180366 ---------------------------------------
180367 PROCEDURE AcctLineType_419 (
180368 p_application_id IN NUMBER
180369 ,p_event_id IN NUMBER
180370 ,p_calculate_acctd_flag IN VARCHAR2
180371 ,p_calculate_g_l_flag IN VARCHAR2
180372 ,p_actual_flag IN OUT VARCHAR2
180373 ,p_balance_type_code OUT VARCHAR2
180374 ,p_gain_or_loss_ref OUT VARCHAR2
180375
180376 --Inflation Adjustment Type Description
180377 , p_source_2 IN VARCHAR2
180378 --Accounting Date
180379 , p_source_3 IN DATE
180380 --Inflation Asset Ccid
180381 , p_source_37 IN NUMBER
180382 --Transaction Header Identifier
180383 , p_source_49 IN NUMBER
180384 --Adjustment Line Identifier
180385 , p_source_50 IN NUMBER
180386 --Distribution Type Code
180387 , p_source_51 IN VARCHAR2
180388 --Inflation Adjustment Type
180389 , p_source_64 IN VARCHAR2
180390 --Inflation Entered Amount
180391 , p_source_65 IN NUMBER
180392 --Inflation Currency Code
180393 , p_source_66 IN VARCHAR2
180394 )
180395 IS
180396
180397 l_component_type VARCHAR2(80);
180398 l_component_code VARCHAR2(30);
180399 l_component_type_code VARCHAR2(1);
180400 l_component_appl_id INTEGER;
180401 l_amb_context_code VARCHAR2(30);
180405 l_event_type_code VARCHAR2(30);
180402 l_entity_code VARCHAR2(30);
180403 l_event_class_code VARCHAR2(30);
180404 l_ae_header_id NUMBER;
180406 l_line_definition_code VARCHAR2(30);
180407 l_line_definition_owner_code VARCHAR2(1);
180408 --
180409 -- adr variables
180410 l_segment VARCHAR2(30);
180411 l_ccid NUMBER;
180412 l_adr_transaction_coa_id NUMBER;
180413 l_adr_accounting_coa_id NUMBER;
180414 l_adr_flexfield_segment_code VARCHAR2(30);
180415 l_adr_flex_value_set_id NUMBER;
180416 l_adr_value_type_code VARCHAR2(30);
180417 l_adr_value_combination_id NUMBER;
180418 l_adr_value_segment_code VARCHAR2(30);
180419
180420 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
180421 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
180422 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
180423 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
180424
180425 -- 4262811 Variables ------------------------------------------------------------------------------------------
180426 l_entered_amt_idx NUMBER;
180427 l_accted_amt_idx NUMBER;
180428 l_acc_rev_flag VARCHAR2(1);
180429 l_accrual_line_num NUMBER;
180430 l_tmp_amt NUMBER;
180431 l_acc_rev_natural_side_code VARCHAR2(1);
180432
180433 l_num_entries NUMBER;
180434 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
180435 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
180436 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
180437 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
180438 l_recog_line_1 NUMBER;
180439 l_recog_line_2 NUMBER;
180440
180441 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
180442 l_bflow_applied_to_amt NUMBER; -- 5132302
180443 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
180444
180445 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
180446
180447 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
180448 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
180449
180450 ---------------------------------------------------------------------------------------------------------------
180451
180452
180453 --
180454 -- bulk performance
180455 --
180456 l_balance_type_code VARCHAR2(1);
180457 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
180458 l_log_module VARCHAR2(240);
180459
180460 --
180461 -- Upgrade strategy
180462 --
180463 l_actual_upg_option VARCHAR2(1);
180464 l_enc_upg_option VARCHAR2(1);
180465
180466 --
180467 BEGIN
180468 --
180469 IF g_log_enabled THEN
180470 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_419';
180471 END IF;
180472 --
180473 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
180474
180475 trace
180476 (p_msg => 'BEGIN of AcctLineType_419'
180477 ,p_level => C_LEVEL_PROCEDURE
180478 ,p_module => l_log_module);
180479
180480 END IF;
180481 --
180482 l_component_type := 'AMB_JLT';
180483 l_component_code := 'IAC_ASSET_COST';
180484 l_component_type_code := 'S';
180485 l_component_appl_id := 140;
180486 l_amb_context_code := 'DEFAULT';
180487 l_entity_code := 'TRANSACTIONS';
180488 l_event_class_code := 'TRANSFERS';
180489 l_event_type_code := 'TRANSFERS_ALL';
180490 l_line_definition_owner_code := 'S';
180491 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
180492 --
180493 l_balance_type_code := 'A';
180494 l_segment := NULL;
180495 l_ccid := NULL;
180496 l_adr_transaction_coa_id := NULL;
180497 l_adr_accounting_coa_id := NULL;
180498 l_adr_flexfield_segment_code := NULL;
180499 l_adr_flex_value_set_id := NULL;
180500 l_adr_value_type_code := NULL;
180501 l_adr_value_combination_id := NULL;
180502 l_adr_value_segment_code := NULL;
180503
180504 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
180505 l_bflow_class_code := ''; -- 4219869 Business Flow
180506 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
180507 l_budgetary_control_flag := 'N';
180508
180509 l_bflow_applied_to_amt_idx := NULL; -- 5132302
180510 l_bflow_applied_to_amt := NULL; -- 5132302
180511 l_entered_amt_idx := NULL; -- 4262811
180512 l_accted_amt_idx := NULL; -- 4262811
180513 l_acc_rev_flag := NULL; -- 4262811
180514 l_accrual_line_num := NULL; -- 4262811
180515 l_tmp_amt := NULL; -- 4262811
180516 --
180517
180518 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
180519 l_balance_type_code <> 'B' THEN
180520 IF NVL(p_source_64,'
180521 ') = 'COST'
180522 THEN
180523
180524 --
180525 XLA_AE_LINES_PKG.SetNewLine;
180526
180527 p_balance_type_code := l_balance_type_code;
180528 -- set the flag so later we will know whether the gain loss line needs to be created
180529
180530 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
180534 --
180531 p_actual_flag :='A';
180532 END IF;
180533
180535 -- bulk performance
180536 --
180537 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
180538 p_header_num => 0); -- 4262811
180539 --
180540 -- set accounting line options
180541 --
180542 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
180543 p_natural_side_code => 'D'
180544 , p_gain_or_loss_flag => 'N'
180545 , p_gl_transfer_mode_code => 'S'
180546 , p_acct_entry_type_code => 'A'
180547 , p_switch_side_flag => 'Y'
180548 , p_merge_duplicate_code => 'N'
180549 );
180550 --
180551 l_acc_rev_natural_side_code := 'C'; -- 4262811
180552 --
180553 --
180554 -- set accounting line type info
180555 --
180556 xla_ae_lines_pkg.SetAcctLineType
180557 (p_component_type => l_component_type
180558 ,p_event_type_code => l_event_type_code
180559 ,p_line_definition_owner_code => l_line_definition_owner_code
180560 ,p_line_definition_code => l_line_definition_code
180561 ,p_accounting_line_code => l_component_code
180562 ,p_accounting_line_type_code => l_component_type_code
180563 ,p_accounting_line_appl_id => l_component_appl_id
180564 ,p_amb_context_code => l_amb_context_code
180565 ,p_entity_code => l_entity_code
180566 ,p_event_class_code => l_event_class_code);
180567 --
180568 -- set accounting class
180569 --
180570 xla_ae_lines_pkg.SetAcctClass(
180571 p_accounting_class_code => 'ASSET'
180572 , p_ae_header_id => l_ae_header_id
180573 );
180574
180575 --
180576 -- set rounding class
180577 --
180578 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
180579 'ASSET';
180580
180581 --
180582 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
180583 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
180584 --
180585 -- bulk performance
180586 --
180587 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
180588
180589 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
180590 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
180591
180592 -- 4955764
180593 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
180594 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
180595
180596 -- 4458381 Public Sector Enh
180597
180598 --
180599 -- set accounting attributes for the line type
180600 --
180601 l_entered_amt_idx := 4;
180602 l_accted_amt_idx := 6;
180603 l_bflow_applied_to_amt_idx := NULL; -- 5132302
180604 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
180605 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
180606 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
180607 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
180608 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
180609 l_rec_acct_attrs.array_char_value(3) := p_source_51;
180610 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
180611 l_rec_acct_attrs.array_num_value(4) := p_source_65;
180612 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
180613 l_rec_acct_attrs.array_char_value(5) := p_source_66;
180614 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
180615 l_rec_acct_attrs.array_num_value(6) := p_source_65;
180616
180617 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
180618 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
180619
180620 ---------------------------------------------------------------------------------------------------------------
180621 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
180622 ---------------------------------------------------------------------------------------------------------------
180623 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
180624
180625 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
180626 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
180627
180628 IF xla_accounting_cache_pkg.GetValueChar
180629 (p_source_code => 'LEDGER_CATEGORY_CODE'
180630 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
180631 AND l_bflow_method_code = 'PRIOR_ENTRY'
180632 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
180633 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
180634 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
180635 )
180636 THEN
180637 xla_ae_lines_pkg.BflowUpgEntry
180638 (p_business_method_code => l_bflow_method_code
180639 ,p_business_class_code => l_bflow_class_code
180640 ,p_balance_type => l_balance_type_code);
180641 ELSE
180642 NULL;
180646 --
180643 -- No business flow processing for business flow method of NONE.
180644 END IF;
180645
180647 -- call analytical criteria
180648 --
180649
180650 --
180651 -- call description
180652 --
180653
180654 xla_ae_lines_pkg.SetLineDescription(
180655 p_ae_header_id => l_ae_header_id
180656 ,p_description => Description_143 (
180657 p_application_id => p_application_id
180658 , p_ae_header_id => l_ae_header_id
180659 , p_source_2 => p_source_2
180660 , p_source_3 => p_source_3
180661 )
180662 );
180663
180664
180665 --
180666 -- call ADRs
180667 -- Bug 4922099
180668 --
180669 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
180670 (NVL(l_actual_upg_option, 'N') = 'O') OR
180671 (NVL(l_enc_upg_option, 'N') = 'O')
180672 )
180673 THEN
180674 NULL;
180675 --
180676 --
180677
180678 l_ccid := AcctDerRule_182(
180679 p_application_id => p_application_id
180680 , p_ae_header_id => l_ae_header_id
180681 , p_source_37 => p_source_37
180682 , x_transaction_coa_id => l_adr_transaction_coa_id
180683 , x_accounting_coa_id => l_adr_accounting_coa_id
180684 , x_value_type_code => l_adr_value_type_code
180685 , p_side => 'NA'
180686 );
180687
180688 xla_ae_lines_pkg.set_ccid(
180689 p_code_combination_id => l_ccid
180690 , p_value_type_code => l_adr_value_type_code
180691 , p_transaction_coa_id => l_adr_transaction_coa_id
180692 , p_accounting_coa_id => l_adr_accounting_coa_id
180693 , p_adr_code => 'IAC_ASSET_COST_AC'
180694 , p_adr_type_code => 'S'
180695 , p_component_type => l_component_type
180696 , p_component_code => l_component_code
180697 , p_component_type_code => l_component_type_code
180698 , p_component_appl_id => l_component_appl_id
180699 , p_amb_context_code => l_amb_context_code
180700 , p_side => 'NA'
180701 );
180702
180703
180704 --
180705 --
180706 END IF;
180707 --
180708 -- Bug 4922099
180709 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
180710 (NVL(l_enc_upg_option, 'N') = 'O')
180711 ) AND
180712 (l_bflow_method_code = 'PRIOR_ENTRY')
180713 )
180714 THEN
180715 IF
180716 --
180717 1 = 2
180718 --
180719 THEN
180720 xla_accounting_err_pkg.build_message
180721 (p_appli_s_name => 'XLA'
180722 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
180723 ,p_token_1 => 'LINE_NUMBER'
180724 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
180725 ,p_token_2 => 'LINE_TYPE_NAME'
180726 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
180727 l_component_type
180728 ,l_component_code
180729 ,l_component_type_code
180730 ,l_component_appl_id
180731 ,l_amb_context_code
180732 ,l_entity_code
180733 ,l_event_class_code
180734 )
180735 ,p_token_3 => 'OWNER'
180736 ,p_value_3 => xla_lookups_pkg.get_meaning(
180737 p_lookup_type => 'XLA_OWNER_TYPE'
180738 ,p_lookup_code => l_component_type_code
180739 )
180740 ,p_token_4 => 'PRODUCT_NAME'
180741 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
180742 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
180743 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
180744 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
180745 ,p_ae_header_id => NULL
180746 );
180747
180748 IF (C_LEVEL_ERROR>= g_log_level) THEN
180749 trace
180750 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
180751 ,p_level => C_LEVEL_ERROR
180752 ,p_module => l_log_module);
180753 END IF;
180754 END IF;
180755 END IF;
180756 --
180757 --
180761 -- Prior Entry. Currently, the following code is always generated.
180758 ------------------------------------------------------------------------------------------------
180759 -- 4219869 Business Flow
180760 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
180762 ------------------------------------------------------------------------------------------------
180763 XLA_AE_LINES_PKG.ValidateCurrentLine;
180764
180765 ------------------------------------------------------------------------------------
180766 -- 4219869 Business Flow
180767 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
180768 ------------------------------------------------------------------------------------
180769 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
180770
180771 ----------------------------------------------------------------------------------
180772 -- 4219869 Business Flow
180773 -- Update journal entry status -- Need to generate this within IF <condition>
180774 ----------------------------------------------------------------------------------
180775 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
180776 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
180777 ,p_balance_type_code => l_balance_type_code
180778 );
180779
180780 -------------------------------------------------------------------------------------------
180781 -- 4262811 - Generate the Accrual Reversal lines
180782 -------------------------------------------------------------------------------------------
180783 BEGIN
180784 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
180785 (g_array_event(p_event_id).array_value_num('header_index'));
180786 IF l_acc_rev_flag IS NULL THEN
180787 l_acc_rev_flag := 'N';
180788 END IF;
180789 EXCEPTION
180790 WHEN OTHERS THEN
180791 l_acc_rev_flag := 'N';
180792 END;
180793 --
180794 IF (l_acc_rev_flag = 'Y') THEN
180795
180796 -- 4645092 ------------------------------------------------------------------------------
180797 -- To allow MPA report to determine if it should generate report process
180798 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
180799 ------------------------------------------------------------------------------------------
180800
180801 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
180802 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
180803 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
180804 -- call ADRs
180805 -- Bug 4922099
180806 --
180807 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
180808 (NVL(l_actual_upg_option, 'N') = 'O') OR
180809 (NVL(l_enc_upg_option, 'N') = 'O')
180810 )
180811 THEN
180812 NULL;
180813 --
180814 --
180815
180816 l_ccid := AcctDerRule_182(
180817 p_application_id => p_application_id
180818 , p_ae_header_id => l_ae_header_id
180819 , p_source_37 => p_source_37
180820 , x_transaction_coa_id => l_adr_transaction_coa_id
180821 , x_accounting_coa_id => l_adr_accounting_coa_id
180822 , x_value_type_code => l_adr_value_type_code
180823 , p_side => 'NA'
180824 );
180825
180826 xla_ae_lines_pkg.set_ccid(
180827 p_code_combination_id => l_ccid
180828 , p_value_type_code => l_adr_value_type_code
180829 , p_transaction_coa_id => l_adr_transaction_coa_id
180830 , p_accounting_coa_id => l_adr_accounting_coa_id
180831 , p_adr_code => 'IAC_ASSET_COST_AC'
180832 , p_adr_type_code => 'S'
180833 , p_component_type => l_component_type
180834 , p_component_code => l_component_code
180835 , p_component_type_code => l_component_type_code
180836 , p_component_appl_id => l_component_appl_id
180837 , p_amb_context_code => l_amb_context_code
180838 , p_side => 'NA'
180839 );
180840
180841
180842 --
180843 --
180844 END IF;
180845
180846 --
180847 -- Update the line information that should be overwritten
180848 --
180849 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
180850 p_header_num => 1);
180851 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
180852
180853 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
180854
180855 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
180856 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
180857 END IF;
180858
180859 --
180860 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
180861 --
180862 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
180863 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
180864 ELSE
180865 ---------------------------------------------------------------------------------------------------
180866 -- 4262811a Switch Sign
180870 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
180867 ---------------------------------------------------------------------------------------------------
180868 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
180869 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
180871 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
180872 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
180873 -- 5132302
180874 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
180875 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
180876
180877 END IF;
180878
180879 -- 4955764
180880 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
180881 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
180882
180883
180884 XLA_AE_LINES_PKG.ValidateCurrentLine;
180885 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
180886
180887 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
180888 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
180889 ,p_balance_type_code => l_balance_type_code);
180890
180891 END IF;
180892
180893 -----------------------------------------------------------------------------------------
180894 -- 4262811 Multiperiod Accounting
180895 -----------------------------------------------------------------------------------------
180896 -- No MPA option is assigned.
180897
180898
180899 END IF;
180900 END IF;
180901 --
180902
180903 --
180904 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
180905 trace
180906 (p_msg => 'END of AcctLineType_419'
180907 ,p_level => C_LEVEL_PROCEDURE
180908 ,p_module => l_log_module);
180909 END IF;
180910 --
180911 EXCEPTION
180912 WHEN xla_exceptions_pkg.application_exception THEN
180913 RAISE;
180914 WHEN OTHERS THEN
180915 xla_exceptions_pkg.raise_message
180916 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_419');
180917 END AcctLineType_419;
180918 --
180919
180920 ---------------------------------------
180921 --
180922 -- PRIVATE FUNCTION
180923 -- AcctLineType_420
180924 --
180925 ---------------------------------------
180926 PROCEDURE AcctLineType_420 (
180927 p_application_id IN NUMBER
180928 ,p_event_id IN NUMBER
180929 ,p_calculate_acctd_flag IN VARCHAR2
180930 ,p_calculate_g_l_flag IN VARCHAR2
180931 ,p_actual_flag IN OUT VARCHAR2
180932 ,p_balance_type_code OUT VARCHAR2
180933 ,p_gain_or_loss_ref OUT VARCHAR2
180934
180935 --Inflation Adjustment Type Description
180936 , p_source_2 IN VARCHAR2
180937 --Accounting Date
180938 , p_source_3 IN DATE
180939 --Inflation Asset Ccid
180940 , p_source_37 IN NUMBER
180941 --Transaction Header Identifier
180942 , p_source_49 IN NUMBER
180943 --Adjustment Line Identifier
180944 , p_source_50 IN NUMBER
180945 --Distribution Type Code
180946 , p_source_51 IN VARCHAR2
180947 --Inflation Adjustment Type
180948 , p_source_64 IN VARCHAR2
180949 --Inflation Entered Amount
180950 , p_source_65 IN NUMBER
180951 --Inflation Currency Code
180952 , p_source_66 IN VARCHAR2
180953 )
180954 IS
180955
180956 l_component_type VARCHAR2(80);
180957 l_component_code VARCHAR2(30);
180958 l_component_type_code VARCHAR2(1);
180959 l_component_appl_id INTEGER;
180960 l_amb_context_code VARCHAR2(30);
180961 l_entity_code VARCHAR2(30);
180962 l_event_class_code VARCHAR2(30);
180963 l_ae_header_id NUMBER;
180964 l_event_type_code VARCHAR2(30);
180965 l_line_definition_code VARCHAR2(30);
180966 l_line_definition_owner_code VARCHAR2(1);
180967 --
180968 -- adr variables
180969 l_segment VARCHAR2(30);
180970 l_ccid NUMBER;
180971 l_adr_transaction_coa_id NUMBER;
180972 l_adr_accounting_coa_id NUMBER;
180973 l_adr_flexfield_segment_code VARCHAR2(30);
180974 l_adr_flex_value_set_id NUMBER;
180975 l_adr_value_type_code VARCHAR2(30);
180976 l_adr_value_combination_id NUMBER;
180977 l_adr_value_segment_code VARCHAR2(30);
180978
180979 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
180980 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
180981 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
180982 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
180983
180984 -- 4262811 Variables ------------------------------------------------------------------------------------------
180985 l_entered_amt_idx NUMBER;
180986 l_accted_amt_idx NUMBER;
180987 l_acc_rev_flag VARCHAR2(1);
180988 l_accrual_line_num NUMBER;
180989 l_tmp_amt NUMBER;
180990 l_acc_rev_natural_side_code VARCHAR2(1);
180991
180992 l_num_entries NUMBER;
180996 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
180993 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
180994 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
180995 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
180997 l_recog_line_1 NUMBER;
180998 l_recog_line_2 NUMBER;
180999
181000 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
181001 l_bflow_applied_to_amt NUMBER; -- 5132302
181002 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
181003
181004 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
181005
181006 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
181007 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
181008
181009 ---------------------------------------------------------------------------------------------------------------
181010
181011
181012 --
181013 -- bulk performance
181014 --
181015 l_balance_type_code VARCHAR2(1);
181016 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
181017 l_log_module VARCHAR2(240);
181018
181019 --
181020 -- Upgrade strategy
181021 --
181022 l_actual_upg_option VARCHAR2(1);
181023 l_enc_upg_option VARCHAR2(1);
181024
181025 --
181026 BEGIN
181027 --
181028 IF g_log_enabled THEN
181029 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_420';
181030 END IF;
181031 --
181032 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
181033
181034 trace
181035 (p_msg => 'BEGIN of AcctLineType_420'
181036 ,p_level => C_LEVEL_PROCEDURE
181037 ,p_module => l_log_module);
181038
181039 END IF;
181040 --
181041 l_component_type := 'AMB_JLT';
181042 l_component_code := 'IAC_ASSET_COST';
181043 l_component_type_code := 'S';
181044 l_component_appl_id := 140;
181045 l_amb_context_code := 'DEFAULT';
181046 l_entity_code := 'TRANSACTIONS';
181047 l_event_class_code := 'CATEGORY_RECLASS';
181048 l_event_type_code := 'CATEGORY_RECLASS_ALL';
181049 l_line_definition_owner_code := 'S';
181050 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
181051 --
181052 l_balance_type_code := 'A';
181053 l_segment := NULL;
181054 l_ccid := NULL;
181055 l_adr_transaction_coa_id := NULL;
181056 l_adr_accounting_coa_id := NULL;
181057 l_adr_flexfield_segment_code := NULL;
181058 l_adr_flex_value_set_id := NULL;
181059 l_adr_value_type_code := NULL;
181060 l_adr_value_combination_id := NULL;
181061 l_adr_value_segment_code := NULL;
181062
181063 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
181064 l_bflow_class_code := ''; -- 4219869 Business Flow
181065 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
181066 l_budgetary_control_flag := 'N';
181067
181068 l_bflow_applied_to_amt_idx := NULL; -- 5132302
181069 l_bflow_applied_to_amt := NULL; -- 5132302
181070 l_entered_amt_idx := NULL; -- 4262811
181071 l_accted_amt_idx := NULL; -- 4262811
181072 l_acc_rev_flag := NULL; -- 4262811
181073 l_accrual_line_num := NULL; -- 4262811
181074 l_tmp_amt := NULL; -- 4262811
181075 --
181076
181077 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
181078 l_balance_type_code <> 'B' THEN
181079 IF NVL(p_source_64,'
181080 ') = 'COST'
181081 THEN
181082
181083 --
181084 XLA_AE_LINES_PKG.SetNewLine;
181085
181086 p_balance_type_code := l_balance_type_code;
181087 -- set the flag so later we will know whether the gain loss line needs to be created
181088
181089 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
181090 p_actual_flag :='A';
181091 END IF;
181092
181093 --
181094 -- bulk performance
181095 --
181096 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
181097 p_header_num => 0); -- 4262811
181098 --
181099 -- set accounting line options
181100 --
181101 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
181102 p_natural_side_code => 'D'
181103 , p_gain_or_loss_flag => 'N'
181104 , p_gl_transfer_mode_code => 'S'
181105 , p_acct_entry_type_code => 'A'
181106 , p_switch_side_flag => 'Y'
181107 , p_merge_duplicate_code => 'N'
181108 );
181109 --
181110 l_acc_rev_natural_side_code := 'C'; -- 4262811
181111 --
181112 --
181113 -- set accounting line type info
181114 --
181115 xla_ae_lines_pkg.SetAcctLineType
181116 (p_component_type => l_component_type
181117 ,p_event_type_code => l_event_type_code
181118 ,p_line_definition_owner_code => l_line_definition_owner_code
181119 ,p_line_definition_code => l_line_definition_code
181120 ,p_accounting_line_code => l_component_code
181121 ,p_accounting_line_type_code => l_component_type_code
181122 ,p_accounting_line_appl_id => l_component_appl_id
181123 ,p_amb_context_code => l_amb_context_code
181127 -- set accounting class
181124 ,p_entity_code => l_entity_code
181125 ,p_event_class_code => l_event_class_code);
181126 --
181128 --
181129 xla_ae_lines_pkg.SetAcctClass(
181130 p_accounting_class_code => 'ASSET'
181131 , p_ae_header_id => l_ae_header_id
181132 );
181133
181134 --
181135 -- set rounding class
181136 --
181137 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
181138 'ASSET';
181139
181140 --
181141 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
181142 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
181143 --
181144 -- bulk performance
181145 --
181146 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
181147
181148 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
181149 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
181150
181151 -- 4955764
181152 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
181153 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
181154
181155 -- 4458381 Public Sector Enh
181156
181157 --
181158 -- set accounting attributes for the line type
181159 --
181160 l_entered_amt_idx := 4;
181161 l_accted_amt_idx := 6;
181162 l_bflow_applied_to_amt_idx := NULL; -- 5132302
181163 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
181164 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
181165 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
181166 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
181167 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
181168 l_rec_acct_attrs.array_char_value(3) := p_source_51;
181169 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
181170 l_rec_acct_attrs.array_num_value(4) := p_source_65;
181171 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
181172 l_rec_acct_attrs.array_char_value(5) := p_source_66;
181173 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
181174 l_rec_acct_attrs.array_num_value(6) := p_source_65;
181175
181176 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
181177 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
181178
181179 ---------------------------------------------------------------------------------------------------------------
181180 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
181181 ---------------------------------------------------------------------------------------------------------------
181182 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
181183
181184 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
181185 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
181186
181187 IF xla_accounting_cache_pkg.GetValueChar
181188 (p_source_code => 'LEDGER_CATEGORY_CODE'
181189 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
181190 AND l_bflow_method_code = 'PRIOR_ENTRY'
181191 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
181192 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
181193 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
181194 )
181195 THEN
181196 xla_ae_lines_pkg.BflowUpgEntry
181197 (p_business_method_code => l_bflow_method_code
181198 ,p_business_class_code => l_bflow_class_code
181199 ,p_balance_type => l_balance_type_code);
181200 ELSE
181201 NULL;
181202 -- No business flow processing for business flow method of NONE.
181203 END IF;
181204
181205 --
181206 -- call analytical criteria
181207 --
181208
181209 --
181210 -- call description
181211 --
181212
181213 xla_ae_lines_pkg.SetLineDescription(
181214 p_ae_header_id => l_ae_header_id
181215 ,p_description => Description_143 (
181216 p_application_id => p_application_id
181217 , p_ae_header_id => l_ae_header_id
181218 , p_source_2 => p_source_2
181219 , p_source_3 => p_source_3
181220 )
181221 );
181222
181223
181224 --
181225 -- call ADRs
181226 -- Bug 4922099
181227 --
181228 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
181229 (NVL(l_actual_upg_option, 'N') = 'O') OR
181230 (NVL(l_enc_upg_option, 'N') = 'O')
181231 )
181232 THEN
181233 NULL;
181234 --
181235 --
181236
181237 l_ccid := AcctDerRule_182(
181238 p_application_id => p_application_id
181239 , p_ae_header_id => l_ae_header_id
181240 , p_source_37 => p_source_37
181241 , x_transaction_coa_id => l_adr_transaction_coa_id
181242 , x_accounting_coa_id => l_adr_accounting_coa_id
181243 , x_value_type_code => l_adr_value_type_code
181244 , p_side => 'NA'
181245 );
181249 , p_value_type_code => l_adr_value_type_code
181246
181247 xla_ae_lines_pkg.set_ccid(
181248 p_code_combination_id => l_ccid
181250 , p_transaction_coa_id => l_adr_transaction_coa_id
181251 , p_accounting_coa_id => l_adr_accounting_coa_id
181252 , p_adr_code => 'IAC_ASSET_COST_AC'
181253 , p_adr_type_code => 'S'
181254 , p_component_type => l_component_type
181255 , p_component_code => l_component_code
181256 , p_component_type_code => l_component_type_code
181257 , p_component_appl_id => l_component_appl_id
181258 , p_amb_context_code => l_amb_context_code
181259 , p_side => 'NA'
181260 );
181261
181262
181263 --
181264 --
181265 END IF;
181266 --
181267 -- Bug 4922099
181268 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
181269 (NVL(l_enc_upg_option, 'N') = 'O')
181270 ) AND
181271 (l_bflow_method_code = 'PRIOR_ENTRY')
181272 )
181273 THEN
181274 IF
181275 --
181276 1 = 2
181277 --
181278 THEN
181279 xla_accounting_err_pkg.build_message
181280 (p_appli_s_name => 'XLA'
181281 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
181282 ,p_token_1 => 'LINE_NUMBER'
181283 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
181284 ,p_token_2 => 'LINE_TYPE_NAME'
181285 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
181286 l_component_type
181287 ,l_component_code
181288 ,l_component_type_code
181289 ,l_component_appl_id
181290 ,l_amb_context_code
181291 ,l_entity_code
181292 ,l_event_class_code
181293 )
181294 ,p_token_3 => 'OWNER'
181295 ,p_value_3 => xla_lookups_pkg.get_meaning(
181296 p_lookup_type => 'XLA_OWNER_TYPE'
181297 ,p_lookup_code => l_component_type_code
181298 )
181299 ,p_token_4 => 'PRODUCT_NAME'
181300 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
181301 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
181302 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
181303 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
181304 ,p_ae_header_id => NULL
181305 );
181306
181307 IF (C_LEVEL_ERROR>= g_log_level) THEN
181308 trace
181309 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
181310 ,p_level => C_LEVEL_ERROR
181311 ,p_module => l_log_module);
181312 END IF;
181313 END IF;
181314 END IF;
181315 --
181316 --
181317 ------------------------------------------------------------------------------------------------
181318 -- 4219869 Business Flow
181319 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
181320 -- Prior Entry. Currently, the following code is always generated.
181321 ------------------------------------------------------------------------------------------------
181322 XLA_AE_LINES_PKG.ValidateCurrentLine;
181323
181324 ------------------------------------------------------------------------------------
181325 -- 4219869 Business Flow
181326 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
181327 ------------------------------------------------------------------------------------
181328 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
181329
181330 ----------------------------------------------------------------------------------
181331 -- 4219869 Business Flow
181332 -- Update journal entry status -- Need to generate this within IF <condition>
181333 ----------------------------------------------------------------------------------
181334 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
181335 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
181336 ,p_balance_type_code => l_balance_type_code
181337 );
181338
181339 -------------------------------------------------------------------------------------------
181340 -- 4262811 - Generate the Accrual Reversal lines
181341 -------------------------------------------------------------------------------------------
181342 BEGIN
181346 l_acc_rev_flag := 'N';
181343 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
181344 (g_array_event(p_event_id).array_value_num('header_index'));
181345 IF l_acc_rev_flag IS NULL THEN
181347 END IF;
181348 EXCEPTION
181349 WHEN OTHERS THEN
181350 l_acc_rev_flag := 'N';
181351 END;
181352 --
181353 IF (l_acc_rev_flag = 'Y') THEN
181354
181355 -- 4645092 ------------------------------------------------------------------------------
181356 -- To allow MPA report to determine if it should generate report process
181357 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
181358 ------------------------------------------------------------------------------------------
181359
181360 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
181361 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
181362 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
181363 -- call ADRs
181364 -- Bug 4922099
181365 --
181366 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
181367 (NVL(l_actual_upg_option, 'N') = 'O') OR
181368 (NVL(l_enc_upg_option, 'N') = 'O')
181369 )
181370 THEN
181371 NULL;
181372 --
181373 --
181374
181375 l_ccid := AcctDerRule_182(
181376 p_application_id => p_application_id
181377 , p_ae_header_id => l_ae_header_id
181378 , p_source_37 => p_source_37
181379 , x_transaction_coa_id => l_adr_transaction_coa_id
181380 , x_accounting_coa_id => l_adr_accounting_coa_id
181381 , x_value_type_code => l_adr_value_type_code
181382 , p_side => 'NA'
181383 );
181384
181385 xla_ae_lines_pkg.set_ccid(
181386 p_code_combination_id => l_ccid
181387 , p_value_type_code => l_adr_value_type_code
181388 , p_transaction_coa_id => l_adr_transaction_coa_id
181389 , p_accounting_coa_id => l_adr_accounting_coa_id
181390 , p_adr_code => 'IAC_ASSET_COST_AC'
181391 , p_adr_type_code => 'S'
181392 , p_component_type => l_component_type
181393 , p_component_code => l_component_code
181394 , p_component_type_code => l_component_type_code
181395 , p_component_appl_id => l_component_appl_id
181396 , p_amb_context_code => l_amb_context_code
181397 , p_side => 'NA'
181398 );
181399
181400
181401 --
181402 --
181403 END IF;
181404
181405 --
181406 -- Update the line information that should be overwritten
181407 --
181408 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
181409 p_header_num => 1);
181410 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
181411
181412 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
181413
181414 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
181415 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
181416 END IF;
181417
181418 --
181419 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
181420 --
181421 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
181422 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
181423 ELSE
181424 ---------------------------------------------------------------------------------------------------
181425 -- 4262811a Switch Sign
181426 ---------------------------------------------------------------------------------------------------
181427 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
181428 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
181429 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
181430 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
181431 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
181432 -- 5132302
181433 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
181434 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
181435
181436 END IF;
181437
181438 -- 4955764
181439 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
181440 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
181441
181442
181443 XLA_AE_LINES_PKG.ValidateCurrentLine;
181444 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
181445
181446 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
181447 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
181448 ,p_balance_type_code => l_balance_type_code);
181449
181450 END IF;
181451
181452 -----------------------------------------------------------------------------------------
181456
181453 -- 4262811 Multiperiod Accounting
181454 -----------------------------------------------------------------------------------------
181455 -- No MPA option is assigned.
181457
181458 END IF;
181459 END IF;
181460 --
181461
181462 --
181463 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
181464 trace
181465 (p_msg => 'END of AcctLineType_420'
181466 ,p_level => C_LEVEL_PROCEDURE
181467 ,p_module => l_log_module);
181468 END IF;
181469 --
181470 EXCEPTION
181471 WHEN xla_exceptions_pkg.application_exception THEN
181472 RAISE;
181473 WHEN OTHERS THEN
181474 xla_exceptions_pkg.raise_message
181475 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_420');
181476 END AcctLineType_420;
181477 --
181478
181479 ---------------------------------------
181480 --
181481 -- PRIVATE FUNCTION
181482 -- AcctLineType_421
181483 --
181484 ---------------------------------------
181485 PROCEDURE AcctLineType_421 (
181486 p_application_id IN NUMBER
181487 ,p_event_id IN NUMBER
181488 ,p_calculate_acctd_flag IN VARCHAR2
181489 ,p_calculate_g_l_flag IN VARCHAR2
181490 ,p_actual_flag IN OUT VARCHAR2
181491 ,p_balance_type_code OUT VARCHAR2
181492 ,p_gain_or_loss_ref OUT VARCHAR2
181493
181494 --Inflation Adjustment Type Description
181495 , p_source_2 IN VARCHAR2
181496 --Accounting Date
181497 , p_source_3 IN DATE
181498 --Inflation Asset Ccid
181499 , p_source_37 IN NUMBER
181500 --Distribution Type Code
181501 , p_source_51 IN VARCHAR2
181502 --Inflation Adjustment Type
181503 , p_source_64 IN VARCHAR2
181504 --Inflation Entered Amount
181505 , p_source_65 IN NUMBER
181506 --Inflation Currency Code
181507 , p_source_66 IN VARCHAR2
181508 --Inflation Adjustment Identifier
181509 , p_source_67 IN NUMBER
181510 --Inflation Asset Identifier
181511 , p_source_68 IN NUMBER
181512 --Inflation Asset Distribution Identifier
181513 , p_source_69 IN NUMBER
181514 --Inflation Adjustment Line Identifier
181515 , p_source_70 IN NUMBER
181516 )
181517 IS
181518
181519 l_component_type VARCHAR2(80);
181520 l_component_code VARCHAR2(30);
181521 l_component_type_code VARCHAR2(1);
181522 l_component_appl_id INTEGER;
181523 l_amb_context_code VARCHAR2(30);
181524 l_entity_code VARCHAR2(30);
181525 l_event_class_code VARCHAR2(30);
181526 l_ae_header_id NUMBER;
181527 l_event_type_code VARCHAR2(30);
181528 l_line_definition_code VARCHAR2(30);
181529 l_line_definition_owner_code VARCHAR2(1);
181530 --
181531 -- adr variables
181532 l_segment VARCHAR2(30);
181533 l_ccid NUMBER;
181534 l_adr_transaction_coa_id NUMBER;
181535 l_adr_accounting_coa_id NUMBER;
181536 l_adr_flexfield_segment_code VARCHAR2(30);
181537 l_adr_flex_value_set_id NUMBER;
181538 l_adr_value_type_code VARCHAR2(30);
181539 l_adr_value_combination_id NUMBER;
181540 l_adr_value_segment_code VARCHAR2(30);
181541
181542 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
181543 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
181544 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
181545 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
181546
181547 -- 4262811 Variables ------------------------------------------------------------------------------------------
181548 l_entered_amt_idx NUMBER;
181549 l_accted_amt_idx NUMBER;
181550 l_acc_rev_flag VARCHAR2(1);
181551 l_accrual_line_num NUMBER;
181552 l_tmp_amt NUMBER;
181553 l_acc_rev_natural_side_code VARCHAR2(1);
181554
181555 l_num_entries NUMBER;
181556 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
181557 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
181558 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
181559 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
181560 l_recog_line_1 NUMBER;
181561 l_recog_line_2 NUMBER;
181562
181563 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
181564 l_bflow_applied_to_amt NUMBER; -- 5132302
181565 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
181566
181567 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
181568
181569 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
181570 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
181571
181572 ---------------------------------------------------------------------------------------------------------------
181573
181574
181575 --
181576 -- bulk performance
181577 --
181578 l_balance_type_code VARCHAR2(1);
181579 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
181580 l_log_module VARCHAR2(240);
181581
181582 --
181583 -- Upgrade strategy
181584 --
181585 l_actual_upg_option VARCHAR2(1);
181586 l_enc_upg_option VARCHAR2(1);
181587
181588 --
181592 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_421';
181589 BEGIN
181590 --
181591 IF g_log_enabled THEN
181593 END IF;
181594 --
181595 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
181596
181597 trace
181598 (p_msg => 'BEGIN of AcctLineType_421'
181599 ,p_level => C_LEVEL_PROCEDURE
181600 ,p_module => l_log_module);
181601
181602 END IF;
181603 --
181604 l_component_type := 'AMB_JLT';
181605 l_component_code := 'IAC_ASSET_COST';
181606 l_component_type_code := 'S';
181607 l_component_appl_id := 140;
181608 l_amb_context_code := 'DEFAULT';
181609 l_entity_code := 'TRANSACTIONS';
181610 l_event_class_code := 'INFLATION_REVALUATION';
181611 l_event_type_code := 'INFLATION_REVALUATION_ALL';
181612 l_line_definition_owner_code := 'S';
181613 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
181614 --
181615 l_balance_type_code := 'A';
181616 l_segment := NULL;
181617 l_ccid := NULL;
181618 l_adr_transaction_coa_id := NULL;
181619 l_adr_accounting_coa_id := NULL;
181620 l_adr_flexfield_segment_code := NULL;
181621 l_adr_flex_value_set_id := NULL;
181622 l_adr_value_type_code := NULL;
181623 l_adr_value_combination_id := NULL;
181624 l_adr_value_segment_code := NULL;
181625
181626 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
181627 l_bflow_class_code := ''; -- 4219869 Business Flow
181628 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
181629 l_budgetary_control_flag := 'N';
181630
181631 l_bflow_applied_to_amt_idx := NULL; -- 5132302
181632 l_bflow_applied_to_amt := NULL; -- 5132302
181633 l_entered_amt_idx := NULL; -- 4262811
181634 l_accted_amt_idx := NULL; -- 4262811
181635 l_acc_rev_flag := NULL; -- 4262811
181636 l_accrual_line_num := NULL; -- 4262811
181637 l_tmp_amt := NULL; -- 4262811
181638 --
181639
181640 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
181641 l_balance_type_code <> 'B' THEN
181642 IF NVL(p_source_64,'
181643 ') = 'COST'
181644 THEN
181645
181646 --
181647 XLA_AE_LINES_PKG.SetNewLine;
181648
181649 p_balance_type_code := l_balance_type_code;
181650 -- set the flag so later we will know whether the gain loss line needs to be created
181651
181652 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
181653 p_actual_flag :='A';
181654 END IF;
181655
181656 --
181657 -- bulk performance
181658 --
181659 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
181660 p_header_num => 0); -- 4262811
181661 --
181662 -- set accounting line options
181663 --
181664 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
181665 p_natural_side_code => 'D'
181666 , p_gain_or_loss_flag => 'N'
181667 , p_gl_transfer_mode_code => 'S'
181668 , p_acct_entry_type_code => 'A'
181669 , p_switch_side_flag => 'Y'
181670 , p_merge_duplicate_code => 'N'
181671 );
181672 --
181673 l_acc_rev_natural_side_code := 'C'; -- 4262811
181674 --
181675 --
181676 -- set accounting line type info
181677 --
181678 xla_ae_lines_pkg.SetAcctLineType
181679 (p_component_type => l_component_type
181680 ,p_event_type_code => l_event_type_code
181681 ,p_line_definition_owner_code => l_line_definition_owner_code
181682 ,p_line_definition_code => l_line_definition_code
181683 ,p_accounting_line_code => l_component_code
181684 ,p_accounting_line_type_code => l_component_type_code
181685 ,p_accounting_line_appl_id => l_component_appl_id
181686 ,p_amb_context_code => l_amb_context_code
181687 ,p_entity_code => l_entity_code
181688 ,p_event_class_code => l_event_class_code);
181689 --
181690 -- set accounting class
181691 --
181692 xla_ae_lines_pkg.SetAcctClass(
181693 p_accounting_class_code => 'ASSET'
181694 , p_ae_header_id => l_ae_header_id
181695 );
181696
181697 --
181698 -- set rounding class
181699 --
181700 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
181701 'ASSET';
181702
181703 --
181704 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
181705 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
181706 --
181707 -- bulk performance
181708 --
181709 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
181710
181711 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
181712 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
181713
181714 -- 4955764
181715 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
181716 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
181717
181718 -- 4458381 Public Sector Enh
181719
181720 --
181724 l_accted_amt_idx := 8;
181721 -- set accounting attributes for the line type
181722 --
181723 l_entered_amt_idx := 6;
181725 l_bflow_applied_to_amt_idx := NULL; -- 5132302
181726 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
181727 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_67);
181728 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
181729 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_68);
181730 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
181731 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_69);
181732 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
181733 l_rec_acct_attrs.array_num_value(4) := to_char(p_source_70);
181734 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_TYPE';
181735 l_rec_acct_attrs.array_char_value(5) := p_source_51;
181736 l_rec_acct_attrs.array_acct_attr_code(6) := 'ENTERED_CURRENCY_AMOUNT';
181737 l_rec_acct_attrs.array_num_value(6) := p_source_65;
181738 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_CODE';
181739 l_rec_acct_attrs.array_char_value(7) := p_source_66;
181740 l_rec_acct_attrs.array_acct_attr_code(8) := 'LEDGER_AMOUNT';
181741 l_rec_acct_attrs.array_num_value(8) := p_source_65;
181742
181743 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
181744 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
181745
181746 ---------------------------------------------------------------------------------------------------------------
181747 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
181748 ---------------------------------------------------------------------------------------------------------------
181749 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
181750
181751 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
181752 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
181753
181754 IF xla_accounting_cache_pkg.GetValueChar
181755 (p_source_code => 'LEDGER_CATEGORY_CODE'
181756 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
181757 AND l_bflow_method_code = 'PRIOR_ENTRY'
181758 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
181759 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
181760 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
181761 )
181762 THEN
181763 xla_ae_lines_pkg.BflowUpgEntry
181764 (p_business_method_code => l_bflow_method_code
181765 ,p_business_class_code => l_bflow_class_code
181766 ,p_balance_type => l_balance_type_code);
181767 ELSE
181768 NULL;
181769 -- No business flow processing for business flow method of NONE.
181770 END IF;
181771
181772 --
181773 -- call analytical criteria
181774 --
181775
181776 --
181777 -- call description
181778 --
181779
181780 xla_ae_lines_pkg.SetLineDescription(
181781 p_ae_header_id => l_ae_header_id
181782 ,p_description => Description_143 (
181783 p_application_id => p_application_id
181784 , p_ae_header_id => l_ae_header_id
181785 , p_source_2 => p_source_2
181786 , p_source_3 => p_source_3
181787 )
181788 );
181789
181790
181791 --
181792 -- call ADRs
181793 -- Bug 4922099
181794 --
181795 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
181796 (NVL(l_actual_upg_option, 'N') = 'O') OR
181797 (NVL(l_enc_upg_option, 'N') = 'O')
181798 )
181799 THEN
181800 NULL;
181801 --
181802 --
181803
181804 l_ccid := AcctDerRule_182(
181805 p_application_id => p_application_id
181806 , p_ae_header_id => l_ae_header_id
181807 , p_source_37 => p_source_37
181808 , x_transaction_coa_id => l_adr_transaction_coa_id
181809 , x_accounting_coa_id => l_adr_accounting_coa_id
181810 , x_value_type_code => l_adr_value_type_code
181811 , p_side => 'NA'
181812 );
181813
181814 xla_ae_lines_pkg.set_ccid(
181815 p_code_combination_id => l_ccid
181816 , p_value_type_code => l_adr_value_type_code
181817 , p_transaction_coa_id => l_adr_transaction_coa_id
181818 , p_accounting_coa_id => l_adr_accounting_coa_id
181819 , p_adr_code => 'IAC_ASSET_COST_AC'
181820 , p_adr_type_code => 'S'
181821 , p_component_type => l_component_type
181822 , p_component_code => l_component_code
181823 , p_component_type_code => l_component_type_code
181824 , p_component_appl_id => l_component_appl_id
181825 , p_amb_context_code => l_amb_context_code
181826 , p_side => 'NA'
181827 );
181828
181829
181830 --
181831 --
181832 END IF;
181833 --
181834 -- Bug 4922099
181835 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
181836 (NVL(l_enc_upg_option, 'N') = 'O')
181837 ) AND
181838 (l_bflow_method_code = 'PRIOR_ENTRY')
181839 )
181840 THEN
181841 IF
181842 --
181846 xla_accounting_err_pkg.build_message
181843 1 = 2
181844 --
181845 THEN
181847 (p_appli_s_name => 'XLA'
181848 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
181849 ,p_token_1 => 'LINE_NUMBER'
181850 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
181851 ,p_token_2 => 'LINE_TYPE_NAME'
181852 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
181853 l_component_type
181854 ,l_component_code
181855 ,l_component_type_code
181856 ,l_component_appl_id
181857 ,l_amb_context_code
181858 ,l_entity_code
181859 ,l_event_class_code
181860 )
181861 ,p_token_3 => 'OWNER'
181862 ,p_value_3 => xla_lookups_pkg.get_meaning(
181863 p_lookup_type => 'XLA_OWNER_TYPE'
181864 ,p_lookup_code => l_component_type_code
181865 )
181866 ,p_token_4 => 'PRODUCT_NAME'
181867 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
181868 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
181869 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
181870 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
181871 ,p_ae_header_id => NULL
181872 );
181873
181874 IF (C_LEVEL_ERROR>= g_log_level) THEN
181875 trace
181876 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
181877 ,p_level => C_LEVEL_ERROR
181878 ,p_module => l_log_module);
181879 END IF;
181880 END IF;
181881 END IF;
181882 --
181883 --
181884 ------------------------------------------------------------------------------------------------
181885 -- 4219869 Business Flow
181886 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
181887 -- Prior Entry. Currently, the following code is always generated.
181888 ------------------------------------------------------------------------------------------------
181889 XLA_AE_LINES_PKG.ValidateCurrentLine;
181890
181891 ------------------------------------------------------------------------------------
181892 -- 4219869 Business Flow
181893 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
181894 ------------------------------------------------------------------------------------
181895 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
181896
181897 ----------------------------------------------------------------------------------
181898 -- 4219869 Business Flow
181899 -- Update journal entry status -- Need to generate this within IF <condition>
181900 ----------------------------------------------------------------------------------
181901 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
181902 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
181903 ,p_balance_type_code => l_balance_type_code
181904 );
181905
181906 -------------------------------------------------------------------------------------------
181907 -- 4262811 - Generate the Accrual Reversal lines
181908 -------------------------------------------------------------------------------------------
181909 BEGIN
181910 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
181911 (g_array_event(p_event_id).array_value_num('header_index'));
181912 IF l_acc_rev_flag IS NULL THEN
181913 l_acc_rev_flag := 'N';
181914 END IF;
181915 EXCEPTION
181916 WHEN OTHERS THEN
181917 l_acc_rev_flag := 'N';
181918 END;
181919 --
181920 IF (l_acc_rev_flag = 'Y') THEN
181921
181922 -- 4645092 ------------------------------------------------------------------------------
181923 -- To allow MPA report to determine if it should generate report process
181924 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
181925 ------------------------------------------------------------------------------------------
181926
181927 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
181928 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
181929 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
181930 -- call ADRs
181931 -- Bug 4922099
181932 --
181933 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
181937 THEN
181934 (NVL(l_actual_upg_option, 'N') = 'O') OR
181935 (NVL(l_enc_upg_option, 'N') = 'O')
181936 )
181938 NULL;
181939 --
181940 --
181941
181942 l_ccid := AcctDerRule_182(
181943 p_application_id => p_application_id
181944 , p_ae_header_id => l_ae_header_id
181945 , p_source_37 => p_source_37
181946 , x_transaction_coa_id => l_adr_transaction_coa_id
181947 , x_accounting_coa_id => l_adr_accounting_coa_id
181948 , x_value_type_code => l_adr_value_type_code
181949 , p_side => 'NA'
181950 );
181951
181952 xla_ae_lines_pkg.set_ccid(
181953 p_code_combination_id => l_ccid
181954 , p_value_type_code => l_adr_value_type_code
181955 , p_transaction_coa_id => l_adr_transaction_coa_id
181956 , p_accounting_coa_id => l_adr_accounting_coa_id
181957 , p_adr_code => 'IAC_ASSET_COST_AC'
181958 , p_adr_type_code => 'S'
181959 , p_component_type => l_component_type
181960 , p_component_code => l_component_code
181961 , p_component_type_code => l_component_type_code
181962 , p_component_appl_id => l_component_appl_id
181963 , p_amb_context_code => l_amb_context_code
181964 , p_side => 'NA'
181965 );
181966
181967
181968 --
181969 --
181970 END IF;
181971
181972 --
181973 -- Update the line information that should be overwritten
181974 --
181975 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
181976 p_header_num => 1);
181977 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
181978
181979 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
181980
181981 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
181982 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
181983 END IF;
181984
181985 --
181986 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
181987 --
181988 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
181989 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
181990 ELSE
181991 ---------------------------------------------------------------------------------------------------
181992 -- 4262811a Switch Sign
181993 ---------------------------------------------------------------------------------------------------
181994 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
181995 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
181996 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
181997 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
181998 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
181999 -- 5132302
182000 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
182001 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
182002
182003 END IF;
182004
182005 -- 4955764
182006 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
182007 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
182008
182009
182010 XLA_AE_LINES_PKG.ValidateCurrentLine;
182011 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
182012
182013 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
182014 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
182015 ,p_balance_type_code => l_balance_type_code);
182016
182017 END IF;
182018
182019 -----------------------------------------------------------------------------------------
182020 -- 4262811 Multiperiod Accounting
182021 -----------------------------------------------------------------------------------------
182022 -- No MPA option is assigned.
182023
182024
182025 END IF;
182026 END IF;
182027 --
182028
182029 --
182030 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
182031 trace
182032 (p_msg => 'END of AcctLineType_421'
182033 ,p_level => C_LEVEL_PROCEDURE
182034 ,p_module => l_log_module);
182035 END IF;
182036 --
182037 EXCEPTION
182038 WHEN xla_exceptions_pkg.application_exception THEN
182039 RAISE;
182040 WHEN OTHERS THEN
182041 xla_exceptions_pkg.raise_message
182042 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_421');
182043 END AcctLineType_421;
182044 --
182045
182046 ---------------------------------------
182047 --
182048 -- PRIVATE FUNCTION
182049 -- AcctLineType_422
182050 --
182051 ---------------------------------------
182052 PROCEDURE AcctLineType_422 (
182053 p_application_id IN NUMBER
182054 ,p_event_id IN NUMBER
182058 ,p_balance_type_code OUT VARCHAR2
182055 ,p_calculate_acctd_flag IN VARCHAR2
182056 ,p_calculate_g_l_flag IN VARCHAR2
182057 ,p_actual_flag IN OUT VARCHAR2
182059 ,p_gain_or_loss_ref OUT VARCHAR2
182060
182061 --Inflation Adjustment Type Description
182062 , p_source_2 IN VARCHAR2
182063 --Accounting Date
182064 , p_source_3 IN DATE
182065 --Inflation Asset Ccid
182066 , p_source_37 IN NUMBER
182067 --Transaction Header Identifier
182068 , p_source_49 IN NUMBER
182069 --Adjustment Line Identifier
182070 , p_source_50 IN NUMBER
182071 --Distribution Type Code
182072 , p_source_51 IN VARCHAR2
182073 --Inflation Adjustment Type
182074 , p_source_64 IN VARCHAR2
182075 --Inflation Entered Amount
182076 , p_source_65 IN NUMBER
182077 --Inflation Currency Code
182078 , p_source_66 IN VARCHAR2
182079 )
182080 IS
182081
182082 l_component_type VARCHAR2(80);
182083 l_component_code VARCHAR2(30);
182084 l_component_type_code VARCHAR2(1);
182085 l_component_appl_id INTEGER;
182086 l_amb_context_code VARCHAR2(30);
182087 l_entity_code VARCHAR2(30);
182088 l_event_class_code VARCHAR2(30);
182089 l_ae_header_id NUMBER;
182090 l_event_type_code VARCHAR2(30);
182091 l_line_definition_code VARCHAR2(30);
182092 l_line_definition_owner_code VARCHAR2(1);
182093 --
182094 -- adr variables
182095 l_segment VARCHAR2(30);
182096 l_ccid NUMBER;
182097 l_adr_transaction_coa_id NUMBER;
182098 l_adr_accounting_coa_id NUMBER;
182099 l_adr_flexfield_segment_code VARCHAR2(30);
182100 l_adr_flex_value_set_id NUMBER;
182101 l_adr_value_type_code VARCHAR2(30);
182102 l_adr_value_combination_id NUMBER;
182103 l_adr_value_segment_code VARCHAR2(30);
182104
182105 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
182106 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
182107 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
182108 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
182109
182110 -- 4262811 Variables ------------------------------------------------------------------------------------------
182111 l_entered_amt_idx NUMBER;
182112 l_accted_amt_idx NUMBER;
182113 l_acc_rev_flag VARCHAR2(1);
182114 l_accrual_line_num NUMBER;
182115 l_tmp_amt NUMBER;
182116 l_acc_rev_natural_side_code VARCHAR2(1);
182117
182118 l_num_entries NUMBER;
182119 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
182120 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
182121 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
182122 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
182123 l_recog_line_1 NUMBER;
182124 l_recog_line_2 NUMBER;
182125
182126 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
182127 l_bflow_applied_to_amt NUMBER; -- 5132302
182128 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
182129
182130 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
182131
182132 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
182133 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
182134
182135 ---------------------------------------------------------------------------------------------------------------
182136
182137
182138 --
182139 -- bulk performance
182140 --
182141 l_balance_type_code VARCHAR2(1);
182142 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
182143 l_log_module VARCHAR2(240);
182144
182145 --
182146 -- Upgrade strategy
182147 --
182148 l_actual_upg_option VARCHAR2(1);
182149 l_enc_upg_option VARCHAR2(1);
182150
182151 --
182152 BEGIN
182153 --
182154 IF g_log_enabled THEN
182155 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_422';
182156 END IF;
182157 --
182158 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
182159
182160 trace
182161 (p_msg => 'BEGIN of AcctLineType_422'
182162 ,p_level => C_LEVEL_PROCEDURE
182163 ,p_module => l_log_module);
182164
182165 END IF;
182166 --
182167 l_component_type := 'AMB_JLT';
182168 l_component_code := 'IAC_ASSET_COST';
182169 l_component_type_code := 'S';
182170 l_component_appl_id := 140;
182171 l_amb_context_code := 'DEFAULT';
182172 l_entity_code := 'TRANSACTIONS';
182173 l_event_class_code := 'ADDITIONS';
182174 l_event_type_code := 'ADDITIONS_ALL';
182175 l_line_definition_owner_code := 'S';
182176 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
182177 --
182178 l_balance_type_code := 'A';
182179 l_segment := NULL;
182180 l_ccid := NULL;
182181 l_adr_transaction_coa_id := NULL;
182182 l_adr_accounting_coa_id := NULL;
182183 l_adr_flexfield_segment_code := NULL;
182184 l_adr_flex_value_set_id := NULL;
182185 l_adr_value_type_code := NULL;
182186 l_adr_value_combination_id := NULL;
182190 l_bflow_class_code := ''; -- 4219869 Business Flow
182187 l_adr_value_segment_code := NULL;
182188
182189 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
182191 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
182192 l_budgetary_control_flag := 'N';
182193
182194 l_bflow_applied_to_amt_idx := NULL; -- 5132302
182195 l_bflow_applied_to_amt := NULL; -- 5132302
182196 l_entered_amt_idx := NULL; -- 4262811
182197 l_accted_amt_idx := NULL; -- 4262811
182198 l_acc_rev_flag := NULL; -- 4262811
182199 l_accrual_line_num := NULL; -- 4262811
182200 l_tmp_amt := NULL; -- 4262811
182201 --
182202
182203 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
182204 l_balance_type_code <> 'B' THEN
182205 IF NVL(p_source_64,'
182206 ') = 'COST'
182207 THEN
182208
182209 --
182210 XLA_AE_LINES_PKG.SetNewLine;
182211
182212 p_balance_type_code := l_balance_type_code;
182213 -- set the flag so later we will know whether the gain loss line needs to be created
182214
182215 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
182216 p_actual_flag :='A';
182217 END IF;
182218
182219 --
182220 -- bulk performance
182221 --
182222 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
182223 p_header_num => 0); -- 4262811
182224 --
182225 -- set accounting line options
182226 --
182227 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
182228 p_natural_side_code => 'D'
182229 , p_gain_or_loss_flag => 'N'
182230 , p_gl_transfer_mode_code => 'S'
182231 , p_acct_entry_type_code => 'A'
182232 , p_switch_side_flag => 'Y'
182233 , p_merge_duplicate_code => 'N'
182234 );
182235 --
182236 l_acc_rev_natural_side_code := 'C'; -- 4262811
182237 --
182238 --
182239 -- set accounting line type info
182240 --
182241 xla_ae_lines_pkg.SetAcctLineType
182242 (p_component_type => l_component_type
182243 ,p_event_type_code => l_event_type_code
182244 ,p_line_definition_owner_code => l_line_definition_owner_code
182245 ,p_line_definition_code => l_line_definition_code
182246 ,p_accounting_line_code => l_component_code
182247 ,p_accounting_line_type_code => l_component_type_code
182248 ,p_accounting_line_appl_id => l_component_appl_id
182249 ,p_amb_context_code => l_amb_context_code
182250 ,p_entity_code => l_entity_code
182251 ,p_event_class_code => l_event_class_code);
182252 --
182253 -- set accounting class
182254 --
182255 xla_ae_lines_pkg.SetAcctClass(
182256 p_accounting_class_code => 'ASSET'
182257 , p_ae_header_id => l_ae_header_id
182258 );
182259
182260 --
182261 -- set rounding class
182262 --
182263 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
182264 'ASSET';
182265
182266 --
182267 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
182268 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
182269 --
182270 -- bulk performance
182271 --
182272 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
182273
182274 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
182275 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
182276
182277 -- 4955764
182278 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
182279 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
182280
182281 -- 4458381 Public Sector Enh
182282
182283 --
182284 -- set accounting attributes for the line type
182285 --
182286 l_entered_amt_idx := 4;
182287 l_accted_amt_idx := 6;
182288 l_bflow_applied_to_amt_idx := NULL; -- 5132302
182289 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
182290 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
182291 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
182292 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
182293 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
182294 l_rec_acct_attrs.array_char_value(3) := p_source_51;
182295 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
182296 l_rec_acct_attrs.array_num_value(4) := p_source_65;
182297 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
182298 l_rec_acct_attrs.array_char_value(5) := p_source_66;
182299 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
182300 l_rec_acct_attrs.array_num_value(6) := p_source_65;
182301
182302 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
182303 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
182304
182305 ---------------------------------------------------------------------------------------------------------------
182306 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
182310 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
182307 ---------------------------------------------------------------------------------------------------------------
182308 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
182309
182311 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
182312
182313 IF xla_accounting_cache_pkg.GetValueChar
182314 (p_source_code => 'LEDGER_CATEGORY_CODE'
182315 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
182316 AND l_bflow_method_code = 'PRIOR_ENTRY'
182317 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
182318 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
182319 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
182320 )
182321 THEN
182322 xla_ae_lines_pkg.BflowUpgEntry
182323 (p_business_method_code => l_bflow_method_code
182324 ,p_business_class_code => l_bflow_class_code
182325 ,p_balance_type => l_balance_type_code);
182326 ELSE
182327 NULL;
182328 -- No business flow processing for business flow method of NONE.
182329 END IF;
182330
182331 --
182332 -- call analytical criteria
182333 --
182334
182335 --
182336 -- call description
182337 --
182338
182339 xla_ae_lines_pkg.SetLineDescription(
182340 p_ae_header_id => l_ae_header_id
182341 ,p_description => Description_143 (
182342 p_application_id => p_application_id
182343 , p_ae_header_id => l_ae_header_id
182344 , p_source_2 => p_source_2
182345 , p_source_3 => p_source_3
182346 )
182347 );
182348
182349
182350 --
182351 -- call ADRs
182352 -- Bug 4922099
182353 --
182354 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
182355 (NVL(l_actual_upg_option, 'N') = 'O') OR
182356 (NVL(l_enc_upg_option, 'N') = 'O')
182357 )
182358 THEN
182359 NULL;
182360 --
182361 --
182362
182363 l_ccid := AcctDerRule_182(
182364 p_application_id => p_application_id
182365 , p_ae_header_id => l_ae_header_id
182366 , p_source_37 => p_source_37
182367 , x_transaction_coa_id => l_adr_transaction_coa_id
182368 , x_accounting_coa_id => l_adr_accounting_coa_id
182369 , x_value_type_code => l_adr_value_type_code
182370 , p_side => 'NA'
182371 );
182372
182373 xla_ae_lines_pkg.set_ccid(
182374 p_code_combination_id => l_ccid
182375 , p_value_type_code => l_adr_value_type_code
182376 , p_transaction_coa_id => l_adr_transaction_coa_id
182377 , p_accounting_coa_id => l_adr_accounting_coa_id
182378 , p_adr_code => 'IAC_ASSET_COST_AC'
182379 , p_adr_type_code => 'S'
182380 , p_component_type => l_component_type
182381 , p_component_code => l_component_code
182382 , p_component_type_code => l_component_type_code
182383 , p_component_appl_id => l_component_appl_id
182384 , p_amb_context_code => l_amb_context_code
182385 , p_side => 'NA'
182386 );
182387
182388
182389 --
182390 --
182391 END IF;
182392 --
182393 -- Bug 4922099
182394 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
182395 (NVL(l_enc_upg_option, 'N') = 'O')
182396 ) AND
182397 (l_bflow_method_code = 'PRIOR_ENTRY')
182398 )
182399 THEN
182400 IF
182401 --
182402 1 = 2
182403 --
182404 THEN
182405 xla_accounting_err_pkg.build_message
182406 (p_appli_s_name => 'XLA'
182407 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
182408 ,p_token_1 => 'LINE_NUMBER'
182409 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
182410 ,p_token_2 => 'LINE_TYPE_NAME'
182411 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
182412 l_component_type
182413 ,l_component_code
182414 ,l_component_type_code
182415 ,l_component_appl_id
182416 ,l_amb_context_code
182417 ,l_entity_code
182418 ,l_event_class_code
182419 )
182420 ,p_token_3 => 'OWNER'
182421 ,p_value_3 => xla_lookups_pkg.get_meaning(
182422 p_lookup_type => 'XLA_OWNER_TYPE'
182426 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
182423 ,p_lookup_code => l_component_type_code
182424 )
182425 ,p_token_4 => 'PRODUCT_NAME'
182427 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
182428 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
182429 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
182430 ,p_ae_header_id => NULL
182431 );
182432
182433 IF (C_LEVEL_ERROR>= g_log_level) THEN
182434 trace
182435 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
182436 ,p_level => C_LEVEL_ERROR
182437 ,p_module => l_log_module);
182438 END IF;
182439 END IF;
182440 END IF;
182441 --
182442 --
182443 ------------------------------------------------------------------------------------------------
182444 -- 4219869 Business Flow
182445 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
182446 -- Prior Entry. Currently, the following code is always generated.
182447 ------------------------------------------------------------------------------------------------
182448 XLA_AE_LINES_PKG.ValidateCurrentLine;
182449
182450 ------------------------------------------------------------------------------------
182451 -- 4219869 Business Flow
182452 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
182453 ------------------------------------------------------------------------------------
182454 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
182455
182456 ----------------------------------------------------------------------------------
182457 -- 4219869 Business Flow
182458 -- Update journal entry status -- Need to generate this within IF <condition>
182459 ----------------------------------------------------------------------------------
182460 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
182461 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
182462 ,p_balance_type_code => l_balance_type_code
182463 );
182464
182465 -------------------------------------------------------------------------------------------
182466 -- 4262811 - Generate the Accrual Reversal lines
182467 -------------------------------------------------------------------------------------------
182468 BEGIN
182469 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
182470 (g_array_event(p_event_id).array_value_num('header_index'));
182471 IF l_acc_rev_flag IS NULL THEN
182472 l_acc_rev_flag := 'N';
182473 END IF;
182474 EXCEPTION
182475 WHEN OTHERS THEN
182476 l_acc_rev_flag := 'N';
182477 END;
182478 --
182479 IF (l_acc_rev_flag = 'Y') THEN
182480
182481 -- 4645092 ------------------------------------------------------------------------------
182482 -- To allow MPA report to determine if it should generate report process
182483 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
182484 ------------------------------------------------------------------------------------------
182485
182486 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
182487 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
182488 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
182489 -- call ADRs
182490 -- Bug 4922099
182491 --
182492 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
182493 (NVL(l_actual_upg_option, 'N') = 'O') OR
182494 (NVL(l_enc_upg_option, 'N') = 'O')
182495 )
182496 THEN
182497 NULL;
182498 --
182499 --
182500
182501 l_ccid := AcctDerRule_182(
182502 p_application_id => p_application_id
182503 , p_ae_header_id => l_ae_header_id
182504 , p_source_37 => p_source_37
182505 , x_transaction_coa_id => l_adr_transaction_coa_id
182506 , x_accounting_coa_id => l_adr_accounting_coa_id
182507 , x_value_type_code => l_adr_value_type_code
182508 , p_side => 'NA'
182509 );
182510
182511 xla_ae_lines_pkg.set_ccid(
182512 p_code_combination_id => l_ccid
182513 , p_value_type_code => l_adr_value_type_code
182514 , p_transaction_coa_id => l_adr_transaction_coa_id
182515 , p_accounting_coa_id => l_adr_accounting_coa_id
182516 , p_adr_code => 'IAC_ASSET_COST_AC'
182517 , p_adr_type_code => 'S'
182518 , p_component_type => l_component_type
182519 , p_component_code => l_component_code
182520 , p_component_type_code => l_component_type_code
182521 , p_component_appl_id => l_component_appl_id
182522 , p_amb_context_code => l_amb_context_code
182523 , p_side => 'NA'
182524 );
182525
182526
182527 --
182528 --
182529 END IF;
182530
182531 --
182535 p_header_num => 1);
182532 -- Update the line information that should be overwritten
182533 --
182534 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
182536 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
182537
182538 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
182539
182540 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
182541 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
182542 END IF;
182543
182544 --
182545 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
182546 --
182547 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
182548 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
182549 ELSE
182550 ---------------------------------------------------------------------------------------------------
182551 -- 4262811a Switch Sign
182552 ---------------------------------------------------------------------------------------------------
182553 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
182554 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
182555 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
182556 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
182557 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
182558 -- 5132302
182559 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
182560 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
182561
182562 END IF;
182563
182564 -- 4955764
182565 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
182566 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
182567
182568
182569 XLA_AE_LINES_PKG.ValidateCurrentLine;
182570 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
182571
182572 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
182573 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
182574 ,p_balance_type_code => l_balance_type_code);
182575
182576 END IF;
182577
182578 -----------------------------------------------------------------------------------------
182579 -- 4262811 Multiperiod Accounting
182580 -----------------------------------------------------------------------------------------
182581 -- No MPA option is assigned.
182582
182583
182584 END IF;
182585 END IF;
182586 --
182587
182588 --
182589 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
182590 trace
182591 (p_msg => 'END of AcctLineType_422'
182592 ,p_level => C_LEVEL_PROCEDURE
182593 ,p_module => l_log_module);
182594 END IF;
182595 --
182596 EXCEPTION
182597 WHEN xla_exceptions_pkg.application_exception THEN
182598 RAISE;
182599 WHEN OTHERS THEN
182600 xla_exceptions_pkg.raise_message
182601 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_422');
182602 END AcctLineType_422;
182603 --
182604
182605 ---------------------------------------
182606 --
182607 -- PRIVATE FUNCTION
182608 -- AcctLineType_423
182609 --
182610 ---------------------------------------
182611 PROCEDURE AcctLineType_423 (
182612 p_application_id IN NUMBER
182613 ,p_event_id IN NUMBER
182614 ,p_calculate_acctd_flag IN VARCHAR2
182615 ,p_calculate_g_l_flag IN VARCHAR2
182616 ,p_actual_flag IN OUT VARCHAR2
182617 ,p_balance_type_code OUT VARCHAR2
182618 ,p_gain_or_loss_ref OUT VARCHAR2
182619
182620 --Inflation Adjustment Type Description
182621 , p_source_2 IN VARCHAR2
182622 --Accounting Date
182623 , p_source_3 IN DATE
182624 --Inflation Asset Ccid
182625 , p_source_37 IN NUMBER
182626 --Distribution Type Code
182627 , p_source_51 IN VARCHAR2
182628 --Asset Identifier
182629 , p_source_56 IN NUMBER
182630 --Period Counter
182631 , p_source_57 IN NUMBER
182632 --Distribution Identifier
182633 , p_source_58 IN NUMBER
182634 --Book Type Code
182635 , p_source_59 IN VARCHAR2
182636 --Depreciation Run Identifier
182637 , p_source_62 IN NUMBER
182638 --Inflation Adjustment Type
182639 , p_source_64 IN VARCHAR2
182640 --Inflation Entered Amount
182641 , p_source_65 IN NUMBER
182642 --Inflation Currency Code
182643 , p_source_66 IN VARCHAR2
182644 )
182645 IS
182646
182647 l_component_type VARCHAR2(80);
182648 l_component_code VARCHAR2(30);
182649 l_component_type_code VARCHAR2(1);
182650 l_component_appl_id INTEGER;
182651 l_amb_context_code VARCHAR2(30);
182652 l_entity_code VARCHAR2(30);
182653 l_event_class_code VARCHAR2(30);
182657 l_line_definition_owner_code VARCHAR2(1);
182654 l_ae_header_id NUMBER;
182655 l_event_type_code VARCHAR2(30);
182656 l_line_definition_code VARCHAR2(30);
182658 --
182659 -- adr variables
182660 l_segment VARCHAR2(30);
182661 l_ccid NUMBER;
182662 l_adr_transaction_coa_id NUMBER;
182663 l_adr_accounting_coa_id NUMBER;
182664 l_adr_flexfield_segment_code VARCHAR2(30);
182665 l_adr_flex_value_set_id NUMBER;
182666 l_adr_value_type_code VARCHAR2(30);
182667 l_adr_value_combination_id NUMBER;
182668 l_adr_value_segment_code VARCHAR2(30);
182669
182670 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
182671 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
182672 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
182673 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
182674
182675 -- 4262811 Variables ------------------------------------------------------------------------------------------
182676 l_entered_amt_idx NUMBER;
182677 l_accted_amt_idx NUMBER;
182678 l_acc_rev_flag VARCHAR2(1);
182679 l_accrual_line_num NUMBER;
182680 l_tmp_amt NUMBER;
182681 l_acc_rev_natural_side_code VARCHAR2(1);
182682
182683 l_num_entries NUMBER;
182684 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
182685 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
182686 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
182687 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
182688 l_recog_line_1 NUMBER;
182689 l_recog_line_2 NUMBER;
182690
182691 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
182692 l_bflow_applied_to_amt NUMBER; -- 5132302
182693 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
182694
182695 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
182696
182697 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
182698 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
182699
182700 ---------------------------------------------------------------------------------------------------------------
182701
182702
182703 --
182704 -- bulk performance
182705 --
182706 l_balance_type_code VARCHAR2(1);
182707 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
182708 l_log_module VARCHAR2(240);
182709
182710 --
182711 -- Upgrade strategy
182712 --
182713 l_actual_upg_option VARCHAR2(1);
182714 l_enc_upg_option VARCHAR2(1);
182715
182716 --
182717 BEGIN
182718 --
182719 IF g_log_enabled THEN
182720 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_423';
182721 END IF;
182722 --
182723 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
182724
182725 trace
182726 (p_msg => 'BEGIN of AcctLineType_423'
182727 ,p_level => C_LEVEL_PROCEDURE
182728 ,p_module => l_log_module);
182729
182730 END IF;
182731 --
182732 l_component_type := 'AMB_JLT';
182733 l_component_code := 'IAC_ASSET_COST';
182734 l_component_type_code := 'S';
182735 l_component_appl_id := 140;
182736 l_amb_context_code := 'DEFAULT';
182737 l_entity_code := 'DEPRECIATION';
182738 l_event_class_code := 'DEPRECIATION';
182739 l_event_type_code := 'DEPRECIATION_ALL';
182740 l_line_definition_owner_code := 'S';
182741 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
182742 --
182743 l_balance_type_code := 'A';
182744 l_segment := NULL;
182745 l_ccid := NULL;
182746 l_adr_transaction_coa_id := NULL;
182747 l_adr_accounting_coa_id := NULL;
182748 l_adr_flexfield_segment_code := NULL;
182749 l_adr_flex_value_set_id := NULL;
182750 l_adr_value_type_code := NULL;
182751 l_adr_value_combination_id := NULL;
182752 l_adr_value_segment_code := NULL;
182753
182754 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
182755 l_bflow_class_code := ''; -- 4219869 Business Flow
182756 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
182757 l_budgetary_control_flag := 'N';
182758
182759 l_bflow_applied_to_amt_idx := NULL; -- 5132302
182760 l_bflow_applied_to_amt := NULL; -- 5132302
182761 l_entered_amt_idx := NULL; -- 4262811
182762 l_accted_amt_idx := NULL; -- 4262811
182763 l_acc_rev_flag := NULL; -- 4262811
182764 l_accrual_line_num := NULL; -- 4262811
182765 l_tmp_amt := NULL; -- 4262811
182766 --
182767
182768 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
182769 l_balance_type_code <> 'B' THEN
182770 IF NVL(p_source_64,'
182771 ') = 'COST'
182772 THEN
182773
182774 --
182775 XLA_AE_LINES_PKG.SetNewLine;
182776
182777 p_balance_type_code := l_balance_type_code;
182778 -- set the flag so later we will know whether the gain loss line needs to be created
182779
182780 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
182781 p_actual_flag :='A';
182782 END IF;
182786 --
182783
182784 --
182785 -- bulk performance
182787 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
182788 p_header_num => 0); -- 4262811
182789 --
182790 -- set accounting line options
182791 --
182792 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
182793 p_natural_side_code => 'D'
182794 , p_gain_or_loss_flag => 'N'
182795 , p_gl_transfer_mode_code => 'S'
182796 , p_acct_entry_type_code => 'A'
182797 , p_switch_side_flag => 'Y'
182798 , p_merge_duplicate_code => 'N'
182799 );
182800 --
182801 l_acc_rev_natural_side_code := 'C'; -- 4262811
182802 --
182803 --
182804 -- set accounting line type info
182805 --
182806 xla_ae_lines_pkg.SetAcctLineType
182807 (p_component_type => l_component_type
182808 ,p_event_type_code => l_event_type_code
182809 ,p_line_definition_owner_code => l_line_definition_owner_code
182810 ,p_line_definition_code => l_line_definition_code
182811 ,p_accounting_line_code => l_component_code
182812 ,p_accounting_line_type_code => l_component_type_code
182813 ,p_accounting_line_appl_id => l_component_appl_id
182814 ,p_amb_context_code => l_amb_context_code
182815 ,p_entity_code => l_entity_code
182816 ,p_event_class_code => l_event_class_code);
182817 --
182818 -- set accounting class
182819 --
182820 xla_ae_lines_pkg.SetAcctClass(
182821 p_accounting_class_code => 'ASSET'
182822 , p_ae_header_id => l_ae_header_id
182823 );
182824
182825 --
182826 -- set rounding class
182827 --
182828 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
182829 'ASSET';
182830
182831 --
182832 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
182833 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
182834 --
182835 -- bulk performance
182836 --
182837 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
182838
182839 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
182840 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
182841
182842 -- 4955764
182843 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
182844 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
182845
182846 -- 4458381 Public Sector Enh
182847
182848 --
182849 -- set accounting attributes for the line type
182850 --
182851 l_entered_amt_idx := 7;
182852 l_accted_amt_idx := 9;
182853 l_bflow_applied_to_amt_idx := NULL; -- 5132302
182854 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
182855 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
182856 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
182857 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
182858 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
182859 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
182860 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
182861 l_rec_acct_attrs.array_char_value(4) := p_source_59;
182862 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
182863 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
182864 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
182865 l_rec_acct_attrs.array_char_value(6) := p_source_51;
182866 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
182867 l_rec_acct_attrs.array_num_value(7) := p_source_65;
182868 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
182869 l_rec_acct_attrs.array_char_value(8) := p_source_66;
182870 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
182871 l_rec_acct_attrs.array_num_value(9) := p_source_65;
182872
182873 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
182874 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
182875
182876 ---------------------------------------------------------------------------------------------------------------
182877 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
182878 ---------------------------------------------------------------------------------------------------------------
182879 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
182880
182881 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
182882 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
182883
182884 IF xla_accounting_cache_pkg.GetValueChar
182885 (p_source_code => 'LEDGER_CATEGORY_CODE'
182886 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
182887 AND l_bflow_method_code = 'PRIOR_ENTRY'
182888 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
182889 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
182890 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
182891 )
182892 THEN
182896 ,p_balance_type => l_balance_type_code);
182893 xla_ae_lines_pkg.BflowUpgEntry
182894 (p_business_method_code => l_bflow_method_code
182895 ,p_business_class_code => l_bflow_class_code
182897 ELSE
182898 NULL;
182899 -- No business flow processing for business flow method of NONE.
182900 END IF;
182901
182902 --
182903 -- call analytical criteria
182904 --
182905
182906 --
182907 -- call description
182908 --
182909
182910 xla_ae_lines_pkg.SetLineDescription(
182911 p_ae_header_id => l_ae_header_id
182912 ,p_description => Description_143 (
182913 p_application_id => p_application_id
182914 , p_ae_header_id => l_ae_header_id
182915 , p_source_2 => p_source_2
182916 , p_source_3 => p_source_3
182917 )
182918 );
182919
182920
182921 --
182922 -- call ADRs
182923 -- Bug 4922099
182924 --
182925 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
182926 (NVL(l_actual_upg_option, 'N') = 'O') OR
182927 (NVL(l_enc_upg_option, 'N') = 'O')
182928 )
182929 THEN
182930 NULL;
182931 --
182932 --
182933
182934 l_ccid := AcctDerRule_182(
182935 p_application_id => p_application_id
182936 , p_ae_header_id => l_ae_header_id
182937 , p_source_37 => p_source_37
182938 , x_transaction_coa_id => l_adr_transaction_coa_id
182939 , x_accounting_coa_id => l_adr_accounting_coa_id
182940 , x_value_type_code => l_adr_value_type_code
182941 , p_side => 'NA'
182942 );
182943
182944 xla_ae_lines_pkg.set_ccid(
182945 p_code_combination_id => l_ccid
182946 , p_value_type_code => l_adr_value_type_code
182947 , p_transaction_coa_id => l_adr_transaction_coa_id
182948 , p_accounting_coa_id => l_adr_accounting_coa_id
182949 , p_adr_code => 'IAC_ASSET_COST_AC'
182950 , p_adr_type_code => 'S'
182951 , p_component_type => l_component_type
182952 , p_component_code => l_component_code
182953 , p_component_type_code => l_component_type_code
182954 , p_component_appl_id => l_component_appl_id
182955 , p_amb_context_code => l_amb_context_code
182956 , p_side => 'NA'
182957 );
182958
182959
182960 --
182961 --
182962 END IF;
182963 --
182964 -- Bug 4922099
182965 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
182966 (NVL(l_enc_upg_option, 'N') = 'O')
182967 ) AND
182968 (l_bflow_method_code = 'PRIOR_ENTRY')
182969 )
182970 THEN
182971 IF
182972 --
182973 1 = 2
182974 --
182975 THEN
182976 xla_accounting_err_pkg.build_message
182977 (p_appli_s_name => 'XLA'
182978 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
182979 ,p_token_1 => 'LINE_NUMBER'
182980 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
182981 ,p_token_2 => 'LINE_TYPE_NAME'
182982 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
182983 l_component_type
182984 ,l_component_code
182985 ,l_component_type_code
182986 ,l_component_appl_id
182987 ,l_amb_context_code
182988 ,l_entity_code
182989 ,l_event_class_code
182990 )
182991 ,p_token_3 => 'OWNER'
182992 ,p_value_3 => xla_lookups_pkg.get_meaning(
182993 p_lookup_type => 'XLA_OWNER_TYPE'
182994 ,p_lookup_code => l_component_type_code
182995 )
182996 ,p_token_4 => 'PRODUCT_NAME'
182997 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
182998 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
182999 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
183000 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
183001 ,p_ae_header_id => NULL
183002 );
183003
183004 IF (C_LEVEL_ERROR>= g_log_level) THEN
183005 trace
183006 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
183007 ,p_level => C_LEVEL_ERROR
183011 END IF;
183008 ,p_module => l_log_module);
183009 END IF;
183010 END IF;
183012 --
183013 --
183014 ------------------------------------------------------------------------------------------------
183015 -- 4219869 Business Flow
183016 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
183017 -- Prior Entry. Currently, the following code is always generated.
183018 ------------------------------------------------------------------------------------------------
183019 XLA_AE_LINES_PKG.ValidateCurrentLine;
183020
183021 ------------------------------------------------------------------------------------
183022 -- 4219869 Business Flow
183023 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
183024 ------------------------------------------------------------------------------------
183025 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
183026
183027 ----------------------------------------------------------------------------------
183028 -- 4219869 Business Flow
183029 -- Update journal entry status -- Need to generate this within IF <condition>
183030 ----------------------------------------------------------------------------------
183031 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
183032 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
183033 ,p_balance_type_code => l_balance_type_code
183034 );
183035
183036 -------------------------------------------------------------------------------------------
183037 -- 4262811 - Generate the Accrual Reversal lines
183038 -------------------------------------------------------------------------------------------
183039 BEGIN
183040 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
183041 (g_array_event(p_event_id).array_value_num('header_index'));
183042 IF l_acc_rev_flag IS NULL THEN
183043 l_acc_rev_flag := 'N';
183044 END IF;
183045 EXCEPTION
183046 WHEN OTHERS THEN
183047 l_acc_rev_flag := 'N';
183048 END;
183049 --
183050 IF (l_acc_rev_flag = 'Y') THEN
183051
183052 -- 4645092 ------------------------------------------------------------------------------
183053 -- To allow MPA report to determine if it should generate report process
183054 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
183055 ------------------------------------------------------------------------------------------
183056
183057 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
183058 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
183059 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
183060 -- call ADRs
183061 -- Bug 4922099
183062 --
183063 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
183064 (NVL(l_actual_upg_option, 'N') = 'O') OR
183065 (NVL(l_enc_upg_option, 'N') = 'O')
183066 )
183067 THEN
183068 NULL;
183069 --
183070 --
183071
183072 l_ccid := AcctDerRule_182(
183073 p_application_id => p_application_id
183074 , p_ae_header_id => l_ae_header_id
183075 , p_source_37 => p_source_37
183076 , x_transaction_coa_id => l_adr_transaction_coa_id
183077 , x_accounting_coa_id => l_adr_accounting_coa_id
183078 , x_value_type_code => l_adr_value_type_code
183079 , p_side => 'NA'
183080 );
183081
183082 xla_ae_lines_pkg.set_ccid(
183083 p_code_combination_id => l_ccid
183084 , p_value_type_code => l_adr_value_type_code
183085 , p_transaction_coa_id => l_adr_transaction_coa_id
183086 , p_accounting_coa_id => l_adr_accounting_coa_id
183087 , p_adr_code => 'IAC_ASSET_COST_AC'
183088 , p_adr_type_code => 'S'
183089 , p_component_type => l_component_type
183090 , p_component_code => l_component_code
183091 , p_component_type_code => l_component_type_code
183092 , p_component_appl_id => l_component_appl_id
183093 , p_amb_context_code => l_amb_context_code
183094 , p_side => 'NA'
183095 );
183096
183097
183098 --
183099 --
183100 END IF;
183101
183102 --
183103 -- Update the line information that should be overwritten
183104 --
183105 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
183106 p_header_num => 1);
183107 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
183108
183109 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
183110
183111 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
183112 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
183113 END IF;
183114
183115 --
183116 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
183117 --
183118 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
183119 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
183120 ELSE
183124 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
183121 ---------------------------------------------------------------------------------------------------
183122 -- 4262811a Switch Sign
183123 ---------------------------------------------------------------------------------------------------
183125 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
183126 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
183127 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
183128 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
183129 -- 5132302
183130 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
183131 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
183132
183133 END IF;
183134
183135 -- 4955764
183136 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
183137 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
183138
183139
183140 XLA_AE_LINES_PKG.ValidateCurrentLine;
183141 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
183142
183143 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
183144 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
183145 ,p_balance_type_code => l_balance_type_code);
183146
183147 END IF;
183148
183149 -----------------------------------------------------------------------------------------
183150 -- 4262811 Multiperiod Accounting
183151 -----------------------------------------------------------------------------------------
183152 -- No MPA option is assigned.
183153
183154
183155 END IF;
183156 END IF;
183157 --
183158
183159 --
183160 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
183161 trace
183162 (p_msg => 'END of AcctLineType_423'
183163 ,p_level => C_LEVEL_PROCEDURE
183164 ,p_module => l_log_module);
183165 END IF;
183166 --
183167 EXCEPTION
183168 WHEN xla_exceptions_pkg.application_exception THEN
183169 RAISE;
183170 WHEN OTHERS THEN
183171 xla_exceptions_pkg.raise_message
183172 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_423');
183173 END AcctLineType_423;
183174 --
183175
183176 ---------------------------------------
183177 --
183178 -- PRIVATE FUNCTION
183179 -- AcctLineType_424
183180 --
183181 ---------------------------------------
183182 PROCEDURE AcctLineType_424 (
183183 p_application_id IN NUMBER
183184 ,p_event_id IN NUMBER
183185 ,p_calculate_acctd_flag IN VARCHAR2
183186 ,p_calculate_g_l_flag IN VARCHAR2
183187 ,p_actual_flag IN OUT VARCHAR2
183188 ,p_balance_type_code OUT VARCHAR2
183189 ,p_gain_or_loss_ref OUT VARCHAR2
183190
183191 --Inflation Adjustment Type Description
183192 , p_source_2 IN VARCHAR2
183193 --Accounting Date
183194 , p_source_3 IN DATE
183195 --Inflation Asset Ccid
183196 , p_source_37 IN NUMBER
183197 --Transaction Header Identifier
183198 , p_source_49 IN NUMBER
183199 --Adjustment Line Identifier
183200 , p_source_50 IN NUMBER
183201 --Distribution Type Code
183202 , p_source_51 IN VARCHAR2
183203 --Inflation Adjustment Type
183204 , p_source_64 IN VARCHAR2
183205 --Inflation Entered Amount
183206 , p_source_65 IN NUMBER
183207 --Inflation Currency Code
183208 , p_source_66 IN VARCHAR2
183209 )
183210 IS
183211
183212 l_component_type VARCHAR2(80);
183213 l_component_code VARCHAR2(30);
183214 l_component_type_code VARCHAR2(1);
183215 l_component_appl_id INTEGER;
183216 l_amb_context_code VARCHAR2(30);
183217 l_entity_code VARCHAR2(30);
183218 l_event_class_code VARCHAR2(30);
183219 l_ae_header_id NUMBER;
183220 l_event_type_code VARCHAR2(30);
183221 l_line_definition_code VARCHAR2(30);
183222 l_line_definition_owner_code VARCHAR2(1);
183223 --
183224 -- adr variables
183225 l_segment VARCHAR2(30);
183226 l_ccid NUMBER;
183227 l_adr_transaction_coa_id NUMBER;
183228 l_adr_accounting_coa_id NUMBER;
183229 l_adr_flexfield_segment_code VARCHAR2(30);
183230 l_adr_flex_value_set_id NUMBER;
183231 l_adr_value_type_code VARCHAR2(30);
183232 l_adr_value_combination_id NUMBER;
183233 l_adr_value_segment_code VARCHAR2(30);
183234
183235 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
183236 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
183237 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
183238 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
183239
183240 -- 4262811 Variables ------------------------------------------------------------------------------------------
183241 l_entered_amt_idx NUMBER;
183242 l_accted_amt_idx NUMBER;
183243 l_acc_rev_flag VARCHAR2(1);
183244 l_accrual_line_num NUMBER;
183248 l_num_entries NUMBER;
183245 l_tmp_amt NUMBER;
183246 l_acc_rev_natural_side_code VARCHAR2(1);
183247
183249 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
183250 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
183251 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
183252 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
183253 l_recog_line_1 NUMBER;
183254 l_recog_line_2 NUMBER;
183255
183256 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
183257 l_bflow_applied_to_amt NUMBER; -- 5132302
183258 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
183259
183260 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
183261
183262 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
183263 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
183264
183265 ---------------------------------------------------------------------------------------------------------------
183266
183267
183268 --
183269 -- bulk performance
183270 --
183271 l_balance_type_code VARCHAR2(1);
183272 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
183273 l_log_module VARCHAR2(240);
183274
183275 --
183276 -- Upgrade strategy
183277 --
183278 l_actual_upg_option VARCHAR2(1);
183279 l_enc_upg_option VARCHAR2(1);
183280
183281 --
183282 BEGIN
183283 --
183284 IF g_log_enabled THEN
183285 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_424';
183286 END IF;
183287 --
183288 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
183289
183290 trace
183291 (p_msg => 'BEGIN of AcctLineType_424'
183292 ,p_level => C_LEVEL_PROCEDURE
183293 ,p_module => l_log_module);
183294
183295 END IF;
183296 --
183297 l_component_type := 'AMB_JLT';
183298 l_component_code := 'IAC_ASSET_COST';
183299 l_component_type_code := 'S';
183300 l_component_appl_id := 140;
183301 l_amb_context_code := 'DEFAULT';
183302 l_entity_code := 'TRANSACTIONS';
183303 l_event_class_code := 'RETIREMENTS';
183304 l_event_type_code := 'RETIREMENTS';
183305 l_line_definition_owner_code := 'S';
183306 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
183307 --
183308 l_balance_type_code := 'A';
183309 l_segment := NULL;
183310 l_ccid := NULL;
183311 l_adr_transaction_coa_id := NULL;
183312 l_adr_accounting_coa_id := NULL;
183313 l_adr_flexfield_segment_code := NULL;
183314 l_adr_flex_value_set_id := NULL;
183315 l_adr_value_type_code := NULL;
183316 l_adr_value_combination_id := NULL;
183317 l_adr_value_segment_code := NULL;
183318
183319 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
183320 l_bflow_class_code := ''; -- 4219869 Business Flow
183321 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
183322 l_budgetary_control_flag := 'N';
183323
183324 l_bflow_applied_to_amt_idx := NULL; -- 5132302
183325 l_bflow_applied_to_amt := NULL; -- 5132302
183326 l_entered_amt_idx := NULL; -- 4262811
183327 l_accted_amt_idx := NULL; -- 4262811
183328 l_acc_rev_flag := NULL; -- 4262811
183329 l_accrual_line_num := NULL; -- 4262811
183330 l_tmp_amt := NULL; -- 4262811
183331 --
183332
183333 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
183334 l_balance_type_code <> 'B' THEN
183335 IF NVL(p_source_64,'
183336 ') = 'COST'
183337 THEN
183338
183339 --
183340 XLA_AE_LINES_PKG.SetNewLine;
183341
183342 p_balance_type_code := l_balance_type_code;
183343 -- set the flag so later we will know whether the gain loss line needs to be created
183344
183345 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
183346 p_actual_flag :='A';
183347 END IF;
183348
183349 --
183350 -- bulk performance
183351 --
183352 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
183353 p_header_num => 0); -- 4262811
183354 --
183355 -- set accounting line options
183356 --
183357 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
183358 p_natural_side_code => 'D'
183359 , p_gain_or_loss_flag => 'N'
183360 , p_gl_transfer_mode_code => 'S'
183361 , p_acct_entry_type_code => 'A'
183362 , p_switch_side_flag => 'Y'
183363 , p_merge_duplicate_code => 'N'
183364 );
183365 --
183366 l_acc_rev_natural_side_code := 'C'; -- 4262811
183367 --
183368 --
183369 -- set accounting line type info
183370 --
183371 xla_ae_lines_pkg.SetAcctLineType
183372 (p_component_type => l_component_type
183373 ,p_event_type_code => l_event_type_code
183374 ,p_line_definition_owner_code => l_line_definition_owner_code
183375 ,p_line_definition_code => l_line_definition_code
183376 ,p_accounting_line_code => l_component_code
183377 ,p_accounting_line_type_code => l_component_type_code
183381 ,p_event_class_code => l_event_class_code);
183378 ,p_accounting_line_appl_id => l_component_appl_id
183379 ,p_amb_context_code => l_amb_context_code
183380 ,p_entity_code => l_entity_code
183382 --
183383 -- set accounting class
183384 --
183385 xla_ae_lines_pkg.SetAcctClass(
183386 p_accounting_class_code => 'ASSET'
183387 , p_ae_header_id => l_ae_header_id
183388 );
183389
183390 --
183391 -- set rounding class
183392 --
183393 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
183394 'ASSET';
183395
183396 --
183397 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
183398 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
183399 --
183400 -- bulk performance
183401 --
183402 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
183403
183404 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
183405 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
183406
183407 -- 4955764
183408 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
183409 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
183410
183411 -- 4458381 Public Sector Enh
183412
183413 --
183414 -- set accounting attributes for the line type
183415 --
183416 l_entered_amt_idx := 4;
183417 l_accted_amt_idx := 6;
183418 l_bflow_applied_to_amt_idx := NULL; -- 5132302
183419 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
183420 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
183421 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
183422 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
183423 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
183424 l_rec_acct_attrs.array_char_value(3) := p_source_51;
183425 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
183426 l_rec_acct_attrs.array_num_value(4) := p_source_65;
183427 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
183428 l_rec_acct_attrs.array_char_value(5) := p_source_66;
183429 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
183430 l_rec_acct_attrs.array_num_value(6) := p_source_65;
183431
183432 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
183433 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
183434
183435 ---------------------------------------------------------------------------------------------------------------
183436 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
183437 ---------------------------------------------------------------------------------------------------------------
183438 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
183439
183440 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
183441 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
183442
183443 IF xla_accounting_cache_pkg.GetValueChar
183444 (p_source_code => 'LEDGER_CATEGORY_CODE'
183445 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
183446 AND l_bflow_method_code = 'PRIOR_ENTRY'
183447 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
183448 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
183449 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
183450 )
183451 THEN
183452 xla_ae_lines_pkg.BflowUpgEntry
183453 (p_business_method_code => l_bflow_method_code
183454 ,p_business_class_code => l_bflow_class_code
183455 ,p_balance_type => l_balance_type_code);
183456 ELSE
183457 NULL;
183458 -- No business flow processing for business flow method of NONE.
183459 END IF;
183460
183461 --
183462 -- call analytical criteria
183463 --
183464
183465 --
183466 -- call description
183467 --
183468
183469 xla_ae_lines_pkg.SetLineDescription(
183470 p_ae_header_id => l_ae_header_id
183471 ,p_description => Description_143 (
183472 p_application_id => p_application_id
183473 , p_ae_header_id => l_ae_header_id
183474 , p_source_2 => p_source_2
183475 , p_source_3 => p_source_3
183476 )
183477 );
183478
183479
183480 --
183481 -- call ADRs
183482 -- Bug 4922099
183483 --
183484 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
183485 (NVL(l_actual_upg_option, 'N') = 'O') OR
183486 (NVL(l_enc_upg_option, 'N') = 'O')
183487 )
183488 THEN
183489 NULL;
183490 --
183491 --
183492
183493 l_ccid := AcctDerRule_182(
183494 p_application_id => p_application_id
183495 , p_ae_header_id => l_ae_header_id
183496 , p_source_37 => p_source_37
183497 , x_transaction_coa_id => l_adr_transaction_coa_id
183498 , x_accounting_coa_id => l_adr_accounting_coa_id
183499 , x_value_type_code => l_adr_value_type_code
183503 xla_ae_lines_pkg.set_ccid(
183500 , p_side => 'NA'
183501 );
183502
183504 p_code_combination_id => l_ccid
183505 , p_value_type_code => l_adr_value_type_code
183506 , p_transaction_coa_id => l_adr_transaction_coa_id
183507 , p_accounting_coa_id => l_adr_accounting_coa_id
183508 , p_adr_code => 'IAC_ASSET_COST_AC'
183509 , p_adr_type_code => 'S'
183510 , p_component_type => l_component_type
183511 , p_component_code => l_component_code
183512 , p_component_type_code => l_component_type_code
183513 , p_component_appl_id => l_component_appl_id
183514 , p_amb_context_code => l_amb_context_code
183515 , p_side => 'NA'
183516 );
183517
183518
183519 --
183520 --
183521 END IF;
183522 --
183523 -- Bug 4922099
183524 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
183525 (NVL(l_enc_upg_option, 'N') = 'O')
183526 ) AND
183527 (l_bflow_method_code = 'PRIOR_ENTRY')
183528 )
183529 THEN
183530 IF
183531 --
183532 1 = 2
183533 --
183534 THEN
183535 xla_accounting_err_pkg.build_message
183536 (p_appli_s_name => 'XLA'
183537 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
183538 ,p_token_1 => 'LINE_NUMBER'
183539 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
183540 ,p_token_2 => 'LINE_TYPE_NAME'
183541 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
183542 l_component_type
183543 ,l_component_code
183544 ,l_component_type_code
183545 ,l_component_appl_id
183546 ,l_amb_context_code
183547 ,l_entity_code
183548 ,l_event_class_code
183549 )
183550 ,p_token_3 => 'OWNER'
183551 ,p_value_3 => xla_lookups_pkg.get_meaning(
183552 p_lookup_type => 'XLA_OWNER_TYPE'
183553 ,p_lookup_code => l_component_type_code
183554 )
183555 ,p_token_4 => 'PRODUCT_NAME'
183556 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
183557 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
183558 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
183559 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
183560 ,p_ae_header_id => NULL
183561 );
183562
183563 IF (C_LEVEL_ERROR>= g_log_level) THEN
183564 trace
183565 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
183566 ,p_level => C_LEVEL_ERROR
183567 ,p_module => l_log_module);
183568 END IF;
183569 END IF;
183570 END IF;
183571 --
183572 --
183573 ------------------------------------------------------------------------------------------------
183574 -- 4219869 Business Flow
183575 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
183576 -- Prior Entry. Currently, the following code is always generated.
183577 ------------------------------------------------------------------------------------------------
183578 XLA_AE_LINES_PKG.ValidateCurrentLine;
183579
183580 ------------------------------------------------------------------------------------
183581 -- 4219869 Business Flow
183582 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
183583 ------------------------------------------------------------------------------------
183584 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
183585
183586 ----------------------------------------------------------------------------------
183587 -- 4219869 Business Flow
183588 -- Update journal entry status -- Need to generate this within IF <condition>
183589 ----------------------------------------------------------------------------------
183590 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
183591 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
183592 ,p_balance_type_code => l_balance_type_code
183593 );
183594
183595 -------------------------------------------------------------------------------------------
183596 -- 4262811 - Generate the Accrual Reversal lines
183600 (g_array_event(p_event_id).array_value_num('header_index'));
183597 -------------------------------------------------------------------------------------------
183598 BEGIN
183599 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
183601 IF l_acc_rev_flag IS NULL THEN
183602 l_acc_rev_flag := 'N';
183603 END IF;
183604 EXCEPTION
183605 WHEN OTHERS THEN
183606 l_acc_rev_flag := 'N';
183607 END;
183608 --
183609 IF (l_acc_rev_flag = 'Y') THEN
183610
183611 -- 4645092 ------------------------------------------------------------------------------
183612 -- To allow MPA report to determine if it should generate report process
183613 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
183614 ------------------------------------------------------------------------------------------
183615
183616 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
183617 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
183618 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
183619 -- call ADRs
183620 -- Bug 4922099
183621 --
183622 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
183623 (NVL(l_actual_upg_option, 'N') = 'O') OR
183624 (NVL(l_enc_upg_option, 'N') = 'O')
183625 )
183626 THEN
183627 NULL;
183628 --
183629 --
183630
183631 l_ccid := AcctDerRule_182(
183632 p_application_id => p_application_id
183633 , p_ae_header_id => l_ae_header_id
183634 , p_source_37 => p_source_37
183635 , x_transaction_coa_id => l_adr_transaction_coa_id
183636 , x_accounting_coa_id => l_adr_accounting_coa_id
183637 , x_value_type_code => l_adr_value_type_code
183638 , p_side => 'NA'
183639 );
183640
183641 xla_ae_lines_pkg.set_ccid(
183642 p_code_combination_id => l_ccid
183643 , p_value_type_code => l_adr_value_type_code
183644 , p_transaction_coa_id => l_adr_transaction_coa_id
183645 , p_accounting_coa_id => l_adr_accounting_coa_id
183646 , p_adr_code => 'IAC_ASSET_COST_AC'
183647 , p_adr_type_code => 'S'
183648 , p_component_type => l_component_type
183649 , p_component_code => l_component_code
183650 , p_component_type_code => l_component_type_code
183651 , p_component_appl_id => l_component_appl_id
183652 , p_amb_context_code => l_amb_context_code
183653 , p_side => 'NA'
183654 );
183655
183656
183657 --
183658 --
183659 END IF;
183660
183661 --
183662 -- Update the line information that should be overwritten
183663 --
183664 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
183665 p_header_num => 1);
183666 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
183667
183668 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
183669
183670 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
183671 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
183672 END IF;
183673
183674 --
183675 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
183676 --
183677 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
183678 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
183679 ELSE
183680 ---------------------------------------------------------------------------------------------------
183681 -- 4262811a Switch Sign
183682 ---------------------------------------------------------------------------------------------------
183683 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
183684 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
183685 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
183686 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
183687 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
183688 -- 5132302
183689 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
183690 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
183691
183692 END IF;
183693
183694 -- 4955764
183695 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
183696 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
183697
183698
183699 XLA_AE_LINES_PKG.ValidateCurrentLine;
183700 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
183701
183702 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
183703 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
183704 ,p_balance_type_code => l_balance_type_code);
183705
183706 END IF;
183710 -----------------------------------------------------------------------------------------
183707
183708 -----------------------------------------------------------------------------------------
183709 -- 4262811 Multiperiod Accounting
183711 -- No MPA option is assigned.
183712
183713
183714 END IF;
183715 END IF;
183716 --
183717
183718 --
183719 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
183720 trace
183721 (p_msg => 'END of AcctLineType_424'
183722 ,p_level => C_LEVEL_PROCEDURE
183723 ,p_module => l_log_module);
183724 END IF;
183725 --
183726 EXCEPTION
183727 WHEN xla_exceptions_pkg.application_exception THEN
183728 RAISE;
183729 WHEN OTHERS THEN
183730 xla_exceptions_pkg.raise_message
183731 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_424');
183732 END AcctLineType_424;
183733 --
183734
183735 ---------------------------------------
183736 --
183737 -- PRIVATE FUNCTION
183738 -- AcctLineType_425
183739 --
183740 ---------------------------------------
183741 PROCEDURE AcctLineType_425 (
183742 p_application_id IN NUMBER
183743 ,p_event_id IN NUMBER
183744 ,p_calculate_acctd_flag IN VARCHAR2
183745 ,p_calculate_g_l_flag IN VARCHAR2
183746 ,p_actual_flag IN OUT VARCHAR2
183747 ,p_balance_type_code OUT VARCHAR2
183748 ,p_gain_or_loss_ref OUT VARCHAR2
183749
183750 --Inflation Adjustment Type Description
183751 , p_source_2 IN VARCHAR2
183752 --Accounting Date
183753 , p_source_3 IN DATE
183754 --Inflation Asset Ccid
183755 , p_source_37 IN NUMBER
183756 --Transaction Header Identifier
183757 , p_source_49 IN NUMBER
183758 --Adjustment Line Identifier
183759 , p_source_50 IN NUMBER
183760 --Distribution Type Code
183761 , p_source_51 IN VARCHAR2
183762 --Inflation Adjustment Type
183763 , p_source_64 IN VARCHAR2
183764 --Inflation Entered Amount
183765 , p_source_65 IN NUMBER
183766 --Inflation Currency Code
183767 , p_source_66 IN VARCHAR2
183768 )
183769 IS
183770
183771 l_component_type VARCHAR2(80);
183772 l_component_code VARCHAR2(30);
183773 l_component_type_code VARCHAR2(1);
183774 l_component_appl_id INTEGER;
183775 l_amb_context_code VARCHAR2(30);
183776 l_entity_code VARCHAR2(30);
183777 l_event_class_code VARCHAR2(30);
183778 l_ae_header_id NUMBER;
183779 l_event_type_code VARCHAR2(30);
183780 l_line_definition_code VARCHAR2(30);
183781 l_line_definition_owner_code VARCHAR2(1);
183782 --
183783 -- adr variables
183784 l_segment VARCHAR2(30);
183785 l_ccid NUMBER;
183786 l_adr_transaction_coa_id NUMBER;
183787 l_adr_accounting_coa_id NUMBER;
183788 l_adr_flexfield_segment_code VARCHAR2(30);
183789 l_adr_flex_value_set_id NUMBER;
183790 l_adr_value_type_code VARCHAR2(30);
183791 l_adr_value_combination_id NUMBER;
183792 l_adr_value_segment_code VARCHAR2(30);
183793
183794 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
183795 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
183796 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
183797 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
183798
183799 -- 4262811 Variables ------------------------------------------------------------------------------------------
183800 l_entered_amt_idx NUMBER;
183801 l_accted_amt_idx NUMBER;
183802 l_acc_rev_flag VARCHAR2(1);
183803 l_accrual_line_num NUMBER;
183804 l_tmp_amt NUMBER;
183805 l_acc_rev_natural_side_code VARCHAR2(1);
183806
183807 l_num_entries NUMBER;
183808 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
183809 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
183810 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
183811 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
183812 l_recog_line_1 NUMBER;
183813 l_recog_line_2 NUMBER;
183814
183815 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
183816 l_bflow_applied_to_amt NUMBER; -- 5132302
183817 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
183818
183819 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
183820
183821 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
183822 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
183823
183824 ---------------------------------------------------------------------------------------------------------------
183825
183826
183827 --
183828 -- bulk performance
183829 --
183830 l_balance_type_code VARCHAR2(1);
183831 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
183832 l_log_module VARCHAR2(240);
183833
183834 --
183835 -- Upgrade strategy
183836 --
183837 l_actual_upg_option VARCHAR2(1);
183838 l_enc_upg_option VARCHAR2(1);
183839
183840 --
183841 BEGIN
183842 --
183846 --
183843 IF g_log_enabled THEN
183844 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_425';
183845 END IF;
183847 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
183848
183849 trace
183850 (p_msg => 'BEGIN of AcctLineType_425'
183851 ,p_level => C_LEVEL_PROCEDURE
183852 ,p_module => l_log_module);
183853
183854 END IF;
183855 --
183856 l_component_type := 'AMB_JLT';
183857 l_component_code := 'IAC_ASSET_COST';
183858 l_component_type_code := 'S';
183859 l_component_appl_id := 140;
183860 l_amb_context_code := 'DEFAULT';
183861 l_entity_code := 'TRANSACTIONS';
183862 l_event_class_code := 'ADJUSTMENTS';
183863 l_event_type_code := 'ADJUSTMENTS_ALL';
183864 l_line_definition_owner_code := 'S';
183865 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
183866 --
183867 l_balance_type_code := 'A';
183868 l_segment := NULL;
183869 l_ccid := NULL;
183870 l_adr_transaction_coa_id := NULL;
183871 l_adr_accounting_coa_id := NULL;
183872 l_adr_flexfield_segment_code := NULL;
183873 l_adr_flex_value_set_id := NULL;
183874 l_adr_value_type_code := NULL;
183875 l_adr_value_combination_id := NULL;
183876 l_adr_value_segment_code := NULL;
183877
183878 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
183879 l_bflow_class_code := ''; -- 4219869 Business Flow
183880 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
183881 l_budgetary_control_flag := 'N';
183882
183883 l_bflow_applied_to_amt_idx := NULL; -- 5132302
183884 l_bflow_applied_to_amt := NULL; -- 5132302
183885 l_entered_amt_idx := NULL; -- 4262811
183886 l_accted_amt_idx := NULL; -- 4262811
183887 l_acc_rev_flag := NULL; -- 4262811
183888 l_accrual_line_num := NULL; -- 4262811
183889 l_tmp_amt := NULL; -- 4262811
183890 --
183891
183892 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
183893 l_balance_type_code <> 'B' THEN
183894 IF NVL(p_source_64,'
183895 ') = 'COST'
183896 THEN
183897
183898 --
183899 XLA_AE_LINES_PKG.SetNewLine;
183900
183901 p_balance_type_code := l_balance_type_code;
183902 -- set the flag so later we will know whether the gain loss line needs to be created
183903
183904 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
183905 p_actual_flag :='A';
183906 END IF;
183907
183908 --
183909 -- bulk performance
183910 --
183911 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
183912 p_header_num => 0); -- 4262811
183913 --
183914 -- set accounting line options
183915 --
183916 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
183917 p_natural_side_code => 'D'
183918 , p_gain_or_loss_flag => 'N'
183919 , p_gl_transfer_mode_code => 'S'
183920 , p_acct_entry_type_code => 'A'
183921 , p_switch_side_flag => 'Y'
183922 , p_merge_duplicate_code => 'N'
183923 );
183924 --
183925 l_acc_rev_natural_side_code := 'C'; -- 4262811
183926 --
183927 --
183928 -- set accounting line type info
183929 --
183930 xla_ae_lines_pkg.SetAcctLineType
183931 (p_component_type => l_component_type
183932 ,p_event_type_code => l_event_type_code
183933 ,p_line_definition_owner_code => l_line_definition_owner_code
183934 ,p_line_definition_code => l_line_definition_code
183935 ,p_accounting_line_code => l_component_code
183936 ,p_accounting_line_type_code => l_component_type_code
183937 ,p_accounting_line_appl_id => l_component_appl_id
183938 ,p_amb_context_code => l_amb_context_code
183939 ,p_entity_code => l_entity_code
183940 ,p_event_class_code => l_event_class_code);
183941 --
183942 -- set accounting class
183943 --
183944 xla_ae_lines_pkg.SetAcctClass(
183945 p_accounting_class_code => 'ASSET'
183946 , p_ae_header_id => l_ae_header_id
183947 );
183948
183949 --
183950 -- set rounding class
183951 --
183952 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
183953 'ASSET';
183954
183955 --
183956 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
183957 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
183958 --
183959 -- bulk performance
183960 --
183961 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
183962
183963 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
183964 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
183965
183966 -- 4955764
183967 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
183968 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
183969
183970 -- 4458381 Public Sector Enh
183971
183972 --
183973 -- set accounting attributes for the line type
183974 --
183975 l_entered_amt_idx := 4;
183979 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
183976 l_accted_amt_idx := 6;
183977 l_bflow_applied_to_amt_idx := NULL; -- 5132302
183978 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
183980 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
183981 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
183982 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
183983 l_rec_acct_attrs.array_char_value(3) := p_source_51;
183984 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
183985 l_rec_acct_attrs.array_num_value(4) := p_source_65;
183986 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
183987 l_rec_acct_attrs.array_char_value(5) := p_source_66;
183988 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
183989 l_rec_acct_attrs.array_num_value(6) := p_source_65;
183990
183991 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
183992 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
183993
183994 ---------------------------------------------------------------------------------------------------------------
183995 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
183996 ---------------------------------------------------------------------------------------------------------------
183997 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
183998
183999 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
184000 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
184001
184002 IF xla_accounting_cache_pkg.GetValueChar
184003 (p_source_code => 'LEDGER_CATEGORY_CODE'
184004 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
184005 AND l_bflow_method_code = 'PRIOR_ENTRY'
184006 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
184007 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
184008 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
184009 )
184010 THEN
184011 xla_ae_lines_pkg.BflowUpgEntry
184012 (p_business_method_code => l_bflow_method_code
184013 ,p_business_class_code => l_bflow_class_code
184014 ,p_balance_type => l_balance_type_code);
184015 ELSE
184016 NULL;
184017 -- No business flow processing for business flow method of NONE.
184018 END IF;
184019
184020 --
184021 -- call analytical criteria
184022 --
184023
184024 --
184025 -- call description
184026 --
184027
184028 xla_ae_lines_pkg.SetLineDescription(
184029 p_ae_header_id => l_ae_header_id
184030 ,p_description => Description_143 (
184031 p_application_id => p_application_id
184032 , p_ae_header_id => l_ae_header_id
184033 , p_source_2 => p_source_2
184034 , p_source_3 => p_source_3
184035 )
184036 );
184037
184038
184039 --
184040 -- call ADRs
184041 -- Bug 4922099
184042 --
184043 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
184044 (NVL(l_actual_upg_option, 'N') = 'O') OR
184045 (NVL(l_enc_upg_option, 'N') = 'O')
184046 )
184047 THEN
184048 NULL;
184049 --
184050 --
184051
184052 l_ccid := AcctDerRule_182(
184053 p_application_id => p_application_id
184054 , p_ae_header_id => l_ae_header_id
184055 , p_source_37 => p_source_37
184056 , x_transaction_coa_id => l_adr_transaction_coa_id
184057 , x_accounting_coa_id => l_adr_accounting_coa_id
184058 , x_value_type_code => l_adr_value_type_code
184059 , p_side => 'NA'
184060 );
184061
184062 xla_ae_lines_pkg.set_ccid(
184063 p_code_combination_id => l_ccid
184064 , p_value_type_code => l_adr_value_type_code
184065 , p_transaction_coa_id => l_adr_transaction_coa_id
184066 , p_accounting_coa_id => l_adr_accounting_coa_id
184067 , p_adr_code => 'IAC_ASSET_COST_AC'
184068 , p_adr_type_code => 'S'
184069 , p_component_type => l_component_type
184070 , p_component_code => l_component_code
184071 , p_component_type_code => l_component_type_code
184072 , p_component_appl_id => l_component_appl_id
184073 , p_amb_context_code => l_amb_context_code
184074 , p_side => 'NA'
184075 );
184076
184077
184078 --
184079 --
184080 END IF;
184081 --
184082 -- Bug 4922099
184083 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
184084 (NVL(l_enc_upg_option, 'N') = 'O')
184085 ) AND
184086 (l_bflow_method_code = 'PRIOR_ENTRY')
184087 )
184088 THEN
184089 IF
184090 --
184091 1 = 2
184092 --
184093 THEN
184094 xla_accounting_err_pkg.build_message
184095 (p_appli_s_name => 'XLA'
184096 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
184097 ,p_token_1 => 'LINE_NUMBER'
184098 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
184102 ,l_component_code
184099 ,p_token_2 => 'LINE_TYPE_NAME'
184100 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
184101 l_component_type
184103 ,l_component_type_code
184104 ,l_component_appl_id
184105 ,l_amb_context_code
184106 ,l_entity_code
184107 ,l_event_class_code
184108 )
184109 ,p_token_3 => 'OWNER'
184110 ,p_value_3 => xla_lookups_pkg.get_meaning(
184111 p_lookup_type => 'XLA_OWNER_TYPE'
184112 ,p_lookup_code => l_component_type_code
184113 )
184114 ,p_token_4 => 'PRODUCT_NAME'
184115 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
184116 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
184117 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
184118 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
184119 ,p_ae_header_id => NULL
184120 );
184121
184122 IF (C_LEVEL_ERROR>= g_log_level) THEN
184123 trace
184124 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
184125 ,p_level => C_LEVEL_ERROR
184126 ,p_module => l_log_module);
184127 END IF;
184128 END IF;
184129 END IF;
184130 --
184131 --
184132 ------------------------------------------------------------------------------------------------
184133 -- 4219869 Business Flow
184134 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
184135 -- Prior Entry. Currently, the following code is always generated.
184136 ------------------------------------------------------------------------------------------------
184137 XLA_AE_LINES_PKG.ValidateCurrentLine;
184138
184139 ------------------------------------------------------------------------------------
184140 -- 4219869 Business Flow
184141 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
184142 ------------------------------------------------------------------------------------
184143 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
184144
184145 ----------------------------------------------------------------------------------
184146 -- 4219869 Business Flow
184147 -- Update journal entry status -- Need to generate this within IF <condition>
184148 ----------------------------------------------------------------------------------
184149 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
184150 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
184151 ,p_balance_type_code => l_balance_type_code
184152 );
184153
184154 -------------------------------------------------------------------------------------------
184155 -- 4262811 - Generate the Accrual Reversal lines
184156 -------------------------------------------------------------------------------------------
184157 BEGIN
184158 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
184159 (g_array_event(p_event_id).array_value_num('header_index'));
184160 IF l_acc_rev_flag IS NULL THEN
184161 l_acc_rev_flag := 'N';
184162 END IF;
184163 EXCEPTION
184164 WHEN OTHERS THEN
184165 l_acc_rev_flag := 'N';
184166 END;
184167 --
184168 IF (l_acc_rev_flag = 'Y') THEN
184169
184170 -- 4645092 ------------------------------------------------------------------------------
184171 -- To allow MPA report to determine if it should generate report process
184172 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
184173 ------------------------------------------------------------------------------------------
184174
184175 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
184176 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
184177 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
184178 -- call ADRs
184179 -- Bug 4922099
184180 --
184181 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
184182 (NVL(l_actual_upg_option, 'N') = 'O') OR
184183 (NVL(l_enc_upg_option, 'N') = 'O')
184184 )
184185 THEN
184186 NULL;
184187 --
184188 --
184189
184190 l_ccid := AcctDerRule_182(
184191 p_application_id => p_application_id
184192 , p_ae_header_id => l_ae_header_id
184193 , p_source_37 => p_source_37
184197 , p_side => 'NA'
184194 , x_transaction_coa_id => l_adr_transaction_coa_id
184195 , x_accounting_coa_id => l_adr_accounting_coa_id
184196 , x_value_type_code => l_adr_value_type_code
184198 );
184199
184200 xla_ae_lines_pkg.set_ccid(
184201 p_code_combination_id => l_ccid
184202 , p_value_type_code => l_adr_value_type_code
184203 , p_transaction_coa_id => l_adr_transaction_coa_id
184204 , p_accounting_coa_id => l_adr_accounting_coa_id
184205 , p_adr_code => 'IAC_ASSET_COST_AC'
184206 , p_adr_type_code => 'S'
184207 , p_component_type => l_component_type
184208 , p_component_code => l_component_code
184209 , p_component_type_code => l_component_type_code
184210 , p_component_appl_id => l_component_appl_id
184211 , p_amb_context_code => l_amb_context_code
184212 , p_side => 'NA'
184213 );
184214
184215
184216 --
184217 --
184218 END IF;
184219
184220 --
184221 -- Update the line information that should be overwritten
184222 --
184223 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
184224 p_header_num => 1);
184225 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
184226
184227 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
184228
184229 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
184230 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
184231 END IF;
184232
184233 --
184234 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
184235 --
184236 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
184237 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
184238 ELSE
184239 ---------------------------------------------------------------------------------------------------
184240 -- 4262811a Switch Sign
184241 ---------------------------------------------------------------------------------------------------
184242 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
184243 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
184244 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
184245 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
184246 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
184247 -- 5132302
184248 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
184249 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
184250
184251 END IF;
184252
184253 -- 4955764
184254 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
184255 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
184256
184257
184258 XLA_AE_LINES_PKG.ValidateCurrentLine;
184259 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
184260
184261 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
184262 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
184263 ,p_balance_type_code => l_balance_type_code);
184264
184265 END IF;
184266
184267 -----------------------------------------------------------------------------------------
184268 -- 4262811 Multiperiod Accounting
184269 -----------------------------------------------------------------------------------------
184270 -- No MPA option is assigned.
184271
184272
184273 END IF;
184274 END IF;
184275 --
184276
184277 --
184278 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
184279 trace
184280 (p_msg => 'END of AcctLineType_425'
184281 ,p_level => C_LEVEL_PROCEDURE
184282 ,p_module => l_log_module);
184283 END IF;
184284 --
184285 EXCEPTION
184286 WHEN xla_exceptions_pkg.application_exception THEN
184287 RAISE;
184288 WHEN OTHERS THEN
184289 xla_exceptions_pkg.raise_message
184290 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_425');
184291 END AcctLineType_425;
184292 --
184293
184294 ---------------------------------------
184295 --
184296 -- PRIVATE FUNCTION
184297 -- AcctLineType_426
184298 --
184299 ---------------------------------------
184300 PROCEDURE AcctLineType_426 (
184301 p_application_id IN NUMBER
184302 ,p_event_id IN NUMBER
184303 ,p_calculate_acctd_flag IN VARCHAR2
184304 ,p_calculate_g_l_flag IN VARCHAR2
184305 ,p_actual_flag IN OUT VARCHAR2
184306 ,p_balance_type_code OUT VARCHAR2
184307 ,p_gain_or_loss_ref OUT VARCHAR2
184308
184309 --Inflation Adjustment Type Description
184310 , p_source_2 IN VARCHAR2
184311 --Accounting Date
184312 , p_source_3 IN DATE
184313 --Inflation Asset Ccid
184317 --Adjustment Line Identifier
184314 , p_source_37 IN NUMBER
184315 --Transaction Header Identifier
184316 , p_source_49 IN NUMBER
184318 , p_source_50 IN NUMBER
184319 --Distribution Type Code
184320 , p_source_51 IN VARCHAR2
184321 --Inflation Adjustment Type
184322 , p_source_64 IN VARCHAR2
184323 --Inflation Entered Amount
184324 , p_source_65 IN NUMBER
184325 --Inflation Currency Code
184326 , p_source_66 IN VARCHAR2
184327 )
184328 IS
184329
184330 l_component_type VARCHAR2(80);
184331 l_component_code VARCHAR2(30);
184332 l_component_type_code VARCHAR2(1);
184333 l_component_appl_id INTEGER;
184334 l_amb_context_code VARCHAR2(30);
184335 l_entity_code VARCHAR2(30);
184336 l_event_class_code VARCHAR2(30);
184337 l_ae_header_id NUMBER;
184338 l_event_type_code VARCHAR2(30);
184339 l_line_definition_code VARCHAR2(30);
184340 l_line_definition_owner_code VARCHAR2(1);
184341 --
184342 -- adr variables
184343 l_segment VARCHAR2(30);
184344 l_ccid NUMBER;
184345 l_adr_transaction_coa_id NUMBER;
184346 l_adr_accounting_coa_id NUMBER;
184347 l_adr_flexfield_segment_code VARCHAR2(30);
184348 l_adr_flex_value_set_id NUMBER;
184349 l_adr_value_type_code VARCHAR2(30);
184350 l_adr_value_combination_id NUMBER;
184351 l_adr_value_segment_code VARCHAR2(30);
184352
184353 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
184354 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
184355 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
184356 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
184357
184358 -- 4262811 Variables ------------------------------------------------------------------------------------------
184359 l_entered_amt_idx NUMBER;
184360 l_accted_amt_idx NUMBER;
184361 l_acc_rev_flag VARCHAR2(1);
184362 l_accrual_line_num NUMBER;
184363 l_tmp_amt NUMBER;
184364 l_acc_rev_natural_side_code VARCHAR2(1);
184365
184366 l_num_entries NUMBER;
184367 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
184368 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
184369 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
184370 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
184371 l_recog_line_1 NUMBER;
184372 l_recog_line_2 NUMBER;
184373
184374 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
184375 l_bflow_applied_to_amt NUMBER; -- 5132302
184376 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
184377
184378 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
184379
184380 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
184381 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
184382
184383 ---------------------------------------------------------------------------------------------------------------
184384
184385
184386 --
184387 -- bulk performance
184388 --
184389 l_balance_type_code VARCHAR2(1);
184390 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
184391 l_log_module VARCHAR2(240);
184392
184393 --
184394 -- Upgrade strategy
184395 --
184396 l_actual_upg_option VARCHAR2(1);
184397 l_enc_upg_option VARCHAR2(1);
184398
184399 --
184400 BEGIN
184401 --
184402 IF g_log_enabled THEN
184403 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_426';
184404 END IF;
184405 --
184406 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
184407
184408 trace
184409 (p_msg => 'BEGIN of AcctLineType_426'
184410 ,p_level => C_LEVEL_PROCEDURE
184411 ,p_module => l_log_module);
184412
184413 END IF;
184414 --
184415 l_component_type := 'AMB_JLT';
184416 l_component_code := 'IAC_ASSET_COST';
184417 l_component_type_code := 'S';
184418 l_component_appl_id := 140;
184419 l_amb_context_code := 'DEFAULT';
184420 l_entity_code := 'TRANSACTIONS';
184421 l_event_class_code := 'RETIREMENTS';
184422 l_event_type_code := 'REINSTATEMENTS';
184423 l_line_definition_owner_code := 'S';
184424 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
184425 --
184426 l_balance_type_code := 'A';
184427 l_segment := NULL;
184428 l_ccid := NULL;
184429 l_adr_transaction_coa_id := NULL;
184430 l_adr_accounting_coa_id := NULL;
184431 l_adr_flexfield_segment_code := NULL;
184432 l_adr_flex_value_set_id := NULL;
184433 l_adr_value_type_code := NULL;
184434 l_adr_value_combination_id := NULL;
184435 l_adr_value_segment_code := NULL;
184436
184437 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
184438 l_bflow_class_code := ''; -- 4219869 Business Flow
184439 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
184440 l_budgetary_control_flag := 'N';
184441
184442 l_bflow_applied_to_amt_idx := NULL; -- 5132302
184446 l_acc_rev_flag := NULL; -- 4262811
184443 l_bflow_applied_to_amt := NULL; -- 5132302
184444 l_entered_amt_idx := NULL; -- 4262811
184445 l_accted_amt_idx := NULL; -- 4262811
184447 l_accrual_line_num := NULL; -- 4262811
184448 l_tmp_amt := NULL; -- 4262811
184449 --
184450
184451 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
184452 l_balance_type_code <> 'B' THEN
184453 IF NVL(p_source_64,'
184454 ') = 'COST'
184455 THEN
184456
184457 --
184458 XLA_AE_LINES_PKG.SetNewLine;
184459
184460 p_balance_type_code := l_balance_type_code;
184461 -- set the flag so later we will know whether the gain loss line needs to be created
184462
184463 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
184464 p_actual_flag :='A';
184465 END IF;
184466
184467 --
184468 -- bulk performance
184469 --
184470 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
184471 p_header_num => 0); -- 4262811
184472 --
184473 -- set accounting line options
184474 --
184475 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
184476 p_natural_side_code => 'D'
184477 , p_gain_or_loss_flag => 'N'
184478 , p_gl_transfer_mode_code => 'S'
184479 , p_acct_entry_type_code => 'A'
184480 , p_switch_side_flag => 'Y'
184481 , p_merge_duplicate_code => 'N'
184482 );
184483 --
184484 l_acc_rev_natural_side_code := 'C'; -- 4262811
184485 --
184486 --
184487 -- set accounting line type info
184488 --
184489 xla_ae_lines_pkg.SetAcctLineType
184490 (p_component_type => l_component_type
184491 ,p_event_type_code => l_event_type_code
184492 ,p_line_definition_owner_code => l_line_definition_owner_code
184493 ,p_line_definition_code => l_line_definition_code
184494 ,p_accounting_line_code => l_component_code
184495 ,p_accounting_line_type_code => l_component_type_code
184496 ,p_accounting_line_appl_id => l_component_appl_id
184497 ,p_amb_context_code => l_amb_context_code
184498 ,p_entity_code => l_entity_code
184499 ,p_event_class_code => l_event_class_code);
184500 --
184501 -- set accounting class
184502 --
184503 xla_ae_lines_pkg.SetAcctClass(
184504 p_accounting_class_code => 'ASSET'
184505 , p_ae_header_id => l_ae_header_id
184506 );
184507
184508 --
184509 -- set rounding class
184510 --
184511 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
184512 'ASSET';
184513
184514 --
184515 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
184516 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
184517 --
184518 -- bulk performance
184519 --
184520 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
184521
184522 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
184523 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
184524
184525 -- 4955764
184526 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
184527 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
184528
184529 -- 4458381 Public Sector Enh
184530
184531 --
184532 -- set accounting attributes for the line type
184533 --
184534 l_entered_amt_idx := 4;
184535 l_accted_amt_idx := 6;
184536 l_bflow_applied_to_amt_idx := NULL; -- 5132302
184537 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
184538 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
184539 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
184540 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
184541 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
184542 l_rec_acct_attrs.array_char_value(3) := p_source_51;
184543 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
184544 l_rec_acct_attrs.array_num_value(4) := p_source_65;
184545 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
184546 l_rec_acct_attrs.array_char_value(5) := p_source_66;
184547 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
184548 l_rec_acct_attrs.array_num_value(6) := p_source_65;
184549
184550 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
184551 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
184552
184553 ---------------------------------------------------------------------------------------------------------------
184554 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
184555 ---------------------------------------------------------------------------------------------------------------
184556 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
184557
184558 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
184562 (p_source_code => 'LEDGER_CATEGORY_CODE'
184559 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
184560
184561 IF xla_accounting_cache_pkg.GetValueChar
184563 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
184564 AND l_bflow_method_code = 'PRIOR_ENTRY'
184565 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
184566 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
184567 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
184568 )
184569 THEN
184570 xla_ae_lines_pkg.BflowUpgEntry
184571 (p_business_method_code => l_bflow_method_code
184572 ,p_business_class_code => l_bflow_class_code
184573 ,p_balance_type => l_balance_type_code);
184574 ELSE
184575 NULL;
184576 -- No business flow processing for business flow method of NONE.
184577 END IF;
184578
184579 --
184580 -- call analytical criteria
184581 --
184582
184583 --
184584 -- call description
184585 --
184586
184587 xla_ae_lines_pkg.SetLineDescription(
184588 p_ae_header_id => l_ae_header_id
184589 ,p_description => Description_143 (
184590 p_application_id => p_application_id
184591 , p_ae_header_id => l_ae_header_id
184592 , p_source_2 => p_source_2
184593 , p_source_3 => p_source_3
184594 )
184595 );
184596
184597
184598 --
184599 -- call ADRs
184600 -- Bug 4922099
184601 --
184602 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
184603 (NVL(l_actual_upg_option, 'N') = 'O') OR
184604 (NVL(l_enc_upg_option, 'N') = 'O')
184605 )
184606 THEN
184607 NULL;
184608 --
184609 --
184610
184611 l_ccid := AcctDerRule_182(
184612 p_application_id => p_application_id
184613 , p_ae_header_id => l_ae_header_id
184614 , p_source_37 => p_source_37
184615 , x_transaction_coa_id => l_adr_transaction_coa_id
184616 , x_accounting_coa_id => l_adr_accounting_coa_id
184617 , x_value_type_code => l_adr_value_type_code
184618 , p_side => 'NA'
184619 );
184620
184621 xla_ae_lines_pkg.set_ccid(
184622 p_code_combination_id => l_ccid
184623 , p_value_type_code => l_adr_value_type_code
184624 , p_transaction_coa_id => l_adr_transaction_coa_id
184625 , p_accounting_coa_id => l_adr_accounting_coa_id
184626 , p_adr_code => 'IAC_ASSET_COST_AC'
184627 , p_adr_type_code => 'S'
184628 , p_component_type => l_component_type
184629 , p_component_code => l_component_code
184630 , p_component_type_code => l_component_type_code
184631 , p_component_appl_id => l_component_appl_id
184632 , p_amb_context_code => l_amb_context_code
184633 , p_side => 'NA'
184634 );
184635
184636
184637 --
184638 --
184639 END IF;
184640 --
184641 -- Bug 4922099
184642 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
184643 (NVL(l_enc_upg_option, 'N') = 'O')
184644 ) AND
184645 (l_bflow_method_code = 'PRIOR_ENTRY')
184646 )
184647 THEN
184648 IF
184649 --
184650 1 = 2
184651 --
184652 THEN
184653 xla_accounting_err_pkg.build_message
184654 (p_appli_s_name => 'XLA'
184655 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
184656 ,p_token_1 => 'LINE_NUMBER'
184657 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
184658 ,p_token_2 => 'LINE_TYPE_NAME'
184659 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
184660 l_component_type
184661 ,l_component_code
184662 ,l_component_type_code
184663 ,l_component_appl_id
184664 ,l_amb_context_code
184665 ,l_entity_code
184666 ,l_event_class_code
184667 )
184668 ,p_token_3 => 'OWNER'
184669 ,p_value_3 => xla_lookups_pkg.get_meaning(
184670 p_lookup_type => 'XLA_OWNER_TYPE'
184671 ,p_lookup_code => l_component_type_code
184672 )
184673 ,p_token_4 => 'PRODUCT_NAME'
184674 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
184678 ,p_ae_header_id => NULL
184675 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
184676 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
184677 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
184679 );
184680
184681 IF (C_LEVEL_ERROR>= g_log_level) THEN
184682 trace
184683 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
184684 ,p_level => C_LEVEL_ERROR
184685 ,p_module => l_log_module);
184686 END IF;
184687 END IF;
184688 END IF;
184689 --
184690 --
184691 ------------------------------------------------------------------------------------------------
184692 -- 4219869 Business Flow
184693 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
184694 -- Prior Entry. Currently, the following code is always generated.
184695 ------------------------------------------------------------------------------------------------
184696 XLA_AE_LINES_PKG.ValidateCurrentLine;
184697
184698 ------------------------------------------------------------------------------------
184699 -- 4219869 Business Flow
184700 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
184701 ------------------------------------------------------------------------------------
184702 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
184703
184704 ----------------------------------------------------------------------------------
184705 -- 4219869 Business Flow
184706 -- Update journal entry status -- Need to generate this within IF <condition>
184707 ----------------------------------------------------------------------------------
184708 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
184709 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
184710 ,p_balance_type_code => l_balance_type_code
184711 );
184712
184713 -------------------------------------------------------------------------------------------
184714 -- 4262811 - Generate the Accrual Reversal lines
184715 -------------------------------------------------------------------------------------------
184716 BEGIN
184717 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
184718 (g_array_event(p_event_id).array_value_num('header_index'));
184719 IF l_acc_rev_flag IS NULL THEN
184720 l_acc_rev_flag := 'N';
184721 END IF;
184722 EXCEPTION
184723 WHEN OTHERS THEN
184724 l_acc_rev_flag := 'N';
184725 END;
184726 --
184727 IF (l_acc_rev_flag = 'Y') THEN
184728
184729 -- 4645092 ------------------------------------------------------------------------------
184730 -- To allow MPA report to determine if it should generate report process
184731 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
184732 ------------------------------------------------------------------------------------------
184733
184734 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
184735 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
184736 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
184737 -- call ADRs
184738 -- Bug 4922099
184739 --
184740 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
184741 (NVL(l_actual_upg_option, 'N') = 'O') OR
184742 (NVL(l_enc_upg_option, 'N') = 'O')
184743 )
184744 THEN
184745 NULL;
184746 --
184747 --
184748
184749 l_ccid := AcctDerRule_182(
184750 p_application_id => p_application_id
184751 , p_ae_header_id => l_ae_header_id
184752 , p_source_37 => p_source_37
184753 , x_transaction_coa_id => l_adr_transaction_coa_id
184754 , x_accounting_coa_id => l_adr_accounting_coa_id
184755 , x_value_type_code => l_adr_value_type_code
184756 , p_side => 'NA'
184757 );
184758
184759 xla_ae_lines_pkg.set_ccid(
184760 p_code_combination_id => l_ccid
184761 , p_value_type_code => l_adr_value_type_code
184762 , p_transaction_coa_id => l_adr_transaction_coa_id
184763 , p_accounting_coa_id => l_adr_accounting_coa_id
184764 , p_adr_code => 'IAC_ASSET_COST_AC'
184765 , p_adr_type_code => 'S'
184766 , p_component_type => l_component_type
184767 , p_component_code => l_component_code
184768 , p_component_type_code => l_component_type_code
184769 , p_component_appl_id => l_component_appl_id
184770 , p_amb_context_code => l_amb_context_code
184771 , p_side => 'NA'
184772 );
184773
184774
184775 --
184776 --
184777 END IF;
184778
184779 --
184780 -- Update the line information that should be overwritten
184781 --
184782 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
184783 p_header_num => 1);
184784 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
184785
184789 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
184786 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
184787
184788 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
184790 END IF;
184791
184792 --
184793 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
184794 --
184795 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
184796 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
184797 ELSE
184798 ---------------------------------------------------------------------------------------------------
184799 -- 4262811a Switch Sign
184800 ---------------------------------------------------------------------------------------------------
184801 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
184802 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
184803 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
184804 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
184805 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
184806 -- 5132302
184807 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
184808 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
184809
184810 END IF;
184811
184812 -- 4955764
184813 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
184814 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
184815
184816
184817 XLA_AE_LINES_PKG.ValidateCurrentLine;
184818 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
184819
184820 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
184821 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
184822 ,p_balance_type_code => l_balance_type_code);
184823
184824 END IF;
184825
184826 -----------------------------------------------------------------------------------------
184827 -- 4262811 Multiperiod Accounting
184828 -----------------------------------------------------------------------------------------
184829 -- No MPA option is assigned.
184830
184831
184832 END IF;
184833 END IF;
184834 --
184835
184836 --
184837 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
184838 trace
184839 (p_msg => 'END of AcctLineType_426'
184840 ,p_level => C_LEVEL_PROCEDURE
184841 ,p_module => l_log_module);
184842 END IF;
184843 --
184844 EXCEPTION
184845 WHEN xla_exceptions_pkg.application_exception THEN
184846 RAISE;
184847 WHEN OTHERS THEN
184848 xla_exceptions_pkg.raise_message
184849 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_426');
184850 END AcctLineType_426;
184851 --
184852
184853 ---------------------------------------
184854 --
184855 -- PRIVATE FUNCTION
184856 -- AcctLineType_427
184857 --
184858 ---------------------------------------
184859 PROCEDURE AcctLineType_427 (
184860 p_application_id IN NUMBER
184861 ,p_event_id IN NUMBER
184862 ,p_calculate_acctd_flag IN VARCHAR2
184863 ,p_calculate_g_l_flag IN VARCHAR2
184864 ,p_actual_flag IN OUT VARCHAR2
184865 ,p_balance_type_code OUT VARCHAR2
184866 ,p_gain_or_loss_ref OUT VARCHAR2
184867
184868 --Inflation Adjustment Type Description
184869 , p_source_2 IN VARCHAR2
184870 --Accounting Date
184871 , p_source_3 IN DATE
184872 --Inflation Backlog Depreciation Reserve Ccid
184873 , p_source_38 IN NUMBER
184874 --Distribution Type Code
184875 , p_source_51 IN VARCHAR2
184876 --Asset Identifier
184877 , p_source_56 IN NUMBER
184878 --Period Counter
184879 , p_source_57 IN NUMBER
184880 --Distribution Identifier
184881 , p_source_58 IN NUMBER
184882 --Book Type Code
184883 , p_source_59 IN VARCHAR2
184884 --Depreciation Run Identifier
184885 , p_source_62 IN NUMBER
184886 --Inflation Adjustment Type
184887 , p_source_64 IN VARCHAR2
184888 --Inflation Entered Amount
184889 , p_source_65 IN NUMBER
184890 --Inflation Currency Code
184891 , p_source_66 IN VARCHAR2
184892 )
184893 IS
184894
184895 l_component_type VARCHAR2(80);
184896 l_component_code VARCHAR2(30);
184897 l_component_type_code VARCHAR2(1);
184898 l_component_appl_id INTEGER;
184899 l_amb_context_code VARCHAR2(30);
184900 l_entity_code VARCHAR2(30);
184901 l_event_class_code VARCHAR2(30);
184902 l_ae_header_id NUMBER;
184903 l_event_type_code VARCHAR2(30);
184904 l_line_definition_code VARCHAR2(30);
184905 l_line_definition_owner_code VARCHAR2(1);
184906 --
184907 -- adr variables
184908 l_segment VARCHAR2(30);
184909 l_ccid NUMBER;
184913 l_adr_flex_value_set_id NUMBER;
184910 l_adr_transaction_coa_id NUMBER;
184911 l_adr_accounting_coa_id NUMBER;
184912 l_adr_flexfield_segment_code VARCHAR2(30);
184914 l_adr_value_type_code VARCHAR2(30);
184915 l_adr_value_combination_id NUMBER;
184916 l_adr_value_segment_code VARCHAR2(30);
184917
184918 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
184919 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
184920 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
184921 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
184922
184923 -- 4262811 Variables ------------------------------------------------------------------------------------------
184924 l_entered_amt_idx NUMBER;
184925 l_accted_amt_idx NUMBER;
184926 l_acc_rev_flag VARCHAR2(1);
184927 l_accrual_line_num NUMBER;
184928 l_tmp_amt NUMBER;
184929 l_acc_rev_natural_side_code VARCHAR2(1);
184930
184931 l_num_entries NUMBER;
184932 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
184933 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
184934 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
184935 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
184936 l_recog_line_1 NUMBER;
184937 l_recog_line_2 NUMBER;
184938
184939 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
184940 l_bflow_applied_to_amt NUMBER; -- 5132302
184941 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
184942
184943 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
184944
184945 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
184946 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
184947
184948 ---------------------------------------------------------------------------------------------------------------
184949
184950
184951 --
184952 -- bulk performance
184953 --
184954 l_balance_type_code VARCHAR2(1);
184955 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
184956 l_log_module VARCHAR2(240);
184957
184958 --
184959 -- Upgrade strategy
184960 --
184961 l_actual_upg_option VARCHAR2(1);
184962 l_enc_upg_option VARCHAR2(1);
184963
184964 --
184965 BEGIN
184966 --
184967 IF g_log_enabled THEN
184968 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_427';
184969 END IF;
184970 --
184971 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
184972
184973 trace
184974 (p_msg => 'BEGIN of AcctLineType_427'
184975 ,p_level => C_LEVEL_PROCEDURE
184976 ,p_module => l_log_module);
184977
184978 END IF;
184979 --
184980 l_component_type := 'AMB_JLT';
184981 l_component_code := 'IAC_BACKLOG_RESERVE';
184982 l_component_type_code := 'S';
184983 l_component_appl_id := 140;
184984 l_amb_context_code := 'DEFAULT';
184985 l_entity_code := 'DEPRECIATION';
184986 l_event_class_code := 'DEPRECIATION';
184987 l_event_type_code := 'DEPRECIATION_ALL';
184988 l_line_definition_owner_code := 'S';
184989 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
184990 --
184991 l_balance_type_code := 'A';
184992 l_segment := NULL;
184993 l_ccid := NULL;
184994 l_adr_transaction_coa_id := NULL;
184995 l_adr_accounting_coa_id := NULL;
184996 l_adr_flexfield_segment_code := NULL;
184997 l_adr_flex_value_set_id := NULL;
184998 l_adr_value_type_code := NULL;
184999 l_adr_value_combination_id := NULL;
185000 l_adr_value_segment_code := NULL;
185001
185002 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
185003 l_bflow_class_code := ''; -- 4219869 Business Flow
185004 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
185005 l_budgetary_control_flag := 'N';
185006
185007 l_bflow_applied_to_amt_idx := NULL; -- 5132302
185008 l_bflow_applied_to_amt := NULL; -- 5132302
185009 l_entered_amt_idx := NULL; -- 4262811
185010 l_accted_amt_idx := NULL; -- 4262811
185011 l_acc_rev_flag := NULL; -- 4262811
185012 l_accrual_line_num := NULL; -- 4262811
185013 l_tmp_amt := NULL; -- 4262811
185014 --
185015
185016 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
185017 l_balance_type_code <> 'B' THEN
185018 IF NVL(p_source_64,'
185019 ') = 'BL RESERVE'
185020 THEN
185021
185022 --
185023 XLA_AE_LINES_PKG.SetNewLine;
185024
185025 p_balance_type_code := l_balance_type_code;
185026 -- set the flag so later we will know whether the gain loss line needs to be created
185027
185028 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
185029 p_actual_flag :='A';
185030 END IF;
185031
185032 --
185033 -- bulk performance
185034 --
185035 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
185036 p_header_num => 0); -- 4262811
185037 --
185041 p_natural_side_code => 'C'
185038 -- set accounting line options
185039 --
185040 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
185042 , p_gain_or_loss_flag => 'N'
185043 , p_gl_transfer_mode_code => 'S'
185044 , p_acct_entry_type_code => 'A'
185045 , p_switch_side_flag => 'Y'
185046 , p_merge_duplicate_code => 'N'
185047 );
185048 --
185049 l_acc_rev_natural_side_code := 'D'; -- 4262811
185050 --
185051 --
185052 -- set accounting line type info
185053 --
185054 xla_ae_lines_pkg.SetAcctLineType
185055 (p_component_type => l_component_type
185056 ,p_event_type_code => l_event_type_code
185057 ,p_line_definition_owner_code => l_line_definition_owner_code
185058 ,p_line_definition_code => l_line_definition_code
185059 ,p_accounting_line_code => l_component_code
185060 ,p_accounting_line_type_code => l_component_type_code
185061 ,p_accounting_line_appl_id => l_component_appl_id
185062 ,p_amb_context_code => l_amb_context_code
185063 ,p_entity_code => l_entity_code
185064 ,p_event_class_code => l_event_class_code);
185065 --
185066 -- set accounting class
185067 --
185068 xla_ae_lines_pkg.SetAcctClass(
185069 p_accounting_class_code => 'ASSET'
185070 , p_ae_header_id => l_ae_header_id
185071 );
185072
185073 --
185074 -- set rounding class
185075 --
185076 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
185077 'ASSET';
185078
185079 --
185080 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
185081 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
185082 --
185083 -- bulk performance
185084 --
185085 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
185086
185087 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
185088 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
185089
185090 -- 4955764
185091 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
185092 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
185093
185094 -- 4458381 Public Sector Enh
185095
185096 --
185097 -- set accounting attributes for the line type
185098 --
185099 l_entered_amt_idx := 7;
185100 l_accted_amt_idx := 9;
185101 l_bflow_applied_to_amt_idx := NULL; -- 5132302
185102 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
185103 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
185104 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
185105 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
185106 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
185107 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
185108 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
185109 l_rec_acct_attrs.array_char_value(4) := p_source_59;
185110 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
185111 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
185112 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
185113 l_rec_acct_attrs.array_char_value(6) := p_source_51;
185114 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
185115 l_rec_acct_attrs.array_num_value(7) := p_source_65;
185116 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
185117 l_rec_acct_attrs.array_char_value(8) := p_source_66;
185118 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
185119 l_rec_acct_attrs.array_num_value(9) := p_source_65;
185120
185121 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
185122 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
185123
185124 ---------------------------------------------------------------------------------------------------------------
185125 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
185126 ---------------------------------------------------------------------------------------------------------------
185127 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
185128
185129 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
185130 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
185131
185132 IF xla_accounting_cache_pkg.GetValueChar
185133 (p_source_code => 'LEDGER_CATEGORY_CODE'
185134 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
185135 AND l_bflow_method_code = 'PRIOR_ENTRY'
185136 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
185137 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
185138 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
185139 )
185140 THEN
185141 xla_ae_lines_pkg.BflowUpgEntry
185142 (p_business_method_code => l_bflow_method_code
185143 ,p_business_class_code => l_bflow_class_code
185144 ,p_balance_type => l_balance_type_code);
185148 END IF;
185145 ELSE
185146 NULL;
185147 -- No business flow processing for business flow method of NONE.
185149
185150 --
185151 -- call analytical criteria
185152 --
185153
185154 --
185155 -- call description
185156 --
185157
185158 xla_ae_lines_pkg.SetLineDescription(
185159 p_ae_header_id => l_ae_header_id
185160 ,p_description => Description_143 (
185161 p_application_id => p_application_id
185162 , p_ae_header_id => l_ae_header_id
185163 , p_source_2 => p_source_2
185164 , p_source_3 => p_source_3
185165 )
185166 );
185167
185168
185169 --
185170 -- call ADRs
185171 -- Bug 4922099
185172 --
185173 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
185174 (NVL(l_actual_upg_option, 'N') = 'O') OR
185175 (NVL(l_enc_upg_option, 'N') = 'O')
185176 )
185177 THEN
185178 NULL;
185179 --
185180 --
185181
185182 l_ccid := AcctDerRule_183(
185183 p_application_id => p_application_id
185184 , p_ae_header_id => l_ae_header_id
185185 , p_source_38 => p_source_38
185186 , x_transaction_coa_id => l_adr_transaction_coa_id
185187 , x_accounting_coa_id => l_adr_accounting_coa_id
185188 , x_value_type_code => l_adr_value_type_code
185189 , p_side => 'NA'
185190 );
185191
185192 xla_ae_lines_pkg.set_ccid(
185193 p_code_combination_id => l_ccid
185194 , p_value_type_code => l_adr_value_type_code
185195 , p_transaction_coa_id => l_adr_transaction_coa_id
185196 , p_accounting_coa_id => l_adr_accounting_coa_id
185197 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
185198 , p_adr_type_code => 'S'
185199 , p_component_type => l_component_type
185200 , p_component_code => l_component_code
185201 , p_component_type_code => l_component_type_code
185202 , p_component_appl_id => l_component_appl_id
185203 , p_amb_context_code => l_amb_context_code
185204 , p_side => 'NA'
185205 );
185206
185207
185208 --
185209 --
185210 END IF;
185211 --
185212 -- Bug 4922099
185213 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
185214 (NVL(l_enc_upg_option, 'N') = 'O')
185215 ) AND
185216 (l_bflow_method_code = 'PRIOR_ENTRY')
185217 )
185218 THEN
185219 IF
185220 --
185221 1 = 2
185222 --
185223 THEN
185224 xla_accounting_err_pkg.build_message
185225 (p_appli_s_name => 'XLA'
185226 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
185227 ,p_token_1 => 'LINE_NUMBER'
185228 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
185229 ,p_token_2 => 'LINE_TYPE_NAME'
185230 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
185231 l_component_type
185232 ,l_component_code
185233 ,l_component_type_code
185234 ,l_component_appl_id
185235 ,l_amb_context_code
185236 ,l_entity_code
185237 ,l_event_class_code
185238 )
185239 ,p_token_3 => 'OWNER'
185240 ,p_value_3 => xla_lookups_pkg.get_meaning(
185241 p_lookup_type => 'XLA_OWNER_TYPE'
185242 ,p_lookup_code => l_component_type_code
185243 )
185244 ,p_token_4 => 'PRODUCT_NAME'
185245 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
185246 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
185247 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
185248 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
185249 ,p_ae_header_id => NULL
185250 );
185251
185252 IF (C_LEVEL_ERROR>= g_log_level) THEN
185253 trace
185254 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
185255 ,p_level => C_LEVEL_ERROR
185256 ,p_module => l_log_module);
185257 END IF;
185258 END IF;
185259 END IF;
185260 --
185261 --
185265 -- Prior Entry. Currently, the following code is always generated.
185262 ------------------------------------------------------------------------------------------------
185263 -- 4219869 Business Flow
185264 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
185266 ------------------------------------------------------------------------------------------------
185267 XLA_AE_LINES_PKG.ValidateCurrentLine;
185268
185269 ------------------------------------------------------------------------------------
185270 -- 4219869 Business Flow
185271 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
185272 ------------------------------------------------------------------------------------
185273 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
185274
185275 ----------------------------------------------------------------------------------
185276 -- 4219869 Business Flow
185277 -- Update journal entry status -- Need to generate this within IF <condition>
185278 ----------------------------------------------------------------------------------
185279 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
185280 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
185281 ,p_balance_type_code => l_balance_type_code
185282 );
185283
185284 -------------------------------------------------------------------------------------------
185285 -- 4262811 - Generate the Accrual Reversal lines
185286 -------------------------------------------------------------------------------------------
185287 BEGIN
185288 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
185289 (g_array_event(p_event_id).array_value_num('header_index'));
185290 IF l_acc_rev_flag IS NULL THEN
185291 l_acc_rev_flag := 'N';
185292 END IF;
185293 EXCEPTION
185294 WHEN OTHERS THEN
185295 l_acc_rev_flag := 'N';
185296 END;
185297 --
185298 IF (l_acc_rev_flag = 'Y') THEN
185299
185300 -- 4645092 ------------------------------------------------------------------------------
185301 -- To allow MPA report to determine if it should generate report process
185302 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
185303 ------------------------------------------------------------------------------------------
185304
185305 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
185306 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
185307 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
185308 -- call ADRs
185309 -- Bug 4922099
185310 --
185311 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
185312 (NVL(l_actual_upg_option, 'N') = 'O') OR
185313 (NVL(l_enc_upg_option, 'N') = 'O')
185314 )
185315 THEN
185316 NULL;
185317 --
185318 --
185319
185320 l_ccid := AcctDerRule_183(
185321 p_application_id => p_application_id
185322 , p_ae_header_id => l_ae_header_id
185323 , p_source_38 => p_source_38
185324 , x_transaction_coa_id => l_adr_transaction_coa_id
185325 , x_accounting_coa_id => l_adr_accounting_coa_id
185326 , x_value_type_code => l_adr_value_type_code
185327 , p_side => 'NA'
185328 );
185329
185330 xla_ae_lines_pkg.set_ccid(
185331 p_code_combination_id => l_ccid
185332 , p_value_type_code => l_adr_value_type_code
185333 , p_transaction_coa_id => l_adr_transaction_coa_id
185334 , p_accounting_coa_id => l_adr_accounting_coa_id
185335 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
185336 , p_adr_type_code => 'S'
185337 , p_component_type => l_component_type
185338 , p_component_code => l_component_code
185339 , p_component_type_code => l_component_type_code
185340 , p_component_appl_id => l_component_appl_id
185341 , p_amb_context_code => l_amb_context_code
185342 , p_side => 'NA'
185343 );
185344
185345
185346 --
185347 --
185348 END IF;
185349
185350 --
185351 -- Update the line information that should be overwritten
185352 --
185353 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
185354 p_header_num => 1);
185355 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
185356
185357 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
185358
185359 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
185360 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
185361 END IF;
185362
185363 --
185364 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
185365 --
185366 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
185367 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
185368 ELSE
185369 ---------------------------------------------------------------------------------------------------
185370 -- 4262811a Switch Sign
185374 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
185371 ---------------------------------------------------------------------------------------------------
185372 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
185373 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
185375 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
185376 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
185377 -- 5132302
185378 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
185379 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
185380
185381 END IF;
185382
185383 -- 4955764
185384 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
185385 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
185386
185387
185388 XLA_AE_LINES_PKG.ValidateCurrentLine;
185389 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
185390
185391 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
185392 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
185393 ,p_balance_type_code => l_balance_type_code);
185394
185395 END IF;
185396
185397 -----------------------------------------------------------------------------------------
185398 -- 4262811 Multiperiod Accounting
185399 -----------------------------------------------------------------------------------------
185400 -- No MPA option is assigned.
185401
185402
185403 END IF;
185404 END IF;
185405 --
185406
185407 --
185408 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
185409 trace
185410 (p_msg => 'END of AcctLineType_427'
185411 ,p_level => C_LEVEL_PROCEDURE
185412 ,p_module => l_log_module);
185413 END IF;
185414 --
185415 EXCEPTION
185416 WHEN xla_exceptions_pkg.application_exception THEN
185417 RAISE;
185418 WHEN OTHERS THEN
185419 xla_exceptions_pkg.raise_message
185420 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_427');
185421 END AcctLineType_427;
185422 --
185423
185424 ---------------------------------------
185425 --
185426 -- PRIVATE FUNCTION
185427 -- AcctLineType_428
185428 --
185429 ---------------------------------------
185430 PROCEDURE AcctLineType_428 (
185431 p_application_id IN NUMBER
185432 ,p_event_id IN NUMBER
185433 ,p_calculate_acctd_flag IN VARCHAR2
185434 ,p_calculate_g_l_flag IN VARCHAR2
185435 ,p_actual_flag IN OUT VARCHAR2
185436 ,p_balance_type_code OUT VARCHAR2
185437 ,p_gain_or_loss_ref OUT VARCHAR2
185438
185439 --Inflation Adjustment Type Description
185440 , p_source_2 IN VARCHAR2
185441 --Accounting Date
185442 , p_source_3 IN DATE
185443 --Inflation Backlog Depreciation Reserve Ccid
185444 , p_source_38 IN NUMBER
185445 --Transaction Header Identifier
185446 , p_source_49 IN NUMBER
185447 --Adjustment Line Identifier
185448 , p_source_50 IN NUMBER
185449 --Distribution Type Code
185450 , p_source_51 IN VARCHAR2
185451 --Inflation Adjustment Type
185452 , p_source_64 IN VARCHAR2
185453 --Inflation Entered Amount
185454 , p_source_65 IN NUMBER
185455 --Inflation Currency Code
185456 , p_source_66 IN VARCHAR2
185457 )
185458 IS
185459
185460 l_component_type VARCHAR2(80);
185461 l_component_code VARCHAR2(30);
185462 l_component_type_code VARCHAR2(1);
185463 l_component_appl_id INTEGER;
185464 l_amb_context_code VARCHAR2(30);
185465 l_entity_code VARCHAR2(30);
185466 l_event_class_code VARCHAR2(30);
185467 l_ae_header_id NUMBER;
185468 l_event_type_code VARCHAR2(30);
185469 l_line_definition_code VARCHAR2(30);
185470 l_line_definition_owner_code VARCHAR2(1);
185471 --
185472 -- adr variables
185473 l_segment VARCHAR2(30);
185474 l_ccid NUMBER;
185475 l_adr_transaction_coa_id NUMBER;
185476 l_adr_accounting_coa_id NUMBER;
185477 l_adr_flexfield_segment_code VARCHAR2(30);
185478 l_adr_flex_value_set_id NUMBER;
185479 l_adr_value_type_code VARCHAR2(30);
185480 l_adr_value_combination_id NUMBER;
185481 l_adr_value_segment_code VARCHAR2(30);
185482
185483 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
185484 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
185485 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
185486 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
185487
185488 -- 4262811 Variables ------------------------------------------------------------------------------------------
185489 l_entered_amt_idx NUMBER;
185490 l_accted_amt_idx NUMBER;
185491 l_acc_rev_flag VARCHAR2(1);
185492 l_accrual_line_num NUMBER;
185493 l_tmp_amt NUMBER;
185494 l_acc_rev_natural_side_code VARCHAR2(1);
185495
185496 l_num_entries NUMBER;
185500 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
185497 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
185498 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
185499 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
185501 l_recog_line_1 NUMBER;
185502 l_recog_line_2 NUMBER;
185503
185504 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
185505 l_bflow_applied_to_amt NUMBER; -- 5132302
185506 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
185507
185508 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
185509
185510 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
185511 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
185512
185513 ---------------------------------------------------------------------------------------------------------------
185514
185515
185516 --
185517 -- bulk performance
185518 --
185519 l_balance_type_code VARCHAR2(1);
185520 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
185521 l_log_module VARCHAR2(240);
185522
185523 --
185524 -- Upgrade strategy
185525 --
185526 l_actual_upg_option VARCHAR2(1);
185527 l_enc_upg_option VARCHAR2(1);
185528
185529 --
185530 BEGIN
185531 --
185532 IF g_log_enabled THEN
185533 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_428';
185534 END IF;
185535 --
185536 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
185537
185538 trace
185539 (p_msg => 'BEGIN of AcctLineType_428'
185540 ,p_level => C_LEVEL_PROCEDURE
185541 ,p_module => l_log_module);
185542
185543 END IF;
185544 --
185545 l_component_type := 'AMB_JLT';
185546 l_component_code := 'IAC_BACKLOG_RESERVE';
185547 l_component_type_code := 'S';
185548 l_component_appl_id := 140;
185549 l_amb_context_code := 'DEFAULT';
185550 l_entity_code := 'TRANSACTIONS';
185551 l_event_class_code := 'RETIREMENTS';
185552 l_event_type_code := 'RETIREMENTS';
185553 l_line_definition_owner_code := 'S';
185554 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
185555 --
185556 l_balance_type_code := 'A';
185557 l_segment := NULL;
185558 l_ccid := NULL;
185559 l_adr_transaction_coa_id := NULL;
185560 l_adr_accounting_coa_id := NULL;
185561 l_adr_flexfield_segment_code := NULL;
185562 l_adr_flex_value_set_id := NULL;
185563 l_adr_value_type_code := NULL;
185564 l_adr_value_combination_id := NULL;
185565 l_adr_value_segment_code := NULL;
185566
185567 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
185568 l_bflow_class_code := ''; -- 4219869 Business Flow
185569 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
185570 l_budgetary_control_flag := 'N';
185571
185572 l_bflow_applied_to_amt_idx := NULL; -- 5132302
185573 l_bflow_applied_to_amt := NULL; -- 5132302
185574 l_entered_amt_idx := NULL; -- 4262811
185575 l_accted_amt_idx := NULL; -- 4262811
185576 l_acc_rev_flag := NULL; -- 4262811
185577 l_accrual_line_num := NULL; -- 4262811
185578 l_tmp_amt := NULL; -- 4262811
185579 --
185580
185581 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
185582 l_balance_type_code <> 'B' THEN
185583 IF NVL(p_source_64,'
185584 ') = 'BL RESERVE'
185585 THEN
185586
185587 --
185588 XLA_AE_LINES_PKG.SetNewLine;
185589
185590 p_balance_type_code := l_balance_type_code;
185591 -- set the flag so later we will know whether the gain loss line needs to be created
185592
185593 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
185594 p_actual_flag :='A';
185595 END IF;
185596
185597 --
185598 -- bulk performance
185599 --
185600 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
185601 p_header_num => 0); -- 4262811
185602 --
185603 -- set accounting line options
185604 --
185605 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
185606 p_natural_side_code => 'C'
185607 , p_gain_or_loss_flag => 'N'
185608 , p_gl_transfer_mode_code => 'S'
185609 , p_acct_entry_type_code => 'A'
185610 , p_switch_side_flag => 'Y'
185611 , p_merge_duplicate_code => 'N'
185612 );
185613 --
185614 l_acc_rev_natural_side_code := 'D'; -- 4262811
185615 --
185616 --
185617 -- set accounting line type info
185618 --
185619 xla_ae_lines_pkg.SetAcctLineType
185620 (p_component_type => l_component_type
185621 ,p_event_type_code => l_event_type_code
185622 ,p_line_definition_owner_code => l_line_definition_owner_code
185623 ,p_line_definition_code => l_line_definition_code
185624 ,p_accounting_line_code => l_component_code
185625 ,p_accounting_line_type_code => l_component_type_code
185626 ,p_accounting_line_appl_id => l_component_appl_id
185630 --
185627 ,p_amb_context_code => l_amb_context_code
185628 ,p_entity_code => l_entity_code
185629 ,p_event_class_code => l_event_class_code);
185631 -- set accounting class
185632 --
185633 xla_ae_lines_pkg.SetAcctClass(
185634 p_accounting_class_code => 'ASSET'
185635 , p_ae_header_id => l_ae_header_id
185636 );
185637
185638 --
185639 -- set rounding class
185640 --
185641 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
185642 'ASSET';
185643
185644 --
185645 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
185646 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
185647 --
185648 -- bulk performance
185649 --
185650 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
185651
185652 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
185653 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
185654
185655 -- 4955764
185656 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
185657 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
185658
185659 -- 4458381 Public Sector Enh
185660
185661 --
185662 -- set accounting attributes for the line type
185663 --
185664 l_entered_amt_idx := 4;
185665 l_accted_amt_idx := 6;
185666 l_bflow_applied_to_amt_idx := NULL; -- 5132302
185667 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
185668 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
185669 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
185670 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
185671 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
185672 l_rec_acct_attrs.array_char_value(3) := p_source_51;
185673 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
185674 l_rec_acct_attrs.array_num_value(4) := p_source_65;
185675 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
185676 l_rec_acct_attrs.array_char_value(5) := p_source_66;
185677 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
185678 l_rec_acct_attrs.array_num_value(6) := p_source_65;
185679
185680 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
185681 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
185682
185683 ---------------------------------------------------------------------------------------------------------------
185684 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
185685 ---------------------------------------------------------------------------------------------------------------
185686 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
185687
185688 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
185689 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
185690
185691 IF xla_accounting_cache_pkg.GetValueChar
185692 (p_source_code => 'LEDGER_CATEGORY_CODE'
185693 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
185694 AND l_bflow_method_code = 'PRIOR_ENTRY'
185695 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
185696 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
185697 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
185698 )
185699 THEN
185700 xla_ae_lines_pkg.BflowUpgEntry
185701 (p_business_method_code => l_bflow_method_code
185702 ,p_business_class_code => l_bflow_class_code
185703 ,p_balance_type => l_balance_type_code);
185704 ELSE
185705 NULL;
185706 -- No business flow processing for business flow method of NONE.
185707 END IF;
185708
185709 --
185710 -- call analytical criteria
185711 --
185712
185713 --
185714 -- call description
185715 --
185716
185717 xla_ae_lines_pkg.SetLineDescription(
185718 p_ae_header_id => l_ae_header_id
185719 ,p_description => Description_143 (
185720 p_application_id => p_application_id
185721 , p_ae_header_id => l_ae_header_id
185722 , p_source_2 => p_source_2
185723 , p_source_3 => p_source_3
185724 )
185725 );
185726
185727
185728 --
185729 -- call ADRs
185730 -- Bug 4922099
185731 --
185732 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
185733 (NVL(l_actual_upg_option, 'N') = 'O') OR
185734 (NVL(l_enc_upg_option, 'N') = 'O')
185735 )
185736 THEN
185737 NULL;
185738 --
185739 --
185740
185741 l_ccid := AcctDerRule_183(
185742 p_application_id => p_application_id
185743 , p_ae_header_id => l_ae_header_id
185744 , p_source_38 => p_source_38
185745 , x_transaction_coa_id => l_adr_transaction_coa_id
185746 , x_accounting_coa_id => l_adr_accounting_coa_id
185747 , x_value_type_code => l_adr_value_type_code
185748 , p_side => 'NA'
185749 );
185750
185754 , p_transaction_coa_id => l_adr_transaction_coa_id
185751 xla_ae_lines_pkg.set_ccid(
185752 p_code_combination_id => l_ccid
185753 , p_value_type_code => l_adr_value_type_code
185755 , p_accounting_coa_id => l_adr_accounting_coa_id
185756 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
185757 , p_adr_type_code => 'S'
185758 , p_component_type => l_component_type
185759 , p_component_code => l_component_code
185760 , p_component_type_code => l_component_type_code
185761 , p_component_appl_id => l_component_appl_id
185762 , p_amb_context_code => l_amb_context_code
185763 , p_side => 'NA'
185764 );
185765
185766
185767 --
185768 --
185769 END IF;
185770 --
185771 -- Bug 4922099
185772 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
185773 (NVL(l_enc_upg_option, 'N') = 'O')
185774 ) AND
185775 (l_bflow_method_code = 'PRIOR_ENTRY')
185776 )
185777 THEN
185778 IF
185779 --
185780 1 = 2
185781 --
185782 THEN
185783 xla_accounting_err_pkg.build_message
185784 (p_appli_s_name => 'XLA'
185785 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
185786 ,p_token_1 => 'LINE_NUMBER'
185787 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
185788 ,p_token_2 => 'LINE_TYPE_NAME'
185789 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
185790 l_component_type
185791 ,l_component_code
185792 ,l_component_type_code
185793 ,l_component_appl_id
185794 ,l_amb_context_code
185795 ,l_entity_code
185796 ,l_event_class_code
185797 )
185798 ,p_token_3 => 'OWNER'
185799 ,p_value_3 => xla_lookups_pkg.get_meaning(
185800 p_lookup_type => 'XLA_OWNER_TYPE'
185801 ,p_lookup_code => l_component_type_code
185802 )
185803 ,p_token_4 => 'PRODUCT_NAME'
185804 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
185805 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
185806 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
185807 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
185808 ,p_ae_header_id => NULL
185809 );
185810
185811 IF (C_LEVEL_ERROR>= g_log_level) THEN
185812 trace
185813 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
185814 ,p_level => C_LEVEL_ERROR
185815 ,p_module => l_log_module);
185816 END IF;
185817 END IF;
185818 END IF;
185819 --
185820 --
185821 ------------------------------------------------------------------------------------------------
185822 -- 4219869 Business Flow
185823 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
185824 -- Prior Entry. Currently, the following code is always generated.
185825 ------------------------------------------------------------------------------------------------
185826 XLA_AE_LINES_PKG.ValidateCurrentLine;
185827
185828 ------------------------------------------------------------------------------------
185829 -- 4219869 Business Flow
185830 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
185831 ------------------------------------------------------------------------------------
185832 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
185833
185834 ----------------------------------------------------------------------------------
185835 -- 4219869 Business Flow
185836 -- Update journal entry status -- Need to generate this within IF <condition>
185837 ----------------------------------------------------------------------------------
185838 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
185839 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
185840 ,p_balance_type_code => l_balance_type_code
185841 );
185842
185843 -------------------------------------------------------------------------------------------
185844 -- 4262811 - Generate the Accrual Reversal lines
185845 -------------------------------------------------------------------------------------------
185849 IF l_acc_rev_flag IS NULL THEN
185846 BEGIN
185847 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
185848 (g_array_event(p_event_id).array_value_num('header_index'));
185850 l_acc_rev_flag := 'N';
185851 END IF;
185852 EXCEPTION
185853 WHEN OTHERS THEN
185854 l_acc_rev_flag := 'N';
185855 END;
185856 --
185857 IF (l_acc_rev_flag = 'Y') THEN
185858
185859 -- 4645092 ------------------------------------------------------------------------------
185860 -- To allow MPA report to determine if it should generate report process
185861 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
185862 ------------------------------------------------------------------------------------------
185863
185864 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
185865 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
185866 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
185867 -- call ADRs
185868 -- Bug 4922099
185869 --
185870 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
185871 (NVL(l_actual_upg_option, 'N') = 'O') OR
185872 (NVL(l_enc_upg_option, 'N') = 'O')
185873 )
185874 THEN
185875 NULL;
185876 --
185877 --
185878
185879 l_ccid := AcctDerRule_183(
185880 p_application_id => p_application_id
185881 , p_ae_header_id => l_ae_header_id
185882 , p_source_38 => p_source_38
185883 , x_transaction_coa_id => l_adr_transaction_coa_id
185884 , x_accounting_coa_id => l_adr_accounting_coa_id
185885 , x_value_type_code => l_adr_value_type_code
185886 , p_side => 'NA'
185887 );
185888
185889 xla_ae_lines_pkg.set_ccid(
185890 p_code_combination_id => l_ccid
185891 , p_value_type_code => l_adr_value_type_code
185892 , p_transaction_coa_id => l_adr_transaction_coa_id
185893 , p_accounting_coa_id => l_adr_accounting_coa_id
185894 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
185895 , p_adr_type_code => 'S'
185896 , p_component_type => l_component_type
185897 , p_component_code => l_component_code
185898 , p_component_type_code => l_component_type_code
185899 , p_component_appl_id => l_component_appl_id
185900 , p_amb_context_code => l_amb_context_code
185901 , p_side => 'NA'
185902 );
185903
185904
185905 --
185906 --
185907 END IF;
185908
185909 --
185910 -- Update the line information that should be overwritten
185911 --
185912 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
185913 p_header_num => 1);
185914 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
185915
185916 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
185917
185918 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
185919 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
185920 END IF;
185921
185922 --
185923 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
185924 --
185925 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
185926 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
185927 ELSE
185928 ---------------------------------------------------------------------------------------------------
185929 -- 4262811a Switch Sign
185930 ---------------------------------------------------------------------------------------------------
185931 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
185932 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
185933 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
185934 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
185935 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
185936 -- 5132302
185937 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
185938 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
185939
185940 END IF;
185941
185942 -- 4955764
185943 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
185944 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
185945
185946
185947 XLA_AE_LINES_PKG.ValidateCurrentLine;
185948 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
185949
185950 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
185951 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
185952 ,p_balance_type_code => l_balance_type_code);
185953
185954 END IF;
185955
185956 -----------------------------------------------------------------------------------------
185957 -- 4262811 Multiperiod Accounting
185961
185958 -----------------------------------------------------------------------------------------
185959 -- No MPA option is assigned.
185960
185962 END IF;
185963 END IF;
185964 --
185965
185966 --
185967 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
185968 trace
185969 (p_msg => 'END of AcctLineType_428'
185970 ,p_level => C_LEVEL_PROCEDURE
185971 ,p_module => l_log_module);
185972 END IF;
185973 --
185974 EXCEPTION
185975 WHEN xla_exceptions_pkg.application_exception THEN
185976 RAISE;
185977 WHEN OTHERS THEN
185978 xla_exceptions_pkg.raise_message
185979 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_428');
185980 END AcctLineType_428;
185981 --
185982
185983 ---------------------------------------
185984 --
185985 -- PRIVATE FUNCTION
185986 -- AcctLineType_429
185987 --
185988 ---------------------------------------
185989 PROCEDURE AcctLineType_429 (
185990 p_application_id IN NUMBER
185991 ,p_event_id IN NUMBER
185992 ,p_calculate_acctd_flag IN VARCHAR2
185993 ,p_calculate_g_l_flag IN VARCHAR2
185994 ,p_actual_flag IN OUT VARCHAR2
185995 ,p_balance_type_code OUT VARCHAR2
185996 ,p_gain_or_loss_ref OUT VARCHAR2
185997
185998 --Inflation Adjustment Type Description
185999 , p_source_2 IN VARCHAR2
186000 --Accounting Date
186001 , p_source_3 IN DATE
186002 --Inflation Backlog Depreciation Reserve Ccid
186003 , p_source_38 IN NUMBER
186004 --Transaction Header Identifier
186005 , p_source_49 IN NUMBER
186006 --Adjustment Line Identifier
186007 , p_source_50 IN NUMBER
186008 --Distribution Type Code
186009 , p_source_51 IN VARCHAR2
186010 --Inflation Adjustment Type
186011 , p_source_64 IN VARCHAR2
186012 --Inflation Entered Amount
186013 , p_source_65 IN NUMBER
186014 --Inflation Currency Code
186015 , p_source_66 IN VARCHAR2
186016 )
186017 IS
186018
186019 l_component_type VARCHAR2(80);
186020 l_component_code VARCHAR2(30);
186021 l_component_type_code VARCHAR2(1);
186022 l_component_appl_id INTEGER;
186023 l_amb_context_code VARCHAR2(30);
186024 l_entity_code VARCHAR2(30);
186025 l_event_class_code VARCHAR2(30);
186026 l_ae_header_id NUMBER;
186027 l_event_type_code VARCHAR2(30);
186028 l_line_definition_code VARCHAR2(30);
186029 l_line_definition_owner_code VARCHAR2(1);
186030 --
186031 -- adr variables
186032 l_segment VARCHAR2(30);
186033 l_ccid NUMBER;
186034 l_adr_transaction_coa_id NUMBER;
186035 l_adr_accounting_coa_id NUMBER;
186036 l_adr_flexfield_segment_code VARCHAR2(30);
186037 l_adr_flex_value_set_id NUMBER;
186038 l_adr_value_type_code VARCHAR2(30);
186039 l_adr_value_combination_id NUMBER;
186040 l_adr_value_segment_code VARCHAR2(30);
186041
186042 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
186043 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
186044 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
186045 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
186046
186047 -- 4262811 Variables ------------------------------------------------------------------------------------------
186048 l_entered_amt_idx NUMBER;
186049 l_accted_amt_idx NUMBER;
186050 l_acc_rev_flag VARCHAR2(1);
186051 l_accrual_line_num NUMBER;
186052 l_tmp_amt NUMBER;
186053 l_acc_rev_natural_side_code VARCHAR2(1);
186054
186055 l_num_entries NUMBER;
186056 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
186057 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
186058 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
186059 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
186060 l_recog_line_1 NUMBER;
186061 l_recog_line_2 NUMBER;
186062
186063 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
186064 l_bflow_applied_to_amt NUMBER; -- 5132302
186065 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
186066
186067 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
186068
186069 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
186070 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
186071
186072 ---------------------------------------------------------------------------------------------------------------
186073
186074
186075 --
186076 -- bulk performance
186077 --
186078 l_balance_type_code VARCHAR2(1);
186079 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
186080 l_log_module VARCHAR2(240);
186081
186082 --
186083 -- Upgrade strategy
186084 --
186085 l_actual_upg_option VARCHAR2(1);
186086 l_enc_upg_option VARCHAR2(1);
186087
186088 --
186089 BEGIN
186090 --
186091 IF g_log_enabled THEN
186092 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_429';
186093 END IF;
186094 --
186098 (p_msg => 'BEGIN of AcctLineType_429'
186095 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
186096
186097 trace
186099 ,p_level => C_LEVEL_PROCEDURE
186100 ,p_module => l_log_module);
186101
186102 END IF;
186103 --
186104 l_component_type := 'AMB_JLT';
186105 l_component_code := 'IAC_BACKLOG_RESERVE';
186106 l_component_type_code := 'S';
186107 l_component_appl_id := 140;
186108 l_amb_context_code := 'DEFAULT';
186109 l_entity_code := 'TRANSACTIONS';
186110 l_event_class_code := 'ADDITIONS';
186111 l_event_type_code := 'ADDITIONS_ALL';
186112 l_line_definition_owner_code := 'S';
186113 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
186114 --
186115 l_balance_type_code := 'A';
186116 l_segment := NULL;
186117 l_ccid := NULL;
186118 l_adr_transaction_coa_id := NULL;
186119 l_adr_accounting_coa_id := NULL;
186120 l_adr_flexfield_segment_code := NULL;
186121 l_adr_flex_value_set_id := NULL;
186122 l_adr_value_type_code := NULL;
186123 l_adr_value_combination_id := NULL;
186124 l_adr_value_segment_code := NULL;
186125
186126 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
186127 l_bflow_class_code := ''; -- 4219869 Business Flow
186128 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
186129 l_budgetary_control_flag := 'N';
186130
186131 l_bflow_applied_to_amt_idx := NULL; -- 5132302
186132 l_bflow_applied_to_amt := NULL; -- 5132302
186133 l_entered_amt_idx := NULL; -- 4262811
186134 l_accted_amt_idx := NULL; -- 4262811
186135 l_acc_rev_flag := NULL; -- 4262811
186136 l_accrual_line_num := NULL; -- 4262811
186137 l_tmp_amt := NULL; -- 4262811
186138 --
186139
186140 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
186141 l_balance_type_code <> 'B' THEN
186142 IF NVL(p_source_64,'
186143 ') = 'BL RESERVE'
186144 THEN
186145
186146 --
186147 XLA_AE_LINES_PKG.SetNewLine;
186148
186149 p_balance_type_code := l_balance_type_code;
186150 -- set the flag so later we will know whether the gain loss line needs to be created
186151
186152 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
186153 p_actual_flag :='A';
186154 END IF;
186155
186156 --
186157 -- bulk performance
186158 --
186159 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
186160 p_header_num => 0); -- 4262811
186161 --
186162 -- set accounting line options
186163 --
186164 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
186165 p_natural_side_code => 'C'
186166 , p_gain_or_loss_flag => 'N'
186167 , p_gl_transfer_mode_code => 'S'
186168 , p_acct_entry_type_code => 'A'
186169 , p_switch_side_flag => 'Y'
186170 , p_merge_duplicate_code => 'N'
186171 );
186172 --
186173 l_acc_rev_natural_side_code := 'D'; -- 4262811
186174 --
186175 --
186176 -- set accounting line type info
186177 --
186178 xla_ae_lines_pkg.SetAcctLineType
186179 (p_component_type => l_component_type
186180 ,p_event_type_code => l_event_type_code
186181 ,p_line_definition_owner_code => l_line_definition_owner_code
186182 ,p_line_definition_code => l_line_definition_code
186183 ,p_accounting_line_code => l_component_code
186184 ,p_accounting_line_type_code => l_component_type_code
186185 ,p_accounting_line_appl_id => l_component_appl_id
186186 ,p_amb_context_code => l_amb_context_code
186187 ,p_entity_code => l_entity_code
186188 ,p_event_class_code => l_event_class_code);
186189 --
186190 -- set accounting class
186191 --
186192 xla_ae_lines_pkg.SetAcctClass(
186193 p_accounting_class_code => 'ASSET'
186194 , p_ae_header_id => l_ae_header_id
186195 );
186196
186197 --
186198 -- set rounding class
186199 --
186200 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
186201 'ASSET';
186202
186203 --
186204 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
186205 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
186206 --
186207 -- bulk performance
186208 --
186209 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
186210
186211 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
186212 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
186213
186214 -- 4955764
186215 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
186216 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
186217
186218 -- 4458381 Public Sector Enh
186219
186220 --
186221 -- set accounting attributes for the line type
186222 --
186223 l_entered_amt_idx := 4;
186224 l_accted_amt_idx := 6;
186228 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
186225 l_bflow_applied_to_amt_idx := NULL; -- 5132302
186226 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
186227 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
186229 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
186230 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
186231 l_rec_acct_attrs.array_char_value(3) := p_source_51;
186232 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
186233 l_rec_acct_attrs.array_num_value(4) := p_source_65;
186234 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
186235 l_rec_acct_attrs.array_char_value(5) := p_source_66;
186236 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
186237 l_rec_acct_attrs.array_num_value(6) := p_source_65;
186238
186239 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
186240 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
186241
186242 ---------------------------------------------------------------------------------------------------------------
186243 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
186244 ---------------------------------------------------------------------------------------------------------------
186245 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
186246
186247 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
186248 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
186249
186250 IF xla_accounting_cache_pkg.GetValueChar
186251 (p_source_code => 'LEDGER_CATEGORY_CODE'
186252 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
186253 AND l_bflow_method_code = 'PRIOR_ENTRY'
186254 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
186255 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
186256 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
186257 )
186258 THEN
186259 xla_ae_lines_pkg.BflowUpgEntry
186260 (p_business_method_code => l_bflow_method_code
186261 ,p_business_class_code => l_bflow_class_code
186262 ,p_balance_type => l_balance_type_code);
186263 ELSE
186264 NULL;
186265 -- No business flow processing for business flow method of NONE.
186266 END IF;
186267
186268 --
186269 -- call analytical criteria
186270 --
186271
186272 --
186273 -- call description
186274 --
186275
186276 xla_ae_lines_pkg.SetLineDescription(
186277 p_ae_header_id => l_ae_header_id
186278 ,p_description => Description_143 (
186279 p_application_id => p_application_id
186280 , p_ae_header_id => l_ae_header_id
186281 , p_source_2 => p_source_2
186282 , p_source_3 => p_source_3
186283 )
186284 );
186285
186286
186287 --
186288 -- call ADRs
186289 -- Bug 4922099
186290 --
186291 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
186292 (NVL(l_actual_upg_option, 'N') = 'O') OR
186293 (NVL(l_enc_upg_option, 'N') = 'O')
186294 )
186295 THEN
186296 NULL;
186297 --
186298 --
186299
186300 l_ccid := AcctDerRule_183(
186301 p_application_id => p_application_id
186302 , p_ae_header_id => l_ae_header_id
186303 , p_source_38 => p_source_38
186304 , x_transaction_coa_id => l_adr_transaction_coa_id
186305 , x_accounting_coa_id => l_adr_accounting_coa_id
186306 , x_value_type_code => l_adr_value_type_code
186307 , p_side => 'NA'
186308 );
186309
186310 xla_ae_lines_pkg.set_ccid(
186311 p_code_combination_id => l_ccid
186312 , p_value_type_code => l_adr_value_type_code
186313 , p_transaction_coa_id => l_adr_transaction_coa_id
186314 , p_accounting_coa_id => l_adr_accounting_coa_id
186315 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
186316 , p_adr_type_code => 'S'
186317 , p_component_type => l_component_type
186318 , p_component_code => l_component_code
186319 , p_component_type_code => l_component_type_code
186320 , p_component_appl_id => l_component_appl_id
186321 , p_amb_context_code => l_amb_context_code
186322 , p_side => 'NA'
186323 );
186324
186325
186326 --
186327 --
186328 END IF;
186329 --
186330 -- Bug 4922099
186331 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
186332 (NVL(l_enc_upg_option, 'N') = 'O')
186333 ) AND
186334 (l_bflow_method_code = 'PRIOR_ENTRY')
186335 )
186336 THEN
186337 IF
186338 --
186339 1 = 2
186340 --
186341 THEN
186342 xla_accounting_err_pkg.build_message
186343 (p_appli_s_name => 'XLA'
186344 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
186345 ,p_token_1 => 'LINE_NUMBER'
186346 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
186350 ,l_component_code
186347 ,p_token_2 => 'LINE_TYPE_NAME'
186348 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
186349 l_component_type
186351 ,l_component_type_code
186352 ,l_component_appl_id
186353 ,l_amb_context_code
186354 ,l_entity_code
186355 ,l_event_class_code
186356 )
186357 ,p_token_3 => 'OWNER'
186358 ,p_value_3 => xla_lookups_pkg.get_meaning(
186359 p_lookup_type => 'XLA_OWNER_TYPE'
186360 ,p_lookup_code => l_component_type_code
186361 )
186362 ,p_token_4 => 'PRODUCT_NAME'
186363 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
186364 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
186365 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
186366 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
186367 ,p_ae_header_id => NULL
186368 );
186369
186370 IF (C_LEVEL_ERROR>= g_log_level) THEN
186371 trace
186372 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
186373 ,p_level => C_LEVEL_ERROR
186374 ,p_module => l_log_module);
186375 END IF;
186376 END IF;
186377 END IF;
186378 --
186379 --
186380 ------------------------------------------------------------------------------------------------
186381 -- 4219869 Business Flow
186382 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
186383 -- Prior Entry. Currently, the following code is always generated.
186384 ------------------------------------------------------------------------------------------------
186385 XLA_AE_LINES_PKG.ValidateCurrentLine;
186386
186387 ------------------------------------------------------------------------------------
186388 -- 4219869 Business Flow
186389 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
186390 ------------------------------------------------------------------------------------
186391 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
186392
186393 ----------------------------------------------------------------------------------
186394 -- 4219869 Business Flow
186395 -- Update journal entry status -- Need to generate this within IF <condition>
186396 ----------------------------------------------------------------------------------
186397 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
186398 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
186399 ,p_balance_type_code => l_balance_type_code
186400 );
186401
186402 -------------------------------------------------------------------------------------------
186403 -- 4262811 - Generate the Accrual Reversal lines
186404 -------------------------------------------------------------------------------------------
186405 BEGIN
186406 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
186407 (g_array_event(p_event_id).array_value_num('header_index'));
186408 IF l_acc_rev_flag IS NULL THEN
186409 l_acc_rev_flag := 'N';
186410 END IF;
186411 EXCEPTION
186412 WHEN OTHERS THEN
186413 l_acc_rev_flag := 'N';
186414 END;
186415 --
186416 IF (l_acc_rev_flag = 'Y') THEN
186417
186418 -- 4645092 ------------------------------------------------------------------------------
186419 -- To allow MPA report to determine if it should generate report process
186420 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
186421 ------------------------------------------------------------------------------------------
186422
186423 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
186424 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
186425 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
186426 -- call ADRs
186427 -- Bug 4922099
186428 --
186429 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
186430 (NVL(l_actual_upg_option, 'N') = 'O') OR
186431 (NVL(l_enc_upg_option, 'N') = 'O')
186432 )
186433 THEN
186434 NULL;
186435 --
186436 --
186437
186438 l_ccid := AcctDerRule_183(
186439 p_application_id => p_application_id
186440 , p_ae_header_id => l_ae_header_id
186441 , p_source_38 => p_source_38
186445 , p_side => 'NA'
186442 , x_transaction_coa_id => l_adr_transaction_coa_id
186443 , x_accounting_coa_id => l_adr_accounting_coa_id
186444 , x_value_type_code => l_adr_value_type_code
186446 );
186447
186448 xla_ae_lines_pkg.set_ccid(
186449 p_code_combination_id => l_ccid
186450 , p_value_type_code => l_adr_value_type_code
186451 , p_transaction_coa_id => l_adr_transaction_coa_id
186452 , p_accounting_coa_id => l_adr_accounting_coa_id
186453 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
186454 , p_adr_type_code => 'S'
186455 , p_component_type => l_component_type
186456 , p_component_code => l_component_code
186457 , p_component_type_code => l_component_type_code
186458 , p_component_appl_id => l_component_appl_id
186459 , p_amb_context_code => l_amb_context_code
186460 , p_side => 'NA'
186461 );
186462
186463
186464 --
186465 --
186466 END IF;
186467
186468 --
186469 -- Update the line information that should be overwritten
186470 --
186471 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
186472 p_header_num => 1);
186473 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
186474
186475 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
186476
186477 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
186478 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
186479 END IF;
186480
186481 --
186482 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
186483 --
186484 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
186485 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
186486 ELSE
186487 ---------------------------------------------------------------------------------------------------
186488 -- 4262811a Switch Sign
186489 ---------------------------------------------------------------------------------------------------
186490 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
186491 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
186492 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
186493 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
186494 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
186495 -- 5132302
186496 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
186497 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
186498
186499 END IF;
186500
186501 -- 4955764
186502 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
186503 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
186504
186505
186506 XLA_AE_LINES_PKG.ValidateCurrentLine;
186507 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
186508
186509 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
186510 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
186511 ,p_balance_type_code => l_balance_type_code);
186512
186513 END IF;
186514
186515 -----------------------------------------------------------------------------------------
186516 -- 4262811 Multiperiod Accounting
186517 -----------------------------------------------------------------------------------------
186518 -- No MPA option is assigned.
186519
186520
186521 END IF;
186522 END IF;
186523 --
186524
186525 --
186526 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
186527 trace
186528 (p_msg => 'END of AcctLineType_429'
186529 ,p_level => C_LEVEL_PROCEDURE
186530 ,p_module => l_log_module);
186531 END IF;
186532 --
186533 EXCEPTION
186534 WHEN xla_exceptions_pkg.application_exception THEN
186535 RAISE;
186536 WHEN OTHERS THEN
186537 xla_exceptions_pkg.raise_message
186538 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_429');
186539 END AcctLineType_429;
186540 --
186541
186542 ---------------------------------------
186543 --
186544 -- PRIVATE FUNCTION
186545 -- AcctLineType_430
186546 --
186547 ---------------------------------------
186548 PROCEDURE AcctLineType_430 (
186549 p_application_id IN NUMBER
186550 ,p_event_id IN NUMBER
186551 ,p_calculate_acctd_flag IN VARCHAR2
186552 ,p_calculate_g_l_flag IN VARCHAR2
186553 ,p_actual_flag IN OUT VARCHAR2
186554 ,p_balance_type_code OUT VARCHAR2
186555 ,p_gain_or_loss_ref OUT VARCHAR2
186556
186557 --Inflation Adjustment Type Description
186558 , p_source_2 IN VARCHAR2
186559 --Accounting Date
186560 , p_source_3 IN DATE
186561 --Inflation Backlog Depreciation Reserve Ccid
186565 --Inflation Adjustment Type
186562 , p_source_38 IN NUMBER
186563 --Distribution Type Code
186564 , p_source_51 IN VARCHAR2
186566 , p_source_64 IN VARCHAR2
186567 --Inflation Entered Amount
186568 , p_source_65 IN NUMBER
186569 --Inflation Currency Code
186570 , p_source_66 IN VARCHAR2
186571 --Inflation Adjustment Identifier
186572 , p_source_67 IN NUMBER
186573 --Inflation Asset Identifier
186574 , p_source_68 IN NUMBER
186575 --Inflation Asset Distribution Identifier
186576 , p_source_69 IN NUMBER
186577 --Inflation Adjustment Line Identifier
186578 , p_source_70 IN NUMBER
186579 )
186580 IS
186581
186582 l_component_type VARCHAR2(80);
186583 l_component_code VARCHAR2(30);
186584 l_component_type_code VARCHAR2(1);
186585 l_component_appl_id INTEGER;
186586 l_amb_context_code VARCHAR2(30);
186587 l_entity_code VARCHAR2(30);
186588 l_event_class_code VARCHAR2(30);
186589 l_ae_header_id NUMBER;
186590 l_event_type_code VARCHAR2(30);
186591 l_line_definition_code VARCHAR2(30);
186592 l_line_definition_owner_code VARCHAR2(1);
186593 --
186594 -- adr variables
186595 l_segment VARCHAR2(30);
186596 l_ccid NUMBER;
186597 l_adr_transaction_coa_id NUMBER;
186598 l_adr_accounting_coa_id NUMBER;
186599 l_adr_flexfield_segment_code VARCHAR2(30);
186600 l_adr_flex_value_set_id NUMBER;
186601 l_adr_value_type_code VARCHAR2(30);
186602 l_adr_value_combination_id NUMBER;
186603 l_adr_value_segment_code VARCHAR2(30);
186604
186605 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
186606 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
186607 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
186608 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
186609
186610 -- 4262811 Variables ------------------------------------------------------------------------------------------
186611 l_entered_amt_idx NUMBER;
186612 l_accted_amt_idx NUMBER;
186613 l_acc_rev_flag VARCHAR2(1);
186614 l_accrual_line_num NUMBER;
186615 l_tmp_amt NUMBER;
186616 l_acc_rev_natural_side_code VARCHAR2(1);
186617
186618 l_num_entries NUMBER;
186619 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
186620 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
186621 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
186622 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
186623 l_recog_line_1 NUMBER;
186624 l_recog_line_2 NUMBER;
186625
186626 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
186627 l_bflow_applied_to_amt NUMBER; -- 5132302
186628 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
186629
186630 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
186631
186632 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
186633 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
186634
186635 ---------------------------------------------------------------------------------------------------------------
186636
186637
186638 --
186639 -- bulk performance
186640 --
186641 l_balance_type_code VARCHAR2(1);
186642 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
186643 l_log_module VARCHAR2(240);
186644
186645 --
186646 -- Upgrade strategy
186647 --
186648 l_actual_upg_option VARCHAR2(1);
186649 l_enc_upg_option VARCHAR2(1);
186650
186651 --
186652 BEGIN
186653 --
186654 IF g_log_enabled THEN
186655 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_430';
186656 END IF;
186657 --
186658 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
186659
186660 trace
186661 (p_msg => 'BEGIN of AcctLineType_430'
186662 ,p_level => C_LEVEL_PROCEDURE
186663 ,p_module => l_log_module);
186664
186665 END IF;
186666 --
186667 l_component_type := 'AMB_JLT';
186668 l_component_code := 'IAC_BACKLOG_RESERVE';
186669 l_component_type_code := 'S';
186670 l_component_appl_id := 140;
186671 l_amb_context_code := 'DEFAULT';
186672 l_entity_code := 'TRANSACTIONS';
186673 l_event_class_code := 'INFLATION_REVALUATION';
186674 l_event_type_code := 'INFLATION_REVALUATION_ALL';
186675 l_line_definition_owner_code := 'S';
186676 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
186677 --
186678 l_balance_type_code := 'A';
186679 l_segment := NULL;
186680 l_ccid := NULL;
186681 l_adr_transaction_coa_id := NULL;
186682 l_adr_accounting_coa_id := NULL;
186683 l_adr_flexfield_segment_code := NULL;
186684 l_adr_flex_value_set_id := NULL;
186685 l_adr_value_type_code := NULL;
186686 l_adr_value_combination_id := NULL;
186687 l_adr_value_segment_code := NULL;
186688
186689 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
186693
186690 l_bflow_class_code := ''; -- 4219869 Business Flow
186691 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
186692 l_budgetary_control_flag := 'N';
186694 l_bflow_applied_to_amt_idx := NULL; -- 5132302
186695 l_bflow_applied_to_amt := NULL; -- 5132302
186696 l_entered_amt_idx := NULL; -- 4262811
186697 l_accted_amt_idx := NULL; -- 4262811
186698 l_acc_rev_flag := NULL; -- 4262811
186699 l_accrual_line_num := NULL; -- 4262811
186700 l_tmp_amt := NULL; -- 4262811
186701 --
186702
186703 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
186704 l_balance_type_code <> 'B' THEN
186705 IF NVL(p_source_64,'
186706 ') = 'BL RESERVE'
186707 THEN
186708
186709 --
186710 XLA_AE_LINES_PKG.SetNewLine;
186711
186712 p_balance_type_code := l_balance_type_code;
186713 -- set the flag so later we will know whether the gain loss line needs to be created
186714
186715 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
186716 p_actual_flag :='A';
186717 END IF;
186718
186719 --
186720 -- bulk performance
186721 --
186722 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
186723 p_header_num => 0); -- 4262811
186724 --
186725 -- set accounting line options
186726 --
186727 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
186728 p_natural_side_code => 'C'
186729 , p_gain_or_loss_flag => 'N'
186730 , p_gl_transfer_mode_code => 'S'
186731 , p_acct_entry_type_code => 'A'
186732 , p_switch_side_flag => 'Y'
186733 , p_merge_duplicate_code => 'N'
186734 );
186735 --
186736 l_acc_rev_natural_side_code := 'D'; -- 4262811
186737 --
186738 --
186739 -- set accounting line type info
186740 --
186741 xla_ae_lines_pkg.SetAcctLineType
186742 (p_component_type => l_component_type
186743 ,p_event_type_code => l_event_type_code
186744 ,p_line_definition_owner_code => l_line_definition_owner_code
186745 ,p_line_definition_code => l_line_definition_code
186746 ,p_accounting_line_code => l_component_code
186747 ,p_accounting_line_type_code => l_component_type_code
186748 ,p_accounting_line_appl_id => l_component_appl_id
186749 ,p_amb_context_code => l_amb_context_code
186750 ,p_entity_code => l_entity_code
186751 ,p_event_class_code => l_event_class_code);
186752 --
186753 -- set accounting class
186754 --
186755 xla_ae_lines_pkg.SetAcctClass(
186756 p_accounting_class_code => 'ASSET'
186757 , p_ae_header_id => l_ae_header_id
186758 );
186759
186760 --
186761 -- set rounding class
186762 --
186763 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
186764 'ASSET';
186765
186766 --
186767 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
186768 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
186769 --
186770 -- bulk performance
186771 --
186772 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
186773
186774 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
186775 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
186776
186777 -- 4955764
186778 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
186779 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
186780
186781 -- 4458381 Public Sector Enh
186782
186783 --
186784 -- set accounting attributes for the line type
186785 --
186786 l_entered_amt_idx := 6;
186787 l_accted_amt_idx := 8;
186788 l_bflow_applied_to_amt_idx := NULL; -- 5132302
186789 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
186790 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_67);
186791 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
186792 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_68);
186793 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
186794 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_69);
186795 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
186796 l_rec_acct_attrs.array_num_value(4) := to_char(p_source_70);
186797 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_TYPE';
186798 l_rec_acct_attrs.array_char_value(5) := p_source_51;
186799 l_rec_acct_attrs.array_acct_attr_code(6) := 'ENTERED_CURRENCY_AMOUNT';
186800 l_rec_acct_attrs.array_num_value(6) := p_source_65;
186801 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_CODE';
186802 l_rec_acct_attrs.array_char_value(7) := p_source_66;
186803 l_rec_acct_attrs.array_acct_attr_code(8) := 'LEDGER_AMOUNT';
186804 l_rec_acct_attrs.array_num_value(8) := p_source_65;
186805
186806 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
186807 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
186808
186812 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
186809 ---------------------------------------------------------------------------------------------------------------
186810 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
186811 ---------------------------------------------------------------------------------------------------------------
186813
186814 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
186815 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
186816
186817 IF xla_accounting_cache_pkg.GetValueChar
186818 (p_source_code => 'LEDGER_CATEGORY_CODE'
186819 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
186820 AND l_bflow_method_code = 'PRIOR_ENTRY'
186821 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
186822 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
186823 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
186824 )
186825 THEN
186826 xla_ae_lines_pkg.BflowUpgEntry
186827 (p_business_method_code => l_bflow_method_code
186828 ,p_business_class_code => l_bflow_class_code
186829 ,p_balance_type => l_balance_type_code);
186830 ELSE
186831 NULL;
186832 -- No business flow processing for business flow method of NONE.
186833 END IF;
186834
186835 --
186836 -- call analytical criteria
186837 --
186838
186839 --
186840 -- call description
186841 --
186842
186843 xla_ae_lines_pkg.SetLineDescription(
186844 p_ae_header_id => l_ae_header_id
186845 ,p_description => Description_143 (
186846 p_application_id => p_application_id
186847 , p_ae_header_id => l_ae_header_id
186848 , p_source_2 => p_source_2
186849 , p_source_3 => p_source_3
186850 )
186851 );
186852
186853
186854 --
186855 -- call ADRs
186856 -- Bug 4922099
186857 --
186858 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
186859 (NVL(l_actual_upg_option, 'N') = 'O') OR
186860 (NVL(l_enc_upg_option, 'N') = 'O')
186861 )
186862 THEN
186863 NULL;
186864 --
186865 --
186866
186867 l_ccid := AcctDerRule_183(
186868 p_application_id => p_application_id
186869 , p_ae_header_id => l_ae_header_id
186870 , p_source_38 => p_source_38
186871 , x_transaction_coa_id => l_adr_transaction_coa_id
186872 , x_accounting_coa_id => l_adr_accounting_coa_id
186873 , x_value_type_code => l_adr_value_type_code
186874 , p_side => 'NA'
186875 );
186876
186877 xla_ae_lines_pkg.set_ccid(
186878 p_code_combination_id => l_ccid
186879 , p_value_type_code => l_adr_value_type_code
186880 , p_transaction_coa_id => l_adr_transaction_coa_id
186881 , p_accounting_coa_id => l_adr_accounting_coa_id
186882 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
186883 , p_adr_type_code => 'S'
186884 , p_component_type => l_component_type
186885 , p_component_code => l_component_code
186886 , p_component_type_code => l_component_type_code
186887 , p_component_appl_id => l_component_appl_id
186888 , p_amb_context_code => l_amb_context_code
186889 , p_side => 'NA'
186890 );
186891
186892
186893 --
186894 --
186895 END IF;
186896 --
186897 -- Bug 4922099
186898 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
186899 (NVL(l_enc_upg_option, 'N') = 'O')
186900 ) AND
186901 (l_bflow_method_code = 'PRIOR_ENTRY')
186902 )
186903 THEN
186904 IF
186905 --
186906 1 = 2
186907 --
186908 THEN
186909 xla_accounting_err_pkg.build_message
186910 (p_appli_s_name => 'XLA'
186911 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
186912 ,p_token_1 => 'LINE_NUMBER'
186913 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
186914 ,p_token_2 => 'LINE_TYPE_NAME'
186915 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
186916 l_component_type
186917 ,l_component_code
186918 ,l_component_type_code
186919 ,l_component_appl_id
186920 ,l_amb_context_code
186921 ,l_entity_code
186922 ,l_event_class_code
186923 )
186924 ,p_token_3 => 'OWNER'
186925 ,p_value_3 => xla_lookups_pkg.get_meaning(
186929 ,p_token_4 => 'PRODUCT_NAME'
186926 p_lookup_type => 'XLA_OWNER_TYPE'
186927 ,p_lookup_code => l_component_type_code
186928 )
186930 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
186931 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
186932 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
186933 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
186934 ,p_ae_header_id => NULL
186935 );
186936
186937 IF (C_LEVEL_ERROR>= g_log_level) THEN
186938 trace
186939 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
186940 ,p_level => C_LEVEL_ERROR
186941 ,p_module => l_log_module);
186942 END IF;
186943 END IF;
186944 END IF;
186945 --
186946 --
186947 ------------------------------------------------------------------------------------------------
186948 -- 4219869 Business Flow
186949 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
186950 -- Prior Entry. Currently, the following code is always generated.
186951 ------------------------------------------------------------------------------------------------
186952 XLA_AE_LINES_PKG.ValidateCurrentLine;
186953
186954 ------------------------------------------------------------------------------------
186955 -- 4219869 Business Flow
186956 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
186957 ------------------------------------------------------------------------------------
186958 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
186959
186960 ----------------------------------------------------------------------------------
186961 -- 4219869 Business Flow
186962 -- Update journal entry status -- Need to generate this within IF <condition>
186963 ----------------------------------------------------------------------------------
186964 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
186965 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
186966 ,p_balance_type_code => l_balance_type_code
186967 );
186968
186969 -------------------------------------------------------------------------------------------
186970 -- 4262811 - Generate the Accrual Reversal lines
186971 -------------------------------------------------------------------------------------------
186972 BEGIN
186973 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
186974 (g_array_event(p_event_id).array_value_num('header_index'));
186975 IF l_acc_rev_flag IS NULL THEN
186976 l_acc_rev_flag := 'N';
186977 END IF;
186978 EXCEPTION
186979 WHEN OTHERS THEN
186980 l_acc_rev_flag := 'N';
186981 END;
186982 --
186983 IF (l_acc_rev_flag = 'Y') THEN
186984
186985 -- 4645092 ------------------------------------------------------------------------------
186986 -- To allow MPA report to determine if it should generate report process
186987 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
186988 ------------------------------------------------------------------------------------------
186989
186990 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
186991 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
186992 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
186993 -- call ADRs
186994 -- Bug 4922099
186995 --
186996 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
186997 (NVL(l_actual_upg_option, 'N') = 'O') OR
186998 (NVL(l_enc_upg_option, 'N') = 'O')
186999 )
187000 THEN
187001 NULL;
187002 --
187003 --
187004
187005 l_ccid := AcctDerRule_183(
187006 p_application_id => p_application_id
187007 , p_ae_header_id => l_ae_header_id
187008 , p_source_38 => p_source_38
187009 , x_transaction_coa_id => l_adr_transaction_coa_id
187010 , x_accounting_coa_id => l_adr_accounting_coa_id
187011 , x_value_type_code => l_adr_value_type_code
187012 , p_side => 'NA'
187013 );
187014
187015 xla_ae_lines_pkg.set_ccid(
187016 p_code_combination_id => l_ccid
187017 , p_value_type_code => l_adr_value_type_code
187018 , p_transaction_coa_id => l_adr_transaction_coa_id
187019 , p_accounting_coa_id => l_adr_accounting_coa_id
187020 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
187021 , p_adr_type_code => 'S'
187022 , p_component_type => l_component_type
187023 , p_component_code => l_component_code
187024 , p_component_type_code => l_component_type_code
187025 , p_component_appl_id => l_component_appl_id
187026 , p_amb_context_code => l_amb_context_code
187027 , p_side => 'NA'
187028 );
187029
187030
187031 --
187032 --
187036 -- Update the line information that should be overwritten
187033 END IF;
187034
187035 --
187037 --
187038 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
187039 p_header_num => 1);
187040 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
187041
187042 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
187043
187044 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
187045 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
187046 END IF;
187047
187048 --
187049 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
187050 --
187051 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
187052 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
187053 ELSE
187054 ---------------------------------------------------------------------------------------------------
187055 -- 4262811a Switch Sign
187056 ---------------------------------------------------------------------------------------------------
187057 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
187058 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
187059 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
187060 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
187061 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
187062 -- 5132302
187063 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
187064 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
187065
187066 END IF;
187067
187068 -- 4955764
187069 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
187070 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
187071
187072
187073 XLA_AE_LINES_PKG.ValidateCurrentLine;
187074 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
187075
187076 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
187077 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
187078 ,p_balance_type_code => l_balance_type_code);
187079
187080 END IF;
187081
187082 -----------------------------------------------------------------------------------------
187083 -- 4262811 Multiperiod Accounting
187084 -----------------------------------------------------------------------------------------
187085 -- No MPA option is assigned.
187086
187087
187088 END IF;
187089 END IF;
187090 --
187091
187092 --
187093 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
187094 trace
187095 (p_msg => 'END of AcctLineType_430'
187096 ,p_level => C_LEVEL_PROCEDURE
187097 ,p_module => l_log_module);
187098 END IF;
187099 --
187100 EXCEPTION
187101 WHEN xla_exceptions_pkg.application_exception THEN
187102 RAISE;
187103 WHEN OTHERS THEN
187104 xla_exceptions_pkg.raise_message
187105 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_430');
187106 END AcctLineType_430;
187107 --
187108
187109 ---------------------------------------
187110 --
187111 -- PRIVATE FUNCTION
187112 -- AcctLineType_431
187113 --
187114 ---------------------------------------
187115 PROCEDURE AcctLineType_431 (
187116 p_application_id IN NUMBER
187117 ,p_event_id IN NUMBER
187118 ,p_calculate_acctd_flag IN VARCHAR2
187119 ,p_calculate_g_l_flag IN VARCHAR2
187120 ,p_actual_flag IN OUT VARCHAR2
187121 ,p_balance_type_code OUT VARCHAR2
187122 ,p_gain_or_loss_ref OUT VARCHAR2
187123
187124 --Inflation Adjustment Type Description
187125 , p_source_2 IN VARCHAR2
187126 --Accounting Date
187127 , p_source_3 IN DATE
187128 --Inflation Backlog Depreciation Reserve Ccid
187129 , p_source_38 IN NUMBER
187130 --Transaction Header Identifier
187131 , p_source_49 IN NUMBER
187132 --Adjustment Line Identifier
187133 , p_source_50 IN NUMBER
187134 --Distribution Type Code
187135 , p_source_51 IN VARCHAR2
187136 --Inflation Adjustment Type
187137 , p_source_64 IN VARCHAR2
187138 --Inflation Entered Amount
187139 , p_source_65 IN NUMBER
187140 --Inflation Currency Code
187141 , p_source_66 IN VARCHAR2
187142 )
187143 IS
187144
187145 l_component_type VARCHAR2(80);
187146 l_component_code VARCHAR2(30);
187147 l_component_type_code VARCHAR2(1);
187148 l_component_appl_id INTEGER;
187149 l_amb_context_code VARCHAR2(30);
187150 l_entity_code VARCHAR2(30);
187151 l_event_class_code VARCHAR2(30);
187152 l_ae_header_id NUMBER;
187153 l_event_type_code VARCHAR2(30);
187154 l_line_definition_code VARCHAR2(30);
187155 l_line_definition_owner_code VARCHAR2(1);
187159 l_ccid NUMBER;
187156 --
187157 -- adr variables
187158 l_segment VARCHAR2(30);
187160 l_adr_transaction_coa_id NUMBER;
187161 l_adr_accounting_coa_id NUMBER;
187162 l_adr_flexfield_segment_code VARCHAR2(30);
187163 l_adr_flex_value_set_id NUMBER;
187164 l_adr_value_type_code VARCHAR2(30);
187165 l_adr_value_combination_id NUMBER;
187166 l_adr_value_segment_code VARCHAR2(30);
187167
187168 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
187169 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
187170 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
187171 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
187172
187173 -- 4262811 Variables ------------------------------------------------------------------------------------------
187174 l_entered_amt_idx NUMBER;
187175 l_accted_amt_idx NUMBER;
187176 l_acc_rev_flag VARCHAR2(1);
187177 l_accrual_line_num NUMBER;
187178 l_tmp_amt NUMBER;
187179 l_acc_rev_natural_side_code VARCHAR2(1);
187180
187181 l_num_entries NUMBER;
187182 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
187183 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
187184 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
187185 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
187186 l_recog_line_1 NUMBER;
187187 l_recog_line_2 NUMBER;
187188
187189 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
187190 l_bflow_applied_to_amt NUMBER; -- 5132302
187191 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
187192
187193 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
187194
187195 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
187196 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
187197
187198 ---------------------------------------------------------------------------------------------------------------
187199
187200
187201 --
187202 -- bulk performance
187203 --
187204 l_balance_type_code VARCHAR2(1);
187205 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
187206 l_log_module VARCHAR2(240);
187207
187208 --
187209 -- Upgrade strategy
187210 --
187211 l_actual_upg_option VARCHAR2(1);
187212 l_enc_upg_option VARCHAR2(1);
187213
187214 --
187215 BEGIN
187216 --
187217 IF g_log_enabled THEN
187218 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_431';
187219 END IF;
187220 --
187221 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
187222
187223 trace
187224 (p_msg => 'BEGIN of AcctLineType_431'
187225 ,p_level => C_LEVEL_PROCEDURE
187226 ,p_module => l_log_module);
187227
187228 END IF;
187229 --
187230 l_component_type := 'AMB_JLT';
187231 l_component_code := 'IAC_BACKLOG_RESERVE';
187232 l_component_type_code := 'S';
187233 l_component_appl_id := 140;
187234 l_amb_context_code := 'DEFAULT';
187235 l_entity_code := 'TRANSACTIONS';
187236 l_event_class_code := 'RETIREMENTS';
187237 l_event_type_code := 'REINSTATEMENTS';
187238 l_line_definition_owner_code := 'S';
187239 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
187240 --
187241 l_balance_type_code := 'A';
187242 l_segment := NULL;
187243 l_ccid := NULL;
187244 l_adr_transaction_coa_id := NULL;
187245 l_adr_accounting_coa_id := NULL;
187246 l_adr_flexfield_segment_code := NULL;
187247 l_adr_flex_value_set_id := NULL;
187248 l_adr_value_type_code := NULL;
187249 l_adr_value_combination_id := NULL;
187250 l_adr_value_segment_code := NULL;
187251
187252 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
187253 l_bflow_class_code := ''; -- 4219869 Business Flow
187254 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
187255 l_budgetary_control_flag := 'N';
187256
187257 l_bflow_applied_to_amt_idx := NULL; -- 5132302
187258 l_bflow_applied_to_amt := NULL; -- 5132302
187259 l_entered_amt_idx := NULL; -- 4262811
187260 l_accted_amt_idx := NULL; -- 4262811
187261 l_acc_rev_flag := NULL; -- 4262811
187262 l_accrual_line_num := NULL; -- 4262811
187263 l_tmp_amt := NULL; -- 4262811
187264 --
187265
187266 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
187267 l_balance_type_code <> 'B' THEN
187268 IF NVL(p_source_64,'
187269 ') = 'BL RESERVE'
187270 THEN
187271
187272 --
187273 XLA_AE_LINES_PKG.SetNewLine;
187274
187275 p_balance_type_code := l_balance_type_code;
187276 -- set the flag so later we will know whether the gain loss line needs to be created
187277
187278 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
187279 p_actual_flag :='A';
187280 END IF;
187281
187282 --
187283 -- bulk performance
187287 --
187284 --
187285 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
187286 p_header_num => 0); -- 4262811
187288 -- set accounting line options
187289 --
187290 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
187291 p_natural_side_code => 'C'
187292 , p_gain_or_loss_flag => 'N'
187293 , p_gl_transfer_mode_code => 'S'
187294 , p_acct_entry_type_code => 'A'
187295 , p_switch_side_flag => 'Y'
187296 , p_merge_duplicate_code => 'N'
187297 );
187298 --
187299 l_acc_rev_natural_side_code := 'D'; -- 4262811
187300 --
187301 --
187302 -- set accounting line type info
187303 --
187304 xla_ae_lines_pkg.SetAcctLineType
187305 (p_component_type => l_component_type
187306 ,p_event_type_code => l_event_type_code
187307 ,p_line_definition_owner_code => l_line_definition_owner_code
187308 ,p_line_definition_code => l_line_definition_code
187309 ,p_accounting_line_code => l_component_code
187310 ,p_accounting_line_type_code => l_component_type_code
187311 ,p_accounting_line_appl_id => l_component_appl_id
187312 ,p_amb_context_code => l_amb_context_code
187313 ,p_entity_code => l_entity_code
187314 ,p_event_class_code => l_event_class_code);
187315 --
187316 -- set accounting class
187317 --
187318 xla_ae_lines_pkg.SetAcctClass(
187319 p_accounting_class_code => 'ASSET'
187320 , p_ae_header_id => l_ae_header_id
187321 );
187322
187323 --
187324 -- set rounding class
187325 --
187326 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
187327 'ASSET';
187328
187329 --
187330 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
187331 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
187332 --
187333 -- bulk performance
187334 --
187335 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
187336
187337 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
187338 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
187339
187340 -- 4955764
187341 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
187342 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
187343
187344 -- 4458381 Public Sector Enh
187345
187346 --
187347 -- set accounting attributes for the line type
187348 --
187349 l_entered_amt_idx := 4;
187350 l_accted_amt_idx := 6;
187351 l_bflow_applied_to_amt_idx := NULL; -- 5132302
187352 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
187353 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
187354 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
187355 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
187356 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
187357 l_rec_acct_attrs.array_char_value(3) := p_source_51;
187358 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
187359 l_rec_acct_attrs.array_num_value(4) := p_source_65;
187360 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
187361 l_rec_acct_attrs.array_char_value(5) := p_source_66;
187362 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
187363 l_rec_acct_attrs.array_num_value(6) := p_source_65;
187364
187365 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
187366 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
187367
187368 ---------------------------------------------------------------------------------------------------------------
187369 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
187370 ---------------------------------------------------------------------------------------------------------------
187371 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
187372
187373 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
187374 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
187375
187376 IF xla_accounting_cache_pkg.GetValueChar
187377 (p_source_code => 'LEDGER_CATEGORY_CODE'
187378 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
187379 AND l_bflow_method_code = 'PRIOR_ENTRY'
187380 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
187381 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
187382 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
187383 )
187384 THEN
187385 xla_ae_lines_pkg.BflowUpgEntry
187386 (p_business_method_code => l_bflow_method_code
187387 ,p_business_class_code => l_bflow_class_code
187388 ,p_balance_type => l_balance_type_code);
187389 ELSE
187390 NULL;
187391 -- No business flow processing for business flow method of NONE.
187392 END IF;
187393
187394 --
187395 -- call analytical criteria
187396 --
187397
187401
187398 --
187399 -- call description
187400 --
187402 xla_ae_lines_pkg.SetLineDescription(
187403 p_ae_header_id => l_ae_header_id
187404 ,p_description => Description_143 (
187405 p_application_id => p_application_id
187406 , p_ae_header_id => l_ae_header_id
187407 , p_source_2 => p_source_2
187408 , p_source_3 => p_source_3
187409 )
187410 );
187411
187412
187413 --
187414 -- call ADRs
187415 -- Bug 4922099
187416 --
187417 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
187418 (NVL(l_actual_upg_option, 'N') = 'O') OR
187419 (NVL(l_enc_upg_option, 'N') = 'O')
187420 )
187421 THEN
187422 NULL;
187423 --
187424 --
187425
187426 l_ccid := AcctDerRule_183(
187427 p_application_id => p_application_id
187428 , p_ae_header_id => l_ae_header_id
187429 , p_source_38 => p_source_38
187430 , x_transaction_coa_id => l_adr_transaction_coa_id
187431 , x_accounting_coa_id => l_adr_accounting_coa_id
187432 , x_value_type_code => l_adr_value_type_code
187433 , p_side => 'NA'
187434 );
187435
187436 xla_ae_lines_pkg.set_ccid(
187437 p_code_combination_id => l_ccid
187438 , p_value_type_code => l_adr_value_type_code
187439 , p_transaction_coa_id => l_adr_transaction_coa_id
187440 , p_accounting_coa_id => l_adr_accounting_coa_id
187441 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
187442 , p_adr_type_code => 'S'
187443 , p_component_type => l_component_type
187444 , p_component_code => l_component_code
187445 , p_component_type_code => l_component_type_code
187446 , p_component_appl_id => l_component_appl_id
187447 , p_amb_context_code => l_amb_context_code
187448 , p_side => 'NA'
187449 );
187450
187451
187452 --
187453 --
187454 END IF;
187455 --
187456 -- Bug 4922099
187457 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
187458 (NVL(l_enc_upg_option, 'N') = 'O')
187459 ) AND
187460 (l_bflow_method_code = 'PRIOR_ENTRY')
187461 )
187462 THEN
187463 IF
187464 --
187465 1 = 2
187466 --
187467 THEN
187468 xla_accounting_err_pkg.build_message
187469 (p_appli_s_name => 'XLA'
187470 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
187471 ,p_token_1 => 'LINE_NUMBER'
187472 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
187473 ,p_token_2 => 'LINE_TYPE_NAME'
187474 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
187475 l_component_type
187476 ,l_component_code
187477 ,l_component_type_code
187478 ,l_component_appl_id
187479 ,l_amb_context_code
187480 ,l_entity_code
187481 ,l_event_class_code
187482 )
187483 ,p_token_3 => 'OWNER'
187484 ,p_value_3 => xla_lookups_pkg.get_meaning(
187485 p_lookup_type => 'XLA_OWNER_TYPE'
187486 ,p_lookup_code => l_component_type_code
187487 )
187488 ,p_token_4 => 'PRODUCT_NAME'
187489 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
187490 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
187491 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
187492 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
187493 ,p_ae_header_id => NULL
187494 );
187495
187496 IF (C_LEVEL_ERROR>= g_log_level) THEN
187497 trace
187498 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
187499 ,p_level => C_LEVEL_ERROR
187500 ,p_module => l_log_module);
187501 END IF;
187502 END IF;
187503 END IF;
187504 --
187505 --
187506 ------------------------------------------------------------------------------------------------
187507 -- 4219869 Business Flow
187508 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
187509 -- Prior Entry. Currently, the following code is always generated.
187513 ------------------------------------------------------------------------------------
187510 ------------------------------------------------------------------------------------------------
187511 XLA_AE_LINES_PKG.ValidateCurrentLine;
187512
187514 -- 4219869 Business Flow
187515 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
187516 ------------------------------------------------------------------------------------
187517 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
187518
187519 ----------------------------------------------------------------------------------
187520 -- 4219869 Business Flow
187521 -- Update journal entry status -- Need to generate this within IF <condition>
187522 ----------------------------------------------------------------------------------
187523 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
187524 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
187525 ,p_balance_type_code => l_balance_type_code
187526 );
187527
187528 -------------------------------------------------------------------------------------------
187529 -- 4262811 - Generate the Accrual Reversal lines
187530 -------------------------------------------------------------------------------------------
187531 BEGIN
187532 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
187533 (g_array_event(p_event_id).array_value_num('header_index'));
187534 IF l_acc_rev_flag IS NULL THEN
187535 l_acc_rev_flag := 'N';
187536 END IF;
187537 EXCEPTION
187538 WHEN OTHERS THEN
187539 l_acc_rev_flag := 'N';
187540 END;
187541 --
187542 IF (l_acc_rev_flag = 'Y') THEN
187543
187544 -- 4645092 ------------------------------------------------------------------------------
187545 -- To allow MPA report to determine if it should generate report process
187546 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
187547 ------------------------------------------------------------------------------------------
187548
187549 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
187550 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
187551 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
187552 -- call ADRs
187553 -- Bug 4922099
187554 --
187555 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
187556 (NVL(l_actual_upg_option, 'N') = 'O') OR
187557 (NVL(l_enc_upg_option, 'N') = 'O')
187558 )
187559 THEN
187560 NULL;
187561 --
187562 --
187563
187564 l_ccid := AcctDerRule_183(
187565 p_application_id => p_application_id
187566 , p_ae_header_id => l_ae_header_id
187567 , p_source_38 => p_source_38
187568 , x_transaction_coa_id => l_adr_transaction_coa_id
187569 , x_accounting_coa_id => l_adr_accounting_coa_id
187570 , x_value_type_code => l_adr_value_type_code
187571 , p_side => 'NA'
187572 );
187573
187574 xla_ae_lines_pkg.set_ccid(
187575 p_code_combination_id => l_ccid
187576 , p_value_type_code => l_adr_value_type_code
187577 , p_transaction_coa_id => l_adr_transaction_coa_id
187578 , p_accounting_coa_id => l_adr_accounting_coa_id
187579 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
187580 , p_adr_type_code => 'S'
187581 , p_component_type => l_component_type
187582 , p_component_code => l_component_code
187583 , p_component_type_code => l_component_type_code
187584 , p_component_appl_id => l_component_appl_id
187585 , p_amb_context_code => l_amb_context_code
187586 , p_side => 'NA'
187587 );
187588
187589
187590 --
187591 --
187592 END IF;
187593
187594 --
187595 -- Update the line information that should be overwritten
187596 --
187597 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
187598 p_header_num => 1);
187599 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
187600
187601 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
187602
187603 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
187604 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
187605 END IF;
187606
187607 --
187608 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
187609 --
187610 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
187611 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
187612 ELSE
187613 ---------------------------------------------------------------------------------------------------
187614 -- 4262811a Switch Sign
187615 ---------------------------------------------------------------------------------------------------
187616 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
187617 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
187621 -- 5132302
187618 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
187619 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
187620 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
187622 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
187623 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
187624
187625 END IF;
187626
187627 -- 4955764
187628 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
187629 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
187630
187631
187632 XLA_AE_LINES_PKG.ValidateCurrentLine;
187633 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
187634
187635 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
187636 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
187637 ,p_balance_type_code => l_balance_type_code);
187638
187639 END IF;
187640
187641 -----------------------------------------------------------------------------------------
187642 -- 4262811 Multiperiod Accounting
187643 -----------------------------------------------------------------------------------------
187644 -- No MPA option is assigned.
187645
187646
187647 END IF;
187648 END IF;
187649 --
187650
187651 --
187652 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
187653 trace
187654 (p_msg => 'END of AcctLineType_431'
187655 ,p_level => C_LEVEL_PROCEDURE
187656 ,p_module => l_log_module);
187657 END IF;
187658 --
187659 EXCEPTION
187660 WHEN xla_exceptions_pkg.application_exception THEN
187661 RAISE;
187662 WHEN OTHERS THEN
187663 xla_exceptions_pkg.raise_message
187664 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_431');
187665 END AcctLineType_431;
187666 --
187667
187668 ---------------------------------------
187669 --
187670 -- PRIVATE FUNCTION
187671 -- AcctLineType_432
187672 --
187673 ---------------------------------------
187674 PROCEDURE AcctLineType_432 (
187675 p_application_id IN NUMBER
187676 ,p_event_id IN NUMBER
187677 ,p_calculate_acctd_flag IN VARCHAR2
187678 ,p_calculate_g_l_flag IN VARCHAR2
187679 ,p_actual_flag IN OUT VARCHAR2
187680 ,p_balance_type_code OUT VARCHAR2
187681 ,p_gain_or_loss_ref OUT VARCHAR2
187682
187683 --Inflation Adjustment Type Description
187684 , p_source_2 IN VARCHAR2
187685 --Accounting Date
187686 , p_source_3 IN DATE
187687 --Inflation Backlog Depreciation Reserve Ccid
187688 , p_source_38 IN NUMBER
187689 --Transaction Header Identifier
187690 , p_source_49 IN NUMBER
187691 --Adjustment Line Identifier
187692 , p_source_50 IN NUMBER
187693 --Distribution Type Code
187694 , p_source_51 IN VARCHAR2
187695 --Inflation Adjustment Type
187696 , p_source_64 IN VARCHAR2
187697 --Inflation Entered Amount
187698 , p_source_65 IN NUMBER
187699 --Inflation Currency Code
187700 , p_source_66 IN VARCHAR2
187701 )
187702 IS
187703
187704 l_component_type VARCHAR2(80);
187705 l_component_code VARCHAR2(30);
187706 l_component_type_code VARCHAR2(1);
187707 l_component_appl_id INTEGER;
187708 l_amb_context_code VARCHAR2(30);
187709 l_entity_code VARCHAR2(30);
187710 l_event_class_code VARCHAR2(30);
187711 l_ae_header_id NUMBER;
187712 l_event_type_code VARCHAR2(30);
187713 l_line_definition_code VARCHAR2(30);
187714 l_line_definition_owner_code VARCHAR2(1);
187715 --
187716 -- adr variables
187717 l_segment VARCHAR2(30);
187718 l_ccid NUMBER;
187719 l_adr_transaction_coa_id NUMBER;
187720 l_adr_accounting_coa_id NUMBER;
187721 l_adr_flexfield_segment_code VARCHAR2(30);
187722 l_adr_flex_value_set_id NUMBER;
187723 l_adr_value_type_code VARCHAR2(30);
187724 l_adr_value_combination_id NUMBER;
187725 l_adr_value_segment_code VARCHAR2(30);
187726
187727 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
187728 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
187729 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
187730 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
187731
187732 -- 4262811 Variables ------------------------------------------------------------------------------------------
187733 l_entered_amt_idx NUMBER;
187734 l_accted_amt_idx NUMBER;
187735 l_acc_rev_flag VARCHAR2(1);
187736 l_accrual_line_num NUMBER;
187737 l_tmp_amt NUMBER;
187738 l_acc_rev_natural_side_code VARCHAR2(1);
187739
187740 l_num_entries NUMBER;
187741 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
187742 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
187743 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
187744 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
187748 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
187745 l_recog_line_1 NUMBER;
187746 l_recog_line_2 NUMBER;
187747
187749 l_bflow_applied_to_amt NUMBER; -- 5132302
187750 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
187751
187752 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
187753
187754 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
187755 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
187756
187757 ---------------------------------------------------------------------------------------------------------------
187758
187759
187760 --
187761 -- bulk performance
187762 --
187763 l_balance_type_code VARCHAR2(1);
187764 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
187765 l_log_module VARCHAR2(240);
187766
187767 --
187768 -- Upgrade strategy
187769 --
187770 l_actual_upg_option VARCHAR2(1);
187771 l_enc_upg_option VARCHAR2(1);
187772
187773 --
187774 BEGIN
187775 --
187776 IF g_log_enabled THEN
187777 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_432';
187778 END IF;
187779 --
187780 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
187781
187782 trace
187783 (p_msg => 'BEGIN of AcctLineType_432'
187784 ,p_level => C_LEVEL_PROCEDURE
187785 ,p_module => l_log_module);
187786
187787 END IF;
187788 --
187789 l_component_type := 'AMB_JLT';
187790 l_component_code := 'IAC_BACKLOG_RESERVE';
187791 l_component_type_code := 'S';
187792 l_component_appl_id := 140;
187793 l_amb_context_code := 'DEFAULT';
187794 l_entity_code := 'TRANSACTIONS';
187795 l_event_class_code := 'ADJUSTMENTS';
187796 l_event_type_code := 'ADJUSTMENTS_ALL';
187797 l_line_definition_owner_code := 'S';
187798 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
187799 --
187800 l_balance_type_code := 'A';
187801 l_segment := NULL;
187802 l_ccid := NULL;
187803 l_adr_transaction_coa_id := NULL;
187804 l_adr_accounting_coa_id := NULL;
187805 l_adr_flexfield_segment_code := NULL;
187806 l_adr_flex_value_set_id := NULL;
187807 l_adr_value_type_code := NULL;
187808 l_adr_value_combination_id := NULL;
187809 l_adr_value_segment_code := NULL;
187810
187811 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
187812 l_bflow_class_code := ''; -- 4219869 Business Flow
187813 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
187814 l_budgetary_control_flag := 'N';
187815
187816 l_bflow_applied_to_amt_idx := NULL; -- 5132302
187817 l_bflow_applied_to_amt := NULL; -- 5132302
187818 l_entered_amt_idx := NULL; -- 4262811
187819 l_accted_amt_idx := NULL; -- 4262811
187820 l_acc_rev_flag := NULL; -- 4262811
187821 l_accrual_line_num := NULL; -- 4262811
187822 l_tmp_amt := NULL; -- 4262811
187823 --
187824
187825 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
187826 l_balance_type_code <> 'B' THEN
187827 IF NVL(p_source_64,'
187828 ') = 'BL RESERVE'
187829 THEN
187830
187831 --
187832 XLA_AE_LINES_PKG.SetNewLine;
187833
187834 p_balance_type_code := l_balance_type_code;
187835 -- set the flag so later we will know whether the gain loss line needs to be created
187836
187837 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
187838 p_actual_flag :='A';
187839 END IF;
187840
187841 --
187842 -- bulk performance
187843 --
187844 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
187845 p_header_num => 0); -- 4262811
187846 --
187847 -- set accounting line options
187848 --
187849 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
187850 p_natural_side_code => 'C'
187851 , p_gain_or_loss_flag => 'N'
187852 , p_gl_transfer_mode_code => 'S'
187853 , p_acct_entry_type_code => 'A'
187854 , p_switch_side_flag => 'Y'
187855 , p_merge_duplicate_code => 'N'
187856 );
187857 --
187858 l_acc_rev_natural_side_code := 'D'; -- 4262811
187859 --
187860 --
187861 -- set accounting line type info
187862 --
187863 xla_ae_lines_pkg.SetAcctLineType
187864 (p_component_type => l_component_type
187865 ,p_event_type_code => l_event_type_code
187866 ,p_line_definition_owner_code => l_line_definition_owner_code
187867 ,p_line_definition_code => l_line_definition_code
187868 ,p_accounting_line_code => l_component_code
187869 ,p_accounting_line_type_code => l_component_type_code
187870 ,p_accounting_line_appl_id => l_component_appl_id
187871 ,p_amb_context_code => l_amb_context_code
187872 ,p_entity_code => l_entity_code
187873 ,p_event_class_code => l_event_class_code);
187874 --
187875 -- set accounting class
187879 , p_ae_header_id => l_ae_header_id
187876 --
187877 xla_ae_lines_pkg.SetAcctClass(
187878 p_accounting_class_code => 'ASSET'
187880 );
187881
187882 --
187883 -- set rounding class
187884 --
187885 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
187886 'ASSET';
187887
187888 --
187889 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
187890 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
187891 --
187892 -- bulk performance
187893 --
187894 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
187895
187896 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
187897 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
187898
187899 -- 4955764
187900 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
187901 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
187902
187903 -- 4458381 Public Sector Enh
187904
187905 --
187906 -- set accounting attributes for the line type
187907 --
187908 l_entered_amt_idx := 4;
187909 l_accted_amt_idx := 6;
187910 l_bflow_applied_to_amt_idx := NULL; -- 5132302
187911 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
187912 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
187913 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
187914 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
187915 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
187916 l_rec_acct_attrs.array_char_value(3) := p_source_51;
187917 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
187918 l_rec_acct_attrs.array_num_value(4) := p_source_65;
187919 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
187920 l_rec_acct_attrs.array_char_value(5) := p_source_66;
187921 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
187922 l_rec_acct_attrs.array_num_value(6) := p_source_65;
187923
187924 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
187925 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
187926
187927 ---------------------------------------------------------------------------------------------------------------
187928 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
187929 ---------------------------------------------------------------------------------------------------------------
187930 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
187931
187932 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
187933 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
187934
187935 IF xla_accounting_cache_pkg.GetValueChar
187936 (p_source_code => 'LEDGER_CATEGORY_CODE'
187937 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
187938 AND l_bflow_method_code = 'PRIOR_ENTRY'
187939 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
187940 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
187941 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
187942 )
187943 THEN
187944 xla_ae_lines_pkg.BflowUpgEntry
187945 (p_business_method_code => l_bflow_method_code
187946 ,p_business_class_code => l_bflow_class_code
187947 ,p_balance_type => l_balance_type_code);
187948 ELSE
187949 NULL;
187950 -- No business flow processing for business flow method of NONE.
187951 END IF;
187952
187953 --
187954 -- call analytical criteria
187955 --
187956
187957 --
187958 -- call description
187959 --
187960
187961 xla_ae_lines_pkg.SetLineDescription(
187962 p_ae_header_id => l_ae_header_id
187963 ,p_description => Description_143 (
187964 p_application_id => p_application_id
187965 , p_ae_header_id => l_ae_header_id
187966 , p_source_2 => p_source_2
187967 , p_source_3 => p_source_3
187968 )
187969 );
187970
187971
187972 --
187973 -- call ADRs
187974 -- Bug 4922099
187975 --
187976 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
187977 (NVL(l_actual_upg_option, 'N') = 'O') OR
187978 (NVL(l_enc_upg_option, 'N') = 'O')
187979 )
187980 THEN
187981 NULL;
187982 --
187983 --
187984
187985 l_ccid := AcctDerRule_183(
187986 p_application_id => p_application_id
187987 , p_ae_header_id => l_ae_header_id
187988 , p_source_38 => p_source_38
187989 , x_transaction_coa_id => l_adr_transaction_coa_id
187990 , x_accounting_coa_id => l_adr_accounting_coa_id
187991 , x_value_type_code => l_adr_value_type_code
187992 , p_side => 'NA'
187993 );
187994
187995 xla_ae_lines_pkg.set_ccid(
187996 p_code_combination_id => l_ccid
187997 , p_value_type_code => l_adr_value_type_code
187998 , p_transaction_coa_id => l_adr_transaction_coa_id
188002 , p_component_type => l_component_type
187999 , p_accounting_coa_id => l_adr_accounting_coa_id
188000 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
188001 , p_adr_type_code => 'S'
188003 , p_component_code => l_component_code
188004 , p_component_type_code => l_component_type_code
188005 , p_component_appl_id => l_component_appl_id
188006 , p_amb_context_code => l_amb_context_code
188007 , p_side => 'NA'
188008 );
188009
188010
188011 --
188012 --
188013 END IF;
188014 --
188015 -- Bug 4922099
188016 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
188017 (NVL(l_enc_upg_option, 'N') = 'O')
188018 ) AND
188019 (l_bflow_method_code = 'PRIOR_ENTRY')
188020 )
188021 THEN
188022 IF
188023 --
188024 1 = 2
188025 --
188026 THEN
188027 xla_accounting_err_pkg.build_message
188028 (p_appli_s_name => 'XLA'
188029 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
188030 ,p_token_1 => 'LINE_NUMBER'
188031 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
188032 ,p_token_2 => 'LINE_TYPE_NAME'
188033 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
188034 l_component_type
188035 ,l_component_code
188036 ,l_component_type_code
188037 ,l_component_appl_id
188038 ,l_amb_context_code
188039 ,l_entity_code
188040 ,l_event_class_code
188041 )
188042 ,p_token_3 => 'OWNER'
188043 ,p_value_3 => xla_lookups_pkg.get_meaning(
188044 p_lookup_type => 'XLA_OWNER_TYPE'
188045 ,p_lookup_code => l_component_type_code
188046 )
188047 ,p_token_4 => 'PRODUCT_NAME'
188048 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
188049 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
188050 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
188051 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
188052 ,p_ae_header_id => NULL
188053 );
188054
188055 IF (C_LEVEL_ERROR>= g_log_level) THEN
188056 trace
188057 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
188058 ,p_level => C_LEVEL_ERROR
188059 ,p_module => l_log_module);
188060 END IF;
188061 END IF;
188062 END IF;
188063 --
188064 --
188065 ------------------------------------------------------------------------------------------------
188066 -- 4219869 Business Flow
188067 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
188068 -- Prior Entry. Currently, the following code is always generated.
188069 ------------------------------------------------------------------------------------------------
188070 XLA_AE_LINES_PKG.ValidateCurrentLine;
188071
188072 ------------------------------------------------------------------------------------
188073 -- 4219869 Business Flow
188074 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
188075 ------------------------------------------------------------------------------------
188076 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
188077
188078 ----------------------------------------------------------------------------------
188079 -- 4219869 Business Flow
188080 -- Update journal entry status -- Need to generate this within IF <condition>
188081 ----------------------------------------------------------------------------------
188082 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
188083 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
188084 ,p_balance_type_code => l_balance_type_code
188085 );
188086
188087 -------------------------------------------------------------------------------------------
188088 -- 4262811 - Generate the Accrual Reversal lines
188089 -------------------------------------------------------------------------------------------
188090 BEGIN
188091 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
188092 (g_array_event(p_event_id).array_value_num('header_index'));
188093 IF l_acc_rev_flag IS NULL THEN
188094 l_acc_rev_flag := 'N';
188098 l_acc_rev_flag := 'N';
188095 END IF;
188096 EXCEPTION
188097 WHEN OTHERS THEN
188099 END;
188100 --
188101 IF (l_acc_rev_flag = 'Y') THEN
188102
188103 -- 4645092 ------------------------------------------------------------------------------
188104 -- To allow MPA report to determine if it should generate report process
188105 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
188106 ------------------------------------------------------------------------------------------
188107
188108 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
188109 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
188110 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
188111 -- call ADRs
188112 -- Bug 4922099
188113 --
188114 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
188115 (NVL(l_actual_upg_option, 'N') = 'O') OR
188116 (NVL(l_enc_upg_option, 'N') = 'O')
188117 )
188118 THEN
188119 NULL;
188120 --
188121 --
188122
188123 l_ccid := AcctDerRule_183(
188124 p_application_id => p_application_id
188125 , p_ae_header_id => l_ae_header_id
188126 , p_source_38 => p_source_38
188127 , x_transaction_coa_id => l_adr_transaction_coa_id
188128 , x_accounting_coa_id => l_adr_accounting_coa_id
188129 , x_value_type_code => l_adr_value_type_code
188130 , p_side => 'NA'
188131 );
188132
188133 xla_ae_lines_pkg.set_ccid(
188134 p_code_combination_id => l_ccid
188135 , p_value_type_code => l_adr_value_type_code
188136 , p_transaction_coa_id => l_adr_transaction_coa_id
188137 , p_accounting_coa_id => l_adr_accounting_coa_id
188138 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
188139 , p_adr_type_code => 'S'
188140 , p_component_type => l_component_type
188141 , p_component_code => l_component_code
188142 , p_component_type_code => l_component_type_code
188143 , p_component_appl_id => l_component_appl_id
188144 , p_amb_context_code => l_amb_context_code
188145 , p_side => 'NA'
188146 );
188147
188148
188149 --
188150 --
188151 END IF;
188152
188153 --
188154 -- Update the line information that should be overwritten
188155 --
188156 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
188157 p_header_num => 1);
188158 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
188159
188160 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
188161
188162 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
188163 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
188164 END IF;
188165
188166 --
188167 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
188168 --
188169 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
188170 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
188171 ELSE
188172 ---------------------------------------------------------------------------------------------------
188173 -- 4262811a Switch Sign
188174 ---------------------------------------------------------------------------------------------------
188175 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
188176 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
188177 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
188178 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
188179 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
188180 -- 5132302
188181 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
188182 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
188183
188184 END IF;
188185
188186 -- 4955764
188187 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
188188 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
188189
188190
188191 XLA_AE_LINES_PKG.ValidateCurrentLine;
188192 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
188193
188194 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
188195 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
188196 ,p_balance_type_code => l_balance_type_code);
188197
188198 END IF;
188199
188200 -----------------------------------------------------------------------------------------
188201 -- 4262811 Multiperiod Accounting
188202 -----------------------------------------------------------------------------------------
188203 -- No MPA option is assigned.
188204
188205
188206 END IF;
188207 END IF;
188208 --
188209
188210 --
188214 ,p_level => C_LEVEL_PROCEDURE
188211 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
188212 trace
188213 (p_msg => 'END of AcctLineType_432'
188215 ,p_module => l_log_module);
188216 END IF;
188217 --
188218 EXCEPTION
188219 WHEN xla_exceptions_pkg.application_exception THEN
188220 RAISE;
188221 WHEN OTHERS THEN
188222 xla_exceptions_pkg.raise_message
188223 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_432');
188224 END AcctLineType_432;
188225 --
188226
188227 ---------------------------------------
188228 --
188229 -- PRIVATE FUNCTION
188230 -- AcctLineType_433
188231 --
188232 ---------------------------------------
188233 PROCEDURE AcctLineType_433 (
188234 p_application_id IN NUMBER
188235 ,p_event_id IN NUMBER
188236 ,p_calculate_acctd_flag IN VARCHAR2
188237 ,p_calculate_g_l_flag IN VARCHAR2
188238 ,p_actual_flag IN OUT VARCHAR2
188239 ,p_balance_type_code OUT VARCHAR2
188240 ,p_gain_or_loss_ref OUT VARCHAR2
188241
188242 --Inflation Adjustment Type Description
188243 , p_source_2 IN VARCHAR2
188244 --Accounting Date
188245 , p_source_3 IN DATE
188246 --Inflation Backlog Depreciation Reserve Ccid
188247 , p_source_38 IN NUMBER
188248 --Transaction Header Identifier
188249 , p_source_49 IN NUMBER
188250 --Adjustment Line Identifier
188251 , p_source_50 IN NUMBER
188252 --Distribution Type Code
188253 , p_source_51 IN VARCHAR2
188254 --Inflation Adjustment Type
188255 , p_source_64 IN VARCHAR2
188256 --Inflation Entered Amount
188257 , p_source_65 IN NUMBER
188258 --Inflation Currency Code
188259 , p_source_66 IN VARCHAR2
188260 )
188261 IS
188262
188263 l_component_type VARCHAR2(80);
188264 l_component_code VARCHAR2(30);
188265 l_component_type_code VARCHAR2(1);
188266 l_component_appl_id INTEGER;
188267 l_amb_context_code VARCHAR2(30);
188268 l_entity_code VARCHAR2(30);
188269 l_event_class_code VARCHAR2(30);
188270 l_ae_header_id NUMBER;
188271 l_event_type_code VARCHAR2(30);
188272 l_line_definition_code VARCHAR2(30);
188273 l_line_definition_owner_code VARCHAR2(1);
188274 --
188275 -- adr variables
188276 l_segment VARCHAR2(30);
188277 l_ccid NUMBER;
188278 l_adr_transaction_coa_id NUMBER;
188279 l_adr_accounting_coa_id NUMBER;
188280 l_adr_flexfield_segment_code VARCHAR2(30);
188281 l_adr_flex_value_set_id NUMBER;
188282 l_adr_value_type_code VARCHAR2(30);
188283 l_adr_value_combination_id NUMBER;
188284 l_adr_value_segment_code VARCHAR2(30);
188285
188286 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
188287 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
188288 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
188289 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
188290
188291 -- 4262811 Variables ------------------------------------------------------------------------------------------
188292 l_entered_amt_idx NUMBER;
188293 l_accted_amt_idx NUMBER;
188294 l_acc_rev_flag VARCHAR2(1);
188295 l_accrual_line_num NUMBER;
188296 l_tmp_amt NUMBER;
188297 l_acc_rev_natural_side_code VARCHAR2(1);
188298
188299 l_num_entries NUMBER;
188300 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
188301 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
188302 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
188303 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
188304 l_recog_line_1 NUMBER;
188305 l_recog_line_2 NUMBER;
188306
188307 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
188308 l_bflow_applied_to_amt NUMBER; -- 5132302
188309 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
188310
188311 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
188312
188313 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
188314 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
188315
188316 ---------------------------------------------------------------------------------------------------------------
188317
188318
188319 --
188320 -- bulk performance
188321 --
188322 l_balance_type_code VARCHAR2(1);
188323 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
188324 l_log_module VARCHAR2(240);
188325
188326 --
188327 -- Upgrade strategy
188328 --
188329 l_actual_upg_option VARCHAR2(1);
188330 l_enc_upg_option VARCHAR2(1);
188331
188332 --
188333 BEGIN
188334 --
188335 IF g_log_enabled THEN
188336 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_433';
188337 END IF;
188338 --
188339 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
188340
188341 trace
188342 (p_msg => 'BEGIN of AcctLineType_433'
188343 ,p_level => C_LEVEL_PROCEDURE
188344 ,p_module => l_log_module);
188345
188349 l_component_code := 'IAC_BACKLOG_RESERVE';
188346 END IF;
188347 --
188348 l_component_type := 'AMB_JLT';
188350 l_component_type_code := 'S';
188351 l_component_appl_id := 140;
188352 l_amb_context_code := 'DEFAULT';
188353 l_entity_code := 'TRANSACTIONS';
188354 l_event_class_code := 'TRANSFERS';
188355 l_event_type_code := 'TRANSFERS_ALL';
188356 l_line_definition_owner_code := 'S';
188357 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
188358 --
188359 l_balance_type_code := 'A';
188360 l_segment := NULL;
188361 l_ccid := NULL;
188362 l_adr_transaction_coa_id := NULL;
188363 l_adr_accounting_coa_id := NULL;
188364 l_adr_flexfield_segment_code := NULL;
188365 l_adr_flex_value_set_id := NULL;
188366 l_adr_value_type_code := NULL;
188367 l_adr_value_combination_id := NULL;
188368 l_adr_value_segment_code := NULL;
188369
188370 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
188371 l_bflow_class_code := ''; -- 4219869 Business Flow
188372 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
188373 l_budgetary_control_flag := 'N';
188374
188375 l_bflow_applied_to_amt_idx := NULL; -- 5132302
188376 l_bflow_applied_to_amt := NULL; -- 5132302
188377 l_entered_amt_idx := NULL; -- 4262811
188378 l_accted_amt_idx := NULL; -- 4262811
188379 l_acc_rev_flag := NULL; -- 4262811
188380 l_accrual_line_num := NULL; -- 4262811
188381 l_tmp_amt := NULL; -- 4262811
188382 --
188383
188384 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
188385 l_balance_type_code <> 'B' THEN
188386 IF NVL(p_source_64,'
188387 ') = 'BL RESERVE'
188388 THEN
188389
188390 --
188391 XLA_AE_LINES_PKG.SetNewLine;
188392
188393 p_balance_type_code := l_balance_type_code;
188394 -- set the flag so later we will know whether the gain loss line needs to be created
188395
188396 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
188397 p_actual_flag :='A';
188398 END IF;
188399
188400 --
188401 -- bulk performance
188402 --
188403 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
188404 p_header_num => 0); -- 4262811
188405 --
188406 -- set accounting line options
188407 --
188408 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
188409 p_natural_side_code => 'C'
188410 , p_gain_or_loss_flag => 'N'
188411 , p_gl_transfer_mode_code => 'S'
188412 , p_acct_entry_type_code => 'A'
188413 , p_switch_side_flag => 'Y'
188414 , p_merge_duplicate_code => 'N'
188415 );
188416 --
188417 l_acc_rev_natural_side_code := 'D'; -- 4262811
188418 --
188419 --
188420 -- set accounting line type info
188421 --
188422 xla_ae_lines_pkg.SetAcctLineType
188423 (p_component_type => l_component_type
188424 ,p_event_type_code => l_event_type_code
188425 ,p_line_definition_owner_code => l_line_definition_owner_code
188426 ,p_line_definition_code => l_line_definition_code
188427 ,p_accounting_line_code => l_component_code
188428 ,p_accounting_line_type_code => l_component_type_code
188429 ,p_accounting_line_appl_id => l_component_appl_id
188430 ,p_amb_context_code => l_amb_context_code
188431 ,p_entity_code => l_entity_code
188432 ,p_event_class_code => l_event_class_code);
188433 --
188434 -- set accounting class
188435 --
188436 xla_ae_lines_pkg.SetAcctClass(
188437 p_accounting_class_code => 'ASSET'
188438 , p_ae_header_id => l_ae_header_id
188439 );
188440
188441 --
188442 -- set rounding class
188443 --
188444 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
188445 'ASSET';
188446
188447 --
188448 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
188449 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
188450 --
188451 -- bulk performance
188452 --
188453 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
188454
188455 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
188456 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
188457
188458 -- 4955764
188459 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
188460 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
188461
188462 -- 4458381 Public Sector Enh
188463
188464 --
188465 -- set accounting attributes for the line type
188466 --
188467 l_entered_amt_idx := 4;
188468 l_accted_amt_idx := 6;
188469 l_bflow_applied_to_amt_idx := NULL; -- 5132302
188470 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
188471 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
188475 l_rec_acct_attrs.array_char_value(3) := p_source_51;
188472 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
188473 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
188474 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
188476 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
188477 l_rec_acct_attrs.array_num_value(4) := p_source_65;
188478 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
188479 l_rec_acct_attrs.array_char_value(5) := p_source_66;
188480 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
188481 l_rec_acct_attrs.array_num_value(6) := p_source_65;
188482
188483 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
188484 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
188485
188486 ---------------------------------------------------------------------------------------------------------------
188487 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
188488 ---------------------------------------------------------------------------------------------------------------
188489 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
188490
188491 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
188492 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
188493
188494 IF xla_accounting_cache_pkg.GetValueChar
188495 (p_source_code => 'LEDGER_CATEGORY_CODE'
188496 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
188497 AND l_bflow_method_code = 'PRIOR_ENTRY'
188498 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
188499 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
188500 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
188501 )
188502 THEN
188503 xla_ae_lines_pkg.BflowUpgEntry
188504 (p_business_method_code => l_bflow_method_code
188505 ,p_business_class_code => l_bflow_class_code
188506 ,p_balance_type => l_balance_type_code);
188507 ELSE
188508 NULL;
188509 -- No business flow processing for business flow method of NONE.
188510 END IF;
188511
188512 --
188513 -- call analytical criteria
188514 --
188515
188516 --
188517 -- call description
188518 --
188519
188520 xla_ae_lines_pkg.SetLineDescription(
188521 p_ae_header_id => l_ae_header_id
188522 ,p_description => Description_143 (
188523 p_application_id => p_application_id
188524 , p_ae_header_id => l_ae_header_id
188525 , p_source_2 => p_source_2
188526 , p_source_3 => p_source_3
188527 )
188528 );
188529
188530
188531 --
188532 -- call ADRs
188533 -- Bug 4922099
188534 --
188535 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
188536 (NVL(l_actual_upg_option, 'N') = 'O') OR
188537 (NVL(l_enc_upg_option, 'N') = 'O')
188538 )
188539 THEN
188540 NULL;
188541 --
188542 --
188543
188544 l_ccid := AcctDerRule_183(
188545 p_application_id => p_application_id
188546 , p_ae_header_id => l_ae_header_id
188547 , p_source_38 => p_source_38
188548 , x_transaction_coa_id => l_adr_transaction_coa_id
188549 , x_accounting_coa_id => l_adr_accounting_coa_id
188550 , x_value_type_code => l_adr_value_type_code
188551 , p_side => 'NA'
188552 );
188553
188554 xla_ae_lines_pkg.set_ccid(
188555 p_code_combination_id => l_ccid
188556 , p_value_type_code => l_adr_value_type_code
188557 , p_transaction_coa_id => l_adr_transaction_coa_id
188558 , p_accounting_coa_id => l_adr_accounting_coa_id
188559 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
188560 , p_adr_type_code => 'S'
188561 , p_component_type => l_component_type
188562 , p_component_code => l_component_code
188563 , p_component_type_code => l_component_type_code
188564 , p_component_appl_id => l_component_appl_id
188565 , p_amb_context_code => l_amb_context_code
188566 , p_side => 'NA'
188567 );
188568
188569
188570 --
188571 --
188572 END IF;
188573 --
188574 -- Bug 4922099
188575 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
188576 (NVL(l_enc_upg_option, 'N') = 'O')
188577 ) AND
188578 (l_bflow_method_code = 'PRIOR_ENTRY')
188579 )
188580 THEN
188581 IF
188582 --
188583 1 = 2
188584 --
188585 THEN
188586 xla_accounting_err_pkg.build_message
188587 (p_appli_s_name => 'XLA'
188588 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
188589 ,p_token_1 => 'LINE_NUMBER'
188590 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
188591 ,p_token_2 => 'LINE_TYPE_NAME'
188592 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
188593 l_component_type
188597 ,l_amb_context_code
188594 ,l_component_code
188595 ,l_component_type_code
188596 ,l_component_appl_id
188598 ,l_entity_code
188599 ,l_event_class_code
188600 )
188601 ,p_token_3 => 'OWNER'
188602 ,p_value_3 => xla_lookups_pkg.get_meaning(
188603 p_lookup_type => 'XLA_OWNER_TYPE'
188604 ,p_lookup_code => l_component_type_code
188605 )
188606 ,p_token_4 => 'PRODUCT_NAME'
188607 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
188608 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
188609 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
188610 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
188611 ,p_ae_header_id => NULL
188612 );
188613
188614 IF (C_LEVEL_ERROR>= g_log_level) THEN
188615 trace
188616 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
188617 ,p_level => C_LEVEL_ERROR
188618 ,p_module => l_log_module);
188619 END IF;
188620 END IF;
188621 END IF;
188622 --
188623 --
188624 ------------------------------------------------------------------------------------------------
188625 -- 4219869 Business Flow
188626 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
188627 -- Prior Entry. Currently, the following code is always generated.
188628 ------------------------------------------------------------------------------------------------
188629 XLA_AE_LINES_PKG.ValidateCurrentLine;
188630
188631 ------------------------------------------------------------------------------------
188632 -- 4219869 Business Flow
188633 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
188634 ------------------------------------------------------------------------------------
188635 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
188636
188637 ----------------------------------------------------------------------------------
188638 -- 4219869 Business Flow
188639 -- Update journal entry status -- Need to generate this within IF <condition>
188640 ----------------------------------------------------------------------------------
188641 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
188642 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
188643 ,p_balance_type_code => l_balance_type_code
188644 );
188645
188646 -------------------------------------------------------------------------------------------
188647 -- 4262811 - Generate the Accrual Reversal lines
188648 -------------------------------------------------------------------------------------------
188649 BEGIN
188650 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
188651 (g_array_event(p_event_id).array_value_num('header_index'));
188652 IF l_acc_rev_flag IS NULL THEN
188653 l_acc_rev_flag := 'N';
188654 END IF;
188655 EXCEPTION
188656 WHEN OTHERS THEN
188657 l_acc_rev_flag := 'N';
188658 END;
188659 --
188660 IF (l_acc_rev_flag = 'Y') THEN
188661
188662 -- 4645092 ------------------------------------------------------------------------------
188663 -- To allow MPA report to determine if it should generate report process
188664 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
188665 ------------------------------------------------------------------------------------------
188666
188667 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
188668 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
188669 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
188670 -- call ADRs
188671 -- Bug 4922099
188672 --
188673 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
188674 (NVL(l_actual_upg_option, 'N') = 'O') OR
188675 (NVL(l_enc_upg_option, 'N') = 'O')
188676 )
188677 THEN
188678 NULL;
188679 --
188680 --
188681
188682 l_ccid := AcctDerRule_183(
188683 p_application_id => p_application_id
188684 , p_ae_header_id => l_ae_header_id
188685 , p_source_38 => p_source_38
188686 , x_transaction_coa_id => l_adr_transaction_coa_id
188687 , x_accounting_coa_id => l_adr_accounting_coa_id
188688 , x_value_type_code => l_adr_value_type_code
188689 , p_side => 'NA'
188690 );
188691
188692 xla_ae_lines_pkg.set_ccid(
188696 , p_accounting_coa_id => l_adr_accounting_coa_id
188693 p_code_combination_id => l_ccid
188694 , p_value_type_code => l_adr_value_type_code
188695 , p_transaction_coa_id => l_adr_transaction_coa_id
188697 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
188698 , p_adr_type_code => 'S'
188699 , p_component_type => l_component_type
188700 , p_component_code => l_component_code
188701 , p_component_type_code => l_component_type_code
188702 , p_component_appl_id => l_component_appl_id
188703 , p_amb_context_code => l_amb_context_code
188704 , p_side => 'NA'
188705 );
188706
188707
188708 --
188709 --
188710 END IF;
188711
188712 --
188713 -- Update the line information that should be overwritten
188714 --
188715 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
188716 p_header_num => 1);
188717 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
188718
188719 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
188720
188721 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
188722 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
188723 END IF;
188724
188725 --
188726 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
188727 --
188728 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
188729 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
188730 ELSE
188731 ---------------------------------------------------------------------------------------------------
188732 -- 4262811a Switch Sign
188733 ---------------------------------------------------------------------------------------------------
188734 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
188735 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
188736 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
188737 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
188738 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
188739 -- 5132302
188740 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
188741 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
188742
188743 END IF;
188744
188745 -- 4955764
188746 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
188747 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
188748
188749
188750 XLA_AE_LINES_PKG.ValidateCurrentLine;
188751 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
188752
188753 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
188754 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
188755 ,p_balance_type_code => l_balance_type_code);
188756
188757 END IF;
188758
188759 -----------------------------------------------------------------------------------------
188760 -- 4262811 Multiperiod Accounting
188761 -----------------------------------------------------------------------------------------
188762 -- No MPA option is assigned.
188763
188764
188765 END IF;
188766 END IF;
188767 --
188768
188769 --
188770 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
188771 trace
188772 (p_msg => 'END of AcctLineType_433'
188773 ,p_level => C_LEVEL_PROCEDURE
188774 ,p_module => l_log_module);
188775 END IF;
188776 --
188777 EXCEPTION
188778 WHEN xla_exceptions_pkg.application_exception THEN
188779 RAISE;
188780 WHEN OTHERS THEN
188781 xla_exceptions_pkg.raise_message
188782 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_433');
188783 END AcctLineType_433;
188784 --
188785
188786 ---------------------------------------
188787 --
188788 -- PRIVATE FUNCTION
188789 -- AcctLineType_434
188790 --
188791 ---------------------------------------
188792 PROCEDURE AcctLineType_434 (
188793 p_application_id IN NUMBER
188794 ,p_event_id IN NUMBER
188795 ,p_calculate_acctd_flag IN VARCHAR2
188796 ,p_calculate_g_l_flag IN VARCHAR2
188797 ,p_actual_flag IN OUT VARCHAR2
188798 ,p_balance_type_code OUT VARCHAR2
188799 ,p_gain_or_loss_ref OUT VARCHAR2
188800
188801 --Inflation Adjustment Type Description
188802 , p_source_2 IN VARCHAR2
188803 --Accounting Date
188804 , p_source_3 IN DATE
188805 --Inflation Backlog Depreciation Reserve Ccid
188806 , p_source_38 IN NUMBER
188807 --Transaction Header Identifier
188808 , p_source_49 IN NUMBER
188809 --Adjustment Line Identifier
188810 , p_source_50 IN NUMBER
188811 --Distribution Type Code
188812 , p_source_51 IN VARCHAR2
188813 --Inflation Adjustment Type
188817 --Inflation Currency Code
188814 , p_source_64 IN VARCHAR2
188815 --Inflation Entered Amount
188816 , p_source_65 IN NUMBER
188818 , p_source_66 IN VARCHAR2
188819 )
188820 IS
188821
188822 l_component_type VARCHAR2(80);
188823 l_component_code VARCHAR2(30);
188824 l_component_type_code VARCHAR2(1);
188825 l_component_appl_id INTEGER;
188826 l_amb_context_code VARCHAR2(30);
188827 l_entity_code VARCHAR2(30);
188828 l_event_class_code VARCHAR2(30);
188829 l_ae_header_id NUMBER;
188830 l_event_type_code VARCHAR2(30);
188831 l_line_definition_code VARCHAR2(30);
188832 l_line_definition_owner_code VARCHAR2(1);
188833 --
188834 -- adr variables
188835 l_segment VARCHAR2(30);
188836 l_ccid NUMBER;
188837 l_adr_transaction_coa_id NUMBER;
188838 l_adr_accounting_coa_id NUMBER;
188839 l_adr_flexfield_segment_code VARCHAR2(30);
188840 l_adr_flex_value_set_id NUMBER;
188841 l_adr_value_type_code VARCHAR2(30);
188842 l_adr_value_combination_id NUMBER;
188843 l_adr_value_segment_code VARCHAR2(30);
188844
188845 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
188846 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
188847 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
188848 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
188849
188850 -- 4262811 Variables ------------------------------------------------------------------------------------------
188851 l_entered_amt_idx NUMBER;
188852 l_accted_amt_idx NUMBER;
188853 l_acc_rev_flag VARCHAR2(1);
188854 l_accrual_line_num NUMBER;
188855 l_tmp_amt NUMBER;
188856 l_acc_rev_natural_side_code VARCHAR2(1);
188857
188858 l_num_entries NUMBER;
188859 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
188860 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
188861 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
188862 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
188863 l_recog_line_1 NUMBER;
188864 l_recog_line_2 NUMBER;
188865
188866 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
188867 l_bflow_applied_to_amt NUMBER; -- 5132302
188868 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
188869
188870 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
188871
188872 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
188873 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
188874
188875 ---------------------------------------------------------------------------------------------------------------
188876
188877
188878 --
188879 -- bulk performance
188880 --
188881 l_balance_type_code VARCHAR2(1);
188882 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
188883 l_log_module VARCHAR2(240);
188884
188885 --
188886 -- Upgrade strategy
188887 --
188888 l_actual_upg_option VARCHAR2(1);
188889 l_enc_upg_option VARCHAR2(1);
188890
188891 --
188892 BEGIN
188893 --
188894 IF g_log_enabled THEN
188895 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_434';
188896 END IF;
188897 --
188898 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
188899
188900 trace
188901 (p_msg => 'BEGIN of AcctLineType_434'
188902 ,p_level => C_LEVEL_PROCEDURE
188903 ,p_module => l_log_module);
188904
188905 END IF;
188906 --
188907 l_component_type := 'AMB_JLT';
188908 l_component_code := 'IAC_BACKLOG_RESERVE';
188909 l_component_type_code := 'S';
188910 l_component_appl_id := 140;
188911 l_amb_context_code := 'DEFAULT';
188912 l_entity_code := 'TRANSACTIONS';
188913 l_event_class_code := 'CATEGORY_RECLASS';
188914 l_event_type_code := 'CATEGORY_RECLASS_ALL';
188915 l_line_definition_owner_code := 'S';
188916 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
188917 --
188918 l_balance_type_code := 'A';
188919 l_segment := NULL;
188920 l_ccid := NULL;
188921 l_adr_transaction_coa_id := NULL;
188922 l_adr_accounting_coa_id := NULL;
188923 l_adr_flexfield_segment_code := NULL;
188924 l_adr_flex_value_set_id := NULL;
188925 l_adr_value_type_code := NULL;
188926 l_adr_value_combination_id := NULL;
188927 l_adr_value_segment_code := NULL;
188928
188929 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
188930 l_bflow_class_code := ''; -- 4219869 Business Flow
188931 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
188932 l_budgetary_control_flag := 'N';
188933
188934 l_bflow_applied_to_amt_idx := NULL; -- 5132302
188935 l_bflow_applied_to_amt := NULL; -- 5132302
188936 l_entered_amt_idx := NULL; -- 4262811
188937 l_accted_amt_idx := NULL; -- 4262811
188938 l_acc_rev_flag := NULL; -- 4262811
188939 l_accrual_line_num := NULL; -- 4262811
188943 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
188940 l_tmp_amt := NULL; -- 4262811
188941 --
188942
188944 l_balance_type_code <> 'B' THEN
188945 IF NVL(p_source_64,'
188946 ') = 'BL RESERVE'
188947 THEN
188948
188949 --
188950 XLA_AE_LINES_PKG.SetNewLine;
188951
188952 p_balance_type_code := l_balance_type_code;
188953 -- set the flag so later we will know whether the gain loss line needs to be created
188954
188955 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
188956 p_actual_flag :='A';
188957 END IF;
188958
188959 --
188960 -- bulk performance
188961 --
188962 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
188963 p_header_num => 0); -- 4262811
188964 --
188965 -- set accounting line options
188966 --
188967 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
188968 p_natural_side_code => 'C'
188969 , p_gain_or_loss_flag => 'N'
188970 , p_gl_transfer_mode_code => 'S'
188971 , p_acct_entry_type_code => 'A'
188972 , p_switch_side_flag => 'Y'
188973 , p_merge_duplicate_code => 'N'
188974 );
188975 --
188976 l_acc_rev_natural_side_code := 'D'; -- 4262811
188977 --
188978 --
188979 -- set accounting line type info
188980 --
188981 xla_ae_lines_pkg.SetAcctLineType
188982 (p_component_type => l_component_type
188983 ,p_event_type_code => l_event_type_code
188984 ,p_line_definition_owner_code => l_line_definition_owner_code
188985 ,p_line_definition_code => l_line_definition_code
188986 ,p_accounting_line_code => l_component_code
188987 ,p_accounting_line_type_code => l_component_type_code
188988 ,p_accounting_line_appl_id => l_component_appl_id
188989 ,p_amb_context_code => l_amb_context_code
188990 ,p_entity_code => l_entity_code
188991 ,p_event_class_code => l_event_class_code);
188992 --
188993 -- set accounting class
188994 --
188995 xla_ae_lines_pkg.SetAcctClass(
188996 p_accounting_class_code => 'ASSET'
188997 , p_ae_header_id => l_ae_header_id
188998 );
188999
189000 --
189001 -- set rounding class
189002 --
189003 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
189004 'ASSET';
189005
189006 --
189007 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
189008 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
189009 --
189010 -- bulk performance
189011 --
189012 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
189013
189014 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
189015 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
189016
189017 -- 4955764
189018 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
189019 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
189020
189021 -- 4458381 Public Sector Enh
189022
189023 --
189024 -- set accounting attributes for the line type
189025 --
189026 l_entered_amt_idx := 4;
189027 l_accted_amt_idx := 6;
189028 l_bflow_applied_to_amt_idx := NULL; -- 5132302
189029 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
189030 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
189031 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
189032 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
189033 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
189034 l_rec_acct_attrs.array_char_value(3) := p_source_51;
189035 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
189036 l_rec_acct_attrs.array_num_value(4) := p_source_65;
189037 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
189038 l_rec_acct_attrs.array_char_value(5) := p_source_66;
189039 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
189040 l_rec_acct_attrs.array_num_value(6) := p_source_65;
189041
189042 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
189043 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
189044
189045 ---------------------------------------------------------------------------------------------------------------
189046 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
189047 ---------------------------------------------------------------------------------------------------------------
189048 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
189049
189050 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
189051 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
189052
189053 IF xla_accounting_cache_pkg.GetValueChar
189054 (p_source_code => 'LEDGER_CATEGORY_CODE'
189058 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
189055 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
189056 AND l_bflow_method_code = 'PRIOR_ENTRY'
189057 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
189059 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
189060 )
189061 THEN
189062 xla_ae_lines_pkg.BflowUpgEntry
189063 (p_business_method_code => l_bflow_method_code
189064 ,p_business_class_code => l_bflow_class_code
189065 ,p_balance_type => l_balance_type_code);
189066 ELSE
189067 NULL;
189068 -- No business flow processing for business flow method of NONE.
189069 END IF;
189070
189071 --
189072 -- call analytical criteria
189073 --
189074
189075 --
189076 -- call description
189077 --
189078
189079 xla_ae_lines_pkg.SetLineDescription(
189080 p_ae_header_id => l_ae_header_id
189081 ,p_description => Description_143 (
189082 p_application_id => p_application_id
189083 , p_ae_header_id => l_ae_header_id
189084 , p_source_2 => p_source_2
189085 , p_source_3 => p_source_3
189086 )
189087 );
189088
189089
189090 --
189091 -- call ADRs
189092 -- Bug 4922099
189093 --
189094 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
189095 (NVL(l_actual_upg_option, 'N') = 'O') OR
189096 (NVL(l_enc_upg_option, 'N') = 'O')
189097 )
189098 THEN
189099 NULL;
189100 --
189101 --
189102
189103 l_ccid := AcctDerRule_183(
189104 p_application_id => p_application_id
189105 , p_ae_header_id => l_ae_header_id
189106 , p_source_38 => p_source_38
189107 , x_transaction_coa_id => l_adr_transaction_coa_id
189108 , x_accounting_coa_id => l_adr_accounting_coa_id
189109 , x_value_type_code => l_adr_value_type_code
189110 , p_side => 'NA'
189111 );
189112
189113 xla_ae_lines_pkg.set_ccid(
189114 p_code_combination_id => l_ccid
189115 , p_value_type_code => l_adr_value_type_code
189116 , p_transaction_coa_id => l_adr_transaction_coa_id
189117 , p_accounting_coa_id => l_adr_accounting_coa_id
189118 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
189119 , p_adr_type_code => 'S'
189120 , p_component_type => l_component_type
189121 , p_component_code => l_component_code
189122 , p_component_type_code => l_component_type_code
189123 , p_component_appl_id => l_component_appl_id
189124 , p_amb_context_code => l_amb_context_code
189125 , p_side => 'NA'
189126 );
189127
189128
189129 --
189130 --
189131 END IF;
189132 --
189133 -- Bug 4922099
189134 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
189135 (NVL(l_enc_upg_option, 'N') = 'O')
189136 ) AND
189137 (l_bflow_method_code = 'PRIOR_ENTRY')
189138 )
189139 THEN
189140 IF
189141 --
189142 1 = 2
189143 --
189144 THEN
189145 xla_accounting_err_pkg.build_message
189146 (p_appli_s_name => 'XLA'
189147 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
189148 ,p_token_1 => 'LINE_NUMBER'
189149 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
189150 ,p_token_2 => 'LINE_TYPE_NAME'
189151 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
189152 l_component_type
189153 ,l_component_code
189154 ,l_component_type_code
189155 ,l_component_appl_id
189156 ,l_amb_context_code
189157 ,l_entity_code
189158 ,l_event_class_code
189159 )
189160 ,p_token_3 => 'OWNER'
189161 ,p_value_3 => xla_lookups_pkg.get_meaning(
189162 p_lookup_type => 'XLA_OWNER_TYPE'
189163 ,p_lookup_code => l_component_type_code
189164 )
189165 ,p_token_4 => 'PRODUCT_NAME'
189166 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
189167 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
189168 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
189169 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
189173 IF (C_LEVEL_ERROR>= g_log_level) THEN
189170 ,p_ae_header_id => NULL
189171 );
189172
189174 trace
189175 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
189176 ,p_level => C_LEVEL_ERROR
189177 ,p_module => l_log_module);
189178 END IF;
189179 END IF;
189180 END IF;
189181 --
189182 --
189183 ------------------------------------------------------------------------------------------------
189184 -- 4219869 Business Flow
189185 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
189186 -- Prior Entry. Currently, the following code is always generated.
189187 ------------------------------------------------------------------------------------------------
189188 XLA_AE_LINES_PKG.ValidateCurrentLine;
189189
189190 ------------------------------------------------------------------------------------
189191 -- 4219869 Business Flow
189192 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
189193 ------------------------------------------------------------------------------------
189194 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
189195
189196 ----------------------------------------------------------------------------------
189197 -- 4219869 Business Flow
189198 -- Update journal entry status -- Need to generate this within IF <condition>
189199 ----------------------------------------------------------------------------------
189200 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
189201 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
189202 ,p_balance_type_code => l_balance_type_code
189203 );
189204
189205 -------------------------------------------------------------------------------------------
189206 -- 4262811 - Generate the Accrual Reversal lines
189207 -------------------------------------------------------------------------------------------
189208 BEGIN
189209 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
189210 (g_array_event(p_event_id).array_value_num('header_index'));
189211 IF l_acc_rev_flag IS NULL THEN
189212 l_acc_rev_flag := 'N';
189213 END IF;
189214 EXCEPTION
189215 WHEN OTHERS THEN
189216 l_acc_rev_flag := 'N';
189217 END;
189218 --
189219 IF (l_acc_rev_flag = 'Y') THEN
189220
189221 -- 4645092 ------------------------------------------------------------------------------
189222 -- To allow MPA report to determine if it should generate report process
189223 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
189224 ------------------------------------------------------------------------------------------
189225
189226 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
189227 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
189228 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
189229 -- call ADRs
189230 -- Bug 4922099
189231 --
189232 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
189233 (NVL(l_actual_upg_option, 'N') = 'O') OR
189234 (NVL(l_enc_upg_option, 'N') = 'O')
189235 )
189236 THEN
189237 NULL;
189238 --
189239 --
189240
189241 l_ccid := AcctDerRule_183(
189242 p_application_id => p_application_id
189243 , p_ae_header_id => l_ae_header_id
189244 , p_source_38 => p_source_38
189245 , x_transaction_coa_id => l_adr_transaction_coa_id
189246 , x_accounting_coa_id => l_adr_accounting_coa_id
189247 , x_value_type_code => l_adr_value_type_code
189248 , p_side => 'NA'
189249 );
189250
189251 xla_ae_lines_pkg.set_ccid(
189252 p_code_combination_id => l_ccid
189253 , p_value_type_code => l_adr_value_type_code
189254 , p_transaction_coa_id => l_adr_transaction_coa_id
189255 , p_accounting_coa_id => l_adr_accounting_coa_id
189256 , p_adr_code => 'IAC_BACKLOG_RESERVE_AC'
189257 , p_adr_type_code => 'S'
189258 , p_component_type => l_component_type
189259 , p_component_code => l_component_code
189260 , p_component_type_code => l_component_type_code
189261 , p_component_appl_id => l_component_appl_id
189262 , p_amb_context_code => l_amb_context_code
189263 , p_side => 'NA'
189264 );
189265
189266
189267 --
189268 --
189269 END IF;
189270
189271 --
189272 -- Update the line information that should be overwritten
189273 --
189274 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
189275 p_header_num => 1);
189276 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
189277
189278 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
189279
189280 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
189281 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
189282 END IF;
189283
189284 --
189288 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
189285 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
189286 --
189287 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
189289 ELSE
189290 ---------------------------------------------------------------------------------------------------
189291 -- 4262811a Switch Sign
189292 ---------------------------------------------------------------------------------------------------
189293 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
189294 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
189295 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
189296 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
189297 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
189298 -- 5132302
189299 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
189300 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
189301
189302 END IF;
189303
189304 -- 4955764
189305 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
189306 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
189307
189308
189309 XLA_AE_LINES_PKG.ValidateCurrentLine;
189310 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
189311
189312 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
189313 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
189314 ,p_balance_type_code => l_balance_type_code);
189315
189316 END IF;
189317
189318 -----------------------------------------------------------------------------------------
189319 -- 4262811 Multiperiod Accounting
189320 -----------------------------------------------------------------------------------------
189321 -- No MPA option is assigned.
189322
189323
189324 END IF;
189325 END IF;
189326 --
189327
189328 --
189329 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
189330 trace
189331 (p_msg => 'END of AcctLineType_434'
189332 ,p_level => C_LEVEL_PROCEDURE
189333 ,p_module => l_log_module);
189334 END IF;
189335 --
189336 EXCEPTION
189337 WHEN xla_exceptions_pkg.application_exception THEN
189338 RAISE;
189339 WHEN OTHERS THEN
189340 xla_exceptions_pkg.raise_message
189341 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_434');
189342 END AcctLineType_434;
189343 --
189344
189345 ---------------------------------------
189346 --
189347 -- PRIVATE FUNCTION
189348 -- AcctLineType_435
189349 --
189350 ---------------------------------------
189351 PROCEDURE AcctLineType_435 (
189352 p_application_id IN NUMBER
189353 ,p_event_id IN NUMBER
189354 ,p_calculate_acctd_flag IN VARCHAR2
189355 ,p_calculate_g_l_flag IN VARCHAR2
189356 ,p_actual_flag IN OUT VARCHAR2
189357 ,p_balance_type_code OUT VARCHAR2
189358 ,p_gain_or_loss_ref OUT VARCHAR2
189359
189360 --Inflation Adjustment Type Description
189361 , p_source_2 IN VARCHAR2
189362 --Accounting Date
189363 , p_source_3 IN DATE
189364 --Inflation Depreciation Expense Ccid
189365 , p_source_39 IN NUMBER
189366 --Transaction Header Identifier
189367 , p_source_49 IN NUMBER
189368 --Adjustment Line Identifier
189369 , p_source_50 IN NUMBER
189370 --Distribution Type Code
189371 , p_source_51 IN VARCHAR2
189372 --Inflation Adjustment Type
189373 , p_source_64 IN VARCHAR2
189374 --Inflation Entered Amount
189375 , p_source_65 IN NUMBER
189376 --Inflation Currency Code
189377 , p_source_66 IN VARCHAR2
189378 )
189379 IS
189380
189381 l_component_type VARCHAR2(80);
189382 l_component_code VARCHAR2(30);
189383 l_component_type_code VARCHAR2(1);
189384 l_component_appl_id INTEGER;
189385 l_amb_context_code VARCHAR2(30);
189386 l_entity_code VARCHAR2(30);
189387 l_event_class_code VARCHAR2(30);
189388 l_ae_header_id NUMBER;
189389 l_event_type_code VARCHAR2(30);
189390 l_line_definition_code VARCHAR2(30);
189391 l_line_definition_owner_code VARCHAR2(1);
189392 --
189393 -- adr variables
189394 l_segment VARCHAR2(30);
189395 l_ccid NUMBER;
189396 l_adr_transaction_coa_id NUMBER;
189397 l_adr_accounting_coa_id NUMBER;
189398 l_adr_flexfield_segment_code VARCHAR2(30);
189399 l_adr_flex_value_set_id NUMBER;
189400 l_adr_value_type_code VARCHAR2(30);
189401 l_adr_value_combination_id NUMBER;
189402 l_adr_value_segment_code VARCHAR2(30);
189403
189404 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
189405 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
189406 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
189407 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
189411 l_accted_amt_idx NUMBER;
189408
189409 -- 4262811 Variables ------------------------------------------------------------------------------------------
189410 l_entered_amt_idx NUMBER;
189412 l_acc_rev_flag VARCHAR2(1);
189413 l_accrual_line_num NUMBER;
189414 l_tmp_amt NUMBER;
189415 l_acc_rev_natural_side_code VARCHAR2(1);
189416
189417 l_num_entries NUMBER;
189418 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
189419 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
189420 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
189421 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
189422 l_recog_line_1 NUMBER;
189423 l_recog_line_2 NUMBER;
189424
189425 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
189426 l_bflow_applied_to_amt NUMBER; -- 5132302
189427 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
189428
189429 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
189430
189431 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
189432 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
189433
189434 ---------------------------------------------------------------------------------------------------------------
189435
189436
189437 --
189438 -- bulk performance
189439 --
189440 l_balance_type_code VARCHAR2(1);
189441 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
189442 l_log_module VARCHAR2(240);
189443
189444 --
189445 -- Upgrade strategy
189446 --
189447 l_actual_upg_option VARCHAR2(1);
189448 l_enc_upg_option VARCHAR2(1);
189449
189450 --
189451 BEGIN
189452 --
189453 IF g_log_enabled THEN
189454 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_435';
189455 END IF;
189456 --
189457 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
189458
189459 trace
189460 (p_msg => 'BEGIN of AcctLineType_435'
189461 ,p_level => C_LEVEL_PROCEDURE
189462 ,p_module => l_log_module);
189463
189464 END IF;
189465 --
189466 l_component_type := 'AMB_JLT';
189467 l_component_code := 'IAC_DEPRECIATION_EXPENSE';
189468 l_component_type_code := 'S';
189469 l_component_appl_id := 140;
189470 l_amb_context_code := 'DEFAULT';
189471 l_entity_code := 'TRANSACTIONS';
189472 l_event_class_code := 'ADJUSTMENTS';
189473 l_event_type_code := 'ADJUSTMENTS_ALL';
189474 l_line_definition_owner_code := 'S';
189475 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
189476 --
189477 l_balance_type_code := 'A';
189478 l_segment := NULL;
189479 l_ccid := NULL;
189480 l_adr_transaction_coa_id := NULL;
189481 l_adr_accounting_coa_id := NULL;
189482 l_adr_flexfield_segment_code := NULL;
189483 l_adr_flex_value_set_id := NULL;
189484 l_adr_value_type_code := NULL;
189485 l_adr_value_combination_id := NULL;
189486 l_adr_value_segment_code := NULL;
189487
189488 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
189489 l_bflow_class_code := ''; -- 4219869 Business Flow
189490 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
189491 l_budgetary_control_flag := 'N';
189492
189493 l_bflow_applied_to_amt_idx := NULL; -- 5132302
189494 l_bflow_applied_to_amt := NULL; -- 5132302
189495 l_entered_amt_idx := NULL; -- 4262811
189496 l_accted_amt_idx := NULL; -- 4262811
189497 l_acc_rev_flag := NULL; -- 4262811
189498 l_accrual_line_num := NULL; -- 4262811
189499 l_tmp_amt := NULL; -- 4262811
189500 --
189501
189502 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
189503 l_balance_type_code <> 'B' THEN
189504 IF NVL(p_source_64,'
189505 ') = 'EXPENSE'
189506 THEN
189507
189508 --
189509 XLA_AE_LINES_PKG.SetNewLine;
189510
189511 p_balance_type_code := l_balance_type_code;
189512 -- set the flag so later we will know whether the gain loss line needs to be created
189513
189514 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
189515 p_actual_flag :='A';
189516 END IF;
189517
189518 --
189519 -- bulk performance
189520 --
189521 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
189522 p_header_num => 0); -- 4262811
189523 --
189524 -- set accounting line options
189525 --
189526 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
189527 p_natural_side_code => 'D'
189528 , p_gain_or_loss_flag => 'N'
189529 , p_gl_transfer_mode_code => 'S'
189530 , p_acct_entry_type_code => 'A'
189531 , p_switch_side_flag => 'Y'
189532 , p_merge_duplicate_code => 'N'
189533 );
189534 --
189535 l_acc_rev_natural_side_code := 'C'; -- 4262811
189536 --
189537 --
189538 -- set accounting line type info
189539 --
189543 ,p_line_definition_owner_code => l_line_definition_owner_code
189540 xla_ae_lines_pkg.SetAcctLineType
189541 (p_component_type => l_component_type
189542 ,p_event_type_code => l_event_type_code
189544 ,p_line_definition_code => l_line_definition_code
189545 ,p_accounting_line_code => l_component_code
189546 ,p_accounting_line_type_code => l_component_type_code
189547 ,p_accounting_line_appl_id => l_component_appl_id
189548 ,p_amb_context_code => l_amb_context_code
189549 ,p_entity_code => l_entity_code
189550 ,p_event_class_code => l_event_class_code);
189551 --
189552 -- set accounting class
189553 --
189554 xla_ae_lines_pkg.SetAcctClass(
189555 p_accounting_class_code => 'EXPENSE'
189556 , p_ae_header_id => l_ae_header_id
189557 );
189558
189559 --
189560 -- set rounding class
189561 --
189562 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
189563 'EXPENSE';
189564
189565 --
189566 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
189567 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
189568 --
189569 -- bulk performance
189570 --
189571 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
189572
189573 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
189574 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
189575
189576 -- 4955764
189577 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
189578 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
189579
189580 -- 4458381 Public Sector Enh
189581
189582 --
189583 -- set accounting attributes for the line type
189584 --
189585 l_entered_amt_idx := 4;
189586 l_accted_amt_idx := 6;
189587 l_bflow_applied_to_amt_idx := NULL; -- 5132302
189588 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
189589 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
189590 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
189591 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
189592 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
189593 l_rec_acct_attrs.array_char_value(3) := p_source_51;
189594 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
189595 l_rec_acct_attrs.array_num_value(4) := p_source_65;
189596 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
189597 l_rec_acct_attrs.array_char_value(5) := p_source_66;
189598 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
189599 l_rec_acct_attrs.array_num_value(6) := p_source_65;
189600
189601 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
189602 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
189603
189604 ---------------------------------------------------------------------------------------------------------------
189605 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
189606 ---------------------------------------------------------------------------------------------------------------
189607 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
189608
189609 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
189610 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
189611
189612 IF xla_accounting_cache_pkg.GetValueChar
189613 (p_source_code => 'LEDGER_CATEGORY_CODE'
189614 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
189615 AND l_bflow_method_code = 'PRIOR_ENTRY'
189616 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
189617 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
189618 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
189619 )
189620 THEN
189621 xla_ae_lines_pkg.BflowUpgEntry
189622 (p_business_method_code => l_bflow_method_code
189623 ,p_business_class_code => l_bflow_class_code
189624 ,p_balance_type => l_balance_type_code);
189625 ELSE
189626 NULL;
189627 -- No business flow processing for business flow method of NONE.
189628 END IF;
189629
189630 --
189631 -- call analytical criteria
189632 --
189633
189634 --
189635 -- call description
189636 --
189637
189638 xla_ae_lines_pkg.SetLineDescription(
189639 p_ae_header_id => l_ae_header_id
189640 ,p_description => Description_143 (
189641 p_application_id => p_application_id
189642 , p_ae_header_id => l_ae_header_id
189643 , p_source_2 => p_source_2
189644 , p_source_3 => p_source_3
189645 )
189646 );
189647
189648
189649 --
189650 -- call ADRs
189651 -- Bug 4922099
189652 --
189653 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
189654 (NVL(l_actual_upg_option, 'N') = 'O') OR
189655 (NVL(l_enc_upg_option, 'N') = 'O')
189656 )
189660 --
189657 THEN
189658 NULL;
189659 --
189661
189662 l_ccid := AcctDerRule_184(
189663 p_application_id => p_application_id
189664 , p_ae_header_id => l_ae_header_id
189665 , p_source_39 => p_source_39
189666 , x_transaction_coa_id => l_adr_transaction_coa_id
189667 , x_accounting_coa_id => l_adr_accounting_coa_id
189668 , x_value_type_code => l_adr_value_type_code
189669 , p_side => 'NA'
189670 );
189671
189672 xla_ae_lines_pkg.set_ccid(
189673 p_code_combination_id => l_ccid
189674 , p_value_type_code => l_adr_value_type_code
189675 , p_transaction_coa_id => l_adr_transaction_coa_id
189676 , p_accounting_coa_id => l_adr_accounting_coa_id
189677 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
189678 , p_adr_type_code => 'S'
189679 , p_component_type => l_component_type
189680 , p_component_code => l_component_code
189681 , p_component_type_code => l_component_type_code
189682 , p_component_appl_id => l_component_appl_id
189683 , p_amb_context_code => l_amb_context_code
189684 , p_side => 'NA'
189685 );
189686
189687
189688 --
189689 --
189690 END IF;
189691 --
189692 -- Bug 4922099
189693 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
189694 (NVL(l_enc_upg_option, 'N') = 'O')
189695 ) AND
189696 (l_bflow_method_code = 'PRIOR_ENTRY')
189697 )
189698 THEN
189699 IF
189700 --
189701 1 = 2
189702 --
189703 THEN
189704 xla_accounting_err_pkg.build_message
189705 (p_appli_s_name => 'XLA'
189706 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
189707 ,p_token_1 => 'LINE_NUMBER'
189708 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
189709 ,p_token_2 => 'LINE_TYPE_NAME'
189710 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
189711 l_component_type
189712 ,l_component_code
189713 ,l_component_type_code
189714 ,l_component_appl_id
189715 ,l_amb_context_code
189716 ,l_entity_code
189717 ,l_event_class_code
189718 )
189719 ,p_token_3 => 'OWNER'
189720 ,p_value_3 => xla_lookups_pkg.get_meaning(
189721 p_lookup_type => 'XLA_OWNER_TYPE'
189722 ,p_lookup_code => l_component_type_code
189723 )
189724 ,p_token_4 => 'PRODUCT_NAME'
189725 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
189726 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
189727 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
189728 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
189729 ,p_ae_header_id => NULL
189730 );
189731
189732 IF (C_LEVEL_ERROR>= g_log_level) THEN
189733 trace
189734 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
189735 ,p_level => C_LEVEL_ERROR
189736 ,p_module => l_log_module);
189737 END IF;
189738 END IF;
189739 END IF;
189740 --
189741 --
189742 ------------------------------------------------------------------------------------------------
189743 -- 4219869 Business Flow
189744 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
189745 -- Prior Entry. Currently, the following code is always generated.
189746 ------------------------------------------------------------------------------------------------
189747 XLA_AE_LINES_PKG.ValidateCurrentLine;
189748
189749 ------------------------------------------------------------------------------------
189750 -- 4219869 Business Flow
189751 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
189752 ------------------------------------------------------------------------------------
189753 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
189754
189755 ----------------------------------------------------------------------------------
189756 -- 4219869 Business Flow
189757 -- Update journal entry status -- Need to generate this within IF <condition>
189761 ,p_balance_type_code => l_balance_type_code
189758 ----------------------------------------------------------------------------------
189759 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
189760 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
189762 );
189763
189764 -------------------------------------------------------------------------------------------
189765 -- 4262811 - Generate the Accrual Reversal lines
189766 -------------------------------------------------------------------------------------------
189767 BEGIN
189768 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
189769 (g_array_event(p_event_id).array_value_num('header_index'));
189770 IF l_acc_rev_flag IS NULL THEN
189771 l_acc_rev_flag := 'N';
189772 END IF;
189773 EXCEPTION
189774 WHEN OTHERS THEN
189775 l_acc_rev_flag := 'N';
189776 END;
189777 --
189778 IF (l_acc_rev_flag = 'Y') THEN
189779
189780 -- 4645092 ------------------------------------------------------------------------------
189781 -- To allow MPA report to determine if it should generate report process
189782 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
189783 ------------------------------------------------------------------------------------------
189784
189785 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
189786 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
189787 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
189788 -- call ADRs
189789 -- Bug 4922099
189790 --
189791 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
189792 (NVL(l_actual_upg_option, 'N') = 'O') OR
189793 (NVL(l_enc_upg_option, 'N') = 'O')
189794 )
189795 THEN
189796 NULL;
189797 --
189798 --
189799
189800 l_ccid := AcctDerRule_184(
189801 p_application_id => p_application_id
189802 , p_ae_header_id => l_ae_header_id
189803 , p_source_39 => p_source_39
189804 , x_transaction_coa_id => l_adr_transaction_coa_id
189805 , x_accounting_coa_id => l_adr_accounting_coa_id
189806 , x_value_type_code => l_adr_value_type_code
189807 , p_side => 'NA'
189808 );
189809
189810 xla_ae_lines_pkg.set_ccid(
189811 p_code_combination_id => l_ccid
189812 , p_value_type_code => l_adr_value_type_code
189813 , p_transaction_coa_id => l_adr_transaction_coa_id
189814 , p_accounting_coa_id => l_adr_accounting_coa_id
189815 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
189816 , p_adr_type_code => 'S'
189817 , p_component_type => l_component_type
189818 , p_component_code => l_component_code
189819 , p_component_type_code => l_component_type_code
189820 , p_component_appl_id => l_component_appl_id
189821 , p_amb_context_code => l_amb_context_code
189822 , p_side => 'NA'
189823 );
189824
189825
189826 --
189827 --
189828 END IF;
189829
189830 --
189831 -- Update the line information that should be overwritten
189832 --
189833 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
189834 p_header_num => 1);
189835 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
189836
189837 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
189838
189839 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
189840 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
189841 END IF;
189842
189843 --
189844 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
189845 --
189846 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
189847 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
189848 ELSE
189849 ---------------------------------------------------------------------------------------------------
189850 -- 4262811a Switch Sign
189851 ---------------------------------------------------------------------------------------------------
189852 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
189853 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
189854 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
189855 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
189856 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
189857 -- 5132302
189858 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
189859 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
189860
189861 END IF;
189862
189863 -- 4955764
189864 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
189868 XLA_AE_LINES_PKG.ValidateCurrentLine;
189865 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
189866
189867
189869 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
189870
189871 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
189872 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
189873 ,p_balance_type_code => l_balance_type_code);
189874
189875 END IF;
189876
189877 -----------------------------------------------------------------------------------------
189878 -- 4262811 Multiperiod Accounting
189879 -----------------------------------------------------------------------------------------
189880 -- No MPA option is assigned.
189881
189882
189883 END IF;
189884 END IF;
189885 --
189886
189887 --
189888 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
189889 trace
189890 (p_msg => 'END of AcctLineType_435'
189891 ,p_level => C_LEVEL_PROCEDURE
189892 ,p_module => l_log_module);
189893 END IF;
189894 --
189895 EXCEPTION
189896 WHEN xla_exceptions_pkg.application_exception THEN
189897 RAISE;
189898 WHEN OTHERS THEN
189899 xla_exceptions_pkg.raise_message
189900 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_435');
189901 END AcctLineType_435;
189902 --
189903
189904 ---------------------------------------
189905 --
189906 -- PRIVATE FUNCTION
189907 -- AcctLineType_436
189908 --
189909 ---------------------------------------
189910 PROCEDURE AcctLineType_436 (
189911 p_application_id IN NUMBER
189912 ,p_event_id IN NUMBER
189913 ,p_calculate_acctd_flag IN VARCHAR2
189914 ,p_calculate_g_l_flag IN VARCHAR2
189915 ,p_actual_flag IN OUT VARCHAR2
189916 ,p_balance_type_code OUT VARCHAR2
189917 ,p_gain_or_loss_ref OUT VARCHAR2
189918
189919 --Inflation Adjustment Type Description
189920 , p_source_2 IN VARCHAR2
189921 --Accounting Date
189922 , p_source_3 IN DATE
189923 --Inflation Depreciation Expense Ccid
189924 , p_source_39 IN NUMBER
189925 --Transaction Header Identifier
189926 , p_source_49 IN NUMBER
189927 --Adjustment Line Identifier
189928 , p_source_50 IN NUMBER
189929 --Distribution Type Code
189930 , p_source_51 IN VARCHAR2
189931 --Inflation Adjustment Type
189932 , p_source_64 IN VARCHAR2
189933 --Inflation Entered Amount
189934 , p_source_65 IN NUMBER
189935 --Inflation Currency Code
189936 , p_source_66 IN VARCHAR2
189937 )
189938 IS
189939
189940 l_component_type VARCHAR2(80);
189941 l_component_code VARCHAR2(30);
189942 l_component_type_code VARCHAR2(1);
189943 l_component_appl_id INTEGER;
189944 l_amb_context_code VARCHAR2(30);
189945 l_entity_code VARCHAR2(30);
189946 l_event_class_code VARCHAR2(30);
189947 l_ae_header_id NUMBER;
189948 l_event_type_code VARCHAR2(30);
189949 l_line_definition_code VARCHAR2(30);
189950 l_line_definition_owner_code VARCHAR2(1);
189951 --
189952 -- adr variables
189953 l_segment VARCHAR2(30);
189954 l_ccid NUMBER;
189955 l_adr_transaction_coa_id NUMBER;
189956 l_adr_accounting_coa_id NUMBER;
189957 l_adr_flexfield_segment_code VARCHAR2(30);
189958 l_adr_flex_value_set_id NUMBER;
189959 l_adr_value_type_code VARCHAR2(30);
189960 l_adr_value_combination_id NUMBER;
189961 l_adr_value_segment_code VARCHAR2(30);
189962
189963 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
189964 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
189965 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
189966 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
189967
189968 -- 4262811 Variables ------------------------------------------------------------------------------------------
189969 l_entered_amt_idx NUMBER;
189970 l_accted_amt_idx NUMBER;
189971 l_acc_rev_flag VARCHAR2(1);
189972 l_accrual_line_num NUMBER;
189973 l_tmp_amt NUMBER;
189974 l_acc_rev_natural_side_code VARCHAR2(1);
189975
189976 l_num_entries NUMBER;
189977 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
189978 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
189979 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
189980 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
189981 l_recog_line_1 NUMBER;
189982 l_recog_line_2 NUMBER;
189983
189984 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
189985 l_bflow_applied_to_amt NUMBER; -- 5132302
189986 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
189987
189988 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
189989
189990 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
189991 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
189992
189993 ---------------------------------------------------------------------------------------------------------------
189994
189995
189999 l_balance_type_code VARCHAR2(1);
189996 --
189997 -- bulk performance
189998 --
190000 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
190001 l_log_module VARCHAR2(240);
190002
190003 --
190004 -- Upgrade strategy
190005 --
190006 l_actual_upg_option VARCHAR2(1);
190007 l_enc_upg_option VARCHAR2(1);
190008
190009 --
190010 BEGIN
190011 --
190012 IF g_log_enabled THEN
190013 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_436';
190014 END IF;
190015 --
190016 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
190017
190018 trace
190019 (p_msg => 'BEGIN of AcctLineType_436'
190020 ,p_level => C_LEVEL_PROCEDURE
190021 ,p_module => l_log_module);
190022
190023 END IF;
190024 --
190025 l_component_type := 'AMB_JLT';
190026 l_component_code := 'IAC_DEPRECIATION_EXPENSE';
190027 l_component_type_code := 'S';
190028 l_component_appl_id := 140;
190029 l_amb_context_code := 'DEFAULT';
190030 l_entity_code := 'TRANSACTIONS';
190031 l_event_class_code := 'CATEGORY_RECLASS';
190032 l_event_type_code := 'CATEGORY_RECLASS_ALL';
190033 l_line_definition_owner_code := 'S';
190034 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
190035 --
190036 l_balance_type_code := 'A';
190037 l_segment := NULL;
190038 l_ccid := NULL;
190039 l_adr_transaction_coa_id := NULL;
190040 l_adr_accounting_coa_id := NULL;
190041 l_adr_flexfield_segment_code := NULL;
190042 l_adr_flex_value_set_id := NULL;
190043 l_adr_value_type_code := NULL;
190044 l_adr_value_combination_id := NULL;
190045 l_adr_value_segment_code := NULL;
190046
190047 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
190048 l_bflow_class_code := ''; -- 4219869 Business Flow
190049 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
190050 l_budgetary_control_flag := 'N';
190051
190052 l_bflow_applied_to_amt_idx := NULL; -- 5132302
190053 l_bflow_applied_to_amt := NULL; -- 5132302
190054 l_entered_amt_idx := NULL; -- 4262811
190055 l_accted_amt_idx := NULL; -- 4262811
190056 l_acc_rev_flag := NULL; -- 4262811
190057 l_accrual_line_num := NULL; -- 4262811
190058 l_tmp_amt := NULL; -- 4262811
190059 --
190060
190061 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
190062 l_balance_type_code <> 'B' THEN
190063 IF NVL(p_source_64,'
190064 ') = 'EXPENSE'
190065 THEN
190066
190067 --
190068 XLA_AE_LINES_PKG.SetNewLine;
190069
190070 p_balance_type_code := l_balance_type_code;
190071 -- set the flag so later we will know whether the gain loss line needs to be created
190072
190073 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
190074 p_actual_flag :='A';
190075 END IF;
190076
190077 --
190078 -- bulk performance
190079 --
190080 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
190081 p_header_num => 0); -- 4262811
190082 --
190083 -- set accounting line options
190084 --
190085 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
190086 p_natural_side_code => 'D'
190087 , p_gain_or_loss_flag => 'N'
190088 , p_gl_transfer_mode_code => 'S'
190089 , p_acct_entry_type_code => 'A'
190090 , p_switch_side_flag => 'Y'
190091 , p_merge_duplicate_code => 'N'
190092 );
190093 --
190094 l_acc_rev_natural_side_code := 'C'; -- 4262811
190095 --
190096 --
190097 -- set accounting line type info
190098 --
190099 xla_ae_lines_pkg.SetAcctLineType
190100 (p_component_type => l_component_type
190101 ,p_event_type_code => l_event_type_code
190102 ,p_line_definition_owner_code => l_line_definition_owner_code
190103 ,p_line_definition_code => l_line_definition_code
190104 ,p_accounting_line_code => l_component_code
190105 ,p_accounting_line_type_code => l_component_type_code
190106 ,p_accounting_line_appl_id => l_component_appl_id
190107 ,p_amb_context_code => l_amb_context_code
190108 ,p_entity_code => l_entity_code
190109 ,p_event_class_code => l_event_class_code);
190110 --
190111 -- set accounting class
190112 --
190113 xla_ae_lines_pkg.SetAcctClass(
190114 p_accounting_class_code => 'EXPENSE'
190115 , p_ae_header_id => l_ae_header_id
190116 );
190117
190118 --
190119 -- set rounding class
190120 --
190121 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
190122 'EXPENSE';
190123
190124 --
190125 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
190126 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
190127 --
190128 -- bulk performance
190129 --
190133 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
190130 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
190131
190132 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
190134
190135 -- 4955764
190136 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
190137 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
190138
190139 -- 4458381 Public Sector Enh
190140
190141 --
190142 -- set accounting attributes for the line type
190143 --
190144 l_entered_amt_idx := 4;
190145 l_accted_amt_idx := 6;
190146 l_bflow_applied_to_amt_idx := NULL; -- 5132302
190147 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
190148 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
190149 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
190150 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
190151 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
190152 l_rec_acct_attrs.array_char_value(3) := p_source_51;
190153 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
190154 l_rec_acct_attrs.array_num_value(4) := p_source_65;
190155 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
190156 l_rec_acct_attrs.array_char_value(5) := p_source_66;
190157 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
190158 l_rec_acct_attrs.array_num_value(6) := p_source_65;
190159
190160 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
190161 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
190162
190163 ---------------------------------------------------------------------------------------------------------------
190164 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
190165 ---------------------------------------------------------------------------------------------------------------
190166 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
190167
190168 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
190169 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
190170
190171 IF xla_accounting_cache_pkg.GetValueChar
190172 (p_source_code => 'LEDGER_CATEGORY_CODE'
190173 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
190174 AND l_bflow_method_code = 'PRIOR_ENTRY'
190175 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
190176 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
190177 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
190178 )
190179 THEN
190180 xla_ae_lines_pkg.BflowUpgEntry
190181 (p_business_method_code => l_bflow_method_code
190182 ,p_business_class_code => l_bflow_class_code
190183 ,p_balance_type => l_balance_type_code);
190184 ELSE
190185 NULL;
190186 -- No business flow processing for business flow method of NONE.
190187 END IF;
190188
190189 --
190190 -- call analytical criteria
190191 --
190192
190193 --
190194 -- call description
190195 --
190196
190197 xla_ae_lines_pkg.SetLineDescription(
190198 p_ae_header_id => l_ae_header_id
190199 ,p_description => Description_143 (
190200 p_application_id => p_application_id
190201 , p_ae_header_id => l_ae_header_id
190202 , p_source_2 => p_source_2
190203 , p_source_3 => p_source_3
190204 )
190205 );
190206
190207
190208 --
190209 -- call ADRs
190210 -- Bug 4922099
190211 --
190212 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
190213 (NVL(l_actual_upg_option, 'N') = 'O') OR
190214 (NVL(l_enc_upg_option, 'N') = 'O')
190215 )
190216 THEN
190217 NULL;
190218 --
190219 --
190220
190221 l_ccid := AcctDerRule_184(
190222 p_application_id => p_application_id
190223 , p_ae_header_id => l_ae_header_id
190224 , p_source_39 => p_source_39
190225 , x_transaction_coa_id => l_adr_transaction_coa_id
190226 , x_accounting_coa_id => l_adr_accounting_coa_id
190227 , x_value_type_code => l_adr_value_type_code
190228 , p_side => 'NA'
190229 );
190230
190231 xla_ae_lines_pkg.set_ccid(
190232 p_code_combination_id => l_ccid
190233 , p_value_type_code => l_adr_value_type_code
190234 , p_transaction_coa_id => l_adr_transaction_coa_id
190235 , p_accounting_coa_id => l_adr_accounting_coa_id
190236 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
190237 , p_adr_type_code => 'S'
190238 , p_component_type => l_component_type
190239 , p_component_code => l_component_code
190240 , p_component_type_code => l_component_type_code
190241 , p_component_appl_id => l_component_appl_id
190242 , p_amb_context_code => l_amb_context_code
190243 , p_side => 'NA'
190244 );
190245
190246
190247 --
190248 --
190249 END IF;
190250 --
190254 ) AND
190251 -- Bug 4922099
190252 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
190253 (NVL(l_enc_upg_option, 'N') = 'O')
190255 (l_bflow_method_code = 'PRIOR_ENTRY')
190256 )
190257 THEN
190258 IF
190259 --
190260 1 = 2
190261 --
190262 THEN
190263 xla_accounting_err_pkg.build_message
190264 (p_appli_s_name => 'XLA'
190265 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
190266 ,p_token_1 => 'LINE_NUMBER'
190267 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
190268 ,p_token_2 => 'LINE_TYPE_NAME'
190269 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
190270 l_component_type
190271 ,l_component_code
190272 ,l_component_type_code
190273 ,l_component_appl_id
190274 ,l_amb_context_code
190275 ,l_entity_code
190276 ,l_event_class_code
190277 )
190278 ,p_token_3 => 'OWNER'
190279 ,p_value_3 => xla_lookups_pkg.get_meaning(
190280 p_lookup_type => 'XLA_OWNER_TYPE'
190281 ,p_lookup_code => l_component_type_code
190282 )
190283 ,p_token_4 => 'PRODUCT_NAME'
190284 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
190285 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
190286 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
190287 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
190288 ,p_ae_header_id => NULL
190289 );
190290
190291 IF (C_LEVEL_ERROR>= g_log_level) THEN
190292 trace
190293 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
190294 ,p_level => C_LEVEL_ERROR
190295 ,p_module => l_log_module);
190296 END IF;
190297 END IF;
190298 END IF;
190299 --
190300 --
190301 ------------------------------------------------------------------------------------------------
190302 -- 4219869 Business Flow
190303 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
190304 -- Prior Entry. Currently, the following code is always generated.
190305 ------------------------------------------------------------------------------------------------
190306 XLA_AE_LINES_PKG.ValidateCurrentLine;
190307
190308 ------------------------------------------------------------------------------------
190309 -- 4219869 Business Flow
190310 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
190311 ------------------------------------------------------------------------------------
190312 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
190313
190314 ----------------------------------------------------------------------------------
190315 -- 4219869 Business Flow
190316 -- Update journal entry status -- Need to generate this within IF <condition>
190317 ----------------------------------------------------------------------------------
190318 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
190319 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
190320 ,p_balance_type_code => l_balance_type_code
190321 );
190322
190323 -------------------------------------------------------------------------------------------
190324 -- 4262811 - Generate the Accrual Reversal lines
190325 -------------------------------------------------------------------------------------------
190326 BEGIN
190327 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
190328 (g_array_event(p_event_id).array_value_num('header_index'));
190329 IF l_acc_rev_flag IS NULL THEN
190330 l_acc_rev_flag := 'N';
190331 END IF;
190332 EXCEPTION
190333 WHEN OTHERS THEN
190334 l_acc_rev_flag := 'N';
190335 END;
190336 --
190337 IF (l_acc_rev_flag = 'Y') THEN
190338
190339 -- 4645092 ------------------------------------------------------------------------------
190340 -- To allow MPA report to determine if it should generate report process
190341 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
190342 ------------------------------------------------------------------------------------------
190343
190344 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
190345 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
190349 --
190346 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
190347 -- call ADRs
190348 -- Bug 4922099
190350 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
190351 (NVL(l_actual_upg_option, 'N') = 'O') OR
190352 (NVL(l_enc_upg_option, 'N') = 'O')
190353 )
190354 THEN
190355 NULL;
190356 --
190357 --
190358
190359 l_ccid := AcctDerRule_184(
190360 p_application_id => p_application_id
190361 , p_ae_header_id => l_ae_header_id
190362 , p_source_39 => p_source_39
190363 , x_transaction_coa_id => l_adr_transaction_coa_id
190364 , x_accounting_coa_id => l_adr_accounting_coa_id
190365 , x_value_type_code => l_adr_value_type_code
190366 , p_side => 'NA'
190367 );
190368
190369 xla_ae_lines_pkg.set_ccid(
190370 p_code_combination_id => l_ccid
190371 , p_value_type_code => l_adr_value_type_code
190372 , p_transaction_coa_id => l_adr_transaction_coa_id
190373 , p_accounting_coa_id => l_adr_accounting_coa_id
190374 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
190375 , p_adr_type_code => 'S'
190376 , p_component_type => l_component_type
190377 , p_component_code => l_component_code
190378 , p_component_type_code => l_component_type_code
190379 , p_component_appl_id => l_component_appl_id
190380 , p_amb_context_code => l_amb_context_code
190381 , p_side => 'NA'
190382 );
190383
190384
190385 --
190386 --
190387 END IF;
190388
190389 --
190390 -- Update the line information that should be overwritten
190391 --
190392 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
190393 p_header_num => 1);
190394 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
190395
190396 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
190397
190398 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
190399 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
190400 END IF;
190401
190402 --
190403 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
190404 --
190405 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
190406 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
190407 ELSE
190408 ---------------------------------------------------------------------------------------------------
190409 -- 4262811a Switch Sign
190410 ---------------------------------------------------------------------------------------------------
190411 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
190412 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
190413 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
190414 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
190415 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
190416 -- 5132302
190417 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
190418 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
190419
190420 END IF;
190421
190422 -- 4955764
190423 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
190424 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
190425
190426
190427 XLA_AE_LINES_PKG.ValidateCurrentLine;
190428 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
190429
190430 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
190431 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
190432 ,p_balance_type_code => l_balance_type_code);
190433
190434 END IF;
190435
190436 -----------------------------------------------------------------------------------------
190437 -- 4262811 Multiperiod Accounting
190438 -----------------------------------------------------------------------------------------
190439 -- No MPA option is assigned.
190440
190441
190442 END IF;
190443 END IF;
190444 --
190445
190446 --
190447 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
190448 trace
190449 (p_msg => 'END of AcctLineType_436'
190450 ,p_level => C_LEVEL_PROCEDURE
190451 ,p_module => l_log_module);
190452 END IF;
190453 --
190454 EXCEPTION
190455 WHEN xla_exceptions_pkg.application_exception THEN
190456 RAISE;
190457 WHEN OTHERS THEN
190458 xla_exceptions_pkg.raise_message
190459 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_436');
190460 END AcctLineType_436;
190461 --
190462
190463 ---------------------------------------
190464 --
190465 -- PRIVATE FUNCTION
190466 -- AcctLineType_437
190470 p_application_id IN NUMBER
190467 --
190468 ---------------------------------------
190469 PROCEDURE AcctLineType_437 (
190471 ,p_event_id IN NUMBER
190472 ,p_calculate_acctd_flag IN VARCHAR2
190473 ,p_calculate_g_l_flag IN VARCHAR2
190474 ,p_actual_flag IN OUT VARCHAR2
190475 ,p_balance_type_code OUT VARCHAR2
190476 ,p_gain_or_loss_ref OUT VARCHAR2
190477
190478 --Inflation Adjustment Type Description
190479 , p_source_2 IN VARCHAR2
190480 --Accounting Date
190481 , p_source_3 IN DATE
190482 --Inflation Depreciation Expense Ccid
190483 , p_source_39 IN NUMBER
190484 --Transaction Header Identifier
190485 , p_source_49 IN NUMBER
190486 --Adjustment Line Identifier
190487 , p_source_50 IN NUMBER
190488 --Distribution Type Code
190489 , p_source_51 IN VARCHAR2
190490 --Inflation Adjustment Type
190491 , p_source_64 IN VARCHAR2
190492 --Inflation Entered Amount
190493 , p_source_65 IN NUMBER
190494 --Inflation Currency Code
190495 , p_source_66 IN VARCHAR2
190496 )
190497 IS
190498
190499 l_component_type VARCHAR2(80);
190500 l_component_code VARCHAR2(30);
190501 l_component_type_code VARCHAR2(1);
190502 l_component_appl_id INTEGER;
190503 l_amb_context_code VARCHAR2(30);
190504 l_entity_code VARCHAR2(30);
190505 l_event_class_code VARCHAR2(30);
190506 l_ae_header_id NUMBER;
190507 l_event_type_code VARCHAR2(30);
190508 l_line_definition_code VARCHAR2(30);
190509 l_line_definition_owner_code VARCHAR2(1);
190510 --
190511 -- adr variables
190512 l_segment VARCHAR2(30);
190513 l_ccid NUMBER;
190514 l_adr_transaction_coa_id NUMBER;
190515 l_adr_accounting_coa_id NUMBER;
190516 l_adr_flexfield_segment_code VARCHAR2(30);
190517 l_adr_flex_value_set_id NUMBER;
190518 l_adr_value_type_code VARCHAR2(30);
190519 l_adr_value_combination_id NUMBER;
190520 l_adr_value_segment_code VARCHAR2(30);
190521
190522 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
190523 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
190524 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
190525 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
190526
190527 -- 4262811 Variables ------------------------------------------------------------------------------------------
190528 l_entered_amt_idx NUMBER;
190529 l_accted_amt_idx NUMBER;
190530 l_acc_rev_flag VARCHAR2(1);
190531 l_accrual_line_num NUMBER;
190532 l_tmp_amt NUMBER;
190533 l_acc_rev_natural_side_code VARCHAR2(1);
190534
190535 l_num_entries NUMBER;
190536 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
190537 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
190538 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
190539 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
190540 l_recog_line_1 NUMBER;
190541 l_recog_line_2 NUMBER;
190542
190543 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
190544 l_bflow_applied_to_amt NUMBER; -- 5132302
190545 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
190546
190547 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
190548
190549 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
190550 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
190551
190552 ---------------------------------------------------------------------------------------------------------------
190553
190554
190555 --
190556 -- bulk performance
190557 --
190558 l_balance_type_code VARCHAR2(1);
190559 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
190560 l_log_module VARCHAR2(240);
190561
190562 --
190563 -- Upgrade strategy
190564 --
190565 l_actual_upg_option VARCHAR2(1);
190566 l_enc_upg_option VARCHAR2(1);
190567
190568 --
190569 BEGIN
190570 --
190571 IF g_log_enabled THEN
190572 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_437';
190573 END IF;
190574 --
190575 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
190576
190577 trace
190578 (p_msg => 'BEGIN of AcctLineType_437'
190579 ,p_level => C_LEVEL_PROCEDURE
190580 ,p_module => l_log_module);
190581
190582 END IF;
190583 --
190584 l_component_type := 'AMB_JLT';
190585 l_component_code := 'IAC_DEPRECIATION_EXPENSE';
190586 l_component_type_code := 'S';
190587 l_component_appl_id := 140;
190588 l_amb_context_code := 'DEFAULT';
190589 l_entity_code := 'TRANSACTIONS';
190590 l_event_class_code := 'TRANSFERS';
190591 l_event_type_code := 'TRANSFERS_ALL';
190592 l_line_definition_owner_code := 'S';
190593 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
190594 --
190595 l_balance_type_code := 'A';
190596 l_segment := NULL;
190597 l_ccid := NULL;
190598 l_adr_transaction_coa_id := NULL;
190602 l_adr_value_type_code := NULL;
190599 l_adr_accounting_coa_id := NULL;
190600 l_adr_flexfield_segment_code := NULL;
190601 l_adr_flex_value_set_id := NULL;
190603 l_adr_value_combination_id := NULL;
190604 l_adr_value_segment_code := NULL;
190605
190606 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
190607 l_bflow_class_code := ''; -- 4219869 Business Flow
190608 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
190609 l_budgetary_control_flag := 'N';
190610
190611 l_bflow_applied_to_amt_idx := NULL; -- 5132302
190612 l_bflow_applied_to_amt := NULL; -- 5132302
190613 l_entered_amt_idx := NULL; -- 4262811
190614 l_accted_amt_idx := NULL; -- 4262811
190615 l_acc_rev_flag := NULL; -- 4262811
190616 l_accrual_line_num := NULL; -- 4262811
190617 l_tmp_amt := NULL; -- 4262811
190618 --
190619
190620 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
190621 l_balance_type_code <> 'B' THEN
190622 IF NVL(p_source_64,'
190623 ') = 'EXPENSE'
190624 THEN
190625
190626 --
190627 XLA_AE_LINES_PKG.SetNewLine;
190628
190629 p_balance_type_code := l_balance_type_code;
190630 -- set the flag so later we will know whether the gain loss line needs to be created
190631
190632 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
190633 p_actual_flag :='A';
190634 END IF;
190635
190636 --
190637 -- bulk performance
190638 --
190639 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
190640 p_header_num => 0); -- 4262811
190641 --
190642 -- set accounting line options
190643 --
190644 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
190645 p_natural_side_code => 'D'
190646 , p_gain_or_loss_flag => 'N'
190647 , p_gl_transfer_mode_code => 'S'
190648 , p_acct_entry_type_code => 'A'
190649 , p_switch_side_flag => 'Y'
190650 , p_merge_duplicate_code => 'N'
190651 );
190652 --
190653 l_acc_rev_natural_side_code := 'C'; -- 4262811
190654 --
190655 --
190656 -- set accounting line type info
190657 --
190658 xla_ae_lines_pkg.SetAcctLineType
190659 (p_component_type => l_component_type
190660 ,p_event_type_code => l_event_type_code
190661 ,p_line_definition_owner_code => l_line_definition_owner_code
190662 ,p_line_definition_code => l_line_definition_code
190663 ,p_accounting_line_code => l_component_code
190664 ,p_accounting_line_type_code => l_component_type_code
190665 ,p_accounting_line_appl_id => l_component_appl_id
190666 ,p_amb_context_code => l_amb_context_code
190667 ,p_entity_code => l_entity_code
190668 ,p_event_class_code => l_event_class_code);
190669 --
190670 -- set accounting class
190671 --
190672 xla_ae_lines_pkg.SetAcctClass(
190673 p_accounting_class_code => 'EXPENSE'
190674 , p_ae_header_id => l_ae_header_id
190675 );
190676
190677 --
190678 -- set rounding class
190679 --
190680 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
190681 'EXPENSE';
190682
190683 --
190684 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
190685 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
190686 --
190687 -- bulk performance
190688 --
190689 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
190690
190691 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
190692 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
190693
190694 -- 4955764
190695 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
190696 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
190697
190698 -- 4458381 Public Sector Enh
190699
190700 --
190701 -- set accounting attributes for the line type
190702 --
190703 l_entered_amt_idx := 4;
190704 l_accted_amt_idx := 6;
190705 l_bflow_applied_to_amt_idx := NULL; -- 5132302
190706 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
190707 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
190708 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
190709 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
190710 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
190711 l_rec_acct_attrs.array_char_value(3) := p_source_51;
190712 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
190713 l_rec_acct_attrs.array_num_value(4) := p_source_65;
190714 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
190715 l_rec_acct_attrs.array_char_value(5) := p_source_66;
190716 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
190717 l_rec_acct_attrs.array_num_value(6) := p_source_65;
190718
190719 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
190723 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
190720 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
190721
190722 ---------------------------------------------------------------------------------------------------------------
190724 ---------------------------------------------------------------------------------------------------------------
190725 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
190726
190727 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
190728 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
190729
190730 IF xla_accounting_cache_pkg.GetValueChar
190731 (p_source_code => 'LEDGER_CATEGORY_CODE'
190732 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
190733 AND l_bflow_method_code = 'PRIOR_ENTRY'
190734 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
190735 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
190736 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
190737 )
190738 THEN
190739 xla_ae_lines_pkg.BflowUpgEntry
190740 (p_business_method_code => l_bflow_method_code
190741 ,p_business_class_code => l_bflow_class_code
190742 ,p_balance_type => l_balance_type_code);
190743 ELSE
190744 NULL;
190745 -- No business flow processing for business flow method of NONE.
190746 END IF;
190747
190748 --
190749 -- call analytical criteria
190750 --
190751
190752 --
190753 -- call description
190754 --
190755
190756 xla_ae_lines_pkg.SetLineDescription(
190757 p_ae_header_id => l_ae_header_id
190758 ,p_description => Description_143 (
190759 p_application_id => p_application_id
190760 , p_ae_header_id => l_ae_header_id
190761 , p_source_2 => p_source_2
190762 , p_source_3 => p_source_3
190763 )
190764 );
190765
190766
190767 --
190768 -- call ADRs
190769 -- Bug 4922099
190770 --
190771 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
190772 (NVL(l_actual_upg_option, 'N') = 'O') OR
190773 (NVL(l_enc_upg_option, 'N') = 'O')
190774 )
190775 THEN
190776 NULL;
190777 --
190778 --
190779
190780 l_ccid := AcctDerRule_184(
190781 p_application_id => p_application_id
190782 , p_ae_header_id => l_ae_header_id
190783 , p_source_39 => p_source_39
190784 , x_transaction_coa_id => l_adr_transaction_coa_id
190785 , x_accounting_coa_id => l_adr_accounting_coa_id
190786 , x_value_type_code => l_adr_value_type_code
190787 , p_side => 'NA'
190788 );
190789
190790 xla_ae_lines_pkg.set_ccid(
190791 p_code_combination_id => l_ccid
190792 , p_value_type_code => l_adr_value_type_code
190793 , p_transaction_coa_id => l_adr_transaction_coa_id
190794 , p_accounting_coa_id => l_adr_accounting_coa_id
190795 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
190796 , p_adr_type_code => 'S'
190797 , p_component_type => l_component_type
190798 , p_component_code => l_component_code
190799 , p_component_type_code => l_component_type_code
190800 , p_component_appl_id => l_component_appl_id
190801 , p_amb_context_code => l_amb_context_code
190802 , p_side => 'NA'
190803 );
190804
190805
190806 --
190807 --
190808 END IF;
190809 --
190810 -- Bug 4922099
190811 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
190812 (NVL(l_enc_upg_option, 'N') = 'O')
190813 ) AND
190814 (l_bflow_method_code = 'PRIOR_ENTRY')
190815 )
190816 THEN
190817 IF
190818 --
190819 1 = 2
190820 --
190821 THEN
190822 xla_accounting_err_pkg.build_message
190823 (p_appli_s_name => 'XLA'
190824 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
190825 ,p_token_1 => 'LINE_NUMBER'
190826 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
190827 ,p_token_2 => 'LINE_TYPE_NAME'
190828 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
190829 l_component_type
190830 ,l_component_code
190831 ,l_component_type_code
190832 ,l_component_appl_id
190833 ,l_amb_context_code
190834 ,l_entity_code
190835 ,l_event_class_code
190836 )
190840 ,p_lookup_code => l_component_type_code
190837 ,p_token_3 => 'OWNER'
190838 ,p_value_3 => xla_lookups_pkg.get_meaning(
190839 p_lookup_type => 'XLA_OWNER_TYPE'
190841 )
190842 ,p_token_4 => 'PRODUCT_NAME'
190843 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
190844 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
190845 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
190846 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
190847 ,p_ae_header_id => NULL
190848 );
190849
190850 IF (C_LEVEL_ERROR>= g_log_level) THEN
190851 trace
190852 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
190853 ,p_level => C_LEVEL_ERROR
190854 ,p_module => l_log_module);
190855 END IF;
190856 END IF;
190857 END IF;
190858 --
190859 --
190860 ------------------------------------------------------------------------------------------------
190861 -- 4219869 Business Flow
190862 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
190863 -- Prior Entry. Currently, the following code is always generated.
190864 ------------------------------------------------------------------------------------------------
190865 XLA_AE_LINES_PKG.ValidateCurrentLine;
190866
190867 ------------------------------------------------------------------------------------
190868 -- 4219869 Business Flow
190869 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
190870 ------------------------------------------------------------------------------------
190871 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
190872
190873 ----------------------------------------------------------------------------------
190874 -- 4219869 Business Flow
190875 -- Update journal entry status -- Need to generate this within IF <condition>
190876 ----------------------------------------------------------------------------------
190877 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
190878 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
190879 ,p_balance_type_code => l_balance_type_code
190880 );
190881
190882 -------------------------------------------------------------------------------------------
190883 -- 4262811 - Generate the Accrual Reversal lines
190884 -------------------------------------------------------------------------------------------
190885 BEGIN
190886 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
190887 (g_array_event(p_event_id).array_value_num('header_index'));
190888 IF l_acc_rev_flag IS NULL THEN
190889 l_acc_rev_flag := 'N';
190890 END IF;
190891 EXCEPTION
190892 WHEN OTHERS THEN
190893 l_acc_rev_flag := 'N';
190894 END;
190895 --
190896 IF (l_acc_rev_flag = 'Y') THEN
190897
190898 -- 4645092 ------------------------------------------------------------------------------
190899 -- To allow MPA report to determine if it should generate report process
190900 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
190901 ------------------------------------------------------------------------------------------
190902
190903 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
190904 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
190905 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
190906 -- call ADRs
190907 -- Bug 4922099
190908 --
190909 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
190910 (NVL(l_actual_upg_option, 'N') = 'O') OR
190911 (NVL(l_enc_upg_option, 'N') = 'O')
190912 )
190913 THEN
190914 NULL;
190915 --
190916 --
190917
190918 l_ccid := AcctDerRule_184(
190919 p_application_id => p_application_id
190920 , p_ae_header_id => l_ae_header_id
190921 , p_source_39 => p_source_39
190922 , x_transaction_coa_id => l_adr_transaction_coa_id
190923 , x_accounting_coa_id => l_adr_accounting_coa_id
190924 , x_value_type_code => l_adr_value_type_code
190925 , p_side => 'NA'
190926 );
190927
190928 xla_ae_lines_pkg.set_ccid(
190929 p_code_combination_id => l_ccid
190930 , p_value_type_code => l_adr_value_type_code
190931 , p_transaction_coa_id => l_adr_transaction_coa_id
190932 , p_accounting_coa_id => l_adr_accounting_coa_id
190933 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
190934 , p_adr_type_code => 'S'
190935 , p_component_type => l_component_type
190936 , p_component_code => l_component_code
190937 , p_component_type_code => l_component_type_code
190938 , p_component_appl_id => l_component_appl_id
190939 , p_amb_context_code => l_amb_context_code
190943
190940 , p_side => 'NA'
190941 );
190942
190944 --
190945 --
190946 END IF;
190947
190948 --
190949 -- Update the line information that should be overwritten
190950 --
190951 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
190952 p_header_num => 1);
190953 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
190954
190955 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
190956
190957 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
190958 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
190959 END IF;
190960
190961 --
190962 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
190963 --
190964 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
190965 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
190966 ELSE
190967 ---------------------------------------------------------------------------------------------------
190968 -- 4262811a Switch Sign
190969 ---------------------------------------------------------------------------------------------------
190970 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
190971 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
190972 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
190973 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
190974 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
190975 -- 5132302
190976 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
190977 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
190978
190979 END IF;
190980
190981 -- 4955764
190982 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
190983 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
190984
190985
190986 XLA_AE_LINES_PKG.ValidateCurrentLine;
190987 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
190988
190989 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
190990 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
190991 ,p_balance_type_code => l_balance_type_code);
190992
190993 END IF;
190994
190995 -----------------------------------------------------------------------------------------
190996 -- 4262811 Multiperiod Accounting
190997 -----------------------------------------------------------------------------------------
190998 -- No MPA option is assigned.
190999
191000
191001 END IF;
191002 END IF;
191003 --
191004
191005 --
191006 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
191007 trace
191008 (p_msg => 'END of AcctLineType_437'
191009 ,p_level => C_LEVEL_PROCEDURE
191010 ,p_module => l_log_module);
191011 END IF;
191012 --
191013 EXCEPTION
191014 WHEN xla_exceptions_pkg.application_exception THEN
191015 RAISE;
191016 WHEN OTHERS THEN
191017 xla_exceptions_pkg.raise_message
191018 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_437');
191019 END AcctLineType_437;
191020 --
191021
191022 ---------------------------------------
191023 --
191024 -- PRIVATE FUNCTION
191025 -- AcctLineType_438
191026 --
191027 ---------------------------------------
191028 PROCEDURE AcctLineType_438 (
191029 p_application_id IN NUMBER
191030 ,p_event_id IN NUMBER
191031 ,p_calculate_acctd_flag IN VARCHAR2
191032 ,p_calculate_g_l_flag IN VARCHAR2
191033 ,p_actual_flag IN OUT VARCHAR2
191034 ,p_balance_type_code OUT VARCHAR2
191035 ,p_gain_or_loss_ref OUT VARCHAR2
191036
191037 --Inflation Adjustment Type Description
191038 , p_source_2 IN VARCHAR2
191039 --Accounting Date
191040 , p_source_3 IN DATE
191041 --Inflation Depreciation Expense Ccid
191042 , p_source_39 IN NUMBER
191043 --Transaction Header Identifier
191044 , p_source_49 IN NUMBER
191045 --Adjustment Line Identifier
191046 , p_source_50 IN NUMBER
191047 --Distribution Type Code
191048 , p_source_51 IN VARCHAR2
191049 --Inflation Adjustment Type
191050 , p_source_64 IN VARCHAR2
191051 --Inflation Entered Amount
191052 , p_source_65 IN NUMBER
191053 --Inflation Currency Code
191054 , p_source_66 IN VARCHAR2
191055 )
191056 IS
191057
191058 l_component_type VARCHAR2(80);
191059 l_component_code VARCHAR2(30);
191060 l_component_type_code VARCHAR2(1);
191061 l_component_appl_id INTEGER;
191062 l_amb_context_code VARCHAR2(30);
191063 l_entity_code VARCHAR2(30);
191064 l_event_class_code VARCHAR2(30);
191065 l_ae_header_id NUMBER;
191066 l_event_type_code VARCHAR2(30);
191070 -- adr variables
191067 l_line_definition_code VARCHAR2(30);
191068 l_line_definition_owner_code VARCHAR2(1);
191069 --
191071 l_segment VARCHAR2(30);
191072 l_ccid NUMBER;
191073 l_adr_transaction_coa_id NUMBER;
191074 l_adr_accounting_coa_id NUMBER;
191075 l_adr_flexfield_segment_code VARCHAR2(30);
191076 l_adr_flex_value_set_id NUMBER;
191077 l_adr_value_type_code VARCHAR2(30);
191078 l_adr_value_combination_id NUMBER;
191079 l_adr_value_segment_code VARCHAR2(30);
191080
191081 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
191082 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
191083 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
191084 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
191085
191086 -- 4262811 Variables ------------------------------------------------------------------------------------------
191087 l_entered_amt_idx NUMBER;
191088 l_accted_amt_idx NUMBER;
191089 l_acc_rev_flag VARCHAR2(1);
191090 l_accrual_line_num NUMBER;
191091 l_tmp_amt NUMBER;
191092 l_acc_rev_natural_side_code VARCHAR2(1);
191093
191094 l_num_entries NUMBER;
191095 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
191096 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
191097 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
191098 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
191099 l_recog_line_1 NUMBER;
191100 l_recog_line_2 NUMBER;
191101
191102 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
191103 l_bflow_applied_to_amt NUMBER; -- 5132302
191104 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
191105
191106 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
191107
191108 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
191109 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
191110
191111 ---------------------------------------------------------------------------------------------------------------
191112
191113
191114 --
191115 -- bulk performance
191116 --
191117 l_balance_type_code VARCHAR2(1);
191118 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
191119 l_log_module VARCHAR2(240);
191120
191121 --
191122 -- Upgrade strategy
191123 --
191124 l_actual_upg_option VARCHAR2(1);
191125 l_enc_upg_option VARCHAR2(1);
191126
191127 --
191128 BEGIN
191129 --
191130 IF g_log_enabled THEN
191131 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_438';
191132 END IF;
191133 --
191134 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
191135
191136 trace
191137 (p_msg => 'BEGIN of AcctLineType_438'
191138 ,p_level => C_LEVEL_PROCEDURE
191139 ,p_module => l_log_module);
191140
191141 END IF;
191142 --
191143 l_component_type := 'AMB_JLT';
191144 l_component_code := 'IAC_DEPRECIATION_EXPENSE';
191145 l_component_type_code := 'S';
191146 l_component_appl_id := 140;
191147 l_amb_context_code := 'DEFAULT';
191148 l_entity_code := 'TRANSACTIONS';
191149 l_event_class_code := 'ADDITIONS';
191150 l_event_type_code := 'ADDITIONS_ALL';
191151 l_line_definition_owner_code := 'S';
191152 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
191153 --
191154 l_balance_type_code := 'A';
191155 l_segment := NULL;
191156 l_ccid := NULL;
191157 l_adr_transaction_coa_id := NULL;
191158 l_adr_accounting_coa_id := NULL;
191159 l_adr_flexfield_segment_code := NULL;
191160 l_adr_flex_value_set_id := NULL;
191161 l_adr_value_type_code := NULL;
191162 l_adr_value_combination_id := NULL;
191163 l_adr_value_segment_code := NULL;
191164
191165 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
191166 l_bflow_class_code := ''; -- 4219869 Business Flow
191167 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
191168 l_budgetary_control_flag := 'N';
191169
191170 l_bflow_applied_to_amt_idx := NULL; -- 5132302
191171 l_bflow_applied_to_amt := NULL; -- 5132302
191172 l_entered_amt_idx := NULL; -- 4262811
191173 l_accted_amt_idx := NULL; -- 4262811
191174 l_acc_rev_flag := NULL; -- 4262811
191175 l_accrual_line_num := NULL; -- 4262811
191176 l_tmp_amt := NULL; -- 4262811
191177 --
191178
191179 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
191180 l_balance_type_code <> 'B' THEN
191181 IF NVL(p_source_64,'
191182 ') = 'EXPENSE'
191183 THEN
191184
191185 --
191186 XLA_AE_LINES_PKG.SetNewLine;
191187
191188 p_balance_type_code := l_balance_type_code;
191189 -- set the flag so later we will know whether the gain loss line needs to be created
191190
191191 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
191192 p_actual_flag :='A';
191193 END IF;
191194
191195 --
191199 p_header_num => 0); -- 4262811
191196 -- bulk performance
191197 --
191198 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
191200 --
191201 -- set accounting line options
191202 --
191203 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
191204 p_natural_side_code => 'D'
191205 , p_gain_or_loss_flag => 'N'
191206 , p_gl_transfer_mode_code => 'S'
191207 , p_acct_entry_type_code => 'A'
191208 , p_switch_side_flag => 'Y'
191209 , p_merge_duplicate_code => 'N'
191210 );
191211 --
191212 l_acc_rev_natural_side_code := 'C'; -- 4262811
191213 --
191214 --
191215 -- set accounting line type info
191216 --
191217 xla_ae_lines_pkg.SetAcctLineType
191218 (p_component_type => l_component_type
191219 ,p_event_type_code => l_event_type_code
191220 ,p_line_definition_owner_code => l_line_definition_owner_code
191221 ,p_line_definition_code => l_line_definition_code
191222 ,p_accounting_line_code => l_component_code
191223 ,p_accounting_line_type_code => l_component_type_code
191224 ,p_accounting_line_appl_id => l_component_appl_id
191225 ,p_amb_context_code => l_amb_context_code
191226 ,p_entity_code => l_entity_code
191227 ,p_event_class_code => l_event_class_code);
191228 --
191229 -- set accounting class
191230 --
191231 xla_ae_lines_pkg.SetAcctClass(
191232 p_accounting_class_code => 'EXPENSE'
191233 , p_ae_header_id => l_ae_header_id
191234 );
191235
191236 --
191237 -- set rounding class
191238 --
191239 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
191240 'EXPENSE';
191241
191242 --
191243 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
191244 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
191245 --
191246 -- bulk performance
191247 --
191248 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
191249
191250 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
191251 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
191252
191253 -- 4955764
191254 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
191255 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
191256
191257 -- 4458381 Public Sector Enh
191258
191259 --
191260 -- set accounting attributes for the line type
191261 --
191262 l_entered_amt_idx := 4;
191263 l_accted_amt_idx := 6;
191264 l_bflow_applied_to_amt_idx := NULL; -- 5132302
191265 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
191266 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
191267 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
191268 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
191269 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
191270 l_rec_acct_attrs.array_char_value(3) := p_source_51;
191271 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
191272 l_rec_acct_attrs.array_num_value(4) := p_source_65;
191273 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
191274 l_rec_acct_attrs.array_char_value(5) := p_source_66;
191275 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
191276 l_rec_acct_attrs.array_num_value(6) := p_source_65;
191277
191278 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
191279 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
191280
191281 ---------------------------------------------------------------------------------------------------------------
191282 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
191283 ---------------------------------------------------------------------------------------------------------------
191284 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
191285
191286 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
191287 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
191288
191289 IF xla_accounting_cache_pkg.GetValueChar
191290 (p_source_code => 'LEDGER_CATEGORY_CODE'
191291 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
191292 AND l_bflow_method_code = 'PRIOR_ENTRY'
191293 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
191294 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
191295 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
191296 )
191297 THEN
191298 xla_ae_lines_pkg.BflowUpgEntry
191299 (p_business_method_code => l_bflow_method_code
191300 ,p_business_class_code => l_bflow_class_code
191301 ,p_balance_type => l_balance_type_code);
191302 ELSE
191303 NULL;
191307 --
191304 -- No business flow processing for business flow method of NONE.
191305 END IF;
191306
191308 -- call analytical criteria
191309 --
191310
191311 --
191312 -- call description
191313 --
191314
191315 xla_ae_lines_pkg.SetLineDescription(
191316 p_ae_header_id => l_ae_header_id
191317 ,p_description => Description_143 (
191318 p_application_id => p_application_id
191319 , p_ae_header_id => l_ae_header_id
191320 , p_source_2 => p_source_2
191321 , p_source_3 => p_source_3
191322 )
191323 );
191324
191325
191326 --
191327 -- call ADRs
191328 -- Bug 4922099
191329 --
191330 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
191331 (NVL(l_actual_upg_option, 'N') = 'O') OR
191332 (NVL(l_enc_upg_option, 'N') = 'O')
191333 )
191334 THEN
191335 NULL;
191336 --
191337 --
191338
191339 l_ccid := AcctDerRule_184(
191340 p_application_id => p_application_id
191341 , p_ae_header_id => l_ae_header_id
191342 , p_source_39 => p_source_39
191343 , x_transaction_coa_id => l_adr_transaction_coa_id
191344 , x_accounting_coa_id => l_adr_accounting_coa_id
191345 , x_value_type_code => l_adr_value_type_code
191346 , p_side => 'NA'
191347 );
191348
191349 xla_ae_lines_pkg.set_ccid(
191350 p_code_combination_id => l_ccid
191351 , p_value_type_code => l_adr_value_type_code
191352 , p_transaction_coa_id => l_adr_transaction_coa_id
191353 , p_accounting_coa_id => l_adr_accounting_coa_id
191354 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
191355 , p_adr_type_code => 'S'
191356 , p_component_type => l_component_type
191357 , p_component_code => l_component_code
191358 , p_component_type_code => l_component_type_code
191359 , p_component_appl_id => l_component_appl_id
191360 , p_amb_context_code => l_amb_context_code
191361 , p_side => 'NA'
191362 );
191363
191364
191365 --
191366 --
191367 END IF;
191368 --
191369 -- Bug 4922099
191370 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
191371 (NVL(l_enc_upg_option, 'N') = 'O')
191372 ) AND
191373 (l_bflow_method_code = 'PRIOR_ENTRY')
191374 )
191375 THEN
191376 IF
191377 --
191378 1 = 2
191379 --
191380 THEN
191381 xla_accounting_err_pkg.build_message
191382 (p_appli_s_name => 'XLA'
191383 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
191384 ,p_token_1 => 'LINE_NUMBER'
191385 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
191386 ,p_token_2 => 'LINE_TYPE_NAME'
191387 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
191388 l_component_type
191389 ,l_component_code
191390 ,l_component_type_code
191391 ,l_component_appl_id
191392 ,l_amb_context_code
191393 ,l_entity_code
191394 ,l_event_class_code
191395 )
191396 ,p_token_3 => 'OWNER'
191397 ,p_value_3 => xla_lookups_pkg.get_meaning(
191398 p_lookup_type => 'XLA_OWNER_TYPE'
191399 ,p_lookup_code => l_component_type_code
191400 )
191401 ,p_token_4 => 'PRODUCT_NAME'
191402 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
191403 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
191404 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
191405 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
191406 ,p_ae_header_id => NULL
191407 );
191408
191409 IF (C_LEVEL_ERROR>= g_log_level) THEN
191410 trace
191411 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
191412 ,p_level => C_LEVEL_ERROR
191413 ,p_module => l_log_module);
191414 END IF;
191415 END IF;
191416 END IF;
191417 --
191418 --
191419 ------------------------------------------------------------------------------------------------
191420 -- 4219869 Business Flow
191424 XLA_AE_LINES_PKG.ValidateCurrentLine;
191421 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
191422 -- Prior Entry. Currently, the following code is always generated.
191423 ------------------------------------------------------------------------------------------------
191425
191426 ------------------------------------------------------------------------------------
191427 -- 4219869 Business Flow
191428 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
191429 ------------------------------------------------------------------------------------
191430 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
191431
191432 ----------------------------------------------------------------------------------
191433 -- 4219869 Business Flow
191434 -- Update journal entry status -- Need to generate this within IF <condition>
191435 ----------------------------------------------------------------------------------
191436 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
191437 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
191438 ,p_balance_type_code => l_balance_type_code
191439 );
191440
191441 -------------------------------------------------------------------------------------------
191442 -- 4262811 - Generate the Accrual Reversal lines
191443 -------------------------------------------------------------------------------------------
191444 BEGIN
191445 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
191446 (g_array_event(p_event_id).array_value_num('header_index'));
191447 IF l_acc_rev_flag IS NULL THEN
191448 l_acc_rev_flag := 'N';
191449 END IF;
191450 EXCEPTION
191451 WHEN OTHERS THEN
191452 l_acc_rev_flag := 'N';
191453 END;
191454 --
191455 IF (l_acc_rev_flag = 'Y') THEN
191456
191457 -- 4645092 ------------------------------------------------------------------------------
191458 -- To allow MPA report to determine if it should generate report process
191459 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
191460 ------------------------------------------------------------------------------------------
191461
191462 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
191463 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
191464 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
191465 -- call ADRs
191466 -- Bug 4922099
191467 --
191468 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
191469 (NVL(l_actual_upg_option, 'N') = 'O') OR
191470 (NVL(l_enc_upg_option, 'N') = 'O')
191471 )
191472 THEN
191473 NULL;
191474 --
191475 --
191476
191477 l_ccid := AcctDerRule_184(
191478 p_application_id => p_application_id
191479 , p_ae_header_id => l_ae_header_id
191480 , p_source_39 => p_source_39
191481 , x_transaction_coa_id => l_adr_transaction_coa_id
191482 , x_accounting_coa_id => l_adr_accounting_coa_id
191483 , x_value_type_code => l_adr_value_type_code
191484 , p_side => 'NA'
191485 );
191486
191487 xla_ae_lines_pkg.set_ccid(
191488 p_code_combination_id => l_ccid
191489 , p_value_type_code => l_adr_value_type_code
191490 , p_transaction_coa_id => l_adr_transaction_coa_id
191491 , p_accounting_coa_id => l_adr_accounting_coa_id
191492 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
191493 , p_adr_type_code => 'S'
191494 , p_component_type => l_component_type
191495 , p_component_code => l_component_code
191496 , p_component_type_code => l_component_type_code
191497 , p_component_appl_id => l_component_appl_id
191498 , p_amb_context_code => l_amb_context_code
191499 , p_side => 'NA'
191500 );
191501
191502
191503 --
191504 --
191505 END IF;
191506
191507 --
191508 -- Update the line information that should be overwritten
191509 --
191510 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
191511 p_header_num => 1);
191512 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
191513
191514 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
191515
191516 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
191517 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
191518 END IF;
191519
191520 --
191521 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
191522 --
191523 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
191524 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
191525 ELSE
191526 ---------------------------------------------------------------------------------------------------
191527 -- 4262811a Switch Sign
191528 ---------------------------------------------------------------------------------------------------
191529 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
191533 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
191530 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
191531 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
191532 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
191534 -- 5132302
191535 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
191536 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
191537
191538 END IF;
191539
191540 -- 4955764
191541 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
191542 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
191543
191544
191545 XLA_AE_LINES_PKG.ValidateCurrentLine;
191546 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
191547
191548 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
191549 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
191550 ,p_balance_type_code => l_balance_type_code);
191551
191552 END IF;
191553
191554 -----------------------------------------------------------------------------------------
191555 -- 4262811 Multiperiod Accounting
191556 -----------------------------------------------------------------------------------------
191557 -- No MPA option is assigned.
191558
191559
191560 END IF;
191561 END IF;
191562 --
191563
191564 --
191565 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
191566 trace
191567 (p_msg => 'END of AcctLineType_438'
191568 ,p_level => C_LEVEL_PROCEDURE
191569 ,p_module => l_log_module);
191570 END IF;
191571 --
191572 EXCEPTION
191573 WHEN xla_exceptions_pkg.application_exception THEN
191574 RAISE;
191575 WHEN OTHERS THEN
191576 xla_exceptions_pkg.raise_message
191577 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_438');
191578 END AcctLineType_438;
191579 --
191580
191581 ---------------------------------------
191582 --
191583 -- PRIVATE FUNCTION
191584 -- AcctLineType_439
191585 --
191586 ---------------------------------------
191587 PROCEDURE AcctLineType_439 (
191588 p_application_id IN NUMBER
191589 ,p_event_id IN NUMBER
191590 ,p_calculate_acctd_flag IN VARCHAR2
191591 ,p_calculate_g_l_flag IN VARCHAR2
191592 ,p_actual_flag IN OUT VARCHAR2
191593 ,p_balance_type_code OUT VARCHAR2
191594 ,p_gain_or_loss_ref OUT VARCHAR2
191595
191596 --Inflation Adjustment Type Description
191597 , p_source_2 IN VARCHAR2
191598 --Accounting Date
191599 , p_source_3 IN DATE
191600 --Inflation Depreciation Expense Ccid
191601 , p_source_39 IN NUMBER
191602 --Distribution Type Code
191603 , p_source_51 IN VARCHAR2
191604 --Asset Identifier
191605 , p_source_56 IN NUMBER
191606 --Period Counter
191607 , p_source_57 IN NUMBER
191608 --Distribution Identifier
191609 , p_source_58 IN NUMBER
191610 --Book Type Code
191611 , p_source_59 IN VARCHAR2
191612 --Depreciation Run Identifier
191613 , p_source_62 IN NUMBER
191614 --Inflation Adjustment Type
191615 , p_source_64 IN VARCHAR2
191616 --Inflation Entered Amount
191617 , p_source_65 IN NUMBER
191618 --Inflation Currency Code
191619 , p_source_66 IN VARCHAR2
191620 )
191621 IS
191622
191623 l_component_type VARCHAR2(80);
191624 l_component_code VARCHAR2(30);
191625 l_component_type_code VARCHAR2(1);
191626 l_component_appl_id INTEGER;
191627 l_amb_context_code VARCHAR2(30);
191628 l_entity_code VARCHAR2(30);
191629 l_event_class_code VARCHAR2(30);
191630 l_ae_header_id NUMBER;
191631 l_event_type_code VARCHAR2(30);
191632 l_line_definition_code VARCHAR2(30);
191633 l_line_definition_owner_code VARCHAR2(1);
191634 --
191635 -- adr variables
191636 l_segment VARCHAR2(30);
191637 l_ccid NUMBER;
191638 l_adr_transaction_coa_id NUMBER;
191639 l_adr_accounting_coa_id NUMBER;
191640 l_adr_flexfield_segment_code VARCHAR2(30);
191641 l_adr_flex_value_set_id NUMBER;
191642 l_adr_value_type_code VARCHAR2(30);
191643 l_adr_value_combination_id NUMBER;
191644 l_adr_value_segment_code VARCHAR2(30);
191645
191646 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
191647 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
191648 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
191649 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
191650
191651 -- 4262811 Variables ------------------------------------------------------------------------------------------
191652 l_entered_amt_idx NUMBER;
191653 l_accted_amt_idx NUMBER;
191654 l_acc_rev_flag VARCHAR2(1);
191655 l_accrual_line_num NUMBER;
191656 l_tmp_amt NUMBER;
191657 l_acc_rev_natural_side_code VARCHAR2(1);
191658
191659 l_num_entries NUMBER;
191663 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
191660 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
191661 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
191662 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
191664 l_recog_line_1 NUMBER;
191665 l_recog_line_2 NUMBER;
191666
191667 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
191668 l_bflow_applied_to_amt NUMBER; -- 5132302
191669 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
191670
191671 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
191672
191673 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
191674 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
191675
191676 ---------------------------------------------------------------------------------------------------------------
191677
191678
191679 --
191680 -- bulk performance
191681 --
191682 l_balance_type_code VARCHAR2(1);
191683 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
191684 l_log_module VARCHAR2(240);
191685
191686 --
191687 -- Upgrade strategy
191688 --
191689 l_actual_upg_option VARCHAR2(1);
191690 l_enc_upg_option VARCHAR2(1);
191691
191692 --
191693 BEGIN
191694 --
191695 IF g_log_enabled THEN
191696 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_439';
191697 END IF;
191698 --
191699 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
191700
191701 trace
191702 (p_msg => 'BEGIN of AcctLineType_439'
191703 ,p_level => C_LEVEL_PROCEDURE
191704 ,p_module => l_log_module);
191705
191706 END IF;
191707 --
191708 l_component_type := 'AMB_JLT';
191709 l_component_code := 'IAC_DEPRECIATION_EXPENSE';
191710 l_component_type_code := 'S';
191711 l_component_appl_id := 140;
191712 l_amb_context_code := 'DEFAULT';
191713 l_entity_code := 'DEPRECIATION';
191714 l_event_class_code := 'DEPRECIATION';
191715 l_event_type_code := 'DEPRECIATION_ALL';
191716 l_line_definition_owner_code := 'S';
191717 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
191718 --
191719 l_balance_type_code := 'A';
191720 l_segment := NULL;
191721 l_ccid := NULL;
191722 l_adr_transaction_coa_id := NULL;
191723 l_adr_accounting_coa_id := NULL;
191724 l_adr_flexfield_segment_code := NULL;
191725 l_adr_flex_value_set_id := NULL;
191726 l_adr_value_type_code := NULL;
191727 l_adr_value_combination_id := NULL;
191728 l_adr_value_segment_code := NULL;
191729
191730 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
191731 l_bflow_class_code := ''; -- 4219869 Business Flow
191732 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
191733 l_budgetary_control_flag := 'N';
191734
191735 l_bflow_applied_to_amt_idx := NULL; -- 5132302
191736 l_bflow_applied_to_amt := NULL; -- 5132302
191737 l_entered_amt_idx := NULL; -- 4262811
191738 l_accted_amt_idx := NULL; -- 4262811
191739 l_acc_rev_flag := NULL; -- 4262811
191740 l_accrual_line_num := NULL; -- 4262811
191741 l_tmp_amt := NULL; -- 4262811
191742 --
191743
191744 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
191745 l_balance_type_code <> 'B' THEN
191746 IF NVL(p_source_64,'
191747 ') = 'EXPENSE'
191748 THEN
191749
191750 --
191751 XLA_AE_LINES_PKG.SetNewLine;
191752
191753 p_balance_type_code := l_balance_type_code;
191754 -- set the flag so later we will know whether the gain loss line needs to be created
191755
191756 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
191757 p_actual_flag :='A';
191758 END IF;
191759
191760 --
191761 -- bulk performance
191762 --
191763 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
191764 p_header_num => 0); -- 4262811
191765 --
191766 -- set accounting line options
191767 --
191768 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
191769 p_natural_side_code => 'D'
191770 , p_gain_or_loss_flag => 'N'
191771 , p_gl_transfer_mode_code => 'S'
191772 , p_acct_entry_type_code => 'A'
191773 , p_switch_side_flag => 'Y'
191774 , p_merge_duplicate_code => 'N'
191775 );
191776 --
191777 l_acc_rev_natural_side_code := 'C'; -- 4262811
191778 --
191779 --
191780 -- set accounting line type info
191781 --
191782 xla_ae_lines_pkg.SetAcctLineType
191783 (p_component_type => l_component_type
191784 ,p_event_type_code => l_event_type_code
191785 ,p_line_definition_owner_code => l_line_definition_owner_code
191786 ,p_line_definition_code => l_line_definition_code
191787 ,p_accounting_line_code => l_component_code
191788 ,p_accounting_line_type_code => l_component_type_code
191792 ,p_event_class_code => l_event_class_code);
191789 ,p_accounting_line_appl_id => l_component_appl_id
191790 ,p_amb_context_code => l_amb_context_code
191791 ,p_entity_code => l_entity_code
191793 --
191794 -- set accounting class
191795 --
191796 xla_ae_lines_pkg.SetAcctClass(
191797 p_accounting_class_code => 'EXPENSE'
191798 , p_ae_header_id => l_ae_header_id
191799 );
191800
191801 --
191802 -- set rounding class
191803 --
191804 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
191805 'EXPENSE';
191806
191807 --
191808 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
191809 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
191810 --
191811 -- bulk performance
191812 --
191813 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
191814
191815 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
191816 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
191817
191818 -- 4955764
191819 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
191820 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
191821
191822 -- 4458381 Public Sector Enh
191823
191824 --
191825 -- set accounting attributes for the line type
191826 --
191827 l_entered_amt_idx := 7;
191828 l_accted_amt_idx := 9;
191829 l_bflow_applied_to_amt_idx := NULL; -- 5132302
191830 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
191831 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
191832 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
191833 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
191834 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
191835 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
191836 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
191837 l_rec_acct_attrs.array_char_value(4) := p_source_59;
191838 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
191839 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
191840 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
191841 l_rec_acct_attrs.array_char_value(6) := p_source_51;
191842 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
191843 l_rec_acct_attrs.array_num_value(7) := p_source_65;
191844 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
191845 l_rec_acct_attrs.array_char_value(8) := p_source_66;
191846 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
191847 l_rec_acct_attrs.array_num_value(9) := p_source_65;
191848
191849 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
191850 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
191851
191852 ---------------------------------------------------------------------------------------------------------------
191853 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
191854 ---------------------------------------------------------------------------------------------------------------
191855 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
191856
191857 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
191858 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
191859
191860 IF xla_accounting_cache_pkg.GetValueChar
191861 (p_source_code => 'LEDGER_CATEGORY_CODE'
191862 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
191863 AND l_bflow_method_code = 'PRIOR_ENTRY'
191864 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
191865 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
191866 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
191867 )
191868 THEN
191869 xla_ae_lines_pkg.BflowUpgEntry
191870 (p_business_method_code => l_bflow_method_code
191871 ,p_business_class_code => l_bflow_class_code
191872 ,p_balance_type => l_balance_type_code);
191873 ELSE
191874 NULL;
191875 -- No business flow processing for business flow method of NONE.
191876 END IF;
191877
191878 --
191879 -- call analytical criteria
191880 --
191881
191882 --
191883 -- call description
191884 --
191885
191886 xla_ae_lines_pkg.SetLineDescription(
191887 p_ae_header_id => l_ae_header_id
191888 ,p_description => Description_143 (
191889 p_application_id => p_application_id
191890 , p_ae_header_id => l_ae_header_id
191891 , p_source_2 => p_source_2
191892 , p_source_3 => p_source_3
191893 )
191894 );
191895
191896
191897 --
191898 -- call ADRs
191899 -- Bug 4922099
191900 --
191901 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
191902 (NVL(l_actual_upg_option, 'N') = 'O') OR
191906 NULL;
191903 (NVL(l_enc_upg_option, 'N') = 'O')
191904 )
191905 THEN
191907 --
191908 --
191909
191910 l_ccid := AcctDerRule_184(
191911 p_application_id => p_application_id
191912 , p_ae_header_id => l_ae_header_id
191913 , p_source_39 => p_source_39
191914 , x_transaction_coa_id => l_adr_transaction_coa_id
191915 , x_accounting_coa_id => l_adr_accounting_coa_id
191916 , x_value_type_code => l_adr_value_type_code
191917 , p_side => 'NA'
191918 );
191919
191920 xla_ae_lines_pkg.set_ccid(
191921 p_code_combination_id => l_ccid
191922 , p_value_type_code => l_adr_value_type_code
191923 , p_transaction_coa_id => l_adr_transaction_coa_id
191924 , p_accounting_coa_id => l_adr_accounting_coa_id
191925 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
191926 , p_adr_type_code => 'S'
191927 , p_component_type => l_component_type
191928 , p_component_code => l_component_code
191929 , p_component_type_code => l_component_type_code
191930 , p_component_appl_id => l_component_appl_id
191931 , p_amb_context_code => l_amb_context_code
191932 , p_side => 'NA'
191933 );
191934
191935
191936 --
191937 --
191938 END IF;
191939 --
191940 -- Bug 4922099
191941 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
191942 (NVL(l_enc_upg_option, 'N') = 'O')
191943 ) AND
191944 (l_bflow_method_code = 'PRIOR_ENTRY')
191945 )
191946 THEN
191947 IF
191948 --
191949 1 = 2
191950 --
191951 THEN
191952 xla_accounting_err_pkg.build_message
191953 (p_appli_s_name => 'XLA'
191954 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
191955 ,p_token_1 => 'LINE_NUMBER'
191956 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
191957 ,p_token_2 => 'LINE_TYPE_NAME'
191958 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
191959 l_component_type
191960 ,l_component_code
191961 ,l_component_type_code
191962 ,l_component_appl_id
191963 ,l_amb_context_code
191964 ,l_entity_code
191965 ,l_event_class_code
191966 )
191967 ,p_token_3 => 'OWNER'
191968 ,p_value_3 => xla_lookups_pkg.get_meaning(
191969 p_lookup_type => 'XLA_OWNER_TYPE'
191970 ,p_lookup_code => l_component_type_code
191971 )
191972 ,p_token_4 => 'PRODUCT_NAME'
191973 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
191974 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
191975 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
191976 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
191977 ,p_ae_header_id => NULL
191978 );
191979
191980 IF (C_LEVEL_ERROR>= g_log_level) THEN
191981 trace
191982 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
191983 ,p_level => C_LEVEL_ERROR
191984 ,p_module => l_log_module);
191985 END IF;
191986 END IF;
191987 END IF;
191988 --
191989 --
191990 ------------------------------------------------------------------------------------------------
191991 -- 4219869 Business Flow
191992 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
191993 -- Prior Entry. Currently, the following code is always generated.
191994 ------------------------------------------------------------------------------------------------
191995 XLA_AE_LINES_PKG.ValidateCurrentLine;
191996
191997 ------------------------------------------------------------------------------------
191998 -- 4219869 Business Flow
191999 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
192000 ------------------------------------------------------------------------------------
192001 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
192002
192003 ----------------------------------------------------------------------------------
192004 -- 4219869 Business Flow
192005 -- Update journal entry status -- Need to generate this within IF <condition>
192009 ,p_balance_type_code => l_balance_type_code
192006 ----------------------------------------------------------------------------------
192007 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
192008 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
192010 );
192011
192012 -------------------------------------------------------------------------------------------
192013 -- 4262811 - Generate the Accrual Reversal lines
192014 -------------------------------------------------------------------------------------------
192015 BEGIN
192016 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
192017 (g_array_event(p_event_id).array_value_num('header_index'));
192018 IF l_acc_rev_flag IS NULL THEN
192019 l_acc_rev_flag := 'N';
192020 END IF;
192021 EXCEPTION
192022 WHEN OTHERS THEN
192023 l_acc_rev_flag := 'N';
192024 END;
192025 --
192026 IF (l_acc_rev_flag = 'Y') THEN
192027
192028 -- 4645092 ------------------------------------------------------------------------------
192029 -- To allow MPA report to determine if it should generate report process
192030 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
192031 ------------------------------------------------------------------------------------------
192032
192033 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
192034 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
192035 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
192036 -- call ADRs
192037 -- Bug 4922099
192038 --
192039 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
192040 (NVL(l_actual_upg_option, 'N') = 'O') OR
192041 (NVL(l_enc_upg_option, 'N') = 'O')
192042 )
192043 THEN
192044 NULL;
192045 --
192046 --
192047
192048 l_ccid := AcctDerRule_184(
192049 p_application_id => p_application_id
192050 , p_ae_header_id => l_ae_header_id
192051 , p_source_39 => p_source_39
192052 , x_transaction_coa_id => l_adr_transaction_coa_id
192053 , x_accounting_coa_id => l_adr_accounting_coa_id
192054 , x_value_type_code => l_adr_value_type_code
192055 , p_side => 'NA'
192056 );
192057
192058 xla_ae_lines_pkg.set_ccid(
192059 p_code_combination_id => l_ccid
192060 , p_value_type_code => l_adr_value_type_code
192061 , p_transaction_coa_id => l_adr_transaction_coa_id
192062 , p_accounting_coa_id => l_adr_accounting_coa_id
192063 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
192064 , p_adr_type_code => 'S'
192065 , p_component_type => l_component_type
192066 , p_component_code => l_component_code
192067 , p_component_type_code => l_component_type_code
192068 , p_component_appl_id => l_component_appl_id
192069 , p_amb_context_code => l_amb_context_code
192070 , p_side => 'NA'
192071 );
192072
192073
192074 --
192075 --
192076 END IF;
192077
192078 --
192079 -- Update the line information that should be overwritten
192080 --
192081 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
192082 p_header_num => 1);
192083 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
192084
192085 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
192086
192087 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
192088 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
192089 END IF;
192090
192091 --
192092 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
192093 --
192094 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
192095 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
192096 ELSE
192097 ---------------------------------------------------------------------------------------------------
192098 -- 4262811a Switch Sign
192099 ---------------------------------------------------------------------------------------------------
192100 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
192101 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
192102 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
192103 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
192104 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
192105 -- 5132302
192106 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
192107 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
192108
192109 END IF;
192110
192111 -- 4955764
192112 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
192113 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
192114
192118
192115
192116 XLA_AE_LINES_PKG.ValidateCurrentLine;
192117 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
192119 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
192120 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
192121 ,p_balance_type_code => l_balance_type_code);
192122
192123 END IF;
192124
192125 -----------------------------------------------------------------------------------------
192126 -- 4262811 Multiperiod Accounting
192127 -----------------------------------------------------------------------------------------
192128 -- No MPA option is assigned.
192129
192130
192131 END IF;
192132 END IF;
192133 --
192134
192135 --
192136 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
192137 trace
192138 (p_msg => 'END of AcctLineType_439'
192139 ,p_level => C_LEVEL_PROCEDURE
192140 ,p_module => l_log_module);
192141 END IF;
192142 --
192143 EXCEPTION
192144 WHEN xla_exceptions_pkg.application_exception THEN
192145 RAISE;
192146 WHEN OTHERS THEN
192147 xla_exceptions_pkg.raise_message
192148 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_439');
192149 END AcctLineType_439;
192150 --
192151
192152 ---------------------------------------
192153 --
192154 -- PRIVATE FUNCTION
192155 -- AcctLineType_440
192156 --
192157 ---------------------------------------
192158 PROCEDURE AcctLineType_440 (
192159 p_application_id IN NUMBER
192160 ,p_event_id IN NUMBER
192161 ,p_calculate_acctd_flag IN VARCHAR2
192162 ,p_calculate_g_l_flag IN VARCHAR2
192163 ,p_actual_flag IN OUT VARCHAR2
192164 ,p_balance_type_code OUT VARCHAR2
192165 ,p_gain_or_loss_ref OUT VARCHAR2
192166
192167 --Inflation Adjustment Type Description
192168 , p_source_2 IN VARCHAR2
192169 --Accounting Date
192170 , p_source_3 IN DATE
192171 --Inflation Depreciation Expense Ccid
192172 , p_source_39 IN NUMBER
192173 --Transaction Header Identifier
192174 , p_source_49 IN NUMBER
192175 --Adjustment Line Identifier
192176 , p_source_50 IN NUMBER
192177 --Distribution Type Code
192178 , p_source_51 IN VARCHAR2
192179 --Inflation Adjustment Type
192180 , p_source_64 IN VARCHAR2
192181 --Inflation Entered Amount
192182 , p_source_65 IN NUMBER
192183 --Inflation Currency Code
192184 , p_source_66 IN VARCHAR2
192185 )
192186 IS
192187
192188 l_component_type VARCHAR2(80);
192189 l_component_code VARCHAR2(30);
192190 l_component_type_code VARCHAR2(1);
192191 l_component_appl_id INTEGER;
192192 l_amb_context_code VARCHAR2(30);
192193 l_entity_code VARCHAR2(30);
192194 l_event_class_code VARCHAR2(30);
192195 l_ae_header_id NUMBER;
192196 l_event_type_code VARCHAR2(30);
192197 l_line_definition_code VARCHAR2(30);
192198 l_line_definition_owner_code VARCHAR2(1);
192199 --
192200 -- adr variables
192201 l_segment VARCHAR2(30);
192202 l_ccid NUMBER;
192203 l_adr_transaction_coa_id NUMBER;
192204 l_adr_accounting_coa_id NUMBER;
192205 l_adr_flexfield_segment_code VARCHAR2(30);
192206 l_adr_flex_value_set_id NUMBER;
192207 l_adr_value_type_code VARCHAR2(30);
192208 l_adr_value_combination_id NUMBER;
192209 l_adr_value_segment_code VARCHAR2(30);
192210
192211 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
192212 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
192213 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
192214 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
192215
192216 -- 4262811 Variables ------------------------------------------------------------------------------------------
192217 l_entered_amt_idx NUMBER;
192218 l_accted_amt_idx NUMBER;
192219 l_acc_rev_flag VARCHAR2(1);
192220 l_accrual_line_num NUMBER;
192221 l_tmp_amt NUMBER;
192222 l_acc_rev_natural_side_code VARCHAR2(1);
192223
192224 l_num_entries NUMBER;
192225 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
192226 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
192227 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
192228 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
192229 l_recog_line_1 NUMBER;
192230 l_recog_line_2 NUMBER;
192231
192232 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
192233 l_bflow_applied_to_amt NUMBER; -- 5132302
192234 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
192235
192236 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
192237
192238 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
192239 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
192240
192241 ---------------------------------------------------------------------------------------------------------------
192242
192243
192244 --
192245 -- bulk performance
192246 --
192247 l_balance_type_code VARCHAR2(1);
192251 --
192248 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
192249 l_log_module VARCHAR2(240);
192250
192252 -- Upgrade strategy
192253 --
192254 l_actual_upg_option VARCHAR2(1);
192255 l_enc_upg_option VARCHAR2(1);
192256
192257 --
192258 BEGIN
192259 --
192260 IF g_log_enabled THEN
192261 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_440';
192262 END IF;
192263 --
192264 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
192265
192266 trace
192267 (p_msg => 'BEGIN of AcctLineType_440'
192268 ,p_level => C_LEVEL_PROCEDURE
192269 ,p_module => l_log_module);
192270
192271 END IF;
192272 --
192273 l_component_type := 'AMB_JLT';
192274 l_component_code := 'IAC_DEPRECIATION_EXPENSE';
192275 l_component_type_code := 'S';
192276 l_component_appl_id := 140;
192277 l_amb_context_code := 'DEFAULT';
192278 l_entity_code := 'TRANSACTIONS';
192279 l_event_class_code := 'RETIREMENTS';
192280 l_event_type_code := 'RETIREMENTS';
192281 l_line_definition_owner_code := 'S';
192282 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
192283 --
192284 l_balance_type_code := 'A';
192285 l_segment := NULL;
192286 l_ccid := NULL;
192287 l_adr_transaction_coa_id := NULL;
192288 l_adr_accounting_coa_id := NULL;
192289 l_adr_flexfield_segment_code := NULL;
192290 l_adr_flex_value_set_id := NULL;
192291 l_adr_value_type_code := NULL;
192292 l_adr_value_combination_id := NULL;
192293 l_adr_value_segment_code := NULL;
192294
192295 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
192296 l_bflow_class_code := ''; -- 4219869 Business Flow
192297 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
192298 l_budgetary_control_flag := 'N';
192299
192300 l_bflow_applied_to_amt_idx := NULL; -- 5132302
192301 l_bflow_applied_to_amt := NULL; -- 5132302
192302 l_entered_amt_idx := NULL; -- 4262811
192303 l_accted_amt_idx := NULL; -- 4262811
192304 l_acc_rev_flag := NULL; -- 4262811
192305 l_accrual_line_num := NULL; -- 4262811
192306 l_tmp_amt := NULL; -- 4262811
192307 --
192308
192309 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
192310 l_balance_type_code <> 'B' THEN
192311 IF NVL(p_source_64,'
192312 ') = 'EXPENSE'
192313 THEN
192314
192315 --
192316 XLA_AE_LINES_PKG.SetNewLine;
192317
192318 p_balance_type_code := l_balance_type_code;
192319 -- set the flag so later we will know whether the gain loss line needs to be created
192320
192321 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
192322 p_actual_flag :='A';
192323 END IF;
192324
192325 --
192326 -- bulk performance
192327 --
192328 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
192329 p_header_num => 0); -- 4262811
192330 --
192331 -- set accounting line options
192332 --
192333 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
192334 p_natural_side_code => 'D'
192335 , p_gain_or_loss_flag => 'N'
192336 , p_gl_transfer_mode_code => 'S'
192337 , p_acct_entry_type_code => 'A'
192338 , p_switch_side_flag => 'Y'
192339 , p_merge_duplicate_code => 'N'
192340 );
192341 --
192342 l_acc_rev_natural_side_code := 'C'; -- 4262811
192343 --
192344 --
192345 -- set accounting line type info
192346 --
192347 xla_ae_lines_pkg.SetAcctLineType
192348 (p_component_type => l_component_type
192349 ,p_event_type_code => l_event_type_code
192350 ,p_line_definition_owner_code => l_line_definition_owner_code
192351 ,p_line_definition_code => l_line_definition_code
192352 ,p_accounting_line_code => l_component_code
192353 ,p_accounting_line_type_code => l_component_type_code
192354 ,p_accounting_line_appl_id => l_component_appl_id
192355 ,p_amb_context_code => l_amb_context_code
192356 ,p_entity_code => l_entity_code
192357 ,p_event_class_code => l_event_class_code);
192358 --
192359 -- set accounting class
192360 --
192361 xla_ae_lines_pkg.SetAcctClass(
192362 p_accounting_class_code => 'EXPENSE'
192363 , p_ae_header_id => l_ae_header_id
192364 );
192365
192366 --
192367 -- set rounding class
192368 --
192369 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
192370 'EXPENSE';
192371
192372 --
192373 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
192374 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
192375 --
192376 -- bulk performance
192377 --
192378 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
192379
192383 -- 4955764
192380 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
192381 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
192382
192384 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
192385 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
192386
192387 -- 4458381 Public Sector Enh
192388
192389 --
192390 -- set accounting attributes for the line type
192391 --
192392 l_entered_amt_idx := 4;
192393 l_accted_amt_idx := 6;
192394 l_bflow_applied_to_amt_idx := NULL; -- 5132302
192395 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
192396 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
192397 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
192398 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
192399 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
192400 l_rec_acct_attrs.array_char_value(3) := p_source_51;
192401 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
192402 l_rec_acct_attrs.array_num_value(4) := p_source_65;
192403 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
192404 l_rec_acct_attrs.array_char_value(5) := p_source_66;
192405 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
192406 l_rec_acct_attrs.array_num_value(6) := p_source_65;
192407
192408 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
192409 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
192410
192411 ---------------------------------------------------------------------------------------------------------------
192412 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
192413 ---------------------------------------------------------------------------------------------------------------
192414 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
192415
192416 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
192417 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
192418
192419 IF xla_accounting_cache_pkg.GetValueChar
192420 (p_source_code => 'LEDGER_CATEGORY_CODE'
192421 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
192422 AND l_bflow_method_code = 'PRIOR_ENTRY'
192423 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
192424 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
192425 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
192426 )
192427 THEN
192428 xla_ae_lines_pkg.BflowUpgEntry
192429 (p_business_method_code => l_bflow_method_code
192430 ,p_business_class_code => l_bflow_class_code
192431 ,p_balance_type => l_balance_type_code);
192432 ELSE
192433 NULL;
192434 -- No business flow processing for business flow method of NONE.
192435 END IF;
192436
192437 --
192438 -- call analytical criteria
192439 --
192440
192441 --
192442 -- call description
192443 --
192444
192445 xla_ae_lines_pkg.SetLineDescription(
192446 p_ae_header_id => l_ae_header_id
192447 ,p_description => Description_143 (
192448 p_application_id => p_application_id
192449 , p_ae_header_id => l_ae_header_id
192450 , p_source_2 => p_source_2
192451 , p_source_3 => p_source_3
192452 )
192453 );
192454
192455
192456 --
192457 -- call ADRs
192458 -- Bug 4922099
192459 --
192460 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
192461 (NVL(l_actual_upg_option, 'N') = 'O') OR
192462 (NVL(l_enc_upg_option, 'N') = 'O')
192463 )
192464 THEN
192465 NULL;
192466 --
192467 --
192468
192469 l_ccid := AcctDerRule_184(
192470 p_application_id => p_application_id
192471 , p_ae_header_id => l_ae_header_id
192472 , p_source_39 => p_source_39
192473 , x_transaction_coa_id => l_adr_transaction_coa_id
192474 , x_accounting_coa_id => l_adr_accounting_coa_id
192475 , x_value_type_code => l_adr_value_type_code
192476 , p_side => 'NA'
192477 );
192478
192479 xla_ae_lines_pkg.set_ccid(
192480 p_code_combination_id => l_ccid
192481 , p_value_type_code => l_adr_value_type_code
192482 , p_transaction_coa_id => l_adr_transaction_coa_id
192483 , p_accounting_coa_id => l_adr_accounting_coa_id
192484 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
192485 , p_adr_type_code => 'S'
192486 , p_component_type => l_component_type
192487 , p_component_code => l_component_code
192488 , p_component_type_code => l_component_type_code
192489 , p_component_appl_id => l_component_appl_id
192490 , p_amb_context_code => l_amb_context_code
192491 , p_side => 'NA'
192492 );
192493
192494
192495 --
192496 --
192497 END IF;
192498 --
192499 -- Bug 4922099
192500 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
192501 (NVL(l_enc_upg_option, 'N') = 'O')
192502 ) AND
192506 IF
192503 (l_bflow_method_code = 'PRIOR_ENTRY')
192504 )
192505 THEN
192507 --
192508 1 = 2
192509 --
192510 THEN
192511 xla_accounting_err_pkg.build_message
192512 (p_appli_s_name => 'XLA'
192513 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
192514 ,p_token_1 => 'LINE_NUMBER'
192515 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
192516 ,p_token_2 => 'LINE_TYPE_NAME'
192517 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
192518 l_component_type
192519 ,l_component_code
192520 ,l_component_type_code
192521 ,l_component_appl_id
192522 ,l_amb_context_code
192523 ,l_entity_code
192524 ,l_event_class_code
192525 )
192526 ,p_token_3 => 'OWNER'
192527 ,p_value_3 => xla_lookups_pkg.get_meaning(
192528 p_lookup_type => 'XLA_OWNER_TYPE'
192529 ,p_lookup_code => l_component_type_code
192530 )
192531 ,p_token_4 => 'PRODUCT_NAME'
192532 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
192533 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
192534 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
192535 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
192536 ,p_ae_header_id => NULL
192537 );
192538
192539 IF (C_LEVEL_ERROR>= g_log_level) THEN
192540 trace
192541 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
192542 ,p_level => C_LEVEL_ERROR
192543 ,p_module => l_log_module);
192544 END IF;
192545 END IF;
192546 END IF;
192547 --
192548 --
192549 ------------------------------------------------------------------------------------------------
192550 -- 4219869 Business Flow
192551 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
192552 -- Prior Entry. Currently, the following code is always generated.
192553 ------------------------------------------------------------------------------------------------
192554 XLA_AE_LINES_PKG.ValidateCurrentLine;
192555
192556 ------------------------------------------------------------------------------------
192557 -- 4219869 Business Flow
192558 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
192559 ------------------------------------------------------------------------------------
192560 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
192561
192562 ----------------------------------------------------------------------------------
192563 -- 4219869 Business Flow
192564 -- Update journal entry status -- Need to generate this within IF <condition>
192565 ----------------------------------------------------------------------------------
192566 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
192567 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
192568 ,p_balance_type_code => l_balance_type_code
192569 );
192570
192571 -------------------------------------------------------------------------------------------
192572 -- 4262811 - Generate the Accrual Reversal lines
192573 -------------------------------------------------------------------------------------------
192574 BEGIN
192575 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
192576 (g_array_event(p_event_id).array_value_num('header_index'));
192577 IF l_acc_rev_flag IS NULL THEN
192578 l_acc_rev_flag := 'N';
192579 END IF;
192580 EXCEPTION
192581 WHEN OTHERS THEN
192582 l_acc_rev_flag := 'N';
192583 END;
192584 --
192585 IF (l_acc_rev_flag = 'Y') THEN
192586
192587 -- 4645092 ------------------------------------------------------------------------------
192588 -- To allow MPA report to determine if it should generate report process
192589 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
192590 ------------------------------------------------------------------------------------------
192591
192592 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
192593 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
192594 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
192595 -- call ADRs
192596 -- Bug 4922099
192597 --
192601 )
192598 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
192599 (NVL(l_actual_upg_option, 'N') = 'O') OR
192600 (NVL(l_enc_upg_option, 'N') = 'O')
192602 THEN
192603 NULL;
192604 --
192605 --
192606
192607 l_ccid := AcctDerRule_184(
192608 p_application_id => p_application_id
192609 , p_ae_header_id => l_ae_header_id
192610 , p_source_39 => p_source_39
192611 , x_transaction_coa_id => l_adr_transaction_coa_id
192612 , x_accounting_coa_id => l_adr_accounting_coa_id
192613 , x_value_type_code => l_adr_value_type_code
192614 , p_side => 'NA'
192615 );
192616
192617 xla_ae_lines_pkg.set_ccid(
192618 p_code_combination_id => l_ccid
192619 , p_value_type_code => l_adr_value_type_code
192620 , p_transaction_coa_id => l_adr_transaction_coa_id
192621 , p_accounting_coa_id => l_adr_accounting_coa_id
192622 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
192623 , p_adr_type_code => 'S'
192624 , p_component_type => l_component_type
192625 , p_component_code => l_component_code
192626 , p_component_type_code => l_component_type_code
192627 , p_component_appl_id => l_component_appl_id
192628 , p_amb_context_code => l_amb_context_code
192629 , p_side => 'NA'
192630 );
192631
192632
192633 --
192634 --
192635 END IF;
192636
192637 --
192638 -- Update the line information that should be overwritten
192639 --
192640 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
192641 p_header_num => 1);
192642 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
192643
192644 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
192645
192646 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
192647 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
192648 END IF;
192649
192650 --
192651 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
192652 --
192653 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
192654 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
192655 ELSE
192656 ---------------------------------------------------------------------------------------------------
192657 -- 4262811a Switch Sign
192658 ---------------------------------------------------------------------------------------------------
192659 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
192660 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
192661 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
192662 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
192663 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
192664 -- 5132302
192665 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
192666 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
192667
192668 END IF;
192669
192670 -- 4955764
192671 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
192672 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
192673
192674
192675 XLA_AE_LINES_PKG.ValidateCurrentLine;
192676 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
192677
192678 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
192679 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
192680 ,p_balance_type_code => l_balance_type_code);
192681
192682 END IF;
192683
192684 -----------------------------------------------------------------------------------------
192685 -- 4262811 Multiperiod Accounting
192686 -----------------------------------------------------------------------------------------
192687 -- No MPA option is assigned.
192688
192689
192690 END IF;
192691 END IF;
192692 --
192693
192694 --
192695 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
192696 trace
192697 (p_msg => 'END of AcctLineType_440'
192698 ,p_level => C_LEVEL_PROCEDURE
192699 ,p_module => l_log_module);
192700 END IF;
192701 --
192702 EXCEPTION
192703 WHEN xla_exceptions_pkg.application_exception THEN
192704 RAISE;
192705 WHEN OTHERS THEN
192706 xla_exceptions_pkg.raise_message
192707 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_440');
192708 END AcctLineType_440;
192709 --
192710
192711 ---------------------------------------
192712 --
192713 -- PRIVATE FUNCTION
192714 -- AcctLineType_441
192715 --
192716 ---------------------------------------
192717 PROCEDURE AcctLineType_441 (
192718 p_application_id IN NUMBER
192719 ,p_event_id IN NUMBER
192723 ,p_balance_type_code OUT VARCHAR2
192720 ,p_calculate_acctd_flag IN VARCHAR2
192721 ,p_calculate_g_l_flag IN VARCHAR2
192722 ,p_actual_flag IN OUT VARCHAR2
192724 ,p_gain_or_loss_ref OUT VARCHAR2
192725
192726 --Inflation Adjustment Type Description
192727 , p_source_2 IN VARCHAR2
192728 --Accounting Date
192729 , p_source_3 IN DATE
192730 --Inflation Depreciation Expense Ccid
192731 , p_source_39 IN NUMBER
192732 --Transaction Header Identifier
192733 , p_source_49 IN NUMBER
192734 --Adjustment Line Identifier
192735 , p_source_50 IN NUMBER
192736 --Distribution Type Code
192737 , p_source_51 IN VARCHAR2
192738 --Inflation Adjustment Type
192739 , p_source_64 IN VARCHAR2
192740 --Inflation Entered Amount
192741 , p_source_65 IN NUMBER
192742 --Inflation Currency Code
192743 , p_source_66 IN VARCHAR2
192744 )
192745 IS
192746
192747 l_component_type VARCHAR2(80);
192748 l_component_code VARCHAR2(30);
192749 l_component_type_code VARCHAR2(1);
192750 l_component_appl_id INTEGER;
192751 l_amb_context_code VARCHAR2(30);
192752 l_entity_code VARCHAR2(30);
192753 l_event_class_code VARCHAR2(30);
192754 l_ae_header_id NUMBER;
192755 l_event_type_code VARCHAR2(30);
192756 l_line_definition_code VARCHAR2(30);
192757 l_line_definition_owner_code VARCHAR2(1);
192758 --
192759 -- adr variables
192760 l_segment VARCHAR2(30);
192761 l_ccid NUMBER;
192762 l_adr_transaction_coa_id NUMBER;
192763 l_adr_accounting_coa_id NUMBER;
192764 l_adr_flexfield_segment_code VARCHAR2(30);
192765 l_adr_flex_value_set_id NUMBER;
192766 l_adr_value_type_code VARCHAR2(30);
192767 l_adr_value_combination_id NUMBER;
192768 l_adr_value_segment_code VARCHAR2(30);
192769
192770 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
192771 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
192772 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
192773 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
192774
192775 -- 4262811 Variables ------------------------------------------------------------------------------------------
192776 l_entered_amt_idx NUMBER;
192777 l_accted_amt_idx NUMBER;
192778 l_acc_rev_flag VARCHAR2(1);
192779 l_accrual_line_num NUMBER;
192780 l_tmp_amt NUMBER;
192781 l_acc_rev_natural_side_code VARCHAR2(1);
192782
192783 l_num_entries NUMBER;
192784 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
192785 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
192786 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
192787 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
192788 l_recog_line_1 NUMBER;
192789 l_recog_line_2 NUMBER;
192790
192791 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
192792 l_bflow_applied_to_amt NUMBER; -- 5132302
192793 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
192794
192795 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
192796
192797 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
192798 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
192799
192800 ---------------------------------------------------------------------------------------------------------------
192801
192802
192803 --
192804 -- bulk performance
192805 --
192806 l_balance_type_code VARCHAR2(1);
192807 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
192808 l_log_module VARCHAR2(240);
192809
192810 --
192811 -- Upgrade strategy
192812 --
192813 l_actual_upg_option VARCHAR2(1);
192814 l_enc_upg_option VARCHAR2(1);
192815
192816 --
192817 BEGIN
192818 --
192819 IF g_log_enabled THEN
192820 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_441';
192821 END IF;
192822 --
192823 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
192824
192825 trace
192826 (p_msg => 'BEGIN of AcctLineType_441'
192827 ,p_level => C_LEVEL_PROCEDURE
192828 ,p_module => l_log_module);
192829
192830 END IF;
192831 --
192832 l_component_type := 'AMB_JLT';
192833 l_component_code := 'IAC_DEPRECIATION_EXPENSE';
192834 l_component_type_code := 'S';
192835 l_component_appl_id := 140;
192836 l_amb_context_code := 'DEFAULT';
192837 l_entity_code := 'TRANSACTIONS';
192838 l_event_class_code := 'RETIREMENTS';
192839 l_event_type_code := 'REINSTATEMENTS';
192840 l_line_definition_owner_code := 'S';
192841 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
192842 --
192843 l_balance_type_code := 'A';
192844 l_segment := NULL;
192845 l_ccid := NULL;
192846 l_adr_transaction_coa_id := NULL;
192847 l_adr_accounting_coa_id := NULL;
192848 l_adr_flexfield_segment_code := NULL;
192849 l_adr_flex_value_set_id := NULL;
192853
192850 l_adr_value_type_code := NULL;
192851 l_adr_value_combination_id := NULL;
192852 l_adr_value_segment_code := NULL;
192854 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
192855 l_bflow_class_code := ''; -- 4219869 Business Flow
192856 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
192857 l_budgetary_control_flag := 'N';
192858
192859 l_bflow_applied_to_amt_idx := NULL; -- 5132302
192860 l_bflow_applied_to_amt := NULL; -- 5132302
192861 l_entered_amt_idx := NULL; -- 4262811
192862 l_accted_amt_idx := NULL; -- 4262811
192863 l_acc_rev_flag := NULL; -- 4262811
192864 l_accrual_line_num := NULL; -- 4262811
192865 l_tmp_amt := NULL; -- 4262811
192866 --
192867
192868 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
192869 l_balance_type_code <> 'B' THEN
192870 IF NVL(p_source_64,'
192871 ') = 'EXPENSE'
192872 THEN
192873
192874 --
192875 XLA_AE_LINES_PKG.SetNewLine;
192876
192877 p_balance_type_code := l_balance_type_code;
192878 -- set the flag so later we will know whether the gain loss line needs to be created
192879
192880 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
192881 p_actual_flag :='A';
192882 END IF;
192883
192884 --
192885 -- bulk performance
192886 --
192887 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
192888 p_header_num => 0); -- 4262811
192889 --
192890 -- set accounting line options
192891 --
192892 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
192893 p_natural_side_code => 'D'
192894 , p_gain_or_loss_flag => 'N'
192895 , p_gl_transfer_mode_code => 'S'
192896 , p_acct_entry_type_code => 'A'
192897 , p_switch_side_flag => 'Y'
192898 , p_merge_duplicate_code => 'N'
192899 );
192900 --
192901 l_acc_rev_natural_side_code := 'C'; -- 4262811
192902 --
192903 --
192904 -- set accounting line type info
192905 --
192906 xla_ae_lines_pkg.SetAcctLineType
192907 (p_component_type => l_component_type
192908 ,p_event_type_code => l_event_type_code
192909 ,p_line_definition_owner_code => l_line_definition_owner_code
192910 ,p_line_definition_code => l_line_definition_code
192911 ,p_accounting_line_code => l_component_code
192912 ,p_accounting_line_type_code => l_component_type_code
192913 ,p_accounting_line_appl_id => l_component_appl_id
192914 ,p_amb_context_code => l_amb_context_code
192915 ,p_entity_code => l_entity_code
192916 ,p_event_class_code => l_event_class_code);
192917 --
192918 -- set accounting class
192919 --
192920 xla_ae_lines_pkg.SetAcctClass(
192921 p_accounting_class_code => 'EXPENSE'
192922 , p_ae_header_id => l_ae_header_id
192923 );
192924
192925 --
192926 -- set rounding class
192927 --
192928 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
192929 'EXPENSE';
192930
192931 --
192932 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
192933 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
192934 --
192935 -- bulk performance
192936 --
192937 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
192938
192939 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
192940 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
192941
192942 -- 4955764
192943 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
192944 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
192945
192946 -- 4458381 Public Sector Enh
192947
192948 --
192949 -- set accounting attributes for the line type
192950 --
192951 l_entered_amt_idx := 4;
192952 l_accted_amt_idx := 6;
192953 l_bflow_applied_to_amt_idx := NULL; -- 5132302
192954 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
192955 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
192956 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
192957 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
192958 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
192959 l_rec_acct_attrs.array_char_value(3) := p_source_51;
192960 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
192961 l_rec_acct_attrs.array_num_value(4) := p_source_65;
192962 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
192963 l_rec_acct_attrs.array_char_value(5) := p_source_66;
192964 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
192965 l_rec_acct_attrs.array_num_value(6) := p_source_65;
192966
192967 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
192968 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
192969
192973 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
192970 ---------------------------------------------------------------------------------------------------------------
192971 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
192972 ---------------------------------------------------------------------------------------------------------------
192974
192975 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
192976 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
192977
192978 IF xla_accounting_cache_pkg.GetValueChar
192979 (p_source_code => 'LEDGER_CATEGORY_CODE'
192980 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
192981 AND l_bflow_method_code = 'PRIOR_ENTRY'
192982 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
192983 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
192984 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
192985 )
192986 THEN
192987 xla_ae_lines_pkg.BflowUpgEntry
192988 (p_business_method_code => l_bflow_method_code
192989 ,p_business_class_code => l_bflow_class_code
192990 ,p_balance_type => l_balance_type_code);
192991 ELSE
192992 NULL;
192993 -- No business flow processing for business flow method of NONE.
192994 END IF;
192995
192996 --
192997 -- call analytical criteria
192998 --
192999
193000 --
193001 -- call description
193002 --
193003
193004 xla_ae_lines_pkg.SetLineDescription(
193005 p_ae_header_id => l_ae_header_id
193006 ,p_description => Description_143 (
193007 p_application_id => p_application_id
193008 , p_ae_header_id => l_ae_header_id
193009 , p_source_2 => p_source_2
193010 , p_source_3 => p_source_3
193011 )
193012 );
193013
193014
193015 --
193016 -- call ADRs
193017 -- Bug 4922099
193018 --
193019 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
193020 (NVL(l_actual_upg_option, 'N') = 'O') OR
193021 (NVL(l_enc_upg_option, 'N') = 'O')
193022 )
193023 THEN
193024 NULL;
193025 --
193026 --
193027
193028 l_ccid := AcctDerRule_184(
193029 p_application_id => p_application_id
193030 , p_ae_header_id => l_ae_header_id
193031 , p_source_39 => p_source_39
193032 , x_transaction_coa_id => l_adr_transaction_coa_id
193033 , x_accounting_coa_id => l_adr_accounting_coa_id
193034 , x_value_type_code => l_adr_value_type_code
193035 , p_side => 'NA'
193036 );
193037
193038 xla_ae_lines_pkg.set_ccid(
193039 p_code_combination_id => l_ccid
193040 , p_value_type_code => l_adr_value_type_code
193041 , p_transaction_coa_id => l_adr_transaction_coa_id
193042 , p_accounting_coa_id => l_adr_accounting_coa_id
193043 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
193044 , p_adr_type_code => 'S'
193045 , p_component_type => l_component_type
193046 , p_component_code => l_component_code
193047 , p_component_type_code => l_component_type_code
193048 , p_component_appl_id => l_component_appl_id
193049 , p_amb_context_code => l_amb_context_code
193050 , p_side => 'NA'
193051 );
193052
193053
193054 --
193055 --
193056 END IF;
193057 --
193058 -- Bug 4922099
193059 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
193060 (NVL(l_enc_upg_option, 'N') = 'O')
193061 ) AND
193062 (l_bflow_method_code = 'PRIOR_ENTRY')
193063 )
193064 THEN
193065 IF
193066 --
193067 1 = 2
193068 --
193069 THEN
193070 xla_accounting_err_pkg.build_message
193071 (p_appli_s_name => 'XLA'
193072 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
193073 ,p_token_1 => 'LINE_NUMBER'
193074 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
193075 ,p_token_2 => 'LINE_TYPE_NAME'
193076 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
193077 l_component_type
193078 ,l_component_code
193079 ,l_component_type_code
193080 ,l_component_appl_id
193081 ,l_amb_context_code
193082 ,l_entity_code
193083 ,l_event_class_code
193084 )
193085 ,p_token_3 => 'OWNER'
193086 ,p_value_3 => xla_lookups_pkg.get_meaning(
193090 ,p_token_4 => 'PRODUCT_NAME'
193087 p_lookup_type => 'XLA_OWNER_TYPE'
193088 ,p_lookup_code => l_component_type_code
193089 )
193091 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
193092 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
193093 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
193094 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
193095 ,p_ae_header_id => NULL
193096 );
193097
193098 IF (C_LEVEL_ERROR>= g_log_level) THEN
193099 trace
193100 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
193101 ,p_level => C_LEVEL_ERROR
193102 ,p_module => l_log_module);
193103 END IF;
193104 END IF;
193105 END IF;
193106 --
193107 --
193108 ------------------------------------------------------------------------------------------------
193109 -- 4219869 Business Flow
193110 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
193111 -- Prior Entry. Currently, the following code is always generated.
193112 ------------------------------------------------------------------------------------------------
193113 XLA_AE_LINES_PKG.ValidateCurrentLine;
193114
193115 ------------------------------------------------------------------------------------
193116 -- 4219869 Business Flow
193117 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
193118 ------------------------------------------------------------------------------------
193119 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
193120
193121 ----------------------------------------------------------------------------------
193122 -- 4219869 Business Flow
193123 -- Update journal entry status -- Need to generate this within IF <condition>
193124 ----------------------------------------------------------------------------------
193125 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
193126 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
193127 ,p_balance_type_code => l_balance_type_code
193128 );
193129
193130 -------------------------------------------------------------------------------------------
193131 -- 4262811 - Generate the Accrual Reversal lines
193132 -------------------------------------------------------------------------------------------
193133 BEGIN
193134 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
193135 (g_array_event(p_event_id).array_value_num('header_index'));
193136 IF l_acc_rev_flag IS NULL THEN
193137 l_acc_rev_flag := 'N';
193138 END IF;
193139 EXCEPTION
193140 WHEN OTHERS THEN
193141 l_acc_rev_flag := 'N';
193142 END;
193143 --
193144 IF (l_acc_rev_flag = 'Y') THEN
193145
193146 -- 4645092 ------------------------------------------------------------------------------
193147 -- To allow MPA report to determine if it should generate report process
193148 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
193149 ------------------------------------------------------------------------------------------
193150
193151 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
193152 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
193153 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
193154 -- call ADRs
193155 -- Bug 4922099
193156 --
193157 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
193158 (NVL(l_actual_upg_option, 'N') = 'O') OR
193159 (NVL(l_enc_upg_option, 'N') = 'O')
193160 )
193161 THEN
193162 NULL;
193163 --
193164 --
193165
193166 l_ccid := AcctDerRule_184(
193167 p_application_id => p_application_id
193168 , p_ae_header_id => l_ae_header_id
193169 , p_source_39 => p_source_39
193170 , x_transaction_coa_id => l_adr_transaction_coa_id
193171 , x_accounting_coa_id => l_adr_accounting_coa_id
193172 , x_value_type_code => l_adr_value_type_code
193173 , p_side => 'NA'
193174 );
193175
193176 xla_ae_lines_pkg.set_ccid(
193177 p_code_combination_id => l_ccid
193178 , p_value_type_code => l_adr_value_type_code
193179 , p_transaction_coa_id => l_adr_transaction_coa_id
193180 , p_accounting_coa_id => l_adr_accounting_coa_id
193181 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
193182 , p_adr_type_code => 'S'
193183 , p_component_type => l_component_type
193184 , p_component_code => l_component_code
193185 , p_component_type_code => l_component_type_code
193186 , p_component_appl_id => l_component_appl_id
193187 , p_amb_context_code => l_amb_context_code
193188 , p_side => 'NA'
193189 );
193190
193191
193192 --
193193 --
193194 END IF;
193198 --
193195
193196 --
193197 -- Update the line information that should be overwritten
193199 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
193200 p_header_num => 1);
193201 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
193202
193203 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
193204
193205 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
193206 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
193207 END IF;
193208
193209 --
193210 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
193211 --
193212 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
193213 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
193214 ELSE
193215 ---------------------------------------------------------------------------------------------------
193216 -- 4262811a Switch Sign
193217 ---------------------------------------------------------------------------------------------------
193218 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
193219 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
193220 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
193221 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
193222 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
193223 -- 5132302
193224 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
193225 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
193226
193227 END IF;
193228
193229 -- 4955764
193230 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
193231 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
193232
193233
193234 XLA_AE_LINES_PKG.ValidateCurrentLine;
193235 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
193236
193237 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
193238 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
193239 ,p_balance_type_code => l_balance_type_code);
193240
193241 END IF;
193242
193243 -----------------------------------------------------------------------------------------
193244 -- 4262811 Multiperiod Accounting
193245 -----------------------------------------------------------------------------------------
193246 -- No MPA option is assigned.
193247
193248
193249 END IF;
193250 END IF;
193251 --
193252
193253 --
193254 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
193255 trace
193256 (p_msg => 'END of AcctLineType_441'
193257 ,p_level => C_LEVEL_PROCEDURE
193258 ,p_module => l_log_module);
193259 END IF;
193260 --
193261 EXCEPTION
193262 WHEN xla_exceptions_pkg.application_exception THEN
193263 RAISE;
193264 WHEN OTHERS THEN
193265 xla_exceptions_pkg.raise_message
193266 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_441');
193267 END AcctLineType_441;
193268 --
193269
193270 ---------------------------------------
193271 --
193272 -- PRIVATE FUNCTION
193273 -- AcctLineType_442
193274 --
193275 ---------------------------------------
193276 PROCEDURE AcctLineType_442 (
193277 p_application_id IN NUMBER
193278 ,p_event_id IN NUMBER
193279 ,p_calculate_acctd_flag IN VARCHAR2
193280 ,p_calculate_g_l_flag IN VARCHAR2
193281 ,p_actual_flag IN OUT VARCHAR2
193282 ,p_balance_type_code OUT VARCHAR2
193283 ,p_gain_or_loss_ref OUT VARCHAR2
193284
193285 --Inflation Adjustment Type Description
193286 , p_source_2 IN VARCHAR2
193287 --Accounting Date
193288 , p_source_3 IN DATE
193289 --Inflation Depreciation Expense Ccid
193290 , p_source_39 IN NUMBER
193291 --Distribution Type Code
193292 , p_source_51 IN VARCHAR2
193293 --Inflation Adjustment Type
193294 , p_source_64 IN VARCHAR2
193295 --Inflation Entered Amount
193296 , p_source_65 IN NUMBER
193297 --Inflation Currency Code
193298 , p_source_66 IN VARCHAR2
193299 --Inflation Adjustment Identifier
193300 , p_source_67 IN NUMBER
193301 --Inflation Asset Identifier
193302 , p_source_68 IN NUMBER
193303 --Inflation Asset Distribution Identifier
193304 , p_source_69 IN NUMBER
193305 --Inflation Adjustment Line Identifier
193306 , p_source_70 IN NUMBER
193307 )
193308 IS
193309
193310 l_component_type VARCHAR2(80);
193311 l_component_code VARCHAR2(30);
193312 l_component_type_code VARCHAR2(1);
193313 l_component_appl_id INTEGER;
193314 l_amb_context_code VARCHAR2(30);
193315 l_entity_code VARCHAR2(30);
193316 l_event_class_code VARCHAR2(30);
193317 l_ae_header_id NUMBER;
193321 --
193318 l_event_type_code VARCHAR2(30);
193319 l_line_definition_code VARCHAR2(30);
193320 l_line_definition_owner_code VARCHAR2(1);
193322 -- adr variables
193323 l_segment VARCHAR2(30);
193324 l_ccid NUMBER;
193325 l_adr_transaction_coa_id NUMBER;
193326 l_adr_accounting_coa_id NUMBER;
193327 l_adr_flexfield_segment_code VARCHAR2(30);
193328 l_adr_flex_value_set_id NUMBER;
193329 l_adr_value_type_code VARCHAR2(30);
193330 l_adr_value_combination_id NUMBER;
193331 l_adr_value_segment_code VARCHAR2(30);
193332
193333 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
193334 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
193335 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
193336 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
193337
193338 -- 4262811 Variables ------------------------------------------------------------------------------------------
193339 l_entered_amt_idx NUMBER;
193340 l_accted_amt_idx NUMBER;
193341 l_acc_rev_flag VARCHAR2(1);
193342 l_accrual_line_num NUMBER;
193343 l_tmp_amt NUMBER;
193344 l_acc_rev_natural_side_code VARCHAR2(1);
193345
193346 l_num_entries NUMBER;
193347 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
193348 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
193349 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
193350 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
193351 l_recog_line_1 NUMBER;
193352 l_recog_line_2 NUMBER;
193353
193354 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
193355 l_bflow_applied_to_amt NUMBER; -- 5132302
193356 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
193357
193358 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
193359
193360 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
193361 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
193362
193363 ---------------------------------------------------------------------------------------------------------------
193364
193365
193366 --
193367 -- bulk performance
193368 --
193369 l_balance_type_code VARCHAR2(1);
193370 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
193371 l_log_module VARCHAR2(240);
193372
193373 --
193374 -- Upgrade strategy
193375 --
193376 l_actual_upg_option VARCHAR2(1);
193377 l_enc_upg_option VARCHAR2(1);
193378
193379 --
193380 BEGIN
193381 --
193382 IF g_log_enabled THEN
193383 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_442';
193384 END IF;
193385 --
193386 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
193387
193388 trace
193389 (p_msg => 'BEGIN of AcctLineType_442'
193390 ,p_level => C_LEVEL_PROCEDURE
193391 ,p_module => l_log_module);
193392
193393 END IF;
193394 --
193395 l_component_type := 'AMB_JLT';
193396 l_component_code := 'IAC_DEPRECIATION_EXPENSE';
193397 l_component_type_code := 'S';
193398 l_component_appl_id := 140;
193399 l_amb_context_code := 'DEFAULT';
193400 l_entity_code := 'TRANSACTIONS';
193401 l_event_class_code := 'INFLATION_REVALUATION';
193402 l_event_type_code := 'INFLATION_REVALUATION_ALL';
193403 l_line_definition_owner_code := 'S';
193404 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
193405 --
193406 l_balance_type_code := 'A';
193407 l_segment := NULL;
193408 l_ccid := NULL;
193409 l_adr_transaction_coa_id := NULL;
193410 l_adr_accounting_coa_id := NULL;
193411 l_adr_flexfield_segment_code := NULL;
193412 l_adr_flex_value_set_id := NULL;
193413 l_adr_value_type_code := NULL;
193414 l_adr_value_combination_id := NULL;
193415 l_adr_value_segment_code := NULL;
193416
193417 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
193418 l_bflow_class_code := ''; -- 4219869 Business Flow
193419 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
193420 l_budgetary_control_flag := 'N';
193421
193422 l_bflow_applied_to_amt_idx := NULL; -- 5132302
193423 l_bflow_applied_to_amt := NULL; -- 5132302
193424 l_entered_amt_idx := NULL; -- 4262811
193425 l_accted_amt_idx := NULL; -- 4262811
193426 l_acc_rev_flag := NULL; -- 4262811
193427 l_accrual_line_num := NULL; -- 4262811
193428 l_tmp_amt := NULL; -- 4262811
193429 --
193430
193431 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
193432 l_balance_type_code <> 'B' THEN
193433 IF NVL(p_source_64,'
193434 ') = 'EXPENSE'
193435 THEN
193436
193437 --
193438 XLA_AE_LINES_PKG.SetNewLine;
193439
193440 p_balance_type_code := l_balance_type_code;
193441 -- set the flag so later we will know whether the gain loss line needs to be created
193442
193443 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
193447 --
193444 p_actual_flag :='A';
193445 END IF;
193446
193448 -- bulk performance
193449 --
193450 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
193451 p_header_num => 0); -- 4262811
193452 --
193453 -- set accounting line options
193454 --
193455 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
193456 p_natural_side_code => 'D'
193457 , p_gain_or_loss_flag => 'N'
193458 , p_gl_transfer_mode_code => 'S'
193459 , p_acct_entry_type_code => 'A'
193460 , p_switch_side_flag => 'Y'
193461 , p_merge_duplicate_code => 'N'
193462 );
193463 --
193464 l_acc_rev_natural_side_code := 'C'; -- 4262811
193465 --
193466 --
193467 -- set accounting line type info
193468 --
193469 xla_ae_lines_pkg.SetAcctLineType
193470 (p_component_type => l_component_type
193471 ,p_event_type_code => l_event_type_code
193472 ,p_line_definition_owner_code => l_line_definition_owner_code
193473 ,p_line_definition_code => l_line_definition_code
193474 ,p_accounting_line_code => l_component_code
193475 ,p_accounting_line_type_code => l_component_type_code
193476 ,p_accounting_line_appl_id => l_component_appl_id
193477 ,p_amb_context_code => l_amb_context_code
193478 ,p_entity_code => l_entity_code
193479 ,p_event_class_code => l_event_class_code);
193480 --
193481 -- set accounting class
193482 --
193483 xla_ae_lines_pkg.SetAcctClass(
193484 p_accounting_class_code => 'EXPENSE'
193485 , p_ae_header_id => l_ae_header_id
193486 );
193487
193488 --
193489 -- set rounding class
193490 --
193491 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
193492 'EXPENSE';
193493
193494 --
193495 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
193496 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
193497 --
193498 -- bulk performance
193499 --
193500 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
193501
193502 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
193503 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
193504
193505 -- 4955764
193506 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
193507 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
193508
193509 -- 4458381 Public Sector Enh
193510
193511 --
193512 -- set accounting attributes for the line type
193513 --
193514 l_entered_amt_idx := 6;
193515 l_accted_amt_idx := 8;
193516 l_bflow_applied_to_amt_idx := NULL; -- 5132302
193517 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
193518 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_67);
193519 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
193520 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_68);
193521 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
193522 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_69);
193523 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
193524 l_rec_acct_attrs.array_num_value(4) := to_char(p_source_70);
193525 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_TYPE';
193526 l_rec_acct_attrs.array_char_value(5) := p_source_51;
193527 l_rec_acct_attrs.array_acct_attr_code(6) := 'ENTERED_CURRENCY_AMOUNT';
193528 l_rec_acct_attrs.array_num_value(6) := p_source_65;
193529 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_CODE';
193530 l_rec_acct_attrs.array_char_value(7) := p_source_66;
193531 l_rec_acct_attrs.array_acct_attr_code(8) := 'LEDGER_AMOUNT';
193532 l_rec_acct_attrs.array_num_value(8) := p_source_65;
193533
193534 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
193535 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
193536
193537 ---------------------------------------------------------------------------------------------------------------
193538 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
193539 ---------------------------------------------------------------------------------------------------------------
193540 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
193541
193542 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
193543 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
193544
193545 IF xla_accounting_cache_pkg.GetValueChar
193546 (p_source_code => 'LEDGER_CATEGORY_CODE'
193547 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
193548 AND l_bflow_method_code = 'PRIOR_ENTRY'
193549 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
193550 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
193551 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
193552 )
193556 ,p_business_class_code => l_bflow_class_code
193553 THEN
193554 xla_ae_lines_pkg.BflowUpgEntry
193555 (p_business_method_code => l_bflow_method_code
193557 ,p_balance_type => l_balance_type_code);
193558 ELSE
193559 NULL;
193560 -- No business flow processing for business flow method of NONE.
193561 END IF;
193562
193563 --
193564 -- call analytical criteria
193565 --
193566
193567 --
193568 -- call description
193569 --
193570
193571 xla_ae_lines_pkg.SetLineDescription(
193572 p_ae_header_id => l_ae_header_id
193573 ,p_description => Description_143 (
193574 p_application_id => p_application_id
193575 , p_ae_header_id => l_ae_header_id
193576 , p_source_2 => p_source_2
193577 , p_source_3 => p_source_3
193578 )
193579 );
193580
193581
193582 --
193583 -- call ADRs
193584 -- Bug 4922099
193585 --
193586 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
193587 (NVL(l_actual_upg_option, 'N') = 'O') OR
193588 (NVL(l_enc_upg_option, 'N') = 'O')
193589 )
193590 THEN
193591 NULL;
193592 --
193593 --
193594
193595 l_ccid := AcctDerRule_184(
193596 p_application_id => p_application_id
193597 , p_ae_header_id => l_ae_header_id
193598 , p_source_39 => p_source_39
193599 , x_transaction_coa_id => l_adr_transaction_coa_id
193600 , x_accounting_coa_id => l_adr_accounting_coa_id
193601 , x_value_type_code => l_adr_value_type_code
193602 , p_side => 'NA'
193603 );
193604
193605 xla_ae_lines_pkg.set_ccid(
193606 p_code_combination_id => l_ccid
193607 , p_value_type_code => l_adr_value_type_code
193608 , p_transaction_coa_id => l_adr_transaction_coa_id
193609 , p_accounting_coa_id => l_adr_accounting_coa_id
193610 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
193611 , p_adr_type_code => 'S'
193612 , p_component_type => l_component_type
193613 , p_component_code => l_component_code
193614 , p_component_type_code => l_component_type_code
193615 , p_component_appl_id => l_component_appl_id
193616 , p_amb_context_code => l_amb_context_code
193617 , p_side => 'NA'
193618 );
193619
193620
193621 --
193622 --
193623 END IF;
193624 --
193625 -- Bug 4922099
193626 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
193627 (NVL(l_enc_upg_option, 'N') = 'O')
193628 ) AND
193629 (l_bflow_method_code = 'PRIOR_ENTRY')
193630 )
193631 THEN
193632 IF
193633 --
193634 1 = 2
193635 --
193636 THEN
193637 xla_accounting_err_pkg.build_message
193638 (p_appli_s_name => 'XLA'
193639 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
193640 ,p_token_1 => 'LINE_NUMBER'
193641 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
193642 ,p_token_2 => 'LINE_TYPE_NAME'
193643 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
193644 l_component_type
193645 ,l_component_code
193646 ,l_component_type_code
193647 ,l_component_appl_id
193648 ,l_amb_context_code
193649 ,l_entity_code
193650 ,l_event_class_code
193651 )
193652 ,p_token_3 => 'OWNER'
193653 ,p_value_3 => xla_lookups_pkg.get_meaning(
193654 p_lookup_type => 'XLA_OWNER_TYPE'
193655 ,p_lookup_code => l_component_type_code
193656 )
193657 ,p_token_4 => 'PRODUCT_NAME'
193658 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
193659 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
193660 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
193661 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
193662 ,p_ae_header_id => NULL
193663 );
193664
193665 IF (C_LEVEL_ERROR>= g_log_level) THEN
193666 trace
193667 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
193668 ,p_level => C_LEVEL_ERROR
193672 END IF;
193669 ,p_module => l_log_module);
193670 END IF;
193671 END IF;
193673 --
193674 --
193675 ------------------------------------------------------------------------------------------------
193676 -- 4219869 Business Flow
193677 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
193678 -- Prior Entry. Currently, the following code is always generated.
193679 ------------------------------------------------------------------------------------------------
193680 XLA_AE_LINES_PKG.ValidateCurrentLine;
193681
193682 ------------------------------------------------------------------------------------
193683 -- 4219869 Business Flow
193684 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
193685 ------------------------------------------------------------------------------------
193686 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
193687
193688 ----------------------------------------------------------------------------------
193689 -- 4219869 Business Flow
193690 -- Update journal entry status -- Need to generate this within IF <condition>
193691 ----------------------------------------------------------------------------------
193692 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
193693 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
193694 ,p_balance_type_code => l_balance_type_code
193695 );
193696
193697 -------------------------------------------------------------------------------------------
193698 -- 4262811 - Generate the Accrual Reversal lines
193699 -------------------------------------------------------------------------------------------
193700 BEGIN
193701 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
193702 (g_array_event(p_event_id).array_value_num('header_index'));
193703 IF l_acc_rev_flag IS NULL THEN
193704 l_acc_rev_flag := 'N';
193705 END IF;
193706 EXCEPTION
193707 WHEN OTHERS THEN
193708 l_acc_rev_flag := 'N';
193709 END;
193710 --
193711 IF (l_acc_rev_flag = 'Y') THEN
193712
193713 -- 4645092 ------------------------------------------------------------------------------
193714 -- To allow MPA report to determine if it should generate report process
193715 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
193716 ------------------------------------------------------------------------------------------
193717
193718 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
193719 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
193720 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
193721 -- call ADRs
193722 -- Bug 4922099
193723 --
193724 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
193725 (NVL(l_actual_upg_option, 'N') = 'O') OR
193726 (NVL(l_enc_upg_option, 'N') = 'O')
193727 )
193728 THEN
193729 NULL;
193730 --
193731 --
193732
193733 l_ccid := AcctDerRule_184(
193734 p_application_id => p_application_id
193735 , p_ae_header_id => l_ae_header_id
193736 , p_source_39 => p_source_39
193737 , x_transaction_coa_id => l_adr_transaction_coa_id
193738 , x_accounting_coa_id => l_adr_accounting_coa_id
193739 , x_value_type_code => l_adr_value_type_code
193740 , p_side => 'NA'
193741 );
193742
193743 xla_ae_lines_pkg.set_ccid(
193744 p_code_combination_id => l_ccid
193745 , p_value_type_code => l_adr_value_type_code
193746 , p_transaction_coa_id => l_adr_transaction_coa_id
193747 , p_accounting_coa_id => l_adr_accounting_coa_id
193748 , p_adr_code => 'IAC_DEPRECIATION_EXPENSE_AC'
193749 , p_adr_type_code => 'S'
193750 , p_component_type => l_component_type
193751 , p_component_code => l_component_code
193752 , p_component_type_code => l_component_type_code
193753 , p_component_appl_id => l_component_appl_id
193754 , p_amb_context_code => l_amb_context_code
193755 , p_side => 'NA'
193756 );
193757
193758
193759 --
193760 --
193761 END IF;
193762
193763 --
193764 -- Update the line information that should be overwritten
193765 --
193766 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
193767 p_header_num => 1);
193768 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
193769
193770 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
193771
193772 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
193773 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
193774 END IF;
193775
193776 --
193777 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
193778 --
193779 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
193780 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
193781 ELSE
193785 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
193782 ---------------------------------------------------------------------------------------------------
193783 -- 4262811a Switch Sign
193784 ---------------------------------------------------------------------------------------------------
193786 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
193787 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
193788 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
193789 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
193790 -- 5132302
193791 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
193792 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
193793
193794 END IF;
193795
193796 -- 4955764
193797 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
193798 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
193799
193800
193801 XLA_AE_LINES_PKG.ValidateCurrentLine;
193802 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
193803
193804 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
193805 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
193806 ,p_balance_type_code => l_balance_type_code);
193807
193808 END IF;
193809
193810 -----------------------------------------------------------------------------------------
193811 -- 4262811 Multiperiod Accounting
193812 -----------------------------------------------------------------------------------------
193813 -- No MPA option is assigned.
193814
193815
193816 END IF;
193817 END IF;
193818 --
193819
193820 --
193821 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
193822 trace
193823 (p_msg => 'END of AcctLineType_442'
193824 ,p_level => C_LEVEL_PROCEDURE
193825 ,p_module => l_log_module);
193826 END IF;
193827 --
193828 EXCEPTION
193829 WHEN xla_exceptions_pkg.application_exception THEN
193830 RAISE;
193831 WHEN OTHERS THEN
193832 xla_exceptions_pkg.raise_message
193833 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_442');
193834 END AcctLineType_442;
193835 --
193836
193837 ---------------------------------------
193838 --
193839 -- PRIVATE FUNCTION
193840 -- AcctLineType_443
193841 --
193842 ---------------------------------------
193843 PROCEDURE AcctLineType_443 (
193844 p_application_id IN NUMBER
193845 ,p_event_id IN NUMBER
193846 ,p_calculate_acctd_flag IN VARCHAR2
193847 ,p_calculate_g_l_flag IN VARCHAR2
193848 ,p_actual_flag IN OUT VARCHAR2
193849 ,p_balance_type_code OUT VARCHAR2
193850 ,p_gain_or_loss_ref OUT VARCHAR2
193851
193852 --Inflation Adjustment Type Description
193853 , p_source_2 IN VARCHAR2
193854 --Accounting Date
193855 , p_source_3 IN DATE
193856 --Inflation Depreciation Reserve Ccid
193857 , p_source_40 IN NUMBER
193858 --Transaction Header Identifier
193859 , p_source_49 IN NUMBER
193860 --Adjustment Line Identifier
193861 , p_source_50 IN NUMBER
193862 --Distribution Type Code
193863 , p_source_51 IN VARCHAR2
193864 --Inflation Adjustment Type
193865 , p_source_64 IN VARCHAR2
193866 --Inflation Entered Amount
193867 , p_source_65 IN NUMBER
193868 --Inflation Currency Code
193869 , p_source_66 IN VARCHAR2
193870 )
193871 IS
193872
193873 l_component_type VARCHAR2(80);
193874 l_component_code VARCHAR2(30);
193875 l_component_type_code VARCHAR2(1);
193876 l_component_appl_id INTEGER;
193877 l_amb_context_code VARCHAR2(30);
193878 l_entity_code VARCHAR2(30);
193879 l_event_class_code VARCHAR2(30);
193880 l_ae_header_id NUMBER;
193881 l_event_type_code VARCHAR2(30);
193882 l_line_definition_code VARCHAR2(30);
193883 l_line_definition_owner_code VARCHAR2(1);
193884 --
193885 -- adr variables
193886 l_segment VARCHAR2(30);
193887 l_ccid NUMBER;
193888 l_adr_transaction_coa_id NUMBER;
193889 l_adr_accounting_coa_id NUMBER;
193890 l_adr_flexfield_segment_code VARCHAR2(30);
193891 l_adr_flex_value_set_id NUMBER;
193892 l_adr_value_type_code VARCHAR2(30);
193893 l_adr_value_combination_id NUMBER;
193894 l_adr_value_segment_code VARCHAR2(30);
193895
193896 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
193897 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
193898 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
193899 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
193900
193901 -- 4262811 Variables ------------------------------------------------------------------------------------------
193902 l_entered_amt_idx NUMBER;
193903 l_accted_amt_idx NUMBER;
193904 l_acc_rev_flag VARCHAR2(1);
193905 l_accrual_line_num NUMBER;
193909 l_num_entries NUMBER;
193906 l_tmp_amt NUMBER;
193907 l_acc_rev_natural_side_code VARCHAR2(1);
193908
193910 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
193911 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
193912 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
193913 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
193914 l_recog_line_1 NUMBER;
193915 l_recog_line_2 NUMBER;
193916
193917 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
193918 l_bflow_applied_to_amt NUMBER; -- 5132302
193919 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
193920
193921 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
193922
193923 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
193924 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
193925
193926 ---------------------------------------------------------------------------------------------------------------
193927
193928
193929 --
193930 -- bulk performance
193931 --
193932 l_balance_type_code VARCHAR2(1);
193933 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
193934 l_log_module VARCHAR2(240);
193935
193936 --
193937 -- Upgrade strategy
193938 --
193939 l_actual_upg_option VARCHAR2(1);
193940 l_enc_upg_option VARCHAR2(1);
193941
193942 --
193943 BEGIN
193944 --
193945 IF g_log_enabled THEN
193946 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_443';
193947 END IF;
193948 --
193949 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
193950
193951 trace
193952 (p_msg => 'BEGIN of AcctLineType_443'
193953 ,p_level => C_LEVEL_PROCEDURE
193954 ,p_module => l_log_module);
193955
193956 END IF;
193957 --
193958 l_component_type := 'AMB_JLT';
193959 l_component_code := 'IAC_DEPRECIATION_RESERVE';
193960 l_component_type_code := 'S';
193961 l_component_appl_id := 140;
193962 l_amb_context_code := 'DEFAULT';
193963 l_entity_code := 'TRANSACTIONS';
193964 l_event_class_code := 'TRANSFERS';
193965 l_event_type_code := 'TRANSFERS_ALL';
193966 l_line_definition_owner_code := 'S';
193967 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
193968 --
193969 l_balance_type_code := 'A';
193970 l_segment := NULL;
193971 l_ccid := NULL;
193972 l_adr_transaction_coa_id := NULL;
193973 l_adr_accounting_coa_id := NULL;
193974 l_adr_flexfield_segment_code := NULL;
193975 l_adr_flex_value_set_id := NULL;
193976 l_adr_value_type_code := NULL;
193977 l_adr_value_combination_id := NULL;
193978 l_adr_value_segment_code := NULL;
193979
193980 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
193981 l_bflow_class_code := ''; -- 4219869 Business Flow
193982 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
193983 l_budgetary_control_flag := 'N';
193984
193985 l_bflow_applied_to_amt_idx := NULL; -- 5132302
193986 l_bflow_applied_to_amt := NULL; -- 5132302
193987 l_entered_amt_idx := NULL; -- 4262811
193988 l_accted_amt_idx := NULL; -- 4262811
193989 l_acc_rev_flag := NULL; -- 4262811
193990 l_accrual_line_num := NULL; -- 4262811
193991 l_tmp_amt := NULL; -- 4262811
193992 --
193993
193994 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
193995 l_balance_type_code <> 'B' THEN
193996 IF NVL(p_source_64,'
193997 ') = 'RESERVE'
193998 THEN
193999
194000 --
194001 XLA_AE_LINES_PKG.SetNewLine;
194002
194003 p_balance_type_code := l_balance_type_code;
194004 -- set the flag so later we will know whether the gain loss line needs to be created
194005
194006 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
194007 p_actual_flag :='A';
194008 END IF;
194009
194010 --
194011 -- bulk performance
194012 --
194013 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
194014 p_header_num => 0); -- 4262811
194015 --
194016 -- set accounting line options
194017 --
194018 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
194019 p_natural_side_code => 'C'
194020 , p_gain_or_loss_flag => 'N'
194021 , p_gl_transfer_mode_code => 'S'
194022 , p_acct_entry_type_code => 'A'
194023 , p_switch_side_flag => 'Y'
194024 , p_merge_duplicate_code => 'N'
194025 );
194026 --
194027 l_acc_rev_natural_side_code := 'D'; -- 4262811
194028 --
194029 --
194030 -- set accounting line type info
194031 --
194032 xla_ae_lines_pkg.SetAcctLineType
194033 (p_component_type => l_component_type
194034 ,p_event_type_code => l_event_type_code
194035 ,p_line_definition_owner_code => l_line_definition_owner_code
194036 ,p_line_definition_code => l_line_definition_code
194040 ,p_amb_context_code => l_amb_context_code
194037 ,p_accounting_line_code => l_component_code
194038 ,p_accounting_line_type_code => l_component_type_code
194039 ,p_accounting_line_appl_id => l_component_appl_id
194041 ,p_entity_code => l_entity_code
194042 ,p_event_class_code => l_event_class_code);
194043 --
194044 -- set accounting class
194045 --
194046 xla_ae_lines_pkg.SetAcctClass(
194047 p_accounting_class_code => 'ASSET'
194048 , p_ae_header_id => l_ae_header_id
194049 );
194050
194051 --
194052 -- set rounding class
194053 --
194054 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
194055 'ASSET';
194056
194057 --
194058 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
194059 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
194060 --
194061 -- bulk performance
194062 --
194063 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
194064
194065 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
194066 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
194067
194068 -- 4955764
194069 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
194070 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
194071
194072 -- 4458381 Public Sector Enh
194073
194074 --
194075 -- set accounting attributes for the line type
194076 --
194077 l_entered_amt_idx := 4;
194078 l_accted_amt_idx := 6;
194079 l_bflow_applied_to_amt_idx := NULL; -- 5132302
194080 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
194081 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
194082 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
194083 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
194084 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
194085 l_rec_acct_attrs.array_char_value(3) := p_source_51;
194086 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
194087 l_rec_acct_attrs.array_num_value(4) := p_source_65;
194088 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
194089 l_rec_acct_attrs.array_char_value(5) := p_source_66;
194090 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
194091 l_rec_acct_attrs.array_num_value(6) := p_source_65;
194092
194093 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
194094 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
194095
194096 ---------------------------------------------------------------------------------------------------------------
194097 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
194098 ---------------------------------------------------------------------------------------------------------------
194099 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
194100
194101 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
194102 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
194103
194104 IF xla_accounting_cache_pkg.GetValueChar
194105 (p_source_code => 'LEDGER_CATEGORY_CODE'
194106 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
194107 AND l_bflow_method_code = 'PRIOR_ENTRY'
194108 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
194109 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
194110 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
194111 )
194112 THEN
194113 xla_ae_lines_pkg.BflowUpgEntry
194114 (p_business_method_code => l_bflow_method_code
194115 ,p_business_class_code => l_bflow_class_code
194116 ,p_balance_type => l_balance_type_code);
194117 ELSE
194118 NULL;
194119 -- No business flow processing for business flow method of NONE.
194120 END IF;
194121
194122 --
194123 -- call analytical criteria
194124 --
194125
194126 --
194127 -- call description
194128 --
194129
194130 xla_ae_lines_pkg.SetLineDescription(
194131 p_ae_header_id => l_ae_header_id
194132 ,p_description => Description_143 (
194133 p_application_id => p_application_id
194134 , p_ae_header_id => l_ae_header_id
194135 , p_source_2 => p_source_2
194136 , p_source_3 => p_source_3
194137 )
194138 );
194139
194140
194141 --
194142 -- call ADRs
194143 -- Bug 4922099
194144 --
194145 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
194146 (NVL(l_actual_upg_option, 'N') = 'O') OR
194147 (NVL(l_enc_upg_option, 'N') = 'O')
194148 )
194149 THEN
194150 NULL;
194151 --
194152 --
194153
194154 l_ccid := AcctDerRule_185(
194155 p_application_id => p_application_id
194156 , p_ae_header_id => l_ae_header_id
194157 , p_source_40 => p_source_40
194158 , x_transaction_coa_id => l_adr_transaction_coa_id
194162 );
194159 , x_accounting_coa_id => l_adr_accounting_coa_id
194160 , x_value_type_code => l_adr_value_type_code
194161 , p_side => 'NA'
194163
194164 xla_ae_lines_pkg.set_ccid(
194165 p_code_combination_id => l_ccid
194166 , p_value_type_code => l_adr_value_type_code
194167 , p_transaction_coa_id => l_adr_transaction_coa_id
194168 , p_accounting_coa_id => l_adr_accounting_coa_id
194169 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
194170 , p_adr_type_code => 'S'
194171 , p_component_type => l_component_type
194172 , p_component_code => l_component_code
194173 , p_component_type_code => l_component_type_code
194174 , p_component_appl_id => l_component_appl_id
194175 , p_amb_context_code => l_amb_context_code
194176 , p_side => 'NA'
194177 );
194178
194179
194180 --
194181 --
194182 END IF;
194183 --
194184 -- Bug 4922099
194185 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
194186 (NVL(l_enc_upg_option, 'N') = 'O')
194187 ) AND
194188 (l_bflow_method_code = 'PRIOR_ENTRY')
194189 )
194190 THEN
194191 IF
194192 --
194193 1 = 2
194194 --
194195 THEN
194196 xla_accounting_err_pkg.build_message
194197 (p_appli_s_name => 'XLA'
194198 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
194199 ,p_token_1 => 'LINE_NUMBER'
194200 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
194201 ,p_token_2 => 'LINE_TYPE_NAME'
194202 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
194203 l_component_type
194204 ,l_component_code
194205 ,l_component_type_code
194206 ,l_component_appl_id
194207 ,l_amb_context_code
194208 ,l_entity_code
194209 ,l_event_class_code
194210 )
194211 ,p_token_3 => 'OWNER'
194212 ,p_value_3 => xla_lookups_pkg.get_meaning(
194213 p_lookup_type => 'XLA_OWNER_TYPE'
194214 ,p_lookup_code => l_component_type_code
194215 )
194216 ,p_token_4 => 'PRODUCT_NAME'
194217 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
194218 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
194219 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
194220 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
194221 ,p_ae_header_id => NULL
194222 );
194223
194224 IF (C_LEVEL_ERROR>= g_log_level) THEN
194225 trace
194226 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
194227 ,p_level => C_LEVEL_ERROR
194228 ,p_module => l_log_module);
194229 END IF;
194230 END IF;
194231 END IF;
194232 --
194233 --
194234 ------------------------------------------------------------------------------------------------
194235 -- 4219869 Business Flow
194236 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
194237 -- Prior Entry. Currently, the following code is always generated.
194238 ------------------------------------------------------------------------------------------------
194239 XLA_AE_LINES_PKG.ValidateCurrentLine;
194240
194241 ------------------------------------------------------------------------------------
194242 -- 4219869 Business Flow
194243 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
194244 ------------------------------------------------------------------------------------
194245 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
194246
194247 ----------------------------------------------------------------------------------
194248 -- 4219869 Business Flow
194249 -- Update journal entry status -- Need to generate this within IF <condition>
194250 ----------------------------------------------------------------------------------
194251 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
194252 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
194253 ,p_balance_type_code => l_balance_type_code
194254 );
194255
194259 BEGIN
194256 -------------------------------------------------------------------------------------------
194257 -- 4262811 - Generate the Accrual Reversal lines
194258 -------------------------------------------------------------------------------------------
194260 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
194261 (g_array_event(p_event_id).array_value_num('header_index'));
194262 IF l_acc_rev_flag IS NULL THEN
194263 l_acc_rev_flag := 'N';
194264 END IF;
194265 EXCEPTION
194266 WHEN OTHERS THEN
194267 l_acc_rev_flag := 'N';
194268 END;
194269 --
194270 IF (l_acc_rev_flag = 'Y') THEN
194271
194272 -- 4645092 ------------------------------------------------------------------------------
194273 -- To allow MPA report to determine if it should generate report process
194274 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
194275 ------------------------------------------------------------------------------------------
194276
194277 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
194278 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
194279 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
194280 -- call ADRs
194281 -- Bug 4922099
194282 --
194283 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
194284 (NVL(l_actual_upg_option, 'N') = 'O') OR
194285 (NVL(l_enc_upg_option, 'N') = 'O')
194286 )
194287 THEN
194288 NULL;
194289 --
194290 --
194291
194292 l_ccid := AcctDerRule_185(
194293 p_application_id => p_application_id
194294 , p_ae_header_id => l_ae_header_id
194295 , p_source_40 => p_source_40
194296 , x_transaction_coa_id => l_adr_transaction_coa_id
194297 , x_accounting_coa_id => l_adr_accounting_coa_id
194298 , x_value_type_code => l_adr_value_type_code
194299 , p_side => 'NA'
194300 );
194301
194302 xla_ae_lines_pkg.set_ccid(
194303 p_code_combination_id => l_ccid
194304 , p_value_type_code => l_adr_value_type_code
194305 , p_transaction_coa_id => l_adr_transaction_coa_id
194306 , p_accounting_coa_id => l_adr_accounting_coa_id
194307 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
194308 , p_adr_type_code => 'S'
194309 , p_component_type => l_component_type
194310 , p_component_code => l_component_code
194311 , p_component_type_code => l_component_type_code
194312 , p_component_appl_id => l_component_appl_id
194313 , p_amb_context_code => l_amb_context_code
194314 , p_side => 'NA'
194315 );
194316
194317
194318 --
194319 --
194320 END IF;
194321
194322 --
194323 -- Update the line information that should be overwritten
194324 --
194325 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
194326 p_header_num => 1);
194327 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
194328
194329 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
194330
194331 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
194332 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
194333 END IF;
194334
194335 --
194336 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
194337 --
194338 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
194339 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
194340 ELSE
194341 ---------------------------------------------------------------------------------------------------
194342 -- 4262811a Switch Sign
194343 ---------------------------------------------------------------------------------------------------
194344 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
194345 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
194346 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
194347 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
194348 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
194349 -- 5132302
194350 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
194351 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
194352
194353 END IF;
194354
194355 -- 4955764
194356 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
194357 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
194358
194359
194360 XLA_AE_LINES_PKG.ValidateCurrentLine;
194361 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
194362
194363 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
194364 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
194368
194365 ,p_balance_type_code => l_balance_type_code);
194366
194367 END IF;
194369 -----------------------------------------------------------------------------------------
194370 -- 4262811 Multiperiod Accounting
194371 -----------------------------------------------------------------------------------------
194372 -- No MPA option is assigned.
194373
194374
194375 END IF;
194376 END IF;
194377 --
194378
194379 --
194380 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
194381 trace
194382 (p_msg => 'END of AcctLineType_443'
194383 ,p_level => C_LEVEL_PROCEDURE
194384 ,p_module => l_log_module);
194385 END IF;
194386 --
194387 EXCEPTION
194388 WHEN xla_exceptions_pkg.application_exception THEN
194389 RAISE;
194390 WHEN OTHERS THEN
194391 xla_exceptions_pkg.raise_message
194392 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_443');
194393 END AcctLineType_443;
194394 --
194395
194396 ---------------------------------------
194397 --
194398 -- PRIVATE FUNCTION
194399 -- AcctLineType_444
194400 --
194401 ---------------------------------------
194402 PROCEDURE AcctLineType_444 (
194403 p_application_id IN NUMBER
194404 ,p_event_id IN NUMBER
194405 ,p_calculate_acctd_flag IN VARCHAR2
194406 ,p_calculate_g_l_flag IN VARCHAR2
194407 ,p_actual_flag IN OUT VARCHAR2
194408 ,p_balance_type_code OUT VARCHAR2
194409 ,p_gain_or_loss_ref OUT VARCHAR2
194410
194411 --Inflation Adjustment Type Description
194412 , p_source_2 IN VARCHAR2
194413 --Accounting Date
194414 , p_source_3 IN DATE
194415 --Inflation Depreciation Reserve Ccid
194416 , p_source_40 IN NUMBER
194417 --Transaction Header Identifier
194418 , p_source_49 IN NUMBER
194419 --Adjustment Line Identifier
194420 , p_source_50 IN NUMBER
194421 --Distribution Type Code
194422 , p_source_51 IN VARCHAR2
194423 --Inflation Adjustment Type
194424 , p_source_64 IN VARCHAR2
194425 --Inflation Entered Amount
194426 , p_source_65 IN NUMBER
194427 --Inflation Currency Code
194428 , p_source_66 IN VARCHAR2
194429 )
194430 IS
194431
194432 l_component_type VARCHAR2(80);
194433 l_component_code VARCHAR2(30);
194434 l_component_type_code VARCHAR2(1);
194435 l_component_appl_id INTEGER;
194436 l_amb_context_code VARCHAR2(30);
194437 l_entity_code VARCHAR2(30);
194438 l_event_class_code VARCHAR2(30);
194439 l_ae_header_id NUMBER;
194440 l_event_type_code VARCHAR2(30);
194441 l_line_definition_code VARCHAR2(30);
194442 l_line_definition_owner_code VARCHAR2(1);
194443 --
194444 -- adr variables
194445 l_segment VARCHAR2(30);
194446 l_ccid NUMBER;
194447 l_adr_transaction_coa_id NUMBER;
194448 l_adr_accounting_coa_id NUMBER;
194449 l_adr_flexfield_segment_code VARCHAR2(30);
194450 l_adr_flex_value_set_id NUMBER;
194451 l_adr_value_type_code VARCHAR2(30);
194452 l_adr_value_combination_id NUMBER;
194453 l_adr_value_segment_code VARCHAR2(30);
194454
194455 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
194456 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
194457 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
194458 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
194459
194460 -- 4262811 Variables ------------------------------------------------------------------------------------------
194461 l_entered_amt_idx NUMBER;
194462 l_accted_amt_idx NUMBER;
194463 l_acc_rev_flag VARCHAR2(1);
194464 l_accrual_line_num NUMBER;
194465 l_tmp_amt NUMBER;
194466 l_acc_rev_natural_side_code VARCHAR2(1);
194467
194468 l_num_entries NUMBER;
194469 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
194470 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
194471 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
194472 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
194473 l_recog_line_1 NUMBER;
194474 l_recog_line_2 NUMBER;
194475
194476 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
194477 l_bflow_applied_to_amt NUMBER; -- 5132302
194478 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
194479
194480 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
194481
194482 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
194483 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
194484
194485 ---------------------------------------------------------------------------------------------------------------
194486
194487
194488 --
194489 -- bulk performance
194490 --
194491 l_balance_type_code VARCHAR2(1);
194492 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
194493 l_log_module VARCHAR2(240);
194494
194495 --
194496 -- Upgrade strategy
194497 --
194498 l_actual_upg_option VARCHAR2(1);
194502 BEGIN
194499 l_enc_upg_option VARCHAR2(1);
194500
194501 --
194503 --
194504 IF g_log_enabled THEN
194505 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_444';
194506 END IF;
194507 --
194508 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
194509
194510 trace
194511 (p_msg => 'BEGIN of AcctLineType_444'
194512 ,p_level => C_LEVEL_PROCEDURE
194513 ,p_module => l_log_module);
194514
194515 END IF;
194516 --
194517 l_component_type := 'AMB_JLT';
194518 l_component_code := 'IAC_DEPRECIATION_RESERVE';
194519 l_component_type_code := 'S';
194520 l_component_appl_id := 140;
194521 l_amb_context_code := 'DEFAULT';
194522 l_entity_code := 'TRANSACTIONS';
194523 l_event_class_code := 'RETIREMENTS';
194524 l_event_type_code := 'REINSTATEMENTS';
194525 l_line_definition_owner_code := 'S';
194526 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
194527 --
194528 l_balance_type_code := 'A';
194529 l_segment := NULL;
194530 l_ccid := NULL;
194531 l_adr_transaction_coa_id := NULL;
194532 l_adr_accounting_coa_id := NULL;
194533 l_adr_flexfield_segment_code := NULL;
194534 l_adr_flex_value_set_id := NULL;
194535 l_adr_value_type_code := NULL;
194536 l_adr_value_combination_id := NULL;
194537 l_adr_value_segment_code := NULL;
194538
194539 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
194540 l_bflow_class_code := ''; -- 4219869 Business Flow
194541 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
194542 l_budgetary_control_flag := 'N';
194543
194544 l_bflow_applied_to_amt_idx := NULL; -- 5132302
194545 l_bflow_applied_to_amt := NULL; -- 5132302
194546 l_entered_amt_idx := NULL; -- 4262811
194547 l_accted_amt_idx := NULL; -- 4262811
194548 l_acc_rev_flag := NULL; -- 4262811
194549 l_accrual_line_num := NULL; -- 4262811
194550 l_tmp_amt := NULL; -- 4262811
194551 --
194552
194553 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
194554 l_balance_type_code <> 'B' THEN
194555 IF NVL(p_source_64,'
194556 ') = 'RESERVE'
194557 THEN
194558
194559 --
194560 XLA_AE_LINES_PKG.SetNewLine;
194561
194562 p_balance_type_code := l_balance_type_code;
194563 -- set the flag so later we will know whether the gain loss line needs to be created
194564
194565 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
194566 p_actual_flag :='A';
194567 END IF;
194568
194569 --
194570 -- bulk performance
194571 --
194572 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
194573 p_header_num => 0); -- 4262811
194574 --
194575 -- set accounting line options
194576 --
194577 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
194578 p_natural_side_code => 'C'
194579 , p_gain_or_loss_flag => 'N'
194580 , p_gl_transfer_mode_code => 'S'
194581 , p_acct_entry_type_code => 'A'
194582 , p_switch_side_flag => 'Y'
194583 , p_merge_duplicate_code => 'N'
194584 );
194585 --
194586 l_acc_rev_natural_side_code := 'D'; -- 4262811
194587 --
194588 --
194589 -- set accounting line type info
194590 --
194591 xla_ae_lines_pkg.SetAcctLineType
194592 (p_component_type => l_component_type
194593 ,p_event_type_code => l_event_type_code
194594 ,p_line_definition_owner_code => l_line_definition_owner_code
194595 ,p_line_definition_code => l_line_definition_code
194596 ,p_accounting_line_code => l_component_code
194597 ,p_accounting_line_type_code => l_component_type_code
194598 ,p_accounting_line_appl_id => l_component_appl_id
194599 ,p_amb_context_code => l_amb_context_code
194600 ,p_entity_code => l_entity_code
194601 ,p_event_class_code => l_event_class_code);
194602 --
194603 -- set accounting class
194604 --
194605 xla_ae_lines_pkg.SetAcctClass(
194606 p_accounting_class_code => 'ASSET'
194607 , p_ae_header_id => l_ae_header_id
194608 );
194609
194610 --
194611 -- set rounding class
194612 --
194613 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
194614 'ASSET';
194615
194616 --
194617 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
194618 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
194619 --
194620 -- bulk performance
194621 --
194622 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
194623
194624 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
194625 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
194626
194627 -- 4955764
194628 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
194632
194629 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
194630
194631 -- 4458381 Public Sector Enh
194633 --
194634 -- set accounting attributes for the line type
194635 --
194636 l_entered_amt_idx := 4;
194637 l_accted_amt_idx := 6;
194638 l_bflow_applied_to_amt_idx := NULL; -- 5132302
194639 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
194640 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
194641 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
194642 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
194643 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
194644 l_rec_acct_attrs.array_char_value(3) := p_source_51;
194645 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
194646 l_rec_acct_attrs.array_num_value(4) := p_source_65;
194647 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
194648 l_rec_acct_attrs.array_char_value(5) := p_source_66;
194649 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
194650 l_rec_acct_attrs.array_num_value(6) := p_source_65;
194651
194652 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
194653 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
194654
194655 ---------------------------------------------------------------------------------------------------------------
194656 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
194657 ---------------------------------------------------------------------------------------------------------------
194658 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
194659
194660 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
194661 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
194662
194663 IF xla_accounting_cache_pkg.GetValueChar
194664 (p_source_code => 'LEDGER_CATEGORY_CODE'
194665 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
194666 AND l_bflow_method_code = 'PRIOR_ENTRY'
194667 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
194668 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
194669 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
194670 )
194671 THEN
194672 xla_ae_lines_pkg.BflowUpgEntry
194673 (p_business_method_code => l_bflow_method_code
194674 ,p_business_class_code => l_bflow_class_code
194675 ,p_balance_type => l_balance_type_code);
194676 ELSE
194677 NULL;
194678 -- No business flow processing for business flow method of NONE.
194679 END IF;
194680
194681 --
194682 -- call analytical criteria
194683 --
194684
194685 --
194686 -- call description
194687 --
194688
194689 xla_ae_lines_pkg.SetLineDescription(
194690 p_ae_header_id => l_ae_header_id
194691 ,p_description => Description_143 (
194692 p_application_id => p_application_id
194693 , p_ae_header_id => l_ae_header_id
194694 , p_source_2 => p_source_2
194695 , p_source_3 => p_source_3
194696 )
194697 );
194698
194699
194700 --
194701 -- call ADRs
194702 -- Bug 4922099
194703 --
194704 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
194705 (NVL(l_actual_upg_option, 'N') = 'O') OR
194706 (NVL(l_enc_upg_option, 'N') = 'O')
194707 )
194708 THEN
194709 NULL;
194710 --
194711 --
194712
194713 l_ccid := AcctDerRule_185(
194714 p_application_id => p_application_id
194715 , p_ae_header_id => l_ae_header_id
194716 , p_source_40 => p_source_40
194717 , x_transaction_coa_id => l_adr_transaction_coa_id
194718 , x_accounting_coa_id => l_adr_accounting_coa_id
194719 , x_value_type_code => l_adr_value_type_code
194720 , p_side => 'NA'
194721 );
194722
194723 xla_ae_lines_pkg.set_ccid(
194724 p_code_combination_id => l_ccid
194725 , p_value_type_code => l_adr_value_type_code
194726 , p_transaction_coa_id => l_adr_transaction_coa_id
194727 , p_accounting_coa_id => l_adr_accounting_coa_id
194728 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
194729 , p_adr_type_code => 'S'
194730 , p_component_type => l_component_type
194731 , p_component_code => l_component_code
194732 , p_component_type_code => l_component_type_code
194733 , p_component_appl_id => l_component_appl_id
194734 , p_amb_context_code => l_amb_context_code
194735 , p_side => 'NA'
194736 );
194737
194738
194739 --
194740 --
194741 END IF;
194742 --
194743 -- Bug 4922099
194744 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
194745 (NVL(l_enc_upg_option, 'N') = 'O')
194746 ) AND
194747 (l_bflow_method_code = 'PRIOR_ENTRY')
194748 )
194749 THEN
194750 IF
194751 --
194752 1 = 2
194753 --
194754 THEN
194755 xla_accounting_err_pkg.build_message
194756 (p_appli_s_name => 'XLA'
194760 ,p_token_2 => 'LINE_TYPE_NAME'
194757 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
194758 ,p_token_1 => 'LINE_NUMBER'
194759 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
194761 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
194762 l_component_type
194763 ,l_component_code
194764 ,l_component_type_code
194765 ,l_component_appl_id
194766 ,l_amb_context_code
194767 ,l_entity_code
194768 ,l_event_class_code
194769 )
194770 ,p_token_3 => 'OWNER'
194771 ,p_value_3 => xla_lookups_pkg.get_meaning(
194772 p_lookup_type => 'XLA_OWNER_TYPE'
194773 ,p_lookup_code => l_component_type_code
194774 )
194775 ,p_token_4 => 'PRODUCT_NAME'
194776 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
194777 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
194778 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
194779 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
194780 ,p_ae_header_id => NULL
194781 );
194782
194783 IF (C_LEVEL_ERROR>= g_log_level) THEN
194784 trace
194785 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
194786 ,p_level => C_LEVEL_ERROR
194787 ,p_module => l_log_module);
194788 END IF;
194789 END IF;
194790 END IF;
194791 --
194792 --
194793 ------------------------------------------------------------------------------------------------
194794 -- 4219869 Business Flow
194795 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
194796 -- Prior Entry. Currently, the following code is always generated.
194797 ------------------------------------------------------------------------------------------------
194798 XLA_AE_LINES_PKG.ValidateCurrentLine;
194799
194800 ------------------------------------------------------------------------------------
194801 -- 4219869 Business Flow
194802 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
194803 ------------------------------------------------------------------------------------
194804 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
194805
194806 ----------------------------------------------------------------------------------
194807 -- 4219869 Business Flow
194808 -- Update journal entry status -- Need to generate this within IF <condition>
194809 ----------------------------------------------------------------------------------
194810 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
194811 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
194812 ,p_balance_type_code => l_balance_type_code
194813 );
194814
194815 -------------------------------------------------------------------------------------------
194816 -- 4262811 - Generate the Accrual Reversal lines
194817 -------------------------------------------------------------------------------------------
194818 BEGIN
194819 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
194820 (g_array_event(p_event_id).array_value_num('header_index'));
194821 IF l_acc_rev_flag IS NULL THEN
194822 l_acc_rev_flag := 'N';
194823 END IF;
194824 EXCEPTION
194825 WHEN OTHERS THEN
194826 l_acc_rev_flag := 'N';
194827 END;
194828 --
194829 IF (l_acc_rev_flag = 'Y') THEN
194830
194831 -- 4645092 ------------------------------------------------------------------------------
194832 -- To allow MPA report to determine if it should generate report process
194833 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
194834 ------------------------------------------------------------------------------------------
194835
194836 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
194837 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
194838 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
194839 -- call ADRs
194840 -- Bug 4922099
194841 --
194842 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
194843 (NVL(l_actual_upg_option, 'N') = 'O') OR
194844 (NVL(l_enc_upg_option, 'N') = 'O')
194845 )
194846 THEN
194847 NULL;
194851 l_ccid := AcctDerRule_185(
194848 --
194849 --
194850
194852 p_application_id => p_application_id
194853 , p_ae_header_id => l_ae_header_id
194854 , p_source_40 => p_source_40
194855 , x_transaction_coa_id => l_adr_transaction_coa_id
194856 , x_accounting_coa_id => l_adr_accounting_coa_id
194857 , x_value_type_code => l_adr_value_type_code
194858 , p_side => 'NA'
194859 );
194860
194861 xla_ae_lines_pkg.set_ccid(
194862 p_code_combination_id => l_ccid
194863 , p_value_type_code => l_adr_value_type_code
194864 , p_transaction_coa_id => l_adr_transaction_coa_id
194865 , p_accounting_coa_id => l_adr_accounting_coa_id
194866 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
194867 , p_adr_type_code => 'S'
194868 , p_component_type => l_component_type
194869 , p_component_code => l_component_code
194870 , p_component_type_code => l_component_type_code
194871 , p_component_appl_id => l_component_appl_id
194872 , p_amb_context_code => l_amb_context_code
194873 , p_side => 'NA'
194874 );
194875
194876
194877 --
194878 --
194879 END IF;
194880
194881 --
194882 -- Update the line information that should be overwritten
194883 --
194884 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
194885 p_header_num => 1);
194886 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
194887
194888 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
194889
194890 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
194891 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
194892 END IF;
194893
194894 --
194895 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
194896 --
194897 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
194898 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
194899 ELSE
194900 ---------------------------------------------------------------------------------------------------
194901 -- 4262811a Switch Sign
194902 ---------------------------------------------------------------------------------------------------
194903 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
194904 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
194905 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
194906 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
194907 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
194908 -- 5132302
194909 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
194910 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
194911
194912 END IF;
194913
194914 -- 4955764
194915 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
194916 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
194917
194918
194919 XLA_AE_LINES_PKG.ValidateCurrentLine;
194920 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
194921
194922 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
194923 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
194924 ,p_balance_type_code => l_balance_type_code);
194925
194926 END IF;
194927
194928 -----------------------------------------------------------------------------------------
194929 -- 4262811 Multiperiod Accounting
194930 -----------------------------------------------------------------------------------------
194931 -- No MPA option is assigned.
194932
194933
194934 END IF;
194935 END IF;
194936 --
194937
194938 --
194939 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
194940 trace
194941 (p_msg => 'END of AcctLineType_444'
194942 ,p_level => C_LEVEL_PROCEDURE
194943 ,p_module => l_log_module);
194944 END IF;
194945 --
194946 EXCEPTION
194947 WHEN xla_exceptions_pkg.application_exception THEN
194948 RAISE;
194949 WHEN OTHERS THEN
194950 xla_exceptions_pkg.raise_message
194951 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_444');
194952 END AcctLineType_444;
194953 --
194954
194955 ---------------------------------------
194956 --
194957 -- PRIVATE FUNCTION
194958 -- AcctLineType_445
194959 --
194960 ---------------------------------------
194961 PROCEDURE AcctLineType_445 (
194962 p_application_id IN NUMBER
194963 ,p_event_id IN NUMBER
194964 ,p_calculate_acctd_flag IN VARCHAR2
194965 ,p_calculate_g_l_flag IN VARCHAR2
194966 ,p_actual_flag IN OUT VARCHAR2
194967 ,p_balance_type_code OUT VARCHAR2
194968 ,p_gain_or_loss_ref OUT VARCHAR2
194972 --Accounting Date
194969
194970 --Inflation Adjustment Type Description
194971 , p_source_2 IN VARCHAR2
194973 , p_source_3 IN DATE
194974 --Inflation Depreciation Reserve Ccid
194975 , p_source_40 IN NUMBER
194976 --Distribution Type Code
194977 , p_source_51 IN VARCHAR2
194978 --Asset Identifier
194979 , p_source_56 IN NUMBER
194980 --Period Counter
194981 , p_source_57 IN NUMBER
194982 --Distribution Identifier
194983 , p_source_58 IN NUMBER
194984 --Book Type Code
194985 , p_source_59 IN VARCHAR2
194986 --Depreciation Run Identifier
194987 , p_source_62 IN NUMBER
194988 --Inflation Adjustment Type
194989 , p_source_64 IN VARCHAR2
194990 --Inflation Entered Amount
194991 , p_source_65 IN NUMBER
194992 --Inflation Currency Code
194993 , p_source_66 IN VARCHAR2
194994 )
194995 IS
194996
194997 l_component_type VARCHAR2(80);
194998 l_component_code VARCHAR2(30);
194999 l_component_type_code VARCHAR2(1);
195000 l_component_appl_id INTEGER;
195001 l_amb_context_code VARCHAR2(30);
195002 l_entity_code VARCHAR2(30);
195003 l_event_class_code VARCHAR2(30);
195004 l_ae_header_id NUMBER;
195005 l_event_type_code VARCHAR2(30);
195006 l_line_definition_code VARCHAR2(30);
195007 l_line_definition_owner_code VARCHAR2(1);
195008 --
195009 -- adr variables
195010 l_segment VARCHAR2(30);
195011 l_ccid NUMBER;
195012 l_adr_transaction_coa_id NUMBER;
195013 l_adr_accounting_coa_id NUMBER;
195014 l_adr_flexfield_segment_code VARCHAR2(30);
195015 l_adr_flex_value_set_id NUMBER;
195016 l_adr_value_type_code VARCHAR2(30);
195017 l_adr_value_combination_id NUMBER;
195018 l_adr_value_segment_code VARCHAR2(30);
195019
195020 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
195021 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
195022 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
195023 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
195024
195025 -- 4262811 Variables ------------------------------------------------------------------------------------------
195026 l_entered_amt_idx NUMBER;
195027 l_accted_amt_idx NUMBER;
195028 l_acc_rev_flag VARCHAR2(1);
195029 l_accrual_line_num NUMBER;
195030 l_tmp_amt NUMBER;
195031 l_acc_rev_natural_side_code VARCHAR2(1);
195032
195033 l_num_entries NUMBER;
195034 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
195035 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
195036 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
195037 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
195038 l_recog_line_1 NUMBER;
195039 l_recog_line_2 NUMBER;
195040
195041 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
195042 l_bflow_applied_to_amt NUMBER; -- 5132302
195043 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
195044
195045 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
195046
195047 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
195048 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
195049
195050 ---------------------------------------------------------------------------------------------------------------
195051
195052
195053 --
195054 -- bulk performance
195055 --
195056 l_balance_type_code VARCHAR2(1);
195057 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
195058 l_log_module VARCHAR2(240);
195059
195060 --
195061 -- Upgrade strategy
195062 --
195063 l_actual_upg_option VARCHAR2(1);
195064 l_enc_upg_option VARCHAR2(1);
195065
195066 --
195067 BEGIN
195068 --
195069 IF g_log_enabled THEN
195070 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_445';
195071 END IF;
195072 --
195073 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
195074
195075 trace
195076 (p_msg => 'BEGIN of AcctLineType_445'
195077 ,p_level => C_LEVEL_PROCEDURE
195078 ,p_module => l_log_module);
195079
195080 END IF;
195081 --
195082 l_component_type := 'AMB_JLT';
195083 l_component_code := 'IAC_DEPRECIATION_RESERVE';
195084 l_component_type_code := 'S';
195085 l_component_appl_id := 140;
195086 l_amb_context_code := 'DEFAULT';
195087 l_entity_code := 'DEPRECIATION';
195088 l_event_class_code := 'DEPRECIATION';
195089 l_event_type_code := 'DEPRECIATION_ALL';
195090 l_line_definition_owner_code := 'S';
195091 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
195092 --
195093 l_balance_type_code := 'A';
195094 l_segment := NULL;
195095 l_ccid := NULL;
195096 l_adr_transaction_coa_id := NULL;
195097 l_adr_accounting_coa_id := NULL;
195098 l_adr_flexfield_segment_code := NULL;
195099 l_adr_flex_value_set_id := NULL;
195103
195100 l_adr_value_type_code := NULL;
195101 l_adr_value_combination_id := NULL;
195102 l_adr_value_segment_code := NULL;
195104 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
195105 l_bflow_class_code := ''; -- 4219869 Business Flow
195106 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
195107 l_budgetary_control_flag := 'N';
195108
195109 l_bflow_applied_to_amt_idx := NULL; -- 5132302
195110 l_bflow_applied_to_amt := NULL; -- 5132302
195111 l_entered_amt_idx := NULL; -- 4262811
195112 l_accted_amt_idx := NULL; -- 4262811
195113 l_acc_rev_flag := NULL; -- 4262811
195114 l_accrual_line_num := NULL; -- 4262811
195115 l_tmp_amt := NULL; -- 4262811
195116 --
195117
195118 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
195119 l_balance_type_code <> 'B' THEN
195120 IF NVL(p_source_64,'
195121 ') = 'RESERVE'
195122 THEN
195123
195124 --
195125 XLA_AE_LINES_PKG.SetNewLine;
195126
195127 p_balance_type_code := l_balance_type_code;
195128 -- set the flag so later we will know whether the gain loss line needs to be created
195129
195130 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
195131 p_actual_flag :='A';
195132 END IF;
195133
195134 --
195135 -- bulk performance
195136 --
195137 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
195138 p_header_num => 0); -- 4262811
195139 --
195140 -- set accounting line options
195141 --
195142 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
195143 p_natural_side_code => 'C'
195144 , p_gain_or_loss_flag => 'N'
195145 , p_gl_transfer_mode_code => 'S'
195146 , p_acct_entry_type_code => 'A'
195147 , p_switch_side_flag => 'Y'
195148 , p_merge_duplicate_code => 'N'
195149 );
195150 --
195151 l_acc_rev_natural_side_code := 'D'; -- 4262811
195152 --
195153 --
195154 -- set accounting line type info
195155 --
195156 xla_ae_lines_pkg.SetAcctLineType
195157 (p_component_type => l_component_type
195158 ,p_event_type_code => l_event_type_code
195159 ,p_line_definition_owner_code => l_line_definition_owner_code
195160 ,p_line_definition_code => l_line_definition_code
195161 ,p_accounting_line_code => l_component_code
195162 ,p_accounting_line_type_code => l_component_type_code
195163 ,p_accounting_line_appl_id => l_component_appl_id
195164 ,p_amb_context_code => l_amb_context_code
195165 ,p_entity_code => l_entity_code
195166 ,p_event_class_code => l_event_class_code);
195167 --
195168 -- set accounting class
195169 --
195170 xla_ae_lines_pkg.SetAcctClass(
195171 p_accounting_class_code => 'ASSET'
195172 , p_ae_header_id => l_ae_header_id
195173 );
195174
195175 --
195176 -- set rounding class
195177 --
195178 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
195179 'ASSET';
195180
195181 --
195182 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
195183 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
195184 --
195185 -- bulk performance
195186 --
195187 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
195188
195189 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
195190 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
195191
195192 -- 4955764
195193 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
195194 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
195195
195196 -- 4458381 Public Sector Enh
195197
195198 --
195199 -- set accounting attributes for the line type
195200 --
195201 l_entered_amt_idx := 7;
195202 l_accted_amt_idx := 9;
195203 l_bflow_applied_to_amt_idx := NULL; -- 5132302
195204 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
195205 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
195206 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
195207 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
195208 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
195209 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
195210 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
195211 l_rec_acct_attrs.array_char_value(4) := p_source_59;
195212 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
195213 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
195214 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
195215 l_rec_acct_attrs.array_char_value(6) := p_source_51;
195216 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
195217 l_rec_acct_attrs.array_num_value(7) := p_source_65;
195218 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
195222
195219 l_rec_acct_attrs.array_char_value(8) := p_source_66;
195220 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
195221 l_rec_acct_attrs.array_num_value(9) := p_source_65;
195223 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
195224 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
195225
195226 ---------------------------------------------------------------------------------------------------------------
195227 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
195228 ---------------------------------------------------------------------------------------------------------------
195229 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
195230
195231 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
195232 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
195233
195234 IF xla_accounting_cache_pkg.GetValueChar
195235 (p_source_code => 'LEDGER_CATEGORY_CODE'
195236 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
195237 AND l_bflow_method_code = 'PRIOR_ENTRY'
195238 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
195239 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
195240 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
195241 )
195242 THEN
195243 xla_ae_lines_pkg.BflowUpgEntry
195244 (p_business_method_code => l_bflow_method_code
195245 ,p_business_class_code => l_bflow_class_code
195246 ,p_balance_type => l_balance_type_code);
195247 ELSE
195248 NULL;
195249 -- No business flow processing for business flow method of NONE.
195250 END IF;
195251
195252 --
195253 -- call analytical criteria
195254 --
195255
195256 --
195257 -- call description
195258 --
195259
195260 xla_ae_lines_pkg.SetLineDescription(
195261 p_ae_header_id => l_ae_header_id
195262 ,p_description => Description_143 (
195263 p_application_id => p_application_id
195264 , p_ae_header_id => l_ae_header_id
195265 , p_source_2 => p_source_2
195266 , p_source_3 => p_source_3
195267 )
195268 );
195269
195270
195271 --
195272 -- call ADRs
195273 -- Bug 4922099
195274 --
195275 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
195276 (NVL(l_actual_upg_option, 'N') = 'O') OR
195277 (NVL(l_enc_upg_option, 'N') = 'O')
195278 )
195279 THEN
195280 NULL;
195281 --
195282 --
195283
195284 l_ccid := AcctDerRule_185(
195285 p_application_id => p_application_id
195286 , p_ae_header_id => l_ae_header_id
195287 , p_source_40 => p_source_40
195288 , x_transaction_coa_id => l_adr_transaction_coa_id
195289 , x_accounting_coa_id => l_adr_accounting_coa_id
195290 , x_value_type_code => l_adr_value_type_code
195291 , p_side => 'NA'
195292 );
195293
195294 xla_ae_lines_pkg.set_ccid(
195295 p_code_combination_id => l_ccid
195296 , p_value_type_code => l_adr_value_type_code
195297 , p_transaction_coa_id => l_adr_transaction_coa_id
195298 , p_accounting_coa_id => l_adr_accounting_coa_id
195299 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
195300 , p_adr_type_code => 'S'
195301 , p_component_type => l_component_type
195302 , p_component_code => l_component_code
195303 , p_component_type_code => l_component_type_code
195304 , p_component_appl_id => l_component_appl_id
195305 , p_amb_context_code => l_amb_context_code
195306 , p_side => 'NA'
195307 );
195308
195309
195310 --
195311 --
195312 END IF;
195313 --
195314 -- Bug 4922099
195315 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
195316 (NVL(l_enc_upg_option, 'N') = 'O')
195317 ) AND
195318 (l_bflow_method_code = 'PRIOR_ENTRY')
195319 )
195320 THEN
195321 IF
195322 --
195323 1 = 2
195324 --
195325 THEN
195326 xla_accounting_err_pkg.build_message
195327 (p_appli_s_name => 'XLA'
195328 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
195329 ,p_token_1 => 'LINE_NUMBER'
195330 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
195331 ,p_token_2 => 'LINE_TYPE_NAME'
195332 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
195333 l_component_type
195334 ,l_component_code
195335 ,l_component_type_code
195336 ,l_component_appl_id
195337 ,l_amb_context_code
195338 ,l_entity_code
195342 ,p_value_3 => xla_lookups_pkg.get_meaning(
195339 ,l_event_class_code
195340 )
195341 ,p_token_3 => 'OWNER'
195343 p_lookup_type => 'XLA_OWNER_TYPE'
195344 ,p_lookup_code => l_component_type_code
195345 )
195346 ,p_token_4 => 'PRODUCT_NAME'
195347 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
195348 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
195349 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
195350 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
195351 ,p_ae_header_id => NULL
195352 );
195353
195354 IF (C_LEVEL_ERROR>= g_log_level) THEN
195355 trace
195356 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
195357 ,p_level => C_LEVEL_ERROR
195358 ,p_module => l_log_module);
195359 END IF;
195360 END IF;
195361 END IF;
195362 --
195363 --
195364 ------------------------------------------------------------------------------------------------
195365 -- 4219869 Business Flow
195366 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
195367 -- Prior Entry. Currently, the following code is always generated.
195368 ------------------------------------------------------------------------------------------------
195369 XLA_AE_LINES_PKG.ValidateCurrentLine;
195370
195371 ------------------------------------------------------------------------------------
195372 -- 4219869 Business Flow
195373 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
195374 ------------------------------------------------------------------------------------
195375 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
195376
195377 ----------------------------------------------------------------------------------
195378 -- 4219869 Business Flow
195379 -- Update journal entry status -- Need to generate this within IF <condition>
195380 ----------------------------------------------------------------------------------
195381 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
195382 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
195383 ,p_balance_type_code => l_balance_type_code
195384 );
195385
195386 -------------------------------------------------------------------------------------------
195387 -- 4262811 - Generate the Accrual Reversal lines
195388 -------------------------------------------------------------------------------------------
195389 BEGIN
195390 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
195391 (g_array_event(p_event_id).array_value_num('header_index'));
195392 IF l_acc_rev_flag IS NULL THEN
195393 l_acc_rev_flag := 'N';
195394 END IF;
195395 EXCEPTION
195396 WHEN OTHERS THEN
195397 l_acc_rev_flag := 'N';
195398 END;
195399 --
195400 IF (l_acc_rev_flag = 'Y') THEN
195401
195402 -- 4645092 ------------------------------------------------------------------------------
195403 -- To allow MPA report to determine if it should generate report process
195404 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
195405 ------------------------------------------------------------------------------------------
195406
195407 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
195408 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
195409 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
195410 -- call ADRs
195411 -- Bug 4922099
195412 --
195413 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
195414 (NVL(l_actual_upg_option, 'N') = 'O') OR
195415 (NVL(l_enc_upg_option, 'N') = 'O')
195416 )
195417 THEN
195418 NULL;
195419 --
195420 --
195421
195422 l_ccid := AcctDerRule_185(
195423 p_application_id => p_application_id
195424 , p_ae_header_id => l_ae_header_id
195425 , p_source_40 => p_source_40
195426 , x_transaction_coa_id => l_adr_transaction_coa_id
195427 , x_accounting_coa_id => l_adr_accounting_coa_id
195428 , x_value_type_code => l_adr_value_type_code
195429 , p_side => 'NA'
195430 );
195431
195432 xla_ae_lines_pkg.set_ccid(
195433 p_code_combination_id => l_ccid
195434 , p_value_type_code => l_adr_value_type_code
195435 , p_transaction_coa_id => l_adr_transaction_coa_id
195436 , p_accounting_coa_id => l_adr_accounting_coa_id
195437 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
195438 , p_adr_type_code => 'S'
195439 , p_component_type => l_component_type
195443 , p_amb_context_code => l_amb_context_code
195440 , p_component_code => l_component_code
195441 , p_component_type_code => l_component_type_code
195442 , p_component_appl_id => l_component_appl_id
195444 , p_side => 'NA'
195445 );
195446
195447
195448 --
195449 --
195450 END IF;
195451
195452 --
195453 -- Update the line information that should be overwritten
195454 --
195455 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
195456 p_header_num => 1);
195457 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
195458
195459 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
195460
195461 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
195462 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
195463 END IF;
195464
195465 --
195466 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
195467 --
195468 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
195469 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
195470 ELSE
195471 ---------------------------------------------------------------------------------------------------
195472 -- 4262811a Switch Sign
195473 ---------------------------------------------------------------------------------------------------
195474 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
195475 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
195476 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
195477 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
195478 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
195479 -- 5132302
195480 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
195481 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
195482
195483 END IF;
195484
195485 -- 4955764
195486 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
195487 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
195488
195489
195490 XLA_AE_LINES_PKG.ValidateCurrentLine;
195491 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
195492
195493 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
195494 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
195495 ,p_balance_type_code => l_balance_type_code);
195496
195497 END IF;
195498
195499 -----------------------------------------------------------------------------------------
195500 -- 4262811 Multiperiod Accounting
195501 -----------------------------------------------------------------------------------------
195502 -- No MPA option is assigned.
195503
195504
195505 END IF;
195506 END IF;
195507 --
195508
195509 --
195510 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
195511 trace
195512 (p_msg => 'END of AcctLineType_445'
195513 ,p_level => C_LEVEL_PROCEDURE
195514 ,p_module => l_log_module);
195515 END IF;
195516 --
195517 EXCEPTION
195518 WHEN xla_exceptions_pkg.application_exception THEN
195519 RAISE;
195520 WHEN OTHERS THEN
195521 xla_exceptions_pkg.raise_message
195522 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_445');
195523 END AcctLineType_445;
195524 --
195525
195526 ---------------------------------------
195527 --
195528 -- PRIVATE FUNCTION
195529 -- AcctLineType_446
195530 --
195531 ---------------------------------------
195532 PROCEDURE AcctLineType_446 (
195533 p_application_id IN NUMBER
195534 ,p_event_id IN NUMBER
195535 ,p_calculate_acctd_flag IN VARCHAR2
195536 ,p_calculate_g_l_flag IN VARCHAR2
195537 ,p_actual_flag IN OUT VARCHAR2
195538 ,p_balance_type_code OUT VARCHAR2
195539 ,p_gain_or_loss_ref OUT VARCHAR2
195540
195541 --Inflation Adjustment Type Description
195542 , p_source_2 IN VARCHAR2
195543 --Accounting Date
195544 , p_source_3 IN DATE
195545 --Inflation Depreciation Reserve Ccid
195546 , p_source_40 IN NUMBER
195547 --Transaction Header Identifier
195548 , p_source_49 IN NUMBER
195549 --Adjustment Line Identifier
195550 , p_source_50 IN NUMBER
195551 --Distribution Type Code
195552 , p_source_51 IN VARCHAR2
195553 --Inflation Adjustment Type
195554 , p_source_64 IN VARCHAR2
195555 --Inflation Entered Amount
195556 , p_source_65 IN NUMBER
195557 --Inflation Currency Code
195558 , p_source_66 IN VARCHAR2
195559 )
195560 IS
195561
195562 l_component_type VARCHAR2(80);
195563 l_component_code VARCHAR2(30);
195564 l_component_type_code VARCHAR2(1);
195565 l_component_appl_id INTEGER;
195569 l_ae_header_id NUMBER;
195566 l_amb_context_code VARCHAR2(30);
195567 l_entity_code VARCHAR2(30);
195568 l_event_class_code VARCHAR2(30);
195570 l_event_type_code VARCHAR2(30);
195571 l_line_definition_code VARCHAR2(30);
195572 l_line_definition_owner_code VARCHAR2(1);
195573 --
195574 -- adr variables
195575 l_segment VARCHAR2(30);
195576 l_ccid NUMBER;
195577 l_adr_transaction_coa_id NUMBER;
195578 l_adr_accounting_coa_id NUMBER;
195579 l_adr_flexfield_segment_code VARCHAR2(30);
195580 l_adr_flex_value_set_id NUMBER;
195581 l_adr_value_type_code VARCHAR2(30);
195582 l_adr_value_combination_id NUMBER;
195583 l_adr_value_segment_code VARCHAR2(30);
195584
195585 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
195586 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
195587 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
195588 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
195589
195590 -- 4262811 Variables ------------------------------------------------------------------------------------------
195591 l_entered_amt_idx NUMBER;
195592 l_accted_amt_idx NUMBER;
195593 l_acc_rev_flag VARCHAR2(1);
195594 l_accrual_line_num NUMBER;
195595 l_tmp_amt NUMBER;
195596 l_acc_rev_natural_side_code VARCHAR2(1);
195597
195598 l_num_entries NUMBER;
195599 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
195600 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
195601 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
195602 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
195603 l_recog_line_1 NUMBER;
195604 l_recog_line_2 NUMBER;
195605
195606 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
195607 l_bflow_applied_to_amt NUMBER; -- 5132302
195608 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
195609
195610 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
195611
195612 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
195613 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
195614
195615 ---------------------------------------------------------------------------------------------------------------
195616
195617
195618 --
195619 -- bulk performance
195620 --
195621 l_balance_type_code VARCHAR2(1);
195622 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
195623 l_log_module VARCHAR2(240);
195624
195625 --
195626 -- Upgrade strategy
195627 --
195628 l_actual_upg_option VARCHAR2(1);
195629 l_enc_upg_option VARCHAR2(1);
195630
195631 --
195632 BEGIN
195633 --
195634 IF g_log_enabled THEN
195635 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_446';
195636 END IF;
195637 --
195638 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
195639
195640 trace
195641 (p_msg => 'BEGIN of AcctLineType_446'
195642 ,p_level => C_LEVEL_PROCEDURE
195643 ,p_module => l_log_module);
195644
195645 END IF;
195646 --
195647 l_component_type := 'AMB_JLT';
195648 l_component_code := 'IAC_DEPRECIATION_RESERVE';
195649 l_component_type_code := 'S';
195650 l_component_appl_id := 140;
195651 l_amb_context_code := 'DEFAULT';
195652 l_entity_code := 'TRANSACTIONS';
195653 l_event_class_code := 'RETIREMENTS';
195654 l_event_type_code := 'RETIREMENTS';
195655 l_line_definition_owner_code := 'S';
195656 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
195657 --
195658 l_balance_type_code := 'A';
195659 l_segment := NULL;
195660 l_ccid := NULL;
195661 l_adr_transaction_coa_id := NULL;
195662 l_adr_accounting_coa_id := NULL;
195663 l_adr_flexfield_segment_code := NULL;
195664 l_adr_flex_value_set_id := NULL;
195665 l_adr_value_type_code := NULL;
195666 l_adr_value_combination_id := NULL;
195667 l_adr_value_segment_code := NULL;
195668
195669 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
195670 l_bflow_class_code := ''; -- 4219869 Business Flow
195671 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
195672 l_budgetary_control_flag := 'N';
195673
195674 l_bflow_applied_to_amt_idx := NULL; -- 5132302
195675 l_bflow_applied_to_amt := NULL; -- 5132302
195676 l_entered_amt_idx := NULL; -- 4262811
195677 l_accted_amt_idx := NULL; -- 4262811
195678 l_acc_rev_flag := NULL; -- 4262811
195679 l_accrual_line_num := NULL; -- 4262811
195680 l_tmp_amt := NULL; -- 4262811
195681 --
195682
195683 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
195684 l_balance_type_code <> 'B' THEN
195685 IF NVL(p_source_64,'
195686 ') = 'RESERVE'
195687 THEN
195688
195689 --
195690 XLA_AE_LINES_PKG.SetNewLine;
195691
195695 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
195692 p_balance_type_code := l_balance_type_code;
195693 -- set the flag so later we will know whether the gain loss line needs to be created
195694
195696 p_actual_flag :='A';
195697 END IF;
195698
195699 --
195700 -- bulk performance
195701 --
195702 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
195703 p_header_num => 0); -- 4262811
195704 --
195705 -- set accounting line options
195706 --
195707 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
195708 p_natural_side_code => 'C'
195709 , p_gain_or_loss_flag => 'N'
195710 , p_gl_transfer_mode_code => 'S'
195711 , p_acct_entry_type_code => 'A'
195712 , p_switch_side_flag => 'Y'
195713 , p_merge_duplicate_code => 'N'
195714 );
195715 --
195716 l_acc_rev_natural_side_code := 'D'; -- 4262811
195717 --
195718 --
195719 -- set accounting line type info
195720 --
195721 xla_ae_lines_pkg.SetAcctLineType
195722 (p_component_type => l_component_type
195723 ,p_event_type_code => l_event_type_code
195724 ,p_line_definition_owner_code => l_line_definition_owner_code
195725 ,p_line_definition_code => l_line_definition_code
195726 ,p_accounting_line_code => l_component_code
195727 ,p_accounting_line_type_code => l_component_type_code
195728 ,p_accounting_line_appl_id => l_component_appl_id
195729 ,p_amb_context_code => l_amb_context_code
195730 ,p_entity_code => l_entity_code
195731 ,p_event_class_code => l_event_class_code);
195732 --
195733 -- set accounting class
195734 --
195735 xla_ae_lines_pkg.SetAcctClass(
195736 p_accounting_class_code => 'ASSET'
195737 , p_ae_header_id => l_ae_header_id
195738 );
195739
195740 --
195741 -- set rounding class
195742 --
195743 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
195744 'ASSET';
195745
195746 --
195747 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
195748 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
195749 --
195750 -- bulk performance
195751 --
195752 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
195753
195754 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
195755 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
195756
195757 -- 4955764
195758 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
195759 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
195760
195761 -- 4458381 Public Sector Enh
195762
195763 --
195764 -- set accounting attributes for the line type
195765 --
195766 l_entered_amt_idx := 4;
195767 l_accted_amt_idx := 6;
195768 l_bflow_applied_to_amt_idx := NULL; -- 5132302
195769 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
195770 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
195771 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
195772 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
195773 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
195774 l_rec_acct_attrs.array_char_value(3) := p_source_51;
195775 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
195776 l_rec_acct_attrs.array_num_value(4) := p_source_65;
195777 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
195778 l_rec_acct_attrs.array_char_value(5) := p_source_66;
195779 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
195780 l_rec_acct_attrs.array_num_value(6) := p_source_65;
195781
195782 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
195783 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
195784
195785 ---------------------------------------------------------------------------------------------------------------
195786 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
195787 ---------------------------------------------------------------------------------------------------------------
195788 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
195789
195790 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
195791 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
195792
195793 IF xla_accounting_cache_pkg.GetValueChar
195794 (p_source_code => 'LEDGER_CATEGORY_CODE'
195795 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
195796 AND l_bflow_method_code = 'PRIOR_ENTRY'
195797 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
195798 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
195799 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
195800 )
195801 THEN
195802 xla_ae_lines_pkg.BflowUpgEntry
195803 (p_business_method_code => l_bflow_method_code
195807 NULL;
195804 ,p_business_class_code => l_bflow_class_code
195805 ,p_balance_type => l_balance_type_code);
195806 ELSE
195808 -- No business flow processing for business flow method of NONE.
195809 END IF;
195810
195811 --
195812 -- call analytical criteria
195813 --
195814
195815 --
195816 -- call description
195817 --
195818
195819 xla_ae_lines_pkg.SetLineDescription(
195820 p_ae_header_id => l_ae_header_id
195821 ,p_description => Description_143 (
195822 p_application_id => p_application_id
195823 , p_ae_header_id => l_ae_header_id
195824 , p_source_2 => p_source_2
195825 , p_source_3 => p_source_3
195826 )
195827 );
195828
195829
195830 --
195831 -- call ADRs
195832 -- Bug 4922099
195833 --
195834 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
195835 (NVL(l_actual_upg_option, 'N') = 'O') OR
195836 (NVL(l_enc_upg_option, 'N') = 'O')
195837 )
195838 THEN
195839 NULL;
195840 --
195841 --
195842
195843 l_ccid := AcctDerRule_185(
195844 p_application_id => p_application_id
195845 , p_ae_header_id => l_ae_header_id
195846 , p_source_40 => p_source_40
195847 , x_transaction_coa_id => l_adr_transaction_coa_id
195848 , x_accounting_coa_id => l_adr_accounting_coa_id
195849 , x_value_type_code => l_adr_value_type_code
195850 , p_side => 'NA'
195851 );
195852
195853 xla_ae_lines_pkg.set_ccid(
195854 p_code_combination_id => l_ccid
195855 , p_value_type_code => l_adr_value_type_code
195856 , p_transaction_coa_id => l_adr_transaction_coa_id
195857 , p_accounting_coa_id => l_adr_accounting_coa_id
195858 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
195859 , p_adr_type_code => 'S'
195860 , p_component_type => l_component_type
195861 , p_component_code => l_component_code
195862 , p_component_type_code => l_component_type_code
195863 , p_component_appl_id => l_component_appl_id
195864 , p_amb_context_code => l_amb_context_code
195865 , p_side => 'NA'
195866 );
195867
195868
195869 --
195870 --
195871 END IF;
195872 --
195873 -- Bug 4922099
195874 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
195875 (NVL(l_enc_upg_option, 'N') = 'O')
195876 ) AND
195877 (l_bflow_method_code = 'PRIOR_ENTRY')
195878 )
195879 THEN
195880 IF
195881 --
195882 1 = 2
195883 --
195884 THEN
195885 xla_accounting_err_pkg.build_message
195886 (p_appli_s_name => 'XLA'
195887 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
195888 ,p_token_1 => 'LINE_NUMBER'
195889 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
195890 ,p_token_2 => 'LINE_TYPE_NAME'
195891 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
195892 l_component_type
195893 ,l_component_code
195894 ,l_component_type_code
195895 ,l_component_appl_id
195896 ,l_amb_context_code
195897 ,l_entity_code
195898 ,l_event_class_code
195899 )
195900 ,p_token_3 => 'OWNER'
195901 ,p_value_3 => xla_lookups_pkg.get_meaning(
195902 p_lookup_type => 'XLA_OWNER_TYPE'
195903 ,p_lookup_code => l_component_type_code
195904 )
195905 ,p_token_4 => 'PRODUCT_NAME'
195906 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
195907 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
195908 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
195909 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
195910 ,p_ae_header_id => NULL
195911 );
195912
195913 IF (C_LEVEL_ERROR>= g_log_level) THEN
195914 trace
195915 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
195916 ,p_level => C_LEVEL_ERROR
195917 ,p_module => l_log_module);
195918 END IF;
195919 END IF;
195920 END IF;
195921 --
195922 --
195926 -- Prior Entry. Currently, the following code is always generated.
195923 ------------------------------------------------------------------------------------------------
195924 -- 4219869 Business Flow
195925 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
195927 ------------------------------------------------------------------------------------------------
195928 XLA_AE_LINES_PKG.ValidateCurrentLine;
195929
195930 ------------------------------------------------------------------------------------
195931 -- 4219869 Business Flow
195932 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
195933 ------------------------------------------------------------------------------------
195934 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
195935
195936 ----------------------------------------------------------------------------------
195937 -- 4219869 Business Flow
195938 -- Update journal entry status -- Need to generate this within IF <condition>
195939 ----------------------------------------------------------------------------------
195940 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
195941 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
195942 ,p_balance_type_code => l_balance_type_code
195943 );
195944
195945 -------------------------------------------------------------------------------------------
195946 -- 4262811 - Generate the Accrual Reversal lines
195947 -------------------------------------------------------------------------------------------
195948 BEGIN
195949 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
195950 (g_array_event(p_event_id).array_value_num('header_index'));
195951 IF l_acc_rev_flag IS NULL THEN
195952 l_acc_rev_flag := 'N';
195953 END IF;
195954 EXCEPTION
195955 WHEN OTHERS THEN
195956 l_acc_rev_flag := 'N';
195957 END;
195958 --
195959 IF (l_acc_rev_flag = 'Y') THEN
195960
195961 -- 4645092 ------------------------------------------------------------------------------
195962 -- To allow MPA report to determine if it should generate report process
195963 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
195964 ------------------------------------------------------------------------------------------
195965
195966 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
195967 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
195968 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
195969 -- call ADRs
195970 -- Bug 4922099
195971 --
195972 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
195973 (NVL(l_actual_upg_option, 'N') = 'O') OR
195974 (NVL(l_enc_upg_option, 'N') = 'O')
195975 )
195976 THEN
195977 NULL;
195978 --
195979 --
195980
195981 l_ccid := AcctDerRule_185(
195982 p_application_id => p_application_id
195983 , p_ae_header_id => l_ae_header_id
195984 , p_source_40 => p_source_40
195985 , x_transaction_coa_id => l_adr_transaction_coa_id
195986 , x_accounting_coa_id => l_adr_accounting_coa_id
195987 , x_value_type_code => l_adr_value_type_code
195988 , p_side => 'NA'
195989 );
195990
195991 xla_ae_lines_pkg.set_ccid(
195992 p_code_combination_id => l_ccid
195993 , p_value_type_code => l_adr_value_type_code
195994 , p_transaction_coa_id => l_adr_transaction_coa_id
195995 , p_accounting_coa_id => l_adr_accounting_coa_id
195996 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
195997 , p_adr_type_code => 'S'
195998 , p_component_type => l_component_type
195999 , p_component_code => l_component_code
196000 , p_component_type_code => l_component_type_code
196001 , p_component_appl_id => l_component_appl_id
196002 , p_amb_context_code => l_amb_context_code
196003 , p_side => 'NA'
196004 );
196005
196006
196007 --
196008 --
196009 END IF;
196010
196011 --
196012 -- Update the line information that should be overwritten
196013 --
196014 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
196015 p_header_num => 1);
196016 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
196017
196018 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
196019
196020 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
196021 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
196022 END IF;
196023
196024 --
196025 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
196026 --
196027 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
196028 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
196029 ELSE
196030 ---------------------------------------------------------------------------------------------------
196031 -- 4262811a Switch Sign
196035 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
196032 ---------------------------------------------------------------------------------------------------
196033 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
196034 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
196036 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
196037 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
196038 -- 5132302
196039 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
196040 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
196041
196042 END IF;
196043
196044 -- 4955764
196045 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
196046 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
196047
196048
196049 XLA_AE_LINES_PKG.ValidateCurrentLine;
196050 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
196051
196052 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
196053 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
196054 ,p_balance_type_code => l_balance_type_code);
196055
196056 END IF;
196057
196058 -----------------------------------------------------------------------------------------
196059 -- 4262811 Multiperiod Accounting
196060 -----------------------------------------------------------------------------------------
196061 -- No MPA option is assigned.
196062
196063
196064 END IF;
196065 END IF;
196066 --
196067
196068 --
196069 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
196070 trace
196071 (p_msg => 'END of AcctLineType_446'
196072 ,p_level => C_LEVEL_PROCEDURE
196073 ,p_module => l_log_module);
196074 END IF;
196075 --
196076 EXCEPTION
196077 WHEN xla_exceptions_pkg.application_exception THEN
196078 RAISE;
196079 WHEN OTHERS THEN
196080 xla_exceptions_pkg.raise_message
196081 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_446');
196082 END AcctLineType_446;
196083 --
196084
196085 ---------------------------------------
196086 --
196087 -- PRIVATE FUNCTION
196088 -- AcctLineType_447
196089 --
196090 ---------------------------------------
196091 PROCEDURE AcctLineType_447 (
196092 p_application_id IN NUMBER
196093 ,p_event_id IN NUMBER
196094 ,p_calculate_acctd_flag IN VARCHAR2
196095 ,p_calculate_g_l_flag IN VARCHAR2
196096 ,p_actual_flag IN OUT VARCHAR2
196097 ,p_balance_type_code OUT VARCHAR2
196098 ,p_gain_or_loss_ref OUT VARCHAR2
196099
196100 --Inflation Adjustment Type Description
196101 , p_source_2 IN VARCHAR2
196102 --Accounting Date
196103 , p_source_3 IN DATE
196104 --Inflation Depreciation Reserve Ccid
196105 , p_source_40 IN NUMBER
196106 --Distribution Type Code
196107 , p_source_51 IN VARCHAR2
196108 --Inflation Adjustment Type
196109 , p_source_64 IN VARCHAR2
196110 --Inflation Entered Amount
196111 , p_source_65 IN NUMBER
196112 --Inflation Currency Code
196113 , p_source_66 IN VARCHAR2
196114 --Inflation Adjustment Identifier
196115 , p_source_67 IN NUMBER
196116 --Inflation Asset Identifier
196117 , p_source_68 IN NUMBER
196118 --Inflation Asset Distribution Identifier
196119 , p_source_69 IN NUMBER
196120 --Inflation Adjustment Line Identifier
196121 , p_source_70 IN NUMBER
196122 )
196123 IS
196124
196125 l_component_type VARCHAR2(80);
196126 l_component_code VARCHAR2(30);
196127 l_component_type_code VARCHAR2(1);
196128 l_component_appl_id INTEGER;
196129 l_amb_context_code VARCHAR2(30);
196130 l_entity_code VARCHAR2(30);
196131 l_event_class_code VARCHAR2(30);
196132 l_ae_header_id NUMBER;
196133 l_event_type_code VARCHAR2(30);
196134 l_line_definition_code VARCHAR2(30);
196135 l_line_definition_owner_code VARCHAR2(1);
196136 --
196137 -- adr variables
196138 l_segment VARCHAR2(30);
196139 l_ccid NUMBER;
196140 l_adr_transaction_coa_id NUMBER;
196141 l_adr_accounting_coa_id NUMBER;
196142 l_adr_flexfield_segment_code VARCHAR2(30);
196143 l_adr_flex_value_set_id NUMBER;
196144 l_adr_value_type_code VARCHAR2(30);
196145 l_adr_value_combination_id NUMBER;
196146 l_adr_value_segment_code VARCHAR2(30);
196147
196148 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
196149 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
196150 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
196151 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
196152
196153 -- 4262811 Variables ------------------------------------------------------------------------------------------
196154 l_entered_amt_idx NUMBER;
196155 l_accted_amt_idx NUMBER;
196156 l_acc_rev_flag VARCHAR2(1);
196160
196157 l_accrual_line_num NUMBER;
196158 l_tmp_amt NUMBER;
196159 l_acc_rev_natural_side_code VARCHAR2(1);
196161 l_num_entries NUMBER;
196162 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
196163 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
196164 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
196165 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
196166 l_recog_line_1 NUMBER;
196167 l_recog_line_2 NUMBER;
196168
196169 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
196170 l_bflow_applied_to_amt NUMBER; -- 5132302
196171 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
196172
196173 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
196174
196175 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
196176 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
196177
196178 ---------------------------------------------------------------------------------------------------------------
196179
196180
196181 --
196182 -- bulk performance
196183 --
196184 l_balance_type_code VARCHAR2(1);
196185 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
196186 l_log_module VARCHAR2(240);
196187
196188 --
196189 -- Upgrade strategy
196190 --
196191 l_actual_upg_option VARCHAR2(1);
196192 l_enc_upg_option VARCHAR2(1);
196193
196194 --
196195 BEGIN
196196 --
196197 IF g_log_enabled THEN
196198 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_447';
196199 END IF;
196200 --
196201 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
196202
196203 trace
196204 (p_msg => 'BEGIN of AcctLineType_447'
196205 ,p_level => C_LEVEL_PROCEDURE
196206 ,p_module => l_log_module);
196207
196208 END IF;
196209 --
196210 l_component_type := 'AMB_JLT';
196211 l_component_code := 'IAC_DEPRECIATION_RESERVE';
196212 l_component_type_code := 'S';
196213 l_component_appl_id := 140;
196214 l_amb_context_code := 'DEFAULT';
196215 l_entity_code := 'TRANSACTIONS';
196216 l_event_class_code := 'INFLATION_REVALUATION';
196217 l_event_type_code := 'INFLATION_REVALUATION_ALL';
196218 l_line_definition_owner_code := 'S';
196219 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
196220 --
196221 l_balance_type_code := 'A';
196222 l_segment := NULL;
196223 l_ccid := NULL;
196224 l_adr_transaction_coa_id := NULL;
196225 l_adr_accounting_coa_id := NULL;
196226 l_adr_flexfield_segment_code := NULL;
196227 l_adr_flex_value_set_id := NULL;
196228 l_adr_value_type_code := NULL;
196229 l_adr_value_combination_id := NULL;
196230 l_adr_value_segment_code := NULL;
196231
196232 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
196233 l_bflow_class_code := ''; -- 4219869 Business Flow
196234 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
196235 l_budgetary_control_flag := 'N';
196236
196237 l_bflow_applied_to_amt_idx := NULL; -- 5132302
196238 l_bflow_applied_to_amt := NULL; -- 5132302
196239 l_entered_amt_idx := NULL; -- 4262811
196240 l_accted_amt_idx := NULL; -- 4262811
196241 l_acc_rev_flag := NULL; -- 4262811
196242 l_accrual_line_num := NULL; -- 4262811
196243 l_tmp_amt := NULL; -- 4262811
196244 --
196245
196246 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
196247 l_balance_type_code <> 'B' THEN
196248 IF NVL(p_source_64,'
196249 ') = 'RESERVE'
196250 THEN
196251
196252 --
196253 XLA_AE_LINES_PKG.SetNewLine;
196254
196255 p_balance_type_code := l_balance_type_code;
196256 -- set the flag so later we will know whether the gain loss line needs to be created
196257
196258 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
196259 p_actual_flag :='A';
196260 END IF;
196261
196262 --
196263 -- bulk performance
196264 --
196265 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
196266 p_header_num => 0); -- 4262811
196267 --
196268 -- set accounting line options
196269 --
196270 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
196271 p_natural_side_code => 'C'
196272 , p_gain_or_loss_flag => 'N'
196273 , p_gl_transfer_mode_code => 'S'
196274 , p_acct_entry_type_code => 'A'
196275 , p_switch_side_flag => 'Y'
196276 , p_merge_duplicate_code => 'N'
196277 );
196278 --
196279 l_acc_rev_natural_side_code := 'D'; -- 4262811
196280 --
196281 --
196282 -- set accounting line type info
196283 --
196284 xla_ae_lines_pkg.SetAcctLineType
196285 (p_component_type => l_component_type
196286 ,p_event_type_code => l_event_type_code
196290 ,p_accounting_line_type_code => l_component_type_code
196287 ,p_line_definition_owner_code => l_line_definition_owner_code
196288 ,p_line_definition_code => l_line_definition_code
196289 ,p_accounting_line_code => l_component_code
196291 ,p_accounting_line_appl_id => l_component_appl_id
196292 ,p_amb_context_code => l_amb_context_code
196293 ,p_entity_code => l_entity_code
196294 ,p_event_class_code => l_event_class_code);
196295 --
196296 -- set accounting class
196297 --
196298 xla_ae_lines_pkg.SetAcctClass(
196299 p_accounting_class_code => 'ASSET'
196300 , p_ae_header_id => l_ae_header_id
196301 );
196302
196303 --
196304 -- set rounding class
196305 --
196306 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
196307 'ASSET';
196308
196309 --
196310 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
196311 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
196312 --
196313 -- bulk performance
196314 --
196315 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
196316
196317 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
196318 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
196319
196320 -- 4955764
196321 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
196322 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
196323
196324 -- 4458381 Public Sector Enh
196325
196326 --
196327 -- set accounting attributes for the line type
196328 --
196329 l_entered_amt_idx := 6;
196330 l_accted_amt_idx := 8;
196331 l_bflow_applied_to_amt_idx := NULL; -- 5132302
196332 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
196333 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_67);
196334 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
196335 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_68);
196336 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
196337 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_69);
196338 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
196339 l_rec_acct_attrs.array_num_value(4) := to_char(p_source_70);
196340 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_TYPE';
196341 l_rec_acct_attrs.array_char_value(5) := p_source_51;
196342 l_rec_acct_attrs.array_acct_attr_code(6) := 'ENTERED_CURRENCY_AMOUNT';
196343 l_rec_acct_attrs.array_num_value(6) := p_source_65;
196344 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_CODE';
196345 l_rec_acct_attrs.array_char_value(7) := p_source_66;
196346 l_rec_acct_attrs.array_acct_attr_code(8) := 'LEDGER_AMOUNT';
196347 l_rec_acct_attrs.array_num_value(8) := p_source_65;
196348
196349 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
196350 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
196351
196352 ---------------------------------------------------------------------------------------------------------------
196353 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
196354 ---------------------------------------------------------------------------------------------------------------
196355 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
196356
196357 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
196358 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
196359
196360 IF xla_accounting_cache_pkg.GetValueChar
196361 (p_source_code => 'LEDGER_CATEGORY_CODE'
196362 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
196363 AND l_bflow_method_code = 'PRIOR_ENTRY'
196364 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
196365 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
196366 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
196367 )
196368 THEN
196369 xla_ae_lines_pkg.BflowUpgEntry
196370 (p_business_method_code => l_bflow_method_code
196371 ,p_business_class_code => l_bflow_class_code
196372 ,p_balance_type => l_balance_type_code);
196373 ELSE
196374 NULL;
196375 -- No business flow processing for business flow method of NONE.
196376 END IF;
196377
196378 --
196379 -- call analytical criteria
196380 --
196381
196382 --
196383 -- call description
196384 --
196385
196386 xla_ae_lines_pkg.SetLineDescription(
196387 p_ae_header_id => l_ae_header_id
196388 ,p_description => Description_143 (
196389 p_application_id => p_application_id
196390 , p_ae_header_id => l_ae_header_id
196391 , p_source_2 => p_source_2
196392 , p_source_3 => p_source_3
196393 )
196394 );
196395
196396
196397 --
196398 -- call ADRs
196399 -- Bug 4922099
196400 --
196401 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
196402 (NVL(l_actual_upg_option, 'N') = 'O') OR
196403 (NVL(l_enc_upg_option, 'N') = 'O')
196407 --
196404 )
196405 THEN
196406 NULL;
196408 --
196409
196410 l_ccid := AcctDerRule_185(
196411 p_application_id => p_application_id
196412 , p_ae_header_id => l_ae_header_id
196413 , p_source_40 => p_source_40
196414 , x_transaction_coa_id => l_adr_transaction_coa_id
196415 , x_accounting_coa_id => l_adr_accounting_coa_id
196416 , x_value_type_code => l_adr_value_type_code
196417 , p_side => 'NA'
196418 );
196419
196420 xla_ae_lines_pkg.set_ccid(
196421 p_code_combination_id => l_ccid
196422 , p_value_type_code => l_adr_value_type_code
196423 , p_transaction_coa_id => l_adr_transaction_coa_id
196424 , p_accounting_coa_id => l_adr_accounting_coa_id
196425 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
196426 , p_adr_type_code => 'S'
196427 , p_component_type => l_component_type
196428 , p_component_code => l_component_code
196429 , p_component_type_code => l_component_type_code
196430 , p_component_appl_id => l_component_appl_id
196431 , p_amb_context_code => l_amb_context_code
196432 , p_side => 'NA'
196433 );
196434
196435
196436 --
196437 --
196438 END IF;
196439 --
196440 -- Bug 4922099
196441 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
196442 (NVL(l_enc_upg_option, 'N') = 'O')
196443 ) AND
196444 (l_bflow_method_code = 'PRIOR_ENTRY')
196445 )
196446 THEN
196447 IF
196448 --
196449 1 = 2
196450 --
196451 THEN
196452 xla_accounting_err_pkg.build_message
196453 (p_appli_s_name => 'XLA'
196454 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
196455 ,p_token_1 => 'LINE_NUMBER'
196456 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
196457 ,p_token_2 => 'LINE_TYPE_NAME'
196458 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
196459 l_component_type
196460 ,l_component_code
196461 ,l_component_type_code
196462 ,l_component_appl_id
196463 ,l_amb_context_code
196464 ,l_entity_code
196465 ,l_event_class_code
196466 )
196467 ,p_token_3 => 'OWNER'
196468 ,p_value_3 => xla_lookups_pkg.get_meaning(
196469 p_lookup_type => 'XLA_OWNER_TYPE'
196470 ,p_lookup_code => l_component_type_code
196471 )
196472 ,p_token_4 => 'PRODUCT_NAME'
196473 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
196474 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
196475 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
196476 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
196477 ,p_ae_header_id => NULL
196478 );
196479
196480 IF (C_LEVEL_ERROR>= g_log_level) THEN
196481 trace
196482 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
196483 ,p_level => C_LEVEL_ERROR
196484 ,p_module => l_log_module);
196485 END IF;
196486 END IF;
196487 END IF;
196488 --
196489 --
196490 ------------------------------------------------------------------------------------------------
196491 -- 4219869 Business Flow
196492 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
196493 -- Prior Entry. Currently, the following code is always generated.
196494 ------------------------------------------------------------------------------------------------
196495 XLA_AE_LINES_PKG.ValidateCurrentLine;
196496
196497 ------------------------------------------------------------------------------------
196498 -- 4219869 Business Flow
196499 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
196500 ------------------------------------------------------------------------------------
196501 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
196502
196503 ----------------------------------------------------------------------------------
196504 -- 4219869 Business Flow
196505 -- Update journal entry status -- Need to generate this within IF <condition>
196509 ,p_balance_type_code => l_balance_type_code
196506 ----------------------------------------------------------------------------------
196507 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
196508 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
196510 );
196511
196512 -------------------------------------------------------------------------------------------
196513 -- 4262811 - Generate the Accrual Reversal lines
196514 -------------------------------------------------------------------------------------------
196515 BEGIN
196516 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
196517 (g_array_event(p_event_id).array_value_num('header_index'));
196518 IF l_acc_rev_flag IS NULL THEN
196519 l_acc_rev_flag := 'N';
196520 END IF;
196521 EXCEPTION
196522 WHEN OTHERS THEN
196523 l_acc_rev_flag := 'N';
196524 END;
196525 --
196526 IF (l_acc_rev_flag = 'Y') THEN
196527
196528 -- 4645092 ------------------------------------------------------------------------------
196529 -- To allow MPA report to determine if it should generate report process
196530 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
196531 ------------------------------------------------------------------------------------------
196532
196533 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
196534 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
196535 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
196536 -- call ADRs
196537 -- Bug 4922099
196538 --
196539 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
196540 (NVL(l_actual_upg_option, 'N') = 'O') OR
196541 (NVL(l_enc_upg_option, 'N') = 'O')
196542 )
196543 THEN
196544 NULL;
196545 --
196546 --
196547
196548 l_ccid := AcctDerRule_185(
196549 p_application_id => p_application_id
196550 , p_ae_header_id => l_ae_header_id
196551 , p_source_40 => p_source_40
196552 , x_transaction_coa_id => l_adr_transaction_coa_id
196553 , x_accounting_coa_id => l_adr_accounting_coa_id
196554 , x_value_type_code => l_adr_value_type_code
196555 , p_side => 'NA'
196556 );
196557
196558 xla_ae_lines_pkg.set_ccid(
196559 p_code_combination_id => l_ccid
196560 , p_value_type_code => l_adr_value_type_code
196561 , p_transaction_coa_id => l_adr_transaction_coa_id
196562 , p_accounting_coa_id => l_adr_accounting_coa_id
196563 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
196564 , p_adr_type_code => 'S'
196565 , p_component_type => l_component_type
196566 , p_component_code => l_component_code
196567 , p_component_type_code => l_component_type_code
196568 , p_component_appl_id => l_component_appl_id
196569 , p_amb_context_code => l_amb_context_code
196570 , p_side => 'NA'
196571 );
196572
196573
196574 --
196575 --
196576 END IF;
196577
196578 --
196579 -- Update the line information that should be overwritten
196580 --
196581 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
196582 p_header_num => 1);
196583 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
196584
196585 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
196586
196587 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
196588 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
196589 END IF;
196590
196591 --
196592 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
196593 --
196594 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
196595 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
196596 ELSE
196597 ---------------------------------------------------------------------------------------------------
196598 -- 4262811a Switch Sign
196599 ---------------------------------------------------------------------------------------------------
196600 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
196601 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
196602 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
196603 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
196604 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
196605 -- 5132302
196606 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
196607 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
196608
196609 END IF;
196610
196611 -- 4955764
196612 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
196613 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
196617 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
196614
196615
196616 XLA_AE_LINES_PKG.ValidateCurrentLine;
196618
196619 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
196620 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
196621 ,p_balance_type_code => l_balance_type_code);
196622
196623 END IF;
196624
196625 -----------------------------------------------------------------------------------------
196626 -- 4262811 Multiperiod Accounting
196627 -----------------------------------------------------------------------------------------
196628 -- No MPA option is assigned.
196629
196630
196631 END IF;
196632 END IF;
196633 --
196634
196635 --
196636 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
196637 trace
196638 (p_msg => 'END of AcctLineType_447'
196639 ,p_level => C_LEVEL_PROCEDURE
196640 ,p_module => l_log_module);
196641 END IF;
196642 --
196643 EXCEPTION
196644 WHEN xla_exceptions_pkg.application_exception THEN
196645 RAISE;
196646 WHEN OTHERS THEN
196647 xla_exceptions_pkg.raise_message
196648 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_447');
196649 END AcctLineType_447;
196650 --
196651
196652 ---------------------------------------
196653 --
196654 -- PRIVATE FUNCTION
196655 -- AcctLineType_448
196656 --
196657 ---------------------------------------
196658 PROCEDURE AcctLineType_448 (
196659 p_application_id IN NUMBER
196660 ,p_event_id IN NUMBER
196661 ,p_calculate_acctd_flag IN VARCHAR2
196662 ,p_calculate_g_l_flag IN VARCHAR2
196663 ,p_actual_flag IN OUT VARCHAR2
196664 ,p_balance_type_code OUT VARCHAR2
196665 ,p_gain_or_loss_ref OUT VARCHAR2
196666
196667 --Inflation Adjustment Type Description
196668 , p_source_2 IN VARCHAR2
196669 --Accounting Date
196670 , p_source_3 IN DATE
196671 --Inflation Depreciation Reserve Ccid
196672 , p_source_40 IN NUMBER
196673 --Transaction Header Identifier
196674 , p_source_49 IN NUMBER
196675 --Adjustment Line Identifier
196676 , p_source_50 IN NUMBER
196677 --Distribution Type Code
196678 , p_source_51 IN VARCHAR2
196679 --Inflation Adjustment Type
196680 , p_source_64 IN VARCHAR2
196681 --Inflation Entered Amount
196682 , p_source_65 IN NUMBER
196683 --Inflation Currency Code
196684 , p_source_66 IN VARCHAR2
196685 )
196686 IS
196687
196688 l_component_type VARCHAR2(80);
196689 l_component_code VARCHAR2(30);
196690 l_component_type_code VARCHAR2(1);
196691 l_component_appl_id INTEGER;
196692 l_amb_context_code VARCHAR2(30);
196693 l_entity_code VARCHAR2(30);
196694 l_event_class_code VARCHAR2(30);
196695 l_ae_header_id NUMBER;
196696 l_event_type_code VARCHAR2(30);
196697 l_line_definition_code VARCHAR2(30);
196698 l_line_definition_owner_code VARCHAR2(1);
196699 --
196700 -- adr variables
196701 l_segment VARCHAR2(30);
196702 l_ccid NUMBER;
196703 l_adr_transaction_coa_id NUMBER;
196704 l_adr_accounting_coa_id NUMBER;
196705 l_adr_flexfield_segment_code VARCHAR2(30);
196706 l_adr_flex_value_set_id NUMBER;
196707 l_adr_value_type_code VARCHAR2(30);
196708 l_adr_value_combination_id NUMBER;
196709 l_adr_value_segment_code VARCHAR2(30);
196710
196711 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
196712 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
196713 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
196714 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
196715
196716 -- 4262811 Variables ------------------------------------------------------------------------------------------
196717 l_entered_amt_idx NUMBER;
196718 l_accted_amt_idx NUMBER;
196719 l_acc_rev_flag VARCHAR2(1);
196720 l_accrual_line_num NUMBER;
196721 l_tmp_amt NUMBER;
196722 l_acc_rev_natural_side_code VARCHAR2(1);
196723
196724 l_num_entries NUMBER;
196725 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
196726 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
196727 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
196728 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
196729 l_recog_line_1 NUMBER;
196730 l_recog_line_2 NUMBER;
196731
196732 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
196733 l_bflow_applied_to_amt NUMBER; -- 5132302
196734 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
196735
196736 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
196737
196738 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
196739 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
196740
196741 ---------------------------------------------------------------------------------------------------------------
196742
196743
196744 --
196745 -- bulk performance
196749 l_log_module VARCHAR2(240);
196746 --
196747 l_balance_type_code VARCHAR2(1);
196748 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
196750
196751 --
196752 -- Upgrade strategy
196753 --
196754 l_actual_upg_option VARCHAR2(1);
196755 l_enc_upg_option VARCHAR2(1);
196756
196757 --
196758 BEGIN
196759 --
196760 IF g_log_enabled THEN
196761 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_448';
196762 END IF;
196763 --
196764 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
196765
196766 trace
196767 (p_msg => 'BEGIN of AcctLineType_448'
196768 ,p_level => C_LEVEL_PROCEDURE
196769 ,p_module => l_log_module);
196770
196771 END IF;
196772 --
196773 l_component_type := 'AMB_JLT';
196774 l_component_code := 'IAC_DEPRECIATION_RESERVE';
196775 l_component_type_code := 'S';
196776 l_component_appl_id := 140;
196777 l_amb_context_code := 'DEFAULT';
196778 l_entity_code := 'TRANSACTIONS';
196779 l_event_class_code := 'CATEGORY_RECLASS';
196780 l_event_type_code := 'CATEGORY_RECLASS_ALL';
196781 l_line_definition_owner_code := 'S';
196782 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
196783 --
196784 l_balance_type_code := 'A';
196785 l_segment := NULL;
196786 l_ccid := NULL;
196787 l_adr_transaction_coa_id := NULL;
196788 l_adr_accounting_coa_id := NULL;
196789 l_adr_flexfield_segment_code := NULL;
196790 l_adr_flex_value_set_id := NULL;
196791 l_adr_value_type_code := NULL;
196792 l_adr_value_combination_id := NULL;
196793 l_adr_value_segment_code := NULL;
196794
196795 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
196796 l_bflow_class_code := ''; -- 4219869 Business Flow
196797 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
196798 l_budgetary_control_flag := 'N';
196799
196800 l_bflow_applied_to_amt_idx := NULL; -- 5132302
196801 l_bflow_applied_to_amt := NULL; -- 5132302
196802 l_entered_amt_idx := NULL; -- 4262811
196803 l_accted_amt_idx := NULL; -- 4262811
196804 l_acc_rev_flag := NULL; -- 4262811
196805 l_accrual_line_num := NULL; -- 4262811
196806 l_tmp_amt := NULL; -- 4262811
196807 --
196808
196809 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
196810 l_balance_type_code <> 'B' THEN
196811 IF NVL(p_source_64,'
196812 ') = 'RESERVE'
196813 THEN
196814
196815 --
196816 XLA_AE_LINES_PKG.SetNewLine;
196817
196818 p_balance_type_code := l_balance_type_code;
196819 -- set the flag so later we will know whether the gain loss line needs to be created
196820
196821 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
196822 p_actual_flag :='A';
196823 END IF;
196824
196825 --
196826 -- bulk performance
196827 --
196828 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
196829 p_header_num => 0); -- 4262811
196830 --
196831 -- set accounting line options
196832 --
196833 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
196834 p_natural_side_code => 'C'
196835 , p_gain_or_loss_flag => 'N'
196836 , p_gl_transfer_mode_code => 'S'
196837 , p_acct_entry_type_code => 'A'
196838 , p_switch_side_flag => 'Y'
196839 , p_merge_duplicate_code => 'N'
196840 );
196841 --
196842 l_acc_rev_natural_side_code := 'D'; -- 4262811
196843 --
196844 --
196845 -- set accounting line type info
196846 --
196847 xla_ae_lines_pkg.SetAcctLineType
196848 (p_component_type => l_component_type
196849 ,p_event_type_code => l_event_type_code
196850 ,p_line_definition_owner_code => l_line_definition_owner_code
196851 ,p_line_definition_code => l_line_definition_code
196852 ,p_accounting_line_code => l_component_code
196853 ,p_accounting_line_type_code => l_component_type_code
196854 ,p_accounting_line_appl_id => l_component_appl_id
196855 ,p_amb_context_code => l_amb_context_code
196856 ,p_entity_code => l_entity_code
196857 ,p_event_class_code => l_event_class_code);
196858 --
196859 -- set accounting class
196860 --
196861 xla_ae_lines_pkg.SetAcctClass(
196862 p_accounting_class_code => 'ASSET'
196863 , p_ae_header_id => l_ae_header_id
196864 );
196865
196866 --
196867 -- set rounding class
196868 --
196869 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
196870 'ASSET';
196871
196872 --
196873 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
196874 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
196875 --
196876 -- bulk performance
196877 --
196878 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
196879
196883 -- 4955764
196880 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
196881 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
196882
196884 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
196885 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
196886
196887 -- 4458381 Public Sector Enh
196888
196889 --
196890 -- set accounting attributes for the line type
196891 --
196892 l_entered_amt_idx := 4;
196893 l_accted_amt_idx := 6;
196894 l_bflow_applied_to_amt_idx := NULL; -- 5132302
196895 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
196896 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
196897 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
196898 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
196899 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
196900 l_rec_acct_attrs.array_char_value(3) := p_source_51;
196901 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
196902 l_rec_acct_attrs.array_num_value(4) := p_source_65;
196903 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
196904 l_rec_acct_attrs.array_char_value(5) := p_source_66;
196905 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
196906 l_rec_acct_attrs.array_num_value(6) := p_source_65;
196907
196908 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
196909 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
196910
196911 ---------------------------------------------------------------------------------------------------------------
196912 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
196913 ---------------------------------------------------------------------------------------------------------------
196914 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
196915
196916 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
196917 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
196918
196919 IF xla_accounting_cache_pkg.GetValueChar
196920 (p_source_code => 'LEDGER_CATEGORY_CODE'
196921 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
196922 AND l_bflow_method_code = 'PRIOR_ENTRY'
196923 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
196924 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
196925 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
196926 )
196927 THEN
196928 xla_ae_lines_pkg.BflowUpgEntry
196929 (p_business_method_code => l_bflow_method_code
196930 ,p_business_class_code => l_bflow_class_code
196931 ,p_balance_type => l_balance_type_code);
196932 ELSE
196933 NULL;
196934 -- No business flow processing for business flow method of NONE.
196935 END IF;
196936
196937 --
196938 -- call analytical criteria
196939 --
196940
196941 --
196942 -- call description
196943 --
196944
196945 xla_ae_lines_pkg.SetLineDescription(
196946 p_ae_header_id => l_ae_header_id
196947 ,p_description => Description_143 (
196948 p_application_id => p_application_id
196949 , p_ae_header_id => l_ae_header_id
196950 , p_source_2 => p_source_2
196951 , p_source_3 => p_source_3
196952 )
196953 );
196954
196955
196956 --
196957 -- call ADRs
196958 -- Bug 4922099
196959 --
196960 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
196961 (NVL(l_actual_upg_option, 'N') = 'O') OR
196962 (NVL(l_enc_upg_option, 'N') = 'O')
196963 )
196964 THEN
196965 NULL;
196966 --
196967 --
196968
196969 l_ccid := AcctDerRule_185(
196970 p_application_id => p_application_id
196971 , p_ae_header_id => l_ae_header_id
196972 , p_source_40 => p_source_40
196973 , x_transaction_coa_id => l_adr_transaction_coa_id
196974 , x_accounting_coa_id => l_adr_accounting_coa_id
196975 , x_value_type_code => l_adr_value_type_code
196976 , p_side => 'NA'
196977 );
196978
196979 xla_ae_lines_pkg.set_ccid(
196980 p_code_combination_id => l_ccid
196981 , p_value_type_code => l_adr_value_type_code
196982 , p_transaction_coa_id => l_adr_transaction_coa_id
196983 , p_accounting_coa_id => l_adr_accounting_coa_id
196984 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
196985 , p_adr_type_code => 'S'
196986 , p_component_type => l_component_type
196987 , p_component_code => l_component_code
196988 , p_component_type_code => l_component_type_code
196989 , p_component_appl_id => l_component_appl_id
196990 , p_amb_context_code => l_amb_context_code
196991 , p_side => 'NA'
196992 );
196993
196994
196995 --
196996 --
196997 END IF;
196998 --
196999 -- Bug 4922099
197000 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
197001 (NVL(l_enc_upg_option, 'N') = 'O')
197002 ) AND
197003 (l_bflow_method_code = 'PRIOR_ENTRY')
197004 )
197008 1 = 2
197005 THEN
197006 IF
197007 --
197009 --
197010 THEN
197011 xla_accounting_err_pkg.build_message
197012 (p_appli_s_name => 'XLA'
197013 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
197014 ,p_token_1 => 'LINE_NUMBER'
197015 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
197016 ,p_token_2 => 'LINE_TYPE_NAME'
197017 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
197018 l_component_type
197019 ,l_component_code
197020 ,l_component_type_code
197021 ,l_component_appl_id
197022 ,l_amb_context_code
197023 ,l_entity_code
197024 ,l_event_class_code
197025 )
197026 ,p_token_3 => 'OWNER'
197027 ,p_value_3 => xla_lookups_pkg.get_meaning(
197028 p_lookup_type => 'XLA_OWNER_TYPE'
197029 ,p_lookup_code => l_component_type_code
197030 )
197031 ,p_token_4 => 'PRODUCT_NAME'
197032 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
197033 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
197034 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
197035 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
197036 ,p_ae_header_id => NULL
197037 );
197038
197039 IF (C_LEVEL_ERROR>= g_log_level) THEN
197040 trace
197041 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
197042 ,p_level => C_LEVEL_ERROR
197043 ,p_module => l_log_module);
197044 END IF;
197045 END IF;
197046 END IF;
197047 --
197048 --
197049 ------------------------------------------------------------------------------------------------
197050 -- 4219869 Business Flow
197051 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
197052 -- Prior Entry. Currently, the following code is always generated.
197053 ------------------------------------------------------------------------------------------------
197054 XLA_AE_LINES_PKG.ValidateCurrentLine;
197055
197056 ------------------------------------------------------------------------------------
197057 -- 4219869 Business Flow
197058 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
197059 ------------------------------------------------------------------------------------
197060 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
197061
197062 ----------------------------------------------------------------------------------
197063 -- 4219869 Business Flow
197064 -- Update journal entry status -- Need to generate this within IF <condition>
197065 ----------------------------------------------------------------------------------
197066 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
197067 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
197068 ,p_balance_type_code => l_balance_type_code
197069 );
197070
197071 -------------------------------------------------------------------------------------------
197072 -- 4262811 - Generate the Accrual Reversal lines
197073 -------------------------------------------------------------------------------------------
197074 BEGIN
197075 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
197076 (g_array_event(p_event_id).array_value_num('header_index'));
197077 IF l_acc_rev_flag IS NULL THEN
197078 l_acc_rev_flag := 'N';
197079 END IF;
197080 EXCEPTION
197081 WHEN OTHERS THEN
197082 l_acc_rev_flag := 'N';
197083 END;
197084 --
197085 IF (l_acc_rev_flag = 'Y') THEN
197086
197087 -- 4645092 ------------------------------------------------------------------------------
197088 -- To allow MPA report to determine if it should generate report process
197089 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
197090 ------------------------------------------------------------------------------------------
197091
197092 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
197093 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
197094 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
197095 -- call ADRs
197096 -- Bug 4922099
197097 --
197101 )
197098 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
197099 (NVL(l_actual_upg_option, 'N') = 'O') OR
197100 (NVL(l_enc_upg_option, 'N') = 'O')
197102 THEN
197103 NULL;
197104 --
197105 --
197106
197107 l_ccid := AcctDerRule_185(
197108 p_application_id => p_application_id
197109 , p_ae_header_id => l_ae_header_id
197110 , p_source_40 => p_source_40
197111 , x_transaction_coa_id => l_adr_transaction_coa_id
197112 , x_accounting_coa_id => l_adr_accounting_coa_id
197113 , x_value_type_code => l_adr_value_type_code
197114 , p_side => 'NA'
197115 );
197116
197117 xla_ae_lines_pkg.set_ccid(
197118 p_code_combination_id => l_ccid
197119 , p_value_type_code => l_adr_value_type_code
197120 , p_transaction_coa_id => l_adr_transaction_coa_id
197121 , p_accounting_coa_id => l_adr_accounting_coa_id
197122 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
197123 , p_adr_type_code => 'S'
197124 , p_component_type => l_component_type
197125 , p_component_code => l_component_code
197126 , p_component_type_code => l_component_type_code
197127 , p_component_appl_id => l_component_appl_id
197128 , p_amb_context_code => l_amb_context_code
197129 , p_side => 'NA'
197130 );
197131
197132
197133 --
197134 --
197135 END IF;
197136
197137 --
197138 -- Update the line information that should be overwritten
197139 --
197140 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
197141 p_header_num => 1);
197142 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
197143
197144 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
197145
197146 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
197147 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
197148 END IF;
197149
197150 --
197151 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
197152 --
197153 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
197154 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
197155 ELSE
197156 ---------------------------------------------------------------------------------------------------
197157 -- 4262811a Switch Sign
197158 ---------------------------------------------------------------------------------------------------
197159 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
197160 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
197161 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
197162 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
197163 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
197164 -- 5132302
197165 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
197166 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
197167
197168 END IF;
197169
197170 -- 4955764
197171 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
197172 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
197173
197174
197175 XLA_AE_LINES_PKG.ValidateCurrentLine;
197176 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
197177
197178 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
197179 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
197180 ,p_balance_type_code => l_balance_type_code);
197181
197182 END IF;
197183
197184 -----------------------------------------------------------------------------------------
197185 -- 4262811 Multiperiod Accounting
197186 -----------------------------------------------------------------------------------------
197187 -- No MPA option is assigned.
197188
197189
197190 END IF;
197191 END IF;
197192 --
197193
197194 --
197195 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
197196 trace
197197 (p_msg => 'END of AcctLineType_448'
197198 ,p_level => C_LEVEL_PROCEDURE
197199 ,p_module => l_log_module);
197200 END IF;
197201 --
197202 EXCEPTION
197203 WHEN xla_exceptions_pkg.application_exception THEN
197204 RAISE;
197205 WHEN OTHERS THEN
197206 xla_exceptions_pkg.raise_message
197207 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_448');
197208 END AcctLineType_448;
197209 --
197210
197211 ---------------------------------------
197212 --
197213 -- PRIVATE FUNCTION
197214 -- AcctLineType_449
197215 --
197216 ---------------------------------------
197217 PROCEDURE AcctLineType_449 (
197218 p_application_id IN NUMBER
197219 ,p_event_id IN NUMBER
197223 ,p_balance_type_code OUT VARCHAR2
197220 ,p_calculate_acctd_flag IN VARCHAR2
197221 ,p_calculate_g_l_flag IN VARCHAR2
197222 ,p_actual_flag IN OUT VARCHAR2
197224 ,p_gain_or_loss_ref OUT VARCHAR2
197225
197226 --Inflation Adjustment Type Description
197227 , p_source_2 IN VARCHAR2
197228 --Accounting Date
197229 , p_source_3 IN DATE
197230 --Inflation Depreciation Reserve Ccid
197231 , p_source_40 IN NUMBER
197232 --Transaction Header Identifier
197233 , p_source_49 IN NUMBER
197234 --Adjustment Line Identifier
197235 , p_source_50 IN NUMBER
197236 --Distribution Type Code
197237 , p_source_51 IN VARCHAR2
197238 --Inflation Adjustment Type
197239 , p_source_64 IN VARCHAR2
197240 --Inflation Entered Amount
197241 , p_source_65 IN NUMBER
197242 --Inflation Currency Code
197243 , p_source_66 IN VARCHAR2
197244 )
197245 IS
197246
197247 l_component_type VARCHAR2(80);
197248 l_component_code VARCHAR2(30);
197249 l_component_type_code VARCHAR2(1);
197250 l_component_appl_id INTEGER;
197251 l_amb_context_code VARCHAR2(30);
197252 l_entity_code VARCHAR2(30);
197253 l_event_class_code VARCHAR2(30);
197254 l_ae_header_id NUMBER;
197255 l_event_type_code VARCHAR2(30);
197256 l_line_definition_code VARCHAR2(30);
197257 l_line_definition_owner_code VARCHAR2(1);
197258 --
197259 -- adr variables
197260 l_segment VARCHAR2(30);
197261 l_ccid NUMBER;
197262 l_adr_transaction_coa_id NUMBER;
197263 l_adr_accounting_coa_id NUMBER;
197264 l_adr_flexfield_segment_code VARCHAR2(30);
197265 l_adr_flex_value_set_id NUMBER;
197266 l_adr_value_type_code VARCHAR2(30);
197267 l_adr_value_combination_id NUMBER;
197268 l_adr_value_segment_code VARCHAR2(30);
197269
197270 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
197271 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
197272 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
197273 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
197274
197275 -- 4262811 Variables ------------------------------------------------------------------------------------------
197276 l_entered_amt_idx NUMBER;
197277 l_accted_amt_idx NUMBER;
197278 l_acc_rev_flag VARCHAR2(1);
197279 l_accrual_line_num NUMBER;
197280 l_tmp_amt NUMBER;
197281 l_acc_rev_natural_side_code VARCHAR2(1);
197282
197283 l_num_entries NUMBER;
197284 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
197285 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
197286 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
197287 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
197288 l_recog_line_1 NUMBER;
197289 l_recog_line_2 NUMBER;
197290
197291 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
197292 l_bflow_applied_to_amt NUMBER; -- 5132302
197293 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
197294
197295 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
197296
197297 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
197298 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
197299
197300 ---------------------------------------------------------------------------------------------------------------
197301
197302
197303 --
197304 -- bulk performance
197305 --
197306 l_balance_type_code VARCHAR2(1);
197307 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
197308 l_log_module VARCHAR2(240);
197309
197310 --
197311 -- Upgrade strategy
197312 --
197313 l_actual_upg_option VARCHAR2(1);
197314 l_enc_upg_option VARCHAR2(1);
197315
197316 --
197317 BEGIN
197318 --
197319 IF g_log_enabled THEN
197320 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_449';
197321 END IF;
197322 --
197323 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
197324
197325 trace
197326 (p_msg => 'BEGIN of AcctLineType_449'
197327 ,p_level => C_LEVEL_PROCEDURE
197328 ,p_module => l_log_module);
197329
197330 END IF;
197331 --
197332 l_component_type := 'AMB_JLT';
197333 l_component_code := 'IAC_DEPRECIATION_RESERVE';
197334 l_component_type_code := 'S';
197335 l_component_appl_id := 140;
197336 l_amb_context_code := 'DEFAULT';
197337 l_entity_code := 'TRANSACTIONS';
197338 l_event_class_code := 'ADDITIONS';
197339 l_event_type_code := 'ADDITIONS_ALL';
197340 l_line_definition_owner_code := 'S';
197341 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
197342 --
197343 l_balance_type_code := 'A';
197344 l_segment := NULL;
197345 l_ccid := NULL;
197346 l_adr_transaction_coa_id := NULL;
197347 l_adr_accounting_coa_id := NULL;
197348 l_adr_flexfield_segment_code := NULL;
197349 l_adr_flex_value_set_id := NULL;
197353
197350 l_adr_value_type_code := NULL;
197351 l_adr_value_combination_id := NULL;
197352 l_adr_value_segment_code := NULL;
197354 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
197355 l_bflow_class_code := ''; -- 4219869 Business Flow
197356 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
197357 l_budgetary_control_flag := 'N';
197358
197359 l_bflow_applied_to_amt_idx := NULL; -- 5132302
197360 l_bflow_applied_to_amt := NULL; -- 5132302
197361 l_entered_amt_idx := NULL; -- 4262811
197362 l_accted_amt_idx := NULL; -- 4262811
197363 l_acc_rev_flag := NULL; -- 4262811
197364 l_accrual_line_num := NULL; -- 4262811
197365 l_tmp_amt := NULL; -- 4262811
197366 --
197367
197368 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
197369 l_balance_type_code <> 'B' THEN
197370 IF NVL(p_source_64,'
197371 ') = 'RESERVE'
197372 THEN
197373
197374 --
197375 XLA_AE_LINES_PKG.SetNewLine;
197376
197377 p_balance_type_code := l_balance_type_code;
197378 -- set the flag so later we will know whether the gain loss line needs to be created
197379
197380 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
197381 p_actual_flag :='A';
197382 END IF;
197383
197384 --
197385 -- bulk performance
197386 --
197387 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
197388 p_header_num => 0); -- 4262811
197389 --
197390 -- set accounting line options
197391 --
197392 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
197393 p_natural_side_code => 'C'
197394 , p_gain_or_loss_flag => 'N'
197395 , p_gl_transfer_mode_code => 'S'
197396 , p_acct_entry_type_code => 'A'
197397 , p_switch_side_flag => 'Y'
197398 , p_merge_duplicate_code => 'N'
197399 );
197400 --
197401 l_acc_rev_natural_side_code := 'D'; -- 4262811
197402 --
197403 --
197404 -- set accounting line type info
197405 --
197406 xla_ae_lines_pkg.SetAcctLineType
197407 (p_component_type => l_component_type
197408 ,p_event_type_code => l_event_type_code
197409 ,p_line_definition_owner_code => l_line_definition_owner_code
197410 ,p_line_definition_code => l_line_definition_code
197411 ,p_accounting_line_code => l_component_code
197412 ,p_accounting_line_type_code => l_component_type_code
197413 ,p_accounting_line_appl_id => l_component_appl_id
197414 ,p_amb_context_code => l_amb_context_code
197415 ,p_entity_code => l_entity_code
197416 ,p_event_class_code => l_event_class_code);
197417 --
197418 -- set accounting class
197419 --
197420 xla_ae_lines_pkg.SetAcctClass(
197421 p_accounting_class_code => 'ASSET'
197422 , p_ae_header_id => l_ae_header_id
197423 );
197424
197425 --
197426 -- set rounding class
197427 --
197428 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
197429 'ASSET';
197430
197431 --
197432 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
197433 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
197434 --
197435 -- bulk performance
197436 --
197437 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
197438
197439 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
197440 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
197441
197442 -- 4955764
197443 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
197444 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
197445
197446 -- 4458381 Public Sector Enh
197447
197448 --
197449 -- set accounting attributes for the line type
197450 --
197451 l_entered_amt_idx := 4;
197452 l_accted_amt_idx := 6;
197453 l_bflow_applied_to_amt_idx := NULL; -- 5132302
197454 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
197455 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
197456 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
197457 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
197458 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
197459 l_rec_acct_attrs.array_char_value(3) := p_source_51;
197460 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
197461 l_rec_acct_attrs.array_num_value(4) := p_source_65;
197462 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
197463 l_rec_acct_attrs.array_char_value(5) := p_source_66;
197464 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
197465 l_rec_acct_attrs.array_num_value(6) := p_source_65;
197466
197467 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
197468 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
197469
197473 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
197470 ---------------------------------------------------------------------------------------------------------------
197471 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
197472 ---------------------------------------------------------------------------------------------------------------
197474
197475 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
197476 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
197477
197478 IF xla_accounting_cache_pkg.GetValueChar
197479 (p_source_code => 'LEDGER_CATEGORY_CODE'
197480 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
197481 AND l_bflow_method_code = 'PRIOR_ENTRY'
197482 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
197483 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
197484 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
197485 )
197486 THEN
197487 xla_ae_lines_pkg.BflowUpgEntry
197488 (p_business_method_code => l_bflow_method_code
197489 ,p_business_class_code => l_bflow_class_code
197490 ,p_balance_type => l_balance_type_code);
197491 ELSE
197492 NULL;
197493 -- No business flow processing for business flow method of NONE.
197494 END IF;
197495
197496 --
197497 -- call analytical criteria
197498 --
197499
197500 --
197501 -- call description
197502 --
197503
197504 xla_ae_lines_pkg.SetLineDescription(
197505 p_ae_header_id => l_ae_header_id
197506 ,p_description => Description_143 (
197507 p_application_id => p_application_id
197508 , p_ae_header_id => l_ae_header_id
197509 , p_source_2 => p_source_2
197510 , p_source_3 => p_source_3
197511 )
197512 );
197513
197514
197515 --
197516 -- call ADRs
197517 -- Bug 4922099
197518 --
197519 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
197520 (NVL(l_actual_upg_option, 'N') = 'O') OR
197521 (NVL(l_enc_upg_option, 'N') = 'O')
197522 )
197523 THEN
197524 NULL;
197525 --
197526 --
197527
197528 l_ccid := AcctDerRule_185(
197529 p_application_id => p_application_id
197530 , p_ae_header_id => l_ae_header_id
197531 , p_source_40 => p_source_40
197532 , x_transaction_coa_id => l_adr_transaction_coa_id
197533 , x_accounting_coa_id => l_adr_accounting_coa_id
197534 , x_value_type_code => l_adr_value_type_code
197535 , p_side => 'NA'
197536 );
197537
197538 xla_ae_lines_pkg.set_ccid(
197539 p_code_combination_id => l_ccid
197540 , p_value_type_code => l_adr_value_type_code
197541 , p_transaction_coa_id => l_adr_transaction_coa_id
197542 , p_accounting_coa_id => l_adr_accounting_coa_id
197543 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
197544 , p_adr_type_code => 'S'
197545 , p_component_type => l_component_type
197546 , p_component_code => l_component_code
197547 , p_component_type_code => l_component_type_code
197548 , p_component_appl_id => l_component_appl_id
197549 , p_amb_context_code => l_amb_context_code
197550 , p_side => 'NA'
197551 );
197552
197553
197554 --
197555 --
197556 END IF;
197557 --
197558 -- Bug 4922099
197559 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
197560 (NVL(l_enc_upg_option, 'N') = 'O')
197561 ) AND
197562 (l_bflow_method_code = 'PRIOR_ENTRY')
197563 )
197564 THEN
197565 IF
197566 --
197567 1 = 2
197568 --
197569 THEN
197570 xla_accounting_err_pkg.build_message
197571 (p_appli_s_name => 'XLA'
197572 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
197573 ,p_token_1 => 'LINE_NUMBER'
197574 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
197575 ,p_token_2 => 'LINE_TYPE_NAME'
197576 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
197577 l_component_type
197578 ,l_component_code
197579 ,l_component_type_code
197580 ,l_component_appl_id
197581 ,l_amb_context_code
197582 ,l_entity_code
197583 ,l_event_class_code
197584 )
197585 ,p_token_3 => 'OWNER'
197586 ,p_value_3 => xla_lookups_pkg.get_meaning(
197590 ,p_token_4 => 'PRODUCT_NAME'
197587 p_lookup_type => 'XLA_OWNER_TYPE'
197588 ,p_lookup_code => l_component_type_code
197589 )
197591 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
197592 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
197593 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
197594 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
197595 ,p_ae_header_id => NULL
197596 );
197597
197598 IF (C_LEVEL_ERROR>= g_log_level) THEN
197599 trace
197600 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
197601 ,p_level => C_LEVEL_ERROR
197602 ,p_module => l_log_module);
197603 END IF;
197604 END IF;
197605 END IF;
197606 --
197607 --
197608 ------------------------------------------------------------------------------------------------
197609 -- 4219869 Business Flow
197610 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
197611 -- Prior Entry. Currently, the following code is always generated.
197612 ------------------------------------------------------------------------------------------------
197613 XLA_AE_LINES_PKG.ValidateCurrentLine;
197614
197615 ------------------------------------------------------------------------------------
197616 -- 4219869 Business Flow
197617 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
197618 ------------------------------------------------------------------------------------
197619 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
197620
197621 ----------------------------------------------------------------------------------
197622 -- 4219869 Business Flow
197623 -- Update journal entry status -- Need to generate this within IF <condition>
197624 ----------------------------------------------------------------------------------
197625 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
197626 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
197627 ,p_balance_type_code => l_balance_type_code
197628 );
197629
197630 -------------------------------------------------------------------------------------------
197631 -- 4262811 - Generate the Accrual Reversal lines
197632 -------------------------------------------------------------------------------------------
197633 BEGIN
197634 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
197635 (g_array_event(p_event_id).array_value_num('header_index'));
197636 IF l_acc_rev_flag IS NULL THEN
197637 l_acc_rev_flag := 'N';
197638 END IF;
197639 EXCEPTION
197640 WHEN OTHERS THEN
197641 l_acc_rev_flag := 'N';
197642 END;
197643 --
197644 IF (l_acc_rev_flag = 'Y') THEN
197645
197646 -- 4645092 ------------------------------------------------------------------------------
197647 -- To allow MPA report to determine if it should generate report process
197648 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
197649 ------------------------------------------------------------------------------------------
197650
197651 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
197652 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
197653 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
197654 -- call ADRs
197655 -- Bug 4922099
197656 --
197657 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
197658 (NVL(l_actual_upg_option, 'N') = 'O') OR
197659 (NVL(l_enc_upg_option, 'N') = 'O')
197660 )
197661 THEN
197662 NULL;
197663 --
197664 --
197665
197666 l_ccid := AcctDerRule_185(
197667 p_application_id => p_application_id
197668 , p_ae_header_id => l_ae_header_id
197669 , p_source_40 => p_source_40
197670 , x_transaction_coa_id => l_adr_transaction_coa_id
197671 , x_accounting_coa_id => l_adr_accounting_coa_id
197672 , x_value_type_code => l_adr_value_type_code
197673 , p_side => 'NA'
197674 );
197675
197676 xla_ae_lines_pkg.set_ccid(
197677 p_code_combination_id => l_ccid
197678 , p_value_type_code => l_adr_value_type_code
197679 , p_transaction_coa_id => l_adr_transaction_coa_id
197680 , p_accounting_coa_id => l_adr_accounting_coa_id
197681 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
197682 , p_adr_type_code => 'S'
197683 , p_component_type => l_component_type
197684 , p_component_code => l_component_code
197685 , p_component_type_code => l_component_type_code
197686 , p_component_appl_id => l_component_appl_id
197687 , p_amb_context_code => l_amb_context_code
197688 , p_side => 'NA'
197689 );
197690
197691
197695
197692 --
197693 --
197694 END IF;
197696 --
197697 -- Update the line information that should be overwritten
197698 --
197699 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
197700 p_header_num => 1);
197701 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
197702
197703 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
197704
197705 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
197706 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
197707 END IF;
197708
197709 --
197710 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
197711 --
197712 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
197713 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
197714 ELSE
197715 ---------------------------------------------------------------------------------------------------
197716 -- 4262811a Switch Sign
197717 ---------------------------------------------------------------------------------------------------
197718 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
197719 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
197720 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
197721 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
197722 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
197723 -- 5132302
197724 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
197725 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
197726
197727 END IF;
197728
197729 -- 4955764
197730 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
197731 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
197732
197733
197734 XLA_AE_LINES_PKG.ValidateCurrentLine;
197735 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
197736
197737 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
197738 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
197739 ,p_balance_type_code => l_balance_type_code);
197740
197741 END IF;
197742
197743 -----------------------------------------------------------------------------------------
197744 -- 4262811 Multiperiod Accounting
197745 -----------------------------------------------------------------------------------------
197746 -- No MPA option is assigned.
197747
197748
197749 END IF;
197750 END IF;
197751 --
197752
197753 --
197754 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
197755 trace
197756 (p_msg => 'END of AcctLineType_449'
197757 ,p_level => C_LEVEL_PROCEDURE
197758 ,p_module => l_log_module);
197759 END IF;
197760 --
197761 EXCEPTION
197762 WHEN xla_exceptions_pkg.application_exception THEN
197763 RAISE;
197764 WHEN OTHERS THEN
197765 xla_exceptions_pkg.raise_message
197766 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_449');
197767 END AcctLineType_449;
197768 --
197769
197770 ---------------------------------------
197771 --
197772 -- PRIVATE FUNCTION
197773 -- AcctLineType_450
197774 --
197775 ---------------------------------------
197776 PROCEDURE AcctLineType_450 (
197777 p_application_id IN NUMBER
197778 ,p_event_id IN NUMBER
197779 ,p_calculate_acctd_flag IN VARCHAR2
197780 ,p_calculate_g_l_flag IN VARCHAR2
197781 ,p_actual_flag IN OUT VARCHAR2
197782 ,p_balance_type_code OUT VARCHAR2
197783 ,p_gain_or_loss_ref OUT VARCHAR2
197784
197785 --Inflation Adjustment Type Description
197786 , p_source_2 IN VARCHAR2
197787 --Accounting Date
197788 , p_source_3 IN DATE
197789 --Inflation Depreciation Reserve Ccid
197790 , p_source_40 IN NUMBER
197791 --Transaction Header Identifier
197792 , p_source_49 IN NUMBER
197793 --Adjustment Line Identifier
197794 , p_source_50 IN NUMBER
197795 --Distribution Type Code
197796 , p_source_51 IN VARCHAR2
197797 --Inflation Adjustment Type
197798 , p_source_64 IN VARCHAR2
197799 --Inflation Entered Amount
197800 , p_source_65 IN NUMBER
197801 --Inflation Currency Code
197802 , p_source_66 IN VARCHAR2
197803 )
197804 IS
197805
197806 l_component_type VARCHAR2(80);
197807 l_component_code VARCHAR2(30);
197808 l_component_type_code VARCHAR2(1);
197809 l_component_appl_id INTEGER;
197810 l_amb_context_code VARCHAR2(30);
197811 l_entity_code VARCHAR2(30);
197812 l_event_class_code VARCHAR2(30);
197813 l_ae_header_id NUMBER;
197814 l_event_type_code VARCHAR2(30);
197815 l_line_definition_code VARCHAR2(30);
197819 l_segment VARCHAR2(30);
197816 l_line_definition_owner_code VARCHAR2(1);
197817 --
197818 -- adr variables
197820 l_ccid NUMBER;
197821 l_adr_transaction_coa_id NUMBER;
197822 l_adr_accounting_coa_id NUMBER;
197823 l_adr_flexfield_segment_code VARCHAR2(30);
197824 l_adr_flex_value_set_id NUMBER;
197825 l_adr_value_type_code VARCHAR2(30);
197826 l_adr_value_combination_id NUMBER;
197827 l_adr_value_segment_code VARCHAR2(30);
197828
197829 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
197830 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
197831 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
197832 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
197833
197834 -- 4262811 Variables ------------------------------------------------------------------------------------------
197835 l_entered_amt_idx NUMBER;
197836 l_accted_amt_idx NUMBER;
197837 l_acc_rev_flag VARCHAR2(1);
197838 l_accrual_line_num NUMBER;
197839 l_tmp_amt NUMBER;
197840 l_acc_rev_natural_side_code VARCHAR2(1);
197841
197842 l_num_entries NUMBER;
197843 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
197844 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
197845 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
197846 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
197847 l_recog_line_1 NUMBER;
197848 l_recog_line_2 NUMBER;
197849
197850 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
197851 l_bflow_applied_to_amt NUMBER; -- 5132302
197852 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
197853
197854 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
197855
197856 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
197857 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
197858
197859 ---------------------------------------------------------------------------------------------------------------
197860
197861
197862 --
197863 -- bulk performance
197864 --
197865 l_balance_type_code VARCHAR2(1);
197866 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
197867 l_log_module VARCHAR2(240);
197868
197869 --
197870 -- Upgrade strategy
197871 --
197872 l_actual_upg_option VARCHAR2(1);
197873 l_enc_upg_option VARCHAR2(1);
197874
197875 --
197876 BEGIN
197877 --
197878 IF g_log_enabled THEN
197879 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_450';
197880 END IF;
197881 --
197882 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
197883
197884 trace
197885 (p_msg => 'BEGIN of AcctLineType_450'
197886 ,p_level => C_LEVEL_PROCEDURE
197887 ,p_module => l_log_module);
197888
197889 END IF;
197890 --
197891 l_component_type := 'AMB_JLT';
197892 l_component_code := 'IAC_DEPRECIATION_RESERVE';
197893 l_component_type_code := 'S';
197894 l_component_appl_id := 140;
197895 l_amb_context_code := 'DEFAULT';
197896 l_entity_code := 'TRANSACTIONS';
197897 l_event_class_code := 'ADJUSTMENTS';
197898 l_event_type_code := 'ADJUSTMENTS_ALL';
197899 l_line_definition_owner_code := 'S';
197900 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
197901 --
197902 l_balance_type_code := 'A';
197903 l_segment := NULL;
197904 l_ccid := NULL;
197905 l_adr_transaction_coa_id := NULL;
197906 l_adr_accounting_coa_id := NULL;
197907 l_adr_flexfield_segment_code := NULL;
197908 l_adr_flex_value_set_id := NULL;
197909 l_adr_value_type_code := NULL;
197910 l_adr_value_combination_id := NULL;
197911 l_adr_value_segment_code := NULL;
197912
197913 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
197914 l_bflow_class_code := ''; -- 4219869 Business Flow
197915 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
197916 l_budgetary_control_flag := 'N';
197917
197918 l_bflow_applied_to_amt_idx := NULL; -- 5132302
197919 l_bflow_applied_to_amt := NULL; -- 5132302
197920 l_entered_amt_idx := NULL; -- 4262811
197921 l_accted_amt_idx := NULL; -- 4262811
197922 l_acc_rev_flag := NULL; -- 4262811
197923 l_accrual_line_num := NULL; -- 4262811
197924 l_tmp_amt := NULL; -- 4262811
197925 --
197926
197927 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
197928 l_balance_type_code <> 'B' THEN
197929 IF NVL(p_source_64,'
197930 ') = 'RESERVE'
197931 THEN
197932
197933 --
197934 XLA_AE_LINES_PKG.SetNewLine;
197935
197936 p_balance_type_code := l_balance_type_code;
197937 -- set the flag so later we will know whether the gain loss line needs to be created
197938
197939 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
197940 p_actual_flag :='A';
197941 END IF;
197942
197943 --
197944 -- bulk performance
197948 --
197945 --
197946 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
197947 p_header_num => 0); -- 4262811
197949 -- set accounting line options
197950 --
197951 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
197952 p_natural_side_code => 'C'
197953 , p_gain_or_loss_flag => 'N'
197954 , p_gl_transfer_mode_code => 'S'
197955 , p_acct_entry_type_code => 'A'
197956 , p_switch_side_flag => 'Y'
197957 , p_merge_duplicate_code => 'N'
197958 );
197959 --
197960 l_acc_rev_natural_side_code := 'D'; -- 4262811
197961 --
197962 --
197963 -- set accounting line type info
197964 --
197965 xla_ae_lines_pkg.SetAcctLineType
197966 (p_component_type => l_component_type
197967 ,p_event_type_code => l_event_type_code
197968 ,p_line_definition_owner_code => l_line_definition_owner_code
197969 ,p_line_definition_code => l_line_definition_code
197970 ,p_accounting_line_code => l_component_code
197971 ,p_accounting_line_type_code => l_component_type_code
197972 ,p_accounting_line_appl_id => l_component_appl_id
197973 ,p_amb_context_code => l_amb_context_code
197974 ,p_entity_code => l_entity_code
197975 ,p_event_class_code => l_event_class_code);
197976 --
197977 -- set accounting class
197978 --
197979 xla_ae_lines_pkg.SetAcctClass(
197980 p_accounting_class_code => 'ASSET'
197981 , p_ae_header_id => l_ae_header_id
197982 );
197983
197984 --
197985 -- set rounding class
197986 --
197987 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
197988 'ASSET';
197989
197990 --
197991 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
197992 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
197993 --
197994 -- bulk performance
197995 --
197996 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
197997
197998 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
197999 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
198000
198001 -- 4955764
198002 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
198003 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
198004
198005 -- 4458381 Public Sector Enh
198006
198007 --
198008 -- set accounting attributes for the line type
198009 --
198010 l_entered_amt_idx := 4;
198011 l_accted_amt_idx := 6;
198012 l_bflow_applied_to_amt_idx := NULL; -- 5132302
198013 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
198014 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
198015 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
198016 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
198017 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
198018 l_rec_acct_attrs.array_char_value(3) := p_source_51;
198019 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
198020 l_rec_acct_attrs.array_num_value(4) := p_source_65;
198021 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
198022 l_rec_acct_attrs.array_char_value(5) := p_source_66;
198023 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
198024 l_rec_acct_attrs.array_num_value(6) := p_source_65;
198025
198026 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
198027 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
198028
198029 ---------------------------------------------------------------------------------------------------------------
198030 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
198031 ---------------------------------------------------------------------------------------------------------------
198032 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
198033
198034 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
198035 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
198036
198037 IF xla_accounting_cache_pkg.GetValueChar
198038 (p_source_code => 'LEDGER_CATEGORY_CODE'
198039 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
198040 AND l_bflow_method_code = 'PRIOR_ENTRY'
198041 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
198042 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
198043 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
198044 )
198045 THEN
198046 xla_ae_lines_pkg.BflowUpgEntry
198047 (p_business_method_code => l_bflow_method_code
198048 ,p_business_class_code => l_bflow_class_code
198049 ,p_balance_type => l_balance_type_code);
198050 ELSE
198051 NULL;
198052 -- No business flow processing for business flow method of NONE.
198053 END IF;
198054
198055 --
198056 -- call analytical criteria
198057 --
198058
198059 --
198063 xla_ae_lines_pkg.SetLineDescription(
198060 -- call description
198061 --
198062
198064 p_ae_header_id => l_ae_header_id
198065 ,p_description => Description_143 (
198066 p_application_id => p_application_id
198067 , p_ae_header_id => l_ae_header_id
198068 , p_source_2 => p_source_2
198069 , p_source_3 => p_source_3
198070 )
198071 );
198072
198073
198074 --
198075 -- call ADRs
198076 -- Bug 4922099
198077 --
198078 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
198079 (NVL(l_actual_upg_option, 'N') = 'O') OR
198080 (NVL(l_enc_upg_option, 'N') = 'O')
198081 )
198082 THEN
198083 NULL;
198084 --
198085 --
198086
198087 l_ccid := AcctDerRule_185(
198088 p_application_id => p_application_id
198089 , p_ae_header_id => l_ae_header_id
198090 , p_source_40 => p_source_40
198091 , x_transaction_coa_id => l_adr_transaction_coa_id
198092 , x_accounting_coa_id => l_adr_accounting_coa_id
198093 , x_value_type_code => l_adr_value_type_code
198094 , p_side => 'NA'
198095 );
198096
198097 xla_ae_lines_pkg.set_ccid(
198098 p_code_combination_id => l_ccid
198099 , p_value_type_code => l_adr_value_type_code
198100 , p_transaction_coa_id => l_adr_transaction_coa_id
198101 , p_accounting_coa_id => l_adr_accounting_coa_id
198102 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
198103 , p_adr_type_code => 'S'
198104 , p_component_type => l_component_type
198105 , p_component_code => l_component_code
198106 , p_component_type_code => l_component_type_code
198107 , p_component_appl_id => l_component_appl_id
198108 , p_amb_context_code => l_amb_context_code
198109 , p_side => 'NA'
198110 );
198111
198112
198113 --
198114 --
198115 END IF;
198116 --
198117 -- Bug 4922099
198118 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
198119 (NVL(l_enc_upg_option, 'N') = 'O')
198120 ) AND
198121 (l_bflow_method_code = 'PRIOR_ENTRY')
198122 )
198123 THEN
198124 IF
198125 --
198126 1 = 2
198127 --
198128 THEN
198129 xla_accounting_err_pkg.build_message
198130 (p_appli_s_name => 'XLA'
198131 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
198132 ,p_token_1 => 'LINE_NUMBER'
198133 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
198134 ,p_token_2 => 'LINE_TYPE_NAME'
198135 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
198136 l_component_type
198137 ,l_component_code
198138 ,l_component_type_code
198139 ,l_component_appl_id
198140 ,l_amb_context_code
198141 ,l_entity_code
198142 ,l_event_class_code
198143 )
198144 ,p_token_3 => 'OWNER'
198145 ,p_value_3 => xla_lookups_pkg.get_meaning(
198146 p_lookup_type => 'XLA_OWNER_TYPE'
198147 ,p_lookup_code => l_component_type_code
198148 )
198149 ,p_token_4 => 'PRODUCT_NAME'
198150 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
198151 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
198152 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
198153 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
198154 ,p_ae_header_id => NULL
198155 );
198156
198157 IF (C_LEVEL_ERROR>= g_log_level) THEN
198158 trace
198159 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
198160 ,p_level => C_LEVEL_ERROR
198161 ,p_module => l_log_module);
198162 END IF;
198163 END IF;
198164 END IF;
198165 --
198166 --
198167 ------------------------------------------------------------------------------------------------
198168 -- 4219869 Business Flow
198169 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
198170 -- Prior Entry. Currently, the following code is always generated.
198174 ------------------------------------------------------------------------------------
198171 ------------------------------------------------------------------------------------------------
198172 XLA_AE_LINES_PKG.ValidateCurrentLine;
198173
198175 -- 4219869 Business Flow
198176 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
198177 ------------------------------------------------------------------------------------
198178 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
198179
198180 ----------------------------------------------------------------------------------
198181 -- 4219869 Business Flow
198182 -- Update journal entry status -- Need to generate this within IF <condition>
198183 ----------------------------------------------------------------------------------
198184 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
198185 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
198186 ,p_balance_type_code => l_balance_type_code
198187 );
198188
198189 -------------------------------------------------------------------------------------------
198190 -- 4262811 - Generate the Accrual Reversal lines
198191 -------------------------------------------------------------------------------------------
198192 BEGIN
198193 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
198194 (g_array_event(p_event_id).array_value_num('header_index'));
198195 IF l_acc_rev_flag IS NULL THEN
198196 l_acc_rev_flag := 'N';
198197 END IF;
198198 EXCEPTION
198199 WHEN OTHERS THEN
198200 l_acc_rev_flag := 'N';
198201 END;
198202 --
198203 IF (l_acc_rev_flag = 'Y') THEN
198204
198205 -- 4645092 ------------------------------------------------------------------------------
198206 -- To allow MPA report to determine if it should generate report process
198207 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
198208 ------------------------------------------------------------------------------------------
198209
198210 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
198211 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
198212 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
198213 -- call ADRs
198214 -- Bug 4922099
198215 --
198216 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
198217 (NVL(l_actual_upg_option, 'N') = 'O') OR
198218 (NVL(l_enc_upg_option, 'N') = 'O')
198219 )
198220 THEN
198221 NULL;
198222 --
198223 --
198224
198225 l_ccid := AcctDerRule_185(
198226 p_application_id => p_application_id
198227 , p_ae_header_id => l_ae_header_id
198228 , p_source_40 => p_source_40
198229 , x_transaction_coa_id => l_adr_transaction_coa_id
198230 , x_accounting_coa_id => l_adr_accounting_coa_id
198231 , x_value_type_code => l_adr_value_type_code
198232 , p_side => 'NA'
198233 );
198234
198235 xla_ae_lines_pkg.set_ccid(
198236 p_code_combination_id => l_ccid
198237 , p_value_type_code => l_adr_value_type_code
198238 , p_transaction_coa_id => l_adr_transaction_coa_id
198239 , p_accounting_coa_id => l_adr_accounting_coa_id
198240 , p_adr_code => 'IAC_DEPRECIATION_RESERVE_AC'
198241 , p_adr_type_code => 'S'
198242 , p_component_type => l_component_type
198243 , p_component_code => l_component_code
198244 , p_component_type_code => l_component_type_code
198245 , p_component_appl_id => l_component_appl_id
198246 , p_amb_context_code => l_amb_context_code
198247 , p_side => 'NA'
198248 );
198249
198250
198251 --
198252 --
198253 END IF;
198254
198255 --
198256 -- Update the line information that should be overwritten
198257 --
198258 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
198259 p_header_num => 1);
198260 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
198261
198262 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
198263
198264 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
198265 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
198266 END IF;
198267
198268 --
198269 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
198270 --
198271 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
198272 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
198273 ELSE
198274 ---------------------------------------------------------------------------------------------------
198275 -- 4262811a Switch Sign
198276 ---------------------------------------------------------------------------------------------------
198277 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
198278 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
198282 -- 5132302
198279 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
198280 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
198281 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
198283 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
198284 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
198285
198286 END IF;
198287
198288 -- 4955764
198289 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
198290 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
198291
198292
198293 XLA_AE_LINES_PKG.ValidateCurrentLine;
198294 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
198295
198296 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
198297 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
198298 ,p_balance_type_code => l_balance_type_code);
198299
198300 END IF;
198301
198302 -----------------------------------------------------------------------------------------
198303 -- 4262811 Multiperiod Accounting
198304 -----------------------------------------------------------------------------------------
198305 -- No MPA option is assigned.
198306
198307
198308 END IF;
198309 END IF;
198310 --
198311
198312 --
198313 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
198314 trace
198315 (p_msg => 'END of AcctLineType_450'
198316 ,p_level => C_LEVEL_PROCEDURE
198317 ,p_module => l_log_module);
198318 END IF;
198319 --
198320 EXCEPTION
198321 WHEN xla_exceptions_pkg.application_exception THEN
198322 RAISE;
198323 WHEN OTHERS THEN
198324 xla_exceptions_pkg.raise_message
198325 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_450');
198326 END AcctLineType_450;
198327 --
198328
198329 ---------------------------------------
198330 --
198331 -- PRIVATE FUNCTION
198332 -- AcctLineType_451
198333 --
198334 ---------------------------------------
198335 PROCEDURE AcctLineType_451 (
198336 p_application_id IN NUMBER
198337 ,p_event_id IN NUMBER
198338 ,p_calculate_acctd_flag IN VARCHAR2
198339 ,p_calculate_g_l_flag IN VARCHAR2
198340 ,p_actual_flag IN OUT VARCHAR2
198341 ,p_balance_type_code OUT VARCHAR2
198342 ,p_gain_or_loss_ref OUT VARCHAR2
198343
198344 --Inflation Adjustment Type Description
198345 , p_source_2 IN VARCHAR2
198346 --Accounting Date
198347 , p_source_3 IN DATE
198348 --Inflation General Fund Ccid
198349 , p_source_41 IN NUMBER
198350 --Transaction Header Identifier
198351 , p_source_49 IN NUMBER
198352 --Adjustment Line Identifier
198353 , p_source_50 IN NUMBER
198354 --Distribution Type Code
198355 , p_source_51 IN VARCHAR2
198356 --Inflation Adjustment Type
198357 , p_source_64 IN VARCHAR2
198358 --Inflation Entered Amount
198359 , p_source_65 IN NUMBER
198360 --Inflation Currency Code
198361 , p_source_66 IN VARCHAR2
198362 )
198363 IS
198364
198365 l_component_type VARCHAR2(80);
198366 l_component_code VARCHAR2(30);
198367 l_component_type_code VARCHAR2(1);
198368 l_component_appl_id INTEGER;
198369 l_amb_context_code VARCHAR2(30);
198370 l_entity_code VARCHAR2(30);
198371 l_event_class_code VARCHAR2(30);
198372 l_ae_header_id NUMBER;
198373 l_event_type_code VARCHAR2(30);
198374 l_line_definition_code VARCHAR2(30);
198375 l_line_definition_owner_code VARCHAR2(1);
198376 --
198377 -- adr variables
198378 l_segment VARCHAR2(30);
198379 l_ccid NUMBER;
198380 l_adr_transaction_coa_id NUMBER;
198381 l_adr_accounting_coa_id NUMBER;
198382 l_adr_flexfield_segment_code VARCHAR2(30);
198383 l_adr_flex_value_set_id NUMBER;
198384 l_adr_value_type_code VARCHAR2(30);
198385 l_adr_value_combination_id NUMBER;
198386 l_adr_value_segment_code VARCHAR2(30);
198387
198388 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
198389 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
198390 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
198391 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
198392
198393 -- 4262811 Variables ------------------------------------------------------------------------------------------
198394 l_entered_amt_idx NUMBER;
198395 l_accted_amt_idx NUMBER;
198396 l_acc_rev_flag VARCHAR2(1);
198397 l_accrual_line_num NUMBER;
198398 l_tmp_amt NUMBER;
198399 l_acc_rev_natural_side_code VARCHAR2(1);
198400
198401 l_num_entries NUMBER;
198402 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
198403 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
198404 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
198405 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
198406 l_recog_line_1 NUMBER;
198410 l_bflow_applied_to_amt NUMBER; -- 5132302
198407 l_recog_line_2 NUMBER;
198408
198409 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
198411 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
198412
198413 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
198414
198415 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
198416 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
198417
198418 ---------------------------------------------------------------------------------------------------------------
198419
198420
198421 --
198422 -- bulk performance
198423 --
198424 l_balance_type_code VARCHAR2(1);
198425 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
198426 l_log_module VARCHAR2(240);
198427
198428 --
198429 -- Upgrade strategy
198430 --
198431 l_actual_upg_option VARCHAR2(1);
198432 l_enc_upg_option VARCHAR2(1);
198433
198434 --
198435 BEGIN
198436 --
198437 IF g_log_enabled THEN
198438 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_451';
198439 END IF;
198440 --
198441 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
198442
198443 trace
198444 (p_msg => 'BEGIN of AcctLineType_451'
198445 ,p_level => C_LEVEL_PROCEDURE
198446 ,p_module => l_log_module);
198447
198448 END IF;
198449 --
198450 l_component_type := 'AMB_JLT';
198451 l_component_code := 'IAC_GENERAL_FUND';
198452 l_component_type_code := 'S';
198453 l_component_appl_id := 140;
198454 l_amb_context_code := 'DEFAULT';
198455 l_entity_code := 'TRANSACTIONS';
198456 l_event_class_code := 'TRANSFERS';
198457 l_event_type_code := 'TRANSFERS_ALL';
198458 l_line_definition_owner_code := 'S';
198459 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
198460 --
198461 l_balance_type_code := 'A';
198462 l_segment := NULL;
198463 l_ccid := NULL;
198464 l_adr_transaction_coa_id := NULL;
198465 l_adr_accounting_coa_id := NULL;
198466 l_adr_flexfield_segment_code := NULL;
198467 l_adr_flex_value_set_id := NULL;
198468 l_adr_value_type_code := NULL;
198469 l_adr_value_combination_id := NULL;
198470 l_adr_value_segment_code := NULL;
198471
198472 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
198473 l_bflow_class_code := ''; -- 4219869 Business Flow
198474 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
198475 l_budgetary_control_flag := 'N';
198476
198477 l_bflow_applied_to_amt_idx := NULL; -- 5132302
198478 l_bflow_applied_to_amt := NULL; -- 5132302
198479 l_entered_amt_idx := NULL; -- 4262811
198480 l_accted_amt_idx := NULL; -- 4262811
198481 l_acc_rev_flag := NULL; -- 4262811
198482 l_accrual_line_num := NULL; -- 4262811
198483 l_tmp_amt := NULL; -- 4262811
198484 --
198485
198486 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
198487 l_balance_type_code <> 'B' THEN
198488 IF NVL(p_source_64,'
198489 ') = 'GENERAL FUND'
198490 THEN
198491
198492 --
198493 XLA_AE_LINES_PKG.SetNewLine;
198494
198495 p_balance_type_code := l_balance_type_code;
198496 -- set the flag so later we will know whether the gain loss line needs to be created
198497
198498 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
198499 p_actual_flag :='A';
198500 END IF;
198501
198502 --
198503 -- bulk performance
198504 --
198505 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
198506 p_header_num => 0); -- 4262811
198507 --
198508 -- set accounting line options
198509 --
198510 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
198511 p_natural_side_code => 'C'
198512 , p_gain_or_loss_flag => 'N'
198513 , p_gl_transfer_mode_code => 'S'
198514 , p_acct_entry_type_code => 'A'
198515 , p_switch_side_flag => 'Y'
198516 , p_merge_duplicate_code => 'N'
198517 );
198518 --
198519 l_acc_rev_natural_side_code := 'D'; -- 4262811
198520 --
198521 --
198522 -- set accounting line type info
198523 --
198524 xla_ae_lines_pkg.SetAcctLineType
198525 (p_component_type => l_component_type
198526 ,p_event_type_code => l_event_type_code
198527 ,p_line_definition_owner_code => l_line_definition_owner_code
198528 ,p_line_definition_code => l_line_definition_code
198529 ,p_accounting_line_code => l_component_code
198530 ,p_accounting_line_type_code => l_component_type_code
198531 ,p_accounting_line_appl_id => l_component_appl_id
198532 ,p_amb_context_code => l_amb_context_code
198533 ,p_entity_code => l_entity_code
198534 ,p_event_class_code => l_event_class_code);
198535 --
198536 -- set accounting class
198537 --
198538 xla_ae_lines_pkg.SetAcctClass(
198539 p_accounting_class_code => 'ASSET'
198540 , p_ae_header_id => l_ae_header_id
198541 );
198542
198546 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
198543 --
198544 -- set rounding class
198545 --
198547 'ASSET';
198548
198549 --
198550 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
198551 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
198552 --
198553 -- bulk performance
198554 --
198555 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
198556
198557 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
198558 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
198559
198560 -- 4955764
198561 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
198562 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
198563
198564 -- 4458381 Public Sector Enh
198565
198566 --
198567 -- set accounting attributes for the line type
198568 --
198569 l_entered_amt_idx := 4;
198570 l_accted_amt_idx := 6;
198571 l_bflow_applied_to_amt_idx := NULL; -- 5132302
198572 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
198573 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
198574 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
198575 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
198576 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
198577 l_rec_acct_attrs.array_char_value(3) := p_source_51;
198578 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
198579 l_rec_acct_attrs.array_num_value(4) := p_source_65;
198580 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
198581 l_rec_acct_attrs.array_char_value(5) := p_source_66;
198582 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
198583 l_rec_acct_attrs.array_num_value(6) := p_source_65;
198584
198585 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
198586 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
198587
198588 ---------------------------------------------------------------------------------------------------------------
198589 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
198590 ---------------------------------------------------------------------------------------------------------------
198591 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
198592
198593 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
198594 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
198595
198596 IF xla_accounting_cache_pkg.GetValueChar
198597 (p_source_code => 'LEDGER_CATEGORY_CODE'
198598 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
198599 AND l_bflow_method_code = 'PRIOR_ENTRY'
198600 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
198601 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
198602 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
198603 )
198604 THEN
198605 xla_ae_lines_pkg.BflowUpgEntry
198606 (p_business_method_code => l_bflow_method_code
198607 ,p_business_class_code => l_bflow_class_code
198608 ,p_balance_type => l_balance_type_code);
198609 ELSE
198610 NULL;
198611 -- No business flow processing for business flow method of NONE.
198612 END IF;
198613
198614 --
198615 -- call analytical criteria
198616 --
198617
198618 --
198619 -- call description
198620 --
198621
198622 xla_ae_lines_pkg.SetLineDescription(
198623 p_ae_header_id => l_ae_header_id
198624 ,p_description => Description_143 (
198625 p_application_id => p_application_id
198626 , p_ae_header_id => l_ae_header_id
198627 , p_source_2 => p_source_2
198628 , p_source_3 => p_source_3
198629 )
198630 );
198631
198632
198633 --
198634 -- call ADRs
198635 -- Bug 4922099
198636 --
198637 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
198638 (NVL(l_actual_upg_option, 'N') = 'O') OR
198639 (NVL(l_enc_upg_option, 'N') = 'O')
198640 )
198641 THEN
198642 NULL;
198643 --
198644 --
198645
198646 l_ccid := AcctDerRule_186(
198647 p_application_id => p_application_id
198648 , p_ae_header_id => l_ae_header_id
198649 , p_source_41 => p_source_41
198650 , x_transaction_coa_id => l_adr_transaction_coa_id
198651 , x_accounting_coa_id => l_adr_accounting_coa_id
198652 , x_value_type_code => l_adr_value_type_code
198653 , p_side => 'NA'
198654 );
198655
198656 xla_ae_lines_pkg.set_ccid(
198657 p_code_combination_id => l_ccid
198658 , p_value_type_code => l_adr_value_type_code
198659 , p_transaction_coa_id => l_adr_transaction_coa_id
198660 , p_accounting_coa_id => l_adr_accounting_coa_id
198661 , p_adr_code => 'IAC_GENERAL_FUND_AC'
198662 , p_adr_type_code => 'S'
198666 , p_component_appl_id => l_component_appl_id
198663 , p_component_type => l_component_type
198664 , p_component_code => l_component_code
198665 , p_component_type_code => l_component_type_code
198667 , p_amb_context_code => l_amb_context_code
198668 , p_side => 'NA'
198669 );
198670
198671
198672 --
198673 --
198674 END IF;
198675 --
198676 -- Bug 4922099
198677 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
198678 (NVL(l_enc_upg_option, 'N') = 'O')
198679 ) AND
198680 (l_bflow_method_code = 'PRIOR_ENTRY')
198681 )
198682 THEN
198683 IF
198684 --
198685 1 = 2
198686 --
198687 THEN
198688 xla_accounting_err_pkg.build_message
198689 (p_appli_s_name => 'XLA'
198690 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
198691 ,p_token_1 => 'LINE_NUMBER'
198692 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
198693 ,p_token_2 => 'LINE_TYPE_NAME'
198694 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
198695 l_component_type
198696 ,l_component_code
198697 ,l_component_type_code
198698 ,l_component_appl_id
198699 ,l_amb_context_code
198700 ,l_entity_code
198701 ,l_event_class_code
198702 )
198703 ,p_token_3 => 'OWNER'
198704 ,p_value_3 => xla_lookups_pkg.get_meaning(
198705 p_lookup_type => 'XLA_OWNER_TYPE'
198706 ,p_lookup_code => l_component_type_code
198707 )
198708 ,p_token_4 => 'PRODUCT_NAME'
198709 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
198710 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
198711 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
198712 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
198713 ,p_ae_header_id => NULL
198714 );
198715
198716 IF (C_LEVEL_ERROR>= g_log_level) THEN
198717 trace
198718 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
198719 ,p_level => C_LEVEL_ERROR
198720 ,p_module => l_log_module);
198721 END IF;
198722 END IF;
198723 END IF;
198724 --
198725 --
198726 ------------------------------------------------------------------------------------------------
198727 -- 4219869 Business Flow
198728 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
198729 -- Prior Entry. Currently, the following code is always generated.
198730 ------------------------------------------------------------------------------------------------
198731 XLA_AE_LINES_PKG.ValidateCurrentLine;
198732
198733 ------------------------------------------------------------------------------------
198734 -- 4219869 Business Flow
198735 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
198736 ------------------------------------------------------------------------------------
198737 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
198738
198739 ----------------------------------------------------------------------------------
198740 -- 4219869 Business Flow
198741 -- Update journal entry status -- Need to generate this within IF <condition>
198742 ----------------------------------------------------------------------------------
198743 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
198744 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
198745 ,p_balance_type_code => l_balance_type_code
198746 );
198747
198748 -------------------------------------------------------------------------------------------
198749 -- 4262811 - Generate the Accrual Reversal lines
198750 -------------------------------------------------------------------------------------------
198751 BEGIN
198752 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
198753 (g_array_event(p_event_id).array_value_num('header_index'));
198754 IF l_acc_rev_flag IS NULL THEN
198755 l_acc_rev_flag := 'N';
198756 END IF;
198757 EXCEPTION
198758 WHEN OTHERS THEN
198759 l_acc_rev_flag := 'N';
198763
198760 END;
198761 --
198762 IF (l_acc_rev_flag = 'Y') THEN
198764 -- 4645092 ------------------------------------------------------------------------------
198765 -- To allow MPA report to determine if it should generate report process
198766 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
198767 ------------------------------------------------------------------------------------------
198768
198769 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
198770 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
198771 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
198772 -- call ADRs
198773 -- Bug 4922099
198774 --
198775 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
198776 (NVL(l_actual_upg_option, 'N') = 'O') OR
198777 (NVL(l_enc_upg_option, 'N') = 'O')
198778 )
198779 THEN
198780 NULL;
198781 --
198782 --
198783
198784 l_ccid := AcctDerRule_186(
198785 p_application_id => p_application_id
198786 , p_ae_header_id => l_ae_header_id
198787 , p_source_41 => p_source_41
198788 , x_transaction_coa_id => l_adr_transaction_coa_id
198789 , x_accounting_coa_id => l_adr_accounting_coa_id
198790 , x_value_type_code => l_adr_value_type_code
198791 , p_side => 'NA'
198792 );
198793
198794 xla_ae_lines_pkg.set_ccid(
198795 p_code_combination_id => l_ccid
198796 , p_value_type_code => l_adr_value_type_code
198797 , p_transaction_coa_id => l_adr_transaction_coa_id
198798 , p_accounting_coa_id => l_adr_accounting_coa_id
198799 , p_adr_code => 'IAC_GENERAL_FUND_AC'
198800 , p_adr_type_code => 'S'
198801 , p_component_type => l_component_type
198802 , p_component_code => l_component_code
198803 , p_component_type_code => l_component_type_code
198804 , p_component_appl_id => l_component_appl_id
198805 , p_amb_context_code => l_amb_context_code
198806 , p_side => 'NA'
198807 );
198808
198809
198810 --
198811 --
198812 END IF;
198813
198814 --
198815 -- Update the line information that should be overwritten
198816 --
198817 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
198818 p_header_num => 1);
198819 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
198820
198821 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
198822
198823 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
198824 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
198825 END IF;
198826
198827 --
198828 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
198829 --
198830 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
198831 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
198832 ELSE
198833 ---------------------------------------------------------------------------------------------------
198834 -- 4262811a Switch Sign
198835 ---------------------------------------------------------------------------------------------------
198836 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
198837 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
198838 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
198839 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
198840 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
198841 -- 5132302
198842 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
198843 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
198844
198845 END IF;
198846
198847 -- 4955764
198848 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
198849 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
198850
198851
198852 XLA_AE_LINES_PKG.ValidateCurrentLine;
198853 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
198854
198855 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
198856 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
198857 ,p_balance_type_code => l_balance_type_code);
198858
198859 END IF;
198860
198861 -----------------------------------------------------------------------------------------
198862 -- 4262811 Multiperiod Accounting
198863 -----------------------------------------------------------------------------------------
198864 -- No MPA option is assigned.
198865
198866
198867 END IF;
198868 END IF;
198869 --
198870
198871 --
198872 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
198873 trace
198877 END IF;
198874 (p_msg => 'END of AcctLineType_451'
198875 ,p_level => C_LEVEL_PROCEDURE
198876 ,p_module => l_log_module);
198878 --
198879 EXCEPTION
198880 WHEN xla_exceptions_pkg.application_exception THEN
198881 RAISE;
198882 WHEN OTHERS THEN
198883 xla_exceptions_pkg.raise_message
198884 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_451');
198885 END AcctLineType_451;
198886 --
198887
198888 ---------------------------------------
198889 --
198890 -- PRIVATE FUNCTION
198891 -- AcctLineType_452
198892 --
198893 ---------------------------------------
198894 PROCEDURE AcctLineType_452 (
198895 p_application_id IN NUMBER
198896 ,p_event_id IN NUMBER
198897 ,p_calculate_acctd_flag IN VARCHAR2
198898 ,p_calculate_g_l_flag IN VARCHAR2
198899 ,p_actual_flag IN OUT VARCHAR2
198900 ,p_balance_type_code OUT VARCHAR2
198901 ,p_gain_or_loss_ref OUT VARCHAR2
198902
198903 --Inflation Adjustment Type Description
198904 , p_source_2 IN VARCHAR2
198905 --Accounting Date
198906 , p_source_3 IN DATE
198907 --Inflation General Fund Ccid
198908 , p_source_41 IN NUMBER
198909 --Transaction Header Identifier
198910 , p_source_49 IN NUMBER
198911 --Adjustment Line Identifier
198912 , p_source_50 IN NUMBER
198913 --Distribution Type Code
198914 , p_source_51 IN VARCHAR2
198915 --Inflation Adjustment Type
198916 , p_source_64 IN VARCHAR2
198917 --Inflation Entered Amount
198918 , p_source_65 IN NUMBER
198919 --Inflation Currency Code
198920 , p_source_66 IN VARCHAR2
198921 )
198922 IS
198923
198924 l_component_type VARCHAR2(80);
198925 l_component_code VARCHAR2(30);
198926 l_component_type_code VARCHAR2(1);
198927 l_component_appl_id INTEGER;
198928 l_amb_context_code VARCHAR2(30);
198929 l_entity_code VARCHAR2(30);
198930 l_event_class_code VARCHAR2(30);
198931 l_ae_header_id NUMBER;
198932 l_event_type_code VARCHAR2(30);
198933 l_line_definition_code VARCHAR2(30);
198934 l_line_definition_owner_code VARCHAR2(1);
198935 --
198936 -- adr variables
198937 l_segment VARCHAR2(30);
198938 l_ccid NUMBER;
198939 l_adr_transaction_coa_id NUMBER;
198940 l_adr_accounting_coa_id NUMBER;
198941 l_adr_flexfield_segment_code VARCHAR2(30);
198942 l_adr_flex_value_set_id NUMBER;
198943 l_adr_value_type_code VARCHAR2(30);
198944 l_adr_value_combination_id NUMBER;
198945 l_adr_value_segment_code VARCHAR2(30);
198946
198947 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
198948 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
198949 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
198950 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
198951
198952 -- 4262811 Variables ------------------------------------------------------------------------------------------
198953 l_entered_amt_idx NUMBER;
198954 l_accted_amt_idx NUMBER;
198955 l_acc_rev_flag VARCHAR2(1);
198956 l_accrual_line_num NUMBER;
198957 l_tmp_amt NUMBER;
198958 l_acc_rev_natural_side_code VARCHAR2(1);
198959
198960 l_num_entries NUMBER;
198961 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
198962 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
198963 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
198964 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
198965 l_recog_line_1 NUMBER;
198966 l_recog_line_2 NUMBER;
198967
198968 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
198969 l_bflow_applied_to_amt NUMBER; -- 5132302
198970 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
198971
198972 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
198973
198974 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
198975 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
198976
198977 ---------------------------------------------------------------------------------------------------------------
198978
198979
198980 --
198981 -- bulk performance
198982 --
198983 l_balance_type_code VARCHAR2(1);
198984 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
198985 l_log_module VARCHAR2(240);
198986
198987 --
198988 -- Upgrade strategy
198989 --
198990 l_actual_upg_option VARCHAR2(1);
198991 l_enc_upg_option VARCHAR2(1);
198992
198993 --
198994 BEGIN
198995 --
198996 IF g_log_enabled THEN
198997 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_452';
198998 END IF;
198999 --
199000 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
199001
199002 trace
199003 (p_msg => 'BEGIN of AcctLineType_452'
199004 ,p_level => C_LEVEL_PROCEDURE
199005 ,p_module => l_log_module);
199006
199007 END IF;
199008 --
199009 l_component_type := 'AMB_JLT';
199013 l_amb_context_code := 'DEFAULT';
199010 l_component_code := 'IAC_GENERAL_FUND';
199011 l_component_type_code := 'S';
199012 l_component_appl_id := 140;
199014 l_entity_code := 'TRANSACTIONS';
199015 l_event_class_code := 'RETIREMENTS';
199016 l_event_type_code := 'REINSTATEMENTS';
199017 l_line_definition_owner_code := 'S';
199018 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
199019 --
199020 l_balance_type_code := 'A';
199021 l_segment := NULL;
199022 l_ccid := NULL;
199023 l_adr_transaction_coa_id := NULL;
199024 l_adr_accounting_coa_id := NULL;
199025 l_adr_flexfield_segment_code := NULL;
199026 l_adr_flex_value_set_id := NULL;
199027 l_adr_value_type_code := NULL;
199028 l_adr_value_combination_id := NULL;
199029 l_adr_value_segment_code := NULL;
199030
199031 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
199032 l_bflow_class_code := ''; -- 4219869 Business Flow
199033 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
199034 l_budgetary_control_flag := 'N';
199035
199036 l_bflow_applied_to_amt_idx := NULL; -- 5132302
199037 l_bflow_applied_to_amt := NULL; -- 5132302
199038 l_entered_amt_idx := NULL; -- 4262811
199039 l_accted_amt_idx := NULL; -- 4262811
199040 l_acc_rev_flag := NULL; -- 4262811
199041 l_accrual_line_num := NULL; -- 4262811
199042 l_tmp_amt := NULL; -- 4262811
199043 --
199044
199045 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
199046 l_balance_type_code <> 'B' THEN
199047 IF NVL(p_source_64,'
199048 ') = 'GENERAL FUND'
199049 THEN
199050
199051 --
199052 XLA_AE_LINES_PKG.SetNewLine;
199053
199054 p_balance_type_code := l_balance_type_code;
199055 -- set the flag so later we will know whether the gain loss line needs to be created
199056
199057 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
199058 p_actual_flag :='A';
199059 END IF;
199060
199061 --
199062 -- bulk performance
199063 --
199064 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
199065 p_header_num => 0); -- 4262811
199066 --
199067 -- set accounting line options
199068 --
199069 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
199070 p_natural_side_code => 'C'
199071 , p_gain_or_loss_flag => 'N'
199072 , p_gl_transfer_mode_code => 'S'
199073 , p_acct_entry_type_code => 'A'
199074 , p_switch_side_flag => 'Y'
199075 , p_merge_duplicate_code => 'N'
199076 );
199077 --
199078 l_acc_rev_natural_side_code := 'D'; -- 4262811
199079 --
199080 --
199081 -- set accounting line type info
199082 --
199083 xla_ae_lines_pkg.SetAcctLineType
199084 (p_component_type => l_component_type
199085 ,p_event_type_code => l_event_type_code
199086 ,p_line_definition_owner_code => l_line_definition_owner_code
199087 ,p_line_definition_code => l_line_definition_code
199088 ,p_accounting_line_code => l_component_code
199089 ,p_accounting_line_type_code => l_component_type_code
199090 ,p_accounting_line_appl_id => l_component_appl_id
199091 ,p_amb_context_code => l_amb_context_code
199092 ,p_entity_code => l_entity_code
199093 ,p_event_class_code => l_event_class_code);
199094 --
199095 -- set accounting class
199096 --
199097 xla_ae_lines_pkg.SetAcctClass(
199098 p_accounting_class_code => 'ASSET'
199099 , p_ae_header_id => l_ae_header_id
199100 );
199101
199102 --
199103 -- set rounding class
199104 --
199105 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
199106 'ASSET';
199107
199108 --
199109 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
199110 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
199111 --
199112 -- bulk performance
199113 --
199114 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
199115
199116 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
199117 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
199118
199119 -- 4955764
199120 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
199121 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
199122
199123 -- 4458381 Public Sector Enh
199124
199125 --
199126 -- set accounting attributes for the line type
199127 --
199128 l_entered_amt_idx := 4;
199129 l_accted_amt_idx := 6;
199130 l_bflow_applied_to_amt_idx := NULL; -- 5132302
199131 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
199132 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
199133 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
199134 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
199135 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
199139 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
199136 l_rec_acct_attrs.array_char_value(3) := p_source_51;
199137 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
199138 l_rec_acct_attrs.array_num_value(4) := p_source_65;
199140 l_rec_acct_attrs.array_char_value(5) := p_source_66;
199141 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
199142 l_rec_acct_attrs.array_num_value(6) := p_source_65;
199143
199144 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
199145 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
199146
199147 ---------------------------------------------------------------------------------------------------------------
199148 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
199149 ---------------------------------------------------------------------------------------------------------------
199150 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
199151
199152 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
199153 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
199154
199155 IF xla_accounting_cache_pkg.GetValueChar
199156 (p_source_code => 'LEDGER_CATEGORY_CODE'
199157 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
199158 AND l_bflow_method_code = 'PRIOR_ENTRY'
199159 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
199160 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
199161 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
199162 )
199163 THEN
199164 xla_ae_lines_pkg.BflowUpgEntry
199165 (p_business_method_code => l_bflow_method_code
199166 ,p_business_class_code => l_bflow_class_code
199167 ,p_balance_type => l_balance_type_code);
199168 ELSE
199169 NULL;
199170 -- No business flow processing for business flow method of NONE.
199171 END IF;
199172
199173 --
199174 -- call analytical criteria
199175 --
199176
199177 --
199178 -- call description
199179 --
199180
199181 xla_ae_lines_pkg.SetLineDescription(
199182 p_ae_header_id => l_ae_header_id
199183 ,p_description => Description_143 (
199184 p_application_id => p_application_id
199185 , p_ae_header_id => l_ae_header_id
199186 , p_source_2 => p_source_2
199187 , p_source_3 => p_source_3
199188 )
199189 );
199190
199191
199192 --
199193 -- call ADRs
199194 -- Bug 4922099
199195 --
199196 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
199197 (NVL(l_actual_upg_option, 'N') = 'O') OR
199198 (NVL(l_enc_upg_option, 'N') = 'O')
199199 )
199200 THEN
199201 NULL;
199202 --
199203 --
199204
199205 l_ccid := AcctDerRule_186(
199206 p_application_id => p_application_id
199207 , p_ae_header_id => l_ae_header_id
199208 , p_source_41 => p_source_41
199209 , x_transaction_coa_id => l_adr_transaction_coa_id
199210 , x_accounting_coa_id => l_adr_accounting_coa_id
199211 , x_value_type_code => l_adr_value_type_code
199212 , p_side => 'NA'
199213 );
199214
199215 xla_ae_lines_pkg.set_ccid(
199216 p_code_combination_id => l_ccid
199217 , p_value_type_code => l_adr_value_type_code
199218 , p_transaction_coa_id => l_adr_transaction_coa_id
199219 , p_accounting_coa_id => l_adr_accounting_coa_id
199220 , p_adr_code => 'IAC_GENERAL_FUND_AC'
199221 , p_adr_type_code => 'S'
199222 , p_component_type => l_component_type
199223 , p_component_code => l_component_code
199224 , p_component_type_code => l_component_type_code
199225 , p_component_appl_id => l_component_appl_id
199226 , p_amb_context_code => l_amb_context_code
199227 , p_side => 'NA'
199228 );
199229
199230
199231 --
199232 --
199233 END IF;
199234 --
199235 -- Bug 4922099
199236 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
199237 (NVL(l_enc_upg_option, 'N') = 'O')
199238 ) AND
199239 (l_bflow_method_code = 'PRIOR_ENTRY')
199240 )
199241 THEN
199242 IF
199243 --
199244 1 = 2
199245 --
199246 THEN
199247 xla_accounting_err_pkg.build_message
199248 (p_appli_s_name => 'XLA'
199249 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
199250 ,p_token_1 => 'LINE_NUMBER'
199251 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
199252 ,p_token_2 => 'LINE_TYPE_NAME'
199253 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
199254 l_component_type
199255 ,l_component_code
199259 ,l_entity_code
199256 ,l_component_type_code
199257 ,l_component_appl_id
199258 ,l_amb_context_code
199260 ,l_event_class_code
199261 )
199262 ,p_token_3 => 'OWNER'
199263 ,p_value_3 => xla_lookups_pkg.get_meaning(
199264 p_lookup_type => 'XLA_OWNER_TYPE'
199265 ,p_lookup_code => l_component_type_code
199266 )
199267 ,p_token_4 => 'PRODUCT_NAME'
199268 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
199269 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
199270 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
199271 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
199272 ,p_ae_header_id => NULL
199273 );
199274
199275 IF (C_LEVEL_ERROR>= g_log_level) THEN
199276 trace
199277 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
199278 ,p_level => C_LEVEL_ERROR
199279 ,p_module => l_log_module);
199280 END IF;
199281 END IF;
199282 END IF;
199283 --
199284 --
199285 ------------------------------------------------------------------------------------------------
199286 -- 4219869 Business Flow
199287 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
199288 -- Prior Entry. Currently, the following code is always generated.
199289 ------------------------------------------------------------------------------------------------
199290 XLA_AE_LINES_PKG.ValidateCurrentLine;
199291
199292 ------------------------------------------------------------------------------------
199293 -- 4219869 Business Flow
199294 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
199295 ------------------------------------------------------------------------------------
199296 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
199297
199298 ----------------------------------------------------------------------------------
199299 -- 4219869 Business Flow
199300 -- Update journal entry status -- Need to generate this within IF <condition>
199301 ----------------------------------------------------------------------------------
199302 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
199303 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
199304 ,p_balance_type_code => l_balance_type_code
199305 );
199306
199307 -------------------------------------------------------------------------------------------
199308 -- 4262811 - Generate the Accrual Reversal lines
199309 -------------------------------------------------------------------------------------------
199310 BEGIN
199311 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
199312 (g_array_event(p_event_id).array_value_num('header_index'));
199313 IF l_acc_rev_flag IS NULL THEN
199314 l_acc_rev_flag := 'N';
199315 END IF;
199316 EXCEPTION
199317 WHEN OTHERS THEN
199318 l_acc_rev_flag := 'N';
199319 END;
199320 --
199321 IF (l_acc_rev_flag = 'Y') THEN
199322
199323 -- 4645092 ------------------------------------------------------------------------------
199324 -- To allow MPA report to determine if it should generate report process
199325 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
199326 ------------------------------------------------------------------------------------------
199327
199328 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
199329 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
199330 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
199331 -- call ADRs
199332 -- Bug 4922099
199333 --
199334 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
199335 (NVL(l_actual_upg_option, 'N') = 'O') OR
199336 (NVL(l_enc_upg_option, 'N') = 'O')
199337 )
199338 THEN
199339 NULL;
199340 --
199341 --
199342
199343 l_ccid := AcctDerRule_186(
199344 p_application_id => p_application_id
199345 , p_ae_header_id => l_ae_header_id
199346 , p_source_41 => p_source_41
199347 , x_transaction_coa_id => l_adr_transaction_coa_id
199348 , x_accounting_coa_id => l_adr_accounting_coa_id
199349 , x_value_type_code => l_adr_value_type_code
199350 , p_side => 'NA'
199351 );
199352
199353 xla_ae_lines_pkg.set_ccid(
199354 p_code_combination_id => l_ccid
199358 , p_adr_code => 'IAC_GENERAL_FUND_AC'
199355 , p_value_type_code => l_adr_value_type_code
199356 , p_transaction_coa_id => l_adr_transaction_coa_id
199357 , p_accounting_coa_id => l_adr_accounting_coa_id
199359 , p_adr_type_code => 'S'
199360 , p_component_type => l_component_type
199361 , p_component_code => l_component_code
199362 , p_component_type_code => l_component_type_code
199363 , p_component_appl_id => l_component_appl_id
199364 , p_amb_context_code => l_amb_context_code
199365 , p_side => 'NA'
199366 );
199367
199368
199369 --
199370 --
199371 END IF;
199372
199373 --
199374 -- Update the line information that should be overwritten
199375 --
199376 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
199377 p_header_num => 1);
199378 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
199379
199380 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
199381
199382 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
199383 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
199384 END IF;
199385
199386 --
199387 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
199388 --
199389 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
199390 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
199391 ELSE
199392 ---------------------------------------------------------------------------------------------------
199393 -- 4262811a Switch Sign
199394 ---------------------------------------------------------------------------------------------------
199395 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
199396 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
199397 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
199398 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
199399 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
199400 -- 5132302
199401 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
199402 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
199403
199404 END IF;
199405
199406 -- 4955764
199407 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
199408 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
199409
199410
199411 XLA_AE_LINES_PKG.ValidateCurrentLine;
199412 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
199413
199414 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
199415 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
199416 ,p_balance_type_code => l_balance_type_code);
199417
199418 END IF;
199419
199420 -----------------------------------------------------------------------------------------
199421 -- 4262811 Multiperiod Accounting
199422 -----------------------------------------------------------------------------------------
199423 -- No MPA option is assigned.
199424
199425
199426 END IF;
199427 END IF;
199428 --
199429
199430 --
199431 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
199432 trace
199433 (p_msg => 'END of AcctLineType_452'
199434 ,p_level => C_LEVEL_PROCEDURE
199435 ,p_module => l_log_module);
199436 END IF;
199437 --
199438 EXCEPTION
199439 WHEN xla_exceptions_pkg.application_exception THEN
199440 RAISE;
199441 WHEN OTHERS THEN
199442 xla_exceptions_pkg.raise_message
199443 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_452');
199444 END AcctLineType_452;
199445 --
199446
199447 ---------------------------------------
199448 --
199449 -- PRIVATE FUNCTION
199450 -- AcctLineType_453
199451 --
199452 ---------------------------------------
199453 PROCEDURE AcctLineType_453 (
199454 p_application_id IN NUMBER
199455 ,p_event_id IN NUMBER
199456 ,p_calculate_acctd_flag IN VARCHAR2
199457 ,p_calculate_g_l_flag IN VARCHAR2
199458 ,p_actual_flag IN OUT VARCHAR2
199459 ,p_balance_type_code OUT VARCHAR2
199460 ,p_gain_or_loss_ref OUT VARCHAR2
199461
199462 --Inflation Adjustment Type Description
199463 , p_source_2 IN VARCHAR2
199464 --Accounting Date
199465 , p_source_3 IN DATE
199466 --Inflation General Fund Ccid
199467 , p_source_41 IN NUMBER
199468 --Transaction Header Identifier
199469 , p_source_49 IN NUMBER
199470 --Adjustment Line Identifier
199471 , p_source_50 IN NUMBER
199472 --Distribution Type Code
199473 , p_source_51 IN VARCHAR2
199474 --Inflation Adjustment Type
199475 , p_source_64 IN VARCHAR2
199479 , p_source_66 IN VARCHAR2
199476 --Inflation Entered Amount
199477 , p_source_65 IN NUMBER
199478 --Inflation Currency Code
199480 )
199481 IS
199482
199483 l_component_type VARCHAR2(80);
199484 l_component_code VARCHAR2(30);
199485 l_component_type_code VARCHAR2(1);
199486 l_component_appl_id INTEGER;
199487 l_amb_context_code VARCHAR2(30);
199488 l_entity_code VARCHAR2(30);
199489 l_event_class_code VARCHAR2(30);
199490 l_ae_header_id NUMBER;
199491 l_event_type_code VARCHAR2(30);
199492 l_line_definition_code VARCHAR2(30);
199493 l_line_definition_owner_code VARCHAR2(1);
199494 --
199495 -- adr variables
199496 l_segment VARCHAR2(30);
199497 l_ccid NUMBER;
199498 l_adr_transaction_coa_id NUMBER;
199499 l_adr_accounting_coa_id NUMBER;
199500 l_adr_flexfield_segment_code VARCHAR2(30);
199501 l_adr_flex_value_set_id NUMBER;
199502 l_adr_value_type_code VARCHAR2(30);
199503 l_adr_value_combination_id NUMBER;
199504 l_adr_value_segment_code VARCHAR2(30);
199505
199506 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
199507 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
199508 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
199509 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
199510
199511 -- 4262811 Variables ------------------------------------------------------------------------------------------
199512 l_entered_amt_idx NUMBER;
199513 l_accted_amt_idx NUMBER;
199514 l_acc_rev_flag VARCHAR2(1);
199515 l_accrual_line_num NUMBER;
199516 l_tmp_amt NUMBER;
199517 l_acc_rev_natural_side_code VARCHAR2(1);
199518
199519 l_num_entries NUMBER;
199520 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
199521 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
199522 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
199523 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
199524 l_recog_line_1 NUMBER;
199525 l_recog_line_2 NUMBER;
199526
199527 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
199528 l_bflow_applied_to_amt NUMBER; -- 5132302
199529 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
199530
199531 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
199532
199533 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
199534 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
199535
199536 ---------------------------------------------------------------------------------------------------------------
199537
199538
199539 --
199540 -- bulk performance
199541 --
199542 l_balance_type_code VARCHAR2(1);
199543 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
199544 l_log_module VARCHAR2(240);
199545
199546 --
199547 -- Upgrade strategy
199548 --
199549 l_actual_upg_option VARCHAR2(1);
199550 l_enc_upg_option VARCHAR2(1);
199551
199552 --
199553 BEGIN
199554 --
199555 IF g_log_enabled THEN
199556 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_453';
199557 END IF;
199558 --
199559 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
199560
199561 trace
199562 (p_msg => 'BEGIN of AcctLineType_453'
199563 ,p_level => C_LEVEL_PROCEDURE
199564 ,p_module => l_log_module);
199565
199566 END IF;
199567 --
199568 l_component_type := 'AMB_JLT';
199569 l_component_code := 'IAC_GENERAL_FUND';
199570 l_component_type_code := 'S';
199571 l_component_appl_id := 140;
199572 l_amb_context_code := 'DEFAULT';
199573 l_entity_code := 'TRANSACTIONS';
199574 l_event_class_code := 'RETIREMENTS';
199575 l_event_type_code := 'RETIREMENTS';
199576 l_line_definition_owner_code := 'S';
199577 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
199578 --
199579 l_balance_type_code := 'A';
199580 l_segment := NULL;
199581 l_ccid := NULL;
199582 l_adr_transaction_coa_id := NULL;
199583 l_adr_accounting_coa_id := NULL;
199584 l_adr_flexfield_segment_code := NULL;
199585 l_adr_flex_value_set_id := NULL;
199586 l_adr_value_type_code := NULL;
199587 l_adr_value_combination_id := NULL;
199588 l_adr_value_segment_code := NULL;
199589
199590 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
199591 l_bflow_class_code := ''; -- 4219869 Business Flow
199592 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
199593 l_budgetary_control_flag := 'N';
199594
199595 l_bflow_applied_to_amt_idx := NULL; -- 5132302
199596 l_bflow_applied_to_amt := NULL; -- 5132302
199597 l_entered_amt_idx := NULL; -- 4262811
199598 l_accted_amt_idx := NULL; -- 4262811
199599 l_acc_rev_flag := NULL; -- 4262811
199600 l_accrual_line_num := NULL; -- 4262811
199601 l_tmp_amt := NULL; -- 4262811
199602 --
199606 IF NVL(p_source_64,'
199603
199604 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
199605 l_balance_type_code <> 'B' THEN
199607 ') = 'GENERAL FUND'
199608 THEN
199609
199610 --
199611 XLA_AE_LINES_PKG.SetNewLine;
199612
199613 p_balance_type_code := l_balance_type_code;
199614 -- set the flag so later we will know whether the gain loss line needs to be created
199615
199616 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
199617 p_actual_flag :='A';
199618 END IF;
199619
199620 --
199621 -- bulk performance
199622 --
199623 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
199624 p_header_num => 0); -- 4262811
199625 --
199626 -- set accounting line options
199627 --
199628 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
199629 p_natural_side_code => 'C'
199630 , p_gain_or_loss_flag => 'N'
199631 , p_gl_transfer_mode_code => 'S'
199632 , p_acct_entry_type_code => 'A'
199633 , p_switch_side_flag => 'Y'
199634 , p_merge_duplicate_code => 'N'
199635 );
199636 --
199637 l_acc_rev_natural_side_code := 'D'; -- 4262811
199638 --
199639 --
199640 -- set accounting line type info
199641 --
199642 xla_ae_lines_pkg.SetAcctLineType
199643 (p_component_type => l_component_type
199644 ,p_event_type_code => l_event_type_code
199645 ,p_line_definition_owner_code => l_line_definition_owner_code
199646 ,p_line_definition_code => l_line_definition_code
199647 ,p_accounting_line_code => l_component_code
199648 ,p_accounting_line_type_code => l_component_type_code
199649 ,p_accounting_line_appl_id => l_component_appl_id
199650 ,p_amb_context_code => l_amb_context_code
199651 ,p_entity_code => l_entity_code
199652 ,p_event_class_code => l_event_class_code);
199653 --
199654 -- set accounting class
199655 --
199656 xla_ae_lines_pkg.SetAcctClass(
199657 p_accounting_class_code => 'ASSET'
199658 , p_ae_header_id => l_ae_header_id
199659 );
199660
199661 --
199662 -- set rounding class
199663 --
199664 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
199665 'ASSET';
199666
199667 --
199668 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
199669 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
199670 --
199671 -- bulk performance
199672 --
199673 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
199674
199675 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
199676 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
199677
199678 -- 4955764
199679 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
199680 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
199681
199682 -- 4458381 Public Sector Enh
199683
199684 --
199685 -- set accounting attributes for the line type
199686 --
199687 l_entered_amt_idx := 4;
199688 l_accted_amt_idx := 6;
199689 l_bflow_applied_to_amt_idx := NULL; -- 5132302
199690 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
199691 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
199692 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
199693 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
199694 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
199695 l_rec_acct_attrs.array_char_value(3) := p_source_51;
199696 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
199697 l_rec_acct_attrs.array_num_value(4) := p_source_65;
199698 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
199699 l_rec_acct_attrs.array_char_value(5) := p_source_66;
199700 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
199701 l_rec_acct_attrs.array_num_value(6) := p_source_65;
199702
199703 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
199704 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
199705
199706 ---------------------------------------------------------------------------------------------------------------
199707 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
199708 ---------------------------------------------------------------------------------------------------------------
199709 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
199710
199711 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
199712 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
199713
199714 IF xla_accounting_cache_pkg.GetValueChar
199715 (p_source_code => 'LEDGER_CATEGORY_CODE'
199716 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
199717 AND l_bflow_method_code = 'PRIOR_ENTRY'
199721 )
199718 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
199719 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
199720 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
199722 THEN
199723 xla_ae_lines_pkg.BflowUpgEntry
199724 (p_business_method_code => l_bflow_method_code
199725 ,p_business_class_code => l_bflow_class_code
199726 ,p_balance_type => l_balance_type_code);
199727 ELSE
199728 NULL;
199729 -- No business flow processing for business flow method of NONE.
199730 END IF;
199731
199732 --
199733 -- call analytical criteria
199734 --
199735
199736 --
199737 -- call description
199738 --
199739
199740 xla_ae_lines_pkg.SetLineDescription(
199741 p_ae_header_id => l_ae_header_id
199742 ,p_description => Description_143 (
199743 p_application_id => p_application_id
199744 , p_ae_header_id => l_ae_header_id
199745 , p_source_2 => p_source_2
199746 , p_source_3 => p_source_3
199747 )
199748 );
199749
199750
199751 --
199752 -- call ADRs
199753 -- Bug 4922099
199754 --
199755 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
199756 (NVL(l_actual_upg_option, 'N') = 'O') OR
199757 (NVL(l_enc_upg_option, 'N') = 'O')
199758 )
199759 THEN
199760 NULL;
199761 --
199762 --
199763
199764 l_ccid := AcctDerRule_186(
199765 p_application_id => p_application_id
199766 , p_ae_header_id => l_ae_header_id
199767 , p_source_41 => p_source_41
199768 , x_transaction_coa_id => l_adr_transaction_coa_id
199769 , x_accounting_coa_id => l_adr_accounting_coa_id
199770 , x_value_type_code => l_adr_value_type_code
199771 , p_side => 'NA'
199772 );
199773
199774 xla_ae_lines_pkg.set_ccid(
199775 p_code_combination_id => l_ccid
199776 , p_value_type_code => l_adr_value_type_code
199777 , p_transaction_coa_id => l_adr_transaction_coa_id
199778 , p_accounting_coa_id => l_adr_accounting_coa_id
199779 , p_adr_code => 'IAC_GENERAL_FUND_AC'
199780 , p_adr_type_code => 'S'
199781 , p_component_type => l_component_type
199782 , p_component_code => l_component_code
199783 , p_component_type_code => l_component_type_code
199784 , p_component_appl_id => l_component_appl_id
199785 , p_amb_context_code => l_amb_context_code
199786 , p_side => 'NA'
199787 );
199788
199789
199790 --
199791 --
199792 END IF;
199793 --
199794 -- Bug 4922099
199795 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
199796 (NVL(l_enc_upg_option, 'N') = 'O')
199797 ) AND
199798 (l_bflow_method_code = 'PRIOR_ENTRY')
199799 )
199800 THEN
199801 IF
199802 --
199803 1 = 2
199804 --
199805 THEN
199806 xla_accounting_err_pkg.build_message
199807 (p_appli_s_name => 'XLA'
199808 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
199809 ,p_token_1 => 'LINE_NUMBER'
199810 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
199811 ,p_token_2 => 'LINE_TYPE_NAME'
199812 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
199813 l_component_type
199814 ,l_component_code
199815 ,l_component_type_code
199816 ,l_component_appl_id
199817 ,l_amb_context_code
199818 ,l_entity_code
199819 ,l_event_class_code
199820 )
199821 ,p_token_3 => 'OWNER'
199822 ,p_value_3 => xla_lookups_pkg.get_meaning(
199823 p_lookup_type => 'XLA_OWNER_TYPE'
199824 ,p_lookup_code => l_component_type_code
199825 )
199826 ,p_token_4 => 'PRODUCT_NAME'
199827 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
199828 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
199829 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
199830 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
199831 ,p_ae_header_id => NULL
199832 );
199836 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
199833
199834 IF (C_LEVEL_ERROR>= g_log_level) THEN
199835 trace
199837 ,p_level => C_LEVEL_ERROR
199838 ,p_module => l_log_module);
199839 END IF;
199840 END IF;
199841 END IF;
199842 --
199843 --
199844 ------------------------------------------------------------------------------------------------
199845 -- 4219869 Business Flow
199846 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
199847 -- Prior Entry. Currently, the following code is always generated.
199848 ------------------------------------------------------------------------------------------------
199849 XLA_AE_LINES_PKG.ValidateCurrentLine;
199850
199851 ------------------------------------------------------------------------------------
199852 -- 4219869 Business Flow
199853 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
199854 ------------------------------------------------------------------------------------
199855 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
199856
199857 ----------------------------------------------------------------------------------
199858 -- 4219869 Business Flow
199859 -- Update journal entry status -- Need to generate this within IF <condition>
199860 ----------------------------------------------------------------------------------
199861 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
199862 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
199863 ,p_balance_type_code => l_balance_type_code
199864 );
199865
199866 -------------------------------------------------------------------------------------------
199867 -- 4262811 - Generate the Accrual Reversal lines
199868 -------------------------------------------------------------------------------------------
199869 BEGIN
199870 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
199871 (g_array_event(p_event_id).array_value_num('header_index'));
199872 IF l_acc_rev_flag IS NULL THEN
199873 l_acc_rev_flag := 'N';
199874 END IF;
199875 EXCEPTION
199876 WHEN OTHERS THEN
199877 l_acc_rev_flag := 'N';
199878 END;
199879 --
199880 IF (l_acc_rev_flag = 'Y') THEN
199881
199882 -- 4645092 ------------------------------------------------------------------------------
199883 -- To allow MPA report to determine if it should generate report process
199884 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
199885 ------------------------------------------------------------------------------------------
199886
199887 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
199888 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
199889 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
199890 -- call ADRs
199891 -- Bug 4922099
199892 --
199893 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
199894 (NVL(l_actual_upg_option, 'N') = 'O') OR
199895 (NVL(l_enc_upg_option, 'N') = 'O')
199896 )
199897 THEN
199898 NULL;
199899 --
199900 --
199901
199902 l_ccid := AcctDerRule_186(
199903 p_application_id => p_application_id
199904 , p_ae_header_id => l_ae_header_id
199905 , p_source_41 => p_source_41
199906 , x_transaction_coa_id => l_adr_transaction_coa_id
199907 , x_accounting_coa_id => l_adr_accounting_coa_id
199908 , x_value_type_code => l_adr_value_type_code
199909 , p_side => 'NA'
199910 );
199911
199912 xla_ae_lines_pkg.set_ccid(
199913 p_code_combination_id => l_ccid
199914 , p_value_type_code => l_adr_value_type_code
199915 , p_transaction_coa_id => l_adr_transaction_coa_id
199916 , p_accounting_coa_id => l_adr_accounting_coa_id
199917 , p_adr_code => 'IAC_GENERAL_FUND_AC'
199918 , p_adr_type_code => 'S'
199919 , p_component_type => l_component_type
199920 , p_component_code => l_component_code
199921 , p_component_type_code => l_component_type_code
199922 , p_component_appl_id => l_component_appl_id
199923 , p_amb_context_code => l_amb_context_code
199924 , p_side => 'NA'
199925 );
199926
199927
199928 --
199929 --
199930 END IF;
199931
199932 --
199933 -- Update the line information that should be overwritten
199934 --
199935 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
199936 p_header_num => 1);
199937 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
199938
199939 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
199940
199941 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
199942 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
199943 END IF;
199944
199945 --
199946 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
199947 --
199951 ---------------------------------------------------------------------------------------------------
199948 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
199949 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
199950 ELSE
199952 -- 4262811a Switch Sign
199953 ---------------------------------------------------------------------------------------------------
199954 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
199955 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
199956 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
199957 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
199958 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
199959 -- 5132302
199960 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
199961 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
199962
199963 END IF;
199964
199965 -- 4955764
199966 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
199967 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
199968
199969
199970 XLA_AE_LINES_PKG.ValidateCurrentLine;
199971 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
199972
199973 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
199974 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
199975 ,p_balance_type_code => l_balance_type_code);
199976
199977 END IF;
199978
199979 -----------------------------------------------------------------------------------------
199980 -- 4262811 Multiperiod Accounting
199981 -----------------------------------------------------------------------------------------
199982 -- No MPA option is assigned.
199983
199984
199985 END IF;
199986 END IF;
199987 --
199988
199989 --
199990 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
199991 trace
199992 (p_msg => 'END of AcctLineType_453'
199993 ,p_level => C_LEVEL_PROCEDURE
199994 ,p_module => l_log_module);
199995 END IF;
199996 --
199997 EXCEPTION
199998 WHEN xla_exceptions_pkg.application_exception THEN
199999 RAISE;
200000 WHEN OTHERS THEN
200001 xla_exceptions_pkg.raise_message
200002 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_453');
200003 END AcctLineType_453;
200004 --
200005
200006 ---------------------------------------
200007 --
200008 -- PRIVATE FUNCTION
200009 -- AcctLineType_454
200010 --
200011 ---------------------------------------
200012 PROCEDURE AcctLineType_454 (
200013 p_application_id IN NUMBER
200014 ,p_event_id IN NUMBER
200015 ,p_calculate_acctd_flag IN VARCHAR2
200016 ,p_calculate_g_l_flag IN VARCHAR2
200017 ,p_actual_flag IN OUT VARCHAR2
200018 ,p_balance_type_code OUT VARCHAR2
200019 ,p_gain_or_loss_ref OUT VARCHAR2
200020
200021 --Inflation Adjustment Type Description
200022 , p_source_2 IN VARCHAR2
200023 --Accounting Date
200024 , p_source_3 IN DATE
200025 --Inflation General Fund Ccid
200026 , p_source_41 IN NUMBER
200027 --Distribution Type Code
200028 , p_source_51 IN VARCHAR2
200029 --Inflation Adjustment Type
200030 , p_source_64 IN VARCHAR2
200031 --Inflation Entered Amount
200032 , p_source_65 IN NUMBER
200033 --Inflation Currency Code
200034 , p_source_66 IN VARCHAR2
200035 --Inflation Adjustment Identifier
200036 , p_source_67 IN NUMBER
200037 --Inflation Asset Identifier
200038 , p_source_68 IN NUMBER
200039 --Inflation Asset Distribution Identifier
200040 , p_source_69 IN NUMBER
200041 --Inflation Adjustment Line Identifier
200042 , p_source_70 IN NUMBER
200043 )
200044 IS
200045
200046 l_component_type VARCHAR2(80);
200047 l_component_code VARCHAR2(30);
200048 l_component_type_code VARCHAR2(1);
200049 l_component_appl_id INTEGER;
200050 l_amb_context_code VARCHAR2(30);
200051 l_entity_code VARCHAR2(30);
200052 l_event_class_code VARCHAR2(30);
200053 l_ae_header_id NUMBER;
200054 l_event_type_code VARCHAR2(30);
200055 l_line_definition_code VARCHAR2(30);
200056 l_line_definition_owner_code VARCHAR2(1);
200057 --
200058 -- adr variables
200059 l_segment VARCHAR2(30);
200060 l_ccid NUMBER;
200061 l_adr_transaction_coa_id NUMBER;
200062 l_adr_accounting_coa_id NUMBER;
200063 l_adr_flexfield_segment_code VARCHAR2(30);
200064 l_adr_flex_value_set_id NUMBER;
200065 l_adr_value_type_code VARCHAR2(30);
200066 l_adr_value_combination_id NUMBER;
200067 l_adr_value_segment_code VARCHAR2(30);
200068
200069 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
200070 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
200071 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
200075 l_entered_amt_idx NUMBER;
200072 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
200073
200074 -- 4262811 Variables ------------------------------------------------------------------------------------------
200076 l_accted_amt_idx NUMBER;
200077 l_acc_rev_flag VARCHAR2(1);
200078 l_accrual_line_num NUMBER;
200079 l_tmp_amt NUMBER;
200080 l_acc_rev_natural_side_code VARCHAR2(1);
200081
200082 l_num_entries NUMBER;
200083 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
200084 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
200085 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
200086 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
200087 l_recog_line_1 NUMBER;
200088 l_recog_line_2 NUMBER;
200089
200090 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
200091 l_bflow_applied_to_amt NUMBER; -- 5132302
200092 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
200093
200094 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
200095
200096 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
200097 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
200098
200099 ---------------------------------------------------------------------------------------------------------------
200100
200101
200102 --
200103 -- bulk performance
200104 --
200105 l_balance_type_code VARCHAR2(1);
200106 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
200107 l_log_module VARCHAR2(240);
200108
200109 --
200110 -- Upgrade strategy
200111 --
200112 l_actual_upg_option VARCHAR2(1);
200113 l_enc_upg_option VARCHAR2(1);
200114
200115 --
200116 BEGIN
200117 --
200118 IF g_log_enabled THEN
200119 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_454';
200120 END IF;
200121 --
200122 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
200123
200124 trace
200125 (p_msg => 'BEGIN of AcctLineType_454'
200126 ,p_level => C_LEVEL_PROCEDURE
200127 ,p_module => l_log_module);
200128
200129 END IF;
200130 --
200131 l_component_type := 'AMB_JLT';
200132 l_component_code := 'IAC_GENERAL_FUND';
200133 l_component_type_code := 'S';
200134 l_component_appl_id := 140;
200135 l_amb_context_code := 'DEFAULT';
200136 l_entity_code := 'TRANSACTIONS';
200137 l_event_class_code := 'INFLATION_REVALUATION';
200138 l_event_type_code := 'INFLATION_REVALUATION_ALL';
200139 l_line_definition_owner_code := 'S';
200140 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
200141 --
200142 l_balance_type_code := 'A';
200143 l_segment := NULL;
200144 l_ccid := NULL;
200145 l_adr_transaction_coa_id := NULL;
200146 l_adr_accounting_coa_id := NULL;
200147 l_adr_flexfield_segment_code := NULL;
200148 l_adr_flex_value_set_id := NULL;
200149 l_adr_value_type_code := NULL;
200150 l_adr_value_combination_id := NULL;
200151 l_adr_value_segment_code := NULL;
200152
200153 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
200154 l_bflow_class_code := ''; -- 4219869 Business Flow
200155 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
200156 l_budgetary_control_flag := 'N';
200157
200158 l_bflow_applied_to_amt_idx := NULL; -- 5132302
200159 l_bflow_applied_to_amt := NULL; -- 5132302
200160 l_entered_amt_idx := NULL; -- 4262811
200161 l_accted_amt_idx := NULL; -- 4262811
200162 l_acc_rev_flag := NULL; -- 4262811
200163 l_accrual_line_num := NULL; -- 4262811
200164 l_tmp_amt := NULL; -- 4262811
200165 --
200166
200167 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
200168 l_balance_type_code <> 'B' THEN
200169 IF NVL(p_source_64,'
200170 ') = 'GENERAL FUND'
200171 THEN
200172
200173 --
200174 XLA_AE_LINES_PKG.SetNewLine;
200175
200176 p_balance_type_code := l_balance_type_code;
200177 -- set the flag so later we will know whether the gain loss line needs to be created
200178
200179 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
200180 p_actual_flag :='A';
200181 END IF;
200182
200183 --
200184 -- bulk performance
200185 --
200186 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
200187 p_header_num => 0); -- 4262811
200188 --
200189 -- set accounting line options
200190 --
200191 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
200192 p_natural_side_code => 'C'
200193 , p_gain_or_loss_flag => 'N'
200194 , p_gl_transfer_mode_code => 'S'
200195 , p_acct_entry_type_code => 'A'
200196 , p_switch_side_flag => 'Y'
200197 , p_merge_duplicate_code => 'N'
200198 );
200199 --
200200 l_acc_rev_natural_side_code := 'D'; -- 4262811
200201 --
200202 --
200206 (p_component_type => l_component_type
200203 -- set accounting line type info
200204 --
200205 xla_ae_lines_pkg.SetAcctLineType
200207 ,p_event_type_code => l_event_type_code
200208 ,p_line_definition_owner_code => l_line_definition_owner_code
200209 ,p_line_definition_code => l_line_definition_code
200210 ,p_accounting_line_code => l_component_code
200211 ,p_accounting_line_type_code => l_component_type_code
200212 ,p_accounting_line_appl_id => l_component_appl_id
200213 ,p_amb_context_code => l_amb_context_code
200214 ,p_entity_code => l_entity_code
200215 ,p_event_class_code => l_event_class_code);
200216 --
200217 -- set accounting class
200218 --
200219 xla_ae_lines_pkg.SetAcctClass(
200220 p_accounting_class_code => 'ASSET'
200221 , p_ae_header_id => l_ae_header_id
200222 );
200223
200224 --
200225 -- set rounding class
200226 --
200227 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
200228 'ASSET';
200229
200230 --
200231 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
200232 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
200233 --
200234 -- bulk performance
200235 --
200236 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
200237
200238 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
200239 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
200240
200241 -- 4955764
200242 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
200243 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
200244
200245 -- 4458381 Public Sector Enh
200246
200247 --
200248 -- set accounting attributes for the line type
200249 --
200250 l_entered_amt_idx := 6;
200251 l_accted_amt_idx := 8;
200252 l_bflow_applied_to_amt_idx := NULL; -- 5132302
200253 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
200254 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_67);
200255 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
200256 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_68);
200257 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
200258 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_69);
200259 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
200260 l_rec_acct_attrs.array_num_value(4) := to_char(p_source_70);
200261 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_TYPE';
200262 l_rec_acct_attrs.array_char_value(5) := p_source_51;
200263 l_rec_acct_attrs.array_acct_attr_code(6) := 'ENTERED_CURRENCY_AMOUNT';
200264 l_rec_acct_attrs.array_num_value(6) := p_source_65;
200265 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_CODE';
200266 l_rec_acct_attrs.array_char_value(7) := p_source_66;
200267 l_rec_acct_attrs.array_acct_attr_code(8) := 'LEDGER_AMOUNT';
200268 l_rec_acct_attrs.array_num_value(8) := p_source_65;
200269
200270 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
200271 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
200272
200273 ---------------------------------------------------------------------------------------------------------------
200274 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
200275 ---------------------------------------------------------------------------------------------------------------
200276 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
200277
200278 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
200279 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
200280
200281 IF xla_accounting_cache_pkg.GetValueChar
200282 (p_source_code => 'LEDGER_CATEGORY_CODE'
200283 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
200284 AND l_bflow_method_code = 'PRIOR_ENTRY'
200285 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
200286 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
200287 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
200288 )
200289 THEN
200290 xla_ae_lines_pkg.BflowUpgEntry
200291 (p_business_method_code => l_bflow_method_code
200292 ,p_business_class_code => l_bflow_class_code
200293 ,p_balance_type => l_balance_type_code);
200294 ELSE
200295 NULL;
200296 -- No business flow processing for business flow method of NONE.
200297 END IF;
200298
200299 --
200300 -- call analytical criteria
200301 --
200302
200303 --
200304 -- call description
200305 --
200306
200307 xla_ae_lines_pkg.SetLineDescription(
200308 p_ae_header_id => l_ae_header_id
200309 ,p_description => Description_143 (
200310 p_application_id => p_application_id
200311 , p_ae_header_id => l_ae_header_id
200312 , p_source_2 => p_source_2
200313 , p_source_3 => p_source_3
200314 )
200315 );
200316
200317
200318 --
200322 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
200319 -- call ADRs
200320 -- Bug 4922099
200321 --
200323 (NVL(l_actual_upg_option, 'N') = 'O') OR
200324 (NVL(l_enc_upg_option, 'N') = 'O')
200325 )
200326 THEN
200327 NULL;
200328 --
200329 --
200330
200331 l_ccid := AcctDerRule_186(
200332 p_application_id => p_application_id
200333 , p_ae_header_id => l_ae_header_id
200334 , p_source_41 => p_source_41
200335 , x_transaction_coa_id => l_adr_transaction_coa_id
200336 , x_accounting_coa_id => l_adr_accounting_coa_id
200337 , x_value_type_code => l_adr_value_type_code
200338 , p_side => 'NA'
200339 );
200340
200341 xla_ae_lines_pkg.set_ccid(
200342 p_code_combination_id => l_ccid
200343 , p_value_type_code => l_adr_value_type_code
200344 , p_transaction_coa_id => l_adr_transaction_coa_id
200345 , p_accounting_coa_id => l_adr_accounting_coa_id
200346 , p_adr_code => 'IAC_GENERAL_FUND_AC'
200347 , p_adr_type_code => 'S'
200348 , p_component_type => l_component_type
200349 , p_component_code => l_component_code
200350 , p_component_type_code => l_component_type_code
200351 , p_component_appl_id => l_component_appl_id
200352 , p_amb_context_code => l_amb_context_code
200353 , p_side => 'NA'
200354 );
200355
200356
200357 --
200358 --
200359 END IF;
200360 --
200361 -- Bug 4922099
200362 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
200363 (NVL(l_enc_upg_option, 'N') = 'O')
200364 ) AND
200365 (l_bflow_method_code = 'PRIOR_ENTRY')
200366 )
200367 THEN
200368 IF
200369 --
200370 1 = 2
200371 --
200372 THEN
200373 xla_accounting_err_pkg.build_message
200374 (p_appli_s_name => 'XLA'
200375 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
200376 ,p_token_1 => 'LINE_NUMBER'
200377 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
200378 ,p_token_2 => 'LINE_TYPE_NAME'
200379 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
200380 l_component_type
200381 ,l_component_code
200382 ,l_component_type_code
200383 ,l_component_appl_id
200384 ,l_amb_context_code
200385 ,l_entity_code
200386 ,l_event_class_code
200387 )
200388 ,p_token_3 => 'OWNER'
200389 ,p_value_3 => xla_lookups_pkg.get_meaning(
200390 p_lookup_type => 'XLA_OWNER_TYPE'
200391 ,p_lookup_code => l_component_type_code
200392 )
200393 ,p_token_4 => 'PRODUCT_NAME'
200394 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
200395 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
200396 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
200397 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
200398 ,p_ae_header_id => NULL
200399 );
200400
200401 IF (C_LEVEL_ERROR>= g_log_level) THEN
200402 trace
200403 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
200404 ,p_level => C_LEVEL_ERROR
200405 ,p_module => l_log_module);
200406 END IF;
200407 END IF;
200408 END IF;
200409 --
200410 --
200411 ------------------------------------------------------------------------------------------------
200412 -- 4219869 Business Flow
200413 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
200414 -- Prior Entry. Currently, the following code is always generated.
200415 ------------------------------------------------------------------------------------------------
200416 XLA_AE_LINES_PKG.ValidateCurrentLine;
200417
200418 ------------------------------------------------------------------------------------
200419 -- 4219869 Business Flow
200420 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
200421 ------------------------------------------------------------------------------------
200425 -- 4219869 Business Flow
200422 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
200423
200424 ----------------------------------------------------------------------------------
200426 -- Update journal entry status -- Need to generate this within IF <condition>
200427 ----------------------------------------------------------------------------------
200428 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
200429 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
200430 ,p_balance_type_code => l_balance_type_code
200431 );
200432
200433 -------------------------------------------------------------------------------------------
200434 -- 4262811 - Generate the Accrual Reversal lines
200435 -------------------------------------------------------------------------------------------
200436 BEGIN
200437 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
200438 (g_array_event(p_event_id).array_value_num('header_index'));
200439 IF l_acc_rev_flag IS NULL THEN
200440 l_acc_rev_flag := 'N';
200441 END IF;
200442 EXCEPTION
200443 WHEN OTHERS THEN
200444 l_acc_rev_flag := 'N';
200445 END;
200446 --
200447 IF (l_acc_rev_flag = 'Y') THEN
200448
200449 -- 4645092 ------------------------------------------------------------------------------
200450 -- To allow MPA report to determine if it should generate report process
200451 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
200452 ------------------------------------------------------------------------------------------
200453
200454 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
200455 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
200456 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
200457 -- call ADRs
200458 -- Bug 4922099
200459 --
200460 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
200461 (NVL(l_actual_upg_option, 'N') = 'O') OR
200462 (NVL(l_enc_upg_option, 'N') = 'O')
200463 )
200464 THEN
200465 NULL;
200466 --
200467 --
200468
200469 l_ccid := AcctDerRule_186(
200470 p_application_id => p_application_id
200471 , p_ae_header_id => l_ae_header_id
200472 , p_source_41 => p_source_41
200473 , x_transaction_coa_id => l_adr_transaction_coa_id
200474 , x_accounting_coa_id => l_adr_accounting_coa_id
200475 , x_value_type_code => l_adr_value_type_code
200476 , p_side => 'NA'
200477 );
200478
200479 xla_ae_lines_pkg.set_ccid(
200480 p_code_combination_id => l_ccid
200481 , p_value_type_code => l_adr_value_type_code
200482 , p_transaction_coa_id => l_adr_transaction_coa_id
200483 , p_accounting_coa_id => l_adr_accounting_coa_id
200484 , p_adr_code => 'IAC_GENERAL_FUND_AC'
200485 , p_adr_type_code => 'S'
200486 , p_component_type => l_component_type
200487 , p_component_code => l_component_code
200488 , p_component_type_code => l_component_type_code
200489 , p_component_appl_id => l_component_appl_id
200490 , p_amb_context_code => l_amb_context_code
200491 , p_side => 'NA'
200492 );
200493
200494
200495 --
200496 --
200497 END IF;
200498
200499 --
200500 -- Update the line information that should be overwritten
200501 --
200502 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
200503 p_header_num => 1);
200504 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
200505
200506 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
200507
200508 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
200509 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
200510 END IF;
200511
200512 --
200513 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
200514 --
200515 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
200516 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
200517 ELSE
200518 ---------------------------------------------------------------------------------------------------
200519 -- 4262811a Switch Sign
200520 ---------------------------------------------------------------------------------------------------
200521 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
200522 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
200523 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
200524 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
200525 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
200526 -- 5132302
200527 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
200531
200528 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
200529
200530 END IF;
200532 -- 4955764
200533 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
200534 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
200535
200536
200537 XLA_AE_LINES_PKG.ValidateCurrentLine;
200538 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
200539
200540 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
200541 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
200542 ,p_balance_type_code => l_balance_type_code);
200543
200544 END IF;
200545
200546 -----------------------------------------------------------------------------------------
200547 -- 4262811 Multiperiod Accounting
200548 -----------------------------------------------------------------------------------------
200549 -- No MPA option is assigned.
200550
200551
200552 END IF;
200553 END IF;
200554 --
200555
200556 --
200557 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
200558 trace
200559 (p_msg => 'END of AcctLineType_454'
200560 ,p_level => C_LEVEL_PROCEDURE
200561 ,p_module => l_log_module);
200562 END IF;
200563 --
200564 EXCEPTION
200565 WHEN xla_exceptions_pkg.application_exception THEN
200566 RAISE;
200567 WHEN OTHERS THEN
200568 xla_exceptions_pkg.raise_message
200569 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_454');
200570 END AcctLineType_454;
200571 --
200572
200573 ---------------------------------------
200574 --
200575 -- PRIVATE FUNCTION
200576 -- AcctLineType_455
200577 --
200578 ---------------------------------------
200579 PROCEDURE AcctLineType_455 (
200580 p_application_id IN NUMBER
200581 ,p_event_id IN NUMBER
200582 ,p_calculate_acctd_flag IN VARCHAR2
200583 ,p_calculate_g_l_flag IN VARCHAR2
200584 ,p_actual_flag IN OUT VARCHAR2
200585 ,p_balance_type_code OUT VARCHAR2
200586 ,p_gain_or_loss_ref OUT VARCHAR2
200587
200588 --Inflation Adjustment Type Description
200589 , p_source_2 IN VARCHAR2
200590 --Accounting Date
200591 , p_source_3 IN DATE
200592 --Inflation General Fund Ccid
200593 , p_source_41 IN NUMBER
200594 --Distribution Type Code
200595 , p_source_51 IN VARCHAR2
200596 --Asset Identifier
200597 , p_source_56 IN NUMBER
200598 --Period Counter
200599 , p_source_57 IN NUMBER
200600 --Distribution Identifier
200601 , p_source_58 IN NUMBER
200602 --Book Type Code
200603 , p_source_59 IN VARCHAR2
200604 --Depreciation Run Identifier
200605 , p_source_62 IN NUMBER
200606 --Inflation Adjustment Type
200607 , p_source_64 IN VARCHAR2
200608 --Inflation Entered Amount
200609 , p_source_65 IN NUMBER
200610 --Inflation Currency Code
200611 , p_source_66 IN VARCHAR2
200612 )
200613 IS
200614
200615 l_component_type VARCHAR2(80);
200616 l_component_code VARCHAR2(30);
200617 l_component_type_code VARCHAR2(1);
200618 l_component_appl_id INTEGER;
200619 l_amb_context_code VARCHAR2(30);
200620 l_entity_code VARCHAR2(30);
200621 l_event_class_code VARCHAR2(30);
200622 l_ae_header_id NUMBER;
200623 l_event_type_code VARCHAR2(30);
200624 l_line_definition_code VARCHAR2(30);
200625 l_line_definition_owner_code VARCHAR2(1);
200626 --
200627 -- adr variables
200628 l_segment VARCHAR2(30);
200629 l_ccid NUMBER;
200630 l_adr_transaction_coa_id NUMBER;
200631 l_adr_accounting_coa_id NUMBER;
200632 l_adr_flexfield_segment_code VARCHAR2(30);
200633 l_adr_flex_value_set_id NUMBER;
200634 l_adr_value_type_code VARCHAR2(30);
200635 l_adr_value_combination_id NUMBER;
200636 l_adr_value_segment_code VARCHAR2(30);
200637
200638 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
200639 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
200640 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
200641 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
200642
200643 -- 4262811 Variables ------------------------------------------------------------------------------------------
200644 l_entered_amt_idx NUMBER;
200645 l_accted_amt_idx NUMBER;
200646 l_acc_rev_flag VARCHAR2(1);
200647 l_accrual_line_num NUMBER;
200648 l_tmp_amt NUMBER;
200649 l_acc_rev_natural_side_code VARCHAR2(1);
200650
200651 l_num_entries NUMBER;
200652 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
200653 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
200654 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
200655 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
200656 l_recog_line_1 NUMBER;
200657 l_recog_line_2 NUMBER;
200658
200659 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
200663 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
200660 l_bflow_applied_to_amt NUMBER; -- 5132302
200661 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
200662
200664
200665 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
200666 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
200667
200668 ---------------------------------------------------------------------------------------------------------------
200669
200670
200671 --
200672 -- bulk performance
200673 --
200674 l_balance_type_code VARCHAR2(1);
200675 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
200676 l_log_module VARCHAR2(240);
200677
200678 --
200679 -- Upgrade strategy
200680 --
200681 l_actual_upg_option VARCHAR2(1);
200682 l_enc_upg_option VARCHAR2(1);
200683
200684 --
200685 BEGIN
200686 --
200687 IF g_log_enabled THEN
200688 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_455';
200689 END IF;
200690 --
200691 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
200692
200693 trace
200694 (p_msg => 'BEGIN of AcctLineType_455'
200695 ,p_level => C_LEVEL_PROCEDURE
200696 ,p_module => l_log_module);
200697
200698 END IF;
200699 --
200700 l_component_type := 'AMB_JLT';
200701 l_component_code := 'IAC_GENERAL_FUND';
200702 l_component_type_code := 'S';
200703 l_component_appl_id := 140;
200704 l_amb_context_code := 'DEFAULT';
200705 l_entity_code := 'DEPRECIATION';
200706 l_event_class_code := 'DEPRECIATION';
200707 l_event_type_code := 'DEPRECIATION_ALL';
200708 l_line_definition_owner_code := 'S';
200709 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
200710 --
200711 l_balance_type_code := 'A';
200712 l_segment := NULL;
200713 l_ccid := NULL;
200714 l_adr_transaction_coa_id := NULL;
200715 l_adr_accounting_coa_id := NULL;
200716 l_adr_flexfield_segment_code := NULL;
200717 l_adr_flex_value_set_id := NULL;
200718 l_adr_value_type_code := NULL;
200719 l_adr_value_combination_id := NULL;
200720 l_adr_value_segment_code := NULL;
200721
200722 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
200723 l_bflow_class_code := ''; -- 4219869 Business Flow
200724 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
200725 l_budgetary_control_flag := 'N';
200726
200727 l_bflow_applied_to_amt_idx := NULL; -- 5132302
200728 l_bflow_applied_to_amt := NULL; -- 5132302
200729 l_entered_amt_idx := NULL; -- 4262811
200730 l_accted_amt_idx := NULL; -- 4262811
200731 l_acc_rev_flag := NULL; -- 4262811
200732 l_accrual_line_num := NULL; -- 4262811
200733 l_tmp_amt := NULL; -- 4262811
200734 --
200735
200736 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
200737 l_balance_type_code <> 'B' THEN
200738 IF NVL(p_source_64,'
200739 ') = 'GENERAL FUND'
200740 THEN
200741
200742 --
200743 XLA_AE_LINES_PKG.SetNewLine;
200744
200745 p_balance_type_code := l_balance_type_code;
200746 -- set the flag so later we will know whether the gain loss line needs to be created
200747
200748 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
200749 p_actual_flag :='A';
200750 END IF;
200751
200752 --
200753 -- bulk performance
200754 --
200755 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
200756 p_header_num => 0); -- 4262811
200757 --
200758 -- set accounting line options
200759 --
200760 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
200761 p_natural_side_code => 'C'
200762 , p_gain_or_loss_flag => 'N'
200763 , p_gl_transfer_mode_code => 'S'
200764 , p_acct_entry_type_code => 'A'
200765 , p_switch_side_flag => 'Y'
200766 , p_merge_duplicate_code => 'N'
200767 );
200768 --
200769 l_acc_rev_natural_side_code := 'D'; -- 4262811
200770 --
200771 --
200772 -- set accounting line type info
200773 --
200774 xla_ae_lines_pkg.SetAcctLineType
200775 (p_component_type => l_component_type
200776 ,p_event_type_code => l_event_type_code
200777 ,p_line_definition_owner_code => l_line_definition_owner_code
200778 ,p_line_definition_code => l_line_definition_code
200779 ,p_accounting_line_code => l_component_code
200780 ,p_accounting_line_type_code => l_component_type_code
200781 ,p_accounting_line_appl_id => l_component_appl_id
200782 ,p_amb_context_code => l_amb_context_code
200783 ,p_entity_code => l_entity_code
200784 ,p_event_class_code => l_event_class_code);
200785 --
200786 -- set accounting class
200787 --
200788 xla_ae_lines_pkg.SetAcctClass(
200789 p_accounting_class_code => 'ASSET'
200790 , p_ae_header_id => l_ae_header_id
200791 );
200792
200793 --
200794 -- set rounding class
200795 --
200799 --
200796 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
200797 'ASSET';
200798
200800 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
200801 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
200802 --
200803 -- bulk performance
200804 --
200805 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
200806
200807 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
200808 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
200809
200810 -- 4955764
200811 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
200812 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
200813
200814 -- 4458381 Public Sector Enh
200815
200816 --
200817 -- set accounting attributes for the line type
200818 --
200819 l_entered_amt_idx := 7;
200820 l_accted_amt_idx := 9;
200821 l_bflow_applied_to_amt_idx := NULL; -- 5132302
200822 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
200823 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
200824 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
200825 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
200826 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
200827 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
200828 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
200829 l_rec_acct_attrs.array_char_value(4) := p_source_59;
200830 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
200831 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
200832 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
200833 l_rec_acct_attrs.array_char_value(6) := p_source_51;
200834 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
200835 l_rec_acct_attrs.array_num_value(7) := p_source_65;
200836 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
200837 l_rec_acct_attrs.array_char_value(8) := p_source_66;
200838 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
200839 l_rec_acct_attrs.array_num_value(9) := p_source_65;
200840
200841 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
200842 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
200843
200844 ---------------------------------------------------------------------------------------------------------------
200845 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
200846 ---------------------------------------------------------------------------------------------------------------
200847 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
200848
200849 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
200850 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
200851
200852 IF xla_accounting_cache_pkg.GetValueChar
200853 (p_source_code => 'LEDGER_CATEGORY_CODE'
200854 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
200855 AND l_bflow_method_code = 'PRIOR_ENTRY'
200856 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
200857 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
200858 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
200859 )
200860 THEN
200861 xla_ae_lines_pkg.BflowUpgEntry
200862 (p_business_method_code => l_bflow_method_code
200863 ,p_business_class_code => l_bflow_class_code
200864 ,p_balance_type => l_balance_type_code);
200865 ELSE
200866 NULL;
200867 -- No business flow processing for business flow method of NONE.
200868 END IF;
200869
200870 --
200871 -- call analytical criteria
200872 --
200873
200874 --
200875 -- call description
200876 --
200877
200878 xla_ae_lines_pkg.SetLineDescription(
200879 p_ae_header_id => l_ae_header_id
200880 ,p_description => Description_143 (
200881 p_application_id => p_application_id
200882 , p_ae_header_id => l_ae_header_id
200883 , p_source_2 => p_source_2
200884 , p_source_3 => p_source_3
200885 )
200886 );
200887
200888
200889 --
200890 -- call ADRs
200891 -- Bug 4922099
200892 --
200893 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
200894 (NVL(l_actual_upg_option, 'N') = 'O') OR
200895 (NVL(l_enc_upg_option, 'N') = 'O')
200896 )
200897 THEN
200898 NULL;
200899 --
200900 --
200901
200902 l_ccid := AcctDerRule_186(
200903 p_application_id => p_application_id
200904 , p_ae_header_id => l_ae_header_id
200905 , p_source_41 => p_source_41
200906 , x_transaction_coa_id => l_adr_transaction_coa_id
200907 , x_accounting_coa_id => l_adr_accounting_coa_id
200908 , x_value_type_code => l_adr_value_type_code
200909 , p_side => 'NA'
200910 );
200911
200912 xla_ae_lines_pkg.set_ccid(
200916 , p_accounting_coa_id => l_adr_accounting_coa_id
200913 p_code_combination_id => l_ccid
200914 , p_value_type_code => l_adr_value_type_code
200915 , p_transaction_coa_id => l_adr_transaction_coa_id
200917 , p_adr_code => 'IAC_GENERAL_FUND_AC'
200918 , p_adr_type_code => 'S'
200919 , p_component_type => l_component_type
200920 , p_component_code => l_component_code
200921 , p_component_type_code => l_component_type_code
200922 , p_component_appl_id => l_component_appl_id
200923 , p_amb_context_code => l_amb_context_code
200924 , p_side => 'NA'
200925 );
200926
200927
200928 --
200929 --
200930 END IF;
200931 --
200932 -- Bug 4922099
200933 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
200934 (NVL(l_enc_upg_option, 'N') = 'O')
200935 ) AND
200936 (l_bflow_method_code = 'PRIOR_ENTRY')
200937 )
200938 THEN
200939 IF
200940 --
200941 1 = 2
200942 --
200943 THEN
200944 xla_accounting_err_pkg.build_message
200945 (p_appli_s_name => 'XLA'
200946 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
200947 ,p_token_1 => 'LINE_NUMBER'
200948 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
200949 ,p_token_2 => 'LINE_TYPE_NAME'
200950 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
200951 l_component_type
200952 ,l_component_code
200953 ,l_component_type_code
200954 ,l_component_appl_id
200955 ,l_amb_context_code
200956 ,l_entity_code
200957 ,l_event_class_code
200958 )
200959 ,p_token_3 => 'OWNER'
200960 ,p_value_3 => xla_lookups_pkg.get_meaning(
200961 p_lookup_type => 'XLA_OWNER_TYPE'
200962 ,p_lookup_code => l_component_type_code
200963 )
200964 ,p_token_4 => 'PRODUCT_NAME'
200965 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
200966 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
200967 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
200968 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
200969 ,p_ae_header_id => NULL
200970 );
200971
200972 IF (C_LEVEL_ERROR>= g_log_level) THEN
200973 trace
200974 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
200975 ,p_level => C_LEVEL_ERROR
200976 ,p_module => l_log_module);
200977 END IF;
200978 END IF;
200979 END IF;
200980 --
200981 --
200982 ------------------------------------------------------------------------------------------------
200983 -- 4219869 Business Flow
200984 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
200985 -- Prior Entry. Currently, the following code is always generated.
200986 ------------------------------------------------------------------------------------------------
200987 XLA_AE_LINES_PKG.ValidateCurrentLine;
200988
200989 ------------------------------------------------------------------------------------
200990 -- 4219869 Business Flow
200991 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
200992 ------------------------------------------------------------------------------------
200993 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
200994
200995 ----------------------------------------------------------------------------------
200996 -- 4219869 Business Flow
200997 -- Update journal entry status -- Need to generate this within IF <condition>
200998 ----------------------------------------------------------------------------------
200999 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
201000 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
201001 ,p_balance_type_code => l_balance_type_code
201002 );
201003
201004 -------------------------------------------------------------------------------------------
201005 -- 4262811 - Generate the Accrual Reversal lines
201006 -------------------------------------------------------------------------------------------
201007 BEGIN
201011 l_acc_rev_flag := 'N';
201008 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
201009 (g_array_event(p_event_id).array_value_num('header_index'));
201010 IF l_acc_rev_flag IS NULL THEN
201012 END IF;
201013 EXCEPTION
201014 WHEN OTHERS THEN
201015 l_acc_rev_flag := 'N';
201016 END;
201017 --
201018 IF (l_acc_rev_flag = 'Y') THEN
201019
201020 -- 4645092 ------------------------------------------------------------------------------
201021 -- To allow MPA report to determine if it should generate report process
201022 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
201023 ------------------------------------------------------------------------------------------
201024
201025 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
201026 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
201027 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
201028 -- call ADRs
201029 -- Bug 4922099
201030 --
201031 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
201032 (NVL(l_actual_upg_option, 'N') = 'O') OR
201033 (NVL(l_enc_upg_option, 'N') = 'O')
201034 )
201035 THEN
201036 NULL;
201037 --
201038 --
201039
201040 l_ccid := AcctDerRule_186(
201041 p_application_id => p_application_id
201042 , p_ae_header_id => l_ae_header_id
201043 , p_source_41 => p_source_41
201044 , x_transaction_coa_id => l_adr_transaction_coa_id
201045 , x_accounting_coa_id => l_adr_accounting_coa_id
201046 , x_value_type_code => l_adr_value_type_code
201047 , p_side => 'NA'
201048 );
201049
201050 xla_ae_lines_pkg.set_ccid(
201051 p_code_combination_id => l_ccid
201052 , p_value_type_code => l_adr_value_type_code
201053 , p_transaction_coa_id => l_adr_transaction_coa_id
201054 , p_accounting_coa_id => l_adr_accounting_coa_id
201055 , p_adr_code => 'IAC_GENERAL_FUND_AC'
201056 , p_adr_type_code => 'S'
201057 , p_component_type => l_component_type
201058 , p_component_code => l_component_code
201059 , p_component_type_code => l_component_type_code
201060 , p_component_appl_id => l_component_appl_id
201061 , p_amb_context_code => l_amb_context_code
201062 , p_side => 'NA'
201063 );
201064
201065
201066 --
201067 --
201068 END IF;
201069
201070 --
201071 -- Update the line information that should be overwritten
201072 --
201073 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
201074 p_header_num => 1);
201075 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
201076
201077 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
201078
201079 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
201080 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
201081 END IF;
201082
201083 --
201084 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
201085 --
201086 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
201087 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
201088 ELSE
201089 ---------------------------------------------------------------------------------------------------
201090 -- 4262811a Switch Sign
201091 ---------------------------------------------------------------------------------------------------
201092 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
201093 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
201094 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
201095 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
201096 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
201097 -- 5132302
201098 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
201099 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
201100
201101 END IF;
201102
201103 -- 4955764
201104 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
201105 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
201106
201107
201108 XLA_AE_LINES_PKG.ValidateCurrentLine;
201109 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
201110
201111 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
201112 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
201113 ,p_balance_type_code => l_balance_type_code);
201114
201115 END IF;
201116
201117 -----------------------------------------------------------------------------------------
201121
201118 -- 4262811 Multiperiod Accounting
201119 -----------------------------------------------------------------------------------------
201120 -- No MPA option is assigned.
201122
201123 END IF;
201124 END IF;
201125 --
201126
201127 --
201128 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
201129 trace
201130 (p_msg => 'END of AcctLineType_455'
201131 ,p_level => C_LEVEL_PROCEDURE
201132 ,p_module => l_log_module);
201133 END IF;
201134 --
201135 EXCEPTION
201136 WHEN xla_exceptions_pkg.application_exception THEN
201137 RAISE;
201138 WHEN OTHERS THEN
201139 xla_exceptions_pkg.raise_message
201140 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_455');
201141 END AcctLineType_455;
201142 --
201143
201144 ---------------------------------------
201145 --
201146 -- PRIVATE FUNCTION
201147 -- AcctLineType_456
201148 --
201149 ---------------------------------------
201150 PROCEDURE AcctLineType_456 (
201151 p_application_id IN NUMBER
201152 ,p_event_id IN NUMBER
201153 ,p_calculate_acctd_flag IN VARCHAR2
201154 ,p_calculate_g_l_flag IN VARCHAR2
201155 ,p_actual_flag IN OUT VARCHAR2
201156 ,p_balance_type_code OUT VARCHAR2
201157 ,p_gain_or_loss_ref OUT VARCHAR2
201158
201159 --Inflation Adjustment Type Description
201160 , p_source_2 IN VARCHAR2
201161 --Accounting Date
201162 , p_source_3 IN DATE
201163 --Inflation General Fund Ccid
201164 , p_source_41 IN NUMBER
201165 --Transaction Header Identifier
201166 , p_source_49 IN NUMBER
201167 --Adjustment Line Identifier
201168 , p_source_50 IN NUMBER
201169 --Distribution Type Code
201170 , p_source_51 IN VARCHAR2
201171 --Inflation Adjustment Type
201172 , p_source_64 IN VARCHAR2
201173 --Inflation Entered Amount
201174 , p_source_65 IN NUMBER
201175 --Inflation Currency Code
201176 , p_source_66 IN VARCHAR2
201177 )
201178 IS
201179
201180 l_component_type VARCHAR2(80);
201181 l_component_code VARCHAR2(30);
201182 l_component_type_code VARCHAR2(1);
201183 l_component_appl_id INTEGER;
201184 l_amb_context_code VARCHAR2(30);
201185 l_entity_code VARCHAR2(30);
201186 l_event_class_code VARCHAR2(30);
201187 l_ae_header_id NUMBER;
201188 l_event_type_code VARCHAR2(30);
201189 l_line_definition_code VARCHAR2(30);
201190 l_line_definition_owner_code VARCHAR2(1);
201191 --
201192 -- adr variables
201193 l_segment VARCHAR2(30);
201194 l_ccid NUMBER;
201195 l_adr_transaction_coa_id NUMBER;
201196 l_adr_accounting_coa_id NUMBER;
201197 l_adr_flexfield_segment_code VARCHAR2(30);
201198 l_adr_flex_value_set_id NUMBER;
201199 l_adr_value_type_code VARCHAR2(30);
201200 l_adr_value_combination_id NUMBER;
201201 l_adr_value_segment_code VARCHAR2(30);
201202
201203 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
201204 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
201205 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
201206 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
201207
201208 -- 4262811 Variables ------------------------------------------------------------------------------------------
201209 l_entered_amt_idx NUMBER;
201210 l_accted_amt_idx NUMBER;
201211 l_acc_rev_flag VARCHAR2(1);
201212 l_accrual_line_num NUMBER;
201213 l_tmp_amt NUMBER;
201214 l_acc_rev_natural_side_code VARCHAR2(1);
201215
201216 l_num_entries NUMBER;
201217 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
201218 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
201219 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
201220 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
201221 l_recog_line_1 NUMBER;
201222 l_recog_line_2 NUMBER;
201223
201224 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
201225 l_bflow_applied_to_amt NUMBER; -- 5132302
201226 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
201227
201228 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
201229
201230 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
201231 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
201232
201233 ---------------------------------------------------------------------------------------------------------------
201234
201235
201236 --
201237 -- bulk performance
201238 --
201239 l_balance_type_code VARCHAR2(1);
201240 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
201241 l_log_module VARCHAR2(240);
201242
201243 --
201244 -- Upgrade strategy
201245 --
201246 l_actual_upg_option VARCHAR2(1);
201247 l_enc_upg_option VARCHAR2(1);
201248
201249 --
201250 BEGIN
201251 --
201252 IF g_log_enabled THEN
201253 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_456';
201254 END IF;
201258 trace
201255 --
201256 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
201257
201259 (p_msg => 'BEGIN of AcctLineType_456'
201260 ,p_level => C_LEVEL_PROCEDURE
201261 ,p_module => l_log_module);
201262
201263 END IF;
201264 --
201265 l_component_type := 'AMB_JLT';
201266 l_component_code := 'IAC_GENERAL_FUND';
201267 l_component_type_code := 'S';
201268 l_component_appl_id := 140;
201269 l_amb_context_code := 'DEFAULT';
201270 l_entity_code := 'TRANSACTIONS';
201271 l_event_class_code := 'ADJUSTMENTS';
201272 l_event_type_code := 'ADJUSTMENTS_ALL';
201273 l_line_definition_owner_code := 'S';
201274 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
201275 --
201276 l_balance_type_code := 'A';
201277 l_segment := NULL;
201278 l_ccid := NULL;
201279 l_adr_transaction_coa_id := NULL;
201280 l_adr_accounting_coa_id := NULL;
201281 l_adr_flexfield_segment_code := NULL;
201282 l_adr_flex_value_set_id := NULL;
201283 l_adr_value_type_code := NULL;
201284 l_adr_value_combination_id := NULL;
201285 l_adr_value_segment_code := NULL;
201286
201287 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
201288 l_bflow_class_code := ''; -- 4219869 Business Flow
201289 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
201290 l_budgetary_control_flag := 'N';
201291
201292 l_bflow_applied_to_amt_idx := NULL; -- 5132302
201293 l_bflow_applied_to_amt := NULL; -- 5132302
201294 l_entered_amt_idx := NULL; -- 4262811
201295 l_accted_amt_idx := NULL; -- 4262811
201296 l_acc_rev_flag := NULL; -- 4262811
201297 l_accrual_line_num := NULL; -- 4262811
201298 l_tmp_amt := NULL; -- 4262811
201299 --
201300
201301 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
201302 l_balance_type_code <> 'B' THEN
201303 IF NVL(p_source_64,'
201304 ') = 'GENERAL FUND'
201305 THEN
201306
201307 --
201308 XLA_AE_LINES_PKG.SetNewLine;
201309
201310 p_balance_type_code := l_balance_type_code;
201311 -- set the flag so later we will know whether the gain loss line needs to be created
201312
201313 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
201314 p_actual_flag :='A';
201315 END IF;
201316
201317 --
201318 -- bulk performance
201319 --
201320 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
201321 p_header_num => 0); -- 4262811
201322 --
201323 -- set accounting line options
201324 --
201325 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
201326 p_natural_side_code => 'C'
201327 , p_gain_or_loss_flag => 'N'
201328 , p_gl_transfer_mode_code => 'S'
201329 , p_acct_entry_type_code => 'A'
201330 , p_switch_side_flag => 'Y'
201331 , p_merge_duplicate_code => 'N'
201332 );
201333 --
201334 l_acc_rev_natural_side_code := 'D'; -- 4262811
201335 --
201336 --
201337 -- set accounting line type info
201338 --
201339 xla_ae_lines_pkg.SetAcctLineType
201340 (p_component_type => l_component_type
201341 ,p_event_type_code => l_event_type_code
201342 ,p_line_definition_owner_code => l_line_definition_owner_code
201343 ,p_line_definition_code => l_line_definition_code
201344 ,p_accounting_line_code => l_component_code
201345 ,p_accounting_line_type_code => l_component_type_code
201346 ,p_accounting_line_appl_id => l_component_appl_id
201347 ,p_amb_context_code => l_amb_context_code
201348 ,p_entity_code => l_entity_code
201349 ,p_event_class_code => l_event_class_code);
201350 --
201351 -- set accounting class
201352 --
201353 xla_ae_lines_pkg.SetAcctClass(
201354 p_accounting_class_code => 'ASSET'
201355 , p_ae_header_id => l_ae_header_id
201356 );
201357
201358 --
201359 -- set rounding class
201360 --
201361 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
201362 'ASSET';
201363
201364 --
201365 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
201366 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
201367 --
201368 -- bulk performance
201369 --
201370 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
201371
201372 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
201373 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
201374
201375 -- 4955764
201376 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
201377 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
201378
201379 -- 4458381 Public Sector Enh
201380
201381 --
201382 -- set accounting attributes for the line type
201383 --
201384 l_entered_amt_idx := 4;
201385 l_accted_amt_idx := 6;
201386 l_bflow_applied_to_amt_idx := NULL; -- 5132302
201390 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
201387 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
201388 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
201389 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
201391 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
201392 l_rec_acct_attrs.array_char_value(3) := p_source_51;
201393 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
201394 l_rec_acct_attrs.array_num_value(4) := p_source_65;
201395 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
201396 l_rec_acct_attrs.array_char_value(5) := p_source_66;
201397 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
201398 l_rec_acct_attrs.array_num_value(6) := p_source_65;
201399
201400 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
201401 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
201402
201403 ---------------------------------------------------------------------------------------------------------------
201404 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
201405 ---------------------------------------------------------------------------------------------------------------
201406 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
201407
201408 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
201409 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
201410
201411 IF xla_accounting_cache_pkg.GetValueChar
201412 (p_source_code => 'LEDGER_CATEGORY_CODE'
201413 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
201414 AND l_bflow_method_code = 'PRIOR_ENTRY'
201415 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
201416 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
201417 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
201418 )
201419 THEN
201420 xla_ae_lines_pkg.BflowUpgEntry
201421 (p_business_method_code => l_bflow_method_code
201422 ,p_business_class_code => l_bflow_class_code
201423 ,p_balance_type => l_balance_type_code);
201424 ELSE
201425 NULL;
201426 -- No business flow processing for business flow method of NONE.
201427 END IF;
201428
201429 --
201430 -- call analytical criteria
201431 --
201432
201433 --
201434 -- call description
201435 --
201436
201437 xla_ae_lines_pkg.SetLineDescription(
201438 p_ae_header_id => l_ae_header_id
201439 ,p_description => Description_143 (
201440 p_application_id => p_application_id
201441 , p_ae_header_id => l_ae_header_id
201442 , p_source_2 => p_source_2
201443 , p_source_3 => p_source_3
201444 )
201445 );
201446
201447
201448 --
201449 -- call ADRs
201450 -- Bug 4922099
201451 --
201452 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
201453 (NVL(l_actual_upg_option, 'N') = 'O') OR
201454 (NVL(l_enc_upg_option, 'N') = 'O')
201455 )
201456 THEN
201457 NULL;
201458 --
201459 --
201460
201461 l_ccid := AcctDerRule_186(
201462 p_application_id => p_application_id
201463 , p_ae_header_id => l_ae_header_id
201464 , p_source_41 => p_source_41
201465 , x_transaction_coa_id => l_adr_transaction_coa_id
201466 , x_accounting_coa_id => l_adr_accounting_coa_id
201467 , x_value_type_code => l_adr_value_type_code
201468 , p_side => 'NA'
201469 );
201470
201471 xla_ae_lines_pkg.set_ccid(
201472 p_code_combination_id => l_ccid
201473 , p_value_type_code => l_adr_value_type_code
201474 , p_transaction_coa_id => l_adr_transaction_coa_id
201475 , p_accounting_coa_id => l_adr_accounting_coa_id
201476 , p_adr_code => 'IAC_GENERAL_FUND_AC'
201477 , p_adr_type_code => 'S'
201478 , p_component_type => l_component_type
201479 , p_component_code => l_component_code
201480 , p_component_type_code => l_component_type_code
201481 , p_component_appl_id => l_component_appl_id
201482 , p_amb_context_code => l_amb_context_code
201483 , p_side => 'NA'
201484 );
201485
201486
201487 --
201488 --
201489 END IF;
201490 --
201491 -- Bug 4922099
201492 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
201493 (NVL(l_enc_upg_option, 'N') = 'O')
201494 ) AND
201495 (l_bflow_method_code = 'PRIOR_ENTRY')
201496 )
201497 THEN
201498 IF
201499 --
201500 1 = 2
201501 --
201502 THEN
201503 xla_accounting_err_pkg.build_message
201504 (p_appli_s_name => 'XLA'
201505 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
201506 ,p_token_1 => 'LINE_NUMBER'
201507 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
201508 ,p_token_2 => 'LINE_TYPE_NAME'
201512 ,l_component_type_code
201509 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
201510 l_component_type
201511 ,l_component_code
201513 ,l_component_appl_id
201514 ,l_amb_context_code
201515 ,l_entity_code
201516 ,l_event_class_code
201517 )
201518 ,p_token_3 => 'OWNER'
201519 ,p_value_3 => xla_lookups_pkg.get_meaning(
201520 p_lookup_type => 'XLA_OWNER_TYPE'
201521 ,p_lookup_code => l_component_type_code
201522 )
201523 ,p_token_4 => 'PRODUCT_NAME'
201524 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
201525 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
201526 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
201527 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
201528 ,p_ae_header_id => NULL
201529 );
201530
201531 IF (C_LEVEL_ERROR>= g_log_level) THEN
201532 trace
201533 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
201534 ,p_level => C_LEVEL_ERROR
201535 ,p_module => l_log_module);
201536 END IF;
201537 END IF;
201538 END IF;
201539 --
201540 --
201541 ------------------------------------------------------------------------------------------------
201542 -- 4219869 Business Flow
201543 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
201544 -- Prior Entry. Currently, the following code is always generated.
201545 ------------------------------------------------------------------------------------------------
201546 XLA_AE_LINES_PKG.ValidateCurrentLine;
201547
201548 ------------------------------------------------------------------------------------
201549 -- 4219869 Business Flow
201550 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
201551 ------------------------------------------------------------------------------------
201552 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
201553
201554 ----------------------------------------------------------------------------------
201555 -- 4219869 Business Flow
201556 -- Update journal entry status -- Need to generate this within IF <condition>
201557 ----------------------------------------------------------------------------------
201558 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
201559 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
201560 ,p_balance_type_code => l_balance_type_code
201561 );
201562
201563 -------------------------------------------------------------------------------------------
201564 -- 4262811 - Generate the Accrual Reversal lines
201565 -------------------------------------------------------------------------------------------
201566 BEGIN
201567 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
201568 (g_array_event(p_event_id).array_value_num('header_index'));
201569 IF l_acc_rev_flag IS NULL THEN
201570 l_acc_rev_flag := 'N';
201571 END IF;
201572 EXCEPTION
201573 WHEN OTHERS THEN
201574 l_acc_rev_flag := 'N';
201575 END;
201576 --
201577 IF (l_acc_rev_flag = 'Y') THEN
201578
201579 -- 4645092 ------------------------------------------------------------------------------
201580 -- To allow MPA report to determine if it should generate report process
201581 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
201582 ------------------------------------------------------------------------------------------
201583
201584 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
201585 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
201586 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
201587 -- call ADRs
201588 -- Bug 4922099
201589 --
201590 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
201591 (NVL(l_actual_upg_option, 'N') = 'O') OR
201592 (NVL(l_enc_upg_option, 'N') = 'O')
201593 )
201594 THEN
201595 NULL;
201596 --
201597 --
201598
201599 l_ccid := AcctDerRule_186(
201600 p_application_id => p_application_id
201601 , p_ae_header_id => l_ae_header_id
201602 , p_source_41 => p_source_41
201603 , x_transaction_coa_id => l_adr_transaction_coa_id
201607 );
201604 , x_accounting_coa_id => l_adr_accounting_coa_id
201605 , x_value_type_code => l_adr_value_type_code
201606 , p_side => 'NA'
201608
201609 xla_ae_lines_pkg.set_ccid(
201610 p_code_combination_id => l_ccid
201611 , p_value_type_code => l_adr_value_type_code
201612 , p_transaction_coa_id => l_adr_transaction_coa_id
201613 , p_accounting_coa_id => l_adr_accounting_coa_id
201614 , p_adr_code => 'IAC_GENERAL_FUND_AC'
201615 , p_adr_type_code => 'S'
201616 , p_component_type => l_component_type
201617 , p_component_code => l_component_code
201618 , p_component_type_code => l_component_type_code
201619 , p_component_appl_id => l_component_appl_id
201620 , p_amb_context_code => l_amb_context_code
201621 , p_side => 'NA'
201622 );
201623
201624
201625 --
201626 --
201627 END IF;
201628
201629 --
201630 -- Update the line information that should be overwritten
201631 --
201632 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
201633 p_header_num => 1);
201634 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
201635
201636 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
201637
201638 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
201639 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
201640 END IF;
201641
201642 --
201643 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
201644 --
201645 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
201646 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
201647 ELSE
201648 ---------------------------------------------------------------------------------------------------
201649 -- 4262811a Switch Sign
201650 ---------------------------------------------------------------------------------------------------
201651 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
201652 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
201653 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
201654 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
201655 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
201656 -- 5132302
201657 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
201658 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
201659
201660 END IF;
201661
201662 -- 4955764
201663 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
201664 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
201665
201666
201667 XLA_AE_LINES_PKG.ValidateCurrentLine;
201668 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
201669
201670 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
201671 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
201672 ,p_balance_type_code => l_balance_type_code);
201673
201674 END IF;
201675
201676 -----------------------------------------------------------------------------------------
201677 -- 4262811 Multiperiod Accounting
201678 -----------------------------------------------------------------------------------------
201679 -- No MPA option is assigned.
201680
201681
201682 END IF;
201683 END IF;
201684 --
201685
201686 --
201687 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
201688 trace
201689 (p_msg => 'END of AcctLineType_456'
201690 ,p_level => C_LEVEL_PROCEDURE
201691 ,p_module => l_log_module);
201692 END IF;
201693 --
201694 EXCEPTION
201695 WHEN xla_exceptions_pkg.application_exception THEN
201696 RAISE;
201697 WHEN OTHERS THEN
201698 xla_exceptions_pkg.raise_message
201699 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_456');
201700 END AcctLineType_456;
201701 --
201702
201703 ---------------------------------------
201704 --
201705 -- PRIVATE FUNCTION
201706 -- AcctLineType_457
201707 --
201708 ---------------------------------------
201709 PROCEDURE AcctLineType_457 (
201710 p_application_id IN NUMBER
201711 ,p_event_id IN NUMBER
201712 ,p_calculate_acctd_flag IN VARCHAR2
201713 ,p_calculate_g_l_flag IN VARCHAR2
201714 ,p_actual_flag IN OUT VARCHAR2
201715 ,p_balance_type_code OUT VARCHAR2
201716 ,p_gain_or_loss_ref OUT VARCHAR2
201717
201718 --Inflation Adjustment Type Description
201719 , p_source_2 IN VARCHAR2
201720 --Accounting Date
201721 , p_source_3 IN DATE
201722 --Inflation General Fund Ccid
201723 , p_source_41 IN NUMBER
201727 , p_source_50 IN NUMBER
201724 --Transaction Header Identifier
201725 , p_source_49 IN NUMBER
201726 --Adjustment Line Identifier
201728 --Distribution Type Code
201729 , p_source_51 IN VARCHAR2
201730 --Inflation Adjustment Type
201731 , p_source_64 IN VARCHAR2
201732 --Inflation Entered Amount
201733 , p_source_65 IN NUMBER
201734 --Inflation Currency Code
201735 , p_source_66 IN VARCHAR2
201736 )
201737 IS
201738
201739 l_component_type VARCHAR2(80);
201740 l_component_code VARCHAR2(30);
201741 l_component_type_code VARCHAR2(1);
201742 l_component_appl_id INTEGER;
201743 l_amb_context_code VARCHAR2(30);
201744 l_entity_code VARCHAR2(30);
201745 l_event_class_code VARCHAR2(30);
201746 l_ae_header_id NUMBER;
201747 l_event_type_code VARCHAR2(30);
201748 l_line_definition_code VARCHAR2(30);
201749 l_line_definition_owner_code VARCHAR2(1);
201750 --
201751 -- adr variables
201752 l_segment VARCHAR2(30);
201753 l_ccid NUMBER;
201754 l_adr_transaction_coa_id NUMBER;
201755 l_adr_accounting_coa_id NUMBER;
201756 l_adr_flexfield_segment_code VARCHAR2(30);
201757 l_adr_flex_value_set_id NUMBER;
201758 l_adr_value_type_code VARCHAR2(30);
201759 l_adr_value_combination_id NUMBER;
201760 l_adr_value_segment_code VARCHAR2(30);
201761
201762 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
201763 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
201764 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
201765 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
201766
201767 -- 4262811 Variables ------------------------------------------------------------------------------------------
201768 l_entered_amt_idx NUMBER;
201769 l_accted_amt_idx NUMBER;
201770 l_acc_rev_flag VARCHAR2(1);
201771 l_accrual_line_num NUMBER;
201772 l_tmp_amt NUMBER;
201773 l_acc_rev_natural_side_code VARCHAR2(1);
201774
201775 l_num_entries NUMBER;
201776 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
201777 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
201778 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
201779 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
201780 l_recog_line_1 NUMBER;
201781 l_recog_line_2 NUMBER;
201782
201783 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
201784 l_bflow_applied_to_amt NUMBER; -- 5132302
201785 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
201786
201787 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
201788
201789 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
201790 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
201791
201792 ---------------------------------------------------------------------------------------------------------------
201793
201794
201795 --
201796 -- bulk performance
201797 --
201798 l_balance_type_code VARCHAR2(1);
201799 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
201800 l_log_module VARCHAR2(240);
201801
201802 --
201803 -- Upgrade strategy
201804 --
201805 l_actual_upg_option VARCHAR2(1);
201806 l_enc_upg_option VARCHAR2(1);
201807
201808 --
201809 BEGIN
201810 --
201811 IF g_log_enabled THEN
201812 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_457';
201813 END IF;
201814 --
201815 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
201816
201817 trace
201818 (p_msg => 'BEGIN of AcctLineType_457'
201819 ,p_level => C_LEVEL_PROCEDURE
201820 ,p_module => l_log_module);
201821
201822 END IF;
201823 --
201824 l_component_type := 'AMB_JLT';
201825 l_component_code := 'IAC_GENERAL_FUND';
201826 l_component_type_code := 'S';
201827 l_component_appl_id := 140;
201828 l_amb_context_code := 'DEFAULT';
201829 l_entity_code := 'TRANSACTIONS';
201830 l_event_class_code := 'CATEGORY_RECLASS';
201831 l_event_type_code := 'CATEGORY_RECLASS_ALL';
201832 l_line_definition_owner_code := 'S';
201833 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
201834 --
201835 l_balance_type_code := 'A';
201836 l_segment := NULL;
201837 l_ccid := NULL;
201838 l_adr_transaction_coa_id := NULL;
201839 l_adr_accounting_coa_id := NULL;
201840 l_adr_flexfield_segment_code := NULL;
201841 l_adr_flex_value_set_id := NULL;
201842 l_adr_value_type_code := NULL;
201843 l_adr_value_combination_id := NULL;
201844 l_adr_value_segment_code := NULL;
201845
201846 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
201847 l_bflow_class_code := ''; -- 4219869 Business Flow
201848 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
201849 l_budgetary_control_flag := 'N';
201850
201851 l_bflow_applied_to_amt_idx := NULL; -- 5132302
201852 l_bflow_applied_to_amt := NULL; -- 5132302
201856 l_accrual_line_num := NULL; -- 4262811
201853 l_entered_amt_idx := NULL; -- 4262811
201854 l_accted_amt_idx := NULL; -- 4262811
201855 l_acc_rev_flag := NULL; -- 4262811
201857 l_tmp_amt := NULL; -- 4262811
201858 --
201859
201860 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
201861 l_balance_type_code <> 'B' THEN
201862 IF NVL(p_source_64,'
201863 ') = 'GENERAL FUND'
201864 THEN
201865
201866 --
201867 XLA_AE_LINES_PKG.SetNewLine;
201868
201869 p_balance_type_code := l_balance_type_code;
201870 -- set the flag so later we will know whether the gain loss line needs to be created
201871
201872 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
201873 p_actual_flag :='A';
201874 END IF;
201875
201876 --
201877 -- bulk performance
201878 --
201879 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
201880 p_header_num => 0); -- 4262811
201881 --
201882 -- set accounting line options
201883 --
201884 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
201885 p_natural_side_code => 'C'
201886 , p_gain_or_loss_flag => 'N'
201887 , p_gl_transfer_mode_code => 'S'
201888 , p_acct_entry_type_code => 'A'
201889 , p_switch_side_flag => 'Y'
201890 , p_merge_duplicate_code => 'N'
201891 );
201892 --
201893 l_acc_rev_natural_side_code := 'D'; -- 4262811
201894 --
201895 --
201896 -- set accounting line type info
201897 --
201898 xla_ae_lines_pkg.SetAcctLineType
201899 (p_component_type => l_component_type
201900 ,p_event_type_code => l_event_type_code
201901 ,p_line_definition_owner_code => l_line_definition_owner_code
201902 ,p_line_definition_code => l_line_definition_code
201903 ,p_accounting_line_code => l_component_code
201904 ,p_accounting_line_type_code => l_component_type_code
201905 ,p_accounting_line_appl_id => l_component_appl_id
201906 ,p_amb_context_code => l_amb_context_code
201907 ,p_entity_code => l_entity_code
201908 ,p_event_class_code => l_event_class_code);
201909 --
201910 -- set accounting class
201911 --
201912 xla_ae_lines_pkg.SetAcctClass(
201913 p_accounting_class_code => 'ASSET'
201914 , p_ae_header_id => l_ae_header_id
201915 );
201916
201917 --
201918 -- set rounding class
201919 --
201920 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
201921 'ASSET';
201922
201923 --
201924 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
201925 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
201926 --
201927 -- bulk performance
201928 --
201929 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
201930
201931 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
201932 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
201933
201934 -- 4955764
201935 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
201936 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
201937
201938 -- 4458381 Public Sector Enh
201939
201940 --
201941 -- set accounting attributes for the line type
201942 --
201943 l_entered_amt_idx := 4;
201944 l_accted_amt_idx := 6;
201945 l_bflow_applied_to_amt_idx := NULL; -- 5132302
201946 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
201947 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
201948 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
201949 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
201950 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
201951 l_rec_acct_attrs.array_char_value(3) := p_source_51;
201952 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
201953 l_rec_acct_attrs.array_num_value(4) := p_source_65;
201954 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
201955 l_rec_acct_attrs.array_char_value(5) := p_source_66;
201956 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
201957 l_rec_acct_attrs.array_num_value(6) := p_source_65;
201958
201959 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
201960 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
201961
201962 ---------------------------------------------------------------------------------------------------------------
201963 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
201964 ---------------------------------------------------------------------------------------------------------------
201965 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
201966
201967 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
201968 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
201969
201973 AND l_bflow_method_code = 'PRIOR_ENTRY'
201970 IF xla_accounting_cache_pkg.GetValueChar
201971 (p_source_code => 'LEDGER_CATEGORY_CODE'
201972 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
201974 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
201975 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
201976 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
201977 )
201978 THEN
201979 xla_ae_lines_pkg.BflowUpgEntry
201980 (p_business_method_code => l_bflow_method_code
201981 ,p_business_class_code => l_bflow_class_code
201982 ,p_balance_type => l_balance_type_code);
201983 ELSE
201984 NULL;
201985 -- No business flow processing for business flow method of NONE.
201986 END IF;
201987
201988 --
201989 -- call analytical criteria
201990 --
201991
201992 --
201993 -- call description
201994 --
201995
201996 xla_ae_lines_pkg.SetLineDescription(
201997 p_ae_header_id => l_ae_header_id
201998 ,p_description => Description_143 (
201999 p_application_id => p_application_id
202000 , p_ae_header_id => l_ae_header_id
202001 , p_source_2 => p_source_2
202002 , p_source_3 => p_source_3
202003 )
202004 );
202005
202006
202007 --
202008 -- call ADRs
202009 -- Bug 4922099
202010 --
202011 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
202012 (NVL(l_actual_upg_option, 'N') = 'O') OR
202013 (NVL(l_enc_upg_option, 'N') = 'O')
202014 )
202015 THEN
202016 NULL;
202017 --
202018 --
202019
202020 l_ccid := AcctDerRule_186(
202021 p_application_id => p_application_id
202022 , p_ae_header_id => l_ae_header_id
202023 , p_source_41 => p_source_41
202024 , x_transaction_coa_id => l_adr_transaction_coa_id
202025 , x_accounting_coa_id => l_adr_accounting_coa_id
202026 , x_value_type_code => l_adr_value_type_code
202027 , p_side => 'NA'
202028 );
202029
202030 xla_ae_lines_pkg.set_ccid(
202031 p_code_combination_id => l_ccid
202032 , p_value_type_code => l_adr_value_type_code
202033 , p_transaction_coa_id => l_adr_transaction_coa_id
202034 , p_accounting_coa_id => l_adr_accounting_coa_id
202035 , p_adr_code => 'IAC_GENERAL_FUND_AC'
202036 , p_adr_type_code => 'S'
202037 , p_component_type => l_component_type
202038 , p_component_code => l_component_code
202039 , p_component_type_code => l_component_type_code
202040 , p_component_appl_id => l_component_appl_id
202041 , p_amb_context_code => l_amb_context_code
202042 , p_side => 'NA'
202043 );
202044
202045
202046 --
202047 --
202048 END IF;
202049 --
202050 -- Bug 4922099
202051 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
202052 (NVL(l_enc_upg_option, 'N') = 'O')
202053 ) AND
202054 (l_bflow_method_code = 'PRIOR_ENTRY')
202055 )
202056 THEN
202057 IF
202058 --
202059 1 = 2
202060 --
202061 THEN
202062 xla_accounting_err_pkg.build_message
202063 (p_appli_s_name => 'XLA'
202064 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
202065 ,p_token_1 => 'LINE_NUMBER'
202066 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
202067 ,p_token_2 => 'LINE_TYPE_NAME'
202068 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
202069 l_component_type
202070 ,l_component_code
202071 ,l_component_type_code
202072 ,l_component_appl_id
202073 ,l_amb_context_code
202074 ,l_entity_code
202075 ,l_event_class_code
202076 )
202077 ,p_token_3 => 'OWNER'
202078 ,p_value_3 => xla_lookups_pkg.get_meaning(
202079 p_lookup_type => 'XLA_OWNER_TYPE'
202080 ,p_lookup_code => l_component_type_code
202081 )
202082 ,p_token_4 => 'PRODUCT_NAME'
202083 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
202084 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
202088 );
202085 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
202086 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
202087 ,p_ae_header_id => NULL
202089
202090 IF (C_LEVEL_ERROR>= g_log_level) THEN
202091 trace
202092 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
202093 ,p_level => C_LEVEL_ERROR
202094 ,p_module => l_log_module);
202095 END IF;
202096 END IF;
202097 END IF;
202098 --
202099 --
202100 ------------------------------------------------------------------------------------------------
202101 -- 4219869 Business Flow
202102 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
202103 -- Prior Entry. Currently, the following code is always generated.
202104 ------------------------------------------------------------------------------------------------
202105 XLA_AE_LINES_PKG.ValidateCurrentLine;
202106
202107 ------------------------------------------------------------------------------------
202108 -- 4219869 Business Flow
202109 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
202110 ------------------------------------------------------------------------------------
202111 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
202112
202113 ----------------------------------------------------------------------------------
202114 -- 4219869 Business Flow
202115 -- Update journal entry status -- Need to generate this within IF <condition>
202116 ----------------------------------------------------------------------------------
202117 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
202118 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
202119 ,p_balance_type_code => l_balance_type_code
202120 );
202121
202122 -------------------------------------------------------------------------------------------
202123 -- 4262811 - Generate the Accrual Reversal lines
202124 -------------------------------------------------------------------------------------------
202125 BEGIN
202126 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
202127 (g_array_event(p_event_id).array_value_num('header_index'));
202128 IF l_acc_rev_flag IS NULL THEN
202129 l_acc_rev_flag := 'N';
202130 END IF;
202131 EXCEPTION
202132 WHEN OTHERS THEN
202133 l_acc_rev_flag := 'N';
202134 END;
202135 --
202136 IF (l_acc_rev_flag = 'Y') THEN
202137
202138 -- 4645092 ------------------------------------------------------------------------------
202139 -- To allow MPA report to determine if it should generate report process
202140 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
202141 ------------------------------------------------------------------------------------------
202142
202143 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
202144 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
202145 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
202146 -- call ADRs
202147 -- Bug 4922099
202148 --
202149 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
202150 (NVL(l_actual_upg_option, 'N') = 'O') OR
202151 (NVL(l_enc_upg_option, 'N') = 'O')
202152 )
202153 THEN
202154 NULL;
202155 --
202156 --
202157
202158 l_ccid := AcctDerRule_186(
202159 p_application_id => p_application_id
202160 , p_ae_header_id => l_ae_header_id
202161 , p_source_41 => p_source_41
202162 , x_transaction_coa_id => l_adr_transaction_coa_id
202163 , x_accounting_coa_id => l_adr_accounting_coa_id
202164 , x_value_type_code => l_adr_value_type_code
202165 , p_side => 'NA'
202166 );
202167
202168 xla_ae_lines_pkg.set_ccid(
202169 p_code_combination_id => l_ccid
202170 , p_value_type_code => l_adr_value_type_code
202171 , p_transaction_coa_id => l_adr_transaction_coa_id
202172 , p_accounting_coa_id => l_adr_accounting_coa_id
202173 , p_adr_code => 'IAC_GENERAL_FUND_AC'
202174 , p_adr_type_code => 'S'
202175 , p_component_type => l_component_type
202176 , p_component_code => l_component_code
202177 , p_component_type_code => l_component_type_code
202178 , p_component_appl_id => l_component_appl_id
202179 , p_amb_context_code => l_amb_context_code
202180 , p_side => 'NA'
202181 );
202182
202183
202184 --
202185 --
202186 END IF;
202187
202188 --
202189 -- Update the line information that should be overwritten
202190 --
202191 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
202192 p_header_num => 1);
202193 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
202194
202195 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
202196
202200
202197 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
202198 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
202199 END IF;
202201 --
202202 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
202203 --
202204 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
202205 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
202206 ELSE
202207 ---------------------------------------------------------------------------------------------------
202208 -- 4262811a Switch Sign
202209 ---------------------------------------------------------------------------------------------------
202210 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
202211 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
202212 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
202213 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
202214 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
202215 -- 5132302
202216 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
202217 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
202218
202219 END IF;
202220
202221 -- 4955764
202222 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
202223 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
202224
202225
202226 XLA_AE_LINES_PKG.ValidateCurrentLine;
202227 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
202228
202229 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
202230 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
202231 ,p_balance_type_code => l_balance_type_code);
202232
202233 END IF;
202234
202235 -----------------------------------------------------------------------------------------
202236 -- 4262811 Multiperiod Accounting
202237 -----------------------------------------------------------------------------------------
202238 -- No MPA option is assigned.
202239
202240
202241 END IF;
202242 END IF;
202243 --
202244
202245 --
202246 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
202247 trace
202248 (p_msg => 'END of AcctLineType_457'
202249 ,p_level => C_LEVEL_PROCEDURE
202250 ,p_module => l_log_module);
202251 END IF;
202252 --
202253 EXCEPTION
202254 WHEN xla_exceptions_pkg.application_exception THEN
202255 RAISE;
202256 WHEN OTHERS THEN
202257 xla_exceptions_pkg.raise_message
202258 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_457');
202259 END AcctLineType_457;
202260 --
202261
202262 ---------------------------------------
202263 --
202264 -- PRIVATE FUNCTION
202265 -- AcctLineType_458
202266 --
202267 ---------------------------------------
202268 PROCEDURE AcctLineType_458 (
202269 p_application_id IN NUMBER
202270 ,p_event_id IN NUMBER
202271 ,p_calculate_acctd_flag IN VARCHAR2
202272 ,p_calculate_g_l_flag IN VARCHAR2
202273 ,p_actual_flag IN OUT VARCHAR2
202274 ,p_balance_type_code OUT VARCHAR2
202275 ,p_gain_or_loss_ref OUT VARCHAR2
202276
202277 --Inflation Adjustment Type Description
202278 , p_source_2 IN VARCHAR2
202279 --Accounting Date
202280 , p_source_3 IN DATE
202281 --Inflation General Fund Ccid
202282 , p_source_41 IN NUMBER
202283 --Transaction Header Identifier
202284 , p_source_49 IN NUMBER
202285 --Adjustment Line Identifier
202286 , p_source_50 IN NUMBER
202287 --Distribution Type Code
202288 , p_source_51 IN VARCHAR2
202289 --Inflation Adjustment Type
202290 , p_source_64 IN VARCHAR2
202291 --Inflation Entered Amount
202292 , p_source_65 IN NUMBER
202293 --Inflation Currency Code
202294 , p_source_66 IN VARCHAR2
202295 )
202296 IS
202297
202298 l_component_type VARCHAR2(80);
202299 l_component_code VARCHAR2(30);
202300 l_component_type_code VARCHAR2(1);
202301 l_component_appl_id INTEGER;
202302 l_amb_context_code VARCHAR2(30);
202303 l_entity_code VARCHAR2(30);
202304 l_event_class_code VARCHAR2(30);
202305 l_ae_header_id NUMBER;
202306 l_event_type_code VARCHAR2(30);
202307 l_line_definition_code VARCHAR2(30);
202308 l_line_definition_owner_code VARCHAR2(1);
202309 --
202310 -- adr variables
202311 l_segment VARCHAR2(30);
202312 l_ccid NUMBER;
202313 l_adr_transaction_coa_id NUMBER;
202314 l_adr_accounting_coa_id NUMBER;
202315 l_adr_flexfield_segment_code VARCHAR2(30);
202316 l_adr_flex_value_set_id NUMBER;
202317 l_adr_value_type_code VARCHAR2(30);
202318 l_adr_value_combination_id NUMBER;
202319 l_adr_value_segment_code VARCHAR2(30);
202320
202324 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
202321 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
202322 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
202323 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
202325
202326 -- 4262811 Variables ------------------------------------------------------------------------------------------
202327 l_entered_amt_idx NUMBER;
202328 l_accted_amt_idx NUMBER;
202329 l_acc_rev_flag VARCHAR2(1);
202330 l_accrual_line_num NUMBER;
202331 l_tmp_amt NUMBER;
202332 l_acc_rev_natural_side_code VARCHAR2(1);
202333
202334 l_num_entries NUMBER;
202335 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
202336 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
202337 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
202338 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
202339 l_recog_line_1 NUMBER;
202340 l_recog_line_2 NUMBER;
202341
202342 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
202343 l_bflow_applied_to_amt NUMBER; -- 5132302
202344 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
202345
202346 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
202347
202348 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
202349 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
202350
202351 ---------------------------------------------------------------------------------------------------------------
202352
202353
202354 --
202355 -- bulk performance
202356 --
202357 l_balance_type_code VARCHAR2(1);
202358 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
202359 l_log_module VARCHAR2(240);
202360
202361 --
202362 -- Upgrade strategy
202363 --
202364 l_actual_upg_option VARCHAR2(1);
202365 l_enc_upg_option VARCHAR2(1);
202366
202367 --
202368 BEGIN
202369 --
202370 IF g_log_enabled THEN
202371 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_458';
202372 END IF;
202373 --
202374 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
202375
202376 trace
202377 (p_msg => 'BEGIN of AcctLineType_458'
202378 ,p_level => C_LEVEL_PROCEDURE
202379 ,p_module => l_log_module);
202380
202381 END IF;
202382 --
202383 l_component_type := 'AMB_JLT';
202384 l_component_code := 'IAC_GENERAL_FUND';
202385 l_component_type_code := 'S';
202386 l_component_appl_id := 140;
202387 l_amb_context_code := 'DEFAULT';
202388 l_entity_code := 'TRANSACTIONS';
202389 l_event_class_code := 'ADDITIONS';
202390 l_event_type_code := 'ADDITIONS_ALL';
202391 l_line_definition_owner_code := 'S';
202392 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
202393 --
202394 l_balance_type_code := 'A';
202395 l_segment := NULL;
202396 l_ccid := NULL;
202397 l_adr_transaction_coa_id := NULL;
202398 l_adr_accounting_coa_id := NULL;
202399 l_adr_flexfield_segment_code := NULL;
202400 l_adr_flex_value_set_id := NULL;
202401 l_adr_value_type_code := NULL;
202402 l_adr_value_combination_id := NULL;
202403 l_adr_value_segment_code := NULL;
202404
202405 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
202406 l_bflow_class_code := ''; -- 4219869 Business Flow
202407 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
202408 l_budgetary_control_flag := 'N';
202409
202410 l_bflow_applied_to_amt_idx := NULL; -- 5132302
202411 l_bflow_applied_to_amt := NULL; -- 5132302
202412 l_entered_amt_idx := NULL; -- 4262811
202413 l_accted_amt_idx := NULL; -- 4262811
202414 l_acc_rev_flag := NULL; -- 4262811
202415 l_accrual_line_num := NULL; -- 4262811
202416 l_tmp_amt := NULL; -- 4262811
202417 --
202418
202419 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
202420 l_balance_type_code <> 'B' THEN
202421 IF NVL(p_source_64,'
202422 ') = 'GENERAL FUND'
202423 THEN
202424
202425 --
202426 XLA_AE_LINES_PKG.SetNewLine;
202427
202428 p_balance_type_code := l_balance_type_code;
202429 -- set the flag so later we will know whether the gain loss line needs to be created
202430
202431 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
202432 p_actual_flag :='A';
202433 END IF;
202434
202435 --
202436 -- bulk performance
202437 --
202438 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
202439 p_header_num => 0); -- 4262811
202440 --
202441 -- set accounting line options
202442 --
202443 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
202444 p_natural_side_code => 'C'
202445 , p_gain_or_loss_flag => 'N'
202446 , p_gl_transfer_mode_code => 'S'
202447 , p_acct_entry_type_code => 'A'
202448 , p_switch_side_flag => 'Y'
202449 , p_merge_duplicate_code => 'N'
202450 );
202451 --
202455 -- set accounting line type info
202452 l_acc_rev_natural_side_code := 'D'; -- 4262811
202453 --
202454 --
202456 --
202457 xla_ae_lines_pkg.SetAcctLineType
202458 (p_component_type => l_component_type
202459 ,p_event_type_code => l_event_type_code
202460 ,p_line_definition_owner_code => l_line_definition_owner_code
202461 ,p_line_definition_code => l_line_definition_code
202462 ,p_accounting_line_code => l_component_code
202463 ,p_accounting_line_type_code => l_component_type_code
202464 ,p_accounting_line_appl_id => l_component_appl_id
202465 ,p_amb_context_code => l_amb_context_code
202466 ,p_entity_code => l_entity_code
202467 ,p_event_class_code => l_event_class_code);
202468 --
202469 -- set accounting class
202470 --
202471 xla_ae_lines_pkg.SetAcctClass(
202472 p_accounting_class_code => 'ASSET'
202473 , p_ae_header_id => l_ae_header_id
202474 );
202475
202476 --
202477 -- set rounding class
202478 --
202479 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
202480 'ASSET';
202481
202482 --
202483 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
202484 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
202485 --
202486 -- bulk performance
202487 --
202488 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
202489
202490 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
202491 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
202492
202493 -- 4955764
202494 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
202495 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
202496
202497 -- 4458381 Public Sector Enh
202498
202499 --
202500 -- set accounting attributes for the line type
202501 --
202502 l_entered_amt_idx := 4;
202503 l_accted_amt_idx := 6;
202504 l_bflow_applied_to_amt_idx := NULL; -- 5132302
202505 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
202506 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
202507 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
202508 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
202509 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
202510 l_rec_acct_attrs.array_char_value(3) := p_source_51;
202511 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
202512 l_rec_acct_attrs.array_num_value(4) := p_source_65;
202513 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
202514 l_rec_acct_attrs.array_char_value(5) := p_source_66;
202515 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
202516 l_rec_acct_attrs.array_num_value(6) := p_source_65;
202517
202518 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
202519 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
202520
202521 ---------------------------------------------------------------------------------------------------------------
202522 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
202523 ---------------------------------------------------------------------------------------------------------------
202524 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
202525
202526 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
202527 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
202528
202529 IF xla_accounting_cache_pkg.GetValueChar
202530 (p_source_code => 'LEDGER_CATEGORY_CODE'
202531 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
202532 AND l_bflow_method_code = 'PRIOR_ENTRY'
202533 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
202534 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
202535 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
202536 )
202537 THEN
202538 xla_ae_lines_pkg.BflowUpgEntry
202539 (p_business_method_code => l_bflow_method_code
202540 ,p_business_class_code => l_bflow_class_code
202541 ,p_balance_type => l_balance_type_code);
202542 ELSE
202543 NULL;
202544 -- No business flow processing for business flow method of NONE.
202545 END IF;
202546
202547 --
202548 -- call analytical criteria
202549 --
202550
202551 --
202552 -- call description
202553 --
202554
202555 xla_ae_lines_pkg.SetLineDescription(
202556 p_ae_header_id => l_ae_header_id
202557 ,p_description => Description_143 (
202558 p_application_id => p_application_id
202559 , p_ae_header_id => l_ae_header_id
202560 , p_source_2 => p_source_2
202561 , p_source_3 => p_source_3
202562 )
202563 );
202564
202565
202566 --
202567 -- call ADRs
202568 -- Bug 4922099
202569 --
202570 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
202574 THEN
202571 (NVL(l_actual_upg_option, 'N') = 'O') OR
202572 (NVL(l_enc_upg_option, 'N') = 'O')
202573 )
202575 NULL;
202576 --
202577 --
202578
202579 l_ccid := AcctDerRule_186(
202580 p_application_id => p_application_id
202581 , p_ae_header_id => l_ae_header_id
202582 , p_source_41 => p_source_41
202583 , x_transaction_coa_id => l_adr_transaction_coa_id
202584 , x_accounting_coa_id => l_adr_accounting_coa_id
202585 , x_value_type_code => l_adr_value_type_code
202586 , p_side => 'NA'
202587 );
202588
202589 xla_ae_lines_pkg.set_ccid(
202590 p_code_combination_id => l_ccid
202591 , p_value_type_code => l_adr_value_type_code
202592 , p_transaction_coa_id => l_adr_transaction_coa_id
202593 , p_accounting_coa_id => l_adr_accounting_coa_id
202594 , p_adr_code => 'IAC_GENERAL_FUND_AC'
202595 , p_adr_type_code => 'S'
202596 , p_component_type => l_component_type
202597 , p_component_code => l_component_code
202598 , p_component_type_code => l_component_type_code
202599 , p_component_appl_id => l_component_appl_id
202600 , p_amb_context_code => l_amb_context_code
202601 , p_side => 'NA'
202602 );
202603
202604
202605 --
202606 --
202607 END IF;
202608 --
202609 -- Bug 4922099
202610 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
202611 (NVL(l_enc_upg_option, 'N') = 'O')
202612 ) AND
202613 (l_bflow_method_code = 'PRIOR_ENTRY')
202614 )
202615 THEN
202616 IF
202617 --
202618 1 = 2
202619 --
202620 THEN
202621 xla_accounting_err_pkg.build_message
202622 (p_appli_s_name => 'XLA'
202623 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
202624 ,p_token_1 => 'LINE_NUMBER'
202625 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
202626 ,p_token_2 => 'LINE_TYPE_NAME'
202627 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
202628 l_component_type
202629 ,l_component_code
202630 ,l_component_type_code
202631 ,l_component_appl_id
202632 ,l_amb_context_code
202633 ,l_entity_code
202634 ,l_event_class_code
202635 )
202636 ,p_token_3 => 'OWNER'
202637 ,p_value_3 => xla_lookups_pkg.get_meaning(
202638 p_lookup_type => 'XLA_OWNER_TYPE'
202639 ,p_lookup_code => l_component_type_code
202640 )
202641 ,p_token_4 => 'PRODUCT_NAME'
202642 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
202643 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
202644 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
202645 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
202646 ,p_ae_header_id => NULL
202647 );
202648
202649 IF (C_LEVEL_ERROR>= g_log_level) THEN
202650 trace
202651 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
202652 ,p_level => C_LEVEL_ERROR
202653 ,p_module => l_log_module);
202654 END IF;
202655 END IF;
202656 END IF;
202657 --
202658 --
202659 ------------------------------------------------------------------------------------------------
202660 -- 4219869 Business Flow
202661 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
202662 -- Prior Entry. Currently, the following code is always generated.
202663 ------------------------------------------------------------------------------------------------
202664 XLA_AE_LINES_PKG.ValidateCurrentLine;
202665
202666 ------------------------------------------------------------------------------------
202667 -- 4219869 Business Flow
202668 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
202669 ------------------------------------------------------------------------------------
202670 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
202671
202675 ----------------------------------------------------------------------------------
202672 ----------------------------------------------------------------------------------
202673 -- 4219869 Business Flow
202674 -- Update journal entry status -- Need to generate this within IF <condition>
202676 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
202677 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
202678 ,p_balance_type_code => l_balance_type_code
202679 );
202680
202681 -------------------------------------------------------------------------------------------
202682 -- 4262811 - Generate the Accrual Reversal lines
202683 -------------------------------------------------------------------------------------------
202684 BEGIN
202685 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
202686 (g_array_event(p_event_id).array_value_num('header_index'));
202687 IF l_acc_rev_flag IS NULL THEN
202688 l_acc_rev_flag := 'N';
202689 END IF;
202690 EXCEPTION
202691 WHEN OTHERS THEN
202692 l_acc_rev_flag := 'N';
202693 END;
202694 --
202695 IF (l_acc_rev_flag = 'Y') THEN
202696
202697 -- 4645092 ------------------------------------------------------------------------------
202698 -- To allow MPA report to determine if it should generate report process
202699 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
202700 ------------------------------------------------------------------------------------------
202701
202702 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
202703 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
202704 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
202705 -- call ADRs
202706 -- Bug 4922099
202707 --
202708 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
202709 (NVL(l_actual_upg_option, 'N') = 'O') OR
202710 (NVL(l_enc_upg_option, 'N') = 'O')
202711 )
202712 THEN
202713 NULL;
202714 --
202715 --
202716
202717 l_ccid := AcctDerRule_186(
202718 p_application_id => p_application_id
202719 , p_ae_header_id => l_ae_header_id
202720 , p_source_41 => p_source_41
202721 , x_transaction_coa_id => l_adr_transaction_coa_id
202722 , x_accounting_coa_id => l_adr_accounting_coa_id
202723 , x_value_type_code => l_adr_value_type_code
202724 , p_side => 'NA'
202725 );
202726
202727 xla_ae_lines_pkg.set_ccid(
202728 p_code_combination_id => l_ccid
202729 , p_value_type_code => l_adr_value_type_code
202730 , p_transaction_coa_id => l_adr_transaction_coa_id
202731 , p_accounting_coa_id => l_adr_accounting_coa_id
202732 , p_adr_code => 'IAC_GENERAL_FUND_AC'
202733 , p_adr_type_code => 'S'
202734 , p_component_type => l_component_type
202735 , p_component_code => l_component_code
202736 , p_component_type_code => l_component_type_code
202737 , p_component_appl_id => l_component_appl_id
202738 , p_amb_context_code => l_amb_context_code
202739 , p_side => 'NA'
202740 );
202741
202742
202743 --
202744 --
202745 END IF;
202746
202747 --
202748 -- Update the line information that should be overwritten
202749 --
202750 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
202751 p_header_num => 1);
202752 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
202753
202754 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
202755
202756 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
202757 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
202758 END IF;
202759
202760 --
202761 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
202762 --
202763 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
202764 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
202765 ELSE
202766 ---------------------------------------------------------------------------------------------------
202767 -- 4262811a Switch Sign
202768 ---------------------------------------------------------------------------------------------------
202769 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
202770 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
202771 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
202772 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
202773 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
202774 -- 5132302
202775 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
202776 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
202777
202781 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
202778 END IF;
202779
202780 -- 4955764
202782 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
202783
202784
202785 XLA_AE_LINES_PKG.ValidateCurrentLine;
202786 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
202787
202788 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
202789 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
202790 ,p_balance_type_code => l_balance_type_code);
202791
202792 END IF;
202793
202794 -----------------------------------------------------------------------------------------
202795 -- 4262811 Multiperiod Accounting
202796 -----------------------------------------------------------------------------------------
202797 -- No MPA option is assigned.
202798
202799
202800 END IF;
202801 END IF;
202802 --
202803
202804 --
202805 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
202806 trace
202807 (p_msg => 'END of AcctLineType_458'
202808 ,p_level => C_LEVEL_PROCEDURE
202809 ,p_module => l_log_module);
202810 END IF;
202811 --
202812 EXCEPTION
202813 WHEN xla_exceptions_pkg.application_exception THEN
202814 RAISE;
202815 WHEN OTHERS THEN
202816 xla_exceptions_pkg.raise_message
202817 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_458');
202818 END AcctLineType_458;
202819 --
202820
202821 ---------------------------------------
202822 --
202823 -- PRIVATE FUNCTION
202824 -- AcctLineType_459
202825 --
202826 ---------------------------------------
202827 PROCEDURE AcctLineType_459 (
202828 p_application_id IN NUMBER
202829 ,p_event_id IN NUMBER
202830 ,p_calculate_acctd_flag IN VARCHAR2
202831 ,p_calculate_g_l_flag IN VARCHAR2
202832 ,p_actual_flag IN OUT VARCHAR2
202833 ,p_balance_type_code OUT VARCHAR2
202834 ,p_gain_or_loss_ref OUT VARCHAR2
202835
202836 --Inflation Adjustment Type Description
202837 , p_source_2 IN VARCHAR2
202838 --Accounting Date
202839 , p_source_3 IN DATE
202840 --Inflation AP Intercompany Ccid
202841 , p_source_42 IN NUMBER
202842 --Distribution Type Code
202843 , p_source_51 IN VARCHAR2
202844 --Inflation Adjustment Type
202845 , p_source_64 IN VARCHAR2
202846 --Inflation Entered Amount
202847 , p_source_65 IN NUMBER
202848 --Inflation Currency Code
202849 , p_source_66 IN VARCHAR2
202850 --Inflation Adjustment Identifier
202851 , p_source_67 IN NUMBER
202852 --Inflation Asset Identifier
202853 , p_source_68 IN NUMBER
202854 --Inflation Asset Distribution Identifier
202855 , p_source_69 IN NUMBER
202856 --Inflation Adjustment Line Identifier
202857 , p_source_70 IN NUMBER
202858 )
202859 IS
202860
202861 l_component_type VARCHAR2(80);
202862 l_component_code VARCHAR2(30);
202863 l_component_type_code VARCHAR2(1);
202864 l_component_appl_id INTEGER;
202865 l_amb_context_code VARCHAR2(30);
202866 l_entity_code VARCHAR2(30);
202867 l_event_class_code VARCHAR2(30);
202868 l_ae_header_id NUMBER;
202869 l_event_type_code VARCHAR2(30);
202870 l_line_definition_code VARCHAR2(30);
202871 l_line_definition_owner_code VARCHAR2(1);
202872 --
202873 -- adr variables
202874 l_segment VARCHAR2(30);
202875 l_ccid NUMBER;
202876 l_adr_transaction_coa_id NUMBER;
202877 l_adr_accounting_coa_id NUMBER;
202878 l_adr_flexfield_segment_code VARCHAR2(30);
202879 l_adr_flex_value_set_id NUMBER;
202880 l_adr_value_type_code VARCHAR2(30);
202881 l_adr_value_combination_id NUMBER;
202882 l_adr_value_segment_code VARCHAR2(30);
202883
202884 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
202885 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
202886 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
202887 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
202888
202889 -- 4262811 Variables ------------------------------------------------------------------------------------------
202890 l_entered_amt_idx NUMBER;
202891 l_accted_amt_idx NUMBER;
202892 l_acc_rev_flag VARCHAR2(1);
202893 l_accrual_line_num NUMBER;
202894 l_tmp_amt NUMBER;
202895 l_acc_rev_natural_side_code VARCHAR2(1);
202896
202897 l_num_entries NUMBER;
202898 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
202899 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
202900 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
202901 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
202902 l_recog_line_1 NUMBER;
202903 l_recog_line_2 NUMBER;
202904
202905 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
202906 l_bflow_applied_to_amt NUMBER; -- 5132302
202907 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
202908
202909 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
202910
202914 ---------------------------------------------------------------------------------------------------------------
202911 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
202912 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
202913
202915
202916
202917 --
202918 -- bulk performance
202919 --
202920 l_balance_type_code VARCHAR2(1);
202921 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
202922 l_log_module VARCHAR2(240);
202923
202924 --
202925 -- Upgrade strategy
202926 --
202927 l_actual_upg_option VARCHAR2(1);
202928 l_enc_upg_option VARCHAR2(1);
202929
202930 --
202931 BEGIN
202932 --
202933 IF g_log_enabled THEN
202934 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_459';
202935 END IF;
202936 --
202937 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
202938
202939 trace
202940 (p_msg => 'BEGIN of AcctLineType_459'
202941 ,p_level => C_LEVEL_PROCEDURE
202942 ,p_module => l_log_module);
202943
202944 END IF;
202945 --
202946 l_component_type := 'AMB_JLT';
202947 l_component_code := 'IAC_INTERCOMPANY_AP';
202948 l_component_type_code := 'S';
202949 l_component_appl_id := 140;
202950 l_amb_context_code := 'DEFAULT';
202951 l_entity_code := 'TRANSACTIONS';
202952 l_event_class_code := 'INFLATION_REVALUATION';
202953 l_event_type_code := 'INFLATION_REVALUATION_ALL';
202954 l_line_definition_owner_code := 'S';
202955 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
202956 --
202957 l_balance_type_code := 'A';
202958 l_segment := NULL;
202959 l_ccid := NULL;
202960 l_adr_transaction_coa_id := NULL;
202961 l_adr_accounting_coa_id := NULL;
202962 l_adr_flexfield_segment_code := NULL;
202963 l_adr_flex_value_set_id := NULL;
202964 l_adr_value_type_code := NULL;
202965 l_adr_value_combination_id := NULL;
202966 l_adr_value_segment_code := NULL;
202967
202968 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
202969 l_bflow_class_code := ''; -- 4219869 Business Flow
202970 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
202971 l_budgetary_control_flag := 'N';
202972
202973 l_bflow_applied_to_amt_idx := NULL; -- 5132302
202974 l_bflow_applied_to_amt := NULL; -- 5132302
202975 l_entered_amt_idx := NULL; -- 4262811
202976 l_accted_amt_idx := NULL; -- 4262811
202977 l_acc_rev_flag := NULL; -- 4262811
202978 l_accrual_line_num := NULL; -- 4262811
202979 l_tmp_amt := NULL; -- 4262811
202980 --
202981
202982 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
202983 l_balance_type_code <> 'B' THEN
202984 IF NVL(p_source_64,'
202985 ') = 'INTERCO AP'
202986 THEN
202987
202988 --
202989 XLA_AE_LINES_PKG.SetNewLine;
202990
202991 p_balance_type_code := l_balance_type_code;
202992 -- set the flag so later we will know whether the gain loss line needs to be created
202993
202994 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
202995 p_actual_flag :='A';
202996 END IF;
202997
202998 --
202999 -- bulk performance
203000 --
203001 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
203002 p_header_num => 0); -- 4262811
203003 --
203004 -- set accounting line options
203005 --
203006 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
203007 p_natural_side_code => 'C'
203008 , p_gain_or_loss_flag => 'N'
203009 , p_gl_transfer_mode_code => 'S'
203010 , p_acct_entry_type_code => 'A'
203011 , p_switch_side_flag => 'Y'
203012 , p_merge_duplicate_code => 'N'
203013 );
203014 --
203015 l_acc_rev_natural_side_code := 'D'; -- 4262811
203016 --
203017 --
203018 -- set accounting line type info
203019 --
203020 xla_ae_lines_pkg.SetAcctLineType
203021 (p_component_type => l_component_type
203022 ,p_event_type_code => l_event_type_code
203023 ,p_line_definition_owner_code => l_line_definition_owner_code
203024 ,p_line_definition_code => l_line_definition_code
203025 ,p_accounting_line_code => l_component_code
203026 ,p_accounting_line_type_code => l_component_type_code
203027 ,p_accounting_line_appl_id => l_component_appl_id
203028 ,p_amb_context_code => l_amb_context_code
203029 ,p_entity_code => l_entity_code
203030 ,p_event_class_code => l_event_class_code);
203031 --
203032 -- set accounting class
203033 --
203034 xla_ae_lines_pkg.SetAcctClass(
203035 p_accounting_class_code => 'LIABILITY'
203036 , p_ae_header_id => l_ae_header_id
203037 );
203038
203039 --
203040 -- set rounding class
203041 --
203042 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
203043 'LIABILITY';
203044
203045 --
203046 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
203050 --
203047 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
203048 --
203049 -- bulk performance
203051 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
203052
203053 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
203054 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
203055
203056 -- 4955764
203057 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
203058 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
203059
203060 -- 4458381 Public Sector Enh
203061
203062 --
203063 -- set accounting attributes for the line type
203064 --
203065 l_entered_amt_idx := 6;
203066 l_accted_amt_idx := 8;
203067 l_bflow_applied_to_amt_idx := NULL; -- 5132302
203068 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
203069 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_67);
203070 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
203071 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_68);
203072 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
203073 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_69);
203074 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
203075 l_rec_acct_attrs.array_num_value(4) := to_char(p_source_70);
203076 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_TYPE';
203077 l_rec_acct_attrs.array_char_value(5) := p_source_51;
203078 l_rec_acct_attrs.array_acct_attr_code(6) := 'ENTERED_CURRENCY_AMOUNT';
203079 l_rec_acct_attrs.array_num_value(6) := p_source_65;
203080 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_CODE';
203081 l_rec_acct_attrs.array_char_value(7) := p_source_66;
203082 l_rec_acct_attrs.array_acct_attr_code(8) := 'LEDGER_AMOUNT';
203083 l_rec_acct_attrs.array_num_value(8) := p_source_65;
203084
203085 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
203086 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
203087
203088 ---------------------------------------------------------------------------------------------------------------
203089 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
203090 ---------------------------------------------------------------------------------------------------------------
203091 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
203092
203093 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
203094 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
203095
203096 IF xla_accounting_cache_pkg.GetValueChar
203097 (p_source_code => 'LEDGER_CATEGORY_CODE'
203098 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
203099 AND l_bflow_method_code = 'PRIOR_ENTRY'
203100 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
203101 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
203102 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
203103 )
203104 THEN
203105 xla_ae_lines_pkg.BflowUpgEntry
203106 (p_business_method_code => l_bflow_method_code
203107 ,p_business_class_code => l_bflow_class_code
203108 ,p_balance_type => l_balance_type_code);
203109 ELSE
203110 NULL;
203111 -- No business flow processing for business flow method of NONE.
203112 END IF;
203113
203114 --
203115 -- call analytical criteria
203116 --
203117
203118 --
203119 -- call description
203120 --
203121
203122 xla_ae_lines_pkg.SetLineDescription(
203123 p_ae_header_id => l_ae_header_id
203124 ,p_description => Description_143 (
203125 p_application_id => p_application_id
203126 , p_ae_header_id => l_ae_header_id
203127 , p_source_2 => p_source_2
203128 , p_source_3 => p_source_3
203129 )
203130 );
203131
203132
203133 --
203134 -- call ADRs
203135 -- Bug 4922099
203136 --
203137 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
203138 (NVL(l_actual_upg_option, 'N') = 'O') OR
203139 (NVL(l_enc_upg_option, 'N') = 'O')
203140 )
203141 THEN
203142 NULL;
203143 --
203144 --
203145
203146 l_ccid := AcctDerRule_187(
203147 p_application_id => p_application_id
203148 , p_ae_header_id => l_ae_header_id
203149 , p_source_42 => p_source_42
203150 , x_transaction_coa_id => l_adr_transaction_coa_id
203151 , x_accounting_coa_id => l_adr_accounting_coa_id
203152 , x_value_type_code => l_adr_value_type_code
203153 , p_side => 'NA'
203154 );
203155
203156 xla_ae_lines_pkg.set_ccid(
203157 p_code_combination_id => l_ccid
203158 , p_value_type_code => l_adr_value_type_code
203159 , p_transaction_coa_id => l_adr_transaction_coa_id
203160 , p_accounting_coa_id => l_adr_accounting_coa_id
203161 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
203162 , p_adr_type_code => 'S'
203166 , p_component_appl_id => l_component_appl_id
203163 , p_component_type => l_component_type
203164 , p_component_code => l_component_code
203165 , p_component_type_code => l_component_type_code
203167 , p_amb_context_code => l_amb_context_code
203168 , p_side => 'NA'
203169 );
203170
203171
203172 --
203173 --
203174 END IF;
203175 --
203176 -- Bug 4922099
203177 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
203178 (NVL(l_enc_upg_option, 'N') = 'O')
203179 ) AND
203180 (l_bflow_method_code = 'PRIOR_ENTRY')
203181 )
203182 THEN
203183 IF
203184 --
203185 1 = 2
203186 --
203187 THEN
203188 xla_accounting_err_pkg.build_message
203189 (p_appli_s_name => 'XLA'
203190 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
203191 ,p_token_1 => 'LINE_NUMBER'
203192 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
203193 ,p_token_2 => 'LINE_TYPE_NAME'
203194 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
203195 l_component_type
203196 ,l_component_code
203197 ,l_component_type_code
203198 ,l_component_appl_id
203199 ,l_amb_context_code
203200 ,l_entity_code
203201 ,l_event_class_code
203202 )
203203 ,p_token_3 => 'OWNER'
203204 ,p_value_3 => xla_lookups_pkg.get_meaning(
203205 p_lookup_type => 'XLA_OWNER_TYPE'
203206 ,p_lookup_code => l_component_type_code
203207 )
203208 ,p_token_4 => 'PRODUCT_NAME'
203209 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
203210 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
203211 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
203212 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
203213 ,p_ae_header_id => NULL
203214 );
203215
203216 IF (C_LEVEL_ERROR>= g_log_level) THEN
203217 trace
203218 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
203219 ,p_level => C_LEVEL_ERROR
203220 ,p_module => l_log_module);
203221 END IF;
203222 END IF;
203223 END IF;
203224 --
203225 --
203226 ------------------------------------------------------------------------------------------------
203227 -- 4219869 Business Flow
203228 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
203229 -- Prior Entry. Currently, the following code is always generated.
203230 ------------------------------------------------------------------------------------------------
203231 XLA_AE_LINES_PKG.ValidateCurrentLine;
203232
203233 ------------------------------------------------------------------------------------
203234 -- 4219869 Business Flow
203235 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
203236 ------------------------------------------------------------------------------------
203237 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
203238
203239 ----------------------------------------------------------------------------------
203240 -- 4219869 Business Flow
203241 -- Update journal entry status -- Need to generate this within IF <condition>
203242 ----------------------------------------------------------------------------------
203243 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
203244 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
203245 ,p_balance_type_code => l_balance_type_code
203246 );
203247
203248 -------------------------------------------------------------------------------------------
203249 -- 4262811 - Generate the Accrual Reversal lines
203250 -------------------------------------------------------------------------------------------
203251 BEGIN
203252 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
203253 (g_array_event(p_event_id).array_value_num('header_index'));
203254 IF l_acc_rev_flag IS NULL THEN
203255 l_acc_rev_flag := 'N';
203256 END IF;
203257 EXCEPTION
203258 WHEN OTHERS THEN
203262 IF (l_acc_rev_flag = 'Y') THEN
203259 l_acc_rev_flag := 'N';
203260 END;
203261 --
203263
203264 -- 4645092 ------------------------------------------------------------------------------
203265 -- To allow MPA report to determine if it should generate report process
203266 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
203267 ------------------------------------------------------------------------------------------
203268
203269 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
203270 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
203271 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
203272 -- call ADRs
203273 -- Bug 4922099
203274 --
203275 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
203276 (NVL(l_actual_upg_option, 'N') = 'O') OR
203277 (NVL(l_enc_upg_option, 'N') = 'O')
203278 )
203279 THEN
203280 NULL;
203281 --
203282 --
203283
203284 l_ccid := AcctDerRule_187(
203285 p_application_id => p_application_id
203286 , p_ae_header_id => l_ae_header_id
203287 , p_source_42 => p_source_42
203288 , x_transaction_coa_id => l_adr_transaction_coa_id
203289 , x_accounting_coa_id => l_adr_accounting_coa_id
203290 , x_value_type_code => l_adr_value_type_code
203291 , p_side => 'NA'
203292 );
203293
203294 xla_ae_lines_pkg.set_ccid(
203295 p_code_combination_id => l_ccid
203296 , p_value_type_code => l_adr_value_type_code
203297 , p_transaction_coa_id => l_adr_transaction_coa_id
203298 , p_accounting_coa_id => l_adr_accounting_coa_id
203299 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
203300 , p_adr_type_code => 'S'
203301 , p_component_type => l_component_type
203302 , p_component_code => l_component_code
203303 , p_component_type_code => l_component_type_code
203304 , p_component_appl_id => l_component_appl_id
203305 , p_amb_context_code => l_amb_context_code
203306 , p_side => 'NA'
203307 );
203308
203309
203310 --
203311 --
203312 END IF;
203313
203314 --
203315 -- Update the line information that should be overwritten
203316 --
203317 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
203318 p_header_num => 1);
203319 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
203320
203321 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
203322
203323 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
203324 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
203325 END IF;
203326
203327 --
203328 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
203329 --
203330 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
203331 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
203332 ELSE
203333 ---------------------------------------------------------------------------------------------------
203334 -- 4262811a Switch Sign
203335 ---------------------------------------------------------------------------------------------------
203336 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
203337 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
203338 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
203339 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
203340 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
203341 -- 5132302
203342 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
203343 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
203344
203345 END IF;
203346
203347 -- 4955764
203348 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
203349 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
203350
203351
203352 XLA_AE_LINES_PKG.ValidateCurrentLine;
203353 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
203354
203355 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
203356 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
203357 ,p_balance_type_code => l_balance_type_code);
203358
203359 END IF;
203360
203361 -----------------------------------------------------------------------------------------
203362 -- 4262811 Multiperiod Accounting
203363 -----------------------------------------------------------------------------------------
203364 -- No MPA option is assigned.
203365
203366
203367 END IF;
203368 END IF;
203369 --
203370
203371 --
203372 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
203373 trace
203377 END IF;
203374 (p_msg => 'END of AcctLineType_459'
203375 ,p_level => C_LEVEL_PROCEDURE
203376 ,p_module => l_log_module);
203378 --
203379 EXCEPTION
203380 WHEN xla_exceptions_pkg.application_exception THEN
203381 RAISE;
203382 WHEN OTHERS THEN
203383 xla_exceptions_pkg.raise_message
203384 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_459');
203385 END AcctLineType_459;
203386 --
203387
203388 ---------------------------------------
203389 --
203390 -- PRIVATE FUNCTION
203391 -- AcctLineType_460
203392 --
203393 ---------------------------------------
203394 PROCEDURE AcctLineType_460 (
203395 p_application_id IN NUMBER
203396 ,p_event_id IN NUMBER
203397 ,p_calculate_acctd_flag IN VARCHAR2
203398 ,p_calculate_g_l_flag IN VARCHAR2
203399 ,p_actual_flag IN OUT VARCHAR2
203400 ,p_balance_type_code OUT VARCHAR2
203401 ,p_gain_or_loss_ref OUT VARCHAR2
203402
203403 --Inflation Adjustment Type Description
203404 , p_source_2 IN VARCHAR2
203405 --Accounting Date
203406 , p_source_3 IN DATE
203407 --Inflation AP Intercompany Ccid
203408 , p_source_42 IN NUMBER
203409 --Transaction Header Identifier
203410 , p_source_49 IN NUMBER
203411 --Adjustment Line Identifier
203412 , p_source_50 IN NUMBER
203413 --Distribution Type Code
203414 , p_source_51 IN VARCHAR2
203415 --Inflation Adjustment Type
203416 , p_source_64 IN VARCHAR2
203417 --Inflation Entered Amount
203418 , p_source_65 IN NUMBER
203419 --Inflation Currency Code
203420 , p_source_66 IN VARCHAR2
203421 )
203422 IS
203423
203424 l_component_type VARCHAR2(80);
203425 l_component_code VARCHAR2(30);
203426 l_component_type_code VARCHAR2(1);
203427 l_component_appl_id INTEGER;
203428 l_amb_context_code VARCHAR2(30);
203429 l_entity_code VARCHAR2(30);
203430 l_event_class_code VARCHAR2(30);
203431 l_ae_header_id NUMBER;
203432 l_event_type_code VARCHAR2(30);
203433 l_line_definition_code VARCHAR2(30);
203434 l_line_definition_owner_code VARCHAR2(1);
203435 --
203436 -- adr variables
203437 l_segment VARCHAR2(30);
203438 l_ccid NUMBER;
203439 l_adr_transaction_coa_id NUMBER;
203440 l_adr_accounting_coa_id NUMBER;
203441 l_adr_flexfield_segment_code VARCHAR2(30);
203442 l_adr_flex_value_set_id NUMBER;
203443 l_adr_value_type_code VARCHAR2(30);
203444 l_adr_value_combination_id NUMBER;
203445 l_adr_value_segment_code VARCHAR2(30);
203446
203447 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
203448 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
203449 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
203450 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
203451
203452 -- 4262811 Variables ------------------------------------------------------------------------------------------
203453 l_entered_amt_idx NUMBER;
203454 l_accted_amt_idx NUMBER;
203455 l_acc_rev_flag VARCHAR2(1);
203456 l_accrual_line_num NUMBER;
203457 l_tmp_amt NUMBER;
203458 l_acc_rev_natural_side_code VARCHAR2(1);
203459
203460 l_num_entries NUMBER;
203461 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
203462 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
203463 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
203464 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
203465 l_recog_line_1 NUMBER;
203466 l_recog_line_2 NUMBER;
203467
203468 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
203469 l_bflow_applied_to_amt NUMBER; -- 5132302
203470 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
203471
203472 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
203473
203474 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
203475 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
203476
203477 ---------------------------------------------------------------------------------------------------------------
203478
203479
203480 --
203481 -- bulk performance
203482 --
203483 l_balance_type_code VARCHAR2(1);
203484 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
203485 l_log_module VARCHAR2(240);
203486
203487 --
203488 -- Upgrade strategy
203489 --
203490 l_actual_upg_option VARCHAR2(1);
203491 l_enc_upg_option VARCHAR2(1);
203492
203493 --
203494 BEGIN
203495 --
203496 IF g_log_enabled THEN
203497 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_460';
203498 END IF;
203499 --
203500 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
203501
203502 trace
203503 (p_msg => 'BEGIN of AcctLineType_460'
203504 ,p_level => C_LEVEL_PROCEDURE
203505 ,p_module => l_log_module);
203506
203507 END IF;
203508 --
203509 l_component_type := 'AMB_JLT';
203510 l_component_code := 'IAC_INTERCOMPANY_AP';
203511 l_component_type_code := 'S';
203515 l_event_class_code := 'ADDITIONS';
203512 l_component_appl_id := 140;
203513 l_amb_context_code := 'DEFAULT';
203514 l_entity_code := 'TRANSACTIONS';
203516 l_event_type_code := 'ADDITIONS_ALL';
203517 l_line_definition_owner_code := 'S';
203518 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
203519 --
203520 l_balance_type_code := 'A';
203521 l_segment := NULL;
203522 l_ccid := NULL;
203523 l_adr_transaction_coa_id := NULL;
203524 l_adr_accounting_coa_id := NULL;
203525 l_adr_flexfield_segment_code := NULL;
203526 l_adr_flex_value_set_id := NULL;
203527 l_adr_value_type_code := NULL;
203528 l_adr_value_combination_id := NULL;
203529 l_adr_value_segment_code := NULL;
203530
203531 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
203532 l_bflow_class_code := ''; -- 4219869 Business Flow
203533 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
203534 l_budgetary_control_flag := 'N';
203535
203536 l_bflow_applied_to_amt_idx := NULL; -- 5132302
203537 l_bflow_applied_to_amt := NULL; -- 5132302
203538 l_entered_amt_idx := NULL; -- 4262811
203539 l_accted_amt_idx := NULL; -- 4262811
203540 l_acc_rev_flag := NULL; -- 4262811
203541 l_accrual_line_num := NULL; -- 4262811
203542 l_tmp_amt := NULL; -- 4262811
203543 --
203544
203545 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
203546 l_balance_type_code <> 'B' THEN
203547 IF NVL(p_source_64,'
203548 ') = 'INTERCO AP'
203549 THEN
203550
203551 --
203552 XLA_AE_LINES_PKG.SetNewLine;
203553
203554 p_balance_type_code := l_balance_type_code;
203555 -- set the flag so later we will know whether the gain loss line needs to be created
203556
203557 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
203558 p_actual_flag :='A';
203559 END IF;
203560
203561 --
203562 -- bulk performance
203563 --
203564 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
203565 p_header_num => 0); -- 4262811
203566 --
203567 -- set accounting line options
203568 --
203569 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
203570 p_natural_side_code => 'C'
203571 , p_gain_or_loss_flag => 'N'
203572 , p_gl_transfer_mode_code => 'S'
203573 , p_acct_entry_type_code => 'A'
203574 , p_switch_side_flag => 'Y'
203575 , p_merge_duplicate_code => 'N'
203576 );
203577 --
203578 l_acc_rev_natural_side_code := 'D'; -- 4262811
203579 --
203580 --
203581 -- set accounting line type info
203582 --
203583 xla_ae_lines_pkg.SetAcctLineType
203584 (p_component_type => l_component_type
203585 ,p_event_type_code => l_event_type_code
203586 ,p_line_definition_owner_code => l_line_definition_owner_code
203587 ,p_line_definition_code => l_line_definition_code
203588 ,p_accounting_line_code => l_component_code
203589 ,p_accounting_line_type_code => l_component_type_code
203590 ,p_accounting_line_appl_id => l_component_appl_id
203591 ,p_amb_context_code => l_amb_context_code
203592 ,p_entity_code => l_entity_code
203593 ,p_event_class_code => l_event_class_code);
203594 --
203595 -- set accounting class
203596 --
203597 xla_ae_lines_pkg.SetAcctClass(
203598 p_accounting_class_code => 'LIABILITY'
203599 , p_ae_header_id => l_ae_header_id
203600 );
203601
203602 --
203603 -- set rounding class
203604 --
203605 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
203606 'LIABILITY';
203607
203608 --
203609 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
203610 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
203611 --
203612 -- bulk performance
203613 --
203614 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
203615
203616 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
203617 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
203618
203619 -- 4955764
203620 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
203621 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
203622
203623 -- 4458381 Public Sector Enh
203624
203625 --
203626 -- set accounting attributes for the line type
203627 --
203628 l_entered_amt_idx := 4;
203629 l_accted_amt_idx := 6;
203630 l_bflow_applied_to_amt_idx := NULL; -- 5132302
203631 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
203632 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
203633 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
203634 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
203635 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
203639 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
203636 l_rec_acct_attrs.array_char_value(3) := p_source_51;
203637 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
203638 l_rec_acct_attrs.array_num_value(4) := p_source_65;
203640 l_rec_acct_attrs.array_char_value(5) := p_source_66;
203641 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
203642 l_rec_acct_attrs.array_num_value(6) := p_source_65;
203643
203644 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
203645 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
203646
203647 ---------------------------------------------------------------------------------------------------------------
203648 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
203649 ---------------------------------------------------------------------------------------------------------------
203650 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
203651
203652 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
203653 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
203654
203655 IF xla_accounting_cache_pkg.GetValueChar
203656 (p_source_code => 'LEDGER_CATEGORY_CODE'
203657 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
203658 AND l_bflow_method_code = 'PRIOR_ENTRY'
203659 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
203660 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
203661 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
203662 )
203663 THEN
203664 xla_ae_lines_pkg.BflowUpgEntry
203665 (p_business_method_code => l_bflow_method_code
203666 ,p_business_class_code => l_bflow_class_code
203667 ,p_balance_type => l_balance_type_code);
203668 ELSE
203669 NULL;
203670 -- No business flow processing for business flow method of NONE.
203671 END IF;
203672
203673 --
203674 -- call analytical criteria
203675 --
203676
203677 --
203678 -- call description
203679 --
203680
203681 xla_ae_lines_pkg.SetLineDescription(
203682 p_ae_header_id => l_ae_header_id
203683 ,p_description => Description_143 (
203684 p_application_id => p_application_id
203685 , p_ae_header_id => l_ae_header_id
203686 , p_source_2 => p_source_2
203687 , p_source_3 => p_source_3
203688 )
203689 );
203690
203691
203692 --
203693 -- call ADRs
203694 -- Bug 4922099
203695 --
203696 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
203697 (NVL(l_actual_upg_option, 'N') = 'O') OR
203698 (NVL(l_enc_upg_option, 'N') = 'O')
203699 )
203700 THEN
203701 NULL;
203702 --
203703 --
203704
203705 l_ccid := AcctDerRule_187(
203706 p_application_id => p_application_id
203707 , p_ae_header_id => l_ae_header_id
203708 , p_source_42 => p_source_42
203709 , x_transaction_coa_id => l_adr_transaction_coa_id
203710 , x_accounting_coa_id => l_adr_accounting_coa_id
203711 , x_value_type_code => l_adr_value_type_code
203712 , p_side => 'NA'
203713 );
203714
203715 xla_ae_lines_pkg.set_ccid(
203716 p_code_combination_id => l_ccid
203717 , p_value_type_code => l_adr_value_type_code
203718 , p_transaction_coa_id => l_adr_transaction_coa_id
203719 , p_accounting_coa_id => l_adr_accounting_coa_id
203720 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
203721 , p_adr_type_code => 'S'
203722 , p_component_type => l_component_type
203723 , p_component_code => l_component_code
203724 , p_component_type_code => l_component_type_code
203725 , p_component_appl_id => l_component_appl_id
203726 , p_amb_context_code => l_amb_context_code
203727 , p_side => 'NA'
203728 );
203729
203730
203731 --
203732 --
203733 END IF;
203734 --
203735 -- Bug 4922099
203736 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
203737 (NVL(l_enc_upg_option, 'N') = 'O')
203738 ) AND
203739 (l_bflow_method_code = 'PRIOR_ENTRY')
203740 )
203741 THEN
203742 IF
203743 --
203744 1 = 2
203745 --
203746 THEN
203747 xla_accounting_err_pkg.build_message
203748 (p_appli_s_name => 'XLA'
203749 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
203750 ,p_token_1 => 'LINE_NUMBER'
203751 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
203752 ,p_token_2 => 'LINE_TYPE_NAME'
203753 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
203754 l_component_type
203755 ,l_component_code
203759 ,l_entity_code
203756 ,l_component_type_code
203757 ,l_component_appl_id
203758 ,l_amb_context_code
203760 ,l_event_class_code
203761 )
203762 ,p_token_3 => 'OWNER'
203763 ,p_value_3 => xla_lookups_pkg.get_meaning(
203764 p_lookup_type => 'XLA_OWNER_TYPE'
203765 ,p_lookup_code => l_component_type_code
203766 )
203767 ,p_token_4 => 'PRODUCT_NAME'
203768 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
203769 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
203770 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
203771 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
203772 ,p_ae_header_id => NULL
203773 );
203774
203775 IF (C_LEVEL_ERROR>= g_log_level) THEN
203776 trace
203777 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
203778 ,p_level => C_LEVEL_ERROR
203779 ,p_module => l_log_module);
203780 END IF;
203781 END IF;
203782 END IF;
203783 --
203784 --
203785 ------------------------------------------------------------------------------------------------
203786 -- 4219869 Business Flow
203787 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
203788 -- Prior Entry. Currently, the following code is always generated.
203789 ------------------------------------------------------------------------------------------------
203790 XLA_AE_LINES_PKG.ValidateCurrentLine;
203791
203792 ------------------------------------------------------------------------------------
203793 -- 4219869 Business Flow
203794 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
203795 ------------------------------------------------------------------------------------
203796 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
203797
203798 ----------------------------------------------------------------------------------
203799 -- 4219869 Business Flow
203800 -- Update journal entry status -- Need to generate this within IF <condition>
203801 ----------------------------------------------------------------------------------
203802 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
203803 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
203804 ,p_balance_type_code => l_balance_type_code
203805 );
203806
203807 -------------------------------------------------------------------------------------------
203808 -- 4262811 - Generate the Accrual Reversal lines
203809 -------------------------------------------------------------------------------------------
203810 BEGIN
203811 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
203812 (g_array_event(p_event_id).array_value_num('header_index'));
203813 IF l_acc_rev_flag IS NULL THEN
203814 l_acc_rev_flag := 'N';
203815 END IF;
203816 EXCEPTION
203817 WHEN OTHERS THEN
203818 l_acc_rev_flag := 'N';
203819 END;
203820 --
203821 IF (l_acc_rev_flag = 'Y') THEN
203822
203823 -- 4645092 ------------------------------------------------------------------------------
203824 -- To allow MPA report to determine if it should generate report process
203825 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
203826 ------------------------------------------------------------------------------------------
203827
203828 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
203829 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
203830 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
203831 -- call ADRs
203832 -- Bug 4922099
203833 --
203834 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
203835 (NVL(l_actual_upg_option, 'N') = 'O') OR
203836 (NVL(l_enc_upg_option, 'N') = 'O')
203837 )
203838 THEN
203839 NULL;
203840 --
203841 --
203842
203843 l_ccid := AcctDerRule_187(
203844 p_application_id => p_application_id
203845 , p_ae_header_id => l_ae_header_id
203846 , p_source_42 => p_source_42
203847 , x_transaction_coa_id => l_adr_transaction_coa_id
203848 , x_accounting_coa_id => l_adr_accounting_coa_id
203849 , x_value_type_code => l_adr_value_type_code
203850 , p_side => 'NA'
203851 );
203852
203853 xla_ae_lines_pkg.set_ccid(
203857 , p_accounting_coa_id => l_adr_accounting_coa_id
203854 p_code_combination_id => l_ccid
203855 , p_value_type_code => l_adr_value_type_code
203856 , p_transaction_coa_id => l_adr_transaction_coa_id
203858 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
203859 , p_adr_type_code => 'S'
203860 , p_component_type => l_component_type
203861 , p_component_code => l_component_code
203862 , p_component_type_code => l_component_type_code
203863 , p_component_appl_id => l_component_appl_id
203864 , p_amb_context_code => l_amb_context_code
203865 , p_side => 'NA'
203866 );
203867
203868
203869 --
203870 --
203871 END IF;
203872
203873 --
203874 -- Update the line information that should be overwritten
203875 --
203876 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
203877 p_header_num => 1);
203878 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
203879
203880 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
203881
203882 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
203883 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
203884 END IF;
203885
203886 --
203887 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
203888 --
203889 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
203890 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
203891 ELSE
203892 ---------------------------------------------------------------------------------------------------
203893 -- 4262811a Switch Sign
203894 ---------------------------------------------------------------------------------------------------
203895 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
203896 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
203897 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
203898 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
203899 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
203900 -- 5132302
203901 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
203902 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
203903
203904 END IF;
203905
203906 -- 4955764
203907 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
203908 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
203909
203910
203911 XLA_AE_LINES_PKG.ValidateCurrentLine;
203912 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
203913
203914 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
203915 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
203916 ,p_balance_type_code => l_balance_type_code);
203917
203918 END IF;
203919
203920 -----------------------------------------------------------------------------------------
203921 -- 4262811 Multiperiod Accounting
203922 -----------------------------------------------------------------------------------------
203923 -- No MPA option is assigned.
203924
203925
203926 END IF;
203927 END IF;
203928 --
203929
203930 --
203931 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
203932 trace
203933 (p_msg => 'END of AcctLineType_460'
203934 ,p_level => C_LEVEL_PROCEDURE
203935 ,p_module => l_log_module);
203936 END IF;
203937 --
203938 EXCEPTION
203939 WHEN xla_exceptions_pkg.application_exception THEN
203940 RAISE;
203941 WHEN OTHERS THEN
203942 xla_exceptions_pkg.raise_message
203943 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_460');
203944 END AcctLineType_460;
203945 --
203946
203947 ---------------------------------------
203948 --
203949 -- PRIVATE FUNCTION
203950 -- AcctLineType_461
203951 --
203952 ---------------------------------------
203953 PROCEDURE AcctLineType_461 (
203954 p_application_id IN NUMBER
203955 ,p_event_id IN NUMBER
203956 ,p_calculate_acctd_flag IN VARCHAR2
203957 ,p_calculate_g_l_flag IN VARCHAR2
203958 ,p_actual_flag IN OUT VARCHAR2
203959 ,p_balance_type_code OUT VARCHAR2
203960 ,p_gain_or_loss_ref OUT VARCHAR2
203961
203962 --Inflation Adjustment Type Description
203963 , p_source_2 IN VARCHAR2
203964 --Accounting Date
203965 , p_source_3 IN DATE
203966 --Inflation AP Intercompany Ccid
203967 , p_source_42 IN NUMBER
203968 --Transaction Header Identifier
203969 , p_source_49 IN NUMBER
203970 --Adjustment Line Identifier
203971 , p_source_50 IN NUMBER
203972 --Distribution Type Code
203973 , p_source_51 IN VARCHAR2
203974 --Inflation Adjustment Type
203978 --Inflation Currency Code
203975 , p_source_64 IN VARCHAR2
203976 --Inflation Entered Amount
203977 , p_source_65 IN NUMBER
203979 , p_source_66 IN VARCHAR2
203980 )
203981 IS
203982
203983 l_component_type VARCHAR2(80);
203984 l_component_code VARCHAR2(30);
203985 l_component_type_code VARCHAR2(1);
203986 l_component_appl_id INTEGER;
203987 l_amb_context_code VARCHAR2(30);
203988 l_entity_code VARCHAR2(30);
203989 l_event_class_code VARCHAR2(30);
203990 l_ae_header_id NUMBER;
203991 l_event_type_code VARCHAR2(30);
203992 l_line_definition_code VARCHAR2(30);
203993 l_line_definition_owner_code VARCHAR2(1);
203994 --
203995 -- adr variables
203996 l_segment VARCHAR2(30);
203997 l_ccid NUMBER;
203998 l_adr_transaction_coa_id NUMBER;
203999 l_adr_accounting_coa_id NUMBER;
204000 l_adr_flexfield_segment_code VARCHAR2(30);
204001 l_adr_flex_value_set_id NUMBER;
204002 l_adr_value_type_code VARCHAR2(30);
204003 l_adr_value_combination_id NUMBER;
204004 l_adr_value_segment_code VARCHAR2(30);
204005
204006 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
204007 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
204008 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
204009 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
204010
204011 -- 4262811 Variables ------------------------------------------------------------------------------------------
204012 l_entered_amt_idx NUMBER;
204013 l_accted_amt_idx NUMBER;
204014 l_acc_rev_flag VARCHAR2(1);
204015 l_accrual_line_num NUMBER;
204016 l_tmp_amt NUMBER;
204017 l_acc_rev_natural_side_code VARCHAR2(1);
204018
204019 l_num_entries NUMBER;
204020 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
204021 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
204022 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
204023 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
204024 l_recog_line_1 NUMBER;
204025 l_recog_line_2 NUMBER;
204026
204027 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
204028 l_bflow_applied_to_amt NUMBER; -- 5132302
204029 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
204030
204031 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
204032
204033 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
204034 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
204035
204036 ---------------------------------------------------------------------------------------------------------------
204037
204038
204039 --
204040 -- bulk performance
204041 --
204042 l_balance_type_code VARCHAR2(1);
204043 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
204044 l_log_module VARCHAR2(240);
204045
204046 --
204047 -- Upgrade strategy
204048 --
204049 l_actual_upg_option VARCHAR2(1);
204050 l_enc_upg_option VARCHAR2(1);
204051
204052 --
204053 BEGIN
204054 --
204055 IF g_log_enabled THEN
204056 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_461';
204057 END IF;
204058 --
204059 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
204060
204061 trace
204062 (p_msg => 'BEGIN of AcctLineType_461'
204063 ,p_level => C_LEVEL_PROCEDURE
204064 ,p_module => l_log_module);
204065
204066 END IF;
204067 --
204068 l_component_type := 'AMB_JLT';
204069 l_component_code := 'IAC_INTERCOMPANY_AP';
204070 l_component_type_code := 'S';
204071 l_component_appl_id := 140;
204072 l_amb_context_code := 'DEFAULT';
204073 l_entity_code := 'TRANSACTIONS';
204074 l_event_class_code := 'TRANSFERS';
204075 l_event_type_code := 'TRANSFERS_ALL';
204076 l_line_definition_owner_code := 'S';
204077 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
204078 --
204079 l_balance_type_code := 'A';
204080 l_segment := NULL;
204081 l_ccid := NULL;
204082 l_adr_transaction_coa_id := NULL;
204083 l_adr_accounting_coa_id := NULL;
204084 l_adr_flexfield_segment_code := NULL;
204085 l_adr_flex_value_set_id := NULL;
204086 l_adr_value_type_code := NULL;
204087 l_adr_value_combination_id := NULL;
204088 l_adr_value_segment_code := NULL;
204089
204090 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
204091 l_bflow_class_code := ''; -- 4219869 Business Flow
204092 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
204093 l_budgetary_control_flag := 'N';
204094
204095 l_bflow_applied_to_amt_idx := NULL; -- 5132302
204096 l_bflow_applied_to_amt := NULL; -- 5132302
204097 l_entered_amt_idx := NULL; -- 4262811
204098 l_accted_amt_idx := NULL; -- 4262811
204099 l_acc_rev_flag := NULL; -- 4262811
204100 l_accrual_line_num := NULL; -- 4262811
204101 l_tmp_amt := NULL; -- 4262811
204102 --
204103
204107 ') = 'INTERCO AP'
204104 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
204105 l_balance_type_code <> 'B' THEN
204106 IF NVL(p_source_64,'
204108 THEN
204109
204110 --
204111 XLA_AE_LINES_PKG.SetNewLine;
204112
204113 p_balance_type_code := l_balance_type_code;
204114 -- set the flag so later we will know whether the gain loss line needs to be created
204115
204116 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
204117 p_actual_flag :='A';
204118 END IF;
204119
204120 --
204121 -- bulk performance
204122 --
204123 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
204124 p_header_num => 0); -- 4262811
204125 --
204126 -- set accounting line options
204127 --
204128 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
204129 p_natural_side_code => 'C'
204130 , p_gain_or_loss_flag => 'N'
204131 , p_gl_transfer_mode_code => 'S'
204132 , p_acct_entry_type_code => 'A'
204133 , p_switch_side_flag => 'Y'
204134 , p_merge_duplicate_code => 'N'
204135 );
204136 --
204137 l_acc_rev_natural_side_code := 'D'; -- 4262811
204138 --
204139 --
204140 -- set accounting line type info
204141 --
204142 xla_ae_lines_pkg.SetAcctLineType
204143 (p_component_type => l_component_type
204144 ,p_event_type_code => l_event_type_code
204145 ,p_line_definition_owner_code => l_line_definition_owner_code
204146 ,p_line_definition_code => l_line_definition_code
204147 ,p_accounting_line_code => l_component_code
204148 ,p_accounting_line_type_code => l_component_type_code
204149 ,p_accounting_line_appl_id => l_component_appl_id
204150 ,p_amb_context_code => l_amb_context_code
204151 ,p_entity_code => l_entity_code
204152 ,p_event_class_code => l_event_class_code);
204153 --
204154 -- set accounting class
204155 --
204156 xla_ae_lines_pkg.SetAcctClass(
204157 p_accounting_class_code => 'LIABILITY'
204158 , p_ae_header_id => l_ae_header_id
204159 );
204160
204161 --
204162 -- set rounding class
204163 --
204164 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
204165 'LIABILITY';
204166
204167 --
204168 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
204169 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
204170 --
204171 -- bulk performance
204172 --
204173 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
204174
204175 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
204176 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
204177
204178 -- 4955764
204179 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
204180 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
204181
204182 -- 4458381 Public Sector Enh
204183
204184 --
204185 -- set accounting attributes for the line type
204186 --
204187 l_entered_amt_idx := 4;
204188 l_accted_amt_idx := 6;
204189 l_bflow_applied_to_amt_idx := NULL; -- 5132302
204190 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
204191 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
204192 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
204193 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
204194 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
204195 l_rec_acct_attrs.array_char_value(3) := p_source_51;
204196 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
204197 l_rec_acct_attrs.array_num_value(4) := p_source_65;
204198 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
204199 l_rec_acct_attrs.array_char_value(5) := p_source_66;
204200 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
204201 l_rec_acct_attrs.array_num_value(6) := p_source_65;
204202
204203 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
204204 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
204205
204206 ---------------------------------------------------------------------------------------------------------------
204207 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
204208 ---------------------------------------------------------------------------------------------------------------
204209 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
204210
204211 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
204212 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
204213
204214 IF xla_accounting_cache_pkg.GetValueChar
204215 (p_source_code => 'LEDGER_CATEGORY_CODE'
204216 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
204217 AND l_bflow_method_code = 'PRIOR_ENTRY'
204221 )
204218 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
204219 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
204220 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
204222 THEN
204223 xla_ae_lines_pkg.BflowUpgEntry
204224 (p_business_method_code => l_bflow_method_code
204225 ,p_business_class_code => l_bflow_class_code
204226 ,p_balance_type => l_balance_type_code);
204227 ELSE
204228 NULL;
204229 -- No business flow processing for business flow method of NONE.
204230 END IF;
204231
204232 --
204233 -- call analytical criteria
204234 --
204235
204236 --
204237 -- call description
204238 --
204239
204240 xla_ae_lines_pkg.SetLineDescription(
204241 p_ae_header_id => l_ae_header_id
204242 ,p_description => Description_143 (
204243 p_application_id => p_application_id
204244 , p_ae_header_id => l_ae_header_id
204245 , p_source_2 => p_source_2
204246 , p_source_3 => p_source_3
204247 )
204248 );
204249
204250
204251 --
204252 -- call ADRs
204253 -- Bug 4922099
204254 --
204255 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
204256 (NVL(l_actual_upg_option, 'N') = 'O') OR
204257 (NVL(l_enc_upg_option, 'N') = 'O')
204258 )
204259 THEN
204260 NULL;
204261 --
204262 --
204263
204264 l_ccid := AcctDerRule_187(
204265 p_application_id => p_application_id
204266 , p_ae_header_id => l_ae_header_id
204267 , p_source_42 => p_source_42
204268 , x_transaction_coa_id => l_adr_transaction_coa_id
204269 , x_accounting_coa_id => l_adr_accounting_coa_id
204270 , x_value_type_code => l_adr_value_type_code
204271 , p_side => 'NA'
204272 );
204273
204274 xla_ae_lines_pkg.set_ccid(
204275 p_code_combination_id => l_ccid
204276 , p_value_type_code => l_adr_value_type_code
204277 , p_transaction_coa_id => l_adr_transaction_coa_id
204278 , p_accounting_coa_id => l_adr_accounting_coa_id
204279 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
204280 , p_adr_type_code => 'S'
204281 , p_component_type => l_component_type
204282 , p_component_code => l_component_code
204283 , p_component_type_code => l_component_type_code
204284 , p_component_appl_id => l_component_appl_id
204285 , p_amb_context_code => l_amb_context_code
204286 , p_side => 'NA'
204287 );
204288
204289
204290 --
204291 --
204292 END IF;
204293 --
204294 -- Bug 4922099
204295 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
204296 (NVL(l_enc_upg_option, 'N') = 'O')
204297 ) AND
204298 (l_bflow_method_code = 'PRIOR_ENTRY')
204299 )
204300 THEN
204301 IF
204302 --
204303 1 = 2
204304 --
204305 THEN
204306 xla_accounting_err_pkg.build_message
204307 (p_appli_s_name => 'XLA'
204308 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
204309 ,p_token_1 => 'LINE_NUMBER'
204310 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
204311 ,p_token_2 => 'LINE_TYPE_NAME'
204312 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
204313 l_component_type
204314 ,l_component_code
204315 ,l_component_type_code
204316 ,l_component_appl_id
204317 ,l_amb_context_code
204318 ,l_entity_code
204319 ,l_event_class_code
204320 )
204321 ,p_token_3 => 'OWNER'
204322 ,p_value_3 => xla_lookups_pkg.get_meaning(
204323 p_lookup_type => 'XLA_OWNER_TYPE'
204324 ,p_lookup_code => l_component_type_code
204325 )
204326 ,p_token_4 => 'PRODUCT_NAME'
204327 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
204328 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
204329 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
204330 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
204331 ,p_ae_header_id => NULL
204335 trace
204332 );
204333
204334 IF (C_LEVEL_ERROR>= g_log_level) THEN
204336 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
204337 ,p_level => C_LEVEL_ERROR
204338 ,p_module => l_log_module);
204339 END IF;
204340 END IF;
204341 END IF;
204342 --
204343 --
204344 ------------------------------------------------------------------------------------------------
204345 -- 4219869 Business Flow
204346 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
204347 -- Prior Entry. Currently, the following code is always generated.
204348 ------------------------------------------------------------------------------------------------
204349 XLA_AE_LINES_PKG.ValidateCurrentLine;
204350
204351 ------------------------------------------------------------------------------------
204352 -- 4219869 Business Flow
204353 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
204354 ------------------------------------------------------------------------------------
204355 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
204356
204357 ----------------------------------------------------------------------------------
204358 -- 4219869 Business Flow
204359 -- Update journal entry status -- Need to generate this within IF <condition>
204360 ----------------------------------------------------------------------------------
204361 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
204362 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
204363 ,p_balance_type_code => l_balance_type_code
204364 );
204365
204366 -------------------------------------------------------------------------------------------
204367 -- 4262811 - Generate the Accrual Reversal lines
204368 -------------------------------------------------------------------------------------------
204369 BEGIN
204370 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
204371 (g_array_event(p_event_id).array_value_num('header_index'));
204372 IF l_acc_rev_flag IS NULL THEN
204373 l_acc_rev_flag := 'N';
204374 END IF;
204375 EXCEPTION
204376 WHEN OTHERS THEN
204377 l_acc_rev_flag := 'N';
204378 END;
204379 --
204380 IF (l_acc_rev_flag = 'Y') THEN
204381
204382 -- 4645092 ------------------------------------------------------------------------------
204383 -- To allow MPA report to determine if it should generate report process
204384 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
204385 ------------------------------------------------------------------------------------------
204386
204387 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
204388 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
204389 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
204390 -- call ADRs
204391 -- Bug 4922099
204392 --
204393 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
204394 (NVL(l_actual_upg_option, 'N') = 'O') OR
204395 (NVL(l_enc_upg_option, 'N') = 'O')
204396 )
204397 THEN
204398 NULL;
204399 --
204400 --
204401
204402 l_ccid := AcctDerRule_187(
204403 p_application_id => p_application_id
204404 , p_ae_header_id => l_ae_header_id
204405 , p_source_42 => p_source_42
204406 , x_transaction_coa_id => l_adr_transaction_coa_id
204407 , x_accounting_coa_id => l_adr_accounting_coa_id
204408 , x_value_type_code => l_adr_value_type_code
204409 , p_side => 'NA'
204410 );
204411
204412 xla_ae_lines_pkg.set_ccid(
204413 p_code_combination_id => l_ccid
204414 , p_value_type_code => l_adr_value_type_code
204415 , p_transaction_coa_id => l_adr_transaction_coa_id
204416 , p_accounting_coa_id => l_adr_accounting_coa_id
204417 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
204418 , p_adr_type_code => 'S'
204419 , p_component_type => l_component_type
204420 , p_component_code => l_component_code
204421 , p_component_type_code => l_component_type_code
204422 , p_component_appl_id => l_component_appl_id
204423 , p_amb_context_code => l_amb_context_code
204424 , p_side => 'NA'
204425 );
204426
204427
204428 --
204429 --
204430 END IF;
204431
204432 --
204433 -- Update the line information that should be overwritten
204434 --
204435 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
204436 p_header_num => 1);
204437 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
204438
204439 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
204440
204441 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
204442 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
204443 END IF;
204444
204445 --
204446 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
204450 ELSE
204447 --
204448 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
204449 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
204451 ---------------------------------------------------------------------------------------------------
204452 -- 4262811a Switch Sign
204453 ---------------------------------------------------------------------------------------------------
204454 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
204455 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
204456 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
204457 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
204458 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
204459 -- 5132302
204460 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
204461 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
204462
204463 END IF;
204464
204465 -- 4955764
204466 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
204467 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
204468
204469
204470 XLA_AE_LINES_PKG.ValidateCurrentLine;
204471 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
204472
204473 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
204474 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
204475 ,p_balance_type_code => l_balance_type_code);
204476
204477 END IF;
204478
204479 -----------------------------------------------------------------------------------------
204480 -- 4262811 Multiperiod Accounting
204481 -----------------------------------------------------------------------------------------
204482 -- No MPA option is assigned.
204483
204484
204485 END IF;
204486 END IF;
204487 --
204488
204489 --
204490 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
204491 trace
204492 (p_msg => 'END of AcctLineType_461'
204493 ,p_level => C_LEVEL_PROCEDURE
204494 ,p_module => l_log_module);
204495 END IF;
204496 --
204497 EXCEPTION
204498 WHEN xla_exceptions_pkg.application_exception THEN
204499 RAISE;
204500 WHEN OTHERS THEN
204501 xla_exceptions_pkg.raise_message
204502 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_461');
204503 END AcctLineType_461;
204504 --
204505
204506 ---------------------------------------
204507 --
204508 -- PRIVATE FUNCTION
204509 -- AcctLineType_462
204510 --
204511 ---------------------------------------
204512 PROCEDURE AcctLineType_462 (
204513 p_application_id IN NUMBER
204514 ,p_event_id IN NUMBER
204515 ,p_calculate_acctd_flag IN VARCHAR2
204516 ,p_calculate_g_l_flag IN VARCHAR2
204517 ,p_actual_flag IN OUT VARCHAR2
204518 ,p_balance_type_code OUT VARCHAR2
204519 ,p_gain_or_loss_ref OUT VARCHAR2
204520
204521 --Inflation Adjustment Type Description
204522 , p_source_2 IN VARCHAR2
204523 --Accounting Date
204524 , p_source_3 IN DATE
204525 --Inflation AP Intercompany Ccid
204526 , p_source_42 IN NUMBER
204527 --Distribution Type Code
204528 , p_source_51 IN VARCHAR2
204529 --Asset Identifier
204530 , p_source_56 IN NUMBER
204531 --Period Counter
204532 , p_source_57 IN NUMBER
204533 --Distribution Identifier
204534 , p_source_58 IN NUMBER
204535 --Book Type Code
204536 , p_source_59 IN VARCHAR2
204537 --Depreciation Run Identifier
204538 , p_source_62 IN NUMBER
204539 --Inflation Adjustment Type
204540 , p_source_64 IN VARCHAR2
204541 --Inflation Entered Amount
204542 , p_source_65 IN NUMBER
204543 --Inflation Currency Code
204544 , p_source_66 IN VARCHAR2
204545 )
204546 IS
204547
204548 l_component_type VARCHAR2(80);
204549 l_component_code VARCHAR2(30);
204550 l_component_type_code VARCHAR2(1);
204551 l_component_appl_id INTEGER;
204552 l_amb_context_code VARCHAR2(30);
204553 l_entity_code VARCHAR2(30);
204554 l_event_class_code VARCHAR2(30);
204555 l_ae_header_id NUMBER;
204556 l_event_type_code VARCHAR2(30);
204557 l_line_definition_code VARCHAR2(30);
204558 l_line_definition_owner_code VARCHAR2(1);
204559 --
204560 -- adr variables
204561 l_segment VARCHAR2(30);
204562 l_ccid NUMBER;
204563 l_adr_transaction_coa_id NUMBER;
204564 l_adr_accounting_coa_id NUMBER;
204565 l_adr_flexfield_segment_code VARCHAR2(30);
204566 l_adr_flex_value_set_id NUMBER;
204567 l_adr_value_type_code VARCHAR2(30);
204568 l_adr_value_combination_id NUMBER;
204569 l_adr_value_segment_code VARCHAR2(30);
204570
204571 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
204572 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
204576 -- 4262811 Variables ------------------------------------------------------------------------------------------
204573 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
204574 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
204575
204577 l_entered_amt_idx NUMBER;
204578 l_accted_amt_idx NUMBER;
204579 l_acc_rev_flag VARCHAR2(1);
204580 l_accrual_line_num NUMBER;
204581 l_tmp_amt NUMBER;
204582 l_acc_rev_natural_side_code VARCHAR2(1);
204583
204584 l_num_entries NUMBER;
204585 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
204586 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
204587 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
204588 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
204589 l_recog_line_1 NUMBER;
204590 l_recog_line_2 NUMBER;
204591
204592 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
204593 l_bflow_applied_to_amt NUMBER; -- 5132302
204594 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
204595
204596 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
204597
204598 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
204599 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
204600
204601 ---------------------------------------------------------------------------------------------------------------
204602
204603
204604 --
204605 -- bulk performance
204606 --
204607 l_balance_type_code VARCHAR2(1);
204608 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
204609 l_log_module VARCHAR2(240);
204610
204611 --
204612 -- Upgrade strategy
204613 --
204614 l_actual_upg_option VARCHAR2(1);
204615 l_enc_upg_option VARCHAR2(1);
204616
204617 --
204618 BEGIN
204619 --
204620 IF g_log_enabled THEN
204621 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_462';
204622 END IF;
204623 --
204624 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
204625
204626 trace
204627 (p_msg => 'BEGIN of AcctLineType_462'
204628 ,p_level => C_LEVEL_PROCEDURE
204629 ,p_module => l_log_module);
204630
204631 END IF;
204632 --
204633 l_component_type := 'AMB_JLT';
204634 l_component_code := 'IAC_INTERCOMPANY_AP';
204635 l_component_type_code := 'S';
204636 l_component_appl_id := 140;
204637 l_amb_context_code := 'DEFAULT';
204638 l_entity_code := 'DEPRECIATION';
204639 l_event_class_code := 'DEPRECIATION';
204640 l_event_type_code := 'DEPRECIATION_ALL';
204641 l_line_definition_owner_code := 'S';
204642 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
204643 --
204644 l_balance_type_code := 'A';
204645 l_segment := NULL;
204646 l_ccid := NULL;
204647 l_adr_transaction_coa_id := NULL;
204648 l_adr_accounting_coa_id := NULL;
204649 l_adr_flexfield_segment_code := NULL;
204650 l_adr_flex_value_set_id := NULL;
204651 l_adr_value_type_code := NULL;
204652 l_adr_value_combination_id := NULL;
204653 l_adr_value_segment_code := NULL;
204654
204655 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
204656 l_bflow_class_code := ''; -- 4219869 Business Flow
204657 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
204658 l_budgetary_control_flag := 'N';
204659
204660 l_bflow_applied_to_amt_idx := NULL; -- 5132302
204661 l_bflow_applied_to_amt := NULL; -- 5132302
204662 l_entered_amt_idx := NULL; -- 4262811
204663 l_accted_amt_idx := NULL; -- 4262811
204664 l_acc_rev_flag := NULL; -- 4262811
204665 l_accrual_line_num := NULL; -- 4262811
204666 l_tmp_amt := NULL; -- 4262811
204667 --
204668
204669 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
204670 l_balance_type_code <> 'B' THEN
204671 IF NVL(p_source_64,'
204672 ') = 'INTERCO AP'
204673 THEN
204674
204675 --
204676 XLA_AE_LINES_PKG.SetNewLine;
204677
204678 p_balance_type_code := l_balance_type_code;
204679 -- set the flag so later we will know whether the gain loss line needs to be created
204680
204681 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
204682 p_actual_flag :='A';
204683 END IF;
204684
204685 --
204686 -- bulk performance
204687 --
204688 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
204689 p_header_num => 0); -- 4262811
204690 --
204691 -- set accounting line options
204692 --
204693 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
204694 p_natural_side_code => 'C'
204695 , p_gain_or_loss_flag => 'N'
204696 , p_gl_transfer_mode_code => 'S'
204697 , p_acct_entry_type_code => 'A'
204698 , p_switch_side_flag => 'Y'
204699 , p_merge_duplicate_code => 'N'
204700 );
204701 --
204702 l_acc_rev_natural_side_code := 'D'; -- 4262811
204703 --
204704 --
204708 (p_component_type => l_component_type
204705 -- set accounting line type info
204706 --
204707 xla_ae_lines_pkg.SetAcctLineType
204709 ,p_event_type_code => l_event_type_code
204710 ,p_line_definition_owner_code => l_line_definition_owner_code
204711 ,p_line_definition_code => l_line_definition_code
204712 ,p_accounting_line_code => l_component_code
204713 ,p_accounting_line_type_code => l_component_type_code
204714 ,p_accounting_line_appl_id => l_component_appl_id
204715 ,p_amb_context_code => l_amb_context_code
204716 ,p_entity_code => l_entity_code
204717 ,p_event_class_code => l_event_class_code);
204718 --
204719 -- set accounting class
204720 --
204721 xla_ae_lines_pkg.SetAcctClass(
204722 p_accounting_class_code => 'LIABILITY'
204723 , p_ae_header_id => l_ae_header_id
204724 );
204725
204726 --
204727 -- set rounding class
204728 --
204729 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
204730 'LIABILITY';
204731
204732 --
204733 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
204734 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
204735 --
204736 -- bulk performance
204737 --
204738 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
204739
204740 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
204741 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
204742
204743 -- 4955764
204744 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
204745 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
204746
204747 -- 4458381 Public Sector Enh
204748
204749 --
204750 -- set accounting attributes for the line type
204751 --
204752 l_entered_amt_idx := 7;
204753 l_accted_amt_idx := 9;
204754 l_bflow_applied_to_amt_idx := NULL; -- 5132302
204755 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
204756 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_56);
204757 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
204758 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_57);
204759 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_IDENTIFIER_3';
204760 l_rec_acct_attrs.array_num_value(3) := to_char(p_source_62);
204761 l_rec_acct_attrs.array_acct_attr_code(4) := 'DISTRIBUTION_IDENTIFIER_4';
204762 l_rec_acct_attrs.array_char_value(4) := p_source_59;
204763 l_rec_acct_attrs.array_acct_attr_code(5) := 'DISTRIBUTION_IDENTIFIER_5';
204764 l_rec_acct_attrs.array_num_value(5) := to_char(p_source_58);
204765 l_rec_acct_attrs.array_acct_attr_code(6) := 'DISTRIBUTION_TYPE';
204766 l_rec_acct_attrs.array_char_value(6) := p_source_51;
204767 l_rec_acct_attrs.array_acct_attr_code(7) := 'ENTERED_CURRENCY_AMOUNT';
204768 l_rec_acct_attrs.array_num_value(7) := p_source_65;
204769 l_rec_acct_attrs.array_acct_attr_code(8) := 'ENTERED_CURRENCY_CODE';
204770 l_rec_acct_attrs.array_char_value(8) := p_source_66;
204771 l_rec_acct_attrs.array_acct_attr_code(9) := 'LEDGER_AMOUNT';
204772 l_rec_acct_attrs.array_num_value(9) := p_source_65;
204773
204774 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
204775 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
204776
204777 ---------------------------------------------------------------------------------------------------------------
204778 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
204779 ---------------------------------------------------------------------------------------------------------------
204780 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
204781
204782 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
204783 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
204784
204785 IF xla_accounting_cache_pkg.GetValueChar
204786 (p_source_code => 'LEDGER_CATEGORY_CODE'
204787 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
204788 AND l_bflow_method_code = 'PRIOR_ENTRY'
204789 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
204790 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
204791 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
204792 )
204793 THEN
204794 xla_ae_lines_pkg.BflowUpgEntry
204795 (p_business_method_code => l_bflow_method_code
204796 ,p_business_class_code => l_bflow_class_code
204797 ,p_balance_type => l_balance_type_code);
204798 ELSE
204799 NULL;
204800 -- No business flow processing for business flow method of NONE.
204801 END IF;
204802
204803 --
204804 -- call analytical criteria
204805 --
204806
204807 --
204808 -- call description
204809 --
204810
204811 xla_ae_lines_pkg.SetLineDescription(
204812 p_ae_header_id => l_ae_header_id
204813 ,p_description => Description_143 (
204814 p_application_id => p_application_id
204818 )
204815 , p_ae_header_id => l_ae_header_id
204816 , p_source_2 => p_source_2
204817 , p_source_3 => p_source_3
204819 );
204820
204821
204822 --
204823 -- call ADRs
204824 -- Bug 4922099
204825 --
204826 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
204827 (NVL(l_actual_upg_option, 'N') = 'O') OR
204828 (NVL(l_enc_upg_option, 'N') = 'O')
204829 )
204830 THEN
204831 NULL;
204832 --
204833 --
204834
204835 l_ccid := AcctDerRule_187(
204836 p_application_id => p_application_id
204837 , p_ae_header_id => l_ae_header_id
204838 , p_source_42 => p_source_42
204839 , x_transaction_coa_id => l_adr_transaction_coa_id
204840 , x_accounting_coa_id => l_adr_accounting_coa_id
204841 , x_value_type_code => l_adr_value_type_code
204842 , p_side => 'NA'
204843 );
204844
204845 xla_ae_lines_pkg.set_ccid(
204846 p_code_combination_id => l_ccid
204847 , p_value_type_code => l_adr_value_type_code
204848 , p_transaction_coa_id => l_adr_transaction_coa_id
204849 , p_accounting_coa_id => l_adr_accounting_coa_id
204850 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
204851 , p_adr_type_code => 'S'
204852 , p_component_type => l_component_type
204853 , p_component_code => l_component_code
204854 , p_component_type_code => l_component_type_code
204855 , p_component_appl_id => l_component_appl_id
204856 , p_amb_context_code => l_amb_context_code
204857 , p_side => 'NA'
204858 );
204859
204860
204861 --
204862 --
204863 END IF;
204864 --
204865 -- Bug 4922099
204866 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
204867 (NVL(l_enc_upg_option, 'N') = 'O')
204868 ) AND
204869 (l_bflow_method_code = 'PRIOR_ENTRY')
204870 )
204871 THEN
204872 IF
204873 --
204874 1 = 2
204875 --
204876 THEN
204877 xla_accounting_err_pkg.build_message
204878 (p_appli_s_name => 'XLA'
204879 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
204880 ,p_token_1 => 'LINE_NUMBER'
204881 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
204882 ,p_token_2 => 'LINE_TYPE_NAME'
204883 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
204884 l_component_type
204885 ,l_component_code
204886 ,l_component_type_code
204887 ,l_component_appl_id
204888 ,l_amb_context_code
204889 ,l_entity_code
204890 ,l_event_class_code
204891 )
204892 ,p_token_3 => 'OWNER'
204893 ,p_value_3 => xla_lookups_pkg.get_meaning(
204894 p_lookup_type => 'XLA_OWNER_TYPE'
204895 ,p_lookup_code => l_component_type_code
204896 )
204897 ,p_token_4 => 'PRODUCT_NAME'
204898 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
204899 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
204900 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
204901 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
204902 ,p_ae_header_id => NULL
204903 );
204904
204905 IF (C_LEVEL_ERROR>= g_log_level) THEN
204906 trace
204907 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
204908 ,p_level => C_LEVEL_ERROR
204909 ,p_module => l_log_module);
204910 END IF;
204911 END IF;
204912 END IF;
204913 --
204914 --
204915 ------------------------------------------------------------------------------------------------
204916 -- 4219869 Business Flow
204917 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
204918 -- Prior Entry. Currently, the following code is always generated.
204919 ------------------------------------------------------------------------------------------------
204920 XLA_AE_LINES_PKG.ValidateCurrentLine;
204921
204922 ------------------------------------------------------------------------------------
204926 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
204923 -- 4219869 Business Flow
204924 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
204925 ------------------------------------------------------------------------------------
204927
204928 ----------------------------------------------------------------------------------
204929 -- 4219869 Business Flow
204930 -- Update journal entry status -- Need to generate this within IF <condition>
204931 ----------------------------------------------------------------------------------
204932 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
204933 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
204934 ,p_balance_type_code => l_balance_type_code
204935 );
204936
204937 -------------------------------------------------------------------------------------------
204938 -- 4262811 - Generate the Accrual Reversal lines
204939 -------------------------------------------------------------------------------------------
204940 BEGIN
204941 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
204942 (g_array_event(p_event_id).array_value_num('header_index'));
204943 IF l_acc_rev_flag IS NULL THEN
204944 l_acc_rev_flag := 'N';
204945 END IF;
204946 EXCEPTION
204947 WHEN OTHERS THEN
204948 l_acc_rev_flag := 'N';
204949 END;
204950 --
204951 IF (l_acc_rev_flag = 'Y') THEN
204952
204953 -- 4645092 ------------------------------------------------------------------------------
204954 -- To allow MPA report to determine if it should generate report process
204955 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
204956 ------------------------------------------------------------------------------------------
204957
204958 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
204959 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
204960 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
204961 -- call ADRs
204962 -- Bug 4922099
204963 --
204964 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
204965 (NVL(l_actual_upg_option, 'N') = 'O') OR
204966 (NVL(l_enc_upg_option, 'N') = 'O')
204967 )
204968 THEN
204969 NULL;
204970 --
204971 --
204972
204973 l_ccid := AcctDerRule_187(
204974 p_application_id => p_application_id
204975 , p_ae_header_id => l_ae_header_id
204976 , p_source_42 => p_source_42
204977 , x_transaction_coa_id => l_adr_transaction_coa_id
204978 , x_accounting_coa_id => l_adr_accounting_coa_id
204979 , x_value_type_code => l_adr_value_type_code
204980 , p_side => 'NA'
204981 );
204982
204983 xla_ae_lines_pkg.set_ccid(
204984 p_code_combination_id => l_ccid
204985 , p_value_type_code => l_adr_value_type_code
204986 , p_transaction_coa_id => l_adr_transaction_coa_id
204987 , p_accounting_coa_id => l_adr_accounting_coa_id
204988 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
204989 , p_adr_type_code => 'S'
204990 , p_component_type => l_component_type
204991 , p_component_code => l_component_code
204992 , p_component_type_code => l_component_type_code
204993 , p_component_appl_id => l_component_appl_id
204994 , p_amb_context_code => l_amb_context_code
204995 , p_side => 'NA'
204996 );
204997
204998
204999 --
205000 --
205001 END IF;
205002
205003 --
205004 -- Update the line information that should be overwritten
205005 --
205006 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
205007 p_header_num => 1);
205008 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
205009
205010 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
205011
205012 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
205013 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
205014 END IF;
205015
205016 --
205017 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
205018 --
205019 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
205020 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
205021 ELSE
205022 ---------------------------------------------------------------------------------------------------
205023 -- 4262811a Switch Sign
205024 ---------------------------------------------------------------------------------------------------
205025 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
205026 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
205027 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
205028 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
205029 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
205033
205030 -- 5132302
205031 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
205032 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
205034 END IF;
205035
205036 -- 4955764
205037 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
205038 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
205039
205040
205041 XLA_AE_LINES_PKG.ValidateCurrentLine;
205042 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
205043
205044 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
205045 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
205046 ,p_balance_type_code => l_balance_type_code);
205047
205048 END IF;
205049
205050 -----------------------------------------------------------------------------------------
205051 -- 4262811 Multiperiod Accounting
205052 -----------------------------------------------------------------------------------------
205053 -- No MPA option is assigned.
205054
205055
205056 END IF;
205057 END IF;
205058 --
205059
205060 --
205061 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
205062 trace
205063 (p_msg => 'END of AcctLineType_462'
205064 ,p_level => C_LEVEL_PROCEDURE
205065 ,p_module => l_log_module);
205066 END IF;
205067 --
205068 EXCEPTION
205069 WHEN xla_exceptions_pkg.application_exception THEN
205070 RAISE;
205071 WHEN OTHERS THEN
205072 xla_exceptions_pkg.raise_message
205073 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_462');
205074 END AcctLineType_462;
205075 --
205076
205077 ---------------------------------------
205078 --
205079 -- PRIVATE FUNCTION
205080 -- AcctLineType_463
205081 --
205082 ---------------------------------------
205083 PROCEDURE AcctLineType_463 (
205084 p_application_id IN NUMBER
205085 ,p_event_id IN NUMBER
205086 ,p_calculate_acctd_flag IN VARCHAR2
205087 ,p_calculate_g_l_flag IN VARCHAR2
205088 ,p_actual_flag IN OUT VARCHAR2
205089 ,p_balance_type_code OUT VARCHAR2
205090 ,p_gain_or_loss_ref OUT VARCHAR2
205091
205092 --Inflation Adjustment Type Description
205093 , p_source_2 IN VARCHAR2
205094 --Accounting Date
205095 , p_source_3 IN DATE
205096 --Inflation AP Intercompany Ccid
205097 , p_source_42 IN NUMBER
205098 --Transaction Header Identifier
205099 , p_source_49 IN NUMBER
205100 --Adjustment Line Identifier
205101 , p_source_50 IN NUMBER
205102 --Distribution Type Code
205103 , p_source_51 IN VARCHAR2
205104 --Inflation Adjustment Type
205105 , p_source_64 IN VARCHAR2
205106 --Inflation Entered Amount
205107 , p_source_65 IN NUMBER
205108 --Inflation Currency Code
205109 , p_source_66 IN VARCHAR2
205110 )
205111 IS
205112
205113 l_component_type VARCHAR2(80);
205114 l_component_code VARCHAR2(30);
205115 l_component_type_code VARCHAR2(1);
205116 l_component_appl_id INTEGER;
205117 l_amb_context_code VARCHAR2(30);
205118 l_entity_code VARCHAR2(30);
205119 l_event_class_code VARCHAR2(30);
205120 l_ae_header_id NUMBER;
205121 l_event_type_code VARCHAR2(30);
205122 l_line_definition_code VARCHAR2(30);
205123 l_line_definition_owner_code VARCHAR2(1);
205124 --
205125 -- adr variables
205126 l_segment VARCHAR2(30);
205127 l_ccid NUMBER;
205128 l_adr_transaction_coa_id NUMBER;
205129 l_adr_accounting_coa_id NUMBER;
205130 l_adr_flexfield_segment_code VARCHAR2(30);
205131 l_adr_flex_value_set_id NUMBER;
205132 l_adr_value_type_code VARCHAR2(30);
205133 l_adr_value_combination_id NUMBER;
205134 l_adr_value_segment_code VARCHAR2(30);
205135
205136 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
205137 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
205138 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
205139 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
205140
205141 -- 4262811 Variables ------------------------------------------------------------------------------------------
205142 l_entered_amt_idx NUMBER;
205143 l_accted_amt_idx NUMBER;
205144 l_acc_rev_flag VARCHAR2(1);
205145 l_accrual_line_num NUMBER;
205146 l_tmp_amt NUMBER;
205147 l_acc_rev_natural_side_code VARCHAR2(1);
205148
205149 l_num_entries NUMBER;
205150 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
205151 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
205152 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
205153 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
205154 l_recog_line_1 NUMBER;
205155 l_recog_line_2 NUMBER;
205156
205157 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
205158 l_bflow_applied_to_amt NUMBER; -- 5132302
205159 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
205160
205164 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
205161 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
205162
205163 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
205165
205166 ---------------------------------------------------------------------------------------------------------------
205167
205168
205169 --
205170 -- bulk performance
205171 --
205172 l_balance_type_code VARCHAR2(1);
205173 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
205174 l_log_module VARCHAR2(240);
205175
205176 --
205177 -- Upgrade strategy
205178 --
205179 l_actual_upg_option VARCHAR2(1);
205180 l_enc_upg_option VARCHAR2(1);
205181
205182 --
205183 BEGIN
205184 --
205185 IF g_log_enabled THEN
205186 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_463';
205187 END IF;
205188 --
205189 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
205190
205191 trace
205192 (p_msg => 'BEGIN of AcctLineType_463'
205193 ,p_level => C_LEVEL_PROCEDURE
205194 ,p_module => l_log_module);
205195
205196 END IF;
205197 --
205198 l_component_type := 'AMB_JLT';
205199 l_component_code := 'IAC_INTERCOMPANY_AP';
205200 l_component_type_code := 'S';
205201 l_component_appl_id := 140;
205202 l_amb_context_code := 'DEFAULT';
205203 l_entity_code := 'TRANSACTIONS';
205204 l_event_class_code := 'RETIREMENTS';
205205 l_event_type_code := 'RETIREMENTS';
205206 l_line_definition_owner_code := 'S';
205207 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
205208 --
205209 l_balance_type_code := 'A';
205210 l_segment := NULL;
205211 l_ccid := NULL;
205212 l_adr_transaction_coa_id := NULL;
205213 l_adr_accounting_coa_id := NULL;
205214 l_adr_flexfield_segment_code := NULL;
205215 l_adr_flex_value_set_id := NULL;
205216 l_adr_value_type_code := NULL;
205217 l_adr_value_combination_id := NULL;
205218 l_adr_value_segment_code := NULL;
205219
205220 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
205221 l_bflow_class_code := ''; -- 4219869 Business Flow
205222 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
205223 l_budgetary_control_flag := 'N';
205224
205225 l_bflow_applied_to_amt_idx := NULL; -- 5132302
205226 l_bflow_applied_to_amt := NULL; -- 5132302
205227 l_entered_amt_idx := NULL; -- 4262811
205228 l_accted_amt_idx := NULL; -- 4262811
205229 l_acc_rev_flag := NULL; -- 4262811
205230 l_accrual_line_num := NULL; -- 4262811
205231 l_tmp_amt := NULL; -- 4262811
205232 --
205233
205234 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
205235 l_balance_type_code <> 'B' THEN
205236 IF NVL(p_source_64,'
205237 ') = 'INTERCO AP'
205238 THEN
205239
205240 --
205241 XLA_AE_LINES_PKG.SetNewLine;
205242
205243 p_balance_type_code := l_balance_type_code;
205244 -- set the flag so later we will know whether the gain loss line needs to be created
205245
205246 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
205247 p_actual_flag :='A';
205248 END IF;
205249
205250 --
205251 -- bulk performance
205252 --
205253 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
205254 p_header_num => 0); -- 4262811
205255 --
205256 -- set accounting line options
205257 --
205258 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
205259 p_natural_side_code => 'C'
205260 , p_gain_or_loss_flag => 'N'
205261 , p_gl_transfer_mode_code => 'S'
205262 , p_acct_entry_type_code => 'A'
205263 , p_switch_side_flag => 'Y'
205264 , p_merge_duplicate_code => 'N'
205265 );
205266 --
205267 l_acc_rev_natural_side_code := 'D'; -- 4262811
205268 --
205269 --
205270 -- set accounting line type info
205271 --
205272 xla_ae_lines_pkg.SetAcctLineType
205273 (p_component_type => l_component_type
205274 ,p_event_type_code => l_event_type_code
205275 ,p_line_definition_owner_code => l_line_definition_owner_code
205276 ,p_line_definition_code => l_line_definition_code
205277 ,p_accounting_line_code => l_component_code
205278 ,p_accounting_line_type_code => l_component_type_code
205279 ,p_accounting_line_appl_id => l_component_appl_id
205280 ,p_amb_context_code => l_amb_context_code
205281 ,p_entity_code => l_entity_code
205282 ,p_event_class_code => l_event_class_code);
205283 --
205284 -- set accounting class
205285 --
205286 xla_ae_lines_pkg.SetAcctClass(
205287 p_accounting_class_code => 'LIABILITY'
205288 , p_ae_header_id => l_ae_header_id
205289 );
205290
205291 --
205292 -- set rounding class
205293 --
205294 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
205295 'LIABILITY';
205299 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
205296
205297 --
205298 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
205300 --
205301 -- bulk performance
205302 --
205303 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
205304
205305 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
205306 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
205307
205308 -- 4955764
205309 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
205310 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
205311
205312 -- 4458381 Public Sector Enh
205313
205314 --
205315 -- set accounting attributes for the line type
205316 --
205317 l_entered_amt_idx := 4;
205318 l_accted_amt_idx := 6;
205319 l_bflow_applied_to_amt_idx := NULL; -- 5132302
205320 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
205321 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
205322 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
205323 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
205324 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
205325 l_rec_acct_attrs.array_char_value(3) := p_source_51;
205326 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
205327 l_rec_acct_attrs.array_num_value(4) := p_source_65;
205328 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
205329 l_rec_acct_attrs.array_char_value(5) := p_source_66;
205330 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
205331 l_rec_acct_attrs.array_num_value(6) := p_source_65;
205332
205333 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
205334 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
205335
205336 ---------------------------------------------------------------------------------------------------------------
205337 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
205338 ---------------------------------------------------------------------------------------------------------------
205339 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
205340
205341 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
205342 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
205343
205344 IF xla_accounting_cache_pkg.GetValueChar
205345 (p_source_code => 'LEDGER_CATEGORY_CODE'
205346 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
205347 AND l_bflow_method_code = 'PRIOR_ENTRY'
205348 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
205349 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
205350 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
205351 )
205352 THEN
205353 xla_ae_lines_pkg.BflowUpgEntry
205354 (p_business_method_code => l_bflow_method_code
205355 ,p_business_class_code => l_bflow_class_code
205356 ,p_balance_type => l_balance_type_code);
205357 ELSE
205358 NULL;
205359 -- No business flow processing for business flow method of NONE.
205360 END IF;
205361
205362 --
205363 -- call analytical criteria
205364 --
205365
205366 --
205367 -- call description
205368 --
205369
205370 xla_ae_lines_pkg.SetLineDescription(
205371 p_ae_header_id => l_ae_header_id
205372 ,p_description => Description_143 (
205373 p_application_id => p_application_id
205374 , p_ae_header_id => l_ae_header_id
205375 , p_source_2 => p_source_2
205376 , p_source_3 => p_source_3
205377 )
205378 );
205379
205380
205381 --
205382 -- call ADRs
205383 -- Bug 4922099
205384 --
205385 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
205386 (NVL(l_actual_upg_option, 'N') = 'O') OR
205387 (NVL(l_enc_upg_option, 'N') = 'O')
205388 )
205389 THEN
205390 NULL;
205391 --
205392 --
205393
205394 l_ccid := AcctDerRule_187(
205395 p_application_id => p_application_id
205396 , p_ae_header_id => l_ae_header_id
205397 , p_source_42 => p_source_42
205398 , x_transaction_coa_id => l_adr_transaction_coa_id
205399 , x_accounting_coa_id => l_adr_accounting_coa_id
205400 , x_value_type_code => l_adr_value_type_code
205401 , p_side => 'NA'
205402 );
205403
205404 xla_ae_lines_pkg.set_ccid(
205405 p_code_combination_id => l_ccid
205406 , p_value_type_code => l_adr_value_type_code
205407 , p_transaction_coa_id => l_adr_transaction_coa_id
205408 , p_accounting_coa_id => l_adr_accounting_coa_id
205409 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
205410 , p_adr_type_code => 'S'
205411 , p_component_type => l_component_type
205412 , p_component_code => l_component_code
205416 , p_side => 'NA'
205413 , p_component_type_code => l_component_type_code
205414 , p_component_appl_id => l_component_appl_id
205415 , p_amb_context_code => l_amb_context_code
205417 );
205418
205419
205420 --
205421 --
205422 END IF;
205423 --
205424 -- Bug 4922099
205425 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
205426 (NVL(l_enc_upg_option, 'N') = 'O')
205427 ) AND
205428 (l_bflow_method_code = 'PRIOR_ENTRY')
205429 )
205430 THEN
205431 IF
205432 --
205433 1 = 2
205434 --
205435 THEN
205436 xla_accounting_err_pkg.build_message
205437 (p_appli_s_name => 'XLA'
205438 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
205439 ,p_token_1 => 'LINE_NUMBER'
205440 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
205441 ,p_token_2 => 'LINE_TYPE_NAME'
205442 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
205443 l_component_type
205444 ,l_component_code
205445 ,l_component_type_code
205446 ,l_component_appl_id
205447 ,l_amb_context_code
205448 ,l_entity_code
205449 ,l_event_class_code
205450 )
205451 ,p_token_3 => 'OWNER'
205452 ,p_value_3 => xla_lookups_pkg.get_meaning(
205453 p_lookup_type => 'XLA_OWNER_TYPE'
205454 ,p_lookup_code => l_component_type_code
205455 )
205456 ,p_token_4 => 'PRODUCT_NAME'
205457 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
205458 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
205459 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
205460 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
205461 ,p_ae_header_id => NULL
205462 );
205463
205464 IF (C_LEVEL_ERROR>= g_log_level) THEN
205465 trace
205466 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
205467 ,p_level => C_LEVEL_ERROR
205468 ,p_module => l_log_module);
205469 END IF;
205470 END IF;
205471 END IF;
205472 --
205473 --
205474 ------------------------------------------------------------------------------------------------
205475 -- 4219869 Business Flow
205476 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
205477 -- Prior Entry. Currently, the following code is always generated.
205478 ------------------------------------------------------------------------------------------------
205479 XLA_AE_LINES_PKG.ValidateCurrentLine;
205480
205481 ------------------------------------------------------------------------------------
205482 -- 4219869 Business Flow
205483 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
205484 ------------------------------------------------------------------------------------
205485 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
205486
205487 ----------------------------------------------------------------------------------
205488 -- 4219869 Business Flow
205489 -- Update journal entry status -- Need to generate this within IF <condition>
205490 ----------------------------------------------------------------------------------
205491 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
205492 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
205493 ,p_balance_type_code => l_balance_type_code
205494 );
205495
205496 -------------------------------------------------------------------------------------------
205497 -- 4262811 - Generate the Accrual Reversal lines
205498 -------------------------------------------------------------------------------------------
205499 BEGIN
205500 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
205501 (g_array_event(p_event_id).array_value_num('header_index'));
205502 IF l_acc_rev_flag IS NULL THEN
205503 l_acc_rev_flag := 'N';
205504 END IF;
205505 EXCEPTION
205506 WHEN OTHERS THEN
205507 l_acc_rev_flag := 'N';
205508 END;
205509 --
205510 IF (l_acc_rev_flag = 'Y') THEN
205511
205515 ------------------------------------------------------------------------------------------
205512 -- 4645092 ------------------------------------------------------------------------------
205513 -- To allow MPA report to determine if it should generate report process
205514 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
205516
205517 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
205518 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
205519 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
205520 -- call ADRs
205521 -- Bug 4922099
205522 --
205523 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
205524 (NVL(l_actual_upg_option, 'N') = 'O') OR
205525 (NVL(l_enc_upg_option, 'N') = 'O')
205526 )
205527 THEN
205528 NULL;
205529 --
205530 --
205531
205532 l_ccid := AcctDerRule_187(
205533 p_application_id => p_application_id
205534 , p_ae_header_id => l_ae_header_id
205535 , p_source_42 => p_source_42
205536 , x_transaction_coa_id => l_adr_transaction_coa_id
205537 , x_accounting_coa_id => l_adr_accounting_coa_id
205538 , x_value_type_code => l_adr_value_type_code
205539 , p_side => 'NA'
205540 );
205541
205542 xla_ae_lines_pkg.set_ccid(
205543 p_code_combination_id => l_ccid
205544 , p_value_type_code => l_adr_value_type_code
205545 , p_transaction_coa_id => l_adr_transaction_coa_id
205546 , p_accounting_coa_id => l_adr_accounting_coa_id
205547 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
205548 , p_adr_type_code => 'S'
205549 , p_component_type => l_component_type
205550 , p_component_code => l_component_code
205551 , p_component_type_code => l_component_type_code
205552 , p_component_appl_id => l_component_appl_id
205553 , p_amb_context_code => l_amb_context_code
205554 , p_side => 'NA'
205555 );
205556
205557
205558 --
205559 --
205560 END IF;
205561
205562 --
205563 -- Update the line information that should be overwritten
205564 --
205565 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
205566 p_header_num => 1);
205567 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
205568
205569 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
205570
205571 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
205572 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
205573 END IF;
205574
205575 --
205576 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
205577 --
205578 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
205579 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
205580 ELSE
205581 ---------------------------------------------------------------------------------------------------
205582 -- 4262811a Switch Sign
205583 ---------------------------------------------------------------------------------------------------
205584 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
205585 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
205586 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
205587 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
205588 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
205589 -- 5132302
205590 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
205591 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
205592
205593 END IF;
205594
205595 -- 4955764
205596 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
205597 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
205598
205599
205600 XLA_AE_LINES_PKG.ValidateCurrentLine;
205601 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
205602
205603 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
205604 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
205605 ,p_balance_type_code => l_balance_type_code);
205606
205607 END IF;
205608
205609 -----------------------------------------------------------------------------------------
205610 -- 4262811 Multiperiod Accounting
205611 -----------------------------------------------------------------------------------------
205612 -- No MPA option is assigned.
205613
205614
205615 END IF;
205616 END IF;
205617 --
205618
205619 --
205620 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
205621 trace
205622 (p_msg => 'END of AcctLineType_463'
205623 ,p_level => C_LEVEL_PROCEDURE
205624 ,p_module => l_log_module);
205625 END IF;
205626 --
205627 EXCEPTION
205631 xla_exceptions_pkg.raise_message
205628 WHEN xla_exceptions_pkg.application_exception THEN
205629 RAISE;
205630 WHEN OTHERS THEN
205632 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_463');
205633 END AcctLineType_463;
205634 --
205635
205636 ---------------------------------------
205637 --
205638 -- PRIVATE FUNCTION
205639 -- AcctLineType_464
205640 --
205641 ---------------------------------------
205642 PROCEDURE AcctLineType_464 (
205643 p_application_id IN NUMBER
205644 ,p_event_id IN NUMBER
205645 ,p_calculate_acctd_flag IN VARCHAR2
205646 ,p_calculate_g_l_flag IN VARCHAR2
205647 ,p_actual_flag IN OUT VARCHAR2
205648 ,p_balance_type_code OUT VARCHAR2
205649 ,p_gain_or_loss_ref OUT VARCHAR2
205650
205651 --Inflation Adjustment Type Description
205652 , p_source_2 IN VARCHAR2
205653 --Accounting Date
205654 , p_source_3 IN DATE
205655 --Inflation AP Intercompany Ccid
205656 , p_source_42 IN NUMBER
205657 --Transaction Header Identifier
205658 , p_source_49 IN NUMBER
205659 --Adjustment Line Identifier
205660 , p_source_50 IN NUMBER
205661 --Distribution Type Code
205662 , p_source_51 IN VARCHAR2
205663 --Inflation Adjustment Type
205664 , p_source_64 IN VARCHAR2
205665 --Inflation Entered Amount
205666 , p_source_65 IN NUMBER
205667 --Inflation Currency Code
205668 , p_source_66 IN VARCHAR2
205669 )
205670 IS
205671
205672 l_component_type VARCHAR2(80);
205673 l_component_code VARCHAR2(30);
205674 l_component_type_code VARCHAR2(1);
205675 l_component_appl_id INTEGER;
205676 l_amb_context_code VARCHAR2(30);
205677 l_entity_code VARCHAR2(30);
205678 l_event_class_code VARCHAR2(30);
205679 l_ae_header_id NUMBER;
205680 l_event_type_code VARCHAR2(30);
205681 l_line_definition_code VARCHAR2(30);
205682 l_line_definition_owner_code VARCHAR2(1);
205683 --
205684 -- adr variables
205685 l_segment VARCHAR2(30);
205686 l_ccid NUMBER;
205687 l_adr_transaction_coa_id NUMBER;
205688 l_adr_accounting_coa_id NUMBER;
205689 l_adr_flexfield_segment_code VARCHAR2(30);
205690 l_adr_flex_value_set_id NUMBER;
205691 l_adr_value_type_code VARCHAR2(30);
205692 l_adr_value_combination_id NUMBER;
205693 l_adr_value_segment_code VARCHAR2(30);
205694
205695 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
205696 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
205697 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
205698 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
205699
205700 -- 4262811 Variables ------------------------------------------------------------------------------------------
205701 l_entered_amt_idx NUMBER;
205702 l_accted_amt_idx NUMBER;
205703 l_acc_rev_flag VARCHAR2(1);
205704 l_accrual_line_num NUMBER;
205705 l_tmp_amt NUMBER;
205706 l_acc_rev_natural_side_code VARCHAR2(1);
205707
205708 l_num_entries NUMBER;
205709 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
205710 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
205711 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
205712 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
205713 l_recog_line_1 NUMBER;
205714 l_recog_line_2 NUMBER;
205715
205716 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
205717 l_bflow_applied_to_amt NUMBER; -- 5132302
205718 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
205719
205720 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
205721
205722 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
205723 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
205724
205725 ---------------------------------------------------------------------------------------------------------------
205726
205727
205728 --
205729 -- bulk performance
205730 --
205731 l_balance_type_code VARCHAR2(1);
205732 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
205733 l_log_module VARCHAR2(240);
205734
205735 --
205736 -- Upgrade strategy
205737 --
205738 l_actual_upg_option VARCHAR2(1);
205739 l_enc_upg_option VARCHAR2(1);
205740
205741 --
205742 BEGIN
205743 --
205744 IF g_log_enabled THEN
205745 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_464';
205746 END IF;
205747 --
205748 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
205749
205750 trace
205751 (p_msg => 'BEGIN of AcctLineType_464'
205752 ,p_level => C_LEVEL_PROCEDURE
205753 ,p_module => l_log_module);
205754
205755 END IF;
205756 --
205757 l_component_type := 'AMB_JLT';
205758 l_component_code := 'IAC_INTERCOMPANY_AP';
205759 l_component_type_code := 'S';
205760 l_component_appl_id := 140;
205761 l_amb_context_code := 'DEFAULT';
205762 l_entity_code := 'TRANSACTIONS';
205766 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
205763 l_event_class_code := 'CATEGORY_RECLASS';
205764 l_event_type_code := 'CATEGORY_RECLASS_ALL';
205765 l_line_definition_owner_code := 'S';
205767 --
205768 l_balance_type_code := 'A';
205769 l_segment := NULL;
205770 l_ccid := NULL;
205771 l_adr_transaction_coa_id := NULL;
205772 l_adr_accounting_coa_id := NULL;
205773 l_adr_flexfield_segment_code := NULL;
205774 l_adr_flex_value_set_id := NULL;
205775 l_adr_value_type_code := NULL;
205776 l_adr_value_combination_id := NULL;
205777 l_adr_value_segment_code := NULL;
205778
205779 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
205780 l_bflow_class_code := ''; -- 4219869 Business Flow
205781 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
205782 l_budgetary_control_flag := 'N';
205783
205784 l_bflow_applied_to_amt_idx := NULL; -- 5132302
205785 l_bflow_applied_to_amt := NULL; -- 5132302
205786 l_entered_amt_idx := NULL; -- 4262811
205787 l_accted_amt_idx := NULL; -- 4262811
205788 l_acc_rev_flag := NULL; -- 4262811
205789 l_accrual_line_num := NULL; -- 4262811
205790 l_tmp_amt := NULL; -- 4262811
205791 --
205792
205793 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
205794 l_balance_type_code <> 'B' THEN
205795 IF NVL(p_source_64,'
205796 ') = 'INTERCO AP'
205797 THEN
205798
205799 --
205800 XLA_AE_LINES_PKG.SetNewLine;
205801
205802 p_balance_type_code := l_balance_type_code;
205803 -- set the flag so later we will know whether the gain loss line needs to be created
205804
205805 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
205806 p_actual_flag :='A';
205807 END IF;
205808
205809 --
205810 -- bulk performance
205811 --
205812 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
205813 p_header_num => 0); -- 4262811
205814 --
205815 -- set accounting line options
205816 --
205817 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
205818 p_natural_side_code => 'C'
205819 , p_gain_or_loss_flag => 'N'
205820 , p_gl_transfer_mode_code => 'S'
205821 , p_acct_entry_type_code => 'A'
205822 , p_switch_side_flag => 'Y'
205823 , p_merge_duplicate_code => 'N'
205824 );
205825 --
205826 l_acc_rev_natural_side_code := 'D'; -- 4262811
205827 --
205828 --
205829 -- set accounting line type info
205830 --
205831 xla_ae_lines_pkg.SetAcctLineType
205832 (p_component_type => l_component_type
205833 ,p_event_type_code => l_event_type_code
205834 ,p_line_definition_owner_code => l_line_definition_owner_code
205835 ,p_line_definition_code => l_line_definition_code
205836 ,p_accounting_line_code => l_component_code
205837 ,p_accounting_line_type_code => l_component_type_code
205838 ,p_accounting_line_appl_id => l_component_appl_id
205839 ,p_amb_context_code => l_amb_context_code
205840 ,p_entity_code => l_entity_code
205841 ,p_event_class_code => l_event_class_code);
205842 --
205843 -- set accounting class
205844 --
205845 xla_ae_lines_pkg.SetAcctClass(
205846 p_accounting_class_code => 'LIABILITY'
205847 , p_ae_header_id => l_ae_header_id
205848 );
205849
205850 --
205851 -- set rounding class
205852 --
205853 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
205854 'LIABILITY';
205855
205856 --
205857 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
205858 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
205859 --
205860 -- bulk performance
205861 --
205862 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
205863
205864 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
205865 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
205866
205867 -- 4955764
205868 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
205869 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
205870
205871 -- 4458381 Public Sector Enh
205872
205873 --
205874 -- set accounting attributes for the line type
205875 --
205876 l_entered_amt_idx := 4;
205877 l_accted_amt_idx := 6;
205878 l_bflow_applied_to_amt_idx := NULL; -- 5132302
205879 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
205880 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
205881 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
205882 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
205883 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
205884 l_rec_acct_attrs.array_char_value(3) := p_source_51;
205888 l_rec_acct_attrs.array_char_value(5) := p_source_66;
205885 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
205886 l_rec_acct_attrs.array_num_value(4) := p_source_65;
205887 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
205889 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
205890 l_rec_acct_attrs.array_num_value(6) := p_source_65;
205891
205892 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
205893 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
205894
205895 ---------------------------------------------------------------------------------------------------------------
205896 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
205897 ---------------------------------------------------------------------------------------------------------------
205898 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
205899
205900 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
205901 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
205902
205903 IF xla_accounting_cache_pkg.GetValueChar
205904 (p_source_code => 'LEDGER_CATEGORY_CODE'
205905 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
205906 AND l_bflow_method_code = 'PRIOR_ENTRY'
205907 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
205908 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
205909 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
205910 )
205911 THEN
205912 xla_ae_lines_pkg.BflowUpgEntry
205913 (p_business_method_code => l_bflow_method_code
205914 ,p_business_class_code => l_bflow_class_code
205915 ,p_balance_type => l_balance_type_code);
205916 ELSE
205917 NULL;
205918 -- No business flow processing for business flow method of NONE.
205919 END IF;
205920
205921 --
205922 -- call analytical criteria
205923 --
205924
205925 --
205926 -- call description
205927 --
205928
205929 xla_ae_lines_pkg.SetLineDescription(
205930 p_ae_header_id => l_ae_header_id
205931 ,p_description => Description_143 (
205932 p_application_id => p_application_id
205933 , p_ae_header_id => l_ae_header_id
205934 , p_source_2 => p_source_2
205935 , p_source_3 => p_source_3
205936 )
205937 );
205938
205939
205940 --
205941 -- call ADRs
205942 -- Bug 4922099
205943 --
205944 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
205945 (NVL(l_actual_upg_option, 'N') = 'O') OR
205946 (NVL(l_enc_upg_option, 'N') = 'O')
205947 )
205948 THEN
205949 NULL;
205950 --
205951 --
205952
205953 l_ccid := AcctDerRule_187(
205954 p_application_id => p_application_id
205955 , p_ae_header_id => l_ae_header_id
205956 , p_source_42 => p_source_42
205957 , x_transaction_coa_id => l_adr_transaction_coa_id
205958 , x_accounting_coa_id => l_adr_accounting_coa_id
205959 , x_value_type_code => l_adr_value_type_code
205960 , p_side => 'NA'
205961 );
205962
205963 xla_ae_lines_pkg.set_ccid(
205964 p_code_combination_id => l_ccid
205965 , p_value_type_code => l_adr_value_type_code
205966 , p_transaction_coa_id => l_adr_transaction_coa_id
205967 , p_accounting_coa_id => l_adr_accounting_coa_id
205968 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
205969 , p_adr_type_code => 'S'
205970 , p_component_type => l_component_type
205971 , p_component_code => l_component_code
205972 , p_component_type_code => l_component_type_code
205973 , p_component_appl_id => l_component_appl_id
205974 , p_amb_context_code => l_amb_context_code
205975 , p_side => 'NA'
205976 );
205977
205978
205979 --
205980 --
205981 END IF;
205982 --
205983 -- Bug 4922099
205984 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
205985 (NVL(l_enc_upg_option, 'N') = 'O')
205986 ) AND
205987 (l_bflow_method_code = 'PRIOR_ENTRY')
205988 )
205989 THEN
205990 IF
205991 --
205992 1 = 2
205993 --
205994 THEN
205995 xla_accounting_err_pkg.build_message
205996 (p_appli_s_name => 'XLA'
205997 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
205998 ,p_token_1 => 'LINE_NUMBER'
205999 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
206000 ,p_token_2 => 'LINE_TYPE_NAME'
206001 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
206002 l_component_type
206003 ,l_component_code
206004 ,l_component_type_code
206008 ,l_event_class_code
206005 ,l_component_appl_id
206006 ,l_amb_context_code
206007 ,l_entity_code
206009 )
206010 ,p_token_3 => 'OWNER'
206011 ,p_value_3 => xla_lookups_pkg.get_meaning(
206012 p_lookup_type => 'XLA_OWNER_TYPE'
206013 ,p_lookup_code => l_component_type_code
206014 )
206015 ,p_token_4 => 'PRODUCT_NAME'
206016 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
206017 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
206018 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
206019 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
206020 ,p_ae_header_id => NULL
206021 );
206022
206023 IF (C_LEVEL_ERROR>= g_log_level) THEN
206024 trace
206025 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
206026 ,p_level => C_LEVEL_ERROR
206027 ,p_module => l_log_module);
206028 END IF;
206029 END IF;
206030 END IF;
206031 --
206032 --
206033 ------------------------------------------------------------------------------------------------
206034 -- 4219869 Business Flow
206035 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
206036 -- Prior Entry. Currently, the following code is always generated.
206037 ------------------------------------------------------------------------------------------------
206038 XLA_AE_LINES_PKG.ValidateCurrentLine;
206039
206040 ------------------------------------------------------------------------------------
206041 -- 4219869 Business Flow
206042 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
206043 ------------------------------------------------------------------------------------
206044 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
206045
206046 ----------------------------------------------------------------------------------
206047 -- 4219869 Business Flow
206048 -- Update journal entry status -- Need to generate this within IF <condition>
206049 ----------------------------------------------------------------------------------
206050 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
206051 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
206052 ,p_balance_type_code => l_balance_type_code
206053 );
206054
206055 -------------------------------------------------------------------------------------------
206056 -- 4262811 - Generate the Accrual Reversal lines
206057 -------------------------------------------------------------------------------------------
206058 BEGIN
206059 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
206060 (g_array_event(p_event_id).array_value_num('header_index'));
206061 IF l_acc_rev_flag IS NULL THEN
206062 l_acc_rev_flag := 'N';
206063 END IF;
206064 EXCEPTION
206065 WHEN OTHERS THEN
206066 l_acc_rev_flag := 'N';
206067 END;
206068 --
206069 IF (l_acc_rev_flag = 'Y') THEN
206070
206071 -- 4645092 ------------------------------------------------------------------------------
206072 -- To allow MPA report to determine if it should generate report process
206073 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
206074 ------------------------------------------------------------------------------------------
206075
206076 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
206077 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
206078 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
206079 -- call ADRs
206080 -- Bug 4922099
206081 --
206082 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
206083 (NVL(l_actual_upg_option, 'N') = 'O') OR
206084 (NVL(l_enc_upg_option, 'N') = 'O')
206085 )
206086 THEN
206087 NULL;
206088 --
206089 --
206090
206091 l_ccid := AcctDerRule_187(
206092 p_application_id => p_application_id
206093 , p_ae_header_id => l_ae_header_id
206094 , p_source_42 => p_source_42
206095 , x_transaction_coa_id => l_adr_transaction_coa_id
206096 , x_accounting_coa_id => l_adr_accounting_coa_id
206097 , x_value_type_code => l_adr_value_type_code
206098 , p_side => 'NA'
206099 );
206100
206101 xla_ae_lines_pkg.set_ccid(
206102 p_code_combination_id => l_ccid
206103 , p_value_type_code => l_adr_value_type_code
206104 , p_transaction_coa_id => l_adr_transaction_coa_id
206108 , p_component_type => l_component_type
206105 , p_accounting_coa_id => l_adr_accounting_coa_id
206106 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
206107 , p_adr_type_code => 'S'
206109 , p_component_code => l_component_code
206110 , p_component_type_code => l_component_type_code
206111 , p_component_appl_id => l_component_appl_id
206112 , p_amb_context_code => l_amb_context_code
206113 , p_side => 'NA'
206114 );
206115
206116
206117 --
206118 --
206119 END IF;
206120
206121 --
206122 -- Update the line information that should be overwritten
206123 --
206124 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
206125 p_header_num => 1);
206126 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
206127
206128 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
206129
206130 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
206131 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
206132 END IF;
206133
206134 --
206135 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
206136 --
206137 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
206138 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
206139 ELSE
206140 ---------------------------------------------------------------------------------------------------
206141 -- 4262811a Switch Sign
206142 ---------------------------------------------------------------------------------------------------
206143 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
206144 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
206145 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
206146 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
206147 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
206148 -- 5132302
206149 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
206150 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
206151
206152 END IF;
206153
206154 -- 4955764
206155 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
206156 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
206157
206158
206159 XLA_AE_LINES_PKG.ValidateCurrentLine;
206160 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
206161
206162 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
206163 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
206164 ,p_balance_type_code => l_balance_type_code);
206165
206166 END IF;
206167
206168 -----------------------------------------------------------------------------------------
206169 -- 4262811 Multiperiod Accounting
206170 -----------------------------------------------------------------------------------------
206171 -- No MPA option is assigned.
206172
206173
206174 END IF;
206175 END IF;
206176 --
206177
206178 --
206179 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
206180 trace
206181 (p_msg => 'END of AcctLineType_464'
206182 ,p_level => C_LEVEL_PROCEDURE
206183 ,p_module => l_log_module);
206184 END IF;
206185 --
206186 EXCEPTION
206187 WHEN xla_exceptions_pkg.application_exception THEN
206188 RAISE;
206189 WHEN OTHERS THEN
206190 xla_exceptions_pkg.raise_message
206191 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_464');
206192 END AcctLineType_464;
206193 --
206194
206195 ---------------------------------------
206196 --
206197 -- PRIVATE FUNCTION
206198 -- AcctLineType_465
206199 --
206200 ---------------------------------------
206201 PROCEDURE AcctLineType_465 (
206202 p_application_id IN NUMBER
206203 ,p_event_id IN NUMBER
206204 ,p_calculate_acctd_flag IN VARCHAR2
206205 ,p_calculate_g_l_flag IN VARCHAR2
206206 ,p_actual_flag IN OUT VARCHAR2
206207 ,p_balance_type_code OUT VARCHAR2
206208 ,p_gain_or_loss_ref OUT VARCHAR2
206209
206210 --Inflation Adjustment Type Description
206211 , p_source_2 IN VARCHAR2
206212 --Accounting Date
206213 , p_source_3 IN DATE
206214 --Inflation AP Intercompany Ccid
206215 , p_source_42 IN NUMBER
206216 --Transaction Header Identifier
206217 , p_source_49 IN NUMBER
206218 --Adjustment Line Identifier
206219 , p_source_50 IN NUMBER
206220 --Distribution Type Code
206221 , p_source_51 IN VARCHAR2
206222 --Inflation Adjustment Type
206223 , p_source_64 IN VARCHAR2
206224 --Inflation Entered Amount
206225 , p_source_65 IN NUMBER
206226 --Inflation Currency Code
206227 , p_source_66 IN VARCHAR2
206231 l_component_type VARCHAR2(80);
206228 )
206229 IS
206230
206232 l_component_code VARCHAR2(30);
206233 l_component_type_code VARCHAR2(1);
206234 l_component_appl_id INTEGER;
206235 l_amb_context_code VARCHAR2(30);
206236 l_entity_code VARCHAR2(30);
206237 l_event_class_code VARCHAR2(30);
206238 l_ae_header_id NUMBER;
206239 l_event_type_code VARCHAR2(30);
206240 l_line_definition_code VARCHAR2(30);
206241 l_line_definition_owner_code VARCHAR2(1);
206242 --
206243 -- adr variables
206244 l_segment VARCHAR2(30);
206245 l_ccid NUMBER;
206246 l_adr_transaction_coa_id NUMBER;
206247 l_adr_accounting_coa_id NUMBER;
206248 l_adr_flexfield_segment_code VARCHAR2(30);
206249 l_adr_flex_value_set_id NUMBER;
206250 l_adr_value_type_code VARCHAR2(30);
206251 l_adr_value_combination_id NUMBER;
206252 l_adr_value_segment_code VARCHAR2(30);
206253
206254 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
206255 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
206256 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
206257 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
206258
206259 -- 4262811 Variables ------------------------------------------------------------------------------------------
206260 l_entered_amt_idx NUMBER;
206261 l_accted_amt_idx NUMBER;
206262 l_acc_rev_flag VARCHAR2(1);
206263 l_accrual_line_num NUMBER;
206264 l_tmp_amt NUMBER;
206265 l_acc_rev_natural_side_code VARCHAR2(1);
206266
206267 l_num_entries NUMBER;
206268 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
206269 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
206270 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
206271 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
206272 l_recog_line_1 NUMBER;
206273 l_recog_line_2 NUMBER;
206274
206275 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
206276 l_bflow_applied_to_amt NUMBER; -- 5132302
206277 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
206278
206279 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
206280
206281 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
206282 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
206283
206284 ---------------------------------------------------------------------------------------------------------------
206285
206286
206287 --
206288 -- bulk performance
206289 --
206290 l_balance_type_code VARCHAR2(1);
206291 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
206292 l_log_module VARCHAR2(240);
206293
206294 --
206295 -- Upgrade strategy
206296 --
206297 l_actual_upg_option VARCHAR2(1);
206298 l_enc_upg_option VARCHAR2(1);
206299
206300 --
206301 BEGIN
206302 --
206303 IF g_log_enabled THEN
206304 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_465';
206305 END IF;
206306 --
206307 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
206308
206309 trace
206310 (p_msg => 'BEGIN of AcctLineType_465'
206311 ,p_level => C_LEVEL_PROCEDURE
206312 ,p_module => l_log_module);
206313
206314 END IF;
206315 --
206316 l_component_type := 'AMB_JLT';
206317 l_component_code := 'IAC_INTERCOMPANY_AP';
206318 l_component_type_code := 'S';
206319 l_component_appl_id := 140;
206320 l_amb_context_code := 'DEFAULT';
206321 l_entity_code := 'TRANSACTIONS';
206322 l_event_class_code := 'ADJUSTMENTS';
206323 l_event_type_code := 'ADJUSTMENTS_ALL';
206324 l_line_definition_owner_code := 'S';
206325 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
206326 --
206327 l_balance_type_code := 'A';
206328 l_segment := NULL;
206329 l_ccid := NULL;
206330 l_adr_transaction_coa_id := NULL;
206331 l_adr_accounting_coa_id := NULL;
206332 l_adr_flexfield_segment_code := NULL;
206333 l_adr_flex_value_set_id := NULL;
206334 l_adr_value_type_code := NULL;
206335 l_adr_value_combination_id := NULL;
206336 l_adr_value_segment_code := NULL;
206337
206338 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
206339 l_bflow_class_code := ''; -- 4219869 Business Flow
206340 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
206341 l_budgetary_control_flag := 'N';
206342
206343 l_bflow_applied_to_amt_idx := NULL; -- 5132302
206344 l_bflow_applied_to_amt := NULL; -- 5132302
206345 l_entered_amt_idx := NULL; -- 4262811
206346 l_accted_amt_idx := NULL; -- 4262811
206347 l_acc_rev_flag := NULL; -- 4262811
206348 l_accrual_line_num := NULL; -- 4262811
206349 l_tmp_amt := NULL; -- 4262811
206350 --
206351
206352 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
206353 l_balance_type_code <> 'B' THEN
206357
206354 IF NVL(p_source_64,'
206355 ') = 'INTERCO AP'
206356 THEN
206358 --
206359 XLA_AE_LINES_PKG.SetNewLine;
206360
206361 p_balance_type_code := l_balance_type_code;
206362 -- set the flag so later we will know whether the gain loss line needs to be created
206363
206364 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
206365 p_actual_flag :='A';
206366 END IF;
206367
206368 --
206369 -- bulk performance
206370 --
206371 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
206372 p_header_num => 0); -- 4262811
206373 --
206374 -- set accounting line options
206375 --
206376 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
206377 p_natural_side_code => 'C'
206378 , p_gain_or_loss_flag => 'N'
206379 , p_gl_transfer_mode_code => 'S'
206380 , p_acct_entry_type_code => 'A'
206381 , p_switch_side_flag => 'Y'
206382 , p_merge_duplicate_code => 'N'
206383 );
206384 --
206385 l_acc_rev_natural_side_code := 'D'; -- 4262811
206386 --
206387 --
206388 -- set accounting line type info
206389 --
206390 xla_ae_lines_pkg.SetAcctLineType
206391 (p_component_type => l_component_type
206392 ,p_event_type_code => l_event_type_code
206393 ,p_line_definition_owner_code => l_line_definition_owner_code
206394 ,p_line_definition_code => l_line_definition_code
206395 ,p_accounting_line_code => l_component_code
206396 ,p_accounting_line_type_code => l_component_type_code
206397 ,p_accounting_line_appl_id => l_component_appl_id
206398 ,p_amb_context_code => l_amb_context_code
206399 ,p_entity_code => l_entity_code
206400 ,p_event_class_code => l_event_class_code);
206401 --
206402 -- set accounting class
206403 --
206404 xla_ae_lines_pkg.SetAcctClass(
206405 p_accounting_class_code => 'LIABILITY'
206406 , p_ae_header_id => l_ae_header_id
206407 );
206408
206409 --
206410 -- set rounding class
206411 --
206412 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
206413 'LIABILITY';
206414
206415 --
206416 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
206417 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
206418 --
206419 -- bulk performance
206420 --
206421 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
206422
206423 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
206424 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
206425
206426 -- 4955764
206427 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
206428 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
206429
206430 -- 4458381 Public Sector Enh
206431
206432 --
206433 -- set accounting attributes for the line type
206434 --
206435 l_entered_amt_idx := 4;
206436 l_accted_amt_idx := 6;
206437 l_bflow_applied_to_amt_idx := NULL; -- 5132302
206438 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
206439 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
206440 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
206441 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
206442 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
206443 l_rec_acct_attrs.array_char_value(3) := p_source_51;
206444 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
206445 l_rec_acct_attrs.array_num_value(4) := p_source_65;
206446 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
206447 l_rec_acct_attrs.array_char_value(5) := p_source_66;
206448 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
206449 l_rec_acct_attrs.array_num_value(6) := p_source_65;
206450
206451 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
206452 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
206453
206454 ---------------------------------------------------------------------------------------------------------------
206455 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
206456 ---------------------------------------------------------------------------------------------------------------
206457 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
206458
206459 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
206460 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
206461
206462 IF xla_accounting_cache_pkg.GetValueChar
206463 (p_source_code => 'LEDGER_CATEGORY_CODE'
206464 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
206465 AND l_bflow_method_code = 'PRIOR_ENTRY'
206466 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
206467 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
206471 xla_ae_lines_pkg.BflowUpgEntry
206468 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
206469 )
206470 THEN
206472 (p_business_method_code => l_bflow_method_code
206473 ,p_business_class_code => l_bflow_class_code
206474 ,p_balance_type => l_balance_type_code);
206475 ELSE
206476 NULL;
206477 -- No business flow processing for business flow method of NONE.
206478 END IF;
206479
206480 --
206481 -- call analytical criteria
206482 --
206483
206484 --
206485 -- call description
206486 --
206487
206488 xla_ae_lines_pkg.SetLineDescription(
206489 p_ae_header_id => l_ae_header_id
206490 ,p_description => Description_143 (
206491 p_application_id => p_application_id
206492 , p_ae_header_id => l_ae_header_id
206493 , p_source_2 => p_source_2
206494 , p_source_3 => p_source_3
206495 )
206496 );
206497
206498
206499 --
206500 -- call ADRs
206501 -- Bug 4922099
206502 --
206503 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
206504 (NVL(l_actual_upg_option, 'N') = 'O') OR
206505 (NVL(l_enc_upg_option, 'N') = 'O')
206506 )
206507 THEN
206508 NULL;
206509 --
206510 --
206511
206512 l_ccid := AcctDerRule_187(
206513 p_application_id => p_application_id
206514 , p_ae_header_id => l_ae_header_id
206515 , p_source_42 => p_source_42
206516 , x_transaction_coa_id => l_adr_transaction_coa_id
206517 , x_accounting_coa_id => l_adr_accounting_coa_id
206518 , x_value_type_code => l_adr_value_type_code
206519 , p_side => 'NA'
206520 );
206521
206522 xla_ae_lines_pkg.set_ccid(
206523 p_code_combination_id => l_ccid
206524 , p_value_type_code => l_adr_value_type_code
206525 , p_transaction_coa_id => l_adr_transaction_coa_id
206526 , p_accounting_coa_id => l_adr_accounting_coa_id
206527 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
206528 , p_adr_type_code => 'S'
206529 , p_component_type => l_component_type
206530 , p_component_code => l_component_code
206531 , p_component_type_code => l_component_type_code
206532 , p_component_appl_id => l_component_appl_id
206533 , p_amb_context_code => l_amb_context_code
206534 , p_side => 'NA'
206535 );
206536
206537
206538 --
206539 --
206540 END IF;
206541 --
206542 -- Bug 4922099
206543 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
206544 (NVL(l_enc_upg_option, 'N') = 'O')
206545 ) AND
206546 (l_bflow_method_code = 'PRIOR_ENTRY')
206547 )
206548 THEN
206549 IF
206550 --
206551 1 = 2
206552 --
206553 THEN
206554 xla_accounting_err_pkg.build_message
206555 (p_appli_s_name => 'XLA'
206556 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
206557 ,p_token_1 => 'LINE_NUMBER'
206558 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
206559 ,p_token_2 => 'LINE_TYPE_NAME'
206560 ,p_value_2 => XLA_AE_SOURCES_PKG.GetComponentName (
206561 l_component_type
206562 ,l_component_code
206563 ,l_component_type_code
206564 ,l_component_appl_id
206565 ,l_amb_context_code
206566 ,l_entity_code
206567 ,l_event_class_code
206568 )
206569 ,p_token_3 => 'OWNER'
206570 ,p_value_3 => xla_lookups_pkg.get_meaning(
206571 p_lookup_type => 'XLA_OWNER_TYPE'
206572 ,p_lookup_code => l_component_type_code
206573 )
206574 ,p_token_4 => 'PRODUCT_NAME'
206575 ,p_value_4 => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.application_name
206576 ,p_entity_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.entity_id
206577 ,p_event_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.event_id
206578 ,p_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id
206579 ,p_ae_header_id => NULL
206580 );
206581
206582 IF (C_LEVEL_ERROR>= g_log_level) THEN
206583 trace
206587 END IF;
206584 (p_msg => 'ERROR: XLA_UPG_OVERRIDE_ADR_UNDEFINED'
206585 ,p_level => C_LEVEL_ERROR
206586 ,p_module => l_log_module);
206588 END IF;
206589 END IF;
206590 --
206591 --
206592 ------------------------------------------------------------------------------------------------
206593 -- 4219869 Business Flow
206594 -- NOTE: XLA_AE_LINES_PKG.ValidateCurrentLine should NOT be generated if business flow method is
206595 -- Prior Entry. Currently, the following code is always generated.
206596 ------------------------------------------------------------------------------------------------
206597 XLA_AE_LINES_PKG.ValidateCurrentLine;
206598
206599 ------------------------------------------------------------------------------------
206600 -- 4219869 Business Flow
206601 -- Populated credit and debit amounts -- Need to generate this within IF <condition>
206602 ------------------------------------------------------------------------------------
206603 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
206604
206605 ----------------------------------------------------------------------------------
206606 -- 4219869 Business Flow
206607 -- Update journal entry status -- Need to generate this within IF <condition>
206608 ----------------------------------------------------------------------------------
206609 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
206610 (p_hdr_idx => g_array_event(p_event_id).array_value_num('header_index')
206611 ,p_balance_type_code => l_balance_type_code
206612 );
206613
206614 -------------------------------------------------------------------------------------------
206615 -- 4262811 - Generate the Accrual Reversal lines
206616 -------------------------------------------------------------------------------------------
206617 BEGIN
206618 l_acc_rev_flag := XLA_AE_HEADER_PKG.g_rec_header_new.array_accrual_reversal_flag
206619 (g_array_event(p_event_id).array_value_num('header_index'));
206620 IF l_acc_rev_flag IS NULL THEN
206621 l_acc_rev_flag := 'N';
206622 END IF;
206623 EXCEPTION
206624 WHEN OTHERS THEN
206625 l_acc_rev_flag := 'N';
206626 END;
206627 --
206628 IF (l_acc_rev_flag = 'Y') THEN
206629
206630 -- 4645092 ------------------------------------------------------------------------------
206631 -- To allow MPA report to determine if it should generate report process
206632 XLA_ACCOUNTING_PKG.g_mpa_accrual_exists := 'Y';
206633 ------------------------------------------------------------------------------------------
206634
206635 l_accrual_line_num := XLA_AE_LINES_PKG.g_LineNumber;
206636 XLA_AE_LINES_PKG.CopyLineInfo(l_accrual_line_num);
206637 -- added call to set_ccid to execute mapping for secondary accrual reversal entries bug 7444204
206638 -- call ADRs
206639 -- Bug 4922099
206640 --
206641 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
206642 (NVL(l_actual_upg_option, 'N') = 'O') OR
206643 (NVL(l_enc_upg_option, 'N') = 'O')
206644 )
206645 THEN
206646 NULL;
206647 --
206648 --
206649
206650 l_ccid := AcctDerRule_187(
206651 p_application_id => p_application_id
206652 , p_ae_header_id => l_ae_header_id
206653 , p_source_42 => p_source_42
206654 , x_transaction_coa_id => l_adr_transaction_coa_id
206655 , x_accounting_coa_id => l_adr_accounting_coa_id
206656 , x_value_type_code => l_adr_value_type_code
206657 , p_side => 'NA'
206658 );
206659
206660 xla_ae_lines_pkg.set_ccid(
206661 p_code_combination_id => l_ccid
206662 , p_value_type_code => l_adr_value_type_code
206663 , p_transaction_coa_id => l_adr_transaction_coa_id
206664 , p_accounting_coa_id => l_adr_accounting_coa_id
206665 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
206666 , p_adr_type_code => 'S'
206667 , p_component_type => l_component_type
206668 , p_component_code => l_component_code
206669 , p_component_type_code => l_component_type_code
206670 , p_component_appl_id => l_component_appl_id
206671 , p_amb_context_code => l_amb_context_code
206672 , p_side => 'NA'
206673 );
206674
206675
206676 --
206677 --
206678 END IF;
206679
206680 --
206681 -- Update the line information that should be overwritten
206682 --
206683 XLA_AE_LINES_PKG.set_ae_header_id(p_ae_header_id => p_event_id ,
206684 p_header_num => 1);
206685 XLA_AE_LINES_PKG.g_rec_lines.array_header_num(XLA_AE_LINES_PKG.g_LineNumber) :=1;
206686
206687 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := NULL; -- 4669271
206688
206689 IF l_bflow_method_code <> 'NONE' THEN -- 4655713b
206690 XLA_AE_LINES_PKG.g_rec_lines.array_reversal_code(XLA_AE_LINES_PKG.g_LineNumber) := CONCAT('MPA_',l_bflow_method_code);
206691 END IF;
206692
206693 --
206694 -- Depending on the Reversal Method setup, do a switch side or changes sign for the amounts
206695 --
206696 IF (XLA_AE_JOURNAL_ENTRY_PKG.g_cache_ledgers_info.ledger_reversal_option = 'SIDE') THEN
206700 -- 4262811a Switch Sign
206697 XLA_AE_LINES_PKG.g_rec_lines.array_natural_side_code(XLA_AE_LINES_PKG.g_LineNumber) := l_acc_rev_natural_side_code;
206698 ELSE
206699 ---------------------------------------------------------------------------------------------------
206701 ---------------------------------------------------------------------------------------------------
206702 XLA_AE_LINES_PKG.g_rec_lines.array_switch_side_flag(XLA_AE_LINES_PKG.g_LineNumber) := 'N'; -- 5052518
206703 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
206704 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
206705 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) :=
206706 XLA_AE_LINES_PKG.g_rec_lines.array_entered_amount(XLA_AE_LINES_PKG.g_LineNumber) * -1;
206707 -- 5132302
206708 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) :=
206709 XLA_AE_LINES_PKG.g_rec_lines.array_bflow_applied_to_amt(XLA_AE_LINES_PKG.g_LineNumber) * -1;
206710
206711 END IF;
206712
206713 -- 4955764
206714 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
206715 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('acc_rev_header_index'));
206716
206717
206718 XLA_AE_LINES_PKG.ValidateCurrentLine;
206719 XLA_AE_LINES_PKG.SetDebitCreditAmounts;
206720
206721 XLA_AE_JOURNAL_ENTRY_PKG.UpdateJournalEntryStatus
206722 (p_hdr_idx => g_array_event(p_event_id).array_value_num('acc_rev_header_index')
206723 ,p_balance_type_code => l_balance_type_code);
206724
206725 END IF;
206726
206727 -----------------------------------------------------------------------------------------
206728 -- 4262811 Multiperiod Accounting
206729 -----------------------------------------------------------------------------------------
206730 -- No MPA option is assigned.
206731
206732
206733 END IF;
206734 END IF;
206735 --
206736
206737 --
206738 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
206739 trace
206740 (p_msg => 'END of AcctLineType_465'
206741 ,p_level => C_LEVEL_PROCEDURE
206742 ,p_module => l_log_module);
206743 END IF;
206744 --
206745 EXCEPTION
206746 WHEN xla_exceptions_pkg.application_exception THEN
206747 RAISE;
206748 WHEN OTHERS THEN
206749 xla_exceptions_pkg.raise_message
206750 (p_location => 'XLA_00140_AAD_S_000018_PKG.AcctLineType_465');
206751 END AcctLineType_465;
206752 --
206753
206754 ---------------------------------------
206755 --
206756 -- PRIVATE FUNCTION
206757 -- AcctLineType_466
206758 --
206759 ---------------------------------------
206760 PROCEDURE AcctLineType_466 (
206761 p_application_id IN NUMBER
206762 ,p_event_id IN NUMBER
206763 ,p_calculate_acctd_flag IN VARCHAR2
206764 ,p_calculate_g_l_flag IN VARCHAR2
206765 ,p_actual_flag IN OUT VARCHAR2
206766 ,p_balance_type_code OUT VARCHAR2
206767 ,p_gain_or_loss_ref OUT VARCHAR2
206768
206769 --Inflation Adjustment Type Description
206770 , p_source_2 IN VARCHAR2
206771 --Accounting Date
206772 , p_source_3 IN DATE
206773 --Inflation AP Intercompany Ccid
206774 , p_source_42 IN NUMBER
206775 --Transaction Header Identifier
206776 , p_source_49 IN NUMBER
206777 --Adjustment Line Identifier
206778 , p_source_50 IN NUMBER
206779 --Distribution Type Code
206780 , p_source_51 IN VARCHAR2
206781 --Inflation Adjustment Type
206782 , p_source_64 IN VARCHAR2
206783 --Inflation Entered Amount
206784 , p_source_65 IN NUMBER
206785 --Inflation Currency Code
206786 , p_source_66 IN VARCHAR2
206787 )
206788 IS
206789
206790 l_component_type VARCHAR2(80);
206791 l_component_code VARCHAR2(30);
206792 l_component_type_code VARCHAR2(1);
206793 l_component_appl_id INTEGER;
206794 l_amb_context_code VARCHAR2(30);
206795 l_entity_code VARCHAR2(30);
206796 l_event_class_code VARCHAR2(30);
206797 l_ae_header_id NUMBER;
206798 l_event_type_code VARCHAR2(30);
206799 l_line_definition_code VARCHAR2(30);
206800 l_line_definition_owner_code VARCHAR2(1);
206801 --
206802 -- adr variables
206803 l_segment VARCHAR2(30);
206804 l_ccid NUMBER;
206805 l_adr_transaction_coa_id NUMBER;
206806 l_adr_accounting_coa_id NUMBER;
206807 l_adr_flexfield_segment_code VARCHAR2(30);
206808 l_adr_flex_value_set_id NUMBER;
206809 l_adr_value_type_code VARCHAR2(30);
206810 l_adr_value_combination_id NUMBER;
206811 l_adr_value_segment_code VARCHAR2(30);
206812
206813 l_bflow_method_code VARCHAR2(30); -- 4219869 Business Flow
206814 l_bflow_class_code VARCHAR2(30); -- 4219869 Business Flow
206815 l_inherit_desc_flag VARCHAR2(1); -- 4219869 Business Flow
206816 l_budgetary_control_flag VARCHAR2(1); -- 4458381 Public Sector Enh
206817
206818 -- 4262811 Variables ------------------------------------------------------------------------------------------
206819 l_entered_amt_idx NUMBER;
206823 l_tmp_amt NUMBER;
206820 l_accted_amt_idx NUMBER;
206821 l_acc_rev_flag VARCHAR2(1);
206822 l_accrual_line_num NUMBER;
206824 l_acc_rev_natural_side_code VARCHAR2(1);
206825
206826 l_num_entries NUMBER;
206827 l_gl_dates xla_ae_journal_entry_pkg.t_array_date;
206828 l_accted_amts xla_ae_journal_entry_pkg.t_array_num;
206829 l_entered_amts xla_ae_journal_entry_pkg.t_array_num;
206830 l_period_names xla_ae_journal_entry_pkg.t_array_V15L;
206831 l_recog_line_1 NUMBER;
206832 l_recog_line_2 NUMBER;
206833
206834 l_bflow_applied_to_amt_idx NUMBER; -- 5132302
206835 l_bflow_applied_to_amt NUMBER; -- 5132302
206836 l_bflow_applied_to_amts xla_ae_journal_entry_pkg.t_array_num; -- 5132302
206837
206838 l_event_id NUMBER; -- To handle MPA header Description: xla_ae_header_pkg.SetHdrDescription
206839
206840 --l_rounding_ccy VARCHAR2(15); -- To handle MPA rounding 4262811b
206841 l_same_currency BOOLEAN; -- To handle MPA rounding 4262811b
206842
206843 ---------------------------------------------------------------------------------------------------------------
206844
206845
206846 --
206847 -- bulk performance
206848 --
206849 l_balance_type_code VARCHAR2(1);
206850 l_rec_acct_attrs XLA_AE_LINES_PKG.t_rec_acct_attrs;
206851 l_log_module VARCHAR2(240);
206852
206853 --
206854 -- Upgrade strategy
206855 --
206856 l_actual_upg_option VARCHAR2(1);
206857 l_enc_upg_option VARCHAR2(1);
206858
206859 --
206860 BEGIN
206861 --
206862 IF g_log_enabled THEN
206863 l_log_module := C_DEFAULT_MODULE||'.AcctLineType_466';
206864 END IF;
206865 --
206866 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
206867
206868 trace
206869 (p_msg => 'BEGIN of AcctLineType_466'
206870 ,p_level => C_LEVEL_PROCEDURE
206871 ,p_module => l_log_module);
206872
206873 END IF;
206874 --
206875 l_component_type := 'AMB_JLT';
206876 l_component_code := 'IAC_INTERCOMPANY_AP';
206877 l_component_type_code := 'S';
206878 l_component_appl_id := 140;
206879 l_amb_context_code := 'DEFAULT';
206880 l_entity_code := 'TRANSACTIONS';
206881 l_event_class_code := 'RETIREMENTS';
206882 l_event_type_code := 'REINSTATEMENTS';
206883 l_line_definition_owner_code := 'S';
206884 l_line_definition_code := 'IAC_STANDARD_ACCOUNTING';
206885 --
206886 l_balance_type_code := 'A';
206887 l_segment := NULL;
206888 l_ccid := NULL;
206889 l_adr_transaction_coa_id := NULL;
206890 l_adr_accounting_coa_id := NULL;
206891 l_adr_flexfield_segment_code := NULL;
206892 l_adr_flex_value_set_id := NULL;
206893 l_adr_value_type_code := NULL;
206894 l_adr_value_combination_id := NULL;
206895 l_adr_value_segment_code := NULL;
206896
206897 l_bflow_method_code := 'NONE'; -- 4219869 Business Flow
206898 l_bflow_class_code := ''; -- 4219869 Business Flow
206899 l_inherit_desc_flag := 'N'; -- 4219869 Business Flow
206900 l_budgetary_control_flag := 'N';
206901
206902 l_bflow_applied_to_amt_idx := NULL; -- 5132302
206903 l_bflow_applied_to_amt := NULL; -- 5132302
206904 l_entered_amt_idx := NULL; -- 4262811
206905 l_accted_amt_idx := NULL; -- 4262811
206906 l_acc_rev_flag := NULL; -- 4262811
206907 l_accrual_line_num := NULL; -- 4262811
206908 l_tmp_amt := NULL; -- 4262811
206909 --
206910
206911 IF XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id = XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.ledger_id OR
206912 l_balance_type_code <> 'B' THEN
206913 IF NVL(p_source_64,'
206914 ') = 'INTERCO AP'
206915 THEN
206916
206917 --
206918 XLA_AE_LINES_PKG.SetNewLine;
206919
206920 p_balance_type_code := l_balance_type_code;
206921 -- set the flag so later we will know whether the gain loss line needs to be created
206922
206923 IF(l_balance_type_code = 'A' and p_actual_flag is null) THEN
206924 p_actual_flag :='A';
206925 END IF;
206926
206927 --
206928 -- bulk performance
206929 --
206930 XLA_AE_LINES_PKG.set_ae_header_id (p_ae_header_id => p_event_id ,
206931 p_header_num => 0); -- 4262811
206932 --
206933 -- set accounting line options
206934 --
206935 l_ae_header_id:= xla_ae_lines_pkg.SetAcctLineOption(
206936 p_natural_side_code => 'C'
206937 , p_gain_or_loss_flag => 'N'
206938 , p_gl_transfer_mode_code => 'S'
206939 , p_acct_entry_type_code => 'A'
206940 , p_switch_side_flag => 'Y'
206941 , p_merge_duplicate_code => 'N'
206942 );
206943 --
206944 l_acc_rev_natural_side_code := 'D'; -- 4262811
206945 --
206946 --
206947 -- set accounting line type info
206948 --
206949 xla_ae_lines_pkg.SetAcctLineType
206950 (p_component_type => l_component_type
206951 ,p_event_type_code => l_event_type_code
206955 ,p_accounting_line_type_code => l_component_type_code
206952 ,p_line_definition_owner_code => l_line_definition_owner_code
206953 ,p_line_definition_code => l_line_definition_code
206954 ,p_accounting_line_code => l_component_code
206956 ,p_accounting_line_appl_id => l_component_appl_id
206957 ,p_amb_context_code => l_amb_context_code
206958 ,p_entity_code => l_entity_code
206959 ,p_event_class_code => l_event_class_code);
206960 --
206961 -- set accounting class
206962 --
206963 xla_ae_lines_pkg.SetAcctClass(
206964 p_accounting_class_code => 'LIABILITY'
206965 , p_ae_header_id => l_ae_header_id
206966 );
206967
206968 --
206969 -- set rounding class
206970 --
206971 XLA_AE_LINES_PKG.g_rec_lines.array_rounding_class(XLA_AE_LINES_PKG.g_LineNumber) :=
206972 'LIABILITY';
206973
206974 --
206975 xla_ae_lines_pkg.g_rec_lines.array_calculate_acctd_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_acctd_flag;
206976 xla_ae_lines_pkg.g_rec_lines.array_calculate_g_l_flag(xla_ae_lines_pkg.g_LineNumber) := p_calculate_g_l_flag;
206977 --
206978 -- bulk performance
206979 --
206980 XLA_AE_LINES_PKG.g_rec_lines.array_balance_type_code(XLA_AE_LINES_PKG.g_LineNumber) := l_balance_type_code;
206981
206982 XLA_AE_LINES_PKG.g_rec_lines.array_ledger_id(XLA_AE_LINES_PKG.g_LineNumber) :=
206983 XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id;
206984
206985 -- 4955764
206986 XLA_AE_LINES_PKG.g_rec_lines.array_gl_date(XLA_AE_LINES_PKG.g_LineNumber) :=
206987 XLA_AE_HEADER_PKG.g_rec_header_new.array_gl_date(g_array_event(p_event_id).array_value_num('header_index'));
206988
206989 -- 4458381 Public Sector Enh
206990
206991 --
206992 -- set accounting attributes for the line type
206993 --
206994 l_entered_amt_idx := 4;
206995 l_accted_amt_idx := 6;
206996 l_bflow_applied_to_amt_idx := NULL; -- 5132302
206997 l_rec_acct_attrs.array_acct_attr_code(1) := 'DISTRIBUTION_IDENTIFIER_1';
206998 l_rec_acct_attrs.array_num_value(1) := to_char(p_source_49);
206999 l_rec_acct_attrs.array_acct_attr_code(2) := 'DISTRIBUTION_IDENTIFIER_2';
207000 l_rec_acct_attrs.array_num_value(2) := to_char(p_source_50);
207001 l_rec_acct_attrs.array_acct_attr_code(3) := 'DISTRIBUTION_TYPE';
207002 l_rec_acct_attrs.array_char_value(3) := p_source_51;
207003 l_rec_acct_attrs.array_acct_attr_code(4) := 'ENTERED_CURRENCY_AMOUNT';
207004 l_rec_acct_attrs.array_num_value(4) := p_source_65;
207005 l_rec_acct_attrs.array_acct_attr_code(5) := 'ENTERED_CURRENCY_CODE';
207006 l_rec_acct_attrs.array_char_value(5) := p_source_66;
207007 l_rec_acct_attrs.array_acct_attr_code(6) := 'LEDGER_AMOUNT';
207008 l_rec_acct_attrs.array_num_value(6) := p_source_65;
207009
207010 XLA_AE_LINES_PKG.SetLineAcctAttrs(l_rec_acct_attrs);
207011 p_gain_or_loss_ref := XLA_AE_LINES_PKG.g_rec_lines.array_gain_or_loss_ref(XLA_AE_LINES_PKG.g_LineNumber);
207012
207013 ---------------------------------------------------------------------------------------------------------------
207014 -- 4336173 -- assign Business Flow Class (replace code in xla_ae_lines_pkg.Business_Flow_Validation)
207015 ---------------------------------------------------------------------------------------------------------------
207016 XLA_AE_LINES_PKG.g_rec_lines.array_business_class_code(XLA_AE_LINES_PKG.g_LineNumber) := l_bflow_class_code;
207017
207018 l_actual_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_actual_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
207019 l_enc_upg_option := XLA_AE_LINES_PKG.g_rec_lines.array_enc_upg_option(XLA_AE_LINES_PKG.g_LineNumber);
207020
207021 IF xla_accounting_cache_pkg.GetValueChar
207022 (p_source_code => 'LEDGER_CATEGORY_CODE'
207023 ,p_target_ledger_id => XLA_AE_JOURNAL_ENTRY_PKG.g_cache_event.target_ledger_id) IN ('PRIMARY','ALC')
207024 AND l_bflow_method_code = 'PRIOR_ENTRY'
207025 -- AND (l_actual_upg_option = 'Y' OR l_enc_upg_option = 'Y') Bug 4922099
207026 AND ( (NVL(l_actual_upg_option, 'N') IN ('Y', 'O')) OR
207027 (NVL(l_enc_upg_option, 'N') IN ('Y', 'O'))
207028 )
207029 THEN
207030 xla_ae_lines_pkg.BflowUpgEntry
207031 (p_business_method_code => l_bflow_method_code
207032 ,p_business_class_code => l_bflow_class_code
207033 ,p_balance_type => l_balance_type_code);
207034 ELSE
207035 NULL;
207036 -- No business flow processing for business flow method of NONE.
207037 END IF;
207038
207039 --
207040 -- call analytical criteria
207041 --
207042
207043 --
207044 -- call description
207045 --
207046
207047 xla_ae_lines_pkg.SetLineDescription(
207048 p_ae_header_id => l_ae_header_id
207049 ,p_description => Description_143 (
207050 p_application_id => p_application_id
207051 , p_ae_header_id => l_ae_header_id
207052 , p_source_2 => p_source_2
207053 , p_source_3 => p_source_3
207054 )
207055 );
207056
207057
207058 --
207059 -- call ADRs
207060 -- Bug 4922099
207061 --
207062 IF ( (l_bflow_method_code <> 'PRIOR_ENTRY') OR
207063 (NVL(l_actual_upg_option, 'N') = 'O') OR
207064 (NVL(l_enc_upg_option, 'N') = 'O')
207065 )
207066 THEN
207067 NULL;
207068 --
207069 --
207070
207071 l_ccid := AcctDerRule_187(
207075 , x_transaction_coa_id => l_adr_transaction_coa_id
207072 p_application_id => p_application_id
207073 , p_ae_header_id => l_ae_header_id
207074 , p_source_42 => p_source_42
207076 , x_accounting_coa_id => l_adr_accounting_coa_id
207077 , x_value_type_code => l_adr_value_type_code
207078 , p_side => 'NA'
207079 );
207080
207081 xla_ae_lines_pkg.set_ccid(
207082 p_code_combination_id => l_ccid
207083 , p_value_type_code => l_adr_value_type_code
207084 , p_transaction_coa_id => l_adr_transaction_coa_id
207085 , p_accounting_coa_id => l_adr_accounting_coa_id
207086 , p_adr_code => 'IAC_INTERCOMPANY_AP_AC'
207087 , p_adr_type_code => 'S'
207088 , p_component_type => l_component_type
207089 , p_component_code => l_component_code
207090 , p_component_type_code => l_component_type_code
207091 , p_component_appl_id => l_component_appl_id
207092 , p_amb_context_code => l_amb_context_code
207093 , p_side => 'NA'
207094 );
207095
207096
207097 --
207098 --
207099 END IF;
207100 --
207101 -- Bug 4922099
207102 IF ( ( (NVL(l_actual_upg_option, 'N') = 'O') OR
207103 (NVL(l_enc_upg_option, 'N') = 'O')
207104 ) AND
207105 (l_bflow_method_code = 'PRIOR_ENTRY')
207106 )
207107 THEN
207108 IF
207109 --
207110 1 = 2
207111 --
207112 THEN
207113 xla_accounting_err_pkg.build_message
207114 (p_appli_s_name => 'XLA'
207115 ,p_msg_name => 'XLA_UPG_OVERRIDE_ADR_UNDEFINED'
207116 ,p_token_1 => 'LINE_NUMBER'
207117 ,p_value_1 => XLA_AE_LINES_PKG.g_LineNumber
207118 ,p_token_2 => 'LINE_TYPE_NAME'
207119 ,p_value_2 =>