DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_EXR_SHD

Source


1 Package Body pqp_exr_shd as
2 /* $Header: pqexrrhi.pkb 120.4 2006/10/20 18:38:32 sshetty noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pqp_exr_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 -- ----------------------------------------------------------------------------
25   (p_constraint_name in all_constraints.constraint_name%TYPE
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
26   ) Is
27 --
28   l_proc        varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31   --
32   If (p_constraint_name = 'PET_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   Else
38     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
39     fnd_message.set_token('PROCEDURE', l_proc);
40     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
41     fnd_message.raise_error;
42   End If;
43   --
44 End constraint_error;
45 --
46 -- ----------------------------------------------------------------------------
47 -- |-----------------------------< api_updating >-----------------------------|
48 -- ----------------------------------------------------------------------------
49 Function api_updating
50   (p_exception_report_id                  in     number
51   ,p_object_version_number                in     number
52   )
53   Return Boolean Is
54   --
55   --
56   -- Cursor selects the 'current' row from the HR Schema
57   --
58   Cursor C_Sel1 is
59     select
60        exception_report_id
61       ,exception_report_name
62       ,legislation_code
63       ,business_group_id
64       ,currency_code
65       ,balance_type_id
66       ,balance_dimension_id
67       ,variance_type
68       ,variance_value
69       ,comparison_type
70       ,comparison_value
71       ,object_version_number
72       ,output_format
73       ,variance_operator
74     from        pqp_exception_reports
75     where       exception_report_id = p_exception_report_id;
76   --
77   l_fct_ret     boolean;
78   --
79 Begin
80   --
81   If (p_exception_report_id is null and
82       p_object_version_number is null
83      ) Then
84     --
85     -- One of the primary key arguments is null therefore we must
86     -- set the returning function value to false
87     --
88     l_fct_ret := false;
89   Else
90     If (p_exception_report_id
91         = pqp_exr_shd.g_old_rec.exception_report_id and
92         p_object_version_number
93         = pqp_exr_shd.g_old_rec.object_version_number
94        ) Then
95       --
96       -- The g_old_rec is current therefore we must
97       -- set the returning function to true
98       --
99       l_fct_ret := true;
100     Else
101       --
102       -- Select the current row into g_old_rec
103       --
104       Open C_Sel1;
105       Fetch C_Sel1 Into pqp_exr_shd.g_old_rec;
106       If C_Sel1%notfound Then
107         Close C_Sel1;
108         --
109         -- The primary key is invalid therefore we must error
110         --
111        IF hr_startup_data_api_support.g_startup_mode NOT IN ('GENERIC','STARTUP') THEN
112         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
113         fnd_message.raise_error;
114        END IF;
115       End If;
116       Close C_Sel1;
117       If (p_object_version_number
118           <> pqp_exr_shd.g_old_rec.object_version_number) Then
119         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
120         fnd_message.raise_error;
121       End If;
122       l_fct_ret := true;
123     End If;
124   End If;
125   Return (l_fct_ret);
126 --
127 End api_updating;
128 --
129 -- ----------------------------------------------------------------------------
130 -- |---------------------------------< lck >----------------------------------|
131 -- ----------------------------------------------------------------------------
132 Procedure lck
133   (p_exception_report_id                  in     number
134   ,p_object_version_number                in     number
135   ) is
136 --
137 -- Cursor selects the 'current' row from the HR Schema
138 --
139   Cursor C_Sel1 is
140     select
141        exception_report_id
142       ,exception_report_name
143       ,legislation_code
144       ,business_group_id
145       ,currency_code
146       ,balance_type_id
147       ,balance_dimension_id
148       ,variance_type
149       ,variance_value
150       ,comparison_type
151       ,comparison_value
152       ,object_version_number
153       ,output_format
154       ,variance_operator
155 
156     from        pqp_exception_reports
157     where       exception_report_id = p_exception_report_id
158     for update nowait;
159 --
160   l_proc        varchar2(72) := g_package||'lck';
161 --
162 Begin
163   hr_utility.set_location('Entering:'||l_proc, 5);
164   --
165   hr_api.mandatory_arg_error
166     (p_api_name           => l_proc
167     ,p_argument           => 'EXCEPTION_REPORT_ID'
168     ,p_argument_value     => p_exception_report_id
169     );
170   hr_utility.set_location(l_proc,6);
171   hr_api.mandatory_arg_error
172     (p_api_name           => l_proc
173     ,p_argument           => 'OBJECT_VERSION_NUMBER'
174     ,p_argument_value     => p_object_version_number
175     );
176   --
180     Close C_Sel1;
177   Open  C_Sel1;
178   Fetch C_Sel1 Into pqp_exr_shd.g_old_rec;
179   If C_Sel1%notfound then
181     --
182     -- The primary key is invalid therefore we must error
183     --
184    IF hr_startup_data_api_support.g_startup_mode NOT IN ('GENERIC','STARTUP') THEN
185     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
186     fnd_message.raise_error;
187    END IF;
188   End If;
189   Close C_Sel1;
190   If (p_object_version_number
191       <> pqp_exr_shd.g_old_rec.object_version_number) Then
192         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
193         fnd_message.raise_error;
194   End If;
195   --
196   hr_utility.set_location(' Leaving:'||l_proc, 10);
197   --
198   -- We need to trap the ORA LOCK exception
199   --
200 Exception
201   When HR_Api.Object_Locked then
202     --
203     -- The object is locked therefore we need to supply a meaningful
204     -- error message.
205     --
206     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
207     fnd_message.set_token('TABLE_NAME', 'pqp_exception_reports');
208     fnd_message.raise_error;
209 End lck;
210 --
211 -- ----------------------------------------------------------------------------
212 -- |-----------------------------< convert_args >-----------------------------|
213 -- ----------------------------------------------------------------------------
214 Function convert_args
215   (p_exception_report_id            in number
216   ,p_exception_report_name          in varchar2
217   ,p_legislation_code               in varchar2
218   ,p_business_group_id              in number
219   ,p_currency_code                  in varchar2
220   ,p_balance_type_id                in number
221   ,p_balance_dimension_id           in number
222   ,p_variance_type                  in varchar2
223   ,p_variance_value                 in number
224   ,p_comparison_type                in varchar2
225   ,p_comparison_value               in number
226   ,p_object_version_number          in number
227   ,p_output_format_type             in varchar2
228   ,p_variance_operator              in varchar2
229 
230   )
231   Return g_rec_type is
232 --
233   l_rec   g_rec_type;
234 --
235 
236 Begin
237 
238   --
239 
240   -- Convert arguments into local l_rec structure.
241 
242   --
243 
244   l_rec.exception_report_id              := p_exception_report_id;
245 
246   l_rec.exception_report_name            := p_exception_report_name;
247 
248   l_rec.legislation_code                 := p_legislation_code;
249 
250   l_rec.business_group_id                := p_business_group_id;
251 
252   l_rec.currency_code                    := p_currency_code;
253   l_rec.balance_type_id                  := p_balance_type_id;
254   l_rec.balance_dimension_id             := p_balance_dimension_id;
255   l_rec.variance_type                    := p_variance_type;
256   l_rec.variance_value                   := p_variance_value;
257   l_rec.comparison_type                  := p_comparison_type;
258   l_rec.comparison_value                 := p_comparison_value;
259   l_rec.object_version_number            := p_object_version_number;
260   l_rec.output_format_type               := p_output_format_type;
261   l_rec.variance_operator                := p_variance_operator;
262    --
263   -- Return the plsql record structure.
264   Return(l_rec);
265   --
266 End convert_args;
267 
268 --
269 
270 end pqp_exr_shd;
271