DBA Data[Home] [Help]

PACKAGE BODY: APPS.AP_APXUCPRP_XMLP_PKG

Source


1 PACKAGE BODY AP_APXUCPRP_XMLP_PKG AS
2 /* $Header: APXUCPRPB.pls 120.1 2008/01/06 11:52:48 vjaganat noship $ */
3 
4 FUNCTION  get_base_curr_data  RETURN BOOLEAN IS
5 
6   base_curr ap_system_parameters.base_currency_code%TYPE;   prec      fnd_currencies.precision%TYPE;       min_au    fnd_currencies.minimum_accountable_unit%TYPE;  descr     fnd_currencies.description%TYPE;
7 BEGIN
8 
9   base_curr := '';
10   prec      := 0;
11   min_au    := 0;
12   descr     := '';
13 
14 
15 
16 
17 
18   RETURN (TRUE);
19 
20 RETURN NULL; EXCEPTION
21 
22   WHEN   OTHERS  THEN
23     RETURN (FALSE);
24 
25 END;
26 
27 FUNCTION  get_nls_strings     RETURN BOOLEAN IS
28    nls_void       ap_lookup_codes.displayed_field%TYPE;
29    nls_na         ap_lookup_codes.displayed_field%TYPE;
30    nls_all        ap_lookup_codes.displayed_field%TYPE;
31    nls_yes        fnd_lookups.meaning%TYPE;
32    nls_no         fnd_lookups.meaning%TYPE;
33    nls_pay_method ap_lookup_codes.displayed_field%TYPE;
34 BEGIN
35 
36 
37  IF p_pmt_method IS NOT NULL THEN
38 
39    SELECT  ly.meaning,
40            ln.meaning,
41            l1.displayed_field,
42            l2.displayed_field,
43            l3.displayed_field,
44            l4.displayed_field
45    INTO    nls_yes,
46 	   nls_no,
47 	   nls_all,
48 	   nls_void,
49 	   nls_na,
50            nls_pay_method
51    FROM    fnd_lookups ly,
52 	   fnd_lookups ln,
53 	   ap_lookup_codes l1,
54 	   ap_lookup_codes l2,
55 	   ap_lookup_codes l3,
56            ap_lookup_codes l4
57    WHERE   ly.lookup_type = 'YES_NO'
58      AND   ly.lookup_code = 'Y'
59      AND   ln.lookup_type = 'YES_NO'
60      AND   ln.lookup_code = 'N'
61      AND   l1.lookup_type = 'NLS REPORT PARAMETER'
62      AND   l1.lookup_code = 'ALL'
63      AND   l2.lookup_type = 'NLS TRANSLATION'
64      AND   l2.lookup_code = 'VOID'
65      AND   l3.lookup_type = 'NLS REPORT PARAMETER'
66      AND   l3.lookup_code = 'NA'
67      AND   l4.lookup_type = 'PAYMENT METHOD'
68      AND   (l4.lookup_code = P_PMT_METHOD OR P_PMT_METHOD IS NULL);
69 
70    C_NLS_YES 	      := nls_yes;
71    C_NLS_NO  	      := nls_no;
72    C_NLS_ALL 	      := nls_all;
73    C_NLS_VOID        := nls_void;
74    C_NLS_NA	      := nls_na;
75    CP_PAYMENT_METHOD := nls_pay_method;
76 
77   ELSE
78 
79    SELECT  ly.meaning,
80            ln.meaning,
81            l1.displayed_field,
82            l2.displayed_field,
83            l3.displayed_field
84    INTO    nls_yes,
85 	   nls_no,
86 	   nls_all,
87 	   nls_void,
88 	   nls_na
89    FROM    fnd_lookups ly,
90 	   fnd_lookups ln,
91 	   ap_lookup_codes l1,
92 	   ap_lookup_codes l2,
93 	   ap_lookup_codes l3
94    WHERE   ly.lookup_type = 'YES_NO'
95      AND   ly.lookup_code = 'Y'
96      AND   ln.lookup_type = 'YES_NO'
97      AND   ln.lookup_code = 'N'
98      AND   l1.lookup_type = 'NLS REPORT PARAMETER'
99      AND   l1.lookup_code = 'ALL'
100      AND   l2.lookup_type = 'NLS TRANSLATION'
101      AND   l2.lookup_code = 'VOID'
102      AND   l3.lookup_type = 'NLS REPORT PARAMETER'
103      AND   l3.lookup_code = 'NA';
104 
105    C_NLS_YES 	      := nls_yes;
106    C_NLS_NO  	      := nls_no;
107    C_NLS_ALL 	      := nls_all;
108    C_NLS_VOID        := nls_void;
109    C_NLS_NA	      := nls_na;
110    CP_PAYMENT_METHOD := '';
111 
112   END IF;
113 
114 
115 /*srw.user_exit('FND MESSAGE_NAME APPL="SQLAP" NAME="AP_APPRVL_NO_DATA"');*/null;
116 
117 /*srw.user_exit('FND MESSAGE_GET OUTPUT_FIELD=":C_NLS_NO_DATA_EXISTS"');*/null;
118 
119 /*srw.user_exit('FND MESSAGE_NAME APPL="SQLAP" NAME="AP_ALL_END_OF_REPORT"');*/null;
120 
121 /*srw.user_exit('FND MESSAGE_GET OUTPUT_FIELD=":C_NLS_END_OF_REPORT"');*/null;
122 
123 
124 C_NLS_NO_DATA_EXISTS := 'No Data Found';
125 C_NLS_END_OF_REPORT  := 'End of Report';
126 
127 /*srw.user_exit('FND MESSAGE_NAME APPL="FND" NAME="FND_MO_RPT_PARTIAL_LEDGER"');*/null;
128 
129 /*srw.user_exit('FND MESSAGE_GET OUTPUT_FIELD=":C_LEDGER_PARTIAL_OU"');*/null;
130 
131 
132 
133 RETURN (TRUE);
134 
135 RETURN NULL; EXCEPTION
136    WHEN OTHERS THEN
137       RETURN (FALSE);
138 END;
139 
140 function BeforeReport return boolean is
141 begin
142 
143 
144 
145 DECLARE
146 
147   init_failure    EXCEPTION;
148 
149 BEGIN
150 
151 
152   C_REPORT_START_DATE := sysdate;
153 
154 P_FROM_CHECK_DATE_v:= to_char(P_FROM_CHECK_DATE,'DD-MON-YY');
155 P_TO_CHECK_DATE_v:= to_char(P_TO_CHECK_DATE,'DD-MON-YY');
156 F_LEDGER_PARTIAL_OU:=mo_utils.check_ledger_in_sp(p_set_of_books_id );
157 
158 
159   /*SRW.USER_EXIT('FND SRWINIT');*/null;
160 
161   IF (p_debug_switch in ('y','Y')) THEN
162      /*SRW.MESSAGE('1','After SRWINIT');*/null;
163 
164   END IF;
165 
166 
167 
168 
169   IF (get_company_name <> TRUE) THEN       RAISE init_failure;
170   END IF;
171   IF (p_debug_switch in ('y','Y')) THEN
172      /*SRW.MESSAGE('2','After Get_Company_Name');*/null;
173 
174   END IF;
175 
176 
177   IF (GET_NLS_STRINGS <> TRUE) THEN      RAISE init_failure;
178   END IF;
179   IF (p_debug_switch in ('y','Y')) THEN
180      /*SRW.MESSAGE('3','After Get_NLS_Strings');*/null;
181 
182   END IF;
183 
184 
185   IF (get_base_curr_data <> TRUE) THEN        RAISE init_failure;
186   END IF;
187   IF (p_debug_switch in ('y','Y')) THEN
188      /*SRW.MESSAGE('4','After Get_Base_Curr_Data');*/null;
189 
190   END IF;
191 
192 
193   IF (get_org_placeholders <> TRUE) THEN        RAISE init_failure;
194   END IF;
195   IF (p_debug_switch in ('y','Y')) THEN
196      /*SRW.MESSAGE('5','After Get_Org_Placeholders');*/null;
197 
198   END IF;
199 
200 
201   IF p_bank_account_id IS NOT NULL
202      THEN IF (get_bank_account_info <> TRUE)
203              THEN RAISE init_failure;
204           END IF;
205   END IF;
206   IF (p_debug_switch in ('y','Y')) THEN
207      /*SRW.MESSAGE('5','After get_bank_account_info');*/null;
208 
209   END IF;
210 
211 
212 
213 
214   IF (p_debug_switch in ('y','Y')) THEN
215      /*SRW.BREAK;*/null;
216 
217   END IF;
218 
219 
220 
221   RETURN (TRUE);
222 
223 
224 
225 EXCEPTION
226 
227   WHEN   OTHERS  THEN
228 
229     RAISE_application_error(-20101,null);/*SRW.PROGRAM_ABORT;*/null;
230 
231 
232 END;
233   return (TRUE);
234 end;
235 
236 function AfterReport return boolean is
237 begin
238 
239 BEGIN
240    /*SRW.USER_EXIT('FND SRWEXIT');*/null;
241 
242    IF (P_DEBUG_SWITCH = 'Y') THEN
243       /*SRW.MESSAGE('20','After SRWEXIT');*/null;
244 
245    END IF;
246 EXCEPTION
247 WHEN OTHERS THEN
248    RAISE_application_error(-20101,null);/*SRW.PROGRAM_ABORT;*/null;
249 
250 END;  return (TRUE);
251 end;
252 
253 FUNCTION  get_company_name    RETURN BOOLEAN IS
254   l_chart_of_accounts_id  gl_sets_of_books.chart_of_accounts_id%TYPE;
255   l_name                  gl_sets_of_books.name%TYPE;
256   l_sob_id		  number;
257 BEGIN
258 
259   if P_SET_OF_BOOKS_ID is not null then
260      l_sob_id := p_set_of_books_id;
261      SELECT  name,
262              chart_of_accounts_id
263      INTO    l_name,
264              l_chart_of_accounts_id
265      FROM    gl_sets_of_books
266      WHERE   set_of_books_id = l_sob_id;
267 
268      c_company_name_header     := l_name;
269      c_chart_of_accounts_id    := l_chart_of_accounts_id;
270 
271   end if;
272 
273   RETURN (TRUE);
274 
275 RETURN NULL; EXCEPTION
276 
277   WHEN   OTHERS  THEN
278     RETURN (FALSE);
279 
280 END;
281 
282 FUNCTION GET_ORG_PLACEHOLDERS RETURN BOOLEAN IS
283   multi_org_installation fnd_product_groups.multi_org_flag%TYPE ;
284   l_sob_type_code  gl_sets_of_books.mrc_sob_type_code%TYPE;
285   l_primary_set_of_books_id  gl_sets_of_books.set_of_books_id%TYPE;
286   l_org_id  ap_system_parameters.org_id%TYPE;
287 BEGIN
288   SELECT multi_org_flag
289   INTO   multi_org_installation
290   FROM   fnd_product_groups
291   WHERE  product_group_id = 1 ;
292 
293   IF multi_org_installation = 'Y' THEN
294 
295     SELECT mrc_sob_type_code INTO l_sob_type_code
296     FROM gl_sets_of_books WHERE set_of_books_id = p_set_of_books_id;
297 
298 
299     IF l_sob_type_code = 'R' THEN
300 
301    l_primary_set_of_books_id := GL_MC_INFO.GET_SOURCE_LEDGER_ID
302             (p_set_of_books_id);
303 
304 
305     ELSE
306       l_primary_set_of_books_id := p_set_of_books_id;
307     END IF;
308 
309     c_multi_org_where :=
310        'AND ac.org_id  = oi.organization_id
311         AND asp1.org_id = oi.organization_id
312         AND oi.org_information_context = ''Operating Unit Information''
313         AND DECODE(LTRIM(oi.org_information3,''0123456789''), NULL
314             , TO_NUMBER(oi.org_information3)
315             , NULL ) = '||l_primary_set_of_books_id||'
316         AND DECODE(LTRIM(oi.org_information2,''0123456789''), NULL
317             , TO_NUMBER(oi.org_information2)
318             , NULL ) = le.organization_id
319         AND ou.organization_id = oi.organization_id
320         AND ou.language = USERENV(''LANG'')
321         AND le.language = USERENV(''LANG'')  ' ;
322 
323     c_select_le := 'le.name' ;
324     c_select_ou := 'ou.name' ;
325     c_org_from_tables := ' hr_organization_information oi, hr_all_organization_units_tl le, hr_all_organization_units_tl ou ' ;
326 
327 
328   ELSE
329     c_multi_org_where := ' AND 1=1 ' ;
330     c_select_le := '''Legal Entity''' ;
331     c_select_ou := '''Operating Unit''' ;
332     c_org_from_tables := ' sys.dual ' ;
333   END IF ;
334 
335   RETURN ( TRUE ) ;
336 
337 EXCEPTION
338   WHEN OTHERS THEN
339     RETURN (FALSE) ;
340 
341 END;
342 
343 function AfterPForm return boolean is
344 begin
345 
346   XLA_MO_REPORTING_API.Initialize(p_reporting_level,p_reporting_entity_id,'AUTO');
347   p_org_where_ac  := XLA_MO_REPORTING_API.Get_Predicate('ac',null);
348   p_org_where_asp := XLA_MO_REPORTING_API.Get_Predicate('asp1',null);
349   p_level_name := XLA_MO_REPORTING_API.Get_Reporting_level_name;
350   p_entity_name := XLA_MO_REPORTING_API.Get_Reporting_entity_name;
351 
352   return (TRUE);
353 end;
354 
355 FUNCTION GET_BANK_ACCOUNT_INFO
356    RETURN BOOLEAN IS
357 
358 BEGIN
359 
360    SELECT CBA.bank_account_name
361      INTO cp_bank_account_name
362      FROM ce_bank_accounts CBA, ce_bank_acct_uses_all CBAU
363     WHERE  CBA.bank_account_id  =  CBAU.bank_account_id
364      AND  CBAU.bank_acct_use_id = p_bank_account_id;
365 
366    RETURN (TRUE);
367 
368 EXCEPTION
369 
370    WHEN OTHERS
371       THEN RETURN(FALSE);
372 END;
373 
374 --Functions to refer Oracle report placeholders--
375 
376  Function C_NLS_YES_p return varchar2 is
377 	Begin
378 	 return C_NLS_YES;
379 	 END;
380  Function C_NLS_NO_p return varchar2 is
381 	Begin
382 	 return C_NLS_NO;
383 	 END;
384  Function C_NLS_ALL_p return varchar2 is
385 	Begin
386 	 return C_NLS_ALL;
387 	 END;
388  Function C_NLS_NO_DATA_EXISTS_p return varchar2 is
389 	Begin
390 	 return C_NLS_NO_DATA_EXISTS;
391 	 END;
392  Function C_NLS_VOID_p return varchar2 is
393 	Begin
394 	 return C_NLS_VOID;
395 	 END;
396  Function C_NLS_NA_p return varchar2 is
397 	Begin
398 	 return C_NLS_NA;
399 	 END;
400  Function C_NLS_END_OF_REPORT_p return varchar2 is
401 	Begin
402 	 return C_NLS_END_OF_REPORT;
403 	 END;
404  Function C_REPORT_START_DATE_p return date is
405 	Begin
406 	 return C_REPORT_START_DATE;
407 	 END;
408  Function C_COMPANY_NAME_HEADER_p return varchar2 is
409 	Begin
410 	 return C_COMPANY_NAME_HEADER;
411 	 END;
412  Function C_BASE_CURRENCY_CODE_p return varchar2 is
413 	Begin
414 	 return C_BASE_CURRENCY_CODE;
415 	 END;
416  Function C_BASE_PRECISION_p return number is
417 	Begin
418 	 return C_BASE_PRECISION;
419 	 END;
420  Function C_BASE_MIN_ACCT_UNIT_p return number is
421 	Begin
422 	 return C_BASE_MIN_ACCT_UNIT;
423 	 END;
424  Function C_BASE_DESCRIPTION_p return varchar2 is
425 	Begin
426 	 return C_BASE_DESCRIPTION;
427 	 END;
428  Function C_CHART_OF_ACCOUNTS_ID_p return number is
429 	Begin
430 	 return C_CHART_OF_ACCOUNTS_ID;
431 	 END;
432  Function Applications_Template_Rep_p return varchar2 is
433 	Begin
434 	 return Applications_Template_Report;
435 	 END;
436  Function C_MULTI_ORG_WHERE_p return varchar2 is
437 	Begin
438 	 return C_MULTI_ORG_WHERE;
439 	 END;
440  Function C_ORG_FROM_TABLES_p return varchar2 is
441 	Begin
442 	 return C_ORG_FROM_TABLES;
443 	 END;
444  Function C_SELECT_LE_p return varchar2 is
445 	Begin
446 	 return C_SELECT_LE;
447 	 END;
448  Function C_SELECT_OU_p return varchar2 is
449 	Begin
450 	 return C_SELECT_OU;
451 	 END;
452  Function CP_PAYMENT_METHOD_p return varchar2 is
453 	Begin
454 	 return CP_PAYMENT_METHOD;
455 	 END;
456  Function CP_BANK_ACCOUNT_NAME_p return varchar2 is
457 	Begin
458 	 return CP_BANK_ACCOUNT_NAME;
459 	 END;
460  Function C_LEDGER_PARTIAL_OU_p return varchar2 is
461 	Begin
462 	 return C_LEDGER_PARTIAL_OU;
463 	 END;
464 END AP_APXUCPRP_XMLP_PKG ;
465 
466