DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_AMO_SHD

Source


1 Package Body pay_amo_shd as
2 /* $Header: pyamorhi.pkb 120.0.12000000.1 2007/01/17 15:29:33 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33);  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16   --
17   Return (nvl(g_api_dml, false));
18   --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25   (p_constraint_name in all_constraints.constraint_name%TYPE
26   ) Is
27 --
28   l_proc        varchar2(72);
29 --
30 Begin
31   --
32   l_proc := g_package||'constraint_error';
33   --
34   If (p_constraint_name = 'PAY_AU_MODULES_CHK1') Then
35     fnd_message.set_name('PER', 'PER_52500_INV_YES_NO_FLAG');
36     fnd_message.raise_error;
37   ElsIf (p_constraint_name = 'PAY_AU_MODULES_FK1') Then
38     fnd_message.set_name('PAY','HR_AU_INVALID_MODULE_TYPE');
39     fnd_message.raise_error;
40   ElsIf (p_constraint_name = 'PAY_AU_MODULES_PK') Then
41     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
42     fnd_message.set_token('PROCEDURE', l_proc);
43     fnd_message.set_token('STEP','15');
44     fnd_message.raise_error;
45   ElsIf (p_constraint_name = 'PAY_AU_MODULES_UK1') Then
46     fnd_message.set_name('PAY', 'PER_7901_SYS_DUPLICATE_RECORDS');
47     fnd_message.raise_error;
48   Else
49     fnd_message.set_name('PAY', 'PAY_52681_BHT_CHILD_EXISTS');
50     fnd_message.raise_error;
51   End If;
52   --
53 End constraint_error;
54 --
55 -- ----------------------------------------------------------------------------
56 -- |-----------------------------< api_updating >-----------------------------|
57 -- ----------------------------------------------------------------------------
58 Function api_updating
59   (p_module_id                            in     number
60   ,p_object_version_number                in     number
61   )
62   Return Boolean Is
63   --
64   --
65   -- Cursor selects the 'current' row from the HR Schema
66   --
67   Cursor C_Sel1 is
68     select
69        module_id
70       ,name
71       ,enabled_flag
72       ,module_type_id
73       ,business_group_id
74       ,legislation_code
75       ,description
76       ,package_name
77       ,procedure_function_name
78       ,formula_name
79       ,object_version_number
80     from        pay_au_modules
81     where       module_id = p_module_id;
82   --
83   l_fct_ret     boolean;
84   --
85 Begin
86   --
87   If (p_module_id is null and
88       p_object_version_number is null
89      ) Then
90     --
91     -- One of the primary key arguments is null therefore we must
92     -- set the returning function value to false
93     --
94     l_fct_ret := false;
95   Else
96     If (p_module_id
97         = pay_amo_shd.g_old_rec.module_id and
98         p_object_version_number
99         = pay_amo_shd.g_old_rec.object_version_number
100        ) Then
101       --
102       -- The g_old_rec is current therefore we must
103       -- set the returning function to true
104       --
105       l_fct_ret := true;
106     Else
107       --
108       -- Select the current row into g_old_rec
109       --
110       Open C_Sel1;
111       Fetch C_Sel1 Into pay_amo_shd.g_old_rec;
112       If C_Sel1%notfound Then
113         Close C_Sel1;
114         --
115         -- The primary key is invalid therefore we must error
116         --
117         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
118         fnd_message.raise_error;
119       End If;
120       Close C_Sel1;
121       If (p_object_version_number
122           <> pay_amo_shd.g_old_rec.object_version_number) Then
123         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
124         fnd_message.raise_error;
125       End If;
126       l_fct_ret := true;
127     End If;
128   End If;
129   Return (l_fct_ret);
130 --
131 End api_updating;
132 --
133 -- ----------------------------------------------------------------------------
134 -- |---------------------------------< lck >----------------------------------|
135 -- ----------------------------------------------------------------------------
136 Procedure lck
137   (p_module_id                            in     number
138   ,p_object_version_number                in     number
139   ) is
140 --
141 -- Cursor selects the 'current' row from the HR Schema
142 --
143   Cursor C_Sel1 is
144     select
145        module_id
146       ,name
147       ,enabled_flag
148       ,module_type_id
149       ,business_group_id
150       ,legislation_code
151       ,description
152       ,package_name
153       ,procedure_function_name
154       ,formula_name
155       ,object_version_number
156     from        pay_au_modules
157     where       module_id = p_module_id
158     for update nowait;
159 --
160   l_proc        varchar2(72);
161 --
162 Begin
163   l_proc := g_package||'lck';
164   --
165   hr_utility.set_location('Entering:'||l_proc, 5);
166   --
167   hr_api.mandatory_arg_error
168     (p_api_name           => l_proc
169     ,p_argument           => 'MODULE_ID'
170     ,p_argument_value     => p_module_id
171     );
172   hr_utility.set_location(l_proc,6);
173   hr_api.mandatory_arg_error
174     (p_api_name           => l_proc
175     ,p_argument           => 'OBJECT_VERSION_NUMBER'
176     ,p_argument_value     => p_object_version_number
177     );
178   --
179   Open  C_Sel1;
180   Fetch C_Sel1 Into pay_amo_shd.g_old_rec;
181   If C_Sel1%notfound then
182     Close C_Sel1;
183     --
184     -- The primary key is invalid therefore we must error
185     --
186     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
187     fnd_message.raise_error;
188   End If;
189   Close C_Sel1;
190   If (p_object_version_number
191       <> pay_amo_shd.g_old_rec.object_version_number) Then
192         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
193         fnd_message.raise_error;
194   End If;
195   --
196   hr_utility.set_location(' Leaving:'||l_proc, 10);
197   --
198   -- We need to trap the ORA LOCK exception
199   --
200 Exception
201   When HR_Api.Object_Locked then
202     --
203     -- The object is locked therefore we need to supply a meaningful
204     -- error message.
205     --
206     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
207     fnd_message.set_token('TABLE_NAME', 'pay_au_modules');
208     fnd_message.raise_error;
209 End lck;
210 --
211 -- ----------------------------------------------------------------------------
212 -- |-----------------------------< convert_args >-----------------------------|
213 -- ----------------------------------------------------------------------------
214 Function convert_args
215   (p_module_id                      in number
216   ,p_name                           in varchar2
217   ,p_enabled_flag                   in varchar2
218   ,p_module_type_id                 in number
219   ,p_business_group_id              in number
220   ,p_legislation_code               in varchar2
221   ,p_description                    in varchar2
222   ,p_package_name                   in varchar2
223   ,p_procedure_function_name        in varchar2
224   ,p_formula_name                   in varchar2
225   ,p_object_version_number          in number
226   )
227   Return g_rec_type is
228 --
229   l_rec   g_rec_type;
230 --
231 Begin
232   --
233   -- Convert arguments into local l_rec structure.
234   --
235   l_rec.module_id                        := p_module_id;
236   l_rec.name                             := p_name;
237   l_rec.enabled_flag                     := p_enabled_flag;
238   l_rec.module_type_id                   := p_module_type_id;
239   l_rec.business_group_id                := p_business_group_id;
240   l_rec.legislation_code                 := p_legislation_code;
241   l_rec.description                      := p_description;
242   l_rec.package_name                     := p_package_name;
243   l_rec.procedure_function_name          := p_procedure_function_name;
244   l_rec.formula_name                     := p_formula_name;
245   l_rec.object_version_number            := p_object_version_number;
246   --
247   -- Return the plsql record structure.
248   --
249   Return(l_rec);
250 --
251 End convert_args;
252 --
253 begin
254   g_package  := '  pay_amo_shd.';  -- Global package name
255 end pay_amo_shd;