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