DBA Data[Home] [Help]

PACKAGE BODY: APPS.PN_VAR_RENT_PUB

Source


1 PACKAGE BODY pn_var_rent_pub AS
2 /* $Header: PNVARPUB.pls 120.2 2011/05/09 11:33:29 pstawar noship $ */
3 ------------PACKAGE GLOBAL to be used during updates ---------------------------
4  /*
5    -- Package constant g_pkg_name used for package name validation.
6    -- Package constant pg_debug used for debug mode validation.
7    -- Package constant g_org_id used for organization id validation.
8    -- Package constant g_success used for success validation.
9    -- Package constant g_warning used for warning validation.
10    -- Package constant g_error used for error validation.
11    -- Package constant g_fun_name used for function name validation.
12    -- Package constant g_func_exists used for function existance validation.
13 
14    */
15    g_pkg_name           CONSTANT VARCHAR2 (30) := 'PN_Var_Rent_PUB';
16    pg_debug                      VARCHAR2 (1) := NVL (fnd_profile.VALUE ('PN_DEBUG_MODE')
17                                                     , 'N'
18                                                      );
19    g_org_id             CONSTANT NUMBER := fnd_profile.VALUE ('ORG_ID');
20    g_success            CONSTANT NUMBER := 0;
21    g_warning            CONSTANT NUMBER := 1;
22    g_error              CONSTANT NUMBER := 2;
23    g_fun_name           CONSTANT VARCHAR2 (11) := 'PN_PNXVAREN';
24    g_func_exists                 VARCHAR2 (1);
25 
26 -- ========================================================================================
27 --
28 --Name:               create_var_rent
29 --Type:                 Procedure
30 --Description:  This procedure can be used to create a new variable rent.
31 --
32 --Called subprograms:  pn_varen_pvt.create_var_rent
33 --
34 --
35 -- History:
36 -- 20-SEP-2010   vkatta   o Created
37 -- 11-OCT-2010   vkatta   o Update Variable Rent
38 -- 09-APR-2011   pstawar   Interface Repository Annotation
39 --                          Standards are incorporated.
40 
41 
42    PROCEDURE create_var_rent (
43       p_api_version              IN       NUMBER
44     , p_init_msg_list            IN       VARCHAR2 DEFAULT fnd_api.g_false
45     , p_commit                   IN       VARCHAR2 DEFAULT fnd_api.g_false
46     , p_validate_flag            IN       VARCHAR2 DEFAULT 'N'
47     , p_var_rent_rec             IN OUT NOCOPY pn_varen_pvt.var_rent_rec_type
48     , p_variable_rent_lines_tbl  IN OUT NOCOPY pn_varen_pvt.variable_rent_lines_tbl_type
49     , p_breakpoint_header_tbl    IN OUT NOCOPY pn_varen_pvt.breakpoint_header_tbl_type
50     , p_breakpoint_details_tbl   IN OUT NOCOPY pn_varen_pvt.breakpoint_details_tbl_type
51     , p_constraints_tbl          IN OUT NOCOPY pn_varen_pvt.constraints_tbl_type
52     , p_allow_abat_tbl           IN OUT NOCOPY pn_varen_pvt.allow_abat_tbl_type
53     , p_generate_periods         IN       VARCHAR2 DEFAULT 'N'
54     , p_generate_breakpoints     IN       VARCHAR2 DEFAULT 'N'
55     , p_generate_constraints     IN       VARCHAR2 DEFAULT 'N'
56     , x_return_status            OUT NOCOPY VARCHAR2
57     , x_msg_count                OUT NOCOPY NUMBER
58     , x_msg_data                 OUT NOCOPY VARCHAR2
59     , x_var_rent_id              OUT NOCOPY NUMBER
60     , x_var_rent_num             OUT NOCOPY VARCHAR2
61    )
62    IS
63       l_api_name           CONSTANT VARCHAR2 (30) := 'Create_Var_Rent';
64       l_api_version        CONSTANT NUMBER := 1.0;
65       l_api_name_full      CONSTANT VARCHAR2 (61) :=    g_pkg_name
66                                                      || '.'
67                                                      || l_api_name;
68       l_org_return_status           VARCHAR2 (1);
69       l_org_id                      NUMBER;
70       l_var_rent_rec                pn_varen_pvt.var_rent_rec_type := p_var_rent_rec;
71    BEGIN
72 --      NUll;
73  x_return_status   := fnd_api.g_ret_sts_success;
74 -- Standard Start of API savepoint
75       pn_varen_util.pvt_debug (   l_api_name_full
76                                || ' - Starting API'
77                              , 3
78                               );
79       SAVEPOINT create_var_rent;
80 
81       -- Initialize message list if p_init_msg_list is set to TRUE
82       IF fnd_api.to_boolean (p_init_msg_list)
83       THEN
84          fnd_msg_pub.initialize;
85       END IF;
86 
87       -- Standard call to check for call compatibility.
88       IF NOT fnd_api.compatible_api_call (l_api_version
89                                         , p_api_version
90                                         , l_api_name
91                                         , g_pkg_name
92                                          )
93       THEN
94          RAISE fnd_api.g_exc_error;
95       END IF;
96 
97     -- Actions performed using the APIs would be subject to
98     -- function security. If the responsibility does not allow
99     -- such functions to be executed, the API should not proceed further
100     -- since the user does not have access to such functions
101 
102       IF NVL (mo_global.check_valid_org (g_org_id)
103             , 'N'
104              ) <> 'Y'
105       THEN
106          fnd_message.set_name ('MO'
107                              , 'MO_ORG_INVALID'
108                               );
109          fnd_msg_pub.ADD;
110          RAISE fnd_api.g_exc_error;
111       END IF;
112 
113       --- Verifying whether the VRA from exists or not.
114       IF fnd_function.TEST (function_name                 => g_fun_name)
115       THEN
116          g_func_exists                                                                := 'Y';
117       END IF;
118 
119       IF g_func_exists <> 'Y'
120       THEN
121          fnd_message.set_name ('PN'
122                              , 'PN_FUNCTION_SECURITY'
123                               );
124          fnd_msg_pub.ADD;
125          RAISE fnd_api.g_exc_error;
126       END IF;
127 
128       --  Initialize API return status to success
129 --      x_return_status        := fnd_api.g_ret_sts_success;
130       l_org_return_status                                                          := fnd_api.g_ret_sts_success;
131       pn_varen_util.pvt_debug (   l_api_name_full
132                                || ' : '
133                                || 'l_org_return_status  '
134                                || l_org_return_status
135                              , 3
136                               );
137 
138       IF (    l_org_return_status <> fnd_api.g_ret_sts_success
139           AND g_func_exists = 'Y')
140       THEN
141          x_return_status                                                              := fnd_api.g_ret_sts_error;
142       ELSE
143          pn_varen_util.pvt_debug (   l_api_name_full
144                                   || ' : '
145                                   || 'Before calling pn_varen_pvt.create_var_rent package - l_org_return_status  '
146                                   || l_org_return_status
147                                 , 3
148                                  );
149          --pn_varen_util.pvt_debug ('Public : pn_varen_pvt.create_var_rent', 3);
150          pn_varen_pvt.create_var_rent (p_api_version                 => 1.0
151                                      , p_init_msg_list               => p_init_msg_list
152                                      , p_commit                      => p_commit
153                                      , p_validate_flag               => p_validate_flag
154                                      , p_var_rent_rec                => l_var_rent_rec
155                                      , p_variable_rent_lines_tbl     => p_variable_rent_lines_tbl
156                                      , p_breakpoint_header_tbl       => p_breakpoint_header_tbl
157                                      , p_breakpoint_details_tbl      => p_breakpoint_details_tbl
158                                      , p_constraints_tbl             => p_constraints_tbl
159                                      , p_allow_abat_tbl              => p_allow_abat_tbl
160                                      , p_generate_periods            => p_generate_periods
161                                      , p_generate_breakpoints        => p_generate_breakpoints
162                                      , p_generate_constraints        => p_generate_constraints
163                                      , x_return_status               => x_return_status
164                                      , x_msg_count                   => x_msg_count
165                                      , x_msg_data                    => x_msg_data
166                                      , x_var_rent_id                 => x_var_rent_id
167                                      , x_var_rent_num                => x_var_rent_num
168                                       );
169 
170          -- Standard check of p_commit.
171          IF fnd_api.to_boolean (p_commit)
172          THEN
173             COMMIT;
174          END IF;
175 
176     END IF;
177       fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
178                                   , p_count                       => x_msg_count
179                                   , p_data                        => x_msg_data
180                                    );
181    EXCEPTION
182       WHEN fnd_api.g_exc_error
183       THEN
184          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
185                                   , p_count                       => x_msg_count
186                                   , p_data                        => x_msg_data
187                                    );
188          x_return_status   := fnd_api.g_ret_sts_error;
189          pn_varen_util.pvt_debug (   l_api_name_full
190                                   || ' : '
191                                   || 'Exception : '
192                                   || SQLERRM
193                                 , 3
194                                  );
195          pn_varen_util.pvt_debug (   l_api_name_full
196                                   || ' : '
197                                   || 'Return Status : '
198                                   || x_return_status
199                                 , 3
200                                  );
201          pn_varen_util.pvt_debug (   l_api_name_full
202                                   || ' : '
203                                   || 'No of Error Messages : '
204                                   || x_msg_count
205                                 , 3
206                                  );
207       WHEN fnd_api.g_exc_unexpected_error
208       THEN
209          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
210                                   , p_count                       => x_msg_count
211                                   , p_data                        => x_msg_data
212                                    );
213          x_return_status              := fnd_api.g_ret_sts_unexp_error;
214          pn_varen_util.pvt_debug (   l_api_name_full
215                                   || ' : '
216                                   || 'Unexpected Exception : '
217                                   || SQLERRM
218                                 , 3
219                                  );
220          pn_varen_util.pvt_debug (   l_api_name_full
221                                   || ' : '
222                                   || 'Return Status : '
223                                   || x_return_status
224                                 , 3
225                                  );
226          pn_varen_util.pvt_debug (   l_api_name_full
227                                   || ' : '
228                                   || 'No of Error Messages : '
229                                   || x_msg_count
230                                 , 3
231                                  );
232       WHEN OTHERS
233       THEN
234          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
235                                   , p_count                       => x_msg_count
236                                   , p_data                        => x_msg_data
237                                    );
238          x_return_status                                                              := fnd_api.g_ret_sts_error;
239          pn_varen_util.pvt_debug (   l_api_name_full
240                                   || ' : '
241                                   || 'Others Exception : '
242                                   || SQLERRM
243                                 , 3
244                                  );
245          pn_varen_util.pvt_debug (   l_api_name_full
246                                   || ' : '
247                                   || 'Return Status : '
248                                   || x_return_status
249                                 , 3
250                                  );
251          pn_varen_util.pvt_debug (   l_api_name_full
252                                   || ' : '
253                                   || 'No of Error Messages : '
254                                   || x_msg_count
255                                 , 3
256                                  );
257    END create_var_rent;
258 
259 -- ========================================================================================
260 --
261 --Name:               generate_periods
262 --Type:                 Procedure
263 --Description:  This procedure can be used to generate period for variable rent.
264 --
265 --Called subprograms:  pn_varen_pvt.generate_periods
266 --
267 --
268 -- History:
269 -- 20-SEP-2010   vkatta   o Created
270 -- 11-OCT-2010   vkatta   o Update Variable Rent
271 -- 09-APR-2011   pstawar   Interface Repository Annotation
272 --                          Standards are incorporated.
273 
274 
275 
276    PROCEDURE generate_periods (
277       p_api_version              IN       NUMBER
278     , p_init_msg_list            IN       VARCHAR2 DEFAULT fnd_api.g_false
279     , p_commit                   IN       VARCHAR2 DEFAULT fnd_api.g_false
280     , p_var_rent_id              IN       NUMBER
281     , p_generate_periods         IN       VARCHAR2 DEFAULT 'N'
282     , x_return_status            OUT NOCOPY VARCHAR2
283     , x_msg_count                OUT NOCOPY NUMBER
284     , x_msg_data                 OUT NOCOPY VARCHAR2
285    )
286    IS
287       l_api_name           CONSTANT VARCHAR2 (30) := 'Generate_Periods';
288       l_api_version        CONSTANT NUMBER := 1.0;
289       l_api_name_full      CONSTANT VARCHAR2 (61) :=    g_pkg_name
290                                                      || '.'
291                                                      || l_api_name;
292    BEGIN
293       SAVEPOINT generate_periods;
294 
295       -- Initialize message list if p_init_msg_list is set to TRUE
296       IF fnd_api.to_boolean (p_init_msg_list)
297       THEN
298          fnd_msg_pub.initialize;
299       END IF;
300 
301       -- Standard call to check for call compatibility.
302       IF NOT fnd_api.compatible_api_call (l_api_version
303                                         , p_api_version
304                                         , l_api_name
305                                         , g_pkg_name
306                                          )
307       THEN
308          RAISE fnd_api.g_exc_error;
309       END IF;
310 
311 	-- Actions performed using the APIs would be subject to
312     -- function security. If the responsibility does not allow
313     -- such functions to be executed, the API should not proceed further
314     -- since the user does not have access to such functions
315 
316       IF NVL (mo_global.check_valid_org (g_org_id)
317             , 'N'
318              ) <> 'Y'
319       THEN
320          fnd_message.set_name ('MO'
321                              , 'MO_ORG_INVALID'
322                               );
323          fnd_msg_pub.ADD;
324          RAISE fnd_api.g_exc_error;
325       END IF;
326 
327       --- Verifying whether the VRA from exists or not.
328       IF fnd_function.TEST (function_name                 => g_fun_name)
329       THEN
330          g_func_exists                                                                := 'Y';
331       END IF;
332 
333       IF g_func_exists <> 'Y'
334       THEN
335          fnd_message.set_name ('PN'
336                              , 'PN_FUNCTION_SECURITY'
337                               );
338          fnd_msg_pub.ADD;
339          RAISE fnd_api.g_exc_error;
340       ELSE
341          pn_varen_pvt.generate_periods (p_api_version                 => 1.0
342                                       , p_init_msg_list               => fnd_api.g_false
343                                       , p_commit                      => fnd_api.g_false
344                                       , p_var_rent_id                 => p_var_rent_id
345                                       , p_var_rent_num                => NULL                           --for future use
346                                       , p_org_id                      => g_org_id
347                                       , p_generate_periods            => 'Y'
348                                       , x_return_status               => x_return_status
349                                       , x_msg_count                   => x_msg_count
350                                       , x_msg_data                    => x_msg_data
351                                        );
352 
353          -- Standard check of p_commit.
354          IF fnd_api.to_boolean (p_commit)
355          THEN
356             COMMIT;
357          END IF;
358 
359          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
360                                   , p_count                       => x_msg_count
361                                   , p_data                        => x_msg_data
362                                    );
363       END IF;
364    EXCEPTION
365       WHEN fnd_api.g_exc_error
366       THEN
367          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
368                                   , p_count                       => x_msg_count
369                                   , p_data                        => x_msg_data
370                                    );
371          x_return_status                                                              := fnd_api.g_ret_sts_error;
372          pn_varen_util.pvt_debug (   l_api_name_full
373                                   || ' : '
374                                   || 'Exception : '
375                                   || SQLERRM
376                                 , 3
377                                  );
378          pn_varen_util.pvt_debug (   l_api_name_full
379                                   || ' : '
380                                   || 'Return Status : '
381                                   || x_return_status
382                                 , 3
383                                  );
384          pn_varen_util.pvt_debug (   l_api_name_full
385                                   || ' : '
386                                   || 'No of Error Messages : '
387                                   || x_msg_count
388                                 , 3
389                                  );
390       WHEN fnd_api.g_exc_unexpected_error
391       THEN
392          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
393                                   , p_count                       => x_msg_count
394                                   , p_data                        => x_msg_data
395                                    );
396          x_return_status                                                              := fnd_api.g_ret_sts_unexp_error;
397          pn_varen_util.pvt_debug (   l_api_name_full
398                                   || ' : '
399                                   || 'Unexpected Exception : '
400                                   || SQLERRM
401                                 , 3
402                                  );
403          pn_varen_util.pvt_debug (   l_api_name_full
404                                   || ' : '
405                                   || 'Return Status : '
406                                   || x_return_status
407                                 , 3
408                                  );
409          pn_varen_util.pvt_debug (   l_api_name_full
410                                   || ' : '
411                                   || 'No of Error Messages : '
412                                   || x_msg_count
413                                 , 3
414                                  );
415       WHEN OTHERS
416       THEN
417          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
418                                   , p_count                       => x_msg_count
419                                   , p_data                        => x_msg_data
420                                    );
421          x_return_status                                                              := fnd_api.g_ret_sts_error;
422          pn_varen_util.pvt_debug (   l_api_name_full
423                                   || ' : '
424                                   || 'Others Exception : '
425                                   || SQLERRM
426                                 , 3
427                                  );
428          pn_varen_util.pvt_debug (   l_api_name_full
429                                   || ' : '
430                                   || 'Return Status : '
431                                   || x_return_status
432                                 , 3
433                                  );
434          pn_varen_util.pvt_debug (   l_api_name_full
435                                   || ' : '
436                                   || 'No of Error Messages : '
437                                   || x_msg_count
438                                 , 3
439                                  );
440    END generate_periods;
441 
442 -- ========================================================================================
443 --
444 --Name:               create_bkpt_const_allow_abat
445 --Type:                 Procedure
446 --Description:  This procedure can be used to create breakpoints, constraints, allowances, and abatements for variable rent.
447 --
448 --Called subprograms:  pn_varen_pvt.create_bkpt_const_allow_abat
449 --
450 --
451 -- History:
452 -- 20-SEP-2010   vkatta   o Created
453 -- 11-OCT-2010   vkatta   o Update Variable Rent
454 -- 09-APR-2011   pstawar   Interface Repository Annotation
455 --                          Standards are incorporated.
456 
457    PROCEDURE create_bkpt_const_allow_abat (
458       p_api_version              IN       NUMBER
459     , p_init_msg_list            IN       VARCHAR2 DEFAULT fnd_api.g_false
460     , p_commit                   IN       VARCHAR2 DEFAULT fnd_api.g_false
461     , p_validate_flag            IN       VARCHAR2 DEFAULT 'N'
462     , p_variable_rent_lines_tbl  IN OUT NOCOPY pn_varen_pvt.variable_rent_lines_tbl_type
463     , p_breakpoint_header_tbl    IN OUT NOCOPY pn_varen_pvt.breakpoint_header_tbl_type
464     , p_breakpoint_details_tbl   IN OUT NOCOPY pn_varen_pvt.breakpoint_details_tbl_type
465     , p_constraints_tbl          IN OUT NOCOPY pn_varen_pvt.constraints_tbl_type
466     , p_allow_abat_tbl           IN OUT NOCOPY pn_varen_pvt.allow_abat_tbl_type
467     , x_return_status            OUT NOCOPY VARCHAR2
468     , x_msg_count                OUT NOCOPY NUMBER
469     , x_msg_data                 OUT NOCOPY VARCHAR2
470    )
471    IS
472       l_api_name           CONSTANT VARCHAR2 (30) := 'Create_Bkpt_Const_Allow_Abat';
473       l_api_version        CONSTANT NUMBER := 1.0;
474       l_api_name_full      CONSTANT VARCHAR2 (61) :=    g_pkg_name
475                                                      || '.'
476                                                      || l_api_name;
477    BEGIN
478       SAVEPOINT create_bkpt_const_allow_abat;
479 
480       -- Initialize message list if p_init_msg_list is set to TRUE
481       IF fnd_api.to_boolean (p_init_msg_list)
482       THEN
483          fnd_msg_pub.initialize;
484       END IF;
485 
486       -- Standard call to check for call compatibility.
487       IF NOT fnd_api.compatible_api_call (l_api_version
488                                         , p_api_version
489                                         , l_api_name
490                                         , g_pkg_name
491                                          )
492       THEN
493          RAISE fnd_api.g_exc_error;
494       END IF;
495 
496 	-- Actions performed using the APIs would be subject to
497     -- function security. If the responsibility does not allow
498     -- such functions to be executed, the API should not proceed further
499     -- since the user does not have access to such functions
500 
501       IF NVL (mo_global.check_valid_org (g_org_id)
502             , 'N'
503              ) <> 'Y'
504       THEN
505          fnd_message.set_name ('MO'
506                              , 'MO_ORG_INVALID'
507                               );
508          fnd_msg_pub.ADD;
509          RAISE fnd_api.g_exc_error;
510       END IF;
511 
512       --- Verifying whether the VRA from exists or not.
513       IF fnd_function.TEST (function_name                 => g_fun_name)
514       THEN
515          g_func_exists                                                                := 'Y';
516       END IF;
517 
518       IF g_func_exists <> 'Y'
519       THEN
520          fnd_message.set_name ('PN'
521                              , 'PN_FUNCTION_SECURITY'
522                               );
523          fnd_msg_pub.ADD;
524          RAISE fnd_api.g_exc_error;
525       ELSE
526          pn_varen_util.pvt_debug (   l_api_name_full
527                                   || ' : '
528                                   || 'Start of Create Breakpoints, Constraints, Allowanced and Abatements package'
529                                 , 3
530                                  );
531          pn_varen_pvt.create_bkpt_const_allow_abat (p_api_version                 => 1.0
532                                                   , p_init_msg_list               => p_init_msg_list
533                                                   , p_commit                      => p_commit
534                                                   , p_validate_flag               => p_validate_flag
535                                                   , p_variable_rent_lines_tbl     => p_variable_rent_lines_tbl
536                                                   , p_breakpoint_header_tbl       => p_breakpoint_header_tbl
537                                                   , p_breakpoint_details_tbl      => p_breakpoint_details_tbl
538                                                   , p_constraints_tbl             => p_constraints_tbl
539                                                   , p_allow_abat_tbl              => p_allow_abat_tbl
540                                                   , x_return_status               => x_return_status
541                                                   , x_msg_count                   => x_msg_count
542                                                   , x_msg_data                    => x_msg_data
543                                                    );
544          pn_varen_util.pvt_debug (   l_api_name_full
545                                   || ' : '
546                                   || 'Return Status    : '
547                                   || x_return_status
548                                 , 3
549                                  );
550 
551 -- Standard check of p_commit.
552          IF fnd_api.to_boolean (p_commit)
553          THEN
554             COMMIT;
555          END IF;
556 
557          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
558                                   , p_count                       => x_msg_count
559                                   , p_data                        => x_msg_data
560                                    );
561       END IF;
562 --
563    EXCEPTION
564       WHEN fnd_api.g_exc_error
565       THEN
566          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
567                                   , p_count                       => x_msg_count
568                                   , p_data                        => x_msg_data
569                                    );
570          x_return_status                                                              := fnd_api.g_ret_sts_error;
571          pn_varen_util.pvt_debug (   l_api_name_full
572                                   || ' : '
573                                   || 'Exception : '
574                                   || SQLERRM
575                                 , 3
576                                  );
577          pn_varen_util.pvt_debug (   l_api_name_full
578                                   || ' : '
579                                   || 'Return Status : '
580                                   || x_return_status
581                                 , 3
582                                  );
583          pn_varen_util.pvt_debug (   l_api_name_full
584                                   || ' : '
585                                   || 'No of Error Messages : '
586                                   || x_msg_count
587                                 , 3
588                                  );
589       WHEN fnd_api.g_exc_unexpected_error
590       THEN
591          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
592                                   , p_count                       => x_msg_count
593                                   , p_data                        => x_msg_data
594                                    );
595          x_return_status                                                              := fnd_api.g_ret_sts_unexp_error;
596          pn_varen_util.pvt_debug (   l_api_name_full
597                                   || ' : '
598                                   || 'Unexpected Exception : '
599                                   || SQLERRM
600                                 , 3
601                                  );
602          pn_varen_util.pvt_debug (   l_api_name_full
603                                   || ' : '
604                                   || 'Return Status : '
605                                   || x_return_status
606                                 , 3
607                                  );
608          pn_varen_util.pvt_debug (   l_api_name_full
609                                   || ' : '
610                                   || 'No of Error Messages : '
611                                   || x_msg_count
612                                 , 3
613                                  );
614       WHEN OTHERS
615       THEN
616          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
617                                   , p_count                       => x_msg_count
618                                   , p_data                        => x_msg_data
619                                    );
620          x_return_status                                                              := fnd_api.g_ret_sts_error;
621          pn_varen_util.pvt_debug (   l_api_name_full
622                                   || ' : '
623                                   || 'Others Exception : '
624                                   || SQLERRM
625                                 , 3
626                                  );
627          pn_varen_util.pvt_debug (   l_api_name_full
628                                   || ' : '
629                                   || 'Return Status : '
630                                   || x_return_status
631                                 , 3
632                                  );
633          pn_varen_util.pvt_debug (   l_api_name_full
634                                   || ' : '
635                                   || 'No of Error Messages : '
636                                   || x_msg_count
637                                 , 3
638                                  );
639    END create_bkpt_const_allow_abat;
640 
641 -- ========================================================================================
642 --
643 --Name:               update_var_rent
644 --Type:                 Procedure
645 --Description:  This procedure can be used to update variable rent.
646 --
647 --Called subprograms:  pn_varen_pvt.update_var_rent
648 --
649 --
650 -- History:
651 -- 20-SEP-2010   vkatta   o Created
652 -- 11-OCT-2010   vkatta   o Update Variable Rent
653 -- 09-APR-2011   pstawar   Interface Repository Annotation
654 --                          Standards are incorporated.
655 
656 
657    PROCEDURE update_var_rent (
658       p_api_version              IN       NUMBER
659     , p_init_msg_list            IN       VARCHAR2 DEFAULT fnd_api.g_false
660     , p_commit                   IN       VARCHAR2 DEFAULT fnd_api.g_false
661     , p_validate_flag            IN       VARCHAR2 DEFAULT 'Y'
662     , p_upd_var_rent_rec         IN OUT NOCOPY pn_varen_pvt.upd_var_rent_rec_type
663     , p_var_rent_lines_tbl       IN OUT NOCOPY pn_varen_pvt.variable_rent_lines_tbl_type
664     , p_breakpoint_header_tbl    IN OUT NOCOPY pn_varen_pvt.breakpoint_header_tbl_type
665     , p_breakpoint_details_tbl   IN OUT NOCOPY pn_varen_pvt.breakpoint_details_tbl_type
666     , p_constraints_tbl          IN OUT NOCOPY pn_varen_pvt.constraints_tbl_type
667     , p_allow_abat_tbl           IN OUT NOCOPY pn_varen_pvt.allow_abat_tbl_type
668     , p_undo_periods             IN       VARCHAR2 DEFAULT 'N'
669     , p_undo_breakpoints         IN       VARCHAR2 DEFAULT 'N'
670     , p_undo_constraints         IN       VARCHAR2 DEFAULT 'N'
671     , x_return_status            OUT NOCOPY VARCHAR2
672     , x_msg_count                OUT NOCOPY NUMBER
673     , x_msg_data                 OUT NOCOPY VARCHAR2
674    )
675    IS
676       l_api_name           CONSTANT VARCHAR2 (30) := 'Update_Var_Rent';
677       l_api_version        CONSTANT NUMBER := 1.0;
678       l_api_name_full      CONSTANT VARCHAR2 (61) :=    g_pkg_name
679                                                      || '.'
680                                                      || l_api_name;
681    BEGIN
682 
683       SAVEPOINT update_var_rent;
684 
685       -- Initialize message list if p_init_msg_list is set to TRUE
686       IF fnd_api.to_boolean (p_init_msg_list)
687       THEN
688          fnd_msg_pub.initialize;
689       END IF;
690 
691       -- Standard call to check for call compatibility.
692       IF NOT fnd_api.compatible_api_call (l_api_version
693                                         , p_api_version
694                                         , l_api_name
695                                         , g_pkg_name
696                                          )
697       THEN
698          RAISE fnd_api.g_exc_error;
699       END IF;
700 
701 	-- Actions performed using the APIs would be subject to
702     -- function security. If the responsibility does not allow
703     -- such functions to be executed, the API should not proceed further
704     -- since the user does not have access to such functions
705 
706       IF NVL (mo_global.check_valid_org (g_org_id)
707             , 'N'
708              ) <> 'Y'
709       THEN
710          fnd_message.set_name ('MO'
711                              , 'MO_ORG_INVALID'
712                               );
713          fnd_msg_pub.ADD;
714          RAISE fnd_api.g_exc_error;
715       END IF;
716 
717       --- Verifying whether the VRA from exists or not.
718       IF fnd_function.TEST (function_name                 => g_fun_name)
719       THEN
720          g_func_exists                                                                := 'Y';
721       END IF;
722 
723       IF g_func_exists <> 'Y'
724       THEN
725          fnd_message.set_name ('PN'
726                              , 'PN_FUNCTION_SECURITY'
727                               );
728          fnd_msg_pub.ADD;
729          RAISE fnd_api.g_exc_error;
730       ELSE
731          pn_varen_util.pvt_debug (   l_api_name_full
732                                   || ' : '
733                                   || 'Start of Update Variable Rent package'
734                                 , 3
735                                  );
736 
737 
738          pn_varen_pvt.update_var_rent (p_api_version                 => 1.0
739                                      , p_init_msg_list               => fnd_api.g_false
740                                      , p_commit                      => fnd_api.g_false
741                                      , p_validate_flag               => p_validate_flag
742                                      , p_upd_var_rent_rec            => p_upd_var_rent_rec
743                                      , p_var_rent_lines_tbl          => p_var_rent_lines_tbl
744                                      , p_breakpoint_header_tbl       => p_breakpoint_header_tbl
745                                      , p_breakpoint_details_tbl      => p_breakpoint_details_tbl
746                                      , p_constraints_tbl             => p_constraints_tbl
747                                      , p_allow_abat_tbl              => p_allow_abat_tbl
748                                      , p_undo_periods                => p_undo_periods
749                                      , p_undo_breakpoints            => p_undo_breakpoints
750                                      , p_undo_constraints            => p_undo_constraints
751                                      , x_return_status               => x_return_status
752                                      , x_msg_count                   => x_msg_count
753                                      , x_msg_data                    => x_msg_data
754                                       );
755          pn_varen_util.pvt_debug (   l_api_name_full
756                                   || ' : '
757                                   || 'Return Status    : '
758                                   || x_return_status
759                                 , 3
760                                  );
761 
762          -- Standard check of p_commit.
763          IF fnd_api.to_boolean (p_commit)
764          THEN
765             COMMIT;
766          END IF;
767 
768          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
769                                   , p_count                       => x_msg_count
770                                   , p_data                        => x_msg_data
771                                    );
772       END IF;
773    EXCEPTION
774       WHEN fnd_api.g_exc_error
775       THEN
776          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
777                                   , p_count                       => x_msg_count
778                                   , p_data                        => x_msg_data
779                                    );
780          x_return_status                                                              := fnd_api.g_ret_sts_error;
781          pn_varen_util.pvt_debug (   l_api_name_full
782                                   || ' : '
783                                   || 'Exception : '
784                                   || SQLERRM
785                                 , 3
786                                  );
787          pn_varen_util.pvt_debug (   l_api_name_full
788                                   || ' : '
789                                   || 'Return Status : '
790                                   || x_return_status
791                                 , 3
792                                  );
793          pn_varen_util.pvt_debug (   l_api_name_full
794                                   || ' : '
795                                   || 'No of Error Messages : '
796                                   || x_msg_count
797                                 , 3
798                                  );
799       WHEN fnd_api.g_exc_unexpected_error
800       THEN
801          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
802                                   , p_count                       => x_msg_count
803                                   , p_data                        => x_msg_data
804                                    );
805          x_return_status                                                              := fnd_api.g_ret_sts_unexp_error;
806          pn_varen_util.pvt_debug (   l_api_name_full
807                                   || ' : '
808                                   || 'Unexpected Exception : '
809                                   || SQLERRM
810                                 , 3
811                                  );
812          pn_varen_util.pvt_debug (   l_api_name_full
813                                   || ' : '
814                                   || 'Return Status : '
815                                   || x_return_status
816                                 , 3
817                                  );
818          pn_varen_util.pvt_debug (   l_api_name_full
819                                   || ' : '
820                                   || 'No of Error Messages : '
821                                   || x_msg_count
822                                 , 3
823                                  );
824       WHEN OTHERS
825       THEN
826          fnd_msg_pub.count_and_get (p_encoded                     => fnd_api.g_false
827                                   , p_count                       => x_msg_count
828                                   , p_data                        => x_msg_data
829                                    );
830          x_return_status                                                              := fnd_api.g_ret_sts_error;
831          pn_varen_util.pvt_debug (   l_api_name_full
832                                   || ' : '
833                                   || 'Others Exception : '
834                                   || SQLERRM
835                                 , 3
836                                  );
837          pn_varen_util.pvt_debug (   l_api_name_full
838                                   || ' : '
839                                   || 'Return Status : '
840                                   || x_return_status
841                                 , 3
842                                  );
843          pn_varen_util.pvt_debug (   l_api_name_full
844                                   || ' : '
845                                   || 'No of Error Messages : '
846                                   || x_msg_count
847                                 , 3
848                                  );
849    END update_var_rent;
850 END pn_var_rent_pub;