DBA Data[Home] [Help]

PACKAGE BODY: APPS.GL_PERIOD_STATUS_SYNC_PUB

Source


1 PACKAGE BODY gl_period_status_sync_pub AS
2 /* $Header: glpssysb.pls 120.4.12010000.1 2009/12/16 11:56:23 sommukhe noship $ */
3 /*================================================================================|
4 | FILENAME                                                                        |
5 |    glpssysb.pls                                                                 |
6 |                                                                                 |
7 | PACKAGE NAME                                                                    |
8 |    GL_PERIOD_STATUS_SYNC_PUB                                                    |
9 |                                                                                 |
10 | DESCRIPTION                                                                     |
11 |     This is a GL Period Synchronization which is used to Open a GL period for   |
12 |     Primary and its Secondary and Reporting Ledgers with in a gieven date range.|
13 |     Also this Program used to close the period which is beyond the date range   |
14 |     if the periods already opened.                                              |
15 |                                                                                 |
16 |     In case of any error in any stage of the program will stop the process. And |
17 |     error will be notified to AIA through business event.                       |
18 |                                                                                 |
19 |     Existing concurrent Program used to change the Period statuses.             |
20 |                                                                                 |
21 |     This is a package Body                                                      |
22 |                                                                                 |
23 |                                                                                 |
24 | SUB PROGRAMS                                                                    |
25 | ------------                                                                    |
26 | PROCEDURE period_status_sync                                                    |
27 |                                                                                 |
28 | PARAMETER DESCRIPTION                                                           |
29 | ---------------------                                                           |
30 | p_ledger_short_name   IN  short_name from gl_ledgers table.                     |
31 | p_start_date          IN      start_date of the period from gl_period_statuses  |
32 | p_end_date            IN  end_date of the period from gl_period_statuses        |
33 | errbuf                OUT      Default out parameter to capture error message   |
34 | retcode               OUT      Default out parameter to capture error code      |
35 | x_return_status       OUT  Default out parameter to capture status              |
36 | HISTORY                                                                         |
37 | -------                                                                         |
38 | 25-JUN-08  KARTHIK M P    Created                                               |
39 | 15-SEP-08  Vamshidhar G   Modified for the Validations.                         |
40 | 06-OCT-08  Vamshidhar G   Fix for the Bug No 7439499 and 7453185.               |
41 | 24-OCT-08  Vamshidhar G   Fix for the Bug No 7454214 and 7453834.               |
42 +=================================================================================*/
43    PROCEDURE period_status_sync (
44       errbuf                OUT NOCOPY      VARCHAR2,
45       retcode               OUT NOCOPY      VARCHAR2,
46       x_return_status       OUT NOCOPY      VARCHAR2,
47       p_ledger_short_name   IN              VARCHAR2,
48       p_start_date          IN              DATE,
49       p_end_date            IN              DATE
50    )
51    IS
52 ----------------------------------------------------------------------------------
53 ---------------------------****Declaring Cursor****-------------------------------
54 ----------------------------------------------------------------------------------
55 
56       --Cursor to get Primary and its Secondary and ALC ledgers
57       CURSOR c_get_ledgers_rec (
58          c_ledger_short_name           VARCHAR2,
59          c_object_type_code            VARCHAR2,
60          c_application_id              NUMBER,
61          c_relationship_enabled_flag   VARCHAR2
62       )
63       IS
64          SELECT *
65            FROM gl_ledgers
66           WHERE ledger_id IN (
67                    SELECT gll2.ledger_id
68                      FROM gl_ledgers gll1,
69                           gl_ledgers gll2,
70                           gl_ledger_relationships glrs
71                     WHERE gll1.short_name = c_ledger_short_name
72                       AND glrs.primary_ledger_id = gll1.ledger_id
73                       AND gll2.object_type_code = c_object_type_code
74                       AND glrs.target_ledger_id = gll2.ledger_id
75                       AND glrs.application_id = c_application_id
76                       AND glrs.relationship_enabled_flag =
77                                                    c_relationship_enabled_flag);
78 
79       --Cursor to get the periods for open
80       CURSOR c_get_period_open_rec (
81          c_application_id   NUMBER,
82          c_closing_status   VARCHAR2,
83          c_ledger_id        NUMBER,
84          c_start_date       DATE,
85          c_end_date         DATE
86       )
87       IS
88          SELECT *
89            FROM gl_period_statuses
90           WHERE application_id = c_application_id                        --101
91             AND closing_status <> c_closing_status                       --'O'
92             AND ledger_id = c_ledger_id
93             AND start_date >= c_start_date
94             AND end_date <= c_end_date;
95 
96       --Cursor to get the periods for closing
97       CURSOR c_get_period_close_rec (
98          c_application_id   NUMBER,
99          c_closing_status   VARCHAR2,
100          c_ledger_id        NUMBER,
101          c_start_date       DATE,
102          c_end_date         DATE
103       )
104       IS
105          SELECT *
106            FROM gl_period_statuses
107           WHERE application_id = c_application_id
108             AND closing_status = c_closing_status
109             AND ledger_id = c_ledger_id
110             AND (start_date < c_start_date OR end_date > c_end_date);
111 
112       --Cursor to get the Period Status After Submit Request
113       CURSOR c_check_open_status_rec (
114          c_ledger_id        IN   NUMBER,
115          c_application_id   IN   NUMBER,
116          c_period_name      IN   VARCHAR2
117       )
118       IS
119          SELECT closing_status
120            FROM gl_period_statuses
121           WHERE ledger_id = c_ledger_id
122             AND application_id = c_application_id
123             AND period_name = c_period_name;
124 
125       --Cursor to fetch the Ledger Short Name
126       CURSOR c_get_short_name
127       IS
128          SELECT 'Y'
129            FROM DUAL
130           WHERE EXISTS (SELECT short_name
131                           FROM gl_ledgers
132                          WHERE short_name = p_ledger_short_name);
133 
134       --Cursor to fetch the start_date
135       CURSOR c_start_date (
136          c_ledger_short_name   IN   VARCHAR2,
137          c_application_id      IN   NUMBER,
138          c_start_date          IN   DATE
139       )
140       IS
141          SELECT 'Y'
142            FROM DUAL
143           WHERE EXISTS (
144                    SELECT 1
145                      FROM gl_period_statuses gps, gl_ledgers gl
146                     WHERE gl.ledger_id = gps.ledger_id
147                       AND gps.application_id = c_application_id
148                       AND gl.short_name = c_ledger_short_name
149                       AND gps.start_date = c_start_date);
150 
151       --Cursor to fetch the end_date
152       CURSOR c_end_date (
153          c_ledger_short_name   IN   VARCHAR2,
154          c_application_id      IN   NUMBER,
155          c_end_date            IN   DATE
156       )
157       IS
158          SELECT 'Y'
159            FROM DUAL
160           WHERE EXISTS (
161                    SELECT 1
162                      FROM gl_period_statuses gps, gl_ledgers gl
163                     WHERE gl.ledger_id = gps.ledger_id
164                       AND gps.application_id = c_application_id
165                       AND gl.short_name = c_ledger_short_name
166                       AND gps.end_date = c_end_date);
167 
168 --------------------------------------------------
169 --------****Declaring Local Variables****---------
170 --------------------------------------------------
171 
172       --Declaring Local Variables
173       l_request_id             NUMBER (15);
174       l_conc_request_id        NUMBER (15);
175       l_chart_of_accounts_id   NUMBER (15);
176       l_ledger_name            VARCHAR2 (30);
177       l_ledger_short_name      VARCHAR2 (1);
178       l_access_set_id          NUMBER (15);
179       l_phase                  VARCHAR2 (240);
180       l_status                 VARCHAR2 (240);
181       l_dev_phase              VARCHAR2 (240);
182       l_dev_status             VARCHAR2 (240);
183       l_message                VARCHAR2 (1500);
184       l_wait_for_request       BOOLEAN;
185       l_period_name            VARCHAR2 (30);
186       l_message_ps             VARCHAR2 (100);
187       l_ledger_id              NUMBER;
188       l_user_id                NUMBER;
189       l_resp_id                NUMBER;
190       l_apps_id                NUMBER;
191       l_closing_status         VARCHAR2 (1);
192       l_con_status             VARCHAR2 (30);
193       l_process_status_msg     VARCHAR2 (1000);
194       l_be_message             VARCHAR2 (1000);
195       l_business_event_type    VARCHAR2 (30);
196       l_rec_type               gl_ledgers%ROWTYPE;
197       l_start_date             VARCHAR2 (1);
198       l_end_date               VARCHAR2 (1);
199    BEGIN
200 --Initializing Concurrent Parameteres
201       x_return_status := 'S';
202       retcode := 0;
203 
204       OPEN c_get_short_name;
205 
206       FETCH c_get_short_name
207        INTO l_ledger_short_name;
208 
209       IF l_ledger_short_name = 'Y'
210       THEN
211          IF p_start_date < p_end_date
212          THEN
213             fnd_file.put_line (fnd_file.LOG, '');
214             fnd_file.put_line
215                (fnd_file.LOG,
216                 '+---------------------------------------------------------------------------+'
217                );
218             fnd_file.put_line
219                (fnd_file.LOG,
220                 '+--------------------****GL OPEN PERIOD SYNCHRONIZATION****-----------------+'
221                );
222             fnd_file.put_line
223                (fnd_file.LOG,
224                 '+---------------------------------------------------------------------------+'
225                );
226             fnd_file.put_line (fnd_file.LOG, '');
227 --Difinitions
228             fnd_file.put_line (fnd_file.LOG, 'DEFINITIONS');
229             fnd_file.put_line (fnd_file.LOG, '-----------');
230             fnd_file.put_line
231                       (fnd_file.LOG,
232                        '  GLPSL : GL PERIOD STATUS SYNCHRONIZATION LOG(LINES)'
233                       );
234             fnd_file.put_line
235                            (fnd_file.LOG,
236                             '  GLPSL : GL PERIOD STATUS SYNCHRONIZATION ERROR'
237                            );
238             fnd_file.put_line (fnd_file.LOG, 'RESP ID : RESPONSIBILITY ID');
239             fnd_file.put_line (fnd_file.LOG, 'APPS ID : APPLICATION ID');
240             fnd_file.put_line (fnd_file.LOG, '      C : CLOSED');
241             fnd_file.put_line (fnd_file.LOG, '      O : OPENED');
242             fnd_file.put_line (fnd_file.LOG, '');
243             fnd_file.put_line (fnd_file.LOG, 'GLPSL: Program Begins...');
244             fnd_file.put_line (fnd_file.LOG, '');
245 --Find the Concurrent Request Id for Period Synchronization
246             fnd_file.put_line
247                (fnd_file.LOG,
248                 'GLPSL: Get The Concurrent request ID for Period Synchronization....'
249                );
250             l_conc_request_id := fnd_global.conc_request_id;
251             fnd_file.put_line (fnd_file.LOG,
252                                   'GLPSL: Concurrent Request ID = '
253                                || l_conc_request_id
254                               );
255 --------------------------------------------------
256 ------****Initializing Global Parameters****------
257 --------------------------------------------------
258             fnd_file.put_line (fnd_file.LOG,
259                                'GLPSL: Initializing Global Parameters.......'
260                               );
261 --FND_GLOBAL.APPS_INITIALIZE(1001530,50553,101);
262             l_user_id := fnd_global.user_id;                            --1318
263             l_resp_id := fnd_global.resp_id;                           --50553
264             l_apps_id := fnd_global.resp_appl_id;                        --101
265 --FND_GLOBAL.APPS_INITIALIZE(1318,50553,101);
266             fnd_global.apps_initialize (l_user_id, l_resp_id, l_apps_id);
267 /*fnd_global.apps_initialize
268 (fnd_profile.value('USER_ID'),
269  fnd_profile.value('RESP_ID'),
270  fnd_profile.value('RESP_APPL_ID'));*/--commented by Vamshi
271             l_access_set_id := fnd_profile.VALUE ('GL_ACCESS_SET_ID');
272             fnd_file.put_line (fnd_file.LOG,
273                                   'GLPSL: USER ID : '
274                                || l_user_id
275                                || ', '
276                                || 'RESP ID : '
277                                || l_resp_id
278                                || ', '
279                                || 'APPS ID : '
280                                || l_apps_id
281                                || ', '
282                                || 'Access Set ID : '
283                                || l_access_set_id
284                               );
285             fnd_file.put_line (fnd_file.LOG, '');
286 
287             OPEN c_start_date (p_ledger_short_name, l_apps_id, p_start_date);
288 
289             FETCH c_start_date
290              INTO l_start_date;
291 
292             OPEN c_end_date (p_ledger_short_name, l_apps_id, p_end_date);
293 
294             FETCH c_end_date
295              INTO l_end_date;
296 
297 /*--If The given start/end date mathces with the EBS Periods start/end dates*/
298             IF (l_start_date = 'Y' AND l_end_date = 'Y')
299             THEN
300 /*--If there are no records or the Ledger Short Name is Invalid then set the Error Code to 'E'
301 OPEN c_get_ledgers_rec (p_ledger_short_name,
302                              'L',
303                              l_apps_id,
304                              'Y');
305 FETCH c_get_ledgers_rec INTO l_rec_type;
306 IF c_get_ledgers_rec%FOUND THEN*/
307 
308                --------------------------------------------------
309 --Get the Primary, its secondary and ALC Ledgers--
310 --------------------------------------------------
311                fnd_file.put_line (fnd_file.LOG, '');
312                fnd_file.put_line
313                   (fnd_file.LOG,
314                    'GLPSL: GETS INTO PRIMARY, ITS SECONDARY AND ALC LEDGER RECORDS'
315                   );
316                fnd_file.put_line (fnd_file.LOG, '');
317 
318                FOR c1 IN c_get_ledgers_rec (p_ledger_short_name,
319                                             'L',
320                                             l_apps_id,
321                                             'Y'
322                                            )
323                LOOP
324                   IF c1.ledger_id IS NOT NULL
325                   THEN
326                      FOR c2 IN c_get_period_open_rec (l_apps_id,
327                                                       'O',
328                                                       c1.ledger_id,
329                                                       p_start_date,
330                                                       p_end_date
331                                                      )
332                      LOOP
333                         IF c2.period_name IS NOT NULL
334                         THEN
335                            fnd_file.put_line
336                               (fnd_file.LOG,
337                                '-----**Open Period for the Given Date Range**-----'
338                               );
339                            fnd_file.put_line (fnd_file.LOG, '');
340                            fnd_file.put_line
341                               (fnd_file.LOG,
342                                'GLPSL: Nullifying request_id for open period Process'
343                               );
344                            l_request_id := NULL;
345                            fnd_file.put_line
346                               (fnd_file.LOG,
347                                   'GLPSL: Submit the Open Period request for the Period of '
348                                || c2.period_name
349                               );
350                            fnd_file.put_line
351                                          (fnd_file.LOG,
352                                           'GLPSL: Submit Concurrent GLOOAP...'
353                                          );
354                            l_request_id :=
355                               fnd_request.submit_request
356                                             ('SQLGL',
357                                              'GLOOAP',
358                                              '',
359                                              '',
360                                              FALSE,
361                                              c1.NAME,
362                                              TO_CHAR (l_access_set_id),
363                                              TO_CHAR (c2.ledger_id),
364                                              TO_CHAR (c1.chart_of_accounts_id),
365                                              TO_CHAR (c2.application_id),
366                                              'P',
367                                              c2.period_name,
368                                              CHR (0),
369                                              '','','','','','','','','','',
370                                              '','','','','','','','','','',
371                                              '','','','','','','','','','',
372                                              '','','','','','','','','','',
373                                              '','','','','','','','','','',
374 					     '','','','','','','','','','',
375                                              '','','','','','','','','','',
376                                              '','','','','','','','','','',
377                                              '','','','','','','','','','',
378                                              '',''
379                                             );
380                            COMMIT;
381                            fnd_file.put_line
382                                         (fnd_file.LOG,
383                                          'GLPSL: Commit to get the Request ID'
384                                         );
385                            fnd_file.put_line (fnd_file.LOG,
386                                                  'GLPSL: Request ID = '
387                                               || l_request_id
388                                              );
389                            fnd_file.put_line (fnd_file.LOG, '');
390 
391                            IF l_request_id > 0
392                            THEN
393     --------------------------------------------------
394 ---**Monitoring Request Status on Open Period**---
395     --------------------------------------------------
396                               fnd_file.put_line
397                                  (fnd_file.LOG,
398                                   'GLPSL: Monitoring Request Status on Open Period'
399                                  );
400                               fnd_file.put_line
401                                     (fnd_file.LOG,
402                                      'GLPSL: Open Period Monitoring Loop.....'
403                                     );
404                               fnd_file.put_line
405                                    (fnd_file.LOG,
406                                     'GLPSL: Wait Untill request complete.....'
407                                    );
408 
409                               LOOP
410                                  l_phase := NULL;
411                                  l_status := NULL;
412                                  l_dev_phase := NULL;
413                                  l_dev_status := NULL;
414                                  l_message := NULL;
415                                  l_wait_for_request :=
416                                     fnd_concurrent.wait_for_request
417                                                  (request_id      => l_request_id,
418                                                   INTERVAL        => 20,
419                                                   max_wait        => 5,
420                                                   phase           => l_phase,
421                                                   status          => l_status,
422                                                   dev_phase       => l_dev_phase,
423                                                   dev_status      => l_dev_status,
424                                                   MESSAGE         => l_message
425                                                  );
426                                  EXIT WHEN l_phase = 'Completed';
427                               END LOOP;
428 
429                               fnd_file.put_line (fnd_file.LOG,
430                                                     'GLPSL: Phase    : '
431                                                  || l_phase
432                                                  || '  '
433                                                  || 'Status    : '
434                                                  || l_status
435                                                 );
436                            ELSE
437                               fnd_file.put_line
438                                               (fnd_file.LOG,
439                                                'GLPSL: Request Not Submitted'
440                                               );
441                            END IF;
442 
443                            FOR c IN c_check_open_status_rec (c2.ledger_id,
444                                                              l_apps_id,
445                                                              c2.period_name
446                                                             )
447                            LOOP
448                               l_closing_status := c.closing_status;
449                               fnd_file.put_line
450                                               (fnd_file.LOG,
451                                                   'GLPSL: CLOSING STATUS OF '
452                                                || c2.period_name
453                                                || ' IS '
454                                                || l_closing_status
455                                               );
456                               fnd_file.put_line (fnd_file.LOG, '');
457                            END LOOP;
458 
459                            IF l_closing_status <> 'O'
460                            THEN
461                               l_con_status := 'FAILURE';
462                               l_process_status_msg :=
463                                     'GLPSE: Execution Failed in Open Period '
464                                  || c2.period_name
465                                  || ' of Ledger '
466                                  || c1.short_name;
467                               fnd_file.put_line
468                                  (fnd_file.LOG,
469                                   'GLPSE: Error and Exiting From Open Period Loop'
470                                  );
471                               fnd_file.put_line (fnd_file.LOG,
472                                                     'GLPSE: Error IN '
473                                                  || c2.period_name
474                                                  || ' Period of '
475                                                  || c1.NAME
476                                                 );
477                               EXIT;
478                            END IF;
479                         ELSE
480                            fnd_file.put_line
481                               (fnd_file.LOG,
482                                   'GLPSL: There Are No periods To Process for '
483                                || c1.NAME
484                               );
485                         END IF;
486                      END LOOP;
487 
488                      IF l_closing_status <> 'O'
489                      THEN
490                         fnd_file.put_line
491                                  (fnd_file.LOG,
492                                   'GLPSE: Error and Exiting From Ledger Loop'
493                                  );
494                         EXIT;
495                      END IF;
496 
497 ------------********************************************************************---------------
498                           --**Closing Period Beyond the Given Date Range**--
499                      FOR c3 IN c_get_period_close_rec (l_apps_id,
500                                                        'O',
501                                                        c1.ledger_id,
502                                                        p_start_date,
503                                                        p_end_date
504                                                       )
505                      LOOP
506                         IF c3.period_name IS NOT NULL
507                         THEN
508                            fnd_file.put_line
509                               (fnd_file.LOG,
510                                '--**Closing Period Beyond the Given Date Range**--'
511                               );
512                            fnd_file.put_line (fnd_file.LOG, '');
513                            fnd_file.put_line
514                               (fnd_file.LOG,
515                                'GLPSL: Nullifying request_id for open period Process'
516                               );
517                            l_request_id := NULL;
518                            fnd_file.put_line
519                               (fnd_file.LOG,
520                                   'GLPSL: Submit the Open Period request for the Period of '
521                                || c3.period_name
522                               );
523                            fnd_file.put_line
524                                          (fnd_file.LOG,
525                                           'GLPSL: Submit Concurrent GLOCPP...'
526                                          );
527                            l_request_id :=
528                               fnd_request.submit_request ('SQLGL',
529                                                           'GLOCPP',
530                                                           '',
531                                                           '',
532                                                           FALSE,
533                                                           c1.NAME,
534                                                           l_access_set_id,
535                                                           c3.ledger_id,
536                                                           c3.period_name,
537                                                           'N',
538                                                           'C',
539                                                           c3.application_id,
540                                                           CHR (0),
541                                                           '','','','','','','','','','',
542 							  '','','','','','','','','','',
543                                                           '','','','','','','','','','',
544                                                           '','','','','','','','','','',
545                                                           '','','','','','','','','','',
546                                                           '','','','','','','','','','',
547                                                           '','','','','','','','','','',
548                                                           '','','','','','','','','','',
549                                                           '','','','','','','','','','',
550                                                           '',''
551                                                          );
552                            COMMIT;
553                            fnd_file.put_line
554                                         (fnd_file.LOG,
555                                          'GLPSL: Commit to get the Request ID'
556                                         );
557                            fnd_file.put_line (fnd_file.LOG,
558                                                  'GLPSL: Request ID : '
559                                               || l_request_id
560                                              );
561                            fnd_file.put_line (fnd_file.LOG, '');
562 
563                            IF l_request_id > 0
564                            THEN
565     --------------------------------------------------
566 --**Monitoring Request Status for Close Period**--
567     --------------------------------------------------
568                               fnd_file.put_line
569                                  (fnd_file.LOG,
570                                   'GLPSL: Monitoring Request Status on Close Period'
571                                  );
572                               fnd_file.put_line
573                                    (fnd_file.LOG,
574                                     'GLPSL: Wait Untill request complete.....'
575                                    );
576 
577                               LOOP
578                                  l_phase := NULL;
579                                  l_status := NULL;
580                                  l_dev_phase := NULL;
581                                  l_dev_status := NULL;
582                                  l_message := NULL;
583                                  l_wait_for_request :=
584                                     fnd_concurrent.wait_for_request
585                                                  (request_id      => l_request_id,
586                                                   INTERVAL        => 20,
587                                                   max_wait        => 5,
588                                                   phase           => l_phase,
589                                                   status          => l_status,
590                                                   dev_phase       => l_dev_phase,
591                                                   dev_status      => l_dev_status,
592                                                   MESSAGE         => l_message
593                                                  );
594                                  EXIT WHEN l_phase = 'Completed';
595                               END LOOP;
596 
597                               fnd_file.put_line (fnd_file.LOG,
598                                                     'GLPSL: Phase    : '
599                                                  || l_phase
600                                                  || '  '
601                                                  || 'Status    : '
602                                                  || l_status
603                                                 );
604                            ELSE
605                               fnd_file.put_line
606                                               (fnd_file.LOG,
607                                                'GLPSE : Reuest Not Submitted'
608                                               );
609                            END IF;
610 
611                            FOR c IN c_check_open_status_rec (c3.ledger_id,
612                                                              l_apps_id,
613                                                              c3.period_name
614                                                             )
615                            LOOP
616                               l_closing_status := c.closing_status;
617                               fnd_file.put_line
618                                               (fnd_file.LOG,
619                                                   'GLPSL: CLOSING STATUS OF '
620                                                || c3.period_name
621                                                || ' IS '
622                                                || l_closing_status
623                                               );
624                               fnd_file.put_line (fnd_file.LOG, '');
625                            END LOOP;
626 
627                            IF l_closing_status <> 'C'
628                            THEN
629                               --
630                               l_con_status := 'FAILURE';
631                               l_process_status_msg :=
632                                     'GLPSE: Execution Failed in Open Period '
633                                  || c3.period_name
634                                  || ' of Ledger '
635                                  || c1.short_name;
636                               fnd_file.put_line
637                                  (fnd_file.LOG,
638                                   'GLPSE: Error and Exiting From Open Period Loop'
639                                  );
640                               fnd_file.put_line (fnd_file.LOG,
641                                                     'GLPSE: Error IN '
642                                                  || c3.period_name
643                                                  || ' Period of '
644                                                  || c1.NAME
645                                                 );
646                               fnd_file.put_line
647                                  (fnd_file.LOG,
648                                   'GLPSE: Error and Exiting From Close Period Loop'
649                                  );
650                               EXIT;
651                            END IF;
652 
653                            l_closing_status := 'O';
654                         ELSE
655                            fnd_file.put_line
656                               (fnd_file.LOG,
657                                   'GLPSE: There Are No Periods To Close for '
658                                || c1.NAME
659                               );
660                         END IF;
661 
662                         fnd_file.put_line
663                                        (fnd_file.LOG,
664                                         'GLPSL: END of Close Period Loop.....'
665                                        );
666                      END LOOP;
667 --IF l_closing_status <> 'C' THEN
668 --fnd_file.put_line( fnd_file.log,'Error and Exiting From Ledger Loop');
669 --EXIT;
670 --END IF;
671                   ELSE
672                      fnd_file.put_line
673                              (fnd_file.LOG,
674                               'GLPSE: There are No Ledger Records To Process'
675                              );
676                   END IF;
677 
678                   fnd_file.put_line (fnd_file.LOG, '');
679                END LOOP;
680 
681                IF l_con_status = 'FAILURE'
682                THEN
683                   retcode := 2;
684                   x_return_status := 'E';
685                   l_be_message := l_process_status_msg;
686                   fnd_file.put_line (fnd_file.LOG, 'TRANSACTION FAILURE');
687                ELSE
688                   l_con_status := 'SUCCESS';
689                   l_be_message :=
690                         'Open Period Synchronization Process Successfully Completed for Ledger '
691                      || p_ledger_short_name
692                      || ' Date Range Between '
693                      || p_start_date
694                      || ' and '
695                      || p_end_date;
696                   fnd_file.put_line (fnd_file.LOG, 'SUCESSFULL TRANSACTION');
697                END IF;
698 /*fnd_file.put_line( fnd_file.log,'');
699 
700 fnd_file.put_line( fnd_file.log,'GLPSL: **** RAISING '||l_con_Status||' BUSINESS EVENT ****');
701 
702 
703 gl_business_events.raise(
704 p_event_name       => 'oracle.apps.gl.ProcessPeriodStatus.complete',
705 p_event_key        => to_char(l_conc_request_id),
706 p_parameter_name1  => 'STATUS',
707 p_parameter_value1 => l_con_Status,
708 p_parameter_name2  => 'STATUS MESSAGE',
709 p_parameter_value2 => l_be_message);*/--commented by Vamshi
710             ELSE
711                retcode := 2;
712                x_return_status := 'E';
713                errbuf :=
714                   'Given Start Date/ End Date Does not Match with the EBS Periods';
715                fnd_file.put_line
716                   (fnd_file.LOG,
717                    'GLPSE: Given Start Date/ End Date Does not Match with the EBS Periods'
718                   );
719             END IF;
720          ELSE
721             retcode := 2;
722             x_return_status := 'E';
723             errbuf := 'Strat Date is Greater Than End Date';
724             fnd_file.put_line
725                     (fnd_file.LOG,
726                      'GLPSE: Given Start Date is Greater than Given End Date'
727                     );
728          END IF;
729       ELSE
730          retcode := 2;
731          x_return_status := 'E';
732          errbuf := 'Ledger short name is not valid';
733          fnd_file.put_line (fnd_file.LOG,
734                             'GLPSE: Given Ledger Short Name is not Valid'
735                            );
736       END IF;
737 
738       fnd_file.put_line (fnd_file.LOG, '');
739       fnd_file.put_line
740          (fnd_file.LOG,
741           '+---------------------------------------------------------------------------+'
742          );
743       fnd_file.put_line
744          (fnd_file.LOG,
745           '+----------------------------------END--------------------------------------+'
746          );
747       fnd_file.put_line
748          (fnd_file.LOG,
749           '+---------------------------------------------------------------------------+'
750          );
751    EXCEPTION
752       WHEN OTHERS
753       THEN
754          ROLLBACK;
755          retcode := 2;
756          x_return_status := 'E';
757          fnd_file.put_line (fnd_file.LOG, SQLERRM);
758          errbuf := fnd_message.get_string ('GL', 'GLPSE: Unexpected Error');
759          fnd_file.put_line (fnd_file.LOG, '');
760          fnd_file.put_line
761             (fnd_file.LOG,
762              '+---------------------------------------------------------------------------+'
763             );
764          fnd_file.put_line
765             (fnd_file.LOG,
766              '+----------------------------------END--------------------------------------+'
767             );
768          fnd_file.put_line
769             (fnd_file.LOG,
770              '+---------------------------------------------------------------------------+'
771             );
772    END period_status_sync;
773 ------------********************************************************************---------------
774 END gl_period_status_sync_pub;
775 ------------********************************************************************---------------
776 ------------********************************************************************---------------