[Home] [Help]
PACKAGE BODY: APPS.PQH_WFS_SHD
Source
1 Package Body pqh_wfs_shd as
2 /* $Header: pqwfsrhi.pkb 115.7 2003/04/02 20:02:19 srajakum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_wfs_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
15 --
16 l_proc varchar2(72) := g_package||'constraint_error';
17 --
18 Begin
19 hr_utility.set_location('Entering:'||l_proc, 5);
20 --
21 If (p_constraint_name = 'PQH_WORKSHEET_FUND_SRCS_FK1') Then
22 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
23 hr_utility.set_message_token('PROCEDURE', l_proc);
24 hr_utility.set_message_token('STEP','5');
25 hr_utility.raise_error;
26 ElsIf (p_constraint_name = 'PQH_WORKSHEET_FUND_SRCS_FK2') Then
27 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
28 hr_utility.set_message_token('PROCEDURE', l_proc);
29 hr_utility.set_message_token('STEP','10');
30 hr_utility.raise_error;
31 ElsIf (p_constraint_name = 'PQH_WORKSHEET_FUND_SRCS_PK') Then
32 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
33 hr_utility.set_message_token('PROCEDURE', l_proc);
34 hr_utility.set_message_token('STEP','15');
35 hr_utility.raise_error;
36 ElsIf (p_constraint_name = 'PQH_WORKSHEET_FUND_SRCS_UK') Then
37 --
38 -- Code Changed to provide a more meaningful message on
39 -- unique constraint failure.
40 --
41 hr_utility.set_message(8302, 'PQH_DUPLICATE_BUDGET_SRCS');
42 hr_utility.raise_error;
43 /**
44 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
45 hr_utility.set_message_token('PROCEDURE', l_proc);
46 hr_utility.set_message_token('STEP','20');
47 hr_utility.raise_error;
48 **/
49 Else
50 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
51 hr_utility.set_message_token('PROCEDURE', l_proc);
52 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
53 hr_utility.raise_error;
54 End If;
55 --
56 hr_utility.set_location(' Leaving:'||l_proc, 10);
57 End constraint_error;
58 --
59 -- ----------------------------------------------------------------------------
60 -- |-----------------------------< api_updating >-----------------------------|
61 -- ----------------------------------------------------------------------------
62 Function api_updating
63 (
64 p_worksheet_fund_src_id in number,
65 p_object_version_number in number
66 ) Return Boolean Is
67 --
68 --
69 -- Cursor selects the 'current' row from the HR Schema
70 --
71 Cursor C_Sel1 is
72 select
73 worksheet_fund_src_id,
74 worksheet_bdgt_elmnt_id,
75 distribution_percentage,
76 cost_allocation_keyflex_id,
77 project_id,
78 award_id,
79 task_id,
80 expenditure_type,
81 organization_id,
82 object_version_number
83 from pqh_worksheet_fund_srcs
84 where worksheet_fund_src_id = p_worksheet_fund_src_id;
85 --
86 l_proc varchar2(72) := g_package||'api_updating';
87 l_fct_ret boolean;
88 --
89 Begin
90 hr_utility.set_location('Entering:'||l_proc, 5);
91 --
92 If (
93 p_worksheet_fund_src_id is null and
94 p_object_version_number is null
95 ) Then
96 --
97 -- One of the primary key arguments is null therefore we must
98 -- set the returning function value to false
99 --
100 l_fct_ret := false;
101 Else
102 If (
103 p_worksheet_fund_src_id = g_old_rec.worksheet_fund_src_id and
104 p_object_version_number = g_old_rec.object_version_number
105 ) Then
106 hr_utility.set_location(l_proc, 10);
107 --
108 -- The g_old_rec is current therefore we must
109 -- set the returning function to true
110 --
111 l_fct_ret := true;
112 Else
113 --
114 -- Select the current row into g_old_rec
115 --
116 Open C_Sel1;
117 Fetch C_Sel1 Into g_old_rec;
118 If C_Sel1%notfound Then
119 Close C_Sel1;
120 --
121 -- The primary key is invalid therefore we must error
122 --
123 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
124 hr_utility.raise_error;
125 End If;
126 Close C_Sel1;
127 If (p_object_version_number <> g_old_rec.object_version_number) Then
128 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
129 hr_utility.raise_error;
130 End If;
131 hr_utility.set_location(l_proc, 15);
132 l_fct_ret := true;
133 End If;
134 End If;
135 hr_utility.set_location(' Leaving:'||l_proc, 20);
136 Return (l_fct_ret);
137 --
138 End api_updating;
139 --
140 -- ----------------------------------------------------------------------------
141 -- |---------------------------------< lck >----------------------------------|
142 -- ----------------------------------------------------------------------------
143 Procedure lck
144 (
145 p_worksheet_fund_src_id in number,
146 p_object_version_number in number
147 ) is
148 --
149 -- Cursor selects the 'current' row from the HR Schema
150 --
151 Cursor C_Sel1 is
152 select worksheet_fund_src_id,
153 worksheet_bdgt_elmnt_id,
154 distribution_percentage,
155 cost_allocation_keyflex_id,
156 project_id,
157 award_id,
158 task_id,
159 expenditure_type,
160 organization_id,
161 object_version_number
162 from pqh_worksheet_fund_srcs
163 where worksheet_fund_src_id = p_worksheet_fund_src_id
164 for update nowait;
165 --
166 l_proc varchar2(72) := g_package||'lck';
167 --
168 Begin
169 hr_utility.set_location('Entering:'||l_proc, 5);
170 --
171 -- Add any mandatory argument checking here:
172 -- Example:
173 -- hr_api.mandatory_arg_error
174 -- (p_api_name => l_proc,
175 -- p_argument => 'object_version_number',
176 -- p_argument_value => p_object_version_number);
177 --
178 Open C_Sel1;
179 Fetch C_Sel1 Into g_old_rec;
180 If C_Sel1%notfound then
181 Close C_Sel1;
182 --
183 -- The primary key is invalid therefore we must error
184 --
185 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
186 hr_utility.raise_error;
187 End If;
188 Close C_Sel1;
189 If (p_object_version_number <> g_old_rec.object_version_number) Then
190 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
191 hr_utility.raise_error;
192 End If;
193 --
194 hr_utility.set_location(' Leaving:'||l_proc, 10);
195 --
196 -- We need to trap the ORA LOCK exception
197 --
198 Exception
199 When HR_Api.Object_Locked then
200 --
201 -- The object is locked therefore we need to supply a meaningful
202 -- error message.
203 --
204 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
205 hr_utility.set_message_token('TABLE_NAME', 'pqh_worksheet_fund_srcs');
206 hr_utility.raise_error;
207 End lck;
208 --
209 -- ----------------------------------------------------------------------------
210 -- |-----------------------------< convert_args >-----------------------------|
211 -- ----------------------------------------------------------------------------
212 Function convert_args
213 (
214 p_worksheet_fund_src_id in number,
215 p_worksheet_bdgt_elmnt_id in number,
216 p_distribution_percentage in number,
217 p_cost_allocation_keyflex_id in number,
218 p_project_id in number,
219 p_award_id in number,
220 p_task_id in number,
221 p_expenditure_type in varchar2,
222 p_organization_id in number,
223 p_object_version_number in number
224 )
225 Return g_rec_type is
226 --
227 l_rec g_rec_type;
228 l_proc varchar2(72) := g_package||'convert_args';
229 --
230 Begin
231 --
232 hr_utility.set_location('Entering:'||l_proc, 5);
233 --
234 -- Convert arguments into local l_rec structure.
235 --
236 l_rec.worksheet_fund_src_id := p_worksheet_fund_src_id;
237 l_rec.worksheet_bdgt_elmnt_id := p_worksheet_bdgt_elmnt_id;
238 l_rec.distribution_percentage := p_distribution_percentage;
239 l_rec.cost_allocation_keyflex_id := p_cost_allocation_keyflex_id;
240 l_rec.project_id := p_project_id;
241 l_rec.award_id := p_award_id;
242 l_rec.task_id := p_task_id;
243 l_rec.expenditure_type := p_expenditure_type;
244 l_rec.organization_id := p_organization_id;
245 l_rec.object_version_number := p_object_version_number;
246 --
247 -- Return the plsql record structure.
248 --
249 hr_utility.set_location(' Leaving:'||l_proc, 10);
250 Return(l_rec);
251 --
252 End convert_args;
253 --
254 end pqh_wfs_shd;