[Home] [Help]
PACKAGE BODY: APPS.FARX_AJ
Source
1 PACKAGE BODY FARX_AJ as
2 /* $Header: farxajb.pls 120.18 2006/05/19 09:10:19 dfred ship $ */
3
4 procedure cost_adjust (
5 book in varchar2,
6 begin_period in varchar2,
7 end_period in varchar2,
8 request_id in number,
9 user_id in number,
10 retcode out nocopy number,
11 errbuf out nocopy varchar2) is
12
13 h_count number;
14 h_book varchar2(15);
15 h_period1_pod date;
16 h_period2_pcd date;
17 h_precision number;
18
19 h_acct_segs fa_rx_shared_pkg.Seg_Array;
20 h_acct_struct number;
21 h_concat_acct varchar2(500);
22 h_acct_seg number;
23 h_cc_seg number;
24 h_bal_seg number;
25
26 h_cat_struct number;
27 h_concat_cat varchar2(500);
28 h_cat_segs fa_rx_shared_pkg.Seg_Array;
29
30 h_loc_struct number;
31 h_concat_loc varchar2(500);
32 h_loc_segs fa_rx_shared_pkg.Seg_Array;
33
34 h_login_id number;
35 h_request_id number;
36
37 h_mass_ref_id number;
38 h_ccid number;
39 h_asset_type varchar2(25);
40 h_category_id number;
41 h_location_id number;
42 h_emp_name varchar2(240);
43 h_emp_number varchar2(30);
44 h_cost_acct varchar2(25);
45 h_asset_number varchar2(15);
46 h_tag_number varchar2(15);
47 h_serial_number varchar2(35);
48 h_inventorial varchar2(3);
49 h_before_cost number;
50 h_after_cost number;
51 h_vendor_name varchar2(240);
52 h_invoice_number varchar2(50);
53 h_line_number number;
54 h_thid number;
55 h_description varchar2(80);
56 h_invoice_descr varchar2(80);
57 h_invoice_adjust number;
58 h_asset_adjust number;
59 h_inv_flag varchar2(1);
60 h_is_inv_adj varchar2(3);
61 h_group_asset_number varchar2(15);
62 h_distribution_source_book varchar2(15);
63
64 h_mesg_name varchar2(50);
65 h_mesg_str varchar2(2000);
66 h_flex_error varchar2(5);
67 h_ccid_error number;
68
69 cursor cost_adjust is
70 SELECT TH.MASS_REFERENCE_ID,
71 dhcc.code_combination_id,
72 FALU.MEANING, cat_bk.category_id, dh.location_id,
73 emp.name, emp.employee_number,
74 DECODE(AH.ASSET_TYPE, 'CIP',CAT_BK.CIP_COST_ACCT,
75 CAT_BK.ASSET_COST_ACCT),
76 AD.ASSET_NUMBER,
77 ad.description, ad.tag_number, ad.serial_number, ad.inventorial,
78 bk_out.cost, bk_in.cost,
79 DECODE(NVL(PO_IN.SEGMENT1,PO_OUT.SEGMENT1),NULL,NULL,
80 NVL(PO_IN.SEGMENT1,PO_OUT.SEGMENT1)||' - '||
81 NVL(PO_IN.VENDOR_NAME,PO_OUT.VENDOR_NAME)),
82 nvl(AI_IN.invoice_number,AI_OUT.invoice_number) ,
83 decode( nvl(AI_IN.INVOICE_LINE_NUMBER, AI_OUT.INVOICE_LINE_NUMBER), null,
84 NVL(AI_IN.AP_DISTRIBUTION_LINE_NUMBER, AI_OUT.AP_DISTRIBUTION_LINE_NUMBER),
85 nvl(AI_IN.INVOICE_LINE_NUMBER, AI_OUT.INVOICE_LINE_NUMBER)||' - '||NVL(AI_IN.AP_DISTRIBUTION_LINE_NUMBER, AI_OUT.AP_DISTRIBUTION_LINE_NUMBER)),
86 TH.TRANSACTION_HEADER_ID,
87 NVL(AI_IN.DESCRIPTION,AI_OUT.DESCRIPTION),
88 ROUND(SUM((DH.UNITS_ASSIGNED/AH.UNITS) *
89 (
90 decode(it.transaction_type,'INVOICE DELETE',
91 0-NVL(AI_IN.FIXED_ASSETS_COST,0),
92 'INVOICE REINSTATE',
93 NVL(AI_IN.FIXED_ASSETS_COST,0),
94 NVL(AI_IN.FIXED_ASSETS_COST,0)-NVL(AI_OUT.FIXED_ASSETS_COST,0)
95 )
96 )), h_precision),
97 ROUND(SUM((DH.UNITS_ASSIGNED/AH.UNITS) *
98 DECODE(TH.INVOICE_TRANSACTION_ID,NULL,
99 (NVL(BK_IN.COST,0) - NVL(BK_OUT.COST,0)),
100 (
101 decode(it.transaction_type,'INVOICE DELETE',
102 0-NVL(AI_IN.FIXED_ASSETS_COST,0),
103 'INVOICE REINSTATE',
104 NVL(AI_IN.FIXED_ASSETS_COST,0),
105 NVL(AI_IN.FIXED_ASSETS_COST,0)-NVL(AI_OUT.FIXED_ASSETS_COST,0)
106 )
107 ))), h_precision),
108 DECODE(IT.TRANSACTION_TYPE,'INVOICE ADDITION','M',
109 'INVOICE ADJUSTMENT','A',
110 'INVOICE TRANSFER','T',
111 'INVOICE DELETE','D',
112 'INVOICE REINSTATE','R',
113 NULL),
114 DECODE(IT.TRANSACTION_TYPE, NULL, 'NO', 'YES'),
115 GAD.ASSET_NUMBER GROUP_ASSET_NUMBER
116 FROM FA_INVOICE_TRANSACTIONS IT,
117 FA_ASSET_INVOICES AI_IN,
118 FA_ASSET_INVOICES AI_OUT,
119 FA_BOOKS BK_IN,
120 FA_BOOKS BK_OUT,
121 FA_TRANSACTION_HEADERS TH,
122 ( select full_name name, employee_number, person_id employee_id
123 from per_people_f
124 where TRUNC(SYSDATE) BETWEEN EFFECTIVE_START_DATE AND EFFECTIVE_END_DATE
125 ) EMP,
126 FA_DISTRIBUTION_HISTORY DH,
127 FA_ASSET_HISTORY AH,
128 FA_CATEGORY_BOOKS CAT_BK,
129 FA_LOOKUPS FALU,
130 PO_VENDORS PO_IN,
131 PO_VENDORS PO_OUT,
132 FA_ADDITIONS AD,
133 GL_CODE_COMBINATIONS DHCC,
134 FA_BOOKS ACTIVE_BK,
135 FA_ADDITIONS_B GAD
136 WHERE
137 TH.TRANSACTION_TYPE_CODE IN ('ADJUSTMENT','CIP ADJUSTMENT') AND
138 TH.BOOK_TYPE_CODE = h_book AND
139 TH.INVOICE_TRANSACTION_ID = IT.INVOICE_TRANSACTION_ID (+) AND
140 TH.DATE_EFFECTIVE BETWEEN
141 h_period1_pod AND
142 nvl(h_period2_pcd,sysdate)
143 -- added to get the active group asset
144 -- in respect to the group active at end of last period
145 AND ACTIVE_BK.book_type_code = h_book AND
146 ACTIVE_BK.ASSET_ID = TH.ASSET_ID AND
147 ACTIVE_BK.date_effective <= nvl(h_period2_pcd,sysdate) AND
148 NVL(ACTIVE_BK.date_ineffective, sysdate) >= nvl(h_period2_pcd,sysdate) AND
149 ACTIVE_BK.group_asset_id = gad.asset_id (+)
150 AND
151 DH.TRANSACTION_HEADER_ID_IN <= TH.TRANSACTION_HEADER_ID AND
152 NVL(DH.TRANSACTION_HEADER_ID_OUT, TH.TRANSACTION_HEADER_ID +1)
153 > TH.TRANSACTION_HEADER_ID AND
154 /*fix for bug no.3803578 */
155 DH.BOOK_TYPE_CODE = h_distribution_source_book AND
156 DH.ASSET_ID = TH.ASSET_ID AND
157 DH.CODE_COMBINATION_ID = DHCC.CODE_COMBINATION_ID
158 AND
159 emp.employee_id (+) = dh.assigned_to
160 AND
161 CAT_BK.CATEGORY_ID = AH.CATEGORY_ID AND
162 CAT_BK.BOOK_TYPE_CODE = h_book
163 AND
164 BK_IN.COST <> BK_OUT.COST
165 AND
166 AD.ASSET_ID = TH.ASSET_ID
167 AND
168 BK_IN.ASSET_ID(+) = TH.ASSET_ID AND
169 BK_IN.BOOK_TYPE_CODE(+) = h_book AND
170 BK_IN.TRANSACTION_HEADER_ID_IN(+) = TH.TRANSACTION_HEADER_ID
171 AND
172 BK_OUT.ASSET_ID(+) = TH.ASSET_ID AND
173 BK_OUT.BOOK_TYPE_CODE(+)||'' = h_book AND
174 BK_OUT.TRANSACTION_HEADER_ID_OUT(+) = TH.TRANSACTION_HEADER_ID
175 AND
176 AI_IN.ASSET_ID (+) = TH.ASSET_ID AND
177 AI_IN.INVOICE_TRANSACTION_ID_IN(+) = TH.INVOICE_TRANSACTION_ID
178 AND
179 AI_OUT.ASSET_ID(+) = TH.ASSET_ID AND
180 AI_OUT.INVOICE_TRANSACTION_ID_OUT(+) = TH.INVOICE_TRANSACTION_ID
181 AND
182 IT.BOOK_TYPE_CODE (+) = h_book
183 AND
184 AH.ASSET_ID = TH.ASSET_ID AND
185 TH.DATE_EFFECTIVE BETWEEN AH.DATE_EFFECTIVE AND
186 NVL(AH.DATE_INEFFECTIVE,
187 nvl(h_period2_pcd,sysdate))
188 AND
189 PO_IN.VENDOR_ID(+) = AI_IN.po_vendor_id AND
190 PO_OUT.VENDOR_ID(+) = AI_OUT.PO_VENDOR_ID
191 AND
192 FALU.LOOKUP_CODE = AH.ASSET_TYPE AND
193 FALU.LOOKUP_TYPE = 'ASSET TYPE'
194 GROUP BY
195 TH.MASS_REFERENCE_ID,
196 dhcc.code_combination_id,
197 FALU.MEANING,cat_bk.category_id, dh.location_id,
198 emp.name, emp.employee_number,
199 DECODE(AH.ASSET_TYPE, 'CIP',CAT_BK.CIP_COST_ACCT,
200 CAT_BK.ASSET_COST_ACCT) ,
201 AD.ASSET_NUMBER,
202 AD.DESCRIPTION, ad.tag_number, ad.serial_number, ad.inventorial,
203 bk_out.cost, bk_in.cost,
204 DECODE(NVL(PO_IN.SEGMENT1,PO_OUT.SEGMENT1),NULL,NULL,
205 NVL(PO_IN.SEGMENT1,PO_OUT.SEGMENT1)||' - '||
206 NVL(PO_IN.VENDOR_NAME,PO_OUT.VENDOR_NAME)),
207 nvl(AI_IN.invoice_number,AI_OUT.invoice_number),
208 decode( nvl(AI_IN.INVOICE_LINE_NUMBER, AI_OUT.INVOICE_LINE_NUMBER), null,
209 NVL(AI_IN.AP_DISTRIBUTION_LINE_NUMBER, AI_OUT.AP_DISTRIBUTION_LINE_NUMBER),
210 nvl(AI_IN.INVOICE_LINE_NUMBER, AI_OUT.INVOICE_LINE_NUMBER)||' - '||NVL(AI_IN.AP_DISTRIBUTION_LINE_NUMBER, AI_OUT.AP_DISTRIBUTION_LINE_NUMBER)),
211 -- NVL(AI_IN.AP_DISTRIBUTION_LINE_NUMBER, AI_OUT.AP_DISTRIBUTION_LINE_NUMBER),
212 TH.TRANSACTION_HEADER_ID,
213 NVL(AI_IN.DESCRIPTION,AI_OUT.DESCRIPTION),
214 IT.TRANSACTION_TYPE,
215 GAD.ASSET_NUMBER;
216
217
218 begin
219 h_book := book;
220 h_request_id := request_id;
221
222 select fcr.last_update_login into h_login_id
223 from fnd_concurrent_requests fcr
224 where fcr.request_id = h_request_id;
225
226 h_mesg_name := 'FA_AMT_SEL_PERIODS';
227 /* fix for bug no.3803578. Added the following query to get the distribution_source_book*/
228 select distribution_source_book into h_distribution_source_book
229 from fa_book_controls
230 where book_type_code=h_book;
231
232 select period_open_date
233 into h_period1_pod
234 from fa_deprn_periods
235 where book_type_code = h_book and period_name = begin_period;
236
237 select count(*) into h_count
238 from fa_deprn_periods where period_name = end_period
239 and book_type_code = h_book;
240
241 if (h_count > 0) then
242 select period_close_date
243 into h_period2_pcd
244 from fa_deprn_periods
245 where book_type_code = h_book and period_name = end_period;
246 else
247 h_period2_pcd := null;
248 end if;
249
250 h_mesg_name := 'FA_REC_SQL_ACCT_FLEX';
251
252 select accounting_flex_structure
253 into h_acct_struct
254 from fa_book_controls
255 where book_type_code = h_book;
256
257 h_mesg_name := 'FA_FA_LOOKUP_IN_SYSTEM_CTLS';
258
259 select location_flex_structure, category_flex_structure
260 into h_loc_struct, h_cat_struct
261 from fa_system_controls;
262
263 h_mesg_name := 'FA_RX_SEGNUMS';
264
265 fa_rx_shared_pkg.GET_ACCT_SEGMENT_NUMBERS (
266 BOOK => h_book,
267 BALANCING_SEGNUM => h_bal_seg,
268 ACCOUNT_SEGNUM => h_acct_seg,
269 CC_SEGNUM => h_cc_seg,
270 CALLING_FN => 'COST_ADJUST');
271
272 select cur.precision into h_precision
273 from fa_book_controls bc, gl_sets_of_books sob, fnd_currencies cur
274 where bc.book_type_code = h_book
275 and sob.set_of_books_id = bc.set_of_books_id
276 and sob.currency_code = cur.currency_code;
277
278 h_mesg_name := 'FA_DEPRN_SQL_DCUR';
279
280 open cost_adjust;
281 loop
282
283 h_mesg_name := 'FA_DEPRN_SQL_FCUR';
284
285 fetch cost_adjust into
286 h_mass_ref_id,
287 h_ccid,
288 h_asset_type,
289 h_category_id,
290 h_location_id,
291 h_emp_name,
292 h_emp_number,
293 h_cost_acct,
294 h_asset_number,
295 h_description,
296 h_tag_number,
297 h_serial_number, h_inventorial,
298 h_before_cost,
299 h_after_cost,
300 h_vendor_name,
301 h_invoice_number,
302 h_line_number,
303 h_thid,
304 h_invoice_descr,
305 h_invoice_adjust,
306 h_asset_adjust,
307 h_inv_flag,
308 h_is_inv_adj,
309 h_group_asset_number;
310
311 if (cost_adjust%NOTFOUND) then exit; end if;
312
313 h_mesg_name := 'FA_RX_CONCAT_SEGS';
314 h_flex_error := 'GL#';
315 h_ccid_error := h_ccid;
316
317 fa_rx_shared_pkg.concat_acct (
318 struct_id => h_acct_struct,
319 ccid => h_ccid,
320 concat_string => h_concat_acct,
321 segarray => h_acct_segs);
322
323 if (h_category_id is not null) then
324
325 h_flex_error := 'CAT#';
326 h_ccid_error := h_category_id;
327
328 fa_rx_shared_pkg.concat_category (
329 struct_id => h_cat_struct,
330 ccid => h_category_id,
331 concat_string => h_concat_cat,
332 segarray => h_cat_segs);
333
334 end if;
335
336 if (h_location_id is not null) then
337
338 h_flex_error := 'LOC#';
339 h_ccid_error := h_location_id;
340
341 fa_rx_shared_pkg.concat_location (
342 struct_id => h_loc_struct,
343 ccid => h_location_id,
344 concat_string => h_concat_loc,
345 segarray => h_loc_segs);
346
347 end if;
348
349 h_mesg_name := 'FA_SHARED_INSERT_FAILED';
350
351 insert into fa_adjust_rep_itf (
352 request_id, mass_ref_id, company, cost_center,
353 expense_Acct, cost_acct, employee_name, employee_number,
354 location, category,
355 asset_number, description, tag_number, serial_number, inventorial,
356 before_cost, after_cost, vendor_name, invoice_number,
357 line_number, invoice_description, transaction_header_id,
358 invoice_adjustment, asset_adjustment, inv_trx_flag,
359 is_inv_adj_flag, created_by, creation_date,
360 last_updated_by, last_update_date, last_update_login, group_asset_number)
361 values (request_id, h_mass_ref_id, h_acct_segs(h_bal_seg),
362 h_acct_segs(h_cc_seg), h_acct_segs(h_acct_seg),
363 h_cost_acct, h_emp_name, h_emp_number,
364 h_concat_loc, h_concat_cat, h_asset_number,
365 h_description, h_tag_number, h_serial_number, h_inventorial,
366 h_before_cost, h_after_cost, h_vendor_name,
367 h_invoice_number, h_line_number, h_invoice_descr, h_thid,
368 h_invoice_adjust, h_asset_adjust,
369 h_inv_flag, h_is_inv_adj,
370 user_id, sysdate, user_id, sysdate, h_login_id, h_group_asset_number);
371
372
373
374 end loop;
375
376 h_mesg_name := 'FA_DEPRN_SQL_CCUR';
377
378 close cost_adjust;
379
380 exception when others then
381 if SQLCODE <> 0 then
382 fa_Rx_conc_mesg_pkg.log(SQLERRM);
383 end if;
384 fnd_message.set_name('OFA',h_mesg_name);
385 if h_mesg_name = 'FA_SHARED_INSERT_FAIL' then
386 fnd_message.set_token('TABLE','FA_ADJUST_REP_ITF',FALSE);
387 end if;
388 if h_mesg_name = 'FA_RX_CONCAT_SEGS' then
389 fnd_message.set_token('CCID',to_char(h_ccid_error),FALSE);
390 fnd_message.set_token('FLEX_CODE',h_flex_error,FALSE);
391 end if;
392
393 h_mesg_str := fnd_message.get;
394 fa_rx_conc_mesg_pkg.log(h_mesg_str);
395 retcode := 2;
396
397
398 end cost_adjust;
399
400
401
402
403 procedure cost_clear_rec (
404 book in varchar2,
405 period in varchar2,
406 request_id in number,
407 user_id in number,
408 retcode out nocopy number,
409 errbuf out nocopy varchar2) is
410
411
412 h_book varchar2(15);
413 h_count number;
414 h_period1_pod date;
415 h_period1_pcd date;
416
417
418 h_fa_ccid number;
419 h_ar_ccid number;
420 h_thcode varchar2(25);
421 h_asset_number varchar2(15);
422 h_description varchar2(80);
423 h_tag_number varchar2(15);
424 h_serial_number varchar2(35);
425 h_inventorial varchar2(3);
426 h_vendor_name varchar2(240);
427 h_invoice_number varchar2(50);
428 h_line_number number;
429 h_inv_description varchar2(80);
430 h_payables_cost number;
431
432 h_acct_struct number;
433 h_ar_acct_segs fa_rx_shared_pkg.Seg_Array;
434 h_fa_acct_segs fa_rx_shared_pkg.Seg_Array;
435 h_concat_ar varchar2(500);
436 h_concat_fa varchar2(500);
437 h_bal_seg number;
438 h_cc_seg number;
439 h_acct_seg number;
440
441 h_request_id number;
442 h_login_id number;
443
444 h_mesg_name varchar2(50);
445 h_mesg_str varchar2(2000);
446 h_flex_error varchar2(5);
447 h_ccid_error number;
448
449
450 cursor cost_clear_lines is
451 select dh.code_combination_id,glcc_ar.code_combination_id,
452 lu.meaning,
453 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
454 ad.inventorial, po_ai_in.vendor_name,
455 ai_in.invoice_number,
456 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
457 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
458 ai_in.description,
459 sum(nvl(ai_in.payables_cost,0) * nvl(dh.units_assigned, ah.units) / ah.units )
460 from
461 po_vendors po_ai_in,
462 fa_lookups lu,
463 gl_code_combinations glcc_ar,
464 fa_additions ad,
465 fa_distribution_history dh,
466 fa_asset_history ah,
467 fa_asset_invoices ai_in,
468 fa_transaction_headers th
469 where
470 lu.lookup_code = 'CIP ADDITION' and
471 lu.lookup_type = 'FAXOLTRX' and
472 ah.asset_type = 'CIP' and
473 th.date_effective between
474 h_period1_pod and
475 nvl(h_period1_pcd,sysdate) and
476 th.book_type_code = h_book and
477 th.transaction_type_code = 'TRANSFER IN'
478 and dh.asset_id = th.asset_id
479 and dh.transaction_header_id_in = th.transaction_header_id
480 and ad.asset_id = th.asset_id
481 and ah.asset_id = th.asset_id and
482 ah.date_effective <=
483 nvl(h_period1_pcd,sysdate) and
484 nvl(ah.date_ineffective,sysdate) >=
485 nvl(h_period1_pcd,sysdate)
486 and ai_in.asset_id = th.asset_id and
487 ai_in.date_effective <=
488 nvl(h_period1_pcd,sysdate) and
489 nvl(ai_in.date_ineffective,sysdate) >=
490 nvl(h_period1_pcd,sysdate)
491 and glcc_ar.code_combination_id = ai_in.payables_code_combination_id
492 and nvl(ai_in.payables_cost, 0) <> 0
493 and po_ai_in.vendor_id (+) = ai_in.po_vendor_id
494 group by
495 dh.code_combination_id,
496 glcc_ar.code_combination_id,
497 lu.meaning,
498 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
499 ad.inventorial, po_ai_in.vendor_name,
500 ai_in.invoice_number,
501 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
502 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
503 --ai_in.ap_distribution_line_number,
504 ai_in.description
505 union
506 select dh.code_combination_id,glcc_ar.code_combination_id,
507 lu.meaning,
508 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
509 ad.inventorial, po_ai_in.vendor_name,
510 ai_in.invoice_number,
511 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
512 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
513 -- ai_in.ap_distribution_line_number,
514 ai_in.description,
515 sum(nvl(ai_in.payables_cost,0) * nvl(dh.units_assigned, ah.units) / ah.units )
516 from
517 po_vendors po_ai_in,
518 fa_lookups lu,
519 gl_code_combinations glcc_ar,
520 fa_additions ad,
521 fa_distribution_history dh,
522 fa_asset_history ah,
523 fa_asset_invoices ai_in,
524 fa_transaction_headers th
525 where
526 lu.lookup_code = 'ADDITION' and
527 lu.lookup_type = 'FAXOLTRX' and
528 ah.asset_type <> 'CIP' and
529 th.date_effective between
530 h_period1_pod and
531 nvl(h_period1_pcd,sysdate) and
532 th.book_type_code = h_book and
533 th.transaction_type_code = 'TRANSFER IN'
534 and dh.asset_id = th.asset_id
535 and dh.transaction_header_id_in = th.transaction_header_id
536 and ad.asset_id = th.asset_id
537 and ah.asset_id = th.asset_id and
538 ah.date_effective <=
539 nvl(h_period1_pcd,sysdate) and
540 nvl(ah.date_ineffective,sysdate) >=
541 nvl(h_period1_pcd,sysdate)
542 and ai_in.asset_id = th.asset_id and
543 ai_in.date_effective <=
544 nvl(h_period1_pcd,sysdate) and
545 nvl(ai_in.date_ineffective,sysdate) >=
546 nvl(h_period1_pcd,sysdate)
547 and glcc_ar.code_combination_id = ai_in.payables_code_combination_id
548 and nvl(ai_in.payables_cost, 0) <> 0
549 and po_ai_in.vendor_id (+) = ai_in.po_vendor_id
550 group by
551 dh.code_combination_id,
552 glcc_ar.code_combination_id,
553 lu.meaning,
554 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
555 ad.inventorial, po_ai_in.vendor_name,
556 ai_in.invoice_number,
557 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
558 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
559 -- ai_in.ap_distribution_line_number,
560 ai_in.description
561 union
562 select dh.code_combination_id,
563 glcc_ar.code_combination_id,
564 lu.meaning,
565 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
566 ad.inventorial, po_ai_in.vendor_name,
567 ai_in.invoice_number,
568 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
569 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
570 --ai_in.ap_distribution_line_number,
571 ai_in.description,
572 sum(nvl(ai_in.payables_cost,0) * nvl(dh.units_assigned, ah.units) / ah.units )
573 from po_vendors po_ai_in,
574 fa_lookups lu,
575 gl_code_combinations glcc_ar,
576 fa_additions ad,
577 fa_distribution_history dh,
578 fa_asset_history ah,
579 fa_invoice_transactions it,
580 fa_asset_invoices ai_in,
581 fa_transaction_headers tht,
582 fa_transaction_headers th
583 where it.book_type_code = h_book and
584 it.invoice_transaction_id = th.invoice_transaction_id and
585 it.transaction_type = 'MASS ADDITION'
586 and lu.lookup_code = decode(th.transaction_type_code,
587 'ADDITION/VOID','ADDITION',
588 th.transaction_type_code) and
589 lu.lookup_type = 'FAXOLTRX'
590 and th.date_effective between
591 h_period1_pod and
592 nvl(h_period1_pcd,sysdate) and
593 th.book_type_code = h_book and
594 th.transaction_type_code in
595 ('CIP ADJUSTMENT', 'ADJUSTMENT', 'ADDITION','ADDITION/VOID')
596 and tht.date_effective <
597 h_period1_pod and
598 tht.book_type_code = h_book and
599 tht.asset_id = th.asset_id and
600 tht.transaction_type_code = 'TRANSFER IN'
601 and dh.asset_id = tht.asset_id
602 and dh.transaction_header_id_in = tht.transaction_header_id
603 and ad.asset_id = th.asset_id
604 and ah.asset_id = th.asset_id and
605 ah.date_effective <=
606 nvl(h_period1_pcd,sysdate) and
607 nvl(ah.date_ineffective,sysdate) >=
608 nvl(h_period1_pcd,sysdate)
609 and ai_in.asset_id = th.asset_id and
610 ai_in.payables_code_combination_id
611 = glcc_ar.code_combination_id
612 and ai_in.invoice_transaction_id_in = it.invoice_transaction_id
613 and ai_in.date_effective <= th.date_effective and
614 nvl(ai_in.date_ineffective,sysdate) >= th.date_effective
615 and nvl(ai_in.payables_cost, 0) <> 0
616 and ai_in.po_vendor_id = po_ai_in.vendor_id(+)
617 group by
618 dh.code_combination_id,
619 glcc_ar.code_combination_id,
620 lu.meaning,
621 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
622 ad.inventorial, po_ai_in.vendor_name,
623 ai_in.invoice_number,
624 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
625 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
626 -- ai_in.ap_distribution_line_number,
627 ai_in.description
628 union /* FA's bal, AR's cc and acct */
629 select glcc_fa.code_combination_id, glcc_ar.code_combination_id,
630 lu.meaning,
631 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
632 ad.inventorial, po_ai_in.vendor_name,
633 ai_in.invoice_number,
634 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
635 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
636 -- ai_in.ap_distribution_line_number,
637 ai_in.description,
638 sum((decode(ai_in.deleted_flag, 'YES', 0,
639 nvl(ai_in.fixed_assets_cost, 0)) -
640 nvl(ai_in.payables_cost, 0))
641 * (nvl (dh.units_assigned, ah.units) /
642 ah.units))
643 from po_vendors po_ai_in,
644 fa_lookups lu,
645 fa_distribution_history dh,
646 gl_code_combinations glcc_fa,
647 gl_code_combinations glcc_ar,
648 fa_additions ad,
649 fa_asset_history ah,
650 fa_category_books cat_bk,
651 fa_asset_invoices ai_in,
652 fa_transaction_headers th
653 where
654 lu.lookup_code = decode(ah.asset_type, 'CIP',
655 'CIP ADDITION', 'ADDITION') and
656 lu.lookup_type = 'FAXOLTRX'
657 and th.date_effective between
658 h_period1_pod and
659 nvl(h_period1_pcd,sysdate) and
660 th.book_type_code = h_book and
661 th.transaction_type_code = 'TRANSFER IN'
662 and ad.asset_id = th.asset_id
663 and ah.asset_id = th.asset_id and
664 ah.date_effective <=
665 nvl(h_period1_pcd,sysdate) and
666 nvl(ah.date_ineffective,sysdate) >=
667 nvl(h_period1_pcd,sysdate) and
668 ah.asset_type <> 'EXPENSED'
669 and cat_bk.book_type_code = h_book and
670 cat_bk.category_id = ah.category_id
671 and dh.book_type_code = h_book and
672 dh.asset_id = th.asset_id and
673 dh.date_effective <=
674 nvl(h_period1_pcd,sysdate) and
675 nvl(dh.date_ineffective,sysdate) >=
676 nvl(h_period1_pcd,sysdate)
677
678 and glcc_fa.code_combination_id = dh.code_combination_id
679 and ai_in.asset_id = th.asset_id and
680 ai_in.date_effective <=
681 nvl(h_period1_pcd,sysdate) and
682 nvl(ai_in.date_ineffective,sysdate) >=
683 nvl(h_period1_pcd,sysdate) and
684 nvl(ai_in.fixed_assets_cost,0) <>
685 nvl(ai_in.payables_cost,0)
686 and decode(ah.asset_type,'CIP',cat_bk.wip_clearing_account_ccid,
687 cat_bk.asset_clearing_account_ccid)
688 = glcc_ar.code_combination_id
689 and po_ai_in.vendor_id (+) = ai_in.po_vendor_id
690 group by
691 glcc_fa.code_combination_id, glcc_ar.code_combination_id,
692 lu.meaning,
693 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
694 ad.inventorial, po_ai_in.vendor_name,
695 ai_in.invoice_number,
696 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
697 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
698 -- ai_in.ap_distribution_line_number,
699 ai_in.description
700 union
701 select glcc_fa.code_combination_id, glcc_ar.code_combination_id,
702 lu.meaning,
703 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
704 ad.inventorial, null,
705 null,
706 to_number (null),
707 null,
708 round(sum((bk_in.cost - nvl(bk_out.cost,0)) *
709 dh.units_assigned / ah.units),2)
710 from fa_books bk_in,
711 fa_books bk_out,
712 fa_distribution_history dh,
713 fa_lookups lu,
714 gl_code_combinations glcc_fa,
715 gl_code_combinations glcc_ar,
716 fa_additions ad,
717 fa_asset_history ah,
718 fa_category_books cat_bk,
719 fa_transaction_headers th
720 where
721 th.book_type_code = h_book and
722 th.invoice_transaction_id is null and
723 th.transaction_type_code in ('CIP ADDITION', 'CIP ADDITION/VOID',
724 'ADDITION','ADDITION/VOID', 'ADJUSTMENT', 'CIP ADJUSTMENT') and
725 th.date_effective between
726 h_period1_pod and
727 nvl(h_period1_pcd,sysdate)
728 and lu.lookup_code = decode(ah.asset_type, 'CIP',
729 decode(th.transaction_type_code,
730 'CIP ADDITION/VOID','CIP ADDITION',
731 'ADDITION/VOID','CIP ADDITION',
732 th.transaction_type_code),
733 decode(th.transaction_type_code,
734 'CIP ADDITION/VOID','ADDITION',
735 'ADDITION/VOID','ADDITION',
736 th.transaction_type_code)) and
737 lu.lookup_type = 'FAXOLTRX'
738 and ad.asset_id = th.asset_id
739 and ah.asset_id = th.asset_id and
740 ah.date_effective <=
741 decode(th.transaction_type_code,
742 'CIP ADJUSTMENT', th.date_effective,
743 'ADJUSTMENT', th.date_effective,
744 nvl(h_period1_pcd,sysdate)) and
745 nvl(ah.date_ineffective,sysdate) >=
746 decode(th.transaction_type_code,
747 'CIP ADJUSTMENT', th.date_effective,
748 'ADJUSTMENT', th.date_effective,
749 nvl(h_period1_pcd,sysdate)) and
750 ah.asset_type <> 'EXPENSED'
751 and bk_in.transaction_header_id_in = th.transaction_header_id
752 and bk_out.transaction_header_id_out(+) = th.transaction_header_id
753 and dh.book_type_code = h_book and
754 dh.asset_id = th.asset_id and
755 dh.date_effective <=
756 decode(th.transaction_type_code,
757 'CIP ADJUSTMENT', th.date_effective,
758 'ADJUSTMENT', th.date_effective,
759 nvl(h_period1_pcd,sysdate)) and
760 nvl(dh.date_ineffective,sysdate) >=
761 decode(th.transaction_type_code,
762 'CIP ADJUSTMENT', th.date_effective,
763 'ADJUSTMENT', th.date_effective,
764 nvl(h_period1_pcd,sysdate))
765 and glcc_fa.code_combination_id = dh.code_combination_id
766 and cat_bk.category_id = ah.category_id and
767 cat_bk.book_type_code = h_book and
768 decode(ah.asset_type,'CIP',cat_bk.wip_clearing_account_ccid,
769 cat_bk.asset_clearing_account_ccid)
770 = glcc_ar.code_combination_id
771 and bk_in.cost <> nvl(bk_out.cost,0)
772 group by
773 glcc_ar.code_combination_id, glcc_fa.code_combination_id,
774 lu.meaning,
775 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
776 ad.inventorial
777 union
778 select glcc_fa.code_combination_id, glcc_ar.code_combination_id,
779 lu.meaning,
780 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
781 ad.inventorial, po_ai_in.vendor_name,
782 ai_in.invoice_number,
783 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
784 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
785 --ai_in.ap_distribution_line_number,
786 ai_in.description,
787 round(sum(decode(it.transaction_type,
788 'INVOICE ADJUSTMENT',
789 nvl(ai_in.fixed_assets_cost,0) -
790 nvl(ai_out.fixed_assets_cost,0),
791 'INVOICE DELETE',
792 -nvl(ai_in.fixed_assets_cost,0),
793 'INVOICE REINSTATE',
794 nvl(ai_in.fixed_assets_cost,0),
795 nvl(ai_in.fixed_assets_cost, 0) -
796 nvl(ai_in.payables_cost, 0))
797 * (dh.units_assigned / ah.units)),2)
798 from fa_asset_invoices ai_out,
799 po_vendors po_ai_in,
800 fa_lookups lu,
801 fa_distribution_history dh,
802 gl_code_combinations glcc_fa,
803 gl_code_combinations glcc_ar,
804 fa_additions ad,
805 fa_asset_history ah,
806 fa_category_books cat_bk,
807 fa_transaction_headers th,
808 fa_invoice_transactions it,
809 fa_asset_invoices ai_in
810 where it.book_type_code = h_book and
811 ((it.transaction_type = 'MASS ADDITION' and
812 nvl(ai_in.fixed_assets_cost,0) <>
813 nvl(ai_in.payables_cost,0)) or
814 (it.transaction_type = 'INVOICE ADDITION' and
815 nvl(ai_in.fixed_assets_cost,0) <> 0) or
816 (it.transaction_type = 'INVOICE ADJUSTMENT' and
817 nvl(ai_in.fixed_assets_cost,0) <>
818 nvl(ai_out.fixed_assets_cost,0)) or
819 (it.transaction_type = 'INVOICE DELETE' and
820 nvl(ai_in.fixed_assets_cost,0) <> 0) or
821 (it.transaction_type = 'INVOICE REINSTATE' and
822 nvl(ai_in.fixed_assets_cost,0) <> 0))
823 and lu.lookup_code = th.transaction_type_code and
824 lu.lookup_type = 'FAXOLTRX'
825 and th.date_effective between
826 h_period1_pod and
827 nvl(h_period1_pcd,sysdate) and
828 th.invoice_transaction_id = it.invoice_transaction_id and
829 th.transaction_type_code in ('ADJUSTMENT', 'CIP ADJUSTMENT') and
830 th.book_type_code = h_book
831 and ad.asset_id = th.asset_id and
832 ad.asset_id = ah.asset_id
833 and ah.date_effective <= th.date_effective and
834 nvl(ah.date_ineffective,sysdate) >= th.date_effective and
835 ah.category_id = cat_bk.category_id and
836 ah.asset_type <> 'EXPENSED'
837 and cat_bk.book_type_code = h_book
838 and dh.book_type_code = h_book and
839 dh.asset_id = th.asset_id and
840 dh.date_effective <= th.date_effective and
841 nvl(dh.date_ineffective,sysdate) >= th.date_effective
842 and
843 dh.code_combination_id = glcc_fa.code_combination_id
844 and ai_in.invoice_transaction_id_in = th.invoice_transaction_id and
845 ai_in.asset_id = th.asset_id and
846 ai_in.date_effective <= th.date_effective and
847 nvl(ai_in.date_ineffective,sysdate) >= th.date_effective
848 and decode(ah.asset_type,'CIP',cat_bk.wip_clearing_account_ccid,
849 cat_bk.asset_clearing_account_ccid)
850 = glcc_ar.code_combination_id
851 and ai_out.invoice_transaction_id_out (+)
852 = ai_in.invoice_transaction_id_in and
853 ai_out.asset_id (+) = ai_in.asset_id and
854 ai_out.asset_invoice_id (+) = ai_in.asset_invoice_id
855 and po_ai_in.vendor_id (+) = ai_in.po_vendor_id
856 group by
857 glcc_fa.code_combination_id, glcc_ar.code_combination_id,
858 lu.meaning,
859 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
860 ad.inventorial, po_ai_in.vendor_name,
861 ai_in.invoice_number,
862 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
863 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
864 --ai_in.ap_distribution_line_number,
865 ai_in.description
866 union
867 --propagetd fix for bug 3375136 starts
868 select
869 lines.code_combination_id, --adj1.code_combination_id,
870 lines.code_combination_id, --adj1.code_combination_id,
871 lu.meaning,
872 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
873 ad.inventorial, po_ai_in.vendor_name,
874 ai_in.invoice_number,
875 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
876 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
877 -- ai_in.ap_distribution_line_number,
878 ai_in.description,
879 round(sum(decode(th.asset_id,
880 ai_in.asset_id,
881 nvl(ai_in.fixed_assets_cost,0),
882 ai_out.asset_id,
883 -nvl(ai_out.fixed_assets_cost,0),0)
884 * (dh.units_assigned / ah.units)),2)
885 from fa_asset_invoices ai_out,
886 po_vendors po_ai_in,
887 fa_lookups lu,
888 fa_distribution_history dh,
889 gl_code_combinations glcc_fa,
890 gl_code_combinations glcc_ar,
891 fa_additions ad,
892 fa_asset_history ah,
893 fa_category_books cat_bk,
894 fa_transaction_headers th,
895 fa_invoice_transactions it,
896 fa_asset_invoices ai_in,
897 fa_adjustments adj1
898
899 /* SLA Changes */
900 ,xla_ae_headers headers
901 ,xla_ae_lines lines
902 ,xla_distribution_links links
903 ,fa_book_controls bc
904
905 where bc.book_type_code = h_book and
906 it.book_type_code = h_book and
907 it.transaction_type = 'INVOICE TRANSFER' and
908 nvl(ai_in.fixed_assets_cost,0) <> 0
909 and lu.lookup_code = th.transaction_type_code and
910 lu.lookup_type = 'FAXOLTRX'
911 and th.date_effective between
912 h_period1_pod and
913 nvl(h_period1_pcd,sysdate) and
914 th.invoice_transaction_id = it.invoice_transaction_id and
915 th.transaction_type_code in ('ADJUSTMENT', 'CIP ADJUSTMENT') and
916 th.book_type_code = h_book
917 and ad.asset_id = th.asset_id and
918 ad.asset_id = ah.asset_id
919 and ah.date_effective <= th.date_effective and
920 nvl(ah.date_ineffective,sysdate) >= th.date_effective and
921 ah.category_id = cat_bk.category_id and
922 ah.asset_type <> 'EXPENSED'
923 and cat_bk.book_type_code = h_book
924 and dh.book_type_code = h_book and
925 dh.asset_id = th.asset_id and
926 dh.date_effective <= th.date_effective and
927 nvl(dh.date_ineffective,sysdate) >= th.date_effective
928 and
929 dh.code_combination_id = glcc_fa.code_combination_id
930 and ai_in.invoice_transaction_id_in = th.invoice_transaction_id and
931 ai_in.date_effective <= th.date_effective and
932 nvl(ai_in.date_ineffective,sysdate) >= th.date_effective
933 and decode(ah.asset_type,'CIP',cat_bk.wip_clearing_account_ccid,
934 cat_bk.asset_clearing_account_ccid)
935 = glcc_ar.code_combination_id
936 and ai_out.invoice_transaction_id_out
937 = ai_in.invoice_transaction_id_in and
938 ai_out.asset_invoice_id = ai_in.asset_invoice_id
939 and ai_in.po_vendor_id = po_ai_in.vendor_id(+)
940
941 and ai_out.asset_id = ai_in.asset_id /* Added for High Cost SQL - to remove FTS on FA-ASSET_INVOICES*/
942
943
944 and adj1.book_type_code = h_book and
945 adj1.asset_id = th.asset_id
946 and adj1.adjustment_type = 'COST CLEARING'
947 and adj1.transaction_header_id = th.transaction_header_id
948
949 /* SLA Changes */
950 and links.Source_distribution_id_num_1 = adj1.transaction_header_id
951 and links.Source_distribution_id_num_2 = adj1.adjustment_line_id
952 and links.application_id = 140
953 and links.source_distribution_type = 'TRX'
954 and headers.ae_header_id = links.ae_header_id
955 and headers.ledger_id = bc.set_of_books_id
956 and headers.application_id = 140
957 and lines.ae_header_id = links.ae_header_id
958 and lines.ae_line_num = links.ae_line_num
959 and lines.application_id = 140
960 group by
961 lines.code_combination_id, --adj1.code_combination_id,
962 lu.meaning,
963 ad.asset_number, ad.description, ad.tag_number, ad.serial_number,
964 ad.inventorial, po_ai_in.vendor_name,
965 ai_in.invoice_number,
966 decode(ai_in.invoice_line_number, null, ai_in.ap_distribution_line_number,
967 ai_in.invoice_line_number||' - '||ai_in.ap_distribution_line_number ),
968 --ai_in.ap_distribution_line_number,
969 ai_in.description;
970 --propagetd fix for bug 3375136 ends
971
972 cc_value gl_code_combinations.segment1%TYPE;
973 begin
974
975 retcode := 0;
976 h_book := book;
977 h_request_id := request_id;
978
979 select fcr.last_update_login into h_login_id
980 from fnd_concurrent_requests fcr
981 where fcr.request_id = h_request_id;
982
983 h_mesg_name := 'FA_AMT_SEL_PERIODS';
984
985 select period_open_date, period_close_date
986 into h_period1_pod, h_period1_pcd
987 from fa_deprn_periods
988 where book_type_code = h_book and period_name = period;
989
990 h_mesg_name := 'FA_REC_SQL_ACCT_FLEX';
991
992 select accounting_flex_structure
993 into h_acct_struct
994 from fa_book_controls
995 where book_type_code = h_book;
996
997 h_mesg_name := 'FA_RX_SEGNUMS';
998
999 fa_rx_shared_pkg.GET_ACCT_SEGMENT_NUMBERS (
1000 BOOK => h_book,
1001 BALANCING_SEGNUM => h_bal_seg,
1002 ACCOUNT_SEGNUM => h_acct_seg,
1003 CC_SEGNUM => h_cc_seg,
1004 CALLING_FN => 'COST_CLEAR_REC');
1005
1006
1007 h_mesg_name := 'FA_DEPRN_SQL_DCUR';
1008
1009 open cost_clear_lines;
1010 loop
1011
1012 h_mesg_name := 'FA_DEPRN_SQL_FCUR';
1013
1014 fetch cost_clear_lines into
1015 h_fa_ccid,
1016 h_ar_ccid,
1017 h_thcode,
1018 h_asset_number,
1019 h_description,
1020 h_tag_number,
1021 h_serial_number,
1022 h_inventorial,
1023 h_vendor_name,
1024 h_invoice_number,
1025 h_line_number,
1026 h_inv_description,
1027 h_payables_cost;
1028
1029
1030
1031
1032 if (cost_clear_lines%NOTFOUND) then exit; end if;
1033
1034 h_mesg_name := 'FA_RX_CONCAT_SEGS';
1035 h_flex_error := 'GL#';
1036 h_ccid_error := h_ar_ccid;
1037
1038 fa_rx_shared_pkg.concat_acct (
1039 struct_id => h_acct_struct,
1040 ccid => h_ar_ccid,
1041 concat_string => h_concat_ar,
1042 segarray => h_ar_acct_segs);
1043
1044 if (h_fa_ccid is not null) then
1045
1046 h_flex_error := 'GL#';
1047 h_ccid_error := h_fa_ccid;
1048
1049 fa_rx_shared_pkg.concat_acct (
1050 struct_id => h_acct_struct,
1051 ccid => h_fa_ccid,
1052 concat_string => h_concat_fa,
1053 segarray => h_fa_acct_segs);
1054
1055 h_ar_acct_segs(h_bal_seg) := h_fa_acct_segs(h_bal_seg);
1056 else
1057 h_fa_acct_segs(h_bal_seg) := null;
1058 h_fa_acct_segs(h_cc_seg) := null;
1059 h_fa_acct_segs(h_acct_seg) := null;
1060 end if;
1061
1062
1063 h_mesg_name := 'FA_SHARED_INSERT_FAILED';
1064
1065 insert into fa_costclear_rep_itf (
1066 request_id, company, cost_Center, account, transaction_type,
1067 asset_number, description, tag_number, serial_number,
1068 vendor_name, invoice_number, line_number, inventorial,
1069 inv_description, payables_cost, created_by,
1070 creation_date, last_updated_by, last_update_date,
1071 last_update_login) values (request_id,
1072 h_ar_acct_segs(h_bal_seg), h_fa_acct_segs(h_cc_seg),
1073 h_ar_acct_segs(h_acct_seg), h_thcode, h_asset_number, h_description,
1074 h_tag_number, h_serial_number, h_vendor_name,
1075 h_invoice_number, h_line_number, h_inventorial, h_inv_description,
1076 h_payables_cost, user_id, sysdate, user_id, sysdate, h_login_id);
1077
1078
1079
1080 end loop;
1081
1082 h_mesg_name := 'FA_DEPRN_SQL_CCUR';
1083
1084 close cost_clear_lines;
1085
1086 exception when others then
1087 if SQLCODE <> 0 then
1088 fa_Rx_conc_mesg_pkg.log(SQLERRM);
1089 end if;
1090 fnd_message.set_name('OFA',h_mesg_name);
1091 if h_mesg_name = 'FA_SHARED_INSERT_FAIL' then
1092 fnd_message.set_token('TABLE','FA_COSTCLEAR_REP_ITF',FALSE);
1093 end if;
1094 if h_mesg_name = 'FA_RX_CONCAT_SEGS' then
1095 fnd_message.set_token('CCID',to_char(h_ccid_error),FALSE);
1096 fnd_message.set_token('FLEX_CODE',h_flex_error,FALSE);
1097 end if;
1098
1099 h_mesg_str := fnd_message.get;
1100 fa_rx_conc_mesg_pkg.log(h_mesg_str);
1101 retcode := 2;
1102
1103 end cost_clear_rec;
1104
1105 END FARX_AJ;