DBA Data[Home] [Help]

PACKAGE BODY: APPS.FUN_XLA_TAB_PKG

Source


1 PACKAGE BODY FUN_XLA_TAB_PKG AS
2 /* $Header: funxlatabb.pls 120.1.12010000.2 2008/08/22 09:04:46 makansal ship $   */
3 /*======================================================================+
4 |                Copyright (c) 2004 Oracle Corporation                  |
5 |                       Redwood Shores, CA, USA                         |
6 |                         All rights reserved.                          |
7 +=======================================================================+
8 | PACKAGE NAME                                                          |
9 |     FUN_XLA_TAB_PKG                                                   |
10 |                                                                       |
11 | DESCRIPTION                                                           |
12 |                                                                       |
13 |     Transaction Account Builder API.                                  |
14 |                                                                       |
15 |     Package generated by Oracle Subledger Accounting for              |
16 |                                                                       |
17 |     Financials Common Modules                                         |
18 |     (application_id: 435)                                             |
19 |                                                                       |
20 |     ATTENTION:                                                        |
21 |     This package has been automatically generated by the              |
22 |     Oracle Subledger Accounting Compiler. You should not modify its   |
23 |     content manually.                                                 |
24 |     This package has been generated according to the Transaction      |
25 |     Account Types setup for this application.                         |
26 |     In case of issues independent of the setup (e.g. GSCC errors)     |
27 |     please log a bug against Oracle Subledger Accounting.             |
28 |                                                                       |
29 |                                                                       |
30 | HISTORY                                                               |
31 |     12-JUL-06 XLA Generated by Oracle Subledger Accounting Compiler   |
32 |                                                                       |
33 +=======================================================================*/
34 --Private exceptions
35    le_fatal_error  EXCEPTION;
36 --Private constants
37    C_API_VERSION          CONSTANT NUMBER(1)    := 1;
38    C_PACKAGE_NAME         CONSTANT VARCHAR2(30) := 'FUN_XLA_TAB_PKG';
39 
40 
41 --=============================================================================
42 --               *********** Local Trace Routine **********
43 --=============================================================================
44 C_LEVEL_STATEMENT     CONSTANT NUMBER := FND_LOG.LEVEL_STATEMENT;
45 C_LEVEL_PROCEDURE     CONSTANT NUMBER := FND_LOG.LEVEL_PROCEDURE;
46 C_LEVEL_EVENT         CONSTANT NUMBER := FND_LOG.LEVEL_EVENT;
47 C_LEVEL_EXCEPTION     CONSTANT NUMBER := FND_LOG.LEVEL_EXCEPTION;
48 C_LEVEL_ERROR         CONSTANT NUMBER := FND_LOG.LEVEL_ERROR;
49 C_LEVEL_UNEXPECTED    CONSTANT NUMBER := FND_LOG.LEVEL_UNEXPECTED;
50 
51 C_LEVEL_LOG_DISABLED  CONSTANT NUMBER := 99;
52 C_DEFAULT_MODULE      CONSTANT VARCHAR2(240) := 'fun.plsql.fun_xla_tab_pkg';
53 
54 g_log_level           NUMBER;
55 g_log_enabled         BOOLEAN;
56 
57 PROCEDURE trace
58        ( p_module                     IN VARCHAR2 DEFAULT C_DEFAULT_MODULE
59         ,p_msg                        IN VARCHAR2
60         ,p_level                      IN NUMBER
61         )
62 IS
63 BEGIN
64    IF (p_msg IS NULL AND p_level >= g_log_level) THEN
65       fnd_log.message(p_level, p_module);
66    ELSIF p_level >= g_log_level THEN
67       fnd_log.string(p_level, p_module, p_msg);
68    END IF;
69 
70 EXCEPTION
71 WHEN app_exceptions.application_exception THEN
72    RAISE;
73 WHEN OTHERS THEN
74    fnd_message.set_name('XLA', 'XLA_TAB_UNHANDLED_EXCEPTION');
75    fnd_message.set_token( 'PROCEDURE'
76                          ,'fun_xla_tab_pkg.trace');
77    RAISE;
78 END trace;
79 
80 --Private procedure
81    PROCEDURE reset_online_interface
82    IS
83       l_log_module           VARCHAR2 (2000);
84    BEGIN
85       IF g_log_enabled THEN
86          l_log_module := C_DEFAULT_MODULE||'.reset_online_interface';
87       END IF;
88 
89       IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
90          trace
91            ( p_module   => l_log_module
92             ,p_msg      => 'BEGIN ' || l_log_module
93             ,p_level    => C_LEVEL_PROCEDURE);
94       END IF;
95 
96       --Remove all the elements from the PLSQL tables
97       g_array_xla_tab.DELETE;
98 
99 
100       IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
101          trace
102            (p_msg      => 'END ' || l_log_module
103             ,p_level    => C_LEVEL_PROCEDURE);
104       END IF;
105 
106    EXCEPTION
107    WHEN OTHERS THEN
108       RAISE;
109    END reset_online_interface;
110 
111 
112 
113 --Public procedures
114    PROCEDURE run
115    (
116      p_api_version                      IN NUMBER
117     ,p_account_definition_type_code     IN VARCHAR2
118     ,p_account_definition_code          IN VARCHAR2
119     ,p_transaction_coa_id               IN NUMBER
120     ,p_mode                             IN VARCHAR2
121     ,x_return_status                    OUT NOCOPY VARCHAR2
122     ,x_msg_count                        OUT NOCOPY NUMBER
123     ,x_msg_data                         OUT NOCOPY VARCHAR2
124    )
125    IS
126       l_return_status     VARCHAR2(1);
127       l_return_msg_name   VARCHAR2(30);
128       l_msg_count         NUMBER;
129       l_msg_data          VARCHAR2(2000);
130       l_log_module           VARCHAR2 (2000);
131    BEGIN
132       IF g_log_enabled THEN
133          l_log_module := C_DEFAULT_MODULE||'.run';
134       END IF;
135 
136       IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
137          trace
138            ( p_module   => l_log_module
139             ,p_msg      => 'BEGIN ' || l_log_module
140             ,p_level    => C_LEVEL_PROCEDURE);
141       END IF;
142 
143       --Initialize the global message table
144       FND_MSG_PUB.Initialize;
145 
146 	  IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
147      	FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'Calling xla_tab_pub_pkg.run with following parameters');
148 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run','p_api_version = ' || p_api_version);
149 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run','p_application_id = ' || 435);
150 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run','p_account_definition_type_code = ' || p_account_definition_type_code);
151 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run','p_account_definition_code = ' || p_account_definition_code);
152 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run','p_transaction_coa_id = ' || p_transaction_coa_id);
153 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run','p_mode = ' || p_mode);
154      END IF;
155 
156       xla_tab_pub_pkg.run
157          (
158            p_api_version                  => p_api_version
159           ,p_application_id               => 435
160           ,p_account_definition_type_code => p_account_definition_type_code
161           ,p_account_definition_code      => p_account_definition_code
162           ,p_transaction_coa_id           => p_transaction_coa_id
163           ,p_mode                         => p_mode
164           ,x_return_status                => l_return_status
165           ,x_msg_count                    => l_msg_count
166           ,x_msg_data                     => l_msg_data
167          );
168 
169 	IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
170      	FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'xla_tab_pub_pkg returns status ' || l_return_status );
171 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'xla_tab_pub_pkg l_msg_count = ' || l_msg_count );
172 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'xla_tab_pub_pkg l_msg_data = ' || l_msg_data );
173      END IF;
174 
175       IF l_return_status <> C_RET_STS_SUCCESS
176       THEN
177          --Push the error message again so that it does not get lost
178          IF l_msg_data IS NOT NULL
179          THEN
180 			IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
181 				FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'If return status is not success and l_msg_data is not null');
182 				FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'initialize fnd_msg_pub and add message data in to fnd_msg_pub');
183 			END IF;
184 
185             fnd_msg_pub.initialize;
186 
187             fnd_message.set_encoded
188             (
189               encoded_message => l_msg_data
190             );
191 
192             --Add it to the message table
193             fnd_msg_pub.add;
194 
195 			IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
196 				FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'set l_msg_count and l_msd_data to NULL');
197 			END IF;
198             --Reset single message variables
199             l_msg_count := NULL;
200             l_msg_data  := NULL;
201          END IF;
202 		 IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
203 				FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'Raise fatal exception');
204 		 END IF;
205 
206          RAISE le_fatal_error;
207       END IF;
208 
209 	  IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
210 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'Assign out parameters');
211 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'x_msg_count = ' || l_msg_count);
212 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'x_msg_data = ' || l_msg_data);
213 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'x-return_status = ' || C_RET_STS_SUCCESS);
214 	  END IF;
215 
216       --Assign out parameters
217       x_msg_count     := NVL(l_msg_count, 0);
218       x_msg_data      := l_msg_data;
219       x_return_status := C_RET_STS_SUCCESS;
220 
221       IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
222          trace
223            ( p_module   => l_log_module
224             ,p_msg      => 'END ' || l_log_module
225             ,p_level    => C_LEVEL_PROCEDURE);
226       END IF;
227 
228    EXCEPTION
229    WHEN le_fatal_error THEN
230 
231 	  IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
232 			FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'When Fatal Exception remove all element from PLSQL table');
233 			FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'reset online interface and add standard unexpected error message');
234 	  END IF;
235       --Remove all the elements from the PLSQL table
236       reset_online_interface;
237       --If there is a no token message to log
238       IF l_return_msg_name IS NOT NULL
239       THEN
240          --Set it on the stack
241          fnd_message.set_name
242             (
243               application => 'XLA'
244              ,name        => l_return_msg_name
245          );
246          --Add it to the message table
247          fnd_msg_pub.add;
248       END IF;
249       --Set the failure message on the stack
250       fnd_message.set_name
251             (
252               application => 'XLA'
253              ,name        => 'XLA_TAB_RUN_FAILED'
254          );
255       fnd_message.set_token( 'FUNCTION_NAME'
256                             ,'fun_xla_tab_pkg.run');
257 
258       --Add it to the message table
259       fnd_msg_pub.add;
260 
261       --If there is only one message retrieve it
262       fnd_msg_pub.Count_And_Get
263          (
264            p_count => l_msg_count
265           ,p_data  => l_msg_data
266          );
267       --Put the message on the stack to ensure old Forms detect the error
268       fnd_message.set_encoded
269          (
270            encoded_message => l_msg_data
271          );
272       --Assign out parameters
273       x_msg_count     := l_msg_count;
274       x_msg_data      := l_msg_data;
275 	  IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
276 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'Assign out parameters');
277 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'x_msg_count = ' || l_msg_count);
278 		FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'x_msg_data = ' || l_msg_data);
279 	  END IF;
280 
281       IF l_return_status IS NOT NULL
282       THEN
283 		 IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
284 			FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'x-return_status = ' || l_return_status);
285 	     END IF;
286          x_return_status := l_return_status;
287       ELSE
288 		 IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
289 			FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'x-return_status = ' || C_RET_STS_UNEXP_ERROR);
290 	     END IF;
291          x_return_status := C_RET_STS_UNEXP_ERROR;
292       END IF;
293    WHEN OTHERS THEN
294 		 IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
295 			FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'When Other Exception remove all element from PLSQL table');
296 			FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'reset online interface and add standard unexpected error message');
297 	     END IF;
298       --Remove all the elements from the PLSQL table
299       reset_online_interface;
300       --Add the standard unexpected error message
301       fnd_msg_pub.Add_Exc_Msg
302          ( p_pkg_name       => C_PACKAGE_NAME
303           ,p_procedure_name => 'run'
304          );
305       --If there is only one message retrieve it
306       fnd_msg_pub.Count_And_Get
307          (
308            p_count => l_msg_count
309           ,p_data  => l_msg_data
310          );
311       --Put the message on the stack to ensure all Forms detect the error
312       fnd_message.set_encoded
313          (
314            encoded_message => l_msg_data
315          );
316 
317 		 IF (FND_LOG.LEVEL_PROCEDURE >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
318 			FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'Assign out parameters');
319 			FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'x_msg_count = ' || l_msg_count);
320 			FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'x_msg_data = ' || l_msg_data);
321 			FND_LOG.STRING(FND_LOG.LEVEL_PROCEDURE, 'fun.plsql.fun_xla_tab_pkg.run', 'x-return_status = ' || C_RET_STS_UNEXP_ERROR);
322 		 END IF;
323 
324       --Assign out parameters
325       x_msg_count     := l_msg_count;
326       x_msg_data      := l_msg_data;
327       x_return_status := C_RET_STS_UNEXP_ERROR;
328    END run;
329 
330 
331    PROCEDURE reset_online_interface
332     (
333       p_api_version                      IN  NUMBER
334      ,x_return_status                    OUT NOCOPY VARCHAR2
335      ,x_msg_count                        OUT NOCOPY NUMBER
336      ,x_msg_data                         OUT NOCOPY VARCHAR2
337     )
338    IS
339       l_return_status         VARCHAR2(1);
340       l_return_msg_name       VARCHAR2(30);
341 
342       l_msg_count             NUMBER;
343       l_msg_data              VARCHAR2(2000);
344 
345       l_log_module           VARCHAR2 (2000);
346 
347    BEGIN
348       IF g_log_enabled THEN
349          l_log_module := C_DEFAULT_MODULE||'.reset_online_interface';
350       END IF;
351 
355             ,p_msg      => 'BEGIN ' || l_log_module
352       IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
353          trace
354            ( p_module   => l_log_module
356             ,p_level    => C_LEVEL_PROCEDURE);
357       END IF;
358 
359       --Initialize the global message table
360       FND_MSG_PUB.Initialize;
361 
362       --Initialize return status and message local variables
363       l_return_msg_name:= NULL;
364       l_return_status  := NULL;
365 
366       IF NOT FND_API.Compatible_API_Call
367          (
368            p_current_version_number => C_API_VERSION
369           ,p_caller_version_number  => p_api_version
370           ,p_api_name               => 'reset_online_interface'
371           ,p_pkg_name               => C_PACKAGE_NAME
372          )
373       THEN
374          RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
375       END IF;
376 
377       --Remove all the elements from the PLSQL tables
378       reset_online_interface;
379 
380       --Assign out parameters
381       x_msg_count     := l_msg_count;
382       x_msg_data      := l_msg_data;
383       IF l_return_status IS NOT NULL
384       THEN
385          x_return_status := l_return_status;
386       ELSE
387          x_return_status := C_RET_STS_UNEXP_ERROR;
388       END IF;
389 
390       IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
391          trace
392            ( p_module   => l_log_module
393             ,p_msg      => 'END ' || l_log_module
394             ,p_level    => C_LEVEL_PROCEDURE);
395       END IF;
396 
397    EXCEPTION
398    WHEN le_fatal_error THEN
399       --If there is a no token message to log
400       IF l_return_msg_name IS NOT NULL
401       THEN
402          --Set it on the stack
403          fnd_message.set_name
404             (
405               application => 'XLA'
406              ,name        => l_return_msg_name
407          );
408          --Add it to the message table
409          fnd_msg_pub.add;
410       END IF;
411       --If there is only one message retrieve it
412       fnd_msg_pub.Count_And_Get
413          (
414            p_count => l_msg_count
415           ,p_data  => l_msg_data
416          );
417       --Put the message on the stack to ensure old Forms detect the error
418       fnd_message.set_encoded
419          (
420            encoded_message => l_msg_data
421          );
422       --Assign out parameters
423       x_msg_count     := l_msg_count;
424       x_msg_data      := l_msg_data;
425       IF l_return_status IS NOT NULL
426       THEN
427          x_return_status := l_return_status;
428       ELSE
429          x_return_status := C_RET_STS_UNEXP_ERROR;
430       END IF;
431    WHEN OTHERS THEN
432       --Add the standard unexpected error message
433       fnd_msg_pub.Add_Exc_Msg
434          ( p_pkg_name       => C_PACKAGE_NAME
435           ,p_procedure_name => 'reset_online_interface'
436          );
437       --If there is only one message retrieve it
438       fnd_msg_pub.Count_And_Get
439          (
440            p_count => l_msg_count
441           ,p_data  => l_msg_data
442          );
443       --Put the message on the stack to ensure all Forms detect the error
444       fnd_message.set_encoded
445          (
446            encoded_message => l_msg_data
447          );
448       --Assign out parameters
449       x_msg_count     := l_msg_count;
450       x_msg_data      := l_msg_data;
451       x_return_status := C_RET_STS_UNEXP_ERROR;
452    END reset_online_interface;
453 
454 
455    PROCEDURE write_online_tab
456    (
457      p_api_version                      IN NUMBER           --INPUT NOT NULL
458     ,p_source_distrib_id_num_1          IN NUMBER           --INPUT
459     ,p_source_distrib_id_num_2          IN NUMBER           --INPUT
460     ,p_source_distrib_id_num_3          IN NUMBER           --INPUT
461     ,p_source_distrib_id_num_4          IN NUMBER           --INPUT
462     ,p_source_distrib_id_num_5          IN NUMBER           --INPUT
463     ,p_account_type_code                IN VARCHAR2         --INPUT NOT NULL
464     --START of source list
465     ,ftb_attribute1                     IN VARCHAR2                  --INPUT
466     ,ftb_attribute10                    IN VARCHAR2                  --INPUT
467     ,ftb_attribute11                    IN VARCHAR2                  --INPUT
468     ,ftb_attribute12                    IN VARCHAR2                  --INPUT
469     ,ftb_attribute13                    IN VARCHAR2                  --INPUT
470     ,ftb_attribute14                    IN VARCHAR2                  --INPUT
471     ,ftb_attribute15                    IN VARCHAR2                  --INPUT
472     ,ftb_attribute2                     IN VARCHAR2                  --INPUT
473     ,ftb_attribute3                     IN VARCHAR2                  --INPUT
474     ,ftb_attribute4                     IN VARCHAR2                  --INPUT
475     ,ftb_attribute5                     IN VARCHAR2                  --INPUT
476     ,ftb_attribute6                     IN VARCHAR2                  --INPUT
477     ,ftb_attribute7                     IN VARCHAR2                  --INPUT
478     ,ftb_attribute8                     IN VARCHAR2                  --INPUT
479     ,ftb_attribute9                     IN VARCHAR2                  --INPUT
480     ,ftb_category_code                  IN VARCHAR2                  --INPUT
484     ,ftb_initiator_bsv                  IN VARCHAR2                  --INPUT
481     ,ftb_currency_code                  IN VARCHAR2                  --INPUT
482     ,ftb_from_ledger_id                 IN NUMBER                    --INPUT
483     ,ftb_from_le_id                     IN NUMBER                    --INPUT
485     ,ftb_initiator_id                   IN NUMBER                    --INPUT
486     ,fth_attribute1                     IN VARCHAR2                  --INPUT
487     ,fth_attribute10                    IN VARCHAR2                  --INPUT
488     ,fth_attribute11                    IN VARCHAR2                  --INPUT
489     ,fth_attribute12                    IN VARCHAR2                  --INPUT
490     ,fth_attribute13                    IN VARCHAR2                  --INPUT
491     ,fth_attribute14                    IN VARCHAR2                  --INPUT
492     ,fth_attribute15                    IN VARCHAR2                  --INPUT
493     ,fth_attribute2                     IN VARCHAR2                  --INPUT
494     ,fth_attribute3                     IN VARCHAR2                  --INPUT
495     ,fth_attribute4                     IN VARCHAR2                  --INPUT
496     ,fth_attribute5                     IN VARCHAR2                  --INPUT
497     ,fth_attribute6                     IN VARCHAR2                  --INPUT
498     ,fth_attribute7                     IN VARCHAR2                  --INPUT
499     ,fth_attribute8                     IN VARCHAR2                  --INPUT
500     ,fth_attribute9                     IN VARCHAR2                  --INPUT
501     ,fth_attribute_category             IN VARCHAR2                  --INPUT
502     ,fth_recipient_bsv                  IN VARCHAR2                  --INPUT
503     ,fth_recipient_id                   IN NUMBER                    --INPUT
504     ,fth_to_ledger_id                   IN NUMBER                    --INPUT
505     ,fth_to_le_id                       IN NUMBER                    --INPUT
506     ,ftt_allow_interest_accr_flag       IN VARCHAR2                  --INPUT
507     ,ftt_allow_invoicing_flag           IN VARCHAR2                  --INPUT
508     ,ftt_attribute1                     IN VARCHAR2                  --INPUT
509     ,ftt_attribute10                    IN VARCHAR2                  --INPUT
510     ,ftt_attribute11                    IN VARCHAR2                  --INPUT
511     ,ftt_attribute12                    IN VARCHAR2                  --INPUT
512     ,ftt_attribute13                    IN VARCHAR2                  --INPUT
513     ,ftt_attribute14                    IN VARCHAR2                  --INPUT
514     ,ftt_attribute15                    IN VARCHAR2                  --INPUT
515     ,ftt_attribute2                     IN VARCHAR2                  --INPUT
516     ,ftt_attribute3                     IN VARCHAR2                  --INPUT
517     ,ftt_attribute4                     IN VARCHAR2                  --INPUT
518     ,ftt_attribute5                     IN VARCHAR2                  --INPUT
519     ,ftt_attribute6                     IN VARCHAR2                  --INPUT
520     ,ftt_attribute7                     IN VARCHAR2                  --INPUT
521     ,ftt_attribute8                     IN VARCHAR2                  --INPUT
522     ,ftt_attribute9                     IN VARCHAR2                  --INPUT
523     ,ftt_attribute_category             IN VARCHAR2                  --INPUT
524     ,ftt_manual_approve_flag            IN VARCHAR2                  --INPUT
525     ,ftt_trx_type_id                    IN NUMBER                    --INPUT
526     ,ftt_vat_taxable_flag               IN VARCHAR2                  --INPUT
527     --END of source list
528     ,x_return_status                    OUT NOCOPY VARCHAR2 --OUTPUT
529     ,x_msg_count                        OUT NOCOPY NUMBER   --OUTPUT
530     ,x_msg_data                         OUT NOCOPY VARCHAR2 --OUTPUT
531    )
532    IS
533       l_return_status     VARCHAR2(1);
534       l_return_msg_name   VARCHAR2(30);
535       l_msg_count         NUMBER;
536       l_msg_data          VARCHAR2(2000);
537       l_watermark         NUMBER;
538       l_new_idx           NUMBER;
539 
540       l_log_module           VARCHAR2 (2000);
541    BEGIN
542       IF g_log_enabled THEN
543          l_log_module := C_DEFAULT_MODULE||'write_online_tab ';
544       END IF;
545 
546       IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
547          trace
548            ( p_module   => l_log_module
549             ,p_msg      => 'BEGIN ' || l_log_module
550             ,p_level    => C_LEVEL_PROCEDURE);
551       END IF;
552 
553       --Initialize the global message table
554       FND_MSG_PUB.Initialize;
555 
556       --Initialize return status and message local variables
557       l_return_msg_name  := NULL;
558       l_return_status    := NULL;
559 
560       IF NOT FND_API.Compatible_API_Call
561          (
562            p_current_version_number => C_API_VERSION
563           ,p_caller_version_number  => p_api_version
564           ,p_api_name               => 'write_online_tab '
565           ,p_pkg_name               => C_PACKAGE_NAME
566          )
567       THEN
568          RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
569       END IF;
570 
571       --p_account_type_code cannot be NULL
572       IF p_account_type_code IS NULL
573       THEN
574          --Assign an error message and a return code of FAILURE
575          l_return_msg_name  := 'XLA_TAB_WR_ROW_ACCT_TYPE_NULL';
576          RAISE le_fatal_error;
577       END IF;
578 
579       --Get the highest index of the PL/SQL table
580       --Cannot use COUNT since some elements might have been
581       --collected and deleted
585       FOR i IN 0..l_watermark
582       l_watermark := NVL(g_array_xla_tab .LAST, -1);
583 
584       --Loop on all the rows of the PL/SQL table
586       LOOP
587          --If the current row has the same key of the new row
588          IF  g_array_xla_tab .EXISTS(i)
589          AND (   g_array_xla_tab (i).source_distribution_id_num_1 = p_source_distrib_id_num_1
590               OR g_array_xla_tab (i).source_distribution_id_num_1 IS NULL AND p_source_distrib_id_num_1 IS NULL
591              )
592          AND (   g_array_xla_tab (i).source_distribution_id_num_2 = p_source_distrib_id_num_2
593               OR g_array_xla_tab (i).source_distribution_id_num_2 IS NULL AND p_source_distrib_id_num_2 IS NULL
594              )
595          AND (   g_array_xla_tab (i).source_distribution_id_num_3 = p_source_distrib_id_num_3
596               OR g_array_xla_tab (i).source_distribution_id_num_3 IS NULL AND p_source_distrib_id_num_3 IS NULL
597              )
598          AND (   g_array_xla_tab (i).source_distribution_id_num_4 = p_source_distrib_id_num_4
599               OR g_array_xla_tab (i).source_distribution_id_num_4 IS NULL AND p_source_distrib_id_num_4 IS NULL
600              )
601          AND (   g_array_xla_tab (i).source_distribution_id_num_5 = p_source_distrib_id_num_5
602               OR g_array_xla_tab (i).source_distribution_id_num_5 IS NULL AND p_source_distrib_id_num_5 IS NULL
603              )
604          AND g_array_xla_tab (i).account_type_code            = p_account_type_code
605          THEN
606             --Assign a return code of FAILURE
607             l_return_status    := C_RET_STS_UNEXP_ERROR;
608             --Set the TAB message onto the message stack
609             FND_MESSAGE.SET_NAME
610             (
611               application => 'XLA'
612              ,name        => 'XLA_TAB_WR_ROW_DUPLICATE'
613             );
614 
615             --Replace the token for the flex message retrieved above
616             FND_MESSAGE.SET_TOKEN
617             (
618               token => 'TRX_ACCT_TYPE_CODE'
619              ,value => g_array_xla_tab (i).account_type_code
620             );
621             --Replace the token for the flex message retrieved above
622             FND_MESSAGE.SET_TOKEN
623             (
624               token => 'SOURCE_DIST_ID_NUM1'
625              ,value => g_array_xla_tab (i).source_distribution_id_num_1
626             );
627             --Replace the token for the flex message retrieved above
628             FND_MESSAGE.SET_TOKEN
629             (
630               token => 'SOURCE_DIST_ID_NUM2'
631              ,value => g_array_xla_tab (i).source_distribution_id_num_2
632             );
633             --Replace the token for the flex message retrieved above
634             FND_MESSAGE.SET_TOKEN
635             (
636               token => 'SOURCE_DIST_ID_NUM3'
637              ,value => g_array_xla_tab (i).source_distribution_id_num_3
638             );
639             --Replace the token for the flex message retrieved above
640             FND_MESSAGE.SET_TOKEN
641             (
642               token => 'SOURCE_DIST_ID_NUM4'
643              ,value => g_array_xla_tab (i).source_distribution_id_num_4
644             );
645             --Replace the token for the flex message retrieved above
646             FND_MESSAGE.SET_TOKEN
647             (
648               token => 'SOURCE_DIST_ID_NUM5'
649              ,value => g_array_xla_tab (i).source_distribution_id_num_5
650             );
651 
652             fnd_msg_pub.add;
653 
654             --Raise a local exception
655             RAISE le_fatal_error;
656          --Elsif the current row has already been processed
657          ELSIF g_array_xla_tab .EXISTS(i)
658            AND g_array_xla_tab (i).target_ccid   IS NOT NULL
659            AND g_array_xla_tab (i).msg_data IS NOT NULL
660          THEN
661             --It means the caller has previously uploaded the interface and run
662             --the processing but has not collected all the results.
663             --Assign an error message and a return code of FAILURE
664             l_return_msg_name  := 'XLA_TAB_WR_ROW_PROCESSED';
665             l_return_status    := C_RET_STS_UNEXP_ERROR;
666             --Raise a local exception
667             RAISE le_fatal_error;
668          END IF;
669       END LOOP;
670 
671       --Get the index of the new row
672       l_new_idx := g_array_xla_tab .COUNT;
673       --Assign the values to the new row
674       g_array_xla_tab (l_new_idx).source_distribution_id_num_1   := p_source_distrib_id_num_1;
675       g_array_xla_tab (l_new_idx).source_distribution_id_num_2   := p_source_distrib_id_num_2;
676       g_array_xla_tab (l_new_idx).source_distribution_id_num_3   := p_source_distrib_id_num_3;
677       g_array_xla_tab (l_new_idx).source_distribution_id_num_4   := p_source_distrib_id_num_4;
678       g_array_xla_tab (l_new_idx).source_distribution_id_num_5   := p_source_distrib_id_num_5;
679       g_array_xla_tab (l_new_idx).account_type_code              := p_account_type_code;
680     --START of source list
681       g_array_xla_tab (l_new_idx).ftb_attribute1                 := ftb_attribute1;
682       g_array_xla_tab (l_new_idx).ftb_attribute10                := ftb_attribute10;
683       g_array_xla_tab (l_new_idx).ftb_attribute11                := ftb_attribute11;
684       g_array_xla_tab (l_new_idx).ftb_attribute12                := ftb_attribute12;
688       g_array_xla_tab (l_new_idx).ftb_attribute2                 := ftb_attribute2;
685       g_array_xla_tab (l_new_idx).ftb_attribute13                := ftb_attribute13;
686       g_array_xla_tab (l_new_idx).ftb_attribute14                := ftb_attribute14;
687       g_array_xla_tab (l_new_idx).ftb_attribute15                := ftb_attribute15;
689       g_array_xla_tab (l_new_idx).ftb_attribute3                 := ftb_attribute3;
690       g_array_xla_tab (l_new_idx).ftb_attribute4                 := ftb_attribute4;
691       g_array_xla_tab (l_new_idx).ftb_attribute5                 := ftb_attribute5;
692       g_array_xla_tab (l_new_idx).ftb_attribute6                 := ftb_attribute6;
693       g_array_xla_tab (l_new_idx).ftb_attribute7                 := ftb_attribute7;
694       g_array_xla_tab (l_new_idx).ftb_attribute8                 := ftb_attribute8;
695       g_array_xla_tab (l_new_idx).ftb_attribute9                 := ftb_attribute9;
696       g_array_xla_tab (l_new_idx).ftb_category_code              := ftb_category_code;
697       g_array_xla_tab (l_new_idx).ftb_currency_code              := ftb_currency_code;
698       g_array_xla_tab (l_new_idx).ftb_from_ledger_id             := ftb_from_ledger_id;
699       g_array_xla_tab (l_new_idx).ftb_from_le_id                 := ftb_from_le_id;
700       g_array_xla_tab (l_new_idx).ftb_initiator_bsv              := ftb_initiator_bsv;
701       g_array_xla_tab (l_new_idx).ftb_initiator_id               := ftb_initiator_id;
702       g_array_xla_tab (l_new_idx).fth_attribute1                 := fth_attribute1;
703       g_array_xla_tab (l_new_idx).fth_attribute10                := fth_attribute10;
704       g_array_xla_tab (l_new_idx).fth_attribute11                := fth_attribute11;
705       g_array_xla_tab (l_new_idx).fth_attribute12                := fth_attribute12;
706       g_array_xla_tab (l_new_idx).fth_attribute13                := fth_attribute13;
707       g_array_xla_tab (l_new_idx).fth_attribute14                := fth_attribute14;
708       g_array_xla_tab (l_new_idx).fth_attribute15                := fth_attribute15;
709       g_array_xla_tab (l_new_idx).fth_attribute2                 := fth_attribute2;
710       g_array_xla_tab (l_new_idx).fth_attribute3                 := fth_attribute3;
711       g_array_xla_tab (l_new_idx).fth_attribute4                 := fth_attribute4;
712       g_array_xla_tab (l_new_idx).fth_attribute5                 := fth_attribute5;
713       g_array_xla_tab (l_new_idx).fth_attribute6                 := fth_attribute6;
714       g_array_xla_tab (l_new_idx).fth_attribute7                 := fth_attribute7;
715       g_array_xla_tab (l_new_idx).fth_attribute8                 := fth_attribute8;
716       g_array_xla_tab (l_new_idx).fth_attribute9                 := fth_attribute9;
717       g_array_xla_tab (l_new_idx).fth_attribute_category         := fth_attribute_category;
718       g_array_xla_tab (l_new_idx).fth_recipient_bsv              := fth_recipient_bsv;
719       g_array_xla_tab (l_new_idx).fth_recipient_id               := fth_recipient_id;
720       g_array_xla_tab (l_new_idx).fth_to_ledger_id               := fth_to_ledger_id;
721       g_array_xla_tab (l_new_idx).fth_to_le_id                   := fth_to_le_id;
722       g_array_xla_tab (l_new_idx).ftt_allow_interest_accr_flag   := ftt_allow_interest_accr_flag;
723       g_array_xla_tab (l_new_idx).ftt_allow_invoicing_flag       := ftt_allow_invoicing_flag;
724       g_array_xla_tab (l_new_idx).ftt_attribute1                 := ftt_attribute1;
725       g_array_xla_tab (l_new_idx).ftt_attribute10                := ftt_attribute10;
726       g_array_xla_tab (l_new_idx).ftt_attribute11                := ftt_attribute11;
727       g_array_xla_tab (l_new_idx).ftt_attribute12                := ftt_attribute12;
728       g_array_xla_tab (l_new_idx).ftt_attribute13                := ftt_attribute13;
729       g_array_xla_tab (l_new_idx).ftt_attribute14                := ftt_attribute14;
730       g_array_xla_tab (l_new_idx).ftt_attribute15                := ftt_attribute15;
731       g_array_xla_tab (l_new_idx).ftt_attribute2                 := ftt_attribute2;
732       g_array_xla_tab (l_new_idx).ftt_attribute3                 := ftt_attribute3;
733       g_array_xla_tab (l_new_idx).ftt_attribute4                 := ftt_attribute4;
734       g_array_xla_tab (l_new_idx).ftt_attribute5                 := ftt_attribute5;
735       g_array_xla_tab (l_new_idx).ftt_attribute6                 := ftt_attribute6;
736       g_array_xla_tab (l_new_idx).ftt_attribute7                 := ftt_attribute7;
737       g_array_xla_tab (l_new_idx).ftt_attribute8                 := ftt_attribute8;
738       g_array_xla_tab (l_new_idx).ftt_attribute9                 := ftt_attribute9;
739       g_array_xla_tab (l_new_idx).ftt_attribute_category         := ftt_attribute_category;
740       g_array_xla_tab (l_new_idx).ftt_manual_approve_flag        := ftt_manual_approve_flag;
741       g_array_xla_tab (l_new_idx).ftt_trx_type_id                := ftt_trx_type_id;
742       g_array_xla_tab (l_new_idx).ftt_vat_taxable_flag           := ftt_vat_taxable_flag;
743     --END of source list
744       g_array_xla_tab (l_new_idx).target_ccid                    := NULL;
745       g_array_xla_tab (l_new_idx).msg_data                       := NULL;
746 
747       --Assign out parameters
748       x_return_status    := C_RET_STS_SUCCESS;
749       x_msg_data         := NULL;
750       x_msg_count        := 0;
751 
752 
753       IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
754          trace
755            ( p_module   => l_log_module
756             ,p_msg      => 'END ' || l_log_module
757             ,p_level    => C_LEVEL_PROCEDURE);
758       END IF;
759 
760    EXCEPTION
764       --If there is a no token message to log
761    WHEN le_fatal_error THEN
762       --Remove all the elements from the PLSQL table
763       g_array_xla_tab .DELETE;
765       IF l_return_msg_name IS NOT NULL
766       THEN
767          --Set it on the stack
768          fnd_message.set_name
769             (
770               application => 'XLA'
771              ,name        => l_return_msg_name
772          );
773          --Add it to the message table
774          fnd_msg_pub.add;
775       END IF;
776       --If there is only one message retrieve it
777       fnd_msg_pub.Count_And_Get
778          (
779            p_count => l_msg_count
780           ,p_data  => l_msg_data
781          );
782       --Put the message on the stack to ensure old Forms detect the error
783       fnd_message.set_encoded
784          (
785            encoded_message => l_msg_data
786          );
787       --Assign out parameters
788       x_msg_count     := l_msg_count;
789       x_msg_data      := l_msg_data;
790       IF l_return_status IS NOT NULL
791       THEN
792          x_return_status := l_return_status;
793       ELSE
794          x_return_status := C_RET_STS_UNEXP_ERROR;
795       END IF;
796    WHEN OTHERS THEN
797       --Remove all the elements from the PLSQL table
798       g_array_xla_tab .DELETE;
799       --Add the standard unexpected error message
800       fnd_msg_pub.Add_Exc_Msg
801          ( p_pkg_name       => C_PACKAGE_NAME
802           ,p_procedure_name => 'write_online_tab '
803          );
804       --If there is only one message retrieve it
805       fnd_msg_pub.Count_And_Get
806          (
807            p_count => l_msg_count
808           ,p_data  => l_msg_data
809          );
810       --Put the message on the stack to ensure all Forms detect the error
811       fnd_message.set_encoded
812          (
813            encoded_message => l_msg_data
814          );
815       --Assign out parameters
816       x_msg_count     := l_msg_count;
817       x_msg_data      := l_msg_data;
818       x_return_status := C_RET_STS_UNEXP_ERROR;
819    END write_online_tab ;
820 
821 
822    PROCEDURE read_online_tab
823     (
824       p_api_version                      IN  NUMBER
825      ,p_source_distrib_id_num_1          IN  NUMBER
826      ,p_source_distrib_id_num_2          IN  NUMBER
827      ,p_source_distrib_id_num_3          IN  NUMBER
828      ,p_source_distrib_id_num_4          IN  NUMBER
829      ,p_source_distrib_id_num_5          IN  NUMBER
830      ,p_account_type_code                IN  VARCHAR2
831      ,x_target_ccid                      OUT NOCOPY NUMBER
832      ,x_concatenated_segments            OUT NOCOPY VARCHAR2
833      ,x_return_status                    OUT NOCOPY VARCHAR2
834      ,x_msg_count                        OUT NOCOPY NUMBER
835      ,x_msg_data                         OUT NOCOPY VARCHAR2
836     )
837    IS
838       TYPE lt_table_V2000         IS TABLE OF VARCHAR2(2000);
839 
840       l_return_status             VARCHAR2(1);
841       l_return_msg_name           VARCHAR2(30);
842 
843       l_msg_count                 NUMBER;
844       l_msg_data                  VARCHAR2(2000);
845 
846       l_found                     BOOLEAN;
847       l_watermark                 NUMBER;
848       l_row_base_rowid            UROWID;
849       l_row_target_ccid           NUMBER;
850       l_row_concatenated_segments VARCHAR2(2000);
851       l_row_msg_count             NUMBER;
852       l_row_msg_data              VARCHAR2(2000);
853       l_table_of_row_errors       lt_table_V2000;
854 
855       l_log_module                VARCHAR2 (2000);
856    BEGIN
857       IF g_log_enabled THEN
858          l_log_module := C_DEFAULT_MODULE||'read_online_tab ';
859       END IF;
860 
861       IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
862          trace
863            ( p_module   => l_log_module
864             ,p_msg      => 'BEGIN ' || l_log_module
865             ,p_level    => C_LEVEL_PROCEDURE);
866       END IF;
867 
868       --Initialize the global message table
869       FND_MSG_PUB.Initialize;
870 
871       --Initialize return status and message local variables
872       l_return_msg_name:= NULL;
873       l_return_status  := NULL;
874 
875       IF NOT FND_API.Compatible_API_Call
876          (
877            p_current_version_number => C_API_VERSION
878           ,p_caller_version_number  => p_api_version
879           ,p_api_name               => 'read_online_tab '
880           ,p_pkg_name               => C_PACKAGE_NAME
881          )
882       THEN
883          RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
884       END IF;
885 
886       --Start the actual logic
887 
888       --p_account_type_code cannot be NULL
889       IF p_account_type_code IS NULL
890       THEN
891          --Assign an error message and a return code of FAILURE
892          l_return_msg_name  := 'XLA_TAB_RD_ROW_ACCT_TYPE_NULL';
893          RAISE le_fatal_error;
894       END IF;
895 
896       l_found     := FALSE;
897 
898       --Get the highest index of the PL/SQL table
899       --Cannot use COUNT since some elements might have been
900       --collected and deleted
901       l_watermark := NVL(g_array_xla_tab .LAST, -1);
902 
903       --Loop on all the rows of the PL/SQL table
904       FOR i IN 0..l_watermark
905       LOOP
906          --If the current row identifiers correspond to the IN parameters
907          IF  g_array_xla_tab .EXISTS(i)
908          AND (   g_array_xla_tab (i).source_distribution_id_num_1 = p_source_distrib_id_num_1
909               OR g_array_xla_tab (i).source_distribution_id_num_1 IS NULL AND p_source_distrib_id_num_1 IS NULL
910              )
911          AND (   g_array_xla_tab (i).source_distribution_id_num_2 = p_source_distrib_id_num_2
912               OR g_array_xla_tab (i).source_distribution_id_num_2 IS NULL AND p_source_distrib_id_num_2 IS NULL
913              )
914          AND (   g_array_xla_tab (i).source_distribution_id_num_3 = p_source_distrib_id_num_3
915               OR g_array_xla_tab (i).source_distribution_id_num_3 IS NULL AND p_source_distrib_id_num_3 IS NULL
916              )
917          AND (   g_array_xla_tab (i).source_distribution_id_num_4 = p_source_distrib_id_num_4
918               OR g_array_xla_tab (i).source_distribution_id_num_4 IS NULL AND p_source_distrib_id_num_4 IS NULL
919              )
920          AND (   g_array_xla_tab (i).source_distribution_id_num_5 = p_source_distrib_id_num_5
921               OR g_array_xla_tab (i).source_distribution_id_num_5 IS NULL AND p_source_distrib_id_num_5 IS NULL
922              )
923          AND g_array_xla_tab (i).account_type_code                = p_account_type_code
924          THEN
925             --Set the element found flag
926             l_found := TRUE;
927 
928             --Assign the target ccid and encoded message to local variables
929             l_row_base_rowid            :=
930                       g_array_xla_tab (i).base_rowid;
931 
932             l_row_target_ccid           :=
933                       g_array_xla_tab (i).target_ccid;
934 
935             l_row_concatenated_segments :=
936                       g_array_xla_tab (i).concatenated_segments;
937 
938             l_row_msg_count             :=
939                       NVL(g_array_xla_tab (i).msg_count, 0);
940 
941             l_row_msg_data              :=
942                       g_array_xla_tab (i).msg_data;
943 
944             IF (C_LEVEL_STATEMENT >= g_log_level) THEN
945                trace
946                   (p_module => l_log_module
947                   ,p_msg      => 'l_row_base_rowid = ' || l_row_base_rowid
948                   ,p_level    => C_LEVEL_STATEMENT);
949                trace
950                   (p_module => l_log_module
951                   ,p_msg      => 'l_row_target_ccid = ' || l_row_target_ccid
952                   ,p_level    => C_LEVEL_STATEMENT);
953                trace
954                   (p_module => l_log_module
955                   ,p_msg      => 'l_row_msg_count = ' || l_row_msg_count
956                   ,p_level    => C_LEVEL_STATEMENT);
957                trace
958                   (p_module => l_log_module
959                   ,p_msg      => 'l_row_msg_data = ' || l_row_msg_data
960                   ,p_level    => C_LEVEL_STATEMENT);
961             END IF;
962 
963             --If the line has not been processed raise an error
964             IF  l_row_target_ccid IS NULL
965             AND l_row_msg_count   = 0
966             THEN
967                l_return_msg_name := 'XLA_TBA_RD_ROW_UNPROCESSED';
968                --Raise a local exception
969                RAISE le_fatal_error;
970             END IF;
971 
972             --remove the element
973             g_array_xla_tab .DELETE(i);
974 
975             --exit the loop
976             EXIT;
977          END IF;
978       END LOOP;
979 
980       --If no match found raise an error
981       IF NOT l_found
982       THEN
983          l_return_msg_name := 'XLA_TBA_RD_ROW_NOT_FOUND';
984          RAISE le_fatal_error;
985       END IF;
986 
987       --If the row has only one error push it on the stack
988       IF l_row_msg_count = 1
989       THEN
990          --push it on the message stack
991          fnd_message.set_encoded
992             (
993               encoded_message => l_row_msg_data
994             );
995          --Add it to the message table
996          fnd_msg_pub.add;
997          --If there is only one message retrieve it
998          fnd_msg_pub.count_and_get
999             (
1000               p_count => l_msg_count
1001              ,p_data  => l_msg_data
1002             );
1003          --Put the message on the stack to ensure old Forms detect the error
1004          fnd_message.set_encoded
1005             (
1006               encoded_message => l_msg_data
1007             );
1008          --Set the return values
1009          l_msg_count     := l_msg_count;
1010          l_msg_data      := l_msg_data;
1011          --Set return status
1012          l_return_status := C_RET_STS_ERROR;
1013       --If the row has more than one error fetch them from the error table
1014       ELSIF l_row_msg_count > 1
1015       THEN
1016          --Read the errors from XLA_TAB_ERRORS_GT and push them on the stack
1017          SELECT xte.msg_data
1018            BULK COLLECT
1019            INTO l_table_of_row_errors
1020            FROM xla_tab_errors_gt xte
1021           WHERE xte.base_rowid = l_row_base_rowid;
1022          --Loop on the errors and push them on the stack
1023          FOR i IN l_table_of_row_errors.FIRST .. l_table_of_row_errors.LAST
1024          LOOP
1025             --Push the current message on the stack
1026             fnd_message.set_encoded
1027             (
1028               encoded_message => l_table_of_row_errors(i)
1029             );
1030             --Add the stacked message to the table
1031             fnd_msg_pub.add;
1032          END LOOP;
1033          --Set the return values
1034          l_msg_count     := l_row_msg_count;
1035          l_msg_data      := NULL;
1036          l_return_status := C_RET_STS_ERROR;
1037       ELSE
1038          --The row has been found and has no errors
1039          l_msg_count     := 0;
1040          l_msg_data      := NULL;
1041          l_return_status := C_RET_STS_SUCCESS;
1042       END IF;
1043 
1044       --Assign out parameters
1045       x_target_ccid           := l_row_target_ccid;
1046       x_concatenated_segments := l_row_concatenated_segments;
1047       x_msg_count             := l_msg_count;
1048       x_msg_data              := l_msg_data;
1049 
1050       IF l_return_status IS NOT NULL
1051       THEN
1052          x_return_status := l_return_status;
1053       ELSE
1054          x_return_status := C_RET_STS_UNEXP_ERROR;
1055       END IF;
1056 
1057       IF (C_LEVEL_PROCEDURE >= g_log_level) THEN
1058          trace
1059            ( p_module   => l_log_module
1060             ,p_msg      => 'END ' || l_log_module
1061             ,p_level    => C_LEVEL_PROCEDURE);
1062       END IF;
1063 
1064    EXCEPTION
1065    WHEN le_fatal_error THEN
1066       --Remove all the elements from the PLSQL table
1067       g_array_xla_tab .DELETE;
1068       --If there is a no token message to log
1069       IF l_return_msg_name IS NOT NULL
1070       THEN
1071          --Set it on the stack
1072          fnd_message.set_name
1073             (
1074               application => 'XLA'
1075              ,name        => l_return_msg_name
1076          );
1077          --Add it to the message table
1078          fnd_msg_pub.add;
1079       END IF;
1080       --If there is only one message retrieve it
1081       fnd_msg_pub.Count_And_Get
1082          (
1083            p_count => l_msg_count
1084           ,p_data  => l_msg_data
1085          );
1086       --Put the message on the stack to ensure old Forms detect the error
1087       fnd_message.set_encoded
1088          (
1089            encoded_message => l_msg_data
1090          );
1091       --Assign out parameters
1092       x_msg_count     := l_msg_count;
1093       x_msg_data      := l_msg_data;
1094       IF l_return_status IS NOT NULL
1095       THEN
1096          x_return_status := l_return_status;
1097       ELSE
1098          x_return_status := C_RET_STS_UNEXP_ERROR;
1099       END IF;
1100    WHEN OTHERS THEN
1101       --Remove all the elements from the PLSQL table
1102       g_array_xla_tab .DELETE;
1103       --Add the standard unexpected error message
1104       fnd_msg_pub.Add_Exc_Msg
1105          ( p_pkg_name       => C_PACKAGE_NAME
1106           ,p_procedure_name => 'read_online_tab '
1107          );
1108       --If there is only one message retrieve it
1109       fnd_msg_pub.Count_And_Get
1110          (
1111            p_count => l_msg_count
1112           ,p_data  => l_msg_data
1113          );
1114       --Put the message on the stack to ensure all Forms detect the error
1115       fnd_message.set_encoded
1116          (
1117            encoded_message => l_msg_data
1118          );
1119       --Assign out parameters
1120       x_msg_count     := l_msg_count;
1121       x_msg_data      := l_msg_data;
1122       x_return_status := C_RET_STS_UNEXP_ERROR;
1123    END read_online_tab ;
1124 
1125 
1126 
1127 --Trace initialization
1128 BEGIN
1129    g_log_level      := FND_LOG.G_CURRENT_RUNTIME_LEVEL;
1130    g_log_enabled    := fnd_log.test
1131                           (log_level  => g_log_level
1132                           ,module     => C_DEFAULT_MODULE);
1133 
1134    IF NOT g_log_enabled  THEN
1135       g_log_level := C_LEVEL_LOG_DISABLED;
1136    END IF;
1137 
1138 
1139 END FUN_XLA_TAB_PKG;