DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_BAI_SHD

Source


1 Package Body ben_bai_shd as
2 /* $Header: bebairhi.pkb 115.7 2002/12/13 06:21:35 hmani ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_bai_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_BATCH_ACTN_ITEM_INFO_PK') Then
37     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
38     hr_utility.set_message_token('PROCEDURE', l_proc);
39     hr_utility.set_message_token('STEP','5');
40     hr_utility.raise_error;
41   Else
42     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
45     hr_utility.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_batch_actn_item_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 		batch_actn_item_id,
66 	benefit_action_id,
67 	person_id,
68 	actn_typ_id,
69 	cmpltd_dt,
70 	due_dt,
71 	rqd_flag,
72 	actn_cd,
73 	business_group_id,
74 	object_version_number
75     from	ben_batch_actn_item_info
76     where	batch_actn_item_id = p_batch_actn_item_id;
77 --
78   l_proc	varchar2(72)	:= g_package||'api_updating';
79   l_fct_ret	boolean;
80 --
81 Begin
82   hr_utility.set_location('Entering:'||l_proc, 5);
83   --
84   If (
85 	p_batch_actn_item_id is null and
86 	p_object_version_number is null
87      ) Then
88     --
89     -- One of the primary key arguments is null therefore we must
90     -- set the returning function value to false
91     --
92     l_fct_ret := false;
93   Else
94     If (
95 	p_batch_actn_item_id = g_old_rec.batch_actn_item_id and
96 	p_object_version_number = g_old_rec.object_version_number
97        ) Then
98       hr_utility.set_location(l_proc, 10);
99       --
100       -- The g_old_rec is current therefore we must
101       -- set the returning function to true
102       --
103       l_fct_ret := true;
104     Else
105       --
106       -- Select the current row into g_old_rec
107       --
108       Open C_Sel1;
109       Fetch C_Sel1 Into g_old_rec;
110       If C_Sel1%notfound Then
111         Close C_Sel1;
112         --
113         -- The primary key is invalid therefore we must error
114         --
115         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
116         hr_utility.raise_error;
117       End If;
118       Close C_Sel1;
119       If (p_object_version_number <> g_old_rec.object_version_number) Then
120         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
121         hr_utility.raise_error;
122       End If;
123       hr_utility.set_location(l_proc, 15);
124       l_fct_ret := true;
125     End If;
126   End If;
127   hr_utility.set_location(' Leaving:'||l_proc, 20);
128   Return (l_fct_ret);
129 --
130 End api_updating;
131 --
132 -- ----------------------------------------------------------------------------
133 -- |---------------------------------< lck >----------------------------------|
134 -- ----------------------------------------------------------------------------
135 Procedure lck
136   (
137   p_batch_actn_item_id                 in number,
138   p_object_version_number              in number
139   ) is
140 --
141 -- Cursor selects the 'current' row from the HR Schema
142 --
143   Cursor C_Sel1 is
144     select 	batch_actn_item_id,
145 	benefit_action_id,
146 	person_id,
147 	actn_typ_id,
148 	cmpltd_dt,
149 	due_dt,
150 	rqd_flag,
151 	actn_cd,
152 	business_group_id,
153 	object_version_number
154     from	ben_batch_actn_item_info
155     where	batch_actn_item_id = p_batch_actn_item_id
156     for	update nowait;
157 --
158   l_proc	varchar2(72) := g_package||'lck';
159 --
160 Begin
161   hr_utility.set_location('Entering:'||l_proc, 5);
162   --
163   -- Add any mandatory argument checking here:
164   -- Example:
165   -- hr_api.mandatory_arg_error
166   --   (p_api_name       => l_proc,
167   --    p_argument       => 'object_version_number',
168   --    p_argument_value => p_object_version_number);
169   --
170   Open  C_Sel1;
171   Fetch C_Sel1 Into g_old_rec;
172   If C_Sel1%notfound then
173     Close C_Sel1;
174     --
175     -- The primary key is invalid therefore we must error
176     --
177     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
178     hr_utility.raise_error;
179   End If;
180   Close C_Sel1;
181   If (p_object_version_number <> g_old_rec.object_version_number) Then
182         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
183         hr_utility.raise_error;
184       End If;
185 --
186   hr_utility.set_location(' Leaving:'||l_proc, 10);
187 --
188 -- We need to trap the ORA LOCK exception
189 --
190 Exception
191   When HR_Api.Object_Locked then
192     --
193     -- The object is locked therefore we need to supply a meaningful
194     -- error message.
195     --
196     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
197     hr_utility.set_message_token('TABLE_NAME', 'ben_batch_actn_item_info');
198     hr_utility.raise_error;
199 End lck;
200 --
201 -- ----------------------------------------------------------------------------
202 -- |-----------------------------< convert_args >-----------------------------|
203 -- ----------------------------------------------------------------------------
204 Function convert_args
205 	(
206 	p_batch_actn_item_id            in number,
207 	p_benefit_action_id             in number,
208 	p_person_id                     in number,
209 	p_actn_typ_id                   in number,
210 	p_cmpltd_dt                     in date,
211 	p_due_dt                        in date,
212 	p_rqd_flag                      in varchar2,
213 	p_actn_cd                       in varchar2,
214 	p_business_group_id             in number,
215 	p_object_version_number         in number
216 	)
217 	Return g_rec_type is
218 --
219   l_rec	  g_rec_type;
220   l_proc  varchar2(72) := g_package||'convert_args';
221 --
222 Begin
223   --
224   hr_utility.set_location('Entering:'||l_proc, 5);
225   --
226   -- Convert arguments into local l_rec structure.
227   --
228   l_rec.batch_actn_item_id               := p_batch_actn_item_id;
229   l_rec.benefit_action_id                := p_benefit_action_id;
230   l_rec.person_id                        := p_person_id;
231   l_rec.actn_typ_id                      := p_actn_typ_id;
232   l_rec.cmpltd_dt                        := p_cmpltd_dt;
233   l_rec.due_dt                           := p_due_dt;
234   l_rec.rqd_flag                         := p_rqd_flag;
235   l_rec.actn_cd                          := p_actn_cd;
236   l_rec.business_group_id                := p_business_group_id;
237   l_rec.object_version_number            := p_object_version_number;
238   --
239   -- Return the plsql record structure.
240   --
241   hr_utility.set_location(' Leaving:'||l_proc, 10);
242   Return(l_rec);
243 --
244 End convert_args;
245 --
246 end ben_bai_shd;