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