[Home] [Help]
PACKAGE BODY: APPS.PAY_ETT_SHD
Source
1 Package Body pay_ett_shd as
2 /* $Header: pyettrhi.pkb 120.1 2005/10/04 22:03:25 pgongada noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_ett_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_TYPES_F_TL_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 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_element_type_id in number
40 ,p_language in varchar2
41 ) Return Boolean Is
42 --
43 --
44 -- Cursor selects the 'current' row from the HR Schema
45 --
46 Cursor C_Sel1 is
47 select
48 element_type_id
49 ,element_name
50 ,reporting_name
51 ,description
52 ,language
53 ,source_lang
54 from pay_element_types_f_tl
55 where element_type_id = p_element_type_id
56 and language = p_language;
57 --
58 l_fct_ret boolean;
59 --
60 Begin
61 --
62 If (p_element_type_id is null or
63 p_language is null
64 ) Then
65 --
66 -- One of the primary key arguments is null therefore we must
67 -- set the returning function value to false
68 --
69 l_fct_ret := false;
70 Else
71 If (p_element_type_id
72 = pay_ett_shd.g_old_rec.element_type_id and
73 p_language
74 = pay_ett_shd.g_old_rec.language
75 ) Then
76 --
77 -- The g_old_rec is current therefore we must
78 -- set the returning function to true
79 --
80 l_fct_ret := true;
81 Else
82 --
83 -- Select the current row into g_old_rec
84 --
85 Open C_Sel1;
86 Fetch C_Sel1 Into pay_ett_shd.g_old_rec;
87 If C_Sel1%notfound Then
88 Close C_Sel1;
89 --
90 -- The primary key is invalid therefore we must error
91 --
92 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
93 fnd_message.raise_error;
94 End If;
95 Close C_Sel1;
96 --
97 l_fct_ret := true;
98 End If;
99 End If;
100 Return (l_fct_ret);
101 --
102 End api_updating;
103 --
104 -- ----------------------------------------------------------------------------
105 -- |---------------------------------< lck >----------------------------------|
106 -- ----------------------------------------------------------------------------
107 Procedure lck
108 (p_element_type_id in number
109 ,p_language in varchar2
110 ) is
111 --
112 -- Cursor selects the 'current' row from the HR Schema
113 --
114 Cursor C_Sel1 is
115 select
116 element_type_id
117 ,element_name
118 ,reporting_name
119 ,description
120 ,language
121 ,source_lang
122 from pay_element_types_f_tl
123 where element_type_id = p_element_type_id
124 and language = p_language
125 for update nowait;
126 --
127 l_proc varchar2(72) := g_package||'lck';
128 --
129 Begin
130 hr_utility.set_location('Entering:'||l_proc, 5);
131 --
132 hr_api.mandatory_arg_error
133 (p_api_name => l_proc
134 ,p_argument => 'ELEMENT_TYPE_ID'
135 ,p_argument_value => p_element_type_id
136 );
137 hr_utility.set_location(l_proc,6);
138 hr_api.mandatory_arg_error
139 (p_api_name => l_proc
140 ,p_argument => 'LANGUAGE'
141 ,p_argument_value => p_language
142 );
143 --
144 Open C_Sel1;
145 Fetch C_Sel1 Into pay_ett_shd.g_old_rec;
146 If C_Sel1%notfound then
147 Close C_Sel1;
148 --
149 -- The primary key is invalid therefore we must error
150 --
151 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
152 fnd_message.raise_error;
153 End If;
154 Close C_Sel1;
155 --
156 --
157 hr_utility.set_location(' Leaving:'||l_proc, 10);
158 --
159 -- We need to trap the ORA LOCK exception
160 --
161 Exception
162 When HR_Api.Object_Locked then
163 --
164 -- The object is locked therefore we need to supply a meaningful
165 -- error message.
166 --
167 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
168 fnd_message.set_token('TABLE_NAME', 'pay_element_types_f_tl');
169 fnd_message.raise_error;
170 End lck;
171 --
172 -- ----------------------------------------------------------------------------
173 -- |----------------------------< add_language >------------------------------|
174 -- ----------------------------------------------------------------------------
175 --
176 -- This procedure has been added after running the UNIX program tltblgen.
177 --
178 -- ----------------------------------------------------------------------------
179 procedure ADD_LANGUAGE
180 is
181 begin
182 delete from PAY_ELEMENT_TYPES_F_TL T
183 where not exists
184 (select NULL
185 from PAY_ELEMENT_TYPES_F B
186 where B.ELEMENT_TYPE_ID = T.ELEMENT_TYPE_ID
187 );
188
189 update PAY_ELEMENT_TYPES_F_TL T set (
190 ELEMENT_NAME ) =
191 (select B.ELEMENT_NAME
192 from PAY_ELEMENT_TYPES_F_TL B
193 where B.ELEMENT_TYPE_ID = T.ELEMENT_TYPE_ID
194 and B.LANGUAGE = T.SOURCE_LANG)
195 where (
196 T.ELEMENT_TYPE_ID,
197 T.LANGUAGE
198 ) in (select
199 SUBT.ELEMENT_TYPE_ID,
200 SUBT.LANGUAGE
201 from PAY_ELEMENT_TYPES_F_TL SUBB, PAY_ELEMENT_TYPES_F_TL SUBT
202 where SUBB.ELEMENT_TYPE_ID = SUBT.ELEMENT_TYPE_ID
203 and SUBB.LANGUAGE = SUBT.SOURCE_LANG
204 and (SUBB.ELEMENT_NAME <> SUBT.ELEMENT_NAME
205 ));
206 insert into PAY_ELEMENT_TYPES_F_TL (
207 ELEMENT_TYPE_ID,
208 ELEMENT_NAME,
209 REPORTING_NAME,
210 DESCRIPTION,
211 LAST_UPDATE_DATE,
212 LAST_UPDATED_BY,
213 LAST_UPDATE_LOGIN,
214 CREATED_BY,
215 CREATION_DATE,
216 LANGUAGE,
217 SOURCE_LANG
218 ) select
219 B.ELEMENT_TYPE_ID,
220 B.ELEMENT_NAME,
221 B.REPORTING_NAME,
222 B.DESCRIPTION,
223 B.LAST_UPDATE_DATE,
224 B.LAST_UPDATED_BY,
225 B.LAST_UPDATE_LOGIN,
226 B.CREATED_BY,
227 B.CREATION_DATE,
228 L.LANGUAGE_CODE,
229 B.SOURCE_LANG
230 from PAY_ELEMENT_TYPES_F_TL B, FND_LANGUAGES L
231 where L.INSTALLED_FLAG in ('I', 'B')
232 and B.LANGUAGE = userenv('LANG')
233 and not exists
234 (select NULL
235 from PAY_ELEMENT_TYPES_F_TL T
236 where T.ELEMENT_TYPE_ID = B.ELEMENT_TYPE_ID
237 and T.LANGUAGE = L.LANGUAGE_CODE);
238 end ADD_LANGUAGE;
239 --
240 -- ----------------------------------------------------------------------------
241 -- |-----------------------------< convert_args >-----------------------------|
242 -- ----------------------------------------------------------------------------
243 Function convert_args
244 (p_element_type_id in number
245 ,p_element_name in varchar2
246 ,p_reporting_name in varchar2
247 ,p_description in varchar2
248 ,p_language in varchar2
249 ,p_source_lang in varchar2
250 )
251 Return g_rec_type is
252 --
253 l_rec g_rec_type;
254 --
255 Begin
256 --
257 -- Convert arguments into local l_rec structure.
258 --
259 l_rec.element_type_id := p_element_type_id;
260 l_rec.element_name := p_element_name;
261 l_rec.reporting_name := p_reporting_name;
262 l_rec.description := p_description;
263 l_rec.language := p_language;
264 l_rec.source_lang := p_source_lang;
265 --
266 -- Return the plsql record structure.
267 --
268 Return(l_rec);
269 --
270 End convert_args;
271 --
272 end pay_ett_shd;