DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PEV_SHD

Source


1 Package Body pay_pev_shd as
2 /* $Header: pypperhi.pkb 120.1.12010000.1 2008/07/27 23:25:17 appldev ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  pay_pev_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_PROCESS_EVENTS_FK2') 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_PROCESS_EVENT_FK1') 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   ElsIf (p_constraint_name = 'PAY_PROCESS_EVENT_ID_PK') Then
43     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('STEP','15');
46     fnd_message.raise_error;
47   Else
48     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
49     fnd_message.set_token('PROCEDURE', l_proc);
50     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
51     fnd_message.raise_error;
52   End If;
53   --
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60   (p_process_event_id                     in     number
61   ,p_object_version_number                in     number
62   )
63   Return Boolean Is
64 --
65   --
66   -- Cursor selects the 'current' row from the HR Schema
67   --
68   Cursor C_Sel1 is
69     select
70        process_event_id
71       ,assignment_id
72       ,effective_date
73       ,change_type
74       ,status
75       ,description
76       ,event_update_id
77       ,business_group_id
78       ,org_process_event_group_id
79       ,surrogate_key
80       ,object_version_number
81       ,calculation_date
82       ,retroactive_status
83       ,noted_value
84     from	pay_process_events
85     where	process_event_id = p_process_event_id;
86 --
87   l_fct_ret	boolean;
88 --
89 Begin
90   --
91   If (p_process_event_id is null and
92       p_object_version_number is null
93      ) Then
94     --
95     -- One of the primary key arguments is null therefore we must
96     -- set the returning function value to false
97     --
98     l_fct_ret := false;
99   Else
100     If (p_process_event_id
101         = pay_pev_shd.g_old_rec.process_event_id and
102         p_object_version_number
103         = pay_pev_shd.g_old_rec.object_version_number
104        ) Then
105       --
106       -- The g_old_rec is current therefore we must
107       -- set the returning function to true
108       --
109       l_fct_ret := true;
110     Else
111       --
112       -- Select the current row into g_old_rec
113       --
114       Open C_Sel1;
115       Fetch C_Sel1 Into pay_pev_shd.g_old_rec;
116       If C_Sel1%notfound Then
117         Close C_Sel1;
118         --
119         -- The primary key is invalid therefore we must error
120         --
121         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
122         fnd_message.raise_error;
123       End If;
124       Close C_Sel1;
125       If (p_object_version_number
126           <> pay_pev_shd.g_old_rec.object_version_number) Then
127         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
128         fnd_message.raise_error;
129       End If;
130       l_fct_ret := true;
131     End If;
132   End If;
133   Return (l_fct_ret);
134 --
135 End api_updating;
136 --
137 -- ----------------------------------------------------------------------------
138 -- |---------------------------------< lck >----------------------------------|
139 -- ----------------------------------------------------------------------------
140 Procedure lck
141   (p_process_event_id                     in     number
142   ,p_object_version_number                in     number
143   ) is
144 --
145 -- Cursor selects the 'current' row from the HR Schema
146 --
147   Cursor C_Sel1 is
148     select
149        process_event_id
150       ,assignment_id
151       ,effective_date
152       ,change_type
153       ,status
154       ,description
155       ,event_update_id
156       ,business_group_id
157       ,org_process_event_group_id
158       ,surrogate_key
159       ,object_version_number
160       ,calculation_date
161       ,retroactive_status
162       ,noted_value
163     from	pay_process_events
164     where	process_event_id = p_process_event_id
165     for	update nowait;
166 --
167   l_proc	varchar2(72) := g_package||'lck';
168 --
169 Begin
170   hr_utility.set_location('Entering:'||l_proc, 5);
171   --
172   hr_api.mandatory_arg_error
173     (p_api_name           => l_proc
174     ,p_argument           => 'PROCESS_EVENT_ID'
175     ,p_argument_value     => p_process_event_id
176     );
177   --
178   Open  C_Sel1;
179   Fetch C_Sel1 Into pay_pev_shd.g_old_rec;
180   If C_Sel1%notfound then
181     Close C_Sel1;
182     --
183     -- The primary key is invalid therefore we must error
184     --
185     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
186     fnd_message.raise_error;
187   End If;
188   Close C_Sel1;
189   If (p_object_version_number
190       <> pay_pev_shd.g_old_rec.object_version_number) Then
191         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
192         fnd_message.raise_error;
193   End If;
194   --
195   hr_utility.set_location(' Leaving:'||l_proc, 10);
196   --
197   -- We need to trap the ORA LOCK exception
198   --
199 Exception
200   When HR_Api.Object_Locked then
201     --
202     -- The object is locked therefore we need to supply a meaningful
203     -- error message.
204     --
205     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
206     fnd_message.set_token('TABLE_NAME', 'pay_process_events');
207     fnd_message.raise_error;
208 End lck;
209 --
210 -- ----------------------------------------------------------------------------
211 -- |-----------------------------< convert_args >-----------------------------|
212 -- ----------------------------------------------------------------------------
213 Function convert_args
214   (p_process_event_id               in number
215   ,p_assignment_id                  in number
216   ,p_effective_date                 in date
217   ,p_change_type                    in varchar2
218   ,p_status                         in varchar2
219   ,p_description                    in varchar2
220   ,p_event_update_id                in number
221   ,p_business_group_id              in number
222   ,p_org_process_event_group_id     in number
223   ,p_surrogate_key                  in varchar2
224   ,p_object_version_number          in number
225   ,p_calculation_date               in date
226   ,p_retroactive_status             in varchar2
227   ,p_noted_value                    in varchar2
228   )
229   Return g_rec_type is
230 --
231   l_rec   g_rec_type;
232 --
233 Begin
234   --
235   -- Convert arguments into local l_rec structure.
236   --
237   l_rec.process_event_id                 := p_process_event_id;
238   l_rec.assignment_id                    := p_assignment_id;
239   l_rec.effective_date                   := p_effective_date;
240   l_rec.change_type                      := p_change_type;
241   l_rec.status                           := p_status;
242   l_rec.description                      := p_description;
243   l_rec.event_update_id                  := p_event_update_id;
244   l_rec.business_group_id                := p_business_group_id;
245   l_rec.org_process_event_group_id       := p_org_process_event_group_id;
246   l_rec.surrogate_key                    := p_surrogate_key;
247   l_rec.object_version_number            := p_object_version_number;
248   l_rec.calculation_date                 := p_calculation_date;
249   l_rec.retroactive_status               := p_retroactive_status;
250   l_rec.noted_value                      := p_noted_value;
251   --
252   -- Return the plsql record structure.
253   --
254   Return(l_rec);
255 --
256 End convert_args;
257 --
258 end pay_pev_shd;