1 package body okl_rev_loss_prov_pvt_w as
2 /* $Header: OKLERPVB.pls 115.3 2003/01/06 19:32:11 sgiyer 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_rev_loss_prov_pvt.lprv_tbl_type, a0 JTF_VARCHAR2_TABLE_200
23 , a1 JTF_VARCHAR2_TABLE_100
24 , a2 JTF_DATE_TABLE
25 ) as
26 ddindx binary_integer; indx binary_integer;
27 begin
28 if a0 is not null and a0.count > 0 then
29 if a0.count > 0 then
30 indx := a0.first;
31 ddindx := 1;
32 while true loop
33 t(ddindx).cntrct_num := a0(indx);
34 t(ddindx).reversal_type := a1(indx);
35 t(ddindx).reversal_date := rosetta_g_miss_date_in_map(a2(indx));
36 ddindx := ddindx+1;
37 if a0.last =indx
38 then exit;
39 end if;
40 indx := a0.next(indx);
41 end loop;
42 end if;
43 end if;
44 end rosetta_table_copy_in_p1;
45 procedure rosetta_table_copy_out_p1(t okl_rev_loss_prov_pvt.lprv_tbl_type, a0 out nocopy JTF_VARCHAR2_TABLE_200
46 , a1 out nocopy JTF_VARCHAR2_TABLE_100
47 , a2 out nocopy JTF_DATE_TABLE
48 ) as
49 ddindx binary_integer; indx binary_integer;
50 begin
51 if t is null or t.count = 0 then
52 a0 := JTF_VARCHAR2_TABLE_200();
53 a1 := JTF_VARCHAR2_TABLE_100();
54 a2 := JTF_DATE_TABLE();
55 else
56 a0 := JTF_VARCHAR2_TABLE_200();
57 a1 := JTF_VARCHAR2_TABLE_100();
58 a2 := JTF_DATE_TABLE();
59 if t.count > 0 then
60 a0.extend(t.count);
61 a1.extend(t.count);
62 a2.extend(t.count);
63 ddindx := t.first;
64 indx := 1;
65 while true loop
66 a0(indx) := t(ddindx).cntrct_num;
67 a1(indx) := t(ddindx).reversal_type;
68 a2(indx) := t(ddindx).reversal_date;
69 indx := indx+1;
70 if t.last =ddindx
71 then exit;
72 end if;
73 ddindx := t.next(ddindx);
74 end loop;
75 end if;
76 end if;
77 end rosetta_table_copy_out_p1;
78
79 procedure reverse_loss_provisions(p_api_version NUMBER
80 , p_init_msg_list VARCHAR2
81 , x_msg_count out nocopy NUMBER
82 , x_msg_data out nocopy VARCHAR2
83 , x_return_status out nocopy VARCHAR2
84 , p5_a0 VARCHAR2 := fnd_api.g_miss_char
85 , p5_a1 VARCHAR2 := fnd_api.g_miss_char
86 , p5_a2 DATE := fnd_api.g_miss_date
87 )
88
89 as
90 ddp_lprv_rec okl_rev_loss_prov_pvt.lprv_rec_type;
91 ddindx binary_integer; indx binary_integer;
92 begin
93
94 -- copy data to the local IN or IN-OUT args, if any
95
96
97
98
99
100 ddp_lprv_rec.cntrct_num := p5_a0;
101 ddp_lprv_rec.reversal_type := p5_a1;
102 ddp_lprv_rec.reversal_date := rosetta_g_miss_date_in_map(p5_a2);
103
104 -- here's the delegated call to the old PL/SQL routine
105 okl_rev_loss_prov_pvt.reverse_loss_provisions(p_api_version,
106 p_init_msg_list,
107 x_msg_count,
108 x_msg_data,
109 x_return_status,
110 ddp_lprv_rec);
111
112 -- copy data back from the local variables to OUT or IN-OUT args, if any
113
114
115
116
117
118 end;
119
120 procedure reverse_loss_provisions(p_api_version NUMBER
121 , p_init_msg_list VARCHAR2
122 , x_msg_count out nocopy NUMBER
123 , x_msg_data out nocopy VARCHAR2
124 , x_return_status out nocopy VARCHAR2
125 , p5_a0 JTF_VARCHAR2_TABLE_200
126 , p5_a1 JTF_VARCHAR2_TABLE_100
127 , p5_a2 JTF_DATE_TABLE
128 )
129
130 as
131 ddp_lprv_tbl okl_rev_loss_prov_pvt.lprv_tbl_type;
132 ddindx binary_integer; indx binary_integer;
133 begin
134
135 -- copy data to the local IN or IN-OUT args, if any
136
137
138
139
140
141 okl_rev_loss_prov_pvt_w.rosetta_table_copy_in_p1(ddp_lprv_tbl, p5_a0
142 , p5_a1
143 , p5_a2
144 );
145
146 -- here's the delegated call to the old PL/SQL routine
147 okl_rev_loss_prov_pvt.reverse_loss_provisions(p_api_version,
148 p_init_msg_list,
149 x_msg_count,
150 x_msg_data,
151 x_return_status,
152 ddp_lprv_tbl);
153
154 -- copy data back from the local variables to OUT or IN-OUT args, if any
155
156
157
158
159
160 end;
161
162 end okl_rev_loss_prov_pvt_w;