DBA Data[Home] [Help]

PACKAGE BODY: APPS.FF_FFN_SHD

Source


1 Package Body ff_ffn_shd as
2 /* $Header: ffffnrhi.pkb 120.1 2005/10/05 01:50 adkumar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ff_ffn_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_FUNCTIONS_PK') 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 = 'FF_FUNC_CLASS_CHK') Then
38     fnd_message.set_name('PAY', 'HR_52966_INVALID_LOOKUP');
39     fnd_message.set_token('COLUMN', 'CLASS');
40     fnd_message.set_token('LOOKUP_TYPE','FUNCTION_CLASS');
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'FF_FUNC_DATA_TYPE_CHK') Then
43     fnd_message.set_name('PAY', 'HR_52966_INVALID_LOOKUP');
44     fnd_message.set_token('COLUMN', 'DATA_TYPE');
45     fnd_message.set_token('LOOKUP_TYPE','DATA_TYPE');
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_function_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        function_id
71       ,business_group_id
72       ,legislation_code
73       ,class
74       ,name
75       ,alias_name
76       ,data_type
77       ,definition
78       ,description
79       ,object_version_number
80     from        ff_functions
81     where       function_id = p_function_id;
82   --
83   l_fct_ret     boolean;
84   --
85 Begin
86   --
87   If (p_function_id 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
99         = ff_ffn_shd.g_old_rec.object_version_number
96     If (p_function_id
97         = ff_ffn_shd.g_old_rec.function_id and
98         p_object_version_number
100        ) Then
101       --
102       -- The g_old_rec is current therefore we must
103       -- set the returning function to true
104       --
105       l_fct_ret := true;
106     Else
107       --
108       -- Select the current row into g_old_rec
109       --
110       Open C_Sel1;
111       Fetch C_Sel1 Into ff_ffn_shd.g_old_rec;
112       If C_Sel1%notfound Then
113         Close C_Sel1;
114         --
115         -- The primary key is invalid therefore we must error
116         --
117         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
118         fnd_message.raise_error;
119       End If;
120       Close C_Sel1;
121       If (p_object_version_number
122           <> ff_ffn_shd.g_old_rec.object_version_number) Then
123         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
124         fnd_message.raise_error;
125       End If;
126       l_fct_ret := true;
127     End If;
128   End If;
129   Return (l_fct_ret);
130 --
131 End api_updating;
132 --
133 -- ----------------------------------------------------------------------------
134 -- |---------------------------------< lck >----------------------------------|
135 -- ----------------------------------------------------------------------------
136 Procedure lck
137   (p_function_id                          in     number
138   ,p_object_version_number                in     number
139   ) is
140 --
141 -- Cursor selects the 'current' row from the HR Schema
142 --
143   Cursor C_Sel1 is
144     select
145        function_id
146       ,business_group_id
147       ,legislation_code
148       ,class
149       ,name
150       ,alias_name
151       ,data_type
152       ,definition
153       ,description
154       ,object_version_number
155     from        ff_functions
156     where       function_id = p_function_id
157     for update nowait;
158 --
159   l_proc        varchar2(72) := g_package||'lck';
160 --
161 Begin
162   hr_utility.set_location('Entering:'||l_proc, 5);
163   --
164   hr_api.mandatory_arg_error
165     (p_api_name           => l_proc
166     ,p_argument           => 'FUNCTION_ID'
167     ,p_argument_value     => p_function_id
168     );
169   hr_utility.set_location(l_proc,6);
170   hr_api.mandatory_arg_error
171     (p_api_name           => l_proc
172     ,p_argument           => 'OBJECT_VERSION_NUMBER'
173     ,p_argument_value     => p_object_version_number
174     );
175   --
176   Open  C_Sel1;
177   Fetch C_Sel1 Into ff_ffn_shd.g_old_rec;
178   If C_Sel1%notfound then
179     Close C_Sel1;
180     --
181     -- The primary key is invalid therefore we must error
182     --
183     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
184     fnd_message.raise_error;
185   End If;
186   Close C_Sel1;
187   If (p_object_version_number
188       <> ff_ffn_shd.g_old_rec.object_version_number) Then
189         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
190         fnd_message.raise_error;
191   End If;
192   --
193   hr_utility.set_location(' Leaving:'||l_proc, 10);
194   --
195   -- We need to trap the ORA LOCK exception
196   --
197 Exception
198   When HR_Api.Object_Locked then
199     --
200     -- The object is locked therefore we need to supply a meaningful
201     -- error message.
202     --
203     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
204     fnd_message.set_token('TABLE_NAME', 'ff_functions');
205     fnd_message.raise_error;
206 End lck;
207 --
208 -- ----------------------------------------------------------------------------
209 -- |-----------------------------< convert_args >-----------------------------|
210 -- ----------------------------------------------------------------------------
211 Function convert_args
212   (p_function_id                    in number
213   ,p_business_group_id              in number
214   ,p_legislation_code               in varchar2
215   ,p_class                          in varchar2
216   ,p_name                           in varchar2
217   ,p_alias_name                     in varchar2
218   ,p_data_type                      in varchar2
219   ,p_definition                     in varchar2
220   ,p_description                    in varchar2
221   ,p_object_version_number          in number
222   )
223   Return g_rec_type is
224 --
225   l_rec   g_rec_type;
226 --
227 Begin
228   --
229   -- Convert arguments into local l_rec structure.
230   --
231   l_rec.function_id                      := p_function_id;
232   l_rec.business_group_id                := p_business_group_id;
233   l_rec.legislation_code                 := p_legislation_code;
234   l_rec.class                            := p_class;
235   l_rec.name                             := p_name;
236   l_rec.alias_name                       := p_alias_name;
237   l_rec.data_type                        := p_data_type;
238   l_rec.definition                       := p_definition;
239   l_rec.description                      := p_description;
240   l_rec.object_version_number            := p_object_version_number;
241   --
242   -- Return the plsql record structure.
243   --
244   Return(l_rec);
245 --
246 End convert_args;
247 --
248 end ff_ffn_shd;