[Home] [Help]
PACKAGE BODY: APPS.HXC_HRP_SHD
Source
1 Package Body hxc_hrp_shd as
2 /* $Header: hxchrprhi.pkb 120.2 2005/09/23 10:43:21 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_hrp_shd.'; -- Global package name
9 g_debug boolean :=hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE
16 ) Is
17 --
18 l_proc varchar2(72) := g_package||'constraint_error';
19 --
20 Begin
21 --
22 If (p_constraint_name = 'HXC_RECURRING_PERIODS_PK') Then
23 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24 fnd_message.set_token('PROCEDURE', l_proc);
25 fnd_message.set_token('STEP','5');
26 fnd_message.raise_error;
27 Else
28 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
29 fnd_message.set_token('PROCEDURE', l_proc);
30 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
31 fnd_message.raise_error;
32 End If;
33 --
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40 (p_recurring_period_id in number
41 ,p_object_version_number in number
42 )
43 Return Boolean Is
44 --
45 --
46 -- Cursor selects the 'current' row from the HR Schema
47 --
48 Cursor C_Sel1 is
49 select
50 recurring_period_id
51 ,name
52 ,start_date
53 ,end_date
54 ,period_type
55 ,duration_in_days
56 ,object_version_number
57 from hxc_recurring_periods
58 where recurring_period_id = p_recurring_period_id;
59 --
60 l_fct_ret boolean;
61 --
62 Begin
63 --
64 If (p_recurring_period_id is null and
65 p_object_version_number is null
66 ) Then
67 --
68 -- One of the primary key arguments is null therefore we must
69 -- set the returning function value to false
70 --
71 l_fct_ret := false;
72 Else
73 If (p_recurring_period_id
74 = hxc_hrp_shd.g_old_rec.recurring_period_id and
75 p_object_version_number
76 = hxc_hrp_shd.g_old_rec.object_version_number
77 ) Then
78 --
79 -- The g_old_rec is current therefore we must
80 -- set the returning function to true
81 --
82 l_fct_ret := true;
83 Else
84 --
85 -- Select the current row into g_old_rec
86 --
87 Open C_Sel1;
88 Fetch C_Sel1 Into hxc_hrp_shd.g_old_rec;
89 If C_Sel1%notfound Then
90 Close C_Sel1;
91 --
92 -- The primary key is invalid therefore we must error
93 --
94 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
95 fnd_message.raise_error;
96 End If;
97 Close C_Sel1;
98 If (p_object_version_number
99 <> hxc_hrp_shd.g_old_rec.object_version_number) Then
100 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
101 fnd_message.raise_error;
102 End If;
103 l_fct_ret := true;
104 End If;
105 End If;
106 Return (l_fct_ret);
107 --
108 End api_updating;
109 --
110 -- ----------------------------------------------------------------------------
111 -- |---------------------------------< lck >----------------------------------|
112 -- ----------------------------------------------------------------------------
113 Procedure lck
114 (p_recurring_period_id in number
115 ,p_object_version_number in number
116 ) is
117 --
118 -- Cursor selects the 'current' row from the HR Schema
119 --
120 Cursor C_Sel1 is
121 select
122 recurring_period_id
123 ,name
124 ,start_date
125 ,end_date
126 ,period_type
127 ,duration_in_days
128 ,object_version_number
129 from hxc_recurring_periods
130 where recurring_period_id = p_recurring_period_id
131 for update nowait;
132 --
133 l_proc varchar2(72);
134 --
135 Begin
136 g_debug:=hr_utility.debug_enabled;
137 if g_debug then
138 l_proc := g_package||'lck';
139 hr_utility.set_location('Entering:'||l_proc, 5);
140 end if;
141 --
142 hr_api.mandatory_arg_error
143 (p_api_name => l_proc
144 ,p_argument => 'RECURRING_PERIOD_ID'
145 ,p_argument_value => p_recurring_period_id
146 );
147 --
148 Open C_Sel1;
149 Fetch C_Sel1 Into hxc_hrp_shd.g_old_rec;
150 If C_Sel1%notfound then
151 Close C_Sel1;
152 --
153 -- The primary key is invalid therefore we must error
154 --
155 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
156 fnd_message.raise_error;
157 End If;
158 Close C_Sel1;
159 If (p_object_version_number
160 <> hxc_hrp_shd.g_old_rec.object_version_number) Then
161 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
162 fnd_message.raise_error;
163 End If;
164 --
165 if g_debug then
166 hr_utility.set_location(' Leaving:'||l_proc, 10);
167 end if;
168 --
169 -- We need to trap the ORA LOCK exception
170 --
171 Exception
172 When HR_Api.Object_Locked then
173 --
174 -- The object is locked therefore we need to supply a meaningful
175 -- error message.
176 --
177 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
178 fnd_message.set_token('TABLE_NAME', 'hxc_recurring_periods');
179 fnd_message.raise_error;
180 End lck;
181 --
182 -- ----------------------------------------------------------------------------
183 -- |-----------------------------< convert_args >-----------------------------|
184 -- ----------------------------------------------------------------------------
185 Function convert_args
186 (p_recurring_period_id in number
187 ,p_name in varchar2
188 ,p_start_date in date
189 ,p_end_date in date
190 ,p_period_type in varchar2
191 ,p_duration_in_days in number
192 ,p_object_version_number in number
193 )
194 Return g_rec_type is
195 --
196 l_rec g_rec_type;
197 --
198 Begin
199 --
200 -- Convert arguments into local l_rec structure.
201 --
202 l_rec.recurring_period_id := p_recurring_period_id;
203 l_rec.name := p_name;
204 l_rec.start_date := p_start_date;
205 l_rec.end_date := p_end_date;
206 l_rec.period_type := p_period_type;
207 l_rec.duration_in_days := p_duration_in_days;
208 l_rec.object_version_number := p_object_version_number;
209 --
210 -- Return the plsql record structure.
211 --
212 Return(l_rec);
213 --
214 End convert_args;
215 --
216 end hxc_hrp_shd;