DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_AU_MODULE_TYPES_API

Source


1 Package Body pay_au_module_types_api as
2 /* $Header: pyamtapi.pkb 120.0 2005/05/29 02:56 appldev noship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33);
7 --
8 -- ------------------------------------------------------------------------
9 -- |--------------------------< create_au_module_type >-------------------|
10 -- ------------------------------------------------------------------------
11 --
12 procedure create_au_module_type
13   (p_validate                      in      boolean  default false,
14    p_name                          in      varchar2,
15    p_enabled_flag                  in      varchar2,
16    p_description                   IN      varchar2,
17    p_module_type_id                out nocopy number,
18    p_object_version_number         out nocopy number)  is
19   --
20   -- Declare cursors and local variables
21   --
22   --
23   -- Out variables
24   --
25   l_module_type_id             pay_au_module_types.module_type_id%TYPE;
26   l_object_version_number      pay_au_module_types.object_version_number%TYPE;
27   --
28   l_proc                       varchar2(72);
29   --
30   -- Declare a cursor that will check whether the passed
31   -- in name for a unique name
32   --
33   cursor csr_valid_name is
34   select module_type_id from pay_au_module_types pamt
35   where  pamt.name  = p_name;
36   --
37   --
38 begin
39   l_proc := g_package||'create_au_module_type';
40   --
41   hr_utility.set_location('Entering:'|| l_proc, 5);
42   --
43   -- Issue a savepoint if operating in validation only mode.
44   --
45   if p_validate then
46     savepoint create_au_module_type;
47   end if;
48   --
49   hr_utility.set_location(l_proc, 10);
50   --
51   -- Validation in addition to Table Handlers
52   --
53   -- Process Logic
54   --
55   --------------------------------------------------------
56   -- Check for unique short name,business_group_id and
57   -- legislation_code combo --
58   --------------------------------------------------------
59      open csr_valid_name;
60      fetch csr_valid_name into l_module_type_id;
61 
62      -- If the process does not exist then create it.
63      -- Do not error if the process does exist, simply return.
64      --
65      if csr_valid_name%notfound then
66         --
67         -- Insert the module type.
68         --
69            pay_amt_ins.ins
70            (
71             p_module_type_id               => l_module_type_id,
72             p_name                         => p_name,
73             p_enabled_flag                 => p_enabled_flag,
74             p_description                  => p_description,
75             p_object_version_number        => l_object_version_number
76            );
77      end if;
78      close csr_valid_name;
79   --
80   hr_utility.set_location(l_proc, 20);
81   --
82   -- When in validation only mode raise the Validate_Enabled exception
83   --
84   if p_validate then
85     raise hr_api.validate_enabled;
86   end if;
87   --
88   -- Set all output arguments
89   --
90   p_module_type_id := l_module_type_id;
91   p_object_version_number := l_object_version_number;
92   --
93   hr_utility.set_location(' Leaving:'||l_proc, 100);
94 exception
95   when hr_api.validate_enabled then
96     --
97     -- Only set output warning arguments
98     -- (Any key or derived arguments must be set to null
99     -- when validation only mode is being used.)
100     --
101     p_module_type_id  := null;
102     --
103     -- As the Validate_Enabled exception has been raised
104     -- we must rollback to the savepoint
105     --
106     ROLLBACK TO create_au_module_type;
107     --
108 end create_au_module_type;
109 --
110 -- ------------------------------------------------------------------------
111 -- |--------------------------< delete_au_module_type >-------------------|
112 -- ------------------------------------------------------------------------
113 --
114 procedure delete_au_module_type
115   (p_validate                      in      boolean  default false,
116    p_module_type_id                in      number,
117    p_object_version_number         in      number)  is
118   --
119   l_proc                       varchar2(72);
120   --
121 begin
122   l_proc := g_package||'delete_au_module_type';
123   --
124   hr_utility.set_location('Entering:'|| l_proc, 5);
125   --
126   -- Issue a savepoint if operating in validation only mode.
127   --
128   if p_validate then
129     savepoint delete_au_module_type;
130   end if;
131   --
132   hr_utility.set_location(l_proc, 10);
133   --
134   -- Validation in addition to Table Handlers
135   --
136   -- None required.
137   --
138   -- Process Logic
139   --
140     pay_amt_del.del
141       (p_module_type_id            => p_module_type_id,
142        p_object_version_number     => p_object_version_number);
143   --
144   hr_utility.set_location(l_proc, 20);
145   --
146   -- When in validation only mode raise the Validate_Enabled exception
147   --
148   if p_validate then
149     raise hr_api.validate_enabled;
150   end if;
151   --
152   hr_utility.set_location(' Leaving:'||l_proc, 100);
153 exception
154   when hr_api.validate_enabled then
155     --
156     -- As the Validate_Enabled exception has been raised
157     -- we must rollback to the savepoint
158     --
159     ROLLBACK TO delete_au_module_type;
160 end delete_au_module_type;
161 --
162 --
163 -- ------------------------------------------------------------------------
164 -- |--------------------------< update_au_module_type >--------------------|
165 -- ------------------------------------------------------------------------
166 --
167 procedure update_au_module_type
168   (p_validate                      in      boolean  default false,
169    p_module_type_id                in      number,
170    p_name                          in      varchar2,
171    p_enabled_flag                  in      varchar2,
172    p_description                   in      varchar2,
173    p_object_version_number         in out  nocopy   number
174   )  is
175   --
176   l_proc                       varchar2(72);
177   --
178 begin
179   l_proc := g_package||'update_au_module_type';
180   --
181   hr_utility.set_location('Entering:'|| l_proc, 5);
182   --
183   -- Issue a savepoint if operating in validation only mode.
184   --
185   if p_validate then
186     savepoint update_au_module_type;
187   end if;
188   --
189   hr_utility.set_location(l_proc, 10);
190   --
191   -- Validation in addition to Table Handlers
192   --
193   -- None required.
194   --
195   -- Process Logic
196   --
197     pay_amt_upd.upd
198       (p_module_type_id               => p_module_type_id,
199        p_object_version_number        => p_object_version_number,
200        p_name                         => p_name,
201        p_enabled_flag                 => p_enabled_flag,
202        p_description                  => p_description
203        );
204   --
205   hr_utility.set_location(l_proc, 20);
206   --
207   -- When in validation only mode raise the Validate_Enabled exception
208   --
209   if p_validate then
210     raise hr_api.validate_enabled;
211   end if;
212   --
213   hr_utility.set_location(' Leaving:'||l_proc, 100);
214 exception
215   when hr_api.validate_enabled then
216     --
217     -- As the Validate_Enabled exception has been raised
218     -- we must rollback to the savepoint
219     --
220     ROLLBACK TO update_au_module_type;
221 end update_au_module_type;
222 --
223 --
224 begin
225   g_package := '  pay_au_module_types_api.';
226 end pay_au_module_types_api;