[Home] [Help]
PACKAGE BODY: APPS.INL_LANDEDCOST_PUB
Source
1 PACKAGE BODY INL_LANDEDCOST_PUB AS
2 /* $Header: INLPLCOB.pls 120.11.12020000.3 2012/08/13 14:15:51 acferrei ship $ */
3
4 -- API name : Get_LandedCost
5 -- Type : Public
6 -- Function :
7 -- Pre-reqs : None
8 -- Parameters :
9 -- IN : p_api_version IN NUMBER Required
10 -- p_init_msg_list IN VARCHAR2 Optional Default = FND_API.G_FALSE
11 -- p_commit IN VARCHAR2 Optional Default = FND_API.G_FALSE
12 -- p_ship_header_id IN NUMBER Required
13 --
14 -- OUT : x_return_status OUT NOCOPY VARCHAR2
15 -- x_msg_count OUT NOCOPY NUMBER
16 -- x_msg_data OUT NOCOPY VARCHAR2
17 -- x_landed_cost_tbl OUT NOCOPY landed_cost_tbl
18 --
19 -- Version : Current version 1.0
20 --
21 -- Notes :
22
23
24 --Bug#14158274 Procedure has been redesigned
25 PROCEDURE Get_LandedCost(
26 p_api_version IN NUMBER,
27 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
28 p_commit IN VARCHAR2 := FND_API.G_FALSE,
29 p_ship_header_id IN NUMBER,
30 x_return_status OUT NOCOPY VARCHAR2,
31 x_msg_count OUT NOCOPY NUMBER,
32 x_msg_data OUT NOCOPY VARCHAR2,
33 x_landed_cost_tbl OUT NOCOPY landed_cost_tbl
34 ) IS
35
36 l_proc_name CONSTANT VARCHAR2(30) := 'Get_LandedCost';
37 l_api_version CONSTANT NUMBER := 1.0;
38
39 l_return_status VARCHAR2(1);
40 l_msg_count NUMBER;
41 l_msg_data VARCHAR2(2000);
42 l_debug_info VARCHAR2(200);
43 l_lc_ln_index NUMBER := NVL(x_landed_cost_tbl.last,0); --Bug#14158274 + 1;
44 l_first_ln NUMBER:=0;
45
46 /*
47 CURSOR c_landed_cost IS
48 SELECT sl.ship_line_id
49 FROM inl_ship_lines sl
50 WHERE sl.ship_header_id = p_ship_header_id
51 AND sl.adjustment_num = 0
52 ORDER BY sl.ship_line_id;
53 l_landed_cost c_landed_cost%ROWTYPE;
54 */
55 CURSOR c_landed_cost IS
56 SELECT
57 NVL(sl.parent_ship_line_id,sl.ship_line_id) parent_ship_line_id,
58 lc.organization_id,
59 sl.inventory_item_id,
60 sl.primary_qty,
61 sl.primary_uom_code,
62 lc.component_type,
63 SUM(lc.allocated_amt) ALC,
64 SUM(lc.estimated_allocated_amt) ELC
65 FROM
66 inl_ship_lines sl,
67 inl_det_landed_costs_v lc
68 WHERE lc.ship_header_id = p_ship_header_id
69 AND lc.adjustment_num = (SELECT MAX(alloc.adjustment_num)
70 FROM inl_allocations alloc
71 WHERE alloc.ship_header_id = p_ship_header_id)
72 AND sl.ship_line_id = lc.ship_line_id
73 GROUP BY NVL(sl.parent_ship_line_id,sl.ship_line_id),
74 lc.organization_id,
75 sl.inventory_item_id,
76 sl.primary_qty,
77 sl.primary_uom_code,
78 lc.component_type
79 ORDER BY NVL(sl.parent_ship_line_id,sl.ship_line_id);
80 TYPE l_landed_cost_tp IS TABLE OF c_landed_cost%ROWTYPE INDEX BY BINARY_INTEGER;
81 l_landed_cost_lst l_landed_cost_tp;
82
83 BEGIN
84
85 -- Standard Beginning of Procedure/Function Logging
86 INL_LOGGING_PVT.Log_BeginProc (p_module_name => g_module_name,
87 p_procedure_name => l_proc_name);
88 -- Standard Start of API savepoint
89 SAVEPOINT Get_LandedCost_PVT2;
90
91 -- Initialize message list if p_init_msg_list is set to TRUE.
92 IF FND_API.to_Boolean( p_init_msg_list ) THEN
93 FND_MSG_PUB.initialize;
94 END IF;
95
96 -- Check for call compatibility.
97 IF NOT FND_API.Compatible_API_Call (
98 l_api_version,
99 p_api_version,
100 l_proc_name,
101 g_pkg_name)
102 THEN
103 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
104 END IF;
105
106 -- Initialize API return status to success
107 x_return_status := FND_API.G_RET_STS_SUCCESS;
108
109 BEGIN
110 l_debug_info := 'Get landed cost info for ship_header_id: ' || p_ship_header_id;
111 INL_LOGGING_PVT.Log_Statement (
112 p_module_name => g_module_name,
113 p_procedure_name => l_proc_name,
114 p_debug_info => l_debug_info);
115
116 OPEN c_landed_cost;
117 FETCH c_landed_cost BULK COLLECT INTO l_landed_cost_lst;
118 CLOSE c_landed_cost;
119
120 l_debug_info := l_landed_cost_lst.LAST||' line(s) have been retrieved (l_landed_cost_lst).';
121 INL_LOGGING_PVT.Log_Statement (
122 p_module_name => g_module_name,
123 p_procedure_name => l_proc_name,
124 p_debug_info => l_debug_info
125 ) ;
126 IF NVL (l_landed_cost_lst.LAST, 0) > 0 THEN
127
128 FOR j IN NVL (l_landed_cost_lst.FIRST, 0)..NVL (l_landed_cost_lst.LAST, 0)
129 LOOP
130 INL_LOGGING_PVT.Log_Variable (
131 p_module_name => g_module_name,
132 p_procedure_name => l_proc_name,
133 p_var_name => 'l_landed_cost_lst('||j||').parent_ship_line_id',
134 p_var_value => l_landed_cost_lst(j).parent_ship_line_id
135 ) ;
136 IF l_first_ln = 0
137 OR NVL(x_landed_cost_tbl(l_lc_ln_index).ship_line_id,-1) <> l_landed_cost_lst(j).parent_ship_line_id
138 THEN
139 l_first_ln := 1;
140 l_lc_ln_index:=l_lc_ln_index+1;
141 INL_LOGGING_PVT.Log_Variable (
142 p_module_name => g_module_name,
143 p_procedure_name => l_proc_name,
144 p_var_name => 'l_lc_ln_index',
145 p_var_value => l_lc_ln_index
146 ) ;
147 INL_LOGGING_PVT.Log_Variable (
148 p_module_name => g_module_name,
149 p_procedure_name => l_proc_name,
150 p_var_name => 'l_landed_cost_lst('||j||').parent_ship_line_id',
151 p_var_value => l_landed_cost_lst(j).parent_ship_line_id
152 ) ;
153 x_landed_cost_tbl(l_lc_ln_index).ship_line_id := l_landed_cost_lst(j).parent_ship_line_id;
154 x_landed_cost_tbl(l_lc_ln_index).organization_id := l_landed_cost_lst(j).organization_id;
155 x_landed_cost_tbl(l_lc_ln_index).inventory_item_id := l_landed_cost_lst(j).inventory_item_id;
156 x_landed_cost_tbl(l_lc_ln_index).primary_qty := l_landed_cost_lst(j).primary_qty;
157 x_landed_cost_tbl(l_lc_ln_index).primary_uom_code := l_landed_cost_lst(j).primary_uom_code;
158
159 x_landed_cost_tbl(l_lc_ln_index).estimated_item_price := 0;
163 x_landed_cost_tbl(l_lc_ln_index).actual_item_price := 0;
160 x_landed_cost_tbl(l_lc_ln_index).estimated_charges := 0;
161 x_landed_cost_tbl(l_lc_ln_index).estimated_taxes := 0;
162 x_landed_cost_tbl(l_lc_ln_index).estimated_unit_landed_cost := 0;
164 x_landed_cost_tbl(l_lc_ln_index).actual_charges := 0;
165 x_landed_cost_tbl(l_lc_ln_index).actual_taxes := 0;
166 x_landed_cost_tbl(l_lc_ln_index).actual_unit_landed_cost := 0;
167 END IF;
168 INL_LOGGING_PVT.Log_Variable (
169 p_module_name => g_module_name,
170 p_procedure_name => l_proc_name,
171 p_var_name => 'l_landed_cost_lst('||j||').component_type',
172 p_var_value => l_landed_cost_lst(j).component_type
173 ) ;
174 INL_LOGGING_PVT.Log_Variable (
175 p_module_name => g_module_name,
176 p_procedure_name => l_proc_name,
177 p_var_name => 'l_landed_cost_lst('||j||').ELC',
178 p_var_value => l_landed_cost_lst(j).ELC
179 ) ;
180 INL_LOGGING_PVT.Log_Variable (
181 p_module_name => g_module_name,
182 p_procedure_name => l_proc_name,
183 p_var_name => 'l_landed_cost_lst('||j||').ALC',
184 p_var_value => l_landed_cost_lst(j).ALC
185 ) ;
186
187 x_landed_cost_tbl(l_lc_ln_index).estimated_unit_landed_cost :=
188 x_landed_cost_tbl(l_lc_ln_index).estimated_unit_landed_cost + (l_landed_cost_lst(j).ELC/l_landed_cost_lst(j).primary_qty);
189 x_landed_cost_tbl(l_lc_ln_index).actual_unit_landed_cost :=
190 x_landed_cost_tbl(l_lc_ln_index).actual_unit_landed_cost + (l_landed_cost_lst(j).ALC/l_landed_cost_lst(j).primary_qty);
191 IF l_landed_cost_lst(j).component_type = 'ITEM PRICE' THEN
192 x_landed_cost_tbl(l_lc_ln_index).estimated_item_price :=
193 x_landed_cost_tbl(l_lc_ln_index).estimated_item_price + NVL(l_landed_cost_lst(j).ELC,0);
194
195 x_landed_cost_tbl(l_lc_ln_index).actual_item_price :=
196 x_landed_cost_tbl(l_lc_ln_index).actual_item_price + NVL(l_landed_cost_lst(j).ALC,0);
197 ELSIF l_landed_cost_lst(j).component_type = 'CHARGE' THEN
198 x_landed_cost_tbl(l_lc_ln_index).estimated_charges :=
199 x_landed_cost_tbl(l_lc_ln_index).estimated_charges + NVL(l_landed_cost_lst(j).ELC,0);
200
201 x_landed_cost_tbl(l_lc_ln_index).actual_charges :=
202 x_landed_cost_tbl(l_lc_ln_index).actual_charges + NVL(l_landed_cost_lst(j).ALC,0);
203 ELSIF l_landed_cost_lst(j).component_type = 'TAX' THEN
204 x_landed_cost_tbl(l_lc_ln_index).estimated_taxes :=
205 x_landed_cost_tbl(l_lc_ln_index).estimated_taxes + NVL(l_landed_cost_lst(j).ELC,0);
206
207 x_landed_cost_tbl(l_lc_ln_index).actual_taxes :=
208 x_landed_cost_tbl(l_lc_ln_index).actual_taxes + NVL(l_landed_cost_lst(j).ALC,0);
209 ELSE
210 INL_LOGGING_PVT.Log_Statement (
211 p_module_name => g_module_name,
212 p_procedure_name => l_proc_name,
213 p_debug_info => 'unexpected component_type: '||l_landed_cost_lst(j).component_type);
214 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
215 END IF;
216 END LOOP;
217 END IF;
218 END;
219 l_debug_info := 'End Loop ';
220 INL_LOGGING_PVT.Log_Statement
221 (p_module_name => g_module_name,
222 p_procedure_name => l_proc_name,
223 p_debug_info => l_debug_info);
224
225 -- Standard check of p_commit.
226 IF FND_API.To_Boolean( p_commit ) THEN
227 COMMIT WORK;
228 END IF;
229
230 -- Standard call to get message count and if count is 1, get message info.
231 FND_MSG_PUB.Count_And_Get(
232 p_encoded => FND_API.g_false,
233 p_count => x_msg_count,
234 p_data => x_msg_data);
235
236 -- Standard End of Procedure/Function Logging
237 INL_LOGGING_PVT.Log_EndProc (
238 p_module_name => g_module_name,
239 p_procedure_name => l_proc_name);
240 EXCEPTION
241 WHEN FND_API.G_EXC_ERROR THEN
242 INL_LOGGING_PVT.Log_Statement
243 (p_module_name => g_module_name,
244 p_procedure_name => l_proc_name,
245 p_debug_info => 'G_EXC_ERROR:'||SQLERRM);
246 -- Standard Expected Error Logging
247 INL_LOGGING_PVT.Log_ExpecError (
248 p_module_name => g_module_name,
249 p_procedure_name => l_proc_name);
250 ROLLBACK TO Get_LandedCost_PVT2;
251 x_return_status := FND_API.G_RET_STS_ERROR;
252 FND_MSG_PUB.Count_And_Get(
253 p_encoded => FND_API.g_false,
254 p_count => x_msg_count,
255 p_data => x_msg_data);
256 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
257 INL_LOGGING_PVT.Log_Statement
258 (p_module_name => g_module_name,
259 p_procedure_name => l_proc_name,
260 p_debug_info => 'G_EXC_UNEXPECTED_ERROR:'||SQLERRM);
261 -- Standard Unexpected Error Logging
262 INL_LOGGING_PVT.Log_UnexpecError (
263 p_module_name => g_module_name,
264 p_procedure_name => l_proc_name);
265 ROLLBACK TO Get_LandedCost_PVT2;
266 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
267 FND_MSG_PUB.Count_And_Get(
268 p_encoded => FND_API.g_false,
269 p_count => x_msg_count,
270 p_data => x_msg_data);
271 WHEN OTHERS THEN
272 INL_LOGGING_PVT.Log_Statement
273 (p_module_name => g_module_name,
274 p_procedure_name => l_proc_name,
275 p_debug_info => 'OTHERS:'||SQLERRM);
276 -- Standard Unexpected Error Logging
277 INL_LOGGING_PVT.Log_UnexpecError (
278 p_module_name => g_module_name,
279 p_procedure_name => l_proc_name);
280 ROLLBACK TO Get_LandedCost_PVT2;
281 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
282 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
283 THEN
284 FND_MSG_PUB.Add_Exc_Msg(
285 g_pkg_name,
286 l_proc_name);
287 END IF;
288 FND_MSG_PUB.Count_And_Get(
289 p_encoded => FND_API.g_false,
290 p_count => x_msg_count,
291 p_data => x_msg_data);
292 END Get_LandedCost;
293
294 -- API name : Get_LandedCost
295 -- Type : Public
296 -- Function :
297 -- Pre-reqs : None
298 -- Parameters :
299 -- IN : p_api_version IN NUMBER Required
300 -- p_init_msg_list IN VARCHAR2 Optional Default = FND_API.G_FALSE
301 -- p_commit IN VARCHAR2 Optional Default = FND_API.G_FALSE
302 -- p_ship_line_id IN NUMBER Required
303 --
304 -- OUT : x_return_status OUT NOCOPY VARCHAR2
305 -- x_msg_count OUT NOCOPY NUMBER
306 -- x_msg_data OUT NOCOPY VARCHAR2
307 -- x_organization_id OUT NOCOPY NUMBER,
308 -- x_inventory_item_id OUT NOCOPY NUMBER,
309 -- x_primary_qty OUT NOCOPY NUMBER,
310 -- x_primary_uom_code OUT NOCOPY VARCHAR2,
311 -- x_estimated_item_price OUT NOCOPY NUMBER,
312 -- x_estimated_charges OUT NOCOPY NUMBER,
313 -- x_estimated_taxes OUT NOCOPY NUMBER,
314 -- x_estimated_unit_landed_cost OUT NOCOPY NUMBER,
315 -- x_actual_item_price OUT NOCOPY NUMBER,
316 -- x_actual_charges OUT NOCOPY NUMBER,
317 -- x_actual_taxes OUT NOCOPY NUMBER,
318 -- x_actual_unit_landed_cost OUT NOCOPY NUMBER,
319 -- x_ajustment_num OUT NOCOPY NUMBER -- OPM Integration
320 --
321 -- Version : Current version 1.0
322 --
323 -- Notes :
324 --Bug#14158274 Procedure has been redesigned
325 PROCEDURE Get_LandedCost(
326 p_api_version IN NUMBER,
327 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
328 p_commit IN VARCHAR2 := FND_API.G_FALSE,
329 p_ship_line_id IN NUMBER,
330 x_return_status OUT NOCOPY VARCHAR2,
331 x_msg_count OUT NOCOPY NUMBER,
332 x_msg_data OUT NOCOPY VARCHAR2,
333 x_organization_id OUT NOCOPY NUMBER,
334 x_inventory_item_id OUT NOCOPY NUMBER,
335 x_primary_qty OUT NOCOPY NUMBER,
336 x_primary_uom_code OUT NOCOPY VARCHAR2,
337 x_estimated_item_price OUT NOCOPY NUMBER,
338 x_estimated_charges OUT NOCOPY NUMBER,
339 x_estimated_taxes OUT NOCOPY NUMBER,
340 x_estimated_unit_landed_cost OUT NOCOPY NUMBER,
341 x_actual_item_price OUT NOCOPY NUMBER,
342 x_actual_charges OUT NOCOPY NUMBER,
343 x_actual_taxes OUT NOCOPY NUMBER,
344 x_actual_unit_landed_cost OUT NOCOPY NUMBER,
345 x_adjustment_num OUT NOCOPY NUMBER -- opm integration
346 ) IS
347
348 l_proc_name CONSTANT VARCHAR2(30) := 'Get_LandedCost-2';
349 l_api_version CONSTANT NUMBER := 1.0;
350 l_return_status VARCHAR2(1);
351 l_msg_count NUMBER;
352 l_msg_data VARCHAR2(2000);
353 l_debug_info VARCHAR2(200);
354
355 CURSOR c_landed_cost IS
356 SELECT
357 NVL(sl0.parent_ship_line_id,sl0.ship_line_id) parent_ship_line_id,
358 lc.organization_id,
359 sl0.inventory_item_id,
360 sl0.primary_qty,
361 sl0.primary_uom_code,
362 lc.component_type,
363 SUM(lc.allocated_amt) ALC,
364 SUM(lc.estimated_allocated_amt) ELC,
365 lc.adjustment_num
366 FROM
367 inl_ship_lines_all sl0, --access to table (performance)
368 inl_det_landed_costs_v lc
369 WHERE sl0.ship_line_id = p_ship_line_id
370 AND lc.ship_header_id = sl0.ship_header_id
371 AND lc.adjustment_num = (SELECT MAX(alloc.adjustment_num)
372 FROM inl_allocations alloc
373 WHERE alloc.ship_header_id = sl0.ship_header_id)
374 AND lc.ship_line_id = (SELECT MAX(sl.ship_line_id)
375 FROM inl_ship_lines sl --access to synon
376 WHERE sl.ship_header_id = sl0.ship_header_id
377 AND sl.ship_line_group_id = sl0.ship_line_group_id
378 AND sl.ship_line_num = sl0.ship_line_num
379 AND sl.adjustment_num <= lc.adjustment_num
380 )
381 GROUP BY NVL(sl0.parent_ship_line_id,sl0.ship_line_id),
382 lc.organization_id,
383 sl0.inventory_item_id,
384 sl0.primary_qty,
385 sl0.primary_uom_code,
386 lc.component_type,
387 lc.adjustment_num
388 ;
389 TYPE l_landed_cost_tp IS TABLE OF c_landed_cost%ROWTYPE INDEX BY BINARY_INTEGER;
390 l_landed_cost_lst l_landed_cost_tp;
391
392 BEGIN
393
397 p_procedure_name => l_proc_name
394 -- Standard Beginning of Procedure/Function Logging
395 INL_LOGGING_PVT.Log_BeginProc (
396 p_module_name => g_module_name,
398 );
399 -- Standard Start of API savepoint
400 SAVEPOINT Get_LandedCost_PVT3;
401
402 -- Initialize message list if p_init_msg_list is set to TRUE.
403 IF FND_API.to_Boolean( p_init_msg_list ) THEN
404 FND_MSG_PUB.initialize;
405 END IF;
406
407 -- Check for call compatibility.
408 IF NOT FND_API.Compatible_API_Call (
409 l_api_version,
410 p_api_version,
411 l_proc_name,
412 g_pkg_name)
413 THEN
414 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
415 END IF;
416
417 -- Initialize API return status to success
418 x_return_status := FND_API.G_RET_STS_SUCCESS;
419
420 BEGIN
421 l_debug_info := 'Get landed cost info for ship_line_id: ' || p_ship_line_id;
422 INL_LOGGING_PVT.Log_Statement (
423 p_module_name => g_module_name,
424 p_procedure_name => l_proc_name,
425 p_debug_info => l_debug_info);
426
427 OPEN c_landed_cost;
428 FETCH c_landed_cost BULK COLLECT INTO l_landed_cost_lst;
429 CLOSE c_landed_cost;
430
431 l_debug_info := l_landed_cost_lst.LAST||' line(s) have been retrieved (l_landed_cost_lst).';
432 INL_LOGGING_PVT.Log_Statement (
433 p_module_name => g_module_name,
434 p_procedure_name => l_proc_name,
435 p_debug_info => l_debug_info
436 ) ;
437 IF NVL (l_landed_cost_lst.LAST, 0) > 0 THEN
438
439 x_organization_id := l_landed_cost_lst(l_landed_cost_lst.FIRST).organization_id;
440 x_inventory_item_id := l_landed_cost_lst(l_landed_cost_lst.FIRST).inventory_item_id;
441 x_primary_qty := l_landed_cost_lst(l_landed_cost_lst.FIRST).primary_qty;
442 x_primary_uom_code := l_landed_cost_lst(l_landed_cost_lst.FIRST).primary_uom_code;
443 x_adjustment_num := l_landed_cost_lst(l_landed_cost_lst.FIRST).adjustment_num;
444 x_estimated_item_price := 0;
445 x_estimated_charges := 0;
446 x_estimated_taxes := 0;
447 x_estimated_unit_landed_cost := 0;
448 x_actual_item_price := 0;
449 x_actual_charges := 0;
450 x_actual_taxes := 0;
451 x_actual_unit_landed_cost := 0;
452 FOR j IN NVL (l_landed_cost_lst.FIRST, 0)..NVL (l_landed_cost_lst.LAST, 0)
453 LOOP
454 INL_LOGGING_PVT.Log_Variable (
455 p_module_name => g_module_name,
456 p_procedure_name => l_proc_name,
457 p_var_name => 'l_landed_cost_lst('||j||').component_type',
458 p_var_value => l_landed_cost_lst(j).component_type
459 ) ;
460 INL_LOGGING_PVT.Log_Variable (
461 p_module_name => g_module_name,
462 p_procedure_name => l_proc_name,
463 p_var_name => 'l_landed_cost_lst('||j||').ELC',
464 p_var_value => l_landed_cost_lst(j).ELC
465 ) ;
466 INL_LOGGING_PVT.Log_Variable (
467 p_module_name => g_module_name,
468 p_procedure_name => l_proc_name,
469 p_var_name => 'l_landed_cost_lst('||j||').ALC',
470 p_var_value => l_landed_cost_lst(j).ALC
471 ) ;
472
473 x_estimated_unit_landed_cost :=
474 x_estimated_unit_landed_cost + (l_landed_cost_lst(j).ELC/l_landed_cost_lst(j).primary_qty);
475 x_actual_unit_landed_cost :=
476 x_actual_unit_landed_cost + (l_landed_cost_lst(j).ALC/l_landed_cost_lst(j).primary_qty);
477 IF l_landed_cost_lst(j).component_type = 'ITEM PRICE' THEN
478 x_estimated_item_price :=
479 x_estimated_item_price + NVL(l_landed_cost_lst(j).ELC,0);
480
481 x_actual_item_price :=
482 x_actual_item_price + NVL(l_landed_cost_lst(j).ALC,0);
483 ELSIF l_landed_cost_lst(j).component_type = 'CHARGE' THEN
484 x_estimated_charges :=
485 x_estimated_charges + NVL(l_landed_cost_lst(j).ELC,0);
486
487 x_actual_charges :=
488 x_actual_charges + NVL(l_landed_cost_lst(j).ALC,0);
489 ELSIF l_landed_cost_lst(j).component_type = 'TAX' THEN
490 x_estimated_taxes :=
491 x_estimated_taxes + NVL(l_landed_cost_lst(j).ELC,0);
492
493 x_actual_taxes :=
494 x_actual_taxes + NVL(l_landed_cost_lst(j).ALC,0);
495 ELSE
496 INL_LOGGING_PVT.Log_Statement (
497 p_module_name => g_module_name,
498 p_procedure_name => l_proc_name,
499 p_debug_info => 'unexpected component_type: '||l_landed_cost_lst(j).component_type);
500 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
501 END IF;
502 END LOOP;
503 END IF;
504 END;
505
506 INL_LOGGING_PVT.Log_Variable(
507 p_module_name => g_module_name,
508 p_procedure_name => g_module_name,
509 p_var_name => 'x_actual_unit_landed_cost',
510 p_var_value => x_actual_unit_landed_cost);
511 INL_LOGGING_PVT.Log_Variable(
512 p_module_name => g_module_name,
513 p_procedure_name => g_module_name,
514 p_var_name => 'x_adjustment_num',
515 p_var_value => x_adjustment_num);
516
517 -- Standard check of p_commit.
518 IF FND_API.To_Boolean( p_commit ) THEN
519 COMMIT WORK;
520 END IF;
521
522 -- Standard call to get message count and if count is 1, get message info.
523 FND_MSG_PUB.Count_And_Get(
524 p_encoded => FND_API.g_false,
525 p_count => x_msg_count,
526 p_data => x_msg_data);
527
528 -- Standard End of Procedure/Function Logging
529 INL_LOGGING_PVT.Log_EndProc (
530 p_module_name => g_module_name,
531 p_procedure_name => l_proc_name);
532 EXCEPTION
533 WHEN FND_API.G_EXC_ERROR THEN
534 -- Standard Expected Error Logging
535 INL_LOGGING_PVT.Log_ExpecError (
536 p_module_name => g_module_name,
537 p_procedure_name => l_proc_name);
538 ROLLBACK TO Get_LandedCost_PVT3;
539 x_return_status := FND_API.G_RET_STS_ERROR;
540 FND_MSG_PUB.Count_And_Get(
541 p_encoded => FND_API.g_false,
542 p_count => x_msg_count,
543 p_data => x_msg_data);
544 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
545 -- Standard Unexpected Error Logging
546 INL_LOGGING_PVT.Log_UnexpecError (
547 p_module_name => g_module_name,
548 p_procedure_name => l_proc_name);
549 ROLLBACK TO Get_LandedCost_PVT3;
550 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
551 FND_MSG_PUB.Count_And_Get(
552 p_encoded => FND_API.g_false,
553 p_count => x_msg_count,
554 p_data => x_msg_data);
555 WHEN OTHERS THEN
556 -- Standard Unexpected Error Logging
557 INL_LOGGING_PVT.Log_UnexpecError (
558 p_module_name => g_module_name,
559 p_procedure_name => l_proc_name);
560 ROLLBACK TO Get_LandedCost_PVT3;
561 x_return_status := FND_API.G_RET_STS_UNEXP_ERROR ;
562 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
563 THEN
564 FND_MSG_PUB.Add_Exc_Msg(
565 g_pkg_name,
566 l_proc_name);
567 END IF;
568 FND_MSG_PUB.Count_And_Get(
569 p_encoded => FND_API.g_false,
570 p_count => x_msg_count,
571 p_data => x_msg_data);
572 END Get_LandedCost;
573
574 END INL_LANDEDCOST_PUB;