DBA Data[Home] [Help]

PACKAGE BODY: APPS.PQP_ERG_SHD

Source


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