[Home] [Help]
PACKAGE BODY: APPS.HXC_TKG_SHD
Source
1 Package Body hxc_tkg_shd as
2 /* $Header: hxctkgrhi.pkb 120.2 2005/09/23 05:28:58 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_tkg_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_TK_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_tk_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 tk_group_id
62 ,tk_group_name
63 ,tk_resource_id
64 ,object_version_number
65 ,business_group_id
66 from hxc_tk_groups tkg
67 where tk_group_id = p_tk_group_id;
68 --
69 l_fct_ret boolean;
70 --
71 Begin
72 --
73 If (p_tk_group_id is null and
74 p_object_version_number is null
75 ) Then
76 --
77 -- One of the primary key arguments is null therefore we must
78 -- set the returning function value to false
79 --
80 l_fct_ret := false;
81 Else
82 If (p_tk_group_id
83 = hxc_tkg_shd.g_old_rec.tk_group_id and
84 p_object_version_number
85 = hxc_tkg_shd.g_old_rec.object_version_number
86 ) Then
87 --
88 -- The g_old_rec is current therefore we must
89 -- set the returning function to true
90 --
91 l_fct_ret := true;
92 Else
93 --
94 -- Select the current row into g_old_rec
95 --
96 Open C_Sel1;
97 Fetch C_Sel1 Into hxc_tkg_shd.g_old_rec;
98 If C_Sel1%notfound Then
99 Close C_Sel1;
100 --
101 -- The primary key is invalid therefore we must error
102 --
103 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
104 fnd_message.raise_error;
105 End If;
106 Close C_Sel1;
107 If (p_object_version_number
108 <> hxc_tkg_shd.g_old_rec.object_version_number) Then
109 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
110 fnd_message.raise_error;
111 End If;
112 l_fct_ret := true;
113 End If;
114 End If;
115 Return (l_fct_ret);
116 --
117 End api_updating;
118 --
119 -- ----------------------------------------------------------------------------
120 -- |---------------------------------< lck >----------------------------------|
121 -- ----------------------------------------------------------------------------
122 Procedure lck
123 (p_tk_group_id in number
124 ,p_object_version_number in number
125 ) is
126 --
127 -- Cursor selects the 'current' row from the HR Schema
128 --
129 Cursor C_Sel1 is
130 select
131 tk_group_id
132 ,tk_group_name
133 ,tk_resource_id
134 ,object_version_number
135 ,business_group_id
136 from hxc_tk_groups
137 where tk_group_id = p_tk_group_id
138 for update nowait;
139 --
140 l_proc varchar2(72) ;
141 --
142 Begin
143 g_debug :=hr_utility.debug_enabled;
144 if g_debug then
145 l_proc := g_package||'lck';
146 hr_utility.set_location('Entering:'||l_proc, 5);
147 end if;
148 --
149 hr_api.mandatory_arg_error
150 (p_api_name => l_proc
151 ,p_argument => 'TK_GROUP_ID'
152 ,p_argument_value => p_tk_group_id
153 );
154 --
155 Open C_Sel1;
156 Fetch C_Sel1 Into hxc_tkg_shd.g_old_rec;
157 If C_Sel1%notfound then
158 Close C_Sel1;
159 --
160 -- The primary key is invalid therefore we must error
161 --
162 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
163 fnd_message.raise_error;
164 End If;
165 Close C_Sel1;
166 If (p_object_version_number
167 <> hxc_tkg_shd.g_old_rec.object_version_number) Then
168 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
169 fnd_message.raise_error;
170 End If;
171 --
172 if g_debug then
173 hr_utility.set_location(' Leaving:'||l_proc, 10);
174 end if;
175 --
176 -- We need to trap the ORA LOCK exception
177 --
178 Exception
179 When HR_Api.Object_Locked then
180 --
181 -- The object is locked therefore we need to supply a meaningful
182 -- error message.
183 --
184 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
185 fnd_message.set_token('TABLE_NAME', 'hxc_tk_groups');
186 fnd_message.raise_error;
187 End lck;
188 --
189 -- ----------------------------------------------------------------------------
190 -- |-----------------------------< convert_args >-----------------------------|
191 -- ----------------------------------------------------------------------------
192 Function convert_args
193 (p_tk_group_id in number
194 ,p_tk_group_name in varchar2
195 ,p_tk_resource_id in number
196 ,p_object_version_number in number
197 ,p_business_group_id in number
198 )
199 Return g_rec_type is
200 --
201 l_rec g_rec_type;
202 --
203 Begin
204 --
205 -- Convert arguments into local l_rec structure.
206 --
207 l_rec.tk_group_id := p_tk_group_id;
208 l_rec.tk_group_name := p_tk_group_name;
209 l_rec.tk_resource_id := p_tk_resource_id;
210 l_rec.object_version_number := p_object_version_number;
211 l_rec.business_group_id := p_business_group_id;
212 --
213 -- Return the plsql record structure.
214 --
215 Return(l_rec);
216 --
217 End convert_args;
218 --
219 end hxc_tkg_shd;