DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_AMT_SHD

Source


1 Package Body pay_amt_shd as
2 /* $Header: pyamtrhi.pkb 120.0.12000000.1 2007/01/17 15:30:47 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   l_proc := g_package||'constraint_error';
32   --
33   If (p_constraint_name = 'PAY_AU_MODULE_TYPES_CHK1') Then
34     fnd_message.set_name('PER', 'PER_52500_INV_YES_NO_FLAG');
35     fnd_message.raise_error;
36   ElsIf (p_constraint_name = 'PAY_AU_MODULE_TYPES_PK') Then
37     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','10');
40     fnd_message.raise_error;
41   ElsIf (p_constraint_name = 'PAY_AU_MODULE_TYPES_UK1') Then
42     fnd_message.set_name('PAY', 'PER_7901_SYS_DUPLICATE_RECORDS');
43     fnd_message.raise_error;
44   Else
45     fnd_message.set_name('PAY', 'PAY_52681_BHT_CHILD_EXISTS');
46     fnd_message.raise_error;
47   End If;
48   --
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55   (p_module_type_id                       in     number
56   ,p_object_version_number                in     number
57   )
58   Return Boolean Is
59   --
60   --
61   -- Cursor selects the 'current' row from the HR Schema
62   --
63   Cursor C_Sel1 is
64     select
65        module_type_id
66       ,name
67       ,enabled_flag
68       ,description
69       ,object_version_number
70     from        pay_au_module_types
71     where       module_type_id = p_module_type_id;
72   --
73   l_fct_ret     boolean;
74   --
75 Begin
76   --
77   If (p_module_type_id is null and
78       p_object_version_number is null
79      ) Then
80     --
81     -- One of the primary key arguments is null therefore we must
82     -- set the returning function value to false
83     --
84     l_fct_ret := false;
85   Else
86     If (p_module_type_id
87         = pay_amt_shd.g_old_rec.module_type_id and
88         p_object_version_number
89         = pay_amt_shd.g_old_rec.object_version_number
90        ) Then
91       --
92       -- The g_old_rec is current therefore we must
93       -- set the returning function to true
94       --
95       l_fct_ret := true;
96     Else
97       --
98       -- Select the current row into g_old_rec
99       --
100       Open C_Sel1;
101       Fetch C_Sel1 Into pay_amt_shd.g_old_rec;
102       If C_Sel1%notfound Then
103         Close C_Sel1;
104         --
105         -- The primary key is invalid therefore we must error
106         --
107         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
108         fnd_message.raise_error;
109       End If;
110       Close C_Sel1;
111       If (p_object_version_number
112           <> pay_amt_shd.g_old_rec.object_version_number) Then
113         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
114         fnd_message.raise_error;
115       End If;
116       l_fct_ret := true;
117     End If;
118   End If;
119   Return (l_fct_ret);
120 --
121 End api_updating;
122 --
123 -- ----------------------------------------------------------------------------
124 -- |---------------------------------< lck >----------------------------------|
125 -- ----------------------------------------------------------------------------
126 Procedure lck
127   (p_module_type_id                       in     number
128   ,p_object_version_number                in     number
129   ) is
130 --
131 -- Cursor selects the 'current' row from the HR Schema
132 --
133   Cursor C_Sel1 is
134     select
135        module_type_id
136       ,name
137       ,enabled_flag
138       ,description
139       ,object_version_number
140     from        pay_au_module_types
141     where       module_type_id = p_module_type_id
142     for update nowait;
143 --
144   l_proc        varchar2(72);
145 --
146 Begin
147   l_proc := g_package||'lck';
148   --
149   hr_utility.set_location('Entering:'||l_proc, 5);
150   --
151   hr_api.mandatory_arg_error
152     (p_api_name           => l_proc
153     ,p_argument           => 'MODULE_TYPE_ID'
154     ,p_argument_value     => p_module_type_id
155     );
156   hr_utility.set_location(l_proc,6);
157   hr_api.mandatory_arg_error
158     (p_api_name           => l_proc
159     ,p_argument           => 'OBJECT_VERSION_NUMBER'
160     ,p_argument_value     => p_object_version_number
161     );
162   --
163   Open  C_Sel1;
164   Fetch C_Sel1 Into pay_amt_shd.g_old_rec;
165   If C_Sel1%notfound then
166     Close C_Sel1;
167     --
168     -- The primary key is invalid therefore we must error
169     --
170     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
171     fnd_message.raise_error;
172   End If;
173   Close C_Sel1;
174   If (p_object_version_number
175       <> pay_amt_shd.g_old_rec.object_version_number) Then
176         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
177         fnd_message.raise_error;
178   End If;
179   --
180   hr_utility.set_location(' Leaving:'||l_proc, 10);
181   --
182   -- We need to trap the ORA LOCK exception
183   --
184 Exception
185   When HR_Api.Object_Locked then
186     --
187     -- The object is locked therefore we need to supply a meaningful
188     -- error message.
189     --
190     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
191     fnd_message.set_token('TABLE_NAME', 'pay_au_module_types');
192     fnd_message.raise_error;
193 End lck;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< convert_args >-----------------------------|
197 -- ----------------------------------------------------------------------------
198 Function convert_args
199   (p_module_type_id                 in number
200   ,p_name                           in varchar2
201   ,p_enabled_flag                   in varchar2
202   ,p_description                    in varchar2
203   ,p_object_version_number          in number
204   )
205   Return g_rec_type is
206 --
207   l_rec   g_rec_type;
208 --
209 Begin
210   --
211   -- Convert arguments into local l_rec structure.
212   --
213   l_rec.module_type_id                   := p_module_type_id;
214   l_rec.name                             := p_name;
215   l_rec.enabled_flag                     := p_enabled_flag;
216   l_rec.description                      := p_description;
217   l_rec.object_version_number            := p_object_version_number;
218   --
219   -- Return the plsql record structure.
220   --
221   Return(l_rec);
222 --
223 End convert_args;
224 --
225 begin
226   g_package := '  pay_amt_shd.';  -- Global package name
227 end pay_amt_shd;