[Home] [Help]
PACKAGE BODY: APPS.PN_INDEX_RENT_PUB
Source
1 PACKAGE BODY PN_INDEX_RENT_PUB AS
2 /* $Header: PNIRPUBB.pls 120.2 2011/05/09 11:35:11 pstawar noship $ */
3
4 g_org_id CONSTANT NUMBER := fnd_profile.VALUE ('ORG_ID');
5
6 -- ========================================================================================
7 --
8 --Name: CREATE_INDEX_RENT
9 --Type: Procedure
10 --Description: This procedure can be used to create a new index rent.
11 --
12 --Called subprograms: PN_INDEX_RENT_PVT.CREATE_INDEX_RENT
13 --
14 --
15 --
16 -- History:
17 -- 03-OCT-2010 kmaddi o Created
18 -- 09-APR-2011 pstawar Interface Repository Annotation
19 -- Standards are incorporated.
20
21 -- Procedure to create a new index rent
22 PROCEDURE CREATE_INDEX_RENT
23 (
24 p_api_version IN NUMBER
25 , p_init_msg_list IN VARCHAR2 DEFAULT FND_API.G_FALSE
26 , p_commit IN VARCHAR2 DEFAULT FND_API.G_FALSE
27 , p_validate IN VARCHAR2 DEFAULT FND_API.G_FALSE
28 , p_rent_index_rec IN OUT NOCOPY PN_INDEX_RENT_PVT.rent_index_rec
29 , p_index_constraint_tbl IN OUT NOCOPY PN_INDEX_RENT_PVT.index_constraint_tbl
30 , x_return_status OUT NOCOPY VARCHAR2
31 , x_msg_count OUT NOCOPY NUMBER
32 , x_msg_data OUT NOCOPY VARCHAR2
33 )
34 AS
35 l_api_version CONSTANT NUMBER := 1.0;
36 l_api_name CONSTANT VARCHAR2 (30) := 'CREATE_INDEX_RENT';
37 l_api_name_full CONSTANT VARCHAR2 (100)
38 := g_pkg_name
39 || '.'
40 || l_api_name;
41 l_func_name CONSTANT VARCHAR2 (100) := 'PN_INDEX_RENT_PUB.CREATE_INDEX_RENT';
42
43
44 BEGIN
45
46
47 -- Standard start of API savepoint
48
49 SAVEPOINT CREATE_INDEX_RENT;
50 -- Initialize API return status to success
51
52 x_return_status := fnd_api.g_ret_sts_success;
53
54 --Added to clear message cache in case of API called with wrong version.
55
56 -- Initialize message list if p_init_msg_list is set to TRUE
57 IF fnd_api.to_boolean (p_init_msg_list)
58 THEN
59 fnd_msg_pub.initialize;
60 END IF;
61
62 -- Standard call to check for call compatibility
63 IF NOT fnd_api.compatible_api_call (l_api_version
64 , p_api_version
65 , l_api_name
66 , g_pkg_name
67 )
68 THEN
69
70 RAISE fnd_api.g_exc_error;
71 END IF;
72
73
74
75 IF p_rent_index_rec.org_id IS NOT NULL AND p_rent_index_rec.org_id<>pn_index_rent_utils.g_pn_miss_num
76 THEN
77 IF p_rent_index_rec.org_id<>fnd_global.org_id
78 THEN
79 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
80 fnd_message.set_token('ERR_MSG', 'Operating unit provided do not exists in the list of Operating Units that are allowed access to, for a responsibility');
81 fnd_msg_pub.ADD;
82 RAISE fnd_api.g_exc_error;
83 END IF;
84 ELSE
85 p_rent_index_rec.org_id:=FND_PROFILE.VALUE('ORG_ID');
86 pn_index_rent_pvt.DEBUG ( l_api_name_full
87 ||' Org Id set to:'||p_rent_index_rec.org_id
88 , 3);
89 END IF;
90
91
92
93
94 /*********************************************/
95 -- Required Parameters Validation starts
96 /*********************************************/
97 -------------------------------------------
98 -- Make sure the Index Lease Number is not null if Auto Index Lease Number is setup to No
99
100 IF (NVL(pn_mo_cache_utils.get_profile_value('PN_AUTOMATIC_INDEX_RENT_NUMBERING', g_org_id), 'N')) <> 'Y'
101 THEN
102 IF ( p_rent_index_rec .index_lease_number IS NULL OR p_rent_index_rec .index_lease_number = pn_index_rent_utils.g_pn_miss_char)
103 THEN
104 l_null_param := 'INDEX_LEASE_NUMBER';
105 pn_index_rent_pvt.debug (l_func_name ||': INDEX_LEASE_NUMBER IS NULL',3);
106 fnd_message.set_name ('PN', 'PN_API_ALL_NULL_PARAMETER');
107 fnd_message.set_token ('API_NAME', l_api_name_full);
108 fnd_message.set_token ('NULL_PARAM',l_null_param );
109 fnd_msg_pub.ADD;
110 RAISE fnd_api.g_exc_error;
111 END IF;
112 END IF;
113
114 ---------------------------------------------------------------
115 -- Make sure the Lease id or Lease ID or Lease Num is not null
116 ---------------------------------------------------------------
117 IF (p_rent_index_rec .lease_id IS NULL
118 OR p_rent_index_rec.lease_id = pn_index_rent_utils.g_pn_miss_num
119 )
120 AND (p_rent_index_rec .lease_num IS NULL
121 OR p_rent_index_rec.lease_num = pn_index_rent_utils.g_pn_miss_char
122 )
123
124 THEN
125 l_null_param := 'LEASE_NUM , LEASE_ID';
126 pn_index_rent_pvt.debug (l_func_name||': LEASE_NUM , LEASE_ID ARE NULL',3);
127 fnd_message.set_name ('PN', 'PN_API_ALL_NULL_PARAMETER');
128 fnd_message.set_token ('API_NAME', l_api_name_full);
129 fnd_message.set_token ('NULL_PARAM', l_null_param);
130 fnd_msg_pub.ADD;
131 RAISE fnd_api.g_exc_error;
132 END IF;
133
134
135 ---------------------------------------------------
136 -- Make sure the Index Type or Index id is not null
137 ---------------------------------------------------
138 IF ( (p_rent_index_rec .index_id IS NULL OR p_rent_index_rec .index_id = pn_index_rent_utils.g_pn_miss_num)
139 AND (p_rent_index_rec .index_type IS NULL OR p_rent_index_rec.index_type = pn_index_rent_utils.g_pn_miss_char)
140 )
141 THEN
142 l_null_param := 'INDEX_ID , INDEX_TYPE';
143 pn_index_rent_pvt.debug (l_func_name||': INDEX_ID , INDEX_TYPE ARE NULL',3);
144 fnd_message.set_name ('PN', 'PN_API_ALL_NULL_PARAMETER');
145 fnd_message.set_token ('API_NAME', l_api_name_full);
146 fnd_message.set_token ('NULL_PARAM', l_null_param);
147 fnd_msg_pub.ADD;
148 RAISE fnd_api.g_exc_error;
149 END IF;
150
151 -----------------------------------------------------------------------------
152 -- Make sure the Increase on or Increase on meaning or Gross flag is not null
153 -- ---------------------------------------------------------------------------
154 IF ( (p_rent_index_rec .increase_on IS NULL OR p_rent_index_rec.increase_on = pn_index_rent_utils.g_pn_miss_char)
155 AND (p_rent_index_rec .increase_on_meaning IS NULL OR p_rent_index_rec.increase_on_meaning = pn_index_rent_utils.g_pn_miss_char)
156 AND (p_rent_index_rec .gross_flag IS NULL OR p_rent_index_rec.gross_flag = pn_index_rent_utils.g_pn_miss_char)
157 )
158 THEN
159 l_null_param := 'INCREASE_ON , INCREASE_ON_MEANING , GROSS_FLAG';
160 pn_index_rent_pvt.debug (l_func_name||': INCREASE_ON , INCREASE_ON_MEANING , GROSS_FLAG ARE NULL',3);
161 fnd_message.set_name ('PN', 'PN_API_ALL_NULL_PARAMETER');
162 fnd_message.set_token ('API_NAME', l_api_name_full);
163 fnd_message.set_token ('NULL_PARAM',l_null_param);
164 fnd_msg_pub.ADD;
165 RAISE fnd_api.g_exc_error;
166 END IF;
167
168
169 -------------------------------------------------------------------------------------------------
170 -- Make sure RELATIONSHIP_DEFAULT,RELATIONSHIP_DEFAULT_MEANING,BASIS_PERCENT_DEFAULT,BASE_YEAR,BASE_INDEX ARE NOT NULL
171 ------------------------------------------------------------------------------------------------
172 IF ( (p_rent_index_rec .relationship_default IS NULL OR p_rent_index_rec .relationship_default = pn_index_rent_utils.g_pn_miss_char)
173 AND (p_rent_index_rec .relationship_default_meaning IS NULL OR p_rent_index_rec .relationship_default_meaning = pn_index_rent_utils.g_pn_miss_char)
174 )
175 AND
176 (p_rent_index_rec .basis_percent_default IS NULL OR p_rent_index_rec .basis_percent_default = pn_index_rent_utils.g_pn_miss_num )
177 AND
178 (p_rent_index_rec .base_year IS NULL OR p_rent_index_rec .base_year = pn_index_rent_utils.g_pn_miss_date )
179 AND
180 (p_rent_index_rec .base_index IS NULL OR p_rent_index_rec .base_index = pn_index_rent_utils.g_pn_miss_num )
181 THEN
182 l_null_param := 'RELATIONSHIP_DEFAULT, RELATIONSHIP_DEFAULT_MEANING, BASIS_PERCENT_DEFAULT, BASE_YEAR, BASE_INDEX';
183 pn_index_rent_pvt.debug (l_func_name||': RELATIONSHIP_DEFAULT,RELATIONSHIP_DEFAULT_MEANING,BASIS_PERCENT_DEFAULT,BASE_YEAR,BASE_INDEX ARE NULL',3);
184 fnd_message.set_name ('PN', 'PN_API_ALL_NULL_PARAMETER');
185 fnd_message.set_token ('API_NAME', l_api_name_full);
186 fnd_message.set_token ('NULL_PARAM', l_null_param);
187 fnd_msg_pub.ADD;
188 RAISE fnd_api.g_exc_error;
189 END IF;
190 /*********************************************/
191 -- Required Parameters Validation Ends
192 /*********************************************/
193 --- Verifying whether the CREATE INDEX RENT program unit exists or not.
194 IF fnd_function.TEST (function_name => l_func_name)
195 THEN
196 l_func_exists := 'Y';
197 END IF;
198
199 IF l_func_exists <> 'Y'
200 THEN
201 fnd_message.set_name ('PN'
202 , 'PN_FUNCTION_SECURITY'
203 );
204 fnd_msg_pub.ADD;
205 RAISE fnd_api.g_exc_error;
206 END IF;
207
208 /*********************************************
209 -- Calling private procedure create index rent
210 /********************************************/
211 PN_INDEX_RENT_PVT.CREATE_INDEX_RENT
212 ( p_api_version => p_api_version
213 , p_init_msg_list => p_init_msg_list
214 , p_commit => p_commit
215 , p_validate => p_validate
216 , p_rent_index_rec => p_rent_index_rec
217 , p_index_constraint_tbl => p_index_constraint_tbl
218 , x_return_status => x_return_status
219 , x_msg_count => x_msg_count
220 , x_msg_data => x_msg_data
221 );
222 -- Standard check of p_commit
223 IF fnd_api.to_boolean (p_commit)
224 THEN
225 COMMIT WORK;
226 END IF;
227
228 fnd_msg_pub.Count_And_Get
229 ( p_encoded => fnd_api.g_false
230 ,p_count => x_msg_count
231 ,p_data => x_msg_data
232 );
233
234 EXCEPTION
235 WHEN fnd_api.g_exc_error
236 THEN
237 x_return_status := fnd_api.g_ret_sts_error;
238
239 fnd_msg_pub.count_and_get (p_encoded => fnd_api.g_false
240 , p_count => x_msg_count
241 , p_data => x_msg_data
242 );
243 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Create_Index_Rent Exception : '
244 || SQLERRM
245 , 3
246 );
247 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Create_Index_Rent Return Status : '
248 || x_return_status
249 , 3
250 );
251 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Create_Index_Rent No of Error Messages : '
252 || x_msg_count
253 , 3
254 );
255
256 WHEN fnd_api.g_exc_unexpected_error
257 THEN
258 x_return_status := fnd_api.g_ret_sts_unexp_error;
259 fnd_msg_pub.count_and_get (p_encoded => fnd_api.g_false
260 , p_count => x_msg_count
261 , p_data => x_msg_data
262 );
263 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Create_Index_Rent Unexpected Exception : '
264 || SQLERRM
265 , 3
266 );
267 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Create_Index_Rent Return Status : '
268 || x_return_status
269 , 3
270 );
271 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Create_Index_Rent No of Error Messages : '
272 || x_msg_count
273 , 3
274 );
275
276 WHEN OTHERS
277 THEN
278 x_return_status := fnd_api.g_ret_sts_unexp_error;
279 fnd_msg_pub.count_and_get (p_encoded => fnd_api.g_false
280 , p_count => x_msg_count
281 , p_data => x_msg_data
282 );
283 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Create_Index_Rent Others Exception : '
284 || SQLERRM
285 , 3
286 );
287
288 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Create_Index_Rent Return Status : '
289 || x_return_status
290 , 3
291 );
292 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Create_Index_Rent No of Error Messages : '
293 || x_msg_count
294 , 3
295 );
296
297
298 END CREATE_INDEX_RENT;
299
300 -- ========================================================================================
301 --
302 --Name: UPDATE_INDEX_RENT
303 --Type: Procedure
304 --Description: This procedure can be used to update a index rent.
305 --
306 --Called subprograms: PN_INDEX_RENT_PVT.UPDATE_INDEX_RENT
307 --
308 --
309 --
310 -- History:
311 -- 03-OCT-2010 kmaddi o Created
312 -- 09-APR-2011 pstawar Interface Repository Annotation
313 -- Standards are incorporated.
314
315 -- Procedure to update a index rent
316 PROCEDURE UPDATE_INDEX_RENT(
317 p_api_version IN NUMBER
318 , p_init_msg_list IN VARCHAR2 := fnd_api.g_false
319 , p_commit IN VARCHAR2 := fnd_api.g_false
320 , p_validate IN VARCHAR2 := fnd_api.g_false
321 , p_rent_index_rec IN OUT NOCOPY PN_INDEX_RENT_PVT.rent_index_rec
322 , p_index_constraint_tbl IN OUT NOCOPY PN_INDEX_RENT_PVT.index_constraint_tbl
323 , x_return_status OUT NOCOPY VARCHAR2
324 , x_msg_count OUT NOCOPY NUMBER
325 , x_msg_data OUT NOCOPY VARCHAR2
326 )
327 AS
328 l_api_version CONSTANT NUMBER := 1.0;
329 l_api_name CONSTANT VARCHAR2 (30) := 'UPDATE_INDEX_RENT';
330 l_api_name_full CONSTANT VARCHAR2 (61)
331 := g_pkg_name
332 || '.'
333 || l_api_name;
334 l_func_name CONSTANT VARCHAR2 (100) := 'PN_INDEX_RENT_PVT.UPDATE_INDEX_RENT';
335
336 BEGIN
337 -- Standard start of API savepoint
341
338 SAVEPOINT UPDATE_INDEX_RENT;
339
340 --Added to clear message cache in case of API call wrong version.
342 -- Initialize message list if p_init_msg_list is set to TRUE
343 IF fnd_api.to_boolean (p_init_msg_list)
344 THEN
345 fnd_msg_pub.initialize;
346 END IF;
347
348 -- Standard call to check for call compatibility
349 IF NOT fnd_api.compatible_api_call (l_api_version
350 , p_api_version
351 , l_api_name
352 , g_pkg_name
353 )
354 THEN
355 RAISE fnd_api.g_exc_error;
356 END IF;
357
358 -- Initialize API return status to success
359 x_return_status := fnd_api.g_ret_sts_success;
360
361 IF p_rent_index_rec.org_id IS NOT NULL AND p_rent_index_rec.org_id<>pn_index_rent_utils.g_pn_miss_num
362 THEN
363 IF p_rent_index_rec.org_id<>fnd_global.org_id
364 THEN
365 fnd_message.set_name('PN','PN_OTHERS_EXCEPTION');
366 fnd_message.set_token('ERR_MSG', 'Operating unit provided do not exists in the list of Operating Units that are allowed access to, for a responsibility');
367 fnd_msg_pub.ADD;
368 RAISE fnd_api.g_exc_error;
369 END IF;
370 ELSE
371 p_rent_index_rec.org_id:=FND_PROFILE.VALUE('ORG_ID');
372 pn_index_rent_pvt.DEBUG ( l_api_name_full
373 ||' Org Id set to:'||p_rent_index_rec.org_id
374 , 3);
375 END IF;
376
377
378 -- -------------------------------------------
379 -- Make sure the Index lease id or Index lease number is not null in index rent record
380 -- -------------------------------------------
381 IF ( (p_rent_index_rec .index_lease_id IS NULL OR p_rent_index_rec .index_lease_id = pn_index_rent_utils.g_pn_miss_num)
382 AND (p_rent_index_rec .index_lease_number IS NULL OR p_rent_index_rec .index_lease_number = pn_index_rent_utils.g_pn_miss_char)
383 )
384 THEN
385 l_null_param := 'INDEX_LEASE_NUMBER';
386 pn_index_rent_pvt.debug (l_func_name||': INDEX_LEASE_ID , INDEX_LEASE_NUMBER ARE NULL',3);
387 fnd_message.set_name ('PN', 'PN_API_ALL_NULL_PARAMETER');
388 fnd_message.set_token ('API_NAME', l_api_name_full);
389 fnd_message.set_token ('NULL_PARAM', l_null_param);
390 fnd_msg_pub.ADD;
391 RAISE fnd_api.g_exc_error;
392 END IF;
393
394 /*
395 --------------------------------------------------------------------------------
396 -- Make sure the Index constraint id is not null if constraint has to be updated
397 -----------------------------------------------------------------------------------
398 IF p_index_constraint_tbl.count > 0 AND p_index_constraint_tbl.COUNT<3
399 THEN
400 FOR i IN 1 .. p_index_constraint_tbl.COUNT
401 LOOP
402 IF ( p_index_constraint_tbl(i).index_constraint_id IS NULL
403 OR
404 p_index_constraint_tbl(i).index_constraint_id = pn_index_rent_utils.g_pn_miss_num
405 )
406 THEN
407 l_null_param := 'INDEX_CONSTRAINT_ID';
408 pn_index_rent_pvt.debug (l_func_name||': INDEX_CONSTRAINT_ID FOR RECORD ('||i||') IS NULL',3);
409 fnd_message.set_name ('PN', 'PN_API_ALL_NULL_PARAMETER');
410 fnd_message.set_token ('API_NAME', l_api_name_full);
411 fnd_message.set_token ('NULL_PARAM', l_null_param);
412 fnd_msg_pub.ADD;
413 RAISE fnd_api.g_exc_error;
414 END IF;
415 END LOOP;
416 END IF;*/
417 /***********************************************************
418 Verifying whether the UPDATE INDEX RENT exists or not.
419 ************************************************************/
420 IF fnd_function.TEST (function_name => l_func_name)
421 THEN
422 l_func_exists := 'Y';
423 END IF;
424
425 IF l_func_exists <> 'Y'
426 THEN
427 fnd_message.set_name ('PN'
428 , 'PN_FUNCTION_SECURITY'
429 );
430 fnd_msg_pub.ADD;
431 RAISE fnd_api.g_exc_error;
432 END IF;
433
434 PN_INDEX_RENT_PVT.UPDATE_INDEX_RENT
435 (p_api_version => p_api_version
436 , p_init_msg_list => p_init_msg_list
437 , p_commit => p_commit
438 , p_validate => p_validate
439 , p_rent_index_rec => p_rent_index_rec
440 , p_index_constraint_tbl => p_index_constraint_tbl
441 , x_return_status => x_return_status
442 , x_msg_count => x_msg_count
443 , x_msg_data => x_msg_data
444 );
445
446 -- Standard check of p_commit
447 IF fnd_api.to_boolean (p_commit)
448 THEN
449 COMMIT WORK;
450 END IF;
451
452 fnd_msg_pub.count_and_get (p_encoded => fnd_api.g_false
453 , p_count => x_msg_count
454 , p_data => x_msg_data
455 );
456
457 EXCEPTION
458 WHEN fnd_api.g_exc_error
459 THEN
460 x_return_status := fnd_api.g_ret_sts_error;
461 fnd_msg_pub.count_and_get (p_encoded => fnd_api.g_false
462 , p_count => x_msg_count
463 , p_data => x_msg_data
464 );
465 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Update_Index_Rent Exception : '
466 || SQLERRM
467 , 3
468 );
469 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Update_Index_Rent Return Status : '
470 || x_return_status
471 , 3
472 );
473 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Update_Index_Rent No of Error Messages : '
474 || x_msg_count
475 , 3
476 );
477
478 WHEN fnd_api.g_exc_unexpected_error
479 THEN
480 x_return_status := fnd_api.g_ret_sts_unexp_error;
481 fnd_msg_pub.count_and_get (p_encoded => fnd_api.g_false
482 , p_count => x_msg_count
483 , p_data => x_msg_data
484 );
485 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Update_Index_Rent Unexpected Exception : '
486 || SQLERRM
487 , 3
488 );
489 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Update_Index_Rent Return Status : '
490 || x_return_status
491 , 3
492 );
493 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Update_Index_Rent No of Error Messages : '
494 || x_msg_count
495 , 3
496 );
497 WHEN OTHERS
498 THEN
499 x_return_status := fnd_api.g_ret_sts_unexp_error;
500 fnd_msg_pub.count_and_get (p_encoded => fnd_api.g_false
501 , p_count => x_msg_count
502 , p_data => x_msg_data
503 );
504 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Update_Index_Rent Others Exception : '
505 || SQLERRM
506 , 3
507 );
508 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Update_Index_Rent Return Status : '
509 || x_return_status
510 , 3
511 );
512 pn_index_rent_pvt.debug ( 'PN_INDEX_RENT_PUB: Update_Index_Rent No of Error Messages : '
513 || x_msg_count
514 , 3
515 );
516
517 END UPDATE_INDEX_RENT;
518
519 END PN_INDEX_RENT_PUB;
520