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