DBA Data[Home] [Help]

PACKAGE BODY: APPS.PSP_PRT_SHD

Source


1 Package Body psp_prt_shd as
2 /* $Header: PSPRTRHB.pls 120.1 2005/07/05 23:50 dpaudel noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  psp_prt_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 = 'PSP_REPORT_TEMPLATES_U2') 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 = 'SYS_C00240334') 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   Else
43     fnd_message.set_name('PAY', '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 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55   (p_template_id                          in     number
56   ,p_object_version_number                in     number
57   )
58   Return Boolean Is
59   --
60   --
61   -- Cursor selects the 'current' row from the HR Schema
62   --
63   Cursor C_Sel1 is
64     select
65        template_id
66       ,template_name
67       ,business_group_id
68       ,set_of_books_id
69       ,object_version_number
70       ,report_type
71       ,period_frequency_id
72       ,report_template_code
73       ,display_all_emp_distrib_flag
74       ,manual_entry_override_flag
75       ,approval_type
76       ,custom_approval_code
77       ,sup_levels
78       ,preview_effort_report_flag
79       ,notification_reminder_in_days
80       ,sprcd_tolerance_amt
81       ,sprcd_tolerance_percent
82       ,description
83       ,legislation_code
84       ,hundred_pcent_eff_at_per_asg
85       ,selection_match_level
86     from        psp_report_templates
87     where       template_id = p_template_id;
88   --
89   l_fct_ret     boolean;
90   --
91 Begin
92   --
93   If (p_template_id is null and
94       p_object_version_number is null
95      ) Then
96     --
97     -- One of the primary key arguments is null therefore we must
98     -- set the returning function value to false
99     --
100     l_fct_ret := false;
101   Else
102     If (p_template_id
103         = psp_prt_shd.g_old_rec.template_id and
104         p_object_version_number
105         = psp_prt_shd.g_old_rec.object_version_number
106        ) Then
107       --
108       -- The g_old_rec is current therefore we must
109       -- set the returning function to true
110       --
111       l_fct_ret := true;
112     Else
113       --
114       -- Select the current row into g_old_rec
115       --
116       Open C_Sel1;
117       Fetch C_Sel1 Into psp_prt_shd.g_old_rec;
118       If C_Sel1%notfound Then
119         Close C_Sel1;
120         --
121         -- The primary key is invalid therefore we must error
122         --
123         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
124         fnd_message.raise_error;
125       End If;
126       Close C_Sel1;
127       If (p_object_version_number
128           <> psp_prt_shd.g_old_rec.object_version_number) Then
129         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
130         fnd_message.raise_error;
131       End If;
132       l_fct_ret := true;
133     End If;
134   End If;
135   Return (l_fct_ret);
136 --
137 End api_updating;
138 --
139 -- ----------------------------------------------------------------------------
140 -- |---------------------------------< lck >----------------------------------|
141 -- ----------------------------------------------------------------------------
142 Procedure lck
143   (p_template_id                          in     number
144   ,p_object_version_number                in     number
145   ) is
146 --
147 -- Cursor selects the 'current' row from the HR Schema
148 --
149   Cursor C_Sel1 is
150     select
151        template_id
152       ,template_name
153       ,business_group_id
154       ,set_of_books_id
155       ,object_version_number
156       ,report_type
157       ,period_frequency_id
158       ,report_template_code
159       ,display_all_emp_distrib_flag
160       ,manual_entry_override_flag
161       ,approval_type
162       ,custom_approval_code
163       ,sup_levels
164       ,preview_effort_report_flag
165       ,notification_reminder_in_days
166       ,sprcd_tolerance_amt
167       ,sprcd_tolerance_percent
168       ,description
169       ,legislation_code
170       ,hundred_pcent_eff_at_per_asg
171       ,selection_match_level
172     from        psp_report_templates
173     where       template_id = p_template_id
174     for update nowait;
175 --
176   l_proc        varchar2(72) := g_package||'lck';
177 --
178 Begin
179   hr_utility.set_location('Entering:'||l_proc, 5);
180   --
181   hr_api.mandatory_arg_error
182     (p_api_name           => l_proc
183     ,p_argument           => 'TEMPLATE_ID'
184     ,p_argument_value     => p_template_id
185     );
186   hr_utility.set_location(l_proc,6);
187   hr_api.mandatory_arg_error
188     (p_api_name           => l_proc
189     ,p_argument           => 'OBJECT_VERSION_NUMBER'
190     ,p_argument_value     => p_object_version_number
191     );
192   --
193   Open  C_Sel1;
194   Fetch C_Sel1 Into psp_prt_shd.g_old_rec;
195   If C_Sel1%notfound then
196     Close C_Sel1;
197     --
198     -- The primary key is invalid therefore we must error
199     --
200     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
201     fnd_message.raise_error;
202   End If;
203   Close C_Sel1;
204   If (p_object_version_number
205       <> psp_prt_shd.g_old_rec.object_version_number) Then
206         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
207         fnd_message.raise_error;
208   End If;
209   --
210   hr_utility.set_location(' Leaving:'||l_proc, 10);
211   --
212   -- We need to trap the ORA LOCK exception
213   --
214 Exception
215   When HR_Api.Object_Locked then
216     --
217     -- The object is locked therefore we need to supply a meaningful
218     -- error message.
219     --
220     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
221     fnd_message.set_token('TABLE_NAME', 'psp_report_templates');
222     fnd_message.raise_error;
223 End lck;
224 --
225 -- ----------------------------------------------------------------------------
226 -- |-----------------------------< convert_args >-----------------------------|
227 -- ----------------------------------------------------------------------------
228 Function convert_args
229   (p_template_id                    in number
230   ,p_template_name                  in varchar2
231   ,p_business_group_id              in number
232   ,p_set_of_books_id                in number
233   ,p_object_version_number          in number
234   ,p_report_type                    in varchar2
235   ,p_period_frequency_id            in number
236   ,p_report_template_code           in varchar2
237   ,p_display_all_emp_distrib_flag   in varchar2
238   ,p_manual_entry_override_flag     in varchar2
239   ,p_approval_type                  in varchar2
240   ,p_custom_approval_code           in varchar2
241   ,p_sup_levels                     in number
242   ,p_preview_effort_report_flag     in varchar2
243   ,p_notification_reminder_in_day   in number
244   ,p_sprcd_tolerance_amt            in number
245   ,p_sprcd_tolerance_percent        in number
246   ,p_description                    in varchar2
247   ,p_legislation_code               in varchar2
248   ,p_hundred_pcent_eff_at_per_asg   in varchar2
249   ,p_selection_match_level          in varchar2
250   )
251   Return g_rec_type is
252 --
253   l_rec   g_rec_type;
254 --
255 Begin
256   --
257   -- Convert arguments into local l_rec structure.
258   --
259   l_rec.template_id                      := p_template_id;
260   l_rec.template_name                    := p_template_name;
261   l_rec.business_group_id                := p_business_group_id;
262   l_rec.set_of_books_id                  := p_set_of_books_id;
263   l_rec.object_version_number            := p_object_version_number;
264   l_rec.report_type                      := p_report_type;
265   l_rec.period_frequency_id              := p_period_frequency_id;
266   l_rec.report_template_code             := p_report_template_code;
267   l_rec.display_all_emp_distrib_flag     := p_display_all_emp_distrib_flag;
268   l_rec.manual_entry_override_flag       := p_manual_entry_override_flag;
269   l_rec.approval_type                    := p_approval_type;
270   l_rec.custom_approval_code             := p_custom_approval_code;
271   l_rec.sup_levels                       := p_sup_levels;
272   l_rec.preview_effort_report_flag       := p_preview_effort_report_flag;
273   l_rec.notification_reminder_in_days    := p_notification_reminder_in_day;
274   l_rec.sprcd_tolerance_amt              := p_sprcd_tolerance_amt;
275   l_rec.sprcd_tolerance_percent          := p_sprcd_tolerance_percent;
276   l_rec.description                      := p_description;
277   l_rec.legislation_code                 := p_legislation_code;
278   l_rec.hundred_pcent_eff_at_per_asg     := p_hundred_pcent_eff_at_per_asg;
279   l_rec.selection_match_level            := p_selection_match_level;
280   --
281   -- Return the plsql record structure.
282   --
283   Return(l_rec);
284 --
285 End convert_args;
286 --
287 end psp_prt_shd;