DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQH_BPL_SHD

Source


1 Package Body pqh_bpl_shd as
2 /* $Header: pqbplrhi.pkb 115.9 2003/04/11 11:44:23 mvankada noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqh_bpl_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 = 'PQH_BUDGET_POOLS_FK1') 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 = 'PQH_BUDGET_POOLS_FK2') 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','10');
41     fnd_message.raise_error;
42   ElsIf (p_constraint_name = 'PQH_BUDGET_POOLS_PK') Then
43     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44     fnd_message.set_token('PROCEDURE', l_proc);
45     fnd_message.set_token('STEP','15');
46     fnd_message.raise_error;
47   ElsIf (p_constraint_name = 'PQH_BUDGET_POOLS_U1') Then
48     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
49     fnd_message.set_token('PROCEDURE', l_proc);
50     fnd_message.set_token('STEP','20');
51     fnd_message.raise_error;
52   Else
53     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
54     fnd_message.set_token('PROCEDURE', l_proc);
55     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
56     fnd_message.raise_error;
57   End If;
58   --
59 End constraint_error;
60 --
61 -- ----------------------------------------------------------------------------
62 -- |-----------------------------< api_updating >-----------------------------|
63 -- ----------------------------------------------------------------------------
64 Function api_updating
65   (p_pool_id                              in     number
66   ,p_object_version_number                in     number
67   )
68   Return Boolean Is
69   --
70   --
71   -- Cursor selects the 'current' row from the HR Schema
72   --
73   Cursor C_Sel1 is
74     select
75        pool_id
76       ,name
77       ,budget_version_id
78       ,budget_unit_id
79       ,object_version_number
80       ,entity_type
81       ,parent_pool_id
82       ,business_group_id
83       ,approval_status
84       ,wf_transaction_category_id
85     from        pqh_budget_pools
86     where       pool_id = p_pool_id;
87   --
88   l_fct_ret     boolean;
89   --
90 Begin
91   --
92   If (p_pool_id is null and
93       p_object_version_number is null
94      ) Then
95     --
96     -- One of the primary key arguments is null therefore we must
97     -- set the returning function value to false
98     --
99     l_fct_ret := false;
100   Else
101     If (p_pool_id
102         = pqh_bpl_shd.g_old_rec.pool_id and
103         p_object_version_number
104         = pqh_bpl_shd.g_old_rec.object_version_number
105        ) Then
106       --
107       -- The g_old_rec is current therefore we must
108       -- set the returning function to true
109       --
110       l_fct_ret := true;
111     Else
112       --
113       -- Select the current row into g_old_rec
114       --
115       Open C_Sel1;
116       Fetch C_Sel1 Into pqh_bpl_shd.g_old_rec;
117       If C_Sel1%notfound Then
118         Close C_Sel1;
119         --
120         -- The primary key is invalid therefore we must error
121         --
122         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
123         fnd_message.raise_error;
124       End If;
125       Close C_Sel1;
126       If (p_object_version_number
127           <> pqh_bpl_shd.g_old_rec.object_version_number) Then
128         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
129         fnd_message.raise_error;
130       End If;
131       l_fct_ret := true;
132     End If;
133   End If;
134   Return (l_fct_ret);
135 --
136 End api_updating;
137 --
138 -- ----------------------------------------------------------------------------
139 -- |---------------------------------< lck >----------------------------------|
140 -- ----------------------------------------------------------------------------
141 Procedure lck
142   (p_pool_id                              in     number
143   ,p_object_version_number                in     number
144   ) is
145 --
146 -- Cursor selects the 'current' row from the HR Schema
147 --
148   Cursor C_Sel1 is
149     select
150        pool_id
151       ,name
152       ,budget_version_id
153       ,budget_unit_id
154       ,object_version_number
155       ,entity_type
156       ,parent_pool_id
157       ,business_group_id
158       ,approval_status
159       ,wf_transaction_category_id
160     from        pqh_budget_pools
161     where       pool_id = p_pool_id
162     for update nowait;
163 --
164   l_proc        varchar2(72) := g_package||'lck';
165 --
166 Begin
167   hr_utility.set_location('Entering:'||l_proc, 5);
168   --
169   hr_api.mandatory_arg_error
170     (p_api_name           => l_proc
171     ,p_argument           => 'POOL_ID'
172     ,p_argument_value     => p_pool_id
173     );
174   hr_utility.set_location(l_proc,6);
175   hr_api.mandatory_arg_error
176     (p_api_name           => l_proc
177     ,p_argument           => 'OBJECT_VERSION_NUMBER'
178     ,p_argument_value     => p_object_version_number
179     );
180   --
181   Open  C_Sel1;
182   Fetch C_Sel1 Into pqh_bpl_shd.g_old_rec;
183   If C_Sel1%notfound then
184     Close C_Sel1;
185     --
186     -- The primary key is invalid therefore we must error
187     --
188     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
189     fnd_message.raise_error;
190   End If;
191   Close C_Sel1;
192   If (p_object_version_number
193       <> pqh_bpl_shd.g_old_rec.object_version_number) Then
194         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
195         fnd_message.raise_error;
196   End If;
197   --
198   hr_utility.set_location(' Leaving:'||l_proc, 10);
199   --
200   -- We need to trap the ORA LOCK exception
201   --
202 Exception
203   When HR_Api.Object_Locked then
204     --
205     -- The object is locked therefore we need to supply a meaningful
206     -- error message.
207     --
208     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
209     fnd_message.set_token('TABLE_NAME', 'pqh_budget_pools');
210     fnd_message.raise_error;
211 End lck;
212 --
213 -- ----------------------------------------------------------------------------
214 -- |-----------------------------< convert_args >-----------------------------|
215 -- ----------------------------------------------------------------------------
216 Function convert_args
217   (p_pool_id                        in number
218   ,p_name                           in varchar2
219   ,p_budget_version_id              in number
220   ,p_budget_unit_id                 in number
221   ,p_object_version_number          in number
222   ,p_entity_type                    in varchar2
223   ,p_parent_pool_id               in number
224   ,p_business_group_id              in number
225   ,p_approval_status                in varchar2
226   ,p_wf_transaction_category_id     in number
227   )
228   Return g_rec_type is
229 --
230   l_rec   g_rec_type;
231 --
232 Begin
233   --
234   -- Convert arguments into local l_rec structure.
235   --
236   l_rec.pool_id                          := p_pool_id;
237   l_rec.name                             := p_name;
238   l_rec.budget_version_id                := p_budget_version_id;
239   l_rec.budget_unit_id                   := p_budget_unit_id;
240   l_rec.object_version_number            := p_object_version_number;
241   l_rec.entity_type                      := p_entity_type;
242   l_rec.parent_pool_id                 := p_parent_pool_id;
243   l_rec.business_group_id                := p_business_group_id;
244   l_rec.approval_status                  := p_approval_status;
245   l_rec.wf_transaction_category_id       :=p_wf_transaction_category_id;
246   --
247   -- Return the plsql record structure.
248   --
249   Return(l_rec);
250 --
251 End convert_args;
252 --
253 end pqh_bpl_shd;