DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_OSE_SHD

Source


1 Package Body per_ose_shd as
2 /* $Header: peoserhi.pkb 120.2.12000000.1 2007/01/22 00:38:55 appldev ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_ose_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_ORG_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_ORG_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_ORG_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_ORG_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_ORG_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_ORG_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_org_structure_element_id             in     number
76   ,p_object_version_number                in     number
77   )
78   Return Boolean Is
79 --
80   --
81   -- Cursor selects the 'current' row from the HR Schema
82   --
83   Cursor C_Sel1 is
84     select
85        org_structure_element_id
86       ,business_group_id
87       ,organization_id_parent
88       ,org_structure_version_id
89       ,organization_id_child
90       ,request_id
91       ,program_application_id
92       ,program_id
93       ,program_update_date
94       ,object_version_number
95       ,position_control_enabled_flag
96     from	per_org_structure_elements
97     where	org_structure_element_id = p_org_structure_element_id;
98 --
99   l_fct_ret	boolean;
100 --
101 Begin
102   --
103   If (p_org_structure_element_id is null and
104       p_object_version_number is null
105      ) Then
106     --
107     -- One of the primary key arguments is null therefore we must
108     -- set the returning function value to false
109     --
110     l_fct_ret := false;
111   Else
112     If (p_org_structure_element_id
113         = per_ose_shd.g_old_rec.org_structure_element_id and
114         p_object_version_number
115         = per_ose_shd.g_old_rec.object_version_number
116        ) Then
120       --
117       --
118       -- The g_old_rec is current therefore we must
119       -- set the returning function to true
121       l_fct_ret := true;
122     Else
123       --
124       -- Select the current row into g_old_rec
125       --
126       Open C_Sel1;
127       Fetch C_Sel1 Into per_ose_shd.g_old_rec;
128       If C_Sel1%notfound Then
129         Close C_Sel1;
130         --
131         -- The primary key is invalid therefore we must error
132         --
133         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
134         fnd_message.raise_error;
135       End If;
136       Close C_Sel1;
137       If (p_object_version_number
138           <> per_ose_shd.g_old_rec.object_version_number) Then
139         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
140         fnd_message.raise_error;
141       End If;
142       l_fct_ret := true;
143     End If;
144   End If;
145   Return (l_fct_ret);
146 --
147 End api_updating;
148 --
149 -- ----------------------------------------------------------------------------
150 -- |---------------------------------< lck >----------------------------------|
151 -- ----------------------------------------------------------------------------
152 Procedure lck
153   (p_org_structure_element_id             in     number
154   ,p_object_version_number                in     number
155   ) is
156 --
157 -- Cursor selects the 'current' row from the HR Schema
158 --
159   Cursor C_Sel1 is
160     select
161        org_structure_element_id
162       ,business_group_id
163       ,organization_id_parent
164       ,org_structure_version_id
165       ,organization_id_child
166       ,request_id
167       ,program_application_id
168       ,program_id
169       ,program_update_date
170       ,object_version_number
171       ,position_control_enabled_flag
172     from	per_org_structure_elements
173     where	org_structure_element_id = p_org_structure_element_id
174     for	update nowait;
175 --
176   l_proc	varchar2(72) := g_package||'lck';
177 --
178 Begin
179   hr_utility.set_location('Entering:'||l_proc, 5);
180   --
181   hr_api.mandatory_arg_error
182     (p_api_name           => l_proc
183     ,p_argument           => 'ORG_STRUCTURE_ELEMENT_ID'
184     ,p_argument_value     => p_org_structure_element_id
185     );
186   --
187   Open  C_Sel1;
188   Fetch C_Sel1 Into per_ose_shd.g_old_rec;
189   If C_Sel1%notfound then
190     Close C_Sel1;
191     --
192     -- The primary key is invalid therefore we must error
193     --
194     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
195     fnd_message.raise_error;
196   End If;
197   Close C_Sel1;
198   If (p_object_version_number
199       <> per_ose_shd.g_old_rec.object_version_number) Then
200         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
201         fnd_message.raise_error;
202   End If;
203   --
204   hr_utility.set_location(' Leaving:'||l_proc, 10);
205   --
206   -- We need to trap the ORA LOCK exception
207   --
208 Exception
209   When HR_Api.Object_Locked then
210     --
211     -- The object is locked therefore we need to supply a meaningful
212     -- error message.
213     --
214     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
215     fnd_message.set_token('TABLE_NAME', 'per_org_structure_elements');
216     fnd_message.raise_error;
217 End lck;
218 --
219 -- ----------------------------------------------------------------------------
220 -- |-----------------------------< convert_args >-----------------------------|
221 -- ----------------------------------------------------------------------------
222 Function convert_args
223   (p_org_structure_element_id       in number
224   ,p_business_group_id              in number
225   ,p_organization_id_parent         in number
226   ,p_org_structure_version_id       in number
227   ,p_organization_id_child          in number
228   ,p_request_id                     in number
229   ,p_program_application_id         in number
230   ,p_program_id                     in number
231   ,p_program_update_date            in date
232   ,p_object_version_number          in number
233   ,p_pos_control_enabled_flag       in varchar2
234   )
235   Return g_rec_type is
236 --
237   l_rec   g_rec_type;
238 --
239 Begin
240   --
241   -- Convert arguments into local l_rec structure.
242   --
243   l_rec.org_structure_element_id         := p_org_structure_element_id;
244   l_rec.business_group_id                := p_business_group_id;
245   l_rec.organization_id_parent           := p_organization_id_parent;
246   l_rec.org_structure_version_id         := p_org_structure_version_id;
247   l_rec.organization_id_child            := p_organization_id_child;
248   l_rec.request_id                       := p_request_id;
249   l_rec.program_application_id           := p_program_application_id;
250   l_rec.program_id                       := p_program_id;
251   l_rec.program_update_date              := p_program_update_date;
252   l_rec.object_version_number            := p_object_version_number;
253   l_rec.position_control_enabled_flag    := p_pos_control_enabled_flag;
254   --
255   -- Return the plsql record structure.
256   --
257   Return(l_rec);
258 --
259 End convert_args;
260 --
261 end per_ose_shd;