DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_REVERSAL_PVT_W

Source


1 package body okl_reversal_pvt_w as
2   /* $Header: OKLEREVB.pls 120.1 2005/07/11 14:19:56 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_p0(t out nocopy okl_reversal_pvt.source_id_tbl_type, a0 JTF_NUMBER_TABLE) as
23     ddindx binary_integer; indx binary_integer;
24   begin
25   if a0 is not null and a0.count > 0 then
26       if a0.count > 0 then
27         indx := a0.first;
28         ddindx := 1;
29         while true loop
30           t(ddindx) := rosetta_g_miss_num_map(a0(indx));
31           ddindx := ddindx+1;
32           if a0.last =indx
33             then exit;
34           end if;
35           indx := a0.next(indx);
36         end loop;
37       end if;
38    end if;
39   end rosetta_table_copy_in_p0;
40   procedure rosetta_table_copy_out_p0(t okl_reversal_pvt.source_id_tbl_type, a0 out nocopy JTF_NUMBER_TABLE) as
41     ddindx binary_integer; indx binary_integer;
42   begin
43   if t is null or t.count = 0 then
44     a0 := JTF_NUMBER_TABLE();
45   else
46       a0 := JTF_NUMBER_TABLE();
47       if t.count > 0 then
48         a0.extend(t.count);
49         ddindx := t.first;
50         indx := 1;
51         while true loop
52           a0(indx) := rosetta_g_miss_num_map(t(ddindx));
53           indx := indx+1;
54           if t.last =ddindx
55             then exit;
56           end if;
57           ddindx := t.next(ddindx);
58         end loop;
59       end if;
60    end if;
61   end rosetta_table_copy_out_p0;
62 
63   procedure reverse_entries(p_api_version  NUMBER
64     , p_init_msg_list  VARCHAR2
65     , x_return_status out nocopy  VARCHAR2
66     , x_msg_count out nocopy  NUMBER
67     , x_msg_data out nocopy  VARCHAR2
68     , p_source_id  NUMBER
69     , p_source_table  VARCHAR2
70     , p_acct_date  date
71   )
72 
73   as
74     ddp_acct_date date;
75     ddindx binary_integer; indx binary_integer;
76   begin
77 
78     -- copy data to the local IN or IN-OUT args, if any
79 
80 
81 
82 
83 
84 
85 
86     ddp_acct_date := rosetta_g_miss_date_in_map(p_acct_date);
87 
88     -- here's the delegated call to the old PL/SQL routine
89     okl_reversal_pvt.reverse_entries(p_api_version,
90       p_init_msg_list,
91       x_return_status,
92       x_msg_count,
93       x_msg_data,
94       p_source_id,
95       p_source_table,
96       ddp_acct_date);
97 
98     -- copy data back from the local variables to OUT or IN-OUT args, if any
99 
100 
101 
102 
103 
104 
105 
106   end;
107 
108   procedure reverse_entries(p_api_version  NUMBER
109     , p_init_msg_list  VARCHAR2
110     , x_return_status out nocopy  VARCHAR2
111     , x_msg_count out nocopy  NUMBER
112     , x_msg_data out nocopy  VARCHAR2
113     , p_source_table  VARCHAR2
114     , p_acct_date  date
115     , p_source_id_tbl JTF_NUMBER_TABLE
116   )
117 
118   as
119     ddp_acct_date date;
120     ddp_source_id_tbl okl_reversal_pvt.source_id_tbl_type;
121     ddindx binary_integer; indx binary_integer;
122   begin
123 
124     -- copy data to the local IN or IN-OUT args, if any
125 
126 
127 
128 
129 
130 
131     ddp_acct_date := rosetta_g_miss_date_in_map(p_acct_date);
132 
133     okl_reversal_pvt_w.rosetta_table_copy_in_p0(ddp_source_id_tbl, p_source_id_tbl);
134 
135     -- here's the delegated call to the old PL/SQL routine
136     okl_reversal_pvt.reverse_entries(p_api_version,
137       p_init_msg_list,
138       x_return_status,
139       x_msg_count,
140       x_msg_data,
141       p_source_table,
142       ddp_acct_date,
143       ddp_source_id_tbl);
144 
145     -- copy data back from the local variables to OUT or IN-OUT args, if any
146 
147 
148 
149 
150 
151 
152 
153   end;
154 
155 end okl_reversal_pvt_w;