DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XCC_SHD

Source


1 Package Body ben_xcc_shd as
2 /* $Header: bexccrhi.pkb 120.1 2005/10/31 11:39:19 tjesumic noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_xcc_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15   l_proc 	varchar2(72) := g_package||'return_api_dml_status';
16 --
17 Begin
18   hr_utility.set_location('Entering:'||l_proc, 5);
19   --
20   Return (nvl(g_api_dml, false));
21   --
22   hr_utility.set_location(' Leaving:'||l_proc, 10);
23 End return_api_dml_status;
24 --
25 -- ----------------------------------------------------------------------------
26 -- |---------------------------< constraint_error >---------------------------|
27 -- ----------------------------------------------------------------------------
28 Procedure constraint_error
29             (p_constraint_name in all_constraints.constraint_name%TYPE) Is
30 --
31   l_proc 	varchar2(72) := g_package||'constraint_error';
32 --
33 Begin
34   hr_utility.set_location('Entering:'||l_proc, 5);
35   --
36   If (p_constraint_name = 'BEN_EXT_CRIT_CMBN_FK1') Then
37     ben_utility.child_exists_error(p_table_name => 'BEN_EXT_CRIT_CMBN');
38   ElsIf (p_constraint_name = 'BEN_EXT_CRIT_CMBN_PK') Then
39     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
40     fnd_message.set_token('PROCEDURE', l_proc);
41     fnd_message.set_token('STEP','10');
42     fnd_message.raise_error;
43   Else
44     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
45     fnd_message.set_token('PROCEDURE', l_proc);
46     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
47     fnd_message.raise_error;
48   End If;
49   --
50   hr_utility.set_location(' Leaving:'||l_proc, 10);
51 End constraint_error;
52 --
53 -- ----------------------------------------------------------------------------
54 -- |-----------------------------< api_updating >-----------------------------|
55 -- ----------------------------------------------------------------------------
56 Function api_updating
57   (
58   p_ext_crit_cmbn_id                   in number,
59   p_object_version_number              in number
60   )      Return Boolean Is
61 --
62   --
63   -- Cursor selects the 'current' row from the HR Schema
64   --
65   Cursor C_Sel1 is
66     select
67 		ext_crit_cmbn_id,
68 	crit_typ_cd,
69 	oper_cd,
70 	val_1,
71 	val_2,
72 	ext_crit_val_id,
73 	business_group_id,
74 	legislation_code,
75         last_update_date,
76         creation_date,
77         last_updated_by,
78         last_update_login,
79         created_by ,
80 	object_version_number
81     from	ben_ext_crit_cmbn
82     where	ext_crit_cmbn_id = p_ext_crit_cmbn_id;
83 --
84   l_proc	varchar2(72)	:= g_package||'api_updating';
85   l_fct_ret	boolean;
86 --
87 Begin
88   hr_utility.set_location('Entering:'||l_proc, 5);
89   --
90   If (
91 	p_ext_crit_cmbn_id is null and
92 	p_object_version_number is null
93      ) Then
94     --
95     -- One of the primary key arguments is null therefore we must
96     -- set the returning function value to false
97     --
98     l_fct_ret := false;
99   Else
100     If (
101 	p_ext_crit_cmbn_id = g_old_rec.ext_crit_cmbn_id and
102 	p_object_version_number = g_old_rec.object_version_number
103        ) Then
104       hr_utility.set_location(l_proc, 10);
105       --
106       -- The g_old_rec is current therefore we must
107       -- set the returning function to true
108       --
109       l_fct_ret := true;
110     Else
111       --
112       -- Select the current row into g_old_rec
113       --
114       Open C_Sel1;
115       Fetch C_Sel1 Into g_old_rec;
116       If C_Sel1%notfound Then
117         Close C_Sel1;
118         --
119         -- The primary key is invalid therefore we must error
120         --
121         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
122         fnd_message.raise_error;
123       End If;
124       Close C_Sel1;
125       If (p_object_version_number <> g_old_rec.object_version_number) Then
126         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
127         fnd_message.raise_error;
128       End If;
129       hr_utility.set_location(l_proc, 15);
130       l_fct_ret := true;
131     End If;
132   End If;
133   hr_utility.set_location(' Leaving:'||l_proc, 20);
134   Return (l_fct_ret);
135 --
136 End api_updating;
137 --
138 -- ----------------------------------------------------------------------------
139 -- |---------------------------------< lck >----------------------------------|
140 -- ----------------------------------------------------------------------------
141 Procedure lck
142   (
143   p_ext_crit_cmbn_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 	ext_crit_cmbn_id,
151 	crit_typ_cd,
152 	oper_cd,
153 	val_1,
154 	val_2,
155 	ext_crit_val_id,
156 	business_group_id,
157 	legislation_code,
158         last_update_date,
159         creation_date,
160         last_updated_by,
161         last_update_login,
162         created_by ,
163 	object_version_number
164     from	ben_ext_crit_cmbn
165     where	ext_crit_cmbn_id = p_ext_crit_cmbn_id
166     for	update nowait;
167 --
168   l_proc	varchar2(72) := g_package||'lck';
169 --
170 Begin
171   hr_utility.set_location('Entering:'||l_proc, 5);
172   --
173   -- Add any mandatory argument checking here:
174   -- Example:
175   -- hr_api.mandatory_arg_error
176   --   (p_api_name       => l_proc,
177   --    p_argument       => 'object_version_number',
178   --    p_argument_value => p_object_version_number);
179   --
180   Open  C_Sel1;
181   Fetch C_Sel1 Into g_old_rec;
182   If C_Sel1%notfound then
183     Close C_Sel1;
184     --
185     -- The primary key is invalid therefore we must error
186     --
187     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
188     fnd_message.raise_error;
189   End If;
190   Close C_Sel1;
191   If (p_object_version_number <> g_old_rec.object_version_number) Then
192         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
193         fnd_message.raise_error;
194       End If;
195 --
196   hr_utility.set_location(' Leaving:'||l_proc, 10);
197 --
198 -- We need to trap the ORA LOCK exception
199 --
200 Exception
201   When HR_Api.Object_Locked then
202     --
203     -- The object is locked therefore we need to supply a meaningful
204     -- error message.
205     --
206     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
207     fnd_message.set_token('TABLE_NAME', 'ben_ext_crit_cmbn');
208     fnd_message.raise_error;
209 End lck;
210 --
211 -- ----------------------------------------------------------------------------
212 -- |-----------------------------< convert_args >-----------------------------|
213 -- ----------------------------------------------------------------------------
214 Function convert_args
215 	(
216 	p_ext_crit_cmbn_id              in number,
217 	p_crit_typ_cd                   in varchar2,
218 	p_oper_cd                       in varchar2,
219 	p_val_1                         in varchar2,
220 	p_val_2                         in varchar2,
221 	p_ext_crit_val_id               in number,
222 	p_business_group_id             in number,
223 	p_legislation_code              in varchar2,
224         p_last_update_date              in date,
225         p_creation_date                 in date,
226         p_last_updated_by               in number,
227         p_last_update_login             in number,
228         p_created_by                    in number,
229 	p_object_version_number         in number
230 	)
231 	Return g_rec_type is
232 --
233   l_rec	  g_rec_type;
234   l_proc  varchar2(72) := g_package||'convert_args';
235 --
236 Begin
237   --
238   hr_utility.set_location('Entering:'||l_proc, 5);
239   --
240   -- Convert arguments into local l_rec structure.
241   --
242   l_rec.ext_crit_cmbn_id                 := p_ext_crit_cmbn_id;
243   l_rec.crit_typ_cd                      := p_crit_typ_cd;
244   l_rec.oper_cd                          := p_oper_cd;
245   l_rec.val_1                            := p_val_1;
246   l_rec.val_2                            := p_val_2;
247   l_rec.ext_crit_val_id                  := p_ext_crit_val_id;
248   l_rec.business_group_id                := p_business_group_id;
249   l_rec.legislation_code		 := p_legislation_code;
250   l_rec.last_update_date                 := p_last_update_date;
251   l_rec.creation_date                    := p_creation_date;
252   l_rec.last_updated_by                  := p_last_updated_by;
253   l_rec.last_update_login                := p_last_update_login;
254   l_rec.created_by                       := p_created_by;
255   l_rec.object_version_number            := p_object_version_number;
256   --
257   -- Return the plsql record structure.
258   --
259   hr_utility.set_location(' Leaving:'||l_proc, 10);
260   Return(l_rec);
261 --
262 End convert_args;
263 --
264 end ben_xcc_shd;