DBA Data[Home] [Help]

PACKAGE BODY: APPS.JA_CN_CFS_GENERATE_PKG

Source


1 PACKAGE BODY JA_CN_CFS_GENERATE_PKG AS
2 --$Header: JACNCGEB.pls 120.7.12010000.2 2008/10/28 06:24:39 shyan ship $
3 --+=======================================================================+
4 --|               Copyright (c) 2006 Oracle Corporation
5 --|                       Redwood Shores, CA, USA
6 --|                         All rights reserved.
7 --+=============a==========================================================
8 --| FILENAME
9 --|     JACNCGEB.pls
10 --|
11 --| DESCRIPTION
12 --|
13 --|   This package is the main program for 'Cash Flow Statement - Generation'
14 --|
15 --|
16 --| PROCEDURE LIST
17 --|   Submit Requests
18 --|
19 --|
20 --| HISTORY
21 --|   24-Mar-2006     Donghai Wang Created
22 --|   1-Sep-2008      Chaoqun Wu Updated for CNAO Enhancement
23 --|
24 --+======================================================================*/
25 
26 l_module_prefix   VARCHAR2(100):='JA_CN_CFS_GENERATE_PKG';
27 
28 --==========================================================================
29 --  PROCEDURE NAME:
30 --
31 --    Submit_Requests               Public
32 --
33 --  DESCRIPTION:
34 --
35 --   	The 'Submit_Requests' procedure is responsible for submit the following
36 --    four concurrent programs in turn to generate the final output file in 'TXT'
37 --    format for CNAO.
38 --       1. Cash Flow Statement - FSG
39 --       2. Cash Flow Statement - Calculation
40 --       3. Cash Flow Statement - Combination
41 --
42 --  PARAMETERS:
43 --      In: p_legal_entity_id           Identifier of legal entity
44 --          p_ledger_id             Identifier of GL set of book, a required
45 --                                      parameter for FSG report
46 --          p_coa_id                    Chart of Accounts Id, a required parameter
47 --                                      for FSG report
48 --          p_adhoc_prefix              Ad hoc prefix for FSG report, a required
49 --                                      parameter for FSG report
50 --          p_industry                  Industry with constant value 'C' for
51 --                                      now, a required parameter for FSG report
52 --          p_id_flex_code              ID flex code, a required parameter for
53 --                                      FSG report
54 --          p_report_id                 Identifier of FSG report
55 --          p_period_name               GL period Name
56 --          p_axis_set_id               Identifier of FSG Row Set
57 --          p_colset_id                 Identifier of FSG Column Set, a required
58 --                                      parameter for FSG
59 --          p_rounding_option           Rounding option for amount in Cash Flow
60 --                                      statement
61 --          p_segment_override          Segment override for FSG report
62 --                                      flow statement calculation
63 --          p_accounting_date           Accounting date
64 --          p_parameter_set_id          Parameter set id, a required parameter
65 --                                      for FSG report
66 --          p_max_page_length           Maximum page length
67 --          p_balance_type              Type of balance, available value is
68 --                                      'YTD/QTD/PTD'. a required parameter for
69 --                                       FSG report
70 --          p_internal_trx_flag         To indicate if intercompany transactions
71 --                                      should be involved in amount calculation
72 --                                      of cash flow statement.
73 --          p_xml_template_language     Template language of Cash Flow Statement
74 --          p_xml_template_territory    Template territory of Cash Flow Statement
75 --          p_xml_output_format         Output format of Cash Flow Statement
76 --          p_source_charset            Characterset of input file for characterset
77 --                                      conversion
78 --          p_destination_charset       Characterset of output file for characterset
79 --                                      conversion
80 --          p_source_separator          Separater between fields in input file
81 --                                      for conversion
82 --          p_destination_filename      file name after change
83 --
84 --  DESIGN REFERENCES:
85 --     CNAO_Cashflow_Statement_Generation_TD.doc
86 --
87 --  CHANGE HISTORY:
88 --
89 --      24-Mar-2006     Donghai Wang Created
90 --
91 --===========================================================================
92 --the parameter is updated by lyb,because the rg30rfsg program is changed.
93 PROCEDURE Submit_Requests
94 (p_legal_entity_id         IN         NUMBER
95  ,p_ledger_id              IN         NUMBER
96  ,P_DATA_ACCESS_SET_ID     IN         NUMBER--added by lyb
97  ,p_coa_id                 IN         NUMBER
98  ,p_adhoc_prefix           IN         VARCHAR2
99  ,p_industry               IN         VARCHAR2
100  ,p_id_flex_code           IN         VARCHAR2
101  ,p_ledger_name            IN         VARCHAR2
102  ,p_report_id              IN         NUMBER
103  ,p_axis_set_id            IN         NUMBER
104  ,p_colset_id              IN         NUMBER
105  ,p_period_name            IN         VARCHAR2
106  ,p_currency_code          IN         VARCHAR2
107  ,p_rounding_option        IN         VARCHAR2
108  ,p_segment_override       IN         VARCHAR2
109  ,p_content_set_id         IN      NUMBER
110  ,P_ROW_ORDER_ID           IN      NUMBER
111  ,P_REPORT_DISPLAY_SET_ID  IN      NUMBER
112  ,p_OUTPUT_OPTION          IN         VARCHAR2
113  ,p_EXCEPTIONS_FLAG        IN         VARCHAR2
114  ,p_MINIMUM_DISPLAY_LEVEL  IN      NUMBER
115  ,p_accounting_date        IN      varchar2
116  ,p_parameter_set_id       IN      NUMBER
117  ,P_PAGE_LENGTH            IN      NUMBER
118  ,p_SUBREQUEST_ID          IN      NUMBER
119  ,P_APPL_NAME              IN         VARCHAR2
120 
121 ,p_balance_type            IN         VARCHAR2
122 --,p_internal_trx_flag       IN         VARCHAR2
123 ,p_xml_template_language   IN         VARCHAR2
124 ,p_xml_template_territory  IN         VARCHAR2
125 ,p_xml_output_format       IN         VARCHAR2
126 ,p_source_charset          IN         VARCHAR2
127 ,p_destination_charset     IN         VARCHAR2
128 ,p_destination_filename    IN         VARCHAR2
129 ,p_source_separator        IN         VARCHAR2
130 )
131 IS
132 l_legal_entity_id         NUMBER(15)                              :=p_legal_entity_id;
133 l_legal_entity_name       hr_all_organization_units_tl.name%TYPE;
134 l_currency_code           fnd_currencies.currency_code%TYPE;
135 l_reqid_fsg               NUMBER;  --Request id for 'Program - Run Financial Statement Generator'
136 l_reqid_cal               NUMBER;  --Request id for 'Cash flow statement - Calculation'
137 l_reqid_fsg_cfs           NUMBER;  --Request id for the FSG - CFS report that automatically submitted by
138                                  --'Program - Run Financial Statement Generator'
139 l_fsg_req_phase           fnd_lookup_values.meaning%TYPE;
140 l_fsg_req_status          fnd_lookup_values.meaning%TYPE;
141 l_fsg_req_status_code     fnd_lookup_values.lookup_code%TYPE;
142 
143 l_fsg_req_phase_cfs       fnd_lookup_values.meaning%TYPE;
144 l_fsg_req_status_cfs      fnd_lookup_values.meaning%TYPE;
145 l_fsg_req_status_cfs_code fnd_lookup_values.lookup_code%TYPE;
146 
147 l_cal_req_phase           fnd_lookup_values.meaning%TYPE;
148 l_cal_req_status          fnd_lookup_values.meaning%TYPE;
149 l_cal_req_status_code     fnd_lookup_values.lookup_code%TYPE;
150 
151 l_reqid_comb              NUMBER;  -- Request id for the 'Cash flow statement - Combination'
152 
153 
154 l_comb_req_phase          fnd_lookup_values.meaning%TYPE;
155 l_comb_req_status         fnd_lookup_values.meaning%TYPE;
156 l_comb_req_status_code    fnd_lookup_values.lookup_code%TYPE;
157 
158 l_error_flag              VARCHAR2(1);
159 l_error_status            BOOLEAN;
160 
161 l_waiting_interval        NUMBER   :=10;
162 l_dev_phase               VARCHAR2(100);
163 l_dev_status              VARCHAR2(100);
164 l_message                 VARCHAR2(1000);
165 l_xml_layout              BOOLEAN;
166 
167 l_reqid_cvt               NUMBER;
168 l_cvt_req_status          VARCHAR2(100);
169 
170 l_reqid_chg               NUMBER;
171 l_chg_req_status          VARCHAR2(100);
172 
173 L_COMPANY_NAME            VARCHAR2(100);
174 
175 
176 
177 --Cursor to get request_id for CFS FSG xml output
178 CURSOR c_reqid_fsg_cfs
179 IS
180 SELECT
181   request_id
182 FROM
183   fnd_concurrent_requests
184 WHERE parent_request_id=l_reqid_fsg;
185 
186 --Cursor to get functional currency code of current set of book
187 --this cursor is updated by lyb, get functional currency code from gl_ledgers
188 CURSOR c_func_currency_code
189 IS
190 SELECT
191   currency_code
192 FROM
193   gl_ledgers
194 WHERE
195   ledger_id=p_ledger_id;
196 
197 --Cursor to get legal entity name
198 CURSOR c_legal_entity
199 IS
200 SELECT
201   name
202 FROM
203   hr_legal_entities
204 WHERE organization_id=l_legal_entity_id;
205 
206 CURSOR C_COMPANY_NAME
207 IS
208 SELECT COMPANY_NAME
209 INTO L_COMPANY_NAME
210 FROM JA_CN_SYSTEM_PARAMETERS_ALL
211 WHERE LEGAL_ENTITY_ID= l_legal_entity_id;
212 
213 
214 l_dbg_level           NUMBER            :=FND_LOG.G_Current_Runtime_Level;
215 l_proc_level          NUMBER            :=FND_LOG.Level_Procedure;
216 l_proc_name           VARCHAR2(100)     :='Submit_Requests';
217 
218 BEGIN
219 
220 --log for debug
221   IF (l_proc_level >= l_dbg_level)
222   THEN
223     FND_LOG.String(l_proc_level
224                   ,l_module_prefix||'.'||l_proc_name||'.begin'
225                   ,'Enter procedure'
226                   );
227 
228     FND_LOG.String(l_proc_level
229                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
230                   ,'p_legal_entity_id '||p_legal_entity_id
231                   );
232 
233     FND_LOG.String(l_proc_level
234                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
235                   ,'p_ledger_id '||p_ledger_id
236                   );
237     FND_LOG.String(l_proc_level
238                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
239                   ,'p_coa_id '||p_coa_id
240                   );
241     FND_LOG.String(l_proc_level
242                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
243                   ,'p_adhoc_prefix '||p_adhoc_prefix
244                   );
245     FND_LOG.String(l_proc_level
246                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
247                   ,'p_industry '||p_industry
248                   );
249     FND_LOG.String(l_proc_level
250                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
251                   ,'p_id_flex_code '||p_id_flex_code
252                   );
253     FND_LOG.String(l_proc_level
254                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
255                   ,'p_report_id '||p_report_id
256                   );
257     FND_LOG.String(l_proc_level
258                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
259                   ,'p_period_name '||p_period_name
260                   );
261     FND_LOG.String(l_proc_level
262                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
263                   ,'p_axis_set_id '||p_axis_set_id
264                   );
265     FND_LOG.String(l_proc_level
266                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
267                   ,'p_colset_id '||p_colset_id
268                   );
269 
270     FND_LOG.String(l_proc_level
271                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
272                   ,'p_rounding_option '||p_rounding_option
273                   );
274     FND_LOG.String(l_proc_level
275                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
276                   ,'p_segment_override '||p_segment_override
277                   );
278     FND_LOG.String(l_proc_level
279                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
280                   ,'p_accounting_date '||p_accounting_date
281                   );
282     FND_LOG.String(l_proc_level
283                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
284                   ,'p_parameter_set_id '||p_parameter_set_id
285                   );
286 
287     FND_LOG.String(l_proc_level
288                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
289                   ,'P_PAGE_LENGTH '||P_PAGE_LENGTH
290                   );
291     FND_LOG.String(l_proc_level
292                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
293                   ,'p_balance_type '||p_balance_type
294                   );
295     FND_LOG.String(l_proc_level
296                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
297                   ,'p_xml_template_language  '||p_xml_template_language
298                   );
299     FND_LOG.String(l_proc_level
300                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
301                   ,'p_xml_template_territory  '||p_xml_template_territory
302                   );
303     FND_LOG.String(l_proc_level
304                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
305                   ,'p_xml_output_format  '||p_xml_output_format
306                   );
307    FND_LOG.String(l_proc_level
308                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
309                   ,'p_source_charset '||p_source_charset
310                   );
311 
312     FND_LOG.String(l_proc_level
313                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
314                   ,'p_destination_charset '||p_destination_charset
315                   );
316 
317     FND_LOG.String(l_proc_level
318                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
319                   ,'p_source_separator '||p_source_separator
320                   );
321 
322     FND_LOG.String(l_proc_level
323                   ,l_module_prefix||'.'||l_proc_name||'.parameters'
324                   ,'p_destination_filename '||p_destination_filename
325                   );
326   END IF;  --(l_proc_level >= l_dbg_level)
327   l_error_flag:='N';
328 
329   --To get functional currency code of current set of book
330   OPEN  c_func_currency_code;
331   FETCH c_func_currency_code INTO l_currency_code;
332   CLOSE c_func_currency_code;
333 
334   --To get name for current legal entity
335   OPEN c_legal_entity;
336   FETCH c_legal_entity INTO l_legal_entity_name;
337   CLOSE c_legal_entity;
338 
339   OPEN C_COMPANY_NAME;
340   FETCH C_COMPANY_NAME INTO L_COMPANY_NAME;
341   CLOSE C_COMPANY_NAME;
342 
343   --Submit the first concurrent program 'Cash Flow Statement - FSG',which
344   --will automatically submit another request for the CFS report to generate XML file
345   l_reqid_fsg:=FND_REQUEST.Submit_Request( 'SQLGL'
346                                          ,'RGRARG'
347                                          ,''
348                                          ,''
349                                          ,FALSE
350                                          ,P_DATA_ACCESS_SET_ID
351                                          ,p_coa_id
352                                          ,p_adhoc_prefix
353                                          ,p_industry
354                                          ,p_id_flex_code
355                                          ,p_ledger_name
356                                          ,p_report_id
357                                          ,p_axis_set_id
358                                          ,p_colset_id
359                                          ,p_period_name
360                                          ,p_currency_code
361                                          ,p_rounding_option
362                                          ,p_segment_override
363                                          ,p_content_set_id
364                                          ,P_ROW_ORDER_ID
365                                          ,P_REPORT_DISPLAY_SET_ID
366                                          ,p_OUTPUT_OPTION
367                                          ,p_EXCEPTIONS_FLAG
368                                          ,p_MINIMUM_DISPLAY_LEVEL
369                                          ,p_ACCOUNTING_DATE
370                                          ,p_parameter_set_id
371                                          ,P_PAGE_LENGTH
372                                          ,p_SUBREQUEST_ID
373                                          ,P_APPL_NAME
374                                          ,L_COMPANY_NAME,
375                                  '', '', '', '', '',
376                                  '', '', '', '', '', '', '', '', '', '',
377                                  '', '', '', '', '', '', '', '', '', '',
378                                  '', '', '', '', '', '', '', '', '', '',
379                                  '', '', '', '', '', '', '', '', '', '',
380                                  '', '', '', '', '', '', '', '', '', '',
381                                  '', '', '', '', '', '', '', '', '', '',
382                                  '', '', '', '', '', '', '', '', '', ''
383                                          );
384 
385            IF (p_OUTPUT_OPTION = 'Y') THEN
386             UPDATE 	FND_CONCURRENT_REQUESTS
387             SET
388               OUTPUT_FILE_TYPE = 'XML'
389             WHERE
390               REQUEST_ID = l_reqid_fsg;
391          END IF;
392        COMMIT;
393 
394   --Waiting for the 'Cash Flow Statement - FSG' completed, and then retrive the sub-request id
395   --from the table 'fnd_concurrent_requests' for the FSG - CFS report.
396   IF l_reqid_fsg<>0
397   THEN
398 
399 
400     IF FND_CONCURRENT.Wait_For_Request(request_id   => l_reqid_fsg
401                                       ,interval     => l_waiting_interval
402                                       ,phase        => l_fsg_req_phase
403                                       ,status       => l_fsg_req_status
404                                       ,dev_phase    => l_dev_phase
405                                       ,dev_status   => l_dev_status
406                                       ,message      => l_message
407                                       )
408     THEN
409 
410       --To get lookup code for current status
411       SELECT
412         lookup_code
413       INTO
414         l_fsg_req_status_code
415       FROM
416         fnd_lookup_values
417       WHERE lookup_type = 'CP_STATUS_CODE'
418         AND view_application_id=0
419         AND security_group_id=0
420         AND meaning=l_fsg_req_status
421         AND enabled_flag='Y'
422         AND language = USERENV('LANG');
423 
424       --To judge if the Program - Run Financial Statement Generator' has been
425       --completed successfully.
426 
427       --Completed with 'Normal'
428       IF l_fsg_req_status_code='C'
429       THEN
430        null;
431       --Completed with 'Warning'
432       ELSIF l_fsg_req_status_code='G'
433       THEN
434         l_error_flag:='W';
435       --Completed with 'Error'
436       ELSIF l_fsg_req_status_code='E'
437       THEN
438         l_error_flag:='E';
439       END IF; --l_fsg_req_status_code='C'
440     END IF;   -- FND_CONCURRENT.Wait_For_Request  ...
441   ELSE
442     l_error_flag:='E';
443   END IF; --l_reqid_fsg<>0
444 
445   --if FSG xml output request for cfs is successfully completed, then submit the 'Cash flow statement- Calculation'
446   --program
447 
448 
449   IF nvl(l_reqid_fsg,0)<>0 AND l_error_flag='N'
450   THEN
451         --Submit the second concurrent program 'Cash flow statement - Calculation'
452         --this parameter is changed by lyb, add p_coa_id and delete p_internal_trx_flag
453         l_reqid_cal:=FND_REQUEST.Submit_Request(application  => 'JA'
454                                                ,program      => 'JACNCFSN'
455                                                ,argument1    => p_legal_entity_id
456                                                ,argument2    => p_ledger_id
457                                                ,argument3    => p_period_name
458                                                ,argument4    => p_axis_set_id
459                                                ,argument5    => p_rounding_option
460                                                ,argument6    => p_balance_type
461                                               -- ,argument7    => p_internal_trx_flag
462                                                ,argument7    => p_coa_id
463                                                ,argument8    => p_segment_override --Added for CNAO Enhancement
464                                                );
465         COMMIT;
466         --Waiting for the 'Cash flow statement - Calculation' successfully completed and then submit
467         --'Cash Flow Statement - Combination' program
468         IF l_reqid_cal<>0
469         THEN
470           IF FND_CONCURRENT.Wait_For_Request(request_id   => l_reqid_cal
471                                             ,interval     => l_waiting_interval
472                                             ,phase        => l_cal_req_phase
473                                             ,status       => l_cal_req_status
474                                             ,dev_phase    => l_dev_phase
475                                             ,dev_status   => l_dev_status
476                                             ,message      => l_message
477                                             )
478           THEN
479 
480 
481 
482             --Submit the third concurrent program 'Cash flow statement - Combination' after the
483             --'Cash flow statement - Calculation' succesfully
484 
485             --To get lookup code for current status
486             SELECT
487               lookup_code
488             INTO
489               l_cal_req_status_code
490             FROM
491               fnd_lookup_values
492             WHERE lookup_type = 'CP_STATUS_CODE'
493               AND view_application_id=0
494               AND security_group_id=0
495               AND meaning=l_cal_req_status
496               AND enabled_flag='Y'
497               AND language = USERENV('LANG');
498 
499             --Completed with successful
500             IF l_cal_req_status_code='C'
501             THEN
502               --Submit the third concurrent program 'Cash flow statement - Combination'
503 
504               --As output of Cash flow statement - Combination' is in XML format and
505               --need to associate with XML publisher template automatically,
506               --it is required to set layout before submit the program, bug 5168016
507 
508                l_xml_layout := FND_REQUEST.Add_Layout(template_appl_name  => 'JA'
509                                                      ,template_code       => 'JACNCFSC'
510                                                      ,template_language   => p_xml_template_language --'zh' ('en')
511                                                      ,template_territory  => p_xml_template_territory--'00' ('US')
512                                                      ,output_format       => p_xml_output_format --'ETEXT' (
513                                             );
514 
515 
516               l_reqid_comb:=FND_REQUEST.Submit_Request(application => 'JA'
517                                                       ,program     => 'JACNCFSC'
518                                                       ,argument1   => l_reqid_fsg
519                                                       ,argument2   => l_reqid_cal
520                                                       );
521               COMMIT;
522               --Waiting for the 'Cash flow statement - Combination' completed
523               --get its status
524 
525               IF l_reqid_comb<>0
526               THEN
527 
528                 IF FND_CONCURRENT.Wait_For_Request(request_id   => l_reqid_comb
529                                                   ,interval     => l_waiting_interval
530                                                   ,phase        => l_comb_req_phase
531                                                   ,status       => l_comb_req_status
532                                                   ,dev_phase    => l_dev_phase
533                                                   ,dev_status   => l_dev_status
534                                                   ,message      => l_message
535                                                   )
536                 THEN
537 
538                   --To get lookup code for current status
539                   SELECT
540                     lookup_code
541                   INTO
542                     l_comb_req_status_code
543                   FROM
544                     fnd_lookup_values
545                   WHERE lookup_type = 'CP_STATUS_CODE'
546                     AND view_application_id=0
547                     AND security_group_id=0
548                     AND meaning=l_comb_req_status
549                     AND enabled_flag='Y'
550                     AND language = USERENV('LANG');
551 
552                   --Completed with Normal
553                   IF l_comb_req_status_code='C'
554                   THEN
555                     --Submit characrter set conversion program
556                     --to convert charaterset of output file
557                     JA_CN_UTILITY.Submit_Charset_Conversion(p_xml_request_id      => l_reqid_comb
558                                                            ,p_source_charset      => p_source_charset
559                                                            ,p_destination_charset => p_destination_charset
560                                                            ,p_source_separator    => p_source_separator
561                                                            ,x_charset_request_id  => l_reqid_cvt
562                                                            ,x_result_flag         => l_cvt_req_status
563                                                            );
564                     IF l_cvt_req_status='Success'
565                     THEN
566                       --Submit "Change File Name" concurrent program
567                       --to change name of output file
568                       JA_CN_UTILITY.Change_Output_Filename(p_xml_request_id       => l_reqid_comb
569                                                           ,p_destination_charset  => p_destination_charset
570                                                           ,p_destination_filename => p_destination_filename
571                                                           ,x_filename_request_id  => l_reqid_chg
572                                                           ,x_result_flag          => l_chg_req_status
573                                                           );
574                       IF l_chg_req_status='Success'
575                       THEN
576                         NULL;
577                       ELSIF  l_chg_req_status='Warning'
578                       THEN
579                         l_error_flag:='W';
580                       ELSIF  l_chg_req_status='Error'
581                       THEN
582                         l_error_flag:='E';
583                       END IF;  --l_chg_req_status='Success'
584 
585 
586                     ELSIF l_cvt_req_status='Warning'
587                     THEN
588                       l_error_flag:='W';
589                     ELSIF l_cvt_req_status='Error'
590                     THEN
591                       l_error_flag:='E';
592                     END IF; --l_cvt_req_status='Success'
593 
594                   --Completed with 'Warning'
595                   ELSIF l_comb_req_status_code='G'
596                   THEN
597                     l_error_flag:='W';
598                   --Completed with 'Error'
599                   ELSIF l_comb_req_status_code='E'
600                   THEN
601                     l_error_flag:='E';
602                   END IF; --l_comb_req_status_code='C'
603                 END IF; --FND_CONCURRENT.Wait_For_Request(request_id   => l_reqid_comb
604               ELSE
605                 l_error_flag:='E';
606               END IF; --l_reqid_comb<>0
607 
608             --Completed with 'Warning'
609             ELSIF l_cal_req_status_code='G'
610             THEN
611               l_error_flag:='W';
612             --Completed with 'Error'
613             ELSIF l_cal_req_status_code='E'
614             THEN
615               l_error_flag:='E';
616             END IF; --l_cal_req_status_code='C'
617 
618           END IF; --FND_CONCURRENT.Wait_For_Request(request_id   => l_reqid_cal
619 
620         ELSE
621           l_error_flag:='E';
622         END IF; --l_reqid_cal<>0
623 
624   END IF; --nvl(l_reqid_fsg_cfs,0)<>0 AND l_error_flag='N'
625 
626 
627 
628 
629 
630   --If any of above four concurrent porgrams is Warning/Failed, set current generation
631   --program to status 'Warning'/'Error' accordingly.
632   IF l_error_flag='W'
633   THEN
634     l_error_status:=FND_CONCURRENT.Set_Completion_Status(status => 'WARNING'
635                                                         ,message => ''
636                                                         );
637   ELSIF l_error_flag='E'
638   THEN
639     l_error_status:=FND_CONCURRENT.Set_Completion_Status(status => 'ERROR'
640                                                         ,message => ''
641                                                         );
642   END IF;  --l_error_flag='W'
643 
644   --log for debug
645   IF ( l_proc_level >= l_dbg_level)
646   THEN
647     FND_LOG.STRING(l_proc_level
648                   ,l_module_prefix||'.'||l_proc_name
649                   ,l_error_flag
650                   );
651     FND_LOG.STRING(l_proc_level
652                   ,l_module_prefix||'.'||l_proc_name||'.end'
653                   ,'Exit procedure'
654                   );
655   END IF;  --( l_proc_level >= l_dbg_level )
656 
657 EXCEPTION
658 WHEN OTHERS THEN
659 
660   IF (l_proc_level >= l_dbg_level)
661   THEN
662     FND_LOG.STRING(l_proc_level
663                   ,l_module_prefix||'.'||l_proc_name||'EXCEPTION'
664                   ,l_error_flag
665                   );
666     FND_LOG.String(l_proc_level
667                   ,l_module_prefix||'.'||l_proc_name||'. Other_Exception '
668                   ,SQLCODE||':'||SQLERRM
669                   );
670   END IF;  --(l_proc_level >= l_dbg_level)
671 
672 END Submit_Requests;
673 END JA_CN_CFS_GENERATE_PKG;
674