DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_PSE_SHD

Source


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