[Home] [Help]
PACKAGE BODY: APPS.PAY_ESU_SHD
Source
1 Package Body pay_esu_shd as
2 /* $Header: pyesurhi.pkb 115.1 2003/08/15 02:39:10 thabara noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_esu_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 = 'PAY_ELEMENT_SPAN_USAGES_PK') 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 ElsIf (p_constraint_name = 'PAY_ELEMENT_SPAN_USAGES_UK1') Then
27 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('STEP','10');
30 fnd_message.raise_error;
31 Else
32 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33 fnd_message.set_token('PROCEDURE', l_proc);
34 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35 fnd_message.raise_error;
36 End If;
37 --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44 (p_element_span_usage_id in number
45 ,p_object_version_number in number
46 )
47 Return Boolean Is
48 --
49 --
50 -- Cursor selects the 'current' row from the HR Schema
51 --
52 Cursor C_Sel1 is
53 select
54 element_span_usage_id
55 ,business_group_id
56 ,legislation_code
57 ,time_span_id
58 ,retro_component_usage_id
59 ,adjustment_type
60 ,retro_element_type_id
61 ,object_version_number
62 from pay_element_span_usages
63 where element_span_usage_id = p_element_span_usage_id;
64 --
65 l_fct_ret boolean;
66 --
67 Begin
68 --
69 If (p_element_span_usage_id is null and
70 p_object_version_number is null
71 ) Then
72 --
73 -- One of the primary key arguments is null therefore we must
74 -- set the returning function value to false
75 --
76 l_fct_ret := false;
77 Else
78 If (p_element_span_usage_id
79 = pay_esu_shd.g_old_rec.element_span_usage_id and
80 p_object_version_number
81 = pay_esu_shd.g_old_rec.object_version_number
82 ) Then
83 --
84 -- The g_old_rec is current therefore we must
85 -- set the returning function to true
86 --
87 l_fct_ret := true;
88 Else
89 --
90 -- Select the current row into g_old_rec
91 --
92 Open C_Sel1;
93 Fetch C_Sel1 Into pay_esu_shd.g_old_rec;
94 If C_Sel1%notfound Then
95 Close C_Sel1;
96 --
97 -- The primary key is invalid therefore we must error
98 --
99 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
100 fnd_message.raise_error;
101 End If;
102 Close C_Sel1;
103 If (p_object_version_number
104 <> pay_esu_shd.g_old_rec.object_version_number) Then
105 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
106 fnd_message.raise_error;
107 End If;
108 l_fct_ret := true;
109 End If;
110 End If;
111 Return (l_fct_ret);
112 --
113 End api_updating;
114 --
115 -- ----------------------------------------------------------------------------
116 -- |---------------------------------< lck >----------------------------------|
117 -- ----------------------------------------------------------------------------
118 Procedure lck
119 (p_element_span_usage_id in number
120 ,p_object_version_number in number
121 ) is
122 --
123 -- Cursor selects the 'current' row from the HR Schema
124 --
125 Cursor C_Sel1 is
126 select
127 element_span_usage_id
128 ,business_group_id
129 ,legislation_code
130 ,time_span_id
131 ,retro_component_usage_id
132 ,adjustment_type
133 ,retro_element_type_id
134 ,object_version_number
135 from pay_element_span_usages
136 where element_span_usage_id = p_element_span_usage_id
137 for update nowait;
138 --
139 l_proc varchar2(72) := g_package||'lck';
140 --
141 Begin
142 hr_utility.set_location('Entering:'||l_proc, 5);
143 --
144 hr_api.mandatory_arg_error
145 (p_api_name => l_proc
146 ,p_argument => 'ELEMENT_SPAN_USAGE_ID'
147 ,p_argument_value => p_element_span_usage_id
148 );
149 hr_utility.set_location(l_proc,6);
150 hr_api.mandatory_arg_error
151 (p_api_name => l_proc
152 ,p_argument => 'OBJECT_VERSION_NUMBER'
153 ,p_argument_value => p_object_version_number
154 );
155 --
156 Open C_Sel1;
157 Fetch C_Sel1 Into pay_esu_shd.g_old_rec;
158 If C_Sel1%notfound then
159 Close C_Sel1;
160 --
161 -- The primary key is invalid therefore we must error
162 --
163 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
164 fnd_message.raise_error;
165 End If;
166 Close C_Sel1;
167 If (p_object_version_number
168 <> pay_esu_shd.g_old_rec.object_version_number) Then
169 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
170 fnd_message.raise_error;
171 End If;
172 --
173 hr_utility.set_location(' Leaving:'||l_proc, 10);
174 --
175 -- We need to trap the ORA LOCK exception
176 --
177 Exception
178 When HR_Api.Object_Locked then
179 --
180 -- The object is locked therefore we need to supply a meaningful
181 -- error message.
182 --
183 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
184 fnd_message.set_token('TABLE_NAME', 'pay_element_span_usages');
185 fnd_message.raise_error;
186 End lck;
187 --
188 -- ----------------------------------------------------------------------------
189 -- |-----------------------------< convert_args >-----------------------------|
190 -- ----------------------------------------------------------------------------
191 Function convert_args
192 (p_element_span_usage_id in number
193 ,p_business_group_id in number
194 ,p_legislation_code in varchar2
195 ,p_time_span_id in number
196 ,p_retro_component_usage_id in number
197 ,p_adjustment_type in varchar2
198 ,p_retro_element_type_id in number
199 ,p_object_version_number in number
200 )
201 Return g_rec_type is
202 --
203 l_rec g_rec_type;
204 --
205 Begin
206 --
207 -- Convert arguments into local l_rec structure.
208 --
209 l_rec.element_span_usage_id := p_element_span_usage_id;
210 l_rec.business_group_id := p_business_group_id;
211 l_rec.legislation_code := p_legislation_code;
212 l_rec.time_span_id := p_time_span_id;
213 l_rec.retro_component_usage_id := p_retro_component_usage_id;
214 l_rec.adjustment_type := p_adjustment_type;
215 l_rec.retro_element_type_id := p_retro_element_type_id;
216 l_rec.object_version_number := p_object_version_number;
217 --
218 -- Return the plsql record structure.
219 --
220 Return(l_rec);
221 --
222 End convert_args;
223 --
224 end pay_esu_shd;