[Home] [Help]
PACKAGE BODY: APPS.FA_TRANS_API_PUB
Source
1 PACKAGE BODY FA_TRANS_API_PUB AS
2 /* $Header: FAPTAPIB.pls 120.27.12020000.2 2012/07/23 09:55:18 rmandali ship $ */
3
4 g_log_level_rec fa_api_types.log_level_rec_type;
5
6 PROCEDURE do_addition (
7 -- Standard Parameters --
8 p_api_version IN NUMBER,
9 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
10 p_commit IN VARCHAR2 := FND_API.G_FALSE,
11 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
12 x_return_status OUT NOCOPY VARCHAR2,
13 x_msg_count OUT NOCOPY NUMBER,
14 x_msg_data OUT NOCOPY VARCHAR2,
15 p_calling_fn IN VARCHAR2,
16 -- API Options --
17 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
18 -- Out Parameters --
19 x_asset_id OUT NOCOPY NUMBER,
20 x_asset_number OUT NOCOPY VARCHAR2,
21 x_transaction_header_id OUT NOCOPY NUMBER,
22 x_dist_transaction_header_id OUT NOCOPY NUMBER,
23 -- Transaction Info (Books) --
24 p_transaction_date_entered IN DATE DEFAULT NULL,
25 p_transaction_name IN VARCHAR2 DEFAULT NULL,
26 p_transaction_subtype IN VARCHAR2 DEFAULT NULL,
27 p_amortization_start_date IN DATE DEFAULT NULL,
28 p_mass_reference_id IN NUMBER DEFAULT NULL,
29 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
30 p_last_update_date IN DATE,
31 p_last_updated_by IN NUMBER,
32 p_created_by IN NUMBER,
33 p_creation_date IN DATE,
34 p_last_update_login IN NUMBER,
35 p_attribute1 IN VARCHAR2 DEFAULT NULL,
36 p_attribute2 IN VARCHAR2 DEFAULT NULL,
37 p_attribute3 IN VARCHAR2 DEFAULT NULL,
38 p_attribute4 IN VARCHAR2 DEFAULT NULL,
39 p_attribute5 IN VARCHAR2 DEFAULT NULL,
40 p_attribute6 IN VARCHAR2 DEFAULT NULL,
41 p_attribute7 IN VARCHAR2 DEFAULT NULL,
42 p_attribute8 IN VARCHAR2 DEFAULT NULL,
43 p_attribute9 IN VARCHAR2 DEFAULT NULL,
44 p_attribute10 IN VARCHAR2 DEFAULT NULL,
45 p_attribute11 IN VARCHAR2 DEFAULT NULL,
46 p_attribute12 IN VARCHAR2 DEFAULT NULL,
47 p_attribute13 IN VARCHAR2 DEFAULT NULL,
48 p_attribute14 IN VARCHAR2 DEFAULT NULL,
49 p_attribute15 IN VARCHAR2 DEFAULT NULL,
50 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
51 -- Transaction Info (Distributions) --
52 p_dist_transaction_name IN VARCHAR2 DEFAULT NULL,
53 p_dist_attribute1 IN VARCHAR2 DEFAULT NULL,
54 p_dist_attribute2 IN VARCHAR2 DEFAULT NULL,
55 p_dist_attribute3 IN VARCHAR2 DEFAULT NULL,
56 p_dist_attribute4 IN VARCHAR2 DEFAULT NULL,
57 p_dist_attribute5 IN VARCHAR2 DEFAULT NULL,
58 p_dist_attribute6 IN VARCHAR2 DEFAULT NULL,
59 p_dist_attribute7 IN VARCHAR2 DEFAULT NULL,
60 p_dist_attribute8 IN VARCHAR2 DEFAULT NULL,
61 p_dist_attribute9 IN VARCHAR2 DEFAULT NULL,
62 p_dist_attribute10 IN VARCHAR2 DEFAULT NULL,
63 p_dist_attribute11 IN VARCHAR2 DEFAULT NULL,
64 p_dist_attribute12 IN VARCHAR2 DEFAULT NULL,
65 p_dist_attribute13 IN VARCHAR2 DEFAULT NULL,
66 p_dist_attribute14 IN VARCHAR2 DEFAULT NULL,
67 p_dist_attribute15 IN VARCHAR2 DEFAULT NULL,
68 p_dist_attribute_category_code IN VARCHAR2 DEFAULT NULL,
69 -- Asset Header Info --
70 p_asset_id IN NUMBER DEFAULT NULL,
71 p_book_type_code IN VARCHAR2,
72 p_set_of_books_id IN NUMBER DEFAULT NULL,
73 -- Asset Description Info --
74 p_asset_number IN VARCHAR2 DEFAULT NULL,
75 p_description IN VARCHAR2,
76 p_tag_number IN VARCHAR2 DEFAULT NULL,
77 p_serial_number IN VARCHAR2 DEFAULT NULL,
78 p_asset_key_ccid IN NUMBER DEFAULT NULL,
79 p_parent_asset_id IN NUMBER DEFAULT NULL,
80 p_status IN VARCHAR2 DEFAULT NULL,
81 p_manufacturer_name IN VARCHAR2 DEFAULT NULL,
82 p_model_number IN VARCHAR2 DEFAULT NULL,
83 p_warranty_id IN NUMBER DEFAULT NULL,
84 p_property_type_code IN VARCHAR2,
85 p_property_1245_1250_code IN VARCHAR2,
86 p_in_use_flag IN VARCHAR2,
87 p_inventorial IN VARCHAR2 DEFAULT NULL,
88 p_commitment IN VARCHAR2 DEFAULT NULL,
89 p_investment_law IN VARCHAR2 DEFAULT NULL,
90 p_owned_leased IN VARCHAR2,
91 p_new_used IN VARCHAR2,
92 p_lease_id IN NUMBER DEFAULT NULL,
93 p_ls_attribute1 IN VARCHAR2 DEFAULT NULL,
94 p_ls_attribute2 IN VARCHAR2 DEFAULT NULL,
95 p_ls_attribute3 IN VARCHAR2 DEFAULT NULL,
96 p_ls_attribute4 IN VARCHAR2 DEFAULT NULL,
97 p_ls_attribute5 IN VARCHAR2 DEFAULT NULL,
98 p_ls_attribute6 IN VARCHAR2 DEFAULT NULL,
99 p_ls_attribute7 IN VARCHAR2 DEFAULT NULL,
100 p_ls_attribute8 IN VARCHAR2 DEFAULT NULL,
101 p_ls_attribute9 IN VARCHAR2 DEFAULT NULL,
102 p_ls_attribute10 IN VARCHAR2 DEFAULT NULL,
103 p_ls_attribute11 IN VARCHAR2 DEFAULT NULL,
104 p_ls_attribute12 IN VARCHAR2 DEFAULT NULL,
105 p_ls_attribute13 IN VARCHAR2 DEFAULT NULL,
106 p_ls_attribute14 IN VARCHAR2 DEFAULT NULL,
107 p_ls_attribute15 IN VARCHAR2 DEFAULT NULL,
108 p_ls_attribute_category_code IN VARCHAR2 DEFAULT NULL,
109 p_ad_global_attribute1 IN VARCHAR2 DEFAULT NULL,
110 p_ad_global_attribute2 IN VARCHAR2 DEFAULT NULL,
111 p_ad_global_attribute3 IN VARCHAR2 DEFAULT NULL,
112 p_ad_global_attribute4 IN VARCHAR2 DEFAULT NULL,
113 p_ad_global_attribute5 IN VARCHAR2 DEFAULT NULL,
114 p_ad_global_attribute6 IN VARCHAR2 DEFAULT NULL,
115 p_ad_global_attribute7 IN VARCHAR2 DEFAULT NULL,
116 p_ad_global_attribute8 IN VARCHAR2 DEFAULT NULL,
117 p_ad_global_attribute9 IN VARCHAR2 DEFAULT NULL,
118 p_ad_global_attribute10 IN VARCHAR2 DEFAULT NULL,
119 p_ad_global_attribute11 IN VARCHAR2 DEFAULT NULL,
120 p_ad_global_attribute12 IN VARCHAR2 DEFAULT NULL,
121 p_ad_global_attribute13 IN VARCHAR2 DEFAULT NULL,
122 p_ad_global_attribute14 IN VARCHAR2 DEFAULT NULL,
123 p_ad_global_attribute15 IN VARCHAR2 DEFAULT NULL,
124 p_ad_global_attribute16 IN VARCHAR2 DEFAULT NULL,
125 p_ad_global_attribute17 IN VARCHAR2 DEFAULT NULL,
126 p_ad_global_attribute18 IN VARCHAR2 DEFAULT NULL,
127 p_ad_global_attribute19 IN VARCHAR2 DEFAULT NULL,
128 p_ad_global_attribute20 IN VARCHAR2 DEFAULT NULL,
129 p_ad_global_attribute_category IN VARCHAR2 DEFAULT NULL,
130 -- Asset Type Info --
131 p_asset_type IN VARCHAR2,
132 -- Asset Category Info --
133 p_category_id IN NUMBER,
134 p_cat_attribute1 IN VARCHAR2 DEFAULT NULL,
135 p_cat_attribute2 IN VARCHAR2 DEFAULT NULL,
136 p_cat_attribute3 IN VARCHAR2 DEFAULT NULL,
137 p_cat_attribute4 IN VARCHAR2 DEFAULT NULL,
138 p_cat_attribute5 IN VARCHAR2 DEFAULT NULL,
139 p_cat_attribute6 IN VARCHAR2 DEFAULT NULL,
140 p_cat_attribute7 IN VARCHAR2 DEFAULT NULL,
141 p_cat_attribute8 IN VARCHAR2 DEFAULT NULL,
142 p_cat_attribute9 IN VARCHAR2 DEFAULT NULL,
143 p_cat_attribute10 IN VARCHAR2 DEFAULT NULL,
144 p_cat_attribute11 IN VARCHAR2 DEFAULT NULL,
145 p_cat_attribute12 IN VARCHAR2 DEFAULT NULL,
146 p_cat_attribute13 IN VARCHAR2 DEFAULT NULL,
147 p_cat_attribute14 IN VARCHAR2 DEFAULT NULL,
148 p_cat_attribute15 IN VARCHAR2 DEFAULT NULL,
149 p_cat_attribute16 IN VARCHAR2 DEFAULT NULL,
150 p_cat_attribute17 IN VARCHAR2 DEFAULT NULL,
151 p_cat_attribute18 IN VARCHAR2 DEFAULT NULL,
152 p_cat_attribute19 IN VARCHAR2 DEFAULT NULL,
153 p_cat_attribute20 IN VARCHAR2 DEFAULT NULL,
154 p_cat_attribute21 IN VARCHAR2 DEFAULT NULL,
155 p_cat_attribute22 IN VARCHAR2 DEFAULT NULL,
156 p_cat_attribute23 IN VARCHAR2 DEFAULT NULL,
157 p_cat_attribute24 IN VARCHAR2 DEFAULT NULL,
158 p_cat_attribute25 IN VARCHAR2 DEFAULT NULL,
159 p_cat_attribute26 IN VARCHAR2 DEFAULT NULL,
160 p_cat_attribute27 IN VARCHAR2 DEFAULT NULL,
161 p_cat_attribute28 IN VARCHAR2 DEFAULT NULL,
162 p_cat_attribute29 IN VARCHAR2 DEFAULT NULL,
163 p_cat_attribute30 IN VARCHAR2 DEFAULT NULL,
164 p_cat_attribute_category_code IN VARCHAR2 DEFAULT NULL,
165 p_context IN VARCHAR2 DEFAULT NULL,
166 -- Asset Hierarchy Info --
167 p_parent_hierarchy_id IN NUMBER DEFAULT NULL,
168 -- Asset Financial Info --
169 p_cost IN NUMBER,
170 p_original_cost IN NUMBER,
171 p_unrevalued_cost IN NUMBER DEFAULT NULL,
172 p_salvage_value IN NUMBER,
173 p_ceiling_name IN VARCHAR2 DEFAULT NULL,
174 p_reval_ceiling IN NUMBER DEFAULT NULL,
175 p_depreciate_flag IN VARCHAR2,
176 -- HH group ed.
177 p_disabled_flag IN VARCHAR2 DEFAULT NULL,
178 p_date_placed_in_service IN DATE,
179 p_prorate_convention_code IN VARCHAR2,
180 p_deprn_method_code IN VARCHAR2,
181 p_life_in_months IN NUMBER DEFAULT NULL,
182 p_basic_rate IN NUMBER DEFAULT NULL,
183 p_adjusted_rate IN NUMBER DEFAULT NULL,
184 p_production_capacity IN NUMBER DEFAULT NULL,
185 p_unit_of_measure IN VARCHAR2 DEFAULT NULL,
186 p_bonus_rule IN VARCHAR2 DEFAULT NULL,
187 p_itc_amount_id IN NUMBER DEFAULT NULL,
188 p_short_fiscal_year_flag IN VARCHAR2 DEFAULT NULL,
189 p_conversion_date IN DATE DEFAULT NULL,
190 p_orig_deprn_start_date IN DATE DEFAULT NULL,
191 p_group_asset_id IN NUMBER DEFAULT NULL,
192 /* toru */
193 -- Addition for Group Depreciation
194 p_percent_salvage_value IN NUMBER DEFAULT NULL,
195 p_allowed_deprn_limit IN NUMBER DEFAULT NULL,
196 p_allowed_deprn_limit_amount IN NUMBER DEFAULT NULL,
197 p_super_group_id IN NUMBER DEFAULT NULL,
198 p_reduction_rate IN NUMBER DEFAULT NULL,
199 p_reduce_addition_flag IN VARCHAR2 DEFAULT NULL,
200 p_reduce_adjustment_flag IN VARCHAR2 DEFAULT NULL,
201 p_reduce_retirement_flag IN VARCHAR2 DEFAULT NULL,
202 p_over_depreciate_option IN VARCHAR2 DEFAULT NULL,
203 p_recognize_gain_loss IN VARCHAR2 DEFAULT NULL,
204 p_recapture_reserve_flag IN VARCHAR2 DEFAULT NULL,
205 p_limit_proceeds_flag IN VARCHAR2 DEFAULT NULL,
206 p_terminal_gain_loss IN VARCHAR2 DEFAULT NULL,
207 p_exclude_proceeds_from_basis IN VARCHAR2 DEFAULT NULL,
208 p_retirement_deprn_option IN VARCHAR2 DEFAULT NULL,
209 p_salvage_type IN VARCHAR2 DEFAULT NULL,
210 p_deprn_limit_type IN VARCHAR2 DEFAULT NULL,
211 p_tracking_method IN VARCHAR2 DEFAULT NULL,
212 p_allocate_to_fully_rsv_flag IN VARCHAR2 DEFAULT NULL,
213 p_allocate_to_fully_ret_flag IN VARCHAR2 DEFAULT NULL,
214 p_excess_allocation_option IN VARCHAR2 DEFAULT NULL,
215 p_depreciation_option IN VARCHAR2 DEFAULT NULL,
216 p_member_rollup_flag IN VARCHAR2 DEFAULT NULL,
217 p_ytd_proceeds IN NUMBER DEFAULT NULL,
218 p_ltd_proceeds IN NUMBER DEFAULT NULL,
219 p_exclude_fully_rsv_flag IN VARCHAR2 DEFAULT NULL,
220 p_eofy_reserve IN NUMBER DEFAULT NULL,
221 p_reclass_transfer_type IN VARCHAR2 DEFAULT NULL,
222 p_reclass_transfer_amount IN NUMBER DEFAULT NULL,
223 p_reclass_src_expense IN NUMBER DEFAULT NULL,
224 p_reclass_dest_expense IN NUMBER DEFAULT NULL,
225 p_reclass_src_eofy_reserve IN NUMBER DEFAULT NULL,
226 p_reclass_dest_eofy_reserve IN NUMBER DEFAULT NULL,
227 -- End of Addition for Group Depreciation
228 /* Etoru */
229 p_bk_global_attribute1 IN VARCHAR2 DEFAULT NULL,
230 p_bk_global_attribute2 IN VARCHAR2 DEFAULT NULL,
231 p_bk_global_attribute3 IN VARCHAR2 DEFAULT NULL,
232 p_bk_global_attribute4 IN VARCHAR2 DEFAULT NULL,
233 p_bk_global_attribute5 IN VARCHAR2 DEFAULT NULL,
234 p_bk_global_attribute6 IN VARCHAR2 DEFAULT NULL,
235 p_bk_global_attribute7 IN VARCHAR2 DEFAULT NULL,
236 p_bk_global_attribute8 IN VARCHAR2 DEFAULT NULL,
237 p_bk_global_attribute9 IN VARCHAR2 DEFAULT NULL,
238 p_bk_global_attribute10 IN VARCHAR2 DEFAULT NULL,
239 p_bk_global_attribute11 IN VARCHAR2 DEFAULT NULL,
240 p_bk_global_attribute12 IN VARCHAR2 DEFAULT NULL,
241 p_bk_global_attribute13 IN VARCHAR2 DEFAULT NULL,
242 p_bk_global_attribute14 IN VARCHAR2 DEFAULT NULL,
243 p_bk_global_attribute15 IN VARCHAR2 DEFAULT NULL,
244 p_bk_global_attribute16 IN VARCHAR2 DEFAULT NULL,
245 p_bk_global_attribute17 IN VARCHAR2 DEFAULT NULL,
246 p_bk_global_attribute18 IN VARCHAR2 DEFAULT NULL,
247 p_bk_global_attribute19 IN VARCHAR2 DEFAULT NULL,
248 p_bk_global_attribute20 IN VARCHAR2 DEFAULT NULL,
249 p_bk_global_attribute_category IN VARCHAR2 DEFAULT NULL,
250 -- Asset Depreciation Info --
251 p_ytd_deprn IN NUMBER DEFAULT NULL,
252 p_deprn_reserve IN NUMBER DEFAULT NULL,
253 p_reval_deprn_reserve IN NUMBER DEFAULT NULL,
254 p_ytd_production IN NUMBER DEFAULT NULL,
255 p_ltd_production IN NUMBER DEFAULT NULL,
256 -- IAS36 Impairment Info --
257 p_cash_generating_unit_id IN NUMBER DEFAULT NULL,
258 -- Changes made as per the ER No.s 6606548 and 6606552 by Sbyreddy Start
259 p_nbv_at_switch IN NUMBER DEFAULT NULL,
260 p_prior_deprn_limit_type IN VARCHAR2 DEFAULT NULL,
261 p_prior_deprn_limit_amount IN NUMBER DEFAULT NULL,
262 p_prior_deprn_limit IN NUMBER DEFAULT NULL,
263 p_period_counter_fully_rsrved IN NUMBER DEFAULT NULL,
264 p_extended_depreciation_period IN NUMBER DEFAULT NULL,
265 p_prior_deprn_method IN VARCHAR2 DEFAULT NULL,
266 p_prior_life_in_months IN NUMBER DEFAULT NULL,
267 p_prior_basic_rate IN NUMBER DEFAULT NULL,
268 p_prior_adjusted_rate IN NUMBER DEFAULT NULL,
269 p_extended_deprn_flag IN VARCHAR2 DEFAULT NULL
270 -- Changes made as per the ER No.s 6606548 and 6606552 by Sbyreddy End
271 ) AS
272
273 l_trans_rec fa_api_types.trans_rec_type;
274 l_dist_trans_rec fa_api_types.trans_rec_type;
275 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
276 l_asset_desc_rec fa_api_types.asset_desc_rec_type;
277 l_asset_cat_rec fa_api_types.asset_cat_rec_type;
278 l_asset_hierarchy_rec fa_api_types.asset_hierarchy_rec_type;
279 l_asset_type_rec fa_api_types.asset_type_rec_type;
280 l_asset_fin_rec fa_api_types.asset_fin_rec_type;
281 l_asset_deprn_rec fa_api_types.asset_deprn_rec_type;
282 l_asset_dist_rec fa_api_types.asset_dist_rec_type;
283 l_asset_dist_tbl fa_api_types.asset_dist_tbl_type;
284 l_inv_rec fa_api_types.inv_rec_type;
285 l_inv_tbl fa_api_types.inv_tbl_type;
286 /* toru */
287 l_group_reclass_options_rec fa_api_types.group_reclass_options_rec_type;
288 /* Etoru */
289
290 BEGIN
291 -- Initialize message list if p_init_msg_list is set to TRUE.
292 IF FND_API.To_Boolean(p_init_msg_list) THEN
293 -- Initialize error message stack.
294 FA_SRVR_MSG.Init_Server_Message;
295
296 -- Initialize debug message stack.
297 FA_DEBUG_PKG.Initialize;
298 END IF;
299
300 -- Override FA:PRINT_DEBUG profile option.
301 IF (p_debug_flag = 'YES') THEN
302 FA_DEBUG_PKG.Set_Debug_Flag;
303 END IF;
304
305 -- ***** Asset Transaction Info ***** --
306 --l_trans_rec.transaction_header_id :=
307 --l_trans_rec.transaction_type_code :=
308 l_trans_rec.transaction_date_entered := p_transaction_date_entered;
309 l_trans_rec.transaction_name := p_transaction_name;
310 --l_trans_rec.source_transaction_header_id :=
311 l_trans_rec.mass_reference_id := p_mass_reference_id;
312 l_trans_rec.transaction_subtype := p_transaction_subtype;
313 --l_trans_rec.transaction_key :=
314 l_trans_rec.amortization_start_date := p_amortization_start_date;
315 l_trans_rec.calling_interface := p_calling_interface;
316 l_trans_rec.desc_flex.attribute1 := p_attribute1;
317 l_trans_rec.desc_flex.attribute2 := p_attribute2;
318 l_trans_rec.desc_flex.attribute3 := p_attribute3;
319 l_trans_rec.desc_flex.attribute4 := p_attribute4;
320 l_trans_rec.desc_flex.attribute5 := p_attribute5;
321 l_trans_rec.desc_flex.attribute6 := p_attribute6;
322 l_trans_rec.desc_flex.attribute7 := p_attribute7;
323 l_trans_rec.desc_flex.attribute8 := p_attribute8;
324 l_trans_rec.desc_flex.attribute9 := p_attribute9;
325 l_trans_rec.desc_flex.attribute10 := p_attribute10;
326 l_trans_rec.desc_flex.attribute11 := p_attribute11;
327 l_trans_rec.desc_flex.attribute12 := p_attribute12;
328 l_trans_rec.desc_flex.attribute13 := p_attribute13;
329 l_trans_rec.desc_flex.attribute14 := p_attribute14;
330 l_trans_rec.desc_flex.attribute15 := p_attribute15;
331 l_trans_rec.desc_flex.attribute_category_code := p_attribute_category_code;
332 l_trans_rec.who_info.last_update_date := p_last_update_date;
333 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
334 l_trans_rec.who_info.created_by := p_created_by;
335 l_trans_rec.who_info.creation_date := p_creation_date;
336 l_trans_rec.who_info.last_update_login := p_last_update_login;
337
338 -- Fix for Bug #2797309. For CIP Assets, amortization_start_date
339 -- should always be NULL.
340 if (p_asset_type = 'CIP') then
341 l_trans_rec.amortization_start_date := NULL;
342 end if;
343
344 -- ***** Distribution Transaction Info ***** --
345 --l_dist_trans_rec.transaction_header_id :=
346 l_dist_trans_rec.transaction_name := p_dist_transaction_name;
347 l_dist_trans_rec.calling_interface := p_calling_interface;
348 l_dist_trans_rec.desc_flex.attribute1 := p_dist_attribute1;
349 l_dist_trans_rec.desc_flex.attribute2 := p_dist_attribute2;
350 l_dist_trans_rec.desc_flex.attribute3 := p_dist_attribute3;
351 l_dist_trans_rec.desc_flex.attribute4 := p_dist_attribute4;
352 l_dist_trans_rec.desc_flex.attribute5 := p_dist_attribute5;
353 l_dist_trans_rec.desc_flex.attribute6 := p_dist_attribute6;
354 l_dist_trans_rec.desc_flex.attribute7 := p_dist_attribute7;
355 l_dist_trans_rec.desc_flex.attribute8 := p_dist_attribute8;
356 l_dist_trans_rec.desc_flex.attribute9 := p_dist_attribute9;
357 l_dist_trans_rec.desc_flex.attribute10 := p_dist_attribute10;
358 l_dist_trans_rec.desc_flex.attribute11 := p_dist_attribute11;
359 l_dist_trans_rec.desc_flex.attribute12 := p_dist_attribute12;
360 l_dist_trans_rec.desc_flex.attribute13 := p_dist_attribute13;
361 l_dist_trans_rec.desc_flex.attribute14 := p_dist_attribute14;
362 l_dist_trans_rec.desc_flex.attribute15 := p_dist_attribute15;
363 l_dist_trans_rec.desc_flex.attribute_category_code :=
364 p_dist_attribute_category_code;
365
366 -- ***** Asset Header Info ***** --
367 l_asset_hdr_rec.asset_id := p_asset_id;
368 l_asset_hdr_rec.book_type_code := p_book_type_code;
369 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
370 --l_asset_hdr_rec.period_of_addition :=
371
372 -- Derive set of books id for primary book
373 if (l_asset_hdr_rec.set_of_books_id is NULL) then
374 select set_of_books_id
375 into l_asset_hdr_rec.set_of_books_id
376 from fa_book_controls
377 where book_type_code = l_asset_hdr_rec.book_type_code;
378 end if;
379
380 -- ***** Asset Descriptive Info ***** --
381 l_asset_desc_rec.asset_number := p_asset_number;
382 l_asset_desc_rec.description := p_description;
383 l_asset_desc_rec.tag_number := p_tag_number;
384 l_asset_desc_rec.serial_number := p_serial_number;
385 l_asset_desc_rec.asset_key_ccid := p_asset_key_ccid;
386 l_asset_desc_rec.parent_asset_id := p_parent_asset_id;
387 l_asset_desc_rec.manufacturer_name := p_manufacturer_name;
388 l_asset_desc_rec.model_number := p_model_number;
389 l_asset_desc_rec.warranty_id := p_warranty_id;
390 l_asset_desc_rec.lease_id := p_lease_id;
391 l_asset_desc_rec.in_use_flag := p_in_use_flag;
392
393 -- toru
394 -- Inventorial is always 'NO' for group asset
395 --
396 if (p_asset_type = 'GROUP') then
397 l_asset_desc_rec.inventorial := 'NO';
398 else
399 l_asset_desc_rec.inventorial := p_inventorial;
400 end if;
401
402 l_asset_desc_rec.property_type_code := p_property_type_code;
403 l_asset_desc_rec.property_1245_1250_code := p_property_1245_1250_code;
404 l_asset_desc_rec.owned_leased := p_owned_leased;
405 l_asset_desc_rec.new_used := p_new_used;
406 l_asset_desc_rec.commitment := p_commitment;
407 l_asset_desc_rec.investment_law := p_investment_law;
408 --l_asset_desc_rec.unit_adjustment_flag :=
409 --l_asset_desc_rec.add_cost_je_flag :=
410 l_asset_desc_rec.status := p_status;
411 l_asset_desc_rec.lease_desc_flex.attribute1 := p_ls_attribute1;
412 l_asset_desc_rec.lease_desc_flex.attribute2 := p_ls_attribute2;
413 l_asset_desc_rec.lease_desc_flex.attribute3 := p_ls_attribute3;
414 l_asset_desc_rec.lease_desc_flex.attribute4 := p_ls_attribute4;
415 l_asset_desc_rec.lease_desc_flex.attribute5 := p_ls_attribute5;
416 l_asset_desc_rec.lease_desc_flex.attribute6 := p_ls_attribute6;
417 l_asset_desc_rec.lease_desc_flex.attribute7 := p_ls_attribute7;
418 l_asset_desc_rec.lease_desc_flex.attribute8 := p_ls_attribute8;
419 l_asset_desc_rec.lease_desc_flex.attribute9 := p_ls_attribute9;
420 l_asset_desc_rec.lease_desc_flex.attribute10 := p_ls_attribute10;
421 l_asset_desc_rec.lease_desc_flex.attribute11 := p_ls_attribute11;
422 l_asset_desc_rec.lease_desc_flex.attribute12 := p_ls_attribute12;
423 l_asset_desc_rec.lease_desc_flex.attribute13 := p_ls_attribute13;
424 l_asset_desc_rec.lease_desc_flex.attribute14 := p_ls_attribute14;
425 l_asset_desc_rec.lease_desc_flex.attribute15 := p_ls_attribute15;
426 l_asset_desc_rec.lease_desc_flex.attribute_category_code :=
427 p_ls_attribute_category_code;
428 l_asset_desc_rec.global_desc_flex.attribute1 := p_ad_global_attribute1;
429 l_asset_desc_rec.global_desc_flex.attribute2 := p_ad_global_attribute2;
430 l_asset_desc_rec.global_desc_flex.attribute3 := p_ad_global_attribute3;
431 l_asset_desc_rec.global_desc_flex.attribute4 := p_ad_global_attribute4;
432 l_asset_desc_rec.global_desc_flex.attribute5 := p_ad_global_attribute5;
433 l_asset_desc_rec.global_desc_flex.attribute6 := p_ad_global_attribute6;
434 l_asset_desc_rec.global_desc_flex.attribute7 := p_ad_global_attribute7;
435 l_asset_desc_rec.global_desc_flex.attribute8 := p_ad_global_attribute8;
436 l_asset_desc_rec.global_desc_flex.attribute9 := p_ad_global_attribute9;
437 l_asset_desc_rec.global_desc_flex.attribute10 := p_ad_global_attribute10;
438 l_asset_desc_rec.global_desc_flex.attribute11 := p_ad_global_attribute11;
439 l_asset_desc_rec.global_desc_flex.attribute12 := p_ad_global_attribute12;
440 l_asset_desc_rec.global_desc_flex.attribute13 := p_ad_global_attribute13;
441 l_asset_desc_rec.global_desc_flex.attribute14 := p_ad_global_attribute14;
442 l_asset_desc_rec.global_desc_flex.attribute15 := p_ad_global_attribute15;
443 l_asset_desc_rec.global_desc_flex.attribute16 := p_ad_global_attribute16;
444 l_asset_desc_rec.global_desc_flex.attribute17 := p_ad_global_attribute17;
445 l_asset_desc_rec.global_desc_flex.attribute18 := p_ad_global_attribute18;
446 l_asset_desc_rec.global_desc_flex.attribute19 := p_ad_global_attribute19;
447 l_asset_desc_rec.global_desc_flex.attribute20 := p_ad_global_attribute20;
448 l_asset_desc_rec.global_desc_flex.attribute_category_code :=
449 p_ad_global_attribute_category;
450
451 -- ***** Asset Type Info ***** --
452 l_asset_type_rec.asset_type := p_asset_type;
453
454 -- ***** Asset Category Info ***** --
455 l_asset_cat_rec.category_id := p_category_id;
456 l_asset_cat_rec.desc_flex.attribute1 := p_cat_attribute1;
457 l_asset_cat_rec.desc_flex.attribute2 := p_cat_attribute2;
458 l_asset_cat_rec.desc_flex.attribute3 := p_cat_attribute3;
459 l_asset_cat_rec.desc_flex.attribute4 := p_cat_attribute4;
460 l_asset_cat_rec.desc_flex.attribute5 := p_cat_attribute5;
461 l_asset_cat_rec.desc_flex.attribute6 := p_cat_attribute6;
462 l_asset_cat_rec.desc_flex.attribute7 := p_cat_attribute7;
463 l_asset_cat_rec.desc_flex.attribute8 := p_cat_attribute8;
464 l_asset_cat_rec.desc_flex.attribute9 := p_cat_attribute9;
465 l_asset_cat_rec.desc_flex.attribute10 := p_cat_attribute10;
466 l_asset_cat_rec.desc_flex.attribute11 := p_cat_attribute11;
467 l_asset_cat_rec.desc_flex.attribute12 := p_cat_attribute12;
468 l_asset_cat_rec.desc_flex.attribute13 := p_cat_attribute13;
469 l_asset_cat_rec.desc_flex.attribute14 := p_cat_attribute14;
470 l_asset_cat_rec.desc_flex.attribute15 := p_cat_attribute15;
471 l_asset_cat_rec.desc_flex.attribute16 := p_cat_attribute16;
472 l_asset_cat_rec.desc_flex.attribute17 := p_cat_attribute17;
473 l_asset_cat_rec.desc_flex.attribute18 := p_cat_attribute18;
474 l_asset_cat_rec.desc_flex.attribute19 := p_cat_attribute19;
475 l_asset_cat_rec.desc_flex.attribute20 := p_cat_attribute20;
476 l_asset_cat_rec.desc_flex.attribute21 := p_cat_attribute21;
477 l_asset_cat_rec.desc_flex.attribute22 := p_cat_attribute22;
478 l_asset_cat_rec.desc_flex.attribute23 := p_cat_attribute23;
479 l_asset_cat_rec.desc_flex.attribute24 := p_cat_attribute24;
480 l_asset_cat_rec.desc_flex.attribute25 := p_cat_attribute25;
481 l_asset_cat_rec.desc_flex.attribute26 := p_cat_attribute26;
482 l_asset_cat_rec.desc_flex.attribute27 := p_cat_attribute27;
483 l_asset_cat_rec.desc_flex.attribute28 := p_cat_attribute28;
484 l_asset_cat_rec.desc_flex.attribute29 := p_cat_attribute29;
485 l_asset_cat_rec.desc_flex.attribute30 := p_cat_attribute30;
486 l_asset_cat_rec.desc_flex.attribute_category_code :=
487 p_cat_attribute_category_code;
488 l_asset_cat_rec.desc_flex.context := p_context;
489
490 -- ***** Asset Hierarchy Info ***** --
491 l_asset_hierarchy_rec.parent_hierarchy_id := p_parent_hierarchy_id;
492
493 -- ***** Asset Financial Info ***** --
494 l_asset_fin_rec.set_of_books_id := l_asset_hdr_rec.set_of_books_id;
495 l_asset_fin_rec.date_placed_in_service := p_date_placed_in_service;
496 l_asset_fin_rec.deprn_method_code := p_deprn_method_code;
497 l_asset_fin_rec.life_in_months := p_life_in_months;
498 l_asset_fin_rec.cost := p_cost;
499 l_asset_fin_rec.original_cost := p_original_cost;
500 l_asset_fin_rec.unrevalued_cost := p_unrevalued_cost;
501 l_asset_fin_rec.salvage_value := p_salvage_value;
502 l_asset_fin_rec.prorate_convention_code := p_prorate_convention_code;
503 l_asset_fin_rec.depreciate_flag := p_depreciate_flag;
504 --HH group ed.
505 l_asset_fin_rec.disabled_flag := p_disabled_flag;
506 l_asset_fin_rec.itc_amount_id := p_itc_amount_id;
507 l_asset_fin_rec.basic_rate := p_basic_rate;
508 l_asset_fin_rec.adjusted_rate := p_adjusted_rate;
509 l_asset_fin_rec.bonus_rule := p_bonus_rule;
510 l_asset_fin_rec.ceiling_name := p_ceiling_name;
511 --l_asset_fin_rec.idled_flag :=
512 l_asset_fin_rec.production_capacity := p_production_capacity;
513 l_asset_fin_rec.reval_ceiling := p_reval_ceiling;
514 l_asset_fin_rec.unit_of_measure := p_unit_of_measure;
515 --@@@l_asset_fin_rec.allowed_deprn_limit := p_allowed_deprn_limit;
516 --l_asset_fin_rec.allowed_deprn_limit_amount := p_allowed_deprn_limit_amount;
517 /* toru */
518 l_asset_fin_rec.percent_salvage_value := p_percent_salvage_value;
519 l_asset_fin_rec.allowed_deprn_limit := p_allowed_deprn_limit;
520 l_asset_fin_rec.allowed_deprn_limit_amount := p_allowed_deprn_limit_amount;
521 /* Etoru */
522 l_asset_fin_rec.short_fiscal_year_flag := p_short_fiscal_year_flag;
523 l_asset_fin_rec.conversion_date := p_conversion_date;
524 l_asset_fin_rec.orig_deprn_start_date := p_orig_deprn_start_date;
525 l_asset_fin_rec.group_asset_id := p_group_asset_id;
526 /* toru */
527 l_asset_fin_rec.super_group_id := p_super_group_id;
528 l_asset_fin_rec.reduction_rate := p_reduction_rate;
529 l_asset_fin_rec.reduce_addition_flag := p_reduce_addition_flag;
530 l_asset_fin_rec.reduce_adjustment_flag := p_reduce_adjustment_flag;
531 l_asset_fin_rec.reduce_retirement_flag := p_reduce_retirement_flag;
532 l_asset_fin_rec.over_depreciate_option := p_over_depreciate_option;
533 l_asset_fin_rec.recognize_gain_loss := p_recognize_gain_loss;
534 l_asset_fin_rec.recapture_reserve_flag := p_recapture_reserve_flag;
535 l_asset_fin_rec.limit_proceeds_flag := p_limit_proceeds_flag;
536 l_asset_fin_rec.terminal_gain_loss := p_terminal_gain_loss;
537 l_asset_fin_rec.exclude_proceeds_from_basis := p_exclude_proceeds_from_basis;
538 l_asset_fin_rec.retirement_deprn_option := p_retirement_deprn_option;
539 l_asset_fin_rec.salvage_type := p_salvage_type;
540 l_asset_fin_rec.deprn_limit_type := p_deprn_limit_type;
541 l_asset_fin_rec.tracking_method := p_tracking_method;
542 l_asset_fin_rec.allocate_to_fully_rsv_flag := p_allocate_to_fully_rsv_flag;
543 l_asset_fin_rec.allocate_to_fully_ret_flag := p_allocate_to_fully_ret_flag;
544 l_asset_fin_rec.excess_allocation_option := p_excess_allocation_option;
545 l_asset_fin_rec.depreciation_option := p_depreciation_option;
546 l_asset_fin_rec.member_rollup_flag := p_member_rollup_flag;
547 l_asset_fin_rec.ytd_proceeds := p_ytd_proceeds;
548 l_asset_fin_rec.ltd_proceeds := p_ltd_proceeds;
549 l_asset_fin_rec.exclude_fully_rsv_flag := p_exclude_fully_rsv_flag;
550 l_asset_fin_rec.eofy_reserve := p_eofy_reserve;
551
552 l_asset_fin_rec.cash_generating_unit_id := p_cash_generating_unit_id;
553
554 -- Changes made as per the ER No.s 6606548 and 6606552 by Sbyreddy Start
555 l_asset_fin_rec.nbv_at_switch := p_nbv_at_switch;
556 l_asset_fin_rec.prior_deprn_limit_type := p_prior_deprn_limit_type ;
557 l_asset_fin_rec.prior_deprn_limit_amount := p_prior_deprn_limit_amount ;
558 l_asset_fin_rec.prior_deprn_limit := p_prior_deprn_limit ;
559 l_asset_fin_rec.period_counter_fully_reserved := p_period_counter_fully_rsrved ;
560 l_asset_fin_rec.extended_depreciation_period := p_extended_depreciation_period ;
561 l_asset_fin_rec.prior_deprn_method := p_prior_deprn_method ;
562 l_asset_fin_rec.prior_life_in_months := p_prior_life_in_months ;
563 l_asset_fin_rec.prior_basic_rate := p_prior_basic_rate ;
564 l_asset_fin_rec.prior_adjusted_rate := p_prior_adjusted_rate ;
565 l_asset_fin_rec.extended_deprn_flag := p_extended_deprn_flag ;
566
567 -- Changes made as per the ER No.s 6606548 and 6606552 by Sbyreddy End
568
569 /* Etoru */
570 l_asset_fin_rec.global_attribute1 := p_bk_global_attribute1;
571 l_asset_fin_rec.global_attribute2 := p_bk_global_attribute2;
572 l_asset_fin_rec.global_attribute3 := p_bk_global_attribute3;
573 l_asset_fin_rec.global_attribute4 := p_bk_global_attribute4;
574 l_asset_fin_rec.global_attribute5 := p_bk_global_attribute5;
575 l_asset_fin_rec.global_attribute6 := p_bk_global_attribute6;
576 l_asset_fin_rec.global_attribute7 := p_bk_global_attribute7;
577 l_asset_fin_rec.global_attribute8 := p_bk_global_attribute8;
578 l_asset_fin_rec.global_attribute9 := p_bk_global_attribute9;
579 l_asset_fin_rec.global_attribute10 := p_bk_global_attribute10;
580 l_asset_fin_rec.global_attribute11 := p_bk_global_attribute11;
581 l_asset_fin_rec.global_attribute12 := p_bk_global_attribute12;
582 l_asset_fin_rec.global_attribute13 := p_bk_global_attribute13;
583 l_asset_fin_rec.global_attribute14 := p_bk_global_attribute14;
584 l_asset_fin_rec.global_attribute15 := p_bk_global_attribute15;
585 l_asset_fin_rec.global_attribute16 := p_bk_global_attribute16;
586 l_asset_fin_rec.global_attribute17 := p_bk_global_attribute17;
587 l_asset_fin_rec.global_attribute18 := p_bk_global_attribute18;
588 l_asset_fin_rec.global_attribute19 := p_bk_global_attribute19;
589 l_asset_fin_rec.global_attribute20 := p_bk_global_attribute20;
590 l_asset_fin_rec.global_attribute_category := p_bk_global_attribute_category;
591
592 -- ***** Asset Depreciation Info ***** --
593 l_asset_deprn_rec.set_of_books_id := l_asset_hdr_rec.set_of_books_id;
594 --l_asset_deprn_rec.deprn_amount :=
595 l_asset_deprn_rec.ytd_deprn := p_ytd_deprn;
596 l_asset_deprn_rec.deprn_reserve := p_deprn_reserve;
597 --l_asset_deprn_rec.prior_fy_expense :=
598 --l_asset_deprn_rec.bonus_deprn_amount :=
599 --l_asset_deprn_rec.bonus_ytd_deprn :=
600 --l_asset_deprn_rec.prior_fy_bonus_expense :=
601 --l_asset_deprn_rec.reval_amortization :=
602 --l_asset_deprn_rec.reval_amortization_basis :=
603 --l_asset_deprn_rec.reval_deprn_expense :=
604 --l_asset_deprn_rec.reval_ytd_deprn :=
605 l_asset_deprn_rec.reval_deprn_reserve := p_reval_deprn_reserve;
606 --l_asset_deprn_rec.production :=
607 l_asset_deprn_rec.ltd_production := p_ltd_production;
608 l_asset_deprn_rec.ytd_production := p_ytd_production;
609
610 -- ***** Asset Distribution Info ***** --
611 l_asset_dist_tbl.delete;
612
613 -- Get the details from fa_load_tbl_pkg.dist_table
614 for i in 1 .. fa_load_tbl_pkg.dist_table.count loop
615 if (fa_load_tbl_pkg.dist_table(i).record_status = 'INSERT') then
616 l_asset_dist_rec.distribution_id :=
617 fa_load_tbl_pkg.dist_table(i).dist_id;
618 l_asset_dist_rec.units_assigned :=
619 fa_load_tbl_pkg.dist_table(i).trans_units;
620 l_asset_dist_rec.transaction_units := NULL;
621 l_asset_dist_rec.assigned_to :=
622 fa_load_tbl_pkg.dist_table(i).assigned_to;
623 l_asset_dist_rec.expense_ccid := fa_load_tbl_pkg.dist_table(i).ccid;
624 l_asset_dist_rec.location_ccid :=
625 fa_load_tbl_pkg.dist_table(i).location_id;
626
627 l_asset_dist_tbl(i) := l_asset_dist_rec;
628 end if;
629 end loop;
630
631 -- ***** Invoice Info ***** --
632 l_inv_tbl.delete;
633
634 -- Get the details from fa_load_tbl_pkg.inv_table
635 for i in 1 .. fa_load_tbl_pkg.inv_table.COUNT loop
636
637 l_inv_rec.po_vendor_id := fa_load_tbl_pkg.inv_table(i).po_vendor_id;
638 l_inv_rec.asset_invoice_id :=
639 fa_load_tbl_pkg.inv_table(i).asset_invoice_id;
640 l_inv_rec.fixed_assets_cost :=
641 fa_load_tbl_pkg.inv_table(i).fixed_assets_cost;
642 l_inv_rec.deleted_flag := fa_load_tbl_pkg.inv_table(i).deleted_flag;
643 l_inv_rec.po_number := fa_load_tbl_pkg.inv_table(i).po_number;
644 l_inv_rec.invoice_number := fa_load_tbl_pkg.inv_table(i).invoice_number;
645 l_inv_rec.payables_batch_name :=
646 fa_load_tbl_pkg.inv_table(i).payables_batch_name;
647 l_inv_rec.payables_code_combination_id :=
648 fa_load_tbl_pkg.inv_table(i).payables_ccid;
649 l_inv_rec.feeder_system_name :=
650 fa_load_tbl_pkg.inv_table(i).feeder_system_name;
651 l_inv_rec.create_batch_date :=
652 fa_load_tbl_pkg.inv_table(i).create_batch_date;
653 l_inv_rec.create_batch_id :=
654 fa_load_tbl_pkg.inv_table(i).create_batch_id;
655 l_inv_rec.invoice_date := fa_load_tbl_pkg.inv_table(i).invoice_date;
656 l_inv_rec.payables_cost := fa_load_tbl_pkg.inv_table(i).payables_cost;
657 l_inv_rec.post_batch_id := fa_load_tbl_pkg.inv_table(i).post_batch_id;
658 l_inv_rec.invoice_id := fa_load_tbl_pkg.inv_table(i).invoice_id;
659 l_inv_rec.invoice_distribution_id := fa_load_tbl_pkg.inv_table(i).invoice_distribution_id;
660 l_inv_rec.invoice_line_number := fa_load_tbl_pkg.inv_table(i).invoice_line_number;
661 l_inv_rec.po_distribution_id := fa_load_tbl_pkg.inv_table(i).po_distribution_id;
662 l_inv_rec.ap_distribution_line_number :=
663 fa_load_tbl_pkg.inv_table(i).ap_dist_line_num;
664 l_inv_rec.payables_units := fa_load_tbl_pkg.inv_table(i).payables_units;
665 --l_inv_rec.split_merged_code :=
666 l_inv_rec.description := fa_load_tbl_pkg.inv_table(i).description;
667 --l_inv_rec.parent_mass_additions_id :=
668 --l_inv_rec.unrevalued_cost :=
669 --l_inv_rec.merged_code :=
670 --l_inv_rec.split_code :=
671 --l_inv_rec.merge_parent_mass_additions_id :=
672 --l_inv_rec.split_parent_mass_additions_id :=
673 l_inv_rec.project_asset_line_id :=
674 fa_load_tbl_pkg.inv_table(i).project_asset_line_id;
675 l_inv_rec.project_id := fa_load_tbl_pkg.inv_table(i).project_id;
676 l_inv_rec.task_id := fa_load_tbl_pkg.inv_table(i).task_id;
677 l_inv_rec.material_indicator_flag :=
678 fa_load_tbl_pkg.inv_table(i).material_indicator_flag;
679 l_inv_rec.depreciate_in_group_flag :=
680 fa_load_tbl_pkg.inv_table(i).depreciate_in_group_flag;
681 l_inv_rec.source_line_id := fa_load_tbl_pkg.inv_table(i).source_line_id;
682 l_inv_rec.depreciate_in_group_flag := fa_load_tbl_pkg.inv_table(i).depreciate_in_group_flag;
683 l_inv_rec.attribute1 := fa_load_tbl_pkg.inv_table(i).attribute1;
684 l_inv_rec.attribute2 := fa_load_tbl_pkg.inv_table(i).attribute2;
685 l_inv_rec.attribute3 := fa_load_tbl_pkg.inv_table(i).attribute3;
686 l_inv_rec.attribute4 := fa_load_tbl_pkg.inv_table(i).attribute4;
687 l_inv_rec.attribute5 := fa_load_tbl_pkg.inv_table(i).attribute5;
688 l_inv_rec.attribute6 := fa_load_tbl_pkg.inv_table(i).attribute6;
689 l_inv_rec.attribute7 := fa_load_tbl_pkg.inv_table(i).attribute7;
690 l_inv_rec.attribute8 := fa_load_tbl_pkg.inv_table(i).attribute8;
691 l_inv_rec.attribute9 := fa_load_tbl_pkg.inv_table(i).attribute9;
692 l_inv_rec.attribute10 := fa_load_tbl_pkg.inv_table(i).attribute10;
693 l_inv_rec.attribute11 := fa_load_tbl_pkg.inv_table(i).attribute11;
694 l_inv_rec.attribute12 := fa_load_tbl_pkg.inv_table(i).attribute12;
695 l_inv_rec.attribute13 := fa_load_tbl_pkg.inv_table(i).attribute13;
696 l_inv_rec.attribute14 := fa_load_tbl_pkg.inv_table(i).attribute14;
697 l_inv_rec.attribute15 := fa_load_tbl_pkg.inv_table(i).attribute15;
698 l_inv_rec.attribute_category_code :=
699 fa_load_tbl_pkg.inv_table(i).attribute_cat_code;
700
701 l_inv_tbl(i) := l_inv_rec;
702 end loop;
703
704
705 /* toru */
706 -- ***** Group Reclass Options ***** --
707 l_group_reclass_options_rec.group_reclass_type := p_reclass_transfer_type;
708 l_group_reclass_options_rec.reserve_amount := p_reclass_transfer_amount;
709 l_group_reclass_options_rec.source_exp_amount := p_reclass_src_expense;
710 l_group_reclass_options_rec.destination_exp_amount := p_reclass_dest_expense;
711 l_group_reclass_options_rec.source_eofy_reserve := p_reclass_src_eofy_reserve;
712 l_group_reclass_options_rec.destination_eofy_reserve := p_reclass_dest_eofy_reserve;
713 /* Etoru */
714
715 -- Fix for Bug #2392236. It is possible to NULL out fields for an addition
716 -- if the user does not want the value to default from a category, etc.
717 -- From an external interface, the user would pass G_MISS* for that field.
718 -- However, from the form, we need to derive it here since forms cannot
719 -- access global variables defined in PL/SQL. We only need to distinguish
720 -- between Detail Add snd Quick Add since there are some values you cannot
721 -- NULL out a value from Quick Add that you can in Detail Add.
722 -- For a form call, the p_calling_interface is FAXASSET
723 -- Detail Add, p_calling_fn is fa_addition_eng.post_forms_commit
724 -- Quick Add, p_calling_fn is fa_addition_dist1.call_quick_add
725 if (p_calling_interface = 'FAXASSET') then
726
727 -- Check bonus rule. Can only be nulled out in Detail Add.
728 if ((p_bonus_rule is NULL) and
729 (p_calling_fn = 'fa_addition_eng.post_forms_commit')) then
730
731 l_asset_fin_rec.bonus_rule := FND_API.G_MISS_CHAR;
732 end if;
733
734 -- Check ceiling name. Can only be nulled out in Detail Add.
735 if ((p_ceiling_name is NULL) and
736 (p_calling_fn = 'fa_addition_eng.post_forms_commit')) then
737
738 l_asset_fin_rec.ceiling_name := FND_API.G_MISS_CHAR;
739 end if;
740
741 -- Check group_asset_id. Can be nulled out in Detail or Quick Add.
742 if (p_group_asset_id is NULL) then
743 l_asset_fin_rec.group_asset_id := FND_API.G_MISS_NUM;
744 end if;
745 end if;
746
747 -- Call the Public Additions API
748 fa_addition_pub.do_addition
749 (p_api_version => p_api_version,
750 p_init_msg_list => p_init_msg_list,
751 p_commit => p_commit,
752 p_validation_level => p_validation_level,
753 x_return_status => x_return_status,
754 x_msg_count => x_msg_count,
755 x_msg_data => x_msg_data,
756 p_calling_fn => p_calling_fn,
757 px_trans_rec => l_trans_rec,
758 px_dist_trans_rec => l_dist_trans_rec,
759 px_asset_hdr_rec => l_asset_hdr_rec,
760 px_asset_desc_rec => l_asset_desc_rec,
761 px_asset_type_rec => l_asset_type_rec,
762 px_asset_cat_rec => l_asset_cat_rec,
763 px_asset_hierarchy_rec => l_asset_hierarchy_rec,
764 px_asset_fin_rec => l_asset_fin_rec,
765 px_asset_deprn_rec => l_asset_deprn_rec,
766 px_asset_dist_tbl => l_asset_dist_tbl,
767 px_inv_tbl => l_inv_tbl
768 );
769
770 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
771 return;
772 end if;
773
774 -- Set the output variables to return back to the calling program.
775 x_asset_id := l_asset_hdr_rec.asset_id;
776 x_asset_number := l_asset_desc_rec.asset_number;
777 x_transaction_header_id := l_trans_rec.transaction_header_id;
778 x_dist_transaction_header_id := l_dist_trans_rec.transaction_header_id;
779
780 EXCEPTION
781 when others then
782 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_addition',
783 p_log_level_rec => g_log_level_rec);
784 x_return_status := FND_API.G_RET_STS_ERROR;
785
786 END do_addition;
787
788 PROCEDURE do_adjustment (
789 -- Standard Parameters --
790 p_api_version IN NUMBER,
791 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
792 p_commit IN VARCHAR2 := FND_API.G_FALSE,
793 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
794 x_return_status OUT NOCOPY VARCHAR2,
795 x_msg_count OUT NOCOPY NUMBER,
796 x_msg_data OUT NOCOPY VARCHAR2,
797 p_calling_fn IN VARCHAR2,
798 -- API Options --
799 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
800 p_reset_miss_flag IN VARCHAR2 DEFAULT 'NO',
801 -- Out Parameters --
802 x_transaction_header_id OUT NOCOPY NUMBER,
803 -- Transaction Info (Books) --
804 p_transaction_date_entered IN DATE DEFAULT NULL,
805 p_transaction_name IN VARCHAR2 DEFAULT NULL,
806 p_transaction_subtype IN VARCHAR2 DEFAULT NULL,
807 p_amortization_start_date IN DATE DEFAULT NULL,
808 p_mass_reference_id IN NUMBER DEFAULT NULL,
809 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
810 p_last_update_date IN DATE,
811 p_last_updated_by IN NUMBER,
812 p_created_by IN NUMBER,
813 p_creation_date IN DATE,
814 p_last_update_login IN NUMBER,
815 p_attribute1 IN VARCHAR2 DEFAULT NULL,
816 p_attribute2 IN VARCHAR2 DEFAULT NULL,
817 p_attribute3 IN VARCHAR2 DEFAULT NULL,
818 p_attribute4 IN VARCHAR2 DEFAULT NULL,
819 p_attribute5 IN VARCHAR2 DEFAULT NULL,
820 p_attribute6 IN VARCHAR2 DEFAULT NULL,
821 p_attribute7 IN VARCHAR2 DEFAULT NULL,
822 p_attribute8 IN VARCHAR2 DEFAULT NULL,
823 p_attribute9 IN VARCHAR2 DEFAULT NULL,
824 p_attribute10 IN VARCHAR2 DEFAULT NULL,
825 p_attribute11 IN VARCHAR2 DEFAULT NULL,
826 p_attribute12 IN VARCHAR2 DEFAULT NULL,
827 p_attribute13 IN VARCHAR2 DEFAULT NULL,
828 p_attribute14 IN VARCHAR2 DEFAULT NULL,
829 p_attribute15 IN VARCHAR2 DEFAULT NULL,
830 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
831 -- Asset Header Info --
832 p_asset_id IN NUMBER,
833 p_book_type_code IN VARCHAR2,
834 p_set_of_books_id IN NUMBER DEFAULT NULL,
835 -- Asset Financial Info --
836 p_cost IN NUMBER DEFAULT NULL,
837 p_original_cost IN NUMBER DEFAULT NULL,
838 p_unrevalued_cost IN NUMBER DEFAULT NULL,
839 p_recoverable_cost IN NUMBER DEFAULT NULL,
840 p_salvage_value IN NUMBER DEFAULT NULL,
841 p_ceiling_name IN VARCHAR2 DEFAULT NULL,
842 p_reval_ceiling IN NUMBER DEFAULT NULL,
843 p_depreciate_flag IN VARCHAR2 DEFAULT NULL,
844 -- HH group ed.
845 p_disabled_flag IN VARCHAR2 DEFAULT NULL,
846 p_date_placed_in_service IN DATE DEFAULT NULL,
847 p_prorate_convention_code IN VARCHAR2 DEFAULT NULL,
848 p_deprn_method_code IN VARCHAR2 DEFAULT NULL,
849 p_life_in_months IN NUMBER DEFAULT NULL,
850 p_basic_rate IN NUMBER DEFAULT NULL,
851 p_adjusted_rate IN NUMBER DEFAULT NULL,
852 p_production_capacity IN NUMBER DEFAULT NULL,
853 p_unit_of_measure IN VARCHAR2 DEFAULT NULL,
854 p_bonus_rule IN VARCHAR2 DEFAULT NULL,
855 p_itc_amount_id IN NUMBER DEFAULT NULL,
856 p_short_fiscal_year_flag IN VARCHAR2 DEFAULT NULL,
857 p_conversion_date IN DATE DEFAULT NULL,
858 p_orig_deprn_start_date IN DATE DEFAULT NULL,
859 p_group_asset_id IN NUMBER DEFAULT NULL,
860 /* toru */
861 -- Addition for Group Depreciation
862 p_percent_salvage_value IN NUMBER DEFAULT NULL,
863 p_allowed_deprn_limit IN NUMBER DEFAULT NULL,
864 p_allowed_deprn_limit_amount IN NUMBER DEFAULT NULL,
865 p_super_group_id IN NUMBER DEFAULT NULL,
866 p_reduction_rate IN NUMBER DEFAULT NULL,
867 p_reduce_addition_flag IN VARCHAR2 DEFAULT NULL,
868 p_reduce_adjustment_flag IN VARCHAR2 DEFAULT NULL,
869 p_reduce_retirement_flag IN VARCHAR2 DEFAULT NULL,
870 p_over_depreciate_option IN VARCHAR2 DEFAULT NULL,
871 p_recognize_gain_loss IN VARCHAR2 DEFAULT NULL,
872 p_recapture_reserve_flag IN VARCHAR2 DEFAULT NULL,
873 p_limit_proceeds_flag IN VARCHAR2 DEFAULT NULL,
874 p_terminal_gain_loss IN VARCHAR2 DEFAULT NULL,
875 p_exclude_proceeds_from_basis IN VARCHAR2 DEFAULT NULL,
876 p_retirement_deprn_option IN VARCHAR2 DEFAULT NULL,
877 p_salvage_type IN VARCHAR2 DEFAULT NULL,
878 p_deprn_limit_type IN VARCHAR2 DEFAULT NULL,
879 p_tracking_method IN VARCHAR2 DEFAULT NULL,
880 p_allocate_to_fully_rsv_flag IN VARCHAR2 DEFAULT NULL,
881 p_allocate_to_fully_ret_flag IN VARCHAR2 DEFAULT NULL,
882 p_excess_allocation_option IN VARCHAR2 DEFAULT NULL,
883 p_depreciation_option IN VARCHAR2 DEFAULT NULL,
884 p_member_rollup_flag IN VARCHAR2 DEFAULT NULL,
885 p_ytd_proceeds IN NUMBER DEFAULT NULL,
886 p_ltd_proceeds IN NUMBER DEFAULT NULL,
887 p_exclude_fully_rsv_flag IN VARCHAR2 DEFAULT NULL,
888 p_eofy_reserve IN NUMBER DEFAULT NULL,
889 p_reclass_transfer_type IN VARCHAR2 DEFAULT NULL,
890 p_reclass_transfer_amount IN NUMBER DEFAULT NULL,
891 p_reclass_src_expense IN NUMBER DEFAULT NULL,
892 p_reclass_dest_expense IN NUMBER DEFAULT NULL,
893 p_reclass_src_eofy_reserve IN NUMBER DEFAULT NULL,
894 p_reclass_dest_eofy_reserve IN NUMBER DEFAULT NULL,
895 -- End of Addition for Group Depreciation
896 /* Etoru */
897 p_bk_global_attribute1 IN VARCHAR2 DEFAULT NULL,
898 p_bk_global_attribute2 IN VARCHAR2 DEFAULT NULL,
899 p_bk_global_attribute3 IN VARCHAR2 DEFAULT NULL,
900 p_bk_global_attribute4 IN VARCHAR2 DEFAULT NULL,
901 p_bk_global_attribute5 IN VARCHAR2 DEFAULT NULL,
902 p_bk_global_attribute6 IN VARCHAR2 DEFAULT NULL,
903 p_bk_global_attribute7 IN VARCHAR2 DEFAULT NULL,
904 p_bk_global_attribute8 IN VARCHAR2 DEFAULT NULL,
905 p_bk_global_attribute9 IN VARCHAR2 DEFAULT NULL,
906 p_bk_global_attribute10 IN VARCHAR2 DEFAULT NULL,
907 p_bk_global_attribute11 IN VARCHAR2 DEFAULT NULL,
908 p_bk_global_attribute12 IN VARCHAR2 DEFAULT NULL,
909 p_bk_global_attribute13 IN VARCHAR2 DEFAULT NULL,
910 p_bk_global_attribute14 IN VARCHAR2 DEFAULT NULL,
911 p_bk_global_attribute15 IN VARCHAR2 DEFAULT NULL,
912 p_bk_global_attribute16 IN VARCHAR2 DEFAULT NULL,
913 p_bk_global_attribute17 IN VARCHAR2 DEFAULT NULL,
914 p_bk_global_attribute18 IN VARCHAR2 DEFAULT NULL,
915 p_bk_global_attribute19 IN VARCHAR2 DEFAULT NULL,
916 p_bk_global_attribute20 IN VARCHAR2 DEFAULT NULL,
917 p_bk_global_attribute_category IN VARCHAR2 DEFAULT NULL,
918 -- Asset Depreciation Info --
919 p_ytd_deprn IN NUMBER DEFAULT NULL,
920 p_deprn_reserve IN NUMBER DEFAULT NULL,
921 p_reval_deprn_reserve IN NUMBER DEFAULT NULL,
922 p_ytd_production IN NUMBER DEFAULT NULL,
923 p_ltd_production IN NUMBER DEFAULT NULL,
924 -- Invoice Info --
925 p_invoice_transaction_type IN VARCHAR2 DEFAULT NULL,
926 -- Group Reclass Options --
927 p_transfer_flag IN VARCHAR2 DEFAULT NULL,
928 p_manual_amount IN NUMBER DEFAULT NULL,
929 p_manual_flag IN VARCHAR2 DEFAULT NULL,
930 -- IAS36 Impairment Info --
931 p_cash_generating_unit_id IN NUMBER DEFAULT NULL,
932 -- Changes made as per the ER No.s 6606548 and 6606552 by Sbyreddy Start
933 p_nbv_at_switch IN NUMBER DEFAULT NULL,
934 p_prior_deprn_limit_type IN VARCHAR2 DEFAULT NULL,
935 p_prior_deprn_limit_amount IN NUMBER DEFAULT NULL,
936 p_prior_deprn_limit IN NUMBER DEFAULT NULL,
937 p_period_counter_fully_rsrved IN VARCHAR2 DEFAULT NULL,
938 p_extended_depreciation_period IN VARCHAR2 DEFAULT NULL,
939 p_prior_deprn_method IN VARCHAR2 DEFAULT NULL,
940 p_prior_life_in_months IN NUMBER DEFAULT NULL,
941 p_prior_basic_rate IN NUMBER DEFAULT NULL,
942 p_prior_adjusted_rate IN NUMBER DEFAULT NULL,
943 p_extended_deprn_flag IN VARCHAR2 DEFAULT NULL
944 -- Changes made as per the ER No.s 6606548 and 6606552 by Sbyreddy End
945 ) AS
946
947 adj_err exception;
948
949 l_trans_rec fa_api_types.trans_rec_type;
950 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
951 l_asset_fin_rec fa_api_types.asset_fin_rec_type;
952 l_asset_fin_rec_old fa_api_types.asset_fin_rec_type;
953 l_asset_fin_rec_adj fa_api_types.asset_fin_rec_type;
954 l_asset_fin_rec_new fa_api_types.asset_fin_rec_type;
955 l_asset_fin_mrc_tbl_new fa_api_types.asset_fin_tbl_type;
956 l_asset_deprn_rec fa_api_types.asset_deprn_rec_type;
957 l_asset_deprn_rec_old fa_api_types.asset_deprn_rec_type;
958 l_asset_deprn_rec_adj fa_api_types.asset_deprn_rec_type;
959 l_asset_deprn_rec_new fa_api_types.asset_deprn_rec_type;
960 l_asset_deprn_mrc_tbl_new fa_api_types.asset_deprn_tbl_type;
961 l_inv_trans_rec fa_api_types.inv_trans_rec_type;
962 l_inv_rec fa_api_types.inv_rec_type;
963 l_inv_rec_old fa_api_types.inv_rec_type;
964 l_inv_tbl fa_api_types.inv_tbl_type;
965 l_group_reclass_options_rec fa_api_types.group_reclass_options_rec_type;
966
967 BEGIN
968 -- Initialize message list if p_init_msg_list is set to TRUE.
969 IF FND_API.To_Boolean(p_init_msg_list) THEN
970 -- Initialize error message stack.
971 FA_SRVR_MSG.Init_Server_Message;
972
973 -- Initialize debug message stack.
974 FA_DEBUG_PKG.Initialize;
975 END IF;
976
977 -- Override FA:PRINT_DEBUG profile option.
978 IF (p_debug_flag = 'YES') THEN
979 FA_DEBUG_PKG.Set_Debug_Flag;
980 END IF;
981
982 -- ***** Asset Transaction Info ***** --
983 --l_trans_rec.transaction_header_id :=
984 --l_trans_rec.transaction_type_code :=
985 l_trans_rec.transaction_date_entered := p_transaction_date_entered;
986 l_trans_rec.transaction_name := p_transaction_name;
987 --l_trans_rec.source_transaction_header_id :=
988 l_trans_rec.mass_reference_id := p_mass_reference_id;
989 l_trans_rec.transaction_subtype := p_transaction_subtype;
990 --l_trans_rec.transaction_key :=
991 l_trans_rec.amortization_start_date := p_amortization_start_date;
992 l_trans_rec.calling_interface := p_calling_interface;
993 l_trans_rec.desc_flex.attribute1 := p_attribute1;
994 l_trans_rec.desc_flex.attribute2 := p_attribute2;
995 l_trans_rec.desc_flex.attribute3 := p_attribute3;
996 l_trans_rec.desc_flex.attribute4 := p_attribute4;
997 l_trans_rec.desc_flex.attribute5 := p_attribute5;
998 l_trans_rec.desc_flex.attribute6 := p_attribute6;
999 l_trans_rec.desc_flex.attribute7 := p_attribute7;
1000 l_trans_rec.desc_flex.attribute8 := p_attribute8;
1001 l_trans_rec.desc_flex.attribute9 := p_attribute9;
1002 l_trans_rec.desc_flex.attribute10 := p_attribute10;
1003 l_trans_rec.desc_flex.attribute11 := p_attribute11;
1004 l_trans_rec.desc_flex.attribute12 := p_attribute12;
1005 l_trans_rec.desc_flex.attribute13 := p_attribute13;
1006 l_trans_rec.desc_flex.attribute14 := p_attribute14;
1007 l_trans_rec.desc_flex.attribute15 := p_attribute15;
1008 l_trans_rec.desc_flex.attribute_category_code :=
1009 p_attribute_category_code;
1010 l_trans_rec.who_info.last_update_date := p_last_update_date;
1011 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
1012 l_trans_rec.who_info.created_by := p_created_by;
1013 l_trans_rec.who_info.creation_date := p_creation_date;
1014 l_trans_rec.who_info.last_update_login := p_last_update_login;
1015
1016 -- If amort start date is set, then this will be the trans date
1017 if (l_trans_rec.amortization_start_date is NOT NULL) then
1018 l_trans_rec.transaction_date_entered :=
1019 l_trans_rec.amortization_start_date;
1020 l_trans_rec.transaction_subtype := 'AMORTIZED';
1021 end if;
1022
1023 -- ***** Asset Header Info ***** --
1024 l_asset_hdr_rec.asset_id := p_asset_id;
1025 l_asset_hdr_rec.book_type_code := p_book_type_code;
1026 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
1027 --l_asset_hdr_rec.period_of_addition :=
1028
1029 -- Derive set of books id for primary book
1030 if (l_asset_hdr_rec.set_of_books_id is NULL) then
1031 select set_of_books_id
1032 into l_asset_hdr_rec.set_of_books_id
1033 from fa_book_controls
1034 where book_type_code = l_asset_hdr_rec.book_type_code;
1035 end if;
1036
1037 -- Get the old asset financial record
1038 if (NOT fa_util_pvt.get_asset_fin_rec (
1039 p_asset_hdr_rec => l_asset_hdr_rec,
1040 px_asset_fin_rec => l_asset_fin_rec_old,
1041 p_mrc_sob_type_code => 'P',
1042 p_log_level_rec => g_log_level_rec
1043 )) then
1044 raise adj_err;
1045 end if;
1046
1047 -- Need to call the cache for book
1048 if (NOT fa_cache_pkg.fazcbc (
1049 X_book => l_asset_hdr_rec.book_type_code,
1050 p_log_level_rec => g_log_level_rec
1051 )) then
1052 raise adj_err;
1053 end if;
1054
1055 if (NOT fa_util_pvt.get_asset_deprn_rec (
1056 p_asset_hdr_rec => l_asset_hdr_rec,
1057 px_asset_deprn_rec => l_asset_deprn_rec_old,
1058 p_mrc_sob_type_code => 'P',
1059 p_log_level_rec => g_log_level_rec
1060 )) then
1061 raise adj_err;
1062 end if;
1063
1064 -- ***** Asset Financial Info ***** --
1065 l_asset_fin_rec_adj.set_of_books_id := l_asset_hdr_rec.set_of_books_id;
1066 l_asset_fin_rec_adj.date_placed_in_service := p_date_placed_in_service;
1067 l_asset_fin_rec_adj.deprn_method_code := p_deprn_method_code;
1068 l_asset_fin_rec_adj.life_in_months := p_life_in_months;
1069 l_asset_fin_rec_adj.cost := p_cost - nvl(l_asset_fin_rec_old.cost,0);
1070 l_asset_fin_rec_adj.original_cost :=
1071 p_original_cost - nvl(l_asset_fin_rec_old.original_cost,0);
1072 -- Relocate this in below because of introceing salvage_type
1073 -- l_asset_fin_rec_adj.salvage_value :=
1074 -- p_salvage_value - nvl(l_asset_fin_rec_old.salvage_value,0);
1075 l_asset_fin_rec_adj.prorate_convention_code := p_prorate_convention_code;
1076 l_asset_fin_rec_adj.depreciate_flag := p_depreciate_flag;
1077 --HH group ed
1078 l_asset_fin_rec_adj.disabled_flag := p_disabled_flag;
1079 l_asset_fin_rec_adj.itc_amount_id := p_itc_amount_id;
1080 l_asset_fin_rec_adj.basic_rate := p_basic_rate;
1081 l_asset_fin_rec_adj.adjusted_rate := p_adjusted_rate;
1082 l_asset_fin_rec_adj.bonus_rule := p_bonus_rule;
1083 l_asset_fin_rec_adj.ceiling_name := p_ceiling_name;
1084 l_asset_fin_rec_adj.recoverable_cost :=
1085 p_recoverable_cost - nvl(l_asset_fin_rec_old.recoverable_cost,0);
1086 l_asset_fin_rec_adj.production_capacity :=
1087 p_production_capacity - nvl(l_asset_fin_rec_old.production_capacity,0);
1088
1089 if (p_reval_ceiling is NULL) then
1090 l_asset_fin_rec_adj.reval_ceiling := NULL;
1091 else
1092 l_asset_fin_rec_adj.reval_ceiling :=
1093 p_reval_ceiling -
1094 nvl(l_asset_fin_rec_old.reval_ceiling,0);
1095 end if;
1096
1097 l_asset_fin_rec_adj.unit_of_measure := p_unit_of_measure;
1098 l_asset_fin_rec_adj.unrevalued_cost :=
1099 p_unrevalued_cost - nvl(l_asset_fin_rec_old.unrevalued_cost,0);
1100 l_asset_fin_rec_adj.short_fiscal_year_flag := p_short_fiscal_year_flag;
1101 l_asset_fin_rec_adj.conversion_date := p_conversion_date;
1102 l_asset_fin_rec_adj.orig_deprn_start_date := p_orig_deprn_start_date;
1103 l_asset_fin_rec_adj.group_asset_id := p_group_asset_id;
1104
1105 l_asset_fin_rec_adj.salvage_value :=
1106 p_salvage_value - nvl(l_asset_fin_rec_old.salvage_value,0);
1107 if (l_asset_fin_rec_old.salvage_type <>
1108 nvl(p_salvage_type, l_asset_fin_rec_old.salvage_type)) then
1109 l_asset_fin_rec_adj.salvage_value := p_salvage_value;
1110 l_asset_fin_rec_adj.percent_salvage_value := p_percent_salvage_value;
1111 else
1112 l_asset_fin_rec_adj.salvage_value :=
1113 p_salvage_value - nvl(l_asset_fin_rec_old.salvage_value,0);
1114 l_asset_fin_rec_adj.percent_salvage_value :=
1115 p_percent_salvage_value - nvl(l_asset_fin_rec_old.percent_salvage_value, 0);
1116 end if; -- (l_asset_fin_rec_old.salvage_type <>
1117
1118 if (nvl(p_deprn_limit_type,'NONE') = 'NONE') then
1119 l_asset_fin_rec_adj.allowed_deprn_limit := to_number(null);
1120 l_asset_fin_rec_adj.allowed_deprn_limit_amount := to_number(null);
1121 elsif (l_asset_fin_rec_old.deprn_limit_type <>
1122 nvl(p_deprn_limit_type, l_asset_fin_rec_old.deprn_limit_type)) then
1123 l_asset_fin_rec_adj.allowed_deprn_limit := p_allowed_deprn_limit;
1124 l_asset_fin_rec_adj.allowed_deprn_limit_amount := p_allowed_deprn_limit_amount;
1125 else
1126 l_asset_fin_rec_adj.allowed_deprn_limit :=
1127 p_allowed_deprn_limit - nvl(l_asset_fin_rec_old.allowed_deprn_limit, 0);
1128 l_asset_fin_rec_adj.allowed_deprn_limit_amount :=
1129 p_allowed_deprn_limit_amount -
1130 nvl(l_asset_fin_rec_old.allowed_deprn_limit_amount, 0);
1131 end if; -- (l_asset_fin_rec_old.salvage_type <>
1132
1133 l_asset_fin_rec_adj.super_group_id := nvl(p_super_group_id, FND_API.G_MISS_NUM);
1134 l_asset_fin_rec_adj.reduction_rate := nvl(p_reduction_rate, 0) -
1135 nvl(l_asset_fin_rec_old.reduction_rate, 0);
1136
1137 l_asset_fin_rec_adj.reduce_addition_flag := p_reduce_addition_flag;
1138 l_asset_fin_rec_adj.reduce_adjustment_flag := p_reduce_adjustment_flag;
1139 l_asset_fin_rec_adj.reduce_retirement_flag := p_reduce_retirement_flag;
1140 l_asset_fin_rec_adj.over_depreciate_option := p_over_depreciate_option;
1141 l_asset_fin_rec_adj.recognize_gain_loss := p_recognize_gain_loss;
1142 l_asset_fin_rec_adj.recapture_reserve_flag := p_recapture_reserve_flag;
1143 l_asset_fin_rec_adj.limit_proceeds_flag := p_limit_proceeds_flag;
1144 l_asset_fin_rec_adj.terminal_gain_loss := p_terminal_gain_loss;
1145 l_asset_fin_rec_adj.exclude_proceeds_from_basis := p_exclude_proceeds_from_basis;
1146
1147 if (p_retirement_deprn_option is null) then
1148 l_asset_fin_rec_adj.retirement_deprn_option := FND_API.G_MISS_CHAR;
1149 else
1150 l_asset_fin_rec_adj.retirement_deprn_option := p_retirement_deprn_option;
1151 end if;
1152
1153 l_asset_fin_rec_adj.salvage_type := p_salvage_type;
1154 l_asset_fin_rec_adj.deprn_limit_type := p_deprn_limit_type;
1155 l_asset_fin_rec_adj.tracking_method := p_tracking_method;
1156
1157 if (p_tracking_method is null) then
1158 l_asset_fin_rec_adj.tracking_method := FND_API.G_MISS_CHAR;
1159 else
1160 l_asset_fin_rec_adj.tracking_method := p_tracking_method;
1161 end if;
1162
1163 l_asset_fin_rec_adj.allocate_to_fully_rsv_flag := p_allocate_to_fully_rsv_flag;
1164 l_asset_fin_rec_adj.allocate_to_fully_ret_flag := p_allocate_to_fully_ret_flag;
1165 l_asset_fin_rec_adj.excess_allocation_option := p_excess_allocation_option;
1166 l_asset_fin_rec_adj.depreciation_option := p_depreciation_option;
1167 l_asset_fin_rec_adj.member_rollup_flag := p_member_rollup_flag;
1168 -- Bug3200566:
1169 --these value cannot be something due to adjustments
1170 -- l_asset_fin_rec_adj.ytd_proceeds := p_ytd_proceeds;
1171 -- l_asset_fin_rec_adj.ltd_proceeds := p_ltd_proceeds;
1172 l_asset_fin_rec_adj.exclude_fully_rsv_flag := p_exclude_fully_rsv_flag;
1173
1174 if (p_cash_generating_unit_id is null) then
1175 l_asset_fin_rec_adj.cash_generating_unit_id := FND_API.G_MISS_NUM;
1176 else
1177 l_asset_fin_rec_adj.cash_generating_unit_id := p_cash_generating_unit_id;
1178 end if;
1179
1180 -- Changes made as per the ER No.s 6606548 and 6606552 by Sbyreddy Start
1181 l_asset_fin_rec_adj.nbv_at_switch := p_nbv_at_switch;
1182 l_asset_fin_rec_adj.prior_deprn_limit_type := p_prior_deprn_limit_type ;
1183 l_asset_fin_rec_adj.prior_deprn_limit_amount := p_prior_deprn_limit_amount ;
1184 l_asset_fin_rec_adj.prior_deprn_limit := p_prior_deprn_limit ;
1185 l_asset_fin_rec_adj.period_counter_fully_reserved := p_period_counter_fully_rsrved ;
1186 l_asset_fin_rec_adj.extended_depreciation_period := p_extended_depreciation_period ;
1187 l_asset_fin_rec_adj.prior_deprn_method := p_prior_deprn_method ;
1188 l_asset_fin_rec_adj.prior_life_in_months := p_prior_life_in_months ;
1189 l_asset_fin_rec_adj.prior_basic_rate := p_prior_basic_rate ;
1190 l_asset_fin_rec_adj.prior_adjusted_rate := p_prior_adjusted_rate ;
1191 l_asset_fin_rec_adj.extended_deprn_flag := p_extended_deprn_flag ;
1192 -- Changes made as per the ER No.s 6606548 and 6606552 by Sbyreddy End
1193
1194 ---- End of Addition
1195
1196 l_asset_fin_rec_adj.global_attribute1 := p_bk_global_attribute1;
1197 l_asset_fin_rec_adj.global_attribute2 := p_bk_global_attribute2;
1198 l_asset_fin_rec_adj.global_attribute3 := p_bk_global_attribute3;
1199 l_asset_fin_rec_adj.global_attribute4 := p_bk_global_attribute4;
1200 l_asset_fin_rec_adj.global_attribute5 := p_bk_global_attribute5;
1201 l_asset_fin_rec_adj.global_attribute6 := p_bk_global_attribute6;
1202 l_asset_fin_rec_adj.global_attribute7 := p_bk_global_attribute7;
1203 l_asset_fin_rec_adj.global_attribute8 := p_bk_global_attribute8;
1204 l_asset_fin_rec_adj.global_attribute9 := p_bk_global_attribute9;
1205 l_asset_fin_rec_adj.global_attribute10 := p_bk_global_attribute10;
1206 l_asset_fin_rec_adj.global_attribute11 := p_bk_global_attribute11;
1207 l_asset_fin_rec_adj.global_attribute12 := p_bk_global_attribute12;
1208 l_asset_fin_rec_adj.global_attribute13 := p_bk_global_attribute13;
1209 l_asset_fin_rec_adj.global_attribute14 := p_bk_global_attribute14;
1210 l_asset_fin_rec_adj.global_attribute15 := p_bk_global_attribute15;
1211 l_asset_fin_rec_adj.global_attribute16 := p_bk_global_attribute16;
1212 l_asset_fin_rec_adj.global_attribute17 := p_bk_global_attribute17;
1213 l_asset_fin_rec_adj.global_attribute18 := p_bk_global_attribute18;
1214 l_asset_fin_rec_adj.global_attribute19 := p_bk_global_attribute19;
1215 l_asset_fin_rec_adj.global_attribute20 := p_bk_global_attribute20;
1216 l_asset_fin_rec_adj.global_attribute_category :=
1217 p_bk_global_attribute_category;
1218
1219 if ((p_reset_miss_flag = 'YES') and
1220 (p_invoice_transaction_type is null)) then
1221
1222 -- Fix for Bug #2653564. Need to pass different record groups to IN
1223 -- and OUT parameters.
1224 l_asset_fin_rec := l_asset_fin_rec_adj;
1225
1226 if (NOT fa_trans_api_pvt.set_asset_fin_rec (
1227 p_asset_hdr_rec => l_asset_hdr_rec,
1228 p_asset_fin_rec => l_asset_fin_rec,
1229 x_asset_fin_rec_new => l_asset_fin_rec_adj,
1230 p_mrc_sob_type_code => 'P'
1231 )) then
1232 raise adj_err;
1233 end if;
1234 end if;
1235
1236 -- ***** Asset Depreciation Info ***** --
1237 l_asset_deprn_rec_adj.set_of_books_id := l_asset_hdr_rec.set_of_books_id;
1238 l_asset_deprn_rec_adj.ytd_deprn :=
1239 p_ytd_deprn - nvl(l_asset_deprn_rec_old.ytd_deprn,0);
1240 l_asset_deprn_rec_adj.deprn_reserve :=
1241 p_deprn_reserve - nvl(l_asset_deprn_rec_old.deprn_reserve,0);
1242 l_asset_deprn_rec_adj.reval_deprn_reserve :=
1243 p_reval_deprn_reserve - nvl(l_asset_deprn_rec_old.reval_deprn_reserve,0);
1244 --l_asset_deprn_rec_adj.ltd_production :=
1245 --l_asset_deprn_rec_adj.ytd_production :=
1246
1247 -- This needs to be taken care only after asset_deprn_rec_adj is determined
1248 l_asset_fin_rec_adj.eofy_reserve := l_asset_deprn_rec_adj.deprn_reserve -
1249 l_asset_deprn_rec_adj.ytd_deprn;
1250
1251 if ((p_reset_miss_flag = 'YES') and
1252 (p_invoice_transaction_type is null)) then
1253
1254 -- Fix for Bug #2653564. Need to pass different record groups to IN
1255 -- and OUT parameters.
1256 l_asset_deprn_rec := l_asset_deprn_rec_adj;
1257
1258 if (NOT fa_trans_api_pvt.set_asset_deprn_rec (
1259 p_asset_hdr_rec => l_asset_hdr_rec,
1260 p_asset_deprn_rec => l_asset_deprn_rec,
1261 x_asset_deprn_rec_new => l_asset_deprn_rec_adj,
1262 p_mrc_sob_type_code => 'P'
1263 )) then
1264 raise adj_err;
1265 end if;
1266 end if;
1267
1268 -- ***** Invoice Transaction Info ***** --
1269 --l_inv_trans_rec.invoice_transaction_id :=
1270 l_inv_trans_rec.transaction_type := p_invoice_transaction_type;
1271
1272 -- ***** Invoice Information ***** --
1273 l_inv_tbl.delete;
1274
1275 -- Get the details from fa_load_tbl_pkg.inv_table
1276 for i in 1 .. fa_load_tbl_pkg.inv_table.COUNT loop
1277
1278 l_inv_rec.po_vendor_id := fa_load_tbl_pkg.inv_table(i).po_vendor_id;
1279 l_inv_rec.asset_invoice_id :=
1280 fa_load_tbl_pkg.inv_table(i).asset_invoice_id;
1281 l_inv_rec.fixed_assets_cost :=
1282 fa_load_tbl_pkg.inv_table(i).inv_new_cost -
1283 nvl(fa_load_tbl_pkg.inv_table(i).fixed_assets_cost, 0);
1284 l_inv_rec.deleted_flag := fa_load_tbl_pkg.inv_table(i).deleted_flag;
1285 l_inv_rec.po_number := fa_load_tbl_pkg.inv_table(i).po_number;
1286 l_inv_rec.invoice_number := fa_load_tbl_pkg.inv_table(i).invoice_number;
1287 l_inv_rec.payables_batch_name :=
1288 fa_load_tbl_pkg.inv_table(i).payables_batch_name;
1289 l_inv_rec.payables_code_combination_id :=
1290 fa_load_tbl_pkg.inv_table(i).payables_ccid;
1291 l_inv_rec.feeder_system_name :=
1292 fa_load_tbl_pkg.inv_table(i).feeder_system_name;
1293 l_inv_rec.create_batch_date :=
1294 fa_load_tbl_pkg.inv_table(i).create_batch_date;
1295 l_inv_rec.create_batch_id :=
1296 fa_load_tbl_pkg.inv_table(i).create_batch_id;
1297 l_inv_rec.invoice_date := fa_load_tbl_pkg.inv_table(i).invoice_date;
1298 l_inv_rec.payables_cost := fa_load_tbl_pkg.inv_table(i).payables_cost;
1299 l_inv_rec.post_batch_id := fa_load_tbl_pkg.inv_table(i).post_batch_id;
1300 l_inv_rec.invoice_id := fa_load_tbl_pkg.inv_table(i).invoice_id;
1301 l_inv_rec.invoice_distribution_id := fa_load_tbl_pkg.inv_table(i).invoice_distribution_id;
1302 l_inv_rec.invoice_line_number := fa_load_tbl_pkg.inv_table(i).invoice_line_number;
1303 l_inv_rec.po_distribution_id := fa_load_tbl_pkg.inv_table(i).po_distribution_id;
1304 l_inv_rec.ap_distribution_line_number :=
1305 fa_load_tbl_pkg.inv_table(i).ap_dist_line_num;
1306 l_inv_rec.payables_units := fa_load_tbl_pkg.inv_table(i).payables_units;
1307 --l_inv_rec.split_merged_code :=
1308 l_inv_rec.description := fa_load_tbl_pkg.inv_table(i).description;
1309 --l_inv_rec.parent_mass_additions_id :=
1310 --l_inv_rec.unrevalued_cost :=
1311 --l_inv_rec.merged_code :=
1312 --l_inv_rec.split_code :=
1313 --l_inv_rec.merge_parent_mass_additions_id :=
1314 --l_inv_rec.split_parent_mass_additions_id :=
1315 l_inv_rec.project_asset_line_id :=
1316 fa_load_tbl_pkg.inv_table(i).project_asset_line_id;
1317 l_inv_rec.project_id := fa_load_tbl_pkg.inv_table(i).project_id;
1318 l_inv_rec.task_id := fa_load_tbl_pkg.inv_table(i).task_id;
1319 l_inv_rec.material_indicator_flag :=
1320 fa_load_tbl_pkg.inv_table(i).material_indicator_flag;
1321 l_inv_rec.depreciate_in_group_flag :=
1322 fa_load_tbl_pkg.inv_table(i).depreciate_in_group_flag;
1323 l_inv_rec.source_line_id := fa_load_tbl_pkg.inv_table(i).source_line_id;
1324 l_inv_rec.attribute1 := fa_load_tbl_pkg.inv_table(i).attribute1;
1325 l_inv_rec.attribute2 := fa_load_tbl_pkg.inv_table(i).attribute2;
1326 l_inv_rec.attribute3 := fa_load_tbl_pkg.inv_table(i).attribute3;
1327 l_inv_rec.attribute4 := fa_load_tbl_pkg.inv_table(i).attribute4;
1328 l_inv_rec.attribute5 := fa_load_tbl_pkg.inv_table(i).attribute5;
1329 l_inv_rec.attribute6 := fa_load_tbl_pkg.inv_table(i).attribute6;
1330 l_inv_rec.attribute7 := fa_load_tbl_pkg.inv_table(i).attribute7;
1331 l_inv_rec.attribute8 := fa_load_tbl_pkg.inv_table(i).attribute8;
1332 l_inv_rec.attribute9 := fa_load_tbl_pkg.inv_table(i).attribute9;
1333 l_inv_rec.attribute10 := fa_load_tbl_pkg.inv_table(i).attribute10;
1334 l_inv_rec.attribute11 := fa_load_tbl_pkg.inv_table(i).attribute11;
1335 l_inv_rec.attribute12 := fa_load_tbl_pkg.inv_table(i).attribute12;
1336 l_inv_rec.attribute13 := fa_load_tbl_pkg.inv_table(i).attribute13;
1337 l_inv_rec.attribute14 := fa_load_tbl_pkg.inv_table(i).attribute14;
1338 l_inv_rec.attribute15 := fa_load_tbl_pkg.inv_table(i).attribute15;
1339 l_inv_rec.attribute_category_code :=
1340 fa_load_tbl_pkg.inv_table(i).attribute_cat_code;
1341
1342 if ((p_reset_miss_flag = 'YES') and
1343 (l_inv_trans_rec.transaction_type = 'INVOICE ADJUSTMENT')) then
1344
1345 -- Fix for Bug #2653564. Need to pass different record groups to
1346 -- IN and OUT parameters.
1347 l_inv_rec_old := l_inv_rec;
1348
1349 if (NOT fa_trans_api_pvt.set_inv_rec (
1350 p_inv_rec => l_inv_rec_old,
1351 x_inv_rec_new => l_inv_rec,
1352 p_mrc_sob_type_code => 'P'
1353 )) then
1354 raise adj_err;
1355 end if;
1356 end if;
1357
1358 l_inv_tbl(i) := l_inv_rec;
1359 end loop;
1360
1361
1362 -- ***** Group Reclass Options ***** --
1363 l_group_reclass_options_rec.transfer_flag := p_transfer_flag;
1364 l_group_reclass_options_rec.manual_flag := p_manual_flag;
1365 l_group_reclass_options_rec.manual_amount := p_manual_amount;
1366 /* toru */
1367 l_group_reclass_options_rec.group_reclass_type := p_reclass_transfer_type;
1368 l_group_reclass_options_rec.reserve_amount := p_reclass_transfer_amount;
1369 l_group_reclass_options_rec.source_exp_amount := p_reclass_src_expense;
1370 l_group_reclass_options_rec.destination_exp_amount := p_reclass_dest_expense;
1371 l_group_reclass_options_rec.source_eofy_reserve := p_reclass_src_eofy_reserve;
1372 l_group_reclass_options_rec.destination_eofy_reserve := p_reclass_dest_eofy_reserve;
1373 /* Etoru */
1374
1375 -- Call the Public Adjustments API
1376 fa_adjustment_pub.do_adjustment
1377 (p_api_version => p_api_version,
1378 p_init_msg_list => p_init_msg_list,
1379 p_commit => p_commit,
1380 p_validation_level => p_validation_level,
1381 x_return_status => x_return_status,
1382 x_msg_count => x_msg_count,
1383 x_msg_data => x_msg_data,
1384 p_calling_fn => p_calling_fn,
1385 px_trans_rec => l_trans_rec,
1386 px_asset_hdr_rec => l_asset_hdr_rec,
1387 p_asset_fin_rec_adj => l_asset_fin_rec_adj,
1388 x_asset_fin_rec_new => l_asset_fin_rec_new,
1389 x_asset_fin_mrc_tbl_new => l_asset_fin_mrc_tbl_new,
1390 p_asset_deprn_rec_adj => l_asset_deprn_rec_adj,
1391 x_asset_deprn_rec_new => l_asset_deprn_rec_new,
1392 x_asset_deprn_mrc_tbl_new => l_asset_deprn_mrc_tbl_new,
1393 px_inv_trans_rec => l_inv_trans_rec,
1394 px_inv_tbl => l_inv_tbl,
1395 p_group_reclass_options_rec => l_group_reclass_options_rec
1396 );
1397
1398 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
1399 return;
1400 end if;
1401
1402 x_transaction_header_id := l_trans_rec.transaction_header_id;
1403
1404 EXCEPTION
1405 when adj_err then
1406 fa_srvr_msg.add_message(calling_fn => 'fa_trans_api_pub.do_adjustment',
1407 p_log_level_rec => g_log_level_rec);
1408 x_return_status := FND_API.G_RET_STS_ERROR;
1409
1410 when others then
1411 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_adjustment',
1412 p_log_level_rec => g_log_level_rec);
1413 x_return_status := FND_API.G_RET_STS_ERROR;
1414
1415 END do_adjustment;
1416
1417 PROCEDURE do_unit_adjustment (
1418 -- Standard Parameters --
1419 p_api_version IN NUMBER,
1420 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
1421 p_commit IN VARCHAR2 := FND_API.G_FALSE,
1422 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1423 x_return_status OUT NOCOPY VARCHAR2,
1424 x_msg_count OUT NOCOPY NUMBER,
1425 x_msg_data OUT NOCOPY VARCHAR2,
1426 p_calling_fn IN VARCHAR2,
1427 -- API Options --
1428 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
1429 -- Out Parameters --
1430 x_transaction_header_id OUT NOCOPY NUMBER,
1431 -- Transaction Info --
1432 p_transaction_date_entered IN DATE DEFAULT NULL,
1433 p_transaction_name IN VARCHAR2 DEFAULT NULL,
1434 p_mass_reference_id IN NUMBER DEFAULT NULL,
1435 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
1436 p_last_update_date IN DATE,
1437 p_last_updated_by IN NUMBER,
1438 p_created_by IN NUMBER,
1439 p_creation_date IN DATE,
1440 p_last_update_login IN NUMBER,
1441 p_attribute1 IN VARCHAR2 DEFAULT NULL,
1442 p_attribute2 IN VARCHAR2 DEFAULT NULL,
1443 p_attribute3 IN VARCHAR2 DEFAULT NULL,
1444 p_attribute4 IN VARCHAR2 DEFAULT NULL,
1445 p_attribute5 IN VARCHAR2 DEFAULT NULL,
1446 p_attribute6 IN VARCHAR2 DEFAULT NULL,
1447 p_attribute7 IN VARCHAR2 DEFAULT NULL,
1448 p_attribute8 IN VARCHAR2 DEFAULT NULL,
1449 p_attribute9 IN VARCHAR2 DEFAULT NULL,
1450 p_attribute10 IN VARCHAR2 DEFAULT NULL,
1451 p_attribute11 IN VARCHAR2 DEFAULT NULL,
1452 p_attribute12 IN VARCHAR2 DEFAULT NULL,
1453 p_attribute13 IN VARCHAR2 DEFAULT NULL,
1454 p_attribute14 IN VARCHAR2 DEFAULT NULL,
1455 p_attribute15 IN VARCHAR2 DEFAULT NULL,
1456 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
1457 -- Asset Header Info --
1458 p_asset_id IN NUMBER,
1459 p_book_type_code IN VARCHAR2,
1460 p_set_of_books_id IN NUMBER DEFAULT NULL
1461 ) AS
1462
1463 l_trans_rec fa_api_types.trans_rec_type;
1464 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
1465 l_asset_dist_rec fa_api_types.asset_dist_rec_type;
1466 l_asset_dist_tbl fa_api_types.asset_dist_tbl_type;
1467
1468 BEGIN
1469
1470 -- Initialize message list if p_init_msg_list is set to TRUE.
1471 IF FND_API.To_Boolean(p_init_msg_list) THEN
1472 -- Initialize error message stack.
1473 FA_SRVR_MSG.Init_Server_Message;
1474
1475 -- Initialize debug message stack.
1476 FA_DEBUG_PKG.Initialize;
1477 END IF;
1478
1479 -- Override FA:PRINT_DEBUG profile option.
1480 IF (p_debug_flag = 'YES') THEN
1481 FA_DEBUG_PKG.Set_Debug_Flag;
1482 END IF;
1483
1484 -- ***** Asset Transaction Info ***** --
1485 --l_trans_rec.transaction_header_id :=
1486 --l_trans_rec.transaction_type_code :=
1487 l_trans_rec.transaction_date_entered := p_transaction_date_entered;
1488 l_trans_rec.transaction_name := p_transaction_name;
1489 --l_trans_rec.source_transaction_header_id :=
1490 l_trans_rec.mass_reference_id := p_mass_reference_id;
1491 --l_trans_rec.transaction_subtype :=
1492 --l_trans_rec.transaction_key :=
1493 --l_trans_rec.amortization_start_date :=
1494 l_trans_rec.calling_interface := p_calling_interface;
1495 l_trans_rec.desc_flex.attribute1 := p_attribute1;
1496 l_trans_rec.desc_flex.attribute2 := p_attribute2;
1497 l_trans_rec.desc_flex.attribute3 := p_attribute3;
1498 l_trans_rec.desc_flex.attribute4 := p_attribute4;
1499 l_trans_rec.desc_flex.attribute5 := p_attribute5;
1500 l_trans_rec.desc_flex.attribute6 := p_attribute6;
1501 l_trans_rec.desc_flex.attribute7 := p_attribute7;
1502 l_trans_rec.desc_flex.attribute8 := p_attribute8;
1503 l_trans_rec.desc_flex.attribute9 := p_attribute9;
1504 l_trans_rec.desc_flex.attribute10 := p_attribute10;
1505 l_trans_rec.desc_flex.attribute11 := p_attribute11;
1506 l_trans_rec.desc_flex.attribute12 := p_attribute12;
1507 l_trans_rec.desc_flex.attribute13 := p_attribute13;
1508 l_trans_rec.desc_flex.attribute14 := p_attribute14;
1509 l_trans_rec.desc_flex.attribute15 := p_attribute15;
1510 l_trans_rec.desc_flex.attribute_category_code := p_attribute_category_code;
1511 l_trans_rec.who_info.last_update_date := p_last_update_date;
1512 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
1513 l_trans_rec.who_info.created_by := p_created_by;
1514 l_trans_rec.who_info.creation_date := p_creation_date;
1515 l_trans_rec.who_info.last_update_login := p_last_update_login;
1516
1517 -- ***** Asset Header Info ***** --
1518 l_asset_hdr_rec.asset_id := p_asset_id;
1519 l_asset_hdr_rec.book_type_code := p_book_type_code;
1520 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
1521 --l_asset_hdr_rec.period_of_addition :=
1522
1523 -- Derive set of books id for primary book
1524 if (l_asset_hdr_rec.set_of_books_id is NULL) then
1525 select set_of_books_id
1526 into l_asset_hdr_rec.set_of_books_id
1527 from fa_book_controls
1528 where book_type_code = l_asset_hdr_rec.book_type_code;
1529 end if;
1530
1531 -- ***** Asset Distribution Info ***** --
1532 l_asset_dist_tbl.delete;
1533
1534 -- Get the details from fa_load_tbl_pkg.dist_tbl;
1535 for i in fa_load_tbl_pkg.dist_table.FIRST ..
1536 fa_load_tbl_pkg.dist_table.LAST loop
1537 l_asset_dist_rec.distribution_id :=
1538 fa_load_tbl_pkg.dist_table(i).dist_id;
1539 --l_asset_dist_rec.units_assigned :=
1540 l_asset_dist_rec.transaction_units :=
1541 fa_load_tbl_pkg.dist_table(i).trans_units;
1542 l_asset_dist_rec.assigned_to :=
1543 fa_load_tbl_pkg.dist_table(i).assigned_to;
1544 l_asset_dist_rec.expense_ccid := fa_load_tbl_pkg.dist_table(i).ccid;
1545 l_asset_dist_rec.location_ccid :=
1546 fa_load_tbl_pkg.dist_table(i).location_id;
1547
1548 l_asset_dist_tbl(i) := l_asset_dist_rec;
1549 end loop;
1550
1551 -- Call Public Unit Adjustment API
1552 fa_unit_adj_pub.do_unit_adjustment(
1553 p_api_version => p_api_version,
1554 p_init_msg_list => p_init_msg_list,
1555 p_commit => p_commit,
1556 p_validation_level => p_validation_level,
1557 p_calling_fn => p_calling_fn,
1558 x_return_status => x_return_status,
1559 x_msg_count => x_msg_count,
1560 x_msg_data => x_msg_data,
1561 px_trans_rec => l_trans_rec,
1562 px_asset_hdr_rec => l_asset_hdr_rec,
1563 px_asset_dist_tbl => l_asset_dist_tbl);
1564
1565 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
1566 return;
1567 end if;
1568
1569 x_transaction_header_id := l_trans_rec.transaction_header_id;
1570
1571 EXCEPTION
1572 when others then
1573 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_unit_adj',
1574 p_log_level_rec => g_log_level_rec);
1575 x_return_status := FND_API.G_RET_STS_ERROR;
1576
1577 END do_unit_adjustment;
1578
1579 PROCEDURE do_transfer (
1580 -- Standard Parameters --
1581 p_api_version IN NUMBER,
1582 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
1583 p_commit IN VARCHAR2 := FND_API.G_FALSE,
1584 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1585 x_return_status OUT NOCOPY VARCHAR2,
1586 x_msg_count OUT NOCOPY NUMBER,
1587 x_msg_data OUT NOCOPY VARCHAR2,
1588 p_calling_fn IN VARCHAR2,
1589 -- API Options --
1590 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
1591 -- Out Parameters --
1592 x_transaction_header_id OUT NOCOPY NUMBER,
1593 -- Transaction Info --
1594 p_transaction_date_entered IN DATE DEFAULT NULL,
1595 p_transaction_name IN VARCHAR2 DEFAULT NULL,
1596 p_mass_reference_id IN NUMBER DEFAULT NULL,
1597 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
1598 p_last_update_date IN DATE,
1599 p_last_updated_by IN NUMBER,
1600 p_created_by IN NUMBER,
1601 p_creation_date IN DATE,
1602 p_last_update_login IN NUMBER,
1603 p_attribute1 IN VARCHAR2 DEFAULT NULL,
1604 p_attribute2 IN VARCHAR2 DEFAULT NULL,
1605 p_attribute3 IN VARCHAR2 DEFAULT NULL,
1606 p_attribute4 IN VARCHAR2 DEFAULT NULL,
1607 p_attribute5 IN VARCHAR2 DEFAULT NULL,
1608 p_attribute6 IN VARCHAR2 DEFAULT NULL,
1609 p_attribute7 IN VARCHAR2 DEFAULT NULL,
1610 p_attribute8 IN VARCHAR2 DEFAULT NULL,
1611 p_attribute9 IN VARCHAR2 DEFAULT NULL,
1612 p_attribute10 IN VARCHAR2 DEFAULT NULL,
1613 p_attribute11 IN VARCHAR2 DEFAULT NULL,
1614 p_attribute12 IN VARCHAR2 DEFAULT NULL,
1615 p_attribute13 IN VARCHAR2 DEFAULT NULL,
1616 p_attribute14 IN VARCHAR2 DEFAULT NULL,
1617 p_attribute15 IN VARCHAR2 DEFAULT NULL,
1618 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
1619 -- Asset Header Info --
1620 p_asset_id IN NUMBER,
1621 p_book_type_code IN VARCHAR2,
1622 p_set_of_books_id IN NUMBER DEFAULT NULL
1623 ) AS
1624
1625 l_trans_rec fa_api_types.trans_rec_type;
1626 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
1627 l_asset_dist_rec fa_api_types.asset_dist_rec_type;
1628 l_asset_dist_tbl fa_api_types.asset_dist_tbl_type;
1629
1630 BEGIN
1631
1632 -- Initialize message list if p_init_msg_list is set to TRUE.
1633 IF FND_API.To_Boolean(p_init_msg_list) THEN
1634 -- Initialize error message stack.
1635 FA_SRVR_MSG.Init_Server_Message;
1636
1637 -- Initialize debug message stack.
1638 FA_DEBUG_PKG.Initialize;
1639 END IF;
1640
1641 -- Override FA:PRINT_DEBUG profile option.
1642 IF (p_debug_flag = 'YES') THEN
1643 FA_DEBUG_PKG.Set_Debug_Flag;
1644 END IF;
1645
1646 -- ***** Asset Transaction Info ***** --
1647 --l_trans_rec.transaction_header_id :=
1648 --l_trans_rec.transaction_type_code :=
1649 l_trans_rec.transaction_date_entered := p_transaction_date_entered;
1650 l_trans_rec.transaction_name := p_transaction_name;
1651 --l_trans_rec.source_transaction_header_id :=
1652 l_trans_rec.mass_reference_id := p_mass_reference_id;
1653 --l_trans_rec.transaction_subtype :=
1654 --l_trans_rec.transaction_key :=
1655 --l_trans_rec.amortization_start_date :=
1656 l_trans_rec.calling_interface := p_calling_interface;
1657 l_trans_rec.desc_flex.attribute1 := p_attribute1;
1658 l_trans_rec.desc_flex.attribute2 := p_attribute2;
1659 l_trans_rec.desc_flex.attribute3 := p_attribute3;
1660 l_trans_rec.desc_flex.attribute4 := p_attribute4;
1661 l_trans_rec.desc_flex.attribute5 := p_attribute5;
1662 l_trans_rec.desc_flex.attribute6 := p_attribute6;
1663 l_trans_rec.desc_flex.attribute7 := p_attribute7;
1664 l_trans_rec.desc_flex.attribute8 := p_attribute8;
1665 l_trans_rec.desc_flex.attribute9 := p_attribute9;
1666 l_trans_rec.desc_flex.attribute10 := p_attribute10;
1667 l_trans_rec.desc_flex.attribute11 := p_attribute11;
1668 l_trans_rec.desc_flex.attribute12 := p_attribute12;
1669 l_trans_rec.desc_flex.attribute13 := p_attribute13;
1670 l_trans_rec.desc_flex.attribute14 := p_attribute14;
1671 l_trans_rec.desc_flex.attribute15 := p_attribute15;
1672 l_trans_rec.desc_flex.attribute_category_code := p_attribute_category_code;
1673 l_trans_rec.who_info.last_update_date := p_last_update_date;
1674 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
1675 l_trans_rec.who_info.created_by := p_created_by;
1676 l_trans_rec.who_info.creation_date := p_creation_date;
1677 l_trans_rec.who_info.last_update_login := p_last_update_login;
1678
1679 -- ***** Asset Header Info ***** --
1680 l_asset_hdr_rec.asset_id := p_asset_id;
1681 l_asset_hdr_rec.book_type_code := p_book_type_code;
1682 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
1683 --l_asset_hdr_rec.period_of_addition :=
1684
1685 -- Derive set of books id for primary book
1686 if (l_asset_hdr_rec.set_of_books_id is NULL) then
1687 select set_of_books_id
1688 into l_asset_hdr_rec.set_of_books_id
1689 from fa_book_controls
1690 where book_type_code = l_asset_hdr_rec.book_type_code;
1691 end if;
1692
1693 -- ***** Asset Distribution Info ***** --
1694 l_asset_dist_tbl.delete;
1695
1696 -- Get the details from fa_load_tbl_pkg.dist_tbl;
1697 for i in fa_load_tbl_pkg.dist_table.FIRST ..
1698 fa_load_tbl_pkg.dist_table.LAST loop
1699 l_asset_dist_rec.distribution_id :=
1700 fa_load_tbl_pkg.dist_table(i).dist_id;
1701 --l_asset_dist_rec.units_assigned :=
1702 l_asset_dist_rec.transaction_units :=
1703 fa_load_tbl_pkg.dist_table(i).trans_units;
1704 l_asset_dist_rec.assigned_to :=
1705 fa_load_tbl_pkg.dist_table(i).assigned_to;
1706 l_asset_dist_rec.expense_ccid := fa_load_tbl_pkg.dist_table(i).ccid;
1707 l_asset_dist_rec.location_ccid :=
1708 fa_load_tbl_pkg.dist_table(i).location_id;
1709
1710 l_asset_dist_tbl(i) := l_asset_dist_rec;
1711 end loop;
1712
1713 -- Call Public Transfer API
1714 fa_transfer_pub.do_transfer(
1715 p_api_version => p_api_version,
1716 p_init_msg_list => p_init_msg_list,
1717 p_commit => p_commit,
1718 p_validation_level => p_validation_level,
1719 p_calling_fn => p_calling_fn,
1720 x_return_status => x_return_status,
1721 x_msg_count => x_msg_count,
1722 x_msg_data => x_msg_data,
1723 px_trans_rec => l_trans_rec,
1724 px_asset_hdr_rec => l_asset_hdr_rec,
1725 px_asset_dist_tbl => l_asset_dist_tbl);
1726
1727 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
1728 return;
1729 end if;
1730
1731 x_transaction_header_id := l_trans_rec.transaction_header_id;
1732
1733 EXCEPTION
1734 when others then
1735 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_transfer',
1736 p_log_level_rec => g_log_level_rec);
1737 x_return_status := FND_API.G_RET_STS_ERROR;
1738
1739 END do_transfer;
1740
1741 PROCEDURE do_invoice_transfer (
1742 -- Standard Parameters --
1743 p_api_version IN NUMBER,
1744 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
1745 p_commit IN VARCHAR2 := FND_API.G_FALSE,
1746 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
1747 x_return_status OUT NOCOPY VARCHAR2,
1748 x_msg_count OUT NOCOPY NUMBER,
1749 x_msg_data OUT NOCOPY VARCHAR2,
1750 p_calling_fn IN VARCHAR2,
1751 -- API Options --
1752 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
1753 -- Out Parameters --
1754 x_src_transaction_header_id OUT NOCOPY NUMBER,
1755 x_dest_transaction_header_id OUT NOCOPY NUMBER,
1756 -- Transaction Info --
1757 p_transaction_date_entered IN DATE DEFAULT NULL,
1758 p_amortization_start_date IN DATE DEFAULT NULL,
1759 p_mass_reference_id IN NUMBER DEFAULT NULL,
1760 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
1761 p_last_update_date IN DATE,
1762 p_last_updated_by IN NUMBER,
1763 p_created_by IN NUMBER,
1764 p_creation_date IN DATE,
1765 p_last_update_login IN NUMBER,
1766 -- Source Asset Header Info --
1767 p_src_asset_id IN NUMBER,
1768 p_book_type_code IN VARCHAR2,
1769 p_set_of_books_id IN NUMBER DEFAULT NULL,
1770 -- Destination Asset Header Info --
1771 p_dest_asset_id IN NUMBER
1772 ) AS
1773
1774 l_src_trans_rec fa_api_types.trans_rec_type;
1775 l_src_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
1776 l_dest_trans_rec fa_api_types.trans_rec_type;
1777 l_dest_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
1778 l_inv_rec fa_api_types.inv_rec_type;
1779 l_inv_tbl fa_api_types.inv_tbl_type;
1780
1781 BEGIN
1782
1783 -- Initialize message list if p_init_msg_list is set to TRUE.
1784 IF FND_API.To_Boolean(p_init_msg_list) THEN
1785 -- Initialize error message stack.
1786 FA_SRVR_MSG.Init_Server_Message;
1787
1788 -- Initialize debug message stack.
1789 FA_DEBUG_PKG.Initialize;
1790 END IF;
1791
1792 -- Override FA:PRINT_DEBUG profile option.
1793 IF (p_debug_flag = 'YES') THEN
1794 FA_DEBUG_PKG.Set_Debug_Flag;
1795 END IF;
1796
1797 -- ***** Source Asset Transaction Info ***** --
1798 --l_src_trans_rec.transaction_header_id :=
1799 --l_src_trans_rec.transaction_type_code :=
1800 l_src_trans_rec.transaction_date_entered := p_transaction_date_entered;
1801 --l_src_trans_rec.transaction_name :=
1802 --l_src_trans_rec.source_transaction_header_id :=
1803 l_src_trans_rec.mass_reference_id := p_mass_reference_id;
1804 if (p_amortization_start_date is not null) then
1805 l_src_trans_rec.transaction_subtype := 'AMORTIZED';
1806 end if;
1807 --l_src_trans_rec.transaction_subtype :=
1808 --l_src_trans_rec.transaction_key :=
1809 l_src_trans_rec.amortization_start_date := p_amortization_start_date;
1810 l_src_trans_rec.calling_interface := p_calling_interface;
1811 --l_src_trans_rec.desc_flex.attribute1 :=
1812 --l_src_trans_rec.desc_flex.attribute2 :=
1813 --l_src_trans_rec.desc_flex.attribute3 :=
1814 --l_src_trans_rec.desc_flex.attribute4 :=
1815 --l_src_trans_rec.desc_flex.attribute5 :=
1816 --l_src_trans_rec.desc_flex.attribute6 :=
1817 --l_src_trans_rec.desc_flex.attribute7 :=
1818 --l_src_trans_rec.desc_flex.attribute8 :=
1819 --l_src_trans_rec.desc_flex.attribute9 :=
1820 --l_src_trans_rec.desc_flex.attribute10 :=
1821 --l_src_trans_rec.desc_flex.attribute11 :=
1822 --l_src_trans_rec.desc_flex.attribute11 :=
1823 --l_src_trans_rec.desc_flex.attribute12 :=
1824 --l_src_trans_rec.desc_flex.attribute13 :=
1825 --l_src_trans_rec.desc_flex.attribute14 :=
1826 --l_src_trans_rec.desc_flex.attribute15 :=
1827 --l_src_trans_rec.desc_flex.attribute_category_code :=
1828 l_src_trans_rec.who_info.last_update_date := p_last_update_date;
1829 l_src_trans_rec.who_info.last_updated_by := p_last_updated_by;
1830 l_src_trans_rec.who_info.created_by := p_created_by;
1831 l_src_trans_rec.who_info.creation_date := p_creation_date;
1832 l_src_trans_rec.who_info.last_update_login := p_last_update_login;
1833
1834 -- ***** Source Asset Header Info ***** --
1835 l_src_asset_hdr_rec.asset_id := p_src_asset_id;
1836 l_src_asset_hdr_rec.book_type_code := p_book_type_code;
1837 l_src_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
1838 --l_src_asset_hdr_rec.period_of_addition :=
1839
1840 -- Derive set of books id for primary book
1841 if (l_src_asset_hdr_rec.set_of_books_id is NULL) then
1842 select set_of_books_id
1843 into l_src_asset_hdr_rec.set_of_books_id
1844 from fa_book_controls
1845 where book_type_code = l_src_asset_hdr_rec.book_type_code;
1846 end if;
1847
1848 -- ***** Destination Asset Transaction Info ***** --
1849 --l_dest_trans_rec.transaction_header_id :=
1850 --l_dest_trans_rec.transaction_type_code :=
1851 l_dest_trans_rec.transaction_date_entered := p_transaction_date_entered;
1852 --l_dest_trans_rec.transaction_name :=
1853 --l_dest_trans_rec.source_transaction_header_id :=
1854 l_dest_trans_rec.mass_reference_id := p_mass_reference_id;
1855 --l_dest_trans_rec.transaction_subtype :=
1856 if (p_amortization_start_date is not null) then
1857 l_dest_trans_rec.transaction_subtype := 'AMORTIZED';
1858 end if;
1859 --l_dest_trans_rec.transaction_key :=
1860 l_dest_trans_rec.amortization_start_date := p_amortization_start_date;
1861 l_dest_trans_rec.calling_interface := p_calling_interface;
1862 --l_dest_trans_rec.desc_flex.attribute1 :=
1863 --l_dest_trans_rec.desc_flex.attribute2 :=
1864 --l_dest_trans_rec.desc_flex.attribute3 :=
1865 --l_dest_trans_rec.desc_flex.attribute4 :=
1866 --l_dest_trans_rec.desc_flex.attribute5 :=
1867 --l_dest_trans_rec.desc_flex.attribute6 :=
1868 --l_dest_trans_rec.desc_flex.attribute7 :=
1869 --l_dest_trans_rec.desc_flex.attribute8 :=
1870 --l_dest_trans_rec.desc_flex.attribute9 :=
1871 --l_dest_trans_rec.desc_flex.attribute10 :=
1872 --l_dest_trans_rec.desc_flex.attribute11 :=
1873 --l_dest_trans_rec.desc_flex.attribute11 :=
1874 --l_dest_trans_rec.desc_flex.attribute12 :=
1875 --l_dest_trans_rec.desc_flex.attribute13 :=
1876 --l_dest_trans_rec.desc_flex.attribute14 :=
1877 --l_dest_trans_rec.desc_flex.attribute15 :=
1878 --l_dest_trans_rec.desc_flex.attribute_category_code :=
1879 l_dest_trans_rec.who_info.last_update_date := p_last_update_date;
1880 l_dest_trans_rec.who_info.last_updated_by := p_last_updated_by;
1881 l_dest_trans_rec.who_info.created_by := p_created_by;
1882 l_dest_trans_rec.who_info.creation_date := p_creation_date;
1883 l_dest_trans_rec.who_info.last_update_login := p_last_update_login;
1884
1885 -- ***** Destination Asset Header Info ***** --
1886 l_dest_asset_hdr_rec.asset_id := p_dest_asset_id;
1887 l_dest_asset_hdr_rec.book_type_code := p_book_type_code;
1888 l_dest_asset_hdr_rec.set_of_books_id := l_src_asset_hdr_rec.set_of_books_id;
1889 --l_dest_asset_hdr_rec.period_of_addition :=
1890
1891 -- ***** Invoice Info ***** --
1892 l_inv_tbl.delete;
1893
1894 -- Get the details from fa_load_tbl_pkg.inv_table
1895 for i in 1 .. fa_load_tbl_pkg.inv_table.COUNT loop
1896
1897 l_inv_rec.po_vendor_id := fa_load_tbl_pkg.inv_table(i).po_vendor_id;
1898 l_inv_rec.asset_invoice_id :=
1899 fa_load_tbl_pkg.inv_table(i).asset_invoice_id;
1900 l_inv_rec.fixed_assets_cost := 0 -
1901 fa_load_tbl_pkg.inv_table(i).inv_transfer_cost;
1902 l_inv_rec.deleted_flag := fa_load_tbl_pkg.inv_table(i).deleted_flag;
1903 l_inv_rec.po_number := fa_load_tbl_pkg.inv_table(i).po_number;
1904 l_inv_rec.invoice_number := fa_load_tbl_pkg.inv_table(i).invoice_number;
1905 l_inv_rec.payables_batch_name :=
1906 fa_load_tbl_pkg.inv_table(i).payables_batch_name;
1907 l_inv_rec.payables_code_combination_id :=
1908 fa_load_tbl_pkg.inv_table(i).payables_ccid;
1909 l_inv_rec.feeder_system_name :=
1910 fa_load_tbl_pkg.inv_table(i).feeder_system_name;
1911 l_inv_rec.create_batch_date :=
1912 fa_load_tbl_pkg.inv_table(i).create_batch_date;
1913 l_inv_rec.create_batch_id :=
1914 fa_load_tbl_pkg.inv_table(i).create_batch_id;
1915 l_inv_rec.invoice_date := fa_load_tbl_pkg.inv_table(i).invoice_date;
1916 l_inv_rec.payables_cost := fa_load_tbl_pkg.inv_table(i).payables_cost;
1917 l_inv_rec.post_batch_id := fa_load_tbl_pkg.inv_table(i).post_batch_id;
1918 l_inv_rec.invoice_id := fa_load_tbl_pkg.inv_table(i).invoice_id;
1919 l_inv_rec.invoice_distribution_id := fa_load_tbl_pkg.inv_table(i).invoice_distribution_id;
1920 l_inv_rec.invoice_line_number := fa_load_tbl_pkg.inv_table(i).invoice_line_number;
1921 l_inv_rec.po_distribution_id := fa_load_tbl_pkg.inv_table(i).po_distribution_id;
1922 l_inv_rec.ap_distribution_line_number :=
1923 fa_load_tbl_pkg.inv_table(i).ap_dist_line_num;
1924 l_inv_rec.payables_units := fa_load_tbl_pkg.inv_table(i).payables_units;
1925 --l_inv_rec.split_merged_code :=
1926 l_inv_rec.description := fa_load_tbl_pkg.inv_table(i).description;
1927 --l_inv_rec.parent_mass_additions_id :=
1928 --l_inv_rec.unrevalued_cost :=
1929 --l_inv_rec.merged_code :=
1930 --l_inv_rec.split_code :=
1931 --l_inv_rec.merge_parent_mass_additions_id :=
1932 --l_inv_rec.split_parent_mass_additions_id :=
1933 l_inv_rec.project_asset_line_id :=
1934 fa_load_tbl_pkg.inv_table(i).project_asset_line_id;
1935 l_inv_rec.project_id := fa_load_tbl_pkg.inv_table(i).project_id;
1936 l_inv_rec.task_id := fa_load_tbl_pkg.inv_table(i).task_id;
1937 l_inv_rec.material_indicator_flag :=
1938 fa_load_tbl_pkg.inv_table(i).material_indicator_flag;
1939 l_inv_rec.depreciate_in_group_flag :=
1940 fa_load_tbl_pkg.inv_table(i).depreciate_in_group_flag;
1941 l_inv_rec.source_line_id := fa_load_tbl_pkg.inv_table(i).source_line_id;
1942 l_inv_rec.attribute1 := fa_load_tbl_pkg.inv_table(i).attribute1;
1943 l_inv_rec.attribute2 := fa_load_tbl_pkg.inv_table(i).attribute2;
1944 l_inv_rec.attribute3 := fa_load_tbl_pkg.inv_table(i).attribute3;
1945 l_inv_rec.attribute4 := fa_load_tbl_pkg.inv_table(i).attribute4;
1946 l_inv_rec.attribute5 := fa_load_tbl_pkg.inv_table(i).attribute5;
1947 l_inv_rec.attribute6 := fa_load_tbl_pkg.inv_table(i).attribute6;
1948 l_inv_rec.attribute7 := fa_load_tbl_pkg.inv_table(i).attribute7;
1949 l_inv_rec.attribute8 := fa_load_tbl_pkg.inv_table(i).attribute8;
1950 l_inv_rec.attribute9 := fa_load_tbl_pkg.inv_table(i).attribute9;
1951 l_inv_rec.attribute10 := fa_load_tbl_pkg.inv_table(i).attribute10;
1952 l_inv_rec.attribute11 := fa_load_tbl_pkg.inv_table(i).attribute11;
1953 l_inv_rec.attribute12 := fa_load_tbl_pkg.inv_table(i).attribute12;
1954 l_inv_rec.attribute13 := fa_load_tbl_pkg.inv_table(i).attribute13;
1955 l_inv_rec.attribute14 := fa_load_tbl_pkg.inv_table(i).attribute14;
1956 l_inv_rec.attribute15 := fa_load_tbl_pkg.inv_table(i).attribute15;
1957 l_inv_rec.attribute_category_code :=
1958 fa_load_tbl_pkg.inv_table(i).attribute_cat_code;
1959
1960 l_inv_tbl(i) := l_inv_rec;
1961 end loop;
1962
1963 -- Call the Public Invoice Transfer API
1964 fa_inv_xfr_pub.do_transfer
1965 (p_api_version => p_api_version,
1966 p_init_msg_list => p_init_msg_list,
1967 p_commit => p_commit,
1968 p_validation_level => p_validation_level,
1969 p_calling_fn => p_calling_fn,
1970 x_return_status => x_return_status,
1971 x_msg_count => x_msg_count,
1972 x_msg_data => x_msg_data,
1973 px_src_trans_rec => l_src_trans_rec,
1974 px_src_asset_hdr_rec => l_src_asset_hdr_rec,
1975 px_dest_trans_rec => l_dest_trans_rec,
1976 px_dest_asset_hdr_rec => l_dest_asset_hdr_rec,
1977 p_inv_tbl => l_inv_tbl
1978 );
1979
1980 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
1981 return;
1982 end if;
1983
1984 x_src_transaction_header_id := l_src_trans_rec.transaction_header_id;
1985 x_dest_transaction_header_id := l_dest_trans_rec.transaction_header_id;
1986
1987 EXCEPTION
1988 when others then
1989 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_inv_xfr',
1990 p_log_level_rec => g_log_level_rec);
1991 x_return_status := FND_API.G_RET_STS_ERROR;
1992
1993 END do_invoice_transfer;
1994
1995 PROCEDURE do_reclass (
1996 -- Standard Parameters --
1997 p_api_version IN NUMBER,
1998 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
1999 p_commit IN VARCHAR2 := FND_API.G_FALSE,
2000 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
2001 x_return_status OUT NOCOPY VARCHAR2,
2002 x_msg_count OUT NOCOPY NUMBER,
2003 x_msg_data OUT NOCOPY VARCHAR2,
2004 p_calling_fn IN VARCHAR2,
2005 -- API Options --
2006 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
2007 -- Out Parameters --
2008 x_transaction_header_id OUT NOCOPY NUMBER,
2009 -- Transaction Info --
2010 p_transaction_date_entered IN DATE DEFAULT NULL,
2011 p_transaction_name IN VARCHAR2 DEFAULT NULL,
2012 p_transaction_subtype IN VARCHAR2 DEFAULT NULL,
2013 p_amortization_start_date IN DATE DEFAULT NULL,
2014 p_mass_reference_id IN NUMBER DEFAULT NULL,
2015 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
2016 p_last_update_date IN DATE,
2017 p_last_updated_by IN NUMBER,
2018 p_created_by IN NUMBER,
2019 p_creation_date IN DATE,
2020 p_last_update_login IN NUMBER,
2021 p_attribute1 IN VARCHAR2 DEFAULT NULL,
2022 p_attribute2 IN VARCHAR2 DEFAULT NULL,
2023 p_attribute3 IN VARCHAR2 DEFAULT NULL,
2024 p_attribute4 IN VARCHAR2 DEFAULT NULL,
2025 p_attribute5 IN VARCHAR2 DEFAULT NULL,
2026 p_attribute6 IN VARCHAR2 DEFAULT NULL,
2027 p_attribute7 IN VARCHAR2 DEFAULT NULL,
2028 p_attribute8 IN VARCHAR2 DEFAULT NULL,
2029 p_attribute9 IN VARCHAR2 DEFAULT NULL,
2030 p_attribute10 IN VARCHAR2 DEFAULT NULL,
2031 p_attribute11 IN VARCHAR2 DEFAULT NULL,
2032 p_attribute12 IN VARCHAR2 DEFAULT NULL,
2033 p_attribute13 IN VARCHAR2 DEFAULT NULL,
2034 p_attribute14 IN VARCHAR2 DEFAULT NULL,
2035 p_attribute15 IN VARCHAR2 DEFAULT NULL,
2036 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
2037 -- Asset Header Info --
2038 p_asset_id IN NUMBER,
2039 -- Asset Category Info --
2040 p_new_category_id IN NUMBER,
2041 p_cat_attribute1 IN VARCHAR2 DEFAULT NULL,
2042 p_cat_attribute2 IN VARCHAR2 DEFAULT NULL,
2043 p_cat_attribute3 IN VARCHAR2 DEFAULT NULL,
2044 p_cat_attribute4 IN VARCHAR2 DEFAULT NULL,
2045 p_cat_attribute5 IN VARCHAR2 DEFAULT NULL,
2046 p_cat_attribute6 IN VARCHAR2 DEFAULT NULL,
2047 p_cat_attribute7 IN VARCHAR2 DEFAULT NULL,
2048 p_cat_attribute8 IN VARCHAR2 DEFAULT NULL,
2049 p_cat_attribute9 IN VARCHAR2 DEFAULT NULL,
2050 p_cat_attribute10 IN VARCHAR2 DEFAULT NULL,
2051 p_cat_attribute11 IN VARCHAR2 DEFAULT NULL,
2052 p_cat_attribute12 IN VARCHAR2 DEFAULT NULL,
2053 p_cat_attribute13 IN VARCHAR2 DEFAULT NULL,
2054 p_cat_attribute14 IN VARCHAR2 DEFAULT NULL,
2055 p_cat_attribute15 IN VARCHAR2 DEFAULT NULL,
2056 p_cat_attribute16 IN VARCHAR2 DEFAULT NULL,
2057 p_cat_attribute17 IN VARCHAR2 DEFAULT NULL,
2058 p_cat_attribute18 IN VARCHAR2 DEFAULT NULL,
2059 p_cat_attribute19 IN VARCHAR2 DEFAULT NULL,
2060 p_cat_attribute20 IN VARCHAR2 DEFAULT NULL,
2061 p_cat_attribute21 IN VARCHAR2 DEFAULT NULL,
2062 p_cat_attribute22 IN VARCHAR2 DEFAULT NULL,
2063 p_cat_attribute23 IN VARCHAR2 DEFAULT NULL,
2064 p_cat_attribute24 IN VARCHAR2 DEFAULT NULL,
2065 p_cat_attribute25 IN VARCHAR2 DEFAULT NULL,
2066 p_cat_attribute26 IN VARCHAR2 DEFAULT NULL,
2067 p_cat_attribute27 IN VARCHAR2 DEFAULT NULL,
2068 p_cat_attribute28 IN VARCHAR2 DEFAULT NULL,
2069 p_cat_attribute29 IN VARCHAR2 DEFAULT NULL,
2070 p_cat_attribute30 IN VARCHAR2 DEFAULT NULL,
2071 p_cat_attribute_category_code IN VARCHAR2 DEFAULT NULL,
2072 p_context IN VARCHAR2 DEFAULT NULL,
2073 -- Reclass Options Info --
2074 p_copy_cat_desc_flag IN VARCHAR2 DEFAULT 'NO',
2075 p_redefault_flag IN VARCHAR2 DEFAULT 'NO'
2076 ) AS
2077
2078 l_trans_rec fa_api_types.trans_rec_type;
2079 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
2080 l_asset_cat_rec_new fa_api_types.asset_cat_rec_type;
2081 l_reclass_options_rec fa_api_types.reclass_options_rec_type;
2082
2083 BEGIN
2084
2085 -- Initialize message list if p_init_msg_list is set to TRUE.
2086 IF FND_API.To_Boolean(p_init_msg_list) THEN
2087 -- Initialize error message stack.
2088 FA_SRVR_MSG.Init_Server_Message;
2089
2090 -- Initialize debug message stack.
2091 FA_DEBUG_PKG.Initialize;
2092 END IF;
2093
2094 -- Override FA:PRINT_DEBUG profile option.
2095 IF (p_debug_flag = 'YES') THEN
2096 FA_DEBUG_PKG.Set_Debug_Flag;
2097 END IF;
2098
2099 -- ***** Asset Transaction Info ***** --
2100 --l_trans_rec.transaction_header_id :=
2101 --l_trans_rec.transaction_type_code :=
2102 l_trans_rec.transaction_date_entered := p_transaction_date_entered;
2103 l_trans_rec.transaction_name := p_transaction_name;
2104 --l_trans_rec.source_transaction_header_id :=
2105 l_trans_rec.mass_reference_id := p_mass_reference_id;
2106 l_trans_rec.transaction_subtype := p_transaction_subtype;
2107 --l_trans_rec.transaction_key :=
2108 l_trans_rec.amortization_start_date := p_amortization_start_date;
2109 l_trans_rec.calling_interface := p_calling_interface;
2110 l_trans_rec.desc_flex.attribute1 := p_attribute1;
2111 l_trans_rec.desc_flex.attribute2 := p_attribute2;
2112 l_trans_rec.desc_flex.attribute3 := p_attribute3;
2113 l_trans_rec.desc_flex.attribute4 := p_attribute4;
2114 l_trans_rec.desc_flex.attribute5 := p_attribute5;
2115 l_trans_rec.desc_flex.attribute6 := p_attribute6;
2116 l_trans_rec.desc_flex.attribute7 := p_attribute7;
2117 l_trans_rec.desc_flex.attribute8 := p_attribute8;
2118 l_trans_rec.desc_flex.attribute9 := p_attribute9;
2119 l_trans_rec.desc_flex.attribute10 := p_attribute10;
2120 l_trans_rec.desc_flex.attribute11 := p_attribute11;
2121 l_trans_rec.desc_flex.attribute12 := p_attribute12;
2122 l_trans_rec.desc_flex.attribute13 := p_attribute13;
2123 l_trans_rec.desc_flex.attribute14 := p_attribute14;
2124 l_trans_rec.desc_flex.attribute15 := p_attribute15;
2125 l_trans_rec.desc_flex.attribute_category_code := p_attribute_category_code;
2126 l_trans_rec.who_info.last_update_date := p_last_update_date;
2127 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
2128 l_trans_rec.who_info.created_by := p_created_by;
2129 l_trans_rec.who_info.creation_date := p_creation_date;
2130 l_trans_rec.who_info.last_update_login := p_last_update_login;
2131
2132 if (p_amortization_start_date is NOT NULL) then
2133 l_trans_rec.transaction_subtype := 'AMORTIZED';
2134 end if;
2135
2136 -- ***** Asset Header Info ***** --
2137 l_asset_hdr_rec.asset_id := p_asset_id;
2138 --l_asset_hdr_rec.book_type_code :=
2139 --l_asset_hdr_rec.period_of_addition :=
2140
2141 -- Derive set of books id for primary book
2142 /* select set_of_books_id
2143 into l_asset_hdr_rec.set_of_books_id
2144 from fa_book_controls
2145 where book_type_code = l_asset_hdr_rec.book_type_code;
2146 */
2147 -- ***** Asset Category Info ***** --
2148 l_asset_cat_rec_new.category_id := p_new_category_id;
2149 l_asset_cat_rec_new.desc_flex.attribute1 := p_cat_attribute1;
2150 l_asset_cat_rec_new.desc_flex.attribute2 := p_cat_attribute2;
2151 l_asset_cat_rec_new.desc_flex.attribute3 := p_cat_attribute3;
2152 l_asset_cat_rec_new.desc_flex.attribute4 := p_cat_attribute4;
2153 l_asset_cat_rec_new.desc_flex.attribute5 := p_cat_attribute5;
2154 l_asset_cat_rec_new.desc_flex.attribute6 := p_cat_attribute6;
2155 l_asset_cat_rec_new.desc_flex.attribute7 := p_cat_attribute7;
2156 l_asset_cat_rec_new.desc_flex.attribute8 := p_cat_attribute8;
2157 l_asset_cat_rec_new.desc_flex.attribute9 := p_cat_attribute9;
2158 l_asset_cat_rec_new.desc_flex.attribute10 := p_cat_attribute10;
2159 l_asset_cat_rec_new.desc_flex.attribute11 := p_cat_attribute11;
2160 l_asset_cat_rec_new.desc_flex.attribute12 := p_cat_attribute12;
2161 l_asset_cat_rec_new.desc_flex.attribute13 := p_cat_attribute13;
2162 l_asset_cat_rec_new.desc_flex.attribute14 := p_cat_attribute14;
2163 l_asset_cat_rec_new.desc_flex.attribute15 := p_cat_attribute15;
2164 l_asset_cat_rec_new.desc_flex.attribute16 := p_cat_attribute16;
2165 l_asset_cat_rec_new.desc_flex.attribute17 := p_cat_attribute17;
2166 l_asset_cat_rec_new.desc_flex.attribute18 := p_cat_attribute18;
2167 l_asset_cat_rec_new.desc_flex.attribute19 := p_cat_attribute19;
2168 l_asset_cat_rec_new.desc_flex.attribute20 := p_cat_attribute20;
2169 l_asset_cat_rec_new.desc_flex.attribute21 := p_cat_attribute21;
2170 l_asset_cat_rec_new.desc_flex.attribute22 := p_cat_attribute22;
2171 l_asset_cat_rec_new.desc_flex.attribute23 := p_cat_attribute23;
2172 l_asset_cat_rec_new.desc_flex.attribute24 := p_cat_attribute24;
2173 l_asset_cat_rec_new.desc_flex.attribute25 := p_cat_attribute25;
2174 l_asset_cat_rec_new.desc_flex.attribute26 := p_cat_attribute26;
2175 l_asset_cat_rec_new.desc_flex.attribute27 := p_cat_attribute27;
2176 l_asset_cat_rec_new.desc_flex.attribute28 := p_cat_attribute28;
2177 l_asset_cat_rec_new.desc_flex.attribute29 := p_cat_attribute29;
2178 l_asset_cat_rec_new.desc_flex.attribute30 := p_cat_attribute30;
2179 l_asset_cat_rec_new.desc_flex.attribute_category_code :=
2180 p_cat_attribute_category_code;
2181 l_asset_cat_rec_new.desc_flex.context := p_context;
2182
2183 -- ***** Asset Reclass Options Info ***** --
2184 l_reclass_options_rec.copy_cat_desc_flag := p_copy_cat_desc_flag;
2185 l_reclass_options_rec.redefault_flag := p_redefault_flag;
2186 -- ?? include fully reserved assets?
2187
2188 -- Call Public Reclass API
2189 fa_reclass_pub.do_reclass (
2190 p_api_version => p_api_version,
2191 p_init_msg_list => p_init_msg_list,
2192 p_commit => p_commit,
2193 p_validation_level => p_validation_level,
2194 p_calling_fn => p_calling_fn,
2195 x_return_status => x_return_status,
2196 x_msg_count => x_msg_count,
2197 x_msg_data => x_msg_data,
2198 px_trans_rec => l_trans_rec,
2199 px_asset_hdr_rec => l_asset_hdr_rec,
2200 px_asset_cat_rec_new => l_asset_cat_rec_new,
2201 p_recl_opt_rec => l_reclass_options_rec);
2202
2203 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
2204 return;
2205 end if;
2206
2207 x_transaction_header_id := l_trans_rec.transaction_header_id;
2208
2209 EXCEPTION
2210 when others then
2211 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_reclass',
2212 p_log_level_rec => g_log_level_rec);
2213 x_return_status := FND_API.G_RET_STS_ERROR;
2214
2215 END do_reclass;
2216
2217 PROCEDURE do_retirement (
2218 -- Standard Parameters --
2219 p_api_version IN NUMBER,
2220 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
2221 p_commit IN VARCHAR2 := FND_API.G_FALSE,
2222 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
2223 x_return_status OUT NOCOPY VARCHAR2,
2224 x_msg_count OUT NOCOPY NUMBER,
2225 x_msg_data OUT NOCOPY VARCHAR2,
2226 p_calling_fn IN VARCHAR2,
2227 -- API Options --
2228 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
2229 -- Out Parameters --
2230 x_retirement_id OUT NOCOPY NUMBER,
2231 x_transaction_header_id OUT NOCOPY NUMBER,
2232 x_dist_transaction_header_id OUT NOCOPY NUMBER,
2233 -- Transaction Info (Retirement) --
2234 p_transaction_date_entered IN DATE DEFAULT NULL,
2235 p_transaction_name IN VARCHAR2 DEFAULT NULL,
2236 p_mass_reference_id IN NUMBER DEFAULT NULL,
2237 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
2238 p_last_update_date IN DATE,
2239 p_last_updated_by IN NUMBER,
2240 p_created_by IN NUMBER,
2241 p_creation_date IN DATE,
2242 p_last_update_login IN NUMBER,
2243 p_attribute1 IN VARCHAR2 DEFAULT NULL,
2244 p_attribute2 IN VARCHAR2 DEFAULT NULL,
2245 p_attribute3 IN VARCHAR2 DEFAULT NULL,
2246 p_attribute4 IN VARCHAR2 DEFAULT NULL,
2247 p_attribute5 IN VARCHAR2 DEFAULT NULL,
2248 p_attribute6 IN VARCHAR2 DEFAULT NULL,
2249 p_attribute7 IN VARCHAR2 DEFAULT NULL,
2250 p_attribute8 IN VARCHAR2 DEFAULT NULL,
2251 p_attribute9 IN VARCHAR2 DEFAULT NULL,
2252 p_attribute10 IN VARCHAR2 DEFAULT NULL,
2253 p_attribute11 IN VARCHAR2 DEFAULT NULL,
2254 p_attribute12 IN VARCHAR2 DEFAULT NULL,
2255 p_attribute13 IN VARCHAR2 DEFAULT NULL,
2256 p_attribute14 IN VARCHAR2 DEFAULT NULL,
2257 p_attribute15 IN VARCHAR2 DEFAULT NULL,
2258 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
2259 -- Transaction Info (Distributions) --
2260 p_dist_transaction_name IN VARCHAR2 DEFAULT NULL,
2261 p_dist_attribute1 IN VARCHAR2 DEFAULT NULL,
2262 p_dist_attribute2 IN VARCHAR2 DEFAULT NULL,
2263 p_dist_attribute3 IN VARCHAR2 DEFAULT NULL,
2264 p_dist_attribute4 IN VARCHAR2 DEFAULT NULL,
2265 p_dist_attribute5 IN VARCHAR2 DEFAULT NULL,
2266 p_dist_attribute6 IN VARCHAR2 DEFAULT NULL,
2267 p_dist_attribute7 IN VARCHAR2 DEFAULT NULL,
2268 p_dist_attribute8 IN VARCHAR2 DEFAULT NULL,
2269 p_dist_attribute9 IN VARCHAR2 DEFAULT NULL,
2270 p_dist_attribute10 IN VARCHAR2 DEFAULT NULL,
2271 p_dist_attribute11 IN VARCHAR2 DEFAULT NULL,
2272 p_dist_attribute12 IN VARCHAR2 DEFAULT NULL,
2273 p_dist_attribute13 IN VARCHAR2 DEFAULT NULL,
2274 p_dist_attribute14 IN VARCHAR2 DEFAULT NULL,
2275 p_dist_attribute15 IN VARCHAR2 DEFAULT NULL,
2276 p_dist_attribute_category_code IN VARCHAR2 DEFAULT NULL,
2277 -- Asset Header Info --
2278 p_asset_id IN NUMBER,
2279 p_book_type_code IN VARCHAR2,
2280 p_set_of_books_id IN NUMBER DEFAULT NULL,
2281 -- Asset Retirement Info --
2282 p_calculate_gain_loss IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2283 p_units_retired IN NUMBER DEFAULT NULL,
2284 p_cost_retired IN NUMBER DEFAULT NULL,
2285 p_proceeds_of_sale IN NUMBER DEFAULT NULL,
2286 p_cost_of_removal IN NUMBER DEFAULT NULL,
2287 p_retirement_type_code IN VARCHAR2 DEFAULT NULL,
2288 p_retire_prorate_convention IN VARCHAR2 DEFAULT NULL,
2289 p_stl_method_code IN VARCHAR2 DEFAULT NULL,
2290 p_stl_life_in_months IN NUMBER DEFAULT NULL,
2291 p_sold_to IN VARCHAR2 DEFAULT NULL,
2292 p_trade_in_asset_id IN NUMBER DEFAULT NULL,
2293 p_status IN VARCHAR2 DEFAULT NULL,
2294 p_reference_num IN VARCHAR2 DEFAULT NULL,
2295 p_recognize_gain_loss IN VARCHAR2 DEFAULT NULL,
2296 p_recapture_reserve_flag IN VARCHAR2 DEFAULT NULL,
2297 p_limit_proceeds_flag IN VARCHAR2 DEFAULT NULL,
2298 p_terminal_gain_loss IN VARCHAR2 DEFAULT NULL,
2299 p_reduction_rate IN NUMBER DEFAULT NULL,
2300 p_reserve_retired IN NUMBER DEFAULT NULL,
2301 p_eofy_reserve IN NUMBER DEFAULT NULL,
2302 p_ret_attribute1 IN VARCHAR2 DEFAULT NULL,
2303 p_ret_attribute2 IN VARCHAR2 DEFAULT NULL,
2304 p_ret_attribute3 IN VARCHAR2 DEFAULT NULL,
2305 p_ret_attribute4 IN VARCHAR2 DEFAULT NULL,
2306 p_ret_attribute5 IN VARCHAR2 DEFAULT NULL,
2307 p_ret_attribute6 IN VARCHAR2 DEFAULT NULL,
2308 p_ret_attribute7 IN VARCHAR2 DEFAULT NULL,
2309 p_ret_attribute8 IN VARCHAR2 DEFAULT NULL,
2310 p_ret_attribute9 IN VARCHAR2 DEFAULT NULL,
2311 p_ret_attribute10 IN VARCHAR2 DEFAULT NULL,
2312 p_ret_attribute11 IN VARCHAR2 DEFAULT NULL,
2313 p_ret_attribute12 IN VARCHAR2 DEFAULT NULL,
2314 p_ret_attribute13 IN VARCHAR2 DEFAULT NULL,
2315 p_ret_attribute14 IN VARCHAR2 DEFAULT NULL,
2316 p_ret_attribute15 IN VARCHAR2 DEFAULT NULL,
2317 p_ret_attribute_category_code IN VARCHAR2 DEFAULT NULL
2318 ) AS
2319
2320 l_trans_rec fa_api_types.trans_rec_type;
2321 l_dist_trans_rec fa_api_types.trans_rec_type;
2322 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
2323 l_asset_retire_rec fa_api_types.asset_retire_rec_type;
2324 l_asset_dist_rec fa_api_types.asset_dist_rec_type;
2325 l_asset_dist_tbl fa_api_types.asset_dist_tbl_type;
2326 l_subcomp_rec fa_api_types.subcomp_rec_type;
2327 l_subcomp_tbl fa_api_types.subcomp_tbl_type;
2328 l_inv_rec fa_api_types.inv_rec_type;
2329 l_inv_tbl fa_api_types.inv_tbl_type;
2330
2331 BEGIN
2332
2333 -- Initialize message list if p_init_msg_list is set to TRUE.
2334 IF FND_API.To_Boolean(p_init_msg_list) THEN
2335 -- Initialize error message stack.
2336 FA_SRVR_MSG.Init_Server_Message;
2337
2338 -- Initialize debug message stack.
2339 FA_DEBUG_PKG.Initialize;
2340 END IF;
2341
2342 -- Override FA:PRINT_DEBUG profile option.
2343 IF (p_debug_flag = 'YES') THEN
2344 FA_DEBUG_PKG.Set_Debug_Flag;
2345 END IF;
2346
2347 -- ***** Asset Transaction Info ***** --
2348 --l_trans_rec.transaction_header_id :=
2349 --l_trans_rec.transaction_type_code :=
2350 l_trans_rec.transaction_date_entered := p_transaction_date_entered;
2351 l_trans_rec.transaction_name := p_transaction_name;
2352 --l_trans_rec.source_transaction_header_id :=
2353 l_trans_rec.mass_reference_id := p_mass_reference_id;
2354 --l_trans_rec.transaction_subtype :=
2355 --l_trans_rec.transaction_key :=
2356 --l_trans_rec.amortization_start_date :=
2357 l_trans_rec.calling_interface := p_calling_interface;
2358 l_trans_rec.desc_flex.attribute1 := p_attribute1;
2359 l_trans_rec.desc_flex.attribute2 := p_attribute2;
2360 l_trans_rec.desc_flex.attribute3 := p_attribute3;
2361 l_trans_rec.desc_flex.attribute4 := p_attribute4;
2362 l_trans_rec.desc_flex.attribute5 := p_attribute5;
2363 l_trans_rec.desc_flex.attribute6 := p_attribute6;
2364 l_trans_rec.desc_flex.attribute7 := p_attribute7;
2365 l_trans_rec.desc_flex.attribute8 := p_attribute8;
2366 l_trans_rec.desc_flex.attribute9 := p_attribute9;
2367 l_trans_rec.desc_flex.attribute10 := p_attribute10;
2368 l_trans_rec.desc_flex.attribute11 := p_attribute11;
2369 l_trans_rec.desc_flex.attribute12 := p_attribute12;
2370 l_trans_rec.desc_flex.attribute13 := p_attribute13;
2371 l_trans_rec.desc_flex.attribute14 := p_attribute14;
2372 l_trans_rec.desc_flex.attribute15 := p_attribute15;
2373 l_trans_rec.desc_flex.attribute_category_code :=
2374 p_attribute_category_code;
2375 l_trans_rec.who_info.last_update_date := p_last_update_date;
2376 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
2377 l_trans_rec.who_info.created_by := p_created_by;
2378 l_trans_rec.who_info.creation_date := p_creation_date;
2379 l_trans_rec.who_info.last_update_login := p_last_update_login;
2380
2381 -- ***** Distribution Transaction Info ***** --
2382 --l_dist_trans_rec.transaction_header_id :=
2383 l_dist_trans_rec.transaction_date_entered := p_transaction_date_entered;
2384 l_dist_trans_rec.transaction_name := p_dist_transaction_name;
2385 l_dist_trans_rec.calling_interface := p_calling_interface;
2386 l_dist_trans_rec.desc_flex.attribute1 := p_dist_attribute1;
2387 l_dist_trans_rec.desc_flex.attribute2 := p_dist_attribute2;
2388 l_dist_trans_rec.desc_flex.attribute3 := p_dist_attribute3;
2389 l_dist_trans_rec.desc_flex.attribute4 := p_dist_attribute4;
2390 l_dist_trans_rec.desc_flex.attribute5 := p_dist_attribute5;
2391 l_dist_trans_rec.desc_flex.attribute6 := p_dist_attribute6;
2392 l_dist_trans_rec.desc_flex.attribute7 := p_dist_attribute7;
2393 l_dist_trans_rec.desc_flex.attribute8 := p_dist_attribute8;
2394 l_dist_trans_rec.desc_flex.attribute9 := p_dist_attribute9;
2395 l_dist_trans_rec.desc_flex.attribute10 := p_dist_attribute10;
2396 l_dist_trans_rec.desc_flex.attribute11 := p_dist_attribute11;
2397 l_dist_trans_rec.desc_flex.attribute12 := p_dist_attribute12;
2398 l_dist_trans_rec.desc_flex.attribute13 := p_dist_attribute13;
2399 l_dist_trans_rec.desc_flex.attribute14 := p_dist_attribute14;
2400 l_dist_trans_rec.desc_flex.attribute15 := p_dist_attribute15;
2401 l_dist_trans_rec.desc_flex.attribute_category_code :=
2402 p_dist_attribute_category_code;
2403 l_dist_trans_rec.who_info.last_update_date := p_last_update_date;
2404 l_dist_trans_rec.who_info.last_updated_by := p_last_updated_by;
2405 l_dist_trans_rec.who_info.created_by := p_created_by;
2406 l_dist_trans_rec.who_info.creation_date := p_creation_date;
2407 l_dist_trans_rec.who_info.last_update_login := p_last_update_login;
2408
2409 -- ***** Asset Header Info ***** --
2410 l_asset_hdr_rec.asset_id := p_asset_id;
2411 l_asset_hdr_rec.book_type_code := p_book_type_code;
2412 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
2413 --l_asset_hdr_rec.period_of_addition := NULL;
2414
2415 -- Derive set of books id for primary book
2416 if (l_asset_hdr_rec.set_of_books_id is NULL) then
2417 select set_of_books_id
2418 into l_asset_hdr_rec.set_of_books_id
2419 from fa_book_controls
2420 where book_type_code = l_asset_hdr_rec.book_type_code;
2421 end if;
2422
2423 -- ***** Asset Retirement Info ***** --
2424 --l_asset_retire_rec.retirement_id :=
2425 l_asset_retire_rec.date_retired := p_transaction_date_entered;
2426 l_asset_retire_rec.units_retired := p_units_retired;
2427 l_asset_retire_rec.cost_retired := p_cost_retired;
2428 l_asset_retire_rec.proceeds_of_sale := p_proceeds_of_sale;
2429 l_asset_retire_rec.cost_of_removal := p_cost_of_removal;
2430 l_asset_retire_rec.retirement_type_code := p_retirement_type_code;
2431 l_asset_retire_rec.retirement_prorate_convention :=
2432 p_retire_prorate_convention;
2433 l_asset_retire_rec.detail_info.stl_method_code := p_stl_method_code;
2434 l_asset_retire_rec.detail_info.stl_life_in_months := p_stl_life_in_months;
2435 l_asset_retire_rec.sold_to := p_sold_to;
2436 l_asset_retire_rec.trade_in_asset_id := p_trade_in_asset_id;
2437 l_asset_retire_rec.status := p_status;
2438 l_asset_retire_rec.reference_num := p_reference_num;
2439 -- toru
2440 -- New variables
2441 l_asset_retire_rec.recognize_gain_loss := p_recognize_gain_loss;
2442 l_asset_retire_rec.recapture_reserve_flag := p_recapture_reserve_flag;
2443 l_asset_retire_rec.limit_proceeds_flag := p_limit_proceeds_flag;
2444 l_asset_retire_rec.terminal_gain_loss := p_terminal_gain_loss;
2445 l_asset_retire_rec.reserve_retired := p_reserve_retired;
2446 l_asset_retire_rec.eofy_reserve := p_eofy_reserve;
2447 l_asset_retire_rec.reduction_rate :=p_reduction_rate;
2448 --
2449 l_asset_retire_rec.calculate_gain_loss := p_calculate_gain_loss;
2450 l_asset_retire_rec.desc_flex.attribute1 := p_ret_attribute1;
2451 l_asset_retire_rec.desc_flex.attribute2 := p_ret_attribute2;
2452 l_asset_retire_rec.desc_flex.attribute3 := p_ret_attribute3;
2453 l_asset_retire_rec.desc_flex.attribute4 := p_ret_attribute4;
2454 l_asset_retire_rec.desc_flex.attribute5 := p_ret_attribute5;
2455 l_asset_retire_rec.desc_flex.attribute6 := p_ret_attribute6;
2456 l_asset_retire_rec.desc_flex.attribute7 := p_ret_attribute7;
2457 l_asset_retire_rec.desc_flex.attribute8 := p_ret_attribute8;
2458 l_asset_retire_rec.desc_flex.attribute9 := p_ret_attribute9;
2459 l_asset_retire_rec.desc_flex.attribute10 := p_ret_attribute10;
2460 l_asset_retire_rec.desc_flex.attribute11 := p_ret_attribute11;
2461 l_asset_retire_rec.desc_flex.attribute12 := p_ret_attribute12;
2462 l_asset_retire_rec.desc_flex.attribute13 := p_ret_attribute13;
2463 l_asset_retire_rec.desc_flex.attribute14 := p_ret_attribute14;
2464 l_asset_retire_rec.desc_flex.attribute15 := p_ret_attribute15;
2465 l_asset_retire_rec.desc_flex.attribute_category_code :=
2466 p_ret_attribute_category_code;
2467
2468 -- ***** Asset Distribution Info ***** --
2469 l_asset_dist_tbl.delete;
2470
2471 -- Get the details from fa_load_tbl_pkg.dist_tbl;
2472 for i in 1 .. fa_load_tbl_pkg.dist_table.COUNT loop
2473 if (fa_load_tbl_pkg.dist_table(i).record_status = 'UPDATE') then
2474 l_asset_dist_rec.distribution_id :=
2475 fa_load_tbl_pkg.dist_table(i).dist_id;
2476 l_asset_dist_rec.transaction_units :=
2477 fa_load_tbl_pkg.dist_table(i).trans_units;
2478 l_asset_dist_rec.units_assigned := NULL;
2479 l_asset_dist_rec.assigned_to :=
2480 fa_load_tbl_pkg.dist_table(i).assigned_to;
2481 l_asset_dist_rec.expense_ccid := fa_load_tbl_pkg.dist_table(i).ccid;
2482 l_asset_dist_rec.location_ccid :=
2483 fa_load_tbl_pkg.dist_table(i).location_id;
2484
2485 l_asset_dist_tbl(i) := l_asset_dist_rec;
2486 end if;
2487 end loop;
2488
2489 -- ***** Subcomponent Asset Info ***** --
2490 -- Don't need to worry about subcomponents for now because you can only
2491 -- retire subcomponents through Mass Retirements and not the Workbench.
2492 l_subcomp_tbl.delete;
2493
2494 -- ***** Invoice Info ***** --
2495 l_inv_tbl.delete;
2496
2497 -- Get the details from fa_load_tbl_pkg.inv_table
2498 for i in 1 .. fa_load_tbl_pkg.inv_table.COUNT loop
2499
2500 l_inv_rec.po_vendor_id := fa_load_tbl_pkg.inv_table(i).po_vendor_id;
2501 l_inv_rec.asset_invoice_id :=
2502 fa_load_tbl_pkg.inv_table(i).asset_invoice_id;
2503 l_inv_rec.fixed_assets_cost :=
2504 fa_load_tbl_pkg.inv_table(i).inv_new_cost -
2505 nvl(fa_load_tbl_pkg.inv_table(i).fixed_assets_cost, 0);
2506 l_inv_rec.deleted_flag := fa_load_tbl_pkg.inv_table(i).deleted_flag;
2507 l_inv_rec.po_number := fa_load_tbl_pkg.inv_table(i).po_number;
2508 l_inv_rec.invoice_number := fa_load_tbl_pkg.inv_table(i).invoice_number;
2509 l_inv_rec.payables_batch_name :=
2510 fa_load_tbl_pkg.inv_table(i).payables_batch_name;
2511 l_inv_rec.payables_code_combination_id :=
2512 fa_load_tbl_pkg.inv_table(i).payables_ccid;
2513 l_inv_rec.feeder_system_name :=
2514 fa_load_tbl_pkg.inv_table(i).feeder_system_name;
2515 l_inv_rec.create_batch_date :=
2516 fa_load_tbl_pkg.inv_table(i).create_batch_date;
2517 l_inv_rec.create_batch_id :=
2518 fa_load_tbl_pkg.inv_table(i).create_batch_id;
2519 l_inv_rec.invoice_date := fa_load_tbl_pkg.inv_table(i).invoice_date;
2520 l_inv_rec.payables_cost := fa_load_tbl_pkg.inv_table(i).payables_cost;
2521 l_inv_rec.post_batch_id := fa_load_tbl_pkg.inv_table(i).post_batch_id;
2522 l_inv_rec.invoice_id := fa_load_tbl_pkg.inv_table(i).invoice_id;
2523 l_inv_rec.invoice_distribution_id := fa_load_tbl_pkg.inv_table(i).invoice_distribution_id;
2524 l_inv_rec.invoice_line_number := fa_load_tbl_pkg.inv_table(i).invoice_line_number;
2525 l_inv_rec.po_distribution_id := fa_load_tbl_pkg.inv_table(i).po_distribution_id;
2526 l_inv_rec.ap_distribution_line_number :=
2527 fa_load_tbl_pkg.inv_table(i).ap_dist_line_num;
2528 l_inv_rec.payables_units := fa_load_tbl_pkg.inv_table(i).payables_units;
2529 --l_inv_rec.split_merged_code :=
2530 l_inv_rec.description := fa_load_tbl_pkg.inv_table(i).description;
2531 --l_inv_rec.parent_mass_additions_id :=
2532 --l_inv_rec.unrevalued_cost :=
2533 --l_inv_rec.merged_code :=
2534 --l_inv_rec.split_code :=
2535 --l_inv_rec.merge_parent_mass_additions_id :=
2536 --l_inv_rec.split_parent_mass_additions_id :=
2537 l_inv_rec.project_asset_line_id :=
2538 fa_load_tbl_pkg.inv_table(i).project_asset_line_id;
2539 l_inv_rec.project_id := fa_load_tbl_pkg.inv_table(i).project_id;
2540 l_inv_rec.task_id := fa_load_tbl_pkg.inv_table(i).task_id;
2541 l_inv_rec.material_indicator_flag :=
2542 fa_load_tbl_pkg.inv_table(i).material_indicator_flag;
2543 l_inv_rec.depreciate_in_group_flag :=
2544 fa_load_tbl_pkg.inv_table(i).depreciate_in_group_flag;
2545 l_inv_rec.source_line_id := fa_load_tbl_pkg.inv_table(i).source_line_id;
2546 l_inv_rec.attribute1 := fa_load_tbl_pkg.inv_table(i).attribute1;
2547 l_inv_rec.attribute2 := fa_load_tbl_pkg.inv_table(i).attribute2;
2548 l_inv_rec.attribute3 := fa_load_tbl_pkg.inv_table(i).attribute3;
2549 l_inv_rec.attribute4 := fa_load_tbl_pkg.inv_table(i).attribute4;
2550 l_inv_rec.attribute5 := fa_load_tbl_pkg.inv_table(i).attribute5;
2551 l_inv_rec.attribute6 := fa_load_tbl_pkg.inv_table(i).attribute6;
2552 l_inv_rec.attribute7 := fa_load_tbl_pkg.inv_table(i).attribute7;
2553 l_inv_rec.attribute8 := fa_load_tbl_pkg.inv_table(i).attribute8;
2554 l_inv_rec.attribute9 := fa_load_tbl_pkg.inv_table(i).attribute9;
2555 l_inv_rec.attribute10 := fa_load_tbl_pkg.inv_table(i).attribute10;
2556 l_inv_rec.attribute11 := fa_load_tbl_pkg.inv_table(i).attribute11;
2557 l_inv_rec.attribute12 := fa_load_tbl_pkg.inv_table(i).attribute12;
2558 l_inv_rec.attribute13 := fa_load_tbl_pkg.inv_table(i).attribute13;
2559 l_inv_rec.attribute14 := fa_load_tbl_pkg.inv_table(i).attribute14;
2560 l_inv_rec.attribute15 := fa_load_tbl_pkg.inv_table(i).attribute15;
2561 l_inv_rec.attribute_category_code :=
2562 fa_load_tbl_pkg.inv_table(i).attribute_cat_code;
2563
2564 l_inv_tbl(i) := l_inv_rec;
2565 end loop;
2566
2567 -- Call Public Retirement API
2568 fa_retirement_pub.do_retirement
2569 (p_api_version => p_api_version,
2570 p_init_msg_list => p_init_msg_list,
2571 p_commit => p_commit,
2572 p_validation_level => p_validation_level,
2573 p_calling_fn => p_calling_fn,
2574 x_return_status => x_return_status,
2575 x_msg_count => x_msg_count,
2576 x_msg_data => x_msg_data,
2577 px_trans_rec => l_trans_rec,
2578 px_dist_trans_rec => l_dist_trans_rec,
2579 px_asset_hdr_rec => l_asset_hdr_rec,
2580 px_asset_retire_rec => l_asset_retire_rec,
2581 p_asset_dist_tbl => l_asset_dist_tbl,
2582 p_subcomp_tbl => l_subcomp_tbl,
2583 p_inv_tbl => l_inv_tbl);
2584
2585 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
2586 return;
2587 end if;
2588
2589 x_retirement_id := l_asset_retire_rec.retirement_id;
2590 x_transaction_header_id := l_trans_rec.transaction_header_id;
2591 x_dist_transaction_header_id := l_dist_trans_rec.transaction_header_id;
2592
2593 EXCEPTION
2594 when others then
2595 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_retirement',
2596 p_log_level_rec => g_log_level_rec);
2597 x_return_status := FND_API.G_RET_STS_ERROR;
2598
2599 END do_retirement;
2600
2601 PROCEDURE undo_retirement (
2602 -- Standard Parameters --
2603 p_api_version IN NUMBER,
2604 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
2605 p_commit IN VARCHAR2 := FND_API.G_FALSE,
2606 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
2607 x_return_status OUT NOCOPY VARCHAR2,
2608 x_msg_count OUT NOCOPY NUMBER,
2609 x_msg_data OUT NOCOPY VARCHAR2,
2610 p_calling_fn IN VARCHAR2,
2611 -- API Options --
2612 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
2613 -- Transaction Info --
2614 p_last_update_date IN DATE,
2615 p_last_updated_by IN NUMBER,
2616 p_last_update_login IN NUMBER,
2617 -- Asset Header Info --
2618 p_asset_id IN NUMBER,
2619 p_book_type_code IN VARCHAR2,
2620 p_set_of_books_id IN NUMBER DEFAULT NULL,
2621 -- Asset Retirement Info --
2622 p_retirement_id IN NUMBER DEFAULT NULL,
2623 p_status IN VARCHAR2 DEFAULT NULL
2624 ) AS
2625
2626 l_trans_rec fa_api_types.trans_rec_type;
2627 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
2628 l_asset_retire_rec fa_api_types.asset_retire_rec_type;
2629
2630 BEGIN
2631
2632 -- Initialize message list if p_init_msg_list is set to TRUE.
2633 IF FND_API.To_Boolean(p_init_msg_list) THEN
2634 -- Initialize error message stack.
2635 FA_SRVR_MSG.Init_Server_Message;
2636
2637 -- Initialize debug message stack.
2638 FA_DEBUG_PKG.Initialize;
2639 END IF;
2640
2641 -- Override FA:PRINT_DEBUG profile option.
2642 IF (p_debug_flag = 'YES') THEN
2643 FA_DEBUG_PKG.Set_Debug_Flag;
2644 END IF;
2645
2646 -- ***** Asset Transaction Info ***** --
2647 --l_trans_rec.transaction_header_id :=
2648 --l_trans_rec.transaction_type_code :=
2649 --l_trans_rec.transaction_date_entered :=
2650 --l_trans_rec.transaction_name :=
2651 --l_trans_rec.source_transaction_header_id :=
2652 --l_trans_rec.mass_reference_id :=
2653 --l_trans_rec.transaction_subtype :=
2654 --l_trans_rec.transaction_key :=
2655 --l_trans_rec.amortization_start_date :=
2656 --l_trans_rec.calling_interface :=
2657 --l_trans_rec.desc_flex.attribute1 :=
2658 --l_trans_rec.desc_flex.attribute2 :=
2659 --l_trans_rec.desc_flex.attribute3 :=
2660 --l_trans_rec.desc_flex.attribute4 :=
2661 --l_trans_rec.desc_flex.attribute5 :=
2662 --l_trans_rec.desc_flex.attribute6 :=
2663 --l_trans_rec.desc_flex.attribute7 :=
2664 --l_trans_rec.desc_flex.attribute8 :=
2665 --l_trans_rec.desc_flex.attribute9 :=
2666 --l_trans_rec.desc_flex.attribute10 :=
2667 --l_trans_rec.desc_flex.attribute11 :=
2668 --l_trans_rec.desc_flex.attribute12 :=
2669 --l_trans_rec.desc_flex.attribute13 :=
2670 --l_trans_rec.desc_flex.attribute14 :=
2671 --l_trans_rec.desc_flex.attribute15 :=
2672 --l_trans_rec.desc_flex.attribute_category_code :=
2673 l_trans_rec.who_info.last_update_date := p_last_update_date;
2674 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
2675 l_trans_rec.who_info.created_by := NULL;
2676 l_trans_rec.who_info.creation_date := NULL;
2677 l_trans_rec.who_info.last_update_login := p_last_update_login;
2678
2679 -- ***** Asset Header Info ***** --
2680 l_asset_hdr_rec.asset_id := p_asset_id;
2681 l_asset_hdr_rec.book_type_code := p_book_type_code;
2682 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
2683 --l_asset_hdr_rec.period_of_addition := NULL;
2684
2685 -- Derive set of books id for primary book
2686 if (l_asset_hdr_rec.set_of_books_id is NULL) then
2687 select set_of_books_id
2688 into l_asset_hdr_rec.set_of_books_id
2689 from fa_book_controls
2690 where book_type_code = l_asset_hdr_rec.book_type_code;
2691 end if;
2692
2693 -- ***** Asset Retirement Info ***** --
2694 l_asset_retire_rec.retirement_id := p_retirement_id;
2695 --l_asset_retire_rec.date_retired :=
2696 --l_asset_retire_rec.units_retired :=
2697 --l_asset_retire_rec.cost_retired :=
2698 --l_asset_retire_rec.proceeds_of_sale :=
2699 --l_asset_retire_rec.cost_of_removal :=
2700 --l_asset_retire_rec.retirement_type_code :=
2701 --l_asset_retire_rec.retirement_prorate_convention :=
2702 --l_asset_retire_rec.sold_to :=
2703 --l_asset_retire_rec.trade_in_asset_id :=
2704 l_asset_retire_rec.status := p_status;
2705 --l_asset_retire_rec.reference_num :=
2706 --l_asset_retire_rec.calculate_gain_loss :=
2707 --l_asset_retire_rec.desc_flex.attribute1 :=
2708 --l_asset_retire_rec.desc_flex.attribute2 :=
2709 --l_asset_retire_rec.desc_flex.attribute3 :=
2710 --l_asset_retire_rec.desc_flex.attribute4 :=
2711 --l_asset_retire_rec.desc_flex.attribute5 :=
2712 --l_asset_retire_rec.desc_flex.attribute6 :=
2713 --l_asset_retire_rec.desc_flex.attribute7 :=
2714 --l_asset_retire_rec.desc_flex.attribute8 :=
2715 --l_asset_retire_rec.desc_flex.attribute9 :=
2716 --l_asset_retire_rec.desc_flex.attribute10 :=
2717 --l_asset_retire_rec.desc_flex.attribute11 :=
2718 --l_asset_retire_rec.desc_flex.attribute12 :=
2719 --l_asset_retire_rec.desc_flex.attribute13 :=
2720 --l_asset_retire_rec.desc_flex.attribute14 :=
2721 --l_asset_retire_rec.desc_flex.attribute15 :=
2722 --l_asset_retire_rec.desc_flex.attribute_category_code :=
2723
2724 -- Call Public Undo Retirement API
2725 fa_retirement_pub.undo_retirement (
2726 p_api_version => p_api_version,
2727 p_init_msg_list => p_init_msg_list,
2728 p_commit => p_commit,
2729 p_validation_level => p_validation_level,
2730 p_calling_fn => p_calling_fn,
2731 x_return_status => x_return_status,
2732 x_msg_count => x_msg_count,
2733 x_msg_data => x_msg_data,
2734 px_trans_rec => l_trans_rec,
2735 px_asset_hdr_rec => l_asset_hdr_rec,
2736 px_asset_retire_rec => l_asset_retire_rec
2737 );
2738
2739 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
2740 return;
2741 end if;
2742
2743 EXCEPTION
2744 when others then
2745 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.undo_ret',
2746 p_log_level_rec => g_log_level_rec);
2747 x_return_status := FND_API.G_RET_STS_ERROR;
2748
2749 END undo_retirement;
2750
2751 PROCEDURE do_reinstatement (
2752 -- Standard Parameters --
2753 p_api_version IN NUMBER,
2754 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
2755 p_commit IN VARCHAR2 := FND_API.G_FALSE,
2756 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
2757 x_return_status OUT NOCOPY VARCHAR2,
2758 x_msg_count OUT NOCOPY NUMBER,
2759 x_msg_data OUT NOCOPY VARCHAR2,
2760 p_calling_fn IN VARCHAR2,
2761 -- API Options --
2762 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
2763 -- Out Parameters --
2764 x_transaction_header_id OUT NOCOPY NUMBER,
2765 -- Transaction Info --
2766 p_transaction_date_entered IN DATE DEFAULT NULL,
2767 p_transaction_name IN VARCHAR2 DEFAULT NULL,
2768 p_mass_reference_id IN NUMBER DEFAULT NULL,
2769 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
2770 p_last_update_date IN DATE,
2771 p_last_updated_by IN NUMBER,
2772 p_created_by IN NUMBER,
2773 p_creation_date IN DATE,
2774 p_last_update_login IN NUMBER,
2775 p_attribute1 IN VARCHAR2 DEFAULT NULL,
2776 p_attribute2 IN VARCHAR2 DEFAULT NULL,
2777 p_attribute3 IN VARCHAR2 DEFAULT NULL,
2778 p_attribute4 IN VARCHAR2 DEFAULT NULL,
2779 p_attribute5 IN VARCHAR2 DEFAULT NULL,
2780 p_attribute6 IN VARCHAR2 DEFAULT NULL,
2781 p_attribute7 IN VARCHAR2 DEFAULT NULL,
2782 p_attribute8 IN VARCHAR2 DEFAULT NULL,
2783 p_attribute9 IN VARCHAR2 DEFAULT NULL,
2784 p_attribute10 IN VARCHAR2 DEFAULT NULL,
2785 p_attribute11 IN VARCHAR2 DEFAULT NULL,
2786 p_attribute12 IN VARCHAR2 DEFAULT NULL,
2787 p_attribute13 IN VARCHAR2 DEFAULT NULL,
2788 p_attribute14 IN VARCHAR2 DEFAULT NULL,
2789 p_attribute15 IN VARCHAR2 DEFAULT NULL,
2790 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
2791 -- Asset Header Info --
2792 p_asset_id IN NUMBER,
2793 p_book_type_code IN VARCHAR2,
2794 p_set_of_books_id IN NUMBER DEFAULT NULL,
2795 -- Asset Retirement Info --
2796 p_calculate_gain_loss IN VARCHAR2 DEFAULT FND_API.G_FALSE,
2797 p_retirement_id IN NUMBER DEFAULT NULL,
2798 p_proceeds_of_sale IN NUMBER DEFAULT NULL,
2799 p_cost_of_removal IN NUMBER DEFAULT NULL,
2800 p_retirement_type_code IN VARCHAR2 DEFAULT NULL,
2801 p_retire_prorate_convention IN VARCHAR2 DEFAULT NULL,
2802 p_sold_to IN VARCHAR2 DEFAULT NULL,
2803 p_trade_in_asset_id IN NUMBER DEFAULT NULL,
2804 p_status IN VARCHAR2 DEFAULT NULL,
2805 p_reference_num IN VARCHAR2 DEFAULT NULL,
2806 p_ret_attribute1 IN VARCHAR2 DEFAULT NULL,
2807 p_ret_attribute2 IN VARCHAR2 DEFAULT NULL,
2808 p_ret_attribute3 IN VARCHAR2 DEFAULT NULL,
2809 p_ret_attribute4 IN VARCHAR2 DEFAULT NULL,
2810 p_ret_attribute5 IN VARCHAR2 DEFAULT NULL,
2811 p_ret_attribute6 IN VARCHAR2 DEFAULT NULL,
2812 p_ret_attribute7 IN VARCHAR2 DEFAULT NULL,
2813 p_ret_attribute8 IN VARCHAR2 DEFAULT NULL,
2814 p_ret_attribute9 IN VARCHAR2 DEFAULT NULL,
2815 p_ret_attribute10 IN VARCHAR2 DEFAULT NULL,
2816 p_ret_attribute11 IN VARCHAR2 DEFAULT NULL,
2817 p_ret_attribute12 IN VARCHAR2 DEFAULT NULL,
2818 p_ret_attribute13 IN VARCHAR2 DEFAULT NULL,
2819 p_ret_attribute14 IN VARCHAR2 DEFAULT NULL,
2820 p_ret_attribute15 IN VARCHAR2 DEFAULT NULL,
2821 p_ret_attribute_category_code IN VARCHAR2 DEFAULT NULL
2822 ) AS
2823
2824 l_trans_rec fa_api_types.trans_rec_type;
2825 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
2826 l_asset_retire_rec fa_api_types.asset_retire_rec_type;
2827 l_asset_dist_rec fa_api_types.asset_dist_rec_type;
2828 l_asset_dist_tbl fa_api_types.asset_dist_tbl_type;
2829 l_subcomp_rec fa_api_types.subcomp_rec_type;
2830 l_subcomp_tbl fa_api_types.subcomp_tbl_type;
2831 l_inv_rec fa_api_types.inv_rec_type;
2832 l_inv_tbl fa_api_types.inv_tbl_type;
2833
2834 BEGIN
2835
2836 -- Initialize message list if p_init_msg_list is set to TRUE.
2837 IF FND_API.To_Boolean(p_init_msg_list) THEN
2838 -- Initialize error message stack.
2839 FA_SRVR_MSG.Init_Server_Message;
2840
2841 -- Initialize debug message stack.
2842 FA_DEBUG_PKG.Initialize;
2843 END IF;
2844
2845 -- Override FA:PRINT_DEBUG profile option.
2846 IF (p_debug_flag = 'YES') THEN
2847 FA_DEBUG_PKG.Set_Debug_Flag;
2848 END IF;
2849
2850 -- ***** Asset Transaction Info ***** --
2851 --l_trans_rec.transaction_header_id :=
2852 --l_trans_rec.transaction_type_code :=
2853 l_trans_rec.transaction_date_entered := p_transaction_date_entered;
2854 l_trans_rec.transaction_name := p_transaction_name;
2855 --l_trans_rec.source_transaction_header_id :=
2856 l_trans_rec.mass_reference_id := p_mass_reference_id;
2857 --l_trans_rec.transaction_subtype :=
2858 --l_trans_rec.transaction_key :=
2859 --l_trans_rec.amortization_start_date :=
2860 l_trans_rec.calling_interface := p_calling_interface;
2861 l_trans_rec.desc_flex.attribute1 := p_attribute1;
2862 l_trans_rec.desc_flex.attribute2 := p_attribute2;
2863 l_trans_rec.desc_flex.attribute3 := p_attribute3;
2864 l_trans_rec.desc_flex.attribute4 := p_attribute4;
2865 l_trans_rec.desc_flex.attribute5 := p_attribute5;
2866 l_trans_rec.desc_flex.attribute6 := p_attribute6;
2867 l_trans_rec.desc_flex.attribute7 := p_attribute7;
2868 l_trans_rec.desc_flex.attribute8 := p_attribute8;
2869 l_trans_rec.desc_flex.attribute9 := p_attribute9;
2870 l_trans_rec.desc_flex.attribute10 := p_attribute10;
2871 l_trans_rec.desc_flex.attribute11 := p_attribute11;
2872 l_trans_rec.desc_flex.attribute12 := p_attribute12;
2873 l_trans_rec.desc_flex.attribute13 := p_attribute13;
2874 l_trans_rec.desc_flex.attribute14 := p_attribute14;
2875 l_trans_rec.desc_flex.attribute15 := p_attribute15;
2876 l_trans_rec.desc_flex.attribute_category_code :=
2877 p_attribute_category_code;
2878 l_trans_rec.who_info.last_update_date := p_last_update_date;
2879 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
2880 l_trans_rec.who_info.created_by := p_created_by;
2881 l_trans_rec.who_info.creation_date := p_creation_date;
2882 l_trans_rec.who_info.last_update_login := p_last_update_login;
2883
2884 -- ***** Asset Header Info ***** --
2885 l_asset_hdr_rec.asset_id := p_asset_id;
2886 l_asset_hdr_rec.book_type_code := p_book_type_code;
2887 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
2888 --l_asset_hdr_rec.period_of_addition := NULL;
2889
2890 -- Derive set of books id for primary book
2891 if (l_asset_hdr_rec.set_of_books_id is NULL) then
2892 select set_of_books_id
2893 into l_asset_hdr_rec.set_of_books_id
2894 from fa_book_controls
2895 where book_type_code = l_asset_hdr_rec.book_type_code;
2896 end if;
2897
2898 -- ***** Asset Retirement Info ***** --
2899 l_asset_retire_rec.retirement_id := p_retirement_id;
2900 --l_asset_retire_rec.date_retired :=
2901 --l_asset_retire_rec.units_retired :=
2902 --l_asset_retire_rec.cost_retired :=
2903 l_asset_retire_rec.proceeds_of_sale := p_proceeds_of_sale;
2904 l_asset_retire_rec.cost_of_removal := p_cost_of_removal;
2905 l_asset_retire_rec.retirement_type_code := p_retirement_type_code;
2906 l_asset_retire_rec.retirement_prorate_convention :=
2907 p_retire_prorate_convention;
2908 l_asset_retire_rec.sold_to := p_sold_to;
2909 l_asset_retire_rec.trade_in_asset_id := p_trade_in_asset_id;
2910 l_asset_retire_rec.status := p_status;
2911 l_asset_retire_rec.reference_num := p_reference_num;
2912 l_asset_retire_rec.calculate_gain_loss := p_calculate_gain_loss;
2913 l_asset_retire_rec.desc_flex.attribute1 := p_ret_attribute1;
2914 l_asset_retire_rec.desc_flex.attribute2 := p_ret_attribute2;
2915 l_asset_retire_rec.desc_flex.attribute3 := p_ret_attribute3;
2916 l_asset_retire_rec.desc_flex.attribute4 := p_ret_attribute4;
2917 l_asset_retire_rec.desc_flex.attribute5 := p_ret_attribute5;
2918 l_asset_retire_rec.desc_flex.attribute6 := p_ret_attribute6;
2919 l_asset_retire_rec.desc_flex.attribute7 := p_ret_attribute7;
2920 l_asset_retire_rec.desc_flex.attribute8 := p_ret_attribute8;
2921 l_asset_retire_rec.desc_flex.attribute9 := p_ret_attribute9;
2922 l_asset_retire_rec.desc_flex.attribute10 := p_ret_attribute10;
2923 l_asset_retire_rec.desc_flex.attribute11 := p_ret_attribute11;
2924 l_asset_retire_rec.desc_flex.attribute12 := p_ret_attribute12;
2925 l_asset_retire_rec.desc_flex.attribute13 := p_ret_attribute13;
2926 l_asset_retire_rec.desc_flex.attribute14 := p_ret_attribute14;
2927 l_asset_retire_rec.desc_flex.attribute15 := p_ret_attribute15;
2928 l_asset_retire_rec.desc_flex.attribute_category_code :=
2929 p_ret_attribute_category_code;
2930
2931 -- ***** Asset Distribution Info ***** --
2932 l_asset_dist_tbl.delete;
2933
2934 -- Get the details from fa_load_tbl_pkg.dist_tbl;
2935 for i in 1 .. fa_load_tbl_pkg.dist_table.COUNT loop
2936 if (fa_load_tbl_pkg.dist_table(i).record_status = 'UPDATE') then
2937 l_asset_dist_rec.distribution_id :=
2938 fa_load_tbl_pkg.dist_table(i).dist_id;
2939 l_asset_dist_rec.units_assigned :=
2940 fa_load_tbl_pkg.dist_table(i).trans_units;
2941 l_asset_dist_rec.transaction_units := NULL;
2942 l_asset_dist_rec.assigned_to :=
2943 fa_load_tbl_pkg.dist_table(i).assigned_to;
2944 l_asset_dist_rec.expense_ccid := fa_load_tbl_pkg.dist_table(i).ccid;
2945 l_asset_dist_rec.location_ccid :=
2946 fa_load_tbl_pkg.dist_table(i).location_id;
2947
2948 l_asset_dist_tbl(i) := l_asset_dist_rec;
2949 end if;
2950 end loop;
2951
2952 -- ***** Subcomponent Asset Info ***** --
2953 -- Don't need to worry about subcomponents for now because you can only
2954 -- retire subcomponents through Mass Retirements and not the Workbench.
2955 l_subcomp_tbl.delete;
2956 --l_subcomp_rec.asset_id :=
2957 --l_subcomp_rec.parent_flag :=
2958
2959 -- ***** Invoice Info ***** --
2960 l_inv_tbl.delete;
2961
2962 -- Get the details from fa_load_tbl_pkg.inv_table
2963 for i in 1 .. fa_load_tbl_pkg.inv_table.COUNT loop
2964
2965 l_inv_rec.po_vendor_id := fa_load_tbl_pkg.inv_table(i).po_vendor_id;
2966 l_inv_rec.asset_invoice_id :=
2967 fa_load_tbl_pkg.inv_table(i).asset_invoice_id;
2968 l_inv_rec.fixed_assets_cost :=
2969 fa_load_tbl_pkg.inv_table(i).fixed_assets_cost;
2970 l_inv_rec.deleted_flag := fa_load_tbl_pkg.inv_table(i).deleted_flag;
2971 l_inv_rec.po_number := fa_load_tbl_pkg.inv_table(i).po_number;
2972 l_inv_rec.invoice_number := fa_load_tbl_pkg.inv_table(i).invoice_number;
2973 l_inv_rec.payables_batch_name :=
2974 fa_load_tbl_pkg.inv_table(i).payables_batch_name;
2975 l_inv_rec.payables_code_combination_id :=
2976 fa_load_tbl_pkg.inv_table(i).payables_ccid;
2977 l_inv_rec.feeder_system_name :=
2978 fa_load_tbl_pkg.inv_table(i).feeder_system_name;
2979 l_inv_rec.create_batch_date :=
2980 fa_load_tbl_pkg.inv_table(i).create_batch_date;
2981 l_inv_rec.create_batch_id :=
2982 fa_load_tbl_pkg.inv_table(i).create_batch_id;
2983 l_inv_rec.invoice_date := fa_load_tbl_pkg.inv_table(i).invoice_date;
2984 l_inv_rec.payables_cost := fa_load_tbl_pkg.inv_table(i).payables_cost;
2985 l_inv_rec.post_batch_id := fa_load_tbl_pkg.inv_table(i).post_batch_id;
2986 l_inv_rec.invoice_id := fa_load_tbl_pkg.inv_table(i).invoice_id;
2987 l_inv_rec.invoice_distribution_id := fa_load_tbl_pkg.inv_table(i).invoice_distribution_id;
2988 l_inv_rec.invoice_line_number := fa_load_tbl_pkg.inv_table(i).invoice_line_number;
2989 l_inv_rec.po_distribution_id := fa_load_tbl_pkg.inv_table(i).po_distribution_id;
2990 l_inv_rec.ap_distribution_line_number :=
2991 fa_load_tbl_pkg.inv_table(i).ap_dist_line_num;
2992 l_inv_rec.payables_units := fa_load_tbl_pkg.inv_table(i).payables_units;
2993 --l_inv_rec.split_merged_code :=
2994 l_inv_rec.description := fa_load_tbl_pkg.inv_table(i).description;
2995 --l_inv_rec.parent_mass_additions_id :=
2996 --l_inv_rec.unrevalued_cost :=
2997 --l_inv_rec.merged_code :=
2998 --l_inv_rec.split_code :=
2999 --l_inv_rec.merge_parent_mass_additions_id :=
3000 --l_inv_rec.split_parent_mass_additions_id :=
3001 l_inv_rec.project_asset_line_id :=
3002 fa_load_tbl_pkg.inv_table(i).project_asset_line_id;
3003 l_inv_rec.project_id := fa_load_tbl_pkg.inv_table(i).project_id;
3004 l_inv_rec.task_id := fa_load_tbl_pkg.inv_table(i).task_id;
3005 l_inv_rec.material_indicator_flag :=
3006 fa_load_tbl_pkg.inv_table(i).material_indicator_flag;
3007 l_inv_rec.depreciate_in_group_flag :=
3008 fa_load_tbl_pkg.inv_table(i).depreciate_in_group_flag;
3009 l_inv_rec.source_line_id := fa_load_tbl_pkg.inv_table(i).source_line_id;
3010 l_inv_rec.attribute1 := fa_load_tbl_pkg.inv_table(i).attribute1;
3011 l_inv_rec.attribute2 := fa_load_tbl_pkg.inv_table(i).attribute2;
3012 l_inv_rec.attribute3 := fa_load_tbl_pkg.inv_table(i).attribute3;
3013 l_inv_rec.attribute4 := fa_load_tbl_pkg.inv_table(i).attribute4;
3014 l_inv_rec.attribute5 := fa_load_tbl_pkg.inv_table(i).attribute5;
3015 l_inv_rec.attribute6 := fa_load_tbl_pkg.inv_table(i).attribute6;
3016 l_inv_rec.attribute7 := fa_load_tbl_pkg.inv_table(i).attribute7;
3017 l_inv_rec.attribute8 := fa_load_tbl_pkg.inv_table(i).attribute8;
3018 l_inv_rec.attribute9 := fa_load_tbl_pkg.inv_table(i).attribute9;
3019 l_inv_rec.attribute10 := fa_load_tbl_pkg.inv_table(i).attribute10;
3020 l_inv_rec.attribute11 := fa_load_tbl_pkg.inv_table(i).attribute11;
3021 l_inv_rec.attribute12 := fa_load_tbl_pkg.inv_table(i).attribute12;
3022 l_inv_rec.attribute13 := fa_load_tbl_pkg.inv_table(i).attribute13;
3023 l_inv_rec.attribute14 := fa_load_tbl_pkg.inv_table(i).attribute14;
3024 l_inv_rec.attribute15 := fa_load_tbl_pkg.inv_table(i).attribute15;
3025 l_inv_rec.attribute_category_code :=
3026 fa_load_tbl_pkg.inv_table(i).attribute_cat_code;
3027
3028 l_inv_tbl(i) := l_inv_rec;
3029 end loop;
3030
3031 -- Call Public Reinstatement API
3032 fa_retirement_pub.do_reinstatement
3033 (p_api_version => p_api_version,
3034 p_init_msg_list => p_init_msg_list,
3035 p_commit => p_commit,
3036 p_validation_level => p_validation_level,
3037 p_calling_fn => p_calling_fn,
3038 x_return_status => x_return_status,
3039 x_msg_count => x_msg_count,
3040 x_msg_data => x_msg_data,
3041 px_trans_rec => l_trans_rec,
3042 px_asset_hdr_rec => l_asset_hdr_rec,
3043 px_asset_retire_rec => l_asset_retire_rec,
3044 p_asset_dist_tbl => l_asset_dist_tbl,
3045 p_subcomp_tbl => l_subcomp_tbl,
3046 p_inv_tbl => l_inv_tbl);
3047
3048 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
3049 return;
3050 end if;
3051
3052 x_transaction_header_id := l_trans_rec.transaction_header_id;
3053
3054 EXCEPTION
3055 when others then
3056 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_reinst',
3057 p_log_level_rec => g_log_level_rec);
3058 x_return_status := FND_API.G_RET_STS_ERROR;
3059
3060 END do_reinstatement;
3061
3062 PROCEDURE undo_reinstatement (
3063 -- Standard Parameters --
3064 p_api_version IN NUMBER,
3065 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
3066 p_commit IN VARCHAR2 := FND_API.G_FALSE,
3067 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
3068 x_return_status OUT NOCOPY VARCHAR2,
3069 x_msg_count OUT NOCOPY NUMBER,
3070 x_msg_data OUT NOCOPY VARCHAR2,
3071 p_calling_fn IN VARCHAR2,
3072 -- API Options --
3073 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
3074 -- Transaction Info (Retirement) --
3075 p_last_update_date IN DATE,
3076 p_last_updated_by IN NUMBER,
3077 p_last_update_login IN NUMBER,
3078 -- Asset Header Info --
3079 p_asset_id IN NUMBER,
3080 p_book_type_code IN VARCHAR2,
3081 p_set_of_books_id IN NUMBER DEFAULT NULL,
3082 -- Asset Retirement Info --
3083 p_retirement_id IN NUMBER DEFAULT NULL,
3084 p_status IN VARCHAR2 DEFAULT NULL
3085 ) AS
3086
3087 l_trans_rec fa_api_types.trans_rec_type;
3088 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
3089 l_asset_retire_rec fa_api_types.asset_retire_rec_type;
3090
3091 BEGIN
3092
3093 -- Initialize message list if p_init_msg_list is set to TRUE.
3094 IF FND_API.To_Boolean(p_init_msg_list) THEN
3095 -- Initialize error message stack.
3096 FA_SRVR_MSG.Init_Server_Message;
3097
3098 -- Initialize debug message stack.
3099 FA_DEBUG_PKG.Initialize;
3100 END IF;
3101
3102 -- Override FA:PRINT_DEBUG profile option.
3103 IF (p_debug_flag = 'YES') THEN
3104 FA_DEBUG_PKG.Set_Debug_Flag;
3105 END IF;
3106
3107 -- ***** Asset Transaction Info ***** --
3108 --l_trans_rec.transaction_header_id :=
3109 --l_trans_rec.transaction_type_code :=
3110 --l_trans_rec.transaction_date_entered :=
3111 --l_trans_rec.transaction_name :=
3112 --l_trans_rec.source_transaction_header_id :=
3113 --l_trans_rec.mass_reference_id :=
3114 --l_trans_rec.transaction_subtype :=
3115 --l_trans_rec.transaction_key :=
3116 --l_trans_rec.amortization_start_date :=
3117 --l_trans_rec.calling_interface :=
3118 --l_trans_rec.desc_flex.attribute1 :=
3119 --l_trans_rec.desc_flex.attribute2 :=
3120 --l_trans_rec.desc_flex.attribute3 :=
3121 --l_trans_rec.desc_flex.attribute4 :=
3122 --l_trans_rec.desc_flex.attribute5 :=
3123 --l_trans_rec.desc_flex.attribute6 :=
3124 --l_trans_rec.desc_flex.attribute7 :=
3125 --l_trans_rec.desc_flex.attribute8 :=
3126 --l_trans_rec.desc_flex.attribute9 :=
3127 --l_trans_rec.desc_flex.attribute10 :=
3128 --l_trans_rec.desc_flex.attribute11 :=
3129 --l_trans_rec.desc_flex.attribute12 :=
3130 --l_trans_rec.desc_flex.attribute12 :=
3131 --l_trans_rec.desc_flex.attribute13 :=
3132 --l_trans_rec.desc_flex.attribute14 :=
3133 --l_trans_rec.desc_flex.attribute15 :=
3134 --l_trans_rec.desc_flex.attribute_category_code :=
3135 l_trans_rec.who_info.last_update_date := p_last_update_date;
3136 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
3137 l_trans_rec.who_info.created_by := NULL;
3138 l_trans_rec.who_info.creation_date := NULL;
3139 l_trans_rec.who_info.last_update_login := p_last_update_login;
3140
3141 -- ***** Asset Header Info ***** --
3142 l_asset_hdr_rec.asset_id := p_asset_id;
3143 l_asset_hdr_rec.book_type_code := p_book_type_code;
3144 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
3145 --l_asset_hdr_rec.period_of_addition := NULL;
3146
3147 -- Derive set of books id for primary book
3148 if (l_asset_hdr_rec.set_of_books_id is NULL) then
3149 select set_of_books_id
3150 into l_asset_hdr_rec.set_of_books_id
3151 from fa_book_controls
3152 where book_type_code = l_asset_hdr_rec.book_type_code;
3153 end if;
3154
3155 -- ***** Asset Retirement Info ***** --
3156 l_asset_retire_rec.retirement_id := p_retirement_id;
3157 --l_asset_retire_rec.date_retired :=
3158 --l_asset_retire_rec.units_retired :=
3159 --l_asset_retire_rec.cost_retired :=
3160 --l_asset_retire_rec.proceeds_of_sale :=
3161 --l_asset_retire_rec.cost_of_removal :=
3162 --l_asset_retire_rec.retirement_type_code :=
3163 --l_asset_retire_rec.retirement_prorate_convention :=
3164 --l_asset_retire_rec.sold_to :=
3165 --l_asset_retire_rec.trade_in_asset_id :=
3166 l_asset_retire_rec.status := p_status;
3167 --l_asset_retire_rec.reference_num :=
3168 --l_asset_retire_rec.calculate_gain_loss :=
3169 --l_asset_retire_rec.desc_flex.attribute1 :=
3170 --l_asset_retire_rec.desc_flex.attribute2 :=
3171 --l_asset_retire_rec.desc_flex.attribute3 :=
3172 --l_asset_retire_rec.desc_flex.attribute4 :=
3173 --l_asset_retire_rec.desc_flex.attribute5 :=
3174 --l_asset_retire_rec.desc_flex.attribute6 :=
3175 --l_asset_retire_rec.desc_flex.attribute7 :=
3176 --l_asset_retire_rec.desc_flex.attribute8 :=
3177 --l_asset_retire_rec.desc_flex.attribute9 :=
3178 --l_asset_retire_rec.desc_flex.attribute10 :=
3179 --l_asset_retire_rec.desc_flex.attribute11 :=
3180 --l_asset_retire_rec.desc_flex.attribute12 :=
3181 --l_asset_retire_rec.desc_flex.attribute13 :=
3182 --l_asset_retire_rec.desc_flex.attribute14 :=
3183 --l_asset_retire_rec.desc_flex.attribute15 :=
3184 --l_asset_retire_rec.desc_flex.attribute_category_code :=
3185
3186 -- Call Public Undo Reinstatement API
3187 fa_retirement_pub.undo_reinstatement (
3188 p_api_version => p_api_version,
3189 p_init_msg_list => p_init_msg_list,
3190 p_commit => p_commit,
3191 p_validation_level => p_validation_level,
3192 p_calling_fn => p_calling_fn,
3193 x_return_status => x_return_status,
3194 x_msg_count => x_msg_count,
3195 x_msg_data => x_msg_data,
3196 px_trans_rec => l_trans_rec,
3197 px_asset_hdr_rec => l_asset_hdr_rec,
3198 px_asset_retire_rec => l_asset_retire_rec
3199 );
3200
3201 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
3202 return;
3203 end if;
3204
3205 EXCEPTION
3206 when others then
3207 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.undo_reinst',
3208 p_log_level_rec => g_log_level_rec);
3209 x_return_status := FND_API.G_RET_STS_ERROR;
3210
3211 END undo_reinstatement;
3212
3213 PROCEDURE do_capitalization (
3214 -- Standard Parameters --
3215 p_api_version IN NUMBER,
3216 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
3217 p_commit IN VARCHAR2 := FND_API.G_FALSE,
3218 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
3219 x_return_status OUT NOCOPY VARCHAR2,
3220 x_msg_count OUT NOCOPY NUMBER,
3221 x_msg_data OUT NOCOPY VARCHAR2,
3222 p_calling_fn IN VARCHAR2,
3223 -- API Options --
3224 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
3225 -- Out Parameters --
3226 x_transaction_header_id OUT NOCOPY NUMBER,
3227 -- Transaction Info --
3228 p_transaction_date_entered IN DATE DEFAULT NULL,
3229 p_transaction_name IN VARCHAR2 DEFAULT NULL,
3230 p_mass_reference_id IN NUMBER DEFAULT NULL,
3231 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
3232 p_last_update_date IN DATE,
3233 p_last_updated_by IN NUMBER,
3234 p_created_by IN NUMBER,
3235 p_creation_date IN DATE,
3236 p_last_update_login IN NUMBER,
3237 p_attribute1 IN VARCHAR2 DEFAULT NULL,
3238 p_attribute2 IN VARCHAR2 DEFAULT NULL,
3239 p_attribute3 IN VARCHAR2 DEFAULT NULL,
3240 p_attribute4 IN VARCHAR2 DEFAULT NULL,
3241 p_attribute5 IN VARCHAR2 DEFAULT NULL,
3242 p_attribute6 IN VARCHAR2 DEFAULT NULL,
3243 p_attribute7 IN VARCHAR2 DEFAULT NULL,
3244 p_attribute8 IN VARCHAR2 DEFAULT NULL,
3245 p_attribute9 IN VARCHAR2 DEFAULT NULL,
3246 p_attribute10 IN VARCHAR2 DEFAULT NULL,
3247 p_attribute11 IN VARCHAR2 DEFAULT NULL,
3248 p_attribute12 IN VARCHAR2 DEFAULT NULL,
3249 p_attribute13 IN VARCHAR2 DEFAULT NULL,
3250 p_attribute14 IN VARCHAR2 DEFAULT NULL,
3251 p_attribute15 IN VARCHAR2 DEFAULT NULL,
3252 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
3253 -- Asset Header Info --
3254 p_asset_id IN NUMBER,
3255 p_book_type_code IN VARCHAR2,
3256 p_set_of_books_id IN NUMBER DEFAULT NULL,
3257 -- Asset Financial Info --
3258 p_date_placed_in_service IN DATE
3259 ) AS
3260
3261 l_trans_rec fa_api_types.trans_rec_type;
3262 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
3263 l_asset_fin_rec fa_api_types.asset_fin_rec_type;
3264
3265 BEGIN
3266
3267 -- Initialize message list if p_init_msg_list is set to TRUE.
3268 IF FND_API.To_Boolean(p_init_msg_list) THEN
3269 -- Initialize error message stack.
3270 FA_SRVR_MSG.Init_Server_Message;
3271
3272 -- Initialize debug message stack.
3273 FA_DEBUG_PKG.Initialize;
3274 END IF;
3275
3276 -- Override FA:PRINT_DEBUG profile option.
3277 IF (p_debug_flag = 'YES') THEN
3278 FA_DEBUG_PKG.Set_Debug_Flag;
3279 END IF;
3280
3281 -- ***** Asset Transaction Info ***** --
3282 --l_trans_rec.transaction_header_id :=
3283 --l_trans_rec.transaction_type_code :=
3284 l_trans_rec.transaction_date_entered := p_transaction_date_entered;
3285 l_trans_rec.transaction_name := p_transaction_name;
3286 --l_trans_rec.source_transaction_header_id :=
3287 l_trans_rec.mass_reference_id := p_mass_reference_id;
3288 --l_trans_rec.transaction_subtype :=
3289 --l_trans_rec.transaction_key :=
3290 --l_trans_rec.amortization_start_date :=
3291 l_trans_rec.calling_interface := p_calling_interface;
3292 l_trans_rec.desc_flex.attribute1 := p_attribute1;
3293 l_trans_rec.desc_flex.attribute2 := p_attribute2;
3294 l_trans_rec.desc_flex.attribute3 := p_attribute3;
3295 l_trans_rec.desc_flex.attribute4 := p_attribute4;
3296 l_trans_rec.desc_flex.attribute5 := p_attribute5;
3297 l_trans_rec.desc_flex.attribute6 := p_attribute6;
3298 l_trans_rec.desc_flex.attribute7 := p_attribute7;
3299 l_trans_rec.desc_flex.attribute8 := p_attribute8;
3300 l_trans_rec.desc_flex.attribute9 := p_attribute9;
3301 l_trans_rec.desc_flex.attribute10 := p_attribute10;
3302 l_trans_rec.desc_flex.attribute11 := p_attribute11;
3303 l_trans_rec.desc_flex.attribute12 := p_attribute12;
3304 l_trans_rec.desc_flex.attribute13 := p_attribute13;
3305 l_trans_rec.desc_flex.attribute14 := p_attribute14;
3306 l_trans_rec.desc_flex.attribute15 := p_attribute15;
3307 l_trans_rec.desc_flex.attribute_category_code := p_attribute_category_code;
3308 l_trans_rec.who_info.last_update_date := p_last_update_date;
3309 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
3310 l_trans_rec.who_info.created_by := p_created_by;
3311 l_trans_rec.who_info.creation_date := p_creation_date;
3312 l_trans_rec.who_info.last_update_login := p_last_update_login;
3313
3314 -- ***** Asset Header Info ***** --
3315 l_asset_hdr_rec.asset_id := p_asset_id;
3316 l_asset_hdr_rec.book_type_code := p_book_type_code;
3317 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
3318 --l_asset_hdr_rec.period_of_addition := NULL;
3319
3320 -- Derive set of books id for primary book
3321 if (l_asset_hdr_rec.set_of_books_id is NULL) then
3322 select set_of_books_id
3323 into l_asset_hdr_rec.set_of_books_id
3324 from fa_book_controls
3325 where book_type_code = l_asset_hdr_rec.book_type_code;
3326 end if;
3327
3328 -- ***** Asset Financial Info ***** --
3329 l_asset_fin_rec.set_of_books_id := l_asset_hdr_rec.set_of_books_id;
3330 l_asset_fin_rec.date_placed_in_service := p_date_placed_in_service;
3331 --l_asset_fin_rec.cost :=
3332
3333 -- Call Capitalization API
3334 fa_cip_pub.do_capitalization
3335 (p_api_version => p_api_version,
3336 p_init_msg_list => p_init_msg_list,
3337 p_commit => p_commit,
3338 p_validation_level => p_validation_level,
3339 p_calling_fn => p_calling_fn,
3340 x_return_status => x_return_status,
3341 x_msg_count => x_msg_count,
3342 x_msg_data => x_msg_data,
3343 px_trans_rec => l_trans_rec,
3344 px_asset_hdr_rec => l_asset_hdr_rec,
3345 px_asset_fin_rec => l_asset_fin_rec);
3346
3347 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
3348 return;
3349 end if;
3350
3351 x_transaction_header_id := l_trans_rec.transaction_header_id;
3352
3353 EXCEPTION
3354 when others then
3355 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_cap',
3356 p_log_level_rec => g_log_level_rec);
3357 x_return_status := FND_API.G_RET_STS_ERROR;
3358 END do_capitalization;
3359
3360 PROCEDURE do_reverse (
3361 -- Standard Parameters --
3362 p_api_version IN NUMBER,
3363 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
3364 p_commit IN VARCHAR2 := FND_API.G_FALSE,
3365 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
3366 x_return_status OUT NOCOPY VARCHAR2,
3367 x_msg_count OUT NOCOPY NUMBER,
3368 x_msg_data OUT NOCOPY VARCHAR2,
3369 p_calling_fn IN VARCHAR2,
3370 -- API Options --
3371 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
3372 -- Out Parameters --
3373 x_transaction_header_id OUT NOCOPY NUMBER,
3374 -- Transaction Info --
3375 p_transaction_date_entered IN DATE DEFAULT NULL,
3376 p_transaction_name IN VARCHAR2 DEFAULT NULL,
3377 p_mass_reference_id IN NUMBER DEFAULT NULL,
3378 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
3379 p_last_update_date IN DATE,
3380 p_last_updated_by IN NUMBER,
3381 p_created_by IN NUMBER,
3382 p_creation_date IN DATE,
3383 p_last_update_login IN NUMBER,
3384 p_attribute1 IN VARCHAR2 DEFAULT NULL,
3385 p_attribute2 IN VARCHAR2 DEFAULT NULL,
3386 p_attribute3 IN VARCHAR2 DEFAULT NULL,
3387 p_attribute4 IN VARCHAR2 DEFAULT NULL,
3388 p_attribute5 IN VARCHAR2 DEFAULT NULL,
3389 p_attribute6 IN VARCHAR2 DEFAULT NULL,
3390 p_attribute7 IN VARCHAR2 DEFAULT NULL,
3391 p_attribute8 IN VARCHAR2 DEFAULT NULL,
3392 p_attribute9 IN VARCHAR2 DEFAULT NULL,
3393 p_attribute10 IN VARCHAR2 DEFAULT NULL,
3394 p_attribute11 IN VARCHAR2 DEFAULT NULL,
3395 p_attribute12 IN VARCHAR2 DEFAULT NULL,
3396 p_attribute13 IN VARCHAR2 DEFAULT NULL,
3397 p_attribute14 IN VARCHAR2 DEFAULT NULL,
3398 p_attribute15 IN VARCHAR2 DEFAULT NULL,
3399 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
3400 -- Asset Header Info --
3401 p_asset_id IN NUMBER,
3402 p_book_type_code IN VARCHAR2,
3403 p_set_of_books_id IN NUMBER DEFAULT NULL,
3404 -- Asset Financial Info --
3405 p_date_placed_in_service IN DATE
3406 ) AS
3407
3408 l_trans_rec fa_api_types.trans_rec_type;
3409 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
3410 l_asset_fin_rec fa_api_types.asset_fin_rec_type;
3411
3412 BEGIN
3413
3414 -- Initialize message list if p_init_msg_list is set to TRUE.
3415 IF FND_API.To_Boolean(p_init_msg_list) THEN
3416 -- Initialize error message stack.
3417 FA_SRVR_MSG.Init_Server_Message;
3418
3419 -- Initialize debug message stack.
3420 FA_DEBUG_PKG.Initialize;
3421 END IF;
3422
3423 -- Override FA:PRINT_DEBUG profile option.
3424 IF (p_debug_flag = 'YES') THEN
3425 FA_DEBUG_PKG.Set_Debug_Flag;
3426 END IF;
3427
3428 -- ***** Asset Transaction Info ***** --
3429 --l_trans_rec.transaction_header_id :=
3430 --l_trans_rec.transaction_type_code :=
3431 l_trans_rec.transaction_date_entered := p_transaction_date_entered;
3432 l_trans_rec.transaction_name := p_transaction_name;
3433 --l_trans_rec.source_transaction_header_id :=
3434 l_trans_rec.mass_reference_id := p_mass_reference_id;
3435 --l_trans_rec.transaction_subtype :=
3436 --l_trans_rec.transaction_key :=
3437 --l_trans_rec.amortization_start_date :=
3438 l_trans_rec.calling_interface := p_calling_interface;
3439 l_trans_rec.desc_flex.attribute1 := p_attribute1;
3440 l_trans_rec.desc_flex.attribute2 := p_attribute2;
3441 l_trans_rec.desc_flex.attribute3 := p_attribute3;
3442 l_trans_rec.desc_flex.attribute4 := p_attribute4;
3443 l_trans_rec.desc_flex.attribute5 := p_attribute5;
3444 l_trans_rec.desc_flex.attribute6 := p_attribute6;
3445 l_trans_rec.desc_flex.attribute7 := p_attribute7;
3446 l_trans_rec.desc_flex.attribute8 := p_attribute8;
3447 l_trans_rec.desc_flex.attribute9 := p_attribute9;
3448 l_trans_rec.desc_flex.attribute10 := p_attribute10;
3449 l_trans_rec.desc_flex.attribute11 := p_attribute11;
3450 l_trans_rec.desc_flex.attribute12 := p_attribute12;
3451 l_trans_rec.desc_flex.attribute13 := p_attribute13;
3452 l_trans_rec.desc_flex.attribute14 := p_attribute14;
3453 l_trans_rec.desc_flex.attribute15 := p_attribute15;
3454 l_trans_rec.desc_flex.attribute_category_code := p_attribute_category_code;
3455 l_trans_rec.who_info.last_update_date := p_last_update_date;
3456 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
3457 l_trans_rec.who_info.created_by := p_created_by;
3458 l_trans_rec.who_info.creation_date := p_creation_date;
3459 l_trans_rec.who_info.last_update_login := p_last_update_login;
3460
3461 -- ***** Asset Header Info ***** --
3462 l_asset_hdr_rec.asset_id := p_asset_id;
3463 l_asset_hdr_rec.book_type_code := p_book_type_code;
3464 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
3465 --l_asset_hdr_rec.period_of_addition := NULL;
3466
3467 -- Derive set of books id for primary book
3468 if (l_asset_hdr_rec.set_of_books_id is NULL) then
3469 select set_of_books_id
3470 into l_asset_hdr_rec.set_of_books_id
3471 from fa_book_controls
3472 where book_type_code = l_asset_hdr_rec.book_type_code;
3473 end if;
3474
3475 -- ***** Asset Financial Info ***** --
3476 l_asset_fin_rec.set_of_books_id := l_asset_hdr_rec.set_of_books_id;
3477 l_asset_fin_rec.date_placed_in_service := p_date_placed_in_service;
3478 --l_asset_fin_rec.cost :=
3479
3480 -- Call Reverse API
3481 fa_cip_pub.do_reverse
3482 (p_api_version => p_api_version,
3483 p_init_msg_list => p_init_msg_list,
3484 p_commit => p_commit,
3485 p_validation_level => p_validation_level,
3486 p_calling_fn => p_calling_fn,
3487 x_return_status => x_return_status,
3488 x_msg_count => x_msg_count,
3489 x_msg_data => x_msg_data,
3490 px_trans_rec => l_trans_rec,
3491 px_asset_hdr_rec => l_asset_hdr_rec,
3492 px_asset_fin_rec => l_asset_fin_rec);
3493
3494 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
3495 return;
3496 end if;
3497
3498 x_transaction_header_id := l_trans_rec.transaction_header_id;
3499
3500 EXCEPTION
3501 when others then
3502 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_rev',
3503 p_log_level_rec => g_log_level_rec);
3504 x_return_status := FND_API.G_RET_STS_ERROR;
3505 END do_reverse;
3506
3507 PROCEDURE do_asset_desc_update (
3508 -- Standard Parameters --
3509 p_api_version IN NUMBER,
3510 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
3511 p_commit IN VARCHAR2 := FND_API.G_FALSE,
3512 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
3513 x_return_status OUT NOCOPY VARCHAR2,
3514 x_msg_count OUT NOCOPY NUMBER,
3515 x_msg_data OUT NOCOPY VARCHAR2,
3516 p_calling_fn IN VARCHAR2,
3517 -- API Options --
3518 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
3519 p_reset_miss_flag IN VARCHAR2 DEFAULT 'NO',
3520 -- Transaction Info --
3521 p_last_update_date IN DATE,
3522 p_last_updated_by IN NUMBER,
3523 p_last_update_login IN NUMBER,
3524 -- Asset Header Info --
3525 p_asset_id IN NUMBER,
3526 -- Asset Description Info --
3527 p_asset_number IN VARCHAR2 DEFAULT NULL,
3528 p_description IN VARCHAR2 DEFAULT NULL,
3529 p_tag_number IN VARCHAR2 DEFAULT NULL,
3530 p_serial_number IN VARCHAR2 DEFAULT NULL,
3531 p_asset_key_ccid IN NUMBER DEFAULT NULL,
3532 p_current_units IN NUMBER DEFAULT NULL,
3533 p_parent_asset_id IN NUMBER DEFAULT NULL,
3534 p_status IN VARCHAR2 DEFAULT NULL,
3535 p_manufacturer_name IN VARCHAR2 DEFAULT NULL,
3536 p_model_number IN VARCHAR2 DEFAULT NULL,
3537 p_warranty_id IN NUMBER DEFAULT NULL,
3538 p_property_type_code IN VARCHAR2 DEFAULT NULL,
3539 p_property_1245_1250_code IN VARCHAR2 DEFAULT NULL,
3540 p_in_use_flag IN VARCHAR2 DEFAULT NULL,
3541 p_inventorial IN VARCHAR2 DEFAULT NULL,
3542 p_commitment IN VARCHAR2 DEFAULT NULL,
3543 p_investment_law IN VARCHAR2 DEFAULT NULL,
3544 p_owned_leased IN VARCHAR2 DEFAULT NULL,
3545 p_new_used IN VARCHAR2 DEFAULT NULL,
3546 p_lease_id IN NUMBER DEFAULT NULL,
3547 p_ls_attribute1 IN VARCHAR2 DEFAULT NULL,
3548 p_ls_attribute2 IN VARCHAR2 DEFAULT NULL,
3549 p_ls_attribute3 IN VARCHAR2 DEFAULT NULL,
3550 p_ls_attribute4 IN VARCHAR2 DEFAULT NULL,
3551 p_ls_attribute5 IN VARCHAR2 DEFAULT NULL,
3552 p_ls_attribute6 IN VARCHAR2 DEFAULT NULL,
3553 p_ls_attribute7 IN VARCHAR2 DEFAULT NULL,
3554 p_ls_attribute8 IN VARCHAR2 DEFAULT NULL,
3555 p_ls_attribute9 IN VARCHAR2 DEFAULT NULL,
3556 p_ls_attribute10 IN VARCHAR2 DEFAULT NULL,
3557 p_ls_attribute11 IN VARCHAR2 DEFAULT NULL,
3558 p_ls_attribute12 IN VARCHAR2 DEFAULT NULL,
3559 p_ls_attribute13 IN VARCHAR2 DEFAULT NULL,
3560 p_ls_attribute14 IN VARCHAR2 DEFAULT NULL,
3561 p_ls_attribute15 IN VARCHAR2 DEFAULT NULL,
3562 p_ls_attribute_category_code IN VARCHAR2 DEFAULT NULL,
3563 p_ad_global_attribute1 IN VARCHAR2 DEFAULT NULL,
3564 p_ad_global_attribute2 IN VARCHAR2 DEFAULT NULL,
3565 p_ad_global_attribute3 IN VARCHAR2 DEFAULT NULL,
3566 p_ad_global_attribute4 IN VARCHAR2 DEFAULT NULL,
3567 p_ad_global_attribute5 IN VARCHAR2 DEFAULT NULL,
3568 p_ad_global_attribute6 IN VARCHAR2 DEFAULT NULL,
3569 p_ad_global_attribute7 IN VARCHAR2 DEFAULT NULL,
3570 p_ad_global_attribute8 IN VARCHAR2 DEFAULT NULL,
3571 p_ad_global_attribute9 IN VARCHAR2 DEFAULT NULL,
3572 p_ad_global_attribute10 IN VARCHAR2 DEFAULT NULL,
3573 p_ad_global_attribute11 IN VARCHAR2 DEFAULT NULL,
3574 p_ad_global_attribute12 IN VARCHAR2 DEFAULT NULL,
3575 p_ad_global_attribute13 IN VARCHAR2 DEFAULT NULL,
3576 p_ad_global_attribute14 IN VARCHAR2 DEFAULT NULL,
3577 p_ad_global_attribute15 IN VARCHAR2 DEFAULT NULL,
3578 p_ad_global_attribute16 IN VARCHAR2 DEFAULT NULL,
3579 p_ad_global_attribute17 IN VARCHAR2 DEFAULT NULL,
3580 p_ad_global_attribute18 IN VARCHAR2 DEFAULT NULL,
3581 p_ad_global_attribute19 IN VARCHAR2 DEFAULT NULL,
3582 p_ad_global_attribute20 IN VARCHAR2 DEFAULT NULL,
3583 p_ad_global_attribute_category IN VARCHAR2 DEFAULT NULL,
3584 -- Asset Category Info --
3585 p_category_id IN NUMBER,
3586 p_cat_attribute1 IN VARCHAR2 DEFAULT NULL,
3587 p_cat_attribute2 IN VARCHAR2 DEFAULT NULL,
3588 p_cat_attribute3 IN VARCHAR2 DEFAULT NULL,
3589 p_cat_attribute4 IN VARCHAR2 DEFAULT NULL,
3590 p_cat_attribute5 IN VARCHAR2 DEFAULT NULL,
3591 p_cat_attribute6 IN VARCHAR2 DEFAULT NULL,
3592 p_cat_attribute7 IN VARCHAR2 DEFAULT NULL,
3593 p_cat_attribute8 IN VARCHAR2 DEFAULT NULL,
3594 p_cat_attribute9 IN VARCHAR2 DEFAULT NULL,
3595 p_cat_attribute10 IN VARCHAR2 DEFAULT NULL,
3596 p_cat_attribute11 IN VARCHAR2 DEFAULT NULL,
3597 p_cat_attribute12 IN VARCHAR2 DEFAULT NULL,
3598 p_cat_attribute13 IN VARCHAR2 DEFAULT NULL,
3599 p_cat_attribute14 IN VARCHAR2 DEFAULT NULL,
3600 p_cat_attribute15 IN VARCHAR2 DEFAULT NULL,
3601 p_cat_attribute16 IN VARCHAR2 DEFAULT NULL,
3602 p_cat_attribute17 IN VARCHAR2 DEFAULT NULL,
3603 p_cat_attribute18 IN VARCHAR2 DEFAULT NULL,
3604 p_cat_attribute19 IN VARCHAR2 DEFAULT NULL,
3605 p_cat_attribute20 IN VARCHAR2 DEFAULT NULL,
3606 p_cat_attribute21 IN VARCHAR2 DEFAULT NULL,
3607 p_cat_attribute22 IN VARCHAR2 DEFAULT NULL,
3608 p_cat_attribute23 IN VARCHAR2 DEFAULT NULL,
3609 p_cat_attribute24 IN VARCHAR2 DEFAULT NULL,
3610 p_cat_attribute25 IN VARCHAR2 DEFAULT NULL,
3611 p_cat_attribute26 IN VARCHAR2 DEFAULT NULL,
3612 p_cat_attribute27 IN VARCHAR2 DEFAULT NULL,
3613 p_cat_attribute28 IN VARCHAR2 DEFAULT NULL,
3614 p_cat_attribute29 IN VARCHAR2 DEFAULT NULL,
3615 p_cat_attribute30 IN VARCHAR2 DEFAULT NULL,
3616 p_cat_attribute_category_code IN VARCHAR2 DEFAULT NULL,
3617 p_context IN VARCHAR2 DEFAULT NULL
3618 ) AS
3619
3620 l_trans_rec fa_api_types.trans_rec_type;
3621 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
3622 l_asset_desc_rec fa_api_types.asset_desc_rec_type;
3623 l_asset_desc_rec_old fa_api_types.asset_desc_rec_type;
3624 l_asset_cat_rec fa_api_types.asset_cat_rec_type;
3625 l_asset_cat_rec_old fa_api_types.asset_cat_rec_type;
3626
3627 desc_err exception;
3628
3629 BEGIN
3630
3631 -- Initialize message list if p_init_msg_list is set to TRUE.
3632 IF FND_API.To_Boolean(p_init_msg_list) THEN
3633 -- Initialize error message stack.
3634 FA_SRVR_MSG.Init_Server_Message;
3635
3636 -- Initialize debug message stack.
3637 FA_DEBUG_PKG.Initialize;
3638 END IF;
3639
3640 -- Override FA:PRINT_DEBUG profile option.
3641 IF (p_debug_flag = 'YES') THEN
3642 FA_DEBUG_PKG.Set_Debug_Flag;
3643 END IF;
3644
3645 -- ***** Asset Transaction Info ***** --
3646 --l_trans_rec.transaction_header_id :=
3647 --l_trans_rec.transaction_type_code :=
3648 --l_trans_rec.transaction_date_entered :=
3649 --l_trans_rec.transaction_name :=
3650 --l_trans_rec.source_transaction_header_id :=
3651 --l_trans_rec.mass_reference_id :=
3652 --l_trans_rec.transaction_subtype :=
3653 --l_trans_rec.transaction_key :=
3654 --l_trans_rec.amortization_start_date :=
3655 --l_trans_rec.calling_interface :=
3656 --l_trans_rec.desc_flex.attribute1 :=
3657 --l_trans_rec.desc_flex.attribute2 :=
3658 --l_trans_rec.desc_flex.attribute3 :=
3659 --l_trans_rec.desc_flex.attribute4 :=
3660 --l_trans_rec.desc_flex.attribute5 :=
3661 --l_trans_rec.desc_flex.attribute6 :=
3662 --l_trans_rec.desc_flex.attribute7 :=
3663 --l_trans_rec.desc_flex.attribute8 :=
3664 --l_trans_rec.desc_flex.attribute9 :=
3665 --l_trans_rec.desc_flex.attribute10 :=
3666 --l_trans_rec.desc_flex.attribute11 :=
3667 --l_trans_rec.desc_flex.attribute12 :=
3668 --l_trans_rec.desc_flex.attribute13 :=
3669 --l_trans_rec.desc_flex.attribute14 :=
3670 --l_trans_rec.desc_flex.attribute15 :=
3671 --l_trans_rec.desc_flex.attribute_category_code :=
3672 l_trans_rec.who_info.last_update_date := p_last_update_date;
3673 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
3674 l_trans_rec.who_info.created_by := NULL;
3675 l_trans_rec.who_info.creation_date := NULL;
3676 l_trans_rec.who_info.last_update_login := p_last_update_login;
3677
3678 -- ***** Asset Header Info ***** --
3679 l_asset_hdr_rec.asset_id := p_asset_id;
3680 --l_asset_hdr_rec.book_type_code :=
3681 --l_asset_hdr_rec.set_of_books_id :=
3682 --l_asset_hdr_rec.period_of_addition :=
3683
3684 --@@@ Derive set of books id for primary book
3685 /* select set_of_books_id
3686 into l_asset_hdr_rec.set_of_books_id
3687 from fa_book_controls
3688 where book_type_code = l_asset_hdr_rec.book_type_code;
3689 */
3690
3691 -- ***** Asset Descriptive Info ***** --
3692 l_asset_desc_rec.asset_number := p_asset_number;
3693 l_asset_desc_rec.description := p_description;
3694 l_asset_desc_rec.tag_number := p_tag_number;
3695 l_asset_desc_rec.serial_number := p_serial_number;
3696 l_asset_desc_rec.asset_key_ccid := p_asset_key_ccid;
3697 l_asset_desc_rec.parent_asset_id := p_parent_asset_id;
3698 l_asset_desc_rec.manufacturer_name := p_manufacturer_name;
3699 l_asset_desc_rec.model_number := p_model_number;
3700 l_asset_desc_rec.warranty_id := p_warranty_id;
3701 l_asset_desc_rec.lease_id := p_lease_id;
3702 l_asset_desc_rec.in_use_flag := p_in_use_flag;
3703 l_asset_desc_rec.inventorial := p_inventorial;
3704 l_asset_desc_rec.commitment := p_commitment;
3705 l_asset_desc_rec.investment_law := p_investment_law;
3706 l_asset_desc_rec.property_type_code := p_property_type_code;
3707 l_asset_desc_rec.property_1245_1250_code := p_property_1245_1250_code;
3708 l_asset_desc_rec.owned_leased := p_owned_leased;
3709 l_asset_desc_rec.new_used := p_new_used;
3710 l_asset_desc_rec.current_units := p_current_units;
3711 --l_asset_desc_rec.unit_adjustment_flag :=
3712 --l_asset_desc_rec.add_cost_je_flag :=
3713 l_asset_desc_rec.status := p_status;
3714 l_asset_desc_rec.lease_desc_flex.attribute1 := p_ls_attribute1;
3715 l_asset_desc_rec.lease_desc_flex.attribute2 := p_ls_attribute2;
3716 l_asset_desc_rec.lease_desc_flex.attribute3 := p_ls_attribute3;
3717 l_asset_desc_rec.lease_desc_flex.attribute4 := p_ls_attribute4;
3718 l_asset_desc_rec.lease_desc_flex.attribute5 := p_ls_attribute5;
3719 l_asset_desc_rec.lease_desc_flex.attribute6 := p_ls_attribute6;
3720 l_asset_desc_rec.lease_desc_flex.attribute7 := p_ls_attribute7;
3721 l_asset_desc_rec.lease_desc_flex.attribute8 := p_ls_attribute8;
3722 l_asset_desc_rec.lease_desc_flex.attribute9 := p_ls_attribute9;
3723 l_asset_desc_rec.lease_desc_flex.attribute10 := p_ls_attribute10;
3724 l_asset_desc_rec.lease_desc_flex.attribute11 := p_ls_attribute11;
3725 l_asset_desc_rec.lease_desc_flex.attribute12 := p_ls_attribute12;
3726 l_asset_desc_rec.lease_desc_flex.attribute13 := p_ls_attribute13;
3727 l_asset_desc_rec.lease_desc_flex.attribute14 := p_ls_attribute14;
3728 l_asset_desc_rec.lease_desc_flex.attribute15 := p_ls_attribute15;
3729 l_asset_desc_rec.lease_desc_flex.attribute_category_code :=
3730 p_ls_attribute_category_code;
3731 l_asset_desc_rec.global_desc_flex.attribute1 := p_ad_global_attribute1;
3732 l_asset_desc_rec.global_desc_flex.attribute2 := p_ad_global_attribute2;
3733 l_asset_desc_rec.global_desc_flex.attribute3 := p_ad_global_attribute3;
3734 l_asset_desc_rec.global_desc_flex.attribute4 := p_ad_global_attribute4;
3735 l_asset_desc_rec.global_desc_flex.attribute5 := p_ad_global_attribute5;
3736 l_asset_desc_rec.global_desc_flex.attribute6 := p_ad_global_attribute6;
3737 l_asset_desc_rec.global_desc_flex.attribute7 := p_ad_global_attribute7;
3738 l_asset_desc_rec.global_desc_flex.attribute8 := p_ad_global_attribute8;
3739 l_asset_desc_rec.global_desc_flex.attribute9 := p_ad_global_attribute9;
3740 l_asset_desc_rec.global_desc_flex.attribute10 := p_ad_global_attribute10;
3741 l_asset_desc_rec.global_desc_flex.attribute11 := p_ad_global_attribute11;
3742 l_asset_desc_rec.global_desc_flex.attribute12 := p_ad_global_attribute12;
3743 l_asset_desc_rec.global_desc_flex.attribute13 := p_ad_global_attribute13;
3744 l_asset_desc_rec.global_desc_flex.attribute14 := p_ad_global_attribute14;
3745 l_asset_desc_rec.global_desc_flex.attribute15 := p_ad_global_attribute15;
3746 l_asset_desc_rec.global_desc_flex.attribute16 := p_ad_global_attribute16;
3747 l_asset_desc_rec.global_desc_flex.attribute17 := p_ad_global_attribute17;
3748 l_asset_desc_rec.global_desc_flex.attribute18 := p_ad_global_attribute18;
3749 l_asset_desc_rec.global_desc_flex.attribute19 := p_ad_global_attribute19;
3750 l_asset_desc_rec.global_desc_flex.attribute20 := p_ad_global_attribute20;
3751 l_asset_desc_rec.global_desc_flex.attribute_category_code :=
3752 p_ad_global_attribute_category;
3753
3754 if (p_reset_miss_flag = 'YES') then
3755 -- Fix for Bug #2653564. Need to pass different record groups to
3756 -- IN and OUT parameters.
3757 l_asset_desc_rec_old := l_asset_desc_rec;
3758
3759 if (NOT fa_trans_api_pvt.set_asset_desc_rec (
3760 p_asset_hdr_rec => l_asset_hdr_rec,
3761 p_asset_desc_rec => l_asset_desc_rec_old,
3762 x_asset_desc_rec_new => l_asset_desc_rec
3763 )) then
3764 raise desc_err;
3765 end if;
3766 end if;
3767
3768 -- ***** Asset Category Info ***** --
3769 l_asset_cat_rec.category_id := p_category_id; --BUG 14126264
3770 l_asset_cat_rec.desc_flex.attribute1 := p_cat_attribute1;
3771 l_asset_cat_rec.desc_flex.attribute2 := p_cat_attribute2;
3772 l_asset_cat_rec.desc_flex.attribute3 := p_cat_attribute3;
3773 l_asset_cat_rec.desc_flex.attribute4 := p_cat_attribute4;
3774 l_asset_cat_rec.desc_flex.attribute5 := p_cat_attribute5;
3775 l_asset_cat_rec.desc_flex.attribute6 := p_cat_attribute6;
3776 l_asset_cat_rec.desc_flex.attribute7 := p_cat_attribute7;
3777 l_asset_cat_rec.desc_flex.attribute8 := p_cat_attribute8;
3778 l_asset_cat_rec.desc_flex.attribute9 := p_cat_attribute9;
3779 l_asset_cat_rec.desc_flex.attribute10 := p_cat_attribute10;
3780 l_asset_cat_rec.desc_flex.attribute11 := p_cat_attribute11;
3781 l_asset_cat_rec.desc_flex.attribute12 := p_cat_attribute12;
3782 l_asset_cat_rec.desc_flex.attribute13 := p_cat_attribute13;
3783 l_asset_cat_rec.desc_flex.attribute14 := p_cat_attribute14;
3784 l_asset_cat_rec.desc_flex.attribute15 := p_cat_attribute15;
3785 l_asset_cat_rec.desc_flex.attribute16 := p_cat_attribute16;
3786 l_asset_cat_rec.desc_flex.attribute17 := p_cat_attribute17;
3787 l_asset_cat_rec.desc_flex.attribute18 := p_cat_attribute18;
3788 l_asset_cat_rec.desc_flex.attribute19 := p_cat_attribute19;
3789 l_asset_cat_rec.desc_flex.attribute20 := p_cat_attribute20;
3790 l_asset_cat_rec.desc_flex.attribute21 := p_cat_attribute21;
3791 l_asset_cat_rec.desc_flex.attribute22 := p_cat_attribute22;
3792 l_asset_cat_rec.desc_flex.attribute23 := p_cat_attribute23;
3793 l_asset_cat_rec.desc_flex.attribute24 := p_cat_attribute24;
3794 l_asset_cat_rec.desc_flex.attribute25 := p_cat_attribute25;
3795 l_asset_cat_rec.desc_flex.attribute26 := p_cat_attribute26;
3796 l_asset_cat_rec.desc_flex.attribute27 := p_cat_attribute27;
3797 l_asset_cat_rec.desc_flex.attribute28 := p_cat_attribute28;
3798 l_asset_cat_rec.desc_flex.attribute29 := p_cat_attribute29;
3799 l_asset_cat_rec.desc_flex.attribute30 := p_cat_attribute30;
3800 l_asset_cat_rec.desc_flex.attribute_category_code :=
3801 p_cat_attribute_category_code;
3802 l_asset_cat_rec.desc_flex.context := p_context;
3803
3804 if (p_reset_miss_flag = 'YES') then
3805 -- Fix for Bug #2653564. Need to pass different record groups to
3806 -- IN and OUT parameters.
3807 l_asset_cat_rec_old := l_asset_cat_rec;
3808
3809 if (NOT fa_trans_api_pvt.set_asset_cat_rec (
3810 p_asset_hdr_rec => l_asset_hdr_rec,
3811 p_asset_cat_rec => l_asset_cat_rec_old,
3812 x_asset_cat_rec_new => l_asset_cat_rec
3813 )) then
3814 raise desc_err;
3815 end if;
3816 end if;
3817
3818 -- Call Public Asset Description Update API
3819 fa_asset_desc_pub.update_desc (
3820 p_api_version => p_api_version,
3821 p_init_msg_list => p_init_msg_list,
3822 p_commit => p_commit,
3823 p_validation_level => p_validation_level,
3824 x_return_status => x_return_status,
3825 x_msg_count => x_msg_count,
3826 x_msg_data => x_msg_data,
3827 p_calling_fn => p_calling_fn,
3828 px_trans_rec => l_trans_rec,
3829 px_asset_hdr_rec => l_asset_hdr_rec,
3830 px_asset_desc_rec_new => l_asset_desc_rec,
3831 px_asset_cat_rec_new => l_asset_cat_rec);
3832
3833 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
3834 return;
3835 end if;
3836
3837 EXCEPTION
3838 when desc_err then
3839 fa_srvr_msg.add_message(calling_fn => 'fa_trans_api_pub.do_desc_update',
3840 p_log_level_rec => g_log_level_rec);
3841 x_return_status := FND_API.G_RET_STS_ERROR;
3842 when others then
3843 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_desc_update',
3844 p_log_level_rec => g_log_level_rec);
3845 x_return_status := FND_API.G_RET_STS_ERROR;
3846 END do_asset_desc_update;
3847
3848 PROCEDURE do_invoice_desc_update (
3849 -- Standard Parameters --
3850 p_api_version IN NUMBER,
3851 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
3852 p_commit IN VARCHAR2 := FND_API.G_FALSE,
3853 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
3854 x_return_status OUT NOCOPY VARCHAR2,
3855 x_msg_count OUT NOCOPY NUMBER,
3856 x_msg_data OUT NOCOPY VARCHAR2,
3857 p_calling_fn IN VARCHAR2,
3858 -- API Options --
3859 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
3860 p_reset_miss_flag IN VARCHAR2 DEFAULT 'NO',
3861 -- Transaction Info --
3862 p_last_update_date IN DATE,
3863 p_last_updated_by IN NUMBER,
3864 p_last_update_login IN NUMBER,
3865 -- Asset Header Info --
3866 p_asset_id IN NUMBER,
3867 p_book_type_code IN VARCHAR2,
3868 p_set_of_books_id IN NUMBER DEFAULT NULL
3869 ) AS
3870
3871 l_trans_rec fa_api_types.trans_rec_type;
3872 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
3873 l_inv_rec fa_api_types.inv_rec_type;
3874 l_inv_rec_old fa_api_types.inv_rec_type;
3875 l_inv_tbl fa_api_types.inv_tbl_type;
3876
3877 desc_err exception;
3878
3879 BEGIN
3880
3881 -- Initialize message list if p_init_msg_list is set to TRUE.
3882 IF FND_API.To_Boolean(p_init_msg_list) THEN
3883 -- Initialize error message stack.
3884 FA_SRVR_MSG.Init_Server_Message;
3885
3886 -- Initialize debug message stack.
3887 FA_DEBUG_PKG.Initialize;
3888 END IF;
3889
3890 -- Override FA:PRINT_DEBUG profile option.
3891 IF (p_debug_flag = 'YES') THEN
3892 FA_DEBUG_PKG.Set_Debug_Flag;
3893 END IF;
3894
3895 -- ***** Asset Transaction Info ***** --
3896 --l_trans_rec.transaction_header_id :=
3897 --l_trans_rec.transaction_type_code :=
3898 --l_trans_rec.transaction_date_entered :=
3899 --l_trans_rec.transaction_name :=
3900 --l_trans_rec.source_transaction_header_id :=
3901 --l_trans_rec.mass_reference_id :=
3902 --l_trans_rec.transaction_subtype :=
3903 --l_trans_rec.transaction_key :=
3904 --l_trans_rec.amortization_start_date :=
3905 --l_trans_rec.calling_interface :=
3906 --l_trans_rec.desc_flex.attribute1 :=
3907 --l_trans_rec.desc_flex.attribute2 :=
3908 --l_trans_rec.desc_flex.attribute3 :=
3909 --l_trans_rec.desc_flex.attribute4 :=
3910 --l_trans_rec.desc_flex.attribute5 :=
3911 --l_trans_rec.desc_flex.attribute6 :=
3912 --l_trans_rec.desc_flex.attribute7 :=
3913 --l_trans_rec.desc_flex.attribute8 :=
3914 --l_trans_rec.desc_flex.attribute9 :=
3915 --l_trans_rec.desc_flex.attribute10 :=
3916 --l_trans_rec.desc_flex.attribute11 :=
3917 --l_trans_rec.desc_flex.attribute12 :=
3918 --l_trans_rec.desc_flex.attribute13 :=
3919 --l_trans_rec.desc_flex.attribute14 :=
3920 --l_trans_rec.desc_flex.attribute15 :=
3921 --l_trans_rec.desc_flex.attribute_category_code :=
3922 l_trans_rec.who_info.last_update_date := p_Last_Update_Date;
3923 l_trans_rec.who_info.last_updated_by := p_Last_Updated_By;
3924 l_trans_rec.who_info.created_by := NULL;
3925 l_trans_rec.who_info.creation_date := NULL;
3926 l_trans_rec.who_info.last_update_login := p_Last_Update_Login;
3927
3928 -- ***** Asset Header Info ***** --
3929 l_asset_hdr_rec.asset_id := p_Asset_Id;
3930 l_asset_hdr_rec.book_type_code := p_book_type_code;
3931 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
3932 --l_asset_hdr_rec.period_of_addition :=
3933
3934 -- Derive set of books id for primary book
3935 if (l_asset_hdr_rec.set_of_books_id is NULL) then
3936 select set_of_books_id
3937 into l_asset_hdr_rec.set_of_books_id
3938 from fa_book_controls
3939 where book_type_code = l_asset_hdr_rec.book_type_code;
3940 end if;
3941
3942 -- ***** Invoice Info ***** --
3943 l_inv_tbl.delete;
3944
3945 -- Get the details from fa_load_tbl_pkg.inv_table
3946 for i in 1 .. fa_load_tbl_pkg.inv_table.COUNT loop
3947
3948 l_inv_rec.po_vendor_id := fa_load_tbl_pkg.inv_table(i).po_vendor_id;
3949 l_inv_rec.asset_invoice_id :=
3950 fa_load_tbl_pkg.inv_table(i).asset_invoice_id;
3951 l_inv_rec.fixed_assets_cost :=
3952 fa_load_tbl_pkg.inv_table(i).fixed_assets_cost;
3953 l_inv_rec.deleted_flag := fa_load_tbl_pkg.inv_table(i).deleted_flag;
3954 l_inv_rec.po_number := fa_load_tbl_pkg.inv_table(i).po_number;
3955 l_inv_rec.invoice_number := fa_load_tbl_pkg.inv_table(i).invoice_number;
3956 l_inv_rec.payables_batch_name :=
3957 fa_load_tbl_pkg.inv_table(i).payables_batch_name;
3958 l_inv_rec.payables_code_combination_id :=
3959 fa_load_tbl_pkg.inv_table(i).payables_ccid;
3960 l_inv_rec.feeder_system_name :=
3961 fa_load_tbl_pkg.inv_table(i).feeder_system_name;
3962 l_inv_rec.create_batch_date :=
3963 fa_load_tbl_pkg.inv_table(i).create_batch_date;
3964 l_inv_rec.create_batch_id :=
3965 fa_load_tbl_pkg.inv_table(i).create_batch_id;
3966 l_inv_rec.invoice_date := fa_load_tbl_pkg.inv_table(i).invoice_date;
3967 l_inv_rec.payables_cost := fa_load_tbl_pkg.inv_table(i).payables_cost;
3968 l_inv_rec.post_batch_id := fa_load_tbl_pkg.inv_table(i).post_batch_id;
3969 l_inv_rec.invoice_id := fa_load_tbl_pkg.inv_table(i).invoice_id;
3970 l_inv_rec.invoice_distribution_id := fa_load_tbl_pkg.inv_table(i).invoice_distribution_id;
3971 l_inv_rec.invoice_line_number := fa_load_tbl_pkg.inv_table(i).invoice_line_number;
3972 l_inv_rec.po_distribution_id := fa_load_tbl_pkg.inv_table(i).po_distribution_id;
3973 l_inv_rec.ap_distribution_line_number :=
3974 fa_load_tbl_pkg.inv_table(i).ap_dist_line_num;
3975 l_inv_rec.payables_units := fa_load_tbl_pkg.inv_table(i).payables_units;
3976 --l_inv_rec.split_merged_code :=
3977 l_inv_rec.description := fa_load_tbl_pkg.inv_table(i).description;
3978 --l_inv_rec.parent_mass_additions_id :=
3979 --l_inv_rec.unrevalued_cost :=
3980 --l_inv_rec.merged_code :=
3981 --l_inv_rec.split_code :=
3982 --l_inv_rec.merge_parent_mass_additions_id :=
3983 --l_inv_rec.split_parent_mass_additions_id :=
3984 l_inv_rec.project_asset_line_id :=
3985 fa_load_tbl_pkg.inv_table(i).project_asset_line_id;
3986 l_inv_rec.project_id := fa_load_tbl_pkg.inv_table(i).project_id;
3987 l_inv_rec.task_id := fa_load_tbl_pkg.inv_table(i).task_id;
3988 l_inv_rec.material_indicator_flag :=
3989 fa_load_tbl_pkg.inv_table(i).material_indicator_flag;
3990 l_inv_rec.depreciate_in_group_flag :=
3991 fa_load_tbl_pkg.inv_table(i).depreciate_in_group_flag;
3992 l_inv_rec.source_line_id := fa_load_tbl_pkg.inv_table(i).source_line_id;
3993 l_inv_rec.attribute1 := fa_load_tbl_pkg.inv_table(i).attribute1;
3994 l_inv_rec.attribute2 := fa_load_tbl_pkg.inv_table(i).attribute2;
3995 l_inv_rec.attribute3 := fa_load_tbl_pkg.inv_table(i).attribute3;
3996 l_inv_rec.attribute4 := fa_load_tbl_pkg.inv_table(i).attribute4;
3997 l_inv_rec.attribute5 := fa_load_tbl_pkg.inv_table(i).attribute5;
3998 l_inv_rec.attribute6 := fa_load_tbl_pkg.inv_table(i).attribute6;
3999 l_inv_rec.attribute7 := fa_load_tbl_pkg.inv_table(i).attribute7;
4000 l_inv_rec.attribute8 := fa_load_tbl_pkg.inv_table(i).attribute8;
4001 l_inv_rec.attribute9 := fa_load_tbl_pkg.inv_table(i).attribute9;
4002 l_inv_rec.attribute10 := fa_load_tbl_pkg.inv_table(i).attribute10;
4003 l_inv_rec.attribute11 := fa_load_tbl_pkg.inv_table(i).attribute11;
4004 l_inv_rec.attribute12 := fa_load_tbl_pkg.inv_table(i).attribute12;
4005 l_inv_rec.attribute13 := fa_load_tbl_pkg.inv_table(i).attribute13;
4006 l_inv_rec.attribute14 := fa_load_tbl_pkg.inv_table(i).attribute14;
4007 l_inv_rec.attribute15 := fa_load_tbl_pkg.inv_table(i).attribute15;
4008 l_inv_rec.attribute_category_code :=
4009 fa_load_tbl_pkg.inv_table(i).attribute_cat_code;
4010
4011 if (p_reset_miss_flag = 'YES') then
4012 -- Fix for Bug #2653564. Need to pass different record groups to
4013 -- IN and OUT parameters.
4014 l_inv_rec_old := l_inv_rec;
4015
4016 if (NOT fa_trans_api_pvt.set_inv_rec (
4017 p_inv_rec => l_inv_rec_old,
4018 x_inv_rec_new => l_inv_rec,
4019 p_mrc_sob_type_code => 'P'
4020 )) then
4021 raise desc_err;
4022 end if;
4023 end if;
4024
4025 l_inv_tbl(i) := l_inv_rec;
4026 end loop;
4027
4028 fa_asset_desc_pub.update_invoice_desc (
4029 p_api_version => p_api_version,
4030 p_init_msg_list => p_init_msg_list ,
4031 p_commit => p_commit,
4032 p_validation_level => p_validation_level,
4033 x_return_status => x_return_status,
4034 x_msg_count => x_msg_count,
4035 x_msg_data => x_msg_data,
4036 p_calling_fn => p_calling_fn,
4037 px_trans_rec => l_trans_rec,
4038 px_asset_hdr_rec => l_asset_hdr_rec,
4039 px_inv_tbl_new => l_inv_tbl);
4040
4041 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
4042 return;
4043 end if;
4044
4045 EXCEPTION
4046 when desc_err then
4047 fa_srvr_msg.add_message(calling_fn => 'fa_trans_api_pub.do_inv_desc_upd',
4048 p_log_level_rec => g_log_level_rec);
4049 x_return_status := FND_API.G_RET_STS_ERROR;
4050
4051 when others then
4052 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_inv_desc_upd',
4053 p_log_level_rec => g_log_level_rec);
4054 x_return_status := FND_API.G_RET_STS_ERROR;
4055
4056 END do_invoice_desc_update;
4057
4058 PROCEDURE do_retirement_desc_update (
4059 -- Standard Parameters --
4060 p_api_version IN NUMBER,
4061 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
4062 p_commit IN VARCHAR2 := FND_API.G_FALSE,
4063 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
4064 x_return_status OUT NOCOPY VARCHAR2,
4065 x_msg_count OUT NOCOPY NUMBER,
4066 x_msg_data OUT NOCOPY VARCHAR2,
4067 p_calling_fn IN VARCHAR2,
4068 -- API Options --
4069 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
4070 p_reset_miss_flag IN VARCHAR2 DEFAULT 'NO',
4071 -- Transaction Info (Retirement) --
4072 p_last_update_date IN DATE,
4073 p_last_updated_by IN NUMBER,
4074 p_last_update_login IN NUMBER,
4075 -- Asset Header Info --
4076 p_asset_id IN NUMBER,
4077 p_book_type_code IN VARCHAR2,
4078 p_set_of_books_id IN NUMBER DEFAULT NULL,
4079 -- Asset Retirement Info --
4080 p_retirement_id IN NUMBER,
4081 p_proceeds_of_sale IN NUMBER DEFAULT NULL,
4082 p_cost_of_removal IN NUMBER DEFAULT NULL,
4083 p_retirement_type_code IN VARCHAR2 DEFAULT NULL,
4084 p_retire_prorate_convention IN VARCHAR2 DEFAULT NULL,
4085 p_sold_to IN VARCHAR2 DEFAULT NULL,
4086 p_trade_in_asset_id IN NUMBER DEFAULT NULL,
4087 p_status IN VARCHAR2 DEFAULT NULL,
4088 p_reference_num IN VARCHAR2 DEFAULT NULL,
4089 p_ret_attribute1 IN VARCHAR2 DEFAULT NULL,
4090 p_ret_attribute2 IN VARCHAR2 DEFAULT NULL,
4091 p_ret_attribute3 IN VARCHAR2 DEFAULT NULL,
4092 p_ret_attribute4 IN VARCHAR2 DEFAULT NULL,
4093 p_ret_attribute5 IN VARCHAR2 DEFAULT NULL,
4094 p_ret_attribute6 IN VARCHAR2 DEFAULT NULL,
4095 p_ret_attribute7 IN VARCHAR2 DEFAULT NULL,
4096 p_ret_attribute8 IN VARCHAR2 DEFAULT NULL,
4097 p_ret_attribute9 IN VARCHAR2 DEFAULT NULL,
4098 p_ret_attribute10 IN VARCHAR2 DEFAULT NULL,
4099 p_ret_attribute11 IN VARCHAR2 DEFAULT NULL,
4100 p_ret_attribute12 IN VARCHAR2 DEFAULT NULL,
4101 p_ret_attribute13 IN VARCHAR2 DEFAULT NULL,
4102 p_ret_attribute14 IN VARCHAR2 DEFAULT NULL,
4103 p_ret_attribute15 IN VARCHAR2 DEFAULT NULL,
4104 p_ret_attribute_category_code IN VARCHAR2 DEFAULT NULL
4105 ) AS
4106
4107 l_trans_rec fa_api_types.trans_rec_type;
4108 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
4109 l_asset_retire_rec fa_api_types.asset_retire_rec_type;
4110 l_asset_retire_rec_old fa_api_types.asset_retire_rec_type;
4111
4112 desc_err exception;
4113
4114 BEGIN
4115
4116 -- Initialize message list if p_init_msg_list is set to TRUE.
4117 IF FND_API.To_Boolean(p_init_msg_list) THEN
4118 -- Initialize error message stack.
4119 FA_SRVR_MSG.Init_Server_Message;
4120
4121 -- Initialize debug message stack.
4122 FA_DEBUG_PKG.Initialize;
4123 END IF;
4124
4125 -- Override FA:PRINT_DEBUG profile option.
4126 IF (p_debug_flag = 'YES') THEN
4127 FA_DEBUG_PKG.Set_Debug_Flag;
4128 END IF;
4129
4130 -- ***** Asset Transaction Info ***** --
4131 --l_trans_rec.transaction_header_id :=
4132 --l_trans_rec.transaction_type_code :=
4133 --l_trans_rec.transaction_date_entered :=
4134 --l_trans_rec.transaction_name :=
4135 --l_trans_rec.source_transaction_header_id :=
4136 --l_trans_rec.mass_reference_id :=
4137 --l_trans_rec.transaction_subtype :=
4138 --l_trans_rec.transaction_key :=
4139 --l_trans_rec.amortization_start_date :=
4140 --l_trans_rec.calling_interface :=
4141 --l_trans_rec.desc_flex.attribute1 :=
4142 --l_trans_rec.desc_flex.attribute2 :=
4143 --l_trans_rec.desc_flex.attribute3 :=
4144 --l_trans_rec.desc_flex.attribute4 :=
4145 --l_trans_rec.desc_flex.attribute5 :=
4146 --l_trans_rec.desc_flex.attribute6 :=
4147 --l_trans_rec.desc_flex.attribute7 :=
4148 --l_trans_rec.desc_flex.attribute8 :=
4149 --l_trans_rec.desc_flex.attribute9 :=
4150 --l_trans_rec.desc_flex.attribute10 :=
4151 --l_trans_rec.desc_flex.attribute11 :=
4152 --l_trans_rec.desc_flex.attribute12 :=
4153 --l_trans_rec.desc_flex.attribute13 :=
4154 --l_trans_rec.desc_flex.attribute14 :=
4155 --l_trans_rec.desc_flex.attribute15 :=
4156 --l_trans_rec.desc_flex.attribute_category_code :=
4157 l_trans_rec.who_info.last_update_date := p_last_update_date;
4158 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
4159 l_trans_rec.who_info.created_by := NULL;
4160 l_trans_rec.who_info.creation_date := NULL;
4161 l_trans_rec.who_info.last_update_login := p_last_update_login;
4162
4163 -- ***** Asset Header Info ***** --
4164 l_asset_hdr_rec.asset_id := p_Asset_Id;
4165 l_asset_hdr_rec.book_type_code := p_book_type_code;
4166 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
4167 --l_asset_hdr_rec.period_of_addition :=
4168
4169 -- Derive set of books id for primary book
4170 if (l_asset_hdr_rec.set_of_books_id is NULL) then
4171 select set_of_books_id
4172 into l_asset_hdr_rec.set_of_books_id
4173 from fa_book_controls
4174 where book_type_code = l_asset_hdr_rec.book_type_code;
4175 end if;
4176
4177 -- ***** Asset Retirement Info ***** --
4178 l_asset_retire_rec.retirement_id := p_retirement_id;
4179 l_asset_retire_rec.proceeds_of_sale := p_proceeds_of_sale;
4180 l_asset_retire_rec.cost_of_removal := p_cost_of_removal;
4181 l_asset_retire_rec.retirement_type_code := p_retirement_type_code;
4182 l_asset_retire_rec.retirement_prorate_convention :=
4183 p_retire_prorate_convention;
4184 l_asset_retire_rec.sold_to := p_sold_to;
4185 l_asset_retire_rec.trade_in_asset_id := p_trade_in_asset_id;
4186 l_asset_retire_rec.status := p_status;
4187 l_asset_retire_rec.reference_num := p_reference_num;
4188 l_asset_retire_rec.desc_flex.attribute1 := p_ret_attribute1;
4189 l_asset_retire_rec.desc_flex.attribute2 := p_ret_attribute2;
4190 l_asset_retire_rec.desc_flex.attribute3 := p_ret_attribute3;
4191 l_asset_retire_rec.desc_flex.attribute4 := p_ret_attribute4;
4192 l_asset_retire_rec.desc_flex.attribute5 := p_ret_attribute5;
4193 l_asset_retire_rec.desc_flex.attribute6 := p_ret_attribute6;
4194 l_asset_retire_rec.desc_flex.attribute7 := p_ret_attribute7;
4195 l_asset_retire_rec.desc_flex.attribute8 := p_ret_attribute8;
4196 l_asset_retire_rec.desc_flex.attribute9 := p_ret_attribute9;
4197 l_asset_retire_rec.desc_flex.attribute10 := p_ret_attribute10;
4198 l_asset_retire_rec.desc_flex.attribute11 := p_ret_attribute11;
4199 l_asset_retire_rec.desc_flex.attribute12 := p_ret_attribute12;
4200 l_asset_retire_rec.desc_flex.attribute13 := p_ret_attribute13;
4201 l_asset_retire_rec.desc_flex.attribute14 := p_ret_attribute14;
4202 l_asset_retire_rec.desc_flex.attribute15 := p_ret_attribute15;
4203 l_asset_retire_rec.desc_flex.attribute_category_code :=
4204 p_ret_attribute_category_code;
4205
4206 if (p_reset_miss_flag = 'YES') then
4207 -- Fix for Bug #2653564. Need to pass different record groups to
4208 -- IN and OUT parameters.
4209 l_asset_retire_rec_old := l_asset_retire_rec;
4210
4211 if (NOT fa_trans_api_pvt.set_asset_retire_rec (
4212 p_asset_retire_rec => l_asset_retire_rec_old,
4213 x_asset_retire_rec_new => l_asset_retire_rec,
4214 p_mrc_sob_type_code => 'P'
4215 )) then
4216 raise desc_err;
4217 end if;
4218 end if;
4219
4220 fa_asset_desc_pub.update_retirement_desc (
4221 p_api_version => p_api_version,
4222 p_init_msg_list => p_init_msg_list,
4223 p_commit => p_commit,
4224 p_validation_level => p_validation_level,
4225 x_return_status => x_return_status,
4226 x_msg_count => x_msg_count,
4227 x_msg_data => x_msg_data,
4228 p_calling_fn => p_calling_fn,
4229 px_trans_rec => l_trans_rec,
4230 px_asset_hdr_rec => l_asset_hdr_rec,
4231 px_asset_retire_rec_new => l_asset_retire_rec);
4232
4233 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
4234 return;
4235 end if;
4236
4237 EXCEPTION
4238 when desc_err then
4239 fa_srvr_msg.add_message(calling_fn => 'fa_trans_api_pub.do_ret_desc_upd',
4240 p_log_level_rec => g_log_level_rec);
4241 x_return_status := FND_API.G_RET_STS_ERROR;
4242
4243 when others then
4244 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_ret_desc_upd',
4245 p_log_level_rec => g_log_level_rec);
4246 x_return_status := FND_API.G_RET_STS_ERROR;
4247
4248 END do_retirement_desc_update;
4249
4250 PROCEDURE do_unplanned (
4251 -- Standard Parameters --
4252 p_api_version IN NUMBER,
4253 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
4254 p_commit IN VARCHAR2 := FND_API.G_FALSE,
4255 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
4256 x_return_status OUT NOCOPY VARCHAR2,
4257 x_msg_count OUT NOCOPY NUMBER,
4258 x_msg_data OUT NOCOPY VARCHAR2,
4259 p_calling_fn IN VARCHAR2,
4260 -- API Options --
4261 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
4262 -- Out Parameters --
4263 x_transaction_header_id OUT NOCOPY NUMBER,
4264 -- Transaction Info --
4265 p_transaction_date_entered IN DATE DEFAULT NULL,
4266 p_transaction_name IN VARCHAR2 DEFAULT NULL,
4267 p_transaction_subtype IN VARCHAR2 DEFAULT NULL,
4268 p_amortization_start_date IN DATE DEFAULT NULL,
4269 p_mass_reference_id IN NUMBER DEFAULT NULL,
4270 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
4271 p_last_update_date IN DATE,
4272 p_last_updated_by IN NUMBER,
4273 p_created_by IN NUMBER,
4274 p_creation_date IN DATE,
4275 p_last_update_login IN NUMBER,
4276 p_attribute1 IN VARCHAR2 DEFAULT NULL,
4277 p_attribute2 IN VARCHAR2 DEFAULT NULL,
4278 p_attribute3 IN VARCHAR2 DEFAULT NULL,
4279 p_attribute4 IN VARCHAR2 DEFAULT NULL,
4280 p_attribute5 IN VARCHAR2 DEFAULT NULL,
4281 p_attribute6 IN VARCHAR2 DEFAULT NULL,
4282 p_attribute7 IN VARCHAR2 DEFAULT NULL,
4283 p_attribute8 IN VARCHAR2 DEFAULT NULL,
4284 p_attribute9 IN VARCHAR2 DEFAULT NULL,
4285 p_attribute10 IN VARCHAR2 DEFAULT NULL,
4286 p_attribute11 IN VARCHAR2 DEFAULT NULL,
4287 p_attribute12 IN VARCHAR2 DEFAULT NULL,
4288 p_attribute13 IN VARCHAR2 DEFAULT NULL,
4289 p_attribute14 IN VARCHAR2 DEFAULT NULL,
4290 p_attribute15 IN VARCHAR2 DEFAULT NULL,
4291 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
4292 -- Asset Header Info --
4293 p_asset_id IN NUMBER,
4294 p_book_type_code IN VARCHAR2,
4295 p_set_of_books_id IN NUMBER DEFAULT NULL,
4296 -- Unplanned Depreciation Info --
4297 p_code_combination_id IN NUMBER,
4298 p_unplanned_amount IN NUMBER,
4299 p_unplanned_type IN VARCHAR2 DEFAULT NULL
4300 ) AS
4301
4302 l_trans_rec fa_api_types.trans_rec_type;
4303 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
4304 l_unplanned_deprn_rec fa_api_types.unplanned_deprn_rec_type;
4305
4306 BEGIN
4307
4308 -- Initialize message list if p_init_msg_list is set to TRUE.
4309 IF FND_API.To_Boolean(p_init_msg_list) THEN
4310 -- Initialize error message stack.
4311 FA_SRVR_MSG.Init_Server_Message;
4312
4313 -- Initialize debug message stack.
4314 FA_DEBUG_PKG.Initialize;
4315 END IF;
4316
4317 -- Override FA:PRINT_DEBUG profile option.
4318 IF (p_debug_flag = 'YES') THEN
4319 FA_DEBUG_PKG.Set_Debug_Flag;
4320 END IF;
4321
4322 -- ***** Asset Transaction Info ***** --
4323 --l_trans_rec.transaction_header_id :=
4324 --l_trans_rec.transaction_type_code :=
4325 l_trans_rec.transaction_date_entered := p_transaction_date_entered;
4326 l_trans_rec.transaction_name := p_transaction_name;
4327 --l_trans_rec.source_transaction_header_id :=
4328 --l_trans_rec.mass_reference_id :=
4329 l_trans_rec.transaction_subtype := p_transaction_subtype;
4330 --l_trans_rec.transaction_key :=
4331 l_trans_rec.amortization_start_date := p_amortization_start_date;
4332 l_trans_rec.calling_interface := p_calling_interface;
4333 l_trans_rec.desc_flex.attribute1 := p_attribute1;
4334 l_trans_rec.desc_flex.attribute2 := p_attribute2;
4335 l_trans_rec.desc_flex.attribute3 := p_attribute3;
4336 l_trans_rec.desc_flex.attribute4 := p_attribute4;
4337 l_trans_rec.desc_flex.attribute5 := p_attribute5;
4338 l_trans_rec.desc_flex.attribute6 := p_attribute6;
4339 l_trans_rec.desc_flex.attribute7 := p_attribute7;
4340 l_trans_rec.desc_flex.attribute8 := p_attribute8;
4341 l_trans_rec.desc_flex.attribute9 := p_attribute9;
4342 l_trans_rec.desc_flex.attribute10 := p_attribute10;
4343 l_trans_rec.desc_flex.attribute11 := p_attribute11;
4344 l_trans_rec.desc_flex.attribute12 := p_attribute12;
4345 l_trans_rec.desc_flex.attribute13 := p_attribute13;
4346 l_trans_rec.desc_flex.attribute14 := p_attribute14;
4347 l_trans_rec.desc_flex.attribute15 := p_attribute15;
4348 l_trans_rec.desc_flex.attribute_category_code := p_attribute_category_code;
4349 l_trans_rec.who_info.last_update_date := p_last_update_date;
4350 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
4351 l_trans_rec.who_info.created_by := p_created_by;
4352 l_trans_rec.who_info.creation_date := p_creation_date;
4353 l_trans_rec.who_info.last_update_login := p_last_update_login;
4354
4355 if (p_amortization_start_date is NOT NULL) then
4356 --l_trans_rec.transaction_date_entered := p_amortization_start_date;
4357 l_trans_rec.transaction_subtype := 'AMORTIZED';
4358 l_trans_rec.amortization_start_date := NULL;
4359 end if;
4360
4361 -- ***** Asset Header Info ***** --
4362 l_asset_hdr_rec.asset_id := p_asset_id;
4363 l_asset_hdr_rec.book_type_code := p_book_type_code;
4364 l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
4365 --l_asset_hdr_rec.period_of_addition :=
4366
4367 -- Derive set of books id for primary book
4368 if (l_asset_hdr_rec.set_of_books_id is NULL) then
4369 select set_of_books_id
4370 into l_asset_hdr_rec.set_of_books_id
4371 from fa_book_controls
4372 where book_type_code = l_asset_hdr_rec.book_type_code;
4373 end if;
4374
4375 -- ***** Unplanned Depreciation Info ***** --
4376 l_unplanned_deprn_rec.code_combination_id := p_code_combination_id;
4377 l_unplanned_deprn_rec.unplanned_amount := p_unplanned_amount;
4378 l_unplanned_deprn_rec.unplanned_type := substr(p_unplanned_type,1,9);
4379
4380 -- Call Public Unplanned Depreciation API
4381 fa_unplanned_pub.do_unplanned
4382 (p_api_version => p_api_version,
4383 p_init_msg_list => p_init_msg_list,
4384 p_commit => p_commit,
4385 p_validation_level => p_validation_level,
4386 p_calling_fn => p_calling_fn,
4387 x_return_status => x_return_status,
4388 x_msg_count => x_msg_count,
4389 x_msg_data => x_msg_data,
4390 px_trans_rec => l_trans_rec,
4391 px_asset_hdr_rec => l_asset_hdr_rec,
4392 p_unplanned_deprn_rec => l_unplanned_deprn_rec
4393 );
4394
4395 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
4396 return;
4397 end if;
4398
4399 x_transaction_header_id := l_trans_rec.transaction_header_id;
4400
4401 EXCEPTION
4402 when others then
4403 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_unplanned',
4404 p_log_level_rec => g_log_level_rec);
4405 x_return_status := FND_API.G_RET_STS_ERROR;
4406
4407 END do_unplanned;
4408
4409 PROCEDURE do_reserve_transfer (
4410 -- Standard Parameters --
4411 p_api_version IN NUMBER,
4412 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
4413 p_commit IN VARCHAR2 := FND_API.G_FALSE,
4414 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
4415 x_return_status OUT NOCOPY VARCHAR2,
4416 x_msg_count OUT NOCOPY NUMBER,
4417 x_msg_data OUT NOCOPY VARCHAR2,
4418 p_calling_fn IN VARCHAR2,
4419 -- API Options --
4420 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
4421 -- Out Parameters --
4422 x_src_transaction_header_id OUT NOCOPY NUMBER,
4423 x_dest_transaction_header_id OUT NOCOPY NUMBER,
4424 -- Transaction Info --
4425 p_transaction_date_entered IN DATE DEFAULT NULL,
4426 p_transaction_name IN VARCHAR2 DEFAULT NULL,
4427 p_transaction_subtype IN VARCHAR2 DEFAULT NULL,
4428 p_amortization_start_date IN DATE DEFAULT NULL,
4429 p_mass_reference_id IN NUMBER DEFAULT NULL,
4430 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
4431 p_last_update_date IN DATE,
4432 p_last_updated_by IN NUMBER,
4433 p_created_by IN NUMBER,
4434 p_creation_date IN DATE,
4435 p_last_update_login IN NUMBER,
4436 p_attribute1 IN VARCHAR2 DEFAULT NULL,
4437 p_attribute2 IN VARCHAR2 DEFAULT NULL,
4438 p_attribute3 IN VARCHAR2 DEFAULT NULL,
4439 p_attribute4 IN VARCHAR2 DEFAULT NULL,
4440 p_attribute5 IN VARCHAR2 DEFAULT NULL,
4441 p_attribute6 IN VARCHAR2 DEFAULT NULL,
4442 p_attribute7 IN VARCHAR2 DEFAULT NULL,
4443 p_attribute8 IN VARCHAR2 DEFAULT NULL,
4444 p_attribute9 IN VARCHAR2 DEFAULT NULL,
4445 p_attribute10 IN VARCHAR2 DEFAULT NULL,
4446 p_attribute11 IN VARCHAR2 DEFAULT NULL,
4447 p_attribute12 IN VARCHAR2 DEFAULT NULL,
4448 p_attribute13 IN VARCHAR2 DEFAULT NULL,
4449 p_attribute14 IN VARCHAR2 DEFAULT NULL,
4450 p_attribute15 IN VARCHAR2 DEFAULT NULL,
4451 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
4452 -- Asset Header Info --
4453 p_src_asset_id IN NUMBER, -- Source Asset Id
4454 p_book_type_code IN VARCHAR2,-- Source Book Type Code
4455 -- Reserve Transfer Info --
4456 p_transfer_amount IN NUMBER,
4457 p_dest_asset_id IN NUMBER -- Destination Asset Id
4458 ) IS
4459
4460 l_src_trans_rec FA_API_TYPES.trans_rec_type;
4461 l_dest_trans_rec FA_API_TYPES.trans_rec_type;
4462
4463 BEGIN
4464
4465 -- Initialize message list if p_init_msg_list is set to TRUE.
4466 if FND_API.To_Boolean(p_init_msg_list) then
4467 -- Initialize error message stack.
4468 FA_SRVR_MSG.Init_Server_Message;
4469
4470 -- Initialize debug message stack.
4471 FA_DEBUG_PKG.Initialize;
4472 end if;
4473
4474 -- Override FA:PRINT_DEBUG profile option.
4475 if (p_debug_flag = 'YES') then
4476 FA_DEBUG_PKG.Set_Debug_Flag;
4477 end if;
4478
4479 -- ***** Source Asset Transaction Info ***** --
4480 l_src_trans_rec.transaction_type_code := 'GROUP ADJUSTMENT';
4481 l_src_trans_rec.transaction_subtype := 'AMORTIZED';
4482
4483 l_src_trans_rec.who_info.last_update_date := p_last_update_date;
4484 l_src_trans_rec.who_info.last_updated_by := p_last_updated_by;
4485 l_src_trans_rec.who_info.created_by := p_created_by;
4486 l_src_trans_rec.who_info.creation_date := p_creation_date;
4487 --l_src_trans_rec.who_info.last_update_login := p_last_update_login;
4488
4489 -- ***** Destination Asset Transaction Info ***** --
4490 l_dest_trans_rec.transaction_type_code := 'GROUP ADJUSTMENT';
4491 l_dest_trans_rec.transaction_subtype := 'AMORTIZED';
4492
4493 l_dest_trans_rec.who_info.last_update_date := p_last_update_date;
4494 l_dest_trans_rec.who_info.last_updated_by := p_last_updated_by;
4495 l_dest_trans_rec.who_info.created_by := p_created_by;
4496 l_dest_trans_rec.who_info.creation_date := p_creation_date;
4497 --l_dest_trans_rec.who_info.last_update_login := p_last_update_login;
4498
4499
4500
4501 FA_RESERVE_TRANSFER_PUB.do_reserve_transfer (
4502 p_api_version => p_api_version,
4503 p_init_msg_list => p_init_msg_list,
4504 p_commit => p_commit,
4505 p_validation_level => p_validation_level,
4506 p_calling_fn => p_calling_fn,
4507 x_return_status => x_return_status,
4508 x_msg_count => x_msg_count,
4509 x_msg_data => x_msg_data,
4510 p_src_asset_id => p_src_asset_id,
4511 p_dest_asset_id => p_dest_asset_id,
4512 p_book_type_code => p_book_type_code,
4513 p_amount => p_transfer_amount,
4514 px_src_trans_rec => l_src_trans_rec,
4515 px_dest_trans_rec => l_dest_trans_rec);
4516
4517 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
4518 x_src_transaction_header_id := l_src_trans_rec.transaction_header_id;
4519 x_dest_transaction_header_id := l_dest_trans_rec.transaction_header_id;
4520 return;
4521 end if;
4522
4523 EXCEPTION
4524 when others then
4525 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_rsv_xfr',
4526 p_log_level_rec => g_log_level_rec);
4527 x_return_status := FND_API.G_RET_STS_ERROR;
4528
4529 END do_reserve_transfer;
4530
4531 PROCEDURE do_retirement_adjustment (
4532 -- Standard Parameters --
4533 p_api_version IN NUMBER,
4534 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
4535 p_commit IN VARCHAR2 := FND_API.G_FALSE,
4536 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
4537 x_return_status OUT NOCOPY VARCHAR2,
4538 x_msg_count OUT NOCOPY NUMBER,
4539 x_msg_data OUT NOCOPY VARCHAR2,
4540 p_calling_fn IN VARCHAR2,
4541 -- API Options --
4542 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
4543 -- Out Parameters --
4544 x_transaction_header_id OUT NOCOPY NUMBER,
4545 -- Transaction Info --
4546 p_transaction_date_entered IN DATE DEFAULT NULL,
4547 p_transaction_name IN VARCHAR2 DEFAULT NULL,
4548 p_transaction_subtype IN VARCHAR2 DEFAULT NULL,
4549 p_amortization_start_date IN DATE DEFAULT NULL,
4550 p_mass_reference_id IN NUMBER DEFAULT NULL,
4551 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
4552 p_last_update_date IN DATE,
4553 p_last_updated_by IN NUMBER,
4554 p_created_by IN NUMBER,
4555 p_creation_date IN DATE,
4556 p_last_update_login IN NUMBER,
4557 p_attribute1 IN VARCHAR2 DEFAULT NULL,
4558 p_attribute2 IN VARCHAR2 DEFAULT NULL,
4559 p_attribute3 IN VARCHAR2 DEFAULT NULL,
4560 p_attribute4 IN VARCHAR2 DEFAULT NULL,
4561 p_attribute5 IN VARCHAR2 DEFAULT NULL,
4562 p_attribute6 IN VARCHAR2 DEFAULT NULL,
4563 p_attribute7 IN VARCHAR2 DEFAULT NULL,
4564 p_attribute8 IN VARCHAR2 DEFAULT NULL,
4565 p_attribute9 IN VARCHAR2 DEFAULT NULL,
4566 p_attribute10 IN VARCHAR2 DEFAULT NULL,
4567 p_attribute11 IN VARCHAR2 DEFAULT NULL,
4568 p_attribute12 IN VARCHAR2 DEFAULT NULL,
4569 p_attribute13 IN VARCHAR2 DEFAULT NULL,
4570 p_attribute14 IN VARCHAR2 DEFAULT NULL,
4571 p_attribute15 IN VARCHAR2 DEFAULT NULL,
4572 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
4573 -- Asset Header Info --
4574 p_asset_id IN NUMBER,
4575 p_book_type_code IN VARCHAR2,
4576 -- Retirement Adjustment Info --
4577 p_proceeds_of_sale IN NUMBER,
4578 p_cost_of_removal IN NUMBER
4579 ) IS
4580
4581 l_trans_rec fa_api_types.trans_rec_type;
4582 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
4583
4584 BEGIN
4585 l_trans_rec.transaction_type_code := 'GROUP ADJUSTMENT';
4586 l_trans_rec.transaction_subtype := 'AMORTIZED';
4587
4588 l_trans_rec.who_info.last_update_date := p_last_update_date;
4589 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
4590 l_trans_rec.who_info.created_by := p_created_by;
4591 l_trans_rec.who_info.creation_date := p_creation_date;
4592
4593 -- ***** Asset Header Info ***** --
4594 l_asset_hdr_rec.asset_id := p_asset_id;
4595 l_asset_hdr_rec.book_type_code := p_book_type_code;
4596 -- l_asset_hdr_rec.set_of_books_id := p_set_of_books_id;
4597
4598 FA_RETIREMENT_ADJUSTMENT_PUB.do_retirement_adjustment
4599 (p_api_version => p_api_version,
4600 p_init_msg_list => p_init_msg_list,
4601 p_commit => p_commit,
4602 p_validation_level => p_validation_level,
4603 p_calling_fn => p_calling_fn,
4604 x_return_status => x_return_status,
4605 x_msg_count => x_msg_count,
4606 x_msg_data => x_msg_data,
4607 px_trans_rec => l_trans_rec,
4608 px_asset_hdr_rec => l_asset_hdr_rec,
4609 p_cost_of_removal => p_cost_of_removal,
4610 p_proceeds => p_proceeds_of_sale
4611 );
4612
4613 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
4614 x_transaction_header_id := l_trans_rec.transaction_header_id;
4615 return;
4616 end if;
4617
4618 EXCEPTION
4619 when others then
4620 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_ret_adj',
4621 p_log_level_rec => g_log_level_rec);
4622 x_return_status := FND_API.G_RET_STS_ERROR;
4623 END do_retirement_adjustment;
4624
4625 PROCEDURE do_tax_reserve_adjustment(
4626 -- Standard Parameters --
4627 p_api_version IN NUMBER,
4628 p_init_msg_list IN VARCHAR2 := FND_API.G_TRUE,
4629 p_commit IN VARCHAR2 := FND_API.G_FALSE,
4630 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
4631 x_return_status OUT NOCOPY VARCHAR2,
4632 x_msg_count OUT NOCOPY NUMBER,
4633 x_msg_data OUT NOCOPY VARCHAR2,
4634 p_calling_fn IN VARCHAR2,
4635 -- API Options --
4636 p_debug_flag IN VARCHAR2 DEFAULT 'NO',
4637 -- Out Parameters --
4638 x_transaction_header_id OUT NOCOPY NUMBER,
4639 -- Transaction Info --
4640 p_transaction_name IN VARCHAR2 DEFAULT NULL,
4641 p_mass_reference_id IN NUMBER DEFAULT NULL,
4642 p_calling_interface IN VARCHAR2 DEFAULT 'CUSTOM',
4643 p_last_update_date IN DATE,
4644 p_last_updated_by IN NUMBER,
4645 p_created_by IN NUMBER,
4646 p_creation_date IN DATE,
4647 p_last_update_login IN NUMBER,
4648 p_attribute1 IN VARCHAR2 DEFAULT NULL,
4649 p_attribute2 IN VARCHAR2 DEFAULT NULL,
4650 p_attribute3 IN VARCHAR2 DEFAULT NULL,
4651 p_attribute4 IN VARCHAR2 DEFAULT NULL,
4652 p_attribute5 IN VARCHAR2 DEFAULT NULL,
4653 p_attribute6 IN VARCHAR2 DEFAULT NULL,
4654 p_attribute7 IN VARCHAR2 DEFAULT NULL,
4655 p_attribute8 IN VARCHAR2 DEFAULT NULL,
4656 p_attribute9 IN VARCHAR2 DEFAULT NULL,
4657 p_attribute10 IN VARCHAR2 DEFAULT NULL,
4658 p_attribute11 IN VARCHAR2 DEFAULT NULL,
4659 p_attribute12 IN VARCHAR2 DEFAULT NULL,
4660 p_attribute13 IN VARCHAR2 DEFAULT NULL,
4661 p_attribute14 IN VARCHAR2 DEFAULT NULL,
4662 p_attribute15 IN VARCHAR2 DEFAULT NULL,
4663 p_attribute_category_code IN VARCHAR2 DEFAULT NULL,
4664 -- Asset Header Info --
4665 p_asset_id IN NUMBER,
4666 p_book_type_code IN VARCHAR2,
4667 -- Tax Reserve Adjustment Info --
4668 p_fiscal_year IN NUMBER,
4669 p_adjusted_ytd_deprn IN OUT NOCOPY NUMBER, -- Delta (New_FY_Ytd_Deprn - Old_FY_Ytd_Deprn)
4670 p_deprn_basis_formula IN NUMBER,
4671 p_run_mode IN VARCHAR2 DEFAULT 'RUN'
4672 ) IS
4673
4674 l_trans_rec fa_api_types.trans_rec_type;
4675 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
4676 l_asset_tax_rsv_adj_rec fa_api_types.asset_tax_rsv_adj_rec_type;
4677
4678 BEGIN
4679 -- Initialize message list if p_init_msg_list is set to TRUE.
4680 IF FND_API.To_Boolean(p_init_msg_list) THEN
4681 -- Initialize error message stack.
4682 FA_SRVR_MSG.Init_Server_Message;
4683
4684 -- Initialize debug message stack.
4685 FA_DEBUG_PKG.Initialize;
4686 END IF;
4687
4688 -- Override FA:PRINT_DEBUG profile option.
4689 IF (p_debug_flag = 'YES') THEN
4690 FA_DEBUG_PKG.Set_Debug_Flag;
4691 END IF;
4692
4693 -- ***** Tax reserve adjustment Info ***** --
4694 l_asset_tax_rsv_adj_rec.fiscal_year := p_fiscal_year;
4695 l_asset_tax_rsv_adj_rec.adjusted_ytd_deprn := p_adjusted_ytd_deprn;
4696 l_asset_tax_rsv_adj_rec.deprn_basis_formula := p_deprn_basis_formula;
4697 l_asset_tax_rsv_adj_rec.run_mode := p_run_mode;
4698 -- ***** Transaction Header Info ***** --
4699 l_trans_rec.transaction_name := p_transaction_name;
4700 l_trans_rec.mass_reference_id := p_mass_reference_id;
4701 l_trans_rec.calling_interface := p_calling_interface;
4702
4703 If l_asset_tax_rsv_adj_rec.deprn_basis_formula = 'STRICT_FLAT' then
4704 l_trans_rec.transaction_subtype := 'AMORTIZED';
4705 l_trans_rec.amortization_start_date := sysdate;
4706 else
4707 l_trans_rec.transaction_subtype := 'EXPENSED';
4708 l_trans_rec.amortization_start_date := NULL;
4709 end if;
4710
4711 l_trans_rec.desc_flex.attribute1 := p_attribute1;
4712 l_trans_rec.desc_flex.attribute2 := p_attribute2;
4713 l_trans_rec.desc_flex.attribute3 := p_attribute3;
4714 l_trans_rec.desc_flex.attribute4 := p_attribute4;
4715 l_trans_rec.desc_flex.attribute5 := p_attribute5;
4716 l_trans_rec.desc_flex.attribute6 := p_attribute6;
4717 l_trans_rec.desc_flex.attribute7 := p_attribute7;
4718 l_trans_rec.desc_flex.attribute8 := p_attribute8;
4719 l_trans_rec.desc_flex.attribute9 := p_attribute9;
4720 l_trans_rec.desc_flex.attribute10 := p_attribute10;
4721 l_trans_rec.desc_flex.attribute11 := p_attribute11;
4722 l_trans_rec.desc_flex.attribute12 := p_attribute12;
4723 l_trans_rec.desc_flex.attribute13 := p_attribute13;
4724 l_trans_rec.desc_flex.attribute14 := p_attribute14;
4725 l_trans_rec.desc_flex.attribute15 := p_attribute15;
4726 l_trans_rec.desc_flex.attribute_category_code := p_attribute_category_code;
4727 l_trans_rec.who_info.last_update_date := p_last_update_date;
4728 l_trans_rec.who_info.last_updated_by := p_last_updated_by;
4729 l_trans_rec.who_info.created_by := p_created_by;
4730 l_trans_rec.who_info.creation_date := p_creation_date;
4731 l_trans_rec.who_info.last_update_login := p_last_update_login;
4732
4733 -- ***** Asset Header Info ***** --
4734 l_asset_hdr_rec.asset_id := p_asset_id;
4735 l_asset_hdr_rec.book_type_code := p_book_type_code;
4736
4737 fa_tax_rsv_adj_pub.do_tax_rsv_adj
4738 (p_api_version => p_api_version,
4739 p_init_msg_list => p_init_msg_list,
4740 p_commit => p_commit,
4741 p_validation_level => p_validation_level,
4742 p_calling_fn => p_calling_fn,
4743 x_return_status => x_return_status,
4744 x_msg_count => x_msg_count,
4745 x_msg_data => x_msg_data,
4746 px_trans_rec => l_trans_rec,
4747 px_asset_hdr_rec => l_asset_hdr_rec,
4748 p_asset_tax_rsv_adj_rec => l_asset_tax_rsv_adj_rec
4749 );
4750
4751 if (x_return_status <> FND_API.G_RET_STS_SUCCESS) then
4752 x_transaction_header_id := l_trans_rec.transaction_header_id;
4753 return;
4754 end if;
4755
4756 EXCEPTION
4757 when others then
4758 fa_srvr_msg.add_sql_error(calling_fn => 'fa_trans_api_pub.do_tax_rsv_adj');
4759 x_return_status := FND_API.G_RET_STS_ERROR;
4760 END do_tax_reserve_adjustment;
4761
4762
4763 END FA_TRANS_API_PUB;