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