DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_CMT_SHD

Source


1 Package Body ben_cmt_shd as
2 /* $Header: becmtrhi.pkb 115.14 2002/12/31 23:57:48 mmudigon ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  ben_cmt_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_CM_DLVRY_MTHD_TYP_FK3') 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   ElsIf (p_constraint_name = 'BEN_CM_DLVRY_MTHD_TYP_PK') Then
42     hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43     hr_utility.set_message_token('PROCEDURE', l_proc);
44     hr_utility.set_message_token('STEP','10');
45     hr_utility.raise_error;
46   ElsIf (p_constraint_name = 'BEN_CM_DLVRY_MED_TYP_FK2') Then
47     ben_utility.child_exists_error(p_table_name => 'BEN_CM_DLVRY_MED_TYP');
48   Else
49     hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
50     hr_utility.set_message_token('PROCEDURE', l_proc);
51     hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
52     hr_utility.raise_error;
53   End If;
54   --
55   hr_utility.set_location(' Leaving:'||l_proc, 10);
56 End constraint_error;
57 --
58 -- ----------------------------------------------------------------------------
59 -- |-----------------------------< api_updating >-----------------------------|
60 -- ----------------------------------------------------------------------------
61 Function api_updating
62   (
63   p_cm_dlvry_mthd_typ_id               in number,
64   p_object_version_number              in number
65   )      Return Boolean Is
66 --
67   --
68   -- Cursor selects the 'current' row from the HR Schema
69   --
70   Cursor C_Sel1 is
71     select
72 		cm_dlvry_mthd_typ_id,
73 	cm_dlvry_mthd_typ_cd,
74 	business_group_id,
75 	cm_typ_id,
76 	cmt_attribute1,
77 	cmt_attribute10,
78 	cmt_attribute11,
79 	cmt_attribute12,
80 	cmt_attribute13,
81 	cmt_attribute14,
82 	cmt_attribute15,
83 	cmt_attribute16,
84 	cmt_attribute17,
85 	cmt_attribute18,
86 	cmt_attribute19,
87 	cmt_attribute2,
88 	cmt_attribute20,
89 	cmt_attribute21,
90 	cmt_attribute22,
91 	cmt_attribute23,
92 	cmt_attribute24,
93 	cmt_attribute25,
94 	cmt_attribute26,
95 	cmt_attribute27,
96 	cmt_attribute28,
97 	cmt_attribute29,
98 	cmt_attribute3,
99 	cmt_attribute30,
100 	rqd_flag,
101 	cmt_attribute_category,
102 	cmt_attribute4,
103 	cmt_attribute5,
104 	cmt_attribute6,
105 	cmt_attribute7,
106 	cmt_attribute8,
107 	cmt_attribute9,
108 	dflt_flag,
109 	object_version_number
110     from	ben_cm_dlvry_mthd_typ
111     where	cm_dlvry_mthd_typ_id = p_cm_dlvry_mthd_typ_id;
112 --
113   l_proc	varchar2(72)	:= g_package||'api_updating';
114   l_fct_ret	boolean;
115 --
116 Begin
117   hr_utility.set_location('Entering:'||l_proc, 5);
118   --
119   If (
120 	p_cm_dlvry_mthd_typ_id is null and
121 	p_object_version_number is null
122      ) Then
123     --
124     -- One of the primary key arguments is null therefore we must
125     -- set the returning function value to false
126     --
127     l_fct_ret := false;
128   Else
129     If (
130 	p_cm_dlvry_mthd_typ_id = g_old_rec.cm_dlvry_mthd_typ_id and
131 	p_object_version_number = g_old_rec.object_version_number
132        ) Then
133       hr_utility.set_location(l_proc, 10);
134       --
135       -- The g_old_rec is current therefore we must
136       -- set the returning function to true
137       --
138       l_fct_ret := true;
139     Else
140       --
141       -- Select the current row into g_old_rec
142       --
143       Open C_Sel1;
144       Fetch C_Sel1 Into g_old_rec;
145       If C_Sel1%notfound Then
146         Close C_Sel1;
147         --
148         -- The primary key is invalid therefore we must error
149         --
150         hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
151         hr_utility.raise_error;
152       End If;
153       Close C_Sel1;
154       If (p_object_version_number <> g_old_rec.object_version_number) Then
155         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
156         hr_utility.raise_error;
157       End If;
158       hr_utility.set_location(l_proc, 15);
159       l_fct_ret := true;
160     End If;
161   End If;
162   hr_utility.set_location(' Leaving:'||l_proc, 20);
163   Return (l_fct_ret);
164 --
165 End api_updating;
166 --
167 -- ----------------------------------------------------------------------------
168 -- |---------------------------------< lck >----------------------------------|
169 -- ----------------------------------------------------------------------------
170 Procedure lck
171   (
172   p_cm_dlvry_mthd_typ_id               in number,
173   p_object_version_number              in number
174   ) is
175 --
176 -- Cursor selects the 'current' row from the HR Schema
177 --
178   Cursor C_Sel1 is
179     select 	cm_dlvry_mthd_typ_id,
180 	cm_dlvry_mthd_typ_cd,
181 	business_group_id,
182 	cm_typ_id,
183 	cmt_attribute1,
184 	cmt_attribute10,
185 	cmt_attribute11,
186 	cmt_attribute12,
187 	cmt_attribute13,
188 	cmt_attribute14,
189 	cmt_attribute15,
190 	cmt_attribute16,
191 	cmt_attribute17,
192 	cmt_attribute18,
193 	cmt_attribute19,
194 	cmt_attribute2,
195 	cmt_attribute20,
196 	cmt_attribute21,
197 	cmt_attribute22,
198 	cmt_attribute23,
199 	cmt_attribute24,
200 	cmt_attribute25,
201 	cmt_attribute26,
202 	cmt_attribute27,
203 	cmt_attribute28,
204 	cmt_attribute29,
205 	cmt_attribute3,
206 	cmt_attribute30,
207 	rqd_flag,
208 	cmt_attribute_category,
209 	cmt_attribute4,
210 	cmt_attribute5,
211 	cmt_attribute6,
212 	cmt_attribute7,
213 	cmt_attribute8,
214 	cmt_attribute9,
215 	dflt_flag,
216 	object_version_number
217     from	ben_cm_dlvry_mthd_typ
218     where	cm_dlvry_mthd_typ_id = p_cm_dlvry_mthd_typ_id
219     for	update nowait;
220 --
221   l_proc	varchar2(72) := g_package||'lck';
222 --
223 Begin
224   hr_utility.set_location('Entering:'||l_proc, 5);
225   --
226   -- Add any mandatory argument checking here:
227   -- Example:
228   -- hr_api.mandatory_arg_error
229   --   (p_api_name       => l_proc,
230   --    p_argument       => 'object_version_number',
231   --    p_argument_value => p_object_version_number);
232   --
233   Open  C_Sel1;
234   Fetch C_Sel1 Into g_old_rec;
235   If C_Sel1%notfound then
236     Close C_Sel1;
237     --
238     -- The primary key is invalid therefore we must error
239     --
240     hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
241     hr_utility.raise_error;
242   End If;
243   Close C_Sel1;
244   If (p_object_version_number <> g_old_rec.object_version_number) Then
245         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
246         hr_utility.raise_error;
247       End If;
248 --
249   hr_utility.set_location(' Leaving:'||l_proc, 10);
250 --
251 -- We need to trap the ORA LOCK exception
252 --
253 Exception
254   When HR_Api.Object_Locked then
255     --
256     -- The object is locked therefore we need to supply a meaningful
257     -- error message.
258     --
259     hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
260     hr_utility.set_message_token('TABLE_NAME', 'ben_cm_dlvry_mthd_typ');
261     hr_utility.raise_error;
262 End lck;
263 --
264 -- ----------------------------------------------------------------------------
265 -- |-----------------------------< convert_args >-----------------------------|
266 -- ----------------------------------------------------------------------------
267 Function convert_args
268 	(
269 	p_cm_dlvry_mthd_typ_id          in number,
270 	p_cm_dlvry_mthd_typ_cd          in varchar2,
271 	p_business_group_id             in number,
272 	p_cm_typ_id                     in number,
273 	p_cmt_attribute1                in varchar2,
274 	p_cmt_attribute10               in varchar2,
275 	p_cmt_attribute11               in varchar2,
276 	p_cmt_attribute12               in varchar2,
277 	p_cmt_attribute13               in varchar2,
278 	p_cmt_attribute14               in varchar2,
279 	p_cmt_attribute15               in varchar2,
280 	p_cmt_attribute16               in varchar2,
281 	p_cmt_attribute17               in varchar2,
282 	p_cmt_attribute18               in varchar2,
283 	p_cmt_attribute19               in varchar2,
284 	p_cmt_attribute2                in varchar2,
285 	p_cmt_attribute20               in varchar2,
286 	p_cmt_attribute21               in varchar2,
287 	p_cmt_attribute22               in varchar2,
288 	p_cmt_attribute23               in varchar2,
289 	p_cmt_attribute24               in varchar2,
290 	p_cmt_attribute25               in varchar2,
291 	p_cmt_attribute26               in varchar2,
292 	p_cmt_attribute27               in varchar2,
293 	p_cmt_attribute28               in varchar2,
294 	p_cmt_attribute29               in varchar2,
295 	p_cmt_attribute3                in varchar2,
296 	p_cmt_attribute30               in varchar2,
297 	p_rqd_flag                      in varchar2,
298 	p_cmt_attribute_category        in varchar2,
299 	p_cmt_attribute4                in varchar2,
300 	p_cmt_attribute5                in varchar2,
301 	p_cmt_attribute6                in varchar2,
302 	p_cmt_attribute7                in varchar2,
303 	p_cmt_attribute8                in varchar2,
304 	p_cmt_attribute9                in varchar2,
305 	p_dflt_flag                     in varchar2,
306 	p_object_version_number         in number
307 	)
308 	Return g_rec_type is
309 --
310   l_rec	  g_rec_type;
311   l_proc  varchar2(72) := g_package||'convert_args';
312 --
313 Begin
314   --
315   hr_utility.set_location('Entering:'||l_proc, 5);
316   --
317   -- Convert arguments into local l_rec structure.
318   --
319   l_rec.cm_dlvry_mthd_typ_id             := p_cm_dlvry_mthd_typ_id;
320   l_rec.cm_dlvry_mthd_typ_cd             := p_cm_dlvry_mthd_typ_cd;
321   l_rec.business_group_id                := p_business_group_id;
322   l_rec.cm_typ_id                        := p_cm_typ_id;
323   l_rec.cmt_attribute1                   := p_cmt_attribute1;
324   l_rec.cmt_attribute10                  := p_cmt_attribute10;
325   l_rec.cmt_attribute11                  := p_cmt_attribute11;
326   l_rec.cmt_attribute12                  := p_cmt_attribute12;
327   l_rec.cmt_attribute13                  := p_cmt_attribute13;
328   l_rec.cmt_attribute14                  := p_cmt_attribute14;
329   l_rec.cmt_attribute15                  := p_cmt_attribute15;
330   l_rec.cmt_attribute16                  := p_cmt_attribute16;
331   l_rec.cmt_attribute17                  := p_cmt_attribute17;
332   l_rec.cmt_attribute18                  := p_cmt_attribute18;
333   l_rec.cmt_attribute19                  := p_cmt_attribute19;
334   l_rec.cmt_attribute2                   := p_cmt_attribute2;
335   l_rec.cmt_attribute20                  := p_cmt_attribute20;
336   l_rec.cmt_attribute21                  := p_cmt_attribute21;
337   l_rec.cmt_attribute22                  := p_cmt_attribute22;
338   l_rec.cmt_attribute23                  := p_cmt_attribute23;
339   l_rec.cmt_attribute24                  := p_cmt_attribute24;
340   l_rec.cmt_attribute25                  := p_cmt_attribute25;
341   l_rec.cmt_attribute26                  := p_cmt_attribute26;
342   l_rec.cmt_attribute27                  := p_cmt_attribute27;
343   l_rec.cmt_attribute28                  := p_cmt_attribute28;
344   l_rec.cmt_attribute29                  := p_cmt_attribute29;
345   l_rec.cmt_attribute3                   := p_cmt_attribute3;
346   l_rec.cmt_attribute30                  := p_cmt_attribute30;
347   l_rec.rqd_flag                         := p_rqd_flag;
348   l_rec.cmt_attribute_category           := p_cmt_attribute_category;
349   l_rec.cmt_attribute4                   := p_cmt_attribute4;
350   l_rec.cmt_attribute5                   := p_cmt_attribute5;
351   l_rec.cmt_attribute6                   := p_cmt_attribute6;
352   l_rec.cmt_attribute7                   := p_cmt_attribute7;
353   l_rec.cmt_attribute8                   := p_cmt_attribute8;
354   l_rec.cmt_attribute9                   := p_cmt_attribute9;
355   l_rec.dflt_flag                        := p_dflt_flag;
356   l_rec.object_version_number            := p_object_version_number;
357   --
358   -- Return the plsql record structure.
359   --
360   hr_utility.set_location(' Leaving:'||l_proc, 10);
361   Return(l_rec);
362 --
363 End convert_args;
364 --
365 end ben_cmt_shd;