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