[Home] [Help]
PACKAGE BODY: APPS.XLA_PERIOD_CLOSE_EXP_PKG
Source
1 PACKAGE BODY XLA_PERIOD_CLOSE_EXP_PKG AS
2 -- $Header: xlarppcl.pkb 120.44.12020000.2 2012/07/23 07:08:17 vgopiset ship $
3 /*===========================================================================+
4 | Copyright (c) 2003 Oracle Corporation Belmont, California, USA |
5 | ALL rights reserved. |
6 +============================================================================+
7 | FILENAME |
8 | xlarppcl.pkb |
9 | |
10 | PACKAGE NAME |
11 | xla_period_close_exp_pkg |
12 | |
13 | DESCRIPTION |
14 | This package generates an XML extract for the Period Close Validation |
15 | program unit. A dynamic query is created based on the parameters that are |
16 | input and the data template is used to generate XML. The extract is |
17 | called either when the user submits a concurrent request or when a General |
18 | Ledger Period is closed. |
19 | |
20 | HISTORY |
21 | 26/07/2005 VS Koushik Created |
22 | 15/02/2006 VamsiKrishna Kasina Changed the package to use |
23 | Data Template. |
24 | 7/12/2007 ssawhney 6613827, perf fix changed NOT IN |
25 | to IN in C_EVENTS_WO_AAD |
26 | 7/2/2008 vkasina removed the event_date filter in |
27 | C_EVENTS_WO_AAD |
28 | 08/02/2008 sasingha bug 6805286: |
29 | STAMP_EVENTS_WO_AAD is more needed|
30 | and call to it are removed. |
31 | 24/04/2008 schodava bug 6981926: |
32 | Perf fix, added hint of index in |
33 | procedure get_transaction_id |
34 | 08/03/2011 vgopiset bug11824686 Report errors with SQL Expression |
35 | error for Trx Identifiers sql when there are NO |
36 | Trx Identifiers defined or the Trx View defined |
37 | is SYNONYM in APPS with base object in non-APPS. |
38 | 08/05/2012 sragadde bug14042966 get_transaction_id synonym case |
39 | corrected the code change for bug11824686 |
40 +===========================================================================*/
41
42 TYPE t_rec IS RECORD
43 (f1 VARCHAR2(80)
44 ,f2 VARCHAR2(80));
45 TYPE t_array IS TABLE OF t_rec INDEX BY BINARY_INTEGER;
46
47 --=============================================================================
48 -- *********** Local Trace Routine **********
49 --=============================================================================
50 C_LEVEL_STATEMENT CONSTANT NUMBER := FND_LOG.LEVEL_STATEMENT;
51 C_LEVEL_PROCEDURE CONSTANT NUMBER := FND_LOG.LEVEL_PROCEDURE;
52 C_LEVEL_EVENT CONSTANT NUMBER := FND_LOG.LEVEL_EVENT;
53 C_LEVEL_EXCEPTION CONSTANT NUMBER := FND_LOG.LEVEL_EXCEPTION;
54 C_LEVEL_ERROR CONSTANT NUMBER := FND_LOG.LEVEL_ERROR;
55 C_LEVEL_UNEXPECTED CONSTANT NUMBER := FND_LOG.LEVEL_UNEXPECTED;
56 C_LEVEL_LOG_DISABLED CONSTANT NUMBER := 99;
57 C_DEFAULT_MODULE CONSTANT VARCHAR2(240)
58 := 'xla.plsql.xla_period_close_exp_pkg';
59
60 g_log_level NUMBER;
61 g_log_enabled BOOLEAN;
62 g_use_ledger_security VARCHAR2(1) :=
63 nvl(fnd_profile.value('XLA_USE_LEDGER_SECURITY'), 'N');
64 g_access_set_id PLS_INTEGER := fnd_profile.value('GL_ACCESS_SET_ID');
65 g_sec_access_set_id PLS_INTEGER :=
66 fnd_profile.value('XLA_GL_SECONDARY_ACCESS_SET_ID');
67
68 PROCEDURE param_list_sql
69 (p_application_id IN NUMBER
70 ,p_ledger_id IN NUMBER
71 ,p_object_type_code OUT NOCOPY VARCHAR2
72 ,p_je_source_name OUT NOCOPY VARCHAR2);
73
74 PROCEDURE build_query_sql
75 (p_application_id IN NUMBER
76 ,p_ledger_id IN NUMBER
77 ,p_period_from IN VARCHAR2
78 ,p_period_to IN VARCHAR2
79 ,p_event_class IN VARCHAR2
80 ,p_je_category IN VARCHAR2
81 ,p_object_type_code IN VARCHAR2
82 ,p_je_source_name IN VARCHAR2
83 ,p_mode IN VARCHAR2);
84
85 PROCEDURE trace
86 (p_msg IN VARCHAR2
87 ,p_level IN NUMBER
88 ,p_module IN VARCHAR2) IS
89 BEGIN
90 IF (p_msg IS NULL AND p_level >= g_log_level) THEN
91 fnd_log.message(p_level, NVL(p_module,C_DEFAULT_MODULE));
92 ELSIF p_level >= g_log_level THEN
93 fnd_log.string(p_level, NVL(p_module,C_DEFAULT_MODULE), p_msg);
94 END IF;
95
96 EXCEPTION
97 WHEN xla_exceptions_pkg.application_exception THEN
98 RAISE;
99 WHEN OTHERS THEN
100 xla_exceptions_pkg.raise_message
101 (p_location => 'xla_period_close_exp_pkg.trace');
102 END trace;
103
104 --=============================================================================
105 -- *********** public procedures and functions **********
106 --=============================================================================
107 -- 1. run_report
108 --=============================================================================
109 PROCEDURE RUN_REPORT
110 (p_errbuf OUT NOCOPY VARCHAR2
111 ,p_retcode OUT NOCOPY NUMBER
112 ,p_application_id IN NUMBER
113 ,p_ledger_id IN NUMBER
114 ,p_period_from IN VARCHAR2
115 ,p_period_to IN VARCHAR2
116 ,p_event_class IN VARCHAR2
117 ,p_je_category IN VARCHAR2
118 ,p_mode IN VARCHAR2) IS
119
120 l_log_module VARCHAR2(240);
121
122 l_object_type_code gl_ledgers.object_type_code%TYPE;
123 l_je_source_name gl_je_sources.je_source_name%TYPE;
124
125 BEGIN
126 IF g_log_enabled THEN
127 l_log_module := C_DEFAULT_MODULE||'.run_report';
128 END IF;
129
130 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
131 trace('run_report.Begin',C_LEVEL_PROCEDURE,l_log_module);
132 END IF;
133
134 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
135 trace('p_application_id = '|| to_char(p_application_id),
136 C_LEVEL_STATEMENT, l_log_module);
137 trace('p_ledger_id = '|| to_char(p_ledger_id),
138 C_LEVEL_STATEMENT, l_log_module);
139 trace('p_period_from = '|| p_period_from,
140 C_LEVEL_STATEMENT,l_log_module);
141 trace('p_period_to = '|| p_period_to,
142 C_LEVEL_STATEMENT, l_log_module);
143 trace('p_mode = '|| p_mode,
144 C_LEVEL_STATEMENT, l_log_module);
145 trace('p_event_class = '|| p_event_class,
146 C_LEVEL_STATEMENT, l_log_module);
147 trace('p_je_category = '|| p_je_category,
148 C_LEVEL_STATEMENT, l_log_module);
149 END IF;
150
151 ----------------------------------------------------------------------------
152 -- Following sets the Security Context for the execution. This enables the
153 -- event API to respect the transaction security implementation
154 ----------------------------------------------------------------------------
155
156 IF p_application_id = 101 THEN
157 xla_security_pkg.set_security_context(602);
158 ELSE
159 xla_security_pkg.set_security_context(p_application_id);
160 END IF;
161
162 param_list_sql
163 (p_application_id => p_application_id
164 ,p_ledger_id => p_ledger_id
165 ,p_object_type_code => l_object_type_code
166 ,p_je_source_name => l_je_source_name);
167
168 build_query_sql
169 (p_application_id => p_application_id
170 ,p_ledger_id => p_ledger_id
171 ,p_period_from => p_period_from
172 ,p_period_to => p_period_to
173 ,p_event_class => p_event_class
174 ,p_je_category => p_je_category
175 ,p_object_type_code => l_object_type_code
176 ,p_je_source_name => l_je_source_name
177 ,p_mode => p_mode);
178
179 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
180 trace('run_report.End',C_LEVEL_PROCEDURE,l_Log_module);
181 END IF;
182 EXCEPTION
183 WHEN OTHERS THEN
184
185 xla_exceptions_pkg.raise_message
186 (p_location => 'xla_period_close_exp_pkg.run_report ');
187 END run_report;
188
189
190 --------------------------------------------------------------------
191 -- The following is procedure is actually no more needed and
192 -- can be removed.
193 -- There is no call to this procedure and this change is
194 -- made as part of bug fix 6805286
195 --------------------------------------------------------------------
196 PROCEDURE stamp_events_wo_aad
197 (p_application_id IN NUMBER
198 ,p_ledger_id IN VARCHAR2 -- 4949921
199 ,p_start_date IN DATE
200 ,p_end_date IN DATE) IS
201
202 l_set NUMBER;
203 l_return_status VARCHAR2(10);
204 l_log_module VARCHAR2(240);
205 l_stamp_query VARCHAR2(32000);
206 l_percl_query VARCHAR2(10000);
207 l_filters VARCHAR2(1000);
208 l_application_id xla_events.application_id%TYPE;
209
210 C_EVENTS_WO_AAD CONSTANT VARCHAR2(10000) :=
211 ' UPDATE xla_events xle
212 SET xle.event_status_code = ''P''
213 ,xle.process_status_code = ''P''
214 ,xle.last_update_date = sysdate
215 ,xle.last_updated_by = fnd_global.user_id
216 ,xle.last_update_login = fnd_global.login_id
217 ,xle.program_id = fnd_global.conc_program_id
218 ,xle.request_id = nvl(fnd_global.conc_request_id,0)
219 ,xle.program_application_id = fnd_global.prog_appl_id
220 WHERE event_type_code NOT IN (''MANUAL'',''REVERSAL'') --FSAH-PSFT FP
221 AND event_type_code in
222 (SELECT xetb.event_type_code
223 FROM gl_ledgers glg,
224 xla_acctg_methods_b xam,
225 xla_acctg_method_rules xamr,
226 xla_prod_acct_headers xpah,
227 xla_event_types_b xetb
228 WHERE glg.sla_accounting_method_code = xam.accounting_method_code
229 AND glg.sla_accounting_method_type = xam.accounting_method_type_code
230 AND xam.accounting_method_code = xamr.accounting_method_code
231 AND xam.accounting_method_type_code =
232 xamr.accounting_method_type_code
233 AND xamr.application_id = xle.application_id
234 AND xetb.application_id = xpah.application_id
235 AND xetb.entity_code = xpah.entity_code
236 AND xetb.event_class_code = xpah.event_class_code
237 AND (substr(xpah.event_type_code,-4) = ''_ALL''
238 OR xetb.event_type_code = xpah.event_type_code)
239 AND (NVL(xam.enabled_flag,''N'') <> ''Y''
240 -- OR xle.event_date < xamr.start_date_active
241 -- OR xle.event_date > xamr.end_date_active
242 OR NVL(xpah.accounting_required_flag,''N'') <> ''Y'')
243 AND xpah.application_id = xamr.application_id
244 AND xpah.product_rule_type_code = xamr.product_rule_type_code
245 AND xpah.product_rule_code = xamr.product_rule_code
246 AND xpah.amb_context_code = xamr.amb_context_code
247 AND xpah.amb_context_code =
248 NVL(xla_profiles_pkg.get_value(''XLA_AMB_CONTEXT''),''DEFAULT'')
249 AND glg.ledger_id IN ($ledger_ids$))
250 AND xle.event_status_code IN ( ''U'',''I'')
251 AND xle.process_status_code IN (''I'',''U'',''R'',''D'',''E'')
252 AND $filters$';
253 -- For 6613827 changed the NOT IN from P,N to IN U and I.
254 -- For 6784591 added process_status_code filter.
255
256 BEGIN
257
258 IF g_log_enabled THEN
259 l_log_module := C_DEFAULT_MODULE||'.stamp_events_wo_aad';
260 END IF;
261
262 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
263 trace
264 ( p_msg => 'BEGIN of procedure stamp_events_wo_aad'
265 ,p_level => C_LEVEL_PROCEDURE
266 ,p_module => l_log_module);
267 END IF;
268
269 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
270 trace('p_application_id = ' ||
271 to_char(p_application_id), C_LEVEL_STATEMENT, l_log_module);
272 trace('p_ledger_id = '||
273 p_ledger_id, C_LEVEL_STATEMENT, l_log_module);
274 trace('p_start_date = '||
275 to_char(p_start_date,'DD-MON-YYYY'), C_LEVEL_STATEMENT, l_log_module);
276 trace('p_end_date = '||
277 to_char(p_end_date,'DD-MON-YYYY'), C_LEVEL_STATEMENT, l_log_module);
278 END IF;
279
280 l_percl_query := C_EVENTS_WO_AAD;
281
282 l_filters := 'xle.event_date between '''|| p_start_date ||''' and '''
283 || p_end_date||'''';
284
285 IF p_application_id <> 101 then
286 l_filters := l_filters || ' AND xle.application_id = '
287 || p_application_id;
288 END IF;
289
290 l_percl_query := REPLACE(l_percl_query, '$ledger_ids$',p_ledger_id);
291 l_percl_query := REPLACE(l_percl_query, '$filters$', l_filters);
292
293 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
294 trace
295 ( p_msg => 'l_percl_query'||l_percl_query
296 ,p_level => C_LEVEL_PROCEDURE
297 ,p_module => l_log_module);
298 END IF;
299
300 EXECUTE IMMEDIATE l_percl_query;
301
302 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
303 trace
304 ( p_msg => 'Number of events updated'||SQL%ROWCOUNT
305 ,p_level => C_LEVEL_PROCEDURE
306 ,p_module => l_log_module);
307 END IF;
308
309 EXCEPTION
310 WHEN NO_DATA_FOUND THEN
311 NULL;
312 WHEN xla_exceptions_pkg.application_exception THEN
313 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
314 trace( p_msg => 'End of procedure stamp_events_wo_aad'
315 ,p_level => C_LEVEL_PROCEDURE
316 ,p_module => l_log_module);
317 END IF;
318 RAISE;
319 END stamp_events_wo_aad;
320
321
322
323 PROCEDURE param_list_sql
324 (p_application_id IN NUMBER
325 ,p_ledger_id IN NUMBER
326 ,p_object_type_code OUT NOCOPY VARCHAR2
327 ,p_je_source_name OUT NOCOPY VARCHAR2) IS
328
329 l_log_module VARCHAR2(240);
330 BEGIN
331
332 IF g_log_enabled THEN
333 l_log_module := C_DEFAULT_MODULE||'.param_list_sql';
334 END IF;
335 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
336 trace('param_list_sql.Begin',C_LEVEL_PROCEDURE,l_Log_module);
337 END IF;
338
339 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
340 trace('p_application_id = '|| to_char(p_application_id),
341 C_LEVEL_STATEMENT,l_log_module);
342 trace('p_ledger_id = '|| to_char(p_ledger_id),
343 C_LEVEL_STATEMENT,l_log_module);
344 END IF;
345
346 --
347 -- Getting Translated value for all ID and codes
348 --
349
350 p_object_type_code := xla_report_utility_pkg.
351 get_ledger_object_type(p_ledger_id);
352
353 IF p_application_id = 101 THEN
354 p_je_source_name := NULL;
355 ELSE
356 SELECT gjst.je_source_name
357 INTO p_je_source_name
358 FROM xla_subledgers xls, gl_je_sources_tl gjst
359 WHERE xls.application_id = p_application_id
360 AND xls.je_source_name = gjst.je_source_name
361 AND gjst.language = USERENV('LANG');
362 END IF;
363
364 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
365 trace('p_object_type_code = '|| p_object_type_code,
366 C_LEVEL_STATEMENT,l_log_module);
367 trace('p_je_source_name = '|| p_je_source_name,
368 C_LEVEL_STATEMENT,l_log_module);
369 END IF;
370
371
372 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
373 trace('param_list_sql.End',C_LEVEL_PROCEDURE,l_Log_module);
374 END IF;
375
376 EXCEPTION
377 WHEN OTHERS THEN
378 -- trace mesg
379 xla_exceptions_pkg.raise_message
380 (p_location => 'xla_period_close_exp_pkg.param_list_sql');
381 END param_list_sql;
382
383 PROCEDURE get_period_start_end_dates
384 ( p_ledger_id IN NUMBER
385 ,p_period_from IN VARCHAR2
386 ,p_period_to IN VARCHAR2
387 ,p_start_date OUT NOCOPY DATE
388 ,p_end_date OUT NOCOPY DATE ) IS
389
390 l_log_module VARCHAR2(240);
391 gl_appl_id NUMBER := 101;
392
393 BEGIN
394
395 IF g_log_enabled THEN
396 l_log_module := C_DEFAULT_MODULE||'.get_period_start_end_dates';
397 END IF;
398
399 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
400 trace('get_period_start_end_dates.Begin'
401 ,C_LEVEL_PROCEDURE, l_log_module);
402 END IF;
403
404 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
405 trace('p_ledger_id = '|| to_char(p_ledger_id),
406 C_LEVEL_STATEMENT,l_log_module);
407 trace('p_period_from = '|| p_period_from,
408 C_LEVEL_STATEMENT,l_log_module);
409 trace('p_period_to = '|| p_period_to,
410 C_LEVEL_STATEMENT,l_log_module);
411 END IF;
412
413 SELECT start_date, end_date
414 INTO p_start_date, p_end_date
415 FROM gl_period_statuses glp
416 WHERE glp.period_name = p_period_from
417 AND glp.ledger_id = p_ledger_id
418 AND glp.adjustment_period_flag = 'N'
419 AND glp.application_id = gl_appl_id ;
420
421 IF p_period_from <> p_period_to THEN
422 SELECT end_date
423 INTO p_end_date
424 FROM gl_period_statuses glp
425 WHERE glp.period_name = p_period_to
426 AND glp.ledger_id = p_ledger_id
427 AND glp.adjustment_period_flag = 'N'
428 AND glp.application_id = gl_appl_id ;
429 END IF;
430
431 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
432 trace('get_period_start_end_dates.End'
433 ,C_LEVEL_PROCEDURE, l_log_module);
434 END IF;
435
436 EXCEPTION
437 WHEN OTHERS THEN
438 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
439 trace('get_period_start_end_dates.End with Error'
440 ,C_LEVEL_PROCEDURE, l_log_module);
441 END IF;
442 xla_exceptions_pkg.raise_message
443 (p_location =>
444 'xla_period_close_exp_pkg.get_period_start_end_dates');
445 END get_period_start_end_dates ;
446
447
448 PROCEDURE build_xml_sql IS
449 l_log_module VARCHAR2(240);
450 BEGIN
451
452 IF g_log_enabled THEN
453 l_log_module := C_DEFAULT_MODULE||'.build_xml_sql';
454 END IF;
455
456 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
457 trace('build_xml_sql.Begin'
458 ,C_LEVEL_PROCEDURE, l_log_module);
459 END IF;
460
461 C_EVENTS_COLS_QUERY :=
462 ' SELECT ent.ledger_id LEDGER_ID
463 ,gld.short_name LEDGER_SHORT_NAME
464 ,gld.name LEDGER_NAME
465 ,gld.description LEDGER_DESCRIPTION
466 ,gld.currency_code LEDGER_CURRENCY
467 ,gps.period_year PERIOD_YEAR
468 ,gps.period_num PERIOD_NUMBER
469 ,gps.period_name PERIOD_NAME
470 ,xle.application_id APPLICATION_ID
471 ,gjt.je_source_name JOURNAL_SOURCE
472 ,gjt.user_je_source_name USER_JE_SOURCE
473 ,xcl.event_class_code EVENT_CLASS_CODE
474 ,xcl.name EVENT_CLASS_NAME
475 ,gjct.je_category_name JOURNAL_CATEGORY_NAME
476 ,gjct.user_je_category_name USER_JE_CATEGORY_NAME
477 ,to_char(xle.event_date,''YYYY-MM-DD'') EVENT_DATE
478 ,xle.event_id EVENT_ID
479 ,xle.event_number EVENT_NUMBER
480 ,fnu.user_id CREATED_BY
481 ,fnu.user_name USER_NAME
482 ,to_char(xle.last_update_date,''YYYY-MM-DD'') LAST_UPDATE_DATE
483 ,to_char(xle.creation_date,''YYYY-MM-DD'') CREATION_DATE
484 ,ent.transaction_number TRANSACTION_NUMBER
485 ,to_char(xle.transaction_date,''YYYY-MM-DD'') TRANSACTION_DATE
486 ,xle.on_hold_flag ON_HOLD_FLAG
487 ,xlo2.meaning ON_HOLD
488 ,xtt.event_type_code EVENT_TYPE_CODE
489 ,xtt.name EVENT_TYPE_NAME
490 ,NULL BALANCE_TYPE_CODE
491 ,NULL BALANCE_TYPE
492 ,xlo1.meaning PRINT_STATUS ';
493
494 C_EVENTS_FROM_QUERY :=
495 ' FROM XLA_EVENTS XLE
496 ,XLA_TRANSACTION_ENTITIES ENT
497 ,XLA_SUBLEDGERS XLS
498 ,FND_USER FNU
499 ,GL_PERIOD_STATUSES GPS
500 ,GL_LEDGERS GLD
501 ,GL_JE_SOURCES_TL GJT
502 ,GL_JE_CATEGORIES_TL GJCT
503 ,XLA_EVENT_CLASSES_TL XCL
504 ,XLA_EVENT_TYPES_B XET
505 ,XLA_EVENT_TYPES_TL XTT
506 ,XLA_EVENT_CLASS_ATTRS XECA
507 ,XLA_LOOKUPS XLO1
508 ,XLA_LOOKUPS XLO2
509 ,XLA_LEDGER_OPTIONS XLP
510 WHERE xls.application_id = xle.application_id
511 AND xle.event_status_code IN (''I'',''U'')
512 AND xle.process_status_code IN (''U'',''D'',''E'',''R'',''I'')
513 AND xle.entity_id = ent.entity_id
514 AND ent.application_id = xle.application_id
515 AND ent.ledger_id = gps.ledger_id
516 AND gps.application_id = 101
517 AND xle.event_date BETWEEN gps.start_date AND gps.end_date
518 AND gps.adjustment_period_flag <> ''Y'' -- Added by krsankar for bug 8212297
519 AND gld.ledger_id = ent.ledger_id
520 AND gjt.je_source_name = xls.je_source_name
521 AND gjt.LANGUAGE = USERENV(''LANG'')
522 AND fnu.user_id = xle.created_by
523 AND xet.application_id = xle.application_id
524 AND xet.event_type_code = xle.event_type_code
525 AND xtt.application_id = xet.application_id
526 AND xtt.event_type_code = xet.event_type_code
527 AND xtt.event_class_code = xet.event_class_code
528 AND xtt.entity_code = xet.entity_code
529 AND xtt.LANGUAGE = USERENV(''LANG'')
530 AND xcl.application_id = xet.application_id
531 AND xcl.entity_code = xet.entity_code
532 AND xcl.event_class_code = xet.event_class_code
533 AND xcl.application_id = ent.application_id
534 AND xcl.entity_code = ent.entity_code
535 AND xcl.LANGUAGE = USERENV(''LANG'')
536 AND xeca.application_id = xcl.application_id
537 AND xeca.entity_code = xcl.entity_code
538 AND xeca.event_class_code = xcl.event_class_code
539 AND xeca.je_category_name = gjct.je_category_name
540 AND gjct.language = USERENV(''LANG'')
541 AND xlo1.lookup_type = ''XLA_EVENT_STATUS''
542 AND xlo1.lookup_code = xle.event_status_code
543 AND xlo2.lookup_type = ''XLA_YES_NO''
544 AND xlo2.lookup_code = xle.on_hold_flag
545 AND ent.ledger_id = xlp.ledger_id
546 AND ent.application_id = xlp.application_id
547 AND xlp.capture_event_flag = ''Y''
548 AND NOT EXISTS (SELECT aeh.event_id
549 FROM XLA_AE_HEADERS aeh
550 WHERE aeh.application_id = xle.application_id
551 AND aeh.event_id = xle.event_id
552 )
553 AND ent.ledger_id IN ';
554
555 C_HEADERS_COLS_QUERY :=
556 ' SELECT /*+ leading(aeh) */ aeh.ledger_id LEDGER_ID
557 ,gld.short_name LEDGER_SHORT_NAME
558 ,gld.name LEDGER_NAME
559 ,gld.description LEDGER_DESCRIPTION
560 ,gld.currency_code LEDGER_CURRENCY
561 ,gps.period_year PERIOD_YEAR
562 ,gps.period_num PERIOD_NUMBER
563 ,gps.period_name PERIOD_NAME
564 ,xle.application_id APPLICATION_ID
565 ,gjt.je_source_name JOURNAL_SOURCE
566 ,gjt.user_je_source_name USER_JE_SOURCE
567 ,xcl.event_class_code EVENT_CLASS_CODE
568 ,xcl.name EVENT_CLASS_NAME
569 ,gjct.je_category_name JOURNAL_CATEGORY_NAME
570 ,gjct.user_je_category_name USER_JE_CATEGORY_NAME
571 ,to_char(aeh.accounting_date,''YYYY-MM-DD'') EVENT_DATE
572 ,xle.event_id EVENT_ID
573 ,xle.event_number EVENT_NUMBER
574 ,fnu.user_id CREATED_BY
575 ,fnu.user_name USER_NAME
576 ,to_char(aeh.last_update_date,''YYYY-MM-DD'') LAST_UPDATE_DATE
577 ,to_char(aeh.creation_date,''YYYY-MM-DD'') CREATION_DATE
578 ,ent.transaction_number TRANSACTION_NUMBER
579 ,to_char(xle.transaction_date,''YYYY-MM-DD'') TRANSACTION_DATE
580 ,xle.on_hold_flag ON_HOLD_FLAG
581 ,xlo2.meaning ON_HOLD
582 ,xet.event_type_code EVENT_TYPE_CODE
583 ,xtt.name EVENT_TYPE_NAME
584 ,aeh.balance_type_code BALANCE_TYPE_CODE
585 ,xlo5.meaning BALANCE_TYPE
586 ,xlo4.meaning PRINT_STATUS ';
587
588 C_HEADERS_FROM_QUERY :=
589 ' FROM XLA_AE_HEADERS AEH
590 ,XLA_EVENTS XLE
591 ,XLA_TRANSACTION_ENTITIES ENT
592 ,XLA_SUBLEDGERS XLS
593 ,FND_USER FNU
594 ,GL_PERIOD_STATUSES GPS
595 ,GL_LEDGERS GLD
596 ,GL_JE_SOURCES_TL GJT
597 ,GL_JE_CATEGORIES_TL GJCT
598 ,XLA_EVENT_TYPES_B XET
599 ,XLA_EVENT_TYPES_TL XTT
600 ,XLA_EVENT_CLASSES_TL XCL
601 ,XLA_LOOKUPS XLO2
602 ,XLA_LOOKUPS XLO4
603 ,XLA_LOOKUPS XLO5
604 WHERE xls.application_id = aeh.application_id
605 AND aeh.event_id = xle.event_id
606 AND aeh.application_id = xle.application_id
607 AND xle.entity_id = ent.entity_id
608 AND xle.application_id = ent.application_id
609 AND aeh.period_name = gps.period_name
610 AND aeh.ledger_id = gps.ledger_id
611 AND gps.application_id = 101
612 AND gld.ledger_id = aeh.ledger_id
613 AND fnu.user_id = aeh.created_by
614 AND gjt.je_source_name = xls.je_source_name
615 AND gjt.LANGUAGE = USERENV(''LANG'')
616 AND xet.application_id = xle.application_id
617 AND xet.event_type_code = aeh.event_type_code
618 AND xtt.application_id = xet.application_id
619 AND xtt.event_type_code = xet.event_type_code
620 AND xtt.entity_code = xet.entity_code
621 AND xtt.event_class_code = xet.event_class_code
622 AND xtt.LANGUAGE = USERENV(''LANG'')
623 AND xcl.application_id = xtt.application_id
624 AND xcl.entity_code = xtt.entity_code
625 AND xcl.event_class_code = xtt.event_class_code
626 AND xcl.application_id = ent.application_id
627 AND xcl.entity_code = ent.entity_code
628 AND xcl.LANGUAGE = USERENV(''LANG'')
629 AND gjct.je_category_name = aeh.je_category_name
630 AND gjct.LANGUAGE = USERENV(''LANG'')
631 AND aeh.gl_transfer_status_code IN (''N'',''E'')
632 AND xlo2.lookup_type = ''XLA_YES_NO''
633 AND xlo2.lookup_code = xle.on_hold_flag
634 AND xlo4.lookup_type = ''XLA_ACCOUNTING_ENTRY_STATUS''
635 AND xlo4.lookup_code = aeh.accounting_entry_status_code
636 AND xlo5.lookup_type = ''XLA_BALANCE_TYPE''
637 AND xlo5.lookup_code = aeh.balance_type_code
638 AND aeh.ledger_id IN ';
639
640 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
641 trace('build_xml_sql.End'
642 ,C_LEVEL_PROCEDURE, l_log_module);
643 END IF;
644
645 EXCEPTION
646 WHEN OTHERS THEN
647 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
648 trace('build_xml_sql.End with Error'
649 ,C_LEVEL_PROCEDURE, l_log_module);
650 END IF;
651 xla_exceptions_pkg.raise_message
652 (p_location =>
653 'xla_period_close_exp_pkg.build_xml_sql');
654 END build_xml_sql;
655
656 --changed Function get_transaction_id returning varchar2 to a procedure preeti/6204675
657
658 procedure get_transaction_id
659 (p_ledger_ids IN VARCHAR2
660 ,p_event_filter IN VARCHAR2
661 ,p_header_filter IN VARCHAR2) IS
662
663 C_EVENTS_HEADERS_QUERY VARCHAR2(8000) :=
664 'SELECT /*+ index(ent XLA_TRANSACTION_ENTITIES_U1) */ DISTINCT
665 xle.application_id APPLICATION_ID
666 ,xcl.entity_code ENTITY_CODE
667 ,xcl.event_class_code EVENT_CLASS_CODE
668 ,gjct.reporting_view_name REPORTING_VIEW_NAME
669 FROM xla_events xle
670 ,xla_event_types_b xcl
671 ,xla_event_class_attrs gjct
672 ,xla_transaction_entities ent
673 ,xla_ledger_options xlo
674 WHERE ent.entity_id = xle.entity_id
675 AND ent.application_id = xle.application_id
676 AND ent.ledger_id = xlo.ledger_id
677 AND ent.application_id = xlo.application_id
678 AND xlo.capture_event_flag = ''Y''
679 AND xcl.application_id = xle.application_id
680 AND xcl.event_type_code = xle.event_type_code
681 AND xcl.entity_code NOT IN (''MANUAL'',''THIRD_PARTY_MERGE'',''REVERSAL'') -- FSAH-PSFT FP
682 AND gjct.application_id = xcl.application_id
683 AND gjct.entity_code = xcl.entity_code
684 AND gjct.event_class_code = xcl.event_class_code
685 AND xle.event_status_code IN (''I'',''U'')
686 AND xle.process_status_code IN (''U'',''D'',''E'',''R'',''I'')
687 AND ent.ledger_id IN $ledger_ids$
688 $event_filter$
689 UNION ALL
690 SELECT DISTINCT
691 aeh.application_id APPLICATION_ID
692 ,xcl.entity_code ENTITY_CODE
693 ,xcl.event_class_code EVENT_CLASS_CODE
694 ,gjct.reporting_view_name REPORTING_VIEW_NAME
695 FROM xla_ae_headers aeh
696 ,xla_event_types_b xcl
697 ,xla_event_class_attrs gjct
698 ,xla_transaction_entities ent
699 WHERE xcl.application_id = aeh.application_id
700 AND xcl.event_type_code = aeh.event_type_code
701 AND gjct.application_id = xcl.application_id
702 AND gjct.entity_code = xcl.entity_code
703 AND gjct.event_class_code = xcl.event_class_code
704 AND ent.entity_id = aeh.entity_id
705 AND ent.application_id = aeh.application_id
706 AND xcl.entity_code NOT IN (''MANUAL'',''THIRD_PARTY_MERGE'',''REVERSAL'') --FSAH-PSFT FP bug 6896350
707 AND aeh.gl_transfer_status_code IN (''N'',''E'') -- bug 6896350
708 AND aeh.ledger_id IN $ledger_ids$
709 $header_filter$';
710
711 cursor c1 is
712 SELECT application_id
713 ,entity_code
714 ,event_class_code
715 ,reporting_view_name
716 FROM xla_event_class_attrs;
717
718 TYPE l_event_class_tab IS TABLE of c1%ROWTYPE;
719 l_event_class_set l_event_class_tab;
720
721 l_col_array t_array;
722 l_null_col_array t_array;
723 l_trx_id_str VARCHAR2(32000):=NULL;
724 l_trx_id_str_temp VARCHAR2(32000):=NULL;
725 l_col_string VARCHAR2(10000) := NULL;
726 l_view_name VARCHAR2(800);
727 l_join_string VARCHAR2(10000) := NULL;
728 l_index INTEGER;
729 l_outerjoin VARCHAR2(300);
730 l_log_module VARCHAR2(240);
731 l_id_num number:=1;
732 BEGIN
733 IF g_log_enabled THEN
734 l_log_module := C_DEFAULT_MODULE||'.get_transaction_id';
735 END IF;
736 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
737 trace
738 (p_msg => 'BEGIN of procedure GET_TRANSACTION_ID'
739 ,p_level => C_LEVEL_PROCEDURE
740 ,p_module => l_log_module);
741 trace
742 (p_msg => 'p_ledger_ids = '||p_ledger_ids
743 ,p_level => C_LEVEL_PROCEDURE
744 ,p_module => l_log_module);
745 trace
746 (p_msg => 'p_event_filter = '||p_event_filter
747 ,p_level => C_LEVEL_PROCEDURE
748 ,p_module => l_log_module);
749 trace
750 (p_msg => 'p_header_filter = '||p_header_filter
751 ,p_level => C_LEVEL_PROCEDURE
752 ,p_module => l_log_module);
753 END IF;
754 l_trx_id_str := ',CASE WHEN 1<1 THEN NULL';
755
756 C_EVENTS_HEADERS_QUERY := replace(C_EVENTS_HEADERS_QUERY,
757 '$ledger_ids$',p_ledger_ids);
758 C_EVENTS_HEADERS_QUERY := replace(C_EVENTS_HEADERS_QUERY,
759 '$event_filter$',p_event_filter);
760 C_EVENTS_HEADERS_QUERY := replace(C_EVENTS_HEADERS_QUERY,
761 '$header_filter$',p_header_filter);
762
763 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
764 trace
765 (p_msg => 'C_EVENTS_HEADERS_QUERY = '||C_EVENTS_HEADERS_QUERY
766 ,p_level => C_LEVEL_STATEMENT
767 ,p_module => l_log_module);
768 END IF;
769
770
771 EXECUTE IMMEDIATE C_EVENTS_HEADERS_QUERY
772 BULK COLLECT INTO l_event_class_set;
773
774 IF l_event_class_set.count > 0 THEN
775 FOR k in l_event_class_set.FIRST .. l_event_class_set.LAST
776 LOOP
777
778 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
779 trace
780 (p_msg => 'inside loop count = '||k
781 ,p_level => C_LEVEL_STATEMENT
782 ,p_module => l_log_module);
783 END IF;
784
785 l_col_string := NULL;
786 l_view_name := NULL;
787 l_join_string := NULL;
788
789
790 --
791 -- creating a dummy array that contains "NULL" strings
792 --
793
794
795 FOR i IN 1..10 LOOP
796 l_null_col_array(i).f1 := 'NULL';
797 l_null_col_array(i).f2 := 'NULL';
798 END LOOP;
799 --
800 -- initiating the array that contains name of the columns to be
801 -- selected from the TID View.
802 --
803 l_col_array := l_null_col_array;
804
805 --
806 -- creating SELECT,FROM and WHERE clause strings when the reporting
807 -- view is defined for an Event Class.
808 --
809
810 IF l_event_class_set(k).reporting_view_name IS NOT NULL THEN
811 --
812 -- creating string to be added to FROM clause
813 --
814
815 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
816 trace
817 (p_msg => 'Inside when reporting view name is not null'
818 ,p_level => C_LEVEL_STATEMENT
819 ,p_module => l_log_module);
820 END IF;
821
822 l_view_name := l_event_class_set(k).reporting_view_name
823 || ' TIV';
824
825 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
826 trace
827 (p_msg => 'length of l_view_name = '||length(l_view_name)
828 ,p_level => C_LEVEL_STATEMENT
829 ,p_module => l_log_module);
830 END IF;
831 -- added outer join on event mappings to select the entity mappings so that where condition
832 -- forms successfully without throwing sql expression error for bug14042966
833 l_index := 0;
834
835 FOR cols_csr IN
836 (SELECT xid.transaction_id_col_name_1 trx_col_1
837 ,xid.transaction_id_col_name_2 trx_col_2
838 ,xid.transaction_id_col_name_3 trx_col_3
839 ,xid.transaction_id_col_name_4 trx_col_4
840 ,xid.source_id_col_name_1 src_col_1
841 ,xid.source_id_col_name_2 src_col_2
842 ,xid.source_id_col_name_3 src_col_3
843 ,xid.source_id_col_name_4 src_col_4
844 -- ,xem.column_name column_name
845 -- ,xem.column_title PROMPT
846 -- ,utc.data_type data_type
847 FROM xla_entity_id_mappings xid
848 --,xla_event_mappings_vl xem
849 -- ,user_tab_columns utc
850 WHERE xid.application_id = l_event_class_set(k).application_id
851 AND xid.entity_code = l_event_class_set(k).entity_code)
852 --AND xem.application_id(+) = xid.application_id -- l_event_class_set(k).application_id
853 -- AND xem.entity_code(+) = xid.entity_code -- l_event_class_set(k).entity_code
854 -- AND xem.event_class_code(+) = l_event_class_set(k).event_class_code
855 -- AND utc.table_name = l_event_class_set(k).reporting_view_name
856 -- AND utc.column_name = xem.column_name
857 -- ORDER BY xem.user_sequence)
858 LOOP
859
860 l_index := l_index + 1;
861 --
862 -- creating string to be added to WHERE clause
863 --
864 IF l_index = 1 THEN
865 -----------------------------------------------------------
866 -- Bug 3389175
867 -- Following logic is build to make sure all events are
868 -- reported if debug is enabled evenif there is no data for
869 -- the event in the transaction id view.
870 -- if log enabled then
871 -- outer join to TID view
872 -- endif
873 -----------------------------------------------------------
874 IF g_log_level <> C_LEVEL_LOG_DISABLED THEN
875 l_outerjoin := '(+)';
876 ELSE
877 l_outerjoin := NULL;
878 END IF;
879
880 IF cols_csr.trx_col_1 IS NOT NULL THEN
881 l_join_string := l_join_string ||
882 ' TIV.'|| cols_csr.trx_col_1 ||
883 l_outerjoin ||
884 ' = ENT.'|| cols_csr.src_col_1;
885 END IF;
886 IF cols_csr.trx_col_2 IS NOT NULL THEN
887 l_join_string := l_join_string ||
888 ' AND TIV.'|| cols_csr.trx_col_2 ||
889 l_outerjoin ||
890 ' = ENT.'|| cols_csr.src_col_2;
891 END IF;
892 IF cols_csr.trx_col_3 IS NOT NULL THEN
893 l_join_string := l_join_string ||
894 ' AND TIV.'|| cols_csr.trx_col_3 ||
895 l_outerjoin ||
896 ' = ENT.'|| cols_csr.src_col_3;
897 END IF;
898 IF cols_csr.trx_col_4 IS NOT NULL THEN
899 l_join_string := l_join_string ||
900 ' AND TIV.'|| cols_csr.trx_col_4 ||
901 l_outerjoin ||
902 ' = ENT.'|| cols_csr.src_col_4;
903 END IF;
904
905 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
906 trace
907 (p_msg => 'length of l_join_string = '||length(l_join_string)
908 ,p_level => C_LEVEL_STATEMENT
909 ,p_module => l_log_module);
910 END IF;
911
912 END IF;
913 END LOOP;
914 l_index := 0;
915 --Check if the object is synonym or not.(Added for Bug 14042966)
916 FOR cols_csr IN
917 (SELECT xem.column_name column_name
918 ,xem.column_title PROMPT
919 ,utc.data_type data_type
920 FROM (SELECT t.table_name , t.column_name ,t.data_type
921 FROM user_tab_columns t , user_objects o
922 WHERE t.table_name = o.object_name
923 AND o.object_name = l_event_class_set(k).reporting_view_name
924 AND o.object_type <> 'SYNONYM'
925 UNION ALL
926 SELECT dt.table_name, dt.column_name , dt.data_type
927 FROM dba_tab_columns dt
928 WHERE (dt.table_name , dt.owner)
929 IN ( SELECT s.table_name , s.table_owner
930 FROM user_synonyms s , user_objects o
931 WHERE 1 = 1
932 AND o.object_name = l_event_class_set(k).reporting_view_name
933 AND o.object_type = 'SYNONYM'
934 AND s.synonym_name = o.object_name ) ) utc,
935 xla_event_mappings_vl xem
936 WHERE xem.application_id = l_event_class_set(k).application_id
937 AND xem.entity_code = l_event_class_set(k).entity_code
938 AND xem.event_class_code = l_event_class_set(k).event_class_code
939 AND utc.column_name = xem.column_name
940 ORDER BY xem.user_sequence)
941 LOOP
942
943 l_index := l_index + 1;
944
945
946
947
948 IF ( cols_csr.column_name IS NOT NULL )
949 THEN
950 --
951 -- getting the PROMPTs to be displayed
952 --
953 --l_col_array(l_index).f1 := ''''||cols_csr.PROMPT||'''';
954 l_col_array(l_index).f1 := ''''||REPLACE (cols_csr.PROMPT,'''','''''')||''''; -- bug 6755287
955
956 ---
957 -- getting the columns to be displayed
958 ---
959
960 IF cols_csr.data_type = 'VARCHAR2' THEN
961 l_col_array(l_index).f2 := 'TIV.'|| cols_csr.column_name;
962 ELSE
963 l_col_array(l_index).f2 := 'to_char(TIV.'||
964 cols_csr.column_name||')';
965 END IF;
966 -- added for bug11824686 commented for bug14042966
967 -- l_col_array(l_index).f2 := 'to_char(TIV.'|| cols_csr.column_name||')' ; --bug14042966
968 END IF ;
969
970 END LOOP;
971 END IF;
972 --------------------------------------------------------------------
973 -- building the string to be added to the SELECT clause
974 --------------------------------------------------------------------
975 l_col_string := l_col_string ||
976 l_col_array(1).f1||'||''|''||'||l_col_array(1).f2;
977
978 FOR i IN 2..l_col_array.count LOOP
979 l_col_string := l_col_string ||'||''|''||'||l_col_array(i).f1
980 ||'||''|''||'||l_col_array(i).f2;
981 END LOOP;
982
983
984 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
985 trace
986 (p_msg => 'length of l_col_string = '||length(l_col_string)
987 ,p_level => C_LEVEL_STATEMENT
988 ,p_module => l_log_module);
989 END IF;
990
991 l_trx_id_str_temp := l_trx_id_str||' WHEN xet.event_class_code = '''
992 ||l_event_class_set(k).event_class_code||
993 ''' THEN ( SELECT '||l_col_string
994 ||' FROM '||l_view_name ||' WHERE '|| l_join_string
995 ||' )' ;
996 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
997 trace
998 (p_msg => 'length of l_trx_id_str_temp = '||length(l_trx_id_str_temp)
999 ,p_level => C_LEVEL_STATEMENT
1000 ,p_module => l_log_module);
1001 END IF;
1002
1003 IF length(l_trx_id_str_temp)<=25000 then
1004 l_trx_id_str := l_trx_id_str_temp;
1005
1006 ELSE
1007 IF l_id_num = 1 then
1008 p_trx_identifiers_1 := l_trx_id_str;
1009 l_trx_id_str_temp:=NULL;
1010 l_trx_id_str:=NULL;
1011 END IF;
1012 IF l_id_num = 2 then
1013 p_trx_identifiers_2 := l_trx_id_str;
1014 l_trx_id_str_temp:=NULL;
1015 l_trx_id_str:=NULL;
1016 END IF;
1017 IF l_id_num = 3 then
1018 p_trx_identifiers_3 := l_trx_id_str;
1019 l_trx_id_str_temp:=NULL;
1020 l_trx_id_str:=NULL;
1021 END IF;
1022 IF l_id_num = 4 then
1023 p_trx_identifiers_4 := l_trx_id_str;
1024 l_trx_id_str_temp:=NULL;
1025 l_trx_id_str:=NULL;
1026 END IF;
1027 IF l_id_num = 5 then
1028 p_trx_identifiers_5 := l_trx_id_str;
1029 l_trx_id_str_temp:=NULL;
1030 l_trx_id_str:=NULL;
1031 END IF;
1032 l_trx_id_str_temp := ' WHEN xet.event_class_code = '''
1033 ||l_event_class_set(k).event_class_code||
1034 ''' THEN ( SELECT '||l_col_string
1035 ||' FROM '||l_view_name ||' WHERE '|| l_join_string
1036 ||' )' ;
1037 l_trx_id_str:=l_trx_id_str_temp;
1038 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1039 trace
1040 (p_msg => 'inside length of l_trx_id_str_temp = '||length(l_trx_id_str_temp)
1041 ,p_level => C_LEVEL_STATEMENT
1042 ,p_module => l_log_module);
1043 END IF;
1044
1045 l_id_num := l_id_num + 1;
1046
1047 END IF;
1048
1049
1050
1051
1052 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1053 trace
1054 (p_msg => 'length of l_trx_id_str = '||length(l_trx_id_str)
1055 ,p_level => C_LEVEL_STATEMENT
1056 ,p_module => l_log_module);
1057 END IF;
1058
1059
1060
1061
1062 END LOOP;
1063 END IF;
1064
1065 l_trx_id_str := l_trx_id_str ||' END '||' USERIDS';
1066
1067 if l_id_num = 1 then
1068 p_trx_identifiers_1 := l_trx_id_str;
1069 elsif l_id_num = 2 then
1070 p_trx_identifiers_2 := l_trx_id_str;
1071 elsif l_id_num = 3 then
1072 p_trx_identifiers_3 := l_trx_id_str;
1073 elsif l_id_num = 4 then
1074 p_trx_identifiers_4 := l_trx_id_str;
1075 elsif l_id_num = 5 then
1076 p_trx_identifiers_5 := l_trx_id_str;
1077 end if;
1078
1079 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1080 trace('get_transaction_id .End'
1081 ,C_LEVEL_PROCEDURE, l_log_module);
1082 END IF;
1083
1084
1085 EXCEPTION
1086 WHEN OTHERS THEN
1087 xla_exceptions_pkg.raise_message
1088 (p_location => 'xla_period_close_exp_pkg.get_transaction_id ');
1089
1090 END get_transaction_id;
1091
1092
1093 FUNCTION get_ledger_ids(p_ledger_id IN NUMBER) RETURN VARCHAR2 IS
1094 CURSOR cur_primary_ledger( p_ledger_id NUMBER) IS
1095 select distinct glr1.target_ledger_id ledger_id
1096 from gl_ledger_relationships glr1
1097 ,gl_ledger_relationships glr2
1098 where glr1.source_ledger_id = glr2.source_ledger_id
1099 and glr1.application_id = glr2.application_id
1100 and glr2.target_ledger_id = p_ledger_id
1101 and glr2.application_id = 101
1102 and (g_use_ledger_security = 'N'
1103 or glr1.target_ledger_id in
1104 (select led.ledger_id
1105 from gl_ledgers led, gl_access_set_assignments aset
1106 where aset.ledger_id = led.ledger_id
1107 and aset.access_set_id in
1108 (g_access_set_id, g_sec_access_set_id)));
1109
1110 CURSOR cur_ledger ( p_ledger_id NUMBER) IS
1111 SELECT distinct glr2.target_ledger_id ledger_id
1112 FROM gl_ledger_set_assignments gla
1113 ,gl_ledger_relationships glr1
1114 ,gl_ledger_relationships glr2
1115 WHERE gla.ledger_id = glr1.target_ledger_id
1116 AND glr1.source_ledger_id = glr2.source_ledger_id
1117 and glr1.application_id = glr2.application_id
1118 AND gla.ledger_set_id = p_ledger_id
1119 AND gla.ledger_id <> gla.ledger_set_id
1120 AND glr1.application_id = 101
1121 AND (g_use_ledger_security = 'N'
1122 or glr2.target_ledger_id in
1123 (SELECT led.ledger_id
1124 FROM gl_ledgers led, gl_access_set_assignments aset
1125 WHERE aset.ledger_id = led.ledger_id
1126 AND aset.access_set_id in
1127 (g_access_set_id, g_sec_access_set_id)));
1128
1129 l_log_module VARCHAR2(240);
1130 l_ledger_ids VARCHAR2(2000);
1131 l_object_type_code VARCHAR2(1);
1132
1133 BEGIN
1134 IF g_log_enabled THEN
1135 l_log_module := C_DEFAULT_MODULE||'.get_ledger_ids';
1136 END IF;
1137
1138 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1139 trace('get_ledger_ids.Begin',C_LEVEL_PROCEDURE,l_log_module);
1140 END IF;
1141
1142 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1143 trace('p_ledger_id = '|| to_char(p_ledger_id),
1144 C_LEVEL_STATEMENT ,l_log_module);
1145 trace('g_access_set_id = '|| to_char(g_access_set_id),
1146 C_LEVEL_STATEMENT ,l_log_module);
1147 trace('g_sec_access_set_id = '|| to_char(g_sec_access_set_id),
1148 C_LEVEL_STATEMENT ,l_log_module);
1149 trace('g_use_ledger_security = '|| g_use_ledger_security,
1150 C_LEVEL_STATEMENT ,l_log_module);
1151 END IF;
1152
1153 l_object_type_code := xla_report_utility_pkg.get_ledger_object_type
1154 (p_ledger_id);
1155
1156 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1157 trace('l_object_type_code = '|| l_object_type_code,
1158 C_LEVEL_STATEMENT ,l_log_module);
1159 END IF;
1160
1161 IF l_object_type_code = 'S' THEN
1162 FOR l_set IN cur_ledger(p_ledger_id)
1163 LOOP
1164 l_ledger_ids := l_ledger_ids || l_set.ledger_id ||',';
1165 END LOOP;
1166
1167 ELSIF l_object_type_code = 'L' THEN
1168
1169 FOR l_set IN cur_primary_ledger(p_ledger_id)
1170 LOOP
1171 l_ledger_ids := l_ledger_ids || l_set.ledger_id || ',';
1172 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1173 trace('l_ledger_ids = '|| l_ledger_ids,
1174 C_LEVEL_STATEMENT ,l_log_module);
1175 trace('l_set.ledger_id = '|| to_char(l_set.ledger_id),
1176 C_LEVEL_STATEMENT ,l_log_module);
1177 END IF;
1178 END LOOP;
1179 END IF;
1180
1181 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1182 trace('l_ledger_ids = '|| l_ledger_ids,
1183 C_LEVEL_STATEMENT ,l_log_module);
1184 END IF;
1185
1186 l_ledger_ids := substr(l_ledger_ids,0,length(l_ledger_ids)-1);
1187
1188 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1189 trace('l_ledger_ids = '|| l_ledger_ids,
1190 C_LEVEL_STATEMENT ,l_log_module);
1191 END IF;
1192
1193 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1194 trace('get_ledger_ids.End',C_LEVEL_PROCEDURE,l_log_module);
1195 END IF;
1196 RETURN l_ledger_ids;
1197 EXCEPTION
1198 WHEN OTHERS THEN
1199 xla_exceptions_pkg.raise_message
1200 (p_location => 'xla_period_close_exp_pkg.get_ledger_ids');
1201 END get_ledger_ids;
1202
1203 PROCEDURE build_query_sql
1204 (p_application_id IN NUMBER
1205 ,p_ledger_id IN NUMBER
1206 ,p_period_from IN VARCHAR2
1207 ,p_period_to IN VARCHAR2
1208 ,p_event_class IN VARCHAR2
1209 ,p_je_category IN VARCHAR2
1210 ,p_object_type_code IN VARCHAR2
1211 ,p_je_source_name IN VARCHAR2
1212 ,p_mode IN VARCHAR2) IS
1213
1214 l_event_filter VARCHAR2(4000) := ' ';
1215
1216 l_header_filter VARCHAR2(4000) := ' ';
1217 l_application_filter_evt VARCHAR2(150);
1218 l_application_filter_aeh VARCHAR2(200);
1219 l_je_source_filter VARCHAR2(200) := ' ';
1220 l_je_category_filter VARCHAR2(200);
1221 l_date_filter_evt VARCHAR2(200);
1222 l_date_filter_aeh VARCHAR2(200);
1223 l_ledger_ids VARCHAR2(2000);
1224 l_event_class_filter VARCHAR2(200);
1225
1226 l_start_date DATE;
1227 l_end_date DATE;
1228
1229 l_log_module VARCHAR2(240);
1230 l_period_ledger_id GL_LEDGERS.ledger_id%TYPE;
1231 l_index NUMBER;
1232
1233
1234
1235
1236 BEGIN
1237
1238 IF g_log_enabled THEN
1239 l_log_module := C_DEFAULT_MODULE||'.build_query_sql';
1240 END IF;
1241
1242 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1243 trace('build_query_sql.Begin',C_LEVEL_PROCEDURE,l_log_module);
1244 END IF;
1245
1246 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1247 trace('p_ledger_id =' || p_ledger_id,C_LEVEL_STATEMENT,
1248 l_log_module);
1249 trace('period_from =' || p_period_from,C_LEVEL_STATEMENT,l_log_module);
1250 trace('period_to = '|| p_period_to,C_LEVEL_STATEMENT,l_Log_module);
1251 trace('p_event_class = '|| p_event_class,
1252 C_LEVEL_STATEMENT ,l_log_module);
1253 trace('p_je_category = '|| p_je_category,
1254 C_LEVEL_STATEMENT, l_log_module);
1255 trace('p_object_type_code = '|| p_object_type_code,
1256 C_LEVEL_STATEMENT, l_log_module);
1257 trace('p_je_source_name = '|| p_je_source_name,
1258 C_LEVEL_STATEMENT, l_log_module);
1259 END IF;
1260
1261
1262 build_xml_sql;
1263
1264 ----------------------------------------------------------------------------
1265 -- build filter condition based on parameters
1266 ----------------------------------------------------------------------------
1267
1268 l_ledger_ids := get_ledger_ids(p_ledger_id);
1269
1270
1271 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1272 trace('l_ledger_ids = '|| l_ledger_ids,
1273 C_LEVEL_STATEMENT, l_log_module);
1274 END IF;
1275
1276
1277 IF p_object_type_code = 'S' THEN
1278 SELECT ledger_id
1279 INTO l_period_ledger_id
1280 FROM gl_ledger_set_assignments
1281 WHERE ledger_set_id = p_ledger_id
1282 AND ledger_id <> p_ledger_id
1283 AND ROWNUM = 1;
1284 ELSE
1285 l_period_ledger_id := p_ledger_id ;
1286 END IF;
1287
1288
1289 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1290 trace('l_period_ledger_id = '|| l_period_ledger_id,
1291 C_LEVEL_STATEMENT, l_log_module);
1292 END IF;
1293
1294 get_period_start_end_dates(l_period_ledger_id
1295 ,p_period_from
1296 ,p_period_to
1297 ,l_start_date
1298 ,l_end_date);
1299
1300 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1301 trace('l_start_date = '|| to_char(l_start_date,'DD-MON-YYYY'),
1302 C_LEVEL_STATEMENT, l_log_module);
1303 trace('l_end_date = '|| to_char(l_end_date,'DD-MON-YYYY'),
1304 C_LEVEL_STATEMENT, l_log_module);
1305 END IF;
1306
1307 l_ledger_ids := nvl(l_ledger_ids,'NULL');
1308
1309 --------------------------------------------------------------------
1310 -- the following is removed (commented) as part of bug fix 6805286
1311 --------------------------------------------------------------------
1312 -- IF p_mode <> 'W' THEN
1313 --
1314 -- stamp_events_wo_aad(p_application_id
1315 -- ,l_ledger_ids
1316 -- ,l_start_date
1317 -- ,l_end_date);
1318 -- END IF;
1319
1320 l_ledger_ids := '(' || l_ledger_ids ||')';
1321
1322 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1323 trace('l_ledger_ids = '|| l_ledger_ids,
1324 C_LEVEL_STATEMENT, l_log_module);
1325 END IF;
1326
1327 IF p_application_id <> 101 THEN
1328 l_application_filter_evt := l_application_filter_evt ||
1329 ' AND xle.application_id = '|| to_char(p_application_id) ;
1330 l_application_filter_aeh := l_application_filter_aeh ||
1331 ' AND aeh.application_id = '|| to_char(p_application_id) ;
1332 END IF;
1333
1334 IF p_je_source_name is NOT NULL THEN
1335 l_je_source_filter := ' AND xls.je_source_name =
1336 ' ||''''|| p_je_source_name||'''' ;
1337 END IF;
1338
1339 IF p_je_category is NOT NULL THEN
1340 l_je_category_filter := ' AND gjct.je_category_name = ' ||''''||
1341 p_je_category||'''';
1342 END IF;
1343
1344 IF p_event_class is NOT NULL THEN
1345 l_event_class_filter := ' AND xcl.event_class_code = ' ||''''||
1346 p_event_class||'''' ;
1347 END IF;
1348
1349 l_date_filter_evt :=
1350 ' AND xle.event_date BETWEEN '''||l_start_date|| ''' '||
1351 'AND '''||l_end_date||''' ';
1352
1353 l_date_filter_aeh :=
1354 ' AND aeh.accounting_date BETWEEN '''||l_start_date|| ''' '||
1355 'AND '''||l_end_date||''' ';
1356
1357 l_event_filter := l_application_filter_evt || l_date_filter_evt ||
1358 l_je_category_filter || l_event_class_filter ;
1359 l_header_filter := l_application_filter_aeh || l_date_filter_aeh ||
1360 l_je_category_filter || l_event_class_filter ;
1361
1362 -- l_application_filter_evt needs to be combined with
1363 -- l_application_filter_aeh to be replaced in l_percl_query
1364 -- but the same cannot be used from l_user_trx_query
1365 -- so joining with l_je_source_filter which will be used for l_percl_query
1366
1367
1368 get_transaction_id(l_ledger_ids,l_event_filter,l_header_filter);
1369
1370
1371 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1372 trace('p_trx_identifiers_1='||substr(p_trx_identifiers_1,1,3000),C_LEVEL_PROCEDURE, l_log_module);
1373 END IF;
1374 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1375 trace('p_trx_identifiers_2='||substr(p_trx_identifiers_2,1,3000),C_LEVEL_PROCEDURE, l_log_module);
1376 END IF;
1377 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1378 trace('p_trx_identifiers_3='||substr(p_trx_identifiers_3,1,3000),C_LEVEL_PROCEDURE, l_log_module);
1379 END IF;
1380 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1381 trace('p_trx_identifiers_4='||substr(p_trx_identifiers_4,1,3000),C_LEVEL_PROCEDURE, l_log_module);
1382 END IF;
1383 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1384 trace('p_trx_identifiers_5='||substr(p_trx_identifiers_5,1,3000),C_LEVEL_PROCEDURE, l_log_module);
1385 END IF;
1386
1387
1388
1389
1390 xla_period_close_exp_pkg.p_ledger_ids := l_ledger_ids;
1391 xla_period_close_exp_pkg.p_event_filter := l_event_filter;
1392 xla_period_close_exp_pkg.p_header_filter := l_header_filter;
1393 xla_period_close_exp_pkg.p_je_source_filter := l_je_source_filter;
1394 xla_period_close_exp_pkg.p_object_type_code := p_object_type_code;
1395 xla_period_close_exp_pkg.p_je_source_name := p_je_source_name;
1396
1397 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1398 trace('build_query_sql.End'
1399 ,C_LEVEL_PROCEDURE, l_log_module);
1400 END IF;
1401
1402 EXCEPTION
1403 WHEN NO_DATA_FOUND THEN
1404 NULL;
1405 WHEN OTHERS THEN
1406 xla_exceptions_pkg.raise_message
1407 (p_location => 'xla_period_close_exp_pkg.build_query_sql');
1408 END build_query_sql ;
1409
1410 FUNCTION check_period_close(p_application_id IN NUMBER
1411 ,p_period_name IN VARCHAR2
1412 ,p_ledger_id IN NUMBER) RETURN NUMBER IS
1413 l_log_module VARCHAR2(240);
1414 l_period_start_date DATE;
1415 l_period_end_date DATE;
1416 l_unprocessed NUMBER DEFAULT 0;
1417 l_ledger_ids VARCHAR2(2000);
1418 BEGIN
1419 IF g_log_enabled THEN
1420 l_log_module := C_DEFAULT_MODULE||'.check_period_close';
1421 END IF;
1422
1423 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1424 trace('check_period_close.Begin',C_LEVEL_PROCEDURE,l_log_module);
1425 END IF;
1426
1427 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1428 trace('p_application_id = '|| to_char(p_application_id),
1429 C_LEVEL_STATEMENT ,l_log_module);
1430 trace('p_period_name = '|| p_period_name,
1431 C_LEVEL_STATEMENT ,l_log_module);
1432 trace('p_ledger_id = '|| to_char(p_ledger_id),
1433 C_LEVEL_STATEMENT ,l_log_module);
1434 END IF;
1435 get_period_start_end_dates(p_ledger_id
1436 ,p_period_name
1437 ,p_period_name
1438 ,l_period_start_date
1439 ,l_period_end_date);
1440
1441 l_ledger_ids := nvl(get_ledger_ids(p_ledger_id),'NULL');
1442
1443 --------------------------------------------------------------------
1444 -- the following is removed (commented) as part of bug fix 6805286
1445 --------------------------------------------------------------------
1446 -- stamp_events_wo_aad(p_application_id
1447 -- ,l_ledger_ids
1448 -- ,l_period_start_date
1449 -- ,l_period_end_date);
1450
1451
1452 IF p_application_id = 101 THEN
1453
1454
1455 BEGIN
1456
1457 SELECT 1
1458 INTO l_unprocessed
1459 FROM dual
1460 WHERE EXISTS(select 1
1461 FROM xla_events xle
1462 ,xla_transaction_entities xte
1463 ,gl_ledger_relationships glr1
1464 ,gl_ledger_relationships glr2
1465 ,xla_ledger_options xlo
1466 WHERE xle.entity_id = xte.entity_id
1467 AND xle.application_id = xte.application_id
1468 AND xle.event_date BETWEEN l_period_start_date and l_period_end_date
1469 AND glr2.target_ledger_id = p_ledger_id
1470 AND glr2.source_ledger_id = glr1.source_ledger_id
1471 AND glr2.application_id = glr1.application_id
1472 AND glr1.target_ledger_id = xlo.ledger_id
1473 AND xle.application_id = xlo.application_id
1474 AND xlo.capture_event_flag = 'Y'
1475 AND (glr1.target_ledger_id = xte.ledger_id OR
1476 glr1.primary_ledger_id = xte.ledger_id )
1477 AND (glr1.relationship_type_code = 'SUBLEDGER' OR
1478 (glr1.target_ledger_category_code = 'PRIMARY'
1479 AND glr1.relationship_type_code = 'NONE'))
1480 AND glr2.application_id = 101
1481 AND xle.event_status_code IN ('I','U')
1482 AND xle.process_status_code IN ('I','U','R','D','E'));
1483
1484
1485 EXCEPTION WHEN no_data_found THEN
1486
1487 --IF l_unprocessed = 0 THEN
1488 SELECT count(*)
1489 INTO l_unprocessed
1490 FROM xla_ae_headers aeh
1491 ,xla_transaction_entities xte
1492 ,gl_ledger_relationships glr1
1493 ,gl_ledger_relationships glr2
1494 WHERE aeh.ledger_id = glr2.target_ledger_id
1495 AND glr2.source_ledger_id = glr1.source_ledger_id
1496 AND glr2.application_id = glr1.application_id
1497 AND glr1.target_ledger_id = p_ledger_id
1498 AND glr1.application_id = 101
1499 AND xte.entity_id = aeh.entity_id
1500 AND xte.application_id = aeh.application_id
1501 AND aeh.gl_transfer_status_code IN ('N','E')
1502 AND aeh.accounting_date BETWEEN
1503 l_period_start_date AND l_period_end_date
1504 AND rownum = 1;
1505 --END IF;
1506
1507
1508 END;
1509
1510
1511 ELSE
1512
1513
1514 BEGIN
1515
1516 SELECT 1
1517 INTO l_unprocessed
1518 FROM dual
1519 WHERE EXISTS(select 1
1520 FROM xla_events xle
1521 ,xla_transaction_entities xte
1522 ,gl_ledger_relationships glr1
1523 ,gl_ledger_relationships glr2
1524 ,xla_ledger_options xlo
1525 WHERE xle.entity_id = xte.entity_id
1526 AND xle.application_id = xte.application_id
1527 AND xle.event_date BETWEEN l_period_start_date and l_period_end_date
1528 AND xle.application_id = p_application_id
1529 AND xle.event_status_code IN ('I','U')
1530 AND xle.process_status_code IN ('I','U','R','D','E')
1531 AND glr2.target_ledger_id = p_ledger_id
1532 AND glr2.source_ledger_id = glr1.source_ledger_id
1533 AND glr2.application_id = glr1.application_id
1534 AND glr1.target_ledger_id = xlo.ledger_id
1535 AND xle.application_id = xlo.application_id
1536 AND xlo.capture_event_flag = 'Y'
1537 AND (glr1.target_ledger_id = xte.ledger_id OR
1538 glr1.primary_ledger_id = xte.ledger_id )
1539 AND (glr1.relationship_type_code = 'SUBLEDGER' OR
1540 (glr1.target_ledger_category_code = 'PRIMARY'
1541 AND glr1.relationship_type_code = 'NONE'))
1542 AND glr2.application_id = 101
1543 AND xte.application_id = p_application_id
1544 );
1545
1546 --6784591 added process_status_code check.
1547
1548
1549 EXCEPTION WHEN no_data_found THEN
1550
1551 --IF l_unprocessed = 0 THEN
1552 SELECT count(*)
1553 INTO l_unprocessed
1554 FROM xla_ae_headers aeh
1555 ,xla_transaction_entities xte
1556 ,gl_ledger_relationships glr1
1557 ,gl_ledger_relationships glr2
1558 WHERE aeh.ledger_id = glr2.target_ledger_id
1559 AND glr2.source_ledger_id = glr1.source_ledger_id
1560 AND glr2.application_id = glr1.application_id
1561 AND glr1.target_ledger_id = p_ledger_id
1562 AND glr1.application_id = 101
1563 AND xte.entity_id = aeh.entity_id
1564 AND xte.application_id = aeh.application_id
1565 AND aeh.gl_transfer_status_code IN ('N','E')
1566 AND aeh.accounting_date BETWEEN
1567 l_period_start_date AND l_period_end_date
1568 AND xte.application_id = p_application_id
1569 AND rownum = 1;
1570 --END IF;
1571
1572
1573 END;
1574
1575 END IF;
1576
1577 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1578 trace('l_unprocessed = '|| to_char(l_unprocessed),
1579 C_LEVEL_STATEMENT ,l_log_module);
1580 END IF;
1581
1582 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1583 trace('check_period_close.End',C_LEVEL_PROCEDURE,l_log_module);
1584 END IF;
1585
1586 RETURN l_unprocessed;
1587 EXCEPTION
1588 WHEN OTHERS THEN
1589 xla_exceptions_pkg.raise_message
1590 (p_location => 'xla_period_close_exp_pkg.check_period_close');
1591
1592 END check_period_close;
1593
1594 FUNCTION beforeReport RETURN BOOLEAN IS
1595 l_errbuf VARCHAR2(2000);
1596 l_log_module VARCHAR2(240);
1597 BEGIN
1598 IF g_log_enabled THEN
1599 l_log_module := C_DEFAULT_MODULE||'.beforeReport';
1600 END IF;
1601
1602 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1603 trace('beforeReport.Begin',C_LEVEL_PROCEDURE,l_log_module);
1604 END IF;
1605
1606 IF (C_LEVEL_STATEMENT >= g_log_level) THEN
1607
1608 trace('p_application_id = '|| to_char(p_application_id),
1609 C_LEVEL_STATEMENT, l_log_module);
1610 trace('p_je_source = '|| p_je_source,
1611 C_LEVEL_STATEMENT, l_log_module);
1612 trace('p_dummy_param_1 = '|| to_char(p_dummy_param_1),
1613 C_LEVEL_STATEMENT, l_log_module);
1614 trace('p_dummy_param_2 = '|| to_char(p_dummy_param_2),
1615 C_LEVEL_STATEMENT, l_log_module);
1616 trace('p_ledger_id = '|| to_char(p_ledger_id),
1617 C_LEVEL_STATEMENT, l_log_module);
1618 trace('p_ledger = '|| p_ledger,
1619 C_LEVEL_STATEMENT, l_log_module);
1620 trace('p_period_from = '|| p_period_from,
1621 C_LEVEL_STATEMENT,l_log_module);
1622 trace('p_period_to = '|| p_period_to,
1623 C_LEVEL_STATEMENT, l_log_module);
1624 trace('p_event_class = '|| p_event_class,
1625 C_LEVEL_STATEMENT, l_log_module);
1626 trace('p_event_class_code = '|| p_event_class_code,
1627 C_LEVEL_STATEMENT, l_log_module);
1628 trace('p_je_category = '|| p_je_category,
1629 C_LEVEL_STATEMENT, l_log_module);
1630 trace('p_je_category_name = '|| p_je_category_name,
1631 C_LEVEL_STATEMENT, l_log_module);
1632 trace('p_mode = '|| p_mode,
1633 C_LEVEL_STATEMENT, l_log_module);
1634 END IF;
1635
1636 run_report(p_errbuf => l_errbuf
1637 ,p_retcode => xla_period_close_exp_pkg.C_RETURN_CODE
1638 ,p_application_id => xla_period_close_exp_pkg.p_application_id
1639 ,p_ledger_id => xla_period_close_exp_pkg.p_ledger_id
1640 ,p_period_from => xla_period_close_exp_pkg.p_period_from
1641 ,p_period_to => xla_period_close_exp_pkg.p_period_to
1642 ,p_event_class => xla_period_close_exp_pkg.p_event_class_code
1643 ,p_je_category => xla_period_close_exp_pkg.p_je_category_name
1644 ,p_mode => xla_period_close_exp_pkg.p_mode);
1645
1646 IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1647 trace('beforeReport.End'
1648 ,C_LEVEL_PROCEDURE, l_log_module);
1649 END IF;
1650
1651 RETURN TRUE;
1652
1653 EXCEPTION
1654 WHEN OTHERS THEN
1655 xla_exceptions_pkg.raise_message
1656 (p_location => 'xla_period_close_exp_pkg.beforeReport ');
1657
1658 END beforeReport;
1659
1660 BEGIN
1661 g_log_level := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
1662 g_log_enabled := fnd_log.test
1663 (log_level => g_log_level
1664 ,MODULE => C_DEFAULT_MODULE);
1665
1666 IF NOT g_log_enabled THEN
1667 g_log_level := C_LEVEL_LOG_DISABLED;
1668 END IF;
1669
1670 END xla_period_close_exp_pkg;