[Home] [Help]
PACKAGE BODY: APPS.PAY_PTA_SHD
Source
1 Package Body pay_pta_shd as
2 /* $Header: pyptarhi.pkb 120.0 2005/05/29 07:56:20 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_pta_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_DATED_TABLES_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_DATED_TABLES_UK') Then
27 -- Bug no. 3526519. Duplicate record message was not clear.
28 fnd_message.set_name('PAY', 'PER_7901_SYS_DUPLICATE_RECORDS');
29 fnd_message.raise_error;
30 /* fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
31 fnd_message.set_token('PROCEDURE', l_proc);
32 fnd_message.set_token('STEP','10');
33 fnd_message.raise_error; */
34 Else
35 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
36 fnd_message.set_token('PROCEDURE', l_proc);
37 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
38 fnd_message.raise_error;
39 End If;
40 --
41 End constraint_error;
42 --
43 -- ----------------------------------------------------------------------------
44 -- |-----------------------------< api_updating >-----------------------------|
45 -- ----------------------------------------------------------------------------
46 Function api_updating
47 (p_dated_table_id in number
48 ,p_object_version_number in number
49 )
50 Return Boolean Is
51 --
52 --
53 -- Cursor selects the 'current' row from the HR Schema
54 --
55 Cursor C_Sel1 is
56 select
57 dated_table_id
58 ,table_name
59 ,application_id
60 ,surrogate_key_name
61 ,start_date_name
62 ,end_date_name
63 ,business_group_id
64 ,legislation_code
65 ,object_version_number
66 ,dyn_trigger_type
67 ,dyn_trigger_package_name
68 ,dyn_trig_pkg_generated
69 from pay_dated_tables
70 where dated_table_id = p_dated_table_id;
71 --
72 l_fct_ret boolean;
73 --
74 Begin
75 --
76 If (p_dated_table_id is null and
77 p_object_version_number is null
78 ) Then
79 --
80 -- One of the primary key arguments is null therefore we must
81 -- set the returning function value to false
82 --
83 l_fct_ret := false;
84 Else
85 If (p_dated_table_id
86 = pay_pta_shd.g_old_rec.dated_table_id and
87 p_object_version_number
88 = pay_pta_shd.g_old_rec.object_version_number
89 ) Then
90 --
91 -- The g_old_rec is current therefore we must
92 -- set the returning function to true
93 --
94 l_fct_ret := true;
95 Else
96 --
97 -- Select the current row into g_old_rec
98 --
99 Open C_Sel1;
100 Fetch C_Sel1 Into pay_pta_shd.g_old_rec;
101 If C_Sel1%notfound Then
102 Close C_Sel1;
103 --
104 -- The primary key is invalid therefore we must error
105 --
106 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
107 fnd_message.raise_error;
108 End If;
109 Close C_Sel1;
110 If (p_object_version_number
111 <> pay_pta_shd.g_old_rec.object_version_number) Then
112 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
113 fnd_message.raise_error;
114 End If;
115 l_fct_ret := true;
116 End If;
117 End If;
118 Return (l_fct_ret);
119 --
120 End api_updating;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |---------------------------------< lck >----------------------------------|
124 -- ----------------------------------------------------------------------------
125 Procedure lck
126 (p_dated_table_id in number
127 ,p_object_version_number in number
128 ) is
129 --
130 -- Cursor selects the 'current' row from the HR Schema
131 --
132 Cursor C_Sel1 is
133 select
134 dated_table_id
135 ,table_name
136 ,application_id
137 ,surrogate_key_name
138 ,start_date_name
139 ,end_date_name
140 ,business_group_id
141 ,legislation_code
142 ,object_version_number
143 ,dyn_trigger_type
144 ,dyn_trigger_package_name
145 ,dyn_trig_pkg_generated
146 from pay_dated_tables
147 where dated_table_id = p_dated_table_id
148 for update nowait;
149 --
150 l_proc varchar2(72) := g_package||'lck';
151 --
152 Begin
153 hr_utility.set_location('Entering:'||l_proc, 5);
154 --
155 hr_api.mandatory_arg_error
156 (p_api_name => l_proc
157 ,p_argument => 'DATED_TABLE_ID'
158 ,p_argument_value => p_dated_table_id
159 );
160 --
161 Open C_Sel1;
162 Fetch C_Sel1 Into pay_pta_shd.g_old_rec;
163 If C_Sel1%notfound then
164 Close C_Sel1;
165 --
166 -- The primary key is invalid therefore we must error
167 --
168 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
169 fnd_message.raise_error;
170 End If;
171 Close C_Sel1;
172 If (p_object_version_number
173 <> pay_pta_shd.g_old_rec.object_version_number) Then
174 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
175 fnd_message.raise_error;
176 End If;
177 --
178 hr_utility.set_location(' Leaving:'||l_proc, 10);
179 --
180 -- We need to trap the ORA LOCK exception
181 --
182 Exception
183 When HR_Api.Object_Locked then
184 --
185 -- The object is locked therefore we need to supply a meaningful
186 -- error message.
187 --
188 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
189 fnd_message.set_token('TABLE_NAME', 'pay_dated_tables');
190 fnd_message.raise_error;
191 End lck;
192 --
193 -- ----------------------------------------------------------------------------
194 -- |-----------------------------< convert_args >-----------------------------|
195 -- ----------------------------------------------------------------------------
196 Function convert_args
197 (p_dated_table_id in number
198 ,p_table_name in varchar2
199 ,p_application_id in number
200 ,p_surrogate_key_name in varchar2
201 ,p_start_date_name in varchar2
202 ,p_end_date_name in varchar2
203 ,p_business_group_id in number
204 ,p_legislation_code in varchar2
205 ,p_object_version_number in number
206 ,p_dyn_trigger_type in varchar2
207 ,p_dyn_trigger_package_name in varchar2
208 ,p_dyn_trig_pkg_generated in varchar2
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.dated_table_id := p_dated_table_id;
219 l_rec.table_name := p_table_name;
220 l_rec.application_id := p_application_id;
221 l_rec.surrogate_key_name := p_surrogate_key_name;
222 l_rec.start_date_name := p_start_date_name;
223 l_rec.end_date_name := p_end_date_name;
224 l_rec.business_group_id := p_business_group_id;
225 l_rec.legislation_code := p_legislation_code;
226 l_rec.object_version_number := p_object_version_number;
227 l_rec.dyn_trigger_type := p_dyn_trigger_type;
228 l_rec.dyn_trigger_package_name := p_dyn_trigger_package_name;
229 l_rec.dyn_trig_pkg_generated := p_dyn_trig_pkg_generated;
230 --
231 -- Return the plsql record structure.
232 --
233 Return(l_rec);
234 --
235 End convert_args;
236 --
237 end pay_pta_shd;