DBA Data[Home] [Help]

PACKAGE BODY: APPS.GMF_GL_GET_PERIOD_INFO

Source


1 PACKAGE BODY GMF_GL_GET_PERIOD_INFO AS
2 /* $Header: gmfprinb.pls 115.3 2002/11/11 00:40:29 rseshadr Exp $ */
3        CURSOR cur_get_period_info (calendarname  varchar2,
4            periodtype    varchar2,
5                  dateinperiod  date,
6                  setofbooksid  number,
7            appid         number,
8            periodyear    number,
9            periodnumber number) is
10          SELECT gp.period_name,
11                 gps.closing_status,
12                 gp.period_year,
13                 gp.period_num,
14                 gp.quarter_num,
15                 gpt.description,
16     gp.start_date,
17     gp.end_date
18          FROM   gl_period_statuses gps,
19                 gl_periods gp,
20                 gl_period_sets gpt
21          WHERE  lower(gpt.period_set_name) like  lower(calendarname)
22            AND  gp.period_set_name like  gpt.period_set_name
23      AND  gp.period_type like periodtype
24            AND  nvl(trunc(dateinperiod),gp.start_date) between gp.start_date
25                                  and gp.end_date
26            AND  gps.period_name = gp.period_name
27            AND  gps.set_of_books_id = setofbooksid
28            AND  gps.application_id = appid
29      AND  gp.period_year = nvl(periodyear, gp.period_year)
30      AND gp.period_num  = nvl(periodnumber, gp.period_num)
31   ORDER BY gp.period_year, gp.period_num;
32 
33        PROCEDURE GL_GET_PERIOD_INFO (calendarname in  varchar2,
34                                      periodtype   in  varchar2,
35                                      dateinperiod in  date,
36                                      sobname      in out NOCOPY varchar2,
37                                      appabbr      in  varchar2,
38                                      periodname   out NOCOPY varchar2,
39                                      periodstatus out NOCOPY varchar2,
40                                      periodyear   in out NOCOPY number,
41                                      periodnumber in out NOCOPY number,
42                                      quarternum   out NOCOPY number,
43                                      description  out NOCOPY varchar2,
44                                      statuscode   out NOCOPY number,
45              rowtofetch in out NOCOPY number,
46              period_start_date out NOCOPY date,
47              period_end_date   out NOCOPY date ) IS
48 
49        appid    number;
50        st_date    date;
51        en_date    date;
52        err_sts    number;
53        row_to_fetch  number;
54        setofbooksid  number;
55        BEGIN
56 
57    SELECT application_id
58    INTO   appid
59    FROM   fnd_application
60    WHERE  application_short_name = 'SQLGL';
61 
62    st_date := NULL;
63    en_date := NULL;
64    row_to_fetch := 1;
65 
66    gmf_gl_get_sob_id.proc_gl_get_sob_id( st_date,
67           en_date,
68           sobname,
69           setofbooksid,
70           row_to_fetch,
71           err_sts);
72 
73 
74 
75    IF NOT cur_get_period_info%ISOPEN THEN
76     OPEN cur_get_period_info( calendarname,
77                periodtype,
78                      dateinperiod,
79             setofbooksid,
80             appid,
81             periodyear,
82             periodnumber);
83   END IF;
84 
85   FETCH cur_get_period_info
86         INTO     periodname,
87                  periodstatus,
88                  periodyear,
89                  periodnumber,
90                  quarternum,
91                  description ,
92     period_start_date,
93     period_end_date;
94 
95   if (cur_get_period_info%NOTFOUND) or rowtofetch = 1
96   then
97     if ( cur_get_period_info%NOTFOUND )
98     then
99                   statuscode := 100;
100     end if;
101     CLOSE cur_get_period_info;
102   end if;
103 
104          EXCEPTION
105            when NO_DATA_FOUND then
106                 statuscode := 100;
107            when OTHERS then
108                 statuscode := SQLCODE;
109 
110          END gl_get_period_info;
111 END GMF_GL_GET_PERIOD_INFO;