DBA Data[Home] [Help]

PACKAGE BODY: APPS.FA_FAS840_XMLP_PKG

Source


1 PACKAGE BODY FA_FAS840_XMLP_PKG AS
2 /* $Header: FAS840B.pls 120.0.12010000.1 2008/07/28 13:15:57 appldev ship $ */
3 function BookFormula return VARCHAR2 is
4 begin
5 DECLARE
6   l_book       VARCHAR2(15);
7   l_accounting_flex_structure NUMBER(15);
8   l_currency_code VARCHAR2(15);
9   l_distribution_source_book VARCHAR2(15);
10   l_precision  NUMBER(15);
11 BEGIN
12 IF upper(p_mrcsobtype) = 'R'
13 THEN
14   SELECT bc.book_type_code,
15          bc.accounting_flex_structure,
16          bc.distribution_source_book,
17          sob.currency_code,
18          cur.precision
19   INTO   l_book,
20          l_accounting_flex_Structure,
21          l_distribution_source_book,
22          l_currency_code,
23          l_precision
24   FROM   FA_BOOK_CONTROLS_MRC_V bc,
25          GL_SETS_OF_BOOKS sob,
26          FND_CURRENCIES cur
27   WHERE  bc.book_type_code = P_BOOK
28   AND    sob.set_of_books_id = bc.set_of_books_id
29   AND    cur.currency_code = sob.currency_code;
30 ELSE
31   SELECT bc.book_type_code,
32          bc.accounting_flex_structure,
33          bc.distribution_source_book,
34          sob.currency_code,
35          cur.precision
36   INTO   l_book,
37          l_accounting_flex_Structure,
38          l_distribution_source_book,
39          l_currency_code,
40          l_precision
41   FROM   FA_BOOK_CONTROLS bc,
42          GL_SETS_OF_BOOKS sob,
43          FND_CURRENCIES cur
44   WHERE  bc.book_type_code = P_BOOK
45   AND    sob.set_of_books_id = bc.set_of_books_id
46   AND    cur.currency_code = sob.currency_code;
47 END IF;
48   Accounting_Flex_Structure:=l_accounting_flex_structure;
49   Distribution_SOurce_Book :=l_distribution_source_book;
50   Currency_Code := l_currency_code;
51   Precision := l_precision;
52   return(l_book);
53 END;
54 RETURN NULL; end;
55 function Period1Formula return VARCHAR2 is
56 begin
57 DECLARE
58   l_period_name VARCHAR2(15);
59   l_period_PC   NUMBER(15);
60 BEGIN
61 IF upper(p_mrcsobtype) = 'R'
62 THEN
63  SELECT period_name,
64          period_counter
65   INTO   l_period_name,
66          l_period_PC
67   FROM   FA_DEPRN_PERIODS_MRC_V
68   WHERE  book_type_code = P_BOOK
69   AND    period_name    = P_PERIOD1;
70 ELSE
71  SELECT period_name,
72          period_counter
73   INTO   l_period_name,
74          l_period_PC
75   FROM   FA_DEPRN_PERIODS
76   WHERE  book_type_code = P_BOOK
77   AND    period_name    = P_PERIOD1;
78 END IF;
79   Period1_PC := l_period_PC;
80   return(l_period_name);
81 END;
82 RETURN NULL; end;
83 function Report_NameFormula return VARCHAR2 is
84 begin
85 DECLARE
86   l_report_name VARCHAR2(80);
87   l_conc_program_id NUMBER;
88 BEGIN
89   SELECT cr.concurrent_program_id
90   INTO l_conc_program_id
91   FROM FND_CONCURRENT_REQUESTS cr
92   WHERE cr.program_application_id = 140
93   AND   cr.request_id = P_CONC_REQUEST_ID;
94   SELECT cp.user_concurrent_program_name
95   INTO   l_report_name
96   FROM    FND_CONCURRENT_PROGRAMS_VL cp
97   WHERE
98       cp.concurrent_program_id= l_conc_program_id
99   and cp.application_id = 140;
100  l_report_name := substr(l_report_name,1,instr(l_report_name,' (XML)'));
101   RP_Report_Name := l_report_name;
102   RETURN(l_report_name);
103 EXCEPTION
104   WHEN OTHERS THEN
105     RP_Report_Name := ':Cost Adjustment Report:';
106     RETURN(RP_Report_Name);
107 END;
108 RETURN NULL; end;
109 function Period2Formula return VARCHAR2 is
110 begin
111 DECLARE
112   l_period_name  VARCHAR2(15);
113   l_period_PC    NUMBER(15);
114 BEGIN
115 IF upper(p_mrcsobtype) = 'R'
116 THEN
117       select period_name,
118              period_counter
119       into   l_period_name,
120              l_period_PC
121       from   fa_deprn_periods_mrc_v
122       where  book_type_code = P_BOOK
123       and    period_name = P_PERIOD2;
124 ELSE
125       select period_name,
126              period_counter
127       into   l_period_name,
128              l_period_PC
129       from   fa_deprn_periods
130       where  book_type_code = P_BOOK
131       and    period_name = P_PERIOD2;
132 END IF;
133       PERIOD2_PC := l_period_pc;
134       return(l_period_name);
135 EXCEPTION
136       WHEN NO_DATA_FOUND
137       THEN RETURN(NULL);
138 END;
139 RETURN NULL; end;
140 function BeforeReport return boolean is
141 begin
142  P_CONC_REQUEST_ID := fnd_global.CONC_REQUEST_ID;
143 /*SRW.USER_EXIT('FND SRWINIT');*/null;
144 IF upper(p_mrcsobtype) = 'R'
145 THEN
146   fnd_client_info.set_currency_context(p_ca_set_of_books_id);
147 END IF;
148 return (TRUE);
149 end;
150 function AfterReport return boolean is
151 begin
152 /*SRW.USER_EXIT('FND SRWEXIT');*/null;
153   return (TRUE);
154 end;
155 function AfterPForm return boolean is
156 begin
157 IF p_ca_set_of_books_id <> -1999
158 THEN
159   BEGIN
160    select mrc_sob_type_code, currency_code
161    into p_mrcsobtype, lp_currency_code
162    from gl_sets_of_books
163    where set_of_books_id = p_ca_set_of_books_id;
164   EXCEPTION
165     WHEN OTHERS THEN
166      p_mrcsobtype := 'P';
167   END;
168 ELSE
169    p_mrcsobtype := 'P';
170 END IF;
171 IF upper(p_mrcsobtype) = 'R'
172 THEN
173   lp_fa_books := 'FA_BOOKS_MRC_V';
174   lp_fa_deprn_periods := 'FA_DEPRN_PERIODS_MRC_V';
175 ELSE
176   lp_fa_books := 'FA_BOOKS';
177   lp_fa_deprn_periods := 'FA_DEPRN_PERIODS';
178 END IF;
179   return (TRUE);
180 end;
181 --Functions to refer Oracle report placeholders--
182  Function PRECISION_p return number is
183 	Begin
184 	 return PRECISION;
185 	 END;
186  Function Accounting_Flex_Structure_p return number is
187 	Begin
188 	 return Accounting_Flex_Structure;
189 	 END;
190  Function Currency_Code_p return varchar2 is
191 	Begin
192 	 return Currency_Code;
193 	 END;
194  Function Distribution_Source_Book_p return varchar2 is
195 	Begin
196 	 return Distribution_Source_Book;
197 	 END;
198  Function Period1_PC_p return number is
199 	Begin
200 	 return Period1_PC;
201 	 END;
202  Function Period2_PC_p return number is
203 	Begin
204 	 return Period2_PC;
205 	 END;
206  Function RP_REPORT_NAME_p return varchar2 is
207 	Begin
208 	 return RP_REPORT_NAME;
209 	 END;
210 END FA_FAS840_XMLP_PKG ;
211