[Home] [Help]
PACKAGE BODY: APPS.OKL_EXECUTE_FORMULA_PVT_W
Source
1 package body okl_execute_formula_pvt_w as
2 /* $Header: OKLEFMLB.pls 120.1 2005/07/11 12:49:41 dkagrawa 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_p23(t out nocopy okl_execute_formula_pvt.operand_val_tbl_type, a0 JTF_NUMBER_TABLE
23 , a1 JTF_VARCHAR2_TABLE_800
24 , a2 JTF_VARCHAR2_TABLE_300
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).id := rosetta_g_miss_num_map(a0(indx));
34 t(ddindx).label := a1(indx);
35 t(ddindx).value := 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_p23;
45 procedure rosetta_table_copy_out_p23(t okl_execute_formula_pvt.operand_val_tbl_type, a0 out nocopy JTF_NUMBER_TABLE
46 , a1 out nocopy JTF_VARCHAR2_TABLE_800
47 , a2 out nocopy JTF_VARCHAR2_TABLE_300
48 ) as
49 ddindx binary_integer; indx binary_integer;
50 begin
51 if t is null or t.count = 0 then
52 a0 := JTF_NUMBER_TABLE();
53 a1 := JTF_VARCHAR2_TABLE_800();
54 a2 := JTF_VARCHAR2_TABLE_300();
55 else
56 a0 := JTF_NUMBER_TABLE();
57 a1 := JTF_VARCHAR2_TABLE_800();
58 a2 := JTF_VARCHAR2_TABLE_300();
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) := rosetta_g_miss_num_map(t(ddindx).id);
67 a1(indx) := t(ddindx).label;
68 a2(indx) := t(ddindx).value;
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_p23;
78
79 procedure rosetta_table_copy_in_p25(t out nocopy okl_execute_formula_pvt.ctxt_val_tbl_type, a0 JTF_VARCHAR2_TABLE_200
80 , a1 JTF_VARCHAR2_TABLE_300
81 ) as
82 ddindx binary_integer; indx binary_integer;
83 begin
84 if a0 is not null and a0.count > 0 then
85 if a0.count > 0 then
86 indx := a0.first;
87 ddindx := 1;
88 while true loop
89 t(ddindx).name := a0(indx);
90 t(ddindx).value := a1(indx);
91 ddindx := ddindx+1;
92 if a0.last =indx
93 then exit;
94 end if;
95 indx := a0.next(indx);
96 end loop;
97 end if;
98 end if;
99 end rosetta_table_copy_in_p25;
100 procedure rosetta_table_copy_out_p25(t okl_execute_formula_pvt.ctxt_val_tbl_type, a0 out nocopy JTF_VARCHAR2_TABLE_200
101 , a1 out nocopy JTF_VARCHAR2_TABLE_300
102 ) as
103 ddindx binary_integer; indx binary_integer;
104 begin
105 if t is null or t.count = 0 then
106 a0 := JTF_VARCHAR2_TABLE_200();
107 a1 := JTF_VARCHAR2_TABLE_300();
108 else
109 a0 := JTF_VARCHAR2_TABLE_200();
110 a1 := JTF_VARCHAR2_TABLE_300();
111 if t.count > 0 then
112 a0.extend(t.count);
113 a1.extend(t.count);
114 ddindx := t.first;
115 indx := 1;
116 while true loop
117 a0(indx) := t(ddindx).name;
118 a1(indx) := t(ddindx).value;
119 indx := indx+1;
120 if t.last =ddindx
121 then exit;
122 end if;
123 ddindx := t.next(ddindx);
124 end loop;
125 end if;
126 end if;
127 end rosetta_table_copy_out_p25;
128
129 procedure execute(p_api_version NUMBER
130 , p_init_msg_list VARCHAR2
131 , x_return_status out nocopy VARCHAR2
132 , x_msg_count out nocopy NUMBER
133 , x_msg_data out nocopy VARCHAR2
134 , p_formula_name VARCHAR2
135 , p_contract_id NUMBER
136 , p_line_id NUMBER
137 , p8_a0 JTF_VARCHAR2_TABLE_200
138 , p8_a1 JTF_VARCHAR2_TABLE_300
139 , x_value out nocopy NUMBER
140 )
141
142 as
143 ddp_additional_parameters okl_execute_formula_pvt.ctxt_val_tbl_type;
144 ddindx binary_integer; indx binary_integer;
145 begin
146
147 -- copy data to the local IN or IN-OUT args, if any
148
149
150
151
152
153
154
155
156 okl_execute_formula_pvt_w.rosetta_table_copy_in_p25(ddp_additional_parameters, p8_a0
157 , p8_a1
158 );
159
160
161 -- here's the delegated call to the old PL/SQL routine
162 okl_execute_formula_pvt.execute(p_api_version,
163 p_init_msg_list,
164 x_return_status,
165 x_msg_count,
166 x_msg_data,
167 p_formula_name,
168 p_contract_id,
169 p_line_id,
170 ddp_additional_parameters,
171 x_value);
172
173 -- copy data back from the local variables to OUT or IN-OUT args, if any
174
175
176
177
178
179
180
181
182
183 end;
184
185 procedure execute(p_api_version NUMBER
186 , p_init_msg_list VARCHAR2
187 , x_return_status out nocopy VARCHAR2
188 , x_msg_count out nocopy NUMBER
189 , x_msg_data out nocopy VARCHAR2
190 , p_formula_name VARCHAR2
191 , p_contract_id NUMBER
192 , p_line_id NUMBER
193 , p8_a0 JTF_VARCHAR2_TABLE_200
194 , p8_a1 JTF_VARCHAR2_TABLE_300
195 , p9_a0 out nocopy JTF_NUMBER_TABLE
196 , p9_a1 out nocopy JTF_VARCHAR2_TABLE_800
197 , p9_a2 out nocopy JTF_VARCHAR2_TABLE_300
198 , x_value out nocopy NUMBER
199 )
200
201 as
202 ddp_additional_parameters okl_execute_formula_pvt.ctxt_val_tbl_type;
203 ddx_operand_val_tbl okl_execute_formula_pvt.operand_val_tbl_type;
204 ddindx binary_integer; indx binary_integer;
205 begin
206
207 -- copy data to the local IN or IN-OUT args, if any
208
209
210
211
212
213
214
215
216 okl_execute_formula_pvt_w.rosetta_table_copy_in_p25(ddp_additional_parameters, p8_a0
217 , p8_a1
218 );
219
220
221
222 -- here's the delegated call to the old PL/SQL routine
223 okl_execute_formula_pvt.execute(p_api_version,
224 p_init_msg_list,
225 x_return_status,
226 x_msg_count,
227 x_msg_data,
228 p_formula_name,
229 p_contract_id,
230 p_line_id,
231 ddp_additional_parameters,
232 ddx_operand_val_tbl,
233 x_value);
234
235 -- copy data back from the local variables to OUT or IN-OUT args, if any
236
237
238
239
240
241
242
243
244
245 okl_execute_formula_pvt_w.rosetta_table_copy_out_p23(ddx_operand_val_tbl, p9_a0
246 , p9_a1
247 , p9_a2
248 );
249
250 end;
251
252 end okl_execute_formula_pvt_w;