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