[Home] [Help]
PACKAGE BODY: APPS.PAY_TDU_SHD
Source
1 Package Body pay_tdu_shd as
2 /* $Header: pytdurhi.pkb 120.2 2005/10/14 07:07 adkumar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_tdu_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 = 'PAY_TIME_DEF_USAGES_UK1') then
22
23 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24 fnd_message.set_token('PROCEDURE', l_proc);
25 fnd_message.set_token('STEP','5');
26 fnd_message.raise_error;
27 else
28 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
29 fnd_message.set_token('PROCEDURE', l_proc);
30 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
31 fnd_message.raise_error;
32 end if;
33 --
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40 (p_time_definition_id in number
41 ,p_usage_type in varchar2
42 ,p_object_version_number in number
43 )
44 Return Boolean Is
45 --
46 --
47 -- Cursor selects the 'current' row from the HR Schema
48 --
49 Cursor C_Sel1 is
50 select
51 time_definition_id
52 ,usage_type
53 ,object_version_number
54 from pay_time_def_usages
55 where time_definition_id = p_time_definition_id
56 and usage_type = p_usage_type;
57 --
58 l_fct_ret boolean;
59 --
60 Begin
61 --
62 If (p_time_definition_id is null and
63 p_usage_type is null and
64 p_object_version_number is null
65 ) Then
66 --
67 -- One of the primary key arguments is null therefore we must
68 -- set the returning function value to false
69 --
70 l_fct_ret := false;
71 Else
72 If (p_time_definition_id
73 = pay_tdu_shd.g_old_rec.time_definition_id and
74 p_usage_type
75 = pay_tdu_shd.g_old_rec.usage_type and
76 p_object_version_number
77 = pay_tdu_shd.g_old_rec.object_version_number
78 ) Then
79 --
80 -- The g_old_rec is current therefore we must
81 -- set the returning function to true
82 --
83 l_fct_ret := true;
84 Else
85 --
86 -- Select the current row into g_old_rec
87 --
88 Open C_Sel1;
89 Fetch C_Sel1 Into pay_tdu_shd.g_old_rec;
90 If C_Sel1%notfound Then
91 Close C_Sel1;
92 --
93 -- The primary key is invalid therefore we must error
94 --
95 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
96 fnd_message.raise_error;
97 End If;
98 Close C_Sel1;
99 If (p_object_version_number
100 <> pay_tdu_shd.g_old_rec.object_version_number) Then
101 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
102 fnd_message.raise_error;
103 End If;
104 l_fct_ret := true;
105 End If;
106 End If;
107 Return (l_fct_ret);
108 --
109 End api_updating;
110 --
111 -- ----------------------------------------------------------------------------
112 -- |---------------------------------< lck >----------------------------------|
113 -- ----------------------------------------------------------------------------
114 Procedure lck
115 (p_time_definition_id in number
116 ,p_usage_type in varchar2
117 ,p_object_version_number in number
118 ) is
119 --
120 -- Cursor selects the 'current' row from the HR Schema
121 --
122 Cursor C_Sel1 is
123 select
124 time_definition_id
125 ,usage_type
126 ,object_version_number
127 from pay_time_def_usages
128 where time_definition_id = p_time_definition_id
129 and usage_type = p_usage_type
130 for update nowait;
131 --
132 l_proc varchar2(72) := g_package||'lck';
133 --
134 Begin
135 hr_utility.set_location('Entering:'||l_proc, 5);
136 --
137 hr_api.mandatory_arg_error
138 (p_api_name => l_proc
139 ,p_argument => 'TIME_DEFINITION_ID'
140 ,p_argument_value => p_time_definition_id
141 );
142 hr_utility.set_location(l_proc,6);
143 hr_api.mandatory_arg_error
144 (p_api_name => l_proc
145 ,p_argument => 'USAGE_TYPE'
146 ,p_argument_value => p_usage_type
147 );
148 hr_utility.set_location(l_proc,7);
149 hr_api.mandatory_arg_error
150 (p_api_name => l_proc
151 ,p_argument => 'OBJECT_VERSION_NUMBER'
152 ,p_argument_value => p_object_version_number
153 );
154 --
155 Open C_Sel1;
156 Fetch C_Sel1 Into pay_tdu_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 <> pay_tdu_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 hr_utility.set_location(' Leaving:'||l_proc, 10);
173 --
174 -- We need to trap the ORA LOCK exception
175 --
176 Exception
177 When HR_Api.Object_Locked then
178 --
179 -- The object is locked therefore we need to supply a meaningful
180 -- error message.
181 --
182 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
183 fnd_message.set_token('TABLE_NAME', 'pay_time_def_usages');
184 fnd_message.raise_error;
185 End lck;
186 --
187 -- ----------------------------------------------------------------------------
188 -- |-----------------------------< convert_args >-----------------------------|
189 -- ----------------------------------------------------------------------------
190 Function convert_args
191 (p_time_definition_id in number
192 ,p_usage_type in varchar2
193 ,p_object_version_number in number
194 )
195 Return g_rec_type is
196 --
197 l_rec g_rec_type;
198 --
199 Begin
200 --
201 -- Convert arguments into local l_rec structure.
202 --
203 l_rec.time_definition_id := p_time_definition_id;
204 l_rec.usage_type := p_usage_type;
205 l_rec.object_version_number := p_object_version_number;
206 --
207 -- Return the plsql record structure.
208 --
209 Return(l_rec);
210 --
211 End convert_args;
212 --
213 end pay_tdu_shd;