DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_BRE_SHD

Source


1 Package Body pqh_bre_shd as
2 /* $Header: pqbrerhi.pkb 115.6 2003/06/04 08:19:51 ggnanagu noship $ */
3 -- ----------------------------------------------------------------------------
4 -- |                     Private Global Definitions                           |
5 -- ----------------------------------------------------------------------------
6 --
7 g_package  varchar2(33) := '  pqh_bre_shd.';  -- Global package name
8 --
9 -- ----------------------------------------------------------------------------
10 -- |------------------------< return_api_dml_status >-------------------------|
11 -- ----------------------------------------------------------------------------
12 Function return_api_dml_status Return Boolean Is
13 --
14 Begin
15   --
16   Return (nvl(g_api_dml, false));
17   --
18 End return_api_dml_status;
19 --
20 -- ----------------------------------------------------------------------------
21 -- |---------------------------< constraint_error >---------------------------|
22 -- ----------------------------------------------------------------------------
23 Procedure constraint_error
24   (p_constraint_name in all_constraints.constraint_name%TYPE
25   ) Is
26 --
27   l_proc        varchar2(72) := g_package||'constraint_error';
28 --
29 Begin
30   --
31   If (p_constraint_name = 'PQH_BDGT_POOL_REALLOCTIONS_FK1') Then
32       fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
33       fnd_message.set_token('PROCEDURE', l_proc);
34       fnd_message.set_token('STEP','5');
35       fnd_message.raise_error;
36   ELSIf (p_constraint_name = 'PQH_BDGT_POOL_REALLOCTIONS_PK') Then
37     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
38     fnd_message.set_token('PROCEDURE', l_proc);
39     fnd_message.set_token('STEP','10');
40     fnd_message.raise_error;
41    Else
42       fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
43       fnd_message.set_token('PROCEDURE', l_proc);
44       fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
45       fnd_message.raise_error;
46   End If;
47   --
48 End constraint_error;
49 --
50 -- ----------------------------------------------------------------------------
51 -- |-----------------------------< api_updating >-----------------------------|
52 -- ----------------------------------------------------------------------------
53 Function api_updating
54   (p_reallocation_id                      in     number
55   ,p_object_version_number                in     number
56   )
57   Return Boolean Is
58   --
59   --
60   -- Cursor selects the 'current' row from the HR Schema
61   --
62   Cursor C_Sel1 is
63     select
64        reallocation_id
65       ,position_id
66       ,pool_id
67       ,reallocation_amt
68       ,reserved_amt
69       ,object_version_number
70       ,txn_detail_id
71       ,transaction_type
72       ,budget_detail_id
73       ,budget_period_id
74       ,entity_id
75       ,start_date
76       ,end_date
77     from        pqh_bdgt_pool_realloctions
78     where       reallocation_id = p_reallocation_id;
79   --
80   l_fct_ret     boolean;
81   --
82 Begin
83   --
84   If (p_reallocation_id is null and
85       p_object_version_number is null
86      ) Then
87     --
88     -- One of the primary key arguments is null therefore we must
89     -- set the returning function value to false
90     --
91     l_fct_ret := false;
92   Else
93     If (p_reallocation_id
94         = pqh_bre_shd.g_old_rec.reallocation_id and
95         p_object_version_number
96         = pqh_bre_shd.g_old_rec.object_version_number
97        ) Then
98       --
99       -- The g_old_rec is current therefore we must
100       -- set the returning function to true
101       --
102       l_fct_ret := true;
103     Else
104       --
105       -- Select the current row into g_old_rec
106       --
107       Open C_Sel1;
108       Fetch C_Sel1 Into pqh_bre_shd.g_old_rec;
109       If C_Sel1%notfound Then
110         Close C_Sel1;
111         --
112         -- The primary key is invalid therefore we must error
113         --
114         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
115         fnd_message.raise_error;
116       End If;
117       Close C_Sel1;
118       If (p_object_version_number
119           <> pqh_bre_shd.g_old_rec.object_version_number) Then
120         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
121         fnd_message.raise_error;
122       End If;
123       l_fct_ret := true;
124     End If;
125   End If;
126   Return (l_fct_ret);
127 --
128 End api_updating;
129 --
130 -- ----------------------------------------------------------------------------
131 -- |---------------------------------< lck >----------------------------------|
132 -- ----------------------------------------------------------------------------
133 Procedure lck
134   (p_reallocation_id                      in     number
135   ,p_object_version_number                in     number
136   ) is
137 --
138 -- Cursor selects the 'current' row from the HR Schema
139 --
140   Cursor C_Sel1 is
141     select
142        reallocation_id
143       ,position_id
144       ,pool_id
145       ,reallocation_amt
146       ,reserved_amt
147       ,object_version_number
148       ,txn_detail_id
149       ,transaction_type
150       ,budget_detail_id
151       ,budget_period_id
152       ,entity_id
153       ,start_date
154       ,end_date
155     from        pqh_bdgt_pool_realloctions
156     where       reallocation_id = p_reallocation_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           => 'REALLOCATION_ID'
167     ,p_argument_value     => p_reallocation_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 pqh_bre_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       <> pqh_bre_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', 'pqh_bdgt_pool_realloctions');
205     fnd_message.raise_error;
206 End lck;
207 --
208 -- ----------------------------------------------------------------------------
209 -- |-----------------------------< convert_args >-----------------------------|
210 -- ----------------------------------------------------------------------------
211 Function convert_args
212   (p_reallocation_id                in number
213   ,p_position_id                    in number
214   ,p_pool_id                        in number
215   ,p_reallocation_amt               in number
216   ,p_reserved_amt                   in number
217   ,p_object_version_number          in number
218   ,p_txn_detail_id                 in number
219   ,p_transaction_type               in varchar2
220   ,p_budget_detail_id               in number
221   ,p_budget_period_id               in number
222   ,p_entity_id                      in number
223   ,p_start_date                     in date
224   ,p_end_date                       in date
225   )
226   Return g_rec_type is
227 --
228   l_rec   g_rec_type;
229 --
230 Begin
231   --
232   -- Convert arguments into local l_rec structure.
233   --
234   l_rec.reallocation_id                  := p_reallocation_id;
235   l_rec.position_id                      := p_position_id;
236   l_rec.pool_id                          := p_pool_id;
237   l_rec.reallocation_amt                 := p_reallocation_amt;
238   l_rec.reserved_amt                     := p_reserved_amt;
239   l_rec.object_version_number            := p_object_version_number;
240   l_rec.txn_detail_id                   := p_txn_detail_id;
241   l_rec.transaction_type                 := p_transaction_type;
242   l_rec.budget_detail_id                 := p_budget_detail_id;
243   l_rec.budget_period_id                 := p_budget_period_id;
244   l_rec.entity_id                        := p_entity_id;
245   l_rec.start_date                       := p_start_date;
246   l_rec.end_date                         := p_end_date;
247   --
248   -- Return the plsql record structure.
249   --
250   Return(l_rec);
251 --
252 End convert_args;
253 --
254 end pqh_bre_shd;