DBA Data[Home] [Help]

PACKAGE BODY: APPS.AR_CREDIT_MEMO_API_PUB_W

Source


1 package body ar_credit_memo_api_pub_w as
2   /* $Header: ARICMWFB.pls 120.2.12010000.4 2008/09/26 13:33:30 nkanchan ship $ */
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   function rosetta_g_miss_num_map(n number) return number as
7     a number := fnd_api.g_miss_num;
8     b number := 0-1962.0724;
9   begin
10     if n=a then return b; end if;
11     if n=b then return a; end if;
12     return n;
13   end;
14 
15   -- this is to workaround the JDBC bug regarding IN DATE of value GMiss
16   function rosetta_g_miss_date_in_map(d date) return date as
17   begin
18     if d = rosetta_g_mistake_date then return fnd_api.g_miss_date; end if;
19     return d;
20   end;
21 
22   procedure rosetta_table_copy_in_p1(t out nocopy cm_line_tbl_type_cover%type, a0 JTF_NUMBER_TABLE
23     , a1 JTF_NUMBER_TABLE
24     , a2 JTF_NUMBER_TABLE
25     , a3 JTF_NUMBER_TABLE
26     ) as
27     ddindx binary_integer; indx binary_integer;
28   begin
29   if a0 is not null and a0.count > 0 then
30       if a0.count > 0 then
31         indx := a0.first;
32         ddindx := 1;
33         while true loop
34           t(ddindx).customer_trx_line_id := a0(indx);
35           t(ddindx).extended_amount := a1(indx);
36           t(ddindx).quantity_credited := a2(indx);
37           t(ddindx).price := a3(indx);
38           ddindx := ddindx+1;
39           if a0.last =indx
40             then exit;
41           end if;
42           indx := a0.next(indx);
43         end loop;
44       end if;
45    end if;
46   end rosetta_table_copy_in_p1;
47   procedure rosetta_table_copy_out_p1(t cm_line_tbl_type_cover%type, a0 out nocopy JTF_NUMBER_TABLE
48     , a1 out nocopy JTF_NUMBER_TABLE
49     , a2 out nocopy JTF_NUMBER_TABLE
50     , a3 out nocopy JTF_NUMBER_TABLE
51     ) as
52     ddindx binary_integer; indx binary_integer;
53   begin
54   if t is null or t.count = 0 then
55     a0 := JTF_NUMBER_TABLE();
56     a1 := JTF_NUMBER_TABLE();
57     a2 := JTF_NUMBER_TABLE();
58     a3 := JTF_NUMBER_TABLE();
59   else
60       a0 := JTF_NUMBER_TABLE();
61       a1 := JTF_NUMBER_TABLE();
62       a2 := JTF_NUMBER_TABLE();
63       a3 := JTF_NUMBER_TABLE();
64       if t.count > 0 then
65         a0.extend(t.count);
66         a1.extend(t.count);
67         a2.extend(t.count);
68         a3.extend(t.count);
69         ddindx := t.first;
70         indx := 1;
71         while true loop
72           a0(indx) := t(ddindx).customer_trx_line_id;
73           a1(indx) := t(ddindx).extended_amount;
74           a2(indx) := t(ddindx).quantity_credited;
75           a3(indx) := t(ddindx).price;
76           indx := indx+1;
77           if t.last =ddindx
78             then exit;
79           end if;
80           ddindx := t.next(ddindx);
81         end loop;
82       end if;
83    end if;
84   end rosetta_table_copy_out_p1;
85 
86   procedure rosetta_table_copy_in_p4(t out nocopy ar_credit_memo_api_pub.cm_notes_tbl_type_cover, a0 JTF_VARCHAR2_TABLE_300
87     ) as
88     ddindx binary_integer; indx binary_integer;
89   begin
90   if a0 is not null and a0.count > 0 then
91       if a0.count > 0 then
92         indx := a0.first;
93         ddindx := 1;
94         while true loop
95           t(ddindx).notes := a0(indx);
96           ddindx := ddindx+1;
97           if a0.last =indx
98             then exit;
99           end if;
100           indx := a0.next(indx);
101         end loop;
102       end if;
103    end if;
104   end rosetta_table_copy_in_p4;
105   procedure rosetta_table_copy_out_p4(t ar_credit_memo_api_pub.cm_notes_tbl_type_cover, a0 out nocopy JTF_VARCHAR2_TABLE_300
106     ) as
107     ddindx binary_integer; indx binary_integer;
108   begin
109   if t is null or t.count = 0 then
110     a0 := JTF_VARCHAR2_TABLE_300();
111   else
112       a0 := JTF_VARCHAR2_TABLE_300();
113       if t.count > 0 then
114         a0.extend(t.count);
115         ddindx := t.first;
116         indx := 1;
117         while true loop
118           a0(indx) := t(ddindx).notes;
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_p4;
128 
129   procedure rosetta_table_copy_in_p7(t out nocopy ar_credit_memo_api_pub.cm_activity_tbl_type_cover, a0 JTF_DATE_TABLE
130     , a1 JTF_VARCHAR2_TABLE_100
131     , a2 JTF_VARCHAR2_TABLE_100
132     , a3 JTF_VARCHAR2_TABLE_100
133     , a4 JTF_VARCHAR2_TABLE_100
134     ) as
135     ddindx binary_integer; indx binary_integer;
136   begin
137   if a0 is not null and a0.count > 0 then
138       if a0.count > 0 then
139         indx := a0.first;
140         ddindx := 1;
141         while true loop
142           t(ddindx).begin_date := rosetta_g_miss_date_in_map(a0(indx));
143           t(ddindx).activity_name := a1(indx);
144           t(ddindx).status := a2(indx);
145           t(ddindx).result_code := a3(indx);
146           t(ddindx).user := a4(indx);
147           ddindx := ddindx+1;
148           if a0.last =indx
149             then exit;
150           end if;
151           indx := a0.next(indx);
152         end loop;
153       end if;
154    end if;
155   end rosetta_table_copy_in_p7;
156   procedure rosetta_table_copy_out_p7(t ar_credit_memo_api_pub.cm_activity_tbl_type_cover, a0 out nocopy JTF_DATE_TABLE
157     , a1 out nocopy JTF_VARCHAR2_TABLE_100
158     , a2 out nocopy JTF_VARCHAR2_TABLE_100
159     , a3 out nocopy JTF_VARCHAR2_TABLE_100
160     , a4 out nocopy JTF_VARCHAR2_TABLE_100
161     ) as
162     ddindx binary_integer; indx binary_integer;
163   begin
164   if t is null or t.count = 0 then
165     a0 := JTF_DATE_TABLE();
166     a1 := JTF_VARCHAR2_TABLE_100();
167     a2 := JTF_VARCHAR2_TABLE_100();
168     a3 := JTF_VARCHAR2_TABLE_100();
169     a4 := JTF_VARCHAR2_TABLE_100();
170   else
171       a0 := JTF_DATE_TABLE();
172       a1 := JTF_VARCHAR2_TABLE_100();
173       a2 := JTF_VARCHAR2_TABLE_100();
174       a3 := JTF_VARCHAR2_TABLE_100();
175       a4 := JTF_VARCHAR2_TABLE_100();
176       if t.count > 0 then
177         a0.extend(t.count);
178         a1.extend(t.count);
179         a2.extend(t.count);
180         a3.extend(t.count);
181         a4.extend(t.count);
182         ddindx := t.first;
183         indx := 1;
184         while true loop
185           a0(indx) := t(ddindx).begin_date;
186           a1(indx) := t(ddindx).activity_name;
187           a2(indx) := t(ddindx).status;
188           a3(indx) := t(ddindx).result_code;
189           a4(indx) := t(ddindx).user;
190           indx := indx+1;
191           if t.last =ddindx
192             then exit;
193           end if;
194           ddindx := t.next(ddindx);
195         end loop;
196       end if;
197    end if;
198   end rosetta_table_copy_out_p7;
199 
200   procedure create_request(p_api_version  NUMBER
201     , p_init_msg_list  VARCHAR2
202     , p_commit  VARCHAR2
203     , p_validation_level  NUMBER
204     , x_return_status out  nocopy VARCHAR2
205     , x_msg_count out nocopy NUMBER
206     , x_msg_data out nocopy VARCHAR2
207     , p_customer_trx_id  NUMBER
208     , p_line_credit_flag  VARCHAR2
209     , p_line_amount  NUMBER
210     , p_tax_amount  NUMBER
211     , p_freight_amount  NUMBER
212     , p_cm_reason_code  VARCHAR2
213     , p_comments  VARCHAR2
214     , p_orig_trx_number  VARCHAR2
215     , p_tax_ex_cert_num  VARCHAR2
216     , p_request_url  VARCHAR2
217     , p_transaction_url  VARCHAR2
218     , p_trans_act_url  VARCHAR2
219     , p19_a0 JTF_NUMBER_TABLE
220     , p_skip_workflow_flag VARCHAR2
221     , p_credit_method_installments VARCHAR2
222     , p_credit_method_rules VARCHAR2
223     , p_batch_source_name VARCHAR2
224     , p_org_id NUMBER
225     , x_request_id out nocopy VARCHAR2
226     , p19_a1 JTF_NUMBER_TABLE
227     , p19_a2 JTF_NUMBER_TABLE
228     , p19_a3 JTF_NUMBER_TABLE
229     , p_dispute_date DATE
230     , p_internal_comment VARCHAR2
231   )
232   as
233     ddp_cm_line_tbl cm_line_tbl_type_cover%type;
234     ddindx binary_integer; indx binary_integer;
235   begin
236 
237     -- copy data to the local IN or IN-OUT args, if any
238 
239 
240 
241 
242 
243 
244 
245 
246 
247 
248 
249 
250 
251 
252 
253 
254 
255 
256 
257     ar_credit_memo_api_pub_w.rosetta_table_copy_in_p1(ddp_cm_line_tbl, p19_a0
258       , p19_a1
259       , p19_a2
260       , p19_a3
261       );
262 
263 
264     -- here's the delegated call to the old PL/SQL routine
265     ar_credit_memo_api_pub.create_request(p_api_version,
266       p_init_msg_list,
267       p_commit,
268       p_validation_level,
269       x_return_status,
270       x_msg_count,
271       x_msg_data,
272       p_customer_trx_id,
273       p_line_credit_flag,
274       p_line_amount,
275       p_tax_amount,
276       p_freight_amount,
277       p_cm_reason_code,
278       p_comments,
279       p_orig_trx_number,
280       p_tax_ex_cert_num,
281       p_request_url,
282       p_transaction_url,
283       p_trans_act_url,
284       ddp_cm_line_tbl,
285       null,
286       null,
287       null,
288       null,
289       null,
290       x_request_id,
291       null,
292       null,
293       null,
294       null,
295       p_internal_comment
296       );
297 
298     -- copy data back from the local OUT or IN-OUT args, if any
299 
300 
301 
302 
303 
304 
305 
306 
307 
308 
309 
310 
311 
312 
313 
314 
315 
316 
317 
318 
319   end;
320 
321   procedure validate_request_parameters(p_customer_trx_id  NUMBER
322     , p_line_credit_flag  VARCHAR2
323     , p_line_amount  NUMBER
324     , p_tax_amount  NUMBER
325     , p_freight_amount  NUMBER
326     , p_cm_reason_code  VARCHAR2
327     , p_comments  VARCHAR2
328     , p_request_url  VARCHAR2
329     , p_transaction_url  VARCHAR2
330     , p_trans_act_url  VARCHAR2
331     , p10_a0 JTF_NUMBER_TABLE
332     , p_org_id NUMBER
333     , l_val_return_status out nocopy  VARCHAR2
334     , p_skip_workflow_flag VARCHAR2
335     , p_batch_source_name VARCHAR2
336     , p10_a1 JTF_NUMBER_TABLE
337     , p10_a2 JTF_NUMBER_TABLE
338     , p10_a3 JTF_NUMBER_TABLE
339     , p_dispute_date DATE
340   )
341   as
342     ddp_cm_line_tbl cm_line_tbl_type_cover%type;
343     ddindx binary_integer; indx binary_integer;
344   begin
345     -- copy data to the local IN or IN-OUT args, if any
346 
347 
348 
349 
350 
351 
352 
353 
354 
355 
356     ar_credit_memo_api_pub_w.rosetta_table_copy_in_p1(ddp_cm_line_tbl, p10_a0
357       , p10_a1
358       , p10_a2
359       , p10_a3
360       );
361 
362 
363     -- here's the delegated call to the old PL/SQL routine
364     ar_credit_memo_api_pub.validate_request_parameters(p_customer_trx_id,
365       p_line_credit_flag,
366       p_line_amount,
367       p_tax_amount,
368       p_freight_amount,
369       p_cm_reason_code,
370       p_comments,
371       p_request_url,
372       p_transaction_url,
373       p_trans_act_url,
374       ddp_cm_line_tbl,
375       null,
376       l_val_return_status,
377       null);
378 
379     -- copy data back from the local OUT or IN-OUT args, if any
380 
381 
382 
383 
384 
385 
386 
387 
388 
389 
390 
391   end;
392 
393 end ar_credit_memo_api_pub_w;