[Home] [Help]
PACKAGE BODY: APPS.IGI_IAC_XLA_EVENTS_PKG
Source
1 PACKAGE BODY IGI_IAC_XLA_EVENTS_PKG as
2 /* $Header: igixlehb.pls 120.5 2011/04/20 11:02:50 schakkin ship $ */
3 --===========================FND_LOG.START=====================================
4
5 g_state_level NUMBER ;
6 g_proc_level NUMBER ;
7 g_event_level NUMBER ;
8 g_excep_level NUMBER ;
9 g_error_level NUMBER ;
10 g_unexp_level NUMBER ;
11 g_path VARCHAR2(1000) ;
12
13 --===========================FND_LOG.END=====================================
14
15
16 FUNCTION create_revaluation_event
17 (p_revaluation_id IN NUMBER,
18 p_event_id IN OUT NOCOPY NUMBER
19 ) return boolean IS
20
21 l_reval_source_info XLA_EVENTS_PUB_PKG.t_event_source_info;
22 l_security_context XLA_EVENTS_PUB_PKG.t_security;
23 l_event_type_code varchar2(30);
24 l_event_date date;
25 l_event_status varchar2(30);
26 l_valuation_method varchar2(30);
27 l_book_type_code varchar2(30);
28 l_revaluation_date date;
29 l_ledger_id gl_sets_of_books.set_of_books_id%TYPE;
30 l_chart_of_accounts_id gl_sets_of_books.chart_of_accounts_id%TYPE;
31 l_currency_code gl_sets_of_books.currency_code%TYPE;
32 l_precision fnd_currencies.precision%TYPE;
33 invalid_ledger exception;
34 l_path_name varchar2(150) := g_path || 'create_revaluation_event';
35
36 BEGIN
37 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
38 p_full_path => l_path_name,
39 p_string => 'create_revaluation_event....Welcome... ');
40
41 select book_type_code,revaluation_date
42 into l_book_type_code,l_revaluation_date
43 from igi_iac_revaluations
44 where revaluation_id =p_revaluation_id;
45
46 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
47 p_full_path => l_path_name,
48 p_string => 'l_book_type_code = ' || l_book_type_code);
49
50 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
51 p_full_path => l_path_name,
52 p_string => 'l_revaluation_date = ' || l_revaluation_date);
53
54 -- Find the set_of_books_id and the currency code
55 IF (igi_iac_common_utils.get_book_gl_info(l_book_type_code
56 ,l_ledger_id
57 ,l_chart_of_accounts_id
58 ,l_currency_code
59 ,l_precision)) THEN
60
61 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
62 p_full_path => l_path_name,
63 p_string => 'GL book info found for ledger_id = '||l_ledger_id);
64 ELSE
65 raise invalid_ledger;
66 END IF;
67
68 l_reval_source_info.application_id := 140; --Assets
69 l_reval_source_info.legal_entity_id := NULL;
70 l_reval_source_info.ledger_id := l_ledger_id;
71 l_reval_source_info.transaction_number := to_char(p_revaluation_id);
72 l_reval_source_info.source_id_int_1 := p_revaluation_id;
73 -- l_reval_source_info.source_id_int_2 := l_book_type_code;
74 l_reval_source_info.source_id_char_1 := l_book_type_code; -- Bug 8624087
75 l_reval_source_info.entity_type_code := 'TRANSACTIONS';
76 l_event_type_code := 'INFLATION_REVALUATION';
77 l_valuation_method := l_book_type_code;
78 l_event_date := l_revaluation_date; -- Bug 8297092
79 l_event_status := XLA_EVENTS_PUB_PKG.C_EVENT_UNPROCESSED;
80
81 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
82 p_full_path => l_path_name,
83 p_string => 'p_revaluation_id = ' || p_revaluation_id);
84
85 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
86 p_full_path => l_path_name,
87 p_string => 'Calling xla create event api.');
88
89 -- Call XLA API
90 p_event_id :=
91 XLA_EVENTS_PUB_PKG.create_event
92 (p_event_source_info => l_reval_source_info,
93 p_event_type_code => l_event_type_code,
94 p_event_date => l_event_date,
95 p_event_status_code => l_event_status,
96 p_event_number => NULL,
97 p_reference_info => NULL,
98 p_valuation_method => l_valuation_method,
99 p_security_context => l_security_context);
100
101 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
102 p_full_path => l_path_name,
103 p_string => 'p_event_id = ' || p_event_id);
104
105 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
106 p_full_path => l_path_name,
107 p_string => 'End of create_revaluation_event');
108
109 return true;
110
111 EXCEPTION
112 WHEN invalid_ledger THEN
113 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
114 p_full_path => l_path_name,
115 p_string => 'GL book info not found for book = '|| l_book_type_code);
116 igi_iac_debug_pkg.debug_unexpected_msg(p_full_path => l_path_name);
117 return FALSE;
118
119 WHEN OTHERS THEN
120 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
121 p_full_path => l_path_name,
122 p_string => 'Fatal Error = '|| sqlerrm);
123 igi_iac_debug_pkg.debug_unexpected_msg(p_full_path => l_path_name);
124 return FALSE;
125 END create_revaluation_event;
126
127
128 FUNCTION update_revaluation_event
129 ( p_revaluation_id IN NUMBER ) return boolean IS
130
131 l_reval_source_info XLA_EVENTS_PUB_PKG.t_event_source_info;
132 l_security_context XLA_EVENTS_PUB_PKG.t_security;
133 l_event_type_code varchar2(30);
134 l_event_date date;
135 l_event_status varchar2(30);
136 l_valuation_method varchar2(30);
137 l_book_type_code varchar2(30);
138 l_revaluation_date date;
139 l_ledger_id gl_sets_of_books.set_of_books_id%TYPE;
140 l_chart_of_accounts_id gl_sets_of_books.chart_of_accounts_id%TYPE;
141 l_currency_code gl_sets_of_books.currency_code%TYPE;
142 l_precision fnd_currencies.precision%TYPE;
143 invalid_ledger exception;
144 l_event_id number;
145 l_path_name varchar2(150) := g_path || 'update_revaluation_event';
146 begin
147
148 select book_type_code,revaluation_date,event_id
149 into l_book_type_code,l_revaluation_date,l_event_id
150 from igi_iac_revaluations
151 where revaluation_id =p_revaluation_id;
152
153 -- Find the set_of_books_id and the currency code
154 IF (igi_iac_common_utils.get_book_gl_info(l_book_type_code
155 ,l_ledger_id
156 ,l_chart_of_accounts_id
157 ,l_currency_code
158 ,l_precision)) THEN
159
160 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
161 p_full_path => l_path_name,
162 p_string => 'GL book info found for ledger_id = '||l_ledger_id);
163 ELSE
164 raise invalid_ledger;
165 END IF;
166
167 l_reval_source_info.application_id := 140; --Assets
168 l_reval_source_info.legal_entity_id := NULL;
169 l_reval_source_info.ledger_id := l_ledger_id;
170 l_reval_source_info.transaction_number := to_char(p_revaluation_id);
171 l_reval_source_info.source_id_int_1 := p_revaluation_id;
172 -- l_reval_source_info.source_id_int_2 := l_book_type_code;
173 l_reval_source_info.source_id_char_1 := l_book_type_code; -- Bug 8624087
174 l_reval_source_info.entity_type_code := 'TRANSACTIONS';
175 l_event_type_code := 'INFLATION_REVALUATION';
176
177 XLA_EVENTS_PUB_PKG.update_event
178 (p_event_source_info => l_reval_source_info,
179 p_event_id => l_event_id,
180 p_event_type_code => l_event_type_code,
181 p_event_date => null, --tbd
182 p_event_status_code => null, --tbd
183 p_valuation_method => l_book_type_code,
184 p_security_context => l_security_context);
185
186 return true;
187
188 EXCEPTION
189 WHEN OTHERS THEN
190 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
191 p_full_path => l_path_name,
192 p_string => 'Fatal Error = '|| sqlerrm);
193 igi_iac_debug_pkg.debug_unexpected_msg(p_full_path => l_path_name);
194 return FALSE;
195
196 end update_revaluation_event;
197
198
199 FUNCTION delete_revaluation_event
200 (p_revaluation_id IN NUMBER) return boolean IS
201
202 l_event_id NUMBER;
203 l_reval_source_info XLA_EVENTS_PUB_PKG.t_event_source_info;
204 l_security_context XLA_EVENTS_PUB_PKG.t_security;
205 l_event_type_code varchar2(30);
206 l_event_date date;
207 l_event_status varchar2(30);
208 l_valuation_method varchar2(30);
209 l_book_type_code varchar2(30);
210 l_revaluation_date date;
211 l_ledger_id gl_sets_of_books.set_of_books_id%TYPE;
212 l_chart_of_accounts_id gl_sets_of_books.chart_of_accounts_id%TYPE;
213 l_currency_code gl_sets_of_books.currency_code%TYPE;
214 l_precision fnd_currencies.precision%TYPE;
215 invalid_ledger exception;
216 l_path_name varchar2(150) := g_path || 'create_revaluation_event';
217
218 BEGIN
219
220 select book_type_code,revaluation_date
221 into l_book_type_code,l_revaluation_date
222 from igi_iac_revaluations
223 where revaluation_id =p_revaluation_id;
224
225 -- Find the set_of_books_id and the currency code
226 IF (igi_iac_common_utils.get_book_gl_info(l_book_type_code
227 ,l_ledger_id
228 ,l_chart_of_accounts_id
229 ,l_currency_code
230 ,l_precision)) THEN
231
232 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
233 p_full_path => l_path_name,
234 p_string => 'GL book info found for ledger_id = '||l_ledger_id);
235 ELSE
236 raise invalid_ledger;
237 END IF;
238
239 l_reval_source_info.application_id := 140; --Assets
240 l_reval_source_info.legal_entity_id := NULL;
241 l_reval_source_info.ledger_id := l_ledger_id;
242 l_reval_source_info.transaction_number := to_char(p_revaluation_id);
243 l_reval_source_info.source_id_int_1 := p_revaluation_id;
244 -- l_reval_source_info.source_id_int_2 := l_book_type_code;
245 l_reval_source_info.source_id_char_1 := l_book_type_code; -- Bug 8624087
246 l_reval_source_info.entity_type_code := 'TRANSACTIONS';
247 l_event_type_code := 'INFLATION_REVALUATION';
248 l_valuation_method := l_valuation_method;
249
250 XLA_EVENTS_PUB_PKG.delete_event
251 (p_event_source_info => l_reval_source_info,
252 p_event_id => l_event_id,
253 p_valuation_method => l_book_type_code,
254 p_security_context => l_security_context);
255
256 return true;
257
258 EXCEPTION
259 WHEN OTHERS THEN
260 igi_iac_debug_pkg.debug_other_string(p_level => g_state_level,
261 p_full_path => l_path_name,
262 p_string => 'Fatal Error = '|| sqlerrm);
263 igi_iac_debug_pkg.debug_unexpected_msg(p_full_path => l_path_name);
264 return FALSE;
265
266 END delete_revaluation_event;
267
268 BEGIN
269 --===========================FND_LOG.START=====================================
270
271 g_state_level := FND_LOG.LEVEL_STATEMENT;
272 g_proc_level := FND_LOG.LEVEL_PROCEDURE;
273 g_event_level := FND_LOG.LEVEL_EVENT;
274 g_excep_level := FND_LOG.LEVEL_EXCEPTION;
275 g_error_level := FND_LOG.LEVEL_ERROR;
276 g_unexp_level := FND_LOG.LEVEL_UNEXPECTED;
277 g_path := 'IGI.PLSQL.igixevtb.igi_iac_xla_events_pkg.';
278
279 --===========================FND_LOG.END=====================================
280
281 END IGI_IAC_XLA_EVENTS_PKG;
282