DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PEU_SHD

Source


1 Package Body pay_peu_shd as
2 /* $Header: pypeurhi.pkb 120.0 2005/05/29 07:29:11 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_peu_shd.';  -- 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) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   If (p_constraint_name = 'PAY_EVENT_UPDATE_ID_PK') Then
33     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','5');
36     fnd_message.raise_error;
37   ElsIf (p_constraint_name = 'PAY_EVENT_UPD_ETYPE_CHK') Then
38     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('STEP','10');
41     fnd_message.raise_error;
42   Else
43     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
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_event_update_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        event_update_id
66       ,table_name
67       ,column_name
68       ,dated_table_id
69       ,business_group_id
70       ,legislation_code
71       ,change_type
72       ,event_type
73       ,object_version_number
74     from	pay_event_updates
75     where	event_update_id = p_event_update_id;
76 --
77   l_fct_ret	boolean;
78 --
79 Begin
80   --
81   If (p_event_update_id is null and
82       p_object_version_number is null
83      ) Then
84     --
85     -- One of the primary key arguments is null therefore we must
86     -- set the returning function value to false
87     --
88     l_fct_ret := false;
89   Else
90     If (p_event_update_id
91         = pay_peu_shd.g_old_rec.event_update_id and
92         p_object_version_number
93         = pay_peu_shd.g_old_rec.object_version_number
94        ) Then
95       --
96       -- The g_old_rec is current therefore we must
97       -- set the returning function to true
98       --
99       l_fct_ret := true;
100     Else
101       --
102       -- Select the current row into g_old_rec
103       --
104       Open C_Sel1;
105       Fetch C_Sel1 Into pay_peu_shd.g_old_rec;
106       If C_Sel1%notfound Then
107         Close C_Sel1;
108         --
109         -- The primary key is invalid therefore we must error
110         --
111         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
112         fnd_message.raise_error;
113       End If;
114       Close C_Sel1;
115       If (p_object_version_number
116           <> pay_peu_shd.g_old_rec.object_version_number) Then
117         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
118         fnd_message.raise_error;
119       End If;
120       l_fct_ret := true;
121     End If;
122   End If;
123   Return (l_fct_ret);
124 --
125 End api_updating;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |---------------------------------< lck >----------------------------------|
129 -- ----------------------------------------------------------------------------
130 Procedure lck
131   (p_event_update_id                      in     number
132   ,p_object_version_number                in     number
133   ) is
134 --
135 -- Cursor selects the 'current' row from the HR Schema
136 --
137   Cursor C_Sel1 is
138     select
139        event_update_id
140       ,table_name
141       ,column_name
142       ,dated_table_id
143       ,business_group_id
144       ,legislation_code
145       ,change_type
146       ,event_type
147       ,object_version_number
148     from	pay_event_updates
149     where	event_update_id = p_event_update_id
150     for	update nowait;
151 --
152   l_proc	varchar2(72) := g_package||'lck';
153 --
154 Begin
155   hr_utility.set_location('Entering:'||l_proc, 5);
156   --
157   hr_api.mandatory_arg_error
158     (p_api_name           => l_proc
159     ,p_argument           => 'EVENT_UPDATE_ID'
160     ,p_argument_value     => p_event_update_id
161     );
162   --
163   Open  C_Sel1;
164   Fetch C_Sel1 Into pay_peu_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_peu_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_event_updates');
192     fnd_message.raise_error;
193 End lck;
194 --
195 -- ----------------------------------------------------------------------------
196 -- |-----------------------------< convert_args >-----------------------------|
197 -- ----------------------------------------------------------------------------
198 Function convert_args
199   (p_event_update_id                in number
200   ,p_table_name                     in varchar2
201   ,p_column_name                    in varchar2
202   ,p_dated_table_id                 in number
203   ,p_business_group_id              in number
204   ,p_legislation_code               in varchar2
205   ,p_change_type                    in varchar2
206   ,p_event_type                     in varchar2
207   ,p_object_version_number          in number
208   )
209   Return g_rec_type is
210 --
211   l_rec   g_rec_type;
212 --
213 Begin
214   --
215   -- Convert arguments into local l_rec structure.
216   --
217   l_rec.event_update_id                  := p_event_update_id;
218   l_rec.table_name                       := p_table_name;
219   l_rec.column_name                      := p_column_name;
220   l_rec.dated_table_id                   := p_dated_table_id;
221   l_rec.business_group_id                := p_business_group_id;
222   l_rec.legislation_code                 := p_legislation_code;
223   l_rec.change_type                      := p_change_type;
224   l_rec.event_type                       := p_event_type;
225   l_rec.object_version_number            := p_object_version_number;
226   --
227   -- Return the plsql record structure.
228   --
229   Return(l_rec);
230 --
231 End convert_args;
232 --
233 end pay_peu_shd;