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