DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_ENV_SHD

Source


1 Package Body per_env_shd as
2 /* $Header: peenvrhi.pkb 120.1 2005/08/04 03:23:12 vegopala noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_env_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc        varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If (p_constraint_name = 'SYS_C00293446') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   Else
27     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30     fnd_message.raise_error;
31   End If;
32   --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39   (p_cal_entry_value_id                   in     number
40   ,p_object_version_number                in     number
41   )
42   Return Boolean Is
43   --
44   --
45   -- Cursor selects the 'current' row from the HR Schema
46   --
47   Cursor C_Sel1 is
48     select
49        cal_entry_value_id
50       ,calendar_entry_id
51       ,hierarchy_node_id
52       ,idvalue
53       ,org_structure_element_id
54       ,organization_id
55       ,usage_flag
56       ,override_name
57       ,override_type
58       ,parent_entry_value_id
59       ,identifier_key
60       ,object_version_number
61     from        per_cal_entry_values
62     where       cal_entry_value_id = p_cal_entry_value_id;
63   --
64   l_fct_ret     boolean;
65   --
66 Begin
67   --
68   If (p_cal_entry_value_id is null and
69       p_object_version_number is null
70      ) Then
71     --
72     -- One of the primary key arguments is null therefore we must
73     -- set the returning function value to false
74     --
75     l_fct_ret := false;
76   Else
77     If (p_cal_entry_value_id
78         = per_env_shd.g_old_rec.cal_entry_value_id and
79         p_object_version_number
80         = per_env_shd.g_old_rec.object_version_number
81        ) Then
82       --
83       -- The g_old_rec is current therefore we must
84       -- set the returning function to true
85       --
86       l_fct_ret := true;
87     Else
88       --
89       -- Select the current row into g_old_rec
90       --
91       Open C_Sel1;
92       Fetch C_Sel1 Into per_env_shd.g_old_rec;
93       If C_Sel1%notfound Then
94         Close C_Sel1;
95         --
96         -- The primary key is invalid therefore we must error
97         --
98         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
99         fnd_message.raise_error;
100       End If;
101       Close C_Sel1;
102       If (p_object_version_number
103           <> per_env_shd.g_old_rec.object_version_number) Then
104         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
105         fnd_message.raise_error;
106       End If;
107       l_fct_ret := true;
108     End If;
109   End If;
110   Return (l_fct_ret);
111 --
112 End api_updating;
113 --
114 -- ----------------------------------------------------------------------------
115 -- |---------------------------------< lck >----------------------------------|
116 -- ----------------------------------------------------------------------------
117 Procedure lck
118   (p_cal_entry_value_id                   in     number
119   ,p_object_version_number                in     number
120   ) is
121 --
122 -- Cursor selects the 'current' row from the HR Schema
123 --
124   Cursor C_Sel1 is
125     select
126        cal_entry_value_id
127       ,calendar_entry_id
128       ,hierarchy_node_id
129       ,idvalue
130       ,org_structure_element_id
131       ,organization_id
132       ,usage_flag
133       ,override_name
134       ,override_type
135       ,parent_entry_value_id
136       ,identifier_key
137       ,object_version_number
138     from        per_cal_entry_values
139     where       cal_entry_value_id = p_cal_entry_value_id
140     for update nowait;
141 
142 --
143   l_proc        varchar2(72) := g_package||'lck';
144 --
145 Begin
146   hr_utility.set_location('Entering:'||l_proc, 5);
147   --
148   hr_api.mandatory_arg_error
149     (p_api_name           => l_proc
150     ,p_argument           => 'CAL_ENTRY_VALUE_ID'
151     ,p_argument_value     => p_cal_entry_value_id
152     );
153   hr_utility.set_location(l_proc,6);
154   hr_api.mandatory_arg_error
155     (p_api_name           => l_proc
156     ,p_argument           => 'OBJECT_VERSION_NUMBER'
157     ,p_argument_value     => p_object_version_number
158     );
159   --
160   Open  C_Sel1;
161   Fetch C_Sel1 Into per_env_shd.g_old_rec;
162   If C_Sel1%notfound then
163     Close C_Sel1;
164     --
165     -- The primary key is invalid therefore we must error
166     --
167     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
168     fnd_message.raise_error;
169   End If;
170   Close C_Sel1;
171   If (p_object_version_number
172       <> per_env_shd.g_old_rec.object_version_number) Then
173         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
174         fnd_message.raise_error;
175   End If;
176   --
177   hr_utility.set_location(' Leaving:'||l_proc, 10);
178   --
179   -- We need to trap the ORA LOCK exception
180   --
181 Exception
182   When HR_Api.Object_Locked then
183     --
184     -- The object is locked therefore we need to supply a meaningful
185     -- error message.
186     --
187     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
188     fnd_message.set_token('TABLE_NAME', 'per_cal_entry_values');
189     fnd_message.raise_error;
190 End lck;
191 --
192 -- ----------------------------------------------------------------------------
193 -- |-----------------------------< convert_args >-----------------------------|
194 -- ----------------------------------------------------------------------------
195 Function convert_args
196   (p_cal_entry_value_id             in number
197   ,p_calendar_entry_id              in number
198   ,p_hierarchy_node_id              in number
199   ,p_value                          in varchar2
200   ,p_org_structure_element_id       in number
201   ,p_organization_id                in number
202   ,p_override_name                  in varchar2
203   ,p_override_type                  in varchar2
204   ,p_parent_entry_value_id          in number
205   ,p_identifier_key                 in varchar2
206   ,p_object_version_number          in number
207   ,p_usage_flag                     in varchar2
208 
209   )
210   Return g_rec_type is
211 --
212   l_rec   g_rec_type;
213 --
214 Begin
215   --
216   -- Convert arguments into local l_rec structure.
217   --
218   l_rec.cal_entry_value_id               := p_cal_entry_value_id;
219   l_rec.calendar_entry_id                := p_calendar_entry_id;
220   l_rec.hierarchy_node_id                := p_hierarchy_node_id;
221   l_rec.value                            := p_value;
222   l_rec.org_structure_element_id         := p_org_structure_element_id;
223   l_rec.organization_id                  := p_organization_id;
224   l_rec.override_name                    := p_override_name;
225   l_rec.override_type                    := p_override_type;
226   l_rec.parent_entry_value_id            := p_parent_entry_value_id;
227   l_rec.identifier_key                   := p_identifier_key;
228   l_rec.object_version_number            := p_object_version_number;
229   l_rec.usage_flag                       := p_usage_flag;
230   --
231   -- Return the plsql record structure.
232   --
233   Return(l_rec);
234 --
235 End convert_args;
236 --
237 end per_env_shd;