DBA Data[Home] [Help]

PACKAGE BODY: APPS.PSP_RTD_SHD

Source


1 Package Body psp_rtd_shd as
2 /* $Header: PSPRDRHB.pls 120.0 2005/06/02 15:51 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  psp_rtd_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 = 'SYS_C00261002') 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_template_detail_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        template_detail_id
61       ,template_id
62       ,object_version_number
63       ,criteria_lookup_type
64       ,criteria_lookup_code
65       ,include_exclude_flag
66       ,criteria_value1
67       ,criteria_value2
68       ,criteria_value3
69     from        psp_report_template_details
70     where       template_detail_id = p_template_detail_id;
71   --
72   l_fct_ret     boolean;
73   --
74 Begin
75   --
76   If (p_template_detail_id is null and
77       p_object_version_number is null
78      ) Then
79     --
80     -- One of the primary key arguments is null therefore we must
81     -- set the returning function value to false
82     --
83     l_fct_ret := false;
84   Else
85     If (p_template_detail_id
86         = psp_rtd_shd.g_old_rec.template_detail_id and
87         p_object_version_number
88         = psp_rtd_shd.g_old_rec.object_version_number
89        ) Then
90       --
91       -- The g_old_rec is current therefore we must
92       -- set the returning function to true
93       --
94       l_fct_ret := true;
95     Else
96       --
97       -- Select the current row into g_old_rec
98       --
99       Open C_Sel1;
100       Fetch C_Sel1 Into psp_rtd_shd.g_old_rec;
101       If C_Sel1%notfound Then
102         Close C_Sel1;
103         --
104         -- The primary key is invalid therefore we must error
105         --
106         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
107         fnd_message.raise_error;
108       End If;
109       Close C_Sel1;
110       If (p_object_version_number
111           <> psp_rtd_shd.g_old_rec.object_version_number) Then
112         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
113         fnd_message.raise_error;
114       End If;
115       l_fct_ret := true;
116     End If;
117   End If;
118   Return (l_fct_ret);
119 --
120 End api_updating;
121 --
122 -- ----------------------------------------------------------------------------
123 -- |---------------------------------< lck >----------------------------------|
124 -- ----------------------------------------------------------------------------
125 Procedure lck
126   (p_template_detail_id                   in     number
127   ,p_object_version_number                in     number
128   ) is
129 --
130 -- Cursor selects the 'current' row from the HR Schema
131 --
132   Cursor C_Sel1 is
133     select
134        template_detail_id
135       ,template_id
136       ,object_version_number
137       ,criteria_lookup_type
138       ,criteria_lookup_code
139       ,include_exclude_flag
140       ,criteria_value1
141       ,criteria_value2
142       ,criteria_value3
143     from        psp_report_template_details
144     where       template_detail_id = p_template_detail_id
145     for update nowait;
146 --
147   l_proc        varchar2(72) := g_package||'lck';
148 --
149 Begin
150   hr_utility.set_location('Entering:'||l_proc, 5);
151   --
152   hr_api.mandatory_arg_error
153     (p_api_name           => l_proc
154     ,p_argument           => 'TEMPLATE_DETAIL_ID'
155     ,p_argument_value     => p_template_detail_id
156     );
157   hr_utility.set_location(l_proc,6);
158   hr_api.mandatory_arg_error
159     (p_api_name           => l_proc
160     ,p_argument           => 'OBJECT_VERSION_NUMBER'
161     ,p_argument_value     => p_object_version_number
162     );
163   --
164   Open  C_Sel1;
165   Fetch C_Sel1 Into psp_rtd_shd.g_old_rec;
166   If C_Sel1%notfound then
167     Close C_Sel1;
168     --
169     -- The primary key is invalid therefore we must error
170     --
171     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
172     fnd_message.raise_error;
173   End If;
174   Close C_Sel1;
175   If (p_object_version_number
176       <> psp_rtd_shd.g_old_rec.object_version_number) Then
177         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
178         fnd_message.raise_error;
179   End If;
180   --
181   hr_utility.set_location(' Leaving:'||l_proc, 10);
182   --
183   -- We need to trap the ORA LOCK exception
184   --
185 Exception
186   When HR_Api.Object_Locked then
187     --
188     -- The object is locked therefore we need to supply a meaningful
189     -- error message.
190     --
191     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
192     fnd_message.set_token('TABLE_NAME', 'psp_report_template_details');
193     fnd_message.raise_error;
194 End lck;
195 --
196 -- ----------------------------------------------------------------------------
197 -- |-----------------------------< convert_args >-----------------------------|
198 -- ----------------------------------------------------------------------------
199 Function convert_args
200   (p_template_detail_id             in number
201   ,p_template_id                    in number
202   ,p_object_version_number          in number
203   ,p_criteria_lookup_type           in varchar2
204   ,p_criteria_lookup_code           in varchar2
205   ,p_include_exclude_flag           in varchar2
206   ,p_criteria_value1                in varchar2
207   ,p_criteria_value2                in varchar2
208   ,p_criteria_value3                in varchar2
209   )
210   Return g_rec_type is
211 --
212   l_rec   g_rec_type;
213 --
214 Begin
215   --
216   -- Convert arguments into local l_rec structure.
217   --
218   l_rec.template_detail_id               := p_template_detail_id;
219   l_rec.template_id                      := p_template_id;
220   l_rec.object_version_number            := p_object_version_number;
221   l_rec.criteria_lookup_type             := p_criteria_lookup_type;
222   l_rec.criteria_lookup_code             := p_criteria_lookup_code;
223   l_rec.include_exclude_flag             := p_include_exclude_flag;
224   l_rec.criteria_value1                  := p_criteria_value1;
225   l_rec.criteria_value2                  := p_criteria_value2;
226   l_rec.criteria_value3                  := p_criteria_value3;
227   --
228   -- Return the plsql record structure.
229   --
230   Return(l_rec);
231 --
232 End convert_args;
233 --
234 end psp_rtd_shd;