1 package body okl_am_rv_writedown_pvt_w as
2 /* $Header: OKLERVWB.pls 120.1 2005/07/07 12:46:28 asawanka noship $ */
3 rosetta_g_mistake_date date := to_date('01/01/+4713', 'MM/DD/SYYYY');
4 rosetta_g_miss_date date := to_date('01/01/-4712', 'MM/DD/SYYYY');
5
6 -- this is to workaround the JDBC bug regarding IN DATE of value GMiss
7 function rosetta_g_miss_date_in_map(d date) return date as
8 begin
9 if d = rosetta_g_mistake_date then return fnd_api.g_miss_date; end if;
10 return d;
11 end;
12
13 function rosetta_g_miss_num_map(n number) return number as
14 a number := fnd_api.g_miss_num;
15 b number := 0-1962.0724;
16 begin
17 if n=a then return b; end if;
18 if n=b then return a; end if;
19 return n;
20 end;
21
22 procedure rosetta_table_copy_in_p1(t out nocopy okl_am_rv_writedown_pvt.assets_tbl_type, a0 JTF_NUMBER_TABLE
23 , a1 JTF_NUMBER_TABLE
24 ) as
25 ddindx binary_integer; indx binary_integer;
26 begin
27 if a0 is not null and a0.count > 0 then
28 if a0.count > 0 then
29 indx := a0.first;
30 ddindx := 1;
31 while true loop
32 t(ddindx).p_id := rosetta_g_miss_num_map(a0(indx));
33 t(ddindx).p_new_residual_value := rosetta_g_miss_num_map(a1(indx));
34 ddindx := ddindx+1;
35 if a0.last =indx
36 then exit;
37 end if;
38 indx := a0.next(indx);
39 end loop;
40 end if;
41 end if;
42 end rosetta_table_copy_in_p1;
43 procedure rosetta_table_copy_out_p1(t okl_am_rv_writedown_pvt.assets_tbl_type, a0 out nocopy JTF_NUMBER_TABLE
44 , a1 out nocopy JTF_NUMBER_TABLE
45 ) as
46 ddindx binary_integer; indx binary_integer;
47 begin
48 if t is null or t.count = 0 then
49 a0 := JTF_NUMBER_TABLE();
50 a1 := JTF_NUMBER_TABLE();
51 else
52 a0 := JTF_NUMBER_TABLE();
53 a1 := JTF_NUMBER_TABLE();
54 if t.count > 0 then
55 a0.extend(t.count);
56 a1.extend(t.count);
57 ddindx := t.first;
58 indx := 1;
59 while true loop
60 a0(indx) := rosetta_g_miss_num_map(t(ddindx).p_id);
61 a1(indx) := rosetta_g_miss_num_map(t(ddindx).p_new_residual_value);
62 indx := indx+1;
63 if t.last =ddindx
64 then exit;
65 end if;
66 ddindx := t.next(ddindx);
67 end loop;
68 end if;
69 end if;
70 end rosetta_table_copy_out_p1;
71
72 procedure create_residual_value_trx(p_api_version NUMBER
73 , p_init_msg_list VARCHAR2
74 , x_return_status out nocopy VARCHAR2
75 , x_msg_count out nocopy NUMBER
76 , x_msg_data out nocopy VARCHAR2
77 , p5_a0 JTF_NUMBER_TABLE
78 , p5_a1 JTF_NUMBER_TABLE
79 , x_residual_value_status out nocopy VARCHAR2
80 )
81
82 as
83 ddp_assets_tbl okl_am_rv_writedown_pvt.assets_tbl_type;
84 ddindx binary_integer; indx binary_integer;
85 begin
86
87 -- copy data to the local IN or IN-OUT args, if any
88
89
90
91
92
93 okl_am_rv_writedown_pvt_w.rosetta_table_copy_in_p1(ddp_assets_tbl, p5_a0
94 , p5_a1
95 );
96
97
98 -- here's the delegated call to the old PL/SQL routine
99 okl_am_rv_writedown_pvt.create_residual_value_trx(p_api_version,
100 p_init_msg_list,
101 x_return_status,
102 x_msg_count,
103 x_msg_data,
104 ddp_assets_tbl,
105 x_residual_value_status);
106
107 -- copy data back from the local variables to OUT or IN-OUT args, if any
108
109
110
111
112
113
114 end;
115
116 end okl_am_rv_writedown_pvt_w;