DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_BBT_SHD

Source


1 Package Body per_bbt_shd as
2 /* $Header: pebbtrhi.pkb 115.7 2002/12/02 13:20:16 apholt noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  per_bbt_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc 	varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   hr_utility.set_location('Entering:'||l_proc, 5);
21   --
22   If (p_constraint_name = 'PER_BF_BALANCE_TYPES_FK1') Then
23     fnd_message.set_name('PER', 'PER_289357_BF_BG_ID_INVALID');
24     fnd_message.set_token('PROCEDURE', l_proc);
25     fnd_message.set_token('STEP','5');
26     fnd_message.raise_error;
27   ElsIf (p_constraint_name = 'PER_BF_BALANCE_TYPES_PK') Then
28     fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
29     fnd_message.set_token('PROCEDURE', l_proc);
30     fnd_message.set_token('STEP','10');
31     fnd_message.raise_error;
32   ElsIf (p_constraint_name = 'PER_BF_BALANCE_TYPES_UK1') Then
33     fnd_message.set_name('PER', 'HR_52611_DISPLAYED_NOT_UNQ');
34     fnd_message.set_token('PROCEDURE', l_proc);
35     fnd_message.set_token('STEP','10');
36     fnd_message.raise_error;
37   ElsIf (p_constraint_name = 'PER_BF_BALANCE_TYPES_UK2') Then
38     fnd_message.set_name('PER', 'HR_52613_INTERNAL_NOT_UNQ');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('STEP','10');
41     fnd_message.raise_error;
42   Else
43     fnd_message.set_name('PER', 'HR_7877_API_INVALID_CONSTRAINT');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
46     fnd_message.raise_error;
47   End If;
48   --
49   hr_utility.set_location(' Leaving:'||l_proc, 10);
50 End constraint_error;
51 --
52 -- ----------------------------------------------------------------------------
53 -- |-----------------------------< api_updating >-----------------------------|
54 -- ----------------------------------------------------------------------------
55 Function api_updating
56   (p_balance_type_id                      in number
57   ,p_object_version_number                in number
58   )
59   Return Boolean Is
60 --
61   --
62   -- Cursor selects the 'current' row from the HR Schema
63   --
64   Cursor C_Sel1 is
65     select
66        balance_type_id
67       ,input_value_id
68       ,business_group_id
69       ,displayed_name
70       ,internal_name
71       ,uom
72       ,currency
73       ,category
74       ,date_from
75       ,date_to
76       ,object_version_number
77     from	per_bf_balance_types
78     where	balance_type_id = p_balance_type_id;
79 --
80   l_proc	varchar2(72)	:= g_package||'api_updating';
81   l_fct_ret	boolean;
82 --
83 Begin
84   hr_utility.set_location('Entering:'||l_proc, 5);
85   --
86   If (p_balance_type_id is null and
87       p_object_version_number is null
88      ) Then
89     --
90     -- One of the primary key arguments is null therefore we must
91     -- set the returning function value to false
92     --
93     l_fct_ret := false;
94   Else
95     If (p_balance_type_id = g_old_rec.balance_type_id and
96         p_object_version_number = g_old_rec.object_version_number
97        ) Then
98       hr_utility.set_location(l_proc, 10);
99       --
100       -- The g_old_rec is current therefore we must
101       -- set the returning function to true
102       --
103       l_fct_ret := true;
104     Else
105       --
106       -- Select the current row into g_old_rec
107       --
108       Open C_Sel1;
109       Fetch C_Sel1 Into g_old_rec;
110       If C_Sel1%notfound Then
111         Close C_Sel1;
112         --
113         -- The primary key is invalid therefore we must error
114         --
115         fnd_message.set_name('PER', 'HR_7220_INVALID_PRIMARY_KEY');
116         fnd_message.raise_error;
117       End If;
118       Close C_Sel1;
119       If (p_object_version_number <> g_old_rec.object_version_number) Then
120         fnd_message.set_name('PER', 'HR_7155_OBJECT_INVALID');
121         fnd_message.raise_error;
122       End If;
123       hr_utility.set_location(l_proc, 15);
124       l_fct_ret := true;
125     End If;
126   End If;
127   hr_utility.set_location(' Leaving:'||l_proc, 20);
128   Return (l_fct_ret);
129 --
130 End api_updating;
131 --
132 -- ----------------------------------------------------------------------------
133 -- |---------------------------------< lck >----------------------------------|
134 -- ----------------------------------------------------------------------------
135 Procedure lck
136   (p_balance_type_id                      in number
137   ,p_object_version_number                in number
138   ) is
139 --
140 -- Cursor selects the 'current' row from the HR Schema
141 --
142   Cursor C_Sel1 is
143     select
144        balance_type_id
145       ,input_value_id
146       ,business_group_id
147       ,displayed_name
148       ,internal_name
149       ,uom
150       ,currency
151       ,category
152       ,date_from
153       ,date_to
154       ,object_version_number
155     from	per_bf_balance_types
156     where	balance_type_id = p_balance_type_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   -- Add any mandatory argument checking here:
165   -- Example:
166   -- hr_api.mandatory_arg_error
167   --   (p_api_name       => l_proc,
168   --    p_argument       => 'object_version_number',
169   --    p_argument_value => p_object_version_number);
170   --
171   hr_api.mandatory_arg_error(p_api_name           => l_proc
172                             ,p_argument           => 'BALANCE_TYPE_ID'
173                             ,p_argument_value     => p_balance_type_id);
174   --
175   Open  C_Sel1;
176   Fetch C_Sel1 Into g_old_rec;
177   If C_Sel1%notfound then
178     Close C_Sel1;
179     --
180     -- The primary key is invalid therefore we must error
181     --
182     fnd_message.set_name('PER', 'HR_7220_INVALID_PRIMARY_KEY');
183     fnd_message.raise_error;
184   End If;
185   Close C_Sel1;
186   If (p_object_version_number <> g_old_rec.object_version_number) Then
187         fnd_message.set_name('PER', 'HR_7155_OBJECT_INVALID');
188         fnd_message.raise_error;
189   End If;
190   --
191   hr_utility.set_location(' Leaving:'||l_proc, 10);
192   --
193   -- We need to trap the ORA LOCK exception
194   --
195 Exception
196   When HR_Api.Object_Locked then
197     --
198     -- The object is locked therefore we need to supply a meaningful
199     -- error message.
200     --
201     fnd_message.set_name('PER', 'HR_7165_OBJECT_LOCKED');
202     fnd_message.set_token('TABLE_NAME', 'per_bf_balance_types');
203     fnd_message.raise_error;
204 End lck;
205 --
206 -- ----------------------------------------------------------------------------
207 -- |-----------------------------< convert_args >-----------------------------|
208 -- ----------------------------------------------------------------------------
209 Function convert_args
210   (p_balance_type_id                in number
211   ,p_input_value_id                 in number
212   ,p_business_group_id              in number
213   ,p_displayed_name                 in varchar2
214   ,p_internal_name                  in varchar2
215   ,p_uom                            in varchar2
216   ,p_currency                       in varchar2
217   ,p_category                       in varchar2
218   ,p_date_from                      in date
219   ,p_date_to                        in date
220   ,p_object_version_number          in number
221   )
222   Return g_rec_type is
223 --
224   l_rec         g_rec_type;
225   l_proc  varchar2(72) := g_package||'convert_args';
226 --
227 Begin
228   --
229   hr_utility.set_location('Entering:'||l_proc, 5);
230   --
231   -- Convert arguments into local l_rec structure.
232   --
233   l_rec.balance_type_id                  := p_balance_type_id;
234   l_rec.input_value_id                   := p_input_value_id;
235   l_rec.business_group_id                := p_business_group_id;
236   l_rec.displayed_name                   := p_displayed_name;
237   l_rec.internal_name                    := p_internal_name;
238   l_rec.uom                              := p_uom;
239   l_rec.currency                         := p_currency;
240   l_rec.category                         := p_category;
241   l_rec.date_from                        := p_date_from;
242   l_rec.date_to                          := p_date_to;
243   l_rec.object_version_number            := p_object_version_number;
244   --
245   -- Return the plsql record structure.
246   --
247   hr_utility.set_location(' Leaving:'||l_proc, 10);
248   Return(l_rec);
249 --
250 End convert_args;
251 --
252 end per_bbt_shd;