DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_XID_SHD

Source


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