DBA Data[Home] [Help]

PACKAGE BODY: APPS.FF_FFP_SHD

Source


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